From c6d835a949f3d5a917c1b2f3c39d0226514adde9 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Wed, 31 May 2000 06:22:23 +0000 Subject: Initialize the toggle items in the View menu when creating them, so that they start up in the correct state. Deactivate the current control when displaying an empty error page. Removed some crufty debugging messages. svn path=/trunk/; revision=3310 --- shell/ChangeLog | 17 +++++++++++++++++ shell/e-shell-view-menu.c | 20 ++++++++++++++------ shell/e-shell-view.c | 21 ++++++++++++++++++++- shell/e-shell-view.h | 32 +++++++++++++++++--------------- 4 files changed, 68 insertions(+), 22 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index 29f9e0e3a1..a710b9ae1f 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,20 @@ +2000-05-31 Ettore Perazzoli + + * e-shell-view.c (show_error): Use `set_current_notebook_page()' + instead of `gtk_notebook_set_page()'; this will also deactivate + the current control properly. + + * e-shell-view-menu.c (e_shell_view_menu_setup): Initialize the + state of the shortcut/folder toggle menu items using + `e_shell_view_get_shortcut_bar_mode()' and + `e_shell_view_get_folder_bar_mode()'. + (command_toggle_shortcut_bar): Removed debugging message. + (command_toggle_folder_bar): Likewise. + + * e-shell-view.c (e_shell_view_get_shortcut_bar_mode): New + function. + (e_shell_view_get_folder_bar_mode): New function. + 2000-05-31 Ettore Perazzoli * e-storage-set-view.c: New constant `DRAG_RESISTANCE'. New diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c index 4526f5e6f3..8b4bf6c9af 100644 --- a/shell/e-shell-view-menu.c +++ b/shell/e-shell-view-menu.c @@ -175,8 +175,6 @@ command_toggle_folder_bar (BonoboUIHandler *uih, EShellViewSubwindowMode mode; gboolean show; - puts (path); - shell_view = E_SHELL_VIEW (data); show = bonobo_ui_handler_menu_get_toggle_state (uih, path); @@ -200,7 +198,6 @@ command_toggle_shortcut_bar (BonoboUIHandler *uih, shell_view = E_SHELL_VIEW (data); show = bonobo_ui_handler_menu_get_toggle_state (uih, path); - g_print ("%s -- %d\n", path, show); if (show) mode = E_SHELL_VIEW_SUBWINDOW_STICKY; @@ -369,6 +366,10 @@ static GnomeUIInfo menu [] = { }; +/* FIXME these must match the corresponding setup in the GnomeUIInfo and this sucks sucks. */ +#define SHORTCUT_BAR_TOGGLE_PATH "/View/Show shortcut bar" +#define FOLDER_BAR_TOGGLE_PATH "/View/Show folder bar" + void e_shell_view_menu_setup (EShellView *shell_view) { @@ -386,8 +387,15 @@ e_shell_view_menu_setup (EShellView *shell_view) gtk_signal_connect (GTK_OBJECT (shell_view), "shortcut_bar_mode_changed", GTK_SIGNAL_FUNC (shortcut_bar_mode_changed_cb), - ""); - gtk_signal_connect (GTK_OBJECT (shell_view), "shortcut_bar_mode_changed", + SHORTCUT_BAR_TOGGLE_PATH); + gtk_signal_connect (GTK_OBJECT (shell_view), "folder_bar_mode_changed", GTK_SIGNAL_FUNC (folder_bar_mode_changed_cb), - ""); + FOLDER_BAR_TOGGLE_PATH); + + /* Initialize the toggles. Yeah, this is, well, yuck. */ + + folder_bar_mode_changed_cb (shell_view, e_shell_view_get_folder_bar_mode (shell_view), + FOLDER_BAR_TOGGLE_PATH); + shortcut_bar_mode_changed_cb (shell_view, e_shell_view_get_shortcut_bar_mode (shell_view), + SHORTCUT_BAR_TOGGLE_PATH); } diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index f9cc510102..0157b72b0b 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -637,7 +637,8 @@ show_error (EShellView *shell_view, gtk_notebook_remove_page (notebook, 0); gtk_notebook_prepend_page (notebook, label, NULL); - gtk_notebook_set_page (notebook, 0); + + set_current_notebook_page (shell_view, 0); } /* Create a new view for @uri with @control. It assumes a view for @uri does not exist yet. */ @@ -906,6 +907,24 @@ e_shell_view_set_folder_bar_mode (EShellView *shell_view, gtk_signal_emit (GTK_OBJECT (shell_view), signals[FOLDER_BAR_MODE_CHANGED], mode); } +EShellViewSubwindowMode +e_shell_view_get_shortcut_bar_mode (EShellView *shell_view) +{ + g_return_val_if_fail (shell_view != NULL, E_SHELL_VIEW_SUBWINDOW_HIDDEN); + g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), E_SHELL_VIEW_SUBWINDOW_HIDDEN); + + return shell_view->priv->shortcut_bar_mode; +} + +EShellViewSubwindowMode +e_shell_view_get_folder_bar_mode (EShellView *shell_view) +{ + g_return_val_if_fail (shell_view != NULL, E_SHELL_VIEW_SUBWINDOW_HIDDEN); + g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), E_SHELL_VIEW_SUBWINDOW_HIDDEN); + + return shell_view->priv->folder_bar_mode; +} + EShell * e_shell_view_get_shell (EShellView *shell_view) diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h index fa38ff695c..5bc936a7bf 100644 --- a/shell/e-shell-view.h +++ b/shell/e-shell-view.h @@ -71,21 +71,23 @@ struct _EShellViewClass { }; -GtkType e_shell_view_get_type (void); -void e_shell_view_construct (EShellView *shell_view, - EShell *shell); -GtkWidget *e_shell_view_new (EShell *shell); - -gboolean e_shell_view_display_uri (EShellView *shell_view, - const char *uri); - -void e_shell_view_set_shortcut_bar_mode (EShellView *shell_view, - EShellViewSubwindowMode mode); -void e_shell_view_set_folder_bar_mode (EShellView *shell_view, - EShellViewSubwindowMode mode); - -EShell *e_shell_view_get_shell (EShellView *shell_view); -BonoboUIHandler *e_shell_view_get_bonobo_ui_handler (EShellView *shell_view); +GtkType e_shell_view_get_type (void); +void e_shell_view_construct (EShellView *shell_view, + EShell *shell); +GtkWidget *e_shell_view_new (EShell *shell); + +gboolean e_shell_view_display_uri (EShellView *shell_view, + const char *uri); + +void e_shell_view_set_shortcut_bar_mode (EShellView *shell_view, + EShellViewSubwindowMode mode); +void e_shell_view_set_folder_bar_mode (EShellView *shell_view, + EShellViewSubwindowMode mode); +EShellViewSubwindowMode e_shell_view_get_shortcut_bar_mode (EShellView *shell_view); +EShellViewSubwindowMode e_shell_view_get_folder_bar_mode (EShellView *shell_view); + +EShell *e_shell_view_get_shell (EShellView *shell_view); +BonoboUIHandler *e_shell_view_get_bonobo_ui_handler (EShellView *shell_view); #ifdef __cplusplus } -- cgit v1.2.3