diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2003-03-07 03:25:20 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2003-03-07 03:25:20 +0800 |
commit | d039f69326f070a4ddb025f2ec72bb0461aecfed (patch) | |
tree | b5b093d599adeee223451ba0480b94c671bb73dd /shell | |
parent | bfb03e84412a63f6a3dc9de66117a978ca0e1c3b (diff) | |
download | gsoc2013-evolution-d039f69326f070a4ddb025f2ec72bb0461aecfed.tar gsoc2013-evolution-d039f69326f070a4ddb025f2ec72bb0461aecfed.tar.gz gsoc2013-evolution-d039f69326f070a4ddb025f2ec72bb0461aecfed.tar.bz2 gsoc2013-evolution-d039f69326f070a4ddb025f2ec72bb0461aecfed.tar.lz gsoc2013-evolution-d039f69326f070a4ddb025f2ec72bb0461aecfed.tar.xz gsoc2013-evolution-d039f69326f070a4ddb025f2ec72bb0461aecfed.tar.zst gsoc2013-evolution-d039f69326f070a4ddb025f2ec72bb0461aecfed.zip |
(update_other_users_folder_items_sensitivity):
New function to toggle the "open other user's folder" menu item
sensitivity on or off depending on whether there are any storages
that actually support that.
(storage_set_removed_storage_callback): New callback for the
EStorageSet's "removed_storage" signal; it updates the sensitivity
if necessary.
(storage_set_new_storage_callback): Likewise, new callback for the
EStorageSet's "new_storage" signal.
(e_shell_view_construct): Connect these two signal callbacks here.
Also, call update_other_users_folder_items_sensitivity() to set up
the initial sensitivity of the menu item.
(update_for_current_uri): Add a missing EStorageSetView cast here.
svn path=/trunk/; revision=20209
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 16 | ||||
-rw-r--r-- | shell/e-shell-view.c | 71 |
2 files changed, 80 insertions, 7 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 34fd31f08d..9e1cb24630 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,5 +1,21 @@ 2003-03-06 Ettore Perazzoli <ettore@ximian.com> + * e-shell-view.c (update_other_users_folder_items_sensitivity): + New function to toggle the "open other user's folder" menu item + sensitivity on or off depending on whether there are any storages + that actually support that. + (storage_set_removed_storage_callback): New callback for the + EStorageSet's "removed_storage" signal; it updates the sensitivity + if necessary. + (storage_set_new_storage_callback): Likewise, new callback for the + EStorageSet's "new_storage" signal. + (e_shell_view_construct): Connect these two signal callbacks here. + Also, call update_other_users_folder_items_sensitivity() to set up + the initial sensitivity of the menu item. + (update_for_current_uri): Add a missing EStorageSetView cast here. + +2003-03-06 Ettore Perazzoli <ettore@ximian.com> + [#34371] * e-shell-shared-folder-picker-dialog.c diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 105430290a..5920644ada 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -224,6 +224,36 @@ view_destroy (View *view) /* Utility functions. */ +static void +update_other_users_folder_items_sensitivity (EShellView *shell_view) +{ + EShellViewPrivate *priv = shell_view->priv; + gboolean a_storage_supports_shared_folders; + GList *storage_list, *p; + + storage_list = e_storage_set_get_storage_list (e_shell_get_storage_set (priv->shell)); + a_storage_supports_shared_folders = FALSE; + for (p = storage_list; p != NULL; p = p->next) { + if (e_storage_supports_shared_folders (E_STORAGE (p->data))) + a_storage_supports_shared_folders = TRUE; + } + + if (a_storage_supports_shared_folders) { + bonobo_ui_component_set_prop (priv->ui_component, "/commands/FileOpenOtherUsersFolder", + "sensitive", "1", NULL); + bonobo_ui_component_set_prop (priv->ui_component, "/commands/FileRemoveOtherUsersFolder", + "sensitive", "1", NULL); + } else { + bonobo_ui_component_set_prop (priv->ui_component, "/commands/FileOpenOtherUsersFolder", + "sensitive", "0", NULL); + bonobo_ui_component_set_prop (priv->ui_component, "/commands/FileRemoveOtherUsersFolder", + "sensitive", "0", NULL); + } + + g_list_foreach (storage_list, (GFunc) g_object_unref, NULL); + g_list_free (storage_list); +} + static GtkWidget * create_label_for_empty_page (void) { @@ -570,6 +600,28 @@ handle_current_folder_removed (EShellView *shell_view) /* Callbacks for the EStorageSet. */ static void +storage_set_new_storage_callback (EStorageSet *storage_set, + EStorage *storage, + void *data) +{ + if (e_storage_supports_shared_folders (storage)) + update_other_users_folder_items_sensitivity (E_SHELL_VIEW (data)); +} + +static void +storage_set_removed_storage_callback (EStorageSet *storage_set, + EStorage *storage, + void *data) +{ + EShellView *shell_view = E_SHELL_VIEW (data); + + if (! e_storage_supports_shared_folders (storage)) + return; + + update_other_users_folder_items_sensitivity (shell_view); +} + +static void storage_set_removed_folder_callback (EStorageSet *storage_set, const char *path, void *data) @@ -1743,6 +1795,7 @@ e_shell_view_construct (EShellView *shell_view, const char *uri) { EShellViewPrivate *priv; + EStorageSet *storage_set; EShellView *view; char *uri_to_load; @@ -1760,7 +1813,7 @@ e_shell_view_construct (EShellView *shell_view, if (!view) { g_object_unref (shell_view); return NULL; - } + } priv->shell = shell; bonobo_object_ref (BONOBO_OBJECT (priv->shell)); @@ -1768,10 +1821,6 @@ e_shell_view_construct (EShellView *shell_view, g_signal_connect (view, "delete_event", G_CALLBACK (delete_event_cb), NULL); - e_signal_connect_while_alive (e_shell_get_storage_set (priv->shell), - "updated_folder", G_CALLBACK (updated_folder_cb), - shell_view, shell_view); - priv->ui_container = bonobo_window_get_ui_container (BONOBO_WINDOW (view)); g_signal_connect (priv->ui_container, "system_exception", G_CALLBACK (unmerge_on_error), NULL); @@ -1800,13 +1849,21 @@ e_shell_view_construct (EShellView *shell_view, g_signal_connect_object (shell, "line_status_changed", G_CALLBACK (shell_line_status_changed_cb), shell_view, 0); - g_signal_connect_object (GTK_OBJECT (e_shell_get_storage_set (shell)), "removed_folder", + storage_set = e_shell_get_storage_set (shell); + e_signal_connect_while_alive (storage_set, "updated_folder", + G_CALLBACK (updated_folder_cb), shell_view, shell_view); + g_signal_connect_object (storage_set, "new_storage", + G_CALLBACK (storage_set_new_storage_callback), shell_view, 0); + g_signal_connect_object (storage_set, "removed_storage", + G_CALLBACK (storage_set_removed_storage_callback), shell_view, 0); + g_signal_connect_object (storage_set, "removed_folder", G_CALLBACK (storage_set_removed_folder_callback), shell_view, 0); e_shell_user_creatable_items_handler_attach_menus (e_shell_get_user_creatable_items_handler (priv->shell), shell_view); setup_defaults (view); + update_other_users_folder_items_sensitivity (view); if (uri != NULL) { uri_to_load = g_strdup (uri); @@ -2016,7 +2073,7 @@ update_for_current_uri (EShellView *shell_view) g_signal_handlers_block_by_func (priv->storage_set_view, G_CALLBACK (folder_selected_cb), shell_view); - curr_path = e_storage_set_view_get_current_folder (priv->storage_set_view); + curr_path = e_storage_set_view_get_current_folder (E_STORAGE_SET_VIEW (priv->storage_set_view)); if (path != NULL && (curr_path == NULL || strcmp(path, curr_path))) e_storage_set_view_set_current_folder (E_STORAGE_SET_VIEW (priv->storage_set_view), path); |