diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2001-06-30 08:15:11 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2001-06-30 08:15:11 +0800 |
commit | 019a20555bc37540a0ad76c7ede5224c37f32106 (patch) | |
tree | 4dc046cc8be27c216f3253f51778f3361f478982 /shell | |
parent | 71e948a9aea155afaea86132b3bd0b1b38655984 (diff) | |
download | gsoc2013-evolution-019a20555bc37540a0ad76c7ede5224c37f32106.tar gsoc2013-evolution-019a20555bc37540a0ad76c7ede5224c37f32106.tar.gz gsoc2013-evolution-019a20555bc37540a0ad76c7ede5224c37f32106.tar.bz2 gsoc2013-evolution-019a20555bc37540a0ad76c7ede5224c37f32106.tar.lz gsoc2013-evolution-019a20555bc37540a0ad76c7ede5224c37f32106.tar.xz gsoc2013-evolution-019a20555bc37540a0ad76c7ede5224c37f32106.tar.zst gsoc2013-evolution-019a20555bc37540a0ad76c7ede5224c37f32106.zip |
Change EShortcuts to use GSLists instead of GLists.
svn path=/trunk/; revision=10615
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 14 | ||||
-rw-r--r-- | shell/e-shortcuts-view-model.c | 8 | ||||
-rw-r--r-- | shell/e-shortcuts.c | 109 | ||||
-rw-r--r-- | shell/e-shortcuts.h | 4 |
4 files changed, 75 insertions, 60 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 0650465bba..2181119809 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,17 @@ +2001-06-29 Ettore Perazzoli <ettore@ximian.com> + + * e-shortcuts-view-model.c (load_group_into_model): Updated to + match the fact that `e_shortcuts_in_group()' now returns a GSList + instead of a GList. + (load_all_shortcuts_into_model): Likewise for + `e_shortcuts_get_group_titles()'. + + * e-shortcuts.c: Change all `groups' and `views' from GLists to + GSLists in EShortcutsPrivate. + (e_shortcuts_get_group_titles): Return a GSList instead of a + GList. + (e_shortcuts_get_shortcuts_in_group): Likewise. + 2001-06-28 Ettore Perazzoli <ettore@ximian.com> [Fix #3756, `--debug' option not working anymore.] diff --git a/shell/e-shortcuts-view-model.c b/shell/e-shortcuts-view-model.c index 69b417de9a..eadf5ea9e7 100644 --- a/shell/e-shortcuts-view-model.c +++ b/shell/e-shortcuts-view-model.c @@ -75,7 +75,7 @@ load_group_into_model (EShortcutsViewModel *shortcuts_view_model, { EShortcutsViewModelPrivate *priv; EStorageSet *storage_set; - GList *shortcut_list; + GSList *shortcut_list; GList *p; priv = shortcuts_view_model->priv; @@ -110,7 +110,7 @@ load_group_into_model (EShortcutsViewModel *shortcuts_view_model, e_shortcut_model_add_item (E_SHORTCUT_MODEL (shortcuts_view_model), group_num, -1, uri, name); } - e_free_string_list (shortcut_list); + e_free_string_slist (shortcut_list); } static void @@ -118,7 +118,7 @@ load_all_shortcuts_into_model (EShortcutsViewModel *shortcuts_view_model) { EShortcutsViewModelPrivate *priv; GList *group_titles; - GList *p; + GSList *p; int group_num; priv = shortcuts_view_model->priv; @@ -134,7 +134,7 @@ load_all_shortcuts_into_model (EShortcutsViewModel *shortcuts_view_model) load_group_into_model (shortcuts_view_model, group_title, group_num); } - e_free_string_list (group_titles); + e_free_string_slist (group_titles); } diff --git a/shell/e-shortcuts.c b/shell/e-shortcuts.c index 3317dd4835..6dd54ba17a 100644 --- a/shell/e-shortcuts.c +++ b/shell/e-shortcuts.c @@ -75,7 +75,7 @@ struct _ShortcutGroup { char *title; /* A list of strings with the URI for the shortcut. */ - GList *shortcuts; + GSList *shortcuts; }; typedef struct _ShortcutGroup ShortcutGroup; @@ -98,10 +98,10 @@ struct _EShortcutsPrivate { EFolderTypeRegistry *folder_type_registry; /* A list of ShortcutGroups. */ - GList *groups; + GSList *groups; /* A list of ShortcutViews. */ - GList *views; + GSList *views; /* A hash table to get a group given its name. */ GHashTable *title_to_group; @@ -123,8 +123,8 @@ static void unload_shortcuts (EShortcuts *shortcuts) { EShortcutsPrivate *priv; - GList *orig_groups; - GList *p, *q; + GSList *orig_groups; + GSList *p, *q; priv = shortcuts->priv; orig_groups = priv->groups; @@ -142,13 +142,13 @@ unload_shortcuts (EShortcuts *shortcuts) g_free (q->data); g_free (group->title); - g_list_free (group->shortcuts); + g_slist_free (group->shortcuts); priv->groups = priv->groups->next; } if (orig_groups != NULL) - g_list_free (orig_groups); + g_slist_free (orig_groups); priv->groups = NULL; @@ -213,17 +213,17 @@ load_shortcuts (EShortcuts *shortcuts, continue; content = xmlNodeListGetString (doc, q->childs, 1); - shortcut_group->shortcuts = g_list_prepend (shortcut_group->shortcuts, + shortcut_group->shortcuts = g_slist_prepend (shortcut_group->shortcuts, g_strdup (content)); xmlFree (content); } - shortcut_group->shortcuts = g_list_reverse (shortcut_group->shortcuts); + shortcut_group->shortcuts = g_slist_reverse (shortcut_group->shortcuts); - priv->groups = g_list_prepend (priv->groups, shortcut_group); + priv->groups = g_slist_prepend (priv->groups, shortcut_group); g_hash_table_insert (priv->title_to_group, shortcut_group->title, shortcut_group); } - priv->groups = g_list_reverse (priv->groups); + priv->groups = g_slist_reverse (priv->groups); xmlFreeDoc (doc); @@ -237,7 +237,7 @@ save_shortcuts (EShortcuts *shortcuts, EShortcutsPrivate *priv; xmlDoc *doc; xmlNode *root; - GList *p, *q; + GSList *p, *q; priv = shortcuts->priv; @@ -349,7 +349,7 @@ view_destroyed_cb (GtkObject *object, shortcuts = E_SHORTCUTS (data); priv = shortcuts->priv; - priv->views = g_list_remove (priv->views, object); + priv->views = g_slist_remove (priv->views, object); } @@ -517,13 +517,13 @@ e_shortcuts_new (EStorageSet *storage_set, } -GList * +GSList * e_shortcuts_get_group_titles (EShortcuts *shortcuts) { EShortcutsPrivate *priv; ShortcutGroup *group; - GList *list; - GList *p; + GSList *list; + GSList *p; g_return_val_if_fail (shortcuts != NULL, NULL); g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL); @@ -534,20 +534,20 @@ e_shortcuts_get_group_titles (EShortcuts *shortcuts) for (p = priv->groups; p != NULL; p = p->next) { group = (ShortcutGroup *) p->data; - list = g_list_prepend (list, g_strdup (group->title)); + list = g_slist_prepend (list, g_strdup (group->title)); } - return g_list_reverse (list); + return g_slist_reverse (list); } -GList * +GSList * e_shortcuts_get_shortcuts_in_group (EShortcuts *shortcuts, const char *group_title) { EShortcutsPrivate *priv; ShortcutGroup *shortcut_group; - GList *list; - GList *p; + GSList *list; + GSList *p; priv = shortcuts->priv; @@ -562,9 +562,9 @@ e_shortcuts_get_shortcuts_in_group (EShortcuts *shortcuts, list = NULL; for (p = shortcut_group->shortcuts; p != NULL; p = p->next) - list = g_list_prepend (list, g_strdup ((const char *) p->data)); + list = g_slist_prepend (list, g_strdup ((const char *) p->data)); - return g_list_reverse (list); + return g_slist_reverse (list); } @@ -590,7 +590,7 @@ e_shortcuts_new_view (EShortcuts *shortcuts) priv = shortcuts->priv; new = e_shortcuts_view_new (shortcuts); - priv->views = g_list_prepend (priv->views, new); + priv->views = g_slist_prepend (priv->views, new); gtk_signal_connect (GTK_OBJECT (new), "destroy", view_destroyed_cb, shortcuts); @@ -662,18 +662,18 @@ e_shortcuts_get_uri (EShortcuts *shortcuts, int group_num, int num) { EShortcutsPrivate *priv; ShortcutGroup *group; - GList *shortcut_element; + GSList *shortcut_element; g_return_val_if_fail (shortcuts != NULL, NULL); g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL); priv = shortcuts->priv; - group = g_list_nth (priv->groups, group_num)->data; + group = g_slist_nth (priv->groups, group_num)->data; if (group == NULL) return NULL; - shortcut_element = g_list_nth (group->shortcuts, num); + shortcut_element = g_slist_nth (group->shortcuts, num); if (shortcut_element == NULL) return NULL; @@ -688,7 +688,7 @@ e_shortcuts_remove_shortcut (EShortcuts *shortcuts, { EShortcutsPrivate *priv; ShortcutGroup *group; - GList *p; + GSList *p; char *uri; g_return_if_fail (shortcuts != NULL); @@ -696,12 +696,12 @@ e_shortcuts_remove_shortcut (EShortcuts *shortcuts, priv = shortcuts->priv; - p = g_list_nth (priv->groups, group_num); + p = g_slist_nth (priv->groups, group_num); g_return_if_fail (p != NULL); group = (ShortcutGroup *) p->data; - p = g_list_nth (group->shortcuts, num); + p = g_slist_nth (group->shortcuts, num); g_return_if_fail (p != NULL); gtk_signal_emit (GTK_OBJECT (shortcuts), signals[REMOVE_SHORTCUT], group_num, num); @@ -709,7 +709,7 @@ e_shortcuts_remove_shortcut (EShortcuts *shortcuts, uri = (char *) p->data; g_free (uri); - group->shortcuts = g_list_remove_link (group->shortcuts, p); + group->shortcuts = g_slist_remove_link (group->shortcuts, p); make_dirty (shortcuts); } @@ -722,22 +722,22 @@ e_shortcuts_add_shortcut (EShortcuts *shortcuts, { EShortcutsPrivate *priv; ShortcutGroup *group; - GList *p; + GSList *p; g_return_if_fail (shortcuts != NULL); g_return_if_fail (E_IS_SHORTCUTS (shortcuts)); priv = shortcuts->priv; - p = g_list_nth (priv->groups, group_num); + p = g_slist_nth (priv->groups, group_num); g_return_if_fail (p != NULL); group = (ShortcutGroup *) p->data; if (num == -1) - num = g_list_length (group->shortcuts); + num = g_slist_length (group->shortcuts); - group->shortcuts = g_list_insert (group->shortcuts, g_strdup (uri), num); + group->shortcuts = g_slist_insert (group->shortcuts, g_strdup (uri), num); gtk_signal_emit (GTK_OBJECT (shortcuts), signals[NEW_SHORTCUT], group_num, num); @@ -765,13 +765,13 @@ typedef struct { int num; } EShortcutPosition; -static GList * +static GSList * find_positions_by_uri (EShortcuts *shortcuts, const char *uri) { EShortcutsPrivate *priv; - GList *p = NULL, *q = NULL; - GList *retval = NULL; + GSList *p = NULL, *q = NULL; + GSList *retval = NULL; int group_num = 0, num = 0; priv = shortcuts->priv; @@ -791,7 +791,7 @@ find_positions_by_uri (EShortcuts *shortcuts, position->group_num = group_num; position->num = num; - retval = g_list_append (retval, position); + retval = g_slist_prepend (retval, position); } num++; } @@ -800,14 +800,15 @@ find_positions_by_uri (EShortcuts *shortcuts, num = 0; } - return g_list_first (retval); + retval = g_slist_reverse (retval); + return retval; } void e_shortcuts_remove_shortcut_by_uri (EShortcuts *shortcuts, const char *uri) { - GList *items = NULL; + GSList *items = NULL; items = find_positions_by_uri (shortcuts, uri); @@ -818,16 +819,16 @@ e_shortcuts_remove_shortcut_by_uri (EShortcuts *shortcuts, e_shortcuts_remove_shortcut (shortcuts, pos->group_num, pos->num); g_free (pos); } - items = g_list_next (items); + items = g_slist_next (items); } - g_list_free (items); + g_slist_free (items); } void e_shortcuts_update_shortcut_by_uri (EShortcuts *shortcuts, const char *uri) { - GList *items = NULL; + GSList *items = NULL; items = find_positions_by_uri (shortcuts, uri); @@ -840,9 +841,9 @@ e_shortcuts_update_shortcut_by_uri (EShortcuts *shortcuts, uri); g_free (pos); } - items = g_list_next (items); + items = g_slist_next (items); } - g_list_free (items); + g_slist_free (items); } void @@ -851,23 +852,23 @@ e_shortcuts_remove_group (EShortcuts *shortcuts, { EShortcutsPrivate *priv; ShortcutGroup *group; - GList *p; + GSList *p; g_return_if_fail (shortcuts != NULL); g_return_if_fail (E_IS_SHORTCUTS (shortcuts)); priv = shortcuts->priv; - p = g_list_nth (priv->groups, group_num); + p = g_slist_nth (priv->groups, group_num); g_return_if_fail (p != NULL); gtk_signal_emit (GTK_OBJECT (shortcuts), signals[REMOVE_GROUP], group_num); group = (ShortcutGroup *) p->data; - e_free_string_list (group->shortcuts); + e_free_string_slist (group->shortcuts); - priv->groups = g_list_remove_link (priv->groups, p); + priv->groups = g_slist_remove_link (priv->groups, p); make_dirty (shortcuts); } @@ -890,9 +891,9 @@ e_shortcuts_add_group (EShortcuts *shortcuts, group->shortcuts = NULL; if (group_num == -1) - group_num = g_list_length (priv->groups); + group_num = g_slist_length (priv->groups); - priv->groups = g_list_insert (priv->groups, group, group_num); + priv->groups = g_slist_insert (priv->groups, group, group_num); gtk_signal_emit (GTK_OBJECT (shortcuts), signals[NEW_GROUP], group_num); @@ -905,7 +906,7 @@ e_shortcuts_get_group_title (EShortcuts *shortcuts, int group_num) { EShortcutsPrivate *priv; - GList *group_element; + GSList *group_element; const ShortcutGroup *group; g_return_val_if_fail (shortcuts != NULL, NULL); @@ -913,7 +914,7 @@ e_shortcuts_get_group_title (EShortcuts *shortcuts, priv = shortcuts->priv; - group_element = g_list_nth (priv->groups, group_num); + group_element = g_slist_nth (priv->groups, group_num); if (group_element == NULL) return NULL; diff --git a/shell/e-shortcuts.h b/shell/e-shortcuts.h index 2abbf6bb7f..4276c9a032 100644 --- a/shell/e-shortcuts.h +++ b/shell/e-shortcuts.h @@ -73,11 +73,11 @@ EShortcuts *e_shortcuts_new (EStorageSet *storage_s EFolderTypeRegistry *folder_type_registry, const char *file_name); -GList *e_shortcuts_get_group_titles (EShortcuts *shortcuts); +GSList *e_shortcuts_get_group_titles (EShortcuts *shortcuts); const char *e_shortcuts_get_group_title (EShortcuts *shortcuts, int group_num); -GList *e_shortcuts_get_shortcuts_in_group (EShortcuts *shortcuts, +GSList *e_shortcuts_get_shortcuts_in_group (EShortcuts *shortcuts, const char *group_title); EStorageSet *e_shortcuts_get_storage_set (EShortcuts *shortcuts); GtkWidget *e_shortcuts_new_view (EShortcuts *shortcuts); |