diff options
author | Federico Mena Quintero <federico@ximian.com> | 2001-06-02 07:28:13 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2001-06-02 07:28:13 +0800 |
commit | 06ebf6a67ec10e399ad041f666deb497924803cd (patch) | |
tree | 3cd99ba59389d6ef73fb0e318982fa22dad3ff6f /mail/folder-browser-factory.c | |
parent | 338203f38e6841318c76dd6d330e223489e8e5ad (diff) | |
download | gsoc2013-evolution-06ebf6a67ec10e399ad041f666deb497924803cd.tar.gz gsoc2013-evolution-06ebf6a67ec10e399ad041f666deb497924803cd.tar.zst gsoc2013-evolution-06ebf6a67ec10e399ad041f666deb497924803cd.zip |
Added fields for the GalViewMenus and GalViewCollection, since we need to
2001-06-01 Federico Mena Quintero <federico@ximian.com>
* folder-browser.h (FolderBrowser): Added fields for the
GalViewMenus and GalViewCollection, since we need to keep them
around while the component is active.
* folder-browser-factory.c (folder_browser_setup_view_menus): Plug
leaks; unref the spec and factory. Set the view collection and
the view menus on the FolderBrowser object.
(folder_browser_discard_view_menus): New function.
(control_deactivate): Discard the menus.
* folder-browser.c (folder_browser_destroy): Destroy the view
collection and the view menus.
svn path=/trunk/; revision=10086
Diffstat (limited to 'mail/folder-browser-factory.c')
-rw-r--r-- | mail/folder-browser-factory.c | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index e9bd4adc87..c8964babc1 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -151,18 +151,18 @@ static void folder_browser_setup_view_menus (FolderBrowser *fb, BonoboUIComponent *uic) { - GalViewCollection *collection; - GalViewMenus *views; GalViewFactory *factory; ETableSpecification *spec; char *local_dir; - collection = gal_view_collection_new(); - /* FIXME: Memory leak. */ + g_assert (fb->view_collection == NULL); + g_assert (fb->view_menus == NULL); + + fb->view_collection = gal_view_collection_new(); + local_dir = gnome_util_prepend_user_home ("/evolution/views/mail/"); - gal_view_collection_set_storage_directories( - collection, + fb->view_collection, EVOLUTION_DATADIR "/evolution/views/mail/", local_dir); g_free (local_dir); @@ -170,19 +170,31 @@ folder_browser_setup_view_menus (FolderBrowser *fb, spec = e_table_specification_new(); e_table_specification_load_from_file(spec, EVOLUTION_ETSPECDIR "/message-list.etspec"); - factory = gal_view_factory_etable_new(spec); - gal_view_collection_add_factory(collection, factory); - gtk_object_sink(GTK_OBJECT(factory)); + factory = gal_view_factory_etable_new (spec); + gtk_object_unref (GTK_OBJECT (spec)); + gal_view_collection_add_factory (fb->view_collection, factory); + gtk_object_unref (GTK_OBJECT (factory)); - gal_view_collection_load(collection); + gal_view_collection_load(fb->view_collection); - views = gal_view_menus_new(collection); - gal_view_menus_apply(views, uic, NULL); /* This function probably needs to sink the views object. */ - gtk_signal_connect(GTK_OBJECT(collection), "display_view", + fb->view_menus = gal_view_menus_new(fb->view_collection); + gal_view_menus_apply(fb->view_menus, uic, NULL); + gtk_signal_connect(GTK_OBJECT(fb->view_collection), "display_view", display_view, fb); - /* gtk_object_sink(GTK_OBJECT(views)); */ +} - gtk_object_sink(GTK_OBJECT(collection)); +/* Gets rid of the view collection and view menus objects */ +static void +folder_browser_discard_view_menus (FolderBrowser *fb) +{ + g_assert (fb->view_collection != NULL); + g_assert (fb->view_menus != NULL); + + gtk_object_unref (GTK_OBJECT (fb->view_collection)); + fb->view_collection = NULL; + + gtk_object_unref (GTK_OBJECT (fb->view_menus)); + fb->view_menus = NULL; } static void @@ -293,6 +305,8 @@ control_deactivate (BonoboControl *control, if (fb->folder) mail_sync_folder (fb->folder, NULL, NULL); + + folder_browser_discard_view_menus (fb); } static void |