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-06 21:34:32.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);
}
/**
@@ -272,12 +275,11 @@ gpm_applet_draw_cb (GpmInhibitApplet *ap
}
/* retrieve applet size */
- gpm_applet_get_icon (applet);
gpm_applet_check_size (applet);
- if (applet->size <= 2) {
- return FALSE;
- }
+ return FALSE;
+
+#if 0
/* if no icon, then don't try to display */
if (applet->icon == NULL) {
return FALSE;
@@ -309,6 +311,7 @@ gpm_applet_draw_cb (GpmInhibitApplet *ap
GDK_RGB_DITHER_NONE, 0, 0);
return TRUE;
+#endif
}
/**
@@ -318,10 +321,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 +618,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 +647,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);