[gthumb] selections: use the new icon names



commit 15fcf9f3e65ea43dd0b5b2cb375ac4573bc6d0cf
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Wed Oct 30 22:03:41 2013 +0100

    selections: use the new icon names

 extensions/selections/callbacks.c                  |    5 +---
 .../selections/gth-metadata-provider-selections.c  |    2 +-
 extensions/selections/gth-selections-manager.c     |   22 ++++++++++++++++---
 extensions/selections/gth-selections-manager.h     |    2 +
 4 files changed, 22 insertions(+), 9 deletions(-)
---
diff --git a/extensions/selections/callbacks.c b/extensions/selections/callbacks.c
index 75b6f49..1a54fa2 100644
--- a/extensions/selections/callbacks.c
+++ b/extensions/selections/callbacks.c
@@ -94,14 +94,12 @@ _selection_button_new (int      n_selection,
                       gpointer user_data)
 {
        GtkWidget *button;
-       char      *icon_name;
        char      *tooltip;
 
-       icon_name = g_strdup_printf ("selection%d", n_selection);
        tooltip = g_strdup_printf (_("Show selection %d"), n_selection);
 
        button = gtk_button_new ();
-       gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name (icon_name, 
GTK_ICON_SIZE_MENU));
+       gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name (gth_selection_get_icon_name 
(n_selection), GTK_ICON_SIZE_MENU));
        gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
        gtk_widget_show_all (button);
        gtk_widget_set_sensitive (button, FALSE);
@@ -113,7 +111,6 @@ _selection_button_new (int      n_selection,
                          user_data);
 
        g_free (tooltip);
-       g_free (icon_name);
 
        return button;
 }
diff --git a/extensions/selections/gth-metadata-provider-selections.c 
b/extensions/selections/gth-metadata-provider-selections.c
index 14c0615..62b4637 100644
--- a/extensions/selections/gth-metadata-provider-selections.c
+++ b/extensions/selections/gth-metadata-provider-selections.c
@@ -62,7 +62,7 @@ gth_metadata_provider_selections_read (GthMetadataProvider *self,
        emblem_list = NULL;
        for (i = GTH_SELECTIONS_MANAGER_N_SELECTIONS; i >= 0; i--) {
                if (gth_selections_manager_file_exists (i, file_data->file))
-                       emblem_list = g_list_prepend (emblem_list, g_strdup_printf ("selection%d", i));
+                       emblem_list = g_list_prepend (emblem_list, g_strdup (gth_selection_get_icon_name 
(i)));
        }
 
        emblems = gth_string_list_new (emblem_list);
diff --git a/extensions/selections/gth-selections-manager.c b/extensions/selections/gth-selections-manager.c
index 01c330b..de55ced 100644
--- a/extensions/selections/gth-selections-manager.c
+++ b/extensions/selections/gth-selections-manager.c
@@ -219,15 +219,13 @@ gth_selections_manager_update_file_info (GFile     *file,
        if (n_selection > 0) {
                GIcon *icon;
 
-               name = g_strdup_printf ("selection%d", n_selection);
-               icon = g_themed_icon_new (name);
+               icon = g_themed_icon_new (gth_selection_get_icon_name (n_selection));
                g_file_info_set_icon (info, icon);
 
                g_object_unref (icon);
-               g_free (name);
        }
        else {
-               GIcon *icon = g_themed_icon_new ("selection");
+               GIcon *icon = g_themed_icon_new ("emblem-flag-gray");
                g_file_info_set_icon (info, icon);
                g_object_unref (icon);
        }
@@ -577,3 +575,19 @@ _g_file_get_n_selection (GFile *file)
 
        return n;
 }
+
+
+static const char * selection_icons[] = {
+       "emblem-flag-gray",
+       "emblem-flag-green",
+       "emblem-flag-red",
+       "emblem-flag-blue"
+};
+
+
+const char *
+gth_selection_get_icon_name (int n_selection)
+{
+       g_return_val_if_fail (n_selection >= 1 && n_selection <= GTH_SELECTIONS_MANAGER_N_SELECTIONS, NULL);
+       return selection_icons[n_selection];
+}
diff --git a/extensions/selections/gth-selections-manager.h b/extensions/selections/gth-selections-manager.h
index b4a02b9..032c07d 100644
--- a/extensions/selections/gth-selections-manager.h
+++ b/extensions/selections/gth-selections-manager.h
@@ -79,6 +79,8 @@ gboolean gth_selections_manager_get_is_empty     (int                   n_select
 /* utilities */
 
 int      _g_file_get_n_selection                 (GFile                *file);
+const char *
+        gth_selection_get_icon_name             (int                   n_selection);
 
 G_END_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]