diff options
author | Rodrigo Moya <rodrigo@novell.com> | 2005-01-29 00:29:54 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2005-01-29 00:29:54 +0800 |
commit | 7877fcf7ae556864b8d9962e5a6927c2e9f7e434 (patch) | |
tree | cac3a81916a885143d006dd7e636d2b125835735 /calendar/gui/e-tasks.c | |
parent | 4135d44dec7eb285b62e09779462dc971b93b29d (diff) | |
download | gsoc2013-evolution-7877fcf7ae556864b8d9962e5a6927c2e9f7e434.tar.gz gsoc2013-evolution-7877fcf7ae556864b8d9962e5a6927c2e9f7e434.tar.zst gsoc2013-evolution-7877fcf7ae556864b8d9962e5a6927c2e9f7e434.zip |
Fixes #33078
2005-01-28 Rodrigo Moya <rodrigo@novell.com>
Fixes #33078
* gui/gnome-cal.c: deal now with categories entirely here, no more
"categories_changed" signal from the backends.
(free_categories, add_categories, append_category_cb,
client_categories_changed_cb, copy_categories): removed.
(gnome_calendar_add_source): don't connect to removed signal.
(gnome_calendar_destroy): destroy the config listener.
(gnome_calendar_init): create a listener for the categories list
GConf key.
(config_categories_changed_cb): callback for configuration changes
in category list.
(setup_widgets): initialize the search bar with categories from
the configuration.
* gui/e-tasks.c (client_categories_changed_cb, e_tasks_add_todo_source,
e_tasks_init, config_categories_changed_cb, e_tasks_destroy,
setup_widgets): same as gnome-cal.c.
svn path=/trunk/; revision=28599
Diffstat (limited to 'calendar/gui/e-tasks.c')
-rw-r--r-- | calendar/gui/e-tasks.c | 53 |
1 files changed, 39 insertions, 14 deletions
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c index 2a536a1c6c..9ca424f44a 100644 --- a/calendar/gui/e-tasks.c +++ b/calendar/gui/e-tasks.c @@ -35,6 +35,7 @@ #include "widgets/misc/e-error.h" #include "e-util/e-categories-config.h" +#include "e-util/e-config-listener.h" #include "e-util/e-time-utils.h" #include "shell/e-user-creatable-items-handler.h" #include <libedataserver/e-url.h> @@ -64,6 +65,8 @@ struct _ETasksPrivate { ECalView *query; + EConfigListener *config_listener; + /* The ECalendarTable showing the tasks. */ GtkWidget *tasks_view; ECalendarTableConfig *tasks_view_config; @@ -469,6 +472,7 @@ setup_widgets (ETasks *tasks) G_CALLBACK (search_bar_sexp_changed_cb), tasks); g_signal_connect (priv->search_bar, "category_changed", G_CALLBACK (search_bar_category_changed_cb), tasks); + config_categories_changed_cb (priv->config_listener, "/apps/evolution/general//category_master_list", tasks); gtk_table_attach (GTK_TABLE (tasks), priv->search_bar, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0, 0); @@ -582,6 +586,29 @@ e_tasks_class_init (ETasksClass *class) } +static void +config_categories_changed_cb (EConfigListener *config_listener, const char *key, gpointer user_data) +{ + GList *cat_list; + GPtrArray *cat_array; + ETasksPrivate *priv; + ETasks *tasks = user_data; + + priv = tasks->priv; + + cat_array = g_ptr_array_new (); + cat_list = e_categories_get_list (); + while (cat_list != NULL) { + if (e_categories_is_searchable ((const char *) cat_list->data)) + g_ptr_array_add (cat_array, cat_list->data); + cat_list = g_list_remove (cat_list, cat_list->data); + } + + cal_search_bar_set_categories (priv->search_bar, cat_array); + + g_ptr_array_free (cat_array, TRUE); +} + /* Object initialization function for the gnome calendar */ static void e_tasks_init (ETasks *tasks) @@ -591,6 +618,9 @@ e_tasks_init (ETasks *tasks) priv = g_new0 (ETasksPrivate, 1); tasks->priv = priv; + priv->config_listener = e_config_listener_new (); + g_signal_connect (priv->config_listener, "key_changed", G_CALLBACK (config_categories_changed_cb), tasks); + setup_config (tasks); setup_widgets (tasks); @@ -604,19 +634,6 @@ e_tasks_init (ETasks *tasks) update_view (tasks); } -/* Callback used when the set of categories changes in the calendar client */ -static void -client_categories_changed_cb (ECal *client, GPtrArray *categories, gpointer data) -{ - ETasks *tasks; - ETasksPrivate *priv; - - tasks = E_TASKS (data); - priv = tasks->priv; - - cal_search_bar_set_categories (CAL_SEARCH_BAR (priv->search_bar), categories); -} - GtkWidget * e_tasks_new (void) { @@ -654,6 +671,15 @@ e_tasks_destroy (GtkObject *object) if (priv) { GList *l; + /* unset the config listener */ + if (priv->config_listener) { + g_signal_disconnect_matched (priv->config_listener, + G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, tasks); + g_object_unref (priv->config_listener); + priv->config_listener = NULL; + } + /* disconnect from signals on all the clients */ for (l = priv->clients_list; l != NULL; l = l->next) { g_signal_handlers_disconnect_matched (l->data, G_SIGNAL_MATCH_DATA, @@ -947,7 +973,6 @@ e_tasks_add_todo_source (ETasks *tasks, ESource *source) } g_signal_connect (G_OBJECT (client), "backend_error", G_CALLBACK (backend_error_cb), tasks); - g_signal_connect (G_OBJECT (client), "categories_changed", G_CALLBACK (client_categories_changed_cb), tasks); g_signal_connect (G_OBJECT (client), "backend_died", G_CALLBACK (backend_died_cb), tasks); /* add the client to internal structure */ |