aboutsummaryrefslogtreecommitdiff
path: root/libindicate/server.c
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-02-05 15:27:42 +0100
committerTed Gould <ted@canonical.com>2009-02-05 15:27:42 +0100
commita14b6ddf7db70eff5d831aa1e9e11b46b726002f (patch)
tree40a058ff817fba1e27028cab4e45a0d707bf3a93 /libindicate/server.c
parentd52c59bb78c033753254b647e44b43a28edb91c2 (diff)
downloadlibayatana-indicator-a14b6ddf7db70eff5d831aa1e9e11b46b726002f.tar.gz
libayatana-indicator-a14b6ddf7db70eff5d831aa1e9e11b46b726002f.tar.bz2
libayatana-indicator-a14b6ddf7db70eff5d831aa1e9e11b46b726002f.zip
Changing the DBUS API slightly. Now there is no 'get_desktop' function as desktop is a property. Added a property for type so that we can understand what kind of application this is. And finally adding show/hide signals on the server as they were already on the listener.
Diffstat (limited to 'libindicate/server.c')
-rw-r--r--libindicate/server.c56
1 files changed, 21 insertions, 35 deletions
diff --git a/libindicate/server.c b/libindicate/server.c
index ab64304..ba86210 100644
--- a/libindicate/server.c
+++ b/libindicate/server.c
@@ -22,6 +22,8 @@ enum {
INDICATOR_ADDED,
INDICATOR_REMOVED,
INDICATOR_MODIFIED,
+ SERVER_SHOW,
+ SERVER_HIDE,
LAST_SIGNAL
};
@@ -49,7 +51,6 @@ G_DEFINE_TYPE (IndicateServer, indicate_server, G_TYPE_OBJECT);
/* Prototypes */
static void indicate_server_finalize (GObject * obj);
-static gboolean get_desktop (IndicateServer * server, gchar ** desktop_path, GError **error);
static gboolean get_indicator_count (IndicateServer * server, guint * count, GError **error);
static gboolean get_indicator_count_by_type (IndicateServer * server, gchar * type, guint * count, GError **error);
static gboolean get_indicator_list (IndicateServer * server, GArray ** indicators, GError ** error);
@@ -93,11 +94,24 @@ indicate_server_class_init (IndicateServerClass * class)
NULL, NULL,
g_cclosure_marshal_VOID__UINT_POINTER,
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING);
+ signals[SERVER_SHOW] = g_signal_new("server-show",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (IndicateServerClass, server_show),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_STRING);
+ signals[SERVER_HIDE] = g_signal_new("server-hide",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (IndicateServerClass, server_hide),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_STRING);
dbus_g_object_type_install_info(INDICATE_TYPE_SERVER,
&dbus_glib_indicate_server_object_info);
- class->get_desktop = get_desktop;
class->get_indicator_count = get_indicator_count;
class->get_indicator_count_by_type = get_indicator_count_by_type;
class->get_indicator_list = get_indicator_list;
@@ -133,6 +147,9 @@ indicate_server_finalize (GObject * obj)
IndicateServer * server = INDICATE_SERVER(obj);
IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server);
+ /* TODO: This probably shouldn't be as far down as finalize, but it's fine here. */
+ g_signal_emit(server, signals[SERVER_HIDE], 0, "", TRUE);
+
if (priv->path) {
g_free(priv->path);
}
@@ -168,6 +185,8 @@ indicate_server_show (IndicateServer * server)
priv->path,
G_OBJECT(server));
priv->visible = TRUE;
+
+ g_signal_emit(server, signals[SERVER_SHOW], 0, "", TRUE);
return;
}
@@ -278,18 +297,6 @@ indicate_server_set_default (IndicateServer * server)
}
static gboolean
-get_desktop (IndicateServer * server, gchar ** desktop_path, GError **error)
-{
- IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server);
-
- if (priv->path != NULL) {
- // TODO: This might be a memory leak, check into that.
- *desktop_path = g_strdup(priv->path);
- }
- return TRUE;
-}
-
-static gboolean
get_indicator_count (IndicateServer * server, guint * count, GError **error)
{
IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server);
@@ -505,27 +512,6 @@ show_indicator_to_user (IndicateServer * server, guint id, GError ** error)
/* Virtual Functions */
gboolean
-indicate_server_get_desktop (IndicateServer * server, gchar ** desktop_path, GError **error)
-{
- IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
-
- if (class != NULL) {
- return class->get_desktop (server, desktop_path, error);
- }
-
- if (error) {
- g_set_error(error,
- indicate_server_error_quark(),
- NO_GET_DESKTOP,
- "get_desktop function doesn't exist for this server class: %s",
- G_OBJECT_TYPE_NAME(server));
- return FALSE;
- }
-
- return TRUE;
-}
-
-gboolean
indicate_server_get_indicator_count (IndicateServer * server, guint * count, GError **error)
{
IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);