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