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

Ali Abdallah aliov at xfce.org
Mon May 18 20:34:30 CEST 2009


Author: aliov
Date: 2009-05-18 18:34:30 +0000 (Mon, 18 May 2009)
New Revision: 7366

Modified:
   xfce4-power-manager/trunk/ChangeLog
   xfce4-power-manager/trunk/libxfpm/hal-battery.c
   xfce4-power-manager/trunk/settings/xfpm-settings.c
   xfce4-power-manager/trunk/src/xfpm-battery.c
   xfce4-power-manager/trunk/src/xfpm-battery.h
   xfce4-power-manager/trunk/src/xfpm-config.h
   xfce4-power-manager/trunk/src/xfpm-debug.c
   xfce4-power-manager/trunk/src/xfpm-main.c
   xfce4-power-manager/trunk/src/xfpm-network-manager.c
   xfce4-power-manager/trunk/src/xfpm-shutdown.c
   xfce4-power-manager/trunk/src/xfpm-xfconf.c
Log:
	* : Fix inactivity sleep string in the settings dialog to
	Suspend instead of suspend (same for hibernate).
	* : Change the storage type of some variables used in xfpm-debug.c
	* : some optimization for const fuctions.
	* : use G_GNUC_NORETURN in the xfpm_start and the 
	xfpm_show_version functions.

Modified: xfce4-power-manager/trunk/ChangeLog
===================================================================
--- xfce4-power-manager/trunk/ChangeLog	2009-05-18 18:12:30 UTC (rev 7365)
+++ xfce4-power-manager/trunk/ChangeLog	2009-05-18 18:34:30 UTC (rev 7366)
@@ -1,3 +1,11 @@
+2009-05-18 19:40
+	* : Fix inactivity sleep string in the settings dialog to
+	Suspend instead of suspend (same for hibernate).
+	* : Change the storage type of some variables used in xfpm-debug.c
+	* : some optimization for const fuctions.
+	* : use G_GNUC_NORETURN in the xfpm_start and the 
+	xfpm_show_version functions.
+
 2009-05-18 18:35
 	* : libxfpm/xfpm-notify Remove unused parameter to some functions.
 	* : xfpm-debug.h Check if the compiler supports variadic macros.

Modified: xfce4-power-manager/trunk/libxfpm/hal-battery.c
===================================================================
--- xfce4-power-manager/trunk/libxfpm/hal-battery.c	2009-05-18 18:12:30 UTC (rev 7365)
+++ xfce4-power-manager/trunk/libxfpm/hal-battery.c	2009-05-18 18:34:30 UTC (rev 7366)
@@ -325,7 +325,7 @@
     G_OBJECT_CLASS(hal_battery_parent_class)->finalize(object);
 }
 
-static HalDeviceType
+static HalDeviceType G_GNUC_PURE
 hal_battery_type_enum_from_string(const gchar *string)
 {
     if ( !g_strcmp0 (string, "primary") )
@@ -375,12 +375,10 @@
 	type_enum  = hal_battery_type_enum_from_string(type);
 	g_free(type);
     }
- 
-    //g_free (udi);
     return type_enum;
 }
 
-static guint 
+static guint G_GNUC_CONST
 _get_battery_percentage (guint32 last_full, guint32 current)
 {
     guint val = 100;
@@ -440,7 +438,7 @@
 		
 }
 
-static const gchar *
+static const gchar * G_GNUC_PURE
 _translate_technology (const gchar *tech)
 {
     if ( !g_strcmp0 (tech, "lithium-ion") )
@@ -463,7 +461,7 @@
     return _("Unknown");
 }
 
-static const gchar *
+static const gchar * G_GNUC_PURE
 _translate_unit (const gchar *unit)
 {
     if ( !g_strcmp0 (unit, "mWh") )

Modified: xfce4-power-manager/trunk/settings/xfpm-settings.c
===================================================================
--- xfce4-power-manager/trunk/settings/xfpm-settings.c	2009-05-18 18:12:30 UTC (rev 7365)
+++ xfce4-power-manager/trunk/settings/xfpm-settings.c	2009-05-18 18:34:30 UTC (rev 7366)
@@ -222,7 +222,7 @@
 static void
 set_hibernate_inactivity (GtkWidget *w, XfconfChannel *channel)
 {
-    if (!xfconf_channel_set_string (channel, INACTIVITY_SLEEP_MODE, "hibernate") )
+    if (!xfconf_channel_set_string (channel, INACTIVITY_SLEEP_MODE, "Hibernate") )
     {
 	g_critical ("Cannot set value hibernate for property %s", INACTIVITY_SLEEP_MODE);
     }
@@ -231,7 +231,7 @@
 static void
 set_suspend_inactivity (GtkWidget *w, XfconfChannel *channel)
 {
-    if (!xfconf_channel_set_string (channel, INACTIVITY_SLEEP_MODE, "suspend") )
+    if (!xfconf_channel_set_string (channel, INACTIVITY_SLEEP_MODE, "Suspend") )
     {
 	g_critical ("Cannot set value suspend for property %s", INACTIVITY_SLEEP_MODE);
     }
@@ -1227,10 +1227,10 @@
     g_signal_connect (inact_hibernate, "toggled",
 		      G_CALLBACK (set_hibernate_inactivity), channel);
 		      
-    str = xfconf_channel_get_string (channel, INACTIVITY_SLEEP_MODE, "suspend");
-    if ( xfpm_strequal (str, "suspend") )
+    str = xfconf_channel_get_string (channel, INACTIVITY_SLEEP_MODE, "Suspend");
+    if ( xfpm_strequal (str, "Suspend") )
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (inact_suspend), TRUE);
-    else if ( xfpm_strequal (str, "hibernate"))
+    else if ( xfpm_strequal (str, "Hibernate"))
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (inact_hibernate), TRUE);
     else 
     {

Modified: xfce4-power-manager/trunk/src/xfpm-battery.c
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-battery.c	2009-05-18 18:12:30 UTC (rev 7365)
+++ xfce4-power-manager/trunk/src/xfpm-battery.c	2009-05-18 18:34:30 UTC (rev 7366)
@@ -82,7 +82,7 @@
 
 G_DEFINE_TYPE(XfpmBattery, xfpm_battery, G_TYPE_OBJECT)
 
-static const gchar *
+static const gchar * G_GNUC_CONST
 xfpm_battery_get_icon_index (HalDeviceType type, guint percent)
 {
     if (percent < 10) {
@@ -99,7 +99,7 @@
     return "100";
 }
 
-static const gchar *
+static const gchar * G_GNUC_CONST
 xfpm_battery_get_message_from_battery_state (XfpmBatteryState state, gboolean adapter_present)
 {
     switch (state)
@@ -247,7 +247,7 @@
     }
 }
 
-static const gchar *
+static const gchar * G_GNUC_CONST
 _get_battery_name (HalDeviceType type)
 {
     if ( type ==  HAL_DEVICE_TYPE_UPS)
@@ -264,7 +264,7 @@
     return _("Your Battery");
 }
 
-static const gchar *
+static const gchar * G_GNUC_PURE
 xfpm_battery_get_battery_state (XfpmBatteryState *state, 
 				gboolean is_charging, 
 				gboolean is_discharging,

Modified: xfce4-power-manager/trunk/src/xfpm-battery.h
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-battery.h	2009-05-18 18:12:30 UTC (rev 7365)
+++ xfce4-power-manager/trunk/src/xfpm-battery.h	2009-05-18 18:34:30 UTC (rev 7366)
@@ -56,13 +56,13 @@
 GType        		 xfpm_battery_get_type           (void) G_GNUC_CONST;
 XfpmBattery    		*xfpm_battery_new                (const HalBattery *device);
 
-const HalBattery	*xfpm_battery_get_device         (XfpmBattery *battery);
+const HalBattery	*xfpm_battery_get_device         (XfpmBattery *battery) G_GNUC_PURE;
 
-XfpmBatteryState         xfpm_battery_get_state          (XfpmBattery *battery);
+XfpmBatteryState         xfpm_battery_get_state          (XfpmBattery *battery) G_GNUC_PURE;
 
 GtkStatusIcon  		*xfpm_battery_get_status_icon    (XfpmBattery *battery);
 
-const gchar    		*xfpm_battery_get_icon_name      (XfpmBattery *battery);
+const gchar    		*xfpm_battery_get_icon_name      (XfpmBattery *battery) G_GNUC_PURE;
 
 G_END_DECLS
 

Modified: xfce4-power-manager/trunk/src/xfpm-config.h
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-config.h	2009-05-18 18:12:30 UTC (rev 7365)
+++ xfce4-power-manager/trunk/src/xfpm-config.h	2009-05-18 18:34:30 UTC (rev 7366)
@@ -57,12 +57,10 @@
 
 #define 	GENERAL_NOTIFICATION_CFG    "/xfce4-power-manager/general-notification"
 
-#ifdef HAVE_LIBNOTIFY
 #define 	BATT_STATE_NOTIFICATION_CFG "/xfce4-power-manager/battery-state-notification"  /* default TRUE */
 
 #define 	SHOW_SLEEP_ERRORS_CFG       "/xfce4-power-manager/show-sleep-errors"
 #define 	SHOW_POWER_MANAGEMENT_ERROR "/xfce4-power-manager/show-power-management-error"
-#endif
 
 #define 	SHOW_TRAY_ICON_CFG          "/xfce4-power-manager/show-tray-icon"              /* default 0 = always,1 = when charging or discharging, 2 = when battery is present */
 

Modified: xfce4-power-manager/trunk/src/xfpm-debug.c
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-debug.c	2009-05-18 18:12:30 UTC (rev 7365)
+++ xfce4-power-manager/trunk/src/xfpm-debug.c	2009-05-18 18:34:30 UTC (rev 7366)
@@ -36,8 +36,8 @@
 void xfpm_debug_enum (const gchar *func, const gchar *file, gint line, 
 		      const gchar *text, gint v_enum, GType type)
 {
-    static gchar *content = NULL;
-    static GValue __value__ = { 0, };
+    gchar *content = NULL;
+    GValue __value__ = { 0, };
 
     g_value_init (&__value__, type);
     g_value_set_enum (&__value__, v_enum);
@@ -57,8 +57,8 @@
     va_list args;
     gchar *buffer;
     
-    static gchar *content = NULL;
-    static GValue __value__ = { 0, };
+    gchar *content = NULL;
+    GValue __value__ = { 0, };
     
     g_value_init (&__value__, type);
     g_value_set_enum (&__value__, v_enum);

Modified: xfce4-power-manager/trunk/src/xfpm-main.c
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-main.c	2009-05-18 18:12:30 UTC (rev 7365)
+++ xfce4-power-manager/trunk/src/xfpm-main.c	2009-05-18 18:34:30 UTC (rev 7366)
@@ -47,7 +47,7 @@
 static gchar    *client_id = NULL;
 static gboolean no_daemon  = FALSE;
 
-static void
+static void G_GNUC_NORETURN
 show_version (void)
 {
     g_print (_("\n"
@@ -55,6 +55,8 @@
              "Part of the Xfce Goodies Project\n"
              "http://goodies.xfce.org\n\n"
              "Licensed under the GNU GPL.\n\n"), VERSION);
+
+    exit (EXIT_SUCCESS);
 }
 
 static void
@@ -65,14 +67,14 @@
     xfpm_manager_stop (manager);
 }
 
-static void
+static void G_GNUC_NORETURN
 xfpm_start (DBusGConnection *bus)
 {
     XfpmManager *manager;
     XfpmSession *session;
     GError *error = NULL;
     
-    TRACE("Starting the power manager\n");
+    TRACE ("Starting the power manager");
     session = xfpm_session_new ();
     
     if ( client_id != NULL )
@@ -96,7 +98,7 @@
     } 
     else 
     {
-        g_warning("Unable to set up POSIX signal handlers: %s", error->message);
+        g_warning ("Unable to set up POSIX signal handlers: %s", error->message);
         g_error_free(error);
     }
 
@@ -109,6 +111,8 @@
     gtk_main ();
     
     g_object_unref (session);
+    
+    exit (EXIT_SUCCESS);
 }
 
 int main(int argc, char **argv)
@@ -157,7 +161,6 @@
     if ( version )    
     {
 	show_version();
-    	return EXIT_SUCCESS;
     }
     
     if ( run + quit + config + version > 1 )

Modified: xfce4-power-manager/trunk/src/xfpm-network-manager.c
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-network-manager.c	2009-05-18 18:12:30 UTC (rev 7365)
+++ xfce4-power-manager/trunk/src/xfpm-network-manager.c	2009-05-18 18:34:30 UTC (rev 7366)
@@ -38,6 +38,7 @@
     GError          *error = NULL;
     
     bus = dbus_g_bus_get ( DBUS_BUS_SYSTEM, &error);
+    
     if ( error )
     {
 	g_warning("%s", error->message);
@@ -45,7 +46,6 @@
 	return FALSE;
     }
     
-    
     proxy = dbus_g_proxy_new_for_name (bus,
 				       "org.freedesktop.NetworkManager",
 				       "/org/freedesktop/NetworkManager",
@@ -53,7 +53,7 @@
 				       
     if (!proxy)
     {
-	g_critical ("Failed to create proxy for Network Manager interface");
+	g_warning ("Failed to create proxy for Network Manager interface");
 	return FALSE;
     }
     

Modified: xfce4-power-manager/trunk/src/xfpm-shutdown.c
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-shutdown.c	2009-05-18 18:12:30 UTC (rev 7365)
+++ xfce4-power-manager/trunk/src/xfpm-shutdown.c	2009-05-18 18:34:30 UTC (rev 7366)
@@ -327,7 +327,7 @@
     return TRUE;
 }
 
-static const gchar *
+static const gchar * G_GNUC_PURE
 _filter_error_message(const gchar *error)
 {
     if( xfpm_strequal ("No back-end for your operating system", error))

Modified: xfce4-power-manager/trunk/src/xfpm-xfconf.c
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-xfconf.c	2009-05-18 18:12:30 UTC (rev 7365)
+++ xfce4-power-manager/trunk/src/xfpm-xfconf.c	2009-05-18 18:34:30 UTC (rev 7366)
@@ -180,7 +180,7 @@
 	conf->priv->lock_screen = g_value_get_boolean (value);
     }
 #ifdef HAVE_DPMS
-    if ( xfpm_strequal (property, DPMS_ENABLED_CFG) )
+    else if ( xfpm_strequal (property, DPMS_ENABLED_CFG) )
     {
 	conf->priv->dpms_enabled = g_value_get_boolean (value);
 	g_signal_emit (G_OBJECT(conf), signals[DPMS_SETTINGS_CHANGED], 0);




More information about the Goodies-commits mailing list