mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
* add a 'modality' flag to the gnc-account-sel (which new-account API)
so that the new-account-window can be called using the modal dialog interfaces. * use the GNCAccoutSel in the date-close dialog (fixes bug #94973) git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7334 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
aff7319bb1
commit
76db396102
@ -16,6 +16,11 @@
|
|||||||
to map book -> backend compile and fill it in when the terms are
|
to map book -> backend compile and fill it in when the terms are
|
||||||
recompiled.
|
recompiled.
|
||||||
|
|
||||||
|
* add a 'modality' flag to the gnc-account-sel (which new-account API)
|
||||||
|
so that the new-account-window can be called using the modal dialog
|
||||||
|
interfaces.
|
||||||
|
* use the GNCAccoutSel in the date-close dialog (fixes bug #94973)
|
||||||
|
|
||||||
2002-10-16 Joshua Sled <jsled@asynchronous.org>
|
2002-10-16 Joshua Sled <jsled@asynchronous.org>
|
||||||
|
|
||||||
* src/app-utils/gnc-exp-parser.c (gnc_exp_parser_parse): This
|
* src/app-utils/gnc-exp-parser.c (gnc_exp_parser_parse): This
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "gnc-ui-util.h"
|
#include "gnc-ui-util.h"
|
||||||
#include "AccWindow.h"
|
#include "AccWindow.h"
|
||||||
#include "gnc-date-edit.h"
|
#include "gnc-date-edit.h"
|
||||||
|
#include "gnc-account-sel.h"
|
||||||
|
|
||||||
#include "business-utils.h"
|
#include "business-utils.h"
|
||||||
#include "dialog-date-close.h"
|
#include "dialog-date-close.h"
|
||||||
@ -60,44 +61,15 @@ gnc_dialog_date_close_ok_cb (GtkWidget *widget, gpointer user_data)
|
|||||||
|
|
||||||
if (ddc->acct_combo) {
|
if (ddc->acct_combo) {
|
||||||
Account *acc;
|
Account *acc;
|
||||||
gboolean new_acc = TRUE;
|
|
||||||
char *name =
|
|
||||||
g_strdup (gtk_entry_get_text
|
|
||||||
(GTK_ENTRY ((GTK_COMBO (ddc->acct_combo))->entry)));
|
|
||||||
|
|
||||||
if (!name || safe_strcmp (name, "") == 0) {
|
acc = gnc_account_sel_get_account( GNC_ACCOUNT_SEL(ddc->acct_combo) );
|
||||||
g_free (name);
|
|
||||||
name = _("You must enter an account name.");
|
|
||||||
gnc_error_dialog_parented (GTK_WINDOW (ddc->dialog), name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
acc = xaccGetAccountFromFullName (gnc_book_get_group (ddc->book),
|
|
||||||
name, gnc_get_account_separator ());
|
|
||||||
while (!acc) {
|
|
||||||
acc = ask_make_acct (ddc, name, new_acc);
|
|
||||||
if (!acc) {
|
if (!acc) {
|
||||||
g_free (name);
|
gnc_error_dialog_parented (GTK_WINDOW (ddc->dialog),
|
||||||
|
_("No Account selected. Please try again."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_list_index (ddc->acct_types, (gpointer)xaccAccountGetType (acc))
|
|
||||||
== -1) {
|
|
||||||
const char *format = _("Invalid Account Type, %s.\n"
|
|
||||||
"Please try again...");
|
|
||||||
|
|
||||||
gnc_error_dialog_parented (GTK_WINDOW (ddc->dialog),
|
|
||||||
format,
|
|
||||||
xaccAccountGetTypeStr (xaccAccountGetType (acc)));
|
|
||||||
g_free (name);
|
|
||||||
name = xaccAccountGetFullName (acc, gnc_get_account_separator ());
|
|
||||||
acc = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
new_acc = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free (name);
|
|
||||||
ddc->acct = acc;
|
ddc->acct = acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +109,15 @@ gnc_dialog_date_close_cb (GnomeDialog *dialog, gpointer data)
|
|||||||
static void
|
static void
|
||||||
fill_in_acct_info (DialogDateClose *ddc)
|
fill_in_acct_info (DialogDateClose *ddc)
|
||||||
{
|
{
|
||||||
gnc_fill_account_select_combo (ddc->acct_combo, ddc->book, ddc->acct_types);
|
GNCAccountSel *gas = GNC_ACCOUNT_SEL (ddc->acct_combo);
|
||||||
|
|
||||||
|
/* How do I set the book? */
|
||||||
|
gnc_account_sel_set_acct_filters( gas, ddc->acct_types );
|
||||||
|
gnc_account_sel_set_new_account_ability( gas, TRUE );
|
||||||
|
gnc_account_sel_set_new_account_modal( gas, TRUE );
|
||||||
|
|
||||||
|
/* XXX: Some way to remember the last selection? */
|
||||||
|
gnc_account_sel_set_account( gas, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -264,6 +244,7 @@ gnc_dialog_dates_acct_parented (GtkWidget *parent, const char *message,
|
|||||||
GtkWidget *hbox;
|
GtkWidget *hbox;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GtkWidget *date_box;
|
GtkWidget *date_box;
|
||||||
|
GtkWidget *acct_box;
|
||||||
GladeXML *xml;
|
GladeXML *xml;
|
||||||
gboolean retval;
|
gboolean retval;
|
||||||
|
|
||||||
@ -281,9 +262,12 @@ gnc_dialog_dates_acct_parented (GtkWidget *parent, const char *message,
|
|||||||
|
|
||||||
xml = gnc_glade_xml_new ("date-close.glade", "Date Account Dialog");
|
xml = gnc_glade_xml_new ("date-close.glade", "Date Account Dialog");
|
||||||
ddc->dialog = glade_xml_get_widget (xml, "Date Account Dialog");
|
ddc->dialog = glade_xml_get_widget (xml, "Date Account Dialog");
|
||||||
ddc->acct_combo = glade_xml_get_widget (xml, "acct_combo");
|
|
||||||
hbox = glade_xml_get_widget (xml, "the_hbox");
|
|
||||||
ddc->memo_entry = glade_xml_get_widget (xml, "memo_entry");
|
ddc->memo_entry = glade_xml_get_widget (xml, "memo_entry");
|
||||||
|
hbox = glade_xml_get_widget (xml, "the_hbox");
|
||||||
|
|
||||||
|
acct_box = glade_xml_get_widget (xml, "acct_hbox");
|
||||||
|
ddc->acct_combo = gnc_account_sel_new();
|
||||||
|
gtk_box_pack_start (GTK_BOX(acct_box), ddc->acct_combo, TRUE, TRUE, 0);
|
||||||
|
|
||||||
date_box = glade_xml_get_widget (xml, "date_box");
|
date_box = glade_xml_get_widget (xml, "date_box");
|
||||||
ddc->date = gnc_date_edit_new (time(NULL), FALSE, FALSE);
|
ddc->date = gnc_date_edit_new (time(NULL), FALSE, FALSE);
|
||||||
@ -356,6 +340,7 @@ gnc_dialog_date_acct_parented (GtkWidget *parent, const char *message,
|
|||||||
GtkWidget *hbox;
|
GtkWidget *hbox;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GtkWidget *date_box;
|
GtkWidget *date_box;
|
||||||
|
GtkWidget *acct_box;
|
||||||
GladeXML *xml;
|
GladeXML *xml;
|
||||||
gboolean retval;
|
gboolean retval;
|
||||||
|
|
||||||
@ -370,9 +355,12 @@ gnc_dialog_date_acct_parented (GtkWidget *parent, const char *message,
|
|||||||
|
|
||||||
xml = gnc_glade_xml_new ("date-close.glade", "Date Account Dialog");
|
xml = gnc_glade_xml_new ("date-close.glade", "Date Account Dialog");
|
||||||
ddc->dialog = glade_xml_get_widget (xml, "Date Account Dialog");
|
ddc->dialog = glade_xml_get_widget (xml, "Date Account Dialog");
|
||||||
ddc->acct_combo = glade_xml_get_widget (xml, "acct_combo");
|
|
||||||
hbox = glade_xml_get_widget (xml, "the_hbox");
|
hbox = glade_xml_get_widget (xml, "the_hbox");
|
||||||
|
|
||||||
|
acct_box = glade_xml_get_widget (xml, "acct_hbox");
|
||||||
|
ddc->acct_combo = gnc_account_sel_new();
|
||||||
|
gtk_box_pack_start (GTK_BOX(acct_box), ddc->acct_combo, TRUE, TRUE, 0);
|
||||||
|
|
||||||
date_box = glade_xml_get_widget (xml, "date_box");
|
date_box = glade_xml_get_widget (xml, "date_box");
|
||||||
ddc->date = gnc_date_edit_new (time(NULL), FALSE, FALSE);
|
ddc->date = gnc_date_edit_new (time(NULL), FALSE, FALSE);
|
||||||
gtk_box_pack_start (GTK_BOX(date_box), ddc->date, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX(date_box), ddc->date, TRUE, TRUE, 0);
|
||||||
|
@ -443,14 +443,10 @@
|
|||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkCombo</class>
|
<class>GtkHBox</class>
|
||||||
<name>acct_combo</name>
|
<name>acct_hbox</name>
|
||||||
<value_in_list>False</value_in_list>
|
<homogeneous>False</homogeneous>
|
||||||
<ok_if_empty>True</ok_if_empty>
|
<spacing>0</spacing>
|
||||||
<case_sensitive>False</case_sensitive>
|
|
||||||
<use_arrows>True</use_arrows>
|
|
||||||
<use_arrows_always>False</use_arrows_always>
|
|
||||||
<items></items>
|
|
||||||
<child>
|
<child>
|
||||||
<padding>0</padding>
|
<padding>0</padding>
|
||||||
<expand>False</expand>
|
<expand>False</expand>
|
||||||
@ -458,15 +454,7 @@
|
|||||||
</child>
|
</child>
|
||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkEntry</class>
|
<class>Placeholder</class>
|
||||||
<child_name>GtkCombo:entry</child_name>
|
|
||||||
<name>acct_combo_entry</name>
|
|
||||||
<can_focus>True</can_focus>
|
|
||||||
<has_focus>True</has_focus>
|
|
||||||
<editable>True</editable>
|
|
||||||
<text_visible>True</text_visible>
|
|
||||||
<text_max_length>0</text_max_length>
|
|
||||||
<text></text>
|
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -468,10 +468,22 @@ gnc_account_sel_set_new_account_ability( GNCAccountSel *gas,
|
|||||||
FALSE, FALSE, 2 );
|
FALSE, FALSE, 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gnc_account_sel_set_new_account_modal( GNCAccountSel *gas,
|
||||||
|
gboolean state )
|
||||||
|
{
|
||||||
|
g_assert ( gas );
|
||||||
|
gas->isModal = state;
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
void
|
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;
|
||||||
|
if (gas->isModal)
|
||||||
|
gnc_ui_new_accounts_from_name_window_with_types ( NULL,
|
||||||
|
gas->acctTypeFilters );
|
||||||
|
else
|
||||||
gnc_ui_new_account_with_types( NULL, gas->acctTypeFilters );
|
gnc_ui_new_account_with_types( NULL, gas->acctTypeFilters );
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
GtkHBox hbox;
|
GtkHBox hbox;
|
||||||
gboolean initDone;
|
gboolean initDone;
|
||||||
|
gboolean isModal;
|
||||||
GtkCombo *combo;
|
GtkCombo *combo;
|
||||||
GList *acctTypeFilters;
|
GList *acctTypeFilters;
|
||||||
gint eventHandlerId;
|
gint eventHandlerId;
|
||||||
@ -93,6 +94,15 @@ void gnc_account_sel_set_acct_filters( GNCAccountSel *gas, GList *filters );
|
|||||||
void gnc_account_sel_set_new_account_ability( GNCAccountSel *gas,
|
void gnc_account_sel_set_new_account_ability( GNCAccountSel *gas,
|
||||||
gboolean state );
|
gboolean state );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Conditional call of the new-account window in modal mode.
|
||||||
|
* @param state TRUE if the new-account window should be modal, FALSE otherwise.
|
||||||
|
**/
|
||||||
|
void gnc_account_sel_set_new_account_modal( GNCAccountSel *gas,
|
||||||
|
gboolean state );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
END_GNOME_DECLS
|
END_GNOME_DECLS
|
||||||
|
|
||||||
#endif /* !ndef GNC_ACCOUNT_SEL_H */
|
#endif /* !ndef GNC_ACCOUNT_SEL_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user