diff options
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/ChangeLog | 9 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-view.c | 25 |
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 (); |