From 1373f7ac7325e82b6de0b83c31c1ab4eea48879a Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Sat, 23 Jun 2001 07:03:46 +0000 Subject: Get the menu hints to work with the new status bar. svn path=/trunk/; revision=10437 --- shell/ChangeLog | 15 +++++++++++++++ shell/e-shell-view.c | 47 +++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 56 insertions(+), 6 deletions(-) (limited to 'shell') diff --git a/shell/ChangeLog b/shell/ChangeLog index b4b2300a29..8c77ae36f1 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,18 @@ +2001-06-23 Ettore Perazzoli + + * e-shell-view.c: New member `menu_hint_label' in + `EShellViewPrivate'. + (init): Init to NULL. + (ui_engine_add_hint_callback): Set the label in the menu hint + label, show the menu hint label, hide the task bar. + (ui_engine_remove_hint_callback): New callback for the + "remove_hint" signal on the BonoboUIEngine; hide the hint label, + show the task bar. + (setup_statusbar_hints): Connect it. + (setup_menu_hint_label): New helper function to create the menu + hint label. + (create_status_bar): Call it. + 2001-06-23 Ettore Perazzoli * e-shell-view-menu.c (command_quit): Add a `gtk_main_quit()' at diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index d2d29c26dc..f52d7eb7c7 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -104,6 +104,7 @@ struct _EShellViewPrivate { GtkWidget *status_bar; GtkWidget *offline_toggle; GtkWidget *offline_toggle_pixmap; + GtkWidget *menu_hint_label; GtkWidget *task_bar; /* The view we have already open. */ @@ -643,11 +644,24 @@ setup_offline_toggle (EShellView *shell_view) } static void -setup_task_bar (EShellView *task_bar) +setup_menu_hint_label (EShellView *shell_view) { EShellViewPrivate *priv; - priv = task_bar->priv; + priv = shell_view->priv; + + priv->menu_hint_label = gtk_label_new (""); + gtk_misc_set_alignment (GTK_MISC (priv->menu_hint_label), 0.0, 0.5); + + gtk_box_pack_start (GTK_BOX (priv->status_bar), priv->menu_hint_label, TRUE, TRUE, 0); +} + +static void +setup_task_bar (EShellView *shell_view) +{ + EShellViewPrivate *priv; + + priv = shell_view->priv; priv->task_bar = e_task_bar_new (); @@ -668,6 +682,7 @@ create_status_bar (EShellView *shell_view) gtk_widget_show (priv->status_bar); setup_offline_toggle (shell_view); + setup_menu_hint_label (shell_view); setup_task_bar (shell_view); } @@ -676,7 +691,7 @@ create_status_bar (EShellView *shell_view) static void ui_engine_add_hint_callback (BonoboUIEngine *engine, - const char *str, + const char *hint, void *data) { EShellView *shell_view; @@ -685,22 +700,41 @@ ui_engine_add_hint_callback (BonoboUIEngine *engine, shell_view = E_SHELL_VIEW (data); priv = shell_view->priv; - g_print ("Hint -- %s\n", str); + gtk_label_set (GTK_LABEL (priv->menu_hint_label), hint); + gtk_widget_show (priv->menu_hint_label); + gtk_widget_hide (priv->task_bar); +} + +static void +ui_engine_remove_hint_callback (BonoboUIEngine *engine, + void *data) +{ + EShellView *shell_view; + EShellViewPrivate *priv; - /* FIXME: Implement me. */ + shell_view = E_SHELL_VIEW (data); + priv = shell_view->priv; + + gtk_widget_hide (priv->menu_hint_label); + gtk_widget_show (priv->task_bar); } static void setup_statusbar_hints (EShellView *shell_view) { EShellViewPrivate *priv; + BonoboUIEngine *ui_engine; priv = shell_view->priv; g_assert (priv->status_bar != NULL); - gtk_signal_connect (GTK_OBJECT (bonobo_window_get_ui_engine (BONOBO_WINDOW (shell_view))), "add_hint", + ui_engine = bonobo_window_get_ui_engine (BONOBO_WINDOW (shell_view)); + + gtk_signal_connect (GTK_OBJECT (ui_engine), "add_hint", GTK_SIGNAL_FUNC (ui_engine_add_hint_callback), shell_view); + gtk_signal_connect (GTK_OBJECT (ui_engine), "remove_hint", + GTK_SIGNAL_FUNC (ui_engine_remove_hint_callback), shell_view); } @@ -959,6 +993,7 @@ init (EShellView *shell_view) priv->status_bar = NULL; priv->offline_toggle = NULL; priv->offline_toggle_pixmap = NULL; + priv->menu_hint_label = NULL; priv->task_bar = NULL; priv->shortcut_bar_mode = E_SHELL_VIEW_SUBWINDOW_HIDDEN; -- cgit v1.2.3