diff options
author | Ted Gould <ted@gould.cx> | 2010-08-11 22:22:24 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-08-11 22:22:24 -0500 |
commit | fa45eaa48e679ddf2c264185e624723a7c1c27ac (patch) | |
tree | cfa9f6f739f95dad0bff4623676d64a9a802785b /src | |
parent | d72265317345f41ea39f306c149fcf098ba1194e (diff) | |
download | libayatana-appindicator-fa45eaa48e679ddf2c264185e624723a7c1c27ac.tar.gz libayatana-appindicator-fa45eaa48e679ddf2c264185e624723a7c1c27ac.tar.bz2 libayatana-appindicator-fa45eaa48e679ddf2c264185e624723a7c1c27ac.zip |
Switching the get_position() function to look at the visibility of the applications.
Diffstat (limited to 'src')
-rw-r--r-- | src/application-service-appstore.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 00de4b9..1b10033 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -342,18 +342,34 @@ string_to_status(const gchar * status_string) } /* A small helper function to get the position of an application - in the app list. */ + in the app list of the applications that are visible. */ static gint get_position (Application * app) { ApplicationServiceAppstore * appstore = app->appstore; ApplicationServiceAppstorePrivate * priv = appstore->priv; - GList * applistitem = g_list_find(priv->applications, app); - if (applistitem == NULL) { - return -1; + GList * lapp; + gint count; + + /* Go through the list and try to find ours */ + for (lapp = priv->applications, count = 0; lapp != NULL; lapp = g_list_next(lapp), count++) { + if (lapp->data == app) { + break; + } + + /* If the selected app isn't visible let's not + count it's position */ + Application * thisapp = (Application *)(lapp->data); + if (thisapp->visible_state == VISIBLE_STATE_HIDDEN) { + count--; + } } - return g_list_position(priv->applications, applistitem); + if (lapp == NULL) { + return -1; + } + + return count; } /* A simple global function for dealing with freeing the information |