aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
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 /addressbook
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
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog9
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c25
2 files changed, 30 insertions, 4 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 ();