aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/launcher-menu-item.c13
-rw-r--r--src/launcher-menu-item.h1
-rw-r--r--src/messages-service.c35
3 files changed, 49 insertions, 0 deletions
diff --git a/src/launcher-menu-item.c b/src/launcher-menu-item.c
index 6c79adb..d9c35a8 100644
--- a/src/launcher-menu-item.c
+++ b/src/launcher-menu-item.c
@@ -194,3 +194,16 @@ launcher_menu_item_set_eclipsed (LauncherMenuItem * li, gboolean eclipsed)
dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(li), "show", eclipsed ? "false" : "true");
return;
}
+
+gboolean
+launcher_menu_item_get_eclipsed (LauncherMenuItem * li)
+{
+ const gchar * show = dbusmenu_menuitem_property_get(DBUSMENU_MENUITEM(li), "show");
+ if (show == NULL) {
+ return FALSE;
+ }
+ if (!g_strcmp0(show, "true")) {
+ return TRUE;
+ }
+ return FALSE;
+}
diff --git a/src/launcher-menu-item.h b/src/launcher-menu-item.h
index 2b39073..920194e 100644
--- a/src/launcher-menu-item.h
+++ b/src/launcher-menu-item.h
@@ -57,6 +57,7 @@ LauncherMenuItem * launcher_menu_item_new (const gchar * desktop_file);
const gchar * launcher_menu_item_get_name (LauncherMenuItem * appitem);
const gchar * launcher_menu_item_get_desktop (LauncherMenuItem * launchitem);
void launcher_menu_item_set_eclipsed (LauncherMenuItem * li, gboolean eclipsed);
+gboolean launcher_menu_item_get_eclipsed (LauncherMenuItem * li);
G_END_DECLS
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;