aboutsummaryrefslogtreecommitdiff
path: root/src/application-service-appstore.c
diff options
context:
space:
mode:
authorSense Egbert Hofstede <sense@ubuntu.com>2010-09-18 19:22:25 +0200
committerSense Egbert Hofstede <sense@ubuntu.com>2010-09-18 19:22:25 +0200
commit6c8da9ed8f79fb5f411a4130c99ce3189b7b5b82 (patch)
tree364ffa7b5846ebe142ddf1729584754f18e04404 /src/application-service-appstore.c
parente050bfc4eedf02d0adffecca9f3cf901e73686b2 (diff)
parentc2aee8ac8876b03c1fcddaeca884620f973d698d (diff)
downloadlibayatana-appindicator-6c8da9ed8f79fb5f411a4130c99ce3189b7b5b82.tar.gz
libayatana-appindicator-6c8da9ed8f79fb5f411a4130c99ce3189b7b5b82.tar.bz2
libayatana-appindicator-6c8da9ed8f79fb5f411a4130c99ce3189b7b5b82.zip
Updating to trunk
Diffstat (limited to 'src/application-service-appstore.c')
-rw-r--r--src/application-service-appstore.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c
index f52ea2d..46118bb 100644
--- a/src/application-service-appstore.c
+++ b/src/application-service-appstore.c
@@ -72,6 +72,8 @@ typedef enum {
VISIBLE_STATE_SHOWN
} visible_state_t;
+#define STATE2STRING(x) ((x) == VISIBLE_STATE_HIDDEN ? "hidden" : "visible")
+
typedef struct _Approver Approver;
struct _Approver {
DBusGProxy * proxy;
@@ -129,6 +131,7 @@ static AppIndicatorCategory string_to_cat(const gchar * cat_string);
static void approver_free (gpointer papprover, gpointer user_data);
static void check_with_new_approver (gpointer papp, gpointer papprove);
static void check_with_old_approver (gpointer papprove, gpointer papp);
+static Application * find_application (ApplicationServiceAppstore * appstore, const gchar * address, const gchar * object);
G_DEFINE_TYPE (ApplicationServiceAppstore, application_service_appstore, G_TYPE_OBJECT);
@@ -485,6 +488,7 @@ get_position (Application * app) {
}
if (lapp == NULL) {
+ g_warning("Unable to find position for app '%s'", app->id);
return -1;
}
@@ -497,6 +501,7 @@ static void
application_free (Application * app)
{
if (app == NULL) return;
+ g_debug("Application free '%s'", app->id);
/* Handle the case where this could be called by unref'ing one of
the proxy objects. */
@@ -554,6 +559,7 @@ static void
application_removed_cb (DBusGProxy * proxy, gpointer userdata)
{
Application * app = (Application *)userdata;
+ g_debug("Application proxy destroyed '%s'", app->id);
/* Remove from the panel */
app->status = APP_INDICATOR_STATUS_PASSIVE;
@@ -596,10 +602,19 @@ apply_status (Application * app)
}
/* Nothing needs to change, we're good */
- if (app->visible_state == goal_state) {
+ if (app->visible_state == goal_state /* ) { */
+ && goal_state == VISIBLE_STATE_HIDDEN) {
+ /* TODO: Uhg, this is a little wrong in that we're going to
+ send an icon every time the status changes and the indicator
+ is visible even though it might not be updating. But, at
+ this point we need a small patch that is harmless. In the
+ future we need to track which icon is shown and remove the
+ duplicate message. */
return;
}
+ g_debug("Changing app '%s' state from %s to %s", app->id, STATE2STRING(app->visible_state), STATE2STRING(goal_state));
+
/* This means we're going off line */
if (goal_state == VISIBLE_STATE_HIDDEN) {
gint position = get_position(app);
@@ -621,7 +636,7 @@ apply_status (Application * app)
g_signal_emit(G_OBJECT(app->appstore),
signals[APPLICATION_ADDED], 0,
newicon,
- g_list_index(priv->applications, app), /* Position */
+ get_position(app), /* Position */
app->dbus_name,
app->menu,
app->icon_theme_path,
@@ -848,10 +863,20 @@ application_service_appstore_application_add (ApplicationServiceAppstore * appst
g_return_if_fail(dbus_name != NULL && dbus_name[0] != '\0');
g_return_if_fail(dbus_object != NULL && dbus_object[0] != '\0');
ApplicationServiceAppstorePrivate * priv = appstore->priv;
+ Application * app = find_application(appstore, dbus_name, dbus_object);
+
+ if (app != NULL) {
+ g_warning("Application already exists! Rerequesting properties.");
+ org_freedesktop_DBus_Properties_get_all_async(app->prop_proxy,
+ NOTIFICATION_ITEM_DBUS_IFACE,
+ get_all_properties_cb,
+ app);
+ return;
+ }
/* Build the application entry. This will be carried
along until we're sure we've got everything. */
- Application * app = g_new0(Application, 1);
+ app = g_new0(Application, 1);
app->validated = FALSE;
app->dbus_name = g_strdup(dbus_name);