From 761ef8c4e63dcc68e4f6c2669c833454c097d460 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Thu, 4 Aug 2011 23:41:01 +0200 Subject: [PATCH] Fix hiding of the empty extension list --- midori/main.c | 20 +++++++++++++++++--- panels/midori-extensions.c | 5 +---- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/midori/main.c b/midori/main.c index 14805c9d..22912aa2 100644 --- a/midori/main.c +++ b/midori/main.c @@ -711,10 +711,24 @@ midori_browser_show_preferences_cb (MidoriBrowser* browser, KatzePreferences* preferences, MidoriApp* app) { - GtkWidget* scrolled = katze_scrolled_new (NULL, NULL); - GtkWidget* addon = g_object_new (MIDORI_TYPE_EXTENSIONS, NULL); - GList* children = gtk_container_get_children (GTK_CONTAINER (addon)); + KatzeArray* array; + GtkWidget* scrolled; + GtkWidget* addon; + GList* children; GtkWidget* page; + + /* Hide if there are no extensions at all */ + array = katze_object_get_object (app, "extensions"); + if (!katze_array_get_nth_item (array, 0)) + { + g_object_unref (array); + return; + } + g_object_unref (array); + + scrolled = katze_scrolled_new (NULL, NULL); + addon = g_object_new (MIDORI_TYPE_EXTENSIONS, NULL); + children = gtk_container_get_children (GTK_CONTAINER (addon)); gtk_widget_reparent (g_list_nth_data (children, 0), scrolled); g_list_free (children); g_object_set (addon, "app", app, NULL); diff --git a/panels/midori-extensions.c b/panels/midori-extensions.c index fa4be41f..133b982e 100644 --- a/panels/midori-extensions.c +++ b/panels/midori-extensions.c @@ -178,10 +178,7 @@ midori_extensions_set_property (GObject* object, KATZE_ARRAY_FOREACH_ITEM (extension, array) midori_extensions_add_item_cb (array, extension, extensions); - - /* Hide if there are no extensions at all */ - if (!katze_array_get_nth_item (array, 0)) - gtk_widget_hide (GTK_WIDGET (object)); + g_object_unref (array); } break; default: -- 2.39.5