The combo box manip needs to come before the field setting, or the stupid signal handler will screw up the fields. :p

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15602 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Joshua Sled 2007-02-18 19:30:18 +00:00
parent 1d2e90dce7
commit 47a10cabf8

View File

@ -261,23 +261,6 @@ do_frequency_setup(GncFrequency *gf, FreqSpec *fs, time_t *secs)
* don't change any other settings. */ * don't change any other settings. */
if (NULL == fs) return; if (NULL == fs) return;
#if 0
uift = xaccFreqSpecGetUIType( fs );
page = -1;
for ( i=0; i < UIFREQ_NUM_UI_FREQSPECS+1; i++ )
{
if ( PAGES[i].uiFTVal == uift )
{
page = PAGES[i].idx;
break;
}
}
g_assert( page != -1 );
gtk_notebook_set_current_page( gf->nb, page );
gtk_combo_box_set_active( gf->freqComboBox, page );
#endif // 0
switch ( uift ) switch ( uift )
{ {
case UIFREQ_NONE: case UIFREQ_NONE:
@ -948,8 +931,7 @@ _test_for_weekly_multiple(GList *recurrences)
for (r_iter = recurrences; r_iter != NULL; r_iter = r_iter->next) for (r_iter = recurrences; r_iter != NULL; r_iter = r_iter->next)
{ {
Recurrence *r = (Recurrence*)r_iter->data; Recurrence *r = (Recurrence*)r_iter->data;
if (recurrenceGetPeriodType(r) != PERIOD_WEEK)
if (!(recurrenceGetPeriodType(r) == PERIOD_WEEK))
{ {
return FALSE; return FALSE;
} }
@ -1017,12 +999,13 @@ gnc_frequency_setup_recurrence(GncFrequency *gf, GList *recurrences, GDate *star
{ {
if (_test_for_weekly_multiple(recurrences)) if (_test_for_weekly_multiple(recurrences))
{ {
gtk_notebook_set_current_page(gf->nb, PAGE_WEEKLY);
gtk_combo_box_set_active(gf->freqComboBox, PAGE_WEEKLY);
for (; recurrences != NULL; recurrences = recurrences->next) for (; recurrences != NULL; recurrences = recurrences->next)
{ {
_setup_weekly_recurrence(gf, (Recurrence*)recurrences->data); _setup_weekly_recurrence(gf, (Recurrence*)recurrences->data);
} }
gtk_notebook_set_current_page(gf->nb, PAGE_WEEKLY);
gtk_combo_box_set_active(gf->freqComboBox, PAGE_WEEKLY);
} }
else if (_test_for_semi_monthly(recurrences)) else if (_test_for_semi_monthly(recurrences))
{ {
@ -1030,6 +1013,9 @@ gnc_frequency_setup_recurrence(GncFrequency *gf, GList *recurrences, GDate *star
GtkWidget *multiplier_spin; GtkWidget *multiplier_spin;
GtkWidget *dom_combobox; GtkWidget *dom_combobox;
gtk_notebook_set_current_page(gf->nb, PAGE_SEMI_MONTHLY);
gtk_combo_box_set_active(gf->freqComboBox, PAGE_SEMI_MONTHLY);
first = (Recurrence*)g_list_nth_data(recurrences, 0); first = (Recurrence*)g_list_nth_data(recurrences, 0);
second = (Recurrence*)g_list_nth_data(recurrences, 1); second = (Recurrence*)g_list_nth_data(recurrences, 1);
@ -1041,8 +1027,6 @@ gnc_frequency_setup_recurrence(GncFrequency *gf, GList *recurrences, GDate *star
dom_combobox = glade_xml_get_widget(gf->gxml, "semimonthly_second"); dom_combobox = glade_xml_get_widget(gf->gxml, "semimonthly_second");
gtk_combo_box_set_active(GTK_COMBO_BOX(dom_combobox), _get_monthly_combobox_index(second)); gtk_combo_box_set_active(GTK_COMBO_BOX(dom_combobox), _get_monthly_combobox_index(second));
gtk_notebook_set_current_page(gf->nb, PAGE_SEMI_MONTHLY);
gtk_combo_box_set_active(gf->freqComboBox, PAGE_SEMI_MONTHLY);
} }
else else
{ {
@ -1064,26 +1048,28 @@ gnc_frequency_setup_recurrence(GncFrequency *gf, GList *recurrences, GDate *star
g_date_strftime(recur_date_str, 127, "%x", &recurrence_date); g_date_strftime(recur_date_str, 127, "%x", &recurrence_date);
g_critical("start_date [%s] != recurrence_date [%s]", start_date_str, recur_date_str); g_critical("start_date [%s] != recurrence_date [%s]", start_date_str, recur_date_str);
} }
gtk_notebook_set_current_page(gf->nb, PAGE_ONCE); gtk_notebook_set_current_page(gf->nb, PAGE_ONCE);
gtk_combo_box_set_active(gf->freqComboBox, PAGE_ONCE); gtk_combo_box_set_active(gf->freqComboBox, PAGE_ONCE);
} break; } break;
case PERIOD_DAY: { case PERIOD_DAY: {
guint multiplier; guint multiplier;
GtkWidget *spin_button; GtkWidget *spin_button;
gtk_notebook_set_current_page(gf->nb, PAGE_DAILY);
gtk_combo_box_set_active(gf->freqComboBox, PAGE_DAILY);
multiplier = recurrenceGetMultiplier(r); multiplier = recurrenceGetMultiplier(r);
spin_button = glade_xml_get_widget(gf->gxml, "daily_spin"); spin_button = glade_xml_get_widget(gf->gxml, "daily_spin");
gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_button), multiplier); gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_button), multiplier);
made_changes = TRUE; made_changes = TRUE;
gtk_notebook_set_current_page(gf->nb, PAGE_DAILY);
gtk_combo_box_set_active(gf->freqComboBox, PAGE_DAILY);
} break; } break;
case PERIOD_WEEK: { case PERIOD_WEEK: {
_setup_weekly_recurrence(gf, r);
gtk_notebook_set_current_page(gf->nb, PAGE_WEEKLY); gtk_notebook_set_current_page(gf->nb, PAGE_WEEKLY);
gtk_combo_box_set_active(gf->freqComboBox, PAGE_WEEKLY); gtk_combo_box_set_active(gf->freqComboBox, PAGE_WEEKLY);
_setup_weekly_recurrence(gf, r);
} break; } break;
case PERIOD_END_OF_MONTH: case PERIOD_END_OF_MONTH:
case PERIOD_MONTH: case PERIOD_MONTH:
@ -1094,6 +1080,9 @@ gnc_frequency_setup_recurrence(GncFrequency *gf, GList *recurrences, GDate *star
GDate recurrence_day; GDate recurrence_day;
int day_of_month_index; int day_of_month_index;
gtk_notebook_set_current_page(gf->nb, PAGE_MONTHLY);
gtk_combo_box_set_active(gf->freqComboBox, PAGE_MONTHLY);
multipler_spin = glade_xml_get_widget(gf->gxml, "monthly_spin"); multipler_spin = glade_xml_get_widget(gf->gxml, "monthly_spin");
multiplier = recurrenceGetMultiplier(r); multiplier = recurrenceGetMultiplier(r);
if (recurrenceGetPeriodType(r) == PERIOD_YEAR) if (recurrenceGetPeriodType(r) == PERIOD_YEAR)
@ -1103,9 +1092,6 @@ gnc_frequency_setup_recurrence(GncFrequency *gf, GList *recurrences, GDate *star
day_of_month = glade_xml_get_widget(gf->gxml, "monthly_day"); day_of_month = glade_xml_get_widget(gf->gxml, "monthly_day");
gtk_combo_box_set_active(GTK_COMBO_BOX(day_of_month), _get_monthly_combobox_index(r)); gtk_combo_box_set_active(GTK_COMBO_BOX(day_of_month), _get_monthly_combobox_index(r));
gtk_notebook_set_current_page(gf->nb, PAGE_MONTHLY);
gtk_combo_box_set_active(gf->freqComboBox, PAGE_MONTHLY);
} break; } break;
case PERIOD_NTH_WEEKDAY: case PERIOD_NTH_WEEKDAY:
g_critical("unhandled period type [%d]", recurrenceGetPeriodType(r)); g_critical("unhandled period type [%d]", recurrenceGetPeriodType(r));