Re: [Usability] GnomeIconList selection color



On Sun, Feb 10, 2002 at 08:25:40PM -0500, Havoc Pennington wrote:
> Jorn Baayen <jorn nl linux org> writes:
> > +	{
> > +		if (GTK_WIDGET_HAS_FOCUS (GNOME_CANVAS_ITEM (iti)->canvas))
> > +		{
> 
> I think libgnomeui indentation is Linux-kernel-style, so braces are
> like this:
> 
>  if (whatever) {
>          gdk_draw_...
>  }
> 
> I'd write the code as:
> 
>  GtkStateType state;
> 
>  if (GTK_WIDGET_HAS_FOCUS (widget))
>           state = GTK_STATE_SELECTED;
>  else
>           state = GTK_STATE_ACTIVE;
> 
> to avoid cutting-and-pasting the other args to draw_rectangle().

Heh k, pardon my ignorance :) Fixed in this patch.

> 
> You should get final commit approval from Anders, I don't know if he
> reads this list. If not you could mail gnome-libs-devel or just
> andersca gnu org  

Ok, CC'ing him.

> 
> (The patch looks correct though, aside from the style nitpicks.)
> 
> Havoc
>  

Cheers
Jorn
? stamp-h1
? libgnomeui/diff
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libgnomeui/ChangeLog,v
retrieving revision 1.100
diff -u -r1.100 ChangeLog
--- ChangeLog	2002/02/09 22:32:52	1.100
+++ ChangeLog	2002/02/11 01:42:37
@@ -1,3 +1,8 @@
+2002-02-11  Jorn Baayen  <jorn nl linux org>
+
+	* libgnomeui/gnome-icon-item.c: use base_gc rather than bg_gc to
+	draw the background color of the selected item.
+	
 2002-02-10  Pauli Virtanen  <ptvirtan cc hut fi>
 
 	* configure.in (ALL_LINGUAS): Added "fi" (Finnish).
Index: libgnomeui/gnome-icon-item.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-icon-item.c,v
retrieving revision 1.52
diff -u -r1.52 gnome-icon-item.c
--- libgnomeui/gnome-icon-item.c	2002/02/01 23:32:56	1.52
+++ libgnomeui/gnome-icon-item.c	2002/02/11 01:42:38
@@ -561,12 +561,20 @@
 	text_xofs = xofs - (iti->width - priv->layout_width - 2 * MARGIN_X) / 2;
 	text_yofs = yofs + MARGIN_Y;
 
-	if (iti->selected && !iti->editing)
+	if (iti->selected && !iti->editing) {
+		GtkStateType state;
+
+		if (GTK_WIDGET_HAS_FOCUS (widget))
+			state = GTK_STATE_SELECTED;
+		else
+			state = GTK_STATE_ACTIVE;
+
 		gdk_draw_rectangle (drawable,
-				    style->bg_gc[GTK_STATE_SELECTED],
+				    style->base_gc[state],
 				    TRUE,
 				    xofs + 1, yofs + 1,
 				    w - 2, h - 2);
+	}
 	if (iti->focused && ! iti->editing)
 		gtk_draw_focus (style,
 				drawable,


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