From 3be92767b85acabf1f30e010cca425d322b89de2 Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Wed, 24 Jul 2013 19:59:05 +0200 Subject: Code improvements and deprecation fixes --- src/gpm-backlight-helper.c | 2 ++ src/gpm-button.c | 4 ++-- src/gpm-control.c | 7 +++---- src/gpm-main.c | 8 ++++---- src/gpm-manager.c | 1 + src/gpm-statistics.c | 5 +++-- 6 files changed, 15 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gpm-backlight-helper.c b/src/gpm-backlight-helper.c index a9c0fd4..3ad78c7 100644 --- a/src/gpm-backlight-helper.c +++ b/src/gpm-backlight-helper.c @@ -175,8 +175,10 @@ main (gint argc, gchar *argv[]) bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); +#if !GLIB_CHECK_VERSION(2,36,0) /* setup type system */ g_type_init (); +#endif context = g_option_context_new (NULL); /* TRANSLATORS: tool that is used when copying profiles system-wide */ diff --git a/src/gpm-button.c b/src/gpm-button.c index 3c70ca1..1e38173 100644 --- a/src/gpm-button.c +++ b/src/gpm-button.c @@ -255,13 +255,13 @@ gpm_button_class_init (GpmButtonClass *klass) gboolean gpm_button_is_lid_closed (GpmButton *button) { - g_return_val_if_fail (GPM_IS_BUTTON (button), FALSE); - GDBusProxy *proxy; GVariant *res, *inner; gboolean lid; GError *error = NULL; + g_return_val_if_fail (GPM_IS_BUTTON (button), FALSE); + if (LOGIND_RUNNING()) { proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, diff --git a/src/gpm-control.c b/src/gpm-control.c index d7ba36c..cb84814 100644 --- a/src/gpm-control.c +++ b/src/gpm-control.c @@ -95,7 +95,7 @@ gpm_control_error_quark (void) static gboolean gpm_control_systemd_shutdown (void) { GError *error = NULL; - DBusGProxy *proxy; + GDBusProxy *proxy; egg_debug ("Requesting systemd to shutdown"); proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, @@ -217,8 +217,7 @@ gpm_control_suspend (GpmControl *control, GError **error) #endif /* WITH_KEYRING */ GError *dbus_error = NULL; - DBusGProxy *proxy; - GVariant *res; + GDBusProxy *proxy; screensaver = gpm_screensaver_new (); @@ -329,7 +328,7 @@ gpm_control_hibernate (GpmControl *control, GError **error) #endif /* WITH_KEYRING */ GError *dbus_error = NULL; - DBusGProxy *proxy; + GDBusProxy *proxy; screensaver = gpm_screensaver_new (); diff --git a/src/gpm-main.c b/src/gpm-main.c index 064ccf3..054cf3b 100644 --- a/src/gpm-main.c +++ b/src/gpm-main.c @@ -183,13 +183,14 @@ main (int argc, char *argv[]) bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); -#if GLIB_CHECK_VERSION(2,32,0) -#else +#if !GLIB_CHECK_VERSION(2,32,0) if (! g_thread_supported ()) g_thread_init (NULL); #endif dbus_g_thread_init (); +#if !GLIB_CHECK_VERSION(2,36,0) g_type_init (); +#endif context = g_option_context_new (N_("MATE Power Manager")); /* TRANSLATORS: program name, a simple app to view pending updates */ @@ -203,8 +204,7 @@ main (int argc, char *argv[]) goto unref_program; } -#if GLIB_CHECK_VERSION(2,32,0) -#else +#if !GLIB_CHECK_VERSION(2,32,0) if (!g_thread_supported ()) g_thread_init (NULL); #endif diff --git a/src/gpm-manager.c b/src/gpm-manager.c index b1f760a..aeb5a31 100644 --- a/src/gpm-manager.c +++ b/src/gpm-manager.c @@ -35,6 +35,7 @@ #endif /* HAVE_UNISTD_H */ #include +#include #include #include #include diff --git a/src/gpm-statistics.c b/src/gpm-statistics.c index 4813d1f..98b5632 100644 --- a/src/gpm-statistics.c +++ b/src/gpm-statistics.c @@ -1564,13 +1564,14 @@ main (int argc, char *argv[]) bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); -#if GLIB_CHECK_VERSION(2,32,0) -#else +#if !GLIB_CHECK_VERSION(2,32,0) if (! g_thread_supported ()) g_thread_init (NULL); #endif dbus_g_thread_init (); +#if !GLIB_CHECK_VERSION(2,36,0) g_type_init (); +#endif context = g_option_context_new (NULL); /* TRANSLATORS: the program name */ -- cgit v1.2.1