summaryrefslogtreecommitdiff
path: root/shell/launcher-grid.c
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2013-10-28 14:27:41 +0100
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2013-10-28 14:39:03 +0100
commitad592c81d71c57726b6d0a172b0bc6e05bbcdd43 (patch)
tree4af9b214591781d1b9c3b1bebd420c936e8eff74 /shell/launcher-grid.c
parent0b3669f00e5278cb53a250dd0a15eedb019d0493 (diff)
downloadgraynard-ad592c81d71c57726b6d0a172b0bc6e05bbcdd43.tar.gz
graynard-ad592c81d71c57726b6d0a172b0bc6e05bbcdd43.zip
grid: don't add duplicate entries when the menu tree changes
Fix a few bugs in our shell-app-system code that are exposed by this change.
Diffstat (limited to 'shell/launcher-grid.c')
-rw-r--r--shell/launcher-grid.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/shell/launcher-grid.c b/shell/launcher-grid.c
index 2ba8443..916722d 100644
--- a/shell/launcher-grid.c
+++ b/shell/launcher-grid.c
@@ -26,19 +26,26 @@ child_activated_cb (GtkWidget *grid,
}
static void
+destroy_widget (GtkWidget *widget,
+ gpointer data)
+{
+ gtk_widget_destroy (widget);
+}
+
+static void
installed_changed_cb (ShellAppSystem *app_system, GtkWidget *grid)
{
GHashTable *entries = shell_app_system_get_entries (app_system);
GHashTableIter iter;
gpointer key, value;
- /* FIXME: if the tree changes while we're running, we'll readd entries
- * that haven't been removed from the tree, so we'll get lots of dups */
+ /* Remove all children first */
+ gtk_container_foreach (GTK_CONTAINER (grid), destroy_widget, NULL);
g_hash_table_iter_init (&iter, entries);
while (g_hash_table_iter_next (&iter, &key, &value))
{
- GDesktopAppInfo *info = value;
+ GDesktopAppInfo *info = G_DESKTOP_APP_INFO (value);
GtkWidget *app = app_launcher_new_from_desktop_info (info);
gtk_container_add (GTK_CONTAINER (grid), app);