mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Change the way the focus is added to plugin_pages
This change corrects a previous commit and makes all the plugin_pages follow the same format. In the previous commit a test was made for the plugin_page to be equal to one returned from get_current_page which would always be the case. With this change the respective plugin_page is passed as a parameter to the 'page_changed' call back and it is this that is tested against the current plugin_page.
This commit is contained in:
parent
7ee3f43037
commit
94cb96501e
@ -44,8 +44,6 @@
|
|||||||
static void gnc_plugin_account_tree_class_init (GncPluginAccountTreeClass *klass);
|
static void gnc_plugin_account_tree_class_init (GncPluginAccountTreeClass *klass);
|
||||||
static void gnc_plugin_account_tree_init (GncPluginAccountTree *plugin);
|
static void gnc_plugin_account_tree_init (GncPluginAccountTree *plugin);
|
||||||
static void gnc_plugin_account_tree_finalize (GObject *object);
|
static void gnc_plugin_account_tree_finalize (GObject *object);
|
||||||
static void gnc_plugin_account_tree_add_to_window (GncPlugin *plugin,
|
|
||||||
GncMainWindow *window, GQuark type);
|
|
||||||
|
|
||||||
/* Command callbacks */
|
/* Command callbacks */
|
||||||
static void gnc_plugin_account_tree_cmd_new_account_tree (GtkAction *action, GncMainWindowActionData *data);
|
static void gnc_plugin_account_tree_cmd_new_account_tree (GtkAction *action, GncMainWindowActionData *data);
|
||||||
@ -97,26 +95,6 @@ gnc_plugin_account_tree_new (void)
|
|||||||
return GNC_PLUGIN (plugin);
|
return GNC_PLUGIN (plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gnc_plugin_account_tree_main_window_page_changed (GncMainWindow *window,
|
|
||||||
GncPluginPage *plugin_page, gpointer user_data)
|
|
||||||
{
|
|
||||||
// We continue only if the plugin_page is a valid
|
|
||||||
if (!plugin_page || !GNC_IS_PLUGIN_PAGE(plugin_page))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (gnc_main_window_get_current_page (window) == plugin_page)
|
|
||||||
{
|
|
||||||
if (!GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE(plugin_page))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// The page changed signal is emitted multiple times so we need
|
|
||||||
// to use an idle_add to change the focus to the tree view
|
|
||||||
g_idle_remove_by_data (GNC_PLUGIN_PAGE_ACCOUNT_TREE (plugin_page));
|
|
||||||
g_idle_add ((GSourceFunc)gnc_plugin_page_account_tree_focus,
|
|
||||||
GNC_PLUGIN_PAGE_ACCOUNT_TREE (plugin_page));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Initialize the class for a new account tree plugin. This will set
|
/** Initialize the class for a new account tree plugin. This will set
|
||||||
* up any function pointers that override functions in the parent
|
* up any function pointers that override functions in the parent
|
||||||
@ -138,9 +116,6 @@ gnc_plugin_account_tree_class_init (GncPluginAccountTreeClass *klass)
|
|||||||
/* plugin info */
|
/* plugin info */
|
||||||
plugin_class->plugin_name = GNC_PLUGIN_ACCOUNT_TREE_NAME;
|
plugin_class->plugin_name = GNC_PLUGIN_ACCOUNT_TREE_NAME;
|
||||||
|
|
||||||
/* function overrides */
|
|
||||||
plugin_class->add_to_window = gnc_plugin_account_tree_add_to_window;
|
|
||||||
|
|
||||||
/* widget addition/removal */
|
/* widget addition/removal */
|
||||||
plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
|
plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
|
||||||
plugin_class->actions = gnc_plugin_actions;
|
plugin_class->actions = gnc_plugin_actions;
|
||||||
@ -176,20 +151,6 @@ gnc_plugin_account_tree_finalize (GObject *object)
|
|||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when this plugin is added to a main window. Connect a few callbacks
|
|
||||||
* here to track page changes.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static void gnc_plugin_account_tree_add_to_window (GncPlugin *plugin,
|
|
||||||
GncMainWindow *mainwindow,
|
|
||||||
GQuark type)
|
|
||||||
{
|
|
||||||
g_signal_connect(mainwindow, "page_changed",
|
|
||||||
G_CALLBACK(gnc_plugin_account_tree_main_window_page_changed),
|
|
||||||
plugin);
|
|
||||||
}
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
* Command Callbacks *
|
* Command Callbacks *
|
||||||
************************************************************/
|
************************************************************/
|
||||||
|
@ -101,28 +101,6 @@ GncPlugin * gnc_plugin_budget_new (void)
|
|||||||
return GNC_PLUGIN(plugin);
|
return GNC_PLUGIN(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gnc_plugin_budget_main_window_page_changed (GncMainWindow *window,
|
|
||||||
GncPluginPage *plugin_page,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
// We continue only if the plugin_page is a valid
|
|
||||||
if (!plugin_page || !GNC_IS_PLUGIN_PAGE(plugin_page))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (gnc_main_window_get_current_page (window) == plugin_page)
|
|
||||||
{
|
|
||||||
if (!GNC_IS_PLUGIN_PAGE_BUDGET(plugin_page))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// The page changed signal is emitted multiple times so we need
|
|
||||||
// to use an idle_add to change the focus to the tree view
|
|
||||||
g_idle_remove_by_data (GNC_PLUGIN_PAGE_BUDGET(plugin_page));
|
|
||||||
g_idle_add ((GSourceFunc)gnc_plugin_page_budget_focus,
|
|
||||||
GNC_PLUGIN_PAGE_BUDGET(plugin_page));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_PRIVATE(GncPluginBudget, gnc_plugin_budget, GNC_TYPE_PLUGIN)
|
G_DEFINE_TYPE_WITH_PRIVATE(GncPluginBudget, gnc_plugin_budget, GNC_TYPE_PLUGIN)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -135,9 +113,6 @@ gnc_plugin_budget_class_init (GncPluginBudgetClass *klass)
|
|||||||
parent_class = g_type_class_peek_parent (klass);
|
parent_class = g_type_class_peek_parent (klass);
|
||||||
object_class->finalize = gnc_plugin_budget_finalize;
|
object_class->finalize = gnc_plugin_budget_finalize;
|
||||||
|
|
||||||
/* function overrides */
|
|
||||||
plugin_class->add_to_window = gnc_plugin_budget_add_to_window;
|
|
||||||
|
|
||||||
plugin_class->plugin_name = GNC_PLUGIN_BUDGET_NAME;
|
plugin_class->plugin_name = GNC_PLUGIN_BUDGET_NAME;
|
||||||
plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
|
plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
|
||||||
plugin_class->actions = gnc_plugin_actions;
|
plugin_class->actions = gnc_plugin_actions;
|
||||||
@ -163,20 +138,6 @@ gnc_plugin_budget_finalize (GObject *object)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when this plugin is added to a main window. Connect a few callbacks
|
|
||||||
* here to track page changes.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static void gnc_plugin_budget_add_to_window (GncPlugin *plugin,
|
|
||||||
GncMainWindow *mainwindow,
|
|
||||||
GQuark type)
|
|
||||||
{
|
|
||||||
g_signal_connect (mainwindow, "page_changed",
|
|
||||||
G_CALLBACK(gnc_plugin_budget_main_window_page_changed),
|
|
||||||
plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
* Command Callbacks *
|
* Command Callbacks *
|
||||||
************************************************************/
|
************************************************************/
|
||||||
|
@ -636,11 +636,32 @@ gnc_plugin_page_account_editing_finished_cb (gpointer various, GncPluginPageRegi
|
|||||||
gtk_action_set_sensitive (action, TRUE);
|
gtk_action_set_sensitive (action, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_plugin_account_tree_main_window_page_changed (GncMainWindow *window,
|
||||||
|
GncPluginPage *current_plugin_page,
|
||||||
|
GncPluginPage *account_plugin_page)
|
||||||
|
{
|
||||||
|
// We continue only if the plugin_page is a valid
|
||||||
|
if (!current_plugin_page || !GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE(current_plugin_page)||
|
||||||
|
!account_plugin_page || !GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE(account_plugin_page))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (current_plugin_page == account_plugin_page)
|
||||||
|
{
|
||||||
|
// The page changed signal is emitted multiple times so we need
|
||||||
|
// to use an idle_add to change the focus to the tree view
|
||||||
|
g_idle_remove_by_data (GNC_PLUGIN_PAGE_ACCOUNT_TREE (account_plugin_page));
|
||||||
|
g_idle_add ((GSourceFunc)gnc_plugin_page_account_tree_focus,
|
||||||
|
GNC_PLUGIN_PAGE_ACCOUNT_TREE (account_plugin_page));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
gnc_plugin_page_account_tree_create_widget (GncPluginPage *plugin_page)
|
gnc_plugin_page_account_tree_create_widget (GncPluginPage *plugin_page)
|
||||||
{
|
{
|
||||||
GncPluginPageAccountTree *page;
|
GncPluginPageAccountTree *page;
|
||||||
GncPluginPageAccountTreePrivate *priv;
|
GncPluginPageAccountTreePrivate *priv;
|
||||||
|
GncMainWindow *window;
|
||||||
GtkTreeSelection *selection;
|
GtkTreeSelection *selection;
|
||||||
GtkTreeView *tree_view;
|
GtkTreeView *tree_view;
|
||||||
GtkWidget *scrolled_window;
|
GtkWidget *scrolled_window;
|
||||||
@ -738,6 +759,11 @@ gnc_plugin_page_account_tree_create_widget (GncPluginPage *plugin_page)
|
|||||||
gnc_plugin_page_account_tree_summarybar_position_changed,
|
gnc_plugin_page_account_tree_summarybar_position_changed,
|
||||||
page);
|
page);
|
||||||
|
|
||||||
|
window = GNC_MAIN_WINDOW(GNC_PLUGIN_PAGE(page)->window);
|
||||||
|
g_signal_connect (window, "page_changed",
|
||||||
|
G_CALLBACK(gnc_plugin_account_tree_main_window_page_changed),
|
||||||
|
plugin_page);
|
||||||
|
|
||||||
// Read account filter state information from account section
|
// Read account filter state information from account section
|
||||||
gnc_tree_view_account_restore_filter (GNC_TREE_VIEW_ACCOUNT(priv->tree_view), &priv->fd,
|
gnc_tree_view_account_restore_filter (GNC_TREE_VIEW_ACCOUNT(priv->tree_view), &priv->fd,
|
||||||
gnc_state_get_current(), gnc_tree_view_get_state_section (GNC_TREE_VIEW(priv->tree_view)));
|
gnc_state_get_current(), gnc_tree_view_get_state_section (GNC_TREE_VIEW(priv->tree_view)));
|
||||||
|
@ -423,6 +423,27 @@ gnc_plugin_page_budget_refresh_cb (GHashTable *changes, gpointer user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_plugin_budget_main_window_page_changed (GncMainWindow *window,
|
||||||
|
GncPluginPage *current_plugin_page,
|
||||||
|
GncPluginPage *budget_plugin_page)
|
||||||
|
{
|
||||||
|
// We continue only if the plugin_page is a valid
|
||||||
|
if (!current_plugin_page || !GNC_IS_PLUGIN_PAGE_BUDGET(current_plugin_page) ||
|
||||||
|
!budget_plugin_page || !GNC_IS_PLUGIN_PAGE_BUDGET(budget_plugin_page))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (current_plugin_page == budget_plugin_page)
|
||||||
|
{
|
||||||
|
// The page changed signal is emitted multiple times so we need
|
||||||
|
// to use an idle_add to change the focus to the tree view
|
||||||
|
g_idle_remove_by_data (GNC_PLUGIN_PAGE_BUDGET(budget_plugin_page));
|
||||||
|
g_idle_add ((GSourceFunc)gnc_plugin_page_budget_focus,
|
||||||
|
GNC_PLUGIN_PAGE_BUDGET(budget_plugin_page));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************
|
/****************************
|
||||||
* GncPluginPage Functions *
|
* GncPluginPage Functions *
|
||||||
***************************/
|
***************************/
|
||||||
@ -431,6 +452,7 @@ gnc_plugin_page_budget_create_widget (GncPluginPage *plugin_page)
|
|||||||
{
|
{
|
||||||
GncPluginPageBudget *page;
|
GncPluginPageBudget *page;
|
||||||
GncPluginPageBudgetPrivate *priv;
|
GncPluginPageBudgetPrivate *priv;
|
||||||
|
GncMainWindow *window;
|
||||||
|
|
||||||
ENTER("page %p", plugin_page);
|
ENTER("page %p", plugin_page);
|
||||||
page = GNC_PLUGIN_PAGE_BUDGET(plugin_page);
|
page = GNC_PLUGIN_PAGE_BUDGET(plugin_page);
|
||||||
@ -465,6 +487,11 @@ gnc_plugin_page_budget_create_widget (GncPluginPage *plugin_page)
|
|||||||
gnc_budget_get_guid (priv->budget),
|
gnc_budget_get_guid (priv->budget),
|
||||||
QOF_EVENT_DESTROY | QOF_EVENT_MODIFY);
|
QOF_EVENT_DESTROY | QOF_EVENT_MODIFY);
|
||||||
|
|
||||||
|
window = GNC_MAIN_WINDOW(GNC_PLUGIN_PAGE(page)->window);
|
||||||
|
g_signal_connect (window, "page_changed",
|
||||||
|
G_CALLBACK(gnc_plugin_budget_main_window_page_changed),
|
||||||
|
plugin_page);
|
||||||
|
|
||||||
LEAVE("widget = %p", priv->budget_view);
|
LEAVE("widget = %p", priv->budget_view);
|
||||||
return GTK_WIDGET(priv->budget_view);
|
return GTK_WIDGET(priv->budget_view);
|
||||||
}
|
}
|
||||||
|
@ -605,22 +605,17 @@ gnc_plugin_page_invoice_focus (InvoiceWindow *iw)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
gnc_plugin_page_invoice_main_window_page_changed (GncMainWindow *window,
|
gnc_plugin_page_invoice_main_window_page_changed (GncMainWindow *window,
|
||||||
GncPluginPage *plugin_page, gpointer user_data)
|
GncPluginPage *current_plugin_page,
|
||||||
|
GncPluginPage *invoice_plugin_page)
|
||||||
{
|
{
|
||||||
// We continue only if the plugin_page is a valid
|
// We continue only if the plugin_page is a valid
|
||||||
if (!plugin_page || !GNC_IS_PLUGIN_PAGE(plugin_page))
|
if (!current_plugin_page || !GNC_IS_PLUGIN_PAGE_INVOICE(current_plugin_page) ||
|
||||||
|
!invoice_plugin_page || !GNC_IS_PLUGIN_PAGE_INVOICE(invoice_plugin_page))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gnc_main_window_get_current_page (window) == plugin_page)
|
if (current_plugin_page == invoice_plugin_page)
|
||||||
{
|
{
|
||||||
GncPluginPageInvoice *page;
|
GncPluginPageInvoicePrivate *priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(invoice_plugin_page);
|
||||||
GncPluginPageInvoicePrivate *priv;
|
|
||||||
|
|
||||||
if (!GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page))
|
|
||||||
return;
|
|
||||||
|
|
||||||
page = GNC_PLUGIN_PAGE_INVOICE(plugin_page);
|
|
||||||
priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
|
|
||||||
|
|
||||||
// The page changed signal is emitted multiple times so we need
|
// The page changed signal is emitted multiple times so we need
|
||||||
// to use an idle_add to change the focus to the sheet
|
// to use an idle_add to change the focus to the sheet
|
||||||
|
@ -384,22 +384,17 @@ gnc_plugin_page_owner_focus (GtkTreeView *tree_view)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
gnc_plugin_page_owner_main_window_page_changed (GncMainWindow *window,
|
gnc_plugin_page_owner_main_window_page_changed (GncMainWindow *window,
|
||||||
GncPluginPage *plugin_page, gpointer user_data)
|
GncPluginPage *current_plugin_page,
|
||||||
|
GncPluginPage *owner_plugin_page)
|
||||||
{
|
{
|
||||||
// We continue only if the plugin_page is a valid
|
// We continue only if the plugin_page is a valid
|
||||||
if (!plugin_page || !GNC_IS_PLUGIN_PAGE(plugin_page))
|
if (!current_plugin_page || !GNC_IS_PLUGIN_PAGE_OWNER_TREE(current_plugin_page) ||
|
||||||
|
!owner_plugin_page || !GNC_IS_PLUGIN_PAGE_OWNER_TREE(owner_plugin_page))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gnc_main_window_get_current_page (window) == plugin_page)
|
if (current_plugin_page == owner_plugin_page)
|
||||||
{
|
{
|
||||||
GncPluginPageOwnerTree *page;
|
GncPluginPageOwnerTreePrivate *priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(owner_plugin_page);
|
||||||
GncPluginPageOwnerTreePrivate *priv;
|
|
||||||
|
|
||||||
if (!GNC_IS_PLUGIN_PAGE_OWNER_TREE(plugin_page))
|
|
||||||
return;
|
|
||||||
|
|
||||||
page = GNC_PLUGIN_PAGE_OWNER_TREE(plugin_page);
|
|
||||||
priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(page);
|
|
||||||
|
|
||||||
// The page changed signal is emitted multiple times so we need
|
// The page changed signal is emitted multiple times so we need
|
||||||
// to use an idle_add to change the focus to the tree view
|
// to use an idle_add to change the focus to the tree view
|
||||||
|
@ -1144,11 +1144,36 @@ get_filter_default_num_of_days (GNCLedgerDisplayType ledger_type)
|
|||||||
return "0";
|
return "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_plugin_register_main_window_page_changed (GncMainWindow *window,
|
||||||
|
GncPluginPage *current_plugin_page,
|
||||||
|
GncPluginPage *register_plugin_page)
|
||||||
|
{
|
||||||
|
GncPluginPageRegisterPrivate *priv;
|
||||||
|
|
||||||
|
// We continue only if the plugin_page is a valid
|
||||||
|
if (!current_plugin_page || !GNC_IS_PLUGIN_PAGE_REGISTER(current_plugin_page) ||
|
||||||
|
!register_plugin_page || !GNC_IS_PLUGIN_PAGE_REGISTER(register_plugin_page))
|
||||||
|
return;
|
||||||
|
|
||||||
|
priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(register_plugin_page);
|
||||||
|
|
||||||
|
if (current_plugin_page == register_plugin_page)
|
||||||
|
{
|
||||||
|
// The page changed signal is emitted multiple times so we need
|
||||||
|
// to use an idle_add to change the focus to the register
|
||||||
|
g_idle_remove_by_data (GNC_PLUGIN_PAGE_REGISTER (register_plugin_page));
|
||||||
|
g_idle_add ((GSourceFunc)gnc_plugin_page_register_focus,
|
||||||
|
GNC_PLUGIN_PAGE_REGISTER (register_plugin_page));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
gnc_plugin_page_register_create_widget (GncPluginPage *plugin_page)
|
gnc_plugin_page_register_create_widget (GncPluginPage *plugin_page)
|
||||||
{
|
{
|
||||||
GncPluginPageRegister *page;
|
GncPluginPageRegister *page;
|
||||||
GncPluginPageRegisterPrivate *priv;
|
GncPluginPageRegisterPrivate *priv;
|
||||||
|
GncMainWindow *window;
|
||||||
GNCLedgerDisplayType ledger_type;
|
GNCLedgerDisplayType ledger_type;
|
||||||
GncWindow *gnc_window;
|
GncWindow *gnc_window;
|
||||||
guint numRows;
|
guint numRows;
|
||||||
@ -1361,6 +1386,11 @@ gnc_plugin_page_register_create_widget (GncPluginPage *plugin_page)
|
|||||||
gnc_split_reg_set_moved_cb
|
gnc_split_reg_set_moved_cb
|
||||||
(priv->gsr, (GFunc)gnc_plugin_page_register_ui_update, page);
|
(priv->gsr, (GFunc)gnc_plugin_page_register_ui_update, page);
|
||||||
|
|
||||||
|
window = GNC_MAIN_WINDOW(GNC_PLUGIN_PAGE(plugin_page)->window);
|
||||||
|
g_signal_connect (window, "page_changed",
|
||||||
|
G_CALLBACK(gnc_plugin_register_main_window_page_changed),
|
||||||
|
plugin_page);
|
||||||
|
|
||||||
/* DRH - Probably lots of other stuff from regWindowLedger should end up here. */
|
/* DRH - Probably lots of other stuff from regWindowLedger should end up here. */
|
||||||
LEAVE(" ");
|
LEAVE(" ");
|
||||||
return priv->widget;
|
return priv->widget;
|
||||||
|
@ -205,22 +205,17 @@ gnc_plugin_page_sx_list_focus (GtkTreeView *tree_view)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
gnc_plugin_page_sx_list_main_window_page_changed (GncMainWindow *window,
|
gnc_plugin_page_sx_list_main_window_page_changed (GncMainWindow *window,
|
||||||
GncPluginPage *plugin_page, gpointer user_data)
|
GncPluginPage *current_plugin_page,
|
||||||
|
GncPluginPage *sx_plugin_page)
|
||||||
{
|
{
|
||||||
// We continue only if the plugin_page is a valid
|
// We continue only if the plugin_page is a valid
|
||||||
if (!plugin_page || !GNC_IS_PLUGIN_PAGE(plugin_page))
|
if (!current_plugin_page || !GNC_IS_PLUGIN_PAGE_SX_LIST(current_plugin_page) ||
|
||||||
|
!sx_plugin_page || !GNC_IS_PLUGIN_PAGE_SX_LIST(sx_plugin_page))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gnc_main_window_get_current_page (window) == plugin_page)
|
if (current_plugin_page == sx_plugin_page)
|
||||||
{
|
{
|
||||||
GncPluginPageSxList *page;
|
GncPluginPageSxListPrivate *priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(sx_plugin_page);
|
||||||
GncPluginPageSxListPrivate *priv;
|
|
||||||
|
|
||||||
if (!GNC_IS_PLUGIN_PAGE_SX_LIST(plugin_page))
|
|
||||||
return;
|
|
||||||
|
|
||||||
page = GNC_PLUGIN_PAGE_SX_LIST(plugin_page);
|
|
||||||
priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
|
|
||||||
|
|
||||||
// The page changed signal is emitted multiple times so we need
|
// The page changed signal is emitted multiple times so we need
|
||||||
// to use an idle_add to change the focus to the tree view
|
// to use an idle_add to change the focus to the tree view
|
||||||
|
@ -120,27 +120,6 @@ gnc_plugin_register_new (void)
|
|||||||
return GNC_PLUGIN (plugin);
|
return GNC_PLUGIN (plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gnc_plugin_register_main_window_page_changed(GncMainWindow *window,
|
|
||||||
GncPluginPage *plugin_page, gpointer user_data)
|
|
||||||
{
|
|
||||||
// We continue only if the plugin_page is a valid
|
|
||||||
if (!plugin_page || !GNC_IS_PLUGIN_PAGE(plugin_page))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (gnc_main_window_get_current_page (window) == plugin_page)
|
|
||||||
{
|
|
||||||
if (!GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// The page changed signal is emitted multiple times so we need
|
|
||||||
// to use an idle_add to change the focus to the register
|
|
||||||
g_idle_remove_by_data (GNC_PLUGIN_PAGE_REGISTER (plugin_page));
|
|
||||||
g_idle_add ((GSourceFunc)gnc_plugin_page_register_focus,
|
|
||||||
GNC_PLUGIN_PAGE_REGISTER (plugin_page));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_plugin_register_class_init (GncPluginRegisterClass *klass)
|
gnc_plugin_register_class_init (GncPluginRegisterClass *klass)
|
||||||
{
|
{
|
||||||
@ -204,10 +183,6 @@ gnc_plugin_register_add_to_window (GncPlugin *plugin,
|
|||||||
{
|
{
|
||||||
gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL_REGISTER, NULL,
|
gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL_REGISTER, NULL,
|
||||||
gnc_plugin_register_pref_changed, window);
|
gnc_plugin_register_pref_changed, window);
|
||||||
|
|
||||||
g_signal_connect(window, "page_changed",
|
|
||||||
G_CALLBACK(gnc_plugin_register_main_window_page_changed),
|
|
||||||
plugin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -250,24 +250,18 @@ gnc_plugin_page_report_focus (GtkWidget *widget)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
gnc_plugin_page_report_main_window_page_changed (GncMainWindow *window,
|
gnc_plugin_page_report_main_window_page_changed (GncMainWindow *window,
|
||||||
GncPluginPage *plugin_page, gpointer user_data)
|
GncPluginPage *current_plugin_page,
|
||||||
|
GncPluginPage *report_plugin_page)
|
||||||
{
|
{
|
||||||
// We continue only if the plugin_page is a valid
|
// We continue only if the plugin_page is a valid
|
||||||
if (!plugin_page || !GNC_IS_PLUGIN_PAGE(plugin_page))
|
if (!current_plugin_page || !GNC_IS_PLUGIN_PAGE_REPORT(current_plugin_page) ||
|
||||||
|
!report_plugin_page || !GNC_IS_PLUGIN_PAGE_REPORT(report_plugin_page))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gnc_main_window_get_current_page (window) == plugin_page)
|
if (current_plugin_page == report_plugin_page)
|
||||||
{
|
{
|
||||||
GncPluginPageReport *report;
|
GncPluginPageReportPrivate *priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report_plugin_page);
|
||||||
GncPluginPageReportPrivate *priv;
|
GtkWidget *widget = gnc_html_get_widget (priv->html);
|
||||||
GtkWidget *widget;
|
|
||||||
|
|
||||||
if (!GNC_IS_PLUGIN_PAGE_REPORT(plugin_page))
|
|
||||||
return;
|
|
||||||
|
|
||||||
report = GNC_PLUGIN_PAGE_REPORT(plugin_page);
|
|
||||||
priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
|
|
||||||
widget = gnc_html_get_widget(priv->html);
|
|
||||||
|
|
||||||
// The page changed signal is emitted multiple times so we need
|
// The page changed signal is emitted multiple times so we need
|
||||||
// to use an idle_add to change the focus to the webkit widget
|
// to use an idle_add to change the focus to the webkit widget
|
||||||
|
Loading…
Reference in New Issue
Block a user