aboutsummaryrefslogtreecommitdiff
path: root/libindicate
diff options
context:
space:
mode:
Diffstat (limited to 'libindicate')
-rw-r--r--libindicate/server.c205
-rw-r--r--libindicate/server.h9
2 files changed, 214 insertions, 0 deletions
diff --git a/libindicate/server.c b/libindicate/server.c
index 0a0eab1..271a335 100644
--- a/libindicate/server.c
+++ b/libindicate/server.c
@@ -2,6 +2,19 @@
#include "server.h"
#include "dbus-indicate-server.h"
+/* Errors */
+enum {
+ NO_GET_DESKTOP,
+ NO_GET_INDICATOR_COUNT,
+ NO_GET_INDICATOR_COUNT_BY_TYPE,
+ NO_GET_INDICATOR_LIST,
+ NO_GET_INDICATOR_LIST_BY_TYPE,
+ NO_GET_INDICATOR_PROPERTY,
+ NO_GET_INDICATOR_PROPERTY_GROUP,
+ NO_GET_INDICATOR_PROPERTIES,
+ NO_SHOW_INDICATOR_TO_USER,
+ LAST_ERROR
+};
/* Signals */
enum {
@@ -46,3 +59,195 @@ indicate_server_finalize (GObject * obj)
return;
}
+
+static GQuark
+indicate_server_error_quark (void)
+{
+ static GQuark quark = 0;
+ if (quark == 0) {
+ quark = g_quark_from_static_string (G_LOG_DOMAIN);
+ }
+ return quark;
+}
+
+/* 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 TRUE;
+}
+
+gboolean
+indicate_server_get_indicator_count (IndicateServer * server, guint * count, GError **error)
+{
+ IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
+
+ if (class != NULL) {
+ return class->get_indicator_count (server, count, error);
+ }
+
+ if (error) {
+ g_set_error(error,
+ indicate_server_error_quark(),
+ NO_GET_INDICATOR_COUNT,
+ "get_indicator_count function doesn't exist for this server class: %s",
+ G_OBJECT_TYPE_NAME(server));
+ }
+
+ return TRUE;
+}
+
+gboolean
+indicate_server_get_indicator_count_by_type (IndicateServer * server, gchar * type, guint * count, GError **error)
+{
+ IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
+
+ if (class != NULL) {
+ return class->get_indicator_count_by_type (server, type, count, error);
+ }
+
+ if (error) {
+ g_set_error(error,
+ indicate_server_error_quark(),
+ NO_GET_INDICATOR_COUNT_BY_TYPE,
+ "get_indicator_count_by_type function doesn't exist for this server class: %s",
+ G_OBJECT_TYPE_NAME(server));
+ }
+
+ return TRUE;
+}
+
+gboolean
+indicate_server_get_indicator_list (IndicateServer * server, guint ** indicators, GError ** error)
+{
+ IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
+
+ if (class != NULL) {
+ return class->get_indicator_list (server, indicators, error);
+ }
+
+ if (error) {
+ g_set_error(error,
+ indicate_server_error_quark(),
+ NO_GET_INDICATOR_LIST,
+ "get_indicator_list function doesn't exist for this server class: %s",
+ G_OBJECT_TYPE_NAME(server));
+ }
+
+ return TRUE;
+}
+
+gboolean
+indicate_server_get_indicator_list_by_type (IndicateServer * server, gchar * type, guint ** indicators, GError ** error)
+{
+ IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
+
+ if (class != NULL) {
+ return class->get_indicator_list_by_type (server, type, indicators, error);
+ }
+
+ if (error) {
+ g_set_error(error,
+ indicate_server_error_quark(),
+ NO_GET_INDICATOR_LIST_BY_TYPE,
+ "get_indicator_list_by_type function doesn't exist for this server class: %s",
+ G_OBJECT_TYPE_NAME(server));
+ }
+
+ return TRUE;
+}
+
+gboolean
+indicate_server_get_indicator_property (IndicateServer * server, guint id, gchar * property, gchar ** value, GError **error)
+{
+ IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
+
+ if (class != NULL) {
+ return class->get_indicator_property (server, id, property, value, error);
+ }
+
+ if (error) {
+ g_set_error(error,
+ indicate_server_error_quark(),
+ NO_GET_INDICATOR_PROPERTY,
+ "get_indicator_property function doesn't exist for this server class: %s",
+ G_OBJECT_TYPE_NAME(server));
+ }
+
+ return TRUE;
+}
+
+gboolean
+indicate_server_get_indicator_property_group (IndicateServer * server, guint id, gchar ** properties, gchar *** value, GError **error)
+{
+ IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
+
+ if (class != NULL) {
+ return class->get_indicator_property_group (server, id, properties, value, error);
+ }
+
+ if (error) {
+ g_set_error(error,
+ indicate_server_error_quark(),
+ NO_GET_INDICATOR_PROPERTY_GROUP,
+ "get_indicator_property_group function doesn't exist for this server class: %s",
+ G_OBJECT_TYPE_NAME(server));
+ }
+
+ return TRUE;
+}
+
+gboolean
+indicate_server_get_indicator_properties (IndicateServer * server, guint id, gchar *** properties, GError **error)
+{
+ IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
+
+ if (class != NULL) {
+ return class->get_indicator_properties (server, id, properties, error);
+ }
+
+ if (error) {
+ g_set_error(error,
+ indicate_server_error_quark(),
+ NO_GET_INDICATOR_PROPERTIES,
+ "get_indicator_properties function doesn't exist for this server class: %s",
+ G_OBJECT_TYPE_NAME(server));
+ }
+
+ return TRUE;
+}
+
+gboolean
+indicate_server_show_indicator_to_user (IndicateServer * server, guint id, GError ** error)
+{
+ IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
+
+ if (class != NULL) {
+ return class->show_indicator_to_user (server, id, error);
+ }
+
+ if (error) {
+ g_set_error(error,
+ indicate_server_error_quark(),
+ NO_SHOW_INDICATOR_TO_USER,
+ "show_indicator_to_user function doesn't exist for this server class: %s",
+ G_OBJECT_TYPE_NAME(server));
+ }
+
+ return TRUE;
+}
+
diff --git a/libindicate/server.h b/libindicate/server.h
index 79a314b..28529dd 100644
--- a/libindicate/server.h
+++ b/libindicate/server.h
@@ -23,6 +23,15 @@ typedef struct _IndicateServerClass IndicateServerClass;
struct _IndicateServerClass {
GObjectClass parent;
+ gboolean (*get_desktop) (IndicateServer * server, gchar ** desktop_path, GError **error);
+ gboolean (*get_indicator_count) (IndicateServer * server, guint * count, GError **error);
+ gboolean (*get_indicator_count_by_type) (IndicateServer * server, gchar * type, guint * count, GError **error);
+ gboolean (*get_indicator_list) (IndicateServer * server, guint ** indicators, GError ** error);
+ gboolean (*get_indicator_list_by_type) (IndicateServer * server, gchar * type, guint ** indicators, GError ** error);
+ gboolean (*get_indicator_property) (IndicateServer * server, guint id, gchar * property, gchar ** value, GError **error);
+ gboolean (*get_indicator_property_group) (IndicateServer * server, guint id, gchar ** properties, gchar *** value, GError **error);
+ gboolean (*get_indicator_properties) (IndicateServer * server, guint id, gchar *** properties, GError **error);
+ gboolean (*show_indicator_to_user) (IndicateServer * server, guint id, GError ** error);
};
/* Create a new server */