aboutsummaryrefslogtreecommitdiffstats
path: root/shell/evolution-shell-component.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-03-08 20:55:05 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-03-08 20:55:05 +0800
commit9618cd2cb63840bd9138519bc52a3afad07590fa (patch)
tree259fda93de990254e0c3a108be88e584b2646b7f /shell/evolution-shell-component.c
parent698fc6235d8b59e89369c5220ad6b15cc0c74b81 (diff)
downloadgsoc2013-evolution-9618cd2cb63840bd9138519bc52a3afad07590fa.tar.gz
gsoc2013-evolution-9618cd2cb63840bd9138519bc52a3afad07590fa.tar.zst
gsoc2013-evolution-9618cd2cb63840bd9138519bc52a3afad07590fa.zip
Added a ShellComponent method to retrieve the selection for drag and
drop and support for it in the shell. Untested. svn path=/trunk/; revision=8594
Diffstat (limited to 'shell/evolution-shell-component.c')
-rw-r--r--shell/evolution-shell-component.c67
1 files changed, 60 insertions, 7 deletions
diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c
index 0e28981ef6..f076daf431 100644
--- a/shell/evolution-shell-component.c
+++ b/shell/evolution-shell-component.c
@@ -41,11 +41,12 @@ static GtkObjectClass *parent_class = NULL;
struct _EvolutionShellComponentPrivate {
GList *folder_types; /* EvolutionShellComponentFolderType */
- EvolutionShellComponentCreateViewFn create_view_fn;
- EvolutionShellComponentCreateFolderFn create_folder_fn;
- EvolutionShellComponentRemoveFolderFn remove_folder_fn;
- EvolutionShellComponentCopyFolderFn copy_folder_fn;
- EvolutionShellComponentPopulateFolderContextMenu populate_folder_context_menu_fn;
+ EvolutionShellComponentCreateViewFn create_view_fn;
+ EvolutionShellComponentCreateFolderFn create_folder_fn;
+ EvolutionShellComponentRemoveFolderFn remove_folder_fn;
+ EvolutionShellComponentCopyFolderFn copy_folder_fn;
+ EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn;
+ EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn;
EvolutionShellClient *owner_client;
@@ -366,6 +367,53 @@ impl_ShellComponent_populate_folder_context_menu (PortableServer_Servant servant
bonobo_object_unref (BONOBO_OBJECT (uic));
}
+static void
+impl_ShellComponent_getDndSelection (PortableServer_Servant servant,
+ const CORBA_char *physical_uri,
+ const CORBA_short type,
+ CORBA_short *format_return,
+ GNOME_Evolution_ShellComponent_Selection **selection_return,
+ CORBA_Environment *ev)
+{
+ BonoboObject *bonobo_object;
+ EvolutionShellComponent *shell_component;
+ EvolutionShellComponentPrivate *priv;
+ const char *selection;
+ int selection_length;
+ int format;
+
+ bonobo_object = bonobo_object_from_servant (servant);
+ shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object);
+ priv = shell_component->priv;
+
+ if (priv->get_dnd_selection_fn == NULL) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_GNOME_Evolution_ShellComponent_NoSelection, NULL);
+ return;
+ }
+
+ (* priv->get_dnd_selection_fn) (shell_component, physical_uri, type,
+ &format, &selection, &selection_length,
+ priv->closure);
+
+ if (selection == NULL) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_GNOME_Evolution_ShellComponent_NoSelection, NULL);
+ } else {
+ *format_return = format;
+
+ *selection_return = GNOME_Evolution_ShellComponent_Selection__alloc ();
+
+ (* selection_return)->_buffer = CORBA_octet_allocbuf (selection_length);
+ memcpy ((* selection_return)->_buffer, selection, selection_length);
+
+ (* selection_return)->_length = selection_length;
+ (* selection_return)->_maximum = selection_length;
+
+ CORBA_sequence_set_release (*selection_return, TRUE);
+ }
+}
+
/* GtkObject methods. */
@@ -447,6 +495,7 @@ class_init (EvolutionShellComponentClass *klass)
epv->createFolderAsync = impl_ShellComponent_async_create_folder;
epv->removeFolderAsync = impl_ShellComponent_async_remove_folder;
epv->populateFolderContextMenu = impl_ShellComponent_populate_folder_context_menu;
+ epv->getDndSelection = impl_ShellComponent_getDndSelection;
}
static void
@@ -477,7 +526,8 @@ evolution_shell_component_construct (EvolutionShellComponent *shell_component,
EvolutionShellComponentCreateFolderFn create_folder_fn,
EvolutionShellComponentRemoveFolderFn remove_folder_fn,
EvolutionShellComponentCopyFolderFn copy_folder_fn,
- EvolutionShellComponentPopulateFolderContextMenu populate_folder_context_menu_fn,
+ EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn,
+ EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn,
void *closure)
{
EvolutionShellComponentPrivate *priv;
@@ -492,6 +542,7 @@ evolution_shell_component_construct (EvolutionShellComponent *shell_component,
priv->remove_folder_fn = remove_folder_fn;
priv->copy_folder_fn = copy_folder_fn;
priv->populate_folder_context_menu_fn = populate_folder_context_menu_fn;
+ priv->get_dnd_selection_fn = get_dnd_selection_fn;
priv->closure = closure;
@@ -522,7 +573,8 @@ evolution_shell_component_new (const EvolutionShellComponentFolderType folder_ty
EvolutionShellComponentCreateFolderFn create_folder_fn,
EvolutionShellComponentRemoveFolderFn remove_folder_fn,
EvolutionShellComponentCopyFolderFn copy_folder_fn,
- EvolutionShellComponentPopulateFolderContextMenu populate_folder_context_menu_fn,
+ EvolutionShellComponentPopulateFolderContextMenuFn populate_folder_context_menu_fn,
+ EvolutionShellComponentGetDndSelectionFn get_dnd_selection_fn,
void *closure)
{
EvolutionShellComponent *new;
@@ -536,6 +588,7 @@ evolution_shell_component_new (const EvolutionShellComponentFolderType folder_ty
remove_folder_fn,
copy_folder_fn,
populate_folder_context_menu_fn,
+ get_dnd_selection_fn,
closure);
return new;