diff options
-rw-r--r-- | libempathy-gtk/empathy-contact-list-view.c | 18 | ||||
-rw-r--r-- | libempathy-gtk/empathy-individual-store.c | 7 | ||||
-rw-r--r-- | libempathy-gtk/empathy-individual-view.c | 37 | ||||
-rw-r--r-- | libempathy-gtk/empathy-persona-view.c | 28 | ||||
-rw-r--r-- | src/empathy-chat-window.c | 3 | ||||
-rw-r--r-- | src/empathy-main-window.c | 3 | ||||
-rw-r--r-- | src/empathy-status-icon.c | 3 |
7 files changed, 56 insertions, 43 deletions
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c index 79eb5a316..bda1ed8d5 100644 --- a/libempathy-gtk/empathy-contact-list-view.c +++ b/libempathy-gtk/empathy-contact-list-view.c @@ -112,9 +112,6 @@ static const GtkTargetEntry drag_types_source[] = { { "text/contact-id", 0, DND_DRAG_TYPE_CONTACT_ID }, }; -static GdkAtom drag_atoms_dest[G_N_ELEMENTS (drag_types_dest)]; -static GdkAtom drag_atoms_source[G_N_ELEMENTS (drag_types_source)]; - enum { DRAG_CONTACT_RECEIVED, LAST_SIGNAL @@ -763,7 +760,8 @@ contact_list_view_drag_data_get (GtkWidget *widget, str = g_strconcat (account_id, ":", contact_id, NULL); if (info == DND_DRAG_TYPE_CONTACT_ID) { - gtk_selection_data_set (selection, drag_atoms_source[info], 8, + gtk_selection_data_set (selection, + gdk_atom_intern ("text/contact-id", FALSE), 8, (guchar *) str, strlen (str) + 1); } @@ -1497,7 +1495,6 @@ contact_list_view_constructed (GObject *object) EmpathyContactListViewPriv *priv = GET_PRIV (view); GtkCellRenderer *cell; GtkTreeViewColumn *col; - guint i; priv->filter = GTK_TREE_MODEL_FILTER (gtk_tree_model_filter_new ( GTK_TREE_MODEL (priv->store), NULL)); @@ -1629,17 +1626,6 @@ contact_list_view_constructed (GObject *object) /* Actually add the column now we have added all cell renderers */ gtk_tree_view_append_column (GTK_TREE_VIEW (view), col); - - /* Drag & Drop. */ - for (i = 0; i < G_N_ELEMENTS (drag_types_dest); ++i) { - drag_atoms_dest[i] = gdk_atom_intern (drag_types_dest[i].target, - FALSE); - } - - for (i = 0; i < G_N_ELEMENTS (drag_types_source); ++i) { - drag_atoms_source[i] = gdk_atom_intern (drag_types_source[i].target, - FALSE); - } } static void diff --git a/libempathy-gtk/empathy-individual-store.c b/libempathy-gtk/empathy-individual-store.c index 242bad2be..1b4b4fd8a 100644 --- a/libempathy-gtk/empathy-individual-store.c +++ b/libempathy-gtk/empathy-individual-store.c @@ -1902,7 +1902,7 @@ individual_store_get_individual_status_icon_with_icon_name ( FolksIndividual *individual, const gchar *status_icon_name) { - GdkPixbuf *pixbuf_status = NULL; + GdkPixbuf *pixbuf_status; EmpathyIndividualStorePriv *priv; const gchar *protocol_name = NULL; gchar *icon_name = NULL; @@ -1934,13 +1934,18 @@ individual_store_get_individual_status_icon_with_icon_name ( { icon_name = g_strdup_printf ("%s", status_icon_name); } + + pixbuf_status = g_hash_table_lookup (priv->status_icons, icon_name); + if (pixbuf_status == NULL) { pixbuf_status = empathy_pixbuf_contact_status_icon_with_icon_name (contact, status_icon_name, show_protocols_here); + if (pixbuf_status != NULL) { + /* pass the reference to the hash table */ g_hash_table_insert (priv->status_icons, g_strdup (icon_name), pixbuf_status); } diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c index 12486195c..1e0602353 100644 --- a/libempathy-gtk/empathy-individual-view.c +++ b/libempathy-gtk/empathy-individual-view.c @@ -110,13 +110,14 @@ enum /* TODO: re-add DRAG_TYPE_CONTACT_ID, for the case that we're dragging around * specific EmpathyContacts (between/in/out of Individuals) */ -enum DndDragType +typedef enum { - DND_DRAG_TYPE_INDIVIDUAL_ID, + DND_DRAG_TYPE_UNKNOWN = -1, + DND_DRAG_TYPE_INDIVIDUAL_ID = 0, DND_DRAG_TYPE_PERSONA_ID, DND_DRAG_TYPE_URI_LIST, DND_DRAG_TYPE_STRING, -}; +} DndDragType; #define DRAG_TYPE(T,I) \ { (gchar *) T, 0, I } @@ -137,7 +138,6 @@ static const GtkTargetEntry drag_types_source[] = { #undef DRAG_TYPE static GdkAtom drag_atoms_dest[G_N_ELEMENTS (drag_types_dest)]; -static GdkAtom drag_atoms_source[G_N_ELEMENTS (drag_types_source)]; enum { @@ -565,6 +565,8 @@ individual_view_drag_motion (GtkWidget *widget, gboolean is_different = FALSE; gboolean cleanup = TRUE; gboolean retval = TRUE; + guint i; + DndDragType drag_type = DND_DRAG_TYPE_UNKNOWN; priv = GET_PRIV (EMPATHY_INDIVIDUAL_VIEW (widget)); model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); @@ -595,8 +597,18 @@ individual_view_drag_motion (GtkWidget *widget, target = gtk_drag_dest_find_target (widget, context, NULL); gtk_tree_model_get_iter (model, &iter, path); - if (target == drag_atoms_dest[DND_DRAG_TYPE_URI_LIST] || - target == drag_atoms_dest[DND_DRAG_TYPE_STRING]) + /* Determine the DndDragType of the data */ + for (i = 0; i < G_N_ELEMENTS (drag_atoms_dest); i++) + { + if (target == drag_atoms_dest[i]) + { + drag_type = drag_types_dest[i].info; + break; + } + } + + if (drag_type == DND_DRAG_TYPE_URI_LIST || + drag_type == DND_DRAG_TYPE_STRING) { /* This is a file drag, and it can only be dropped on contacts, * not groups. @@ -641,10 +653,10 @@ individual_view_drag_motion (GtkWidget *widget, if (individual != NULL) g_object_unref (individual); } - else if ((target == drag_atoms_dest[DND_DRAG_TYPE_INDIVIDUAL_ID] && + else if ((drag_type == DND_DRAG_TYPE_INDIVIDUAL_ID && (priv->view_features & EMPATHY_INDIVIDUAL_VIEW_FEATURE_GROUPS_CHANGE || priv->drag_row == NULL)) || - (target == drag_atoms_dest[DND_DRAG_TYPE_PERSONA_ID] && + (drag_type == DND_DRAG_TYPE_PERSONA_ID && priv->view_features & EMPATHY_INDIVIDUAL_VIEW_FEATURE_PERSONA_DROP)) { /* If target != GDK_NONE, then we have a contact (individual or persona) @@ -789,7 +801,8 @@ individual_view_drag_data_get (GtkWidget *widget, if (info == DND_DRAG_TYPE_INDIVIDUAL_ID) { - gtk_selection_data_set (selection, drag_atoms_source[info], 8, + gtk_selection_data_set (selection, + gdk_atom_intern ("text/individual-id", FALSE), 8, (guchar *) individual_id, strlen (individual_id) + 1); } @@ -1856,12 +1869,6 @@ individual_view_constructed (GObject *object) { drag_atoms_dest[i] = gdk_atom_intern (drag_types_dest[i].target, FALSE); } - - for (i = 0; i < G_N_ELEMENTS (drag_types_source); ++i) - { - drag_atoms_source[i] = gdk_atom_intern (drag_types_source[i].target, - FALSE); - } } static void diff --git a/libempathy-gtk/empathy-persona-view.c b/libempathy-gtk/empathy-persona-view.c index adfe6be5c..ff2c6ec82 100644 --- a/libempathy-gtk/empathy-persona-view.c +++ b/libempathy-gtk/empathy-persona-view.c @@ -83,12 +83,13 @@ enum PROP_FEATURES, }; -enum DndDragType +typedef enum { - DND_DRAG_TYPE_INDIVIDUAL_ID, + DND_DRAG_TYPE_UNKNOWN = -1, + DND_DRAG_TYPE_INDIVIDUAL_ID = 0, DND_DRAG_TYPE_PERSONA_ID, DND_DRAG_TYPE_STRING, -}; +} DndDragType; #define DRAG_TYPE(T,I) \ { (gchar *) T, 0, I } @@ -106,7 +107,6 @@ static const GtkTargetEntry drag_types_source[] = { #undef DRAG_TYPE static GdkAtom drag_atoms_dest[G_N_ELEMENTS (drag_types_dest)]; -static GdkAtom drag_atoms_source[G_N_ELEMENTS (drag_types_source)]; enum { @@ -412,12 +412,24 @@ drag_motion (GtkWidget *widget, EmpathyPersonaView *self = EMPATHY_PERSONA_VIEW (widget); EmpathyPersonaViewPriv *priv; GdkAtom target; + guint i; + DndDragType drag_type = DND_DRAG_TYPE_UNKNOWN; priv = GET_PRIV (self); target = gtk_drag_dest_find_target (GTK_WIDGET (self), context, NULL); - if (target == drag_atoms_dest[DND_DRAG_TYPE_INDIVIDUAL_ID]) + /* Determine the DndDragType of the data */ + for (i = 0; i < G_N_ELEMENTS (drag_atoms_dest); i++) + { + if (target == drag_atoms_dest[i]) + { + drag_type = drag_types_dest[i].info; + break; + } + } + + if (drag_type == DND_DRAG_TYPE_INDIVIDUAL_ID) { GtkTreePath *path; @@ -466,7 +478,8 @@ drag_data_get (GtkWidget *widget, return; persona_uid = folks_persona_get_uid (persona); - gtk_selection_data_set (selection, drag_atoms_source[info], 8, + gtk_selection_data_set (selection, + gdk_atom_intern ("text/persona-id", FALSE), 8, (guchar *) persona_uid, strlen (persona_uid) + 1); g_object_unref (persona); @@ -614,9 +627,6 @@ constructed (GObject *object) /* Drag & Drop. */ for (i = 0; i < G_N_ELEMENTS (drag_types_dest); ++i) drag_atoms_dest[i] = gdk_atom_intern (drag_types_dest[i].target, FALSE); - - for (i = 0; i < G_N_ELEMENTS (drag_types_source); ++i) - drag_atoms_source[i] = gdk_atom_intern (drag_types_source[i].target, FALSE); } static void diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index 4bbf1a789..d498d8fec 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -1389,8 +1389,9 @@ chat_window_show_or_update_notification (EmpathyChatWindow *window, G_CALLBACK (chat_window_notification_closed_cb), window, 0); if (has_x_canonical_append) { + /* We have to set a not empty string to keep libnotify happy */ notify_notification_set_hint_string (notification, - EMPATHY_NOTIFY_MANAGER_CAP_X_CANONICAL_APPEND, ""); + EMPATHY_NOTIFY_MANAGER_CAP_X_CANONICAL_APPEND, "1"); } } diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index 2fcc31e02..73ae51bd6 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -223,6 +223,8 @@ main_window_flash_foreach (GtkTreeModel *model, pixbuf = empathy_individual_store_get_individual_status_icon ( GET_PRIV (data->window)->individual_store, individual); + if (pixbuf != NULL) + g_object_ref (pixbuf); } gtk_tree_store_set (GTK_TREE_STORE (model), iter, @@ -243,6 +245,7 @@ main_window_flash_foreach (GtkTreeModel *model, g_object_unref (individual); tp_clear_object (&contact); + tp_clear_object (&pixbuf); return FALSE; } diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c index a4ca21300..325fa7f0f 100644 --- a/src/empathy-status-icon.c +++ b/src/empathy-status-icon.c @@ -251,8 +251,9 @@ status_icon_update_notification (EmpathyStatusIcon *icon) NOTIFY_EXPIRES_DEFAULT); if (has_x_canonical_append) { + /* We have to set a not empty string to keep libnotify happy */ notify_notification_set_hint_string (notification, - EMPATHY_NOTIFY_MANAGER_CAP_X_CANONICAL_APPEND, ""); + EMPATHY_NOTIFY_MANAGER_CAP_X_CANONICAL_APPEND, "1"); } if (empathy_notify_manager_has_capability (priv->notify_mgr, |