[gpm] [Patch] Remove the icon attachment when showing the battery capacity warning



Hello there,

When I used to use GPM version 2.24 in Fedora 9, I always found that the
notification indication a low battery capacity was in the right place
where I expected it to be(at least the location was constant). However
once I switched to Fedora 11, all of a sudden the notification was
showing up somewhere just floating, pointing to no apparent icon, I
suppose this is because the notification is shown before the gnome power
manager icon can be shown on the notification area. 

Therefore I decided to create a patch where the status icon pointer is
temporarily set to NULL while showing the capacity warning, but is
restored once the notification is shown which at least makes the
notification come up somewhere sensible.

By the way, I hope this is the right place to propose patches, if I made
a mistake, my apologies for having done so.:)

Regards,
Pramod Dematagoda
Index: gpm-notify.c
===================================================================
--- gpm-notify.c	(revision 3399)
+++ gpm-notify.c	(working copy)
@@ -317,6 +317,7 @@
 {
 	gchar *msg;
 	const gchar *title;
+	GtkStatusIcon *backup_ptr;
 
 	/* don't show when running under GDM */
 	if (g_getenv ("RUNNING_UNDER_GDM") != NULL) {
@@ -329,6 +330,15 @@
 				 "which means that it may be old or broken."),
 			       capacity);
 
+	/* 
+	 * Set the status icon pointer as NULL so that the notification 
+	 * is shown where it is expected and not just floating about some place. 
+	 *
+	 * After the notification is shown, the status icon is restored.
+	 */
+	backup_ptr = notify->priv->status_icon;
+	notify->priv->status_icon = NULL;
+
 	gpm_notify_create (notify, title, msg, GPM_NOTIFY_TIMEOUT_LONG,
 			   GTK_STOCK_DIALOG_WARNING,
 			   GPM_NOTIFY_URGENCY_CRITICAL);
@@ -342,6 +352,9 @@
 	                                 notify, NULL);
 
 	gpm_notify_show (notify);
+
+	notify->priv->status_icon = backup_ptr;
+
 	g_free (msg);
 	return TRUE;
 }


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