diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2002-07-04 03:29:29 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2002-07-04 03:29:29 +0800 |
commit | 164caed66b245d4244cf8c11604529d33dd1f91f (patch) | |
tree | 432dd6d575b18dc81d2693b775c355b80ea34c1b /shell | |
parent | a4eede504469ace1575b9993f20fc7736184bf2a (diff) | |
download | gsoc2013-evolution-164caed66b245d4244cf8c11604529d33dd1f91f.tar gsoc2013-evolution-164caed66b245d4244cf8c11604529d33dd1f91f.tar.gz gsoc2013-evolution-164caed66b245d4244cf8c11604529d33dd1f91f.tar.bz2 gsoc2013-evolution-164caed66b245d4244cf8c11604529d33dd1f91f.tar.lz gsoc2013-evolution-164caed66b245d4244cf8c11604529d33dd1f91f.tar.xz gsoc2013-evolution-164caed66b245d4244cf8c11604529d33dd1f91f.tar.zst gsoc2013-evolution-164caed66b245d4244cf8c11604529d33dd1f91f.zip |
Invoke e_folder_dnd_bridge_drop().
* e-storage-set-view.c (impl_tree_drag_drop): Invoke
e_folder_dnd_bridge_drop().
* e-folder-dnd-bridge.c (find_matching_target_for_drag_context):
New arg @atom_return. Return the GdkAtom associated with the type
through it.
(e_folder_dnd_bridge_drop): New.
svn path=/trunk/; revision=17362
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 12 | ||||
-rw-r--r-- | shell/e-folder-dnd-bridge.c | 59 | ||||
-rw-r--r-- | shell/e-folder-dnd-bridge.h | 5 | ||||
-rw-r--r-- | shell/e-storage-set-view.c | 21 |
4 files changed, 82 insertions, 15 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 783ab4d7ac..819c4e0281 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,15 @@ +2002-07-03 Ettore Perazzoli <ettore@ximian.com> + + [Fixes #27354.] + + * e-storage-set-view.c (impl_tree_drag_drop): Invoke + e_folder_dnd_bridge_drop(). + + * e-folder-dnd-bridge.c (find_matching_target_for_drag_context): + New arg @atom_return. Return the GdkAtom associated with the type + through it. + (e_folder_dnd_bridge_drop): New. + 2002-07-02 Ettore Perazzoli <ettore@ximian.com> * e-shell.c (e_shell_show_settings): Don't set up the settings diff --git a/shell/e-folder-dnd-bridge.c b/shell/e-folder-dnd-bridge.c index 3c15ba966c..f088c2b3a1 100644 --- a/shell/e-folder-dnd-bridge.c +++ b/shell/e-folder-dnd-bridge.c @@ -54,6 +54,8 @@ folder_xfer_callback (EStorageSet *storage_set, } +/* Utility functions. */ + static GNOME_Evolution_ShellComponentDnd_ActionSet convert_gdk_drag_action_set_to_corba (GdkDragAction action) { @@ -134,7 +136,8 @@ get_component_at_path (EStorageSet *storage_set, static const char * find_matching_target_for_drag_context (EStorageSet *storage_set, const char *path, - GdkDragContext *drag_context) + GdkDragContext *drag_context, + GdkAtom *atom_return) { EFolderTypeRegistry *folder_type_registry; EFolder *folder; @@ -150,17 +153,16 @@ find_matching_target_for_drag_context (EStorageSet *storage_set, accepted_types = e_folder_type_registry_get_accepted_dnd_types_for_type (folder_type_registry, e_folder_get_type_string (folder)); - /* FIXME? We might make this more efficient. Currently it takes `n * - m' string compares, where `n' is the number of targets in the - @drag_context, and `m' is the number of supported types in - @folder. */ - for (p = drag_context->targets; p != NULL; p = p->next) { char *possible_type; - possible_type = gdk_atom_name ((GdkAtom) p->data); + possible_type = gdk_atom_name (GPOINTER_TO_INT (p->data)); if (strcmp (possible_type, E_FOLDER_DND_PATH_TARGET_TYPE) == 0) { g_free (possible_type); + + if (atom_return != NULL) + *atom_return = GPOINTER_TO_INT (p->data); + return E_FOLDER_DND_PATH_TARGET_TYPE; } @@ -170,6 +172,10 @@ find_matching_target_for_drag_context (EStorageSet *storage_set, accepted_type = (const char *) q->data; if (strcmp (possible_type, accepted_type) == 0) { g_free (possible_type); + + if (atom_return != NULL) + *atom_return = GPOINTER_TO_INT (p->data); + return accepted_type; } } @@ -177,6 +183,9 @@ find_matching_target_for_drag_context (EStorageSet *storage_set, g_free (possible_type); } + if (atom_return != NULL) + *atom_return = 0; + return NULL; } @@ -233,6 +242,8 @@ handle_evolution_path_drag_motion (EStorageSet *storage_set, } +/* Bridge for the DnD motion event. */ + gboolean e_folder_dnd_bridge_motion (GtkWidget *widget, GdkDragContext *context, @@ -254,7 +265,7 @@ e_folder_dnd_bridge_motion (GtkWidget *widget, g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), FALSE); g_return_val_if_fail (path != NULL, FALSE); - dnd_type = find_matching_target_for_drag_context (storage_set, path, context); + dnd_type = find_matching_target_for_drag_context (storage_set, path, context, NULL); if (dnd_type == NULL) return FALSE; @@ -294,6 +305,37 @@ e_folder_dnd_bridge_motion (GtkWidget *widget, return TRUE; } + +/* Bridge for the drop event. */ + +gboolean +e_folder_dnd_bridge_drop (GtkWidget *widget, + GdkDragContext *context, + unsigned int time, + EStorageSet *storage_set, + const char *path) +{ + GdkAtom atom; + + g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); + g_return_val_if_fail (context != NULL, FALSE); + g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), FALSE); + g_return_val_if_fail (path != NULL, FALSE); + + if (context->targets == NULL) + return FALSE; + + if (find_matching_target_for_drag_context (storage_set, path, context, &atom) == NULL) + return FALSE; + + gtk_drag_get_data (widget, context, atom, time); + + return FALSE; +} + + +/* Bridge for the data_received event. */ + static gboolean handle_data_received_path (GdkDragContext *context, GtkSelectionData *selection_data, @@ -419,6 +461,7 @@ e_folder_dnd_bridge_data_received (GtkWidget *widget, target_type = gdk_atom_name (selection_data->target); if (strcmp (target_type, E_FOLDER_DND_PATH_TARGET_TYPE) != 0) { + g_print ("drop data received -- target_type %s\n", target_type); handled = handle_data_received_non_path (context, selection_data, storage_set, path, target_type); } else { diff --git a/shell/e-folder-dnd-bridge.h b/shell/e-folder-dnd-bridge.h index db1b3401b8..77cfcd5181 100644 --- a/shell/e-folder-dnd-bridge.h +++ b/shell/e-folder-dnd-bridge.h @@ -40,6 +40,11 @@ gboolean e_folder_dnd_bridge_motion (GtkWidget *widget, unsigned int time, EStorageSet *storage_set, const char *path); +gboolean e_folder_dnd_bridge_drop (GtkWidget *widget, + GdkDragContext *context, + unsigned int time, + EStorageSet *storage_set, + const char *path); void e_folder_dnd_bridge_data_received (GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection_data, diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c index 05ac236412..7bfb88e04f 100644 --- a/shell/e-storage-set-view.c +++ b/shell/e-storage-set-view.c @@ -958,15 +958,22 @@ impl_tree_drag_drop (ETree *etree, int y, unsigned int time) { + EStorageSetView *storage_set_view; + EStorageSetViewPrivate *priv; + const char *folder_path; + + storage_set_view = E_STORAGE_SET_VIEW (etree); + priv = storage_set_view->priv; + e_tree_drag_unhighlight (etree); - if (context->targets != NULL) { - gtk_drag_get_data (GTK_WIDGET (etree), context, - GPOINTER_TO_INT (context->targets->data), - time); - return TRUE; - } - return FALSE; + folder_path = e_tree_memory_node_get_data (E_TREE_MEMORY (priv->etree_model), + e_tree_node_at_row (E_TREE (storage_set_view), row)); + if (folder_path == NULL) + return FALSE; + + return e_folder_dnd_bridge_drop (GTK_WIDGET (etree), context, time, + priv->storage_set, folder_path); } static void |