diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-02-09 03:52:18 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-02-09 07:57:24 +0800 |
commit | 67ce5f3b140525c2f5944270a9383616f9d67923 (patch) | |
tree | 167788f4efa12f87ac04c474598d61b5ca446464 /e-util | |
parent | 9cd1f937a26363aa108f3d2b36606b167597a2eb (diff) | |
download | gsoc2013-evolution-67ce5f3b140525c2f5944270a9383616f9d67923.tar gsoc2013-evolution-67ce5f3b140525c2f5944270a9383616f9d67923.tar.gz gsoc2013-evolution-67ce5f3b140525c2f5944270a9383616f9d67923.tar.bz2 gsoc2013-evolution-67ce5f3b140525c2f5944270a9383616f9d67923.tar.lz gsoc2013-evolution-67ce5f3b140525c2f5944270a9383616f9d67923.tar.xz gsoc2013-evolution-67ce5f3b140525c2f5944270a9383616f9d67923.tar.zst gsoc2013-evolution-67ce5f3b140525c2f5944270a9383616f9d67923.zip |
Add DnD support to e-selection.c.
Avoid listing calendar and directory targets explicitly, so that
e-selection.c contains the one and only master list. Still need
to figure out how to centralize "text/x-source-vcard".
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/e-selection.c | 102 | ||||
-rw-r--r-- | e-util/e-selection.h | 15 |
2 files changed, 117 insertions, 0 deletions
diff --git a/e-util/e-selection.c b/e-util/e-selection.c index 21c63023f0..8be4c0b55a 100644 --- a/e-util/e-selection.c +++ b/e-util/e-selection.c @@ -797,3 +797,105 @@ e_clipboard_wait_is_html_available (GtkClipboard *clipboard) return result; } + +void +e_drag_dest_add_calendar_targets (GtkWidget *widget) +{ + GtkTargetList *target_list; + + g_return_if_fail (GTK_IS_WIDGET (widget)); + + target_list = gtk_drag_source_get_target_list (widget); + if (target_list != NULL) + gtk_target_list_ref (target_list); + else + target_list = gtk_target_list_new (NULL, 0); + e_target_list_add_calendar_targets (target_list, 0); + gtk_drag_dest_set_target_list (widget, target_list); + gtk_target_list_unref (target_list); +} + +void +e_drag_dest_add_directory_targets (GtkWidget *widget) +{ + GtkTargetList *target_list; + + g_return_if_fail (GTK_IS_WIDGET (widget)); + + target_list = gtk_drag_source_get_target_list (widget); + if (target_list != NULL) + gtk_target_list_ref (target_list); + else + target_list = gtk_target_list_new (NULL, 0); + e_target_list_add_directory_targets (target_list, 0); + gtk_drag_dest_set_target_list (widget, target_list); + gtk_target_list_unref (target_list); +} + +void +e_drag_dest_add_html_targets (GtkWidget *widget) +{ + GtkTargetList *target_list; + + g_return_if_fail (GTK_IS_WIDGET (widget)); + + target_list = gtk_drag_source_get_target_list (widget); + if (target_list != NULL) + gtk_target_list_ref (target_list); + else + target_list = gtk_target_list_new (NULL, 0); + e_target_list_add_html_targets (target_list, 0); + gtk_drag_dest_set_target_list (widget, target_list); + gtk_target_list_unref (target_list); +} + +void +e_drag_source_add_calendar_targets (GtkWidget *widget) +{ + GtkTargetList *target_list; + + g_return_if_fail (GTK_IS_WIDGET (widget)); + + target_list = gtk_drag_source_get_target_list (widget); + if (target_list != NULL) + gtk_target_list_ref (target_list); + else + target_list = gtk_target_list_new (NULL, 0); + e_target_list_add_calendar_targets (target_list, 0); + gtk_drag_source_set_target_list (widget, target_list); + gtk_target_list_unref (target_list); +} + +void +e_drag_source_add_directory_targets (GtkWidget *widget) +{ + GtkTargetList *target_list; + + g_return_if_fail (GTK_IS_WIDGET (widget)); + + target_list = gtk_drag_source_get_target_list (widget); + if (target_list != NULL) + gtk_target_list_ref (target_list); + else + target_list = gtk_target_list_new (NULL, 0); + e_target_list_add_directory_targets (target_list, 0); + gtk_drag_source_set_target_list (widget, target_list); + gtk_target_list_unref (target_list); +} + +void +e_drag_source_add_html_targets (GtkWidget *widget) +{ + GtkTargetList *target_list; + + g_return_if_fail (GTK_IS_WIDGET (widget)); + + target_list = gtk_drag_source_get_target_list (widget); + if (target_list != NULL) + gtk_target_list_ref (target_list); + else + target_list = gtk_target_list_new (NULL, 0); + e_target_list_add_html_targets (target_list, 0); + gtk_drag_source_set_target_list (widget, target_list); + gtk_target_list_unref (target_list); +} diff --git a/e-util/e-selection.h b/e-util/e-selection.h index 2c59d3d641..f179180cd9 100644 --- a/e-util/e-selection.h +++ b/e-util/e-selection.h @@ -114,6 +114,21 @@ gboolean e_clipboard_wait_is_directory_available gboolean e_clipboard_wait_is_html_available (GtkClipboard *clipboard); +/* Drag and Drop Functions */ + +void e_drag_dest_add_calendar_targets + (GtkWidget *widget); +void e_drag_dest_add_directory_targets + (GtkWidget *widget); +void e_drag_dest_add_html_targets + (GtkWidget *widget); +void e_drag_source_add_calendar_targets + (GtkWidget *widget); +void e_drag_source_add_directory_targets + (GtkWidget *widget); +void e_drag_source_add_html_targets + (GtkWidget *widget); + G_END_DECLS #endif /* E_SELECTION_H */ |