aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Terry <mike@mterry.name>2011-01-10 16:20:55 -0600
committerMichael Terry <mike@mterry.name>2011-01-10 16:20:55 -0600
commitcef82e736ede231269bfc3d90571d2555c03a7d9 (patch)
tree64a075b57c6c2650275fb5f9c36c16d878baef9c /src
parent4132432b89cedf30cae89042a296ac299cef2161 (diff)
downloadayatana-indicator-datetime-cef82e736ede231269bfc3d90571d2555c03a7d9.tar.gz
ayatana-indicator-datetime-cef82e736ede231269bfc3d90571d2555c03a7d9.tar.bz2
ayatana-indicator-datetime-cef82e736ede231269bfc3d90571d2555c03a7d9.zip
fix signal emission; g-signal receiver parameter definition
Diffstat (limited to 'src')
-rw-r--r--src/datetime-interface.c36
-rw-r--r--src/indicator-datetime.c6
2 files changed, 22 insertions, 20 deletions
diff --git a/src/datetime-interface.c b/src/datetime-interface.c
index 2bb56b0..5939061 100644
--- a/src/datetime-interface.c
+++ b/src/datetime-interface.c
@@ -45,17 +45,10 @@ struct _DatetimeInterfacePrivate {
#define DATETIME_INTERFACE_GET_PRIVATE(o) (DATETIME_INTERFACE(o)->priv)
-enum {
- UPDATE_TIME,
- LAST_SIGNAL
-};
-
/* GDBus Stuff */
static GDBusNodeInfo * node_info = NULL;
static GDBusInterfaceInfo * interface_info = NULL;
-static guint signals[LAST_SIGNAL] = { 0 };
-
static void datetime_interface_class_init (DatetimeInterfaceClass *klass);
static void datetime_interface_init (DatetimeInterface *self);
static void datetime_interface_dispose (GObject *object);
@@ -74,14 +67,6 @@ datetime_interface_class_init (DatetimeInterfaceClass *klass)
object_class->dispose = datetime_interface_dispose;
object_class->finalize = datetime_interface_finalize;
- signals[UPDATE_TIME] = g_signal_new("update-time",
- G_TYPE_FROM_CLASS(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (DatetimeInterfaceClass, update_time),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0, G_TYPE_NONE);
-
/* Setting up the DBus interfaces */
if (node_info == NULL) {
GError * error = NULL;
@@ -145,7 +130,7 @@ bus_get_cb (GObject * object, GAsyncResult * res, gpointer user_data)
}
/* Now register our object on our new connection */
- priv->dbus_registration = g_dbus_connection_register_object(connection,
+ priv->dbus_registration = g_dbus_connection_register_object(priv->bus,
SERVICE_OBJ,
interface_info,
NULL,
@@ -200,6 +185,23 @@ void
datetime_interface_update (DatetimeInterface *self)
{
g_return_if_fail(IS_DATETIME_INTERFACE(self));
- g_signal_emit(G_OBJECT(self), signals[UPDATE_TIME], 0, TRUE);
+
+ DatetimeInterfacePrivate * priv = DATETIME_INTERFACE_GET_PRIVATE(self);
+ GError * error = NULL;
+
+ g_dbus_connection_emit_signal (priv->bus,
+ NULL,
+ SERVICE_OBJ,
+ SERVICE_IFACE,
+ "UpdateTime",
+ NULL,
+ &error);
+
+ if (error != NULL) {
+ g_error("Unable to send UpdateTime signal: %s", error->message);
+ g_error_free(error);
+ return;
+ }
+
return;
}
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 981f2c0..7e0b62d 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -151,7 +151,7 @@ static struct tm * update_label (IndicatorDatetime * io);
static void guess_label_size (IndicatorDatetime * self);
static void setup_timer (IndicatorDatetime * self, struct tm * ltime);
static void update_time (IndicatorDatetime * self);
-static void receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, GVariant parameters, gpointer user_data);
+static void receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, GVariant * parameters, gpointer user_data);
static void service_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data);
/* Indicator Module Config */
@@ -315,7 +315,7 @@ service_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data)
}
if (error != NULL) {
- g_warning("Could not grab DBus proxy for %s: %s", SERVICE_NAME, error->message);
+ g_error("Could not grab DBus proxy for %s: %s", SERVICE_NAME, error->message);
g_error_free(error);
return;
}
@@ -618,7 +618,7 @@ update_time (IndicatorDatetime * self)
/* Receives all signals from the service, routed to the appropriate functions */
static void
receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name,
- GVariant parameters, gpointer user_data)
+ GVariant * parameters, gpointer user_data)
{
IndicatorDatetime * self = INDICATOR_DATETIME(user_data);