From 50a2665bff9c48dc25701194157802e836db9290 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Fri, 14 Nov 2003 20:49:01 +0000 Subject: config accessor (calendar_config_set_calendars_selected): ditto 2003-11-14 JP Rosevear * gui/calendar-config.c (calendar_config_get_calendars_selected): config accessor (calendar_config_set_calendars_selected): ditto (calendar_config_add_notification_calendars_selected): config notification * gui/calendar-config.h: add protos * gui/calendar-config-keys.h: add new key * gui/calendar-component.c (is_in_uids): util function (update_uris_for_selection): save the selection in the configuration (update_selection): update the selection from the config info (source_selection_changed_cb): only pass one param (config_selection_changed_cb): listen for config changes (impl_dispose): remove config notification (impl_createControls): use bonobo_exception_set; add a config notification 2003-11-14 JP Rosevear * test-source-list.c (on_idle_do_stuff): we only need the uid to remove and peek at stuff * e-source-list.h: update proto types * e-source-list.c (e_source_list_peek_source_by_uid): allow peek by uid only (e_source_list_remove_source_by_uid): allow removal by uid only svn path=/trunk/; revision=23362 --- e-util/ChangeLog | 11 +++++++++++ e-util/e-source-list.c | 44 +++++++++++++++++++++++++------------------- e-util/e-source-list.h | 10 ++++------ e-util/test-source-list.c | 45 +++++++++++++++++++-------------------------- 4 files changed, 59 insertions(+), 51 deletions(-) (limited to 'e-util') diff --git a/e-util/ChangeLog b/e-util/ChangeLog index a14f3b8b9d..5c04768a4e 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,14 @@ +2003-11-14 JP Rosevear + + * test-source-list.c (on_idle_do_stuff): we only need the uid to + remove and peek at stuff + + * e-source-list.h: update proto types + + * e-source-list.c (e_source_list_peek_source_by_uid): allow peek + by uid only + (e_source_list_remove_source_by_uid): allow removal by uid only + 2003-11-07 Dan Winship * ename/*: Removed. No longer used by evolution except via diff --git a/e-util/e-source-list.c b/e-util/e-source-list.c index 565df8977e..abe2c63e04 100644 --- a/e-util/e-source-list.c +++ b/e-util/e-source-list.c @@ -398,20 +398,23 @@ e_source_list_peek_group_by_uid (ESourceList *list, ESource * e_source_list_peek_source_by_uid (ESourceList *list, - const char *group_uid, - const char *source_uid) + const char *uid) { - ESourceGroup *group; + GSList *p; g_return_val_if_fail (E_IS_SOURCE_LIST (list), NULL); - g_return_val_if_fail (group_uid != NULL, NULL); - g_return_val_if_fail (source_uid != NULL, NULL); + g_return_val_if_fail (uid != NULL, NULL); - group = e_source_list_peek_group_by_uid (list, group_uid); - if (group == NULL) - return NULL; + for (p = list->priv->groups; p != NULL; p = p->next) { + ESourceGroup *group = E_SOURCE_GROUP (p->data); + ESource *source; + + source = e_source_group_peek_source_by_uid (group, uid); + if (source) + return source; + } - return e_source_group_peek_source_by_uid (group, source_uid); + return NULL; } @@ -470,20 +473,23 @@ e_source_list_remove_group_by_uid (ESourceList *list, gboolean e_source_list_remove_source_by_uid (ESourceList *list, - const char *group_uid, - const char *source_uid) + const char *uid) { - ESourceGroup *group; - + GSList *p; + g_return_val_if_fail (E_IS_SOURCE_LIST (list), FALSE); - g_return_val_if_fail (group_uid != NULL, FALSE); - g_return_val_if_fail (source_uid != NULL, FALSE); + g_return_val_if_fail (uid != NULL, FALSE); - group = e_source_list_peek_group_by_uid (list, group_uid); - if (group== NULL) - return FALSE; + for (p = list->priv->groups; p != NULL; p = p->next) { + ESourceGroup *group = E_SOURCE_GROUP (p->data); + ESource *source; + + source = e_source_group_peek_source_by_uid (group, uid); + if (source) + return e_source_group_remove_source_by_uid (group, uid); + } - return e_source_group_remove_source_by_uid (group, source_uid); + return FALSE; } diff --git a/e-util/e-source-list.h b/e-util/e-source-list.h index 1985b35d73..219ac7b2fa 100644 --- a/e-util/e-source-list.h +++ b/e-util/e-source-list.h @@ -65,10 +65,9 @@ ESourceList *e_source_list_new_for_gconf (GConfClient *client, GSList *e_source_list_peek_groups (ESourceList *list); ESourceGroup *e_source_list_peek_group_by_uid (ESourceList *list, - const char *source_group); + const char *uid); ESource *e_source_list_peek_source_by_uid (ESourceList *list, - const char *group_name, - const char *source_name); + const char *uid); gboolean e_source_list_add_group (ESourceList *list, ESourceGroup *group, @@ -76,10 +75,9 @@ gboolean e_source_list_add_group (ESourceList *list, gboolean e_source_list_remove_group (ESourceList *list, ESourceGroup *group); gboolean e_source_list_remove_group_by_uid (ESourceList *list, - const char *name); + const char *uid); gboolean e_source_list_remove_source_by_uid (ESourceList *list, - const char *group_name, - const char *source_name); + const char *uidj); gboolean e_source_list_sync (ESourceList *list, GError **error); diff --git a/e-util/test-source-list.c b/e-util/test-source-list.c index 7c38436326..b869df01d7 100644 --- a/e-util/test-source-list.c +++ b/e-util/test-source-list.c @@ -377,36 +377,31 @@ on_idle_do_stuff (void *unused_data) if (remove_source_arg != NULL) { ESource *source; - if (group_arg == NULL) { - fprintf (stderr, "When using --remove-source, you need to specify a group using --group.\n"); - exit (1); - } - - source = e_source_list_peek_source_by_uid (list, group_arg, remove_source_arg); + source = e_source_list_peek_source_by_uid (list, remove_source_arg); if (source == NULL) { - fprintf (stderr, "No such source \"%s\" in group \"%s\".\n", remove_source_arg, group_arg); + fprintf (stderr, "No such source \"%s\".\n", remove_source_arg); exit (1); } - e_source_list_remove_source_by_uid (list, group_arg, remove_source_arg); + e_source_list_remove_source_by_uid (list, remove_source_arg); e_source_list_sync (list, NULL); } if (set_name_arg != NULL) { - if (group_arg == NULL) { + if (group_arg == NULL && source_arg == NULL) { fprintf (stderr, - "When using --set-name, you need to specify a source (using --group and\n" - "--source) or a group (using --group alone).\n"); + "When using --set-name, you need to specify a source (using --source" + "alone) or a group (using --group alone).\n"); exit (1); } if (source_arg != NULL) { - ESource *source = e_source_list_peek_source_by_uid (list, group_arg, source_arg); + ESource *source = e_source_list_peek_source_by_uid (list, source_arg); if (source != NULL) { e_source_set_name (source, set_name_arg); } else { - fprintf (stderr, "No such source \"%s\" in group \"%s\".\n", source_arg, group_arg); + fprintf (stderr, "No such source \"%s\".\n", source_arg); exit (1); } } else { @@ -418,7 +413,7 @@ on_idle_do_stuff (void *unused_data) fprintf (stderr, "No such group \"%s\".\n", group_arg); exit (1); } - } + } e_source_list_sync (list, NULL); } @@ -426,14 +421,14 @@ on_idle_do_stuff (void *unused_data) if (set_relative_uri_arg != NULL && add_source_arg == NULL) { ESource *source; - if (source_arg == NULL || group_arg == NULL) { + if (source_arg == NULL) { fprintf (stderr, - "When using --set-relative-uri, you need to specify a source using --group\n" - "and --source.\n"); + "When using --set-relative-uri, you need to specify a source using " + "--source.\n"); exit (1); } - source = e_source_list_peek_source_by_uid (list, group_arg, source_arg); + source = e_source_list_peek_source_by_uid (list, source_arg); e_source_set_relative_uri (source, set_relative_uri_arg); e_source_list_sync (list, NULL); } @@ -442,17 +437,16 @@ on_idle_do_stuff (void *unused_data) ESource *source; guint32 color; - if (add_source_arg == NULL && (source_arg == NULL || group_arg == NULL)) { + if (add_source_arg == NULL && source_arg == NULL) { fprintf (stderr, - "When using --set-color, you need to specify a source using --group\n" - "and --source.\n"); + "When using --set-color, you need to specify a source using --source\n"); exit (1); } if (add_source_arg != NULL) source = new_source; else - source = e_source_list_peek_source_by_uid (list, group_arg, source_arg); + source = e_source_list_peek_source_by_uid (list, source_arg); sscanf (set_color_arg, "%06x", &color); e_source_set_color (source, color); @@ -462,17 +456,16 @@ on_idle_do_stuff (void *unused_data) if (unset_color) { ESource *source; - if (add_source_arg == NULL && (source_arg == NULL || group_arg == NULL)) { + if (add_source_arg == NULL && source_arg == NULL) { fprintf (stderr, - "When using --unset-color, you need to specify a source using --group\n" - "and --source.\n"); + "When using --unset-color, you need to specify a source using --source\n"); exit (1); } if (add_source_arg != NULL) source = new_source; else - source = e_source_list_peek_source_by_uid (list, group_arg, source_arg); + source = e_source_list_peek_source_by_uid (list, source_arg); e_source_unset_color (source); e_source_list_sync (list, NULL); -- cgit v1.2.3