Fix hiding of the empty extension list

This commit is contained in:
Christian Dywan 2011-08-04 23:41:01 +02:00
parent e6ecd20be4
commit 761ef8c4e6
2 changed files with 18 additions and 7 deletions

View file

@ -711,10 +711,24 @@ midori_browser_show_preferences_cb (MidoriBrowser* browser,
KatzePreferences* preferences, KatzePreferences* preferences,
MidoriApp* app) MidoriApp* app)
{ {
GtkWidget* scrolled = katze_scrolled_new (NULL, NULL); KatzeArray* array;
GtkWidget* addon = g_object_new (MIDORI_TYPE_EXTENSIONS, NULL); GtkWidget* scrolled;
GList* children = gtk_container_get_children (GTK_CONTAINER (addon)); GtkWidget* addon;
GList* children;
GtkWidget* page; 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); gtk_widget_reparent (g_list_nth_data (children, 0), scrolled);
g_list_free (children); g_list_free (children);
g_object_set (addon, "app", app, NULL); g_object_set (addon, "app", app, NULL);

View file

@ -178,10 +178,7 @@ midori_extensions_set_property (GObject* object,
KATZE_ARRAY_FOREACH_ITEM (extension, array) KATZE_ARRAY_FOREACH_ITEM (extension, array)
midori_extensions_add_item_cb (array, extension, extensions); midori_extensions_add_item_cb (array, extension, extensions);
g_object_unref (array);
/* Hide if there are no extensions at all */
if (!katze_array_get_nth_item (array, 0))
gtk_widget_hide (GTK_WIDGET (object));
} }
break; break;
default: default: