diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2002-05-11 03:03:56 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2002-05-11 03:03:56 +0800 |
commit | 6fe392b30131574317e2e9715f2cee3eac94f9e7 (patch) | |
tree | a0ebaed8c8a1a7ca35100baab8e5a3378e23d0e1 /shell | |
parent | 4e2ef7120a264c1482d98eb6bd04c162b96234c3 (diff) | |
download | gsoc2013-evolution-6fe392b30131574317e2e9715f2cee3eac94f9e7.tar.gz gsoc2013-evolution-6fe392b30131574317e2e9715f2cee3eac94f9e7.tar.zst gsoc2013-evolution-6fe392b30131574317e2e9715f2cee3eac94f9e7.zip |
Add members `parent' and `shell' in DiscoveryData.
* e-shell-shared-folder-picker-dialog.c: Add members `parent' and
`shell' in DiscoveryData.
(shell_view_destroy_callback): Callback for destruction of
->parent; set ->parent to NULL.
(shell_destroy_callback): Callback for the desctruction of the
shell; clean up everything.
(discover_folder): Initialize ->parent and shell, and add the
corresponding destruction handlers.
(shared_folder_discovery_listener_callback): Open the discovered
folder.
(setup_progress_dialog): Renamed from `show_progress_dialog'. Set
up a timeout for displaying the dialog instead of displaying it
right away.
(progress_dialog_show_timeout_callback): Callback for showing the
dialog after the callback.
svn path=/trunk/; revision=16754
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 18 | ||||
-rw-r--r-- | shell/e-shell-shared-folder-picker-dialog.c | 87 |
2 files changed, 89 insertions, 16 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 9797b6a1fc..11029f6f39 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,5 +1,23 @@ 2002-05-10 Ettore Perazzoli <ettore@ximian.com> + * e-shell-shared-folder-picker-dialog.c: Add members `parent' and + `shell' in DiscoveryData. + (shell_view_destroy_callback): Callback for destruction of + ->parent; set ->parent to NULL. + (shell_destroy_callback): Callback for the desctruction of the + shell; clean up everything. + (discover_folder): Initialize ->parent and shell, and add the + corresponding destruction handlers. + (shared_folder_discovery_listener_callback): Open the discovered + folder. + (setup_progress_dialog): Renamed from `show_progress_dialog'. Set + up a timeout for displaying the dialog instead of displaying it + right away. + (progress_dialog_show_timeout_callback): Callback for showing the + dialog after the callback. + +2002-05-10 Ettore Perazzoli <ettore@ximian.com> + * e-shell-shared-folder-picker-dialog.c (shared_folder_discovery_listener_callback): Updated for FolderResult instead of DiscoverSharedFolderResult. diff --git a/shell/e-shell-shared-folder-picker-dialog.c b/shell/e-shell-shared-folder-picker-dialog.c index 2e2d971c5e..9dfca186bd 100644 --- a/shell/e-shell-shared-folder-picker-dialog.c +++ b/shell/e-shell-shared-folder-picker-dialog.c @@ -28,6 +28,7 @@ #include "e-shell-shared-folder-picker-dialog.h" #include "e-corba-storage.h" +#include "e-shell-constants.h" #include "evolution-storage-listener.h" #include "Evolution-Addressbook-SelectNames.h" @@ -46,6 +47,11 @@ #include <gtk/gtk.h> +/* Timeout for showing the progress dialog (msecs). */ + +#define PROGRESS_DIALOG_DELAY 500 + + /* Dialog creation and handling. */ static void @@ -255,6 +261,8 @@ show_dialog (EShell *shell, /* Discovery process. */ struct _DiscoveryData { + EShell *shell; + EShellView *parent; GtkWidget *dialog; EStorage *storage; char *user; @@ -297,11 +305,21 @@ progress_dialog_close_callback (GnomeDialog *dialog, return TRUE; } +static int +progress_dialog_show_timeout_callback (void *data) +{ + GtkWidget *dialog; + + dialog = GTK_WIDGET (data); + gtk_widget_show_all (dialog); + return FALSE; +} + static GtkWidget * -show_progress_dialog (EShell *shell, - EStorage *storage, - const char *user_email_address, - const char *folder_name) +create_progress_dialog (EShell *shell, + EStorage *storage, + const char *user_email_address, + const char *folder_name) { GtkWidget *dialog; GtkWidget *label; @@ -335,7 +353,7 @@ show_progress_dialog (EShell *shell, GTK_SIGNAL_FUNC (progress_bar_destroy_callback), GINT_TO_POINTER (progress_bar_timeout_id)); - gtk_widget_show_all (dialog); + g_timeout_add (PROGRESS_DIALOG_DELAY, progress_dialog_show_timeout_callback, dialog); return dialog; } @@ -351,8 +369,28 @@ cleanup_discovery (DiscoveryData *discovery_data) } static void -storage_destroyed_callback (GtkObject *object, - void *data) +shell_destroy_callback (GtkObject *object, + void *data) +{ + DiscoveryData *discovery_data; + + discovery_data = (DiscoveryData *) data; + cleanup_discovery (discovery_data); +} + +static void +shell_view_destroy_callback (GtkObject *object, + void *data) +{ + DiscoveryData *discovery_data; + + discovery_data = (DiscoveryData *) data; + discovery_data->parent = NULL; +} + +static void +storage_destroy_callback (GtkObject *object, + void *data) { DiscoveryData *discovery_data; @@ -378,10 +416,19 @@ shared_folder_discovery_listener_callback (BonoboListener *listener, cleanup_discovery (discovery_data); - /* FIXME: The folder has been discovered; do something here, i.e. show - the folder. */ + if (result == GNOME_Evolution_Storage_OK) { + char *uri; + + uri = g_strconcat (E_SHELL_URI_PREFIX, "/", + e_storage_get_name (discovery_data->storage), + result->path, + NULL); - e_notice (NULL, GNOME_MESSAGE_BOX_INFO, "Found folder\n%s", result->path); + if (discovery_data->parent != NULL) + e_shell_view_display_uri (discovery_data->parent, uri); + else + e_shell_create_view (discovery_data->shell, uri, NULL); + } } static void @@ -412,16 +459,24 @@ discover_folder (EShell *shell, if (storage == NULL || ! E_IS_CORBA_STORAGE (storage)) goto error; - dialog = show_progress_dialog (shell, storage, user_email_address, folder_name); + dialog = create_progress_dialog (shell, storage, user_email_address, folder_name); discovery_data = g_new (DiscoveryData, 1); - discovery_data->dialog = dialog; - discovery_data->storage = storage; - discovery_data->user = g_strdup (user_email_address); - discovery_data->folder_name = g_strdup (folder_name); + discovery_data->dialog = dialog; + discovery_data->shell = shell; + discovery_data->parent = parent; + discovery_data->storage = storage; + discovery_data->user = g_strdup (user_email_address); + discovery_data->folder_name = g_strdup (folder_name); + + gtk_signal_connect (GTK_OBJECT (shell), "destroy", + GTK_SIGNAL_FUNC (shell_destroy_callback), discovery_data); + + gtk_signal_connect (GTK_OBJECT (parent), "destroy", + GTK_SIGNAL_FUNC (shell_view_destroy_callback), discovery_data); gtk_signal_connect (GTK_OBJECT (storage), "destroy", - GTK_SIGNAL_FUNC (storage_destroyed_callback), discovery_data); + GTK_SIGNAL_FUNC (storage_destroy_callback), discovery_data); listener = bonobo_listener_new (shared_folder_discovery_listener_callback, discovery_data); |