* src/gnome/new-user-callbacks.c: fix test for commodity added by

setting data on druid rather than a global variable (bad jim.
global variable bad).
(on_chooseAccountTypesPage_prepare): remove old comment.
(on_chooseAccountTypesPage_prepare): set object data that account
lists loaded.

* src/gnome/new-user-funs.c (gnc_get_new_user_dialog): new func.

* src/gnome/new-user-callbacks.c (set_first_startup): simplify
using the global-options.h func gnc_set_boolean_option.

* src/gnome/new-user-callbacks.c
(on_newAccountCurrencyChoosePage_prepare): remove old comment.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4507 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
James LewisMoss 2001-06-07 16:21:22 +00:00
parent 6aa4733965
commit 33df6e7284
6 changed files with 74 additions and 64 deletions

View File

@ -39,8 +39,7 @@
#include "new-user-funs.h"
#include "new-user-interface.h"
#include "query-user.h"
static int commodEditAdded = 0;
#include "global-options.h"
static AccountGroup *our_final_group = NULL;
@ -57,14 +56,7 @@ delete_our_final_group(void)
static void
set_first_startup(int first_startup)
{
gchar *todo;
todo = g_strdup_printf("((gnc:option-setter "
" (gnc:lookup-global-option \"__new_user\" "
" \"first_startup\"))"
" %d)", first_startup);
gh_eval_str(todo);
g_free(todo);
gnc_set_boolean_option("__new_user", "first_startup", first_startup);
}
@ -168,11 +160,11 @@ on_newAccountCurrencyChoosePage_prepare (GnomeDruidPage *gnomedruidpage,
gpointer arg1,
gpointer user_data)
{
/* need to load currency info here. In fact drop a
gnc-commodity-edit widget here */
if(!commodEditAdded)
if(!(int)gtk_object_get_data(GTK_OBJECT(gnc_get_new_user_dialog()),
"commod_added"))
{
commodEditAdded = 1;
gtk_object_set_data (GTK_OBJECT(gnc_get_new_user_dialog()),
"commod_added", (void*)1);
gtk_box_pack_start(
GTK_BOX(lookup_widget(GTK_WIDGET(gnomedruidpage),
@ -204,30 +196,30 @@ on_chooseAccountTypesPage_prepare (GnomeDruidPage *gnomedruidpage,
gpointer arg1,
gpointer user_data)
{
static gboolean addedAccountLists = 0;
GSList *list;
GtkCList *clist;
/* Need to load the account type lists here */
list = gnc_load_example_account_list(GNC_ACCOUNTS_DIR "/C");
clist = gnc_new_user_get_clist();
gtk_clist_freeze(clist);
gtk_clist_set_sort_column(clist, 0);
if(!addedAccountLists)
if(!(int)gtk_object_get_data(GTK_OBJECT(gnc_get_new_user_dialog()),
"account_list_added"))
{
list = gnc_load_example_account_list(GNC_ACCOUNTS_DIR "/C");
clist = gnc_new_user_get_clist();
gtk_clist_freeze(clist);
gtk_clist_set_sort_column(clist, 0);
g_slist_foreach(list, add_each_gea_to_clist, (gpointer)clist);
addedAccountLists = 1;
gtk_clist_sort(clist);
gtk_clist_thaw(clist);
g_slist_free (list);
gtk_object_set_data(GTK_OBJECT(gnc_get_new_user_dialog()),
"account_list_added", (void*)1);
}
gtk_clist_sort(clist);
gtk_clist_thaw(clist);
g_slist_free (list);
}

View File

@ -143,3 +143,4 @@ gboolean
on_finalAccountDruidPage_next (GnomeDruidPage *gnomedruidpage,
gpointer arg1,
gpointer user_data);

View File

@ -61,17 +61,33 @@ clone_account(const Account* from, gnc_commodity *com)
GNCCommodityEdit *
gnc_get_new_user_commodity_editor(void)
{
static GNCCommodityEdit *cur_editor = NULL;
if(!cur_editor)
GtkWidget *tmp_wid = gtk_object_get_data(GTK_OBJECT(newUserDialog),
"commod_editor");
if(!tmp_wid)
{
GNCCommodityEdit *cur_editor = NULL;
cur_editor = GNC_COMMODITY_EDIT(gnc_commodity_edit_new());
gtk_widget_set_name (GTK_WIDGET(cur_editor),
"newAccountCurrencyChooser");
gtk_widget_show(GTK_WIDGET(cur_editor));
gnc_commodity_edit_set_commodity(cur_editor,
gnc_locale_default_currency());
gtk_object_set_data(GTK_OBJECT(newUserDialog), "commod_editor",
cur_editor);
return cur_editor;
}
return cur_editor;
else
{
return GNC_COMMODITY_EDIT(tmp_wid);
}
}
GtkWidget*
gnc_get_new_user_dialog(void)
{
return newUserDialog;
}
GNCAmountEdit *

View File

@ -32,6 +32,7 @@
int gnc_ui_show_new_user_window(gboolean new_user_dialog);
int gnc_ui_delete_new_user_window(void);
gboolean gnc_new_user_dialog_is_new_user(void);
GtkWidget* gnc_get_new_user_dialog(void);
void gnc_ui_show_new_user_choice_window(void);

View File

@ -67,9 +67,9 @@ create_newUserDialog (void)
GtkWidget *hbox4;
GtkWidget *scrolledwindow4;
GtkWidget *finalAccountCTree;
GtkWidget *checkAccountList_AccountNameLabel;
GtkWidget *checkAccountList_TypeLabel;
GtkWidget *checkAccountList_StartBalanceLabel;
GtkWidget *cTreeAccountNameLabel;
GtkWidget *cTreeTypeLabel;
GtkWidget *cTreeOpeningBalanceLabel;
GtkWidget *vbox5;
GtkWidget *frame3;
GtkWidget *startBalanceBox;
@ -382,34 +382,34 @@ create_newUserDialog (void)
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (finalAccountCTree);
gtk_container_add (GTK_CONTAINER (scrolledwindow4), finalAccountCTree);
gtk_clist_set_column_width (GTK_CLIST (finalAccountCTree), 0, 285);
gtk_clist_set_column_width (GTK_CLIST (finalAccountCTree), 1, 118);
gtk_clist_set_column_width (GTK_CLIST (finalAccountCTree), 0, 80);
gtk_clist_set_column_width (GTK_CLIST (finalAccountCTree), 1, 80);
gtk_clist_set_column_width (GTK_CLIST (finalAccountCTree), 2, 80);
gtk_clist_column_titles_show (GTK_CLIST (finalAccountCTree));
checkAccountList_AccountNameLabel = gtk_label_new (_("Account Name"));
gtk_widget_set_name (checkAccountList_AccountNameLabel, "checkAccountList_AccountNameLabel");
gtk_widget_ref (checkAccountList_AccountNameLabel);
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "checkAccountList_AccountNameLabel", checkAccountList_AccountNameLabel,
cTreeAccountNameLabel = gtk_label_new (_("Account Name"));
gtk_widget_set_name (cTreeAccountNameLabel, "cTreeAccountNameLabel");
gtk_widget_ref (cTreeAccountNameLabel);
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "cTreeAccountNameLabel", cTreeAccountNameLabel,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (checkAccountList_AccountNameLabel);
gtk_clist_set_column_widget (GTK_CLIST (finalAccountCTree), 0, checkAccountList_AccountNameLabel);
gtk_widget_show (cTreeAccountNameLabel);
gtk_clist_set_column_widget (GTK_CLIST (finalAccountCTree), 0, cTreeAccountNameLabel);
checkAccountList_TypeLabel = gtk_label_new (_("Type"));
gtk_widget_set_name (checkAccountList_TypeLabel, "checkAccountList_TypeLabel");
gtk_widget_ref (checkAccountList_TypeLabel);
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "checkAccountList_TypeLabel", checkAccountList_TypeLabel,
cTreeTypeLabel = gtk_label_new (_("Type"));
gtk_widget_set_name (cTreeTypeLabel, "cTreeTypeLabel");
gtk_widget_ref (cTreeTypeLabel);
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "cTreeTypeLabel", cTreeTypeLabel,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (checkAccountList_TypeLabel);
gtk_clist_set_column_widget (GTK_CLIST (finalAccountCTree), 1, checkAccountList_TypeLabel);
gtk_widget_show (cTreeTypeLabel);
gtk_clist_set_column_widget (GTK_CLIST (finalAccountCTree), 1, cTreeTypeLabel);
checkAccountList_StartBalanceLabel = gtk_label_new (_("Opening Balance"));
gtk_widget_set_name (checkAccountList_StartBalanceLabel, "checkAccountList_StartBalanceLabel");
gtk_widget_ref (checkAccountList_StartBalanceLabel);
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "checkAccountList_StartBalanceLabel", checkAccountList_StartBalanceLabel,
cTreeOpeningBalanceLabel = gtk_label_new (_("Opening Balance"));
gtk_widget_set_name (cTreeOpeningBalanceLabel, "cTreeOpeningBalanceLabel");
gtk_widget_ref (cTreeOpeningBalanceLabel);
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "cTreeOpeningBalanceLabel", cTreeOpeningBalanceLabel,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (checkAccountList_StartBalanceLabel);
gtk_clist_set_column_widget (GTK_CLIST (finalAccountCTree), 2, checkAccountList_StartBalanceLabel);
gtk_widget_show (cTreeOpeningBalanceLabel);
gtk_clist_set_column_widget (GTK_CLIST (finalAccountCTree), 2, cTreeOpeningBalanceLabel);
vbox5 = gtk_vbox_new (FALSE, 0);
gtk_widget_set_name (vbox5, "vbox5");

View File

@ -487,15 +487,15 @@ accounts may have an opening balance.</label>
<signal>
<name>tree_select_row</name>
<handler>on_finalAccountCTree_tree_select_row</handler>
<last_modification_time>Sat, 12 May 2001 09:28:43 GMT</last_modification_time>
<last_modification_time>Thu, 07 Jun 2001 06:52:18 GMT</last_modification_time>
</signal>
<signal>
<name>tree_unselect_row</name>
<handler>on_finalAccountCTree_tree_unselect_row</handler>
<last_modification_time>Sat, 12 May 2001 09:42:20 GMT</last_modification_time>
<last_modification_time>Thu, 07 Jun 2001 06:52:23 GMT</last_modification_time>
</signal>
<columns>3</columns>
<column_widths>285,118,80</column_widths>
<column_widths>80,80,80</column_widths>
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
<show_titles>True</show_titles>
<shadow_type>GTK_SHADOW_IN</shadow_type>
@ -503,7 +503,7 @@ accounts may have an opening balance.</label>
<widget>
<class>GtkLabel</class>
<child_name>CTree:title</child_name>
<name>checkAccountList_AccountNameLabel</name>
<name>cTreeAccountNameLabel</name>
<label>Account Name</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
@ -516,7 +516,7 @@ accounts may have an opening balance.</label>
<widget>
<class>GtkLabel</class>
<child_name>CTree:title</child_name>
<name>checkAccountList_TypeLabel</name>
<name>cTreeTypeLabel</name>
<label>Type</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
@ -529,7 +529,7 @@ accounts may have an opening balance.</label>
<widget>
<class>GtkLabel</class>
<child_name>CTree:title</child_name>
<name>checkAccountList_StartBalanceLabel</name>
<name>cTreeOpeningBalanceLabel</name>
<label>Opening Balance</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>