From a3f94ff6adca233914611769b684dee3eb82e32e Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Thu, 18 Apr 2002 02:19:27 +0000 Subject: New, override for EShortcutBar::shortcut_drag_motion. * e-shortcuts-view.c (impl_shortcut_drag_motion): New, override for EShortcutBar::shortcut_drag_motion. (impl_shortcut_drag_data_received): New, override for EShortcutBar::shortcut_drag_data_received. (class_init): Install the method overrides. svn path=/trunk/; revision=16502 --- shell/ChangeLog | 8 +++++ shell/e-shortcuts-view.c | 86 +++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 83 insertions(+), 11 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index 160de416f9..c066965a10 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,11 @@ +2002-04-17 Ettore Perazzoli + + * e-shortcuts-view.c (impl_shortcut_drag_motion): New, override + for EShortcutBar::shortcut_drag_motion. + (impl_shortcut_drag_data_received): New, override for + EShortcutBar::shortcut_drag_data_received. + (class_init): Install the method overrides. + 2002-04-17 Christopher James Lahey * e-activity-handler.c: Updated this to match the new EPopupMenu. diff --git a/shell/e-shortcuts-view.c b/shell/e-shortcuts-view.c index a5aee5eb12..3d7fc27656 100644 --- a/shell/e-shortcuts-view.c +++ b/shell/e-shortcuts-view.c @@ -24,6 +24,14 @@ #include #endif +#include "e-shortcuts-view.h" + +#include "e-folder-dnd-bridge.h" +#include "e-shell-constants.h" +#include "e-shortcuts-view-model.h" + +#include "e-util/e-request.h" + #include #include #include @@ -40,14 +48,6 @@ #include #include -#include "e-util/e-request.h" - -#include "e-shell-constants.h" - -#include "e-shortcuts-view-model.h" - -#include "e-shortcuts-view.h" - #define PARENT_TYPE E_TYPE_SHORTCUT_BAR static EShortcutBarClass *parent_class = NULL; @@ -556,6 +556,68 @@ impl_shortcut_dragged (EShortcutBar *shortcut_bar, e_shortcuts_remove_shortcut (priv->shortcuts, group_num, item_num); } +static gboolean +impl_shortcut_drag_motion (EShortcutBar *shortcut_bar, + GtkWidget *widget, + GdkDragContext *context, + guint time, + gint group_num, + gint item_num) +{ + EShortcutsView *view; + EShortcutsViewPrivate *priv; + const EShortcutItem *shortcut; + + view = E_SHORTCUTS_VIEW (shortcut_bar); + priv = view->priv; + + g_print ("%s -- %d %d\n", __FUNCTION__, group_num, item_num); + + shortcut = e_shortcuts_get_shortcut (priv->shortcuts, group_num, item_num); + if (shortcut == NULL) + return FALSE; + if (strncmp (shortcut->uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) != 0) + return FALSE; + + g_print ("%s -- Handling the motion! %s\n", __FUNCTION__, + shortcut->uri + E_SHELL_URI_PREFIX_LEN); + + if (! e_folder_dnd_bridge_motion (widget, context, time, + e_shortcuts_get_storage_set (priv->shortcuts), + shortcut->uri + E_SHELL_URI_PREFIX_LEN)) + gdk_drag_status (context, 0, time); + + return TRUE; +} + +static gboolean +impl_shortcut_drag_data_received (EShortcutBar *shortcut_bar, + GtkWidget *widget, + GdkDragContext *context, + GtkSelectionData *selection_data, + guint time, + gint group_num, + gint item_num) +{ + EShortcutsView *view; + EShortcutsViewPrivate *priv; + const EShortcutItem *shortcut; + + view = E_SHORTCUTS_VIEW (shortcut_bar); + priv = view->priv; + + shortcut = e_shortcuts_get_shortcut (priv->shortcuts, group_num, item_num); + if (shortcut == NULL) + return FALSE; + if (strncmp (shortcut->uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) != 0) + return FALSE; + + e_folder_dnd_bridge_data_received (widget, context, selection_data, time, + e_shortcuts_get_storage_set (priv->shortcuts), + shortcut->uri + E_SHELL_URI_PREFIX_LEN); + return TRUE; +} + static void class_init (EShortcutsViewClass *klass) @@ -567,9 +629,11 @@ class_init (EShortcutsViewClass *klass) object_class->destroy = destroy; shortcut_bar_class = E_SHORTCUT_BAR_CLASS (klass); - shortcut_bar_class->item_selected = item_selected; - shortcut_bar_class->shortcut_dropped = impl_shortcut_dropped; - shortcut_bar_class->shortcut_dragged = impl_shortcut_dragged; + shortcut_bar_class->item_selected = item_selected; + shortcut_bar_class->shortcut_dropped = impl_shortcut_dropped; + shortcut_bar_class->shortcut_dragged = impl_shortcut_dragged; + shortcut_bar_class->shortcut_drag_motion = impl_shortcut_drag_motion; + shortcut_bar_class->shortcut_drag_data_received = impl_shortcut_drag_data_received; parent_class = gtk_type_class (e_shortcut_bar_get_type ()); -- cgit v1.2.3