mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Transient-for for Edit/New Account dialog.
This commit is contained in:
parent
36fa8d57bf
commit
c76efd656e
@ -1568,7 +1568,8 @@ refresh_handler (GHashTable *changes, gpointer user_data)
|
|||||||
|
|
||||||
|
|
||||||
static AccountWindow *
|
static AccountWindow *
|
||||||
gnc_ui_new_account_window_internal (QofBook *book,
|
gnc_ui_new_account_window_internal (GtkWindow *parent,
|
||||||
|
QofBook *book,
|
||||||
Account *base_account,
|
Account *base_account,
|
||||||
gchar **subaccount_names,
|
gchar **subaccount_names,
|
||||||
GList *valid_types,
|
GList *valid_types,
|
||||||
@ -1616,6 +1617,8 @@ gnc_ui_new_account_window_internal (QofBook *book,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gnc_account_window_create (aw);
|
gnc_account_window_create (aw);
|
||||||
|
gtk_window_set_transient_for (GTK_WINDOW (aw->dialog), parent);
|
||||||
|
|
||||||
gnc_account_to_ui (aw);
|
gnc_account_to_ui (aw);
|
||||||
|
|
||||||
gnc_resume_gui_refresh ();
|
gnc_resume_gui_refresh ();
|
||||||
@ -1722,23 +1725,27 @@ gnc_split_account_name (QofBook *book, const char *in_name, Account **base_accou
|
|||||||
************************************************************/
|
************************************************************/
|
||||||
|
|
||||||
Account *
|
Account *
|
||||||
gnc_ui_new_accounts_from_name_window (const char *name)
|
gnc_ui_new_accounts_from_name_window (GtkWindow *parent, const char *name)
|
||||||
{
|
{
|
||||||
return gnc_ui_new_accounts_from_name_with_defaults (name, NULL, NULL, NULL);
|
return gnc_ui_new_accounts_from_name_with_defaults (parent, name, NULL,
|
||||||
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Account *
|
Account *
|
||||||
gnc_ui_new_accounts_from_name_window_with_types (const char *name,
|
gnc_ui_new_accounts_from_name_window_with_types (GtkWindow *parent,
|
||||||
|
const char *name,
|
||||||
GList *valid_types)
|
GList *valid_types)
|
||||||
{
|
{
|
||||||
return gnc_ui_new_accounts_from_name_with_defaults(name, valid_types, NULL, NULL);
|
return gnc_ui_new_accounts_from_name_with_defaults(parent, name,
|
||||||
|
valid_types, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Account *
|
Account *
|
||||||
gnc_ui_new_accounts_from_name_with_defaults (const char *name,
|
gnc_ui_new_accounts_from_name_with_defaults (GtkWindow *parent,
|
||||||
|
const char *name,
|
||||||
GList *valid_types,
|
GList *valid_types,
|
||||||
const gnc_commodity * default_commodity,
|
const gnc_commodity * default_commodity,
|
||||||
Account * parent)
|
Account * parent_acct)
|
||||||
{
|
{
|
||||||
QofBook *book;
|
QofBook *book;
|
||||||
AccountWindow *aw;
|
AccountWindow *aw;
|
||||||
@ -1749,7 +1756,7 @@ gnc_ui_new_accounts_from_name_with_defaults (const char *name,
|
|||||||
gboolean done = FALSE;
|
gboolean done = FALSE;
|
||||||
|
|
||||||
ENTER("name %s, valid %p, commodity %p, account %p",
|
ENTER("name %s, valid %p, commodity %p, account %p",
|
||||||
name, valid_types, default_commodity, parent);
|
name, valid_types, default_commodity, parent_acct);
|
||||||
book = gnc_get_current_book();
|
book = gnc_get_current_book();
|
||||||
if (!name || *name == '\0')
|
if (!name || *name == '\0')
|
||||||
{
|
{
|
||||||
@ -1759,11 +1766,12 @@ gnc_ui_new_accounts_from_name_with_defaults (const char *name,
|
|||||||
else
|
else
|
||||||
subaccount_names = gnc_split_account_name (book, name, &base_account);
|
subaccount_names = gnc_split_account_name (book, name, &base_account);
|
||||||
|
|
||||||
if (parent != NULL)
|
if (parent_acct != NULL)
|
||||||
{
|
{
|
||||||
base_account = parent;
|
base_account = parent_acct;
|
||||||
}
|
}
|
||||||
aw = gnc_ui_new_account_window_internal (book, base_account, subaccount_names,
|
aw = gnc_ui_new_account_window_internal (parent, book, base_account,
|
||||||
|
subaccount_names,
|
||||||
valid_types, default_commodity,
|
valid_types, default_commodity,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
@ -1819,10 +1827,10 @@ find_by_account (gpointer find_data, gpointer user_data)
|
|||||||
* Return: EditAccountWindow object
|
* Return: EditAccountWindow object
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gnc_ui_edit_account_window(Account *account)
|
gnc_ui_edit_account_window(GtkWindow *parent, Account *account)
|
||||||
{
|
{
|
||||||
AccountWindow * aw;
|
AccountWindow * aw;
|
||||||
Account *parent;
|
Account *parent_acct;
|
||||||
|
|
||||||
if (account == NULL)
|
if (account == NULL)
|
||||||
return;
|
return;
|
||||||
@ -1847,6 +1855,7 @@ gnc_ui_edit_account_window(Account *account)
|
|||||||
gnc_suspend_gui_refresh ();
|
gnc_suspend_gui_refresh ();
|
||||||
|
|
||||||
gnc_account_window_create (aw);
|
gnc_account_window_create (aw);
|
||||||
|
gtk_window_set_transient_for (GTK_WINDOW (aw->dialog), parent);
|
||||||
gnc_account_to_ui (aw);
|
gnc_account_to_ui (aw);
|
||||||
|
|
||||||
gnc_resume_gui_refresh ();
|
gnc_resume_gui_refresh ();
|
||||||
@ -1854,13 +1863,13 @@ gnc_ui_edit_account_window(Account *account)
|
|||||||
gtk_widget_show_all (aw->dialog);
|
gtk_widget_show_all (aw->dialog);
|
||||||
gtk_widget_hide (aw->opening_balance_page);
|
gtk_widget_hide (aw->opening_balance_page);
|
||||||
|
|
||||||
parent = gnc_account_get_parent (account);
|
parent_acct = gnc_account_get_parent (account);
|
||||||
if (parent == NULL)
|
if (parent_acct == NULL)
|
||||||
parent = account; /* must be at the root */
|
parent_acct = account; /* must be at the root */
|
||||||
|
|
||||||
gtk_tree_view_collapse_all (aw->parent_tree);
|
gtk_tree_view_collapse_all (aw->parent_tree);
|
||||||
gnc_tree_view_account_set_selected_account (
|
gnc_tree_view_account_set_selected_account (
|
||||||
GNC_TREE_VIEW_ACCOUNT(aw->parent_tree), parent);
|
GNC_TREE_VIEW_ACCOUNT(aw->parent_tree), parent_acct);
|
||||||
|
|
||||||
gnc_account_window_set_name (aw);
|
gnc_account_window_set_name (aw);
|
||||||
|
|
||||||
@ -1886,20 +1895,23 @@ gnc_ui_edit_account_window(Account *account)
|
|||||||
* parent - The initial parent for the new account (optional)
|
* parent - The initial parent for the new account (optional)
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gnc_ui_new_account_window(QofBook *book, Account *parent)
|
gnc_ui_new_account_window (GtkWindow *parent, QofBook *book,
|
||||||
|
Account *parent_acct)
|
||||||
{
|
{
|
||||||
g_return_if_fail(book != NULL);
|
g_return_if_fail(book != NULL);
|
||||||
if (parent && book)
|
if (parent && book)
|
||||||
g_return_if_fail(gnc_account_get_book(parent) == book);
|
g_return_if_fail(gnc_account_get_book(parent_acct) == book);
|
||||||
|
|
||||||
gnc_ui_new_account_window_internal (book, parent, NULL, NULL, NULL, FALSE);
|
gnc_ui_new_account_window_internal (parent, book, parent_acct, NULL, NULL,
|
||||||
|
NULL, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_ui_new_account_with_types( QofBook *book,
|
gnc_ui_new_account_with_types (GtkWindow *parent, QofBook *book,
|
||||||
GList *valid_types)
|
GList *valid_types)
|
||||||
{
|
{
|
||||||
gnc_ui_new_account_window_internal( book, NULL, NULL, valid_types, NULL, FALSE );
|
gnc_ui_new_account_window_internal (parent, book, NULL, NULL,
|
||||||
|
valid_types, NULL, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
|
@ -44,11 +44,13 @@
|
|||||||
@{ */
|
@{ */
|
||||||
|
|
||||||
/** Disply a window for editing the attributes of an existing account.
|
/** Disply a window for editing the attributes of an existing account.
|
||||||
|
*
|
||||||
|
* @param parent The widget on which to parent the dialog.
|
||||||
*
|
*
|
||||||
* @param account This parameter specifies the account whose data
|
* @param account This parameter specifies the account whose data
|
||||||
* will be edited.
|
* will be edited.
|
||||||
*/
|
*/
|
||||||
void gnc_ui_edit_account_window (Account *account);
|
void gnc_ui_edit_account_window (GtkWindow *parent, Account *account);
|
||||||
|
|
||||||
|
|
||||||
/** Disply a window for creating a new account. This function will
|
/** Disply a window for creating a new account. This function will
|
||||||
@ -56,20 +58,25 @@ void gnc_ui_edit_account_window (Account *account);
|
|||||||
* the caller specified. The user is free, however, to choose any
|
* the caller specified. The user is free, however, to choose any
|
||||||
* parent account they wish.
|
* parent account they wish.
|
||||||
*
|
*
|
||||||
|
* @param parent The widget on which to parent the dialog.
|
||||||
|
*
|
||||||
* @param book The book in which the new account should be created.
|
* @param book The book in which the new account should be created.
|
||||||
* This is a required argument.
|
* This is a required argument.
|
||||||
*
|
*
|
||||||
* @param parent The initially selected parent account. This
|
* @param parent_acct The initially selected parent account. This
|
||||||
* argument is optional, but if supplied must be an account contained
|
* argument is optional, but if supplied must be an account contained
|
||||||
* in the specified book.
|
* in the specified book.
|
||||||
*/
|
*/
|
||||||
void gnc_ui_new_account_window (QofBook *book, Account *parent);
|
void gnc_ui_new_account_window (GtkWindow *parent,
|
||||||
|
QofBook *book, Account *parent_acct);
|
||||||
|
|
||||||
|
|
||||||
/** Disply a window for creating a new account. This function will
|
/** Disply a window for creating a new account. This function will
|
||||||
* restrict the available account type values to the list specified
|
* restrict the available account type values to the list specified
|
||||||
* by the caller.
|
* by the caller.
|
||||||
*
|
*
|
||||||
|
* @param parent The widget on which to parent the dialog.
|
||||||
|
*
|
||||||
* @param book The book in which the new account should be created.
|
* @param book The book in which the new account should be created.
|
||||||
* This is a required argument.
|
* This is a required argument.
|
||||||
*
|
*
|
||||||
@ -77,7 +84,7 @@ void gnc_ui_new_account_window (QofBook *book, Account *parent);
|
|||||||
* which are allowed to be created. The calling function is
|
* which are allowed to be created. The calling function is
|
||||||
* responsible for freeing this list.
|
* responsible for freeing this list.
|
||||||
*/
|
*/
|
||||||
void gnc_ui_new_account_with_types (QofBook *book,
|
void gnc_ui_new_account_with_types (GtkWindow *parent, QofBook *book,
|
||||||
GList *valid_types);
|
GList *valid_types);
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
@ -87,16 +94,21 @@ void gnc_ui_new_account_with_types (QofBook *book,
|
|||||||
@{ */
|
@{ */
|
||||||
|
|
||||||
/** Disply a modal window for creating a new account
|
/** Disply a modal window for creating a new account
|
||||||
|
*
|
||||||
|
* @param parent The widget on which to parent the dialog.
|
||||||
*
|
*
|
||||||
* @param name The account name/path to be created. This parameter
|
* @param name The account name/path to be created. This parameter
|
||||||
* is not used for determining the initially selected parent account.
|
* is not used for determining the initially selected parent account.
|
||||||
*/
|
*/
|
||||||
Account * gnc_ui_new_accounts_from_name_window (const char *name);
|
Account * gnc_ui_new_accounts_from_name_window (GtkWindow *parent,
|
||||||
|
const char *name);
|
||||||
|
|
||||||
/** Disply a modal window for creating a new account. This function
|
/** Disply a modal window for creating a new account. This function
|
||||||
* will restrict the available account type values to the list
|
* will restrict the available account type values to the list
|
||||||
* specified by the caller.
|
* specified by the caller.
|
||||||
*
|
*
|
||||||
|
* @param parent The widget on which to parent the dialog.
|
||||||
|
*
|
||||||
* @param name The account name/path to be created. This parameter
|
* @param name The account name/path to be created. This parameter
|
||||||
* is not used for determining the initially selected parent account.
|
* is not used for determining the initially selected parent account.
|
||||||
*
|
*
|
||||||
@ -107,7 +119,8 @@ Account * gnc_ui_new_accounts_from_name_window (const char *name);
|
|||||||
* @return A pointer to the newly created account.
|
* @return A pointer to the newly created account.
|
||||||
*/
|
*/
|
||||||
/* Note that the caller owns the valid_types list */
|
/* Note that the caller owns the valid_types list */
|
||||||
Account * gnc_ui_new_accounts_from_name_window_with_types (const char *name,
|
Account * gnc_ui_new_accounts_from_name_window_with_types (GtkWindow *parent,
|
||||||
|
const char *name,
|
||||||
GList *valid_types);
|
GList *valid_types);
|
||||||
|
|
||||||
|
|
||||||
@ -115,6 +128,8 @@ Account * gnc_ui_new_accounts_from_name_window_with_types (const char *name,
|
|||||||
* will restrict the available account type values to the list
|
* will restrict the available account type values to the list
|
||||||
* specified by the caller.
|
* specified by the caller.
|
||||||
*
|
*
|
||||||
|
* @param parent The widget on which to parent the dialog.
|
||||||
|
*
|
||||||
* @param name The account name/path to be created. This parameter
|
* @param name The account name/path to be created. This parameter
|
||||||
* is not used for determining the initially selected parent account.
|
* is not used for determining the initially selected parent account.
|
||||||
*
|
*
|
||||||
@ -125,14 +140,15 @@ Account * gnc_ui_new_accounts_from_name_window_with_types (const char *name,
|
|||||||
* @param default_commodity The commodity to initially select when
|
* @param default_commodity The commodity to initially select when
|
||||||
* the dialog is presented.
|
* the dialog is presented.
|
||||||
*
|
*
|
||||||
* @param parent The initially selected parent account.
|
* @param parent_acct The initially selected parent account.
|
||||||
*
|
*
|
||||||
* @return A pointer to the newly created account.
|
* @return A pointer to the newly created account.
|
||||||
*/
|
*/
|
||||||
Account * gnc_ui_new_accounts_from_name_with_defaults (const char *name,
|
Account * gnc_ui_new_accounts_from_name_with_defaults (GtkWindow *parent,
|
||||||
|
const char *name,
|
||||||
GList *valid_types,
|
GList *valid_types,
|
||||||
const gnc_commodity * default_commodity,
|
const gnc_commodity * default_commodity,
|
||||||
Account * parent);
|
Account * parent_acct);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* register a callback that get's called when the account has changed
|
* register a callback that get's called when the account has changed
|
||||||
|
@ -480,11 +480,13 @@ static void
|
|||||||
gas_new_account_click( GtkButton *b, gpointer ud )
|
gas_new_account_click( GtkButton *b, gpointer ud )
|
||||||
{
|
{
|
||||||
GNCAccountSel *gas = (GNCAccountSel*)ud;
|
GNCAccountSel *gas = (GNCAccountSel*)ud;
|
||||||
|
GtkWindow *parent = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gas)));
|
||||||
if (gas->isModal)
|
if (gas->isModal)
|
||||||
gnc_ui_new_accounts_from_name_window_with_types ( NULL,
|
gnc_ui_new_accounts_from_name_window_with_types (parent, NULL,
|
||||||
gas->acctTypeFilters );
|
gas->acctTypeFilters );
|
||||||
else
|
else
|
||||||
gnc_ui_new_account_with_types( gnc_get_current_book(), gas->acctTypeFilters );
|
gnc_ui_new_account_with_types (parent, gnc_get_current_book(),
|
||||||
|
gas->acctTypeFilters );
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
|
@ -1973,7 +1973,7 @@ gnc_tree_control_split_reg_get_account_by_name (GncTreeViewSplitReg *view, const
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* User said yes, they want to create a new account. */
|
/* User said yes, they want to create a new account. */
|
||||||
account = gnc_ui_new_accounts_from_name_window (name);
|
account = gnc_ui_new_accounts_from_name_window (window, name);
|
||||||
if (!account)
|
if (!account)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1072,8 +1072,9 @@ static void
|
|||||||
gnc_plugin_page_account_tree_cmd_new_account (GtkAction *action, GncPluginPageAccountTree *page)
|
gnc_plugin_page_account_tree_cmd_new_account (GtkAction *action, GncPluginPageAccountTree *page)
|
||||||
{
|
{
|
||||||
Account *account = gnc_plugin_page_account_tree_get_current_account (page);
|
Account *account = gnc_plugin_page_account_tree_get_current_account (page);
|
||||||
|
GtkWindow *parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
|
||||||
gnc_ui_new_account_window (gnc_get_current_book(), account);
|
gnc_ui_new_account_window (parent, gnc_get_current_book(),
|
||||||
|
account);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1134,13 +1135,13 @@ static void
|
|||||||
gnc_plugin_page_account_tree_cmd_edit_account (GtkAction *action, GncPluginPageAccountTree *page)
|
gnc_plugin_page_account_tree_cmd_edit_account (GtkAction *action, GncPluginPageAccountTree *page)
|
||||||
{
|
{
|
||||||
Account *account;
|
Account *account;
|
||||||
|
GtkWindow *parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
|
||||||
ENTER("action %p, page %p", action, page);
|
ENTER("action %p, page %p", action, page);
|
||||||
|
|
||||||
account = gnc_plugin_page_account_tree_get_current_account (page);
|
account = gnc_plugin_page_account_tree_get_current_account (page);
|
||||||
g_return_if_fail (account != NULL);
|
g_return_if_fail (account != NULL);
|
||||||
|
|
||||||
gnc_ui_edit_account_window (account);
|
gnc_ui_edit_account_window (parent, account);
|
||||||
LEAVE(" ");
|
LEAVE(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -726,10 +726,11 @@ static void
|
|||||||
gnc_plugin_page_invoice_cmd_new_account (GtkAction *action,
|
gnc_plugin_page_invoice_cmd_new_account (GtkAction *action,
|
||||||
GncPluginPageInvoice *plugin_page)
|
GncPluginPageInvoice *plugin_page)
|
||||||
{
|
{
|
||||||
|
GtkWindow *parent = NULL;
|
||||||
g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
|
g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
|
||||||
|
parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page)));
|
||||||
ENTER("(action %p, plugin_page %p)", action, plugin_page);
|
ENTER("(action %p, plugin_page %p)", action, plugin_page);
|
||||||
gnc_ui_new_account_window (gnc_get_current_book(), NULL);
|
gnc_ui_new_account_window (parent, gnc_get_current_book(), NULL);
|
||||||
LEAVE(" ");
|
LEAVE(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2951,13 +2951,13 @@ gnc_plugin_page_register_cmd_edit_account (GtkAction *action,
|
|||||||
GncPluginPageRegister *page)
|
GncPluginPageRegister *page)
|
||||||
{
|
{
|
||||||
Account *account;
|
Account *account;
|
||||||
|
GtkWindow *parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
|
||||||
g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
|
g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
|
||||||
|
|
||||||
ENTER("(action %p, page %p)", action, page);
|
ENTER("(action %p, page %p)", action, page);
|
||||||
account = gnc_plugin_page_register_get_account (page);
|
account = gnc_plugin_page_register_get_account (page);
|
||||||
if (account)
|
if (account)
|
||||||
gnc_ui_edit_account_window (account);
|
gnc_ui_edit_account_window (parent, account);
|
||||||
LEAVE(" ");
|
LEAVE(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2752,13 +2752,13 @@ gnc_plugin_page_register2_cmd_edit_account (GtkAction *action,
|
|||||||
GncPluginPageRegister2 *page) //this works
|
GncPluginPageRegister2 *page) //this works
|
||||||
{
|
{
|
||||||
Account *account;
|
Account *account;
|
||||||
|
GtkWindow *parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
|
||||||
g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
|
g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
|
||||||
|
|
||||||
ENTER("(action %p, page %p)", action, page);
|
ENTER("(action %p, page %p)", action, page);
|
||||||
account = gnc_plugin_page_register2_get_account (page);
|
account = gnc_plugin_page_register2_get_account (page);
|
||||||
if (account)
|
if (account)
|
||||||
gnc_ui_edit_account_window (account);
|
gnc_ui_edit_account_window (parent, account);
|
||||||
LEAVE(" ");
|
LEAVE(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1388,7 +1388,7 @@ gnc_recn_edit_account_cb(GtkAction *action, gpointer data)
|
|||||||
if (account == NULL)
|
if (account == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gnc_ui_edit_account_window (account);
|
gnc_ui_edit_account_window (GTK_WINDOW (recnData->window), account);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1349,7 +1349,7 @@ gnc_recn_edit_account_cb (GtkAction *action, gpointer data)
|
|||||||
if (account == NULL)
|
if (account == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gnc_ui_edit_account_window (account);
|
gnc_ui_edit_account_window (GTK_WINDOW (recnData->window), account);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -143,6 +143,8 @@ gnc_import_add_account(GtkWidget *button, AccountPickerDialog *picker)
|
|||||||
{
|
{
|
||||||
Account *selected_account, *new_account;
|
Account *selected_account, *new_account;
|
||||||
GList * valid_types = NULL;
|
GList * valid_types = NULL;
|
||||||
|
GtkWindow *parent = GTK_WINDOW (gtk_widget_get_toplevel (button));
|
||||||
|
|
||||||
/*DEBUG("Begin"); */
|
/*DEBUG("Begin"); */
|
||||||
if (picker->new_account_default_type != ACCT_TYPE_NONE)
|
if (picker->new_account_default_type != ACCT_TYPE_NONE)
|
||||||
{
|
{
|
||||||
@ -150,7 +152,8 @@ gnc_import_add_account(GtkWidget *button, AccountPickerDialog *picker)
|
|||||||
valid_types = g_list_prepend(valid_types, GINT_TO_POINTER(picker->new_account_default_type));
|
valid_types = g_list_prepend(valid_types, GINT_TO_POINTER(picker->new_account_default_type));
|
||||||
}
|
}
|
||||||
selected_account = gnc_tree_view_account_get_selected_account(picker->account_tree);
|
selected_account = gnc_tree_view_account_get_selected_account(picker->account_tree);
|
||||||
new_account = gnc_ui_new_accounts_from_name_with_defaults ( picker->account_human_description,
|
new_account = gnc_ui_new_accounts_from_name_with_defaults (parent,
|
||||||
|
picker->account_human_description,
|
||||||
valid_types,
|
valid_types,
|
||||||
picker->new_account_default_commodity,
|
picker->new_account_default_commodity,
|
||||||
selected_account);
|
selected_account);
|
||||||
|
@ -79,7 +79,7 @@ int ofx_proc_status_cb(struct OfxStatusData data)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int ofx_proc_security_cb(const struct OfxSecurityData data, void * security_user_data);
|
int ofx_proc_security_cb(const struct OfxSecurityData data, void * security_user_data);
|
||||||
int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_user_data);
|
int ofx_proc_transaction_cb (struct OfxTransactionData data, void *user_data);
|
||||||
int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data);
|
int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data);
|
||||||
static double ofx_get_investment_amount(const struct OfxTransactionData* data);
|
static double ofx_get_investment_amount(const struct OfxTransactionData* data);
|
||||||
|
|
||||||
@ -292,7 +292,8 @@ static gnc_numeric gnc_ofx_numeric_from_double_txn(double value, const Transacti
|
|||||||
|
|
||||||
/* Opens the dialog to create a new account with given name, commodity, parent, type.
|
/* Opens the dialog to create a new account with given name, commodity, parent, type.
|
||||||
* Returns the new account, or NULL if it couldn't be created.. */
|
* Returns the new account, or NULL if it couldn't be created.. */
|
||||||
static Account *gnc_ofx_new_account(const char* name,
|
static Account *gnc_ofx_new_account(GtkWindow* parent,
|
||||||
|
const char* name,
|
||||||
const gnc_commodity * account_commodity,
|
const gnc_commodity * account_commodity,
|
||||||
Account *parent_account,
|
Account *parent_account,
|
||||||
GNCAccountType new_account_default_type)
|
GNCAccountType new_account_default_type)
|
||||||
@ -318,7 +319,7 @@ static Account *gnc_ofx_new_account(const char* name,
|
|||||||
GINT_TO_POINTER(xaccAccountGetType(parent_account)));
|
GINT_TO_POINTER(xaccAccountGetType(parent_account)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = gnc_ui_new_accounts_from_name_with_defaults (name,
|
result = gnc_ui_new_accounts_from_name_with_defaults (parent, name,
|
||||||
valid_types,
|
valid_types,
|
||||||
account_commodity,
|
account_commodity,
|
||||||
parent_account);
|
parent_account);
|
||||||
@ -343,7 +344,7 @@ fix_ofx_bug_39 (time64 t)
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_user_data)
|
int ofx_proc_transaction_cb(struct OfxTransactionData data, void *user_data)
|
||||||
{
|
{
|
||||||
char dest_string[255];
|
char dest_string[255];
|
||||||
time64 current_time = gnc_time (NULL);
|
time64 current_time = gnc_time (NULL);
|
||||||
@ -358,6 +359,7 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_u
|
|||||||
Transaction *transaction;
|
Transaction *transaction;
|
||||||
Split *split;
|
Split *split;
|
||||||
gchar *notes, *tmp;
|
gchar *notes, *tmp;
|
||||||
|
GtkWindow *parent = GTK_WINDOW (user_data);
|
||||||
|
|
||||||
g_assert(gnc_ofx_importer_gui);
|
g_assert(gnc_ofx_importer_gui);
|
||||||
|
|
||||||
@ -637,7 +639,8 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_u
|
|||||||
// commodity.
|
// commodity.
|
||||||
Account *parent_account = investment_account;
|
Account *parent_account = investment_account;
|
||||||
investment_account =
|
investment_account =
|
||||||
gnc_ofx_new_account(investment_account_text,
|
gnc_ofx_new_account(parent,
|
||||||
|
investment_account_text,
|
||||||
investment_commodity,
|
investment_commodity,
|
||||||
parent_account,
|
parent_account,
|
||||||
ACCT_TYPE_STOCK);
|
ACCT_TYPE_STOCK);
|
||||||
@ -1020,7 +1023,7 @@ void gnc_file_ofx_import (GtkWindow *parent)
|
|||||||
|
|
||||||
/*ofx_set_statement_cb(libofx_context, ofx_proc_statement_cb, 0);*/
|
/*ofx_set_statement_cb(libofx_context, ofx_proc_statement_cb, 0);*/
|
||||||
ofx_set_account_cb(libofx_context, ofx_proc_account_cb, 0);
|
ofx_set_account_cb(libofx_context, ofx_proc_account_cb, 0);
|
||||||
ofx_set_transaction_cb(libofx_context, ofx_proc_transaction_cb, 0);
|
ofx_set_transaction_cb(libofx_context, ofx_proc_transaction_cb, parent);
|
||||||
ofx_set_security_cb(libofx_context, ofx_proc_security_cb, 0);
|
ofx_set_security_cb(libofx_context, ofx_proc_security_cb, 0);
|
||||||
/*ofx_set_status_cb(libofx_context, ofx_proc_status_cb, 0);*/
|
/*ofx_set_status_cb(libofx_context, ofx_proc_status_cb, 0);*/
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ gnc_entry_ledger_get_account_by_name (GncEntryLedger *ledger, BasicCell * bcell,
|
|||||||
else
|
else
|
||||||
account_types = g_list_prepend (account_types, (gpointer)ACCT_TYPE_EXPENSE);
|
account_types = g_list_prepend (account_types, (gpointer)ACCT_TYPE_EXPENSE);
|
||||||
|
|
||||||
account = gnc_ui_new_accounts_from_name_window_with_types (name, account_types);
|
account = gnc_ui_new_accounts_from_name_window_with_types (GTK_WINDOW (ledger->parent), name, account_types);
|
||||||
g_list_free ( account_types );
|
g_list_free ( account_types );
|
||||||
if (!account)
|
if (!account)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1852,6 +1852,7 @@ gnc_split_register_get_account_by_name (SplitRegister *reg, BasicCell * bcell,
|
|||||||
ComboCell *cell = (ComboCell *) bcell;
|
ComboCell *cell = (ComboCell *) bcell;
|
||||||
Account *account;
|
Account *account;
|
||||||
static gboolean creating_account = FALSE;
|
static gboolean creating_account = FALSE;
|
||||||
|
GtkWindow *parent = GTK_WINDOW (gnc_split_register_get_parent (reg));
|
||||||
|
|
||||||
if (!name || (strlen(name) == 0))
|
if (!name || (strlen(name) == 0))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1864,12 +1865,11 @@ gnc_split_register_get_account_by_name (SplitRegister *reg, BasicCell * bcell,
|
|||||||
if (!account && !creating_account)
|
if (!account && !creating_account)
|
||||||
{
|
{
|
||||||
/* Ask if they want to create a new one. */
|
/* Ask if they want to create a new one. */
|
||||||
if (!gnc_verify_dialog (GTK_WINDOW (gnc_split_register_get_parent (reg)),
|
if (!gnc_verify_dialog (parent, TRUE, missing, name))
|
||||||
TRUE, missing, name))
|
|
||||||
return NULL;
|
return NULL;
|
||||||
creating_account = TRUE;
|
creating_account = TRUE;
|
||||||
/* User said yes, they want to create a new account. */
|
/* User said yes, they want to create a new account. */
|
||||||
account = gnc_ui_new_accounts_from_name_window (name);
|
account = gnc_ui_new_accounts_from_name_window (parent, name);
|
||||||
creating_account = FALSE;
|
creating_account = FALSE;
|
||||||
if (!account)
|
if (!account)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user