diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | mail/ChangeLog | 5 | ||||
-rw-r--r-- | mail/folder-browser-factory.c | 93 | ||||
-rw-r--r-- | shell/e-shell-view.c | 30 |
4 files changed, 107 insertions, 28 deletions
@@ -1,3 +1,10 @@ +2000-03-29 Dan Winship <danw@helixcode.com> + + * shell/e-shell-view.c (e_shell_view_set_view): Call + bonobo_control_frame_activate on the folder_view every time it + is displayed, and bonobo_control_frame_deactivate every time it is + hidden. + 2000-03-29 Christopher James Lahey <clahey@helixcode.com> * addressbook/backend/ebook/e-card-cursor.c: Fixed management of diff --git a/mail/ChangeLog b/mail/ChangeLog index 1c5721af0c..100c10122f 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2000-03-29 Dan Winship <danw@helixcode.com> + + * folder-browser-factory.c (control_activate): build a toolbar. + (control_deactivate): and hide it. + 2000-03-27 Chris Toshok <toshok@helixcode.com> * mail-display.c: quiet warnings when building in ../po diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index 3dd7a1eafd..9a33b407fe 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -133,33 +133,95 @@ msg_composer_cb (BonoboUIHandler *uih, void *user_data, const char *path) gtk_widget_show (composer); } +static void +check_cb (BonoboUIHandler *uih, void *user_data, const char *path) +{ + printf ("Yow! I am called back!\n"); +} -static void -control_add_menu (BonoboControl *control) + +static void +control_activate (BonoboControl *control, BonoboUIHandler *uih) { Bonobo_UIHandler remote_uih; - BonoboUIHandler *uih; + GtkWidget *toolbar; - uih = bonobo_control_get_ui_handler (control); - g_assert (uih); - remote_uih = bonobo_control_get_remote_ui_handler (control); bonobo_ui_handler_set_container (uih, remote_uih); - - bonobo_ui_handler_menu_new_item (uih, - "/File/New", N_("_Mail"), NULL, -1, - BONOBO_UI_HANDLER_PIXMAP_NONE, NULL, 0, 0, - msg_composer_cb, NULL); - + + bonobo_ui_handler_menu_new_item (uih, "/File/Mail", N_("_Mail"), + NULL, -1, + BONOBO_UI_HANDLER_PIXMAP_NONE, NULL, + 0, 0, msg_composer_cb, NULL); + + toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, + GTK_TOOLBAR_BOTH); + + gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), "New mail", + "Check for new mail", NULL, + gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_MAIL_RCV), + check_cb, NULL); + gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), "Send", + "Send a new message", NULL, + gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_MAIL_SND), + check_cb, NULL); + gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), "Find", + "Find messages", NULL, + gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_SEARCH), + check_cb, NULL); + gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); + gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), "Reply", + "Reply to the sender of this message", NULL, + gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_MAIL_RPL), + check_cb, NULL); + gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), "Reply to All", + "Reply to all recipients of this message", NULL, + gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_MAIL_RPL), + check_cb, NULL); + gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), "Forward", + "Forward this message", NULL, + gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_MAIL_FWD), + check_cb, NULL); + gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); + gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), "Print", + "Print the selected message", NULL, + gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_PRINT), + check_cb, NULL); + gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), "Delete", + "Delete this message", NULL, + gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_TRASH), + check_cb, NULL); + gtk_widget_show_all (toolbar); + + bonobo_ui_handler_dock_add (uih, "/Toolbar", + bonobo_object_corba_objref (bonobo_control_new (toolbar)), + GNOME_DOCK_ITEM_BEH_LOCKED | + GNOME_DOCK_ITEM_BEH_EXCLUSIVE, + GNOME_DOCK_TOP, + 1, 1, 0); } +static void +control_deactivate (BonoboControl *control, BonoboUIHandler *uih) +{ + bonobo_ui_handler_menu_remove (uih, "/File/Mail"); + bonobo_ui_handler_dock_remove (uih, "/Toolbar"); +} static void control_activate_cb (BonoboControl *control, gboolean activate, gpointer user_data) { - control_add_menu (control); + BonoboUIHandler *uih; + + uih = bonobo_control_get_ui_handler (control); + g_assert (uih); + + if (activate) + control_activate (control, uih); + else + control_deactivate (control, uih); } @@ -198,9 +260,8 @@ folder_browser_factory (BonoboGenericFactory *factory, void *closure) return NULL; } - gtk_signal_connect (GTK_OBJECT (control), "activate", control_activate_cb, NULL); - - + gtk_signal_connect (GTK_OBJECT (control), "activate", + control_activate_cb, NULL); bonobo_control_set_property_bag (control, diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index b4558c023b..2061c9b329 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -173,23 +173,30 @@ get_view (EShellView *eshell_view, EFolder *efolder, Bonobo_UIHandler uih) void e_shell_view_set_view (EShellView *eshell_view, EFolder *efolder) { - GtkWidget *notebook = eshell_view->priv->notebook; + GtkNotebook *notebook = GTK_NOTEBOOK (eshell_view->priv->notebook); GtkWidget *folder_view = g_hash_table_lookup ( eshell_view->priv->folder_views, efolder); + int current_page = gtk_notebook_get_current_page (notebook); g_assert (eshell_view); g_assert (efolder); + if (current_page != -1) { + GtkWidget *current; + + current = gtk_notebook_get_nth_page (notebook, current_page); + bonobo_control_frame_control_deactivate (bonobo_widget_get_control_frame (BONOBO_WIDGET (current))); + } + /* if we found a notebook page in our hash, that represents this efolder, switch to it */ if (folder_view) { - - int notebook_page = gtk_notebook_page_num ( - GTK_NOTEBOOK(notebook), - folder_view); + int notebook_page = gtk_notebook_page_num (notebook, + folder_view); g_assert (notebook_page != -1); - gtk_notebook_set_page (GTK_NOTEBOOK (notebook), notebook_page); + gtk_notebook_set_page (notebook, notebook_page); + bonobo_control_frame_control_activate (bonobo_widget_get_control_frame (BONOBO_WIDGET (folder_view))); } else { /* get a new control that represents this efolder, @@ -197,21 +204,20 @@ e_shell_view_set_view (EShellView *eshell_view, EFolder *efolder) Bonobo_UIHandler uih = bonobo_object_corba_objref ( BONOBO_OBJECT (eshell_view->uih)); - + GtkWidget *w = get_view (eshell_view, efolder, uih); int new_page_index; if (!w) return; - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), w, NULL); + gtk_notebook_append_page (notebook, w, NULL); - new_page_index = gtk_notebook_page_num ( - GTK_NOTEBOOK(notebook), - folder_view); + new_page_index = gtk_notebook_page_num (notebook, + folder_view); g_hash_table_insert (eshell_view->priv->folder_views, efolder, w); - gtk_notebook_set_page (GTK_NOTEBOOK (notebook),new_page_index); + gtk_notebook_set_page (notebook, new_page_index); } } |