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 | |
parent | 3f127add9c15e6045ede28e408abf4c9df718243 (diff) | |
download | mate-control-center-764f6d5f6fd9a0fb93ccec100add316d1a4b6828.tar.bz2 mate-control-center-764f6d5f6fd9a0fb93ccec100add316d1a4b6828.tar.xz |
common: migrate to GDBus
-rw-r--r-- | .build.yml | 31 | ||||
-rw-r--r-- | capplets/accessibility/at-properties/main.c | 3 | ||||
-rw-r--r-- | capplets/common/Makefile.am | 3 | ||||
-rw-r--r-- | capplets/common/activate-settings-daemon.c | 65 | ||||
-rw-r--r-- | configure.ac | 2 |
5 files changed, 43 insertions, 61 deletions
@@ -6,6 +6,7 @@ requires: # Useful URL: https://git.archlinux.org/svntogit/community.git/tree/mate-control-center - autoconf-archive - clang + - dbus-glib - file - gcc - git @@ -13,11 +14,12 @@ requires: - intltool - itstool - libxss + - libmatekbd - make - marco - mate-common - mate-menus - - mate-settings-daemon + - polkit - which - yelp-tools @@ -59,7 +61,7 @@ requires: - libpolkit-gobject-1-dev - make - mate-common - - mate-settings-daemon-dev + - policykit-1 - python3-lxml - shared-mime-info - xsltproc @@ -73,6 +75,7 @@ requires: - clang - clang-analyzer - cppcheck-htmlreport + - dbus-glib-devel - dconf-devel - desktop-file-utils - gcc @@ -93,7 +96,6 @@ requires: - polkit-devel - python3-lxml - mate-common - - mate-settings-daemon-devel - redhat-rpm-config - startup-notification-devel - which @@ -103,6 +105,7 @@ requires: - curl - clang - clang-tools + - libdbus-glib-1-dev - desktop-file-utils - git - gobject-introspection @@ -133,7 +136,7 @@ requires: - libpolkit-gobject-1-dev - make - mate-common - - mate-settings-daemon-dev + - policykit-1 - python3-lxml - shared-mime-info - xsltproc @@ -188,29 +191,13 @@ before_scripts: - make install - cd ${START_DIR} - - if [ ! -f mate-settings-daemon-1.23.1.tar.xz ]; then - - curl -Ls -o mate-settings-daemon-1.23.1.tar.xz https://github.com/mate-desktop/mate-settings-daemon/releases/download/v1.23.1/mate-settings-daemon-1.23.1.tar.xz - - fi - - tar xf mate-settings-daemon-1.23.1.tar.xz - - cd mate-settings-daemon-1.23.1 - - if [ ${DISTRO_NAME} == "debian" -o ${DISTRO_NAME} == "ubuntu" ];then - - ./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --libexecdir=/usr/lib/x86_64-linux-gnu - - else - - ./configure --prefix=/usr - - fi - - if [ ${TRAVIS} == "false" ]; then - - make clean - - fi - - make - - make install - - curl -Ls -o /usr/bin/gla11y https://github.com/hypra/gla11y/raw/v0.3/gla11y - chmod +x /usr/bin/gla11y build_scripts: - if [ ${DISTRO_NAME} == "debian" ];then - export CFLAGS+=" -Wsign-compare -Wunused-parameter" - - cppcheck --enable=warning,style,performance,portability,information,missingInclude -i'mate-desktop-1.23.2' -i'mate-settings-daemon-1.23.1' . + - cppcheck --enable=warning,style,performance,portability,information,missingInclude -i'mate-desktop-1.23.2' . - fi - NOCONFIGURE=1 ./autogen.sh @@ -223,7 +210,7 @@ build_scripts: after_scripts: - if [ ${DISTRO_NAME} == "fedora" ];then - - cppcheck --xml --output-file=cppcheck.xml --enable=warning,style,performance,portability,information,missingInclude -i'mate-desktop-1.23.2' -i'mate-settings-daemon-1.23.1' . + - cppcheck --xml --output-file=cppcheck.xml --enable=warning,style,performance,portability,information,missingInclude -i'mate-desktop-1.23.2' . - cppcheck-htmlreport --title=${REPO_NAME} --file=cppcheck.xml --report-dir=cppcheck-htmlreport - ./gen-index -l 20 -i https://github.com/${OWNER_NAME}/mate-icon-theme/raw/master/mate/16x16/categories/preferences-desktop.png - fi diff --git a/capplets/accessibility/at-properties/main.c b/capplets/accessibility/at-properties/main.c index 4f5a3be2..0bc6eea0 100644 --- a/capplets/accessibility/at-properties/main.c +++ b/capplets/accessibility/at-properties/main.c @@ -4,9 +4,6 @@ #include <gio/gdesktopappinfo.h> #include "dm-util.h" -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-lowlevel.h> - #define GSM_SERVICE_DBUS "org.gnome.SessionManager" #define GSM_PATH_DBUS "/org/gnome/SessionManager" #define GSM_INTERFACE_DBUS "org.gnome.SessionManager" 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; } diff --git a/configure.ac b/configure.ac index 7a46ad46..67d53cfe 100644 --- a/configure.ac +++ b/configure.ac @@ -68,7 +68,6 @@ AC_SUBST(SCREENSAVER_LIBS) GLIB_REQUIRED=2.50.0 GTK_REQUIRED=3.22.0 MARCO_REQUIRED=1.17.0 -MSD_REQUIRED=1.23.1 MATEKBD_REQUIRED=1.17.0 MATE_DESKTOP_REQUIRED=1.23.2 APPINDICATOR_REQUIRED=0.0.13 @@ -141,7 +140,6 @@ PKG_CHECK_MODULES(MATE_DESKTOP, mate-desktop-2.0 >= $MATE_DESKTOP_REQUIRED) PKG_CHECK_MODULES(DEFAULT_APPLICATIONS_CAPPLET, libxml-2.0) PKG_CHECK_MODULES(MARCO, libmarco-private >= $MARCO_REQUIRED) PKG_CHECK_MODULES(TYPING, $GMODULE_ADD glib-2.0 >= $GLIB_REQUIRED gio-2.0 gtk+-3.0 >= $GTK_REQUIRED) -PKG_CHECK_MODULES(GSD_DBUS, mate-settings-daemon >= $MSD_REQUIRED) PKG_CHECK_MODULES(GIO, gio-2.0) PKG_CHECK_MODULES([DCONF], [dconf >= 0.13.4]) |