summaryrefslogtreecommitdiff
path: root/applets
diff options
context:
space:
mode:
Diffstat (limited to 'applets')
-rw-r--r--applets/brightness/Makefile.am3
-rw-r--r--applets/brightness/brightness-applet.c78
-rw-r--r--applets/brightness/meson.build4
-rw-r--r--applets/inhibit/Makefile.am3
-rw-r--r--applets/inhibit/inhibit-applet.c64
-rw-r--r--applets/inhibit/meson.build4
-rw-r--r--applets/power-profiles/Makefile.am3
-rw-r--r--applets/power-profiles/meson.build4
-rw-r--r--applets/power-profiles/power-profiles-applet.c1
9 files changed, 94 insertions, 70 deletions
diff --git a/applets/brightness/Makefile.am b/applets/brightness/Makefile.am
index 049a6c4..676de5d 100644
--- a/applets/brightness/Makefile.am
+++ b/applets/brightness/Makefile.am
@@ -3,7 +3,6 @@ NULL =
AM_CPPFLAGS = \
-I. -I$(srcdir) \
$(GLIB_CFLAGS) \
- $(DBUS_CFLAGS) \
$(CAIRO_CFLAGS) \
$(PANEL_CFLAGS) \
$(LIBNOTIFY_CFLAGS) \
@@ -36,7 +35,6 @@ libmate_brightness_applet_la_SOURCES = \
libmate_brightness_applet_la_CFLAGS = $(AM_CFLAGS)
libmate_brightness_applet_la_LDFLAGS = -module -avoid-version
libmate_brightness_applet_la_LIBADD = \
- $(DBUS_LIBS) \
$(CAIRO_LIBS) \
$(PANEL_LIBS)
else
@@ -50,7 +48,6 @@ mate_brightness_applet_SOURCES = \
gpm-common.h
mate_brightness_applet_CFLAGS = $(AM_CFLAGS)
mate_brightness_applet_LDADD = \
- $(DBUS_LIBS) \
$(CAIRO_LIBS) \
$(PANEL_LIBS)
endif
diff --git a/applets/brightness/brightness-applet.c b/applets/brightness/brightness-applet.c
index 73242bc..b2ead95 100644
--- a/applets/brightness/brightness-applet.c
+++ b/applets/brightness/brightness-applet.c
@@ -34,7 +34,6 @@
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include <glib-object.h>
-#include <dbus/dbus-glib.h>
#include "gpm-common.h"
@@ -56,8 +55,8 @@ typedef struct{
GdkPixbuf *icon;
gint icon_width, icon_height;
/* connection to g-p-m */
- DBusGProxy *proxy;
- DBusGConnection *connection;
+ GDBusProxy *proxy;
+ GDBusConnection *connection;
guint bus_watch_id;
guint level;
/* a cache for panel size */
@@ -123,7 +122,7 @@ static gboolean
gpm_applet_get_brightness (GpmBrightnessApplet *applet)
{
GError *error = NULL;
- gboolean ret;
+ GVariant *result;
guint policy_brightness;
if (applet->proxy == NULL) {
@@ -131,22 +130,28 @@ gpm_applet_get_brightness (GpmBrightnessApplet *applet)
return FALSE;
}
- ret = dbus_g_proxy_call (applet->proxy, "GetBrightness", &error,
- G_TYPE_INVALID,
- G_TYPE_UINT, &policy_brightness,
- G_TYPE_INVALID);
+ result = g_dbus_proxy_call_sync (applet->proxy,
+ "GetBrightness",
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &error);
if (error) {
g_debug ("ERROR: %s\n", error->message);
g_error_free (error);
}
- if (ret) {
+ if (result != NULL) {
+ g_variant_get (result, "(u)", &policy_brightness);
+ g_variant_unref (result);
applet->level = policy_brightness;
+ return TRUE;
} else {
/* abort as the DBUS method failed */
g_warning ("GetBrightness failed!\n");
}
- return ret;
+ return FALSE;
}
/**
@@ -157,6 +162,7 @@ static gboolean
gpm_applet_set_brightness (GpmBrightnessApplet *applet)
{
GError *error = NULL;
+ GVariant *result;
gboolean ret;
if (applet->proxy == NULL) {
@@ -164,10 +170,16 @@ gpm_applet_set_brightness (GpmBrightnessApplet *applet)
return FALSE;
}
- ret = dbus_g_proxy_call (applet->proxy, "SetBrightness", &error,
- G_TYPE_UINT, applet->level,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
+ result = g_dbus_proxy_call_sync (applet->proxy,
+ "SetBrightness",
+ g_variant_new ("(u)", applet->level),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &error);
+ ret = (result != NULL);
+ if (result != NULL)
+ g_variant_unref (result);
if (error) {
g_debug ("ERROR: %s", error->message);
g_error_free (error);
@@ -878,6 +890,10 @@ gpm_applet_destroy_cb (GtkWidget *widget)
}
g_bus_unwatch_name (applet->bus_watch_id);
+ if (applet->proxy != NULL)
+ g_object_unref (applet->proxy);
+ if (applet->connection != NULL)
+ g_object_unref (applet->connection);
if (applet->icon != NULL)
g_object_unref (applet->icon);
}
@@ -893,10 +909,18 @@ gpm_brightness_applet_class_init (GpmBrightnessAppletClass *class)
}
static void
-brightness_changed_cb (DBusGProxy *proxy,
- guint brightness,
+brightness_changed_cb (GDBusProxy *proxy,
+ gchar *sender_name,
+ gchar *signal_name,
+ GVariant *parameters,
GpmBrightnessApplet *applet)
{
+ guint brightness;
+
+ if (g_strcmp0 (signal_name, "BrightnessChanged") != 0)
+ return;
+
+ g_variant_get (parameters, "(u)", &brightness);
g_debug ("BrightnessChanged detected: %u\n", brightness);
applet->level = brightness;
}
@@ -912,7 +936,7 @@ gpm_brightness_applet_dbus_connect (GpmBrightnessApplet *applet)
if (applet->connection == NULL) {
g_debug ("get connection\n");
g_clear_error (&error);
- applet->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+ applet->connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
if (error != NULL) {
g_warning ("Could not connect to DBUS daemon: %s", error->message);
g_error_free (error);
@@ -923,22 +947,22 @@ gpm_brightness_applet_dbus_connect (GpmBrightnessApplet *applet)
if (applet->proxy == NULL) {
g_debug ("get proxy\n");
g_clear_error (&error);
- applet->proxy = dbus_g_proxy_new_for_name_owner (applet->connection,
- GPM_DBUS_SERVICE,
- GPM_DBUS_PATH_BACKLIGHT,
- GPM_DBUS_INTERFACE_BACKLIGHT,
- &error);
+ applet->proxy = g_dbus_proxy_new_sync (applet->connection,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ GPM_DBUS_SERVICE,
+ GPM_DBUS_PATH_BACKLIGHT,
+ GPM_DBUS_INTERFACE_BACKLIGHT,
+ NULL,
+ &error);
if (error != NULL) {
g_warning ("Cannot connect, maybe the daemon is not running: %s\n", error->message);
g_error_free (error);
applet->proxy = NULL;
return FALSE;
}
- dbus_g_proxy_add_signal (applet->proxy, "BrightnessChanged",
- G_TYPE_UINT, G_TYPE_INVALID);
- dbus_g_proxy_connect_signal (applet->proxy, "BrightnessChanged",
- G_CALLBACK (brightness_changed_cb),
- applet, NULL);
+ g_signal_connect (applet->proxy, "g-signal",
+ G_CALLBACK (brightness_changed_cb), applet);
/* reset, we might be starting race */
applet->call_worked = gpm_applet_get_brightness (applet);
}
diff --git a/applets/brightness/meson.build b/applets/brightness/meson.build
index 896eef2..8852a05 100644
--- a/applets/brightness/meson.build
+++ b/applets/brightness/meson.build
@@ -23,8 +23,6 @@ if enable_applets_inprocess
glib,
cairo,
notify,
- dbus,
- dbusglib,
matepanel
],
include_directories : config_inc,
@@ -40,8 +38,6 @@ else
glib,
cairo,
notify,
- dbus,
- dbusglib,
matepanel
],
include_directories : config_inc,
diff --git a/applets/inhibit/Makefile.am b/applets/inhibit/Makefile.am
index b6eca59..6d62fef 100644
--- a/applets/inhibit/Makefile.am
+++ b/applets/inhibit/Makefile.am
@@ -3,7 +3,6 @@ NULL =
AM_CPPFLAGS = \
-I. -I$(srcdir) \
$(GLIB_CFLAGS) \
- $(DBUS_CFLAGS) \
$(CAIRO_CFLAGS) \
$(PANEL_CFLAGS) \
$(LIBNOTIFY_CFLAGS) \
@@ -36,7 +35,6 @@ libmate_inhibit_applet_la_SOURCES = \
libmate_inhibit_applet_la_CFLAGS = $(AM_CFLAGS)
libmate_inhibit_applet_la_LDFLAGS = -module -avoid-version
libmate_inhibit_applet_la_LIBADD = \
- $(DBUS_LIBS) \
$(CAIRO_LIBS) \
$(PANEL_LIBS)
else
@@ -50,7 +48,6 @@ mate_inhibit_applet_SOURCES = \
gpm-common.h
mate_inhibit_applet_CFLAGS = $(AM_CFLAGS)
mate_inhibit_applet_LDADD = \
- $(DBUS_LIBS) \
$(CAIRO_LIBS) \
$(PANEL_LIBS)
endif
diff --git a/applets/inhibit/inhibit-applet.c b/applets/inhibit/inhibit-applet.c
index 74ddd6e..7a2bea3 100644
--- a/applets/inhibit/inhibit-applet.c
+++ b/applets/inhibit/inhibit-applet.c
@@ -33,7 +33,6 @@
#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib/gi18n.h>
-#include <dbus/dbus-glib.h>
#include "gpm-common.h"
@@ -51,8 +50,8 @@ typedef struct{
/* the icon */
GtkWidget *image;
/* connection to g-p-m */
- DBusGProxy *proxy;
- DBusGConnection *connection;
+ GDBusProxy *proxy;
+ GDBusConnection *connection;
guint bus_watch_id;
guint level;
/* a cache for panel size */
@@ -97,6 +96,7 @@ gpm_applet_inhibit (GpmInhibitApplet *applet,
guint *cookie)
{
GError *error = NULL;
+ GVariant *result;
gboolean ret;
g_return_val_if_fail (cookie != NULL, FALSE);
@@ -106,14 +106,22 @@ gpm_applet_inhibit (GpmInhibitApplet *applet,
return FALSE;
}
- ret = dbus_g_proxy_call (applet->proxy, "Inhibit", &error,
- G_TYPE_STRING, appname,
- G_TYPE_UINT, 0, /* xid */
- G_TYPE_STRING, reason,
- G_TYPE_UINT, 1+2+4+8, /* logoff, switch, suspend, and idle */
- G_TYPE_INVALID,
- G_TYPE_UINT, cookie,
- G_TYPE_INVALID);
+ result = g_dbus_proxy_call_sync (applet->proxy,
+ "Inhibit",
+ g_variant_new ("(susu)",
+ appname,
+ 0,
+ reason,
+ 1+2+4+8),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &error);
+ ret = (result != NULL);
+ if (result != NULL) {
+ g_variant_get (result, "(u)", cookie);
+ g_variant_unref (result);
+ }
if (error) {
g_debug ("ERROR: %s", error->message);
g_error_free (error);
@@ -132,6 +140,7 @@ gpm_applet_uninhibit (GpmInhibitApplet *applet,
guint cookie)
{
GError *error = NULL;
+ GVariant *result;
gboolean ret;
if (applet->proxy == NULL) {
@@ -139,10 +148,16 @@ gpm_applet_uninhibit (GpmInhibitApplet *applet,
return FALSE;
}
- ret = dbus_g_proxy_call (applet->proxy, "Uninhibit", &error,
- G_TYPE_UINT, cookie,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
+ result = g_dbus_proxy_call_sync (applet->proxy,
+ "Uninhibit",
+ g_variant_new ("(u)", cookie),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &error);
+ ret = (result != NULL);
+ if (result != NULL)
+ g_variant_unref (result);
if (error) {
g_debug ("ERROR: %s", error->message);
g_error_free (error);
@@ -345,6 +360,10 @@ gpm_applet_destroy_cb (GtkWidget *widget)
GpmInhibitApplet *applet = GPM_INHIBIT_APPLET(widget);
g_bus_unwatch_name (applet->bus_watch_id);
+ if (applet->proxy != NULL)
+ g_object_unref (applet->proxy);
+ if (applet->connection != NULL)
+ g_object_unref (applet->connection);
}
/**
@@ -368,7 +387,7 @@ gpm_inhibit_applet_dbus_connect (GpmInhibitApplet *applet)
if (applet->connection == NULL) {
g_debug ("get connection\n");
g_clear_error (&error);
- applet->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+ applet->connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
if (error != NULL) {
g_warning ("Could not connect to DBUS daemon: %s", error->message);
g_error_free (error);
@@ -379,11 +398,14 @@ gpm_inhibit_applet_dbus_connect (GpmInhibitApplet *applet)
if (applet->proxy == NULL) {
g_debug ("get proxy\n");
g_clear_error (&error);
- applet->proxy = dbus_g_proxy_new_for_name_owner (applet->connection,
- GS_DBUS_SERVICE,
- GS_DBUS_PATH,
- GS_DBUS_INTERFACE,
- &error);
+ applet->proxy = g_dbus_proxy_new_sync (applet->connection,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ GS_DBUS_SERVICE,
+ GS_DBUS_PATH,
+ GS_DBUS_INTERFACE,
+ NULL,
+ &error);
if (error != NULL) {
g_warning ("Cannot connect, maybe the daemon is not running: %s\n", error->message);
g_error_free (error);
diff --git a/applets/inhibit/meson.build b/applets/inhibit/meson.build
index 98dfbc1..2d93252 100644
--- a/applets/inhibit/meson.build
+++ b/applets/inhibit/meson.build
@@ -23,8 +23,6 @@ if enable_applets_inprocess
glib,
cairo,
notify,
- dbus,
- dbusglib,
matepanel
],
include_directories : config_inc,
@@ -40,8 +38,6 @@ else
glib,
cairo,
notify,
- dbus,
- dbusglib,
matepanel
],
include_directories : config_inc,
diff --git a/applets/power-profiles/Makefile.am b/applets/power-profiles/Makefile.am
index 041afc9..58acc6f 100644
--- a/applets/power-profiles/Makefile.am
+++ b/applets/power-profiles/Makefile.am
@@ -3,7 +3,6 @@ NULL =
AM_CPPFLAGS = \
-I. -I$(srcdir) \
$(GLIB_CFLAGS) \
- $(DBUS_CFLAGS) \
$(CAIRO_CFLAGS) \
$(PANEL_CFLAGS) \
$(LIBNOTIFY_CFLAGS) \
@@ -36,7 +35,6 @@ libmate_power_profiles_applet_la_SOURCES = \
libmate_power_profiles_applet_la_CFLAGS = $(AM_CFLAGS)
libmate_power_profiles_applet_la_LDFLAGS = -module -avoid-version
libmate_power_profiles_applet_la_LIBADD = \
- $(DBUS_LIBS) \
$(CAIRO_LIBS) \
$(PANEL_LIBS)
else
@@ -50,7 +48,6 @@ mate_power_profiles_applet_SOURCES = \
gpm-common.h
mate_power_profiles_applet_CFLAGS = $(AM_CFLAGS)
mate_power_profiles_applet_LDADD = \
- $(DBUS_LIBS) \
$(CAIRO_LIBS) \
$(PANEL_LIBS)
endif
diff --git a/applets/power-profiles/meson.build b/applets/power-profiles/meson.build
index 1d16402..753a3cb 100644
--- a/applets/power-profiles/meson.build
+++ b/applets/power-profiles/meson.build
@@ -23,8 +23,6 @@ if enable_applets_inprocess
glib,
cairo,
notify,
- dbus,
- dbusglib,
matepanel
],
include_directories : config_inc,
@@ -40,8 +38,6 @@ else
glib,
cairo,
notify,
- dbus,
- dbusglib,
matepanel
],
include_directories : config_inc,
diff --git a/applets/power-profiles/power-profiles-applet.c b/applets/power-profiles/power-profiles-applet.c
index e3bb810..b26fec1 100644
--- a/applets/power-profiles/power-profiles-applet.c
+++ b/applets/power-profiles/power-profiles-applet.c
@@ -31,7 +31,6 @@
#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib/gi18n.h>
-#include <dbus/dbus-glib.h>
#include "gpm-common.h"