rpms/gnome-applets/devel gnome-applets-2.16.0.1-mixer-icon-size.patch, NONE, 1.1 gnome-applets.spec, 1.179, 1.180

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Fri Sep 8 15:50:58 UTC 2006


Author: mclasen

Update of /cvs/dist/rpms/gnome-applets/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv16791

Modified Files:
	gnome-applets.spec 
Added Files:
	gnome-applets-2.16.0.1-mixer-icon-size.patch 
Log Message:
fix mixer resizing


gnome-applets-2.16.0.1-mixer-icon-size.patch:
 applet.c |   79 ++++++++++++++++++++++++++++++++++++---------------------------
 applet.h |    2 -
 2 files changed, 47 insertions(+), 34 deletions(-)

--- NEW FILE gnome-applets-2.16.0.1-mixer-icon-size.patch ---
--- gnome-applets-2.16.0.1/mixer/applet.c.icon-size	2006-09-08 11:19:20.000000000 -0400
+++ gnome-applets-2.16.0.1/mixer/applet.c	2006-09-08 11:46:29.000000000 -0400
@@ -57,6 +57,9 @@
 static void	gnome_volume_applet_init	(GnomeVolumeApplet *applet);
 static void	gnome_volume_applet_dispose	(GObject   *object);
 
+static void     gnome_volume_applet_size_allocate (GtkWidget     *widget, 
+						   GtkAllocation *allocation);
+
 static void	gnome_volume_applet_popup_dock	(GnomeVolumeApplet *applet);
 static void	gnome_volume_applet_popdown_dock (GnomeVolumeApplet *applet);
 
@@ -75,8 +78,6 @@
 						 GdkPixmap *pixmap);
 static void	gnome_volume_applet_orientation	(PanelApplet *applet,
 						 PanelAppletOrient orient);
-static void	gnome_volume_applet_size	(PanelApplet *applet,
-						 guint      size);
 
 static void	gnome_volume_applet_refresh	(GnomeVolumeApplet *applet,
 						 gboolean           force_refresh);
@@ -139,7 +140,6 @@
 {
   static const gchar *pix_filenames[] = {
     "audio-volume-muted",
-    "audio-volume-muted",
     "audio-volume-low",
     "audio-volume-medium",
     "audio-volume-high",
@@ -151,12 +151,11 @@
     if (applet->pix[n])
       g_object_unref (applet->pix[n]);
     
-    applet->pix[n] = gtk_icon_theme_load_icon (
-      	    applet->icon_theme,
-      	    pix_filenames[n],
-      	    panel_applet_get_size (&applet->parent),
-      	    0,
-      	    NULL);
+    applet->pix[n] = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+					       pix_filenames[n],
+					       applet->panel_size - 4,
+					       0,
+					       NULL);
     if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL) {
       GdkPixbuf *temp;
 
@@ -180,8 +179,8 @@
   gtkwidget_class->key_press_event = gnome_volume_applet_key;
   gtkwidget_class->button_press_event = gnome_volume_applet_button;
   gtkwidget_class->scroll_event = gnome_volume_applet_scroll;
+  gtkwidget_class->size_allocate = gnome_volume_applet_size_allocate;
   panelapplet_class->change_orient = gnome_volume_applet_orientation;
-  panelapplet_class->change_size = gnome_volume_applet_size;
   panelapplet_class->change_background = gnome_volume_applet_background;
 
   /* FIXME:
@@ -203,8 +202,8 @@
   applet->lock = FALSE;
   applet->state = -1;
   applet->prefs = NULL;
-  applet->icon_theme = gtk_icon_theme_get_default ();
   applet->dock = NULL;
+  applet->panel_size = 24;
 
   /* init pixbufs */
   init_pixbufs (applet);
@@ -230,7 +229,7 @@
 		    NULL);
 
   /* handle icon theme changes */
-  g_signal_connect (G_OBJECT (applet->icon_theme),
+  g_signal_connect (gtk_icon_theme_get_default (),
 		    "changed", G_CALLBACK (cb_theme_change),
 		    applet);
 
@@ -915,15 +914,30 @@
     PANEL_APPLET_CLASS (parent_class)->change_orient (_applet, orientation);
 }
 
-static void
-gnome_volume_applet_size (PanelApplet *applet,
-			  guint        size)
+void gnome_volume_applet_size_allocate (GtkWidget     *widget, 
+					GtkAllocation *allocation)
 {
-  init_pixbufs (GNOME_VOLUME_APPLET (applet));
-  gnome_volume_applet_refresh (GNOME_VOLUME_APPLET (applet), TRUE);
+  GnomeVolumeApplet *applet = GNOME_VOLUME_APPLET (widget);
+  PanelAppletOrient orient;
+
+  if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
+    GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
 
-  if (PANEL_APPLET_CLASS (parent_class)->change_size)
-    PANEL_APPLET_CLASS (parent_class)->change_size (applet, size);
+  orient = panel_applet_get_orient (PANEL_APPLET (applet));
+  
+  if (orient == PANEL_APPLET_ORIENT_UP || orient == PANEL_APPLET_ORIENT_DOWN) {
+    if (applet->panel_size == allocation->height)
+      return;
+    applet->panel_size = allocation->height;
+  }
+  else {
+    if (applet->panel_size == allocation->width)
+      return;
+    applet->panel_size = allocation->width;
+  }
+
+  init_pixbufs (applet);
+  gnome_volume_applet_refresh (applet, TRUE);
 }
 
 static void
@@ -1065,15 +1079,18 @@
     volume = gnome_volume_applet_get_volume (applet->mixer, first_track);
     mute = GST_MIXER_TRACK_HAS_FLAG (first_track,
 				     GST_MIXER_TRACK_MUTE);
-    if (volume <= 0)
-      mute = TRUE;
-
-    /* select image */
-    n = 3 * volume / 100 + 2;
-    if (n <= 0)
-      n = 1;
-    if (n >= 5)
-      n = 4;
+    if (volume <= 0) {
+	mute = TRUE;
+	n = 0;
+    }
+    else {
+      /* select image */
+      n = 3 * volume / 100 + 1;
+      if (n < 1)
+	n = 1;
+      if (n > 3)
+	n = 3;
+    }
   }
 
   did_change = (force_refresh || (STATE (volume, mute) != applet->state) ||
@@ -1081,11 +1098,7 @@
   applet->force_next_update = FALSE;
 
   if (did_change) {
-    if (mute) {
-      pixbuf = applet->pix[0];
-    } else {
-      pixbuf = applet->pix[n];
-    }
+    pixbuf = applet->pix[n];
 
     gtk_image_set_from_pixbuf (applet->image, pixbuf);
     applet->state = STATE (volume, mute);
--- gnome-applets-2.16.0.1/mixer/applet.h.icon-size	2006-09-08 11:20:48.000000000 -0400
+++ gnome-applets-2.16.0.1/mixer/applet.h	2006-09-08 11:30:07.000000000 -0400
@@ -83,8 +83,8 @@
   GtkWidget *prefs;
 
   /* icon theme */
-  GtkIconTheme *icon_theme;
   GdkPixbuf *pix[5];
+  gint panel_size;
 
   /* use same object for setting tooltop */
   GtkTooltips *tooltips;


Index: gnome-applets.spec
===================================================================
RCS file: /cvs/dist/rpms/gnome-applets/devel/gnome-applets.spec,v
retrieving revision 1.179
retrieving revision 1.180
diff -u -r1.179 -r1.180
--- gnome-applets.spec	5 Sep 2006 04:04:16 -0000	1.179
+++ gnome-applets.spec	8 Sep 2006 15:50:55 -0000	1.180
@@ -32,7 +32,7 @@
 Summary:        Small applications for the GNOME panel
 Name:     	gnome-applets
 Version: 	2.16.0.1
-Release:  	1%{?dist}
+Release:  	2%{?dist}
 Epoch:          1
 License:	GPL
 Group:          User Interface/Desktops
@@ -58,6 +58,9 @@
 # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=204858
 Patch21: gnome-applets-2.15.90-poll-less.patch
 
+# http://bugzilla.gnome.org/show_bug.cgi?id=354986
+Patch22: gnome-applets-2.16.0.1-mixer-icon-size.patch
+
 URL:		http://www.gnome.org/
 
 BuildRoot:	%{_tmppath}/%{name}-%{version}-root
@@ -144,6 +147,7 @@
 %patch20 -p1 -b .redraw
 
 %patch21 -p1 -b .poll-less
+%patch22 -p1 -b .mixer-icon-size
 
 cp gswitchit/gswitchit-applet.png  gswitchit/gswitchit-properties-capplet.png
 
@@ -311,6 +315,9 @@
 %{_libdir}/pkgconfig/gweather.pc
 
 %changelog
+* Fri Sep  8 2006 Matthias Clasen <mclasen at redhat.com> - 1:2.16.0.1-2
+- Fix the resizing behaviour of the mixer applet
+
 * Mon Sep  4 2006 Matthias Clasen <mclasen at redhat.com> - 1:2.16.0.1-1.fc6
 - Update to 2.16.0.1
 




More information about the fedora-cvs-commits mailing list