[Xfce4-commits] <midori:master> Fix hiding of the empty extension list

Christian Dywan noreply at xfce.org
Thu Aug 4 23:42:01 CEST 2011


Updating branch refs/heads/master
         to 761ef8c4e63dcc68e4f6c2669c833454c097d460 (commit)
       from e6ecd20be4085f16e5f750a43c894ca0034d131b (commit)

commit 761ef8c4e63dcc68e4f6c2669c833454c097d460
Author: Christian Dywan <christian at twotoasts.de>
Date:   Thu Aug 4 23:41:01 2011 +0200

    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 14805c9..22912aa 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 fa4be41..133b982 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:


More information about the Xfce4-commits mailing list