[gnc-plugin-page] Don't automatically focus pages when they are recreated

This has to disregard the "open adjacent" preference to get them to be in
the right order because the first page will remain focused until the
restore is complete.

Change the register page so that it doesn't assume it will be in focus on
creation.
This commit is contained in:
Simon Arlott 2023-06-03 11:03:32 +01:00
parent 9ac12db68f
commit d56d68b7ab
No known key found for this signature in database
GPG Key ID: DF001BFD83E75990
3 changed files with 8 additions and 6 deletions

View File

@ -3035,7 +3035,8 @@ gnc_main_window_connect (GncMainWindow *window,
priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
notebook = GTK_NOTEBOOK (priv->notebook);
if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_OPEN_ADJACENT))
if (!priv->restoring_pages
&& gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_OPEN_ADJACENT))
current_position = g_list_index (priv->installed_pages, priv->current_page) + 1;
priv->installed_pages = g_list_insert (priv->installed_pages, page, current_position);
@ -3044,7 +3045,8 @@ gnc_main_window_connect (GncMainWindow *window,
tab_hbox, menu_label, current_position);
gtk_notebook_set_tab_reorderable (notebook, page->notebook_page, TRUE);
gnc_plugin_page_inserted (page);
gtk_notebook_set_current_page (notebook, current_position);
if (!priv->restoring_pages)
gtk_notebook_set_current_page (notebook, current_position);
if (GNC_PLUGIN_PAGE_GET_CLASS(page)->window_changed)
(GNC_PLUGIN_PAGE_GET_CLASS(page)->window_changed)(page, GTK_WIDGET(window));
@ -3187,7 +3189,8 @@ gnc_main_window_open_page (GncMainWindow *window,
if (gnc_main_window_page_exists(page))
{
gnc_main_window_display_page(page);
if (!gnc_main_window_is_restoring_pages (window))
gnc_main_window_display_page (page);
return;
}

View File

@ -888,7 +888,8 @@ gnc_plugin_page_inserted_cb (GncPluginPage *page, gpointer user_data)
page);
// on initial load try and set the page focus
(GNC_PLUGIN_PAGE_GET_CLASS(page)->focus_page)(page, TRUE);
if (!gnc_main_window_is_restoring_pages (GNC_MAIN_WINDOW(page->window)))
(GNC_PLUGIN_PAGE_GET_CLASS(page)->focus_page)(page, TRUE);
}

View File

@ -1202,8 +1202,6 @@ gnc_plugin_page_register_create_widget (GncPluginPage* plugin_page)
LEAVE ("existing widget %p", priv->widget);
return priv->widget;
}
// on create, the page will be the current page so set the focus flag
priv->page_focus = TRUE;
priv->widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_set_homogeneous (GTK_BOX (priv->widget), FALSE);