aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorHans Petter Jansson <hpj@ximian.com>2004-06-23 05:12:15 +0800
committerHans Petter <hansp@src.gnome.org>2004-06-23 05:12:15 +0800
commitecb35cecb1d7690c69607d8fa738d452b3ffded0 (patch)
treef90afbe1163a594c5183e3ad478c764531a373d5 /addressbook
parentd0b89545c588ea26366a69f049f00082c51f283a (diff)
downloadgsoc2013-evolution-ecb35cecb1d7690c69607d8fa738d452b3ffded0.tar
gsoc2013-evolution-ecb35cecb1d7690c69607d8fa738d452b3ffded0.tar.gz
gsoc2013-evolution-ecb35cecb1d7690c69607d8fa738d452b3ffded0.tar.bz2
gsoc2013-evolution-ecb35cecb1d7690c69607d8fa738d452b3ffded0.tar.lz
gsoc2013-evolution-ecb35cecb1d7690c69607d8fa738d452b3ffded0.tar.xz
gsoc2013-evolution-ecb35cecb1d7690c69607d8fa738d452b3ffded0.tar.zst
gsoc2013-evolution-ecb35cecb1d7690c69607d8fa738d452b3ffded0.zip
Fixes #59622.
2004-06-22 Hans Petter Jansson <hpj@ximian.com> Fixes #59622. * gui/widgets/e-minicard-view.c (e_minicard_view_init): Clear drag_list and canvas_drag_data_delete_id. (e_minicard_view_dispose): Clear drag_list. Disconnect drag_data_delete signal if connected. (e_minicard_view_drag_begin): Set up drag_data_delete signal if necessary. Clear old data before drag starts. (clear_drag_data): Implement. (e_minicard_view_drag_data_delete): Implement. (e_minicard_view_drag_data_get): Don't clear drag_list here. svn path=/trunk/; revision=26459
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog14
-rw-r--r--addressbook/gui/widgets/e-minicard-view.c47
-rw-r--r--addressbook/gui/widgets/e-minicard-view.h1
3 files changed, 62 insertions, 0 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index aee73975f1..f0d03e8bb1 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,17 @@
+2004-06-22 Hans Petter Jansson <hpj@ximian.com>
+
+ Fixes #59622.
+
+ * gui/widgets/e-minicard-view.c (e_minicard_view_init): Clear drag_list
+ and canvas_drag_data_delete_id.
+ (e_minicard_view_dispose): Clear drag_list. Disconnect drag_data_delete
+ signal if connected.
+ (e_minicard_view_drag_begin): Set up drag_data_delete signal if
+ necessary. Clear old data before drag starts.
+ (clear_drag_data): Implement.
+ (e_minicard_view_drag_data_delete): Implement.
+ (e_minicard_view_drag_data_get): Don't clear drag_list here.
+
2004-06-22 Chris Toshok <toshok@ximian.com>
[ should fix #60495, #58635 ]
diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c
index e2622d0de2..60893d45f1 100644
--- a/addressbook/gui/widgets/e-minicard-view.c
+++ b/addressbook/gui/widgets/e-minicard-view.c
@@ -93,7 +93,37 @@ e_minicard_view_drag_data_get(GtkWidget *widget,
break;
}
}
+}
+
+static void
+e_minicard_view_drag_data_delete (GtkWidget *widget,
+ GdkDragContext *context,
+ EMinicardView *view)
+{
+ EBook *book;
+ GList *l;
+
+ if (!E_IS_MINICARD_VIEW (view))
+ return;
+
+ if (!view->drag_list) {
+ g_warning ("e_minicard_view_drag_data_delete called without contact list");
+ return;
+ }
+
+ g_object_get (view->adapter, "book", &book, NULL);
+
+ for (l = view->drag_list; l; l = g_list_next (l)) {
+ EContact *contact = l->data;
+ /* XXX no callback */
+ e_book_async_remove_contact (book, contact, NULL, NULL);
+ }
+}
+
+static void
+clear_drag_data (EMinicardView *view)
+{
g_list_foreach (view->drag_list, (GFunc)g_object_unref, NULL);
g_list_free (view->drag_list);
view->drag_list = NULL;
@@ -105,6 +135,8 @@ e_minicard_view_drag_begin (EAddressbookReflowAdapter *adapter, GdkEvent *event,
GdkDragContext *context;
GtkTargetList *target_list;
GdkDragAction actions = GDK_ACTION_MOVE | GDK_ACTION_COPY;
+
+ clear_drag_data (view);
view->drag_list = e_minicard_view_get_card_list (view);
@@ -120,6 +152,11 @@ e_minicard_view_drag_begin (EAddressbookReflowAdapter *adapter, GdkEvent *event,
"drag_data_get",
G_CALLBACK (e_minicard_view_drag_data_get),
view);
+ if (!view->canvas_drag_data_delete_id)
+ view->canvas_drag_data_delete_id = g_signal_connect (GNOME_CANVAS_ITEM (view)->canvas,
+ "drag_data_delete",
+ G_CALLBACK (e_minicard_view_drag_data_delete),
+ view);
gtk_drag_set_icon_default (context);
@@ -269,12 +306,20 @@ e_minicard_view_dispose (GObject *object)
{
EMinicardView *view = E_MINICARD_VIEW(object);
+ clear_drag_data (view);
+
if (view->canvas_drag_data_get_id) {
g_signal_handler_disconnect (GNOME_CANVAS_ITEM (view)->canvas,
view->canvas_drag_data_get_id);
view->canvas_drag_data_get_id = 0;
}
+ if (view->canvas_drag_data_delete_id) {
+ g_signal_handler_disconnect (GNOME_CANVAS_ITEM (view)->canvas,
+ view->canvas_drag_data_delete_id);
+ view->canvas_drag_data_delete_id = 0;
+ }
+
if (view->adapter) {
if (view->writable_status_id) {
EABModel *model;
@@ -497,8 +542,10 @@ e_minicard_view_class_init (EMinicardViewClass *klass)
static void
e_minicard_view_init (EMinicardView *view)
{
+ view->drag_list = NULL;
view->adapter = NULL;
view->canvas_drag_data_get_id = 0;
+ view->canvas_drag_data_delete_id = 0;
view->writable_status_id = 0;
set_empty_message (view);
diff --git a/addressbook/gui/widgets/e-minicard-view.h b/addressbook/gui/widgets/e-minicard-view.h
index 2614b7577a..679e5252c0 100644
--- a/addressbook/gui/widgets/e-minicard-view.h
+++ b/addressbook/gui/widgets/e-minicard-view.h
@@ -69,6 +69,7 @@ struct _EMinicardView
GList *drag_list;
guint canvas_drag_data_get_id;
+ guint canvas_drag_data_delete_id;
guint writable_status_id;
};