aboutsummaryrefslogtreecommitdiffstats
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
parent698fc6235d8b59e89369c5220ad6b15cc0c74b81 (diff)
downloadgsoc2013-evolution-9618cd2cb63840bd9138519bc52a3afad07590fa.tar
gsoc2013-evolution-9618cd2cb63840bd9138519bc52a3afad07590fa.tar.gz
gsoc2013-evolution-9618cd2cb63840bd9138519bc52a3afad07590fa.tar.bz2
gsoc2013-evolution-9618cd2cb63840bd9138519bc52a3afad07590fa.tar.lz
gsoc2013-evolution-9618cd2cb63840bd9138519bc52a3afad07590fa.tar.xz
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
-rw-r--r--addressbook/ChangeLog5
-rw-r--r--addressbook/gui/component/addressbook-component.c3
-rw-r--r--calendar/ChangeLog5
-rw-r--r--calendar/gui/alarm-notify/Makefile.am18
-rw-r--r--calendar/gui/calendar-component.c1
-rw-r--r--calendar/gui/component-factory.c1
-rw-r--r--executive-summary/ChangeLog5
-rw-r--r--executive-summary/component/component-factory.c2
-rw-r--r--mail/ChangeLog5
-rw-r--r--mail/component-factory.c3
-rw-r--r--shell/ChangeLog39
-rw-r--r--shell/Evolution-ShellComponent.idl10
-rw-r--r--shell/e-storage-set-view.c120
-rw-r--r--shell/evolution-shell-component-client.c50
-rw-r--r--shell/evolution-shell-component-client.h8
-rw-r--r--shell/evolution-shell-component.c67
-rw-r--r--shell/evolution-shell-component.h43
17 files changed, 312 insertions, 73 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index d188041709..e5c41ac07a 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,8 @@
+2001-03-08 Ettore Perazzoli <ettore@ximian.com>
+
+ * gui/component/addressbook-component.c (factory_fn): Specify a
+ NULL `EvolutionShellComponentGetDndSelectionFn'.
+
2001-03-06 Jon Trowbridge <trow@ximian.com>
* gui/component/select-names/e-select-names-text-model.c
diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c
index 129a2f2d97..a12dca8086 100644
--- a/addressbook/gui/component/addressbook-component.c
+++ b/addressbook/gui/component/addressbook-component.c
@@ -131,7 +131,8 @@ factory_fn (BonoboGenericFactory *factory,
{
EvolutionShellComponent *shell_component;
- shell_component = evolution_shell_component_new (folder_types, create_view, create_folder, NULL, NULL, NULL, NULL);
+ shell_component = evolution_shell_component_new (folder_types, create_view, create_folder,
+ NULL, NULL, NULL, NULL, NULL);
gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set",
GTK_SIGNAL_FUNC (owner_set_cb), NULL);
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index a96ffd39eb..3e720f8077 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,8 @@
+2001-03-08 Ettore Perazzoli <ettore@ximian.com>
+
+ * gui/component-factory.c (factory_fn): Specify a NULL
+ `EvolutionShellComponentGetDndSelectionFn'.
+
2001-02-27 Miguel de Icaza <miguel@ximian.com>
* gui/e-day-view.c (e_day_view_on_event_right_click): Reorganize
diff --git a/calendar/gui/alarm-notify/Makefile.am b/calendar/gui/alarm-notify/Makefile.am
index b542566d17..f62cb3c365 100644
--- a/calendar/gui/alarm-notify/Makefile.am
+++ b/calendar/gui/alarm-notify/Makefile.am
@@ -11,7 +11,7 @@ idl_flags = `$(GNOME_CONFIG) --cflags idl` -I $(datadir)/idl
$(CORBA_GENERATED): $(idls)
$(ORBIT_IDL) $(idl_flags) $(top_srcdir)/calendar/idl/evolution-calendar.idl
-bin_PROGRAMS = evolution-alarm-notify evolution-alarm-client
+bin_PROGRAMS = evolution-alarm-notify # evolution-alarm-client
noinst_LIBRARIES = libalarm.a
@@ -51,14 +51,14 @@ evolution_alarm_notify_LDADD = \
$(EXTRA_GNOME_LIBS) \
$(INTLLIBS)
-evolution_alarm_client_SOURCES = \
- client-main.c \
- $(CORBA_GENERATED)
-
-evolution_alarm_client_LDADD = \
- $(BONOBO_VFS_GNOME_LIBS) \
- $(EXTRA_GNOME_LIBS) \
- $(INTLLIBS)
+# evolution_alarm_client_SOURCES = \
+# client-main.c \
+# $(CORBA_GENERATED)
+#
+# evolution_alarm_client_LDADD = \
+# $(BONOBO_VFS_GNOME_LIBS) \
+# $(EXTRA_GNOME_LIBS) \
+# $(INTLLIBS)
oafdir = $(datadir)/oaf
oaf_in_files = \
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index 5226c2480d..8486e9cca8 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -145,6 +145,7 @@ factory_fn (BonoboGenericFactory *factory,
NULL, /* remove_folder_fn */
NULL, /* copy_folder_fn */
NULL, /* populate_folder_context_menu_fn */
+ NULL, /* get_dnd_selection_fn */
NULL /* closure */);
gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set",
diff --git a/calendar/gui/component-factory.c b/calendar/gui/component-factory.c
index 5226c2480d..8486e9cca8 100644
--- a/calendar/gui/component-factory.c
+++ b/calendar/gui/component-factory.c
@@ -145,6 +145,7 @@ factory_fn (BonoboGenericFactory *factory,
NULL, /* remove_folder_fn */
NULL, /* copy_folder_fn */
NULL, /* populate_folder_context_menu_fn */
+ NULL, /* get_dnd_selection_fn */
NULL /* closure */);
gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set",
diff --git a/executive-summary/ChangeLog b/executive-summary/ChangeLog
index 343838a70f..8911e7154b 100644
--- a/executive-summary/ChangeLog
+++ b/executive-summary/ChangeLog
@@ -1,3 +1,8 @@
+2001-03-08 Ettore Perazzoli <ettore@ximian.com>
+
+ * component/component-factory.c (factory_fn): Specify a NULL
+ `EvolutionShellComponentGetDndSelectionFn'.
+
2001-02-14 Iain Holmes <iain@ximian.com>
* component/e-summary-url.c (e_summary_url_click): Remove the new
diff --git a/executive-summary/component/component-factory.c b/executive-summary/component/component-factory.c
index 4fba79c420..8036b7b346 100644
--- a/executive-summary/component/component-factory.c
+++ b/executive-summary/component/component-factory.c
@@ -126,7 +126,7 @@ factory_fn (BonoboGenericFactory *factory,
shell_component = evolution_shell_component_new (folder_types,
create_view,
- NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
NULL);
gtk_signal_connect (GTK_OBJECT (shell_component), "destroy",
GTK_SIGNAL_FUNC (factory_destroy), NULL);
diff --git a/mail/ChangeLog b/mail/ChangeLog
index bdfab50949..db1e3824e2 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,8 @@
+2001-03-08 Ettore Perazzoli <ettore@ximian.com>
+
+ * component-factory.c (component_fn): Specify a NULL
+ `EvolutionShellComponentGetDndSelectionFn'.
+
2001-03-07 Jeffrey Stedfast <fejj@ximian.com>
* mail-autofilter.c (filter_rule_from_message): Add an action-part
diff --git a/mail/component-factory.c b/mail/component-factory.c
index d72df7281d..340b9b8c11 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -269,7 +269,8 @@ component_fn (BonoboGenericFactory *factory, void *closure)
create_folder,
NULL, /* remove_folder_fn */
NULL, /* copy_folder_fn */
- NULL, /* populate_folder_context_menu */
+ NULL, /* populate_folder_context_menu_fn */
+ NULL, /* get_dnd_selection_fn */
NULL);
gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set",
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 36a54a7c1b..78eaf1c244 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,42 @@
+2001-03-08 Ettore Perazzoli <ettore@ximian.com>
+
+ * e-storage-set-view.c (get_folder_at_row): New helper function.
+ (create_target_list_for_row): Use it.
+ (table_drag_data_get): Get the selection from the shell component
+ using `evolution_shell_component_client_get_dnd_selection()'.
+ (set_e_shortcut_selection): Turn a `g_return_if_fail()' into a
+ `g_assert()'.
+
+ * evolution-shell-component.c: New member `get_dnd_selection_fn'
+ in `EvolutionShellComponentPrivate'.
+ (evolution_shell_component_construct): New arg
+ @get_dnd_selection_fn.
+ (evolution_shell_component_new): Likewise.
+ (impl_ShellComponent_getDndSelection): New, implementation for
+ `ShellComponent::getDndSelection'.
+ (class_init): Install it.
+
+ * evolution-shell-component-client.c
+ (evolution_shell_component_client_get_dnd_selection): New, wrapper
+ for `ShellComponent::getDndSelection'.
+
+ * evolution-shell-component.h: Renamed
+ `EvolutionShellComponentPopulateFolderContextMenu' into
+ `EvolutionShellComponentPopulateFolderContextMenuFn'. New
+ function pointer typedef `EvolutionShellComponentGetDndSelectionFn'.
+
+ * Evolution-ShellComponent.idl: New method
+ `ShellComponent::getDndSelection'.
+
+ * e-storage-set-view.c (create_target_entries_from_dnd_type_list):
+ Always add an `E_SHORTCUT_TYPE' type at least.
+ (create_target_list_for_row): Don't return NULL if the list of
+ exported DND types is NULL. Don't create an unused target list.
+ Actually return the created target list.
+ (table_drag_data_get): If the @info is zero, set the e-shortcut
+ selection.
+ (set_uri_list_selection): Temporarily disabled.
+
2001-03-07 Ettore Perazzoli <ettore@ximian.com>
* e-component-registry.c (register_type): New args
diff --git a/shell/Evolution-ShellComponent.idl b/shell/Evolution-ShellComponent.idl
index 174f7fafdb..1e1b32eeeb 100644
--- a/shell/Evolution-ShellComponent.idl
+++ b/shell/Evolution-ShellComponent.idl
@@ -23,7 +23,7 @@ module Evolution {
};
typedef sequence<FolderType> FolderTypeList;
-
+
interface ShellComponentListener;
interface ShellComponent : Bonobo::Unknown {
@@ -69,6 +69,14 @@ module Evolution {
void populateFolderContextMenu (in Bonobo::UIContainer uih,
in string physical_uri,
in string type);
+
+ typedef sequence<octet> Selection;
+ exception NoSelection {};
+
+ void getDndSelection (in string physical_uri, in short type,
+ out short format,
+ out Selection selection)
+ raises (NoSelection);
};
interface ShellComponentListener {
diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c
index dc299cb787..ccab7502f2 100644
--- a/shell/e-storage-set-view.c
+++ b/shell/e-storage-set-view.c
@@ -233,6 +233,30 @@ get_pixbuf_for_folder (EStorageSetView *storage_set_view,
return scaled_pixbuf;
}
+static EFolder *
+get_folder_at_row (EStorageSetView *storage_set_view,
+ int row)
+{
+ EStorageSetViewPrivate *priv;
+ ETreePath *folder_node_path;
+ const char *folder_path;
+ EFolder *folder;
+
+ priv = storage_set_view->priv;
+
+ folder_node_path = e_tree_model_node_at_row (priv->etree_model, row);
+ if (folder_node_path == NULL)
+ return NULL;
+
+ folder_path = e_tree_model_node_get_data (priv->etree_model, folder_node_path);
+ g_assert (folder_path != NULL);
+
+ folder = e_storage_set_get_folder (priv->storage_set, folder_path);
+ g_assert (folder != NULL);
+
+ return folder;
+}
+
/* Custom marshalling function. */
@@ -274,15 +298,25 @@ create_target_entries_from_dnd_type_list (GList *dnd_types,
int i;
if (dnd_types == NULL)
- return NULL;
+ num_entries = 0;
+ else
+ num_entries = g_list_length (dnd_types);
- num_entries = g_list_length (dnd_types);
- if (num_entries == 0)
- return NULL;
+ /* We always add an entry for an Evolution URI type. This will let us
+ do drag & drop within Evolution at least. */
+ num_entries ++;
entries = g_new (GtkTargetEntry, num_entries);
- for (p = dnd_types, i = 0; p != NULL; p = p->next, i++) {
+ i = 0;
+
+ /* The Evolution URI will always come first. */
+ entries[i].target = E_SHORTCUT_TYPE;
+ entries[i].flags = 0;
+ entries[i].info = 0;
+ i ++;
+
+ for (p = dnd_types; p != NULL; p = p->next, i++) {
const char *dnd_type;
g_assert (i < num_entries);
@@ -314,35 +348,21 @@ create_target_list_for_row (EStorageSetView *storage_set_view,
EStorageSetViewPrivate *priv;
GtkTargetList *target_list;
EFolderTypeRegistry *folder_type_registry;
- ETreePath *folder_node_path;
- EFolder *folder;
- const char *folder_path;
- const char *folder_type;
GList *exported_dnd_types;
GtkTargetEntry *target_entries;
+ EFolder *folder;
+ const char *folder_type;
int num_target_entries;
priv = storage_set_view->priv;
- target_list = gtk_target_list_new (NULL, 0);
-
folder_type_registry = e_storage_set_get_folder_type_registry (priv->storage_set);
- folder_node_path = e_tree_model_node_at_row (priv->etree_model, row);
- g_assert (folder_node_path != NULL);
-
- folder_path = e_tree_model_node_get_data (priv->etree_model, folder_node_path);
- g_assert (folder_path != NULL);
-
- folder = e_storage_set_get_folder (priv->storage_set, folder_path);
- g_assert (folder != NULL);
-
+ folder = get_folder_at_row (storage_set_view, row);
folder_type = e_folder_get_type_string (folder);
exported_dnd_types = e_folder_type_registry_get_exported_dnd_types_for_type (folder_type_registry,
folder_type);
- if (exported_dnd_types == NULL)
- return NULL;
target_entries = create_target_entries_from_dnd_type_list (exported_dnd_types,
&num_target_entries);
@@ -352,9 +372,10 @@ create_target_list_for_row (EStorageSetView *storage_set_view,
free_target_entries (target_entries);
- return NULL;
+ return target_list;
}
+#if 0
static void
set_uri_list_selection (EStorageSetView *storage_set_view,
GtkSelectionData *selection_data)
@@ -370,6 +391,7 @@ set_uri_list_selection (EStorageSetView *storage_set_view,
8, (guchar *) uri_list, strlen (uri_list));
g_free (uri_list);
}
+#endif
static void
set_e_shortcut_selection (EStorageSetView *storage_set_view,
@@ -381,7 +403,7 @@ set_e_shortcut_selection (EStorageSetView *storage_set_view,
const char *trailing_slash;
const char *name;
- g_return_if_fail(storage_set_view != NULL);
+ g_assert (storage_set_view != NULL);
priv = storage_set_view->priv;
@@ -565,8 +587,6 @@ button_press_event (GtkWidget *widget,
e_table_get_cell_at (table, event->x, event->y, &row, &column);
- g_print ("e-storage-set-view.c::button_press_event() -- row %d column %d\n", row, column);
-
priv->drag_x = event->x;
priv->drag_y = event->y;
priv->drag_column = column;
@@ -587,6 +607,8 @@ motion_notify_event (GtkWidget *widget,
GdkDragAction actions;
GdkDragContext *context;
+ puts (__FUNCTION__);
+
storage_set_view = E_STORAGE_SET_VIEW (widget);
priv = storage_set_view->priv;
@@ -649,19 +671,45 @@ table_drag_data_get (ETable *etable,
guint32 time)
{
EStorageSetView *storage_set_view;
+ EStorageSetViewPrivate *priv;
+ EFolder *folder;
+ EFolderTypeRegistry *folder_type_registry;
+ EvolutionShellComponentClient *component_client;
+ char *selection;
+ int selection_length;
+ int format;
storage_set_view = E_STORAGE_SET_VIEW (etable);
+ priv = storage_set_view->priv;
- switch (info) {
- case DND_TARGET_TYPE_URI_LIST:
- set_uri_list_selection (storage_set_view, selection_data);
- break;
- case DND_TARGET_TYPE_E_SHORTCUT:
+ if (info == 0) {
set_e_shortcut_selection (storage_set_view, selection_data);
- break;
- default:
- g_assert_not_reached ();
+ return;
}
+
+ g_assert (info > 0);
+
+ folder = get_folder_at_row (storage_set_view, drag_row);
+ g_assert (folder != NULL);
+
+ folder_type_registry = e_storage_set_get_folder_type_registry (priv->storage_set);
+ g_assert (folder_type_registry != NULL);
+
+ component_client = e_folder_type_registry_get_handler_for_type (folder_type_registry,
+ e_folder_get_type_string (folder));
+ g_assert (component_client != NULL);
+
+ evolution_shell_component_client_get_dnd_selection (component_client,
+ e_folder_get_physical_uri (folder),
+ info,
+ &format, &selection, &selection_length);
+ if (selection == NULL)
+ return;
+
+ gtk_selection_data_set (selection_data, selection_data->target,
+ format, selection, selection_length);
+
+ g_free (selection);
}
static gboolean
@@ -988,8 +1036,8 @@ new_folder_cb (EStorageSet *storage_set,
parent_path = g_strndup (path, last_separator - path);
parent_node = g_hash_table_lookup (priv->path_to_etree_node, parent_path);
if (parent_node == NULL) {
- g_print ("EStorageSetView: EStorageSet reported new subfolder for non-existing folder -- %s\n",
- parent_path);
+ g_warning ("EStorageSetView: EStorageSet reported new subfolder for non-existing folder -- %s\n",
+ parent_path);
g_free (parent_path);
return;
}
diff --git a/shell/evolution-shell-component-client.c b/shell/evolution-shell-component-client.c
index 4717c5f23d..2a35c0c56b 100644
--- a/shell/evolution-shell-component-client.c
+++ b/shell/evolution-shell-component-client.c
@@ -533,5 +533,55 @@ evolution_shell_component_client_populate_folder_context_menu (EvolutionShellCom
}
+void
+evolution_shell_component_client_get_dnd_selection (EvolutionShellComponentClient *shell_component_client,
+ const char *physical_uri,
+ int type,
+ int *format_return,
+ char **selection_return,
+ int *selection_length_return)
+{
+ EvolutionShellComponentClientPrivate *priv;
+ GNOME_Evolution_ShellComponent corba_shell_component;
+ CORBA_Environment ev;
+ GNOME_Evolution_ShellComponent_Selection *corba_selection;
+ CORBA_short format;
+
+ g_return_if_fail (shell_component_client != NULL);
+ g_return_if_fail (EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component_client));
+ g_return_if_fail (physical_uri != NULL);
+
+ priv = shell_component_client->priv;
+
+ CORBA_exception_init (&ev);
+
+ corba_shell_component = bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client));
+
+ GNOME_Evolution_ShellComponent_getDndSelection (corba_shell_component,
+ physical_uri, type,
+ &format, &corba_selection,
+ &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ *format_return = 0;
+ *selection_return = NULL;
+ *selection_length_return = 0;
+ return;
+ }
+
+ CORBA_exception_free (&ev);
+
+ *format_return = format;
+
+ /* We have to re-allocate the CORBA data using GLib because we cannot
+ mix g_ memory management with CORBA_ memory management. Yes, this
+ does suck. */
+ *selection_return = g_malloc (corba_selection->_length);
+ memcpy (*selection_return, corba_selection->_buffer, corba_selection->_length);
+ *selection_length_return = corba_selection->_length;
+
+ CORBA_free (corba_selection);
+}
+
+
E_MAKE_TYPE (evolution_shell_component_client, "EvolutionShellComponentClient",
EvolutionShellComponentClient, class_init, init, PARENT_TYPE)
diff --git a/shell/evolution-shell-component-client.h b/shell/evolution-shell-component-client.h
index 319902198f..03a76a7d31 100644
--- a/shell/evolution-shell-component-client.h
+++ b/shell/evolution-shell-component-client.h
@@ -94,6 +94,14 @@ void evolution_shell_component_client_populate_folder_context_menu (EvolutionS
const char *physical_uri,
const char *type);
+/* DND stuff. */
+void evolution_shell_component_client_get_dnd_selection (EvolutionShellComponentClient *shell_component_client,
+ const char *physical_uri,
+ int type,
+ int *format_return,
+ char **selection_return,
+ int *selection_length_return);
+
#ifdef cplusplus
}
#endif /* cplusplus */
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;
diff --git a/shell/evolution-shell-component.h b/shell/evolution-shell-component.h
index b64f3ae524..6f7a77a194 100644
--- a/shell/evolution-shell-component.h
+++ b/shell/evolution-shell-component.h
@@ -89,11 +89,18 @@ typedef void (* EvolutionShellComponentCopyFolderFn) (EvolutionShellComponent
gboolean remove_source,
const GNOME_Evolution_ShellComponentListener listener,
void *closure);
-typedef void (* EvolutionShellComponentPopulateFolderContextMenu) (EvolutionShellComponent *shell_component,
+typedef void (* EvolutionShellComponentPopulateFolderContextMenuFn) (EvolutionShellComponent *shell_component,
BonoboUIComponent *uic,
const char *physical_uri,
const char *type,
void *closure);
+typedef char * (* EvolutionShellComponentGetDndSelectionFn) (EvolutionShellComponent *shell_component,
+ const char *physical_uri,
+ int type,
+ int *format_return,
+ const char **selection_return,
+ int *selection_length_return,
+ void *closure);
struct _EvolutionShellComponentFolderType {
char *name;
@@ -126,22 +133,24 @@ struct _EvolutionShellComponentClass {
GtkType evolution_shell_component_get_type (void);
-void evolution_shell_component_construct (EvolutionShellComponent *shell_component,
- const EvolutionShellComponentFolderType folder_types[],
- EvolutionShellComponentCreateViewFn create_view_fn,
- EvolutionShellComponentCreateFolderFn create_folder_fn,
- EvolutionShellComponentRemoveFolderFn remove_folder_fn,
- EvolutionShellComponentCopyFolderFn copy_folder_fn,
- EvolutionShellComponentPopulateFolderContextMenu populate_folder_context_menu_fn,
- void *closure);
-EvolutionShellComponent *evolution_shell_component_new (const EvolutionShellComponentFolderType folder_types[],
- EvolutionShellComponentCreateViewFn create_view_fn,
- EvolutionShellComponentCreateFolderFn create_folder_fn,
- EvolutionShellComponentRemoveFolderFn remove_folder_fn,
- EvolutionShellComponentCopyFolderFn copy_folder_fn,
- EvolutionShellComponentPopulateFolderContextMenu populate_folder_context_menu_fn,
- void *closure);
-EvolutionShellClient *evolution_shell_component_get_owner (EvolutionShellComponent *shell_component);
+void evolution_shell_component_construct (EvolutionShellComponent *shell_component,
+ const EvolutionShellComponentFolderType folder_types[],
+ 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,
+ void *closure);
+EvolutionShellComponent *evolution_shell_component_new (const EvolutionShellComponentFolderType folder_types[],
+ 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,
+ void *closure);
+EvolutionShellClient *evolution_shell_component_get_owner (EvolutionShellComponent *shell_component);
#ifdef cplusplus
}