From 24e195d7d0082aa8a88876ea2a1a8c8fcadf7716 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Sun, 11 Sep 2011 10:58:01 +0000 Subject: [PATCH] Bug #657596 - Migrate Scheduled Transactions from GladeXML to Builder Patch by Robert Fewell git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21243 57a11ea4-9604-0410-9ed3-97b8803252fd --- po/POTFILES.in | 3 +- src/gnome-utils/gnc-frequency.c | 103 +- src/gnome-utils/gnc-frequency.h | 4 +- src/gnome-utils/gtkbuilder/Makefile.am | 1 + .../gtkbuilder/gnc-frequency.glade | 1463 ++++++++ src/gnome/dialog-sx-editor.c | 343 +- src/gnome/dialog-sx-editor.h | 5 +- src/gnome/dialog-sx-from-trans.c | 168 +- src/gnome/dialog-sx-from-trans.h | 3 +- src/gnome/dialog-sx-since-last-run.c | 47 +- src/gnome/dialog-sx-since-last-run.h | 5 +- src/gnome/glade/sched-xact.glade | 2251 ------------ src/gnome/gnc-plugin-page-sx-list.c | 158 +- src/gnome/gnc-plugin-page-sx-list.h | 55 +- src/gnome/gtkbuilder/Makefile.am | 2 +- src/gnome/gtkbuilder/dialog-sx.glade | 1692 +++++++++ src/gnome/gtkbuilder/sched-xact.glade | 3134 ----------------- 17 files changed, 3677 insertions(+), 5760 deletions(-) create mode 100644 src/gnome-utils/gtkbuilder/gnc-frequency.glade create mode 100644 src/gnome/gtkbuilder/dialog-sx.glade diff --git a/po/POTFILES.in b/po/POTFILES.in index d5b8de8998..74b4c69693 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -234,13 +234,13 @@ src/gnome/gtkbuilder/dialog-fincalc.glade src/gnome/gtkbuilder/dialog-lot-viewer.glade src/gnome/gtkbuilder/dialog-price.glade src/gnome/gtkbuilder/dialog-print-check.glade +src/gnome/gtkbuilder/dialog-sx.glade src/gnome/gtkbuilder/gnc-plugin-page-budget.glade src/gnome/gtkbuilder/newuser.glade src/gnome/gtkbuilder/owner.glade src/gnome/gtkbuilder/progress.glade src/gnome/gtkbuilder/reconcile.glade src/gnome/gtkbuilder/register.glade -src/gnome/gtkbuilder/sched-xact.glade src/gnome/gtkbuilder/tax.glade src/gnome/gtkbuilder/userpass.glade src/gnome/gtkbuilder/window-autoclear.glade @@ -359,6 +359,7 @@ src/gnome-utils/gnc-window.c src/gnome-utils/gtkbuilder/dialog-commodity.glade src/gnome-utils/gtkbuilder/dialog-transfer.glade src/gnome-utils/gtkbuilder/gnc-date-format.glade +src/gnome-utils/gtkbuilder/gnc-frequency.glade src/gnome-utils/gtkbuilder/gnc-recurrence.glade src/gnome-utils/misc-gnome-utils.c src/gnome-utils/print-session.c diff --git a/src/gnome-utils/gnc-frequency.c b/src/gnome-utils/gnc-frequency.c index 5ddc66de20..c55a0c5e90 100644 --- a/src/gnome-utils/gnc-frequency.c +++ b/src/gnome-utils/gnc-frequency.c @@ -3,6 +3,7 @@ * Copyright (C) 2001,2002,2007 Joshua Sled * * Copyright (C) 2003 Linas Vepstas * * Copyright (C) 2006 David Hampton * + * Copyright (C) 2011 Robert Fewell * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * @@ -40,6 +41,8 @@ #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "gnc.gui.frequency" +static QofLogModule log_module = GNC_MOD_GUI; + #define LAST_DAY_OF_MONTH_OPTION_INDEX 31 /** Private Defs ********************/ @@ -129,6 +132,7 @@ gnc_frequency_get_type() return gncfreq_type; } + static void gnc_frequency_class_init( GncFrequencyClass *klass ) { @@ -148,6 +152,7 @@ gnc_frequency_class_init( GncFrequencyClass *klass ) 0); } + void gnc_frequency_init(GncFrequency *gf) { @@ -155,6 +160,7 @@ gnc_frequency_init(GncFrequency *gf) GtkVBox* vb; GtkWidget* o; GtkAdjustment* adj; + GtkBuilder *builder; static const struct comboBoxTuple { @@ -162,7 +168,7 @@ gnc_frequency_init(GncFrequency *gf) void (*fn)(); } comboBoxes[] = { - { "freq_combobox", freq_combo_changed }, + { "freq_combobox", freq_combo_changed }, { "semimonthly_first", semimonthly_sel_changed }, { "semimonthly_first_weekend", semimonthly_sel_changed }, { "semimonthly_second", semimonthly_sel_changed }, @@ -185,28 +191,42 @@ gnc_frequency_init(GncFrequency *gf) { NULL, NULL } }; - gf->gxml = gnc_glade_xml_new("sched-xact.glade", "gncfreq_vbox"); - o = glade_xml_get_widget(gf->gxml, "gncfreq_nb"); + builder = gtk_builder_new(); + gnc_builder_add_from_file (builder ,"gnc-frequency.glade", "adjustment1"); + gnc_builder_add_from_file (builder ,"gnc-frequency.glade", "adjustment2"); + gnc_builder_add_from_file (builder ,"gnc-frequency.glade", "adjustment3"); + gnc_builder_add_from_file (builder ,"gnc-frequency.glade", "adjustment4"); + gnc_builder_add_from_file (builder ,"gnc-frequency.glade", "liststore1"); + gnc_builder_add_from_file (builder ,"gnc-frequency.glade", "liststore2"); + gnc_builder_add_from_file (builder ,"gnc-frequency.glade", "liststore3"); + gnc_builder_add_from_file (builder ,"gnc-frequency.glade", "liststore4"); + gnc_builder_add_from_file (builder ,"gnc-frequency.glade", "liststore5"); + gnc_builder_add_from_file (builder ,"gnc-frequency.glade", "liststore6"); + gnc_builder_add_from_file (builder ,"gnc-frequency.glade", "liststore7"); + gnc_builder_add_from_file (builder ,"gnc-frequency.glade", "gncfreq_vbox"); + + gf->builder = builder; + o = GTK_WIDGET(gtk_builder_get_object (builder, "gncfreq_nb")); gf->nb = GTK_NOTEBOOK(o); - o = glade_xml_get_widget(gf->gxml, "freq_combobox"); + o = GTK_WIDGET(gtk_builder_get_object (builder, "freq_combobox")); gf->freqComboBox = GTK_COMBO_BOX(o); gf->startDate = GNC_DATE_EDIT(gnc_date_edit_new(time(NULL), FALSE, FALSE)); /* Add the new widget to the table. */ { gint dont_expand_or_fill = 0; - GtkWidget *table = glade_xml_get_widget(gf->gxml, "gncfreq_table"); + GtkWidget *table = GTK_WIDGET(gtk_builder_get_object (builder, "gncfreq_table")); gtk_table_attach(GTK_TABLE(table), GTK_WIDGET(gf->startDate), - 1, 2, 1, 2, dont_expand_or_fill, 0, + 4, 5, 0, 1, dont_expand_or_fill, 0, 0, 0); } - vb = GTK_VBOX(glade_xml_get_widget(gf->gxml, "gncfreq_vbox")); + vb = GTK_VBOX(gtk_builder_get_object (builder, "gncfreq_vbox")); gf->vb = vb; gtk_container_add(GTK_CONTAINER(&gf->widget), GTK_WIDGET(gf->vb)); /* initialize the combo boxes */ for (i = 0; comboBoxes[i].name != NULL; i++) { - o = glade_xml_get_widget(gf->gxml, comboBoxes[i].name); + o = GTK_WIDGET(gtk_builder_get_object (builder, comboBoxes[i].name)); gtk_combo_box_set_active(GTK_COMBO_BOX(o), 0); if (comboBoxes[i].fn != NULL) { @@ -219,7 +239,7 @@ gnc_frequency_init(GncFrequency *gf) { if (spinVals[i].fn != NULL) { - o = glade_xml_get_widget(gf->gxml, spinVals[i].name); + o = GTK_WIDGET(gtk_builder_get_object (builder, spinVals[i].name)); adj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(o)); g_signal_connect(adj, "value_changed", G_CALLBACK(spinVals[i].fn), gf); } @@ -228,7 +248,7 @@ gnc_frequency_init(GncFrequency *gf) /* initialize the weekly::day-of-week checkbox-selection hooks */ for (i = 0; i < 7; i++) { - o = glade_xml_get_widget(gf->gxml, CHECKBOX_NAMES[i]); + o = GTK_WIDGET(gtk_builder_get_object (builder, CHECKBOX_NAMES[i])); g_signal_connect(o, "clicked", G_CALLBACK(weekly_days_changed), gf); } @@ -237,42 +257,54 @@ gnc_frequency_init(GncFrequency *gf) /* respond to start date changes */ g_signal_connect(gf->startDate, "date_changed", G_CALLBACK(start_date_changed), gf); + + gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, gf); + + /* We can not use this as builder file is accessed when widgets change */ + /* g_object_unref(G_OBJECT(builder)); */ } + static void spin_changed_helper( GtkAdjustment *adj, gpointer d ) { g_signal_emit_by_name(GNC_FREQUENCY(d), "changed"); } + static void weekly_days_changed( GtkButton *b, gpointer d ) { g_signal_emit_by_name(GNC_FREQUENCY(d), "changed"); } + static void monthly_sel_changed( GtkButton *b, gpointer d ) { g_signal_emit_by_name(GNC_FREQUENCY(d), "changed"); } + static void semimonthly_sel_changed( GtkButton *b, gpointer d ) { g_signal_emit_by_name(GNC_FREQUENCY(d), "changed"); } + static inline guint32 minn( guint32 a, guint32 b ) { return a > b ? b : a; } + static inline guint32 maxn( guint32 a, guint32 b ) { return a > b ? a : b; } + static void freq_combo_changed(GtkComboBox *b, gpointer d) { @@ -285,39 +317,44 @@ freq_combo_changed(GtkComboBox *b, gpointer d) g_signal_emit_by_name(gf, "changed"); } + static void start_date_changed( GNCDateEdit *gde, gpointer d ) { g_signal_emit_by_name(GNC_FREQUENCY(d), "changed"); } -/* ================================================================= */ -/* Relabel some of the labels */ +/************************************** + * Relabel some of the labels * + *************************************/ void gnc_frequency_set_frequency_label_text(GncFrequency *gf, const gchar *txt) { GtkLabel *lbl; if (!gf || !txt) return; - lbl = GTK_LABEL (glade_xml_get_widget (gf->gxml, "freq label")); + lbl = GTK_LABEL (gtk_builder_get_object (gf->builder, "freq_label")); gtk_label_set_text (lbl, txt); } + void gnc_frequency_set_date_label_text(GncFrequency *gf, const gchar *txt) { GtkLabel *lbl; if (!gf || !txt) return; - lbl = GTK_LABEL (glade_xml_get_widget (gf->gxml, "startdate label")); + lbl = GTK_LABEL (gtk_builder_get_object (gf->builder, "startdate_label")); gtk_label_set_text (lbl, txt); } + GtkWidget* gnc_frequency_new_from_recurrence(GList *recurrences, const GDate *start_date) { return gnc_frequency_new(recurrences, start_date); } + GtkWidget* gnc_frequency_new(GList *recurrences, const GDate *start_date) { @@ -327,6 +364,7 @@ gnc_frequency_new(GList *recurrences, const GDate *start_date) return GTK_WIDGET(toRet); } + static void _setup_weekly_recurrence(GncFrequency *gf, Recurrence *r) { @@ -336,7 +374,7 @@ _setup_weekly_recurrence(GncFrequency *gf, Recurrence *r) const char *checkbox_widget_name; GtkWidget *weekday_checkbox; - GtkWidget *multipler_spin = glade_xml_get_widget(gf->gxml, "weekly_spin"); + GtkWidget *multipler_spin = GTK_WIDGET(gtk_builder_get_object (gf->builder, "weekly_spin")); gtk_spin_button_set_value(GTK_SPIN_BUTTON(multipler_spin), multiplier); recurrence_date = recurrenceGetDate(r); @@ -345,10 +383,11 @@ _setup_weekly_recurrence(GncFrequency *gf, Recurrence *r) // this `mod 7' is explicit knowledge of the values of (monday=1)-based // GDateWeekday, vs. our (sunday=0)-based checkbox names array. checkbox_widget_name = CHECKBOX_NAMES[day_of_week % 7]; - weekday_checkbox = glade_xml_get_widget(gf->gxml, checkbox_widget_name); + weekday_checkbox = GTK_WIDGET(gtk_builder_get_object (gf->builder, checkbox_widget_name)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(weekday_checkbox), TRUE); } + static int _get_monthly_combobox_index(Recurrence *r) { @@ -379,12 +418,14 @@ _get_monthly_combobox_index(Recurrence *r) return day_of_month_index; } + void gnc_frequency_setup_recurrence(GncFrequency *gf, GList *recurrences, const GDate *start_date) { gnc_frequency_setup(gf, recurrences, start_date); } + void gnc_frequency_setup(GncFrequency *gf, GList *recurrences, const GDate *start_date) { @@ -425,16 +466,15 @@ gnc_frequency_setup(GncFrequency *gf, GList *recurrences, const GDate *start_dat first = (Recurrence*)g_list_nth_data(recurrences, 0); second = (Recurrence*)g_list_nth_data(recurrences, 1); - multiplier_spin = glade_xml_get_widget(gf->gxml, "semimonthly_spin"); + multiplier_spin = GTK_WIDGET(gtk_builder_get_object (gf->builder, "semimonthly_spin")); gtk_spin_button_set_value(GTK_SPIN_BUTTON(multiplier_spin), recurrenceGetMultiplier(first)); - - dom_combobox = glade_xml_get_widget(gf->gxml, "semimonthly_first"); + dom_combobox = GTK_WIDGET(gtk_builder_get_object (gf->builder, "semimonthly_first")); gtk_combo_box_set_active(GTK_COMBO_BOX(dom_combobox), _get_monthly_combobox_index(first)); - dom_combobox = glade_xml_get_widget(gf->gxml, "semimonthly_first_weekend"); + dom_combobox = GTK_WIDGET(gtk_builder_get_object (gf->builder, "semimonthly_first_weekend")); gtk_combo_box_set_active(GTK_COMBO_BOX(dom_combobox), recurrenceGetWeekendAdjust(first)); - dom_combobox = glade_xml_get_widget(gf->gxml, "semimonthly_second"); + dom_combobox = GTK_WIDGET(gtk_builder_get_object (gf->builder, "semimonthly_second")); gtk_combo_box_set_active(GTK_COMBO_BOX(dom_combobox), _get_monthly_combobox_index(second)); - dom_combobox = glade_xml_get_widget(gf->gxml, "semimonthly_second_weekend"); + dom_combobox = GTK_WIDGET(gtk_builder_get_object (gf->builder, "semimonthly_second_weekend")); gtk_combo_box_set_active(GTK_COMBO_BOX(dom_combobox), recurrenceGetWeekendAdjust(second)); gtk_notebook_set_current_page(gf->nb, PAGE_SEMI_MONTHLY); @@ -472,7 +512,7 @@ gnc_frequency_setup(GncFrequency *gf, GList *recurrences, const GDate *start_dat GtkWidget *spin_button; multiplier = recurrenceGetMultiplier(r); - spin_button = glade_xml_get_widget(gf->gxml, "daily_spin"); + spin_button = GTK_WIDGET(gtk_builder_get_object (gf->builder, "daily_spin")); gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_button), multiplier); made_changes = TRUE; @@ -496,15 +536,15 @@ gnc_frequency_setup(GncFrequency *gf, GList *recurrences, const GDate *start_dat guint multiplier; GtkWidget *multipler_spin, *day_of_month, *weekend_mode; - multipler_spin = glade_xml_get_widget(gf->gxml, "monthly_spin"); + multipler_spin = GTK_WIDGET(gtk_builder_get_object (gf->builder, "monthly_spin")); multiplier = recurrenceGetMultiplier(r); if (recurrenceGetPeriodType(r) == PERIOD_YEAR) multiplier *= 12; gtk_spin_button_set_value(GTK_SPIN_BUTTON(multipler_spin), multiplier); - day_of_month = glade_xml_get_widget(gf->gxml, "monthly_day"); + day_of_month = GTK_WIDGET(gtk_builder_get_object (gf->builder, "monthly_day")); gtk_combo_box_set_active(GTK_COMBO_BOX(day_of_month), _get_monthly_combobox_index(r)); - weekend_mode = glade_xml_get_widget(gf->gxml, "monthly_weekend"); + weekend_mode = GTK_WIDGET(gtk_builder_get_object (gf->builder, "monthly_weekend")); gtk_combo_box_set_active(GTK_COMBO_BOX(weekend_mode), recurrenceGetWeekendAdjust(r)); gtk_notebook_set_current_page(gf->nb, PAGE_MONTHLY); @@ -522,21 +562,23 @@ maybe_signal: g_signal_emit_by_name(gf, "changed"); } + static gint _get_multiplier_from_widget(GncFrequency *gf, char *widget_name) { GtkWidget *multiplier_spin; - multiplier_spin = glade_xml_get_widget(gf->gxml, widget_name); + multiplier_spin = GTK_WIDGET(gtk_builder_get_object (gf->builder, widget_name)); return gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(multiplier_spin)); } + static Recurrence* _get_day_of_month_recurrence(GncFrequency *gf, GDate *start_date, int multiplier, char *combo_name, char *combo_weekend_name) { Recurrence *r; - GtkWidget *day_of_month_combo = glade_xml_get_widget(gf->gxml, combo_name); + GtkWidget *day_of_month_combo = GTK_WIDGET(gtk_builder_get_object (gf->builder, combo_name)); int day_of_month_index = gtk_combo_box_get_active(GTK_COMBO_BOX(day_of_month_combo)); - GtkWidget *weekend_adjust_combo = glade_xml_get_widget(gf->gxml, combo_weekend_name); + GtkWidget *weekend_adjust_combo = GTK_WIDGET(gtk_builder_get_object (gf->builder, combo_weekend_name)); int weekend_adjust = gtk_combo_box_get_active(GTK_COMBO_BOX(weekend_adjust_combo)); GDateWeekday selected_day_of_week; GDate *day_of_week_date; @@ -582,6 +624,7 @@ _get_day_of_month_recurrence(GncFrequency *gf, GDate *start_date, int multiplier return r; } + void gnc_frequency_save_to_recurrence(GncFrequency *gf, GList **recurrences, GDate *out_start_date) { @@ -627,7 +670,7 @@ gnc_frequency_save_to_recurrence(GncFrequency *gf, GList **recurrences, GDate *o GDate *day_of_week_aligned_date; Recurrence *r; const char *day_widget_name = CHECKBOX_NAMES[checkbox_idx]; - GtkWidget *weekday_checkbox = glade_xml_get_widget(gf->gxml, day_widget_name); + GtkWidget *weekday_checkbox = GTK_WIDGET(gtk_builder_get_object (gf->builder, day_widget_name)); if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(weekday_checkbox))) continue; diff --git a/src/gnome-utils/gnc-frequency.h b/src/gnome-utils/gnc-frequency.h index 86c0b49080..a2eef6adc9 100644 --- a/src/gnome-utils/gnc-frequency.h +++ b/src/gnome-utils/gnc-frequency.h @@ -42,12 +42,12 @@ **/ typedef struct _GncFrequency { - GtkVBox widget; + GtkVBox widget; GtkVBox *vb; GtkNotebook *nb; GtkComboBox *freqComboBox; GNCDateEdit *startDate; - GladeXML *gxml; + GtkBuilder *builder; } GncFrequency; typedef struct _GncFrequencyClass diff --git a/src/gnome-utils/gtkbuilder/Makefile.am b/src/gnome-utils/gtkbuilder/Makefile.am index cc7336f538..380d52d979 100644 --- a/src/gnome-utils/gtkbuilder/Makefile.am +++ b/src/gnome-utils/gtkbuilder/Makefile.am @@ -3,6 +3,7 @@ gtkbuilder_DATA = \ dialog-commodity.glade \ dialog-transfer.glade \ gnc-date-format.glade \ + gnc-frequency.glade \ gnc-recurrence.glade EXTRA_DIST = $(gtkbuilder_DATA) diff --git a/src/gnome-utils/gtkbuilder/gnc-frequency.glade b/src/gnome-utils/gtkbuilder/gnc-frequency.glade new file mode 100644 index 0000000000..2c22c8bf46 --- /dev/null +++ b/src/gnome-utils/gtkbuilder/gnc-frequency.glade @@ -0,0 +1,1463 @@ + + + + + + False + This window should never be realized. + + + True + False + + + True + False + + + True + False + 5 + + + True + False + 1 + 5 + Frequency: + right + + + GTK_FILL + + + + + + True + False + 1 + 5 + Start Date: + center + + + 3 + 4 + GTK_FILL + + + + + + True + False + liststore2 + + + + 0 + + + + + 1 + 2 + GTK_FILL + GTK_FILL + + + + + 25 + True + False + 0 + 20 + + + + + + 2 + 3 + GTK_FILL + GTK_FILL + + + + + + + + False + False + 6 + 0 + + + + + True + False + 5 + False + True + + + True + False + Not scheduled + center + + + + + True + False + None + center + + + False + + + + + True + False + True + + + True + False + Select occurrence date above. + center + + + False + False + 0 + + + + + 1 + False + + + + + True + False + Once + center + + + 1 + False + + + + + True + False + 5 + + + True + False + 1 + Every + right + + + False + False + 0 + + + + + True + True + False + False + True + True + adjustment4 + 1 + True + True + + + False + False + 5 + 1 + + + + + True + False + 0 + days. + center + + + False + False + 2 + + + + + 2 + False + + + + + True + False + Daily + center + + + 2 + False + + + + + True + False + + + True + False + + + True + False + 5 + + + True + False + 1 + Every + right + + + False + True + 0 + + + + + True + True + + False + False + True + True + adjustment3 + 1 + + + False + False + 5 + 1 + + + + + True + False + 0 + weeks. + fill + + + True + True + 2 + + + + + False + False + 0 + + + + + True + False + 5 + 0.5 + in + + + True + False + 12 + + + True + False + 2 + 3 + 3 + + + Saturday + True + True + False + False + True + True + + + 2 + 3 + + + + + Friday + True + True + False + False + True + True + + + 1 + 2 + 2 + 3 + + + + + Wednesday + True + True + False + False + True + True + + + 1 + 2 + + + + + Thursday + True + True + False + False + True + True + + + 1 + 2 + 1 + 2 + + + + + Sunday + True + True + False + False + True + True + + + + + Monday + True + True + False + False + True + True + + + 1 + 2 + + + + + Tuesday + True + True + False + False + True + True + + + 2 + 3 + + + + + + + + + + + + + + + True + False + 0 + 0 + Days + + + + + False + False + 1 + + + + + False + False + 0 + + + + + 3 + False + + + + + True + False + Weekly + center + + + 3 + False + + + + + True + False + + + True + False + 5 + 6 + + + True + False + + + True + False + 1 + Every + right + + + False + False + 0 + + + + + True + True + False + False + True + True + adjustment2 + 1 + True + + + False + False + 5 + 1 + + + + + True + False + 0 + months. + + + False + False + 2 + + + + + False + False + 0 + + + + + True + False + + + True + False + 1 + First on the: + right + + + False + False + 0 + + + + + True + False + liststore1 + + + + 0 + + + + + False + False + 1 + + + + + True + False + 1 + except on weekends: + right + + + False + False + 2 + + + + + True + False + liststore7 + + + + 0 + + + + + False + False + 3 + + + + + False + False + 1 + + + + + True + False + + + True + False + 1 + then on the: + right + + + False + False + 0 + + + + + True + False + liststore6 + + + + 0 + + + + + False + False + 1 + + + + + True + False + 1 + except on weekends: + right + + + False + False + 2 + + + + + True + False + liststore5 + + + + 0 + + + + + False + False + 3 + + + + + False + False + 2 + + + + + False + False + 0 + + + + + 4 + False + + + + + True + False + Semi-Monthly + center + + + 4 + False + + + + + True + False + + + True + False + 5 + 6 + + + True + False + + + True + False + 1 + Every + center + + + False + False + 0 + + + + + True + True + False + False + True + True + adjustment1 + 1 + True + True + True + + + False + False + 5 + 1 + + + + + True + False + 0 + months. + center + + + False + False + 2 + + + + + False + False + 0 + + + + + True + False + + + True + False + 1 + On the + right + + + False + False + 0 + + + + + True + False + liststore4 + + + + 0 + + + + + False + False + 5 + 1 + + + + + True + False + 1 + except on weekends: + right + + + False + False + 2 + + + + + True + False + liststore3 + + + + 0 + + + + + False + False + 3 + + + + + False + False + 1 + + + + + False + False + 0 + + + + + 5 + False + + + + + True + False + Monthly + center + + + 5 + False + + + + + False + False + 1 + + + + + + + + + 1 + 100 + 1 + 1 + 10 + + + 1 + 100 + 1 + 1 + 10 + + + 1 + 100 + 1 + 1 + 10 + + + 1 + 731 + 1 + 1 + 10 + + + + + + + + + 1st + + + 2nd + + + 3rd + + + 4th + + + 5th + + + 6th + + + 7th + + + 8th + + + 9th + + + 10th + + + 11th + + + 12th + + + 13th + + + 14th + + + 15th + + + 16th + + + 17th + + + 18th + + + 19th + + + 20th + + + 21st + + + 22nd + + + 23rd + + + 24th + + + 25th + + + 26th + + + 27th + + + 28th + + + 29th + + + 30th + + + 31st + + + Last day of month + + + Last Monday + + + Last Tuesday + + + Last Wednesday + + + Last Thursday + + + Last Friday + + + Last Saturday + + + Last Sunday + + + + + + + + + + + None + + + Once + + + Daily + + + Weekly + + + Semi-Monthly + + + Monthly + + + + + + + + + + + No change + + + Use previous weekday + + + Use next weekday + + + + + + + + + + + 1st + + + 2nd + + + 3rd + + + 4th + + + 5th + + + 6th + + + 7th + + + 8th + + + 9th + + + 10th + + + 11th + + + 12th + + + 13th + + + 14th + + + 15th + + + 16th + + + 17th + + + 18th + + + 19th + + + 20th + + + 21st + + + 22nd + + + 23rd + + + 24th + + + 25th + + + 26th + + + 27th + + + 28th + + + 29th + + + 30th + + + 31st + + + Last day of month + + + Last Monday + + + Last Tuesday + + + Last Wednesday + + + Last Thursday + + + Last Friday + + + Last Saturday + + + Last Sunday + + + 1st Mon + + + 1st Tue + + + 1st Wed + + + 1st Thu + + + 1st Fri + + + 1st Sat + + + 1st Sun + + + 2nd Mon + + + 2nd Tue + + + 2nd Wed + + + 2nd Thu + + + 2nd Fri + + + 2nd Sat + + + 2nd Sun + + + 3rd Mon + + + 3rd Tue + + + 3rd Wed + + + 3rd Thu + + + 3rd Fri + + + 3rd Sat + + + 3rd Sun + + + 4th Mon + + + 4th Tue + + + 4th Wed + + + 4th Thu + + + 4th Fri + + + 4th Sat + + + 4th Sun + + + + + + + + + + + No change + + + Use previous weekday + + + Use next weekday + + + + + + + + + + + 1st + + + 2nd + + + 3rd + + + 4th + + + 5th + + + 6th + + + 7th + + + 8th + + + 9th + + + 10th + + + 11th + + + 12th + + + 13th + + + 14th + + + 15th + + + 16th + + + 17th + + + 18th + + + 19th + + + 20th + + + 21st + + + 22nd + + + 23rd + + + 24th + + + 25th + + + 26th + + + 27th + + + 28th + + + 29th + + + 30th + + + 31st + + + Last day of month + + + Last Monday + + + Last Tuesday + + + Last Wednesday + + + Last Thursday + + + Last Friday + + + Last Saturday + + + Last Sunday + + + + + + + + + + + No change + + + Use previous weekday + + + Use next weekday + + + + diff --git a/src/gnome/dialog-sx-editor.c b/src/gnome/dialog-sx-editor.c index 2a75a30fca..0af2342967 100644 --- a/src/gnome/dialog-sx-editor.c +++ b/src/gnome/dialog-sx-editor.c @@ -1,21 +1,23 @@ /********************************************************************\ * dialog-sx-editor.c : dialog for scheduled transaction editing * * Copyright (C) 2001,2002,2006 Joshua Sled * + * Copyright (C) 2011 Robert Fewell * * * * This program is free software; you can redistribute it and/or * - * modify it under the terms of version 2 and/or version 3 of the GNU General Public * - * License as published by the Free Software Foundation. * - * - * As a special exception, permission is granted to link the binary - * module resultant from this code with the OpenSSL project's - * "OpenSSL" library (or modified versions of it that use the same - * license as the "OpenSSL" library), and distribute the linked - * executable. You must obey the GNU General Public License in all - * respects for all of the code used other than "OpenSSL". If you - * modify this file, you may extend this exception to your version - * of the file, but you are not obligated to do so. If you do not - * wish to do so, delete this exception statement from your version - * of this file. + * modify it under the terms of version 2 and/or version 3 of the * + * GNU General Public License as published by the Free Software * + * Foundation. * + * * + * As a special exception, permission is granted to link the binary * + * module resultant from this code with the OpenSSL project's * + * "OpenSSL" library (or modified versions of it that use the same * + * license as the "OpenSSL" library), and distribute the linked * + * executable. You must obey the GNU General Public License in all * + * respects for all of the code used other than "OpenSSL". If you * + * modify this file, you may extend this exception to your version * + * of the file, but you are not obligated to do so. If you do not * + * wish to do so, delete this exception statement from your version * + * of this file. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * @@ -70,26 +72,10 @@ #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "gnc.gui.sx.editor" +static QofLogModule log_module = GNC_MOD_GUI_SX; + static gint _sx_engine_event_handler_id = -1; -#define SX_EDITOR_GLADE_NAME "Scheduled Transaction Editor" - -#define SXED_WIN_PREFIX "sx_editor_win" -#define SXED_NAME_ENTRY "sxe_name" -#define SXED_LAST_OCCUR_LABEL "last_occur_label" -#define ENABLED_OPT "enabled_opt" -#define AUTOCREATE_OPT "autocreate_opt" -#define NOTIFY_OPT "notify_opt" -#define ADVANCE_OPT "advance_opt" -#define ADVANCE_DAYS_SPIN "advance_days" -#define REMIND_OPT "remind_opt" -#define REMIND_DAYS_SPIN "remind_days" -#define END_DATE_BOX "end_date_hbox" -#define END_SPIN "end_spin" -#define REMAIN_SPIN "remain_spin" - -#define SX_GLADE_FILE "sched-xact.glade" - #define END_NEVER_OPTION 0 #define END_DATE_OPTION 1 #define NUM_OCCUR_OPTION 2 @@ -111,10 +97,13 @@ typedef enum _EndTypeEnum END_OCCUR, } EndType; +typedef enum { NO_END, DATE_END, COUNT_END } END_TYPE; + struct _GncSxEditorDialog { - GladeXML *gxml; GtkWidget *dialog; + GtkBuilder *builder; + GtkNotebook *notebook; SchedXaction *sx; /* If this is a new scheduled transaction or not. */ int newsxP; @@ -156,25 +145,21 @@ struct _GncSxEditorDialog static void schedXact_editor_create_freq_sel( GncSxEditorDialog *sxed ); static void schedXact_editor_create_ledger( GncSxEditorDialog *sxed ); static void schedXact_editor_populate( GncSxEditorDialog * ); - static void gnc_sxed_record_size( GncSxEditorDialog *sxed ); -static void gnc_sxed_get_widgets( GncSxEditorDialog *sxed ); -static void endgroup_rb_toggled( GtkButton *b, gpointer d ); +static void endgroup_rb_toggled_cb( GtkButton *b, gpointer d ); static void set_endgroup_toggle_states( GncSxEditorDialog *sxed, EndType t ); -static void advance_toggle( GtkButton *b, GncSxEditorDialog *sxed ); +static void advance_toggled_cb( GtkButton *b, GncSxEditorDialog *sxed ); +static void remind_toggled_cb( GtkButton *b, GncSxEditorDialog *sxed ); static gboolean gnc_sxed_check_consistent( GncSxEditorDialog *sxed ); static gboolean gnc_sxed_check_changed( GncSxEditorDialog *sxed ); static void gnc_sxed_save_sx( GncSxEditorDialog *sxed ); static void gnc_sxed_freq_changed( GncFrequency *gf, gpointer ud ); -static void sxed_excal_update_adapt( GtkObject *o, gpointer ud ); +static void sxed_excal_update_adapt_cb( GtkObject *o, gpointer ud ); static void gnc_sxed_update_cal(GncSxEditorDialog *sxed); - +static void on_sx_check_toggled (GtkWidget *togglebutton, gpointer user_data); static void gnc_sxed_reg_check_close(GncSxEditorDialog *sxed); - static gboolean sxed_delete_event( GtkWidget *widget, GdkEvent *event, gpointer ud ); - static gboolean sxed_confirmed_cancel( GncSxEditorDialog *sxed ); - static gboolean editor_component_sx_equality( gpointer find_data, gpointer user_data ); @@ -200,6 +185,7 @@ sxed_close_handler(gpointer user_data) /* The data will be cleaned up in the destroy handler. */ } + /** * @return TRUE if the user does want to cancel, FALSE if not. If TRUE is * returned, the register's changes have been cancelled. @@ -226,8 +212,12 @@ sxed_confirmed_cancel(GncSxEditorDialog *sxed) return TRUE; } + +/********************************** + * Dialog Action Button functions * + *********************************/ static void -editor_cancel_button_clicked( GtkButton *b, GncSxEditorDialog *sxed ) +editor_cancel_button_clicked_cb( GtkButton *b, GncSxEditorDialog *sxed ) { /* close */ if (!sxed_confirmed_cancel(sxed)) @@ -237,14 +227,16 @@ editor_cancel_button_clicked( GtkButton *b, GncSxEditorDialog *sxed ) sxed ); } + static void -editor_help_button_clicked(GtkButton *b, GncSxEditorDialog *sxed) +editor_help_button_clicked_cb(GtkButton *b, GncSxEditorDialog *sxed) { gnc_gnome_help(HF_HELP, HL_SXEDITOR); } + static void -editor_ok_button_clicked( GtkButton *b, GncSxEditorDialog *sxed ) +editor_ok_button_clicked_cb( GtkButton *b, GncSxEditorDialog *sxed ) { QofBook *book; SchedXactions *sxes; @@ -269,12 +261,13 @@ editor_ok_button_clicked( GtkButton *b, GncSxEditorDialog *sxed ) sxed ); } -/** + +/************************************************************************* * Checks to see if the SX has been modified from it's previously-saved * state. * @return TRUE if this is a 'new' SX, or if the SX has changed from it's * previous configuration. - **/ + ************************************************************************/ static gboolean gnc_sxed_check_changed( GncSxEditorDialog *sxed ) { @@ -459,16 +452,17 @@ gnc_sxed_check_changed( GncSxEditorDialog *sxed ) } -/** +/***************************************************************************** * Holds the credit- and debit-sum for a given Transaction, as used in * gnc_sxed_check_consistent. - **/ + ****************************************************************************/ typedef struct _txnCreditDebitSums { gnc_numeric creditSum; gnc_numeric debitSum; } txnCreditDebitSums; + static void set_sums_to_zero( gpointer key, @@ -480,6 +474,7 @@ set_sums_to_zero( gpointer key, tcds->debitSum = gnc_numeric_zero(); } + static void check_credit_debit_balance( gpointer key, gpointer val, @@ -515,10 +510,11 @@ check_credit_debit_balance( gpointer key, } } -/** + +/******************************************************************************* * Checks to make sure that the SX is in a reasonable state to save. * @return true if checks out okay, false otherwise. - **/ + ******************************************************************************/ static gboolean gnc_sxed_check_consistent( GncSxEditorDialog *sxed ) { @@ -786,7 +782,7 @@ gnc_sxed_check_consistent( GncSxEditorDialog *sxed ) g_free( name ); } - // @@fixme: similar to below, check the commodities involved, and disallow autocreation + // @@FIXME: similar to below, check the commodities involved, and disallow autocreation { gboolean autocreateState, notifyState; @@ -895,10 +891,11 @@ gnc_sxed_check_consistent( GncSxEditorDialog *sxed ) return TRUE; } -/** + +/****************************************************************************** * Saves the contents of the SX. This assumes that gnc_sxed_check_consistent * has returned true. - **/ + *****************************************************************************/ static void gnc_sxed_save_sx( GncSxEditorDialog *sxed ) { @@ -1018,14 +1015,16 @@ gnc_sxed_save_sx( GncSxEditorDialog *sxed ) gnc_sx_commit_edit( sxed->sx ); } + static void -enabled_toggled( GtkObject *o, GncSxEditorDialog *sxed ) +enabled_toggled_cb( GtkObject *o, GncSxEditorDialog *sxed ) { return; } + static void -autocreate_toggled( GtkObject *o, GncSxEditorDialog *sxed ) +autocreate_toggled_cb( GtkObject *o, GncSxEditorDialog *sxed ) { if ( !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(o)) ) { @@ -1035,25 +1034,27 @@ autocreate_toggled( GtkObject *o, GncSxEditorDialog *sxed ) gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(o) ) ); } -static void -advance_toggle( GtkButton *o, GncSxEditorDialog *sxed ) -{ - gchar *spinName; - GtkWidget *spin; - spinName = (gchar*)g_object_get_data( G_OBJECT(o), "whichOneAmI" ); - spin = glade_xml_get_widget( sxed->gxml, spinName ); - if ( !spin ) - { - g_critical("Error getting widget with name \"%s\"", spinName); - return; - } - gtk_widget_set_sensitive( spin, - gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(o) ) ); - /* FIXME: this doesn't do what we want... :( */ - gtk_editable_set_editable( GTK_EDITABLE(spin), TRUE ); +static void +advance_toggled_cb( GtkButton *o, GncSxEditorDialog *sxed ) +{ + + gtk_widget_set_sensitive( GTK_WIDGET(sxed->advanceSpin), + gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(sxed->advanceOpt) ) ); + gtk_editable_set_editable( GTK_EDITABLE(sxed->advanceSpin), TRUE ); } + +static void +remind_toggled_cb( GtkButton *o, GncSxEditorDialog *sxed ) +{ + + gtk_widget_set_sensitive( GTK_WIDGET(sxed->remindSpin), + gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(sxed->remindOpt) ) ); + gtk_editable_set_editable( GTK_EDITABLE(sxed->remindSpin), TRUE ); +} + + /* Local destruction of dialog */ static void scheduledxaction_editor_dialog_destroy(GtkObject *object, gpointer data) @@ -1093,6 +1094,7 @@ scheduledxaction_editor_dialog_destroy(GtkObject *object, gpointer data) g_free (sxed); } + static gboolean sxed_delete_event( GtkWidget *widget, GdkEvent *event, gpointer ud ) @@ -1113,53 +1115,16 @@ sxed_delete_event( GtkWidget *widget, GdkEvent *event, gpointer ud ) return FALSE; } -static -void -gnc_sxed_get_widgets( GncSxEditorDialog *sxed ) -{ - GtkWidget *w; - - w = glade_xml_get_widget( sxed->gxml, SXED_NAME_ENTRY ); - sxed->nameEntry = GTK_EDITABLE(w); - w = glade_xml_get_widget( sxed->gxml, SXED_LAST_OCCUR_LABEL ); - sxed->lastOccurLabel = GTK_LABEL(w); - w = glade_xml_get_widget( sxed->gxml, ENABLED_OPT ); - sxed->enabledOpt = GTK_TOGGLE_BUTTON(w); - w = glade_xml_get_widget( sxed->gxml, AUTOCREATE_OPT ); - sxed->autocreateOpt = GTK_TOGGLE_BUTTON(w); - w = glade_xml_get_widget( sxed->gxml, NOTIFY_OPT ); - sxed->notifyOpt = GTK_TOGGLE_BUTTON(w); - w = glade_xml_get_widget( sxed->gxml, ADVANCE_OPT ); - sxed->advanceOpt = GTK_TOGGLE_BUTTON(w); - w = glade_xml_get_widget( sxed->gxml, ADVANCE_DAYS_SPIN ); - sxed->advanceSpin = GTK_SPIN_BUTTON(w); - w = glade_xml_get_widget( sxed->gxml, REMIND_OPT ); - sxed->remindOpt = GTK_TOGGLE_BUTTON(w); - w = glade_xml_get_widget( sxed->gxml, REMIND_DAYS_SPIN ); - sxed->remindSpin = GTK_SPIN_BUTTON(w); - - w = glade_xml_get_widget( sxed->gxml, "rb_enddate" ); - sxed->optEndDate = GTK_TOGGLE_BUTTON(w); - - w = glade_xml_get_widget( sxed->gxml, "rb_noend" ); - sxed->optEndNone = GTK_TOGGLE_BUTTON(w); - - w = glade_xml_get_widget( sxed->gxml, "rb_num_occur" ); - sxed->optEndCount = GTK_TOGGLE_BUTTON(w); - - w = glade_xml_get_widget( sxed->gxml, END_SPIN ); - sxed->endCountSpin = GTK_ENTRY(w); - - w = glade_xml_get_widget( sxed->gxml, REMAIN_SPIN ); - sxed->endRemainSpin = GTK_ENTRY(w); - -} +/************************************* + * Create the Schedule Editor Dialog * + ************************************/ GncSxEditorDialog * gnc_ui_scheduled_xaction_editor_dialog_create(SchedXaction *sx, gboolean newSX) { GncSxEditorDialog *sxed; + GtkBuilder *builder; GtkWidget *button; int i; GList *dlgExists = NULL; @@ -1172,22 +1137,18 @@ gnc_ui_scheduled_xaction_editor_dialog_create(SchedXaction *sx, gpointer objectData; } widgets[] = { - { "ok_button", "clicked", editor_ok_button_clicked, NULL }, - { "cancel_button", "clicked", editor_cancel_button_clicked, NULL }, - { "help_button", "clicked", editor_help_button_clicked, NULL }, - - { "rb_noend", "toggled", endgroup_rb_toggled, GINT_TO_POINTER(END_NEVER_OPTION) }, - { "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_SPIN , "value-changed", sxed_excal_update_adapt, NULL }, - - { ENABLED_OPT, "toggled", enabled_toggled, NULL }, - { AUTOCREATE_OPT, "toggled", autocreate_toggled, NULL }, - { ADVANCE_OPT, "toggled", advance_toggle, (gpointer)ADVANCE_DAYS_SPIN }, - { REMIND_OPT, "toggled", advance_toggle, (gpointer)REMIND_DAYS_SPIN }, - - { NULL, NULL, NULL, NULL } + { "ok_button", "clicked", editor_ok_button_clicked_cb, NULL }, + { "cancel_button", "clicked", editor_cancel_button_clicked_cb, NULL }, + { "help_button", "clicked", editor_help_button_clicked_cb, NULL }, + { "rb_noend", "toggled", endgroup_rb_toggled_cb, GINT_TO_POINTER(END_NEVER_OPTION) }, + { "rb_enddate", "toggled", endgroup_rb_toggled_cb, GINT_TO_POINTER(END_DATE_OPTION) }, + { "rb_num_occur", "toggled", endgroup_rb_toggled_cb, GINT_TO_POINTER(NUM_OCCUR_OPTION) }, + { "remain_spin" , "value-changed", sxed_excal_update_adapt_cb, NULL }, + { "enabled_opt", "toggled", enabled_toggled_cb, NULL }, + { "autocreate_opt", "toggled", autocreate_toggled_cb, NULL }, + { "advance_opt", "toggled", advance_toggled_cb, NULL }, + { "remind_opt", "toggled", remind_toggled_cb, NULL }, + { NULL, NULL, NULL, NULL } }; dlgExists = gnc_find_gui_components( DIALOG_SCHEDXACTION_EDITOR_CM_CLASS, @@ -1202,35 +1163,50 @@ gnc_ui_scheduled_xaction_editor_dialog_create(SchedXaction *sx, return sxed; } - sxed = g_new0( GncSxEditorDialog, 1 ); - sxed->gxml = gnc_glade_xml_new( SX_GLADE_FILE, - SX_EDITOR_GLADE_NAME ); - sxed->dialog = glade_xml_get_widget( sxed->gxml, SX_EDITOR_GLADE_NAME ); + sxed = g_new0( GncSxEditorDialog, 1 ); sxed->sx = sx; sxed->newsxP = newSX; + + /* Load up Glade file */ + builder = gtk_builder_new(); + gnc_builder_add_from_file (builder, "dialog-sx.glade", "advance_days_adj"); + gnc_builder_add_from_file (builder, "dialog-sx.glade", "remind_days_adj"); + gnc_builder_add_from_file (builder, "dialog-sx.glade", "end_spin_adj"); + gnc_builder_add_from_file (builder, "dialog-sx.glade", "remain_spin_adj"); + gnc_builder_add_from_file (builder, "dialog-sx.glade", "Scheduled Transaction Editor"); + + sxed->builder = builder; + + /* Connect the Widgets */ + sxed->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Scheduled Transaction Editor")); + sxed->notebook = GTK_NOTEBOOK(gtk_builder_get_object (builder, "editor_notebook")); + sxed->nameEntry = GTK_EDITABLE(gtk_builder_get_object (builder, "sxe_name")); + sxed->enabledOpt = GTK_TOGGLE_BUTTON(gtk_builder_get_object (builder, "enabled_opt")); + sxed->autocreateOpt = GTK_TOGGLE_BUTTON(gtk_builder_get_object (builder, "autocreate_opt")); + sxed->notifyOpt = GTK_TOGGLE_BUTTON(gtk_builder_get_object (builder, "notify_opt")); + sxed->advanceOpt = GTK_TOGGLE_BUTTON(gtk_builder_get_object (builder, "advance_opt")); + sxed->advanceSpin = GTK_SPIN_BUTTON(gtk_builder_get_object (builder, "advance_days")); + sxed->remindOpt = GTK_TOGGLE_BUTTON(gtk_builder_get_object (builder, "remind_opt")); + sxed->remindSpin = GTK_SPIN_BUTTON(gtk_builder_get_object (builder, "remind_days")); + sxed->lastOccurLabel = GTK_LABEL(gtk_builder_get_object (builder, "last_occur_label")); + sxed->optEndNone = GTK_TOGGLE_BUTTON(gtk_builder_get_object (builder, "rb_noend")); + sxed->optEndDate = GTK_TOGGLE_BUTTON(gtk_builder_get_object (builder, "rb_enddate")); + sxed->optEndCount = GTK_TOGGLE_BUTTON(gtk_builder_get_object (builder, "rb_num_occur")); + sxed->endCountSpin = GTK_ENTRY(gtk_builder_get_object (builder, "end_spin")); + sxed->endRemainSpin = GTK_ENTRY(gtk_builder_get_object (builder, "remain_spin")); + /* Setup the end-date GNC widget */ { - GtkWidget *endDateBox = - glade_xml_get_widget( sxed->gxml, END_DATE_BOX ); - sxed->endDateEntry = - GNC_DATE_EDIT(gnc_date_edit_new( time(NULL), - FALSE, FALSE )); + GtkWidget *endDateBox = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_hbox")); + sxed->endDateEntry = GNC_DATE_EDIT(gnc_date_edit_new( time(NULL), FALSE, FALSE )); gtk_widget_show(GTK_WIDGET(sxed->endDateEntry)); - g_signal_connect( sxed->endDateEntry, - "date-changed", - G_CALLBACK( sxed_excal_update_adapt ), - sxed ); - gtk_box_pack_start( GTK_BOX(endDateBox), - GTK_WIDGET(sxed->endDateEntry), + g_signal_connect( sxed->endDateEntry, "date-changed", + G_CALLBACK( sxed_excal_update_adapt_cb ), sxed ); + gtk_box_pack_start( GTK_BOX(endDateBox), GTK_WIDGET(sxed->endDateEntry), TRUE, TRUE, 0 ); } - /* NOTE: this must occur before processing the widget list, defined - * above, so the gpointers stored with the advance_ and remind_opts - * are correct. */ - gnc_sxed_get_widgets( sxed ); - gnc_register_gui_component( DIALOG_SCHEDXACTION_EDITOR_CM_CLASS, NULL, /* no refresh handler */ sxed_close_handler, @@ -1244,7 +1220,7 @@ gnc_ui_scheduled_xaction_editor_dialog_create(SchedXaction *sx, for ( i = 0; widgets[i].name != NULL; i++ ) { - button = glade_xml_get_widget( sxed->gxml, widgets[i].name ); + button = GTK_WIDGET(gtk_builder_get_object (builder, widgets[i].name )); if ( widgets[i].objectData != NULL ) { g_object_set_data( G_OBJECT(button), "whichOneAmI", @@ -1254,46 +1230,47 @@ gnc_ui_scheduled_xaction_editor_dialog_create(SchedXaction *sx, G_CALLBACK( widgets[i].fn ), sxed ); } - /* For some reason the Glade-specified sensitivity settings are not - * being honored... ? */ + /* Set sensitivity settings */ 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->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 ); /* Allow resize */ gtk_window_set_resizable (GTK_WINDOW(sxed->dialog), TRUE); - gnc_restore_window_size(SXED_GCONF_SECTION, GTK_WINDOW(sxed->dialog)); - /* create the frequency-selection macrowidget and example - * [dense-]calendar. */ + /* create the frequency-selection widget and example [dense-]calendar. */ schedXact_editor_create_freq_sel( sxed ); + /* create the template-transaction ledger window */ schedXact_editor_create_ledger( sxed ); + /* populate */ schedXact_editor_populate( sxed ); /* Do not call show_all here. Screws up the gtkuimanager code */ gtk_widget_show(sxed->dialog); - - gtk_notebook_set_page( - GTK_NOTEBOOK(glade_xml_get_widget(sxed->gxml, "editor_notebook")), 0); + gtk_notebook_set_page(GTK_NOTEBOOK(sxed->notebook), 0); /* Refresh the cal and the ledger */ gtk_widget_queue_resize( GTK_WIDGET( sxed->example_cal ) ); + gnc_ledger_display_refresh( sxed->ledger ); /* Move keyboard focus to the name entry */ gtk_widget_grab_focus(GTK_WIDGET(sxed->nameEntry)); + gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, sxed); + g_object_unref(G_OBJECT(builder)); + return sxed; } + static void gnc_sxed_record_size( GncSxEditorDialog *sxed ) @@ -1301,13 +1278,15 @@ gnc_sxed_record_size( GncSxEditorDialog *sxed ) gnc_save_window_size( SXED_GCONF_SECTION, GTK_WINDOW(sxed->dialog) ); } + static void schedXact_editor_create_freq_sel( GncSxEditorDialog *sxed ) { GtkBox *b; - b = GTK_BOX(glade_xml_get_widget( sxed->gxml, "gncfreq_hbox" )); + b = GTK_BOX(gtk_builder_get_object (sxed->builder, "gncfreq_hbox")); + sxed->gncfreq = GNC_FREQUENCY(gnc_frequency_new_from_recurrence(gnc_sx_get_schedule(sxed->sx), xaccSchedXactionGetStartDate(sxed->sx))); @@ -1317,7 +1296,7 @@ schedXact_editor_create_freq_sel( GncSxEditorDialog *sxed ) sxed ); gtk_container_add( GTK_CONTAINER(b), GTK_WIDGET(sxed->gncfreq) ); - b = GTK_BOX(glade_xml_get_widget( sxed->gxml, "example_cal_hbox" )); + b = GTK_BOX(gtk_builder_get_object (sxed->builder, "example_cal_hbox" )); sxed->dense_cal_model = gnc_dense_cal_store_new(EX_CAL_NUM_MONTHS * 31); sxed->example_cal = GNC_DENSE_CAL(gnc_dense_cal_new_with_model(GNC_DENSE_CAL_MODEL(sxed->dense_cal_model))); g_assert(sxed->example_cal); @@ -1327,6 +1306,7 @@ schedXact_editor_create_freq_sel( GncSxEditorDialog *sxed ) gtk_widget_show( GTK_WIDGET(sxed->example_cal) ); } + static void schedXact_editor_create_ledger( GncSxEditorDialog *sxed ) @@ -1342,7 +1322,7 @@ schedXact_editor_create_ledger( GncSxEditorDialog *sxed ) splitreg = gnc_ledger_display_get_split_register( sxed->ledger ); /* First the embedded window */ - main_vbox = glade_xml_get_widget( sxed->gxml, "register_vbox" ); + main_vbox = GTK_WIDGET(gtk_builder_get_object (sxed->builder, "register_vbox" )); sxed->embed_window = gnc_embedded_window_new("SXWindowActions", gnc_sxed_menu_entries, @@ -1373,6 +1353,7 @@ schedXact_editor_create_ledger( GncSxEditorDialog *sxed ) gnc_split_register_show_present_divider( splitreg, FALSE ); } + static void schedXact_editor_populate( GncSxEditorDialog *sxed ) @@ -1460,7 +1441,6 @@ schedXact_editor_populate( GncSxEditorDialog *sxed ) } gtk_toggle_button_set_active( sxed->notifyOpt, notifyState ); - /* Do days-in-advance-to-create widget[s] setup. */ if ( sxed->newsxP ) { @@ -1520,6 +1500,7 @@ schedXact_editor_populate( GncSxEditorDialog *sxed ) gnc_sxed_update_cal(sxed); } + static void set_endgroup_toggle_states( GncSxEditorDialog *sxed, EndType type ) @@ -1529,9 +1510,10 @@ set_endgroup_toggle_states( GncSxEditorDialog *sxed, EndType type ) gtk_widget_set_sensitive( GTK_WIDGET(sxed->endRemainSpin), (type == END_OCCUR) ); } + static void -endgroup_rb_toggled( GtkButton *b, gpointer d ) +endgroup_rb_toggled_cb( GtkButton *b, gpointer d ) { /* figure out which one */ GncSxEditorDialog *sxed; @@ -1555,10 +1537,10 @@ endgroup_rb_toggled( GtkButton *b, gpointer d ) g_critical( "Unknown id %d", id ); break; } - gnc_sxed_update_cal(sxed); } + /********************************************************************\ * gnc_register_check_close * * * @@ -1597,6 +1579,7 @@ gnc_sxed_reg_check_close(GncSxEditorDialog *sxed) } } + static gboolean editor_component_sx_equality( gpointer find_data, gpointer user_data ) @@ -1604,8 +1587,9 @@ editor_component_sx_equality( gpointer find_data, return ( (SchedXaction*)find_data == ((GncSxEditorDialog*)user_data)->sx ); } - +/* typedef enum { NO_END, DATE_END, COUNT_END } END_TYPE; +*/ static void gnc_sxed_update_cal(GncSxEditorDialog *sxed) @@ -1677,21 +1661,22 @@ cleanup: recurrenceListFree(&recurrences); } + static void gnc_sxed_freq_changed(GncFrequency *gf, gpointer ud) { gnc_sxed_update_cal((GncSxEditorDialog*)ud); } + static void -sxed_excal_update_adapt(GtkObject *o, gpointer ud) +sxed_excal_update_adapt_cb(GtkObject *o, gpointer ud) { gnc_sxed_update_cal((GncSxEditorDialog*)ud); } -void on_sx_check_toggled (GtkWidget *togglebutton, gpointer user_data); -void +static void on_sx_check_toggled (GtkWidget *togglebutton, gpointer user_data) { @@ -1710,7 +1695,7 @@ on_sx_check_toggled (GtkWidget *togglebutton, /* ------------------------------------------------------------ */ -/* sx app engine; move to somewhere appropriate. :/ */ +/* sx app engine; move to somewhere appropriate. :/ */ typedef struct _acct_deletion_handler_data { @@ -1718,6 +1703,7 @@ typedef struct _acct_deletion_handler_data GtkWidget *dialog; } acct_deletion_handler_data; + static void _open_editors(GtkDialog *dialog, gint response_code, gpointer data) { @@ -1736,6 +1722,7 @@ _open_editors(GtkDialog *dialog, gint response_code, gpointer data) g_free(adhd); } + static void _sx_engine_event_handler(QofInstance *ent, QofEventId event_type, gpointer user_data, gpointer evt_data) { @@ -1757,16 +1744,19 @@ _sx_engine_event_handler(QofInstance *ent, QofEventId event_type, gpointer user_ { GList *sx_iter; acct_deletion_handler_data *data; - GladeXML *xml; + GtkBuilder *builder; GtkWidget *dialog; GtkListStore *name_list; GtkTreeView *list; GtkTreeViewColumn *name_column; GtkCellRenderer *renderer; - xml = gnc_glade_xml_new("sched-xact.glade", "Account Deletion"); - dialog = glade_xml_get_widget(xml, "Account Deletion"); - list = GTK_TREE_VIEW(glade_xml_get_widget(xml, "sx_list")); + builder = gtk_builder_new(); + gnc_builder_add_from_file (builder, "dialog-sx.glade", "Account Deletion"); + + dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Account Deletion")); + + list = GTK_TREE_VIEW(gtk_builder_get_object (builder, "sx_list")); data = (acct_deletion_handler_data*)g_new0(acct_deletion_handler_data, 1); data->dialog = dialog; @@ -1796,9 +1786,12 @@ _sx_engine_event_handler(QofInstance *ent, QofEventId event_type, gpointer user_ G_CALLBACK(_open_editors), data); gtk_widget_show_all(GTK_WIDGET(dialog)); + gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, data); + g_object_unref(G_OBJECT(builder)); } } + void gnc_ui_sx_initialize (void) { @@ -1806,7 +1799,9 @@ gnc_ui_sx_initialize (void) gnc_hook_add_dangler(HOOK_BOOK_OPENED, (GFunc)gnc_sx_sxsincelast_book_opened, NULL); - gnc_preferences_add_page (SX_GLADE_FILE, + + /* Add page to preferences page for Sheduled Transactions */ + gnc_preferences_add_page ("sched-xact.glade", "sx_prefs", _("Scheduled Transactions")); } diff --git a/src/gnome/dialog-sx-editor.h b/src/gnome/dialog-sx-editor.h index 32946bca4f..2eb4a97df6 100644 --- a/src/gnome/dialog-sx-editor.h +++ b/src/gnome/dialog-sx-editor.h @@ -3,8 +3,9 @@ * Copyright (C) 2001,2006 Joshua Sled * * * * This program is free software; you can redistribute it and/or * - * modify it under the terms of version 2 and/or version 3 of the GNU General Public * - * License as published by the Free Software Foundation. * + * modify it under the terms of version 2 and/or version 3 of the * + * GNU General Public License as published by the Free Software * + * Foundation. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * diff --git a/src/gnome/dialog-sx-from-trans.c b/src/gnome/dialog-sx-from-trans.c index f4bed2b202..b1266a7c50 100644 --- a/src/gnome/dialog-sx-from-trans.c +++ b/src/gnome/dialog-sx-from-trans.c @@ -4,6 +4,7 @@ * Copyright (C) 2001 Robert Merkel * * Copyright (C) 2001 Joshua Sled * * Copyright (c) 2006 David Hampton * + * Copyright (c) 2011 Robert Fewell * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * @@ -45,23 +46,6 @@ #include #include -#define SX_GLADE_FILE "sched-xact.glade" -#define SXFTD_DIALOG_GLADE_NAME "sx_from_real_trans" -#define SXFTD_OK_BUTTON "ok_button" -#define SXFTD_ADVANCED_BUTTON "advanced_button" -#define SXFTD_CANCEL_BUTTON "cancel_button" -#define SXFTD_NEVER_END_BUTTON "never_end_button" -#define SXFTD_END_ON_DATE_BUTTON "end_on_date_button" -#define SXFTD_N_OCCURRENCES_BUTTON "n_occurrences_button" -#define SXFTD_PARAM_TABLE "param_table" -#define SXFTD_NAME_ENTRY "name_entry" -#define SXFTD_N_OCCURRENCES_ENTRY "n_occurrences_entry" -#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" -#define SXFTD_END_DATE_BOX "end_date_hbox" - #define SXFTD_ERRNO_UNBALANCED_XACTION 3 #define SXFTD_ERRNO_OPEN_XACTION -3 @@ -70,11 +54,11 @@ #define SXFTD_RESPONSE_ADVANCED 100 /* 'Advanced' button response code */ -static QofLogModule log_module = GNC_MOD_GUI_SX; - #undef G_LOG_DOMAIN #define G_LOG_DOMAIN GNC_MOD_GUI_SX +static QofLogModule log_module = GNC_MOD_GUI_SX; + 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); @@ -91,8 +75,16 @@ typedef enum { FREQ_DAILY = 0, /* I know the =0 is redundant, but I'm using typedef struct { - GladeXML *gxml; + GtkBuilder *builder; GtkWidget *dialog; + GtkEntry *name; + GtkComboBox *freq_combo; + + GtkToggleButton *ne_but; + GtkToggleButton *ed_but; + GtkToggleButton *oc_but; + GtkEntry *n_occurences; + Transaction *trans; SchedXaction *sx; @@ -131,11 +123,11 @@ sxfti_attach_callbacks(SXFromTransInfo *sxfti) { /* Whenever any of the controls change, we want to update the * calendar. */ - { SXFTD_NEVER_END_BUTTON, "clicked", sxftd_update_excal_adapt }, - { SXFTD_END_ON_DATE_BUTTON, "clicked", sxftd_update_excal_adapt }, - { SXFTD_N_OCCURRENCES_BUTTON, "clicked", sxftd_update_excal_adapt }, - { SXFTD_N_OCCURRENCES_ENTRY, "changed", sxftd_update_excal_adapt }, - { NULL, NULL, NULL } + { "never_end_button", "clicked", sxftd_update_excal_adapt }, + { "end_on_date_button", "clicked", sxftd_update_excal_adapt }, + { "n_occurrences_button", "clicked", sxftd_update_excal_adapt }, + { "n_occurrences_entry", "changed", sxftd_update_excal_adapt }, + { NULL, NULL, NULL } }; int i; @@ -143,7 +135,7 @@ sxfti_attach_callbacks(SXFromTransInfo *sxfti) GtkWidget *w; for (i = 0; callbacks[i].name != NULL; i++) { - w = glade_xml_get_widget(sxfti->gxml, callbacks[i].name); + w = GTK_WIDGET(gtk_builder_get_object(sxfti->builder, callbacks[i].name)); g_signal_connect (GTK_OBJECT(w), callbacks[i].signal, G_CALLBACK(callbacks[i].handlerFn), @@ -160,21 +152,18 @@ static getEndTuple sxftd_get_end_info(SXFromTransInfo *sxfti) { getEndTuple retval; - GtkWidget *w; retval.type = BAD_END; g_date_clear( &(retval.end_date), 1 ); retval.n_occurrences = 0; - w = glade_xml_get_widget(sxfti->gxml, SXFTD_NEVER_END_BUTTON); - if (gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(w))) + if (gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(sxfti->ne_but))) { retval.type = NEVER_END; return retval; } - w = glade_xml_get_widget(sxfti->gxml, SXFTD_END_ON_DATE_BUTTON); - if (gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(w))) + if (gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(sxfti->ed_but))) { time_t end_tt; retval.type = END_ON_DATE; @@ -184,14 +173,12 @@ sxftd_get_end_info(SXFromTransInfo *sxfti) return retval; } - w = glade_xml_get_widget(sxfti->gxml, SXFTD_N_OCCURRENCES_BUTTON); - if (gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(w) )) + if (gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(sxfti->oc_but) )) { gchar *text, *endptr; guint n_occs; - w = glade_xml_get_widget(sxfti->gxml, SXFTD_N_OCCURRENCES_ENTRY); - text = gtk_editable_get_chars(GTK_EDITABLE(w), 0, -1); + text = gtk_editable_get_chars(GTK_EDITABLE(sxfti->n_occurences), 0, -1); if (text == NULL || strlen(text) == 0) { n_occs = 0; @@ -204,17 +191,12 @@ sxftd_get_end_info(SXFromTransInfo *sxfti) n_occs = -1; } } - g_free(text); - if (n_occs > 0) - { - retval.type = END_AFTER_N_OCCS; - retval.n_occurrences = n_occs; - return retval; - } + retval.type = END_AFTER_N_OCCS; + retval.n_occurrences = n_occs; + return retval; } - return retval; } @@ -294,6 +276,7 @@ sxftd_add_template_trans(SXFromTransInfo *sxfti) return 0; } + static void sxftd_update_schedule( SXFromTransInfo *sxfti, GDate *date, GList **recurrences) { @@ -302,8 +285,8 @@ sxftd_update_schedule( SXFromTransInfo *sxfti, GDate *date, GList **recurrences) /* Note that we make the start date the *NEXT* instance, not the * present one. */ - w = glade_xml_get_widget(sxfti->gxml, SXFTD_FREQ_COMBO_BOX); - index = gtk_combo_box_get_active(GTK_COMBO_BOX(w)); + + index = gtk_combo_box_get_active(GTK_COMBO_BOX(sxfti->freq_combo)); switch (index) { @@ -346,6 +329,7 @@ sxftd_update_schedule( SXFromTransInfo *sxfti, GDate *date, GList **recurrences) } } + static gint sxftd_init( SXFromTransInfo *sxfti ) { @@ -370,13 +354,30 @@ sxftd_init( SXFromTransInfo *sxfti ) return SXFTD_ERRNO_OPEN_XACTION; } + /* Setup Widgets */ + { + sxfti->ne_but = GTK_TOGGLE_BUTTON(gtk_builder_get_object(sxfti->builder, "never_end_button")); + sxfti->ed_but = GTK_TOGGLE_BUTTON(gtk_builder_get_object(sxfti->builder, "end_on_date_button")); + sxfti->oc_but = GTK_TOGGLE_BUTTON(gtk_builder_get_object(sxfti->builder, "n_occurrences_button")); + sxfti->n_occurences = GTK_ENTRY(gtk_builder_get_object(sxfti->builder, "n_occurrences_entry")); + } + + /* Get the name from the transaction, try that as the initial SX name. */ + transName = xaccTransGetDescription( sxfti->trans ); + xaccSchedXactionSetName( sxfti->sx, transName ); + + sxfti->name = GTK_ENTRY(gtk_builder_get_object(sxfti->builder, "name_entry" )); + pos = 0; + gtk_editable_insert_text( GTK_EDITABLE(sxfti->name), transName, + (strlen(transName) * sizeof(char)), &pos ); + sxfti_attach_callbacks(sxfti); /* Setup the example calendar and related data structures. */ { int num_marks = SXFTD_EXCAL_NUM_MONTHS * 31; - w = GTK_WIDGET(glade_xml_get_widget( sxfti->gxml, SXFTD_EX_CAL_FRAME )); + w = GTK_WIDGET(gtk_builder_get_object(sxfti->builder, "ex_cal_frame" )); sxfti->dense_cal_model = gnc_dense_cal_store_new(num_marks); sxfti->example_cal = GNC_DENSE_CAL(gnc_dense_cal_new_with_model(GNC_DENSE_CAL_MODEL(sxfti->dense_cal_model))); g_object_ref_sink(sxfti->example_cal); @@ -389,8 +390,7 @@ sxftd_init( SXFromTransInfo *sxfti ) /* Setup the start and end dates as GNCDateEdits */ { - GtkWidget *paramTable = glade_xml_get_widget( sxfti->gxml, - SXFTD_PARAM_TABLE ); + GtkWidget *paramTable = GTK_WIDGET(gtk_builder_get_object(sxfti->builder, "param_table" )); sxfti->startDateGDE = GNC_DATE_EDIT( gnc_date_edit_new( time( NULL ), FALSE, FALSE ) ); @@ -405,31 +405,25 @@ sxftd_init( SXFromTransInfo *sxfti ) sxfti ); } { - GtkWidget *endDateBox = glade_xml_get_widget( sxfti->gxml, - SXFTD_END_DATE_BOX ); + GtkWidget *endDateBox = GTK_WIDGET(gtk_builder_get_object(sxfti->builder, "end_date_hbox" )); sxfti->endDateGDE = GNC_DATE_EDIT( gnc_date_edit_new( time( NULL ), FALSE, FALSE ) ); gtk_box_pack_start( GTK_BOX( endDateBox ), GTK_WIDGET( sxfti->endDateGDE ), - FALSE, TRUE, 0 ); + TRUE, TRUE, 0 ); g_signal_connect( sxfti->endDateGDE, "date-changed", G_CALLBACK( sxftd_update_excal_adapt ), sxfti ); } - /* Get the name from the transaction, try that as the initial SX name. */ - transName = xaccTransGetDescription( sxfti->trans ); - xaccSchedXactionSetName( sxfti->sx, transName ); - /* Setup the initial start date for user display/confirmation */ /* 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", + sxfti->freq_combo = GTK_COMBO_BOX(gtk_builder_get_object(sxfti->builder, "freq_combo_box")); + gtk_combo_box_set_active(GTK_COMBO_BOX(sxfti->freq_combo), 0); + g_signal_connect( sxfti->freq_combo, "changed", G_CALLBACK(sxftd_freq_combo_changed), sxfti ); sxftd_update_schedule( sxfti, &date, &schedule); @@ -442,12 +436,7 @@ sxftd_init( SXFromTransInfo *sxfti ) g_free( tmpTm ); gnc_date_edit_set_time( sxfti->startDateGDE, start_tt ); - w = glade_xml_get_widget( sxfti->gxml, SXFTD_NAME_ENTRY ); - pos = 0; - gtk_editable_insert_text( GTK_EDITABLE(w), transName, - (strlen(transName) * sizeof(char)), &pos ); - - g_signal_connect( GTK_OBJECT(w), "destroy", + g_signal_connect( GTK_OBJECT(sxfti->name), "destroy", G_CALLBACK(sxftd_destroy), sxfti ); @@ -456,6 +445,7 @@ sxftd_init( SXFromTransInfo *sxfti ) return 0; } + static guint sxftd_compute_sx(SXFromTransInfo *sxfti) { @@ -469,8 +459,8 @@ sxftd_compute_sx(SXFromTransInfo *sxfti) SchedXaction *sx = sxfti->sx; /* get the name */ - w = glade_xml_get_widget(sxfti->gxml, SXFTD_NAME_ENTRY); - name = gtk_editable_get_chars(GTK_EDITABLE(w), 0, -1); + name = gtk_editable_get_chars(GTK_EDITABLE(sxfti->name), 0, -1); + xaccSchedXactionSetName(sx, name); g_free(name); @@ -536,6 +526,7 @@ sxftd_compute_sx(SXFromTransInfo *sxfti) return sxftd_errno; } + static void sxftd_close(SXFromTransInfo *sxfti, gboolean delete_sx) { @@ -549,6 +540,7 @@ sxftd_close(SXFromTransInfo *sxfti, gboolean delete_sx) gtk_widget_destroy (GTK_WIDGET (sxfti->dialog)); } + static void sxftd_ok_clicked(SXFromTransInfo *sxfti) { @@ -578,6 +570,7 @@ sxftd_ok_clicked(SXFromTransInfo *sxfti) return; } + /** * Update start date... right now we always base this off the transaction * start date, but ideally we want to respect what the user has in the field, @@ -609,6 +602,7 @@ sxftd_freq_combo_changed( GtkWidget *w, gpointer user_data ) sxftd_update_example_cal( sxfti ); } + static void sxftd_advanced_clicked(SXFromTransInfo *sxfti) { @@ -637,6 +631,7 @@ sxftd_advanced_clicked(SXFromTransInfo *sxfti) sxftd_close(sxfti, FALSE); } + static void sxftd_destroy( GtkWidget *w, gpointer user_data ) { @@ -652,11 +647,10 @@ sxftd_destroy( GtkWidget *w, gpointer user_data ) g_object_unref(G_OBJECT(sxfti->dense_cal_model)); g_object_unref(G_OBJECT(sxfti->example_cal)); - /* FIXME: do we need to clean up the GladeXML pointer? */ - g_free(sxfti); } + static void gnc_sx_trans_window_response_cb (GtkDialog *dialog, gint response, @@ -685,6 +679,7 @@ gnc_sx_trans_window_response_cb (GtkDialog *dialog, LEAVE(" "); } + /** * Update the example calendar; make sure to take into account the end * specification. @@ -722,8 +717,8 @@ sxftd_update_example_cal( SXFromTransInfo *sxfti ) GtkWidget *w; gchar *name; /* get the name */ - w = glade_xml_get_widget(sxfti->gxml, SXFTD_NAME_ENTRY); - name = gtk_editable_get_chars(GTK_EDITABLE(w), 0, -1); + name = NULL; + name = gtk_editable_get_chars(GTK_EDITABLE(sxfti->name), 0, -1); gnc_dense_cal_store_update_name(sxfti->dense_cal_model, name); g_free(name); } @@ -735,6 +730,10 @@ sxftd_update_example_cal( SXFromTransInfo *sxfti ) g_free(schedule_desc); } + /* Set End date sensitivity */ + gtk_widget_set_sensitive( GTK_WIDGET(sxfti->endDateGDE), (get.type == END_ON_DATE) ); + gtk_widget_set_sensitive( GTK_WIDGET(sxfti->n_occurences), (get.type == END_AFTER_N_OCCS) ); + switch (get.type) { case NEVER_END: @@ -757,9 +756,10 @@ sxftd_update_example_cal( SXFromTransInfo *sxfti ) recurrenceListFree(&schedule); } -/** - * Callback to update the calendar - **/ + +/*********************************** + * Callback to update the calendar * + **********************************/ static void sxftd_update_excal_adapt( GObject *o, gpointer ud ) { @@ -767,18 +767,27 @@ sxftd_update_excal_adapt( GObject *o, gpointer ud ) sxftd_update_example_cal( sxfti ); } + +/********************* + * Create the dialog * + ********************/ void gnc_sx_create_from_trans( Transaction *trans ) { int errno; SXFromTransInfo *sxfti = g_new0( SXFromTransInfo, 1); + GtkBuilder *builder; + GtkWidget *dialog; - sxfti->gxml = gnc_glade_xml_new(SX_GLADE_FILE, - SXFTD_DIALOG_GLADE_NAME); + builder = gtk_builder_new(); - sxfti->dialog = glade_xml_get_widget(sxfti->gxml, - SXFTD_DIALOG_GLADE_NAME); + gnc_builder_add_from_file (builder ,"dialog-sx.glade", "freq_liststore"); + gnc_builder_add_from_file (builder ,"dialog-sx.glade", "sx_from_real_trans"); + dialog = GTK_WIDGET(gtk_builder_get_object (builder, "sx_from_real_trans")); + + sxfti->builder = builder; + sxfti->dialog = dialog; sxfti->trans = trans; sxfti->sx = xaccSchedXactionMalloc(gnc_get_current_book ()); @@ -802,4 +811,7 @@ gnc_sx_create_from_trans( Transaction *trans ) } gtk_widget_show_all(GTK_WIDGET(sxfti->dialog)); + + gtk_builder_connect_signals(builder, sxfti); + g_object_unref(G_OBJECT(builder)); } diff --git a/src/gnome/dialog-sx-from-trans.h b/src/gnome/dialog-sx-from-trans.h index 332641b2d2..413aef2d73 100644 --- a/src/gnome/dialog-sx-from-trans.h +++ b/src/gnome/dialog-sx-from-trans.h @@ -1,7 +1,6 @@ /******************************************************************** * dialog-sx-from-trans.h -- a simple dialog for creating a * - * scheduled transaction for a "real * - * one * + * scheduled transaction from a real one * * (GnuCash) * * Copyright (C) 2000 Robert Merkel * * * diff --git a/src/gnome/dialog-sx-since-last-run.c b/src/gnome/dialog-sx-since-last-run.c index f0b9652a37..e3bbfd94cb 100644 --- a/src/gnome/dialog-sx-since-last-run.c +++ b/src/gnome/dialog-sx-since-last-run.c @@ -4,19 +4,20 @@ * Copyright (C) 2006 Joshua Sled * * * * This program is free software; you can redistribute it and/or * - * modify it under the terms of version 2 and/or version 3 of the GNU General Public * - * License as published by the Free Software Foundation. * - * - * As a special exception, permission is granted to link the binary - * module resultant from this code with the OpenSSL project's - * "OpenSSL" library (or modified versions of it that use the same - * license as the "OpenSSL" library), and distribute the linked - * executable. You must obey the GNU General Public License in all - * respects for all of the code used other than "OpenSSL". If you - * modify this file, you may extend this exception to your version - * of the file, but you are not obligated to do so. If you do not - * wish to do so, delete this exception statement from your version - * of this file. + * modify it under the terms of version 2 and/or version 3 of the * + * GNU General Public License as published by the Free Software * + * Foundation. * + * * + * As a special exception, permission is granted to link the binary * + * module resultant from this code with the OpenSSL project's * + * "OpenSSL" library (or modified versions of it that use the same * + * license as the "OpenSSL" library), and distribute the linked * + * executable. You must obey the GNU General Public License in all * + * respects for all of the code used other than "OpenSSL". If you * + * modify this file, you may extend this exception to your version * + * of the file, but you are not obligated to do so. If you do not * + * wish to do so, delete this exception statement from your version * + * of this file. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * @@ -34,7 +35,6 @@ #include "config.h" #include #include -#include #include "dialog-utils.h" #include "gnc-exp-parser.h" @@ -55,6 +55,8 @@ #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "gnc.gui.sx.slr" +static QofLogModule log_module = GNC_MOD_GUI_SX; + #define DIALOG_SX_SINCE_LAST_RUN_CM_CLASS "dialog-sx-since-last-run" #define GCONF_SECTION "dialogs/scheduled_trans/since_last_run" @@ -914,14 +916,17 @@ GncSxSinceLastRunDialog* gnc_ui_sx_since_last_run_dialog(GncSxInstanceModel *sx_instances, GList *auto_created_txn_guids) { GncSxSinceLastRunDialog *dialog; - GladeXML *glade; + GtkBuilder *builder; dialog = g_new0(GncSxSinceLastRunDialog, 1); - glade = gnc_glade_xml_new("sched-xact.glade", "since-last-run-dialog"); - dialog->dialog = glade_xml_get_widget(glade, "since-last-run-dialog"); + + builder = gtk_builder_new(); + gnc_builder_add_from_file (builder, "dialog-sx.glade", "since-last-run-dialog"); + + dialog->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "since-last-run-dialog")); dialog->editing_model = gnc_sx_slr_tree_model_adapter_new(sx_instances); - dialog->review_created_txns_toggle = GTK_TOGGLE_BUTTON(glade_xml_get_widget(glade, "review_txn_toggle")); + dialog->review_created_txns_toggle = GTK_TOGGLE_BUTTON(gtk_builder_get_object (builder, "review_txn_toggle")); dialog->created_txns = auto_created_txn_guids; @@ -929,7 +934,7 @@ gnc_ui_sx_since_last_run_dialog(GncSxInstanceModel *sx_instances, GList *auto_cr GtkCellRenderer *renderer; GtkTreeViewColumn *col; - dialog->instance_view = GTK_TREE_VIEW(glade_xml_get_widget(glade, "instance_view")); + dialog->instance_view = GTK_TREE_VIEW(gtk_builder_get_object (builder, "instance_view")); gtk_tree_view_set_model(dialog->instance_view, GTK_TREE_MODEL(dialog->editing_model)); renderer = gtk_cell_renderer_text_new(); @@ -989,6 +994,10 @@ gnc_ui_sx_since_last_run_dialog(GncSxInstanceModel *sx_instances, GList *auto_cr gtk_widget_show_all(dialog->dialog); + gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, dialog); + + g_object_unref(G_OBJECT(builder)); + return dialog; } diff --git a/src/gnome/dialog-sx-since-last-run.h b/src/gnome/dialog-sx-since-last-run.h index 7c94f55c7c..e0f4e34b17 100644 --- a/src/gnome/dialog-sx-since-last-run.h +++ b/src/gnome/dialog-sx-since-last-run.h @@ -4,8 +4,9 @@ * Copyright (C) 2006 Joshua Sled * * * * This program is free software; you can redistribute it and/or * - * modify it under the terms of version 2 and/or version 3 of the GNU General Public * - * License as published by the Free Software Foundation. * + * modify it under the terms of version 2 and/or version 3 of the * + * GNU General Public License as published by the Free Software * + * Foundation. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * diff --git a/src/gnome/glade/sched-xact.glade b/src/gnome/glade/sched-xact.glade index 943b497759..1fadbbd7a0 100644 --- a/src/gnome/glade/sched-xact.glade +++ b/src/gnome/glade/sched-xact.glade @@ -4,1942 +4,6 @@ - - Edit Scheduled Transaction - dialog - - - True - vertical - 8 - - - True - vertical - - - True - - - True - 1 - 5 - <b>Name</b> - True - True - center - sxe_name - - - False - False - 0 - - - - - - - - False - False - 0 - - - - - True - 12 - - - True - True - - - - - False - 1 - - - - - True - True - - - True - vertical - - - True - - - False - False - 0 - - - - - True - 0 - <b>Options</b> - True - - - False - False - 4 - 1 - - - - - True - 12 - - - True - 5 - 2 - 6 - - - Create in advance: - True - True - False - True - True - - - 3 - 4 - GTK_FILL - - - - - - Remind in advance: - True - True - False - True - True - - - 4 - 5 - GTK_FILL - - - - - - True - - - True - True - 0 0 731 1 30 0 - 1 - True - True - - - False - 0 - - - - - True - days - center - - - False - False - 1 - - - - - 1 - 2 - 4 - 5 - GTK_FILL - GTK_FILL - - - - - Create automatically - True - True - False - Conditional on splits not having variables - True - True - - - 2 - 1 - 2 - GTK_FILL - - - - - - True - - - True - True - 0 0 731 1 30 0 - 1 - True - True - - - False - 0 - - - - - True - days - center - - - False - False - 1 - - - - - 1 - 2 - 3 - 4 - GTK_FILL - GTK_FILL - - - - - True - - - Notify me when created - True - False - True - False - True - True - - - - - 2 - 2 - 3 - GTK_FILL - GTK_FILL - 24 - - - - - Enabled - True - True - False - True - True - - - GTK_FILL - - - - - - - - - - - False - 2 - - - - - True - - - False - False - 3 - - - - - True - 0 - <b>Occurrences</b> - True - - - False - False - 4 - 4 - - - - - True - 12 - - - True - vertical - - - True - - - True - 0 - Last Occurred: - center - - - False - False - 0 - - - - - True - YYYY-MM-DD - center - - - False - False - 1 - - - - - False - False - 0 - - - - - True - 0 - Repeats: - - - False - False - 1 - - - - - True - 12 - - - True - 4 - 3 - - - Forever - True - True - False - True - True - True - - - GTK_FILL - - - - - - Until: - True - True - False - True - True - rb_noend - - - 1 - 2 - GTK_FILL - - - - - - For: - True - True - False - True - True - rb_noend - - - 2 - 3 - GTK_FILL - - - - - - True - 3 - occurrences - - - 2 - 3 - 2 - 3 - GTK_FILL - - - - - - True - 0 - 3 - remaining - - - 2 - 3 - 3 - 4 - GTK_FILL - - - - - - True - - - - - - 1 - 3 - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - True - 1 0 1000 1 10 0 - 1 - True - - - 1 - 2 - 2 - 3 - GTK_FILL - - - - - - True - True - 1 0 1000 1 10 0 - 1 - True - - - 1 - 2 - 3 - 4 - GTK_FILL - - - - - - - - - - - - - - - - - False - 2 - - - - - - - False - 5 - - - - - - - True - Overview - - - False - tab - - - - - True - vertical - - - True - - - - - - 0 - - - - - True - - - - - - 1 - - - - - 1 - - - - - True - Frequency - - - 1 - False - tab - - - - - True - 1 - vertical - - - - - - 2 - - - - - True - Template Transaction - - - 2 - False - tab - - - - - 2 - - - - - 2 - - - - - True - end - - - gtk-help - -11 - True - True - True - False - True - - - False - False - 0 - - - - - gtk-cancel - True - True - True - False - True - - - False - False - 1 - - - - - gtk-ok - True - True - True - False - True - - - False - False - 2 - - - - - False - end - 0 - - - - - - - This window should never be realized. - - - True - - - True - vertical - - - True - 2 - 2 - - - True - 1 - 5 - Frequency: - right - - - GTK_FILL - - - - - - True - 1 - 5 - Start Date: - center - - - 1 - 2 - GTK_FILL - - - - - - True - None -Once -Daily -Weekly -Semi-Monthly -Monthly - - - 1 - 2 - GTK_FILL - GTK_FILL - - - - - - - - False - False - 0 - - - - - True - False - True - - - True - Not scheduled - center - - - - - True - None - center - - - False - tab - - - - - True - True - - - True - Select occurrence date above. - center - - - False - False - 0 - - - - - 1 - - - - - True - Once - center - - - 1 - False - tab - - - - - True - - - True - 1 - 4 - Every - right - - - False - False - 0 - - - - - True - True - 1 1 731 1 10 0 - 1 - True - True - - - False - False - 1 - - - - - True - 0 - 5 - days. - center - - - False - False - 2 - - - - - 2 - - - - - True - Daily - center - - - 2 - False - tab - - - - - True - vertical - - - True - - - True - 1 - Every - right - - - False - 0 - - - - - True - True - 1 1 100 1 10 0 - 1 - - - False - False - 1 - - - - - True - 0 - weeks. - fill - - - 2 - - - - - False - False - 5 - 0 - - - - - True - 2 - 0.5 - - - True - - - True - vertical - - - Sunday - True - True - False - True - True - - - False - False - 0 - - - - - Monday - True - True - False - True - True - - - False - False - 1 - - - - - Tuesday - True - True - False - True - True - - - False - False - 2 - - - - - False - False - 0 - - - - - True - vertical - - - Wednesday - True - True - False - True - True - - - False - False - 0 - - - - - Thursday - True - True - False - True - True - - - False - False - 1 - - - - - Friday - True - True - False - True - True - - - False - False - 2 - - - - - False - False - 1 - - - - - True - vertical - - - Saturday - True - True - False - True - True - - - False - False - 0 - - - - - False - False - 2 - - - - - - - True - Days - - - label_item - - - - - False - False - 1 - - - - - 3 - False - - - - - True - Weekly - center - - - 3 - False - tab - - - - - True - - - True - 5 - vertical - - - True - - - True - 1 - Every - right - - - False - False - 0 - - - - - True - True - 1 1 100 1 10 0 - 1 - True - - - False - False - 1 - - - - - True - 0 - months. - - - False - 2 - - - - - False - False - 5 - 0 - - - - - True - - - True - 1 - First on the: - right - - - False - 0 - - - - - True - 1st -2nd -3rd -4th -5th -6th -7th -8th -9th -10th -11th -12th -13th -14th -15th -16th -17th -18th -19th -20th -21st -22nd -23rd -24th -25th -26th -27th -28th -29th -30th -31st -Last day of month -Last Monday -Last Tuesday -Last Wednesday -Last Thursday -Last Friday -Last Saturday -Last Sunday - - - 1 - - - - - True - 1 - except on weekends: - right - - - False - 2 - 2 - - - - - True - No change -Use previous weekday -Use next weekday - - - False - False - 3 - - - - - False - False - 3 - 1 - - - - - True - - - True - 1 - then on the: - right - - - False - False - 0 - - - - - True - 1st -2nd -3rd -4th -5th -6th -7th -8th -9th -10th -11th -12th -13th -14th -15th -16th -17th -18th -19th -20th -21st -22nd -23rd -24th -25th -26th -27th -28th -29th -30th -31st -Last day of month -Last Monday -Last Tuesday -Last Wednesday -Last Thursday -Last Friday -Last Saturday -Last Sunday - - - False - False - 1 - - - - - True - 1 - except on weekends: - right - - - False - 2 - 2 - - - - - True - No change -Use previous weekday -Use next weekday - - - False - False - 3 - - - - - False - False - 3 - 2 - - - - - False - False - 0 - - - - - 4 - - - - - True - Semi-Monthly - center - - - 4 - False - tab - - - - - True - - - True - vertical - - - True - - - True - 1 - Every - center - - - False - 0 - - - - - True - True - 1 1 100 1 10 0 - 1 - True - True - True - - - False - False - 1 - - - - - True - 0 - months. - center - - - False - 2 - - - - - False - False - 5 - 0 - - - - - True - - - True - 1 - On the - right - - - False - 2 - 0 - - - - - True - 1st -2nd -3rd -4th -5th -6th -7th -8th -9th -10th -11th -12th -13th -14th -15th -16th -17th -18th -19th -20th -21st -22nd -23rd -24th -25th -26th -27th -28th -29th -30th -31st -Last day of month -Last Monday -Last Tuesday -Last Wednesday -Last Thursday -Last Friday -Last Saturday -Last Sunday -1st Mon -1st Tue -1st Wed -1st Thu -1st Fri -1st Sat -1st Sun -2nd Mon -2nd Tue -2nd Wed -2nd Thu -2nd Fri -2nd Sat -2nd Sun -3rd Mon -3rd Tue -3rd Wed -3rd Thu -3rd Fri -3rd Sat -3rd Sun -4th Mon -4th Tue -4th Wed -4th Thu -4th Fri -4th Sat -4th Sun - - - False - False - 1 - - - - - True - 1 - except on weekends: - right - - - False - 2 - 2 - - - - - True - No change -Use previous weekday -Use next weekday - - - False - False - 3 - - - - - False - 3 - 1 - - - - - 3 - 0 - - - - - 5 - - - - - True - Monthly - center - - - 5 - False - tab - - - - - False - False - 1 - - - - - - - - - Make Scheduled Transaction - dialog - - - True - vertical - 8 - - - True - - - True - vertical - - - True - 3 - 2 - - - True - 1 - 3 - Name: - center - - - GTK_FILL - - - - - - True - 1 - 3 - Frequency: - center - - - 1 - 2 - GTK_FILL - - - - - - True - 1 - 3 - Start Date: - center - - - 2 - 3 - GTK_FILL - - - - - - True - True - - - 1 - 2 - - - - - - True - Daily -Weekly -Bi-Weekly -Monthly -Quarterly -Yearly - - - 1 - 2 - 1 - 2 - GTK_FILL - GTK_FILL - - - - - - - - False - False - 0 - - - - - True - 2 - 0 - none - - - True - 10 - - - True - vertical - - - Never End - True - True - False - True - True - - - False - False - 0 - - - - - True - - - End Date: - True - True - False - True - True - never_end_button - - - False - False - 0 - - - - - - - - False - False - 1 - - - - - True - - - Number of Occurrences: - True - True - False - True - True - never_end_button - - - False - False - 0 - - - - - True - 10 - - - True - True - - - - - False - 1 - - - - - False - False - 2 - - - - - - - - - True - <b>End</b> - True - - - label_item - - - - - False - False - 1 - - - - - False - False - 0 - - - - - True - 0 - - - - - - 1 - - - - - 2 - - - - - True - end - - - Advanced... - 100 - True - True - True - False - True - - - False - False - 0 - - - - - gtk-cancel - -6 - True - True - True - False - True - - - False - False - 1 - - - - - gtk-ok - -5 - True - True - True - False - True - - - False - False - 2 - - - - - False - end - 0 - - - - - - - True - - - True - Creation State - True - - - True - - - Ignore - True - True - True - - - - - - Postpone - True - True - True - - - - - - Create - True - True - True - - - - - - - - True Preferences @@ -2245,319 +309,4 @@ Yearly - - True - Account Deletion - center - 320 - 240 - dialog - - - True - vertical - - - True - vertical - - - True - The following Scheduled Transactions reference the deleted account, and must now be corrected. Press OK to edit them. - True - - - False - False - 0 - - - - - True - True - automatic - automatic - in - - - True - False - False - - - - - 1 - - - - - 2 - - - - - True - end - - - gtk-ok - -5 - True - True - True - False - True - - - False - False - 0 - - - - - False - end - 0 - - - - - - - True - window1 - - - True - True - vertical - - - True - vertical - - - True - 0 - <b>Transactions</b> - True - - - False - False - 0 - - - - - True - 12 - - - True - 12 - - - True - False - automatic - automatic - in - - - - - - 0 - - - - - - - 1 - - - - - True - True - - - - - True - vertical - - - True - - - False - False - 0 - - - - - True - 0 - <b>Upcoming</b> - True - - - False - False - 1 - - - - - True - 12 - - - True - - - - - - - - 2 - - - - - False - True - - - - - - - True - Since Last Run... - center-on-parent - 640 - 480 - True - dialog - - - True - vertical - - - True - vertical - - - True - True - automatic - automatic - in - - - True - True - True - - - - - 0 - - - - - True - - - True - - - 0 - - - - - _Review created transactions - True - True - False - True - True - - - False - False - 1 - - - - - False - False - 1 - - - - - 2 - - - - - True - end - - - gtk-cancel - -6 - True - True - True - True - False - True - - - False - False - 0 - - - - - gtk-ok - -5 - True - True - True - False - True - - - False - False - 1 - - - - - False - end - 0 - - - - - diff --git a/src/gnome/gnc-plugin-page-sx-list.c b/src/gnome/gnc-plugin-page-sx-list.c index 78bed238ef..77fb907f37 100644 --- a/src/gnome/gnc-plugin-page-sx-list.c +++ b/src/gnome/gnc-plugin-page-sx-list.c @@ -1,34 +1,37 @@ -/* - * gnc-plugin-page-sx-list.c - * - * Copyright (C) 2006 Josh Sled - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 and/or version 3 of the GNU General Public - * License as published by the Free Software Foundation. - * - * As a special exception, permission is granted to link the binary module - * resultant from this code with the OpenSSL project's "OpenSSL" library (or - * modified versions of it that use the same license as the "OpenSSL" - * library), and distribute the linked executable. You must obey the GNU - * General Public License in all respects for all of the code used other than - * "OpenSSL". If you modify this file, you may extend this exception to your - * version of the file, but you are not obligated to do so. If you do not - * wish to do so, delete this exception statement from your version of this - * file. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, contact: - * - * Free Software Foundation Voice: +1-617-542-5942 - * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 - * Boston, MA 02110-1301, USA gnu@gnu.org - */ +/********************************************************************\ + * gnc-plugin-page-sx-list.c : scheduled transaction plugin * + * * + * Copyright (C) 2006 Joshua Sled * + * Copyright (C) 2011 Robert Fewell * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of version 2 and/or version 3 of the * + * GNU General Public License as published by the Free Software * + * Foundation. * + * * + * As a special exception, permission is granted to link the binary * + * module resultant from this code with the OpenSSL project's * + * "OpenSSL" library (or modified versions of it that use the same * + * license as the "OpenSSL" library), and distribute the linked * + * executable. You must obey the GNU General Public License in all * + * respects for all of the code used other than "OpenSSL". If you * + * modify this file, you may extend this exception to your version * + * of the file, but you are not obligated to do so. If you do not * + * wish to do so, delete this exception statement from your version * + * of this file. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License* + * along with this program; if not, contact: * + * * + * Free Software Foundation Voice: +1-617-542-5942 * + * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * + * Boston, MA 02110-1301, USA gnu@gnu.org * +\********************************************************************/ /** @addtogroup ContentPlugins @{ */ @@ -43,7 +46,6 @@ #include #include #include -#include #include "SX-book.h" #include "Split.h" #include "Transaction.h" @@ -69,6 +71,8 @@ #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "gnc.gui.plugin-page.sx-list" +static QofLogModule log_module = GNC_MOD_GUI_SX; + #define PLUGIN_PAGE_SX_LIST_CM_CLASS "plugin-page-sx-list" #define GCONF_SECTION "window/pages/sx_list" @@ -79,12 +83,12 @@ typedef struct GncPluginPageSxListPrivate GtkWidget* widget; gint gnc_component_id; - GladeXML* gxml; GncSxInstanceDenseCalAdapter *dense_cal_model; GncDenseCal* gdcal; GncSxInstanceModel* instances; GtkTreeView* tree_view; + } GncPluginPageSxListPrivate; #define GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(o) \ @@ -132,6 +136,7 @@ static GtkActionEntry gnc_plugin_page_sx_list_actions [] = /** The number of actions provided by this plugin. */ static guint gnc_plugin_page_sx_list_n_actions = G_N_ELEMENTS (gnc_plugin_page_sx_list_actions); + GType gnc_plugin_page_sx_list_get_type (void) { @@ -160,6 +165,7 @@ gnc_plugin_page_sx_list_get_type (void) return gnc_plugin_page_sx_list_type; } + GncPluginPage * gnc_plugin_page_sx_list_new (void) { @@ -168,6 +174,7 @@ gnc_plugin_page_sx_list_new (void) return GNC_PLUGIN_PAGE(plugin_page); } + static void gnc_plugin_page_sx_list_class_init (GncPluginPageSxListClass *klass) { @@ -189,6 +196,7 @@ gnc_plugin_page_sx_list_class_init (GncPluginPageSxListClass *klass) g_type_class_add_private(klass, sizeof(GncPluginPageSxListPrivate)); } + static void gnc_plugin_page_sx_list_init (GncPluginPageSxList *plugin_page) { @@ -217,6 +225,7 @@ gnc_plugin_page_sx_list_init (GncPluginPageSxList *plugin_page) /* gnc_plugin_init_short_names (action_group, toolbar_labels); */ } + static void gnc_plugin_page_sx_list_dispose(GObject *object) { @@ -241,6 +250,7 @@ gnc_plugin_page_sx_list_dispose(GObject *object) G_OBJECT_CLASS (parent_class)->dispose(object); } + static void gnc_plugin_page_sx_list_finalize (GObject *object) { @@ -255,6 +265,7 @@ gnc_plugin_page_sx_list_finalize (GObject *object) G_OBJECT_CLASS (parent_class)->finalize (object); } + /* Virtual Functions */ static void gnc_plugin_page_sx_list_refresh_cb (GHashTable *changes, gpointer user_data) @@ -272,6 +283,7 @@ gnc_plugin_page_sx_list_refresh_cb (GHashTable *changes, gpointer user_data) gtk_widget_queue_draw(priv->widget); } + static void gnc_plugin_page_sx_list_close_cb (gpointer user_data) { @@ -283,6 +295,7 @@ gnc_plugin_page_sx_list_close_cb (gpointer user_data) gnc_main_window_close_page(plugin_page); } + static void gppsl_selection_changed_cb(GtkTreeSelection *selection, gpointer user_data) { @@ -301,19 +314,51 @@ gppsl_selection_changed_cb(GtkTreeSelection *selection, gpointer user_data) gtk_action_set_sensitive(delete_action, selection_state); } + static GtkWidget * gnc_plugin_page_sx_list_create_widget (GncPluginPage *plugin_page) { GncPluginPageSxList *page; GncPluginPageSxListPrivate *priv; + GtkWidget *widget; + GtkWidget *vbox; + GtkWidget *label; + GtkWidget *swin; + char *markup; + char *text; page = GNC_PLUGIN_PAGE_SX_LIST(plugin_page); priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page); if (priv->widget != NULL) return priv->widget; - priv->gxml = gnc_glade_xml_new("sched-xact.glade", "sx-list-vbox"); - priv->widget = glade_xml_get_widget(priv->gxml, "sx-list-vbox"); + /* Create Vpaned widget for top level */ + widget = gtk_vpaned_new(); + priv->widget = widget; + gtk_widget_show (priv->widget); + + /* Add vbox and label */ + vbox = gtk_vbox_new(FALSE,0); + gtk_paned_pack1( GTK_PANED(widget), vbox, TRUE, FALSE); + + label = gtk_label_new(NULL); + text = g_strdup_printf(_("Transactions")); + markup = g_markup_printf_escaped (" %s", text); + gtk_label_set_markup (GTK_LABEL (label), markup); + g_free (markup); + g_free (text); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0); + gtk_widget_show (label); + gtk_box_pack_start ( GTK_BOX(vbox), label, FALSE, FALSE, 0); + gtk_widget_show (vbox); + + /* Create scrolled window for top area */ + swin = gtk_scrolled_window_new(NULL,NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_box_pack_start ( GTK_BOX(vbox), swin, TRUE, TRUE, 5); + gtk_widget_show (swin); { // gint half_way; @@ -339,16 +384,14 @@ gnc_plugin_page_sx_list_create_widget (GncPluginPage *plugin_page) } { - GtkContainer *tree_view_container; GtkTreeSelection *selection; - tree_view_container = GTK_CONTAINER(glade_xml_get_widget(priv->gxml, "sx-list-tree-view-container")); priv->tree_view = GTK_TREE_VIEW(gnc_tree_view_sx_list_new(priv->instances)); g_object_set(G_OBJECT(priv->tree_view), "gconf-section", GCONF_SECTION, "show-column-menu", TRUE, NULL); - gtk_container_add(tree_view_container, GTK_WIDGET(priv->tree_view)); + gtk_container_add(GTK_CONTAINER( swin ), GTK_WIDGET(priv->tree_view)); selection = gtk_tree_view_get_selection(priv->tree_view); gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE); @@ -356,9 +399,31 @@ gnc_plugin_page_sx_list_create_widget (GncPluginPage *plugin_page) g_signal_connect(G_OBJECT(priv->tree_view), "row-activated", (GCallback)gppsl_row_activated_cb, (gpointer)page); } - { - GtkWidget *w; + /* Add vbox and label */ + vbox = gtk_vbox_new(FALSE,0); + gtk_paned_pack2( GTK_PANED(widget), vbox, TRUE, FALSE); + label = gtk_label_new(NULL); + text = g_strdup_printf(_("Upcoming Transactions")); + markup = g_markup_printf_escaped (" %s", text); + gtk_label_set_markup (GTK_LABEL (label), markup); + g_free (markup); + g_free (text); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0); + gtk_widget_show (label); + + gtk_box_pack_start ( GTK_BOX(vbox), label, FALSE, FALSE, 0); + gtk_widget_show (vbox); + + /* Create scrolled window for bottom area */ + swin = gtk_scrolled_window_new(NULL,NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_box_pack_start ( GTK_BOX(vbox), swin, TRUE, TRUE, 5); + gtk_widget_show (swin); + + { priv->dense_cal_model = gnc_sx_instance_dense_cal_adapter_new(GNC_SX_INSTANCE_MODEL(priv->instances)); priv->gdcal = GNC_DENSE_CAL(gnc_dense_cal_new_with_model(GNC_DENSE_CAL_MODEL(priv->dense_cal_model))); g_object_ref_sink(priv->gdcal); @@ -366,9 +431,7 @@ gnc_plugin_page_sx_list_create_widget (GncPluginPage *plugin_page) gnc_dense_cal_set_months_per_col(priv->gdcal, 4); gnc_dense_cal_set_num_months(priv->gdcal, 12); - w = glade_xml_get_widget(priv->gxml, "upcoming_cal_hbox"); - gtk_container_add(GTK_CONTAINER(w), GTK_WIDGET(priv->gdcal)); - gtk_widget_show_all(w); + gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(swin), GTK_WIDGET(priv->gdcal)); } priv->gnc_component_id = gnc_register_gui_component("plugin-page-sx-list", @@ -379,6 +442,7 @@ gnc_plugin_page_sx_list_create_widget (GncPluginPage *plugin_page) return priv->widget; } + static void gnc_plugin_page_sx_list_destroy_widget (GncPluginPage *plugin_page) { @@ -401,6 +465,7 @@ gnc_plugin_page_sx_list_destroy_widget (GncPluginPage *plugin_page) } } + /** Save enough information about this page that it can be recreated next time * the user starts gnucash. * @param plugin_page The page to save. @@ -430,6 +495,7 @@ gnc_plugin_page_sx_list_save_page (GncPluginPage *plugin_page, gtk_paned_get_position(GTK_PANED(priv->widget))); } + /** * Create a new sx list page based on the information saved during a previous * instantiation of gnucash. @@ -478,6 +544,7 @@ gnc_plugin_page_sx_list_recreate_page (GtkWidget *window, return GNC_PLUGIN_PAGE(page); } + static void gnc_plugin_page_sx_list_cmd_new(GtkAction *action, GncPluginPageSxList *page) { @@ -500,18 +567,21 @@ gnc_plugin_page_sx_list_cmd_new(GtkAction *action, GncPluginPageSxList *page) gnc_ui_scheduled_xaction_editor_dialog_create(new_sx, new_sx_flag); } + static void _edit_sx(gpointer data, gpointer user_data) { gnc_ui_scheduled_xaction_editor_dialog_create((SchedXaction*)data, FALSE); } + static SchedXaction* _argument_reorder_fn(GtkTreePath* list_path_data, GncTreeViewSxList* user_tree_view) { return gnc_tree_view_sx_list_get_sx_from_path(user_tree_view, list_path_data); } + static void gnc_plugin_page_sx_list_cmd_edit(GtkAction *action, GncPluginPageSxList *page) { @@ -537,6 +607,7 @@ gnc_plugin_page_sx_list_cmd_edit(GtkAction *action, GncPluginPageSxList *page) g_list_free(selected_paths); } + static void gppsl_row_activated_cb(GtkTreeView *tree_view, GtkTreePath *path, @@ -564,6 +635,7 @@ _destroy_sx(gpointer data, gpointer user_data) xaccSchedXactionDestroy(sx); } + static void gnc_plugin_page_sx_list_cmd_delete(GtkAction *action, GncPluginPageSxList *page) { diff --git a/src/gnome/gnc-plugin-page-sx-list.h b/src/gnome/gnc-plugin-page-sx-list.h index dddb741f35..e0137a938d 100644 --- a/src/gnome/gnc-plugin-page-sx-list.h +++ b/src/gnome/gnc-plugin-page-sx-list.h @@ -1,24 +1,37 @@ -/* - * gnc-plugin-page-sx-list.h - * - * Copyright (C) 2006 Josh Sled - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 and/or version 3 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, contact: - * - * Free Software Foundation Voice: +1-617-542-5942 - * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 - * Boston, MA 02110-1301, USA gnu@gnu.org - */ +/********************************************************************\ + * gnc-plugin-page-sx-list.h : scheduled transaction plugin * + * * + * Copyright (C) 2006 Joshua Sled * + * Copyright (C) 2011 Robert Fewell * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of version 2 and/or version 3 of the * + * GNU General Public License as published by the Free Software * + * Foundation. * + * * + * As a special exception, permission is granted to link the binary * + * module resultant from this code with the OpenSSL project's * + * "OpenSSL" library (or modified versions of it that use the same * + * license as the "OpenSSL" library), and distribute the linked * + * executable. You must obey the GNU General Public License in all * + * respects for all of the code used other than "OpenSSL". If you * + * modify this file, you may extend this exception to your version * + * of the file, but you are not obligated to do so. If you do not * + * wish to do so, delete this exception statement from your version * + * of this file. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License* + * along with this program; if not, contact: * + * * + * Free Software Foundation Voice: +1-617-542-5942 * + * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * + * Boston, MA 02110-1301, USA gnu@gnu.org * +\********************************************************************/ /** @addtogroup ContentPlugins @{ */ diff --git a/src/gnome/gtkbuilder/Makefile.am b/src/gnome/gtkbuilder/Makefile.am index 022b7e98e2..04f98c211b 100644 --- a/src/gnome/gtkbuilder/Makefile.am +++ b/src/gnome/gtkbuilder/Makefile.am @@ -10,13 +10,13 @@ gtkbuilder_DATA = \ dialog-fincalc.glade \ dialog-price.glade \ dialog-print-check.glade \ + dialog-sx.glade \ gnc-plugin-page-budget.glade \ newuser.glade \ owner.glade \ progress.glade \ reconcile.glade \ register.glade \ - sched-xact.glade \ tax.glade \ userpass.glade \ window-autoclear.glade diff --git a/src/gnome/gtkbuilder/dialog-sx.glade b/src/gnome/gtkbuilder/dialog-sx.glade new file mode 100644 index 0000000000..3e7c8b69fd --- /dev/null +++ b/src/gnome/gtkbuilder/dialog-sx.glade @@ -0,0 +1,1692 @@ + + + + + + True + False + 6 + Account Deletion + center + 320 + 240 + dialog + + + True + False + + + True + False + end + + + gtk-ok + True + True + True + False + False + True + + + False + False + 0 + + + + + False + True + end + 0 + + + + + True + False + + + True + False + The following Scheduled Transactions reference the deleted account and must now be corrected. Press OK to edit them. + True + + + False + False + 0 + + + + + True + True + automatic + automatic + in + + + True + False + False + False + + + + + True + True + 1 + + + + + True + True + 2 + + + + + + okbutton1 + + + + True + False + Preferences + + + True + False + 6 + 8 + 4 + 12 + + + True + False + 0 + <b>Since Last Run Dialog</b> + True + + + GTK_FILL + + + + + + True + False + 0 + + + 2 + 3 + GTK_FILL + + + + + + True + False + 0 + <b>Transaction Editor Defaults</b> + True + + + 3 + 4 + GTK_FILL + + + + + + _Run when data file opened + True + True + False + Show the "since last run" window when a file is opened. + False + True + True + + + 4 + 1 + 2 + GTK_FILL + + 12 + + + + + _Auto-create new transactions + True + True + False + Set the 'auto-create' flag on newly created scheduled transactions. + False + True + True + + + + 4 + 4 + 5 + GTK_FILL + + 12 + + + + + True + False + 12 + + + True + False + 0 + Crea_te in advance: + True + gconf/dialogs/scheduled_trans/transaction_editor/create_days + + + + + 6 + 7 + GTK_FILL + GTK_FILL + + + + + True + False + 12 + + + True + False + 0 + R_emind in advance: + True + + + + + 7 + 8 + GTK_FILL + GTK_FILL + + + + + True + False + 6 + + + True + True + Begin notifications this many days before the transaction is created. + False + False + True + True + remind_days + 1 + + + False + True + 0 + + + + + True + False + 0 + days + + + False + False + 1 + + + + + 1 + 2 + 7 + 8 + GTK_FILL + GTK_FILL + + + + + True + False + 6 + + + True + True + Create the transaction this many days before its effective date. + False + False + True + True + create_days_adj + 1 + + + False + True + 0 + + + + + True + False + 0 + days + + + False + False + 1 + + + + + 1 + 2 + 6 + 7 + GTK_FILL + GTK_FILL + + + + + _Notify before transactions are created + True + False + True + False + Set the 'notify' flag on newly created scheduled transactions. + False + True + True + + + + 4 + 5 + 6 + GTK_FILL + + 30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + Edit Scheduled Transaction + dialog + + + True + False + 8 + + + True + False + end + + + gtk-help + True + True + True + False + False + True + + + False + False + 0 + + + + + gtk-cancel + True + True + True + False + False + True + + + False + False + 1 + + + + + gtk-ok + True + True + True + False + False + True + + + False + False + 2 + + + + + False + True + end + 0 + + + + + True + False + 6 + + + True + False + + + True + False + 1 + 5 + <b>Name</b> + True + True + center + sxe_name + + + False + False + 0 + + + + + + + + False + False + 0 + + + + + True + False + 12 + + + True + True + False + False + True + True + + + + + False + True + 6 + 1 + + + + + True + True + + + True + False + + + True + False + + + False + False + 0 + + + + + True + False + 0 + 3 + <b>Options</b> + True + + + False + False + 4 + 1 + + + + + True + False + 12 + + + True + False + 5 + 2 + 6 + + + Create in advance: + True + True + False + False + True + True + + + 3 + 4 + GTK_FILL + + + + + + Remind in advance: + True + True + False + False + True + True + + + 4 + 5 + GTK_FILL + + + + + + True + False + + + True + True + False + False + True + True + remind_days_adj + 1 + True + True + + + False + True + 0 + + + + + True + False + days + center + + + False + False + 1 + + + + + 1 + 2 + 4 + 5 + GTK_FILL + GTK_FILL + + + + + Create automatically + True + True + False + Conditional on splits not having variables + False + True + True + + + 2 + 1 + 2 + GTK_FILL + + + + + + True + False + + + True + True + False + False + True + True + advance_days_adj + 1 + True + True + + + False + True + 0 + + + + + True + False + days + center + + + False + False + 1 + + + + + 1 + 2 + 3 + 4 + GTK_FILL + GTK_FILL + + + + + True + False + + + Notify me when created + True + False + True + False + False + True + True + + + + + 2 + 2 + 3 + GTK_FILL + GTK_FILL + 24 + + + + + Enabled + True + True + False + False + True + True + + + GTK_FILL + + + + + + + + + + + False + True + 2 + + + + + True + False + + + False + False + 3 + + + + + True + False + 0 + 3 + <b>Occurrences</b> + True + + + False + False + 4 + 4 + + + + + True + False + 12 + + + True + False + + + True + False + + + True + False + 0 + Last Occurred: + center + + + False + False + 0 + + + + + True + False + YYYY-MM-DD + center + + + False + False + 1 + + + + + False + False + 0 + + + + + True + False + 0 + Repeats: + + + False + False + 1 + + + + + True + False + 12 + + + True + False + 4 + 3 + + + Forever + True + True + False + False + True + True + True + + + GTK_FILL + + + + + + Until: + True + True + False + False + True + True + rb_noend + + + 1 + 2 + GTK_FILL + + + + + + For: + True + True + False + False + True + True + rb_noend + + + 2 + 3 + GTK_FILL + + + + + + True + False + 0 + 3 + occurrences + + + 2 + 3 + 2 + 3 + GTK_FILL + + + + + + True + False + 0 + 3 + remaining + + + 2 + 3 + 3 + 4 + GTK_FILL + + + + + + True + False + + + + + + 1 + 3 + 1 + 2 + GTK_FILL + GTK_FILL + + + + + True + True + False + False + True + True + end_spin_adj + 1 + True + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + + True + True + False + False + True + True + remain_spin_adj + 1 + True + + + 1 + 2 + 3 + 4 + GTK_FILL + + + + + + + + + + + + + + + + + False + True + 2 + + + + + + + False + True + 5 + + + + + + + True + False + Overview + + + False + + + + + True + False + + + True + False + + + + + + True + True + 0 + + + + + True + False + + + + + + True + True + 1 + + + + + 1 + + + + + True + False + Frequency + + + 1 + False + + + + + True + False + 1 + + + + + + 2 + + + + + True + False + Template Transaction + + + 2 + False + + + + + True + True + 2 + + + + + True + True + 2 + + + + + + help_button + cancel_button + ok_button + + + + 731 + 1 + 30 + + + 10000000 + 1 + 10 + + + 1000 + 1 + 1 + 10 + + + + + + + + + Daily + + + Weekly + + + Bi-Weekly + + + Monthly + + + Quarterly + + + Yearly + + + + + 1000 + 1 + 1 + 10 + + + 10000000 + 1 + 10 + + + 731 + 1 + 30 + + + True + False + Since Last Run... + center-on-parent + 640 + 480 + True + dialog + + + True + False + + + True + False + end + + + gtk-cancel + True + True + True + True + False + False + True + + + False + False + 0 + + + + + gtk-ok + True + True + True + False + False + True + + + False + False + 1 + + + + + False + True + end + 0 + + + + + True + False + + + True + True + automatic + automatic + in + + + True + True + True + + + + + True + True + 0 + + + + + True + False + + + True + False + + + True + True + 0 + + + + + _Review created transactions + True + True + False + False + True + True + + + False + False + 1 + + + + + False + False + 1 + + + + + True + True + 2 + + + + + + cancelbutton2 + okbutton2 + + + + False + Make Scheduled Transaction + dialog + + + True + False + 8 + + + True + False + end + + + Advanced... + True + True + True + False + False + True + + + False + False + 0 + + + + + gtk-cancel + True + True + True + False + False + True + + + False + False + 1 + + + + + gtk-ok + True + True + True + False + False + True + + + False + False + 2 + + + + + False + False + end + 0 + + + + + True + False + + + True + False + + + True + False + 4 + 2 + + + True + False + 1 + 3 + Name: + center + + + + + + + + + True + False + 1 + 3 + Frequency: + center + + + 1 + 2 + + + + + + + True + False + 1 + 3 + Start Date: + center + + + 2 + 3 + + + + + + + True + True + False + False + True + True + + + 1 + 2 + GTK_FILL + + + + + + True + False + freq_liststore + + + + 0 + + + + + 1 + 2 + 1 + 2 + GTK_FILL + GTK_FILL + + + + + True + False + 2 + 0 + in + + + True + False + + + Never End + True + True + False + False + True + True + True + + + False + False + 0 + + + + + True + False + + + End Date: + True + True + False + False + True + True + never_end_button + + + False + False + 0 + + + + + + + + False + False + 1 + + + + + True + False + + + Number of Occurrences: + True + True + False + False + True + True + never_end_button + + + False + False + 0 + + + + + True + True + 4 + + 1 + True + False + False + True + True + + + False + False + 1 + + + + + False + False + 2 + + + + + + + True + False + True + + + + + 1 + 2 + 3 + 4 + + + + + + + True + False + 1 + 0.20000000298023224 + End: + True + + + 3 + 4 + + + + + + + + False + True + 0 + + + + + False + False + 0 + + + + + True + False + 0 + + + + + + True + True + 1 + + + + + True + True + 2 + + + + + + advanced_button + cancel_button + ok_button + + + diff --git a/src/gnome/gtkbuilder/sched-xact.glade b/src/gnome/gtkbuilder/sched-xact.glade index 3ecb16093f..e69de29bb2 100644 --- a/src/gnome/gtkbuilder/sched-xact.glade +++ b/src/gnome/gtkbuilder/sched-xact.glade @@ -1,3134 +0,0 @@ - - - - - - Edit Scheduled Transaction - dialog - - - True - vertical - 8 - - - True - vertical - - - True - - - True - 1 - 5 - <b>Name</b> - True - True - center - sxe_name - - - False - False - 0 - - - - - - - - False - False - 0 - - - - - True - 12 - - - True - True - - - - - False - 1 - - - - - True - True - - - True - vertical - - - True - - - False - False - 0 - - - - - True - 0 - <b>Options</b> - True - - - False - False - 4 - 1 - - - - - True - 12 - - - True - 5 - 2 - 6 - - - Create in advance: - True - True - False - True - True - - - 3 - 4 - GTK_FILL - - - - - - Remind in advance: - True - True - False - True - True - - - 4 - 5 - GTK_FILL - - - - - - True - - - True - True - adjustment13 - 1 - True - True - - - False - 0 - - - - - True - days - center - - - False - False - 1 - - - - - 1 - 2 - 4 - 5 - GTK_FILL - GTK_FILL - - - - - Create automatically - True - True - False - Conditional on splits not having variables - True - True - - - 2 - 1 - 2 - GTK_FILL - - - - - - True - - - True - True - adjustment12 - 1 - True - True - - - False - 0 - - - - - True - days - center - - - False - False - 1 - - - - - 1 - 2 - 3 - 4 - GTK_FILL - GTK_FILL - - - - - True - - - Notify me when created - True - False - True - False - True - True - - - - - 2 - 2 - 3 - GTK_FILL - GTK_FILL - 24 - - - - - Enabled - True - True - False - True - True - - - GTK_FILL - - - - - - - - - - - False - 2 - - - - - True - - - False - False - 3 - - - - - True - 0 - <b>Occurrences</b> - True - - - False - False - 4 - 4 - - - - - True - 12 - - - True - vertical - - - True - - - True - 0 - Last Occurred: - center - - - False - False - 0 - - - - - True - YYYY-MM-DD - center - - - False - False - 1 - - - - - False - False - 0 - - - - - True - 0 - Repeats: - - - False - False - 1 - - - - - True - 12 - - - True - 4 - 3 - - - Forever - True - True - False - True - True - True - - - GTK_FILL - - - - - - Until: - True - True - False - True - True - rb_noend - - - 1 - 2 - GTK_FILL - - - - - - For: - True - True - False - True - True - rb_noend - - - 2 - 3 - GTK_FILL - - - - - - True - 3 - occurrences - - - 2 - 3 - 2 - 3 - GTK_FILL - - - - - - True - 0 - 3 - remaining - - - 2 - 3 - 3 - 4 - GTK_FILL - - - - - - True - - - - - - 1 - 3 - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - True - adjustment11 - 1 - True - - - 1 - 2 - 2 - 3 - GTK_FILL - - - - - - True - True - adjustment10 - 1 - True - - - 1 - 2 - 3 - 4 - GTK_FILL - - - - - - - - - - - - - - - - - False - 2 - - - - - - - False - 5 - - - - - - - True - Overview - - - False - - - - - True - vertical - - - True - - - - - - 0 - - - - - True - - - - - - 1 - - - - - 1 - - - - - True - Frequency - - - 1 - False - - - - - True - 1 - vertical - - - - - - 2 - - - - - True - Template Transaction - - - 2 - False - - - - - 2 - - - - - 2 - - - - - True - end - - - gtk-help - True - True - True - False - True - - - False - False - 0 - - - - - gtk-cancel - True - True - True - False - True - - - False - False - 1 - - - - - gtk-ok - True - True - True - False - True - - - False - False - 2 - - - - - False - end - 0 - - - - - - help_button - cancel_button - ok_button - - - - This window should never be realized. - - - True - - - True - vertical - - - True - 2 - 2 - - - True - 1 - 5 - Frequency: - right - - - GTK_FILL - - - - - - True - 1 - 5 - Start Date: - center - - - 1 - 2 - GTK_FILL - - - - - - True - liststore11 - - - - 0 - - - - - 1 - 2 - GTK_FILL - GTK_FILL - - - - - - - - False - False - 0 - - - - - True - False - True - - - True - Not scheduled - center - - - - - True - None - center - - - False - - - - - True - True - - - True - Select occurrence date above. - center - - - False - False - 0 - - - - - 1 - - - - - True - Once - center - - - 1 - False - - - - - True - - - True - 1 - 4 - Every - right - - - False - False - 0 - - - - - True - True - adjustment9 - 1 - True - True - - - False - False - 1 - - - - - True - 0 - 5 - days. - center - - - False - False - 2 - - - - - 2 - - - - - True - Daily - center - - - 2 - False - - - - - True - vertical - - - True - - - True - 1 - Every - right - - - False - 0 - - - - - True - True - adjustment8 - 1 - - - False - False - 1 - - - - - True - 0 - weeks. - fill - - - 2 - - - - - False - False - 5 - 0 - - - - - True - 2 - 0.5 - - - True - - - True - vertical - - - Sunday - True - True - False - True - True - - - False - False - 0 - - - - - Monday - True - True - False - True - True - - - False - False - 1 - - - - - Tuesday - True - True - False - True - True - - - False - False - 2 - - - - - False - False - 0 - - - - - True - vertical - - - Wednesday - True - True - False - True - True - - - False - False - 0 - - - - - Thursday - True - True - False - True - True - - - False - False - 1 - - - - - Friday - True - True - False - True - True - - - False - False - 2 - - - - - False - False - 1 - - - - - True - vertical - - - Saturday - True - True - False - True - True - - - False - False - 0 - - - - - False - False - 2 - - - - - - - True - Days - - - - - False - False - 1 - - - - - 3 - False - - - - - True - Weekly - center - - - 3 - False - - - - - True - - - True - 5 - vertical - - - True - - - True - 1 - Every - right - - - False - False - 0 - - - - - True - True - adjustment7 - 1 - True - - - False - False - 1 - - - - - True - 0 - months. - - - False - 2 - - - - - False - False - 5 - 0 - - - - - True - - - True - 1 - First on the: - right - - - False - 0 - - - - - True - liststore10 - - - - 0 - - - - - 1 - - - - - True - 1 - except on weekends: - right - - - False - 2 - 2 - - - - - True - liststore9 - - - - 0 - - - - - False - False - 3 - - - - - False - False - 3 - 1 - - - - - True - - - True - 1 - then on the: - right - - - False - False - 0 - - - - - True - liststore8 - - - - 0 - - - - - False - False - 1 - - - - - True - 1 - except on weekends: - right - - - False - 2 - 2 - - - - - True - liststore7 - - - - 0 - - - - - False - False - 3 - - - - - False - False - 3 - 2 - - - - - False - False - 0 - - - - - 4 - - - - - True - Semi-Monthly - center - - - 4 - False - - - - - True - - - True - vertical - - - True - - - True - 1 - Every - center - - - False - 0 - - - - - True - True - adjustment6 - 1 - True - True - True - - - False - False - 1 - - - - - True - 0 - months. - center - - - False - 2 - - - - - False - False - 5 - 0 - - - - - True - - - True - 1 - On the - right - - - False - 2 - 0 - - - - - True - liststore6 - - - - 0 - - - - - False - False - 1 - - - - - True - 1 - except on weekends: - right - - - False - 2 - 2 - - - - - True - liststore5 - - - - 0 - - - - - False - False - 3 - - - - - False - 3 - 1 - - - - - 3 - 0 - - - - - 5 - - - - - True - Monthly - center - - - 5 - False - - - - - False - False - 1 - - - - - - - - - Make Scheduled Transaction - dialog - - - True - vertical - 8 - - - True - - - True - vertical - - - True - 3 - 2 - - - True - 1 - 3 - Name: - center - - - GTK_FILL - - - - - - True - 1 - 3 - Frequency: - center - - - 1 - 2 - GTK_FILL - - - - - - True - 1 - 3 - Start Date: - center - - - 2 - 3 - GTK_FILL - - - - - - True - True - - - 1 - 2 - - - - - - True - liststore4 - - - - 0 - - - - - 1 - 2 - 1 - 2 - GTK_FILL - GTK_FILL - - - - - - - - False - False - 0 - - - - - True - 2 - 0 - none - - - True - 10 - - - True - vertical - - - Never End - True - True - False - True - True - - - False - False - 0 - - - - - True - - - End Date: - True - True - False - True - True - never_end_button - - - False - False - 0 - - - - - - - - False - False - 1 - - - - - True - - - Number of Occurrences: - True - True - False - True - True - never_end_button - - - False - False - 0 - - - - - - - - False - False - 2 - - - - - - - - - True - <b>End</b> - True - - - - - False - False - 1 - - - - - False - False - 0 - - - - - True - 0 - - - - - - 1 - - - - - 2 - - - - - True - end - - - Advanced... - True - True - True - False - True - - - False - False - 0 - - - - - gtk-cancel - True - True - True - False - True - - - False - False - 1 - - - - - gtk-ok - True - True - True - False - True - - - False - False - 2 - - - - - False - end - 0 - - - - - - advanced_button - cancel_button - ok_button - - - - True - - - True - Creation State - True - - - True - - - Ignore - True - True - True - accelgroup1 - - - - - - Postpone - True - True - True - accelgroup1 - - - - - - Create - True - True - True - accelgroup1 - - - - - - - - - - True - Preferences - - - True - 6 - 11 - 4 - 12 - - - True - 0 - <b>Since Last Run Dialog</b> - True - - - GTK_FILL - - - - - - True - 0 - - - 2 - 3 - GTK_FILL - - - - - - True - 0 - <b>Transaction Editor Defaults</b> - True - - - 3 - 4 - GTK_FILL - - - - - - _Run when data file opened - True - True - False - Show the "since last run" window when a file is opened. - True - True - - - 4 - 1 - 2 - GTK_FILL - - 12 - - - - - _Auto-create new transactions - True - True - False - Set the 'auto-create' flag on newly created scheduled transactions. - True - True - - - - 4 - 4 - 5 - GTK_FILL - - 12 - - - - - True - 12 - - - True - 0 - Crea_te in advance: - True - gconf/dialogs/scheduled_trans/transaction_editor/create_days - - - - - 6 - 7 - GTK_FILL - GTK_FILL - - - - - True - 12 - - - True - 0 - R_emind in advance: - True - - - - - 7 - 8 - GTK_FILL - GTK_FILL - - - - - True - 6 - - - True - True - Begin notifications this many days before the transaction is created. - adjustment2 - 1 - - - False - 0 - - - - - True - 0 - days - - - False - False - 1 - - - - - 1 - 2 - 7 - 8 - GTK_FILL - GTK_FILL - - - - - True - 6 - - - True - True - Create the transaction this many days before its effective date. - adjustment1 - 1 - - - False - 0 - - - - - True - 0 - days - - - False - False - 1 - - - - - 1 - 2 - 6 - 7 - GTK_FILL - GTK_FILL - - - - - _Notify before transactions are created - True - False - True - False - Set the 'notify' flag on newly created scheduled transactions. - True - True - - - - 4 - 5 - 6 - GTK_FILL - - 30 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Current Year - - - Now + 1 Year - - - Whole Loan - - - Custom - - - - - - - - - - - Fixed Rate - - - 3/1 Year ARM - - - 5/1 Year ARM - - - 7/1 Year ARM - - - 10/1 Year ARM - - - - - - - - - - - months - - - years - - - - - - - - - - - Daily - - - Weekly - - - Bi-Weekly - - - Monthly - - - Quarterly - - - Yearly - - - - - - - - - - - No change - - - Use previous weekday - - - Use next weekday - - - - - - - - - - - 1st - - - 2nd - - - 3rd - - - 4th - - - 5th - - - 6th - - - 7th - - - 8th - - - 9th - - - 10th - - - 11th - - - 12th - - - 13th - - - 14th - - - 15th - - - 16th - - - 17th - - - 18th - - - 19th - - - 20th - - - 21st - - - 22nd - - - 23rd - - - 24th - - - 25th - - - 26th - - - 27th - - - 28th - - - 29th - - - 30th - - - 31st - - - Last day of month - - - Last Monday - - - Last Tuesday - - - Last Wednesday - - - Last Thursday - - - Last Friday - - - Last Saturday - - - Last Sunday - - - 1st Mon - - - 1st Tue - - - 1st Wed - - - 1st Thu - - - 1st Fri - - - 1st Sat - - - 1st Sun - - - 2nd Mon - - - 2nd Tue - - - 2nd Wed - - - 2nd Thu - - - 2nd Fri - - - 2nd Sat - - - 2nd Sun - - - 3rd Mon - - - 3rd Tue - - - 3rd Wed - - - 3rd Thu - - - 3rd Fri - - - 3rd Sat - - - 3rd Sun - - - 4th Mon - - - 4th Tue - - - 4th Wed - - - 4th Thu - - - 4th Fri - - - 4th Sat - - - 4th Sun - - - - - - - - - - - No change - - - Use previous weekday - - - Use next weekday - - - - - - - - - - - 1st - - - 2nd - - - 3rd - - - 4th - - - 5th - - - 6th - - - 7th - - - 8th - - - 9th - - - 10th - - - 11th - - - 12th - - - 13th - - - 14th - - - 15th - - - 16th - - - 17th - - - 18th - - - 19th - - - 20th - - - 21st - - - 22nd - - - 23rd - - - 24th - - - 25th - - - 26th - - - 27th - - - 28th - - - 29th - - - 30th - - - 31st - - - Last day of month - - - Last Monday - - - Last Tuesday - - - Last Wednesday - - - Last Thursday - - - Last Friday - - - Last Saturday - - - Last Sunday - - - - - - - - - - - No change - - - Use previous weekday - - - Use next weekday - - - - - - - - - - - 1st - - - 2nd - - - 3rd - - - 4th - - - 5th - - - 6th - - - 7th - - - 8th - - - 9th - - - 10th - - - 11th - - - 12th - - - 13th - - - 14th - - - 15th - - - 16th - - - 17th - - - 18th - - - 19th - - - 20th - - - 21st - - - 22nd - - - 23rd - - - 24th - - - 25th - - - 26th - - - 27th - - - 28th - - - 29th - - - 30th - - - 31st - - - Last day of month - - - Last Monday - - - Last Tuesday - - - Last Wednesday - - - Last Thursday - - - Last Friday - - - Last Saturday - - - Last Sunday - - - - - - - - - - - None - - - Once - - - Daily - - - Weekly - - - Semi-Monthly - - - Monthly - - - - - True - Account Deletion - center - 320 - 240 - dialog - - - True - vertical - - - True - vertical - - - True - The following Scheduled Transactions reference the deleted account, and must now be corrected. Press OK to edit them. - True - - - False - False - 0 - - - - - True - True - automatic - automatic - in - - - True - False - False - - - - - 1 - - - - - 2 - - - - - True - end - - - gtk-ok - True - True - True - False - True - - - False - False - 0 - - - - - False - end - 0 - - - - - - okbutton1 - - - - True - window1 - - - True - True - vertical - - - True - vertical - - - True - 0 - <b>Transactions</b> - True - - - False - False - 0 - - - - - True - 12 - - - True - 12 - - - True - False - automatic - automatic - in - - - - - - 0 - - - - - - - 1 - - - - - True - True - - - - - True - vertical - - - True - - - False - False - 0 - - - - - True - 0 - <b>Upcoming</b> - True - - - False - False - 1 - - - - - True - 12 - - - True - - - - - - - - 2 - - - - - False - True - - - - - - - True - Since Last Run... - center-on-parent - 640 - 480 - True - dialog - - - True - vertical - - - True - vertical - - - True - True - automatic - automatic - in - - - True - True - True - - - - - 0 - - - - - True - - - True - - - 0 - - - - - _Review created transactions - True - True - False - True - True - - - False - False - 1 - - - - - False - False - 1 - - - - - 2 - - - - - True - end - - - gtk-cancel - True - True - True - True - False - True - - - False - False - 0 - - - - - gtk-ok - True - True - True - False - True - - - False - False - 1 - - - - - False - end - 0 - - - - - - cancelbutton1 - okbutton2 - - - - 10000000 - 1 - 10 - - - 10000000 - 1 - 10 - - - 1 - 100 - 1 - 10 - - - 1 - 100 - 1 - 10 - - - 1 - 100 - 1 - 10 - - - 1 - 1 - 100 - 1 - 10 - - - 1 - 1 - 100 - 1 - 10 - - - 1 - 1 - 100 - 1 - 10 - - - 1 - 1 - 731 - 1 - 10 - - - 1 - 1000 - 1 - 10 - - - 1 - 1000 - 1 - 10 - - - 731 - 1 - 30 - - - 731 - 1 - 30 - - -