Revision: 1720
          http://geeqie.svn.sourceforge.net/geeqie/?rev=1720&view=rev
Author:   zas_
Date:     2009-06-01 16:37:30 +0000 (Mon, 01 Jun 2009)

Log Message:
-----------
Minor code cleanup and redundancy reduction.

Modified Paths:
--------------
    trunk/src/view_file_icon.c

Modified: trunk/src/view_file_icon.c
===================================================================
--- trunk/src/view_file_icon.c  2009-05-31 14:32:39 UTC (rev 1719)
+++ trunk/src/view_file_icon.c  2009-06-01 16:37:30 UTC (rev 1720)
@@ -2198,83 +2198,75 @@
 static void vficon_cell_data_cb(GtkTreeViewColumn *tree_column, 
GtkCellRenderer *cell,
                                GtkTreeModel *tree_model, GtkTreeIter *iter, 
gpointer data)
 {
-       ColumnData *cd = data;
-       ViewFile *vf;
-       GtkStyle *style;
        GList *list;
-       GdkColor color_fg;
-       GdkColor color_bg;
        IconData *id;
+       ColumnData *cd = data;
+       ViewFile *vf = cd->vf;
 
-       vf = cd->vf;
+       if (!GQV_IS_CELL_RENDERER_ICON(cell)) return;
 
        gtk_tree_model_get(tree_model, iter, FILE_COLUMN_POINTER, &list, -1);
 
        id = g_list_nth_data(list, cd->number);
-
-       if (id) g_assert(id->fd->magick == 0x12345678);
-
-       style = gtk_widget_get_style(vf->listview);
-       if (id && id->selected & SELECTION_SELECTED)
+       
+       if (id)
                {
-               memcpy(&color_fg, &style->text[GTK_STATE_SELECTED], 
sizeof(color_fg));
-               memcpy(&color_bg, &style->base[GTK_STATE_SELECTED], 
sizeof(color_bg));
-               }
-       else
-               {
-               memcpy(&color_fg, &style->text[GTK_STATE_NORMAL], 
sizeof(color_fg));
-               memcpy(&color_bg, &style->base[GTK_STATE_NORMAL], 
sizeof(color_bg));
-               }
+               GdkColor color_fg;
+               GdkColor color_bg;
+               GtkStyle *style;
+               gchar *name_sidecars;
+               gchar *link;
+               GtkStateType state = GTK_STATE_NORMAL;
 
-       if (id && id->selected & SELECTION_PRELIGHT)
-               {
-#if 0
-               shift_color(&color_fg, -1, 0);
-#endif
-               shift_color(&color_bg, -1, 0);
-               }
+               g_assert(id->fd->magick == 0x12345678);
 
-       if (GQV_IS_CELL_RENDERER_ICON(cell))
-               {
-               if (id)
+               link = islink(id->fd->path) ? GQ_LINK_STR : "";
+               if (id->fd->sidecar_files)
                        {
-                       gchar *name_sidecars;
-                       gchar *sidecars = NULL;
-                       gchar *link = islink(id->fd->path) ? GQ_LINK_STR : "";
-
-                       if (id->fd->sidecar_files)
-                               {
-                               sidecars = file_data_sc_list_to_string(id->fd);
-                               name_sidecars = g_strdup_printf("%s%s %s", 
link, id->fd->name, sidecars);
-                               }
-                       else
-                               {
-                               gchar *disabled_grouping = 
id->fd->disable_grouping ? _(" [NO GROUPING]") : "";
-                               name_sidecars = g_strdup_printf("%s%s%s", link, 
id->fd->name, disabled_grouping);
-                               }
-
-                       g_object_set(cell,      "pixbuf", id->fd->thumb_pixbuf,
-                                               "text", name_sidecars,
-                                               "marks", 
file_data_get_marks(id->fd),
-                                               "show_marks", vf->marks_enabled,
-                                               "cell-background-gdk", 
&color_bg,
-                                               "cell-background-set", TRUE,
-                                               "foreground-gdk", &color_fg,
-                                               "foreground-set", TRUE,
-                                               "has-focus", 
(VFICON(vf)->focus_id == id), NULL);
+                       gchar *sidecars = file_data_sc_list_to_string(id->fd);
+                       name_sidecars = g_strdup_printf("%s%s %s", link, 
id->fd->name, sidecars);
                        g_free(sidecars);
-                       g_free(name_sidecars);
                        }
                else
                        {
-                       g_object_set(cell,      "pixbuf", NULL,
-                                               "text", NULL,
-                                               "show_marks", FALSE,
-                                               "cell-background-set", FALSE,
-                                               "foreground-set", FALSE,
-                                               "has-focus", FALSE, NULL);
+                       gchar *disabled_grouping = id->fd->disable_grouping ? 
_(" [NO GROUPING]") : "";
+                       name_sidecars = g_strdup_printf("%s%s%s", link, 
id->fd->name, disabled_grouping);
                        }
+               
+               style = gtk_widget_get_style(vf->listview);
+               if (id->selected & SELECTION_SELECTED)
+                       {
+                       state = GTK_STATE_SELECTED;
+                       }
+               
+               memcpy(&color_fg, &style->text[state], sizeof(color_fg));
+               memcpy(&color_bg, &style->base[state], sizeof(color_bg));
+
+               if (id->selected & SELECTION_PRELIGHT)
+                       {
+                       shift_color(&color_bg, -1, 0);
+                       }
+               
+               g_object_set(cell,      "pixbuf", id->fd->thumb_pixbuf,
+                                       "text", name_sidecars,
+                                       "marks", file_data_get_marks(id->fd),
+                                       "show_marks", vf->marks_enabled,
+                                       "cell-background-gdk", &color_bg,
+                                       "cell-background-set", TRUE,
+                                       "foreground-gdk", &color_fg,
+                                       "foreground-set", TRUE,
+                                       "has-focus", (VFICON(vf)->focus_id == 
id), NULL);
+               g_free(name_sidecars);
                }
+       else
+               {
+               g_object_set(cell,      "pixbuf", NULL,
+                                       "text", NULL,
+                                       "show_marks", FALSE,
+                                       "cell-background-set", FALSE,
+                                       "foreground-set", FALSE,
+                                       "has-focus", FALSE, NULL);
+               }
 }
 
 static void vficon_append_column(ViewFile *vf, gint n)


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn

Reply via email to