Reports were not being loaded

The reports page uses a g_idle_add against the plugin_page to load the
report once the container for the report is realized. With the changes
to the page focus functions, the use of g_idle_remove_by_data removed
this idle function so no report. Change the page focus functions to
record the id used and then use this id to remove the page focus idle
function.
pull/649/head
Robert Fewell 6 years ago
parent c60555e9c5
commit ce0d52e1ef

@ -107,6 +107,7 @@ typedef struct _GncPluginPagePrivate
gchar *statusbar_text;
gulong page_changed_id;
guint focus_source_id;
} GncPluginPagePrivate;
@ -521,6 +522,7 @@ gnc_plugin_page_init (GncPluginPage *page, void *data)
priv->page_color = NULL;
priv->uri = NULL;
priv->page_changed_id = 0;
priv->focus_source_id = 0;
page->window = NULL;
page->summarybar = NULL;
@ -856,6 +858,14 @@ gnc_plugin_page_set_page_color (GncPluginPage *page, const gchar *color)
}
static void
gnc_plugin_page_focus_idle_destroy (GncPluginPage *plugin_page)
{
GncPluginPagePrivate *priv = GNC_PLUGIN_PAGE_GET_PRIVATE(plugin_page);
priv->focus_source_id = 0;
}
static void
gnc_plugin_page_default_focus (GncPluginPage *plugin_page,
gboolean on_current_page)
@ -873,9 +883,14 @@ gnc_plugin_page_default_focus (GncPluginPage *plugin_page,
{
// The page changed signal is emitted multiple times so we need
// to use an idle_add to change the focus
g_idle_remove_by_data (GNC_PLUGIN_PAGE(plugin_page));
g_idle_add ((GSourceFunc)(GNC_PLUGIN_PAGE_GET_CLASS(plugin_page)->focus_page_function),
GNC_PLUGIN_PAGE(plugin_page));
if (priv->focus_source_id > 0)
g_source_remove (priv->focus_source_id);
priv->focus_source_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
(GSourceFunc)(GNC_PLUGIN_PAGE_GET_CLASS(plugin_page)->focus_page_function),
GNC_PLUGIN_PAGE(plugin_page),
(GDestroyNotify)gnc_plugin_page_focus_idle_destroy);
}
}
@ -907,6 +922,7 @@ gnc_plugin_page_main_window_changed (GtkWindow *window,
(GNC_PLUGIN_PAGE_GET_CLASS(plugin_page)->focus_page)(plugin_page, on_current_page);
}
/* this is the callback for the plugin "inserted" signal which will setup
* the callback for the "page_changed" signal and save a pointer to the
* page focus function. */

@ -167,8 +167,8 @@ typedef struct
* widget.
*
* @param page The page that was added to a window.
*
* @param on_current_pgae Whether this page is the currentone. */
*
* @return FALSE to remove idle */
gboolean (* focus_page_function) (GncPluginPage *plugin_page);
/** This function vector allows page specific actions to occur

@ -156,7 +156,7 @@ gnc_plugin_budget_cmd_new_budget (GtkAction *action,
budget = gnc_budget_new (gnc_get_current_book());
page = gnc_plugin_page_budget_new (budget);
date = qof_print_date (gnc_time (NULL));
date = gnc_print_time64 (gnc_time (NULL), qof_date_format_get_string (QOF_DATE_FORMAT_LOCALE));
description = g_strdup_printf ("%s: %s", _("Created"), date);
gnc_budget_set_description (budget, description);
g_free (description);

Loading…
Cancel
Save