diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2001-10-03 02:21:01 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2001-10-03 02:21:01 +0800 |
commit | df580510c9788caa00731e6bbd227388b91f4695 (patch) | |
tree | 95e44dee9a9331775cbde973da31d78da4403615 /shell | |
parent | 3695ce0e609d1e548402934b53c3a8b504aa19cf (diff) | |
download | gsoc2013-evolution-df580510c9788caa00731e6bbd227388b91f4695.tar.gz gsoc2013-evolution-df580510c9788caa00731e6bbd227388b91f4695.tar.zst gsoc2013-evolution-df580510c9788caa00731e6bbd227388b91f4695.zip |
New, callback for the ::removed_folder signal on the shell's EStorageSet.
* e-shell-view.c (storage_set_removed_folder_callback): New,
callback for the ::removed_folder signal on the shell's
EStorageSet.
(e_shell_view_construct): Connect.
(e_shell_view_remove_control_for_uri): Removed.
* e-shell-folder-commands.c
(folder_selection_dialog_folder_selected_callback): Don't call
`e_shell_view_remove_control_for_uri()'.
(e_shell_command_delete_folder): Not here either. And don't
display the default URI either.
svn path=/trunk/; revision=13305
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 14 | ||||
-rw-r--r-- | shell/e-shell-folder-commands.c | 15 | ||||
-rw-r--r-- | shell/e-shell-view.c | 137 |
3 files changed, 86 insertions, 80 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 0a4dc9876b..2a09776847 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,17 @@ +2001-10-02 Ettore Perazzoli <ettore@ximian.com> + + * e-shell-view.c (storage_set_removed_folder_callback): New, + callback for the ::removed_folder signal on the shell's + EStorageSet. + (e_shell_view_construct): Connect. + (e_shell_view_remove_control_for_uri): Removed. + + * e-shell-folder-commands.c + (folder_selection_dialog_folder_selected_callback): Don't call + `e_shell_view_remove_control_for_uri()'. + (e_shell_command_delete_folder): Not here either. And don't + display the default URI either. + 2001-09-28 Ettore Perazzoli <ettore@ximian.com> [Fix #8053, `GNOME_Evolution_Shortcuts' doesn't seem to work.] diff --git a/shell/e-shell-folder-commands.c b/shell/e-shell-folder-commands.c index 7c8ad8316c..9a7d6008e7 100644 --- a/shell/e-shell-folder-commands.c +++ b/shell/e-shell-folder-commands.c @@ -196,10 +196,6 @@ folder_selection_dialog_folder_selected_callback (EShellFolderSelectionDialog *f storage_set = e_shell_get_storage_set (folder_command_data->shell); - if (remove_source) - e_shell_view_remove_control_for_uri (folder_command_data->shell_view, - e_shell_view_get_current_uri (folder_command_data->shell_view)); - e_storage_set_async_xfer_folder (storage_set, folder_command_data->source_path, folder_command_data->destination_path, @@ -445,17 +441,8 @@ e_shell_command_delete_folder (EShell *shell, if (folder_path == NULL) folder_path = e_shell_view_get_current_path (shell_view); - if (delete_dialog (shell_view, get_folder_name (shell, folder_path)) == 0) { - char *uri; - - uri = g_strconcat (E_SHELL_URI_PREFIX, folder_path, NULL); - e_shell_view_remove_control_for_uri (shell_view, uri); - g_free (uri); - + if (delete_dialog (shell_view, get_folder_name (shell, folder_path)) == 0) e_storage_set_async_remove_folder (storage_set, folder_path, delete_cb, shell_view); - - e_shell_view_display_uri (shell_view, E_SHELL_VIEW_DEFAULT_URI); - } } diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 7387781e54..650e76030d 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -275,6 +275,27 @@ cleanup_delayed_selection (EShellView *shell_view) } } +static GtkWidget * +find_socket (GtkContainer *container) +{ + GList *children, *tmp; + + children = gtk_container_children (container); + while (children) { + if (BONOBO_IS_SOCKET (children->data)) + return children->data; + else if (GTK_IS_CONTAINER (children->data)) { + GtkWidget *socket = find_socket (children->data); + if (socket) + return socket; + } + tmp = children->next; + g_list_free_1 (children); + children = tmp; + } + return NULL; +} + static void setup_verb_sensitivity_for_folder (EShellView *shell_view, const char *path) @@ -309,6 +330,51 @@ setup_verb_sensitivity_for_folder (EShellView *shell_view, } +/* Callbacks for the EStorageSet. */ + +static void +storage_set_removed_folder_callback (EStorageSet *storage_set, + const char *path, + void *data) +{ + EShellView *shell_view; + EShellViewPrivate *priv; + GtkWidget *socket; + View *view; + int destroy_connection_id; + int page_num; + char *uri; + + shell_view = E_SHELL_VIEW (data); + priv = shell_view->priv; + + uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL); + view = g_hash_table_lookup (priv->uri_to_view, uri); + g_free (uri); + + if (view == NULL) + return; + + socket = find_socket (GTK_CONTAINER (view->control)); + priv->sockets = g_list_remove (priv->sockets, socket); + + destroy_connection_id = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (socket), + "e_shell_view_destroy_connection_id")); + gtk_signal_disconnect (GTK_OBJECT (socket), destroy_connection_id); + + page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook), view->control); + + gtk_widget_destroy (view->control); + + g_hash_table_remove (priv->uri_to_view, view->uri); + view_destroy (view); + + gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), page_num); + + e_shell_view_display_uri (shell_view, E_SHELL_VIEW_DEFAULT_URI); +} + + /* Folder bar pop-up handling. */ static void @@ -1331,8 +1397,11 @@ e_shell_view_construct (EShellView *shell_view, bonobo_ui_component_thaw (priv->ui_component, NULL); gtk_signal_connect_while_alive (GTK_OBJECT (shell), "line_status_changed", - GTK_SIGNAL_FUNC (shell_line_status_changed_cb), view, - GTK_OBJECT (view)); + GTK_SIGNAL_FUNC (shell_line_status_changed_cb), shell_view, + GTK_OBJECT (shell_view)); + + gtk_signal_connect (GTK_OBJECT (e_shell_get_storage_set (shell)), "removed_folder", + GTK_SIGNAL_FUNC (storage_set_removed_folder_callback), shell_view); e_shell_user_creatable_items_handler_setup_menus (e_shell_get_user_creatable_items_handler (priv->shell), shell_view); @@ -1664,27 +1733,6 @@ setup_corba_interface (EShellView *shell_view, /* Socket destruction handling. */ -static GtkWidget * -find_socket (GtkContainer *container) -{ - GList *children, *tmp; - - children = gtk_container_children (container); - while (children) { - if (BONOBO_IS_SOCKET (children->data)) - return children->data; - else if (GTK_IS_CONTAINER (children->data)) { - GtkWidget *socket = find_socket (children->data); - if (socket) - return socket; - } - tmp = children->next; - g_list_free_1 (children); - children = tmp; - } - return NULL; -} - static void socket_destroy_cb (GtkWidget *socket_widget, gpointer data) { @@ -2015,49 +2063,6 @@ e_shell_view_display_uri (EShellView *shell_view, return retval; } -gboolean -e_shell_view_remove_control_for_uri (EShellView *shell_view, - const char *uri) -{ - EShellViewPrivate *priv; - View *view; - GtkWidget *socket; - GtkWidget *control; - int page_num; - int destroy_connection_id; - - g_return_val_if_fail (shell_view != NULL, FALSE); - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE); - - priv = shell_view->priv; - - /* Get the control, remove it from our hash of controls */ - view = g_hash_table_lookup (priv->uri_to_view, uri); - if (view == NULL) { - g_message ("Trying to remove view for non-existing URI -- %s", uri); - return FALSE; - } - - control = view->control; - g_hash_table_remove (priv->uri_to_view, view->uri); - view_destroy (view); - - /* Get the socket, remove it from our list of sockets */ - socket = find_socket (GTK_CONTAINER (control)); - priv->sockets = g_list_remove (priv->sockets, socket); - - /* disconnect from the destroy signal */ - destroy_connection_id = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (socket), - "e_shell_view_destroy_connection_id")); - gtk_signal_disconnect (GTK_OBJECT (socket), destroy_connection_id); - - /* Remove the notebook page, destroying the control and socket */ - page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook), control); - gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), page_num); - - return TRUE; -} - void e_shell_view_show_shortcut_bar (EShellView *shell_view, |