summaryrefslogtreecommitdiff
path: root/capplets/common/activate-settings-daemon.c
diff options
context:
space:
mode:
authorWu Xiaotian <[email protected]>2020-06-26 22:19:23 +0800
committerWu Xiaotian <[email protected]>2020-06-30 13:50:35 +0800
commit764f6d5f6fd9a0fb93ccec100add316d1a4b6828 (patch)
tree7a524262f5a6707ece76fc1240453501137290fd /capplets/common/activate-settings-daemon.c
parent3f127add9c15e6045ede28e408abf4c9df718243 (diff)
downloadmate-control-center-764f6d5f6fd9a0fb93ccec100add316d1a4b6828.tar.bz2
mate-control-center-764f6d5f6fd9a0fb93ccec100add316d1a4b6828.tar.xz
common: migrate to GDBus
Diffstat (limited to 'capplets/common/activate-settings-daemon.c')
-rw-r--r--capplets/common/activate-settings-daemon.c65
1 files changed, 34 insertions, 31 deletions
diff --git a/capplets/common/activate-settings-daemon.c b/capplets/common/activate-settings-daemon.c
index 21fd2b2b..11651082 100644
--- a/capplets/common/activate-settings-daemon.c
+++ b/capplets/common/activate-settings-daemon.c
@@ -2,10 +2,9 @@
#include <config.h>
#endif
-#include <mate-settings-client.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-
+#include <gio/gio.h>
#include "activate-settings-daemon.h"
static void popup_error_message (void)
@@ -26,35 +25,39 @@ static void popup_error_message (void)
gboolean
activate_settings_daemon (void)
{
- DBusGConnection *connection = NULL;
- DBusGProxy *proxy = NULL;
- GError *error = NULL;
-
- connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
- if (connection == NULL)
- {
- popup_error_message ();
- g_error_free (error);
- return FALSE;
- }
-
- proxy = dbus_g_proxy_new_for_name (connection,
- "org.mate.SettingsDaemon",
- "/org/mate/SettingsDaemon",
- "org.mate.SettingsDaemon");
-
- if (proxy == NULL)
- {
- popup_error_message ();
- return FALSE;
- }
-
- if (!org_mate_SettingsDaemon_awake(proxy, &error))
- {
- popup_error_message ();
- g_error_free (error);
- return FALSE;
- }
+ GError *error = NULL;
+ GDBusProxy *proxy = NULL;
+ GVariant *ret;
+
+ proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ "org.mate.SettingsDaemon",
+ "/org/mate/SettingsDaemon",
+ "org.mate.SettingsDaemon",
+ NULL,
+ &error);
+ if (proxy == NULL) {
+ popup_error_message ();
+ g_error_free (error);
+ return FALSE;
+ }
+
+ ret = g_dbus_proxy_call_sync (proxy,
+ "Awake",
+ g_variant_new ("()"),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &error);
+ if (ret == NULL) {
+ popup_error_message ();
+ g_error_free (error);
+ return FALSE;
+ } else {
+ g_variant_get (ret, "()");
+ g_variant_unref (ret);
+ }
return TRUE;
}