rpms/gnome-power-manager/devel no-background.patch, NONE, 1.1 gnome-power-manager.spec, 1.97, 1.98

Matthias Clasen (mclasen) fedora-extras-commits at redhat.com
Fri Oct 5 18:03:40 UTC 2007


Author: mclasen

Update of /cvs/extras/rpms/gnome-power-manager/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv17317

Modified Files:
	gnome-power-manager.spec 
Added Files:
	no-background.patch 
Log Message:
make the inhibit applet work with all panel backgrounds


no-background.patch:

--- NEW FILE no-background.patch ---
diff -up gnome-power-manager-2.20.0/applets/inhibit/inhibit-applet.c.no-background gnome-power-manager-2.20.0/applets/inhibit/inhibit-applet.c
--- gnome-power-manager-2.20.0/applets/inhibit/inhibit-applet.c.no-background	2007-08-14 16:29:10.000000000 -0400
+++ gnome-power-manager-2.20.0/applets/inhibit/inhibit-applet.c	2007-10-05 14:00:54.000000000 -0400
@@ -48,6 +48,7 @@ typedef struct{
 	PanelApplet parent;
 	/* applet state */
 	guint cookie;
+	GtkWidget *image;
 	/* the icon and a cache for size*/
 	GdkPixbuf *icon;
 	gint icon_width, icon_height;
@@ -225,6 +226,8 @@ gpm_applet_get_icon (GpmInhibitApplet *a
 	/* update size cache */
 	applet->icon_height = gdk_pixbuf_get_height (applet->icon);
 	applet->icon_width = gdk_pixbuf_get_width (applet->icon);
+
+	gtk_image_set_from_pixbuf (GTK_IMAGE (applet->image), applet->icon);
 }
 
 /**
@@ -278,6 +281,9 @@ gpm_applet_draw_cb (GpmInhibitApplet *ap
 		return FALSE;
 	}
 
+	return FALSE;
+
+#if 0
 	/* if no icon, then don't try to display */
 	if (applet->icon == NULL) {
 		return FALSE;
@@ -309,6 +315,7 @@ gpm_applet_draw_cb (GpmInhibitApplet *ap
 			 GDK_RGB_DITHER_NONE, 0, 0);
 
 	return TRUE;
+#endif
 }
 
 /**
@@ -318,10 +325,34 @@ gpm_applet_draw_cb (GpmInhibitApplet *ap
  **/
 static void
 gpm_applet_change_background_cb (GpmInhibitApplet *applet,
-				 PanelAppletBackgroundType arg1,
-				 GdkColor *arg2, GdkPixmap *arg3, gpointer data)
+				 PanelAppletBackgroundType type,
+				 GdkColor *colour, GdkPixmap *pixmap, gpointer data)
 {
-	gtk_widget_queue_draw (GTK_WIDGET (applet));
+  GtkRcStyle *rc_style;
+  GtkStyle *style;
+
+  /* reset style */
+  gtk_widget_set_style (GTK_WIDGET (applet), NULL);
+  rc_style = gtk_rc_style_new ();
+  gtk_widget_modify_style (GTK_WIDGET (applet), rc_style);
+  gtk_rc_style_unref (rc_style);
+
+  switch (type) {
+    case PANEL_NO_BACKGROUND:
+      break;
+    case PANEL_COLOR_BACKGROUND:
+      gtk_widget_modify_bg (GTK_WIDGET (applet),
+                            GTK_STATE_NORMAL, colour);
+      break;
+    case PANEL_PIXMAP_BACKGROUND:
+      style = gtk_style_copy (GTK_WIDGET (applet)->style);
+      if (style->bg_pixmap[GTK_STATE_NORMAL])
+        g_object_unref (style->bg_pixmap[GTK_STATE_NORMAL]);
+      style->bg_pixmap[GTK_STATE_NORMAL] = g_object_ref (pixmap);
+      gtk_widget_set_style (GTK_WIDGET (applet), style);
+      g_object_unref (style);
+      break;
+  }
 }
 
 /**
@@ -591,6 +622,9 @@ gpm_inhibit_applet_init (GpmInhibitApple
 	applet->connection = NULL;
 	applet->proxy = NULL;
 
+	applet->image = gtk_image_new ();
+	gtk_container_add (GTK_CONTAINER (applet), applet->image);
+
 	/* Add application specific icons to search path */
 	gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
                                            GPM_DATA G_DIR_SEPARATOR_S "icons");
@@ -617,17 +651,21 @@ gpm_inhibit_applet_init (GpmInhibitApple
 	g_signal_connect (G_OBJECT(applet), "expose-event",
 			  G_CALLBACK(gpm_applet_draw_cb), NULL);
 
+#if 0
 	/* We use g_signal_connect_after because letting the panel draw
 	 * the background is the only way to have the correct
 	 * background when a theme defines a background picture. */
 	g_signal_connect_after (G_OBJECT(applet), "expose-event",
 				G_CALLBACK(gpm_applet_draw_cb), NULL);
+#endif
 
 	g_signal_connect (G_OBJECT(applet), "change-background",
 			  G_CALLBACK(gpm_applet_change_background_cb), NULL);
 
+#if 0
 	g_signal_connect (G_OBJECT(applet), "change-orient",
 			  G_CALLBACK(gpm_applet_draw_cb), NULL);
+#endif
 
 	g_signal_connect (G_OBJECT(applet), "destroy",
 			  G_CALLBACK(gpm_applet_destroy_cb), NULL);


Index: gnome-power-manager.spec
===================================================================
RCS file: /cvs/extras/rpms/gnome-power-manager/devel/gnome-power-manager.spec,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -r1.97 -r1.98
--- gnome-power-manager.spec	17 Sep 2007 19:31:20 -0000	1.97
+++ gnome-power-manager.spec	5 Oct 2007 18:02:59 -0000	1.98
@@ -5,10 +5,12 @@
 Summary: GNOME Power Manager
 Name: gnome-power-manager
 Version: 2.20.0
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: GPLv2+ and GFDL+
 Group: Applications/System
 Source: http://download.gnome.org/sources/gnome-power-manager/2.20/gnome-power-manager-%{version}.tar.bz2
+# http://bugzilla.gnome.org/show_bug.cgi?id=483826
+Patch0: no-background.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 URL: http://gnome-power.sourceforge.net/
 BuildPrereq: libgnomeui-devel
@@ -44,6 +46,7 @@
 
 %prep
 %setup -q
+%patch0 -p1 -b .no-background
 
 %build
 %configure \
@@ -118,6 +121,10 @@
 %{_datadir}/gnome-2.0/ui/GNOME_InhibitApplet.xml
 
 %changelog 
+* Fri Oct  5 2007 Matthias Clasen <mclasen at redhat.com> - 2.20.0-2
+- Make the inhibit applet work with all background settings 
+  of the panel.
+
 * Mon Sep 17 2007 Matthias Clasen <mclasen at redhat.com> - 2.20.0-1
 - Update to 2.20.0
 




More information about the fedora-extras-commits mailing list