]> spindle.queued.net Git - midori/commitdiff
Fix hiding of the empty extension list
authorChristian Dywan <christian@twotoasts.de>
Thu, 4 Aug 2011 21:41:01 +0000 (23:41 +0200)
committerChristian Dywan <christian@twotoasts.de>
Thu, 4 Aug 2011 21:41:01 +0000 (23:41 +0200)
midori/main.c
panels/midori-extensions.c

index 14805c9d508d8dedd62c0e9a021088d5cfa4a90f..22912aa2c8e77f06d672df97e727c5df97e83179 100644 (file)
@@ -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);
index fa4be41fe09b69a23fc56bfc119a48a6cbe8770c..133b982e04e3d3db969383c0995a282d983eae0a 100644 (file)
@@ -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: