diff options
author | Wu Xiaotian <[email protected]> | 2020-06-26 22:19:23 +0800 |
---|---|---|
committer | Wu Xiaotian <[email protected]> | 2020-06-30 13:50:35 +0800 |
commit | 764f6d5f6fd9a0fb93ccec100add316d1a4b6828 (patch) | |
tree | 7a524262f5a6707ece76fc1240453501137290fd /capplets/common | |
parent | 3f127add9c15e6045ede28e408abf4c9df718243 (diff) | |
download | mate-control-center-764f6d5f6fd9a0fb93ccec100add316d1a4b6828.tar.bz2 mate-control-center-764f6d5f6fd9a0fb93ccec100add316d1a4b6828.tar.xz |
common: migrate to GDBus
Diffstat (limited to 'capplets/common')
-rw-r--r-- | capplets/common/Makefile.am | 3 | ||||
-rw-r--r-- | capplets/common/activate-settings-daemon.c | 65 |
2 files changed, 34 insertions, 34 deletions
diff --git a/capplets/common/Makefile.am b/capplets/common/Makefile.am index d7e5742b..876e1a90 100644 --- a/capplets/common/Makefile.am +++ b/capplets/common/Makefile.am @@ -11,10 +11,8 @@ AM_CPPFLAGS = \ -DPIXMAP_DIR=\""$(datadir)/mate-control-center/pixmaps"\" \ $(WARN_CFLAGS) \ $(CAPPLET_CFLAGS) \ - $(DBUS_CFLAGS) \ $(MATE_DESKTOP_CFLAGS) \ $(MARCO_CFLAGS) \ - $(GSD_DBUS_CFLAGS) \ $(GIO_CFLAGS) \ $(DCONF_CFLAGS) @@ -44,7 +42,6 @@ libcommon_la_SOURCES = \ libcommon_la_LIBADD = \ $(top_builddir)/libwindow-settings/libmate-window-settings.la \ $(MARCO_LIBS) \ - $(DBUS_LIBS) \ $(MATE_DESKTOP_LIBS) \ $(GIO_LIBS) \ $(DCONF_LIBS) 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; } |