From 2c66be6ec9f15771110b0e34f3159a6f3b17df4e Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Fri, 22 Feb 2002 19:27:52 +0000 Subject: New. (display_uri): Call it before returning so the navigation buttons * e-shell-view.c (update_navigation_buttons): New. (display_uri): Call it before returning so the navigation buttons always have the right sensitivity. * e-shell-folder-title-bar.c (e_shell_folder_title_bar_update_navigation_buttons): New. (add_navigation_buttons): Remove the "Back" label. svn path=/trunk/; revision=15799 --- shell/ChangeLog | 10 ++++++++++ shell/e-shell-folder-title-bar.c | 29 ++++++++++++++++++++--------- shell/e-shell-folder-title-bar.h | 4 ++++ shell/e-shell-view.c | 16 +++++++++++++++- 4 files changed, 49 insertions(+), 10 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index eeef21d1c9..dbeb008ce4 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,13 @@ +2002-02-22 Ettore Perazzoli + + * e-shell-view.c (update_navigation_buttons): New. + (display_uri): Call it before returning so the navigation buttons + always have the right sensitivity. + + * e-shell-folder-title-bar.c + (e_shell_folder_title_bar_update_navigation_buttons): New. + (add_navigation_buttons): Remove the "Back" label. + 2002-02-22 Ettore Perazzoli * e-shell-view.c: New member `history' in `EShellViewPrivate'. diff --git a/shell/e-shell-folder-title-bar.c b/shell/e-shell-folder-title-bar.c index ef9801f6e8..7e90e9bbce 100644 --- a/shell/e-shell-folder-title-bar.c +++ b/shell/e-shell-folder-title-bar.c @@ -390,7 +390,7 @@ static void add_navigation_buttons (EShellFolderTitleBar *folder_title_bar) { EShellFolderTitleBarPrivate *priv; - GtkWidget *back_label, *back_pixmap, *back_box; + GtkWidget *back_pixmap; GtkWidget *forward_pixmap; priv = folder_title_bar->priv; @@ -399,15 +399,8 @@ add_navigation_buttons (EShellFolderTitleBar *folder_title_bar) gtk_button_set_relief (GTK_BUTTON (priv->back_button), GTK_RELIEF_NONE); GTK_WIDGET_UNSET_FLAGS (priv->back_button, GTK_CAN_FOCUS); - back_label = gtk_label_new (_("Back")); - set_title_bar_label_style (back_label); back_pixmap = create_pixmap_widget_from_xpm (left_arrow_xpm); - - back_box = gtk_hbox_new (FALSE, 2); - gtk_box_pack_start (GTK_BOX (back_box), back_pixmap, FALSE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (back_box), back_label, FALSE, TRUE, 0); - - gtk_container_add (GTK_CONTAINER (priv->back_button), back_box); + gtk_container_add (GTK_CONTAINER (priv->back_button), back_pixmap); gtk_signal_connect (GTK_OBJECT (priv->back_button), "clicked", GTK_SIGNAL_FUNC (back_button_clicked_callback), folder_title_bar); @@ -593,6 +586,7 @@ init (EShellFolderTitleBar *shell_folder_title_bar) priv->title_button_label = NULL; priv->title_button = NULL; priv->title_button_arrow = NULL; + priv->back_button = NULL; priv->forward_button = NULL; @@ -842,5 +836,22 @@ e_shell_folder_title_bar_set_title_clickable (EShellFolderTitleBar *folder_title priv->title_clickable = !! title_clickable; } + +void +e_shell_folder_title_bar_update_navigation_buttons (EShellFolderTitleBar *folder_title_bar, + gboolean can_go_back, + gboolean can_go_forward) +{ + EShellFolderTitleBarPrivate *priv; + + g_return_if_fail (folder_title_bar != NULL); + g_return_if_fail (E_IS_SHELL_FOLDER_TITLE_BAR (folder_title_bar)); + + priv = folder_title_bar->priv; + + gtk_widget_set_sensitive (priv->back_button, can_go_back); + gtk_widget_set_sensitive (priv->forward_button, can_go_forward); +} + E_MAKE_TYPE (e_shell_folder_title_bar, "EShellFolderTitleBar", EShellFolderTitleBar, class_init, init, PARENT_TYPE) diff --git a/shell/e-shell-folder-title-bar.h b/shell/e-shell-folder-title-bar.h index bbf7dc3b58..fcebeca966 100644 --- a/shell/e-shell-folder-title-bar.h +++ b/shell/e-shell-folder-title-bar.h @@ -73,6 +73,10 @@ void e_shell_folder_title_bar_set_toggle_state (EShellFolderTitleBar *fold void e_shell_folder_title_bar_set_title_clickable (EShellFolderTitleBar *folder_title_bar, gboolean clickable); +void e_shell_folder_title_bar_update_navigation_buttons (EShellFolderTitleBar *folder_title_bar, + gboolean can_go_back, + gboolean can_go_forward); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 66fedd29b1..0df938d816 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -802,7 +802,7 @@ offline_toggle_clicked_cb (GtkButton *button, } -/* More callbacks: navigation buttons handling. */ +/* Handling of the navigation buttons. */ static void back_clicked_callback (EShellFolderTitleBar *title_bar, @@ -842,6 +842,18 @@ forward_clicked_callback (EShellFolderTitleBar *title_bar, display_uri (shell_view, new_uri, FALSE); } +static void +update_navigation_buttons (EShellView *shell_view) +{ + EShellViewPrivate *priv; + + priv = shell_view->priv; + + e_shell_folder_title_bar_update_navigation_buttons (priv->folder_title_bar, + e_history_has_prev (priv->history), + e_history_has_next (priv->history)); +} + /* Widget setup. */ @@ -2108,6 +2120,8 @@ display_uri (EShellView *shell_view, if (add_to_history && retval == TRUE && priv->uri != NULL) e_history_add (priv->history, g_strdup (priv->uri)); + update_navigation_buttons (shell_view); + g_free (priv->set_folder_uri); priv->set_folder_uri = NULL; -- cgit