From aa951a3eb41ba3e4c9fcf9732992aa6e28dc83a8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 1 Dec 2009 16:34:32 -0600 Subject: Change the watch function to return both an API version and a user set version. --- libindicator/indicator-service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libindicator/indicator-service.c') diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index 69422c5..a4cdb68 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -305,7 +305,7 @@ _indicator_service_server_watch (IndicatorService * service, DBusGMethodInvocati priv->timeout = 0; } - dbus_g_method_return(method, 1); + dbus_g_method_return(method, INDICATOR_SERVICE_VERSION, 0); return TRUE; } -- cgit v1.2.3 From d7e9d013ae0d872fe0657b79f081a2a44b42f4c0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 2 Dec 2009 10:06:43 -0600 Subject: Sending a version number for the local service. --- libindicator/indicator-service.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'libindicator/indicator-service.c') diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index a4cdb68..eebe3f8 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -20,6 +20,7 @@ struct _IndicatorServicePrivate { DBusGProxy * dbus_proxy; guint timeout; GList * watchers; + guint this_service_version; }; /* Signals Stuff */ @@ -36,10 +37,12 @@ static guint signals[LAST_SIGNAL] = { 0 }; enum { PROP_0, PROP_NAME, + PROP_VERSION }; /* The strings so that they can be slowly looked up. */ #define PROP_NAME_S "name" +#define PROP_VERSION_S "version" /* GObject Stuff */ #define INDICATOR_SERVICE_GET_PRIVATE(o) \ @@ -78,6 +81,12 @@ indicator_service_class_init (IndicatorServiceClass *klass) "This is the name that should be used on DBus for this service.", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property(object_class, PROP_VERSION, + g_param_spec_uint(PROP_VERSION_S, + "The version of the service that we're implementing.", + "A number to represent the version of the other APIs the service provides. This should match across the manager and the service", + 0, G_MAXUINT, 0, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /* Signals */ @@ -113,6 +122,7 @@ indicator_service_init (IndicatorService *self) priv->dbus_proxy = NULL; priv->timeout = 0; priv->watchers = NULL; + priv->this_service_version = 0; /* Start talkin' dbus */ GError * error = NULL; @@ -213,6 +223,10 @@ set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec } break; /* *********************** */ + case PROP_VERSION: + priv->this_service_version = g_value_get_uint(value); + break; + /* *********************** */ default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -240,6 +254,10 @@ get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspe } break; /* *********************** */ + case PROP_VERSION: + g_value_set_uint(value, priv->this_service_version); + break; + /* *********************** */ default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -305,7 +323,7 @@ _indicator_service_server_watch (IndicatorService * service, DBusGMethodInvocati priv->timeout = 0; } - dbus_g_method_return(method, INDICATOR_SERVICE_VERSION, 0); + dbus_g_method_return(method, INDICATOR_SERVICE_VERSION, priv->this_service_version); return TRUE; } -- cgit v1.2.3 From a4e33bf97827e04c364210f29ccb85ed6254050f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 2 Dec 2009 10:15:11 -0600 Subject: Adding _new functions that include the version number in them. --- libindicator/indicator-service.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'libindicator/indicator-service.c') diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index eebe3f8..2ce5521 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -350,3 +350,28 @@ indicator_service_new (gchar * name) return INDICATOR_SERVICE(obj); } + +/** + indicator_service_new_version: + @name: The name for the service on dbus + @version: The version of the other interfaces provide + by the service. + + This function creates the service on DBus and tries to + get a well-known name specified in @name. If the name + can't be estabilished then the #IndicatorService::shutdown + signal will be sent. + + Return value: A brand new #IndicatorService object or #NULL + if there is an error. +*/ +IndicatorService * +indicator_service_new_version (gchar * name, guint version) +{ + GObject * obj = g_object_new(INDICATOR_SERVICE_TYPE, + PROP_NAME_S, name, + PROP_VERSION_S, version, + NULL); + + return INDICATOR_SERVICE(obj); +} -- cgit v1.2.3