[Goodies-commits] r3942 - ristretto/trunk/src

Stephan Arts stephan at xfce.org
Mon Feb 11 13:12:46 CET 2008


Author: stephan
Date: 2008-02-11 12:12:46 +0000 (Mon, 11 Feb 2008)
New Revision: 3942

Modified:
   ristretto/trunk/src/thumbnail.c
Log:
Modify looks and behaviour of thumbnails

It might require some themes to add an aditional entry specifically for ristretto to increase the contrast.



Modified: ristretto/trunk/src/thumbnail.c
===================================================================
--- ristretto/trunk/src/thumbnail.c	2008-02-11 07:42:49 UTC (rev 3941)
+++ ristretto/trunk/src/thumbnail.c	2008-02-11 12:12:46 UTC (rev 3942)
@@ -170,15 +170,11 @@
 {
     GdkPixmap *pixmap = NULL;
     GtkWidget *widget = GTK_WIDGET(thumb);
+    gint border_width = 0;
 
     GdkGC *gc = gdk_gc_new(GDK_DRAWABLE(widget->window));
-    GdkGC *gc_bg_normal = gdk_gc_new(GDK_DRAWABLE(widget->window));
-    GdkGC *gc_bg_selected = gdk_gc_new(GDK_DRAWABLE(widget->window));
 
-    gdk_gc_set_foreground(gc_bg_selected,
-                        &(widget->style->bg[GTK_STATE_SELECTED]));
-    gdk_gc_set_foreground(gc_bg_normal,
-                        &(widget->style->bg[GTK_STATE_NORMAL]));
+    GtkStateType state = GTK_WIDGET_STATE(widget);
 
     if(thumb->priv->entry)
     {
@@ -188,12 +184,10 @@
 
         pixmap = gdk_pixmap_new(widget->window, widget->allocation.width, widget->allocation.height, -1);
 
-        gdk_gc_set_foreground(gc, &widget->style->fg[GTK_STATE_NORMAL]);
-
-        if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(thumb)))
+        if (widget->style->bg_pixmap[state] == NULL)
         {
             gdk_draw_rectangle(GDK_DRAWABLE(pixmap),
-                            gc_bg_selected,
+                            widget->style->bg_gc[state],
                             TRUE,
                             0, 0, 
                             widget->allocation.width,
@@ -201,18 +195,21 @@
         }
         else
         {
-            gdk_draw_rectangle(GDK_DRAWABLE(pixmap),
-                            gc_bg_normal,
-                            TRUE,
-                            0, 0, 
-                            widget->allocation.width,
-                            widget->allocation.height);
+            gdk_draw_drawable(GDK_DRAWABLE(pixmap),
+                widget->style->bg_gc[state],
+                widget->style->bg_pixmap[state],
+                0, 0,
+                widget->allocation.x, widget->allocation.y,
+                widget->allocation.width,
+                widget->allocation.height);
+
         }
 
+
         if(pixbuf)
         {
             gdk_draw_pixbuf(GDK_DRAWABLE(pixmap),
-                            gc,
+                            widget->style->fg_gc[state],
                             pixbuf,
                             0, 0,
                             (0.5 * (widget->allocation.width - gdk_pixbuf_get_width(pixbuf))),
@@ -226,10 +223,20 @@
             gc,
             pixmap,
             0, 0,
-            widget->allocation.x, widget->allocation.y,
-            widget->allocation.width,
-            widget->allocation.height);
+            widget->allocation.x + border_width, widget->allocation.y + border_width,
+            widget->allocation.width - (2 * border_width),
+            widget->allocation.height - (2 * border_width));
 
+        gtk_paint_shadow(widget->style,
+                         widget->window,
+                         state,
+                         GTK_SHADOW_ETCHED_IN,
+                         NULL,
+                         widget,
+                         NULL,
+                         widget->allocation.x, widget->allocation.y,
+                         widget->allocation.width,
+                         widget->allocation.height);
     }
 }
 
@@ -286,9 +293,10 @@
     RsttoThumbnail *thumb = RSTTO_THUMBNAIL(button);
     GtkToggleButton *tmp_button;
 
-    GSList *tmp_list;
     gboolean toggled = FALSE;
 
+    GSList *tmp_list;
+
     if(toggle_button->active == TRUE)
     {
         tmp_button = NULL;
@@ -306,13 +314,11 @@
         if (tmp_button != NULL)
         {
             toggled = TRUE;
-            toggle_button->active = !toggle_button->active;
         }
     }
     else
     {
         toggled = TRUE;
-        toggle_button->active = !toggle_button->active;
 
         tmp_list = thumb->priv->group;
         while(tmp_list)
@@ -329,9 +335,6 @@
 
     if (toggled == TRUE)
     {
-        gtk_widget_queue_draw (GTK_WIDGET (thumb));
-        gtk_toggle_button_toggled(toggle_button);
-        g_object_notify (G_OBJECT (toggle_button), "active");
+        GTK_BUTTON_CLASS(parent_class)->clicked(button);
     }
-
 }




More information about the Goodies-commits mailing list