midori_panel_append_page (MIDORI_PANEL (panel), MIDORI_VIEWABLE (addon));
/* Extensions */
- addon = g_object_new (MIDORI_TYPE_EXTENSIONS, "app", app, NULL);
+ addon = g_object_new (MIDORI_TYPE_EXTENSIONS, NULL);
gtk_widget_show (addon);
+ g_object_set (addon, "app", app, NULL);
midori_panel_append_page (MIDORI_PANEL (panel), MIDORI_VIEWABLE (addon));
g_object_unref (panel);
stock_id = midori_viewable_get_stock_id (viewable);
menuitem = gtk_image_menu_item_new_from_stock (stock_id, NULL);
- gtk_widget_show (menuitem);
g_object_set_data (G_OBJECT (menuitem), "page", viewable);
g_signal_connect (menuitem, "activate",
G_CALLBACK (midori_panel_menu_item_activate_cb), panel);
+
+ if (GTK_WIDGET_VISIBLE (viewable))
+ gtk_widget_show (menuitem);
return menuitem;
}
* Since 0.1.3 destroying the @viewable implicitly removes
* the page including the menu and eventual toolbar.
*
+ * Since 0.2.1 a hidden @viewable will not be shown in the panel.
+ *
* In the case of an error, -1 is returned.
*
* Return value: the index of the new page, or -1
GObjectClass* gobject_class;
GtkWidget* widget;
GtkWidget* toolbar;
- #if !HAVE_HILDON
GtkToolItem* toolitem;
- #endif
const gchar* label;
guint n;
label = midori_viewable_get_label (viewable);
g_object_set_data (G_OBJECT (viewable), "parent", scrolled);
- midori_panel_construct_tool_item (panel, viewable);
+ toolitem = midori_panel_construct_tool_item (panel, viewable);
g_signal_connect (viewable, "destroy",
G_CALLBACK (midori_panel_viewable_destroy_cb), panel);
+ if (!GTK_WIDGET_VISIBLE (viewable))
+ {
+ gtk_widget_hide (scrolled);
+ gtk_widget_hide (GTK_WIDGET (toolitem));
+ }
+
return n;
}
* silently ignore the attempt to switch the page.
*
* Since 0.1.8 the "page" property is notifying changes.
+ *
+ * Since 0.2.1 switching to hidden pages fails silently.
**/
void
midori_panel_set_current_page (MidoriPanel* panel,
{
const gchar* label;
+ if (!GTK_WIDGET_VISIBLE (viewable))
+ return;
gtk_notebook_set_current_page (GTK_NOTEBOOK (panel->toolbook), n);
gtk_notebook_set_current_page (GTK_NOTEBOOK (panel->notebook), n);
label = midori_viewable_get_label (MIDORI_VIEWABLE (viewable));
gobject_class->get_property = midori_extensions_get_property;
gobject_class->finalize = midori_extensions_finalize;
- flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT;
+ flags = G_PARAM_READWRITE;
g_object_class_install_property (gobject_class,
PROP_APP,
i = 0;
while ((extension = katze_array_get_nth_item (array, i++)))
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));
}
break;
default: