(GSourceFunc)midori_browser_panel_timeout, hpaned, NULL);
}
+static void
+midori_panel_notify_page_cb (MidoriPanel* panel,
+ GParamSpec* pspec,
+ MidoriBrowser* browser)
+{
+ gint page = katze_object_get_boolean (panel, "page");
+ if (browser->settings && page > -1)
+ g_object_set (browser->settings, "last-panel-page", page, NULL);
+}
+
static void
midori_panel_notify_right_aligned_cb (MidoriPanel* panel,
GParamSpec* pspec,
if (GTK_WIDGET_REALIZED (widget))
{
+ gpointer last_page;
GdkWindowState state = gdk_window_get_state (widget->window);
+
+ if ((last_page = g_object_get_data (G_OBJECT (browser), "last-page")))
+ {
+ midori_panel_set_current_page (MIDORI_PANEL (browser->panel),
+ GPOINTER_TO_INT (last_page));
+ g_object_set_data (G_OBJECT (browser), "last-page", NULL);
+ }
+
if (!(state &
(GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN))
&& !browser->alloc_timeout)
browser->panel = g_object_new (MIDORI_TYPE_PANEL,
"menu", browser->menu_tools,
NULL);
+ g_signal_connect (browser->panel, "notify::page",
+ G_CALLBACK (midori_panel_notify_page_cb), browser);
g_signal_connect (browser->panel, "notify::right-aligned",
G_CALLBACK (midori_panel_notify_right_aligned_cb), browser);
g_signal_connect (browser->panel, "close",
right_align_sidepanel);
gtk_paned_set_position (GTK_PANED (gtk_widget_get_parent (browser->panel)),
last_panel_position);
- midori_panel_set_current_page (MIDORI_PANEL (browser->panel), last_panel_page);
+ /* The browser may not yet be visible, which means that we can't set the
+ page. So we set it in midori_browser_size_allocate_cb */
+ if (GTK_WIDGET_VISIBLE (browser))
+ midori_panel_set_current_page (MIDORI_PANEL (browser->panel), last_panel_page);
+ else
+ g_object_set_data (G_OBJECT (browser), "last-page",
+ GINT_TO_POINTER (last_panel_page));
_action_set_active (browser, "Menubar", show_menubar);
_action_set_active (browser, "Navigationbar", browser->show_navigationbar);
*
* The child must be visible, otherwise the underlying GtkNotebook will
* silently ignore the attempt to switch the page.
+ *
+ * Since 0.1.8 the "page" property is notifying changes.
**/
void
midori_panel_set_current_page (MidoriPanel* panel,
g_return_if_fail (MIDORI_IS_PANEL (panel));
- gtk_notebook_set_current_page (GTK_NOTEBOOK (panel->toolbook), n);
- gtk_notebook_set_current_page (GTK_NOTEBOOK (panel->notebook), n);
-
if ((viewable = midori_panel_get_nth_page (panel, n)))
{
const gchar* label;
+ 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));
g_object_set (panel->toolbar_label, "label", label, NULL);
+ g_object_notify (G_OBJECT (panel), "page");
}
}