Re: [PATCH] notification hints for weather applet



On Thu, 2005-08-25 at 01:25 +0800, Davyd Madeley wrote:
> Quoting Rodrigo Moya <rodrigo gnome-db org>:
> 
> > Since I saw this was added to the battery applet, I added it also to the
> > weather applet.
> 
> Do you need to free *hints afterwards? I would expect you do... although I
> notice that I forgot to do it in the battstat code.
> 
yeah right, updated patch attached. Anyway, the notify_hints_destroy
call is missing in the notify.h, and I guess we really want it public,
right Christian?
-- 
Rodrigo Moya <rodrigo gnome-db org>
? docs/gweather-C.omf
? docs/gweather-es.omf
? docs/es/.xml2po.mo
? docs/es/gweather.xml
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-applets/gweather/ChangeLog,v
retrieving revision 1.398
diff -u -p -r1.398 ChangeLog
--- ChangeLog	24 Aug 2005 22:18:13 -0000	1.398
+++ ChangeLog	24 Aug 2005 23:00:54 -0000
@@ -1,3 +1,7 @@
+2005-08-25  Rodrigo Moya <rodrigo novell com>
+
+	* gweather-applet.c (update_finish): use hints for the notification.
+	
 2005-08-24  Ryan Lortie  <desrt desrt ca>
 
 	* Locations.xml.in: Removed broken duplicate Wildwood, New Jersey
Index: gweather-applet.c
===================================================================
RCS file: /cvs/gnome/gnome-applets/gweather/gweather-applet.c,v
retrieving revision 1.96
diff -u -p -r1.96 gweather-applet.c
--- gweather-applet.c	10 Jul 2005 04:40:34 -0000	1.96
+++ gweather-applet.c	24 Aug 2005 23:00:54 -0000
@@ -426,9 +426,12 @@ void update_finish (WeatherInfo *info)
     static int gw_fault_counter = 0;
 #ifdef HAVE_LIBNOTIFY
     static NotifyIcon *icon = NULL;
+    NotifyHints *hints;
     char *notification_message, *notification_detail;
     GdkPixbuf *pixbuf = NULL;
     GConfClient *conf;
+    int x, y;
+    GtkRequisition size;
 #endif
     char *s;
     GWeatherApplet *gw_applet = info->applet;
@@ -506,6 +509,15 @@ void update_finish (WeatherInfo *info)
                 g_free (tmp);
             }
             
+	    gdk_window_get_origin (GTK_WIDGET (gw_applet->applet)->window, &x, &y);
+	    gtk_widget_size_request (GTK_WIDGET (gw_applet->applet), &size);
+	    x += size.width / 2;
+	    y += size.height;
+
+	    hints = notify_hints_new ();
+	    notify_hints_set_int (hints, "x", x);
+	    notify_hints_set_int (hints, "y", y);
+	    
             /* Show notification */
             notification_message = g_strdup_printf ("%s: %s",
                                                     weather_info_get_location (info),
@@ -521,13 +533,14 @@ void update_finish (WeatherInfo *info)
 	                                   notification_detail,	/* body text */
 	                                   icon,		/* icon */
 	                                   TRUE, 0,		/* expiry, server default */
-	                                   NULL,		/* hints */
+	                                   hints,		/* hints */
 	                                   NULL,		/* no user_data */
 	                                   0))			/* no actions */
 	        g_warning ("Could not send notification to daemon\n");
 
 	    g_free (notification_message);
 	    g_free (notification_detail);
+	    notify_hints_destroy (hints);
 #endif
     }
 }


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