aboutsummaryrefslogtreecommitdiffstats
path: root/shell/evolution-test-component.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2002-10-18 04:47:06 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2002-10-18 04:47:06 +0800
commitd91364b0562ad2d80186c8bc5e94a7792989a53d (patch)
treede24f00a6102a69bce5047e26726942ab87e895f /shell/evolution-test-component.c
parentd4e1fb42e0e1017919ca21b5b59cc84b38f794f7 (diff)
downloadgsoc2013-evolution-d91364b0562ad2d80186c8bc5e94a7792989a53d.tar
gsoc2013-evolution-d91364b0562ad2d80186c8bc5e94a7792989a53d.tar.gz
gsoc2013-evolution-d91364b0562ad2d80186c8bc5e94a7792989a53d.tar.bz2
gsoc2013-evolution-d91364b0562ad2d80186c8bc5e94a7792989a53d.tar.lz
gsoc2013-evolution-d91364b0562ad2d80186c8bc5e94a7792989a53d.tar.xz
gsoc2013-evolution-d91364b0562ad2d80186c8bc5e94a7792989a53d.tar.zst
gsoc2013-evolution-d91364b0562ad2d80186c8bc5e94a7792989a53d.zip
New, implementation for the cancel_discover_shared_folder virtual method.
* e-corba-storage.c (cancel_discover_shared_folder): New, implementation for the cancel_discover_shared_folder virtual method. (class_init): Install. * evolution-test-component.c (storage_discover_shared_folder_callback): Instead of passing the listener to the timeout function, just pass the storage. Put the listener and the timeout ID on the storage object by using gtk_object_set_data(). (shared_folder_discovery_timeout_callback): Updated accordingly. (storage_cancel_discover_shared_folder_callback): New, callback for the cancel_discover_shared_folder signal. (setup_custom_storage): Connect. * e-shell-shared-folder-picker-dialog.c: New member storage in struct DiscoveryData. While I am at it, rename member user to user_email_address. (discover_folder): Set the storage member. (cleanup_discovery): Unref storage member. (progress_dialog_clicked_callback): New, callback for the "clicked" signal on the dialog. (discover_folder): Connect. * evolution-storage.c (class_init): Install signal "cancel_discover_shared_folder". (impl_Storage_cancelDiscoverSharedFolder): New, implementation for the cancelDiscoverSharedFolder CORBA method; emit "cancel_discover_shared_folder". (evolution_storage_get_epv): Install CORBA method implementation. * evolution-storage.h: Add signal cancel_discover_shared_folder. * e-storage.c (e_storage_cancel_discover_shared_folder): New. * e-storage.h: New virtual method cancel_discover_shared_folder. * Evolution-Storage.idl (cancelDiscoverSharedFolder): New. svn path=/trunk/; revision=18386
Diffstat (limited to 'shell/evolution-test-component.c')
-rw-r--r--shell/evolution-test-component.c50
1 files changed, 46 insertions, 4 deletions
diff --git a/shell/evolution-test-component.c b/shell/evolution-test-component.c
index 18e11e65e7..2ddda0a7ce 100644
--- a/shell/evolution-test-component.c
+++ b/shell/evolution-test-component.c
@@ -264,12 +264,15 @@ create_new_folder_selector (EvolutionShellComponent *shell_component)
static int
shared_folder_discovery_timeout_callback (void *data)
{
+ GNOME_Evolution_Storage_FolderResult result;
CORBA_Environment ev;
Bonobo_Listener listener;
CORBA_any any;
- GNOME_Evolution_Storage_FolderResult result;
+ EvolutionStorage *storage;
+
+ storage = EVOLUTION_STORAGE (data);
- listener = (Bonobo_Listener) data;
+ listener = (Bonobo_Listener) gtk_object_get_data (GTK_OBJECT (storage), "listener");
result.result = GNOME_Evolution_Storage_OK;
result.path = "/Shared Folders/The Public Folder";
@@ -284,18 +287,22 @@ shared_folder_discovery_timeout_callback (void *data)
g_warning ("Cannot report result for shared folder discovery -- %s",
BONOBO_EX_ID (&ev));
+ Bonobo_Unknown_unref (listener, &ev);
CORBA_Object_release (listener, &ev);
CORBA_exception_free (&ev);
+ gtk_object_set_data (GTK_OBJECT (storage), "listener", NULL);
+ gtk_object_set_data (GTK_OBJECT (storage), "timeout_id", NULL);
+
return FALSE;
}
static void
storage_discover_shared_folder_callback (EvolutionStorage *storage,
+ Bonobo_Listener listener,
const char *user,
const char *folder_name,
- Bonobo_Listener listener,
void *data)
{
CORBA_Environment ev;
@@ -303,9 +310,42 @@ storage_discover_shared_folder_callback (EvolutionStorage *storage,
CORBA_exception_init (&ev);
listener_copy = CORBA_Object_duplicate (listener, &ev);
+ Bonobo_Unknown_ref (listener, &ev);
+ CORBA_exception_free (&ev);
+
+ g_print ("Listener copy %p\n", listener_copy);
+
+ timeout_id = g_timeout_add (1000, shared_folder_discovery_timeout_callback, storage);
+
+ gtk_object_set_data (GTK_OBJECT (storage), "listener", listener_copy);
+ gtk_object_set_data (GTK_OBJECT (storage), "timeout_id", GINT_TO_POINTER (timeout_id));
+}
+
+static void
+storage_cancel_discover_shared_folder_callback (EvolutionStorage *storage,
+ const char *user,
+ const char *folder_name,
+ void *data)
+{
+ Bonobo_Listener listener;
+ CORBA_Environment ev;
+ int timeout_id;
+
+ timeout_id = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (storage), "timeout_id"));
+ if (timeout_id == 0)
+ return;
+
+ g_source_remove (timeout_id);
+ gtk_object_set_data (GTK_OBJECT (storage), "timeout_id", NULL);
+
+ listener = (Bonobo_Listener) gtk_object_get_data (GTK_OBJECT (storage), "listener");
+
+ CORBA_exception_init (&ev);
+ Bonobo_Unknown_unref (listener, &ev);
+ CORBA_Object_release (listener, &ev);
CORBA_exception_free (&ev);
- g_timeout_add (1000, shared_folder_discovery_timeout_callback, listener_copy);
+ gtk_object_set_data (GTK_OBJECT (storage), "listener", NULL);
}
static void
@@ -328,6 +368,8 @@ setup_custom_storage (EvolutionShellClient *shell_client)
gtk_signal_connect (GTK_OBJECT (the_storage), "discover_shared_folder",
GTK_SIGNAL_FUNC (storage_discover_shared_folder_callback), shell_client);
+ gtk_signal_connect (GTK_OBJECT (the_storage), "cancel_discover_shared_folder",
+ GTK_SIGNAL_FUNC (storage_cancel_discover_shared_folder_callback), shell_client);
/* Add some custom "Properties" items. */
evolution_storage_add_property_item (the_storage, "Sharing...",