/** * Whenever the current page is changed, if an invoice page is * the current page, set focus on the sheet or notes field. */ static void gnc_plugin_page_invoice_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) { GncPluginPageInvoice *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 // to use an idle_add to change the focus to the sheet g_idle_remove_by_data (priv->iw); g_idle_add ((GSourceFunc)gnc_plugin_page_invoice_focus, priv->iw); } }
static void gnc_plugin_business_cmd_assign_payment (GtkAction *action, GncMainWindowActionData *mw) { GncPluginBusiness *plugin_business; GncPluginBusinessPrivate *plugin_business_priv; GncPluginPage *plugin_page; GNCSplitReg *gsr; SplitRegister *reg; Split *split; Transaction *trans; gboolean have_owner; GncOwner owner; GncOwner *owner_p; g_return_if_fail (mw != NULL); g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data)); plugin_page = gnc_main_window_get_current_page(mw->window); // We continue only if the current page is a plugin page and more // specifically a register plugin page if (!GNC_IS_PLUGIN_PAGE(plugin_page) || !GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page)) return; gsr = gnc_plugin_page_register_get_gsr(plugin_page); g_return_if_fail(gsr); reg = gnc_ledger_display_get_split_register( gsr->ledger ); g_return_if_fail(reg); split = gnc_split_register_get_current_split(reg); g_return_if_fail(split); trans = xaccSplitGetParent(split); g_return_if_fail(trans); plugin_business = GNC_PLUGIN_BUSINESS (mw->data); plugin_business_priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin_business); have_owner = gncOwnerGetOwnerFromTxn (trans, &owner); if (have_owner) owner_p = &owner; else if (gnc_ui_payment_is_customer_payment(trans)) owner_p = plugin_business_priv->last_customer; else owner_p = plugin_business_priv->last_vendor; gnc_business_assign_payment (GTK_WINDOW (mw->window), trans, owner_p); }
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_add ((GSourceFunc)gnc_plugin_page_account_tree_focus, GNC_PLUGIN_PAGE_ACCOUNT_TREE (plugin_page)); } }