aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-folder-dnd-bridge.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2002-07-04 03:29:29 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2002-07-04 03:29:29 +0800
commit164caed66b245d4244cf8c11604529d33dd1f91f (patch)
tree432dd6d575b18dc81d2693b775c355b80ea34c1b /shell/e-folder-dnd-bridge.c
parenta4eede504469ace1575b9993f20fc7736184bf2a (diff)
downloadgsoc2013-evolution-164caed66b245d4244cf8c11604529d33dd1f91f.tar.gz
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/e-folder-dnd-bridge.c')
-rw-r--r--shell/e-folder-dnd-bridge.c59
1 files changed, 51 insertions, 8 deletions
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 {