[Gnucash-changes] r14346 - gnucash/branches/deprecated-cleanup - More GtkOptionMenu -> GtkCombo and CtkCList -> CtkTreeView
David Hampton
hampton at cvs.gnucash.org
Wed Jun 7 22:07:35 EDT 2006
Author: hampton
Date: 2006-06-07 22:07:33 -0400 (Wed, 07 Jun 2006)
New Revision: 14346
Trac: http://svn.gnucash.org/trac/changeset/14346
Modified:
gnucash/branches/deprecated-cleanup/ChangeLog
gnucash/branches/deprecated-cleanup/src/gnome-search/dialog-search.c
gnucash/branches/deprecated-cleanup/src/gnome/dialog-fincalc.c
gnucash/branches/deprecated-cleanup/src/gnome/dialog-sx-from-trans.c
gnucash/branches/deprecated-cleanup/src/gnome/druid-loan.c
gnucash/branches/deprecated-cleanup/src/gnome/glade/fincalc.glade
gnucash/branches/deprecated-cleanup/src/gnome/glade/lots.glade
gnucash/branches/deprecated-cleanup/src/gnome/glade/sched-xact.glade
gnucash/branches/deprecated-cleanup/src/gnome/lot-viewer.c
Log:
More GtkOptionMenu -> GtkCombo and CtkCList -> CtkTreeView
conversions.
Modified: gnucash/branches/deprecated-cleanup/ChangeLog
===================================================================
--- gnucash/branches/deprecated-cleanup/ChangeLog 2006-06-07 01:34:54 UTC (rev 14345)
+++ gnucash/branches/deprecated-cleanup/ChangeLog 2006-06-08 02:07:33 UTC (rev 14346)
@@ -1,3 +1,15 @@
+2006-06-07 David Hampton <hampton at employees.org>
+
+ * src/gnome/dialog-fincalc.c:
+ * src/gnome/dialog-sx-from-trans.c:
+ * src/gnome/druid-loan.c:
+ * src/gnome/glade/fincalc.glade:
+ * src/gnome/glade/lots.glade:
+ * src/gnome/glade/sched-xact.glade:
+ * src/gnome/lot-viewer.c:
+ * src/gnome-search/dialog-search.c: More GtkOptionMenu -> GtkCombo
+ and CtkCList -> CtkTreeView conversions.
+
2006-06-05 David Hampton <hampton at employees.org>
* src/report/report-gnome/dialog-style-sheet.c:
Modified: gnucash/branches/deprecated-cleanup/src/gnome/dialog-fincalc.c
===================================================================
--- gnucash/branches/deprecated-cleanup/src/gnome/dialog-fincalc.c 2006-06-07 01:34:54 UTC (rev 14345)
+++ gnucash/branches/deprecated-cleanup/src/gnome/dialog-fincalc.c 2006-06-08 02:07:33 UTC (rev 14346)
@@ -64,8 +64,8 @@
GtkWidget *calc_button;
- GtkWidget *compounding_menu;
- GtkWidget *payment_menu;
+ GtkWidget *compounding_combo;
+ GtkWidget *payment_combo;
GtkWidget *end_of_period_radio;
GtkWidget *discrete_compounding_radio;
@@ -162,10 +162,10 @@
gtk_label_set_text (GTK_LABEL(fcd->payment_total_label), string);
i = normalize_period(&fcd->financial_info.CF);
- gtk_option_menu_set_history(GTK_OPTION_MENU(fcd->compounding_menu), i);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(fcd->compounding_combo), i);
i = normalize_period(&fcd->financial_info.PF);
- gtk_option_menu_set_history(GTK_OPTION_MENU(fcd->payment_menu), i);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(fcd->payment_combo), i);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fcd->end_of_period_radio),
!fcd->financial_info.bep);
@@ -203,10 +203,10 @@
gnc_amount_edit_get_damount(GNC_AMOUNT_EDIT(fcd->amounts[FUTURE_VALUE]));
fcd->financial_info.fv = -fcd->financial_info.fv;
- i = gnc_option_menu_get_active(fcd->compounding_menu);
+ i = gtk_combo_box_get_active(GTK_COMBO_BOX(fcd->compounding_combo));
fcd->financial_info.CF = periods[i];
- i = gnc_option_menu_get_active(fcd->payment_menu);
+ i = gtk_combo_box_get_active(GTK_COMBO_BOX(fcd->payment_combo));
fcd->financial_info.PF = periods[i];
toggle = GTK_TOGGLE_BUTTON(fcd->end_of_period_radio);
@@ -254,13 +254,6 @@
g_free(fcd);
}
-static void
-connect_fincalc_menu_item(GtkWidget *item, gpointer data)
-{
- g_signal_connect (G_OBJECT (item), "activate",
- G_CALLBACK (fincalc_update_calc_button_cb), data);
-}
-
void
fincalc_compounding_radio_toggled(GtkToggleButton *togglebutton, gpointer data)
{
@@ -274,7 +267,7 @@
sensitive = gtk_toggle_button_get_active (togglebutton);
- gtk_widget_set_sensitive (fcd->compounding_menu, sensitive);
+ gtk_widget_set_sensitive (fcd->compounding_combo, sensitive);
}
void
@@ -554,7 +547,7 @@
{
FinCalcDialog *fcd;
GtkWidget *button;
- GtkWidget *menu;
+ GtkWidget *combo;
GtkWidget *edit;
GladeXML *xml;
@@ -601,17 +594,15 @@
fcd->calc_button = glade_xml_get_widget (xml, "calc_button");
- menu = glade_xml_get_widget (xml, "compounding_menu");
- fcd->compounding_menu = menu;
- gnc_option_menu_init(menu);
- menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(menu));
- gtk_container_forall(GTK_CONTAINER(menu), connect_fincalc_menu_item, fcd);
+ combo = glade_xml_get_widget (xml, "compounding_combo");
+ fcd->compounding_combo = combo;
+ g_signal_connect(fcd->compounding_combo, "changed",
+ G_CALLBACK (fincalc_update_calc_button_cb), fcd);
- menu = glade_xml_get_widget (xml, "payment_menu");
- fcd->payment_menu = menu;
- gnc_option_menu_init(menu);
- menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(menu));
- gtk_container_forall(GTK_CONTAINER(menu), connect_fincalc_menu_item, fcd);
+ combo = glade_xml_get_widget (xml, "payment_combo");
+ fcd->payment_combo = combo;
+ g_signal_connect(fcd->compounding_combo, "changed",
+ G_CALLBACK (fincalc_update_calc_button_cb), fcd);
button = glade_xml_get_widget (xml, "period_payment_radio");
fcd->end_of_period_radio = button;
Modified: gnucash/branches/deprecated-cleanup/src/gnome/dialog-sx-from-trans.c
===================================================================
--- gnucash/branches/deprecated-cleanup/src/gnome/dialog-sx-from-trans.c 2006-06-07 01:34:54 UTC (rev 14345)
+++ gnucash/branches/deprecated-cleanup/src/gnome/dialog-sx-from-trans.c 2006-06-08 02:07:33 UTC (rev 14346)
@@ -55,7 +55,7 @@
#define SXFTD_PARAM_TABLE "param_table"
#define SXFTD_NAME_ENTRY "name_entry"
#define SXFTD_N_OCCURRENCES_ENTRY "n_occurrences_entry"
-#define SXFTD_FREQ_OPTION_MENU "freq_option_menu"
+#define SXFTD_FREQ_COMBO_BOX "freq_combo_box"
/* #define SXFTD_END_DATE_EDIT "end_date_edit" */
#define SXFTD_START_DATE_EDIT "start_date_edit"
#define SXFTD_EX_CAL_FRAME "ex_cal_frame"
@@ -71,7 +71,7 @@
static QofLogModule log_module = GNC_MOD_SX;
-static void sxftd_freq_option_changed( GtkWidget *w, gpointer user_data );
+static void sxftd_freq_combo_changed( GtkWidget *w, gpointer user_data );
static void gnc_sx_trans_window_response_cb(GtkDialog *dialog, gint response, gpointer data);
static void sxftd_destroy( GtkWidget *w, gpointer user_data );
@@ -295,8 +295,8 @@
/* Note that we make the start date the *NEXT* instance, not the
* present one. */
- w = glade_xml_get_widget(sxfti->gxml, SXFTD_FREQ_OPTION_MENU);
- index = gnc_option_menu_get_active(w);
+ w = glade_xml_get_widget(sxfti->gxml, SXFTD_FREQ_COMBO_BOX);
+ index = gtk_combo_box_get_active(GTK_COMBO_BOX(w));
switch(index)
{
@@ -423,6 +423,12 @@
/* compute good initial date. */
start_tt = xaccTransGetDate( sxfti->trans );
g_date_set_time_t( &date, start_tt );
+ w = glade_xml_get_widget(sxfti->gxml,
+ SXFTD_FREQ_COMBO_BOX);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(w), 0);
+ g_signal_connect( w, "changed",
+ G_CALLBACK(sxftd_freq_combo_changed),
+ sxfti );
fs = xaccFreqSpecMalloc( gnc_get_current_book() );
sxftd_update_fs( sxfti, &date, fs );
xaccFreqSpecGetNextInstance( fs, &date, &nextDate );
@@ -438,14 +444,6 @@
gtk_editable_insert_text( GTK_EDITABLE(w), transName,
(strlen(transName) * sizeof(char)), &pos );
- w = glade_xml_get_widget(sxfti->gxml,
- SXFTD_FREQ_OPTION_MENU);
- gnc_option_menu_init(w);
- w = gtk_option_menu_get_menu( GTK_OPTION_MENU(w) );
- g_signal_connect( GTK_OBJECT(w), "selection-done",
- G_CALLBACK(sxftd_freq_option_changed),
- sxfti );
-
g_signal_connect( GTK_OBJECT(w), "destroy",
G_CALLBACK(sxftd_destroy),
sxfti );
@@ -588,7 +586,7 @@
* somehow.
**/
static void
-sxftd_freq_option_changed( GtkWidget *w, gpointer user_data )
+sxftd_freq_combo_changed( GtkWidget *w, gpointer user_data )
{
SXFromTransInfo *sxfti = (SXFromTransInfo*)user_data;
GDate date, nextDate;
Modified: gnucash/branches/deprecated-cleanup/src/gnome/druid-loan.c
===================================================================
--- gnucash/branches/deprecated-cleanup/src/gnome/druid-loan.c 2006-06-07 01:34:54 UTC (rev 14345)
+++ gnucash/branches/deprecated-cleanup/src/gnome/druid-loan.c 2006-06-08 02:07:33 UTC (rev 14346)
@@ -262,7 +262,7 @@
GNCFrequency *prmVarGncFreq;
GNCDateEdit *prmStartDateGDE;
GtkSpinButton *prmLengthSpin;
- GtkOptionMenu *prmLengthType;
+ GtkComboBox *prmLengthType;
GtkSpinButton *prmRemainSpin;
/* opt = options */
@@ -300,7 +300,7 @@
GNCFrequency *payGncFreq;
/* rev = review */
- GtkOptionMenu *revRangeOpt;
+ GtkComboBox *revRangeOpt;
GtkFrame *revDateFrame;
GtkTable *revTable;
GNCDateEdit *revStartDate;
@@ -355,7 +355,7 @@
GDate *end );
static void ld_rev_recalc_schedule( LoanDruidData *ldd );
-static void ld_rev_range_opt_changed( GtkButton *b, gpointer ud );
+static void ld_rev_range_opt_changed( GtkComboBox *combo, gpointer ud );
static void ld_rev_range_changed( GNCDateEdit *gde, gpointer ud );
static void ld_rev_get_dates( LoanDruidData *ldd,
GDate *start,
@@ -597,8 +597,7 @@
g_signal_connect( ldd->prmLengthSpin, "changed",
G_CALLBACK( ld_calc_upd_rem_payments ),
ldd );
- g_signal_connect( gtk_option_menu_get_menu(ldd->prmLengthType),
- "selection-done",
+ g_signal_connect( ldd->prmLengthType, "changed",
G_CALLBACK( ld_calc_upd_rem_payments ),
ldd );
@@ -609,8 +608,6 @@
}
gnc_option_menu_init( GTK_WIDGET(ldd->prmType) );
- gnc_option_menu_init( GTK_WIDGET(ldd->prmLengthType) );
- gnc_option_menu_init( GTK_WIDGET(ldd->revRangeOpt) );
g_signal_connect( ldd->optEscrowCb, "toggled",
G_CALLBACK(ld_escrow_toggle), ldd );
@@ -716,8 +713,8 @@
/* Review page widget setup. */
{
- g_signal_connect( gtk_option_menu_get_menu(ldd->revRangeOpt),
- "selection-done",
+ gtk_combo_box_set_active( ldd->revRangeOpt, 0 );
+ g_signal_connect( ldd->revRangeOpt, "changed",
G_CALLBACK( ld_rev_range_opt_changed ),
ldd );
g_signal_connect( ldd->revStartDate, "date-changed",
@@ -871,7 +868,7 @@
ldd->prmLengthSpin =
GET_CASTED_WIDGET( GTK_SPIN_BUTTON, LENGTH_SPIN );
ldd->prmLengthType =
- GET_CASTED_WIDGET( GTK_OPTION_MENU, LENGTH_OPT );
+ GET_CASTED_WIDGET( GTK_COMBO_BOX, LENGTH_OPT );
ldd->prmRemainSpin =
GET_CASTED_WIDGET( GTK_SPIN_BUTTON, REMAIN_SPIN );
@@ -919,7 +916,7 @@
/* rev = review */
ldd->revRangeOpt =
- GET_CASTED_WIDGET( GTK_OPTION_MENU, REV_RANGE_OPT );
+ GET_CASTED_WIDGET( GTK_COMBO_BOX, REV_RANGE_OPT );
ldd->revDateFrame =
GET_CASTED_WIDGET( GTK_FRAME, REV_DATE_FRAME );
ldd->revTable =
@@ -1196,7 +1193,7 @@
/* len / periods */
{
ldd->ld.perSize =
- (gnc_option_menu_get_active( GTK_WIDGET(ldd->prmLengthType) )
+ (gtk_combo_box_get_active( ldd->prmLengthType )
== MONTHS) ? MONTHS : YEARS;
ldd->ld.numPer =
gtk_spin_button_get_value_as_int( ldd->prmLengthSpin );
@@ -1237,7 +1234,7 @@
/* length: total and remaining */
{
gtk_spin_button_set_value( ldd->prmLengthSpin, ldd->ld.numPer );
- gtk_option_menu_set_history( ldd->prmLengthType, ldd->ld.perSize );
+ gtk_combo_box_set_active( ldd->prmLengthType, ldd->ld.perSize );
gtk_spin_button_set_value( ldd->prmRemainSpin, ldd->ld.numMonRemain );
}
}
@@ -2522,8 +2519,7 @@
g_free( valueStr );
}
total = totalVal
- * ( gnc_option_menu_get_active(
- GTK_WIDGET(ldd->prmLengthType) )
+ * ( gtk_combo_box_get_active( ldd->prmLengthType )
== 1 ? 12 : 1 );
remain = total - i;
gtk_spin_button_set_value( ldd->prmRemainSpin, remain );
@@ -2532,12 +2528,12 @@
static
void
-ld_rev_range_opt_changed( GtkButton *b, gpointer ud )
+ld_rev_range_opt_changed( GtkComboBox *combo, gpointer ud )
{
LoanDruidData *ldd = (LoanDruidData*)ud;
int opt;
- opt = gnc_option_menu_get_active( GTK_WIDGET(ldd->revRangeOpt) );
+ opt = gtk_combo_box_get_active( ldd->revRangeOpt );
gtk_widget_set_sensitive( GTK_WIDGET(ldd->revDateFrame),
(opt == CUSTOM) );
{
@@ -2585,7 +2581,7 @@
void
ld_rev_get_dates( LoanDruidData *ldd, GDate *start, GDate *end )
{
- int range = gnc_option_menu_get_active( GTK_WIDGET(ldd->revRangeOpt) );
+ int range = gtk_combo_box_get_active( ldd->revRangeOpt );
switch ( range ) {
case CURRENT_YEAR:
g_date_set_time_t( start, time(NULL) );
Modified: gnucash/branches/deprecated-cleanup/src/gnome/glade/fincalc.glade
===================================================================
--- gnucash/branches/deprecated-cleanup/src/gnome/glade/fincalc.glade 2006-06-07 01:34:54 UTC (rev 14345)
+++ gnucash/branches/deprecated-cleanup/src/gnome/glade/fincalc.glade 2006-06-08 02:07:33 UTC (rev 14346)
@@ -910,116 +910,6 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="compounding_menu">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget1">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget2">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Annual</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget3">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Semi-annual</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget4">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Tri-annual</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget5">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Quarterly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget6">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Bi-monthly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget7">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Monthly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget8">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Semi-monthly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget9">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Bi-weekly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget10">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Weekly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget11">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Daily (360)</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget12">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Daily (365)</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
<widget class="GtkAlignment" id="alignment23">
<property name="visible">True</property>
<property name="xalign">0.5</property>
@@ -1082,7 +972,6 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">payment_menu</property>
</widget>
</child>
</widget>
@@ -1120,7 +1009,6 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">payment_menu</property>
</widget>
</child>
</widget>
@@ -1219,116 +1107,6 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="payment_menu">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget13">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget14">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Annual</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget15">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Semi-annual</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget16">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Tri-annual</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget17">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Quarterly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget18">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Bi-monthly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget19">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Monthly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget20">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Semi-monthly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget21">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Bi-weekly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget22">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Weekly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget23">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Daily (360)</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget24">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Daily (365)</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
<widget class="GtkLabel" id="label797">
<property name="visible">True</property>
<property name="label" translatable="yes"><b>Compounding:</b></property>
@@ -1375,6 +1153,58 @@
<property name="y_options"></property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkComboBox" id="payment_combo">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Annual
+Semi-annual
+Tri-annual
+Quarterly
+Bi-monthly
+Monthly
+Semi-monthly
+Bi-weekly
+Weekly
+Daily (360)
+Daily (365)</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkComboBox" id="compounding_combo">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Annual
+Semi-annual
+Tri-annual
+Quarterly
+Bi-monthly
+Monthly
+Semi-monthly
+Bi-weekly
+Weekly
+Daily (360)
+Daily (365)</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
</widget>
</child>
</widget>
Modified: gnucash/branches/deprecated-cleanup/src/gnome/glade/lots.glade
===================================================================
--- gnucash/branches/deprecated-cleanup/src/gnome/glade/lots.glade 2006-06-07 01:34:54 UTC (rev 14345)
+++ gnucash/branches/deprecated-cleanup/src/gnome/glade/lots.glade 2006-06-08 02:07:33 UTC (rev 14346)
@@ -322,7 +322,7 @@
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
+ <property name="invisible_char">*</property>
<property name="activates_default">False</property>
<signal name="changed" handler="lv_title_entry_changed_cb" last_modification_time="Sun, 22 May 2005 21:25:12 GMT"/>
</widget>
@@ -490,96 +490,18 @@
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
- <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkCList" id="lot clist">
+ <widget class="GtkTreeView" id="lot view">
<property name="visible">True</property>
- <property name="tooltip" translatable="yes">A list of all of the lots in this account.</property>
<property name="can_focus">True</property>
- <property name="n_columns">5</property>
- <property name="column_widths">80,80,80,80,80</property>
- <property name="selection_mode">GTK_SELECTION_SINGLE</property>
- <property name="show_titles">True</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <signal name="select_row" handler="lv_select_row_cb" last_modification_time="Sun, 22 May 2005 21:25:47 GMT"/>
- <signal name="unselect_row" handler="lv_unselect_row_cb" last_modification_time="Sun, 22 May 2005 21:26:02 GMT"/>
-
- <child>
- <widget class="GtkLabel" id="label3">
- <property name="label" translatable="yes">Opened</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label4">
- <property name="label" translatable="yes">Closed</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label5">
- <property name="label" translatable="yes">Title</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label6">
- <property name="label" translatable="yes">Balance</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label7">
- <property name="label" translatable="yes">Gains</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">False</property>
+ <property name="fixed_height_mode">False</property>
</widget>
</child>
</widget>
Modified: gnucash/branches/deprecated-cleanup/src/gnome/glade/sched-xact.glade
===================================================================
--- gnucash/branches/deprecated-cleanup/src/gnome/glade/sched-xact.glade 2006-06-07 01:34:54 UTC (rev 14345)
+++ gnucash/branches/deprecated-cleanup/src/gnome/glade/sched-xact.glade 2006-06-08 02:07:33 UTC (rev 14346)
@@ -3504,76 +3504,6 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="freq_option_menu">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget269">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget270">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Daily</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget271">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Weekly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget272">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Bi-Weekly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget273">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Monthly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget274">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Quarterly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget275">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Yearly</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
<widget class="GtkEntry" id="name_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -3593,6 +3523,27 @@
<property name="y_options"></property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkComboBox" id="freq_combo_box">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Daily
+Weekly
+Bi-Weekly
+Monthly
+Quarterly
+Yearly</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
@@ -4834,32 +4785,11 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="len_opt">
+ <widget class="GtkComboBox" id="len_opt">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget288">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget289">
- <property name="visible">True</property>
- <property name="label" translatable="yes">months</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget290">
- <property name="visible">True</property>
- <property name="label" translatable="yes">years</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items" translatable="yes">months
+years</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -6035,48 +5965,13 @@
<property name="spacing">0</property>
<child>
- <widget class="GtkOptionMenu" id="rev_range_opt">
+ <widget class="GtkComboBox" id="rev_range_opt">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget291">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget292">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Current Year</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget293">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Now + 1 Year</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget294">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Whole Loan</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget295">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Custom</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
+ <property name="items" translatable="yes">Current Year
+Now + 1 Year
+Whole Loan
+Custom</property>
+ <property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
Modified: gnucash/branches/deprecated-cleanup/src/gnome/lot-viewer.c
===================================================================
--- gnucash/branches/deprecated-cleanup/src/gnome/lot-viewer.c 2006-06-07 01:34:54 UTC (rev 14345)
+++ gnucash/branches/deprecated-cleanup/src/gnome/lot-viewer.c 2006-06-08 02:07:33 UTC (rev 14346)
@@ -21,14 +21,7 @@
* *
\********************************************************************/
-/* This uses the clist widget, which I know is deprecated in gnome2.
- * Sorry, I'll try to keep it real simple.
- *
- * For example: I'd like to allow the user to edit the lot
- * title 'in-place' in the clist, but gnome-1.2 does not allow
- * entry widgets in clist cells.
- *
- * XXX todo: The button "view lot in register" is not implemented.
+/* XXX todo: The button "view lot in register" is not implemented.
* it needs to open register window showing only the splits in the
* given lot ...
*
@@ -64,7 +57,8 @@
#define TITLE_COL 2
#define BALN_COL 3
#define GAINS_COL 4
-#define NUM_COLS 5
+#define PNTR_COL 5
+#define NUM_COLS 6
#define RESPONSE_VIEW 1
#define RESPONSE_DELETE 2
@@ -83,14 +77,14 @@
GtkButton * scrub_lot_button;
GtkPaned * lot_hpaned;
GtkPaned * lot_vpaned;
- GtkCList * lot_clist;
+ GtkTreeView * lot_view;
+ GtkListStore * lot_store;
GtkTextView * lot_notes;
GtkEntry * title_entry;
GtkCList * mini_clist;
Account * account;
GNCLot * selected_lot;
- int selected_row;
};
static void gnc_lot_viewer_fill (GNCLotViewer *lv);
@@ -98,16 +92,6 @@
/* ======================================================================== */
/* Callback prototypes */
-void lv_select_row_cb (GtkCList *clist,
- gint row,
- gint column,
- GdkEvent *event,
- gpointer user_data);
-void lv_unselect_row_cb (GtkCList *clist,
- gint row,
- gint column,
- GdkEvent *event,
- gpointer user_data);
void lv_title_entry_changed_cb (GtkEntry *ent, gpointer user_data);
void lv_response_cb (GtkDialog *dialog, gint response, gpointer data);
void lv_window_destroy_cb (GtkObject *object, gpointer user_data);
@@ -227,19 +211,12 @@
/* ======================================================================== */
/* Callback for selecting a row the the list-of-list clist */
-void
-lv_select_row_cb (GtkCList *clist,
- gint row,
- gint column,
- GdkEvent *event,
- gpointer user_data)
+static void
+lv_select_row (GNCLotViewer *lv,
+ GNCLot *lot)
{
- GNCLotViewer *lv = user_data;
- GNCLot *lot;
const char * str;
- lot = gtk_clist_get_row_data (clist, row);
-
str = gnc_lot_get_title (lot);
if (!str) str = "";
gtk_entry_set_text (lv->title_entry, str);
@@ -253,8 +230,6 @@
/* Don't set until end, to avoid recursion in gtkentry "changed" cb. */
lv->selected_lot = lot;
- lv->selected_row = row;
-
lv_show_splits (lv);
gtk_widget_set_sensitive(GTK_WIDGET(lv->regview_button), TRUE);
@@ -269,7 +244,6 @@
{
/* Set immediately, to avoid recursion in gtkentry "changed" cb. */
lv->selected_lot = NULL;
- lv->selected_row = -1;
/* Blank the title widget */
gtk_entry_set_text (lv->title_entry, "");
@@ -290,24 +264,17 @@
/* ======================================================================== */
/* Callback for un-selecting a row the the list-of-list clist */
-void
-lv_unselect_row_cb (GtkCList *clist,
- gint row,
- gint column,
- GdkEvent *event,
- gpointer user_data)
+static void
+lv_unselect_row (GNCLotViewer *lv)
{
- GNCLotViewer *lv = user_data;
GNCLot *lot = lv->selected_lot;
const char * str;
char * notes;
- /* Get the title, plunk it into ctree */
- str = gtk_entry_get_text (lv->title_entry);
- gtk_clist_set_text (lv->lot_clist, row, TITLE_COL, str);
-
if (lot)
{
+ /* Get the title, save_the_title */
+ str = gtk_entry_get_text (lv->title_entry);
gnc_lot_set_title (lot, str);
/* Get the notes, save the notes */
@@ -319,6 +286,23 @@
lv_unset_lot (lv);
}
+static void
+lv_selection_changed_cb (GtkTreeSelection *selection,
+ GNCLotViewer *lv)
+{
+ GNCLot *lot;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
+ gtk_tree_model_get(model, &iter, PNTR_COL, &lot, -1);
+ lv_select_row(lv, lot);
+ } else {
+ lv_unselect_row(lv);
+ }
+}
+
+
/* ======================================================================== */
/* Callback when user types a new lot title into the entry widget */
@@ -326,10 +310,16 @@
lv_title_entry_changed_cb (GtkEntry *ent, gpointer user_data)
{
GNCLotViewer *lv = user_data;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkTreeSelection *selection;
const char * title;
title = gtk_entry_get_text (lv->title_entry);
- if (0 > lv->selected_row) return;
- gtk_clist_set_text (lv->lot_clist, lv->selected_row, TITLE_COL, title);
+
+ selection = gtk_tree_view_get_selection(lv->lot_view);
+ if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
+ gtk_list_store_set(GTK_LIST_STORE(model), &iter, TITLE_COL, title, -1);
+ }
}
/* ======================================================================== */
@@ -385,16 +375,23 @@
static void
gnc_lot_viewer_fill (GNCLotViewer *lv)
{
- int row;
LotList *lot_list, *node;
- GNCLot *selected_lot;
- int selected_row = -1;
+ GNCLot *this_lot, *selected_lot = NULL;
+ GtkListStore *store;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkTreeSelection *selection;
+ gboolean found = FALSE;
lot_list = xaccAccountGetLotList (lv->account);
- selected_lot = lv->selected_lot;
- gtk_clist_freeze (lv->lot_clist);
- gtk_clist_clear (lv->lot_clist);
+ selection = gtk_tree_view_get_selection(lv->lot_view);
+ if (gtk_tree_selection_get_selected (selection, &model, &iter))
+ gtk_tree_model_get(model, &iter, PNTR_COL, &selected_lot, -1);
+
+ /* Crazy. Should update in place if possible. */
+ gtk_list_store_clear (lv->lot_store);
+
for (node = lot_list; node; node=node->next)
{
char obuff[MAX_DATE_LENGTH];
@@ -410,9 +407,12 @@
gnc_numeric gains_baln = get_realized_gains (lot, currency);
const char *row_vals[NUM_COLS];
+ store = lv->lot_store;
+ gtk_list_store_append(store, &iter);
+
/* Opening date */
qof_print_date_buff (obuff, MAX_DATE_LENGTH, open_date);
- row_vals[OPEN_COL] = obuff;
+ gtk_list_store_set(store, &iter, OPEN_COL, obuff, -1);
/* Closing date */
if (gnc_lot_is_closed (lot))
@@ -422,43 +422,49 @@
time_t close_date = xaccTransGetDate (ftrans);
qof_print_date_buff (cbuff, MAX_DATE_LENGTH, close_date);
+ gtk_list_store_set(store, &iter, CLOSE_COL, cbuff, -1);
row_vals[CLOSE_COL] = cbuff;
}
else
{
- row_vals[CLOSE_COL] = _("Open");
+ gtk_list_store_set(store, &iter, CLOSE_COL, cbuff, _("Open"), -1);
}
/* Title */
- row_vals[TITLE_COL] = gnc_lot_get_title (lot);
+ gtk_list_store_set(store, &iter, TITLE_COL, gnc_lot_get_title(lot), -1);
/* Amount */
xaccSPrintAmount (baln_buff, amt_baln,
gnc_account_print_info (lv->account, TRUE));
- row_vals[BALN_COL] = baln_buff;
+ gtk_list_store_set(store, &iter, BALN_COL, baln_buff, -1);
/* Capital Gains/Losses Appreciation/Depreciation */
xaccSPrintAmount (gain_buff, gains_baln,
gnc_commodity_print_info (currency, TRUE));
- row_vals[GAINS_COL] = gain_buff;
+ gtk_list_store_set(store, &iter, GAINS_COL, gain_buff, -1);
/* Self-reference */
- row = gtk_clist_append (lv->lot_clist, (char **)row_vals);
- gtk_clist_set_row_data (lv->lot_clist, row, lot);
- if (lot == selected_lot) selected_row = row;
+ gtk_list_store_set(store, &iter, PNTR_COL, lot, -1);
}
- gtk_clist_thaw (lv->lot_clist);
/* re-select the row that the user had previously selected,
* if possible. */
- if (-1 < selected_row)
- {
- gtk_clist_select_row (lv->lot_clist, selected_row, 1);
+ if (selected_lot) {
+ model = GTK_TREE_MODEL(lv->lot_store);
+ if (gtk_tree_model_get_iter_first(model, &iter)) {
+ do {
+ gtk_tree_model_get(model, &iter, PNTR_COL, &this_lot, -1);
+ if (this_lot == selected_lot) {
+ gtk_tree_selection_select_iter(selection, &iter);
+ found = TRUE;
+ break;
+ }
+ } while (gtk_tree_model_iter_next(model, &iter));
+ }
}
- else
- {
- gtk_clist_unselect_all (lv->lot_clist);
- }
+
+ if (!found)
+ gtk_tree_selection_unselect_all(selection);
}
/* ======================================================================== */
@@ -577,6 +583,58 @@
/* ======================================================================== */
static void
+lv_init_lot_view (GNCLotViewer *lv)
+{
+ GtkTreeView *view;
+ GtkListStore *store;
+ GtkTreeViewColumn *column;
+ GtkTreeSelection *selection;
+ GtkCellRenderer *renderer;
+
+ g_return_if_fail(GTK_IS_TREE_VIEW(lv->lot_view));
+
+ view = lv->lot_view;
+ store = gtk_list_store_new(NUM_COLS, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_POINTER);
+ gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
+ lv->lot_store = store;
+
+ /* Set up the columns */
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Opened"), renderer,
+ "text", OPEN_COL, NULL);
+ gtk_tree_view_append_column(view, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Closed"), renderer,
+ "text", CLOSE_COL, NULL);
+ gtk_tree_view_append_column(view, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Title"), renderer,
+ "text", TITLE_COL, NULL);
+ gtk_tree_view_append_column(view, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Balance"), renderer,
+ "text", BALN_COL, NULL);
+ gtk_tree_view_append_column(view, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Gains"), renderer,
+ "text", GAINS_COL, NULL);
+ gtk_tree_view_append_column(view, column);
+
+ /* Set up the selection callbacks */
+ selection = gtk_tree_view_get_selection(view);
+ g_signal_connect(selection, "changed",
+ G_CALLBACK(lv_selection_changed_cb), lv);
+}
+
+/* ======================================================================== */
+
+static void
lv_create (GNCLotViewer *lv)
{
GladeXML *xml;
@@ -594,7 +652,8 @@
lv->delete_button = GTK_BUTTON(glade_xml_get_widget (xml, "delete button"));
lv->scrub_lot_button = GTK_BUTTON(glade_xml_get_widget (xml, "scrub lot button"));
- lv->lot_clist = GTK_CLIST(glade_xml_get_widget (xml, "lot clist"));
+ lv->lot_view = GTK_TREE_VIEW(glade_xml_get_widget (xml, "lot view"));
+ lv_init_lot_view(lv);
lv->lot_notes = GTK_TEXT_VIEW(glade_xml_get_widget (xml, "lot notes text"));
lv->title_entry = GTK_ENTRY (glade_xml_get_widget (xml, "lot title entry"));
@@ -611,19 +670,12 @@
lv->mini_clist = GTK_CLIST(glade_xml_get_widget (xml, "mini clist"));
lv->selected_lot = NULL;
- lv->selected_row = -1;
/* Setup signals */
glade_xml_signal_autoconnect_full( xml,
gnc_glade_autoconnect_full_func,
lv);
- g_signal_connect (lv->lot_clist, "select_row",
- G_CALLBACK (lv_select_row_cb), lv);
-
- g_signal_connect (lv->lot_clist, "unselect_row",
- G_CALLBACK (lv_unselect_row_cb), lv);
-
gnc_restore_window_size(GCONF_SECTION, GTK_WINDOW(lv->window));
}
Modified: gnucash/branches/deprecated-cleanup/src/gnome-search/dialog-search.c
===================================================================
--- gnucash/branches/deprecated-cleanup/src/gnome-search/dialog-search.c 2006-06-07 01:34:54 UTC (rev 14345)
+++ gnucash/branches/deprecated-cleanup/src/gnome-search/dialog-search.c 2006-06-08 02:07:33 UTC (rev 14346)
@@ -52,6 +52,10 @@
GNC_SEARCH_MATCH_ANY = 1
} GNCSearchType;
+#define COL_NAME 0
+#define COL_POINTER 1
+#define NUM_COLS 2
+
struct _GNCSearchWindow {
GtkWidget * dialog;
GtkWidget * criteria_table;
@@ -298,18 +302,12 @@
}
static void
-match_all (GtkWidget *widget, GNCSearchWindow *sw)
+match_combo_changed (GtkComboBox *combo_box, GNCSearchWindow *sw)
{
- sw->grouping = GNC_SEARCH_MATCH_ALL;
+ sw->grouping = gtk_combo_box_get_active(combo_box);
}
static void
-match_any (GtkWidget *widget, GNCSearchWindow *sw)
-{
- sw->grouping = GNC_SEARCH_MATCH_ANY;
-}
-
-static void
search_type_cb (GtkToggleButton *button, GNCSearchWindow *sw)
{
GSList * buttongroup = gtk_radio_button_get_group (GTK_RADIO_BUTTON(button));
@@ -557,11 +555,18 @@
}
static void
-option_activate (GtkMenuItem *item, struct _crit_data *data)
+combo_box_changed (GtkComboBox *combo_box, struct _crit_data *data)
{
- GNCSearchParam *param = g_object_get_data (G_OBJECT (item), "param");
+ GNCSearchParam *param;
GNCSearchCoreType *newelem;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ if (!gtk_combo_box_get_active_iter(combo_box, &iter))
+ return;
+ model = gtk_combo_box_get_model(combo_box);
+ gtk_tree_model_get(model, &iter, COL_POINTER, ¶m, -1);
+
if (gnc_search_param_type_match (param, data->param)) {
/* The param type is the same, just save the new param */
data->param = param;
@@ -614,7 +619,10 @@
static GtkWidget *
get_element_widget (GNCSearchWindow *sw, GNCSearchCoreType *element)
{
- GtkWidget *menu, *item, *omenu, *hbox, *p;
+ GtkWidget *combo_box, *hbox, *p;
+ GtkListStore *store;
+ GtkTreeIter iter;
+ GtkCellRenderer *cell;
GList *l;
struct _crit_data *data;
int index = 0, current = 0;
@@ -632,27 +640,34 @@
data->container = hbox;
data->param = sw->last_param;
- menu = gtk_menu_new ();
+ store = gtk_list_store_new(NUM_COLS, G_TYPE_STRING, G_TYPE_POINTER);
+ combo_box = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
+
+ cell = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start(GTK_CELL_LAYOUT (combo_box), cell, TRUE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), cell,
+ "text", COL_NAME,
+ NULL);
+
for (l = sw->params_list; l; l = l->next) {
GNCSearchParam *param = l->data;
- item = gtk_menu_item_new_with_label (_(param->title));
- g_object_set_data (G_OBJECT (item), "param", param);
- g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (option_activate), data);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ COL_NAME, _(param->title),
+ COL_POINTER, param,
+ -1);
+
if (param == sw->last_param) /* is this the right parameter to start? */
current = index;
index++;
}
- omenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), current);
- gtk_widget_show (omenu);
+ gtk_combo_box_set_active (GTK_COMBO_BOX(combo_box), current);
+ g_signal_connect (combo_box, "changed", G_CALLBACK (combo_box_changed), data);
- gtk_box_pack_start (GTK_BOX (hbox), omenu, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), combo_box, FALSE, FALSE, 0);
if (p)
gtk_box_pack_start (GTK_BOX (hbox), p, FALSE, FALSE, 0);
gtk_widget_show_all (hbox);
@@ -748,7 +763,7 @@
{
GladeXML *xml;
GtkWidget *label, *add, *box;
- GtkWidget *menu, *item, *omenu;
+ GtkComboBox *combo_box;
GtkWidget *new_item_button;
const char * type_label;
gboolean active;
@@ -782,25 +797,14 @@
gtk_box_pack_start (GTK_BOX (box), add, FALSE, FALSE, 3);
/* Set the match-type menu */
- menu = gtk_menu_new ();
+ combo_box = GTK_COMBO_BOX(gtk_combo_box_new_text());
+ gtk_combo_box_append_text(combo_box, _("all criteria are met"));
+ gtk_combo_box_append_text(combo_box, _("any criteria are met"));
+ gtk_combo_box_set_active(combo_box, sw->grouping);
+ g_signal_connect(combo_box, "changed", G_CALLBACK (match_combo_changed), sw);
- item = gtk_menu_item_new_with_label (_("all criteria are met"));
- g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (match_all), sw);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
-
- item = gtk_menu_item_new_with_label (_("any criteria are met"));
- g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (match_any), sw);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
-
- omenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), sw->grouping);
-
- gtk_widget_show (omenu);
box = glade_xml_get_widget (xml, "type_menu_box");
- gtk_box_pack_start (GTK_BOX (box), omenu, FALSE, FALSE, 3);
+ gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET(combo_box), FALSE, FALSE, 3);
/* if there's no original query, make the narrow, add, delete
* buttons inaccessible */
More information about the gnucash-changes
mailing list