~ubuntu-branches/ubuntu/precise/empathy/precise-proposed-201205180810

« back to all changes in this revision

Viewing changes to libempathy-gtk/empathy-persona-view.c

  • Committer: Bazaar Package Importer
  • Author(s): Brian Curtis, Brian Curtis, Ken VanDine
  • Date: 2011-06-01 10:35:24 UTC
  • mfrom: (1.1.70 upstream) (6.3.44 experimental)
  • Revision ID: james.westby@ubuntu.com-20110601103524-wx3wgp71394730jt
Tags: 3.1.1-1ubuntu1
[ Brian Curtis ]
* Merge with Debian experimental, remaining Ubuntu changes:
* debian/control:
  - Drop geoclue/mapping build-depends (they are in Universe)
  - Add Vcz-Bzr link
  - Add Suggests on telepathy-idle
  - Bump telepathy-butterfly, telepathy-haze to recommends
  - Don't recommend the freedesktop sound theme we have an ubuntu one
  - Add build depend for libunity-dev
* debian/rules:
  - Use autoreconf.mk
  - Disable map and location
* debian/empathy.install:
  - Install message indicator configuration
* debian/indicators/empathy:
  - Message indicator configuration
* debian/patches/01_lpi.patch:
  - Add Launchpad integration
* debian/patches/10_use_notify_osd_icons.patch:
  - Use the notify-osd image for new messages
* debian/patches/34_start_raised_execpt_in_session.patch
  - If not started with the session, we should always raise
* debian/patches/36_chat_window_default_size.patch:
  - Make the default chat window size larger
* debian/patches/37_facebook_default.patch:
  - Make facebook the default chat account type
* debian/patches/38_lp_569289.patch
  - Set freenode as default IRC network for new IRC accounts 
* debian/patches/41_unity_launcher_progress.patch
  - Display file transfer progress in the unity launcher

[ Ken VanDine ]
* debian/control
  - build depend on libgcr-3-dev instead of libgcr-dev
  - dropped build depends for libindicate, we will use telepathy-indicator
  - Depend on dconf-gsettings-backend | gsettings-backend
  - Added a Recommends for telepathy-indicator
* +debian/empathy.gsettings-override
  - Added an override for notifications-focus
* debian/patches/series
  - commented out 23_idomessagedialog_for_voip_and_ft.patch, until ido has 
    been ported to gtk3

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
#include "empathy-cell-renderer-activatable.h"
48
48
#include "empathy-gtk-enum-types.h"
49
49
#include "empathy-gtk-marshal.h"
 
50
#include "empathy-ui-utils.h"
50
51
 
51
52
#define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
52
53
#include <libempathy/empathy-debug.h>
83
84
  PROP_FEATURES,
84
85
};
85
86
 
86
 
enum DndDragType
 
87
typedef enum
87
88
{
88
 
  DND_DRAG_TYPE_INDIVIDUAL_ID,
 
89
  DND_DRAG_TYPE_UNKNOWN = -1,
 
90
  DND_DRAG_TYPE_INDIVIDUAL_ID = 0,
89
91
  DND_DRAG_TYPE_PERSONA_ID,
90
92
  DND_DRAG_TYPE_STRING,
91
 
};
 
93
} DndDragType;
92
94
 
93
95
#define DRAG_TYPE(T,I) \
94
96
  { (gchar *) T, 0, I }
106
108
#undef DRAG_TYPE
107
109
 
108
110
static GdkAtom drag_atoms_dest[G_N_ELEMENTS (drag_types_dest)];
109
 
static GdkAtom drag_atoms_source[G_N_ELEMENTS (drag_types_source)];
110
111
 
111
112
enum
112
113
{
236
237
    GtkCellRenderer *cell,
237
238
    gboolean is_active)
238
239
{
239
 
  GdkColor  color;
240
 
  GtkStyle *style;
241
 
 
242
 
  style = gtk_widget_get_style (GTK_WIDGET (self));
243
 
 
244
240
  if (is_active)
245
241
    {
246
 
      color = style->bg[GTK_STATE_SELECTED];
 
242
      GdkRGBA color;
 
243
      GtkStyleContext *style;
 
244
 
 
245
      style = gtk_widget_get_style_context (GTK_WIDGET (self));
 
246
 
 
247
      gtk_style_context_get_background_color (style, GTK_STATE_FLAG_SELECTED,
 
248
          &color);
247
249
 
248
250
      /* Here we take the current theme colour and add it to
249
251
       * the colour for white and average the two. This
250
252
       * gives a colour which is inline with the theme but
251
253
       * slightly whiter.
252
254
       */
253
 
      color.red = (color.red + (style->white).red) / 2;
254
 
      color.green = (color.green + (style->white).green) / 2;
255
 
      color.blue = (color.blue + (style->white).blue) / 2;
 
255
      empathy_make_color_whiter (&color);
256
256
 
257
 
      g_object_set (cell, "cell-background-gdk", &color, NULL);
 
257
      g_object_set (cell, "cell-background-rgba", &color, NULL);
258
258
    }
259
259
  else
260
260
    {
261
 
      g_object_set (cell, "cell-background-gdk", NULL, NULL);
 
261
      g_object_set (cell, "cell-background-rgba", NULL, NULL);
262
262
    }
263
263
}
264
264
 
354
354
    GdkDragContext *context,
355
355
    GtkSelectionData *selection)
356
356
{
357
 
  EmpathyPersonaViewPriv *priv;
358
357
  EmpathyIndividualManager *manager = NULL;
359
358
  FolksIndividual *individual;
360
359
  const gchar *individual_id;
361
360
  gboolean success = FALSE;
362
361
 
363
 
  priv = GET_PRIV (self);
364
 
 
365
362
  individual_id = (const gchar *) gtk_selection_data_get_data (selection);
366
363
  manager = empathy_individual_manager_dup_singleton ();
367
364
  individual = empathy_individual_manager_lookup_member (manager,
410
407
    guint time_)
411
408
{
412
409
  EmpathyPersonaView *self = EMPATHY_PERSONA_VIEW (widget);
413
 
  EmpathyPersonaViewPriv *priv;
414
410
  GdkAtom target;
415
 
 
416
 
  priv = GET_PRIV (self);
 
411
  guint i;
 
412
  DndDragType drag_type = DND_DRAG_TYPE_UNKNOWN;
417
413
 
418
414
  target = gtk_drag_dest_find_target (GTK_WIDGET (self), context, NULL);
419
415
 
420
 
  if (target == drag_atoms_dest[DND_DRAG_TYPE_INDIVIDUAL_ID])
 
416
  /* Determine the DndDragType of the data */
 
417
  for (i = 0; i < G_N_ELEMENTS (drag_atoms_dest); i++)
 
418
    {
 
419
      if (target == drag_atoms_dest[i])
 
420
        {
 
421
          drag_type = drag_types_dest[i].info;
 
422
          break;
 
423
        }
 
424
    }
 
425
 
 
426
  if (drag_type == DND_DRAG_TYPE_INDIVIDUAL_ID)
421
427
    {
422
428
      GtkTreePath *path;
423
429
 
452
458
    guint time_)
453
459
{
454
460
  EmpathyPersonaView *self = EMPATHY_PERSONA_VIEW (widget);
455
 
  EmpathyPersonaViewPriv *priv;
456
461
  FolksPersona *persona;
457
462
  const gchar *persona_uid;
458
463
 
459
464
  if (info != DND_DRAG_TYPE_PERSONA_ID)
460
465
    return;
461
466
 
462
 
  priv = GET_PRIV (self);
463
 
 
464
467
  persona = empathy_persona_view_dup_selected (self);
465
468
  if (persona == NULL)
466
469
    return;
467
470
 
468
471
  persona_uid = folks_persona_get_uid (persona);
469
 
  gtk_selection_data_set (selection, drag_atoms_source[info], 8,
 
472
  gtk_selection_data_set (selection,
 
473
      gdk_atom_intern ("text/persona-id", FALSE), 8,
470
474
      (guchar *) persona_uid, strlen (persona_uid) + 1);
471
475
 
472
476
  g_object_unref (persona);
614
618
  /* Drag & Drop. */
615
619
  for (i = 0; i < G_N_ELEMENTS (drag_types_dest); ++i)
616
620
    drag_atoms_dest[i] = gdk_atom_intern (drag_types_dest[i].target, FALSE);
617
 
 
618
 
  for (i = 0; i < G_N_ELEMENTS (drag_types_source); ++i)
619
 
    drag_atoms_source[i] = gdk_atom_intern (drag_types_source[i].target, FALSE);
620
621
}
621
622
 
622
623
static void
779
780
FolksPersona *
780
781
empathy_persona_view_dup_selected (EmpathyPersonaView *self)
781
782
{
782
 
  EmpathyPersonaViewPriv *priv;
783
783
  GtkTreeSelection *selection;
784
784
  GtkTreeIter iter;
785
785
  GtkTreeModel *model;
787
787
 
788
788
  g_return_val_if_fail (EMPATHY_IS_PERSONA_VIEW (self), NULL);
789
789
 
790
 
  priv = GET_PRIV (self);
791
 
 
792
790
  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self));
793
791
  if (!gtk_tree_selection_get_selected (selection, &model, &iter))
794
792
    return NULL;