diff options
author | Ali Abdallah <ali.slackware@gmail.com> | 2009-05-18 18:34:30 +0000 |
---|---|---|
committer | Ali Abdallah <ali.slackware@gmail.com> | 2009-05-18 18:34:30 +0000 |
commit | 6db2b5e6c0b9cac8172e4714e3b3df7be5a40bf1 (patch) | |
tree | 03be6074e762f2905e2955d92d323d11bde63baa | |
parent | be0045f3f523491adf0ff7c4496233d6bd3a9b33 (diff) | |
download | ixfce4-power-manager-6db2b5e6c0b9cac8172e4714e3b3df7be5a40bf1.tar.gz |
* : 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.
(Old svn revision: 7366)
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | libxfpm/hal-battery.c | 10 | ||||
-rw-r--r-- | settings/xfpm-settings.c | 10 | ||||
-rw-r--r-- | src/xfpm-battery.c | 8 | ||||
-rw-r--r-- | src/xfpm-battery.h | 6 | ||||
-rw-r--r-- | src/xfpm-config.h | 2 | ||||
-rw-r--r-- | src/xfpm-debug.c | 8 | ||||
-rw-r--r-- | src/xfpm-main.c | 13 | ||||
-rw-r--r-- | src/xfpm-network-manager.c | 4 | ||||
-rw-r--r-- | src/xfpm-shutdown.c | 2 | ||||
-rw-r--r-- | src/xfpm-xfconf.c | 2 |
11 files changed, 40 insertions, 33 deletions
@@ -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. diff --git a/libxfpm/hal-battery.c b/libxfpm/hal-battery.c index 2e293e4c..8753fbaa 100644 --- a/libxfpm/hal-battery.c +++ b/libxfpm/hal-battery.c @@ -325,7 +325,7 @@ hal_battery_finalize(GObject *object) 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 @@ hal_battery_get_device_type (HalBattery *battery) 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 @@ hal_battery_refresh_all (HalBattery *battery) } -static const gchar * +static const gchar * G_GNUC_PURE _translate_technology (const gchar *tech) { if ( !g_strcmp0 (tech, "lithium-ion") ) @@ -463,7 +461,7 @@ _translate_technology (const gchar *tech) return _("Unknown"); } -static const gchar * +static const gchar * G_GNUC_PURE _translate_unit (const gchar *unit) { if ( !g_strcmp0 (unit, "mWh") ) diff --git a/settings/xfpm-settings.c b/settings/xfpm-settings.c index 5901f95d..6bec6c30 100644 --- a/settings/xfpm-settings.c +++ b/settings/xfpm-settings.c @@ -222,7 +222,7 @@ notify_toggled_cb (GtkWidget *w, XfconfChannel *channel) 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 @@ set_hibernate_inactivity (GtkWidget *w, XfconfChannel *channel) 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 @@ xfpm_settings_advanced (XfconfChannel *channel, gboolean system_laptop, gboolean 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 { diff --git a/src/xfpm-battery.c b/src/xfpm-battery.c index 3cfcbbe1..d322b799 100644 --- a/src/xfpm-battery.c +++ b/src/xfpm-battery.c @@ -82,7 +82,7 @@ static guint signals[LAST_SIGNAL] = { 0 }; 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 @@ xfpm_battery_get_icon_index (HalDeviceType type, guint percent) 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 @@ xfpm_battery_notify (XfpmBattery *battery) } } -static const gchar * +static const gchar * G_GNUC_CONST _get_battery_name (HalDeviceType type) { if ( type == HAL_DEVICE_TYPE_UPS) @@ -264,7 +264,7 @@ _get_battery_name (HalDeviceType type) 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, diff --git a/src/xfpm-battery.h b/src/xfpm-battery.h index ad8a6788..02ab5a4b 100644 --- a/src/xfpm-battery.h +++ b/src/xfpm-battery.h @@ -56,13 +56,13 @@ typedef struct 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 diff --git a/src/xfpm-config.h b/src/xfpm-config.h index f0d425c5..0cadcd2f 100644 --- a/src/xfpm-config.h +++ b/src/xfpm-config.h @@ -57,12 +57,10 @@ G_BEGIN_DECLS #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 */ diff --git a/src/xfpm-debug.c b/src/xfpm-debug.c index 5cd39624..dc0e48fd 100644 --- a/src/xfpm-debug.c +++ b/src/xfpm-debug.c @@ -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 @@ void xfpm_debug_enum_full (const gchar *func, const gchar *file, gint line, 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); diff --git a/src/xfpm-main.c b/src/xfpm-main.c index 912ea40d..7fea6ef6 100644 --- a/src/xfpm-main.c +++ b/src/xfpm-main.c @@ -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 @@ show_version (void) "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_quit_signal (gint sig, gpointer data) 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 @@ xfpm_start (DBusGConnection *bus) } 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 @@ xfpm_start (DBusGConnection *bus) gtk_main (); g_object_unref (session); + + exit (EXIT_SUCCESS); } int main(int argc, char **argv) @@ -157,7 +161,6 @@ int main(int argc, char **argv) if ( version ) { show_version(); - return EXIT_SUCCESS; } if ( run + quit + config + version > 1 ) diff --git a/src/xfpm-network-manager.c b/src/xfpm-network-manager.c index 4c452bf2..e978d984 100644 --- a/src/xfpm-network-manager.c +++ b/src/xfpm-network-manager.c @@ -38,6 +38,7 @@ gboolean xfpm_send_message_to_network_manager (const gchar *message) GError *error = NULL; bus = dbus_g_bus_get ( DBUS_BUS_SYSTEM, &error); + if ( error ) { g_warning("%s", error->message); @@ -45,7 +46,6 @@ gboolean xfpm_send_message_to_network_manager (const gchar *message) return FALSE; } - proxy = dbus_g_proxy_new_for_name (bus, "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", @@ -53,7 +53,7 @@ gboolean xfpm_send_message_to_network_manager (const gchar *message) if (!proxy) { - g_critical ("Failed to create proxy for Network Manager interface"); + g_warning ("Failed to create proxy for Network Manager interface"); return FALSE; } diff --git a/src/xfpm-shutdown.c b/src/xfpm-shutdown.c index d088de77..a920d170 100644 --- a/src/xfpm-shutdown.c +++ b/src/xfpm-shutdown.c @@ -327,7 +327,7 @@ xfpm_shutdown_internal (DBusConnection *bus, const gchar *shutdown, GError **ger 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)) diff --git a/src/xfpm-xfconf.c b/src/xfpm-xfconf.c index c01d1182..92c65982 100644 --- a/src/xfpm-xfconf.c +++ b/src/xfpm-xfconf.c @@ -180,7 +180,7 @@ xfpm_xfconf_property_changed_cb (XfconfChannel *channel, gchar *property, 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); |