mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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
This commit is contained in:
parent
b2e8c5d2de
commit
24e195d7d0
@ -234,13 +234,13 @@ src/gnome/gtkbuilder/dialog-fincalc.glade
|
|||||||
src/gnome/gtkbuilder/dialog-lot-viewer.glade
|
src/gnome/gtkbuilder/dialog-lot-viewer.glade
|
||||||
src/gnome/gtkbuilder/dialog-price.glade
|
src/gnome/gtkbuilder/dialog-price.glade
|
||||||
src/gnome/gtkbuilder/dialog-print-check.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/gnc-plugin-page-budget.glade
|
||||||
src/gnome/gtkbuilder/newuser.glade
|
src/gnome/gtkbuilder/newuser.glade
|
||||||
src/gnome/gtkbuilder/owner.glade
|
src/gnome/gtkbuilder/owner.glade
|
||||||
src/gnome/gtkbuilder/progress.glade
|
src/gnome/gtkbuilder/progress.glade
|
||||||
src/gnome/gtkbuilder/reconcile.glade
|
src/gnome/gtkbuilder/reconcile.glade
|
||||||
src/gnome/gtkbuilder/register.glade
|
src/gnome/gtkbuilder/register.glade
|
||||||
src/gnome/gtkbuilder/sched-xact.glade
|
|
||||||
src/gnome/gtkbuilder/tax.glade
|
src/gnome/gtkbuilder/tax.glade
|
||||||
src/gnome/gtkbuilder/userpass.glade
|
src/gnome/gtkbuilder/userpass.glade
|
||||||
src/gnome/gtkbuilder/window-autoclear.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-commodity.glade
|
||||||
src/gnome-utils/gtkbuilder/dialog-transfer.glade
|
src/gnome-utils/gtkbuilder/dialog-transfer.glade
|
||||||
src/gnome-utils/gtkbuilder/gnc-date-format.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/gtkbuilder/gnc-recurrence.glade
|
||||||
src/gnome-utils/misc-gnome-utils.c
|
src/gnome-utils/misc-gnome-utils.c
|
||||||
src/gnome-utils/print-session.c
|
src/gnome-utils/print-session.c
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2001,2002,2007 Joshua Sled <jsled@asynchronous.org>*
|
* Copyright (C) 2001,2002,2007 Joshua Sled <jsled@asynchronous.org>*
|
||||||
* Copyright (C) 2003 Linas Vepstas <linas@linas.org> *
|
* Copyright (C) 2003 Linas Vepstas <linas@linas.org> *
|
||||||
* Copyright (C) 2006 David Hampton <hampton@employees.org> *
|
* Copyright (C) 2006 David Hampton <hampton@employees.org> *
|
||||||
|
* Copyright (C) 2011 Robert Fewell *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or *
|
* This program is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU General Public License as *
|
* modify it under the terms of the GNU General Public License as *
|
||||||
@ -40,6 +41,8 @@
|
|||||||
#undef G_LOG_DOMAIN
|
#undef G_LOG_DOMAIN
|
||||||
#define G_LOG_DOMAIN "gnc.gui.frequency"
|
#define G_LOG_DOMAIN "gnc.gui.frequency"
|
||||||
|
|
||||||
|
static QofLogModule log_module = GNC_MOD_GUI;
|
||||||
|
|
||||||
#define LAST_DAY_OF_MONTH_OPTION_INDEX 31
|
#define LAST_DAY_OF_MONTH_OPTION_INDEX 31
|
||||||
|
|
||||||
/** Private Defs ********************/
|
/** Private Defs ********************/
|
||||||
@ -129,6 +132,7 @@ gnc_frequency_get_type()
|
|||||||
return gncfreq_type;
|
return gncfreq_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_frequency_class_init( GncFrequencyClass *klass )
|
gnc_frequency_class_init( GncFrequencyClass *klass )
|
||||||
{
|
{
|
||||||
@ -148,6 +152,7 @@ gnc_frequency_class_init( GncFrequencyClass *klass )
|
|||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_frequency_init(GncFrequency *gf)
|
gnc_frequency_init(GncFrequency *gf)
|
||||||
{
|
{
|
||||||
@ -155,6 +160,7 @@ gnc_frequency_init(GncFrequency *gf)
|
|||||||
GtkVBox* vb;
|
GtkVBox* vb;
|
||||||
GtkWidget* o;
|
GtkWidget* o;
|
||||||
GtkAdjustment* adj;
|
GtkAdjustment* adj;
|
||||||
|
GtkBuilder *builder;
|
||||||
|
|
||||||
static const struct comboBoxTuple
|
static const struct comboBoxTuple
|
||||||
{
|
{
|
||||||
@ -185,28 +191,42 @@ gnc_frequency_init(GncFrequency *gf)
|
|||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
gf->gxml = gnc_glade_xml_new("sched-xact.glade", "gncfreq_vbox");
|
builder = gtk_builder_new();
|
||||||
o = glade_xml_get_widget(gf->gxml, "gncfreq_nb");
|
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);
|
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->freqComboBox = GTK_COMBO_BOX(o);
|
||||||
gf->startDate = GNC_DATE_EDIT(gnc_date_edit_new(time(NULL), FALSE, FALSE));
|
gf->startDate = GNC_DATE_EDIT(gnc_date_edit_new(time(NULL), FALSE, FALSE));
|
||||||
/* Add the new widget to the table. */
|
/* Add the new widget to the table. */
|
||||||
{
|
{
|
||||||
gint dont_expand_or_fill = 0;
|
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),
|
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);
|
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;
|
gf->vb = vb;
|
||||||
gtk_container_add(GTK_CONTAINER(&gf->widget), GTK_WIDGET(gf->vb));
|
gtk_container_add(GTK_CONTAINER(&gf->widget), GTK_WIDGET(gf->vb));
|
||||||
|
|
||||||
/* initialize the combo boxes */
|
/* initialize the combo boxes */
|
||||||
for (i = 0; comboBoxes[i].name != NULL; i++)
|
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);
|
gtk_combo_box_set_active(GTK_COMBO_BOX(o), 0);
|
||||||
if (comboBoxes[i].fn != NULL)
|
if (comboBoxes[i].fn != NULL)
|
||||||
{
|
{
|
||||||
@ -219,7 +239,7 @@ gnc_frequency_init(GncFrequency *gf)
|
|||||||
{
|
{
|
||||||
if (spinVals[i].fn != NULL)
|
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));
|
adj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(o));
|
||||||
g_signal_connect(adj, "value_changed", G_CALLBACK(spinVals[i].fn), gf);
|
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 */
|
/* initialize the weekly::day-of-week checkbox-selection hooks */
|
||||||
for (i = 0; i < 7; i++)
|
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_signal_connect(o, "clicked",
|
||||||
G_CALLBACK(weekly_days_changed), gf);
|
G_CALLBACK(weekly_days_changed), gf);
|
||||||
}
|
}
|
||||||
@ -237,42 +257,54 @@ gnc_frequency_init(GncFrequency *gf)
|
|||||||
|
|
||||||
/* respond to start date changes */
|
/* respond to start date changes */
|
||||||
g_signal_connect(gf->startDate, "date_changed", G_CALLBACK(start_date_changed), gf);
|
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
|
static void
|
||||||
spin_changed_helper( GtkAdjustment *adj, gpointer d )
|
spin_changed_helper( GtkAdjustment *adj, gpointer d )
|
||||||
{
|
{
|
||||||
g_signal_emit_by_name(GNC_FREQUENCY(d), "changed");
|
g_signal_emit_by_name(GNC_FREQUENCY(d), "changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
weekly_days_changed( GtkButton *b, gpointer d )
|
weekly_days_changed( GtkButton *b, gpointer d )
|
||||||
{
|
{
|
||||||
g_signal_emit_by_name(GNC_FREQUENCY(d), "changed");
|
g_signal_emit_by_name(GNC_FREQUENCY(d), "changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
monthly_sel_changed( GtkButton *b, gpointer d )
|
monthly_sel_changed( GtkButton *b, gpointer d )
|
||||||
{
|
{
|
||||||
g_signal_emit_by_name(GNC_FREQUENCY(d), "changed");
|
g_signal_emit_by_name(GNC_FREQUENCY(d), "changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
semimonthly_sel_changed( GtkButton *b, gpointer d )
|
semimonthly_sel_changed( GtkButton *b, gpointer d )
|
||||||
{
|
{
|
||||||
g_signal_emit_by_name(GNC_FREQUENCY(d), "changed");
|
g_signal_emit_by_name(GNC_FREQUENCY(d), "changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline guint32 minn( guint32 a, guint32 b )
|
static inline guint32 minn( guint32 a, guint32 b )
|
||||||
{
|
{
|
||||||
return a > b ? b : a;
|
return a > b ? b : a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline guint32 maxn( guint32 a, guint32 b )
|
static inline guint32 maxn( guint32 a, guint32 b )
|
||||||
{
|
{
|
||||||
return a > b ? a : b;
|
return a > b ? a : b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
freq_combo_changed(GtkComboBox *b, gpointer d)
|
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");
|
g_signal_emit_by_name(gf, "changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
start_date_changed( GNCDateEdit *gde, gpointer d )
|
start_date_changed( GNCDateEdit *gde, gpointer d )
|
||||||
{
|
{
|
||||||
g_signal_emit_by_name(GNC_FREQUENCY(d), "changed");
|
g_signal_emit_by_name(GNC_FREQUENCY(d), "changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================================================================= */
|
|
||||||
/* Relabel some of the labels */
|
|
||||||
|
|
||||||
|
/**************************************
|
||||||
|
* Relabel some of the labels *
|
||||||
|
*************************************/
|
||||||
void
|
void
|
||||||
gnc_frequency_set_frequency_label_text(GncFrequency *gf, const gchar *txt)
|
gnc_frequency_set_frequency_label_text(GncFrequency *gf, const gchar *txt)
|
||||||
{
|
{
|
||||||
GtkLabel *lbl;
|
GtkLabel *lbl;
|
||||||
if (!gf || !txt) return;
|
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);
|
gtk_label_set_text (lbl, txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_frequency_set_date_label_text(GncFrequency *gf, const gchar *txt)
|
gnc_frequency_set_date_label_text(GncFrequency *gf, const gchar *txt)
|
||||||
{
|
{
|
||||||
GtkLabel *lbl;
|
GtkLabel *lbl;
|
||||||
if (!gf || !txt) return;
|
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);
|
gtk_label_set_text (lbl, txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
gnc_frequency_new_from_recurrence(GList *recurrences, const GDate *start_date)
|
gnc_frequency_new_from_recurrence(GList *recurrences, const GDate *start_date)
|
||||||
{
|
{
|
||||||
return gnc_frequency_new(recurrences, start_date);
|
return gnc_frequency_new(recurrences, start_date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
gnc_frequency_new(GList *recurrences, const GDate *start_date)
|
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);
|
return GTK_WIDGET(toRet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_setup_weekly_recurrence(GncFrequency *gf, Recurrence *r)
|
_setup_weekly_recurrence(GncFrequency *gf, Recurrence *r)
|
||||||
{
|
{
|
||||||
@ -336,7 +374,7 @@ _setup_weekly_recurrence(GncFrequency *gf, Recurrence *r)
|
|||||||
const char *checkbox_widget_name;
|
const char *checkbox_widget_name;
|
||||||
GtkWidget *weekday_checkbox;
|
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);
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(multipler_spin), multiplier);
|
||||||
|
|
||||||
recurrence_date = recurrenceGetDate(r);
|
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
|
// this `mod 7' is explicit knowledge of the values of (monday=1)-based
|
||||||
// GDateWeekday, vs. our (sunday=0)-based checkbox names array.
|
// GDateWeekday, vs. our (sunday=0)-based checkbox names array.
|
||||||
checkbox_widget_name = CHECKBOX_NAMES[day_of_week % 7];
|
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);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(weekday_checkbox), TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_get_monthly_combobox_index(Recurrence *r)
|
_get_monthly_combobox_index(Recurrence *r)
|
||||||
{
|
{
|
||||||
@ -379,12 +418,14 @@ _get_monthly_combobox_index(Recurrence *r)
|
|||||||
return day_of_month_index;
|
return day_of_month_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_frequency_setup_recurrence(GncFrequency *gf, GList *recurrences, const GDate *start_date)
|
gnc_frequency_setup_recurrence(GncFrequency *gf, GList *recurrences, const GDate *start_date)
|
||||||
{
|
{
|
||||||
gnc_frequency_setup(gf, recurrences, start_date);
|
gnc_frequency_setup(gf, recurrences, start_date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_frequency_setup(GncFrequency *gf, GList *recurrences, const GDate *start_date)
|
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);
|
first = (Recurrence*)g_list_nth_data(recurrences, 0);
|
||||||
second = (Recurrence*)g_list_nth_data(recurrences, 1);
|
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));
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(multiplier_spin), recurrenceGetMultiplier(first));
|
||||||
|
dom_combobox = GTK_WIDGET(gtk_builder_get_object (gf->builder, "semimonthly_first"));
|
||||||
dom_combobox = glade_xml_get_widget(gf->gxml, "semimonthly_first");
|
|
||||||
gtk_combo_box_set_active(GTK_COMBO_BOX(dom_combobox), _get_monthly_combobox_index(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));
|
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));
|
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_combo_box_set_active(GTK_COMBO_BOX(dom_combobox), recurrenceGetWeekendAdjust(second));
|
||||||
|
|
||||||
gtk_notebook_set_current_page(gf->nb, PAGE_SEMI_MONTHLY);
|
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;
|
GtkWidget *spin_button;
|
||||||
|
|
||||||
multiplier = recurrenceGetMultiplier(r);
|
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);
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_button), multiplier);
|
||||||
made_changes = TRUE;
|
made_changes = TRUE;
|
||||||
|
|
||||||
@ -496,15 +536,15 @@ gnc_frequency_setup(GncFrequency *gf, GList *recurrences, const GDate *start_dat
|
|||||||
guint multiplier;
|
guint multiplier;
|
||||||
GtkWidget *multipler_spin, *day_of_month, *weekend_mode;
|
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);
|
multiplier = recurrenceGetMultiplier(r);
|
||||||
if (recurrenceGetPeriodType(r) == PERIOD_YEAR)
|
if (recurrenceGetPeriodType(r) == PERIOD_YEAR)
|
||||||
multiplier *= 12;
|
multiplier *= 12;
|
||||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(multipler_spin), multiplier);
|
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));
|
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_combo_box_set_active(GTK_COMBO_BOX(weekend_mode), recurrenceGetWeekendAdjust(r));
|
||||||
|
|
||||||
gtk_notebook_set_current_page(gf->nb, PAGE_MONTHLY);
|
gtk_notebook_set_current_page(gf->nb, PAGE_MONTHLY);
|
||||||
@ -522,21 +562,23 @@ maybe_signal:
|
|||||||
g_signal_emit_by_name(gf, "changed");
|
g_signal_emit_by_name(gf, "changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
_get_multiplier_from_widget(GncFrequency *gf, char *widget_name)
|
_get_multiplier_from_widget(GncFrequency *gf, char *widget_name)
|
||||||
{
|
{
|
||||||
GtkWidget *multiplier_spin;
|
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));
|
return gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(multiplier_spin));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Recurrence*
|
static Recurrence*
|
||||||
_get_day_of_month_recurrence(GncFrequency *gf, GDate *start_date, int multiplier, char *combo_name, char *combo_weekend_name)
|
_get_day_of_month_recurrence(GncFrequency *gf, GDate *start_date, int multiplier, char *combo_name, char *combo_weekend_name)
|
||||||
{
|
{
|
||||||
Recurrence *r;
|
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));
|
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));
|
int weekend_adjust = gtk_combo_box_get_active(GTK_COMBO_BOX(weekend_adjust_combo));
|
||||||
GDateWeekday selected_day_of_week;
|
GDateWeekday selected_day_of_week;
|
||||||
GDate *day_of_week_date;
|
GDate *day_of_week_date;
|
||||||
@ -582,6 +624,7 @@ _get_day_of_month_recurrence(GncFrequency *gf, GDate *start_date, int multiplier
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_frequency_save_to_recurrence(GncFrequency *gf, GList **recurrences, GDate *out_start_date)
|
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;
|
GDate *day_of_week_aligned_date;
|
||||||
Recurrence *r;
|
Recurrence *r;
|
||||||
const char *day_widget_name = CHECKBOX_NAMES[checkbox_idx];
|
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)))
|
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(weekday_checkbox)))
|
||||||
continue;
|
continue;
|
||||||
|
@ -47,7 +47,7 @@ typedef struct _GncFrequency
|
|||||||
GtkNotebook *nb;
|
GtkNotebook *nb;
|
||||||
GtkComboBox *freqComboBox;
|
GtkComboBox *freqComboBox;
|
||||||
GNCDateEdit *startDate;
|
GNCDateEdit *startDate;
|
||||||
GladeXML *gxml;
|
GtkBuilder *builder;
|
||||||
} GncFrequency;
|
} GncFrequency;
|
||||||
|
|
||||||
typedef struct _GncFrequencyClass
|
typedef struct _GncFrequencyClass
|
||||||
|
@ -3,6 +3,7 @@ gtkbuilder_DATA = \
|
|||||||
dialog-commodity.glade \
|
dialog-commodity.glade \
|
||||||
dialog-transfer.glade \
|
dialog-transfer.glade \
|
||||||
gnc-date-format.glade \
|
gnc-date-format.glade \
|
||||||
|
gnc-frequency.glade \
|
||||||
gnc-recurrence.glade
|
gnc-recurrence.glade
|
||||||
|
|
||||||
EXTRA_DIST = $(gtkbuilder_DATA)
|
EXTRA_DIST = $(gtkbuilder_DATA)
|
||||||
|
1463
src/gnome-utils/gtkbuilder/gnc-frequency.glade
Normal file
1463
src/gnome-utils/gtkbuilder/gnc-frequency.glade
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,21 +1,23 @@
|
|||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* dialog-sx-editor.c : dialog for scheduled transaction editing *
|
* dialog-sx-editor.c : dialog for scheduled transaction editing *
|
||||||
* Copyright (C) 2001,2002,2006 Joshua Sled <jsled@asynchronous.org>*
|
* Copyright (C) 2001,2002,2006 Joshua Sled <jsled@asynchronous.org>*
|
||||||
|
* Copyright (C) 2011 Robert Fewell *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or *
|
* 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 *
|
* modify it under the terms of version 2 and/or version 3 of the *
|
||||||
* License as published by the Free Software Foundation. *
|
* 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
|
* As a special exception, permission is granted to link the binary *
|
||||||
* "OpenSSL" library (or modified versions of it that use the same
|
* module resultant from this code with the OpenSSL project's *
|
||||||
* license as the "OpenSSL" library), and distribute the linked
|
* "OpenSSL" library (or modified versions of it that use the same *
|
||||||
* executable. You must obey the GNU General Public License in all
|
* license as the "OpenSSL" library), and distribute the linked *
|
||||||
* respects for all of the code used other than "OpenSSL". If you
|
* executable. You must obey the GNU General Public License in all *
|
||||||
* modify this file, you may extend this exception to your version
|
* respects for all of the code used other than "OpenSSL". If you *
|
||||||
* of the file, but you are not obligated to do so. If you do not
|
* modify this file, you may extend this exception to your version *
|
||||||
* wish to do so, delete this exception statement from your version
|
* of the file, but you are not obligated to do so. If you do not *
|
||||||
* of this file.
|
* 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, *
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
@ -70,26 +72,10 @@
|
|||||||
#undef G_LOG_DOMAIN
|
#undef G_LOG_DOMAIN
|
||||||
#define G_LOG_DOMAIN "gnc.gui.sx.editor"
|
#define G_LOG_DOMAIN "gnc.gui.sx.editor"
|
||||||
|
|
||||||
|
static QofLogModule log_module = GNC_MOD_GUI_SX;
|
||||||
|
|
||||||
static gint _sx_engine_event_handler_id = -1;
|
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_NEVER_OPTION 0
|
||||||
#define END_DATE_OPTION 1
|
#define END_DATE_OPTION 1
|
||||||
#define NUM_OCCUR_OPTION 2
|
#define NUM_OCCUR_OPTION 2
|
||||||
@ -111,10 +97,13 @@ typedef enum _EndTypeEnum
|
|||||||
END_OCCUR,
|
END_OCCUR,
|
||||||
} EndType;
|
} EndType;
|
||||||
|
|
||||||
|
typedef enum { NO_END, DATE_END, COUNT_END } END_TYPE;
|
||||||
|
|
||||||
struct _GncSxEditorDialog
|
struct _GncSxEditorDialog
|
||||||
{
|
{
|
||||||
GladeXML *gxml;
|
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
|
GtkBuilder *builder;
|
||||||
|
GtkNotebook *notebook;
|
||||||
SchedXaction *sx;
|
SchedXaction *sx;
|
||||||
/* If this is a new scheduled transaction or not. */
|
/* If this is a new scheduled transaction or not. */
|
||||||
int newsxP;
|
int newsxP;
|
||||||
@ -156,25 +145,21 @@ struct _GncSxEditorDialog
|
|||||||
static void schedXact_editor_create_freq_sel( GncSxEditorDialog *sxed );
|
static void schedXact_editor_create_freq_sel( GncSxEditorDialog *sxed );
|
||||||
static void schedXact_editor_create_ledger( GncSxEditorDialog *sxed );
|
static void schedXact_editor_create_ledger( GncSxEditorDialog *sxed );
|
||||||
static void schedXact_editor_populate( GncSxEditorDialog * );
|
static void schedXact_editor_populate( GncSxEditorDialog * );
|
||||||
|
|
||||||
static void gnc_sxed_record_size( GncSxEditorDialog *sxed );
|
static void gnc_sxed_record_size( GncSxEditorDialog *sxed );
|
||||||
static void gnc_sxed_get_widgets( GncSxEditorDialog *sxed );
|
static void endgroup_rb_toggled_cb( GtkButton *b, gpointer d );
|
||||||
static void endgroup_rb_toggled( GtkButton *b, gpointer d );
|
|
||||||
static void set_endgroup_toggle_states( GncSxEditorDialog *sxed, EndType t );
|
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_consistent( GncSxEditorDialog *sxed );
|
||||||
static gboolean gnc_sxed_check_changed( GncSxEditorDialog *sxed );
|
static gboolean gnc_sxed_check_changed( GncSxEditorDialog *sxed );
|
||||||
static void gnc_sxed_save_sx( GncSxEditorDialog *sxed );
|
static void gnc_sxed_save_sx( GncSxEditorDialog *sxed );
|
||||||
static void gnc_sxed_freq_changed( GncFrequency *gf, gpointer ud );
|
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 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 void gnc_sxed_reg_check_close(GncSxEditorDialog *sxed);
|
||||||
|
|
||||||
static gboolean sxed_delete_event( GtkWidget *widget, GdkEvent *event, gpointer ud );
|
static gboolean sxed_delete_event( GtkWidget *widget, GdkEvent *event, gpointer ud );
|
||||||
|
|
||||||
static gboolean sxed_confirmed_cancel( GncSxEditorDialog *sxed );
|
static gboolean sxed_confirmed_cancel( GncSxEditorDialog *sxed );
|
||||||
|
|
||||||
static gboolean editor_component_sx_equality( gpointer find_data,
|
static gboolean editor_component_sx_equality( gpointer find_data,
|
||||||
gpointer user_data );
|
gpointer user_data );
|
||||||
|
|
||||||
@ -200,6 +185,7 @@ sxed_close_handler(gpointer user_data)
|
|||||||
/* The data will be cleaned up in the destroy handler. */
|
/* 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
|
* @return TRUE if the user does want to cancel, FALSE if not. If TRUE is
|
||||||
* returned, the register's changes have been cancelled.
|
* returned, the register's changes have been cancelled.
|
||||||
@ -226,8 +212,12 @@ sxed_confirmed_cancel(GncSxEditorDialog *sxed)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************
|
||||||
|
* Dialog Action Button functions *
|
||||||
|
*********************************/
|
||||||
static void
|
static void
|
||||||
editor_cancel_button_clicked( GtkButton *b, GncSxEditorDialog *sxed )
|
editor_cancel_button_clicked_cb( GtkButton *b, GncSxEditorDialog *sxed )
|
||||||
{
|
{
|
||||||
/* close */
|
/* close */
|
||||||
if (!sxed_confirmed_cancel(sxed))
|
if (!sxed_confirmed_cancel(sxed))
|
||||||
@ -237,14 +227,16 @@ editor_cancel_button_clicked( GtkButton *b, GncSxEditorDialog *sxed )
|
|||||||
sxed );
|
sxed );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
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);
|
gnc_gnome_help(HF_HELP, HL_SXEDITOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
editor_ok_button_clicked( GtkButton *b, GncSxEditorDialog *sxed )
|
editor_ok_button_clicked_cb( GtkButton *b, GncSxEditorDialog *sxed )
|
||||||
{
|
{
|
||||||
QofBook *book;
|
QofBook *book;
|
||||||
SchedXactions *sxes;
|
SchedXactions *sxes;
|
||||||
@ -269,12 +261,13 @@ editor_ok_button_clicked( GtkButton *b, GncSxEditorDialog *sxed )
|
|||||||
sxed );
|
sxed );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
|
/*************************************************************************
|
||||||
* Checks to see if the SX has been modified from it's previously-saved
|
* Checks to see if the SX has been modified from it's previously-saved
|
||||||
* state.
|
* state.
|
||||||
* @return TRUE if this is a 'new' SX, or if the SX has changed from it's
|
* @return TRUE if this is a 'new' SX, or if the SX has changed from it's
|
||||||
* previous configuration.
|
* previous configuration.
|
||||||
**/
|
************************************************************************/
|
||||||
static gboolean
|
static gboolean
|
||||||
gnc_sxed_check_changed( GncSxEditorDialog *sxed )
|
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
|
* Holds the credit- and debit-sum for a given Transaction, as used in
|
||||||
* gnc_sxed_check_consistent.
|
* gnc_sxed_check_consistent.
|
||||||
**/
|
****************************************************************************/
|
||||||
typedef struct _txnCreditDebitSums
|
typedef struct _txnCreditDebitSums
|
||||||
{
|
{
|
||||||
gnc_numeric creditSum;
|
gnc_numeric creditSum;
|
||||||
gnc_numeric debitSum;
|
gnc_numeric debitSum;
|
||||||
} txnCreditDebitSums;
|
} txnCreditDebitSums;
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
set_sums_to_zero( gpointer key,
|
set_sums_to_zero( gpointer key,
|
||||||
@ -480,6 +474,7 @@ set_sums_to_zero( gpointer key,
|
|||||||
tcds->debitSum = gnc_numeric_zero();
|
tcds->debitSum = gnc_numeric_zero();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
check_credit_debit_balance( gpointer key,
|
check_credit_debit_balance( gpointer key,
|
||||||
gpointer val,
|
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.
|
* Checks to make sure that the SX is in a reasonable state to save.
|
||||||
* @return true if checks out okay, false otherwise.
|
* @return true if checks out okay, false otherwise.
|
||||||
**/
|
******************************************************************************/
|
||||||
static gboolean
|
static gboolean
|
||||||
gnc_sxed_check_consistent( GncSxEditorDialog *sxed )
|
gnc_sxed_check_consistent( GncSxEditorDialog *sxed )
|
||||||
{
|
{
|
||||||
@ -786,7 +782,7 @@ gnc_sxed_check_consistent( GncSxEditorDialog *sxed )
|
|||||||
g_free( name );
|
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;
|
gboolean autocreateState, notifyState;
|
||||||
|
|
||||||
@ -895,10 +891,11 @@ gnc_sxed_check_consistent( GncSxEditorDialog *sxed )
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
|
/******************************************************************************
|
||||||
* Saves the contents of the SX. This assumes that gnc_sxed_check_consistent
|
* Saves the contents of the SX. This assumes that gnc_sxed_check_consistent
|
||||||
* has returned true.
|
* has returned true.
|
||||||
**/
|
*****************************************************************************/
|
||||||
static void
|
static void
|
||||||
gnc_sxed_save_sx( GncSxEditorDialog *sxed )
|
gnc_sxed_save_sx( GncSxEditorDialog *sxed )
|
||||||
{
|
{
|
||||||
@ -1018,14 +1015,16 @@ gnc_sxed_save_sx( GncSxEditorDialog *sxed )
|
|||||||
gnc_sx_commit_edit( sxed->sx );
|
gnc_sx_commit_edit( sxed->sx );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
enabled_toggled( GtkObject *o, GncSxEditorDialog *sxed )
|
enabled_toggled_cb( GtkObject *o, GncSxEditorDialog *sxed )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
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)) )
|
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) ) );
|
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" );
|
static void
|
||||||
spin = glade_xml_get_widget( sxed->gxml, spinName );
|
advance_toggled_cb( GtkButton *o, GncSxEditorDialog *sxed )
|
||||||
if ( !spin )
|
|
||||||
{
|
{
|
||||||
g_critical("Error getting widget with name \"%s\"", spinName);
|
|
||||||
return;
|
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 );
|
||||||
}
|
}
|
||||||
gtk_widget_set_sensitive( spin,
|
|
||||||
gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(o) ) );
|
|
||||||
/* FIXME: this doesn't do what we want... :( */
|
static void
|
||||||
gtk_editable_set_editable( GTK_EDITABLE(spin), TRUE );
|
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 */
|
/* Local destruction of dialog */
|
||||||
static void
|
static void
|
||||||
scheduledxaction_editor_dialog_destroy(GtkObject *object, gpointer data)
|
scheduledxaction_editor_dialog_destroy(GtkObject *object, gpointer data)
|
||||||
@ -1093,6 +1094,7 @@ scheduledxaction_editor_dialog_destroy(GtkObject *object, gpointer data)
|
|||||||
g_free (sxed);
|
g_free (sxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
gboolean
|
gboolean
|
||||||
sxed_delete_event( GtkWidget *widget, GdkEvent *event, gpointer ud )
|
sxed_delete_event( GtkWidget *widget, GdkEvent *event, gpointer ud )
|
||||||
@ -1113,53 +1115,16 @@ sxed_delete_event( GtkWidget *widget, GdkEvent *event, gpointer ud )
|
|||||||
return FALSE;
|
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 *
|
GncSxEditorDialog *
|
||||||
gnc_ui_scheduled_xaction_editor_dialog_create(SchedXaction *sx,
|
gnc_ui_scheduled_xaction_editor_dialog_create(SchedXaction *sx,
|
||||||
gboolean newSX)
|
gboolean newSX)
|
||||||
{
|
{
|
||||||
GncSxEditorDialog *sxed;
|
GncSxEditorDialog *sxed;
|
||||||
|
GtkBuilder *builder;
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
int i;
|
int i;
|
||||||
GList *dlgExists = NULL;
|
GList *dlgExists = NULL;
|
||||||
@ -1172,21 +1137,17 @@ gnc_ui_scheduled_xaction_editor_dialog_create(SchedXaction *sx,
|
|||||||
gpointer objectData;
|
gpointer objectData;
|
||||||
} widgets[] =
|
} widgets[] =
|
||||||
{
|
{
|
||||||
{ "ok_button", "clicked", editor_ok_button_clicked, NULL },
|
{ "ok_button", "clicked", editor_ok_button_clicked_cb, NULL },
|
||||||
{ "cancel_button", "clicked", editor_cancel_button_clicked, NULL },
|
{ "cancel_button", "clicked", editor_cancel_button_clicked_cb, NULL },
|
||||||
{ "help_button", "clicked", editor_help_button_clicked, NULL },
|
{ "help_button", "clicked", editor_help_button_clicked_cb, NULL },
|
||||||
|
{ "rb_noend", "toggled", endgroup_rb_toggled_cb, GINT_TO_POINTER(END_NEVER_OPTION) },
|
||||||
{ "rb_noend", "toggled", endgroup_rb_toggled, GINT_TO_POINTER(END_NEVER_OPTION) },
|
{ "rb_enddate", "toggled", endgroup_rb_toggled_cb, GINT_TO_POINTER(END_DATE_OPTION) },
|
||||||
{ "rb_enddate", "toggled", endgroup_rb_toggled, GINT_TO_POINTER(END_DATE_OPTION) },
|
{ "rb_num_occur", "toggled", endgroup_rb_toggled_cb, GINT_TO_POINTER(NUM_OCCUR_OPTION) },
|
||||||
{ "rb_num_occur", "toggled", endgroup_rb_toggled, GINT_TO_POINTER(NUM_OCCUR_OPTION) },
|
{ "remain_spin" , "value-changed", sxed_excal_update_adapt_cb, NULL },
|
||||||
|
{ "enabled_opt", "toggled", enabled_toggled_cb, NULL },
|
||||||
{ REMAIN_SPIN , "value-changed", sxed_excal_update_adapt, NULL },
|
{ "autocreate_opt", "toggled", autocreate_toggled_cb, NULL },
|
||||||
|
{ "advance_opt", "toggled", advance_toggled_cb, NULL },
|
||||||
{ ENABLED_OPT, "toggled", enabled_toggled, NULL },
|
{ "remind_opt", "toggled", remind_toggled_cb, 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 }
|
{ NULL, NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1203,34 +1164,49 @@ gnc_ui_scheduled_xaction_editor_dialog_create(SchedXaction *sx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
sxed = g_new0( GncSxEditorDialog, 1 );
|
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->sx = sx;
|
sxed->sx = sx;
|
||||||
sxed->newsxP = newSX;
|
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 */
|
/* Setup the end-date GNC widget */
|
||||||
{
|
{
|
||||||
GtkWidget *endDateBox =
|
GtkWidget *endDateBox = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_hbox"));
|
||||||
glade_xml_get_widget( sxed->gxml, END_DATE_BOX );
|
sxed->endDateEntry = GNC_DATE_EDIT(gnc_date_edit_new( time(NULL), FALSE, FALSE ));
|
||||||
sxed->endDateEntry =
|
|
||||||
GNC_DATE_EDIT(gnc_date_edit_new( time(NULL),
|
|
||||||
FALSE, FALSE ));
|
|
||||||
gtk_widget_show(GTK_WIDGET(sxed->endDateEntry));
|
gtk_widget_show(GTK_WIDGET(sxed->endDateEntry));
|
||||||
g_signal_connect( sxed->endDateEntry,
|
g_signal_connect( sxed->endDateEntry, "date-changed",
|
||||||
"date-changed",
|
G_CALLBACK( sxed_excal_update_adapt_cb ), sxed );
|
||||||
G_CALLBACK( sxed_excal_update_adapt ),
|
gtk_box_pack_start( GTK_BOX(endDateBox), GTK_WIDGET(sxed->endDateEntry),
|
||||||
sxed );
|
|
||||||
gtk_box_pack_start( GTK_BOX(endDateBox),
|
|
||||||
GTK_WIDGET(sxed->endDateEntry),
|
|
||||||
TRUE, TRUE, 0 );
|
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,
|
gnc_register_gui_component( DIALOG_SCHEDXACTION_EDITOR_CM_CLASS,
|
||||||
NULL, /* no refresh handler */
|
NULL, /* no refresh handler */
|
||||||
sxed_close_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++ )
|
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 )
|
if ( widgets[i].objectData != NULL )
|
||||||
{
|
{
|
||||||
g_object_set_data( G_OBJECT(button), "whichOneAmI",
|
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 );
|
G_CALLBACK( widgets[i].fn ), sxed );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For some reason the Glade-specified sensitivity settings are not
|
/* Set sensitivity settings */
|
||||||
* being honored... ? */
|
|
||||||
gtk_widget_set_sensitive( GTK_WIDGET(sxed->notifyOpt), FALSE );
|
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->advanceSpin), FALSE );
|
||||||
gtk_widget_set_sensitive( GTK_WIDGET(sxed->remindSpin), 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->endCountSpin), FALSE );
|
||||||
gtk_widget_set_sensitive( GTK_WIDGET(sxed->endRemainSpin), 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->advanceSpin), TRUE );
|
||||||
gtk_editable_set_editable( GTK_EDITABLE(sxed->remindSpin), TRUE );
|
gtk_editable_set_editable( GTK_EDITABLE(sxed->remindSpin), TRUE );
|
||||||
|
|
||||||
/* Allow resize */
|
/* Allow resize */
|
||||||
gtk_window_set_resizable (GTK_WINDOW(sxed->dialog), TRUE);
|
gtk_window_set_resizable (GTK_WINDOW(sxed->dialog), TRUE);
|
||||||
|
|
||||||
gnc_restore_window_size(SXED_GCONF_SECTION, GTK_WINDOW(sxed->dialog));
|
gnc_restore_window_size(SXED_GCONF_SECTION, GTK_WINDOW(sxed->dialog));
|
||||||
|
|
||||||
/* create the frequency-selection macrowidget and example
|
/* create the frequency-selection widget and example [dense-]calendar. */
|
||||||
* [dense-]calendar. */
|
|
||||||
schedXact_editor_create_freq_sel( sxed );
|
schedXact_editor_create_freq_sel( sxed );
|
||||||
|
|
||||||
/* create the template-transaction ledger window */
|
/* create the template-transaction ledger window */
|
||||||
schedXact_editor_create_ledger( sxed );
|
schedXact_editor_create_ledger( sxed );
|
||||||
|
|
||||||
/* populate */
|
/* populate */
|
||||||
schedXact_editor_populate( sxed );
|
schedXact_editor_populate( sxed );
|
||||||
|
|
||||||
/* Do not call show_all here. Screws up the gtkuimanager code */
|
/* Do not call show_all here. Screws up the gtkuimanager code */
|
||||||
gtk_widget_show(sxed->dialog);
|
gtk_widget_show(sxed->dialog);
|
||||||
|
gtk_notebook_set_page(GTK_NOTEBOOK(sxed->notebook), 0);
|
||||||
gtk_notebook_set_page(
|
|
||||||
GTK_NOTEBOOK(glade_xml_get_widget(sxed->gxml, "editor_notebook")), 0);
|
|
||||||
|
|
||||||
/* Refresh the cal and the ledger */
|
/* Refresh the cal and the ledger */
|
||||||
gtk_widget_queue_resize( GTK_WIDGET( sxed->example_cal ) );
|
gtk_widget_queue_resize( GTK_WIDGET( sxed->example_cal ) );
|
||||||
|
|
||||||
gnc_ledger_display_refresh( sxed->ledger );
|
gnc_ledger_display_refresh( sxed->ledger );
|
||||||
|
|
||||||
/* Move keyboard focus to the name entry */
|
/* Move keyboard focus to the name entry */
|
||||||
gtk_widget_grab_focus(GTK_WIDGET(sxed->nameEntry));
|
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;
|
return sxed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
gnc_sxed_record_size( GncSxEditorDialog *sxed )
|
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) );
|
gnc_save_window_size( SXED_GCONF_SECTION, GTK_WINDOW(sxed->dialog) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
schedXact_editor_create_freq_sel( GncSxEditorDialog *sxed )
|
schedXact_editor_create_freq_sel( GncSxEditorDialog *sxed )
|
||||||
{
|
{
|
||||||
GtkBox *b;
|
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 =
|
sxed->gncfreq =
|
||||||
GNC_FREQUENCY(gnc_frequency_new_from_recurrence(gnc_sx_get_schedule(sxed->sx),
|
GNC_FREQUENCY(gnc_frequency_new_from_recurrence(gnc_sx_get_schedule(sxed->sx),
|
||||||
xaccSchedXactionGetStartDate(sxed->sx)));
|
xaccSchedXactionGetStartDate(sxed->sx)));
|
||||||
@ -1317,7 +1296,7 @@ schedXact_editor_create_freq_sel( GncSxEditorDialog *sxed )
|
|||||||
sxed );
|
sxed );
|
||||||
gtk_container_add( GTK_CONTAINER(b), GTK_WIDGET(sxed->gncfreq) );
|
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->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)));
|
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);
|
g_assert(sxed->example_cal);
|
||||||
@ -1327,6 +1306,7 @@ schedXact_editor_create_freq_sel( GncSxEditorDialog *sxed )
|
|||||||
gtk_widget_show( GTK_WIDGET(sxed->example_cal) );
|
gtk_widget_show( GTK_WIDGET(sxed->example_cal) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
schedXact_editor_create_ledger( GncSxEditorDialog *sxed )
|
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 );
|
splitreg = gnc_ledger_display_get_split_register( sxed->ledger );
|
||||||
|
|
||||||
/* First the embedded window */
|
/* 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 =
|
sxed->embed_window =
|
||||||
gnc_embedded_window_new("SXWindowActions",
|
gnc_embedded_window_new("SXWindowActions",
|
||||||
gnc_sxed_menu_entries,
|
gnc_sxed_menu_entries,
|
||||||
@ -1373,6 +1353,7 @@ schedXact_editor_create_ledger( GncSxEditorDialog *sxed )
|
|||||||
gnc_split_register_show_present_divider( splitreg, FALSE );
|
gnc_split_register_show_present_divider( splitreg, FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
schedXact_editor_populate( GncSxEditorDialog *sxed )
|
schedXact_editor_populate( GncSxEditorDialog *sxed )
|
||||||
@ -1460,7 +1441,6 @@ schedXact_editor_populate( GncSxEditorDialog *sxed )
|
|||||||
}
|
}
|
||||||
gtk_toggle_button_set_active( sxed->notifyOpt, notifyState );
|
gtk_toggle_button_set_active( sxed->notifyOpt, notifyState );
|
||||||
|
|
||||||
|
|
||||||
/* Do days-in-advance-to-create widget[s] setup. */
|
/* Do days-in-advance-to-create widget[s] setup. */
|
||||||
if ( sxed->newsxP )
|
if ( sxed->newsxP )
|
||||||
{
|
{
|
||||||
@ -1520,6 +1500,7 @@ schedXact_editor_populate( GncSxEditorDialog *sxed )
|
|||||||
gnc_sxed_update_cal(sxed);
|
gnc_sxed_update_cal(sxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
set_endgroup_toggle_states( GncSxEditorDialog *sxed, EndType type )
|
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) );
|
gtk_widget_set_sensitive( GTK_WIDGET(sxed->endRemainSpin), (type == END_OCCUR) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
endgroup_rb_toggled( GtkButton *b, gpointer d )
|
endgroup_rb_toggled_cb( GtkButton *b, gpointer d )
|
||||||
{
|
{
|
||||||
/* figure out which one */
|
/* figure out which one */
|
||||||
GncSxEditorDialog *sxed;
|
GncSxEditorDialog *sxed;
|
||||||
@ -1555,10 +1537,10 @@ endgroup_rb_toggled( GtkButton *b, gpointer d )
|
|||||||
g_critical( "Unknown id %d", id );
|
g_critical( "Unknown id %d", id );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gnc_sxed_update_cal(sxed);
|
gnc_sxed_update_cal(sxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* gnc_register_check_close *
|
* gnc_register_check_close *
|
||||||
* *
|
* *
|
||||||
@ -1597,6 +1579,7 @@ gnc_sxed_reg_check_close(GncSxEditorDialog *sxed)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
editor_component_sx_equality( gpointer find_data,
|
editor_component_sx_equality( gpointer find_data,
|
||||||
gpointer user_data )
|
gpointer user_data )
|
||||||
@ -1604,8 +1587,9 @@ editor_component_sx_equality( gpointer find_data,
|
|||||||
return ( (SchedXaction*)find_data
|
return ( (SchedXaction*)find_data
|
||||||
== ((GncSxEditorDialog*)user_data)->sx );
|
== ((GncSxEditorDialog*)user_data)->sx );
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
typedef enum { NO_END, DATE_END, COUNT_END } END_TYPE;
|
typedef enum { NO_END, DATE_END, COUNT_END } END_TYPE;
|
||||||
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_sxed_update_cal(GncSxEditorDialog *sxed)
|
gnc_sxed_update_cal(GncSxEditorDialog *sxed)
|
||||||
@ -1677,21 +1661,22 @@ cleanup:
|
|||||||
recurrenceListFree(&recurrences);
|
recurrenceListFree(&recurrences);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_sxed_freq_changed(GncFrequency *gf, gpointer ud)
|
gnc_sxed_freq_changed(GncFrequency *gf, gpointer ud)
|
||||||
{
|
{
|
||||||
gnc_sxed_update_cal((GncSxEditorDialog*)ud);
|
gnc_sxed_update_cal((GncSxEditorDialog*)ud);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
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);
|
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,
|
on_sx_check_toggled (GtkWidget *togglebutton,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
@ -1718,6 +1703,7 @@ typedef struct _acct_deletion_handler_data
|
|||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
} acct_deletion_handler_data;
|
} acct_deletion_handler_data;
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_open_editors(GtkDialog *dialog, gint response_code, gpointer data)
|
_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);
|
g_free(adhd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_sx_engine_event_handler(QofInstance *ent, QofEventId event_type, gpointer user_data, gpointer evt_data)
|
_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;
|
GList *sx_iter;
|
||||||
acct_deletion_handler_data *data;
|
acct_deletion_handler_data *data;
|
||||||
GladeXML *xml;
|
GtkBuilder *builder;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkListStore *name_list;
|
GtkListStore *name_list;
|
||||||
GtkTreeView *list;
|
GtkTreeView *list;
|
||||||
GtkTreeViewColumn *name_column;
|
GtkTreeViewColumn *name_column;
|
||||||
GtkCellRenderer *renderer;
|
GtkCellRenderer *renderer;
|
||||||
|
|
||||||
xml = gnc_glade_xml_new("sched-xact.glade", "Account Deletion");
|
builder = gtk_builder_new();
|
||||||
dialog = glade_xml_get_widget(xml, "Account Deletion");
|
gnc_builder_add_from_file (builder, "dialog-sx.glade", "Account Deletion");
|
||||||
list = GTK_TREE_VIEW(glade_xml_get_widget(xml, "sx_list"));
|
|
||||||
|
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 = (acct_deletion_handler_data*)g_new0(acct_deletion_handler_data, 1);
|
||||||
data->dialog = dialog;
|
data->dialog = dialog;
|
||||||
@ -1796,9 +1786,12 @@ _sx_engine_event_handler(QofInstance *ent, QofEventId event_type, gpointer user_
|
|||||||
G_CALLBACK(_open_editors), data);
|
G_CALLBACK(_open_editors), data);
|
||||||
|
|
||||||
gtk_widget_show_all(GTK_WIDGET(dialog));
|
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
|
void
|
||||||
gnc_ui_sx_initialize (void)
|
gnc_ui_sx_initialize (void)
|
||||||
{
|
{
|
||||||
@ -1806,7 +1799,9 @@ gnc_ui_sx_initialize (void)
|
|||||||
|
|
||||||
gnc_hook_add_dangler(HOOK_BOOK_OPENED,
|
gnc_hook_add_dangler(HOOK_BOOK_OPENED,
|
||||||
(GFunc)gnc_sx_sxsincelast_book_opened, NULL);
|
(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",
|
"sx_prefs",
|
||||||
_("Scheduled Transactions"));
|
_("Scheduled Transactions"));
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,9 @@
|
|||||||
* Copyright (C) 2001,2006 Joshua Sled <jsled@asynchronous.org> *
|
* Copyright (C) 2001,2006 Joshua Sled <jsled@asynchronous.org> *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or *
|
* 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 *
|
* modify it under the terms of version 2 and/or version 3 of the *
|
||||||
* License as published by the Free Software Foundation. *
|
* GNU General Public License as published by the Free Software *
|
||||||
|
* Foundation. *
|
||||||
* *
|
* *
|
||||||
* This program is distributed in the hope that it will be useful, *
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
* Copyright (C) 2001 Robert Merkel <rgmerk@mira.net> *
|
* Copyright (C) 2001 Robert Merkel <rgmerk@mira.net> *
|
||||||
* Copyright (C) 2001 Joshua Sled <jsled@asynchronous.org> *
|
* Copyright (C) 2001 Joshua Sled <jsled@asynchronous.org> *
|
||||||
* Copyright (c) 2006 David Hampton <hampton@employees.org> *
|
* Copyright (c) 2006 David Hampton <hampton@employees.org> *
|
||||||
|
* Copyright (c) 2011 Robert Fewell *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or *
|
* This program is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU General Public License as *
|
* modify it under the terms of the GNU General Public License as *
|
||||||
@ -45,23 +46,6 @@
|
|||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#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_UNBALANCED_XACTION 3
|
||||||
#define SXFTD_ERRNO_OPEN_XACTION -3
|
#define SXFTD_ERRNO_OPEN_XACTION -3
|
||||||
|
|
||||||
@ -70,11 +54,11 @@
|
|||||||
|
|
||||||
#define SXFTD_RESPONSE_ADVANCED 100 /* 'Advanced' button response code */
|
#define SXFTD_RESPONSE_ADVANCED 100 /* 'Advanced' button response code */
|
||||||
|
|
||||||
static QofLogModule log_module = GNC_MOD_GUI_SX;
|
|
||||||
|
|
||||||
#undef G_LOG_DOMAIN
|
#undef G_LOG_DOMAIN
|
||||||
#define G_LOG_DOMAIN GNC_MOD_GUI_SX
|
#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 sxftd_freq_combo_changed( GtkWidget *w, gpointer user_data );
|
||||||
static void gnc_sx_trans_window_response_cb(GtkDialog *dialog, gint response, gpointer data);
|
static void 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
|
typedef struct
|
||||||
{
|
{
|
||||||
GladeXML *gxml;
|
GtkBuilder *builder;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
|
GtkEntry *name;
|
||||||
|
GtkComboBox *freq_combo;
|
||||||
|
|
||||||
|
GtkToggleButton *ne_but;
|
||||||
|
GtkToggleButton *ed_but;
|
||||||
|
GtkToggleButton *oc_but;
|
||||||
|
GtkEntry *n_occurences;
|
||||||
|
|
||||||
Transaction *trans;
|
Transaction *trans;
|
||||||
SchedXaction *sx;
|
SchedXaction *sx;
|
||||||
|
|
||||||
@ -131,10 +123,10 @@ sxfti_attach_callbacks(SXFromTransInfo *sxfti)
|
|||||||
{
|
{
|
||||||
/* Whenever any of the controls change, we want to update the
|
/* Whenever any of the controls change, we want to update the
|
||||||
* calendar. */
|
* calendar. */
|
||||||
{ SXFTD_NEVER_END_BUTTON, "clicked", sxftd_update_excal_adapt },
|
{ "never_end_button", "clicked", sxftd_update_excal_adapt },
|
||||||
{ SXFTD_END_ON_DATE_BUTTON, "clicked", sxftd_update_excal_adapt },
|
{ "end_on_date_button", "clicked", sxftd_update_excal_adapt },
|
||||||
{ SXFTD_N_OCCURRENCES_BUTTON, "clicked", sxftd_update_excal_adapt },
|
{ "n_occurrences_button", "clicked", sxftd_update_excal_adapt },
|
||||||
{ SXFTD_N_OCCURRENCES_ENTRY, "changed", sxftd_update_excal_adapt },
|
{ "n_occurrences_entry", "changed", sxftd_update_excal_adapt },
|
||||||
{ NULL, NULL, NULL }
|
{ NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -143,7 +135,7 @@ sxfti_attach_callbacks(SXFromTransInfo *sxfti)
|
|||||||
GtkWidget *w;
|
GtkWidget *w;
|
||||||
for (i = 0; callbacks[i].name != NULL; i++)
|
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_signal_connect (GTK_OBJECT(w), callbacks[i].signal,
|
||||||
G_CALLBACK(callbacks[i].handlerFn),
|
G_CALLBACK(callbacks[i].handlerFn),
|
||||||
@ -160,21 +152,18 @@ static getEndTuple
|
|||||||
sxftd_get_end_info(SXFromTransInfo *sxfti)
|
sxftd_get_end_info(SXFromTransInfo *sxfti)
|
||||||
{
|
{
|
||||||
getEndTuple retval;
|
getEndTuple retval;
|
||||||
GtkWidget *w;
|
|
||||||
|
|
||||||
retval.type = BAD_END;
|
retval.type = BAD_END;
|
||||||
g_date_clear( &(retval.end_date), 1 );
|
g_date_clear( &(retval.end_date), 1 );
|
||||||
retval.n_occurrences = 0;
|
retval.n_occurrences = 0;
|
||||||
|
|
||||||
w = glade_xml_get_widget(sxfti->gxml, SXFTD_NEVER_END_BUTTON);
|
if (gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(sxfti->ne_but)))
|
||||||
if (gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(w)))
|
|
||||||
{
|
{
|
||||||
retval.type = NEVER_END;
|
retval.type = NEVER_END;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
w = glade_xml_get_widget(sxfti->gxml, SXFTD_END_ON_DATE_BUTTON);
|
if (gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(sxfti->ed_but)))
|
||||||
if (gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(w)))
|
|
||||||
{
|
{
|
||||||
time_t end_tt;
|
time_t end_tt;
|
||||||
retval.type = END_ON_DATE;
|
retval.type = END_ON_DATE;
|
||||||
@ -184,14 +173,12 @@ sxftd_get_end_info(SXFromTransInfo *sxfti)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
w = glade_xml_get_widget(sxfti->gxml, SXFTD_N_OCCURRENCES_BUTTON);
|
if (gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(sxfti->oc_but) ))
|
||||||
if (gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(w) ))
|
|
||||||
{
|
{
|
||||||
gchar *text, *endptr;
|
gchar *text, *endptr;
|
||||||
guint n_occs;
|
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)
|
if (text == NULL || strlen(text) == 0)
|
||||||
{
|
{
|
||||||
n_occs = 0;
|
n_occs = 0;
|
||||||
@ -204,17 +191,12 @@ sxftd_get_end_info(SXFromTransInfo *sxfti)
|
|||||||
n_occs = -1;
|
n_occs = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free(text);
|
g_free(text);
|
||||||
|
|
||||||
if (n_occs > 0)
|
|
||||||
{
|
|
||||||
retval.type = END_AFTER_N_OCCS;
|
retval.type = END_AFTER_N_OCCS;
|
||||||
retval.n_occurrences = n_occs;
|
retval.n_occurrences = n_occs;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,6 +276,7 @@ sxftd_add_template_trans(SXFromTransInfo *sxfti)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sxftd_update_schedule( SXFromTransInfo *sxfti, GDate *date, GList **recurrences)
|
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
|
/* Note that we make the start date the *NEXT* instance, not the
|
||||||
* present one. */
|
* 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)
|
switch (index)
|
||||||
{
|
{
|
||||||
@ -346,6 +329,7 @@ sxftd_update_schedule( SXFromTransInfo *sxfti, GDate *date, GList **recurrences)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
sxftd_init( SXFromTransInfo *sxfti )
|
sxftd_init( SXFromTransInfo *sxfti )
|
||||||
{
|
{
|
||||||
@ -370,13 +354,30 @@ sxftd_init( SXFromTransInfo *sxfti )
|
|||||||
return SXFTD_ERRNO_OPEN_XACTION;
|
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);
|
sxfti_attach_callbacks(sxfti);
|
||||||
|
|
||||||
/* Setup the example calendar and related data structures. */
|
/* Setup the example calendar and related data structures. */
|
||||||
{
|
{
|
||||||
int num_marks = SXFTD_EXCAL_NUM_MONTHS * 31;
|
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->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)));
|
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);
|
g_object_ref_sink(sxfti->example_cal);
|
||||||
@ -389,8 +390,7 @@ sxftd_init( SXFromTransInfo *sxfti )
|
|||||||
|
|
||||||
/* Setup the start and end dates as GNCDateEdits */
|
/* Setup the start and end dates as GNCDateEdits */
|
||||||
{
|
{
|
||||||
GtkWidget *paramTable = glade_xml_get_widget( sxfti->gxml,
|
GtkWidget *paramTable = GTK_WIDGET(gtk_builder_get_object(sxfti->builder, "param_table" ));
|
||||||
SXFTD_PARAM_TABLE );
|
|
||||||
sxfti->startDateGDE =
|
sxfti->startDateGDE =
|
||||||
GNC_DATE_EDIT( gnc_date_edit_new( time( NULL ),
|
GNC_DATE_EDIT( gnc_date_edit_new( time( NULL ),
|
||||||
FALSE, FALSE ) );
|
FALSE, FALSE ) );
|
||||||
@ -405,31 +405,25 @@ sxftd_init( SXFromTransInfo *sxfti )
|
|||||||
sxfti );
|
sxfti );
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
GtkWidget *endDateBox = glade_xml_get_widget( sxfti->gxml,
|
GtkWidget *endDateBox = GTK_WIDGET(gtk_builder_get_object(sxfti->builder, "end_date_hbox" ));
|
||||||
SXFTD_END_DATE_BOX );
|
|
||||||
sxfti->endDateGDE =
|
sxfti->endDateGDE =
|
||||||
GNC_DATE_EDIT( gnc_date_edit_new( time( NULL ),
|
GNC_DATE_EDIT( gnc_date_edit_new( time( NULL ),
|
||||||
FALSE, FALSE ) );
|
FALSE, FALSE ) );
|
||||||
gtk_box_pack_start( GTK_BOX( endDateBox ),
|
gtk_box_pack_start( GTK_BOX( endDateBox ),
|
||||||
GTK_WIDGET( sxfti->endDateGDE ),
|
GTK_WIDGET( sxfti->endDateGDE ),
|
||||||
FALSE, TRUE, 0 );
|
TRUE, TRUE, 0 );
|
||||||
g_signal_connect( sxfti->endDateGDE, "date-changed",
|
g_signal_connect( sxfti->endDateGDE, "date-changed",
|
||||||
G_CALLBACK( sxftd_update_excal_adapt ),
|
G_CALLBACK( sxftd_update_excal_adapt ),
|
||||||
sxfti );
|
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 */
|
/* Setup the initial start date for user display/confirmation */
|
||||||
/* compute good initial date. */
|
/* compute good initial date. */
|
||||||
start_tt = xaccTransGetDate( sxfti->trans );
|
start_tt = xaccTransGetDate( sxfti->trans );
|
||||||
g_date_set_time_t( &date, start_tt );
|
g_date_set_time_t( &date, start_tt );
|
||||||
w = glade_xml_get_widget(sxfti->gxml,
|
sxfti->freq_combo = GTK_COMBO_BOX(gtk_builder_get_object(sxfti->builder, "freq_combo_box"));
|
||||||
SXFTD_FREQ_COMBO_BOX);
|
gtk_combo_box_set_active(GTK_COMBO_BOX(sxfti->freq_combo), 0);
|
||||||
gtk_combo_box_set_active(GTK_COMBO_BOX(w), 0);
|
g_signal_connect( sxfti->freq_combo, "changed",
|
||||||
g_signal_connect( w, "changed",
|
|
||||||
G_CALLBACK(sxftd_freq_combo_changed),
|
G_CALLBACK(sxftd_freq_combo_changed),
|
||||||
sxfti );
|
sxfti );
|
||||||
sxftd_update_schedule( sxfti, &date, &schedule);
|
sxftd_update_schedule( sxfti, &date, &schedule);
|
||||||
@ -442,12 +436,7 @@ sxftd_init( SXFromTransInfo *sxfti )
|
|||||||
g_free( tmpTm );
|
g_free( tmpTm );
|
||||||
gnc_date_edit_set_time( sxfti->startDateGDE, start_tt );
|
gnc_date_edit_set_time( sxfti->startDateGDE, start_tt );
|
||||||
|
|
||||||
w = glade_xml_get_widget( sxfti->gxml, SXFTD_NAME_ENTRY );
|
g_signal_connect( GTK_OBJECT(sxfti->name), "destroy",
|
||||||
pos = 0;
|
|
||||||
gtk_editable_insert_text( GTK_EDITABLE(w), transName,
|
|
||||||
(strlen(transName) * sizeof(char)), &pos );
|
|
||||||
|
|
||||||
g_signal_connect( GTK_OBJECT(w), "destroy",
|
|
||||||
G_CALLBACK(sxftd_destroy),
|
G_CALLBACK(sxftd_destroy),
|
||||||
sxfti );
|
sxfti );
|
||||||
|
|
||||||
@ -456,6 +445,7 @@ sxftd_init( SXFromTransInfo *sxfti )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static guint
|
static guint
|
||||||
sxftd_compute_sx(SXFromTransInfo *sxfti)
|
sxftd_compute_sx(SXFromTransInfo *sxfti)
|
||||||
{
|
{
|
||||||
@ -469,8 +459,8 @@ sxftd_compute_sx(SXFromTransInfo *sxfti)
|
|||||||
SchedXaction *sx = sxfti->sx;
|
SchedXaction *sx = sxfti->sx;
|
||||||
|
|
||||||
/* get the name */
|
/* get the name */
|
||||||
w = glade_xml_get_widget(sxfti->gxml, SXFTD_NAME_ENTRY);
|
name = gtk_editable_get_chars(GTK_EDITABLE(sxfti->name), 0, -1);
|
||||||
name = gtk_editable_get_chars(GTK_EDITABLE(w), 0, -1);
|
|
||||||
xaccSchedXactionSetName(sx, name);
|
xaccSchedXactionSetName(sx, name);
|
||||||
g_free(name);
|
g_free(name);
|
||||||
|
|
||||||
@ -536,6 +526,7 @@ sxftd_compute_sx(SXFromTransInfo *sxfti)
|
|||||||
return sxftd_errno;
|
return sxftd_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sxftd_close(SXFromTransInfo *sxfti, gboolean delete_sx)
|
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));
|
gtk_widget_destroy (GTK_WIDGET (sxfti->dialog));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sxftd_ok_clicked(SXFromTransInfo *sxfti)
|
sxftd_ok_clicked(SXFromTransInfo *sxfti)
|
||||||
{
|
{
|
||||||
@ -578,6 +570,7 @@ sxftd_ok_clicked(SXFromTransInfo *sxfti)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update start date... right now we always base this off the transaction
|
* 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,
|
* 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 );
|
sxftd_update_example_cal( sxfti );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sxftd_advanced_clicked(SXFromTransInfo *sxfti)
|
sxftd_advanced_clicked(SXFromTransInfo *sxfti)
|
||||||
{
|
{
|
||||||
@ -637,6 +631,7 @@ sxftd_advanced_clicked(SXFromTransInfo *sxfti)
|
|||||||
sxftd_close(sxfti, FALSE);
|
sxftd_close(sxfti, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sxftd_destroy( GtkWidget *w, gpointer user_data )
|
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->dense_cal_model));
|
||||||
g_object_unref(G_OBJECT(sxfti->example_cal));
|
g_object_unref(G_OBJECT(sxfti->example_cal));
|
||||||
|
|
||||||
/* FIXME: do we need to clean up the GladeXML pointer? */
|
|
||||||
|
|
||||||
g_free(sxfti);
|
g_free(sxfti);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_sx_trans_window_response_cb (GtkDialog *dialog,
|
gnc_sx_trans_window_response_cb (GtkDialog *dialog,
|
||||||
gint response,
|
gint response,
|
||||||
@ -685,6 +679,7 @@ gnc_sx_trans_window_response_cb (GtkDialog *dialog,
|
|||||||
LEAVE(" ");
|
LEAVE(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the example calendar; make sure to take into account the end
|
* Update the example calendar; make sure to take into account the end
|
||||||
* specification.
|
* specification.
|
||||||
@ -722,8 +717,8 @@ sxftd_update_example_cal( SXFromTransInfo *sxfti )
|
|||||||
GtkWidget *w;
|
GtkWidget *w;
|
||||||
gchar *name;
|
gchar *name;
|
||||||
/* get the name */
|
/* get the name */
|
||||||
w = glade_xml_get_widget(sxfti->gxml, SXFTD_NAME_ENTRY);
|
name = NULL;
|
||||||
name = gtk_editable_get_chars(GTK_EDITABLE(w), 0, -1);
|
name = gtk_editable_get_chars(GTK_EDITABLE(sxfti->name), 0, -1);
|
||||||
gnc_dense_cal_store_update_name(sxfti->dense_cal_model, name);
|
gnc_dense_cal_store_update_name(sxfti->dense_cal_model, name);
|
||||||
g_free(name);
|
g_free(name);
|
||||||
}
|
}
|
||||||
@ -735,6 +730,10 @@ sxftd_update_example_cal( SXFromTransInfo *sxfti )
|
|||||||
g_free(schedule_desc);
|
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)
|
switch (get.type)
|
||||||
{
|
{
|
||||||
case NEVER_END:
|
case NEVER_END:
|
||||||
@ -757,9 +756,10 @@ sxftd_update_example_cal( SXFromTransInfo *sxfti )
|
|||||||
recurrenceListFree(&schedule);
|
recurrenceListFree(&schedule);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback to update the calendar
|
/***********************************
|
||||||
**/
|
* Callback to update the calendar *
|
||||||
|
**********************************/
|
||||||
static void
|
static void
|
||||||
sxftd_update_excal_adapt( GObject *o, gpointer ud )
|
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 );
|
sxftd_update_example_cal( sxfti );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*********************
|
||||||
|
* Create the dialog *
|
||||||
|
********************/
|
||||||
void
|
void
|
||||||
gnc_sx_create_from_trans( Transaction *trans )
|
gnc_sx_create_from_trans( Transaction *trans )
|
||||||
{
|
{
|
||||||
int errno;
|
int errno;
|
||||||
SXFromTransInfo *sxfti = g_new0( SXFromTransInfo, 1);
|
SXFromTransInfo *sxfti = g_new0( SXFromTransInfo, 1);
|
||||||
|
GtkBuilder *builder;
|
||||||
|
GtkWidget *dialog;
|
||||||
|
|
||||||
sxfti->gxml = gnc_glade_xml_new(SX_GLADE_FILE,
|
builder = gtk_builder_new();
|
||||||
SXFTD_DIALOG_GLADE_NAME);
|
|
||||||
|
|
||||||
sxfti->dialog = glade_xml_get_widget(sxfti->gxml,
|
gnc_builder_add_from_file (builder ,"dialog-sx.glade", "freq_liststore");
|
||||||
SXFTD_DIALOG_GLADE_NAME);
|
|
||||||
|
|
||||||
|
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->trans = trans;
|
||||||
|
|
||||||
sxfti->sx = xaccSchedXactionMalloc(gnc_get_current_book ());
|
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_widget_show_all(GTK_WIDGET(sxfti->dialog));
|
||||||
|
|
||||||
|
gtk_builder_connect_signals(builder, sxfti);
|
||||||
|
g_object_unref(G_OBJECT(builder));
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
/********************************************************************
|
/********************************************************************
|
||||||
* dialog-sx-from-trans.h -- a simple dialog for creating a *
|
* dialog-sx-from-trans.h -- a simple dialog for creating a *
|
||||||
* scheduled transaction for a "real *
|
* scheduled transaction from a real one *
|
||||||
* one *
|
|
||||||
* (GnuCash) *
|
* (GnuCash) *
|
||||||
* Copyright (C) 2000 Robert Merkel <rgmerk@mira.net> *
|
* Copyright (C) 2000 Robert Merkel <rgmerk@mira.net> *
|
||||||
* *
|
* *
|
||||||
|
@ -4,19 +4,20 @@
|
|||||||
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org> *
|
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org> *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or *
|
* 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 *
|
* modify it under the terms of version 2 and/or version 3 of the *
|
||||||
* License as published by the Free Software Foundation. *
|
* 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
|
* As a special exception, permission is granted to link the binary *
|
||||||
* "OpenSSL" library (or modified versions of it that use the same
|
* module resultant from this code with the OpenSSL project's *
|
||||||
* license as the "OpenSSL" library), and distribute the linked
|
* "OpenSSL" library (or modified versions of it that use the same *
|
||||||
* executable. You must obey the GNU General Public License in all
|
* license as the "OpenSSL" library), and distribute the linked *
|
||||||
* respects for all of the code used other than "OpenSSL". If you
|
* executable. You must obey the GNU General Public License in all *
|
||||||
* modify this file, you may extend this exception to your version
|
* respects for all of the code used other than "OpenSSL". If you *
|
||||||
* of the file, but you are not obligated to do so. If you do not
|
* modify this file, you may extend this exception to your version *
|
||||||
* wish to do so, delete this exception statement from your version
|
* of the file, but you are not obligated to do so. If you do not *
|
||||||
* of this file.
|
* 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, *
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
@ -34,7 +35,6 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <glade/glade-xml.h>
|
|
||||||
|
|
||||||
#include "dialog-utils.h"
|
#include "dialog-utils.h"
|
||||||
#include "gnc-exp-parser.h"
|
#include "gnc-exp-parser.h"
|
||||||
@ -55,6 +55,8 @@
|
|||||||
#undef G_LOG_DOMAIN
|
#undef G_LOG_DOMAIN
|
||||||
#define G_LOG_DOMAIN "gnc.gui.sx.slr"
|
#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 DIALOG_SX_SINCE_LAST_RUN_CM_CLASS "dialog-sx-since-last-run"
|
||||||
#define GCONF_SECTION "dialogs/scheduled_trans/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)
|
gnc_ui_sx_since_last_run_dialog(GncSxInstanceModel *sx_instances, GList *auto_created_txn_guids)
|
||||||
{
|
{
|
||||||
GncSxSinceLastRunDialog *dialog;
|
GncSxSinceLastRunDialog *dialog;
|
||||||
GladeXML *glade;
|
GtkBuilder *builder;
|
||||||
|
|
||||||
dialog = g_new0(GncSxSinceLastRunDialog, 1);
|
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->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;
|
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;
|
GtkCellRenderer *renderer;
|
||||||
GtkTreeViewColumn *col;
|
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));
|
gtk_tree_view_set_model(dialog->instance_view, GTK_TREE_MODEL(dialog->editing_model));
|
||||||
|
|
||||||
renderer = gtk_cell_renderer_text_new();
|
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_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;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,8 +4,9 @@
|
|||||||
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org> *
|
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org> *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or *
|
* 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 *
|
* modify it under the terms of version 2 and/or version 3 of the *
|
||||||
* License as published by the Free Software Foundation. *
|
* GNU General Public License as published by the Free Software *
|
||||||
|
* Foundation. *
|
||||||
* *
|
* *
|
||||||
* This program is distributed in the hope that it will be useful, *
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,34 +1,37 @@
|
|||||||
/*
|
/********************************************************************\
|
||||||
* gnc-plugin-page-sx-list.c
|
* gnc-plugin-page-sx-list.c : scheduled transaction plugin *
|
||||||
*
|
* *
|
||||||
* Copyright (C) 2006 Josh Sled <jsled@asynchronous.org>
|
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org> *
|
||||||
*
|
* 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
|
* This program is free software; you can redistribute it and/or *
|
||||||
* 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 *
|
||||||
* As a special exception, permission is granted to link the binary module
|
* Foundation. *
|
||||||
* resultant from this code with the OpenSSL project's "OpenSSL" library (or
|
* *
|
||||||
* modified versions of it that use the same license as the "OpenSSL"
|
* As a special exception, permission is granted to link the binary *
|
||||||
* library), and distribute the linked executable. You must obey the GNU
|
* module resultant from this code with the OpenSSL project's *
|
||||||
* General Public License in all respects for all of the code used other than
|
* "OpenSSL" library (or modified versions of it that use the same *
|
||||||
* "OpenSSL". If you modify this file, you may extend this exception to your
|
* license as the "OpenSSL" library), and distribute the linked *
|
||||||
* version of the file, but you are not obligated to do so. If you do not
|
* executable. You must obey the GNU General Public License in all *
|
||||||
* wish to do so, delete this exception statement from your version of this
|
* respects for all of the code used other than "OpenSSL". If you *
|
||||||
* file.
|
* 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 *
|
||||||
* This program is distributed in the hope that it will be useful,
|
* wish to do so, delete this exception statement from your version *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* of this file. *
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* *
|
||||||
* GNU General Public License for more details.
|
* This program is distributed in the hope that it will be useful, *
|
||||||
*
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
* You should have received a copy of the GNU General Public License
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
* along with this program; if not, contact:
|
* GNU General Public License for more details. *
|
||||||
*
|
* *
|
||||||
* Free Software Foundation Voice: +1-617-542-5942
|
* You should have received a copy of the GNU General Public License*
|
||||||
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
|
* along with this program; if not, contact: *
|
||||||
* Boston, MA 02110-1301, USA gnu@gnu.org
|
* *
|
||||||
*/
|
* 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
|
/** @addtogroup ContentPlugins
|
||||||
@{ */
|
@{ */
|
||||||
@ -43,7 +46,6 @@
|
|||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#include <glade/glade-xml.h>
|
|
||||||
#include "SX-book.h"
|
#include "SX-book.h"
|
||||||
#include "Split.h"
|
#include "Split.h"
|
||||||
#include "Transaction.h"
|
#include "Transaction.h"
|
||||||
@ -69,6 +71,8 @@
|
|||||||
#undef G_LOG_DOMAIN
|
#undef G_LOG_DOMAIN
|
||||||
#define G_LOG_DOMAIN "gnc.gui.plugin-page.sx-list"
|
#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 PLUGIN_PAGE_SX_LIST_CM_CLASS "plugin-page-sx-list"
|
||||||
#define GCONF_SECTION "window/pages/sx_list"
|
#define GCONF_SECTION "window/pages/sx_list"
|
||||||
|
|
||||||
@ -79,12 +83,12 @@ typedef struct GncPluginPageSxListPrivate
|
|||||||
GtkWidget* widget;
|
GtkWidget* widget;
|
||||||
gint gnc_component_id;
|
gint gnc_component_id;
|
||||||
|
|
||||||
GladeXML* gxml;
|
|
||||||
GncSxInstanceDenseCalAdapter *dense_cal_model;
|
GncSxInstanceDenseCalAdapter *dense_cal_model;
|
||||||
GncDenseCal* gdcal;
|
GncDenseCal* gdcal;
|
||||||
|
|
||||||
GncSxInstanceModel* instances;
|
GncSxInstanceModel* instances;
|
||||||
GtkTreeView* tree_view;
|
GtkTreeView* tree_view;
|
||||||
|
|
||||||
} GncPluginPageSxListPrivate;
|
} GncPluginPageSxListPrivate;
|
||||||
|
|
||||||
#define GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(o) \
|
#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. */
|
/** 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);
|
static guint gnc_plugin_page_sx_list_n_actions = G_N_ELEMENTS (gnc_plugin_page_sx_list_actions);
|
||||||
|
|
||||||
|
|
||||||
GType
|
GType
|
||||||
gnc_plugin_page_sx_list_get_type (void)
|
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;
|
return gnc_plugin_page_sx_list_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GncPluginPage *
|
GncPluginPage *
|
||||||
gnc_plugin_page_sx_list_new (void)
|
gnc_plugin_page_sx_list_new (void)
|
||||||
{
|
{
|
||||||
@ -168,6 +174,7 @@ gnc_plugin_page_sx_list_new (void)
|
|||||||
return GNC_PLUGIN_PAGE(plugin_page);
|
return GNC_PLUGIN_PAGE(plugin_page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_plugin_page_sx_list_class_init (GncPluginPageSxListClass *klass)
|
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));
|
g_type_class_add_private(klass, sizeof(GncPluginPageSxListPrivate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_plugin_page_sx_list_init (GncPluginPageSxList *plugin_page)
|
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); */
|
/* gnc_plugin_init_short_names (action_group, toolbar_labels); */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_plugin_page_sx_list_dispose(GObject *object)
|
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);
|
G_OBJECT_CLASS (parent_class)->dispose(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_plugin_page_sx_list_finalize (GObject *object)
|
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);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Virtual Functions */
|
/* Virtual Functions */
|
||||||
static void
|
static void
|
||||||
gnc_plugin_page_sx_list_refresh_cb (GHashTable *changes, gpointer user_data)
|
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);
|
gtk_widget_queue_draw(priv->widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_plugin_page_sx_list_close_cb (gpointer user_data)
|
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);
|
gnc_main_window_close_page(plugin_page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gppsl_selection_changed_cb(GtkTreeSelection *selection, gpointer user_data)
|
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);
|
gtk_action_set_sensitive(delete_action, selection_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
gnc_plugin_page_sx_list_create_widget (GncPluginPage *plugin_page)
|
gnc_plugin_page_sx_list_create_widget (GncPluginPage *plugin_page)
|
||||||
{
|
{
|
||||||
GncPluginPageSxList *page;
|
GncPluginPageSxList *page;
|
||||||
GncPluginPageSxListPrivate *priv;
|
GncPluginPageSxListPrivate *priv;
|
||||||
|
GtkWidget *widget;
|
||||||
|
GtkWidget *vbox;
|
||||||
|
GtkWidget *label;
|
||||||
|
GtkWidget *swin;
|
||||||
|
char *markup;
|
||||||
|
char *text;
|
||||||
|
|
||||||
page = GNC_PLUGIN_PAGE_SX_LIST(plugin_page);
|
page = GNC_PLUGIN_PAGE_SX_LIST(plugin_page);
|
||||||
priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
|
priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
|
||||||
if (priv->widget != NULL)
|
if (priv->widget != NULL)
|
||||||
return priv->widget;
|
return priv->widget;
|
||||||
|
|
||||||
priv->gxml = gnc_glade_xml_new("sched-xact.glade", "sx-list-vbox");
|
/* Create Vpaned widget for top level */
|
||||||
priv->widget = glade_xml_get_widget(priv->gxml, "sx-list-vbox");
|
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 ("<b> %s</b>", 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;
|
// gint half_way;
|
||||||
@ -339,16 +384,14 @@ gnc_plugin_page_sx_list_create_widget (GncPluginPage *plugin_page)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
GtkContainer *tree_view_container;
|
|
||||||
GtkTreeSelection *selection;
|
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));
|
priv->tree_view = GTK_TREE_VIEW(gnc_tree_view_sx_list_new(priv->instances));
|
||||||
g_object_set(G_OBJECT(priv->tree_view),
|
g_object_set(G_OBJECT(priv->tree_view),
|
||||||
"gconf-section", GCONF_SECTION,
|
"gconf-section", GCONF_SECTION,
|
||||||
"show-column-menu", TRUE,
|
"show-column-menu", TRUE,
|
||||||
NULL);
|
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);
|
selection = gtk_tree_view_get_selection(priv->tree_view);
|
||||||
gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
|
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);
|
g_signal_connect(G_OBJECT(priv->tree_view), "row-activated", (GCallback)gppsl_row_activated_cb, (gpointer)page);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
/* Add vbox and label */
|
||||||
GtkWidget *w;
|
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 ("<b> %s</b>", 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->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)));
|
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);
|
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_months_per_col(priv->gdcal, 4);
|
||||||
gnc_dense_cal_set_num_months(priv->gdcal, 12);
|
gnc_dense_cal_set_num_months(priv->gdcal, 12);
|
||||||
|
|
||||||
w = glade_xml_get_widget(priv->gxml, "upcoming_cal_hbox");
|
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(swin), GTK_WIDGET(priv->gdcal));
|
||||||
gtk_container_add(GTK_CONTAINER(w), GTK_WIDGET(priv->gdcal));
|
|
||||||
gtk_widget_show_all(w);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->gnc_component_id = gnc_register_gui_component("plugin-page-sx-list",
|
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;
|
return priv->widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_plugin_page_sx_list_destroy_widget (GncPluginPage *plugin_page)
|
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
|
/** Save enough information about this page that it can be recreated next time
|
||||||
* the user starts gnucash.
|
* the user starts gnucash.
|
||||||
* @param plugin_page The page to save.
|
* @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)));
|
gtk_paned_get_position(GTK_PANED(priv->widget)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new sx list page based on the information saved during a previous
|
* Create a new sx list page based on the information saved during a previous
|
||||||
* instantiation of gnucash.
|
* instantiation of gnucash.
|
||||||
@ -478,6 +544,7 @@ gnc_plugin_page_sx_list_recreate_page (GtkWidget *window,
|
|||||||
return GNC_PLUGIN_PAGE(page);
|
return GNC_PLUGIN_PAGE(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_plugin_page_sx_list_cmd_new(GtkAction *action, GncPluginPageSxList *page)
|
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);
|
gnc_ui_scheduled_xaction_editor_dialog_create(new_sx, new_sx_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_edit_sx(gpointer data, gpointer user_data)
|
_edit_sx(gpointer data, gpointer user_data)
|
||||||
{
|
{
|
||||||
gnc_ui_scheduled_xaction_editor_dialog_create((SchedXaction*)data, FALSE);
|
gnc_ui_scheduled_xaction_editor_dialog_create((SchedXaction*)data, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static SchedXaction*
|
static SchedXaction*
|
||||||
_argument_reorder_fn(GtkTreePath* list_path_data, GncTreeViewSxList* user_tree_view)
|
_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);
|
return gnc_tree_view_sx_list_get_sx_from_path(user_tree_view, list_path_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_plugin_page_sx_list_cmd_edit(GtkAction *action, GncPluginPageSxList *page)
|
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);
|
g_list_free(selected_paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gppsl_row_activated_cb(GtkTreeView *tree_view,
|
gppsl_row_activated_cb(GtkTreeView *tree_view,
|
||||||
GtkTreePath *path,
|
GtkTreePath *path,
|
||||||
@ -564,6 +635,7 @@ _destroy_sx(gpointer data, gpointer user_data)
|
|||||||
xaccSchedXactionDestroy(sx);
|
xaccSchedXactionDestroy(sx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_plugin_page_sx_list_cmd_delete(GtkAction *action, GncPluginPageSxList *page)
|
gnc_plugin_page_sx_list_cmd_delete(GtkAction *action, GncPluginPageSxList *page)
|
||||||
{
|
{
|
||||||
|
@ -1,24 +1,37 @@
|
|||||||
/*
|
/********************************************************************\
|
||||||
* gnc-plugin-page-sx-list.h
|
* gnc-plugin-page-sx-list.h : scheduled transaction plugin *
|
||||||
*
|
* *
|
||||||
* Copyright (C) 2006 Josh Sled <jsled@asynchronous.org>
|
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org> *
|
||||||
*
|
* 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
|
* This program is free software; you can redistribute it and/or *
|
||||||
* 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 *
|
||||||
* This program is distributed in the hope that it will be useful,
|
* Foundation. *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* *
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* As a special exception, permission is granted to link the binary *
|
||||||
* GNU General Public License for more details.
|
* module resultant from this code with the OpenSSL project's *
|
||||||
*
|
* "OpenSSL" library (or modified versions of it that use the same *
|
||||||
* You should have received a copy of the GNU General Public License
|
* license as the "OpenSSL" library), and distribute the linked *
|
||||||
* along with this program; if not, contact:
|
* executable. You must obey the GNU General Public License in all *
|
||||||
*
|
* respects for all of the code used other than "OpenSSL". If you *
|
||||||
* Free Software Foundation Voice: +1-617-542-5942
|
* modify this file, you may extend this exception to your version *
|
||||||
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
|
* of the file, but you are not obligated to do so. If you do not *
|
||||||
* Boston, MA 02110-1301, USA gnu@gnu.org
|
* 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
|
/** @addtogroup ContentPlugins
|
||||||
@{ */
|
@{ */
|
||||||
|
@ -10,13 +10,13 @@ gtkbuilder_DATA = \
|
|||||||
dialog-fincalc.glade \
|
dialog-fincalc.glade \
|
||||||
dialog-price.glade \
|
dialog-price.glade \
|
||||||
dialog-print-check.glade \
|
dialog-print-check.glade \
|
||||||
|
dialog-sx.glade \
|
||||||
gnc-plugin-page-budget.glade \
|
gnc-plugin-page-budget.glade \
|
||||||
newuser.glade \
|
newuser.glade \
|
||||||
owner.glade \
|
owner.glade \
|
||||||
progress.glade \
|
progress.glade \
|
||||||
reconcile.glade \
|
reconcile.glade \
|
||||||
register.glade \
|
register.glade \
|
||||||
sched-xact.glade \
|
|
||||||
tax.glade \
|
tax.glade \
|
||||||
userpass.glade \
|
userpass.glade \
|
||||||
window-autoclear.glade
|
window-autoclear.glade
|
||||||
|
1692
src/gnome/gtkbuilder/dialog-sx.glade
Normal file
1692
src/gnome/gtkbuilder/dialog-sx.glade
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user