[gnome-power-manager] Fix the compile of the applets
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-power-manager] Fix the compile of the applets
- Date: Sat, 17 Jul 2010 08:22:59 +0000 (UTC)
commit 70303dfb2a613166fd0d272a142605ae930191a6
Author: Richard Hughes <richard hughsie com>
Date: Sat Jul 17 09:22:05 2010 +0100
Fix the compile of the applets
applets/brightness/brightness-applet.c | 57 ++++++++++++++----------------
applets/inhibit/inhibit-applet.c | 60 +++++++++++++++----------------
2 files changed, 56 insertions(+), 61 deletions(-)
---
diff --git a/applets/brightness/brightness-applet.c b/applets/brightness/brightness-applet.c
index b7cff0a..554e25b 100644
--- a/applets/brightness/brightness-applet.c
+++ b/applets/brightness/brightness-applet.c
@@ -35,7 +35,6 @@
#include <dbus/dbus-glib.h>
#include "egg-debug.h"
-#include "egg-dbus-monitor.h"
#include "gpm-common.h"
#define GPM_TYPE_BRIGHTNESS_APPLET (gpm_brightness_applet_get_type ())
@@ -58,7 +57,7 @@ typedef struct{
/* connection to g-p-m */
DBusGProxy *proxy;
DBusGConnection *connection;
- EggDbusMonitor *monitor;
+ guint bus_watch_id;
guint level;
/* a cache for panel size */
gint size;
@@ -807,12 +806,9 @@ gpm_applet_destroy_cb (GtkObject *object)
{
GpmBrightnessApplet *applet = GPM_BRIGHTNESS_APPLET(object);
- if (applet->monitor != NULL) {
- g_object_unref (applet->monitor);
- }
- if (applet->icon != NULL) {
+ g_bus_unwatch_name (applet->bus_watch_id);
+ if (applet->icon != NULL)
g_object_unref (applet->icon);
- }
}
/**
@@ -893,25 +889,25 @@ gpm_brightness_applet_dbus_disconnect (GpmBrightnessApplet *applet)
}
/**
- * monitor_connection_cb:
- * @proxy: The dbus raw proxy
- * @status: The status of the service, where TRUE is connected
- * @screensaver: This class instance
+ * gpm_brightness_applet_name_appeared_cb:
**/
static void
-monitor_connection_cb (EggDbusMonitor *monitor,
- gboolean status,
- GpmBrightnessApplet *applet)
+gpm_brightness_applet_name_appeared_cb (GDBusConnection *connection, const gchar *name, const gchar *name_owner, GpmBrightnessApplet *applet)
{
- if (status) {
- gpm_brightness_applet_dbus_connect (applet);
- gpm_applet_update_tooltip (applet);
- gpm_applet_draw_cb (applet);
- } else {
- gpm_brightness_applet_dbus_disconnect (applet);
- gpm_applet_update_tooltip (applet);
- gpm_applet_draw_cb (applet);
- }
+ gpm_brightness_applet_dbus_connect (applet);
+ gpm_applet_update_tooltip (applet);
+ gpm_applet_draw_cb (applet);
+}
+
+/**
+ * gpm_brightness_applet_name_vanished_cb:
+ **/
+void
+gpm_brightness_applet_name_vanished_cb (GDBusConnection *connection, const gchar *name, GpmBrightnessApplet *applet)
+{
+ gpm_brightness_applet_dbus_disconnect (applet);
+ gpm_applet_update_tooltip (applet);
+ gpm_applet_draw_cb (applet);
}
/**
@@ -936,13 +932,14 @@ gpm_brightness_applet_init (GpmBrightnessApplet *applet)
gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
GPM_DATA G_DIR_SEPARATOR_S "icons");
-
- applet->monitor = egg_dbus_monitor_new ();
- g_signal_connect (applet->monitor, "connection-changed",
- G_CALLBACK (monitor_connection_cb), applet);
- connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
- egg_dbus_monitor_assign (applet->monitor, connection, GPM_DBUS_SERVICE);
- gpm_brightness_applet_dbus_connect (applet);
+ /* monitor the daemon */
+ applet->bus_watch_id =
+ g_bus_watch_name (G_BUS_TYPE_SESSION,
+ GPM_DBUS_SERVICE,
+ G_BUS_NAME_WATCHER_FLAGS_NONE,
+ (GBusNameAppearedCallback) gpm_brightness_applet_name_appeared_cb,
+ (GBusNameVanishedCallback) gpm_brightness_applet_name_vanished_cb,
+ applet, NULL);
/* coldplug */
applet->call_worked = gpm_applet_get_brightness (applet);
diff --git a/applets/inhibit/inhibit-applet.c b/applets/inhibit/inhibit-applet.c
index 0b3fd0c..dc7d080 100644
--- a/applets/inhibit/inhibit-applet.c
+++ b/applets/inhibit/inhibit-applet.c
@@ -34,7 +34,6 @@
#include <dbus/dbus-glib.h>
#include "egg-debug.h"
-#include "egg-dbus-monitor.h"
#include "gpm-common.h"
#define GPM_TYPE_INHIBIT_APPLET (gpm_inhibit_applet_get_type ())
@@ -54,7 +53,7 @@ typedef struct{
/* connection to g-p-m */
DBusGProxy *proxy;
DBusGConnection *connection;
- EggDbusMonitor *monitor;
+ guint bus_watch_id;
guint level;
/* a cache for panel size */
gint size;
@@ -486,12 +485,9 @@ gpm_applet_destroy_cb (GtkObject *object)
{
GpmInhibitApplet *applet = GPM_INHIBIT_APPLET(object);
- if (applet->monitor != NULL) {
- g_object_unref (applet->monitor);
- }
- if (applet->icon != NULL) {
+ g_bus_unwatch_name (applet->bus_watch_id);
+ if (applet->icon != NULL)
g_object_unref (applet->icon);
- }
}
/**
@@ -559,27 +555,27 @@ gpm_inhibit_applet_dbus_disconnect (GpmInhibitApplet *applet)
}
/**
- * monitor_connection_cb:
- * @proxy: The dbus raw proxy
- * @status: The status of the service, where TRUE is connected
- * @screensaver: This class instance
+ * gpm_inhibit_applet_name_appeared_cb:
**/
static void
-monitor_connection_cb (EggDbusMonitor *monitor,
- gboolean status,
- GpmInhibitApplet *applet)
+gpm_inhibit_applet_name_appeared_cb (GDBusConnection *connection, const gchar *name, const gchar *name_owner, GpmInhibitApplet *applet)
{
- if (status) {
- gpm_inhibit_applet_dbus_connect (applet);
- gpm_applet_update_tooltip (applet);
- gpm_applet_get_icon (applet);
- gpm_applet_draw_cb (applet);
- } else {
- gpm_inhibit_applet_dbus_disconnect (applet);
- gpm_applet_update_tooltip (applet);
- gpm_applet_get_icon (applet);
- gpm_applet_draw_cb (applet);
- }
+ gpm_inhibit_applet_dbus_connect (applet);
+ gpm_applet_update_tooltip (applet);
+ gpm_applet_get_icon (applet);
+ gpm_applet_draw_cb (applet);
+}
+
+/**
+ * gpm_inhibit_applet_name_vanished_cb:
+ **/
+void
+gpm_inhibit_applet_name_vanished_cb (GDBusConnection *connection, const gchar *name, GpmInhibitApplet *applet)
+{
+ gpm_inhibit_applet_dbus_disconnect (applet);
+ gpm_applet_update_tooltip (applet);
+ gpm_applet_get_icon (applet);
+ gpm_applet_draw_cb (applet);
}
/**
@@ -602,12 +598,14 @@ gpm_inhibit_applet_init (GpmInhibitApplet *applet)
gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
GPM_DATA G_DIR_SEPARATOR_S "icons");
- applet->monitor = egg_dbus_monitor_new ();
- g_signal_connect (applet->monitor, "connection-changed",
- G_CALLBACK (monitor_connection_cb), applet);
- connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
- egg_dbus_monitor_assign (applet->monitor, connection, GS_DBUS_SERVICE);
- gpm_inhibit_applet_dbus_connect (applet);
+ /* monitor the daemon */
+ applet->bus_watch_id =
+ g_bus_watch_name (G_BUS_TYPE_SESSION,
+ GS_DBUS_SERVICE,
+ G_BUS_NAME_WATCHER_FLAGS_NONE,
+ (GBusNameAppearedCallback) gpm_inhibit_applet_name_appeared_cb,
+ (GBusNameVanishedCallback) gpm_inhibit_applet_name_vanished_cb,
+ applet, NULL);
/* prepare */
panel_applet_set_flags (PANEL_APPLET (applet), PANEL_APPLET_EXPAND_MINOR);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]