[Gnucash-changes] r13324 - gnucash/trunk - Use a spin_box instead
of an entry for the 'occurrences' and
David Hampton
hampton at cvs.gnucash.org
Mon Feb 20 14:50:42 EST 2006
Author: hampton
Date: 2006-02-20 14:50:42 -0500 (Mon, 20 Feb 2006)
New Revision: 13324
Trac: http://svn.gnucash.org/trac/changeset/13324
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/src/gnome/dialog-scheduledxaction.c
gnucash/trunk/src/gnome/glade/sched-xact.glade
Log:
Use a spin_box instead of an entry for the 'occurrences' and
'remaining' numeric fields.
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2006-02-20 19:40:24 UTC (rev 13323)
+++ gnucash/trunk/ChangeLog 2006-02-20 19:50:42 UTC (rev 13324)
@@ -1,5 +1,9 @@
2006-02-20 David Hampton <hampton at employees.org>
+ * src/gnome/dialog-scheduledxaction.c:
+ * src/gnome/glade/sched-xact.glade: Use a spin_box instead of an
+ entry for the 'occurrences' and 'remaining' numeric fields.
+
* src/gnome/dialog-scheduledxaction.[ch]:
* src/gnome/glade/sched-xact.glade: HIGify the scheduled
transaction dialogs.
Modified: gnucash/trunk/src/gnome/dialog-scheduledxaction.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-scheduledxaction.c 2006-02-20 19:40:24 UTC (rev 13323)
+++ gnucash/trunk/src/gnome/dialog-scheduledxaction.c 2006-02-20 19:50:42 UTC (rev 13324)
@@ -84,8 +84,8 @@
#define REMIND_OPT "remind_opt"
#define REMIND_DAYS_SPIN "remind_days"
#define END_DATE_BOX "end_date_hbox"
-#define END_ENTRY "end_nentry"
-#define REMAIN_ENTRY "remain_nentry"
+#define END_SPIN "end_spin"
+#define REMAIN_SPIN "remain_spin"
#define SX_GLADE_FILE "sched-xact.glade"
@@ -161,8 +161,8 @@
GtkToggleButton *optEndDate;
GtkToggleButton *optEndNone;
GtkToggleButton *optEndCount;
- GtkEntry *endCountEntry;
- GtkEntry *endRemainEntry;
+ GtkEntry *endCountSpin;
+ GtkEntry *endRemainSpin;
GNCDateEdit *endDateEntry;
char *sxGUIDstr;
@@ -479,17 +479,16 @@
/* dialog says... num occur */
if ( gtk_toggle_button_get_active( sxed->optEndCount ) ) {
gint sxNumOccur, sxNumRem, dlgNumOccur, dlgNumRem;
- const gchar *text;
if ( ! xaccSchedXactionGetNumOccur( sxed->sx ) ) {
return TRUE;
}
- text = gtk_entry_get_text (sxed->endCountEntry);
- sscanf (text, "%d", &dlgNumOccur);
+ dlgNumOccur =
+ gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON(sxed->endCountSpin) );
- text = gtk_entry_get_text (sxed->endRemainEntry);
- sscanf (text, "%d", &dlgNumRem);
+ dlgNumRem =
+ gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON(sxed->endRemainSpin) );
sxNumOccur = xaccSchedXactionGetNumOccur( sxed->sx );
sxNumRem = xaccSchedXactionGetRemOccur( sxed->sx );
@@ -935,13 +934,12 @@
if ( gtk_toggle_button_get_active(sxed->optEndCount)) {
gint occur, rem;
- const gchar *text;
- text = gtk_entry_get_text (sxed->endCountEntry);
- sscanf (text, "%d", &occur);
+ occur =
+ gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON(sxed->endCountSpin) );
- text = gtk_entry_get_text (sxed->endRemainEntry);
- sscanf (text, "%d", &rem);
+ rem =
+ gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON(sxed->endRemainSpin) );
if ( occur == 0 ) {
const char *sx_occur_count_zero_msg =
@@ -1031,15 +1029,14 @@
xaccSchedXactionSetNumOccur( sxed->sx, 0 );
} else if ( gtk_toggle_button_get_active(sxed->optEndCount) ) {
gint num;
- const gchar *text;
/* get the occurances data */
- text = gtk_entry_get_text (sxed->endCountEntry);
- sscanf (text, "%d", &num);
+ num =
+ gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON(sxed->endCountSpin) );
xaccSchedXactionSetNumOccur( sxed->sx, num );
- text = gtk_entry_get_text (sxed->endRemainEntry);
- sscanf (text, "%d", &num);
+ num =
+ gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON(sxed->endRemainSpin) );
xaccSchedXactionSetRemOccur( sxed->sx, num );
g_date_clear( &gdate, 1 );
@@ -1391,11 +1388,11 @@
w = glade_xml_get_widget( sxed->gxml, "rb_num_occur" );
sxed->optEndCount = GTK_TOGGLE_BUTTON(w);
- w = glade_xml_get_widget( sxed->gxml, END_ENTRY );
- sxed->endCountEntry = GTK_ENTRY(w);
+ w = glade_xml_get_widget( sxed->gxml, END_SPIN );
+ sxed->endCountSpin = GTK_ENTRY(w);
- w = glade_xml_get_widget( sxed->gxml, REMAIN_ENTRY );
- sxed->endRemainEntry = GTK_ENTRY(w);
+ w = glade_xml_get_widget( sxed->gxml, REMAIN_SPIN );
+ sxed->endRemainSpin = GTK_ENTRY(w);
}
@@ -1423,7 +1420,7 @@
{ "rb_enddate", "toggled", endgroup_rb_toggled, GINT_TO_POINTER(END_DATE_OPTION) },
{ "rb_num_occur", "toggled", endgroup_rb_toggled, GINT_TO_POINTER(NUM_OCCUR_OPTION) },
- { REMAIN_ENTRY , "changed", sxed_excal_update_adapt, NULL },
+ { REMAIN_SPIN , "value-changed", sxed_excal_update_adapt, NULL },
{ AUTOCREATE_OPT, "toggled", autocreate_toggled, NULL },
{ ADVANCE_OPT, "toggled", advance_toggle, (gpointer)ADVANCE_DAYS_SPIN },
@@ -1509,8 +1506,8 @@
gtk_widget_set_sensitive( GTK_WIDGET(sxed->notifyOpt), FALSE );
gtk_widget_set_sensitive( GTK_WIDGET(sxed->advanceSpin), FALSE );
gtk_widget_set_sensitive( GTK_WIDGET(sxed->remindSpin), FALSE );
- gtk_widget_set_sensitive( GTK_WIDGET(sxed->endCountEntry), FALSE );
- gtk_widget_set_sensitive( GTK_WIDGET(sxed->endRemainEntry), FALSE );
+ gtk_widget_set_sensitive( GTK_WIDGET(sxed->endCountSpin), FALSE );
+ gtk_widget_set_sensitive( GTK_WIDGET(sxed->endRemainSpin), FALSE );
gtk_editable_set_editable( GTK_EDITABLE(sxed->advanceSpin), TRUE );
gtk_editable_set_editable( GTK_EDITABLE(sxed->remindSpin), TRUE );
@@ -1624,7 +1621,6 @@
char *name;
time_t tmpDate;
SplitRegister *splitReg;
- GString *tmpgStr;
struct tm *tmpTm;
GDate *gd;
gint daysInAdvance;
@@ -1663,16 +1659,9 @@
gtk_toggle_button_set_active( sxed->optEndCount, TRUE );
- tmpgStr = g_string_sized_new(5);
- g_string_printf( tmpgStr, "%d", numOccur );
- gtk_entry_set_text( sxed->endCountEntry, tmpgStr->str );
- g_string_free( tmpgStr, TRUE );
+ gtk_spin_button_set_value ( GTK_SPIN_BUTTON(sxed->endCountSpin), numOccur );
+ gtk_spin_button_set_value ( GTK_SPIN_BUTTON(sxed->endRemainSpin), numRemain );
- tmpgStr = g_string_sized_new(5);
- g_string_printf( tmpgStr, "%d", numRemain );
- gtk_entry_set_text( sxed->endRemainEntry, tmpgStr->str );
- g_string_free( tmpgStr, TRUE );
-
set_endgroup_toggle_states( sxed, END_OCCUR );
} else {
gtk_toggle_button_set_active( sxed->optEndNone, TRUE );
@@ -1751,8 +1740,8 @@
set_endgroup_toggle_states( SchedXactionEditorDialog *sxed, EndType type )
{
gtk_widget_set_sensitive( GTK_WIDGET(sxed->endDateEntry), (type == END_DATE) );
- gtk_widget_set_sensitive( GTK_WIDGET(sxed->endCountEntry), (type == END_OCCUR) );
- gtk_widget_set_sensitive( GTK_WIDGET(sxed->endRemainEntry), (type == END_OCCUR) );
+ gtk_widget_set_sensitive( GTK_WIDGET(sxed->endCountSpin), (type == END_OCCUR) );
+ gtk_widget_set_sensitive( GTK_WIDGET(sxed->endRemainSpin), (type == END_OCCUR) );
}
static
@@ -2333,7 +2322,6 @@
END_TYPE endType;
GDate endDate;
int numRemain;
- gchar *text;
endType = NO_END;
numRemain = -1;
@@ -2353,10 +2341,9 @@
endType = NO_END;
} else if ( gtk_toggle_button_get_active( sxed->optEndCount ) ) {
endType = COUNT_END;
- text = gtk_editable_get_chars( GTK_EDITABLE (sxed->endRemainEntry),
- 0, -1 );
- sscanf (text, "%d", &numRemain);
- g_free (text);
+ numRemain =
+ gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON(sxed->endRemainSpin) );
+
} else {
g_assert( FALSE );
}
Modified: gnucash/trunk/src/gnome/glade/sched-xact.glade
===================================================================
--- gnucash/trunk/src/gnome/glade/sched-xact.glade 2006-02-20 19:40:24 UTC (rev 13323)
+++ gnucash/trunk/src/gnome/glade/sched-xact.glade 2006-02-20 19:50:42 UTC (rev 13324)
@@ -749,44 +749,43 @@
</child>
<child>
- <widget class="GtkEntry" id="remain_nentry">
+ <widget class="GtkSpinButton" id="end_spin">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">*</property>
- <property name="activates_default">False</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">1 0 1000 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">fill</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkEntry" id="end_nentry">
+ <widget class="GtkSpinButton" id="remain_spin">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">*</property>
- <property name="activates_default">False</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">1 0 1000 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="y_options"></property>
</packing>
</child>
More information about the gnucash-changes
mailing list