diff options
author | Shaun McCance <Shaun McCance> | 2009-10-06 04:09:46 +0800 |
---|---|---|
committer | Shaun McCance <shaunm@gnome.org> | 2009-11-25 05:15:30 +0800 |
commit | adade63c475294db24a422c3a0e5f6b3879641b6 (patch) | |
tree | f9e5d5c272c540bc82031a2196bc962cc38f6f50 /libempathy-gtk | |
parent | bbe8c4eadaf0aadd45b3f70cb55dfad44bd4ba49 (diff) | |
download | gsoc2013-empathy-adade63c475294db24a422c3a0e5f6b3879641b6.tar gsoc2013-empathy-adade63c475294db24a422c3a0e5f6b3879641b6.tar.gz gsoc2013-empathy-adade63c475294db24a422c3a0e5f6b3879641b6.tar.bz2 gsoc2013-empathy-adade63c475294db24a422c3a0e5f6b3879641b6.tar.lz gsoc2013-empathy-adade63c475294db24a422c3a0e5f6b3879641b6.tar.xz gsoc2013-empathy-adade63c475294db24a422c3a0e5f6b3879641b6.tar.zst gsoc2013-empathy-adade63c475294db24a422c3a0e5f6b3879641b6.zip |
Move GtkTargetLists into priv so they're no longer static
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-contact-list-view.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c index 0dc5cba14..0a9b260f8 100644 --- a/libempathy-gtk/empathy-contact-list-view.c +++ b/libempathy-gtk/empathy-contact-list-view.c @@ -65,6 +65,7 @@ typedef struct { EmpathyContactListFeatureFlags list_features; EmpathyContactFeatureFlags contact_features; GtkWidget *tooltip_widget; + GtkTargetList *file_targets; } EmpathyContactListViewPriv; typedef struct { @@ -417,7 +418,6 @@ contact_list_view_drag_motion (GtkWidget *widget, { EmpathyContactListViewPriv *priv; GtkTreeModel *model; - static GtkTargetList *file_targets = NULL; GdkAtom target; GtkTreeIter iter; static DragMotionData *dm = NULL; @@ -430,11 +430,6 @@ contact_list_view_drag_motion (GtkWidget *widget, priv = GET_PRIV (EMPATHY_CONTACT_LIST_VIEW (widget)); model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); - if (file_targets == NULL) { - file_targets = gtk_target_list_new (drag_types_dest_file, - G_N_ELEMENTS (drag_types_dest_file)); - } - is_row = gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), x, y, @@ -460,7 +455,7 @@ contact_list_view_drag_motion (GtkWidget *widget, gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget), NULL, 0); return FALSE; } - target = gtk_drag_dest_find_target (widget, context, file_targets); + target = gtk_drag_dest_find_target (widget, context, priv->file_targets); gtk_tree_model_get_iter (model, &iter, path); if (target == GDK_NONE) { @@ -1266,6 +1261,9 @@ contact_list_view_finalize (GObject *object) if (priv->tooltip_widget) { gtk_widget_destroy (priv->tooltip_widget); } + if (priv->file_targets) { + gtk_target_list_unref (priv->file_targets); + } G_OBJECT_CLASS (empathy_contact_list_view_parent_class)->finalize (object); } @@ -1396,6 +1394,10 @@ empathy_contact_list_view_init (EmpathyContactListView *view) empathy_contact_list_store_row_separator_func, NULL, NULL); + /* Set up drag target lists. */ + priv->file_targets = gtk_target_list_new (drag_types_dest_file, + G_N_ELEMENTS (drag_types_dest_file)); + /* Connect to tree view signals rather than override. */ g_signal_connect (view, "button-press-event", G_CALLBACK (contact_list_view_button_press_event_cb), |