summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorJames Willcox <jwillcox@gnome.org>2002-10-23 15:28:03 +0000
committerJames Willcox <jwillcox@src.gnome.org>2002-10-23 15:28:03 +0000
commit5ab4a9857968fabd843f4c4117d3537aa4d2d565 (patch)
treea92eecaf2f05b1d5cf06e7cb52d0663d22322542 /components
parentb8954ab5e1b5d087722a4440e268f2854d362680 (diff)
downloadnautilus-5ab4a9857968fabd843f4c4117d3537aa4d2d565.tar.gz
Correctly sort the emblems
2002-10-23 James Willcox <jwillcox@gnome.org> * components/emblem/nautilus-emblem-view.c: (emblem_widget_sort_func), (nautilus_emblem_view_populate): Correctly sort the emblems
Diffstat (limited to 'components')
-rw-r--r--components/emblem/nautilus-emblem-view.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/components/emblem/nautilus-emblem-view.c b/components/emblem/nautilus-emblem-view.c
index 7390c560a..978d6597b 100644
--- a/components/emblem/nautilus-emblem-view.c
+++ b/components/emblem/nautilus-emblem-view.c
@@ -846,10 +846,22 @@ nautilus_emblem_view_create_container (NautilusEmblemView *emblem_view)
return scroller;
}
+static gint
+emblem_widget_sort_func (gconstpointer a, gconstpointer b)
+{
+ GObject *obj_a, *obj_b;
+
+ obj_a = G_OBJECT (a);
+ obj_b = G_OBJECT (b);
+
+ return strcmp (g_object_get_data (obj_a, "emblem-display-name"),
+ g_object_get_data (obj_b, "emblem-display-name"));
+}
+
static void
nautilus_emblem_view_populate (NautilusEmblemView *emblem_view)
{
- GList *icons, *l;
+ GList *icons, *l, *widgets;
GtkWidget *emblem_widget;
char *name;
char *path;
@@ -872,9 +884,9 @@ nautilus_emblem_view_populate (NautilusEmblemView *emblem_view)
icons = nautilus_emblem_list_availible ();
- icons = g_list_sort (icons, (GCompareFunc)eel_strcasecmp);
l = icons;
+ widgets = NULL;
while (l != NULL) {
name = (char *)l->data;
l = l->next;
@@ -885,11 +897,21 @@ nautilus_emblem_view_populate (NautilusEmblemView *emblem_view)
emblem_widget = create_emblem_widget (emblem_view, name);
+ widgets = g_list_prepend (widgets, emblem_widget);
+ }
+ eel_g_list_free_deep (icons);
+
+ /* sort the emblems by display name */
+ widgets = g_list_sort (widgets, emblem_widget_sort_func);
+
+ l = widgets;
+ while (l != NULL) {
gtk_container_add
(GTK_CONTAINER (emblem_view->details->emblems_table),
- emblem_widget);
+ l->data);
+ l = l->next;
}
- eel_g_list_free_deep (icons);
+ g_list_free (widgets);
gtk_widget_show_all (emblem_view->details->emblems_table);
}