aboutsummaryrefslogtreecommitdiff
path: root/src/messages-service.c
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-08-26 11:14:39 -0500
committerTed Gould <ted@canonical.com>2009-08-26 11:14:39 -0500
commit81ad298ac031b8a1d3727f00f19b7d82bef981f8 (patch)
tree476529ad2eca97385e9f7baacdf9eaafd463e441 /src/messages-service.c
parent0f990e5a823361e8e428aea77d2db1b7a1cbe8b4 (diff)
downloadayatana-indicator-messages-81ad298ac031b8a1d3727f00f19b7d82bef981f8.tar.gz
ayatana-indicator-messages-81ad298ac031b8a1d3727f00f19b7d82bef981f8.tar.bz2
ayatana-indicator-messages-81ad298ac031b8a1d3727f00f19b7d82bef981f8.zip
Adding in teh ability to count the number of launchers that are visable
Diffstat (limited to 'src/messages-service.c')
-rw-r--r--src/messages-service.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/messages-service.c b/src/messages-service.c
index 6b11e8c..5632c22 100644
--- a/src/messages-service.c
+++ b/src/messages-service.c
@@ -60,6 +60,7 @@ static gboolean blacklist_remove (gpointer data);
static void blacklist_dir_changed (GFileMonitor * monitor, GFile * file, GFile * other_file, GFileMonitorEvent event_type, gpointer user_data);
static void app_dir_changed (GFileMonitor * monitor, GFile * file, GFile * other_file, GFileMonitorEvent event_type, gpointer user_data);
static gboolean destroy_launcher (gpointer data);
+static void check_hidden (void);
/*
@@ -167,6 +168,29 @@ launcherList_sort (gconstpointer a, gconstpointer b)
return g_strcmp0(pan, pbn);
}
+static void
+launcherList_count_helper (gpointer data, gpointer user_data)
+{
+ guint * count = (guint *)user_data;
+ launcherList_t * li = (launcherList_t *)data;
+
+ if (!launcher_menu_item_get_eclipsed(li->menuitem)) {
+ *count = *count + 1;
+ }
+
+ return;
+}
+
+static guint
+launcherList_count (void)
+{
+ guint count = 0;
+
+ g_list_foreach(launcherList, launcherList_count_helper, &count);
+
+ return count;
+}
+
/*
* Black List
*/
@@ -263,6 +287,8 @@ blacklist_add (gpointer udata)
}
}
+ check_hidden();
+
return FALSE;
}
@@ -312,6 +338,8 @@ blacklist_remove (gpointer data)
g_warning("Unable to remove '%s' with value '%s'", definition_file, (gchar *)key);
}
+ check_hidden();
+
return FALSE;
}
@@ -543,6 +571,13 @@ menushell_foreach_cb (DbusmenuMenuitem * data_mi, gpointer data_ms) {
}
static void
+check_hidden (void)
+{
+ launcherList_count();
+ return;
+}
+
+static void
resort_menu (DbusmenuMenuitem * menushell)
{
guint position = 0;