[Goodies-commits] r7363 - in xfce4-power-manager/trunk: . libxfpm src

Ali Abdallah aliov at xfce.org
Mon May 18 18:28:12 CEST 2009


Author: aliov
Date: 2009-05-18 16:28:12 +0000 (Mon, 18 May 2009)
New Revision: 7363

Modified:
   xfce4-power-manager/trunk/ChangeLog
   xfce4-power-manager/trunk/libxfpm/xfpm-notify.c
   xfce4-power-manager/trunk/src/xfpm-debug.c
   xfce4-power-manager/trunk/src/xfpm-debug.h
Log:
	* : libxfpm/xfpm-notify Remove unused parameter to some functions.
	* : xfpm-debug.h Check if the compiler supports variadic macros.
	

Modified: xfce4-power-manager/trunk/ChangeLog
===================================================================
--- xfce4-power-manager/trunk/ChangeLog	2009-05-18 12:46:48 UTC (rev 7362)
+++ xfce4-power-manager/trunk/ChangeLog	2009-05-18 16:28:12 UTC (rev 7363)
@@ -1,4 +1,7 @@
-
+2009-05-18 18:35
+	* : libxfpm/xfpm-notify Remove unused parameter to some functions.
+	* : xfpm-debug.h Check if the compiler supports variadic macros.
+	
 2009-05-17 13:34 Ali aliov at xfce.org 
 	 * : Fix a minor issue in the settings dialog
 

Modified: xfce4-power-manager/trunk/libxfpm/xfpm-notify.c
===================================================================
--- xfce4-power-manager/trunk/libxfpm/xfpm-notify.c	2009-05-18 12:46:48 UTC (rev 7362)
+++ xfce4-power-manager/trunk/libxfpm/xfpm-notify.c	2009-05-18 16:28:12 UTC (rev 7363)
@@ -46,8 +46,7 @@
 
 static void xfpm_notify_finalize   (GObject *object);
 
-static NotifyNotification * xfpm_notify_new_notification_internal (XfpmNotify *notify, 
-								   const gchar *title, 
+static NotifyNotification * xfpm_notify_new_notification_internal (const gchar *title, 
 								   const gchar *message, 
 								   const gchar *icon_name, 
 								   guint timeout, 
@@ -92,11 +91,14 @@
 
     notify = XFPM_NOTIFY(object);
     
+    xfpm_notify_close_normal (notify);
+    xfpm_notify_close_critical (notify);
+    
     G_OBJECT_CLASS(xfpm_notify_parent_class)->finalize(object);
 }
 
 static void
-xfpm_notify_set_icon (XfpmNotify *notify, NotifyNotification *n, const gchar *icon_name )
+xfpm_notify_set_notification_icon (NotifyNotification *n, const gchar *icon_name )
 {
     GdkPixbuf *pix = xfpm_load_icon (icon_name, 48);
     
@@ -109,7 +111,7 @@
 }
 
 static NotifyNotification *
-xfpm_notify_new_notification_internal (XfpmNotify *notify, const gchar *title, const gchar *message,
+xfpm_notify_new_notification_internal (const gchar *title, const gchar *message,
 				       const gchar *icon_name, guint timeout,
 				       XfpmNotifyUrgency urgency, GtkStatusIcon *icon)
 {
@@ -118,12 +120,12 @@
     n = notify_notification_new (title, message, NULL, NULL);
     
     if ( icon_name )
-    	xfpm_notify_set_icon (notify, n, icon_name);
+    	xfpm_notify_set_notification_icon (n, icon_name);
 	
     if ( icon )
     	notify_notification_attach_to_status_icon (n, icon);
 	
-    notify_notification_set_urgency (n, urgency);
+    notify_notification_set_urgency (n, (NotifyUrgency)urgency);
     notify_notification_set_timeout (n, timeout);
     
     return n;
@@ -137,7 +139,7 @@
 }
 
 static void
-xfpm_notify_close_critical_cb (NotifyNotification *n, XfpmNotify *notify)
+xfpm_notify_close_critical_cb (NotifyNotification *n, gpointer data)
 {
     g_object_unref (G_OBJECT (n));
 }
@@ -187,7 +189,7 @@
     if ( !simple )
         xfpm_notify_close_notification (notify);
     
-    n = xfpm_notify_new_notification_internal (notify, title, 
+    n = xfpm_notify_new_notification_internal (title, 
 				               text, icon_name, 
 					       timeout, urgency, 
 					       icon);
@@ -203,7 +205,7 @@
 						  XfpmNotifyUrgency urgency,
 						  GtkStatusIcon *icon)
 {
-    NotifyNotification *n = xfpm_notify_new_notification_internal (notify, title, 
+    NotifyNotification *n = xfpm_notify_new_notification_internal (title, 
 							           text, icon_name, 
 								   timeout, urgency, 
 								   icon);
@@ -246,7 +248,8 @@
     g_object_set_data (G_OBJECT (notify), "critical", n);
     
     g_signal_connect (G_OBJECT (n), "closed", 
-		      G_CALLBACK (xfpm_notify_close_critical_cb), notify);
+		      G_CALLBACK (xfpm_notify_close_critical_cb), NULL);
+		      
     g_idle_add ((GSourceFunc) xfpm_notify_show, n);
 }
 

Modified: xfce4-power-manager/trunk/src/xfpm-debug.c
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-debug.c	2009-05-18 12:46:48 UTC (rev 7362)
+++ xfce4-power-manager/trunk/src/xfpm-debug.c	2009-05-18 16:28:12 UTC (rev 7363)
@@ -31,7 +31,7 @@
 
 #include "xfpm-debug.h"
 
-#ifdef DEBUG
+#if  defined(DEBUG) && defined(VARIADIC_MACRO_SUPPORTED)
 
 void xfpm_debug_enum (const gchar *func, const gchar *file, gint line, 
 		      const gchar *text, gint v_enum, GType type)
@@ -69,7 +69,7 @@
     g_vasprintf (&buffer, format, args);
     va_end (args);
 	
-    fprintf(stdout, "TRACE[%s:%d] %s(): ",file,line,func);
+    fprintf(stdout, "TRACE[%s:%d] %s(): ", file, line, func);
     fprintf(stdout, "%s: %s", buffer, content);
     fprintf(stdout, "\n");
     
@@ -78,4 +78,4 @@
     g_free (buffer);
 }
 
-#endif /*DEBUG*/
+#endif /*DEBUG && VARIADIC_MACRO_SUPPORTED*/

Modified: xfce4-power-manager/trunk/src/xfpm-debug.h
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-debug.h	2009-05-18 12:46:48 UTC (rev 7362)
+++ xfce4-power-manager/trunk/src/xfpm-debug.h	2009-05-18 16:28:12 UTC (rev 7363)
@@ -32,14 +32,20 @@
 
 #ifdef DEBUG
 
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define VARIADIC_MACRO_SUPPORTED
+#elif defined(__GNUC__) && __GNUC__ >= 3
+#define VARIADIC_MACRO_SUPPORTED
+#endif
+
+#ifdef VARIADIC_MACRO_SUPPORTED
+
 #define XFPM_DEBUG_ENUM(_text, _value, _type)\
     xfpm_debug_enum (__func__, __FILE__, __LINE__, _text, _value, _type)
 
 #define XFPM_DEBUG_ENUM_FULL(_value, _type, ...)\
     xfpm_debug_enum_full (__func__, __FILE__, __LINE__, _value, _type, __VA_ARGS__)
 
-
-
 void		xfpm_debug_enum 	(const gchar *func,
 					 const gchar *file,
 					 gint line,
@@ -54,11 +60,19 @@
 					 GType type,
 					 const gchar *format,
 					 ...);
-#else
 
+#else /* !VARIADIC_MACRO_SUPPORTED */
+
 #define XFPM_DEBUG_ENUM(_text, _value, _type)
 #define XFPM_DEBUG_ENUM_FULL(_value, _type, ...)
 
+#endif /* VARIADIC_MACRO_SUPPORTED */
+
+#else /* DEBUG */
+
+#define XFPM_DEBUG_ENUM(_text, _value, _type)
+#define XFPM_DEBUG_ENUM_FULL(_value, _type, ...)
+
 #endif
 
 G_END_DECLS




More information about the Goodies-commits mailing list