1 /* HomeBank -- Free, easy, personal accounting for everyone.
2 * Copyright (C) 1995-2019 Maxime DOYEN
4 * This file is part of HomeBank.
6 * HomeBank is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * HomeBank is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #include "dsp-mainwindow.h"
25 #include "gtk-chart-colors.h"
27 #include "ui-currency.h"
30 /****************************************************************************/
32 /****************************************************************************/
41 /* our global datas */
42 extern struct HomeBank
*GLOBALS
;
43 extern struct Preferences
*PREFS
;
58 PREF_LOCALE
, //old DISPLAY
59 PREF_TXN
, //old COLUMNS
69 static gchar
*pref_iconname
[PREF_MAX
] = {
79 "prf-euro", // to be renamed
83 static gchar
*pref_name
[PREF_MAX
] = {
96 static gchar
*CYA_TOOLBAR_STYLE
[] = {
97 N_("System defaults"),
100 N_("Text under icons"),
101 N_("Text beside icons"),
105 static gchar
*CYA_GRID_LINES
[] = {
114 gchar
*CYA_TANGO_COLORS
[] = {
122 gchar
*CYA_IMPORT_DATEORDER
[] = {
129 gchar
*CYA_IMPORT_OFXNAME
[] = {
137 gchar
*CYA_IMPORT_OFXMEMO
[] = {
139 N_("Append to Info"),
140 N_("Append to Memo"),
141 N_("Append to Payee"),
146 extern gchar
*CYA_CHART_COLORSCHEME
[];
147 extern gchar
*CYA_MONTHS
[];
154 http://en.wikipedia.org/wiki/Currencies_of_the_European_Union
155 http://www.xe.com/euro.php
156 http://fr.wikipedia.org/wiki/Liste_des_unit%C3%A9s_mon%C3%A9taires_remplac%C3%A9es_par_l%27euro
157 http://www.inter-locale.com/LocalesDemo.jsp
159 static EuroParams euro_params
[] =
161 // , rate , symb , prfx , dec, grp, frac
162 // ---------------------------------------------------------------------
163 { 0, "" , "--------" , 1.0 , "" , FALSE
, ",", ".", 2 },
164 { 1, "ATS", "Austria" , 13.7603 , "S" , TRUE
, ",", ".", 2 }, // -S 1.234.567,89
165 { 2, "BEF", "Belgium" , 40.3399 , "BF" , TRUE
, ",", ".", 2 }, // BF 1.234.567,89 -
166 { 20, "BGN", "Bulgaria" , 1.95583 , "лв." , TRUE
, ",", " ", 2 }, // non-fixé - 2014 target for euro
167 { 24, "HRK", "Croatia" , 1.0000 , "kn" , FALSE
, "" , ".", 0 }, // non-fixé - 2015 target for euro earliest
168 { 14, "CYP", "Cyprus" , 0.585274 , "£" , TRUE
, ",", "" , 2 }, //
169 { 23, "CZK", "Czech Republic" , 28.36 , "Kč" , FALSE
, ",", " ", 2 }, // non-fixé - 2015 earliest
171 { 17, "EEK", "Estonia" , 15.6466 , "kr" , FALSE
, ",", " ", 2 }, //
172 { 3, "FIM", "Finland" , 5.94573 , "mk" , FALSE
, ",", " ", 2 }, // -1 234 567,89 mk
173 { 4, "FRF", "France" , 6.55957 , "F" , FALSE
, ",", " ", 2 }, // -1 234 567,89 F
174 { 5, "DEM", "Germany" , 1.95583 , "DM" , FALSE
, ",", ".", 2 }, // -1.234.567,89 DM
175 { 6, "GRD", "Greece" , 340.750 , "d" , TRUE
, ".", ",", 2 }, // ??
176 { 21, "HUF", "Hungary" , 261.51 , "Ft" , TRUE
, ",", " ", 2 }, // non-fixé - No current target for euro
177 { 7, "IEP", "Ireland" , 0.787564 , "£" , TRUE
, ".", ",", 2 }, // -£1,234,567.89
178 { 8, "ITL", "Italy" , 1936.27 , "L" , TRUE
, "" , ".", 0 }, // L -1.234.567
179 { 18, "LVL", "Latvia" , 0.702804 , "lat.", FALSE
, ",", "" , 2 }, // jan. 2014
180 { 19, "LTL", "Lithuania" , 3.45280 , "Lt" , FALSE
, ",", "" , 2 }, // jan. 2015
181 { 9, "LUF", "Luxembourg" , 40.3399 , "LU" , TRUE
, ",", ".", 2 }, // LU 1.234.567,89 -
182 { 15, "MTL", "Malta" , 0.429300 , "Lm" , TRUE
, ",", "" , 2 }, //
183 { 10, "NLG", "Netherlands" , 2.20371 , "F" , TRUE
, ",", ".", 2 }, // F 1.234.567,89-
184 { 25, "PLN", "Poland" , 0.25 , "zł" , FALSE
, ",", "" , 2 }, // non-fixé - No current target for euro
185 { 11, "PTE", "Portugal" , 200.482 , "Esc.", FALSE
, "$", ".", 2 }, // -1.234.567$89 Esc.
186 { 22, "RON", "Romania" , 3.5155 , "Leu" , FALSE
, ",", ".", 2 }, // non-fixé - 2015 target for euro earliest
187 { 16, "SKK", "Slovak Republic", 30.12600 , "Sk" , FALSE
, ",", " ", 2 }, //
188 { 13, "SIT", "Slovenia" , 239.640 , "tol" , TRUE
, ",", ".", 2 }, //
189 { 12, "ESP", "Spain" , 166.386 , "Pts" , TRUE
, "" , ".", 0 }, // -Pts 1.234.567
192 // { " ", "" , 1.00000 , "" , "" , FALSE, ",", "", 2 },
196 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
199 static LangName languagenames
[] =
201 // af ar ast be bg ca cs cy da de el en_AU en_CA en_GB es et eu fa fi fr ga gl he hr hu id is it
202 //ja ka ko lt lv ms nb nds nl oc pl pt_BR pt pt_PT ro ru si sk sl sr sv tr uk vi zh_CN zh_TW
205 { "ab", "Abkhazian" },
207 { "af", "Afrikaans" },
210 { "an", "Aragonese" },
212 { "as", "Assamese" },
213 { "ast", "Asturian, Bable, Leonese, Asturleonese" },
216 { "az", "Azerbaijani" },
218 { "be", "Belarusian" },
219 { "bg", "Bulgarian" },
229 { "ch", "Chamorro" },
230 { "co", "Corsican" },
233 { "cu", "Old Church Slavonic" },
239 { "dz", "Dzongkha" },
243 { "eo", "Esperanto" },
245 { "et", "Estonian" },
253 { "fy", "Western Frisian" },
255 { "gd", "Scottish Gaelic" },
256 { "gl", "Galician" },
258 { "gu", "Gujarati" },
263 { "ho", "Hiri Motu" },
264 { "hr", "Croatian" },
266 { "hu", "Hungarian" },
267 { "hy", "Armenian" },
269 { "ia", "Interlingua" },
270 { "id", "Indonesian" },
271 { "ie", "Interlingue" },
273 { "ii", "Sichuan Yi" },
276 { "is", "Icelandic" },
278 { "iu", "Inuktitut" },
279 { "ja", "Japanese" },
280 { "jv", "Javanese" },
281 { "ka", "Georgian" },
284 { "kj", "Kwanyama" },
286 { "kl", "Kalaallisut" },
291 { "ks", "Kashmiri" },
297 { "lb", "Luxembourgish" },
299 { "li", "Limburgish" },
302 { "lt", "Lithuanian" },
303 { "lu", "Luba-Katanga" },
305 { "mg", "Malagasy" },
306 { "mh", "Marshallese" },
308 { "mk", "Macedonian" },
309 { "ml", "Malayalam" },
310 { "mn", "Mongolian" },
311 { "mo", "Moldavian" },
317 { "nb", "Norwegian Bokmål" },
318 { "nd", "North Ndebele" },
319 { "nds", "Low German, Low Saxon" },
323 { "nn", "Norwegian Nynorsk" },
324 { "no", "Norwegian" },
325 { "nr", "South Ndebele" },
327 { "ny", "Chichewa" },
332 { "os", "Ossetian" },
337 { "pt", "Portuguese" },
341 { "ro", "Romanian" },
343 { "rw", "Kinyarwanda" },
344 { "sa", "Sanskrit" },
345 { "sc", "Sardinian" },
347 { "se", "Northern Sami" },
349 { "si", "Sinhalese" },
355 { "sq", "Albanian" },
359 { "su", "Sundanese" },
366 { "ti", "Tigrinya" },
375 { "ty", "Tahitian" },
377 { "uk", "Ukrainian" },
381 { "vi", "Viêt Namese" },
395 static GtkWidget
*pref_list_create(void);
399 ui_language_combobox_compare_func (GtkTreeModel
*model
, GtkTreeIter
*a
, GtkTreeIter
*b
, gpointer userdata
)
402 gchar
*code1
, *code2
;
403 gchar
*name1
, *name2
;
405 gtk_tree_model_get(model
, a
, 0, &code1
, 1, &name1
, -1);
406 gtk_tree_model_get(model
, b
, 0, &code2
, 1, &name2
, -1);
408 //keep system laguage on top
409 if(code1
== NULL
) name1
= NULL
;
410 if(code2
== NULL
) name2
= NULL
;
412 retval
= hb_string_utf8_compare(name1
, name2
);
421 static gchar
*languagename_get(const gchar
*locale
)
425 for (i
= 0; i
< G_N_ELEMENTS (languagenames
); i
++)
427 if( g_ascii_strncasecmp(locale
, languagenames
[i
].locale
, -1) == 0 )
428 return languagenames
[i
].name
;
436 ui_language_combobox_get_name(const gchar
*locale
)
440 DB( g_print("[ui_language_combobox_get_name]\n") );
442 // A locale directory name is typically of the form language[_territory]
443 lang
= languagename_get (locale
);
446 const gchar
*delimiter
= strchr (locale
, '_'); // strip off the territory suffix
450 gchar
*copy
= g_strndup (locale
, delimiter
- locale
);
451 lang
= languagename_get (copy
);
457 g_warning(" locale name not found '%s'", locale
);
468 ui_language_combobox_populate(GtkWidget
*combobox
)
473 model
= gtk_combo_box_get_model(GTK_COMBO_BOX(combobox
));
474 gtk_list_store_append (GTK_LIST_STORE(model
), &iter
);
475 gtk_list_store_set (GTK_LIST_STORE(model
), &iter
,
477 1, _("System Language"),
480 GDir
*dir
= g_dir_open (homebank_app_get_locale_dir (), 0, NULL
);
481 const gchar
*dirname
;
486 while ((dirname
= g_dir_read_name (dir
)) != NULL
)
488 gchar
*filename
= g_build_filename (homebank_app_get_locale_dir (),
491 GETTEXT_PACKAGE
".mo",
493 //DB( g_print("- seek for '%s'\n", filename) );
494 if (g_file_test (filename
, G_FILE_TEST_EXISTS
))
499 gtk_list_store_append (GTK_LIST_STORE(model
), &iter
);
501 lang
= ui_language_combobox_get_name(dirname
);
502 label
= g_strdup_printf ("%s [%s]", lang
, dirname
);
504 gtk_list_store_set (GTK_LIST_STORE(model
), &iter
,
516 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model
), GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID
, GTK_SORT_ASCENDING
);
523 ui_language_combobox_new(GtkWidget
*label
)
527 GtkCellRenderer
*renderer
;
529 store
= gtk_list_store_new (2,
533 gtk_tree_sortable_set_default_sort_func(GTK_TREE_SORTABLE(store
), ui_language_combobox_compare_func
, NULL
, NULL
);
535 combobox
= gtk_combo_box_new_with_model(GTK_TREE_MODEL(store
));
536 renderer
= gtk_cell_renderer_text_new ();
537 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox
), renderer
, TRUE
);
538 gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox
), renderer
, "text", 1, NULL
);
540 gtk_combo_box_set_id_column( GTK_COMBO_BOX(combobox
), 0);
542 g_object_unref(store
);
545 gtk_label_set_mnemonic_widget (GTK_LABEL(label
), combobox
);
547 ui_language_combobox_populate(combobox
);
549 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox
), 0);
555 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
556 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
557 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
559 static gint
ui_euro_combobox_id_to_active(gint id
)
563 DB( g_print("\n[ui-pref] ui_euro_combobox_id_to_active\n") );
566 for (i
= 0; i
< G_N_ELEMENTS (euro_params
); i
++)
568 if( euro_params
[i
].id
== id
)
571 DB( g_print("- id (country)=%d => %d - %s\n", id
, i
, euro_params
[i
].name
) );
581 static gint
ui_euro_combobox_active_to_id(gint active
)
585 DB( g_print("\n[ui-pref] ui_euro_combobox_active_to_id\n") );
587 DB( g_print("- to %d\n", active
) );
590 if( active
< (gint
)G_N_ELEMENTS (euro_params
) )
592 id
= euro_params
[active
].id
;
593 DB( g_print("- id (country)=%d '%s'\n", id
, euro_params
[active
].name
) );
599 static GtkWidget
*ui_euro_combobox_new(GtkWidget
*label
)
604 DB( g_print("\n[ui-pref] make euro preset\n") );
606 combobox
= gtk_combo_box_text_new();
607 for (i
= 0; i
< G_N_ELEMENTS (euro_params
); i
++)
609 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combobox
), euro_params
[i
].name
);
611 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox
), 0);
614 gtk_label_set_mnemonic_widget (GTK_LABEL(label
), combobox
);
620 static void defpref_pathselect(GtkWidget
*widget
, gpointer user_data
)
622 struct defpref_data
*data
;
623 gint type
= GPOINTER_TO_INT(user_data
);
629 DB( g_print("\n[ui-pref] path select\n") );
631 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), "inst_data");
635 case PRF_PATH_WALLET
:
636 path
= &PREFS
->path_hbfile
;
637 entry
= data
->ST_path_hbfile
;
638 title
= _("Choose a default HomeBank files folder");
640 case PRF_PATH_IMPORT
:
641 path
= &PREFS
->path_import
;
642 entry
= data
->ST_path_import
;
643 title
= _("Choose a default import folder");
645 case PRF_PATH_EXPORT
:
646 path
= &PREFS
->path_export
;
647 entry
= data
->ST_path_export
;
648 title
= _("Choose a default export folder");
654 DB( g_print(" - hbfile %p %s at %p\n" , PREFS
->path_hbfile
, PREFS
->path_hbfile
, &PREFS
->path_hbfile
) );
655 DB( g_print(" - import %p %s at %p\n" , PREFS
->path_import
, PREFS
->path_import
, &PREFS
->path_import
) );
656 DB( g_print(" - export %p %s at %p\n" , PREFS
->path_export
, PREFS
->path_export
, &PREFS
->path_export
) );
659 DB( g_print(" - before: %s %p\n" , *path
, path
) );
661 r
= ui_file_chooser_folder(GTK_WINDOW(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), title
, path
);
664 DB( g_print(" - after: %s\n", *path
) );
667 gtk_entry_set_text(GTK_ENTRY(entry
), *path
);
674 ** update the date sample label
676 static void defpref_date_sample(GtkWidget
*widget
, gpointer user_data
)
678 struct defpref_data
*data
;
683 DB( g_print("\n[ui-pref] date sample\n") );
685 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), "inst_data");
687 fmt
= gtk_entry_get_text(GTK_ENTRY(data
->ST_datefmt
));
688 date
= g_date_new_julian (GLOBALS
->today
);
689 g_date_strftime (buffer
, 256-1, fmt
, date
);
692 gtk_label_set_text(GTK_LABEL(data
->LB_date
), buffer
);
698 ** update the number sample label
700 static void defpref_numbereuro_sample(GtkWidget
*widget
, gpointer user_data
)
702 struct defpref_data
*data
;
704 gchar formatd_buf
[G_ASCII_DTOSTR_BUF_SIZE
];
707 DB( g_print("\n[ui-pref] number sample\n") );
709 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), "inst_data");
711 cur
.symbol
= (gchar
*)gtk_entry_get_text(GTK_ENTRY(data
->ST_euro_symbol
));
712 cur
.sym_prefix
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_euro_isprefix
));
713 cur
.decimal_char
= (gchar
*)gtk_entry_get_text(GTK_ENTRY(data
->ST_euro_decimalchar
));
714 cur
.grouping_char
= (gchar
*)gtk_entry_get_text(GTK_ENTRY(data
->ST_euro_groupingchar
));
715 cur
.frac_digits
= gtk_spin_button_get_value(GTK_SPIN_BUTTON(data
->NB_euro_fracdigits
));
717 da_cur_initformat (&cur
);
719 DB( g_print("fmt: %s\n", cur
.format
) );
721 g_ascii_formatd(formatd_buf
, sizeof (formatd_buf
), cur
.format
, HB_NUMBER_SAMPLE
);
722 hb_str_formatd(buf
, 127, formatd_buf
, &cur
, TRUE
);
724 gtk_label_set_text(GTK_LABEL(data
->LB_numbereuro
), buf
);
730 ** enable/disable euro
732 static void defpref_eurotoggle(GtkWidget
*widget
, gpointer user_data
)
734 struct defpref_data
*data
;
737 DB( g_print("\n[ui-pref] euro toggle\n") );
739 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), "inst_data");
741 sensitive
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_euro_enable
));
743 gtk_widget_set_sensitive(data
->GRP_currency
, sensitive
);
744 gtk_widget_set_sensitive(data
->GRP_rate
, sensitive
);
745 gtk_widget_set_sensitive(data
->GRP_format
, sensitive
);
750 ** set euro value widget from a country
752 static void defpref_eurosetcurrency(GtkWidget
*widget
, gint country
)
754 struct defpref_data
*data
;
759 DB( g_print("\n[ui-pref] eurosetcurrency\n") );
761 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), "inst_data");
763 active
= ui_euro_combobox_id_to_active(country
);
764 euro
= &euro_params
[active
];
765 buf
= g_strdup_printf("%s - %s", euro
->iso
, euro
->name
);
766 gtk_label_set_markup(GTK_LABEL(data
->ST_euro_country
), buf
);
772 ** set euro value widget from a country
774 static void defpref_europreset(GtkWidget
*widget
, gpointer user_data
)
776 struct defpref_data
*data
;
779 DB( g_print("\n[ui-pref] euro preset\n") );
781 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), "inst_data");
783 active
= gtk_combo_box_get_active (GTK_COMBO_BOX(data
->CY_euro_preset
));
784 data
->country
= ui_euro_combobox_active_to_id (active
);;
786 defpref_eurosetcurrency(widget
, data
->country
);
788 gtk_spin_button_set_value(GTK_SPIN_BUTTON(data
->NB_euro_value
), euro_params
[active
].value
);
790 gtk_spin_button_set_value(GTK_SPIN_BUTTON(data
->NB_euro_fracdigits
), euro_params
[active
].frac_digits
);
792 gtk_entry_set_text(GTK_ENTRY(data
->ST_euro_symbol
) , euro_params
[active
].symbol
);
793 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_euro_isprefix
), euro_params
[active
].sym_prefix
);
794 gtk_entry_set_text(GTK_ENTRY(data
->ST_euro_decimalchar
) , euro_params
[active
].decimal_char
);
795 gtk_entry_set_text(GTK_ENTRY(data
->ST_euro_groupingchar
), euro_params
[active
].grouping_char
);
800 static void defpref_colortoggle(GtkWidget
*widget
, gpointer user_data
)
802 struct defpref_data
*data
;
805 DB( g_print("\n[ui-pref] color toggle\n") );
807 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), "inst_data");
809 sensitive
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_custom_colors
));
811 gtk_widget_set_sensitive(data
->LB_colors
, sensitive
);
812 gtk_widget_set_sensitive(data
->CY_colors
, sensitive
);
813 gtk_widget_set_sensitive(data
->LB_exp_color
, sensitive
);
814 gtk_widget_set_sensitive(data
->GR_colors
, sensitive
);
818 static void defpref_backuptoggle(GtkWidget
*widget
, gpointer user_data
)
820 struct defpref_data
*data
;
823 DB( g_print("\n[ui-pref] backup toggle\n") );
825 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), "inst_data");
827 sensitive
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_bak_is_automatic
));
828 gtk_widget_set_sensitive(data
->LB_bak_max_num_copies
, sensitive
);
829 gtk_widget_set_sensitive(data
->NB_bak_max_num_copies
, sensitive
);
830 gtk_widget_set_sensitive(data
->GR_bak_freq
, sensitive
);
835 ** set preset colors for amount display
837 static void defpref_colorpreset(GtkWidget
*widget
, gpointer user_data
)
839 struct defpref_data
*data
;
842 gchar
*expcol
, *inccol
, *wrncol
;
844 DB( g_print("\n[ui-pref] color preset\n") );
846 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), "inst_data");
848 preset
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_colors
));
853 expcol
= LIGHT_EXP_COLOR
;
854 inccol
= LIGHT_INC_COLOR
;
855 wrncol
= LIGHT_WARN_COLOR
;
859 expcol
= MEDIUM_EXP_COLOR
;
860 inccol
= MEDIUM_INC_COLOR
;
861 wrncol
= MEDIUM_WARN_COLOR
;
866 expcol
= DEFAULT_EXP_COLOR
;
867 inccol
= DEFAULT_INC_COLOR
;
868 wrncol
= DEFAULT_WARN_COLOR
;
873 gdk_rgba_parse(&rgba
, expcol
);
874 gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(data
->CP_exp_color
), &rgba
);
876 gdk_rgba_parse(&rgba
, inccol
);
877 gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(data
->CP_inc_color
), &rgba
);
879 gdk_rgba_parse(&rgba
, wrncol
);
880 gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(data
->CP_warn_color
), &rgba
);
886 static void defpref_color_scheme_changed(GtkWidget
*widget
, gpointer user_data
)
888 struct defpref_data
*data
;
890 DB( g_print("\n[ui-pref] color scheme chnaged\n") );
892 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), "inst_data");
894 gtk_widget_queue_draw (data
->DA_colors
);
902 static void setGdkColor_from_RGB(GdkColor *color, guint32 value)
907 color->red = tmp | tmp<<8;
909 tmp = value >> 8 & 0xFF;
910 color->green = tmp | tmp<<8;
913 color->blue = tmp | tmp<<8;
919 ** set :: fill in widgets from PREFS structure
922 static void defpref_set(struct defpref_data
*data
)
926 DB( g_print("\n[ui-pref] set\n") );
929 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_show_splash
), PREFS
->showsplash
);
930 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_load_last
), PREFS
->loadlast
);
931 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_append_scheduled
), PREFS
->appendscheduled
);
932 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_do_update_currency
), PREFS
->do_update_currency
);
933 gtk_combo_box_set_active(GTK_COMBO_BOX(data
->CY_daterange_wal
), PREFS
->date_range_wal
);
934 gtk_spin_button_set_value(GTK_SPIN_BUTTON(data
->NB_fiscyearday
), PREFS
->fisc_year_day
);
935 gtk_combo_box_set_active(GTK_COMBO_BOX(data
->CY_fiscyearmonth
), PREFS
->fisc_year_month
- 1);
938 gtk_entry_set_text(GTK_ENTRY(data
->ST_path_hbfile
), PREFS
->path_hbfile
);
939 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_bak_is_automatic
), PREFS
->bak_is_automatic
);
940 gtk_spin_button_set_value(GTK_SPIN_BUTTON(data
->NB_bak_max_num_copies
), PREFS
->bak_max_num_copies
);
943 if(PREFS
->language
!= NULL
)
944 gtk_combo_box_set_active_id(GTK_COMBO_BOX(data
->CY_language
), PREFS
->language
);
946 gtk_combo_box_set_active (GTK_COMBO_BOX(data
->CY_language
), 0);
947 gtk_combo_box_set_active(GTK_COMBO_BOX(data
->CY_toolbar
), PREFS
->toolbar_style
);
948 //gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_image_size), PREFS->image_size);
950 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_custom_colors
), PREFS
->custom_colors
);
951 gdk_rgba_parse(&rgba
, PREFS
->color_exp
);
952 gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(data
->CP_exp_color
), &rgba
);
953 gdk_rgba_parse(&rgba
, PREFS
->color_inc
);
954 gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(data
->CP_inc_color
), &rgba
);
955 gdk_rgba_parse(&rgba
, PREFS
->color_warn
);
956 gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(data
->CP_warn_color
), &rgba
);
957 //gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_ruleshint), PREFS->rules_hint);
958 gtk_combo_box_set_active(GTK_COMBO_BOX(data
->CY_gridlines
), PREFS
->grid_lines
);
961 gtk_combo_box_set_active(GTK_COMBO_BOX(data
->CY_daterange_txn
), PREFS
->date_range_txn
);
962 gtk_spin_button_set_value(GTK_SPIN_BUTTON(data
->ST_datefuture_nbdays
), PREFS
->date_future_nbdays
);
963 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_hide_reconciled
), PREFS
->hidereconciled
);
964 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_show_remind
), PREFS
->showremind
);
965 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_herit_date
), PREFS
->heritdate
);
966 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_memoacp
), PREFS
->txn_memoacp
);
967 gtk_spin_button_set_value(GTK_SPIN_BUTTON(data
->ST_memoacp_days
), PREFS
->txn_memoacp_days
);
970 gtk_entry_set_text(GTK_ENTRY(data
->ST_datefmt
), PREFS
->date_format
);
971 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_unitismile
), PREFS
->vehicle_unit_ismile
);
972 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_unitisgal
), PREFS
->vehicle_unit_isgal
);
975 gtk_combo_box_set_active(GTK_COMBO_BOX(data
->CY_dtex_datefmt
), PREFS
->dtex_datefmt
);
976 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_dtex_ucfirst
), PREFS
->dtex_ucfirst
);
977 gtk_combo_box_set_active(GTK_COMBO_BOX(data
->CY_dtex_ofxname
), PREFS
->dtex_ofxname
);
978 gtk_combo_box_set_active(GTK_COMBO_BOX(data
->CY_dtex_ofxmemo
), PREFS
->dtex_ofxmemo
);
979 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_dtex_qifmemo
), PREFS
->dtex_qifmemo
);
980 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_dtex_qifswap
), PREFS
->dtex_qifswap
);
981 gtk_entry_set_text(GTK_ENTRY(data
->ST_path_import
), PREFS
->path_import
);
982 gtk_entry_set_text(GTK_ENTRY(data
->ST_path_export
), PREFS
->path_export
);
985 gtk_combo_box_set_active(GTK_COMBO_BOX(data
->CY_daterange_rep
), PREFS
->date_range_rep
);
986 gtk_combo_box_set_active(GTK_COMBO_BOX(data
->CY_color_scheme
), PREFS
->report_color_scheme
);
987 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_stat_byamount
), PREFS
->stat_byamount
);
988 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_stat_showrate
), PREFS
->stat_showrate
);
989 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_stat_showdetail
), PREFS
->stat_showdetail
);
990 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_budg_showdetail
), PREFS
->budg_showdetail
);
993 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_euro_enable
), PREFS
->euro_active
);
994 //gtk_combo_box_set_active(GTK_COMBO_BOX(data->CY_euro_preset), PREFS->euro_country);
995 data
->country
= PREFS
->euro_country
;
996 defpref_eurosetcurrency(data
->window
, data
->country
);
997 gtk_spin_button_set_value(GTK_SPIN_BUTTON(data
->NB_euro_value
), PREFS
->euro_value
);
998 ui_gtk_entry_set_text(data
->ST_euro_symbol
, PREFS
->minor_cur
.symbol
);
999 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_euro_isprefix
), PREFS
->minor_cur
.sym_prefix
);
1000 ui_gtk_entry_set_text(data
->ST_euro_decimalchar
, PREFS
->minor_cur
.decimal_char
);
1001 ui_gtk_entry_set_text(data
->ST_euro_groupingchar
, PREFS
->minor_cur
.grouping_char
);
1002 gtk_spin_button_set_value(GTK_SPIN_BUTTON(data
->NB_euro_fracdigits
), PREFS
->minor_cur
.frac_digits
);
1004 //gtk_entry_set_text(GTK_ENTRY(data->ST_euro_symbol), PREFS->euro_symbol);
1005 //gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_euro_nbdec), PREFS->euro_nbdec);
1006 //gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_euro_thsep), PREFS->euro_thsep);
1011 ** get :: fill PREFS structure from widgets
1013 #define RGBA_TO_INT(x) (int)(x*255)
1015 static gchar
*gdk_rgba_to_hex(GdkRGBA
*rgba
)
1017 return g_strdup_printf("#%02x%02x%02x", RGBA_TO_INT(rgba
->red
), RGBA_TO_INT(rgba
->green
), RGBA_TO_INT(rgba
->blue
));
1021 static void defpref_get(struct defpref_data
*data
)
1026 DB( g_print("\n[ui-pref] get\n") );
1029 PREFS
->showsplash
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_show_splash
));
1030 PREFS
->loadlast
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_load_last
));
1031 PREFS
->appendscheduled
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_append_scheduled
));
1032 PREFS
->do_update_currency
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_do_update_currency
));
1033 PREFS
->date_range_wal
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_daterange_wal
));
1034 PREFS
->fisc_year_day
= gtk_spin_button_get_value(GTK_SPIN_BUTTON(data
->NB_fiscyearday
));
1035 PREFS
->fisc_year_month
= 1 + gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_fiscyearmonth
));
1038 ui_gtk_entry_replace_text(data
->ST_path_hbfile
, &PREFS
->path_hbfile
);
1040 PREFS
->bak_is_automatic
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_bak_is_automatic
));
1041 PREFS
->bak_max_num_copies
= gtk_spin_button_get_value(GTK_SPIN_BUTTON(data
->NB_bak_max_num_copies
));
1043 g_free(PREFS
->language
);
1044 PREFS
->language
= NULL
;
1045 lang
= gtk_combo_box_get_active_id(GTK_COMBO_BOX(data
->CY_language
));
1048 PREFS
->language
= g_strdup(lang
);
1051 PREFS
->toolbar_style
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_toolbar
));
1052 //PREFS->image_size = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->NB_image_size));
1054 PREFS
->custom_colors
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_custom_colors
));
1055 gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(data
->CP_exp_color
), &rgba
);
1056 g_free(PREFS
->color_exp
);
1057 PREFS
->color_exp
= gdk_rgba_to_hex(&rgba
);
1058 gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(data
->CP_inc_color
), &rgba
);
1059 g_free(PREFS
->color_inc
);
1060 PREFS
->color_inc
= gdk_rgba_to_hex(&rgba
);
1061 gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(data
->CP_warn_color
), &rgba
);
1062 g_free(PREFS
->color_warn
);
1063 PREFS
->color_warn
= gdk_rgba_to_hex(&rgba
);
1064 //PREFS->rules_hint = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_ruleshint));
1065 PREFS
->grid_lines
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_gridlines
));
1066 //list_txn_colpref_get(GTK_TREE_VIEW(data->LV_opecolumns), PREFS->lst_ope_columns);
1069 PREFS
->date_range_txn
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_daterange_txn
));
1070 PREFS
->date_future_nbdays
= gtk_spin_button_get_value(GTK_SPIN_BUTTON(data
->ST_datefuture_nbdays
));
1071 PREFS
->hidereconciled
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_hide_reconciled
));
1072 PREFS
->showremind
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_show_remind
));
1073 PREFS
->heritdate
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_herit_date
));
1074 PREFS
->txn_memoacp
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_memoacp
));
1075 PREFS
->txn_memoacp_days
= gtk_spin_button_get_value(GTK_SPIN_BUTTON(data
->ST_memoacp_days
));
1078 g_free(PREFS
->date_format
);
1079 PREFS
->date_format
= g_strdup(gtk_entry_get_text(GTK_ENTRY(data
->ST_datefmt
)));
1080 PREFS
->vehicle_unit_ismile
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_unitismile
));
1081 PREFS
->vehicle_unit_isgal
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_unitisgal
));
1084 PREFS
->dtex_datefmt
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_dtex_datefmt
));
1085 PREFS
->dtex_ucfirst
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_dtex_ucfirst
));
1086 PREFS
->dtex_ofxname
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_dtex_ofxname
));
1087 PREFS
->dtex_ofxmemo
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_dtex_ofxmemo
));
1088 PREFS
->dtex_qifmemo
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_dtex_qifmemo
));
1089 PREFS
->dtex_qifswap
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_dtex_qifswap
));
1090 ui_gtk_entry_replace_text(data
->ST_path_import
, &PREFS
->path_import
);
1091 ui_gtk_entry_replace_text(data
->ST_path_export
, &PREFS
->path_export
);
1094 PREFS
->date_range_rep
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_daterange_rep
));
1095 PREFS
->report_color_scheme
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_color_scheme
));
1096 PREFS
->stat_byamount
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_stat_byamount
));
1097 PREFS
->stat_showrate
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_stat_showrate
));
1098 PREFS
->stat_showdetail
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_stat_showdetail
));
1099 PREFS
->budg_showdetail
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_budg_showdetail
));
1102 PREFS
->euro_active
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_euro_enable
));
1103 PREFS
->euro_country
= data
->country
;
1104 PREFS
->euro_value
= gtk_spin_button_get_value(GTK_SPIN_BUTTON(data
->NB_euro_value
));
1105 //strcpy(PREFS->euro_symbol, gtk_entry_get_text(GTK_ENTRY(data->ST_euro_symbol)));
1106 //PREFS->euro_nbdec = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->NB_euro_nbdec));
1107 //PREFS->euro_thsep = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_euro_thsep));
1108 ui_gtk_entry_replace_text(data
->ST_euro_symbol
, &PREFS
->minor_cur
.symbol
);
1109 PREFS
->minor_cur
.sym_prefix
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_euro_isprefix
));
1110 ui_gtk_entry_replace_text(data
->ST_euro_decimalchar
, &PREFS
->minor_cur
.decimal_char
);
1111 ui_gtk_entry_replace_text(data
->ST_euro_groupingchar
, &PREFS
->minor_cur
.grouping_char
);
1112 PREFS
->minor_cur
.frac_digits
= gtk_spin_button_get_value(GTK_SPIN_BUTTON(data
->NB_euro_fracdigits
));
1113 //PREFS->chart_legend = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_chartlegend));
1117 static GtkWidget
*defpref_page_import (struct defpref_data
*data
)
1119 GtkWidget
*content_grid
, *group_grid
, *label
, *widget
;
1122 content_grid
= gtk_grid_new();
1123 gtk_grid_set_row_spacing (GTK_GRID (content_grid
), SPACING_LARGE
);
1124 gtk_orientable_set_orientation(GTK_ORIENTABLE(content_grid
), GTK_ORIENTATION_VERTICAL
);
1127 // group :: Date options
1128 group_grid
= gtk_grid_new ();
1129 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1130 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1131 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1133 label
= make_label_group(_("Date options"));
1134 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1137 label
= make_label_widget(_("Date order:"));
1138 //----------------------------------------- l, r, t, b
1139 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1140 widget
= make_cycle(label
, CYA_IMPORT_DATEORDER
);
1141 data
->CY_dtex_datefmt
= widget
;
1142 //gtk_grid_attach (GTK_GRID (group_grid), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1143 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1146 // group :: OFX/QFX options
1147 group_grid
= gtk_grid_new ();
1148 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1149 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1150 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1152 label
= make_label_group(_("OFX/QFX options"));
1153 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1156 label
= make_label_widget(_("OFX _Name:"));
1157 //----------------------------------------- l, r, t, b
1158 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1159 widget
= make_cycle(label
, CYA_IMPORT_OFXNAME
);
1160 data
->CY_dtex_ofxname
= widget
;
1161 //gtk_grid_attach (GTK_GRID (group_grid), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1162 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1165 label
= make_label_widget(_("OFX _Memo:"));
1166 //----------------------------------------- l, r, t, b
1167 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1168 widget
= make_cycle(label
, CYA_IMPORT_OFXMEMO
);
1169 data
->CY_dtex_ofxmemo
= widget
;
1170 //gtk_grid_attach (GTK_GRID (group_grid), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1171 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1173 // group :: QIF options
1174 group_grid
= gtk_grid_new ();
1175 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1176 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1177 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1179 label
= make_label_group(_("QIF options"));
1180 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1183 widget
= gtk_check_button_new_with_mnemonic (_("_Import memos"));
1184 data
->CM_dtex_qifmemo
= widget
;
1185 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 1, 1);
1186 widget
= gtk_check_button_new_with_mnemonic (_("_Swap memos with payees"));
1187 data
->CM_dtex_qifswap
= widget
;
1188 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1190 // group :: other options
1191 group_grid
= gtk_grid_new ();
1192 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1193 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1194 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1196 label
= make_label_group(_("Other options"));
1197 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1200 widget
= gtk_check_button_new_with_mnemonic (_("Sentence _case memo/payee"));
1201 data
->CM_dtex_ucfirst
= widget
;
1202 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 1, 1);
1205 return content_grid
;
1211 draw_callback (GtkWidget
*widget
,
1215 struct defpref_data
*data
= user_data
;
1217 GtkColorScheme scheme
;
1221 index
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_color_scheme
));
1223 colorscheme_init(&scheme
, index
);
1225 gtk_widget_get_size_request (widget
, &w
, &h
);
1227 for(i
=0;i
<scheme
.nb_cols
;i
++)
1229 cairo_user_set_rgbcol (cr
, &scheme
.colors
[i
]);
1230 cairo_rectangle(cr
, x
, y
, cube_dim
, cube_dim
);
1234 { x
= 0; y
= 1 + cube_dim
; }
1242 static GtkWidget
*defpref_page_reports (struct defpref_data
*data
)
1244 GtkWidget
*content_grid
, *group_grid
, *label
, *widget
;
1247 content_grid
= gtk_grid_new();
1248 gtk_grid_set_row_spacing (GTK_GRID (content_grid
), SPACING_LARGE
);
1249 gtk_orientable_set_orientation(GTK_ORIENTABLE(content_grid
), GTK_ORIENTATION_VERTICAL
);
1252 // group :: Initial filter
1253 group_grid
= gtk_grid_new ();
1254 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1255 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1256 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1258 label
= make_label_group(_("Initial filter"));
1259 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1262 label
= make_label_widget(_("_Range:"));
1263 //----------------------------------------- l, r, t, b
1264 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1265 widget
= make_daterange(label
, FALSE
);
1266 data
->CY_daterange_rep
= widget
;
1267 //gtk_grid_attach (GTK_GRID (group_grid), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1268 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1270 // group ::Charts options
1271 group_grid
= gtk_grid_new ();
1272 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1273 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1274 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1276 label
= make_label_group(_("Charts options"));
1277 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1280 label
= make_label_widget(_("Color scheme:"));
1281 //----------------------------------------- l, r, t, b
1282 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1283 widget
= make_cycle(label
, chart_colors
);
1284 data
->CY_color_scheme
= widget
;
1285 //gtk_grid_attach (GTK_GRID (group_grid), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1286 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1289 widget
= gtk_drawing_area_new ();
1290 data
->DA_colors
= widget
;
1291 gtk_widget_set_size_request (widget
, (1+cube_dim
)*16, (1+cube_dim
)*2);
1292 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1294 g_signal_connect (data
->DA_colors
, "draw", G_CALLBACK (draw_callback
), data
);
1296 // group :: Statistics options
1297 group_grid
= gtk_grid_new ();
1298 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1299 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1300 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1302 label
= make_label_group(_("Statistics options"));
1303 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1306 widget
= gtk_check_button_new_with_mnemonic (_("Show by _amount"));
1307 data
->CM_stat_byamount
= widget
;
1308 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 2, 1);
1311 widget
= gtk_check_button_new_with_mnemonic (_("Show _rate column"));
1312 data
->CM_stat_showrate
= widget
;
1313 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 2, 1);
1316 widget
= gtk_check_button_new_with_mnemonic (_("Show _details"));
1317 data
->CM_stat_showdetail
= widget
;
1318 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 2, 1);
1320 // group :: Budget options
1321 group_grid
= gtk_grid_new ();
1322 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1323 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1324 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1326 label
= make_label_group(_("Budget options"));
1327 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1330 widget
= gtk_check_button_new_with_mnemonic (_("Show _details"));
1331 data
->CM_budg_showdetail
= widget
;
1332 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 2, 1);
1334 return content_grid
;
1338 static GtkWidget
*defpref_page_euro (struct defpref_data
*data
)
1340 GtkWidget
*content_grid
, *group_grid
, *label
, *widget
, *expander
;
1343 content_grid
= gtk_grid_new();
1344 gtk_grid_set_row_spacing (GTK_GRID (content_grid
), SPACING_LARGE
);
1345 gtk_orientable_set_orientation(GTK_ORIENTABLE(content_grid
), GTK_ORIENTATION_VERTICAL
);
1349 group_grid
= gtk_grid_new ();
1350 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1351 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1352 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1354 label
= make_label_group(_("General"));
1355 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1358 widget
= gtk_check_button_new_with_mnemonic (_("_Enable"));
1359 data
->CM_euro_enable
= widget
;
1360 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 2, 1);
1362 // group :: Currency
1363 group_grid
= gtk_grid_new ();
1364 data
->GRP_currency
= group_grid
;
1365 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1366 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1367 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1369 label
= make_label_group(_("Currency"));
1370 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 4, 1);
1373 widget
= make_label(NULL
, 0.0, 0.5);
1374 data
->ST_euro_country
= widget
;
1375 //gtk_grid_attach (GTK_GRID (group_grid), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1376 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 1, 1);
1379 label
= make_label_widget(_("_Preset:"));
1380 //----------------------------------------- l, r, t, b
1381 gtk_grid_attach (GTK_GRID (group_grid
), label
, 2, row
, 1, 1);
1382 widget
= ui_euro_combobox_new (label
);
1383 data
->CY_euro_preset
= widget
;
1384 gtk_widget_set_margin_left (label
, 2*SPACING_LARGE
);
1385 //gtk_grid_attach (GTK_GRID (group_grid), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1386 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 3, row
, 1, 1);
1389 // group :: Exchange rate
1390 group_grid
= gtk_grid_new ();
1391 data
->GRP_rate
= group_grid
;
1392 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1393 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1394 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1396 label
= make_label_group(_("Exchange rate"));
1397 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1400 label
= make_label_widget("1 EUR _=");
1401 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1402 widget
= make_exchange_rate(label
);
1403 data
->NB_euro_value
= widget
;
1404 //gtk_grid_attach (GTK_GRID (group_grid), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1405 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1407 // group :: Numbers format
1408 group_grid
= gtk_grid_new ();
1409 data
->GRP_format
= group_grid
;
1410 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1411 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1412 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1414 label
= make_label_group(_("Format"));
1415 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1418 widget
= make_label(NULL
, 0, 0.0);
1419 data
->LB_numbereuro
= widget
;
1420 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 1, 1);
1423 expander
= gtk_expander_new_with_mnemonic(_("_Customize"));
1424 gtk_grid_attach (GTK_GRID (group_grid
), expander
, 1, row
, 1, 1);
1426 group_grid
= gtk_grid_new ();
1427 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1428 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1429 gtk_container_add (GTK_CONTAINER (expander
), group_grid
);
1432 label
= make_label_widget(_("_Symbol:"));
1433 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1434 widget
= make_string_maxlength(label
, 3);
1435 data
->ST_euro_symbol
= widget
;
1436 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1439 widget
= gtk_check_button_new_with_mnemonic (_("Is pre_fix"));
1440 data
->CM_euro_isprefix
= widget
;
1441 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1444 label
= make_label_widget(_("_Decimal char:"));
1445 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1446 widget
= make_string_maxlength(label
, 1);
1447 data
->ST_euro_decimalchar
= widget
;
1448 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1451 label
= make_label_widget(_("_Frac digits:"));
1452 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1453 widget
= make_numeric(label
, 0.0, 6.0);
1454 data
->NB_euro_fracdigits
= widget
;
1455 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1458 label
= make_label_widget(_("_Grouping char:"));
1459 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1460 widget
= make_string_maxlength(label
, 1);
1461 data
->ST_euro_groupingchar
= widget
;
1462 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1464 return content_grid
;
1468 static GtkWidget
*defpref_page_display (struct defpref_data
*data
)
1470 GtkWidget
*content_grid
, *group_grid
, *label
, *widget
, *expander
, *hbox
;
1473 content_grid
= gtk_grid_new();
1474 gtk_grid_set_row_spacing (GTK_GRID (content_grid
), SPACING_LARGE
);
1475 gtk_orientable_set_orientation(GTK_ORIENTABLE(content_grid
), GTK_ORIENTATION_VERTICAL
);
1479 group_grid
= gtk_grid_new ();
1480 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1481 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1482 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1484 label
= make_label_group(_("User interface"));
1485 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1488 label
= make_label(_("_Language:"), 0, 0.5);
1489 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1490 widget
= ui_language_combobox_new(label
);
1491 data
->CY_language
= widget
;
1492 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1496 label
= make_label(_("_Date display:"), 0, 0.5);
1497 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1498 widget
= make_label(NULL
, 0, 0.5);
1499 data
->LB_date
= widget
;
1500 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1503 expander
= gtk_expander_new_with_mnemonic(_("_Customize"));
1504 gtk_grid_attach (GTK_GRID (group_grid
), expander
, 2, row
, 1, 1);
1506 group_grid
= gtk_grid_new ();
1507 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1508 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1509 gtk_container_add (GTK_CONTAINER (expander
), group_grid
);
1512 label
= make_label_widget(_("_Format:"));
1513 //----------------------------------------- l, r, t, b
1514 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1515 widget
= make_string(label
);
1516 data
->ST_datefmt
= widget
;
1517 //gtk_grid_attach (GTK_GRID (group_grid), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1518 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1520 widget
= gtk_image_new_from_icon_name (ICONNAME_INFO
, GTK_ICON_SIZE_BUTTON
);
1521 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 3, row
, 1, 1);
1524 gtk_widget_set_tooltip_text(widget
,
1525 _("%a locale's abbreviated weekday name.\n"
1526 "%A locale's full weekday name. \n"
1527 "%b locale's abbreviated month name. \n"
1528 "%B locale's full month name. \n"
1529 "%c locale's appropriate date and time representation. \n"
1530 "%C century number (the year divided by 100 and truncated to an integer) as a decimal number [00-99]. \n"
1531 "%d day of the month as a decimal number [01,31]. \n"
1532 "%D same as %m/%d/%y. \n"
1533 "%e day of the month as a decimal number [1,31]; a single digit is preceded by a space. \n"
1534 "%j day of the year as a decimal number [001,366]. \n"
1535 "%m month as a decimal number [01,12]. \n"
1536 "%p locale's appropriate date representation. \n"
1537 "%y year without century as a decimal number [00,99]. \n"
1538 "%Y year with century as a decimal number.")
1542 widget
= make_label(NULL
, 0.0, 0.5);
1543 gtk_label_set_markup (GTK_LABEL(widget
), "<small><a href=\"http://man7.org/linux/man-pages/man3/strftime.3.html\">online reference</a></small>");
1544 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1549 // group :: Fiscal year
1550 group_grid
= gtk_grid_new ();
1551 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1552 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1553 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1555 label
= make_label_group(_("Fiscal year"));
1556 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1559 //TRANSLATORS: (fiscal year) starts on
1560 label
= make_label_widget(_("Starts _on:"));
1561 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1563 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, SPACING_SMALL
);
1564 gtk_grid_attach (GTK_GRID (group_grid
), hbox
, 2, row
, 1, 1);
1565 widget
= make_numeric (label
, 1, 28);
1566 data
->NB_fiscyearday
= widget
;
1567 gtk_box_pack_start (GTK_BOX (hbox
), widget
, FALSE
, FALSE
, 0);
1568 widget
= make_cycle (NULL
, CYA_MONTHS
);
1569 data
->CY_fiscyearmonth
= widget
;
1570 gtk_box_pack_start (GTK_BOX (hbox
), widget
, FALSE
, FALSE
, 0);
1574 // group :: Measurement units
1575 group_grid
= gtk_grid_new ();
1576 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1577 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1578 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1580 label
= make_label_group(_("Measurement units"));
1581 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1584 widget
= gtk_check_button_new_with_mnemonic (_("Use _miles for meter"));
1585 data
->CM_unitismile
= widget
;
1586 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 2, 1);
1589 widget
= gtk_check_button_new_with_mnemonic (_("Use _gallon for fuel"));
1590 data
->CM_unitisgal
= widget
;
1591 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 2, 1);
1593 return content_grid
;
1597 static GtkWidget
*defpref_page_transactions (struct defpref_data
*data
)
1599 GtkWidget
*content_grid
, *group_grid
, *label
, *widget
;
1602 content_grid
= gtk_grid_new();
1603 gtk_grid_set_row_spacing (GTK_GRID (content_grid
), SPACING_LARGE
);
1604 gtk_orientable_set_orientation(GTK_ORIENTABLE(content_grid
), GTK_ORIENTATION_VERTICAL
);
1607 // group :: Transaction window
1608 group_grid
= gtk_grid_new ();
1609 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1610 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1611 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1613 label
= make_label_group(_("Transaction window"));
1614 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1617 label
= make_label(_("_Range:"), 0, 0.5);
1618 //----------------------------------------- l, r, t, b
1619 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1620 widget
= make_daterange(label
, FALSE
);
1621 data
->CY_daterange_txn
= widget
;
1622 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1625 label
= make_label(_("_Show future:"), 0, 0.5);
1626 //----------------------------------------- l, r, t, b
1627 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1628 widget
= make_numeric(NULL
, 0, 366);
1630 data
->ST_datefuture_nbdays
= widget
;
1631 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1633 //TRANSLATORS: there is a spinner on the left of this label, and so you have 0....x days in advance the current date
1634 label
= make_label(_("days ahead"), 0, 0.5);
1635 gtk_grid_attach (GTK_GRID (group_grid
), label
, 3, row
, 1, 1);
1638 widget
= gtk_check_button_new_with_mnemonic (_("Hide reconciled transactions"));
1639 data
->CM_hide_reconciled
= widget
;
1640 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 3, 1);
1643 widget
= gtk_check_button_new_with_mnemonic (_("Always show remind transactions"));
1644 data
->CM_show_remind
= widget
;
1645 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 3, 1);
1647 // group :: Multiple add
1648 group_grid
= gtk_grid_new ();
1649 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1650 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1651 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1653 label
= make_label_group(_("Multiple add"));
1654 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1657 widget
= gtk_check_button_new_with_mnemonic (_("Keep the last date"));
1658 data
->CM_herit_date
= widget
;
1659 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 2, 1);
1661 // group :: Memo autocomplete
1662 group_grid
= gtk_grid_new ();
1663 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1664 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1665 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1667 label
= make_label_group(_("Memo autocomplete"));
1668 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1671 widget
= gtk_check_button_new_with_mnemonic (_("Active"));
1672 data
->CM_memoacp
= widget
;
1673 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 2, 1);
1676 widget
= make_numeric(NULL
, 0, 1460);
1677 data
->ST_memoacp_days
= widget
;
1678 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1679 label
= make_label(_("rolling days"), 0, 0.5);
1680 gtk_grid_attach (GTK_GRID (group_grid
), label
, 3, row
, 1, 1);
1682 // group :: Column list
1684 group_grid = gtk_grid_new ();
1685 gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
1686 gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
1687 gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
1689 label = make_label_group(_("Column list"));
1690 gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
1693 sw = gtk_scrolled_window_new (NULL, NULL);
1694 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_ETCHED_IN);
1695 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
1696 widget = (GtkWidget *)list_txn_colprefcreate();
1697 data->LV_opecolumns = widget;
1698 gtk_widget_set_size_request(data->LV_opecolumns, HB_MINWIDTH_LIST, -1);
1699 gtk_container_add (GTK_CONTAINER (sw), widget);
1700 gtk_widget_set_vexpand (sw, TRUE);
1701 gtk_grid_attach (GTK_GRID (group_grid), sw, 1, row, 2, 1);
1702 gtk_widget_set_tooltip_text(widget, _("Drag & drop to change the order"));
1705 return content_grid
;
1710 static GtkWidget
*defpref_page_interface (struct defpref_data
*data
)
1712 GtkWidget
*content_grid
, *group_grid
, *hbox
, *label
, *widget
;
1715 content_grid
= gtk_grid_new();
1716 gtk_grid_set_row_spacing (GTK_GRID (content_grid
), SPACING_LARGE
);
1717 gtk_orientable_set_orientation(GTK_ORIENTABLE(content_grid
), GTK_ORIENTATION_VERTICAL
);
1721 group_grid
= gtk_grid_new ();
1722 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1723 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1724 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1726 label
= make_label_group(_("General"));
1727 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1730 label
= make_label(_("_Toolbar:"), 0, 0.5);
1731 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1732 widget
= make_cycle(label
, CYA_TOOLBAR_STYLE
);
1733 data
->CY_toolbar
= widget
;
1734 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1750 //widget = gtk_check_button_new_with_mnemonic (_("Enable rows in alternating colors"));
1751 //data->CM_ruleshint = widget;
1752 label
= make_label(_("_Grid line:"), 0, 0.5);
1753 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1754 widget
= make_cycle(label
, CYA_GRID_LINES
);
1755 data
->CY_gridlines
= widget
;
1756 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1758 // group :: Amount colors
1759 group_grid
= gtk_grid_new ();
1760 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1761 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1762 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1764 label
= make_label_group(_("Amount colors"));
1765 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1768 widget
= gtk_check_button_new_with_mnemonic (_("Uses custom colors"));
1769 data
->CM_custom_colors
= widget
;
1770 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 2, 1);
1773 label
= make_label(_("_Preset:"), 0, 0.5);
1774 data
->LB_colors
= label
;
1775 //----------------------------------------- l, r, t, b
1776 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1777 widget
= make_cycle(label
, CYA_TANGO_COLORS
);
1778 data
->CY_colors
= widget
;
1779 //gtk_grid_attach (GTK_GRID (group_grid), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1780 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1783 label
= make_label(_("_Expense:"), 0, 0.5);
1784 data
->LB_exp_color
= label
;
1785 //----------------------------------------- l, r, t, b
1786 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1787 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, SPACING_SMALL
);
1788 data
->GR_colors
= hbox
;
1789 gtk_grid_attach (GTK_GRID (group_grid
), hbox
, 2, row
, 1, 1);
1791 widget
= gtk_color_button_new ();
1792 data
->CP_exp_color
= widget
;
1793 gtk_box_pack_start (GTK_BOX (hbox
), widget
, FALSE
, FALSE
, 0);
1795 label
= make_label_widget(_("_Income:"));
1796 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
1798 widget
= gtk_color_button_new ();
1799 data
->CP_inc_color
= widget
;
1800 gtk_box_pack_start (GTK_BOX (hbox
), widget
, FALSE
, FALSE
, 0);
1802 label
= make_label_widget(_("_Warning:"));
1803 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
1805 widget
= gtk_color_button_new ();
1806 data
->CP_warn_color
= widget
;
1807 gtk_box_pack_start (GTK_BOX (hbox
), widget
, FALSE
, FALSE
, 0);
1809 return content_grid
;
1813 static GtkWidget
*defpref_page_filebackup (struct defpref_data
*data
)
1815 GtkWidget
*content_grid
, *group_grid
, *hbox
, *label
, *widget
;
1818 content_grid
= gtk_grid_new();
1819 gtk_grid_set_row_spacing (GTK_GRID (content_grid
), SPACING_LARGE
);
1820 gtk_orientable_set_orientation(GTK_ORIENTABLE(content_grid
), GTK_ORIENTATION_VERTICAL
);
1824 group_grid
= gtk_grid_new ();
1825 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1826 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1827 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1829 label
= make_label_group(_("Backup"));
1830 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1833 widget
= gtk_check_button_new_with_mnemonic (_("_Enable automatic backups"));
1834 data
->CM_bak_is_automatic
= widget
;
1835 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 2, 1);
1838 label
= make_label_widget(_("_Number of backups to keep:"));
1839 data
->LB_bak_max_num_copies
= label
;
1840 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1841 widget
= make_numeric (label
, 1, 99);
1842 data
->NB_bak_max_num_copies
= widget
;
1843 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
1846 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, SPACING_SMALL
);
1847 data
->GR_bak_freq
= hbox
;
1848 //gtk_widget_set_hexpand (hbox, TRUE);
1849 gtk_grid_attach (GTK_GRID (group_grid
), hbox
, 1, row
, 2, 1);
1851 widget
= gtk_image_new_from_icon_name (ICONNAME_INFO
, GTK_ICON_SIZE_BUTTON
);
1852 gtk_box_pack_start (GTK_BOX (hbox
), widget
, FALSE
, FALSE
, 0);
1853 label
= make_label_widget(_("Backup frequency is once a day"));
1854 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
1857 return content_grid
;
1861 static GtkWidget
*defpref_page_folders (struct defpref_data
*data
)
1863 GtkWidget
*content_grid
, *group_grid
, *hbox
, *label
, *widget
;
1866 content_grid
= gtk_grid_new();
1867 gtk_grid_set_row_spacing (GTK_GRID (content_grid
), SPACING_LARGE
);
1868 gtk_orientable_set_orientation(GTK_ORIENTABLE(content_grid
), GTK_ORIENTATION_VERTICAL
);
1871 // group :: Files folder
1872 group_grid
= gtk_grid_new ();
1873 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1874 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1875 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1877 label
= make_label_group(_("HomeBank files"));
1878 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1881 label
= make_label_widget(_("_Wallets:"));
1882 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1884 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 0);
1885 gtk_widget_set_hexpand (hbox
, TRUE
);
1886 gtk_grid_attach (GTK_GRID (group_grid
), hbox
, 2, row
, 1, 1);
1888 widget
= make_string(label
);
1889 data
->ST_path_hbfile
= widget
;
1890 gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET(widget
)), GTK_STYLE_CLASS_LINKED
);
1891 gtk_box_pack_start (GTK_BOX (hbox
), widget
, TRUE
, TRUE
, 0);
1893 //widget = gtk_button_new_with_label("...");
1894 widget
= gtk_button_new_from_icon_name(ICONNAME_FOLDER
, GTK_ICON_SIZE_BUTTON
);
1895 data
->BT_path_hbfile
= widget
;
1896 gtk_box_pack_start (GTK_BOX (hbox
), widget
, FALSE
, FALSE
, 0);
1899 // group :: Files folder
1900 group_grid
= gtk_grid_new ();
1901 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1902 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1903 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1905 label
= make_label_group(_("Exchange files"));
1906 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1909 label
= make_label_widget(_("_Import:"));
1910 //----------------------------------------- l, r, t, b
1911 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1913 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 0);
1914 gtk_widget_set_hexpand (hbox
, TRUE
);
1915 gtk_grid_attach (GTK_GRID (group_grid
), hbox
, 2, row
, 1, 1);
1917 widget
= make_string(label
);
1918 data
->ST_path_import
= widget
;
1919 gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET(widget
)), GTK_STYLE_CLASS_LINKED
);
1920 gtk_box_pack_start (GTK_BOX (hbox
), widget
, TRUE
, TRUE
, 0);
1922 //widget = gtk_button_new_with_label("...");
1923 widget
= gtk_button_new_from_icon_name(ICONNAME_FOLDER
, GTK_ICON_SIZE_BUTTON
);
1924 data
->BT_path_import
= widget
;
1925 gtk_box_pack_start (GTK_BOX (hbox
), widget
, FALSE
, FALSE
, 0);
1928 label
= make_label_widget(_("_Export:"));
1929 //----------------------------------------- l, r, t, b
1930 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
1932 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 0);
1933 gtk_widget_set_hexpand (hbox
, TRUE
);
1934 gtk_grid_attach (GTK_GRID (group_grid
), hbox
, 2, row
, 1, 1);
1936 widget
= make_string(label
);
1937 data
->ST_path_export
= widget
;
1938 gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET(widget
)), GTK_STYLE_CLASS_LINKED
);
1939 gtk_box_pack_start (GTK_BOX (hbox
), widget
, TRUE
, TRUE
, 0);
1941 //widget = gtk_button_new_with_label("...");
1942 widget
= gtk_button_new_from_icon_name(ICONNAME_FOLDER
, GTK_ICON_SIZE_BUTTON
);
1943 data
->BT_path_export
= widget
;
1944 gtk_box_pack_start (GTK_BOX (hbox
), widget
, FALSE
, FALSE
, 0);
1948 return content_grid
;
1952 static GtkWidget
*defpref_page_general (struct defpref_data
*data
)
1954 GtkWidget
*content_grid
, *group_grid
, *label
, *widget
;
1957 content_grid
= gtk_grid_new();
1958 gtk_grid_set_row_spacing (GTK_GRID (content_grid
), SPACING_LARGE
);
1959 gtk_orientable_set_orientation(GTK_ORIENTABLE(content_grid
), GTK_ORIENTATION_VERTICAL
);
1962 // group :: Program start
1963 group_grid
= gtk_grid_new ();
1964 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1965 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1966 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1968 label
= make_label_group(_("Program start"));
1969 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
1972 widget
= gtk_check_button_new_with_mnemonic (_("Show splash screen"));
1973 data
->CM_show_splash
= widget
;
1974 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 2, 1);
1977 widget
= gtk_check_button_new_with_mnemonic (_("Load last opened file"));
1978 data
->CM_load_last
= widget
;
1979 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 2, 1);
1982 widget
= gtk_check_button_new_with_mnemonic (_("Post pending scheduled transactions"));
1983 data
->CM_append_scheduled
= widget
;
1984 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 2, 1);
1987 widget
= gtk_check_button_new_with_mnemonic (_("Update currencies online"));
1988 data
->CM_do_update_currency
= widget
;
1989 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 1, row
, 2, 1);
1992 // group :: Main window reports
1993 group_grid
= gtk_grid_new ();
1994 gtk_grid_set_row_spacing (GTK_GRID (group_grid
), SPACING_SMALL
);
1995 gtk_grid_set_column_spacing (GTK_GRID (group_grid
), SPACING_MEDIUM
);
1996 gtk_grid_attach (GTK_GRID (content_grid
), group_grid
, 0, crow
++, 1, 1);
1998 label
= make_label_group(_("Main window reports"));
1999 gtk_grid_attach (GTK_GRID (group_grid
), label
, 0, 0, 3, 1);
2002 label
= make_label(_("_Range:"), 0, 0.5);
2003 gtk_grid_attach (GTK_GRID (group_grid
), label
, 1, row
, 1, 1);
2004 widget
= make_daterange(label
, FALSE
);
2005 data
->CY_daterange_wal
= widget
;
2006 gtk_grid_attach (GTK_GRID (group_grid
), widget
, 2, row
, 1, 1);
2008 return content_grid
;
2012 static void defpref_selection(GtkTreeSelection
*treeselection
, gpointer user_data
)
2014 struct defpref_data
*data
;
2015 GtkWidget
*notebook
;
2016 GtkTreeView
*treeview
;
2017 GtkTreeModel
*model
;
2020 GValue val
= { 0, };
2023 DB( g_print("\n[ui-pref] selection\n") );
2025 if (gtk_tree_selection_get_selected(treeselection
, &model
, &iter
))
2027 notebook
= GTK_WIDGET(user_data
);
2028 treeview
= gtk_tree_selection_get_tree_view(treeselection
);
2029 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(GTK_WIDGET(treeview
), GTK_TYPE_WINDOW
)), "inst_data");
2032 gtk_tree_model_get_value(model
, &iter
, LST_PREF_PAGE
, &val
);
2033 page
= g_value_get_int (&val
);
2034 DB( g_print(" - active is %d\n", page
) );
2035 g_value_unset (&val
);
2038 gtk_tree_model_get_value(model
, &iter
, LST_PREF_NAME
, &val
);
2039 gtk_label_set_text (GTK_LABEL (data
->label
), g_value_get_string (&val
));
2040 g_value_unset (&val
);
2042 gtk_tree_model_get_value(model
, &iter
, LST_PREF_ICONNAME
, &val
);
2043 //gtk_image_set_from_pixbuf (GTK_IMAGE (data->image), g_value_get_object (&val));
2044 gtk_image_set_from_icon_name(GTK_IMAGE (data
->image
), g_value_get_string (&val
), GTK_ICON_SIZE_DIALOG
);
2045 g_value_unset (&val
);
2049 gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook
), page
);
2051 //defpref_change_page(GTK_WIDGET(gtk_tree_selection_get_tree_view(treeselection)), GINT_TO_POINTER(page));
2058 ** set the notebook active page from treeview
2060 /*void defpref_change_page(GtkWidget *widget, gpointer user_data)
2062 struct defpref_data *data;
2063 gint page = GPOINTER_TO_INT(user_data);
2064 GtkTreeModel *model;
2067 DB( g_print("\n[ui-pref] page\n") );
2069 data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
2071 model = gtk_tree_view_get_model(GTK_TREE_VIEW(data->LV_page));
2079 gtk_notebook_set_current_page(GTK_NOTEBOOK(data->GR_page), page);
2085 ** add an empty new account to our temp GList and treeview
2087 static void defpref_reset(GtkWidget
*widget
, gpointer user_data
)
2089 struct defpref_data
*data
;
2092 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), "inst_data");
2093 DB( g_print("\n(defpref_reset) (data=%p)\n", data
) );
2095 result
= ui_dialog_msg_confirm_alert(
2096 GTK_WINDOW(data
->window
),
2097 _("Reset All Preferences"),
2098 _("Do you really want to reset\nall preferences to default\nvalues?"),
2101 if( result
== GTK_RESPONSE_OK
)
2103 homebank_pref_setdefault();
2110 // the window creation
2111 GtkWidget
*defpref_dialog_new (void)
2113 struct defpref_data data
;
2114 GtkWidget
*window
, *content
, *mainvbox
;
2115 GtkWidget
*hbox
, *vbox
, *sw
, *widget
, *notebook
, *page
, *ebox
, *image
, *label
;
2117 window
= gtk_dialog_new_with_buttons (_("Preferences"),
2118 GTK_WINDOW(GLOBALS
->mainwindow
),
2123 GTK_RESPONSE_REJECT
,
2125 GTK_RESPONSE_ACCEPT
,
2128 data
.window
= window
;
2130 //store our window private data
2131 g_object_set_data(G_OBJECT(window
), "inst_data", (gpointer
)&data
);
2133 gtk_window_set_icon_name(GTK_WINDOW (window
), ICONNAME_PREFERENCES
);
2135 content
= gtk_dialog_get_content_area(GTK_DIALOG (window
)); // return a vbox
2136 mainvbox
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, SPACING_MEDIUM
);
2137 gtk_box_pack_start (GTK_BOX (content
), mainvbox
, TRUE
, TRUE
, 0);
2139 gtk_container_set_border_width(GTK_CONTAINER(mainvbox
), SPACING_MEDIUM
);
2141 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, SPACING_MEDIUM
);
2142 gtk_box_pack_start (GTK_BOX (mainvbox
), hbox
, TRUE
, TRUE
, 0);
2145 vbox
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, SPACING_SMALL
);
2146 gtk_box_pack_start (GTK_BOX (hbox
), vbox
, FALSE
, FALSE
, 0);
2149 sw
= gtk_scrolled_window_new (NULL
, NULL
);
2150 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw
), GTK_SHADOW_ETCHED_IN
);
2151 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw
), GTK_POLICY_NEVER
, GTK_POLICY_AUTOMATIC
);
2152 gtk_box_pack_start (GTK_BOX (vbox
), sw
, TRUE
, TRUE
, 0);
2153 widget
= pref_list_create();
2154 data
.LV_page
= widget
;
2155 gtk_container_add (GTK_CONTAINER (sw
), widget
);
2158 //right part : notebook
2159 vbox
= gtk_box_new (GTK_ORIENTATION_VERTICAL
, SPACING_MEDIUM
);
2160 gtk_box_pack_start (GTK_BOX (hbox
), vbox
, TRUE
, TRUE
, 0);
2161 gtk_widget_show (vbox
);
2163 ebox
= gtk_event_box_new();
2164 gtk_widget_set_name(ebox
, "hbebox");
2165 GtkStyleContext
*context
= gtk_widget_get_style_context (ebox
);
2166 #if GTK_MINOR_VERSION <= 18
2167 gtk_style_context_add_class (context
, GTK_STYLE_CLASS_LIST_ROW
);
2168 gtk_widget_set_state_flags(ebox
, GTK_STATE_FLAG_SELECTED
, TRUE
);
2170 GtkCssProvider
*provider
;
2171 provider
= gtk_css_provider_new ();
2172 gtk_css_provider_load_from_data (provider
,
2173 "#hbebox { color: @theme_selected_fg_color; background-color: @theme_selected_bg_color; }"
2175 gtk_style_context_add_provider (context
, GTK_STYLE_PROVIDER(provider
), G_MAXUINT
);
2177 // gtk_style_context_set_state(context, GTK_STATE_FLAG_SELECTED);
2180 gtk_box_pack_start (GTK_BOX (vbox
), ebox
, FALSE
, TRUE
, 0);
2181 gtk_widget_show (ebox
);
2183 hbox
= gtk_box_new (GTK_ORIENTATION_HORIZONTAL
, SPACING_SMALL
);
2184 gtk_container_set_border_width (GTK_CONTAINER (hbox
), SPACING_SMALL
);
2185 gtk_container_add (GTK_CONTAINER (ebox
), hbox
);
2186 gtk_widget_show (hbox
);
2188 label
= gtk_label_new (NULL
);
2189 gtk_widget_set_margin_left(label
, SPACING_MEDIUM
);
2190 gimp_label_set_attributes (GTK_LABEL (label
),
2191 PANGO_ATTR_SCALE
, PANGO_SCALE_XX_LARGE
,
2192 PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
,
2195 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
2196 gtk_widget_show (label
);
2199 image
= gtk_image_new ();
2200 gtk_box_pack_end (GTK_BOX (hbox
), image
, FALSE
, FALSE
, 0);
2201 gtk_widget_show (image
);
2207 notebook
= gtk_notebook_new();
2208 data
.GR_page
= notebook
;
2209 gtk_widget_show(notebook
);
2210 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook
), FALSE
);
2211 gtk_notebook_set_show_border(GTK_NOTEBOOK(notebook
), FALSE
);
2212 gtk_box_pack_start (GTK_BOX (vbox
), notebook
, TRUE
, TRUE
, 0);
2217 PREF_LOCALE, //old DISPLAY
2218 PREF_TXN, //old COLUMNS
2228 page
= defpref_page_general(&data
);
2229 gtk_notebook_append_page (GTK_NOTEBOOK (notebook
), page
, NULL
);
2232 page
= defpref_page_interface(&data
);
2233 gtk_notebook_append_page (GTK_NOTEBOOK (notebook
), page
, NULL
);
2236 page
= defpref_page_display(&data
);
2237 gtk_notebook_append_page (GTK_NOTEBOOK (notebook
), page
, NULL
);
2240 page
= defpref_page_transactions(&data
);
2241 gtk_notebook_append_page (GTK_NOTEBOOK (notebook
), page
, NULL
);
2244 page
= defpref_page_import(&data
);
2245 gtk_notebook_append_page (GTK_NOTEBOOK (notebook
), page
, NULL
);
2248 page
= defpref_page_reports(&data
);
2249 gtk_notebook_append_page (GTK_NOTEBOOK (notebook
), page
, NULL
);
2252 page
= defpref_page_filebackup(&data
);
2253 gtk_notebook_append_page (GTK_NOTEBOOK (notebook
), page
, NULL
);
2256 page
= defpref_page_folders(&data
);
2257 gtk_notebook_append_page (GTK_NOTEBOOK (notebook
), page
, NULL
);
2260 page
= defpref_page_euro(&data
);
2261 gtk_notebook_append_page (GTK_NOTEBOOK (notebook
), page
, NULL
);
2264 //todo:should move this
2265 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
.CM_euro_enable
), PREFS
->euro_active
);
2267 //connect all our signals
2268 g_signal_connect (window
, "destroy", G_CALLBACK (gtk_widget_destroyed
), &window
);
2270 g_signal_connect (data
.CM_bak_is_automatic
, "toggled", G_CALLBACK (defpref_backuptoggle
), NULL
);
2274 g_signal_connect (data
.BT_path_hbfile
, "pressed", G_CALLBACK (defpref_pathselect
), GINT_TO_POINTER(PRF_PATH_WALLET
));
2275 g_signal_connect (data
.BT_path_import
, "pressed", G_CALLBACK (defpref_pathselect
), GINT_TO_POINTER(PRF_PATH_IMPORT
));
2276 g_signal_connect (data
.BT_path_export
, "pressed", G_CALLBACK (defpref_pathselect
), GINT_TO_POINTER(PRF_PATH_EXPORT
));
2278 g_signal_connect (data
.CM_custom_colors
, "toggled", G_CALLBACK (defpref_colortoggle
), NULL
);
2279 g_signal_connect (data
.CY_colors
, "changed", G_CALLBACK (defpref_colorpreset
), NULL
);
2283 g_signal_connect (gtk_tree_view_get_selection(GTK_TREE_VIEW(data
.LV_page
)), "changed", G_CALLBACK (defpref_selection
), notebook
);
2285 g_signal_connect (data
.CM_euro_enable
, "toggled", G_CALLBACK (defpref_eurotoggle
), NULL
);
2287 g_signal_connect (data
.CY_euro_preset
, "changed", G_CALLBACK (defpref_europreset
), NULL
);
2290 g_signal_connect (data
.ST_datefmt
, "changed", G_CALLBACK (defpref_date_sample
), NULL
);
2293 g_signal_connect (data
.CY_color_scheme
, "changed", G_CALLBACK (defpref_color_scheme_changed
), NULL
);
2297 g_signal_connect (data
.ST_euro_symbol
, "changed", G_CALLBACK (defpref_numbereuro_sample
), NULL
);
2298 g_signal_connect (data
.CM_euro_isprefix
, "toggled", G_CALLBACK (defpref_numbereuro_sample
), NULL
);
2299 g_signal_connect (data
.ST_euro_decimalchar
, "changed", G_CALLBACK (defpref_numbereuro_sample
), NULL
);
2300 g_signal_connect (data
.ST_euro_groupingchar
, "changed", G_CALLBACK (defpref_numbereuro_sample
), NULL
);
2301 g_signal_connect (data
.NB_euro_fracdigits
, "value-changed", G_CALLBACK (defpref_numbereuro_sample
), NULL
);
2303 //g_signal_connect (data.BT_default, "pressed", G_CALLBACK (defpref_currency_change), NULL);
2306 //setup, init and show window
2307 //defhbfile_setup(&data);
2308 //defhbfile_update(data.LV_arc, NULL);
2312 defpref_colortoggle(window
, NULL
);
2313 defpref_eurotoggle(window
, NULL
);
2315 gtk_window_resize(GTK_WINDOW(window
), 640, 256);
2319 GtkTreePath
*path
= gtk_tree_path_new_first ();
2321 gtk_tree_selection_select_path (gtk_tree_view_get_selection(GTK_TREE_VIEW(data
.LV_page
)), path
);
2325 gtk_tree_path_free(path
);
2327 gtk_widget_show_all (window
);
2334 result
= gtk_dialog_run (GTK_DIALOG (window
));
2338 case GTK_RESPONSE_ACCEPT
:
2339 old_lang
= g_strdup(PREFS
->language
);
2341 homebank_pref_save();
2342 ui_mainwindow_update(GLOBALS
->mainwindow
, GINT_TO_POINTER(UF_BALANCE
+UF_VISUAL
));
2344 DB( g_print("old='%s' new='%s'\n", old_lang
, PREFS
->language
) );
2346 if(g_ascii_strncasecmp(old_lang
== NULL
? "" : old_lang
, PREFS
->language
== NULL
? "" : PREFS
->language
, -1) != 0)
2348 ui_dialog_msg_infoerror(GTK_WINDOW(window
), GTK_MESSAGE_INFO
,
2350 _("You will have to restart HomeBank\nfor the language change to take effect.")
2359 defpref_reset (window
, NULL
);
2364 // cleanup and destroy
2365 //defhbfile_cleanup(&data, result);
2366 gtk_widget_destroy (window
);
2371 // -------------------------------
2374 static GtkWidget
*pref_list_create(void)
2376 GtkListStore
*store
;
2378 GtkCellRenderer
*renderer
;
2379 GtkTreeViewColumn
*column
;
2383 /* create list store */
2384 store
= gtk_list_store_new(
2392 view
= gtk_tree_view_new_with_model(GTK_TREE_MODEL(store
));
2393 g_object_unref(store
);
2395 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW (view
), FALSE
);
2396 gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(view
)), GTK_SELECTION_SINGLE
);
2398 /* column 1: icon */
2399 column
= gtk_tree_view_column_new();
2400 renderer
= gtk_cell_renderer_pixbuf_new ();
2401 g_object_set(renderer
, "stock-size", GTK_ICON_SIZE_DND
, NULL
);
2402 gtk_tree_view_column_pack_start(column
, renderer
, FALSE
);
2403 gtk_tree_view_column_set_attributes(column
, renderer
, "icon-name", LST_PREF_ICONNAME
, NULL
);
2405 renderer
= gtk_cell_renderer_text_new ();
2406 gtk_tree_view_column_pack_start(column
, renderer
, TRUE
);
2407 gtk_tree_view_column_set_attributes(column
, renderer
, "text", LST_PREF_NAME
, NULL
);
2409 gtk_tree_view_append_column (GTK_TREE_VIEW(view
), column
);
2411 //populate our combobox model
2412 for(i
=0;i
<PREF_MAX
;i
++)
2414 gtk_list_store_append(store
, &iter
);
2416 gtk_list_store_set(store
, &iter
,
2417 LST_PREF_ICONNAME
, pref_iconname
[i
],
2418 LST_PREF_NAME
, _(pref_name
[i
]),
2427 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
2430 extern gchar *list_txn_column_label[];
2434 list_txn_colpref_toggled_cell_data_function (GtkCellRendererToggle *cell,
2438 GtkTreeModel *model = (GtkTreeModel *)data;
2440 GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
2444 gtk_tree_model_get_iter (model, &iter, path);
2445 gtk_tree_model_get (model, &iter, COLUMN_VISIBLE, &fixed, -1);
2447 // do something with the value
2451 gtk_list_store_set (GTK_LIST_STORE (model), &iter, COLUMN_VISIBLE, fixed, -1);
2454 gtk_tree_path_free (path);
2458 static void list_txn_colpref_get(GtkTreeView *treeview, gint *columns)
2460 GtkTreeModel *model;
2466 DB( g_print("[lst_txn-colpref] store column order \n") );
2468 model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
2469 valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter);
2473 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter,
2474 COLUMN_VISIBLE, &visible,
2478 DB( g_print(" - column %d: %d\n",id, visible) );
2479 // start at index 2 (status, date always displayed
2480 columns[i+2] = visible == TRUE ? id : -id;
2482 // Make iter point to the next row in the list store
2483 valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter);
2489 GtkWidget *list_txn_colprefcreate(void)
2491 GtkListStore *store;
2493 GtkCellRenderer *renderer;
2494 GtkTreeViewColumn *column;
2498 DB( g_print("[lst_txn-colpref] create\n") );
2501 // create list store
2502 store = gtk_list_store_new(
2510 for(i=0 ; i < NUM_LST_DSPOPE-1; i++ ) //-1 cause account column avoid
2515 DB( g_print("eval %d, %s\n", i, list_txn_column_label[i]) );
2517 if(i <= LST_DSPOPE_DATE) // status, date always displayed
2520 //[i-1] here because lst_ope_columns[] do not store LST_DSPOPE_DATAS
2521 id = ABS(PREFS->lst_ope_columns[i-1]);
2522 if(id == 0) id = i; //if we pass here, new column or weird into pref file
2523 visible = (PREFS->lst_ope_columns[i-1] > 0) ? TRUE : FALSE;
2526 DB( g_print(" - pos=%2d, id=%2d - %d '%s'\n", i, id, visible, list_txn_column_label[id]) );
2528 gtk_list_store_append (store, &iter);
2529 gtk_list_store_set (store, &iter,
2530 COLUMN_VISIBLE, visible,
2531 COLUMN_NAME, _(list_txn_column_label[id]),
2538 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
2539 g_object_unref(store);
2543 renderer = gtk_cell_renderer_toggle_new ();
2544 column = gtk_tree_view_column_new_with_attributes (_("Visible"),
2546 "active", COLUMN_VISIBLE,
2548 gtk_tree_view_append_column (GTK_TREE_VIEW(view), column);
2550 g_signal_connect (renderer, "toggled",
2551 G_CALLBACK (list_txn_colpref_toggled_cell_data_function), store);
2554 renderer = gtk_cell_renderer_text_new ();
2555 column = gtk_tree_view_column_new_with_attributes (_("Column"),
2557 "text", COLUMN_NAME,
2559 gtk_tree_view_append_column (GTK_TREE_VIEW(view), column);
2561 gtk_tree_view_set_reorderable (GTK_TREE_VIEW(view), TRUE);