diff options
-rw-r--r-- | shell/ChangeLog | 8 | ||||
-rw-r--r-- | 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 <ettore@ximian.com> + + * 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 <clahey@ximian.com> * 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 <config.h> #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 <glib.h> #include <gtk/gtkcheckmenuitem.h> #include <gtk/gtkentry.h> @@ -40,14 +48,6 @@ #include <gal/util/e-util.h> #include <gal/widgets/e-unicode.h> -#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 ()); |