aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2008-04-30 19:01:58 +0800
committerMilan Crha <mcrha@src.gnome.org>2008-04-30 19:01:58 +0800
commitbe98f84cbdf8536fe980e3b4216085003fcbce1e (patch)
tree2a203dec03b08d1fb299dca8a58ef96535471c5d
parent929ac5c61d7b300155ad9e73cfd3159934764314 (diff)
downloadgsoc2013-evolution-be98f84cbdf8536fe980e3b4216085003fcbce1e.tar
gsoc2013-evolution-be98f84cbdf8536fe980e3b4216085003fcbce1e.tar.gz
gsoc2013-evolution-be98f84cbdf8536fe980e3b4216085003fcbce1e.tar.bz2
gsoc2013-evolution-be98f84cbdf8536fe980e3b4216085003fcbce1e.tar.lz
gsoc2013-evolution-be98f84cbdf8536fe980e3b4216085003fcbce1e.tar.xz
gsoc2013-evolution-be98f84cbdf8536fe980e3b4216085003fcbce1e.tar.zst
gsoc2013-evolution-be98f84cbdf8536fe980e3b4216085003fcbce1e.zip
** Fix for bug #316390
2008-04-30 Milan Crha <mcrha@redhat.com> ** Fix for bug #316390 * addressbook/gui/widgets/e-addressbook-view.c: (categories_changed_cb), (get_master_list), (eab_view_dispose), (eab_view_new), (search_activated), (make_suboptions): Listen for changes in categories setup and propagate them to UI. * calendar/gui/e-memos.c: (struct _EMemosPrivate), (categories_changed_cb), (setup_widgets), (e_memos_init), (e_memos_destroy): * calendar/gui/gnome-cal.c: (struct _GnomeCalendarPrivate), (setup_widgets), (categories_changed_cb), (gnome_calendar_init), (gnome_calendar_destroy): * calendar/gui/e-tasks.c: (struct _ETasksPrivate), (categories_changed_cb), (setup_widgets), (e_tasks_init), (e_tasks_destroy): Listen for changes in categories setup and propagate them to UI. Note: be sure you've eds revision 8718 or better svn path=/trunk/; revision=35458
-rw-r--r--addressbook/ChangeLog9
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c25
-rw-r--r--calendar/ChangeLog13
-rw-r--r--calendar/gui/e-memos.c40
-rw-r--r--calendar/gui/e-tasks.c21
-rw-r--r--calendar/gui/gnome-cal.c19
6 files changed, 57 insertions, 70 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 0479225d2d..fada560f7b 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,12 @@
+2008-04-30 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #316390
+
+ * gui/widgets/e-addressbook-view.c: (categories_changed_cb),
+ (get_master_list), (eab_view_dispose), (eab_view_new),
+ (search_activated), (make_suboptions):
+ Listen for changes in categories setup and propagate them to UI.
+
2008-04-28 Matthew Barnes <mbarnes@redhat.com>
** Fixes bug #529768
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 8c659f58c0..98576a9c2f 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -102,11 +102,12 @@ static void selection_get (GtkWidget *invisible, GtkSelectionData *selection_dat
guint info, guint time_stamp, EABView *view);
static void invisible_destroyed (gpointer data, GObject *where_object_was);
+static void categories_changed_cb (gpointer object, gpointer user_data);
static void make_suboptions (EABView *view);
static void query_changed (ESearchBar *esb, EABView *view);
static void search_activated (ESearchBar *esb, EABView *view);
static void search_menu_activated (ESearchBar *esb, int id, EABView *view);
-static GList *get_master_list (void);
+static GList *get_master_list (gboolean force_rebuild);
#define PARENT_TYPE GTK_TYPE_VBOX
static GtkVBoxClass *parent_class = NULL;
@@ -315,6 +316,8 @@ eab_view_dispose (GObject *object)
{
EABView *eav = EAB_VIEW(object);
+ e_categories_unregister_change_listener (G_CALLBACK (categories_changed_cb), eav);
+
if (eav->model) {
g_signal_handlers_disconnect_matched (eav->model,
G_SIGNAL_MATCH_DATA,
@@ -476,6 +479,8 @@ eab_view_new (void)
gtk_widget_show (GTK_WIDGET (eav->search));
make_suboptions (eav);
+ e_categories_register_change_listener (G_CALLBACK (categories_changed_cb), eav);
+
g_signal_connect (eav->search, "query_changed",
G_CALLBACK (query_changed), eav);
g_signal_connect (eav->search, "search_activated",
@@ -1403,7 +1408,7 @@ search_activated (ESearchBar *esb, EABView *v)
subid = e_search_bar_get_viewitem_id (esb);
if (subid) {
- master_list = get_master_list ();
+ master_list = get_master_list (FALSE);
category_name = g_list_nth_data (master_list, subid-1);
view_sexp = g_strdup_printf ("(is \"category_list\" \"%s\")", category_name);
search_query = g_strconcat ("(and ", view_sexp, search_query, ")", NULL);
@@ -1496,6 +1501,13 @@ generate_viewoption_menu (EABSearchBarItem *subitems)
}
static void
+categories_changed_cb (gpointer object, gpointer user_data)
+{
+ get_master_list (TRUE);
+ make_suboptions (user_data);
+}
+
+static void
make_suboptions (EABView *view)
{
EABSearchBarItem *subitems, *s;
@@ -1503,7 +1515,7 @@ make_suboptions (EABView *view)
gint i, N;
GtkWidget *menu;
- master_list = get_master_list ();
+ master_list = get_master_list (FALSE);
N = g_list_length (master_list);
subitems = g_new (EABSearchBarItem, N+2);
@@ -1534,10 +1546,15 @@ make_suboptions (EABView *view)
}
static GList *
-get_master_list (void)
+get_master_list (gboolean force_rebuild)
{
static GList *category_list = NULL;
+ if (force_rebuild) {
+ g_list_free (category_list);
+ category_list = NULL;
+ }
+
if (category_list == NULL) {
GList *l, *p = e_categories_get_list ();
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index fb81e8c1a8..c43975dcbe 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,16 @@
+2008-04-30 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #316390
+
+ * calendar/gui/e-memos.c: (struct _EMemosPrivate), (categories_changed_cb),
+ (setup_widgets), (e_memos_init), (e_memos_destroy):
+ * calendar/gui/gnome-cal.c: (struct _GnomeCalendarPrivate), (setup_widgets),
+ (categories_changed_cb), (gnome_calendar_init),
+ (gnome_calendar_destroy):
+ * calendar/gui/e-tasks.c: (struct _ETasksPrivate), (categories_changed_cb),
+ (setup_widgets), (e_tasks_init), (e_tasks_destroy):
+ Listen for changes in categories setup and propagate them to UI.
+
2008-04-30 Srinivasa Ragavan <sragavan@novell.com>
** Fix for bnc #363908
diff --git a/calendar/gui/e-memos.c b/calendar/gui/e-memos.c
index 08ce5f84c8..019cf2ddaa 100644
--- a/calendar/gui/e-memos.c
+++ b/calendar/gui/e-memos.c
@@ -38,7 +38,6 @@
#include "e-util/e-error.h"
#include "e-util/e-categories-config.h"
-#include "e-util/e-config-listener.h"
#include "e-util/e-util-private.h"
#include "shell/e-user-creatable-items-handler.h"
#include <libecal/e-cal-time-util.h>
@@ -68,8 +67,6 @@ struct _EMemosPrivate {
ECalView *query;
- EConfigListener *config_listener;
-
/* The EMemoTable showing the memos. */
GtkWidget *memos_view;
EMemoTableConfig *memos_view_config;
@@ -97,7 +94,7 @@ static void setup_widgets (EMemos *memos);
static void e_memos_destroy (GtkObject *object);
static void update_view (EMemos *memos);
-static void config_categories_changed_cb (EConfigListener *config_listener, const char *key, gpointer user_data);
+static void categories_changed_cb (gpointer object, gpointer user_data);
static void backend_error_cb (ECal *client, const char *message, gpointer data);
/* Signal IDs */
@@ -499,8 +496,7 @@ setup_widgets (EMemos *memos)
g_signal_connect (priv->search_bar, "category_changed",
G_CALLBACK (search_bar_category_changed_cb), memos);
- /* TODO Why doesn't this work?? */
- config_categories_changed_cb (priv->config_listener, "/apps/evolution/general/category_master_list", memos);
+ categories_changed_cb (NULL, memos);
gtk_table_attach (GTK_TABLE (memos), priv->search_bar, 0, 1, 0, 1,
GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0, 0);
@@ -601,7 +597,7 @@ e_memos_class_init (EMemosClass *klass)
static void
-config_categories_changed_cb (EConfigListener *config_listener, const char *key, gpointer user_data)
+categories_changed_cb (gpointer object, gpointer user_data)
{
GList *cat_list;
GPtrArray *cat_array;
@@ -635,8 +631,7 @@ e_memos_init (EMemos *memos)
setup_config (memos);
setup_widgets (memos);
- priv->config_listener = e_config_listener_new ();
- g_signal_connect (priv->config_listener, "key_changed", G_CALLBACK (config_categories_changed_cb), memos);
+ e_categories_register_change_listener (G_CALLBACK (categories_changed_cb), memos);
priv->clients = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
priv->query = NULL;
@@ -648,23 +643,6 @@ e_memos_init (EMemos *memos)
update_view (memos);
}
-/* Callback used when the set of categories changes in the calendar client */
-/* TODO this was actually taken out of tasks in 2.3.x
- * config_categories doesn't work, but this may - trying with memos*/
-/*
-static void
-client_categories_changed_cb (ECal *client, GPtrArray *categories, gpointer data)
-{
- EMemos *memos;
- EMemosPrivate *priv;
-
- memos = E_MEMOS (data);
- priv = memos->priv;
-
- cal_search_bar_set_categories (CAL_SEARCH_BAR (priv->search_bar), categories);
-}
-*/
-
GtkWidget *
e_memos_new (void)
{
@@ -702,14 +680,7 @@ e_memos_destroy (GtkObject *object)
if (priv) {
GList *l;
- /* unset the config listener */
- if (priv->config_listener) {
- g_signal_handlers_disconnect_matched (priv->config_listener,
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, memos);
- g_object_unref (priv->config_listener);
- priv->config_listener = NULL;
- }
+ e_categories_unregister_change_listener (G_CALLBACK (categories_changed_cb), memos);
/* disconnect from signals on all the clients */
for (l = priv->clients_list; l != NULL; l = l->next) {
@@ -979,7 +950,6 @@ e_memos_add_memo_source (EMemos *memos, ESource *source)
}
g_signal_connect (G_OBJECT (client), "backend_error", G_CALLBACK (backend_error_cb), memos);
-/* g_signal_connect (G_OBJECT (client), "categories_changed", G_CALLBACK (client_categories_changed_cb), memos); */
g_signal_connect (G_OBJECT (client), "backend_died", G_CALLBACK (backend_died_cb), memos);
/* add the client to internal structure */
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index 7e55b99d20..eae255bd88 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -36,7 +36,6 @@
#include "e-util/e-error.h"
#include "e-util/e-categories-config.h"
-#include "e-util/e-config-listener.h"
#include "e-util/e-util-private.h"
#include "shell/e-user-creatable-items-handler.h"
#include <libedataserver/e-url.h>
@@ -69,8 +68,6 @@ struct _ETasksPrivate {
ECalView *query;
- EConfigListener *config_listener;
-
/* The ECalendarTable showing the tasks. */
GtkWidget *tasks_view;
ECalendarTableConfig *tasks_view_config;
@@ -102,7 +99,7 @@ static void setup_widgets (ETasks *tasks);
static void e_tasks_destroy (GtkObject *object);
static void update_view (ETasks *tasks);
-static void config_categories_changed_cb (EConfigListener *config_listener, const char *key, gpointer user_data);
+static void categories_changed_cb (gpointer object, gpointer user_data);
static void backend_error_cb (ECal *client, const char *message, gpointer data);
/* Signal IDs */
@@ -620,7 +617,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);
+ categories_changed_cb (NULL, tasks);
gtk_table_attach (GTK_TABLE (tasks), priv->search_bar, 0, 1, 0, 1,
GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0, 0);
@@ -744,7 +741,7 @@ e_tasks_class_init (ETasksClass *class)
static void
-config_categories_changed_cb (EConfigListener *config_listener, const char *key, gpointer user_data)
+categories_changed_cb (gpointer object, gpointer user_data)
{
GList *cat_list;
GPtrArray *cat_array;
@@ -775,8 +772,7 @@ 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);
+ e_categories_register_change_listener (G_CALLBACK (categories_changed_cb), tasks);
setup_config (tasks);
setup_widgets (tasks);
@@ -829,14 +825,7 @@ e_tasks_destroy (GtkObject *object)
if (priv) {
GList *l;
- /* unset the config listener */
- if (priv->config_listener) {
- g_signal_handlers_disconnect_matched (priv->config_listener,
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, tasks);
- g_object_unref (priv->config_listener);
- priv->config_listener = NULL;
- }
+ e_categories_unregister_change_listener (G_CALLBACK (categories_changed_cb), tasks);
/* disconnect from signals on all the clients */
for (l = priv->clients_list; l != NULL; l = l->next) {
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 5108164c98..dfa066d0ba 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -45,7 +45,6 @@
#include <libedataserver/e-url.h>
#include <libedataserverui/e-passwords.h>
-#include "e-util/e-config-listener.h"
#include "shell/e-user-creatable-items-handler.h"
#include <libecal/e-cal-time-util.h>
#include <widgets/menus/gal-view-factory-etable.h>
@@ -103,8 +102,6 @@ struct _GnomeCalendarPrivate {
GList *clients_list[E_CAL_SOURCE_TYPE_LAST];
ECal *default_client[E_CAL_SOURCE_TYPE_LAST];
- EConfigListener *config_listener;
-
/*
* Fields for the calendar view
*/
@@ -1440,7 +1437,7 @@ month_view_adjustment_changed_cb (GtkAdjustment *adjustment, GnomeCalendar *gcal
}
static void
-config_categories_changed_cb (EConfigListener *config_listener, const char *key, gpointer user_data)
+categories_changed_cb (gpointer object, gpointer user_data)
{
GList *cat_list;
GPtrArray *cat_array;
@@ -1515,7 +1512,7 @@ setup_widgets (GnomeCalendar *gcal)
G_CALLBACK (search_bar_sexp_changed_cb), gcal);
g_signal_connect (priv->search_bar, "category_changed",
G_CALLBACK (search_bar_category_changed_cb), gcal);
- config_categories_changed_cb (priv->config_listener, "/apps/evolution/general/category_master_list", gcal);
+ categories_changed_cb (NULL, gcal);
gtk_widget_show (priv->search_bar);
gtk_box_pack_start (GTK_BOX (gcal), priv->search_bar, FALSE, FALSE, 6);
@@ -1751,8 +1748,7 @@ gnome_calendar_init (GnomeCalendar *gcal)
for (i = 0; i < E_CAL_SOURCE_TYPE_LAST; i++)
priv->clients[i] = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
- priv->config_listener = e_config_listener_new ();
- g_signal_connect (priv->config_listener, "key_changed", G_CALLBACK (config_categories_changed_cb), gcal);
+ e_categories_register_change_listener (G_CALLBACK (categories_changed_cb), gcal);
priv->current_view_type = GNOME_CAL_DAY_VIEW;
priv->range_selected = FALSE;
@@ -1796,14 +1792,7 @@ gnome_calendar_destroy (GtkObject *object)
GList *l;
int i;
- /* unset the config listener */
- if (priv->config_listener) {
- g_signal_handlers_disconnect_matched (priv->config_listener,
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, gcal);
- g_object_unref (priv->config_listener);
- priv->config_listener = NULL;
- }
+ e_categories_unregister_change_listener (G_CALLBACK (categories_changed_cb), gcal);
/* Clean up the clients */
for (i = 0; i < E_CAL_SOURCE_TYPE_LAST; i++) {