Fix report page focus

Currently the setting of keyboard focus is to the scroll window but
should be to the Webkit webview so correct this.
This commit is contained in:
Robert Fewell 2020-10-26 11:05:02 +00:00
parent b51a70675f
commit 5c48244e8d
3 changed files with 43 additions and 4 deletions

View File

@ -253,7 +253,7 @@ gnc_plugin_page_report_focus_widget (GncPluginPage *report_plugin_page)
if (window && !gnc_main_window_is_restoring_pages (GNC_MAIN_WINDOW(window)))
{
GtkWidget * widget = gnc_html_get_widget (priv->html);
GtkWidget *widget = gnc_html_get_webview (priv->html);
gnc_plugin_page_report_load_uri (report_plugin_page);
@ -752,15 +752,12 @@ static void
gnc_plugin_page_report_destroy_widget(GncPluginPage *plugin_page)
{
GncPluginPageReportPrivate *priv;
GtkWidget *widget;
// FIXME: cleanup other resources.
PINFO("destroy widget");
priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(plugin_page);
widget = gnc_html_get_widget(priv->html);
// Remove the page_changed signal callback
gnc_plugin_page_disconnect_page_changed (GNC_PLUGIN_PAGE(plugin_page));

View File

@ -574,6 +574,39 @@ gnc_html_get_widget( GncHtml* self )
return GNC_HTML_GET_PRIVATE(self)->container;
}
GtkWidget *
gnc_html_get_webview( GncHtml* self )
{
GncHtmlPrivate* priv;
GList *sw_list = NULL;
GtkWidget *webview = NULL;
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (GNC_IS_HTML(self), NULL);
priv = GNC_HTML_GET_PRIVATE(self);
sw_list = gtk_container_get_children (GTK_CONTAINER(priv->container));
if (sw_list) // the scroll window has only one child
{
#ifdef WEBKIT1
webview = sw_list->data;
#else
GList *vp_list = gtk_container_get_children (GTK_CONTAINER(sw_list->data));
if (vp_list) // the viewport has only one child
{
webview = vp_list->data;
g_list_free (vp_list);
}
#endif
}
g_list_free (sw_list);
return webview;
}
void
gnc_html_set_parent( GncHtml* self, GtkWindow* parent )
{

View File

@ -256,6 +256,15 @@ gnc_html_history* gnc_html_get_history( GncHtml* html );
*/
GtkWidget* gnc_html_get_widget( GncHtml* html );
/**
* Returns the webview widget for this html engine
*
* @param html GncHtml object
* @return webview widget
*/
GtkWidget* gnc_html_get_webview( GncHtml* html );
/**
* Sets the parent window for this html engine. The engine will be embedded in this parent.
*