diff options
author | Ted Gould <ted@gould.cx> | 2012-02-08 10:49:54 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2012-02-08 10:49:54 -0600 |
commit | 04922240ee1e2c73ec61b46f17cab7653372eefa (patch) | |
tree | 86f389849d1fe991649fa40a0acfa109f38384e7 | |
parent | 8aa53e21ffeb4ccbb52efd47f4f8c8a897187c10 (diff) | |
parent | 7614d417822f95aa20dfadc8f06d70012ea916a6 (diff) | |
download | ayatana-indicator-application-04922240ee1e2c73ec61b46f17cab7653372eefa.tar.gz ayatana-indicator-application-04922240ee1e2c73ec61b46f17cab7653372eefa.tar.bz2 ayatana-indicator-application-04922240ee1e2c73ec61b46f17cab7653372eefa.zip |
Adding support for the Title property
-rw-r--r-- | src/application-service-appstore.c | 38 | ||||
-rw-r--r-- | src/application-service.c | 2 | ||||
-rw-r--r-- | src/application-service.xml | 7 | ||||
-rw-r--r-- | src/dbus-shared.h | 1 | ||||
-rw-r--r-- | src/indicator-application.c | 14 |
5 files changed, 47 insertions, 15 deletions
diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index edc517f..0548ced 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -50,6 +50,7 @@ static void props_cb (GObject * object, GAsyncResult * res, gpointer user_data); #define NOTIFICATION_ITEM_PROP_MENU "Menu" #define NOTIFICATION_ITEM_PROP_LABEL "XAyatanaLabel" #define NOTIFICATION_ITEM_PROP_LABEL_GUIDE "XAyatanaLabelGuide" +#define NOTIFICATION_ITEM_PROP_TITLE "Title" #define NOTIFICATION_ITEM_PROP_ORDERING_INDEX "XAyatanaOrderingIndex" #define NOTIFICATION_ITEM_SIG_NEW_ICON "NewIcon" @@ -57,6 +58,7 @@ static void props_cb (GObject * object, GAsyncResult * res, gpointer user_data); #define NOTIFICATION_ITEM_SIG_NEW_STATUS "NewStatus" #define NOTIFICATION_ITEM_SIG_NEW_LABEL "XAyatanaNewLabel" #define NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH "NewIconThemePath" +#define NOTIFICATION_ITEM_SIG_NEW_TITLE "NewTitle" #define OVERRIDE_GROUP_NAME "Ordering Index Overrides" #define OVERRIDE_FILE_NAME "ordering-override.keyfile" @@ -108,6 +110,7 @@ struct _Application { gchar * icon_theme_path; gchar * label; gchar * guide; + gchar * title; gboolean currently_free; guint ordering_index; GList * approver_cancels; @@ -440,7 +443,7 @@ got_all_properties (GObject * source_object, GAsyncResult * res, * status = NULL, * icon_name = NULL, * aicon_name = NULL, * icon_desc = NULL, * aicon_desc = NULL, * icon_theme_path = NULL, * index = NULL, * label = NULL, - * guide = NULL; + * guide = NULL, * title = NULL; GVariant * properties = g_dbus_proxy_call_finish(G_DBUS_PROXY(source_object), res, &error); @@ -494,6 +497,8 @@ got_all_properties (GObject * source_object, GAsyncResult * res, label = g_variant_ref(value); } else if (g_strcmp0(name, NOTIFICATION_ITEM_PROP_LABEL_GUIDE) == 0) { guide = g_variant_ref(value); + } else if (g_strcmp0(name, NOTIFICATION_ITEM_PROP_TITLE) == 0) { + title = g_variant_ref(value); } /* else ignore */ } g_variant_iter_free (iter); @@ -581,6 +586,13 @@ got_all_properties (GObject * source_object, GAsyncResult * res, app->guide = g_strdup(""); } + g_free(app->title); + if (title != NULL) { + app->title = g_variant_dup_string(title, NULL); + } else { + app->title = g_strdup(""); + } + g_list_foreach(priv->approvers, check_with_old_approver, app); apply_status(app); @@ -603,6 +615,7 @@ got_all_properties (GObject * source_object, GAsyncResult * res, if (index) g_variant_unref (index); if (label) g_variant_unref (label); if (guide) g_variant_unref (guide); + if (title) g_variant_unref (title); return; } @@ -784,6 +797,9 @@ application_free (Application * app) if (app->guide != NULL) { g_free(app->guide); } + if (app->title != NULL) { + g_free(app->title); + } if (app->approver_cancels != NULL) { g_list_foreach(app->approver_cancels, (GFunc)g_cancellable_cancel, NULL); g_list_foreach(app->approver_cancels, (GFunc)g_object_unref, NULL); @@ -906,12 +922,12 @@ apply_status (Application * app) if (app->visible_state == VISIBLE_STATE_HIDDEN) { /* Put on panel */ emit_signal (appstore, "ApplicationAdded", - g_variant_new ("(sisosssss)", newicon, + g_variant_new ("(sisossssss)", newicon, get_position(app), app->dbus_name, app->menu, app->icon_theme_path, app->label, app->guide, - newdesc, app->id)); + newdesc, app->id, app->title)); } else { /* Icon update */ gint position = get_position(app); @@ -923,6 +939,9 @@ apply_status (Application * app) g_variant_new ("(iss)", position, app->label != NULL ? app->label : "", app->guide != NULL ? app->guide : "")); + emit_signal (appstore, "ApplicationTitleChanged", + g_variant_new ("(is)", position, + app->title != NULL ? app->title : "")); } } @@ -1039,6 +1058,7 @@ application_service_appstore_application_add (ApplicationServiceAppstore * appst app->icon_theme_path = NULL; app->label = NULL; app->guide = NULL; + app->title = NULL; app->currently_free = FALSE; app->ordering_index = 0; app->approver_cancels = NULL; @@ -1198,6 +1218,10 @@ app_receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name /* aicon name isn't provided by signal, so look it up */ get_all_properties(app); } + else if (g_strcmp0(signal_name, NOTIFICATION_ITEM_SIG_NEW_TITLE) == 0) { + /* title name isn't provided by signal, so look it up */ + get_all_properties(app); + } else if (g_strcmp0(signal_name, NOTIFICATION_ITEM_SIG_NEW_STATUS) == 0) { const gchar * status; g_variant_get(parameters, "(&s)", &status); @@ -1323,20 +1347,20 @@ get_applications (ApplicationServiceAppstore * appstore) continue; } - g_variant_builder_add (&builder, "(sisosssss)", app->icon, + g_variant_builder_add (&builder, "(sisossssss)", app->icon, position++, app->dbus_name, app->menu, app->icon_theme_path, app->label, app->guide, (app->icon_desc != NULL) ? app->icon_desc : "", - app->id); + app->id, app->title); } out = g_variant_builder_end(&builder); } else { GError * error = NULL; - out = g_variant_parse(g_variant_type_new("a(sisosssss)"), "[]", NULL, NULL, &error); + out = g_variant_parse(g_variant_type_new("a(sisossssss)"), "[]", NULL, NULL, &error); if (error != NULL) { - g_warning("Unable to parse '[]' as a 'a(sisosssss)': %s", error->message); + g_warning("Unable to parse '[]' as a 'a(sisossssss)': %s", error->message); out = NULL; g_error_free(error); } diff --git a/src/application-service.c b/src/application-service.c index 68ac264..bc1787f 100644 --- a/src/application-service.c +++ b/src/application-service.c @@ -55,7 +55,7 @@ main (int argc, char ** argv) g_type_init(); /* Bring us up as a basic indicator service */ - service = indicator_service_new(INDICATOR_APPLICATION_DBUS_ADDR); + service = indicator_service_new_version(INDICATOR_APPLICATION_DBUS_ADDR, INDICATOR_APPLICATION_SERVICE_VERSION); g_signal_connect(G_OBJECT(service), INDICATOR_SERVICE_SIGNAL_SHUTDOWN, G_CALLBACK(service_disconnected), NULL); /* Building our app store */ diff --git a/src/application-service.xml b/src/application-service.xml index 434cfd8..9428ebb 100644 --- a/src/application-service.xml +++ b/src/application-service.xml @@ -26,7 +26,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. <!-- Methods --> <method name="GetApplications"> - <arg type="a(sisosssss)" name="applications" direction="out" /> + <arg type="a(sisossssss)" name="applications" direction="out" /> </method> <method name="ApplicationScrollEvent"> <arg type="s" name="dbusaddress" direction="in" /> @@ -51,6 +51,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. <arg type="s" name="labelguide" direction="out" /> <arg type="s" name="accessibledesc" direction="out" /> <arg type="s" name="hint" direction="out" /> + <arg type="s" name="title" direction="out" /> </signal> <signal name="ApplicationRemoved"> <arg type="i" name="position" direction="out" /> @@ -69,5 +70,9 @@ with this program. If not, see <http://www.gnu.org/licenses/>. <arg type="s" name="label" direction="out" /> <arg type="s" name="guide" direction="out" /> </signal> + <signal name="ApplicationTitleChanged"> + <arg type="i" name="position" direction="out" /> + <arg type="s" name="title" direction="out" /> + </signal> </interface> </node> diff --git a/src/dbus-shared.h b/src/dbus-shared.h index 6144b9b..ce27bd9 100644 --- a/src/dbus-shared.h +++ b/src/dbus-shared.h @@ -23,6 +23,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #define INDICATOR_APPLICATION_DBUS_ADDR "com.canonical.indicator.application" #define INDICATOR_APPLICATION_DBUS_OBJ "/com/canonical/indicator/application/service" #define INDICATOR_APPLICATION_DBUS_IFACE "com.canonical.indicator.application.service" +#define INDICATOR_APPLICATION_SERVICE_VERSION 2 #define NOTIFICATION_WATCHER_DBUS_ADDR "org.kde.StatusNotifierWatcher" #define NOTIFICATION_WATCHER_DBUS_OBJ "/StatusNotifierWatcher" diff --git a/src/indicator-application.c b/src/indicator-application.c index 173124c..8b28ebc 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -158,7 +158,7 @@ indicator_application_init (IndicatorApplication *self) priv->theme_dirs = NULL; priv->disconnect_kill = 0; - priv->sm = indicator_service_manager_new(INDICATOR_APPLICATION_DBUS_ADDR); + priv->sm = indicator_service_manager_new_version(INDICATOR_APPLICATION_DBUS_ADDR, INDICATOR_APPLICATION_SERVICE_VERSION); g_signal_connect(G_OBJECT(priv->sm), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_changed), self); priv->applications = NULL; @@ -811,10 +811,11 @@ receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, const gchar * guide; const gchar * accessible_desc; const gchar * hint; - g_variant_get (parameters, "(&si&s&o&s&s&s&s&s)", &iconname, + const gchar * title; + g_variant_get (parameters, "(&si&s&o&s&s&s&s&s&s)", &iconname, &position, &dbusaddress, &dbusobject, &icon_theme_path, &label, &guide, - &accessible_desc, &hint); + &accessible_desc, &hint, &title); application_added(self, iconname, position, dbusaddress, dbusobject, icon_theme_path, label, guide, accessible_desc, hint); @@ -884,7 +885,7 @@ get_applications (GObject * obj, GAsyncResult * res, gpointer user_data) } /* Get our new applications that we got in the request */ - g_variant_get(result, "(a(sisosssss))", &iter); + g_variant_get(result, "(a(sisossssss))", &iter); while ((child = g_variant_iter_next_value (iter))) { get_applications_helper(self, child); g_variant_unref(child); @@ -909,9 +910,10 @@ get_applications_helper (IndicatorApplication * self, GVariant * variant) const gchar * guide; const gchar * accessible_desc; const gchar * hint; - g_variant_get(variant, "(sisosssss)", &icon_name, &position, + const gchar * title; + g_variant_get(variant, "(sisossssss)", &icon_name, &position, &dbus_address, &dbus_object, &icon_theme_path, &label, - &guide, &accessible_desc, &hint); + &guide, &accessible_desc, &hint, &title); return application_added(self, icon_name, position, dbus_address, dbus_object, icon_theme_path, label, guide, accessible_desc, hint); } |