From 88b0244b327a951ea96687aaab1ed51439c23976 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Sat, 10 Jun 2000 01:52:51 +0000 Subject: Add a serial number to FolderBrowser. * folder-browser.c (folder_browser_new): Add a serial number to FolderBrowser. * folder-browser-factory.c (control_activate, control_deactivate): Include fb serial number in the name of the Bonobo toolbar to prevent problems with disappearing toolbars. This is a kludge and should go away. svn path=/trunk/; revision=3501 --- mail/ChangeLog | 9 +++++++++ mail/folder-browser-factory.c | 25 ++++++++++++++++--------- mail/folder-browser.c | 2 ++ mail/folder-browser.h | 3 +++ 4 files changed, 30 insertions(+), 9 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index de54836c95..555a156f2a 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,14 @@ 2000-06-09 Dan Winship + * folder-browser.c (folder_browser_new): Add a serial number to + FolderBrowser. + + * folder-browser-factory.c (control_activate, control_deactivate): + Include fb serial number in the name of the Bonobo toolbar to + prevent problems with disappearing toolbars. This is a kludge and + should go away. + + * mail-ops.c (expunge_folder): display error from camel_folder_expunge if there is one. diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index d4629d6e17..540119d3fd 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -24,7 +24,7 @@ #else #define CONTROL_FACTORY_ID "control-factory:evolution-mail" #endif - + static void random_cb (GtkWidget *button, gpointer user_data) { @@ -53,11 +53,13 @@ static GnomeUIInfo gnome_toolbar [] = { }; static void -control_activate (BonoboControl *control, BonoboUIHandler *uih) +control_activate (BonoboControl *control, BonoboUIHandler *uih, + FolderBrowser *fb) { Bonobo_UIHandler remote_uih; BonoboControl *toolbar_control; GtkWidget *toolbar, *toolbar_frame, *folder_browser; + char *toolbar_name = g_strdup_printf ("/Toolbar%d", fb->serial); remote_uih = bonobo_control_get_remote_ui_handler (control); bonobo_ui_handler_set_container (uih, remote_uih); @@ -111,23 +113,28 @@ control_activate (BonoboControl *control, BonoboUIHandler *uih) gtk_widget_show_all (toolbar_frame); toolbar_control = bonobo_control_new (toolbar_frame); - bonobo_ui_handler_dock_add (uih, "/Toolbar", + bonobo_ui_handler_dock_add (uih, toolbar_name, bonobo_object_corba_objref (BONOBO_OBJECT (toolbar_control)), GNOME_DOCK_ITEM_BEH_EXCLUSIVE | GNOME_DOCK_ITEM_BEH_NEVER_VERTICAL, GNOME_DOCK_TOP, 1, 1, 0); + g_free (toolbar_name); } static void -control_deactivate (BonoboControl *control, BonoboUIHandler *uih) +control_deactivate (BonoboControl *control, BonoboUIHandler *uih, + FolderBrowser *fb) { + char *toolbar_name = g_strdup_printf ("/Toolbar%d", fb->serial); + bonobo_ui_handler_menu_remove (uih, "/File/Mail"); bonobo_ui_handler_menu_remove (uih, "/Tools/Expunge"); bonobo_ui_handler_menu_remove (uih, "/Tools/Filter Druid ..."); bonobo_ui_handler_menu_remove (uih, "/Tools/Virtual Folder Druid ..."); bonobo_ui_handler_menu_remove (uih, "/Tools/Mail Configuration ..."); bonobo_ui_handler_menu_remove (uih, "/Tools/Forget Passwords"); - bonobo_ui_handler_dock_remove (uih, "/Toolbar"); + bonobo_ui_handler_dock_remove (uih, toolbar_name); + g_free (toolbar_name); } static void @@ -139,11 +146,11 @@ control_activate_cb (BonoboControl *control, uih = bonobo_control_get_ui_handler (control); g_assert (uih); - + if (activate) - control_activate (control, uih); + control_activate (control, uih, user_data); else - control_deactivate (control, uih); + control_deactivate (control, uih, user_data); } static void @@ -175,7 +182,7 @@ folder_browser_factory_new_control (void) } gtk_signal_connect (GTK_OBJECT (control), "activate", - control_activate_cb, NULL); + control_activate_cb, folder_browser); gtk_signal_connect (GTK_OBJECT (control), "destroy", control_destroy_cb, folder_browser); diff --git a/mail/folder-browser.c b/mail/folder-browser.c index da8184993c..efb1deaa9e 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -446,10 +446,12 @@ my_folder_browser_init (GtkObject *object) GtkWidget * folder_browser_new (void) { + static int serial; FolderBrowser *folder_browser = gtk_type_new (folder_browser_get_type ()); my_folder_browser_init (GTK_OBJECT (folder_browser)); folder_browser->uri = NULL; + folder_browser->serial = serial++; return GTK_WIDGET (folder_browser); } diff --git a/mail/folder-browser.h b/mail/folder-browser.h index 6e9c66a0cd..f601d2cb2c 100644 --- a/mail/folder-browser.h +++ b/mail/folder-browser.h @@ -27,6 +27,9 @@ struct _FolderBrowser { Evolution_Shell shell; + /* This is a kludge for the toolbar problem. */ + int serial; + /* * The current URI being displayed by the FolderBrowser */ -- cgit