marlin r1285 - in trunk/src: . other



Author: iain
Date: Wed Oct  1 23:34:44 2008
New Revision: 1285
URL: http://svn.gnome.org/viewvc/marlin?rev=1285&view=rev

Log:
Remove the extra GdkGC


Modified:
   trunk/src/ChangeLog
   trunk/src/other/gtkvumeter.c
   trunk/src/other/gtkvumeter.h

Modified: trunk/src/other/gtkvumeter.c
==============================================================================
--- trunk/src/other/gtkvumeter.c	(original)
+++ trunk/src/other/gtkvumeter.c	Wed Oct  1 23:34:44 2008
@@ -80,8 +80,7 @@
 
 	vumeter->peaks_falloff = GTK_VUMETER_PEAKS_FALLOFF_MEDIUM;
 
-	vumeter->fg_gc = NULL;
-	vumeter->bg_gc = NULL;
+	vumeter->gc = NULL;
 
 	vumeter->rms_level = 0.0;
 	vumeter->peak_level = 0.0;
@@ -178,10 +177,8 @@
 	gtk_vumeter_setup_colors (vumeter);
 
 	/* Set up GC */
-	vumeter->fg_gc = gdk_gc_new (widget->window);
-	gdk_gc_copy (vumeter->fg_gc, widget->style->fg_gc[GTK_STATE_NORMAL]);
-	vumeter->bg_gc = gdk_gc_new (widget->window);
-	gdk_gc_copy (vumeter->bg_gc, widget->style->bg_gc[GTK_STATE_NORMAL]);
+	vumeter->gc = gdk_gc_new (widget->window);
+	gdk_gc_copy (vumeter->gc, widget->style->fg_gc[GTK_STATE_NORMAL]);
 }
 
 static void
@@ -190,8 +187,7 @@
 	GtkVUMeter *vumeter = (GtkVUMeter *) widget;
 
 	gtk_vumeter_free_colors (vumeter);
-	g_object_unref (G_OBJECT (vumeter->fg_gc));
-	g_object_unref (G_OBJECT (vumeter->bg_gc));
+	g_object_unref (G_OBJECT (vumeter->gc));
 
 	GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
 }
@@ -265,17 +261,17 @@
 		height -= 3;
 
 		for (index = rms_level; index < peak_level; index++) {
-			gdk_gc_set_foreground (vumeter->bg_gc,
+			gdk_gc_set_foreground (vumeter->gc,
 					       &vumeter->b_colors[index]);
-			gdk_draw_line (widget->window, vumeter->bg_gc,
+			gdk_draw_line (widget->window, vumeter->gc,
 				       x + 1, (y + height) - index,
 				       x + (width - 3), (y + height) - index);
 		}
 
 		for (index = 0; index < rms_level; index++) {
-			gdk_gc_set_foreground (vumeter->fg_gc,
+			gdk_gc_set_foreground (vumeter->gc,
 					       &vumeter->f_colors[index]);
-			gdk_draw_line (widget->window, vumeter->fg_gc,
+			gdk_draw_line (widget->window, vumeter->gc,
 				       x + 1, (y + height) - index,
 				       x + (width - 3), (y + height) - index);
 		}
@@ -299,17 +295,17 @@
 			       width, widget->allocation.height);
 
 		for (index = rms_level; index < peak_level; index++) {
-			gdk_gc_set_foreground (vumeter->bg_gc,
+			gdk_gc_set_foreground (vumeter->gc,
 					       &vumeter->b_colors[index]);
-			gdk_draw_line (widget->window, vumeter->bg_gc,
+			gdk_draw_line (widget->window, vumeter->gc,
 				       width - index - 1, 1,
 				       width - index - 1, height);
 		}
 
 		for (index = peak_level; index < width - 2; index++) {
-			gdk_gc_set_foreground (vumeter->fg_gc,
+			gdk_gc_set_foreground (vumeter->gc,
 					       &vumeter->f_colors[index]);
-			gdk_draw_line (widget->window, vumeter->bg_gc,
+			gdk_draw_line (widget->window, vumeter->gc,
 				       width - index - 1, 1,
 				       width - index - 1, height);
 		}

Modified: trunk/src/other/gtkvumeter.h
==============================================================================
--- trunk/src/other/gtkvumeter.h	(original)
+++ trunk/src/other/gtkvumeter.h	Wed Oct  1 23:34:44 2008
@@ -5,8 +5,8 @@
  *  Fri Jan 10 20:06:41 2003
  *  Copyright  2003  Todd Goyen
  *  wettoad knighthoodofbuh org
- *  Modified Iain Holmes <iaingnome gmail com> 
- *  Copyright  2004 - 2005 Iain Holmes
+ *  Modified Iain Holmes <iaingnome gmail com>
+ *  Copyright  2004 - 2008 Iain Holmes
  ****************************************************************************/
 
 #ifndef __GTKVUMETER_H__
@@ -39,15 +39,14 @@
 
 struct _GtkVUMeter {
 	GtkWidget widget;
-	
+
 	GdkColormap *colormap;
 	int colors;
-	
+
 	GdkColor *f_colors;
 	GdkColor *b_colors;
 
-	GdkGC *fg_gc;
-	GdkGC *bg_gc;
+	GdkGC *gc;
 
 	GtkVUMeterOrientation orientation;
 	double rms_level;
@@ -55,7 +54,7 @@
 	GtkVUMeterFallOff peaks_falloff;
 	int delay_peak_level;
 	double peak_level;
-	
+
 	MarlinScale scale;
 };
 
@@ -66,7 +65,7 @@
 GType    gtk_vumeter_get_type (void) G_GNUC_CONST;
 GtkWidget *gtk_vumeter_new (GtkVUMeterOrientation orientation);
 void gtk_vumeter_set_levels (GtkVUMeter *vumeter, double rms, double peak);
-void gtk_vumeter_set_peaks_falloff (GtkVUMeter *vumeter, 
+void gtk_vumeter_set_peaks_falloff (GtkVUMeter *vumeter,
 				    GtkVUMeterFallOff peaks_falloff);
 
 G_END_DECLS



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