1 /* HomeBank -- Free, easy, personal accounting for everyone.
2 * Copyright (C) 1995-2014 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"
29 /****************************************************************************/
31 /****************************************************************************/
40 /* our global datas */
41 extern struct HomeBank
*GLOBALS
;
42 extern struct Preferences
*PREFS
;
63 EXT_COLUMN_ENABLED
= 0,
66 EXT_COLUMN_PLUGIN_NAME
,
70 GdkPixbuf
*pref_pixbuf
[PREF_MAX
];
73 static gchar
*pref_pixname
[PREF_MAX
] = {
80 "prf-euro", // to be renamed
85 static gchar
*pref_name
[PREF_MAX
] = {
97 static gchar
*CYA_TOOLBAR_STYLE
[] = {
98 N_("System defaults"),
101 N_("Text under icons"),
102 N_("Text beside icons"),
106 gchar
*CYA_TANGO_COLORS
[] = {
114 gchar
*CYA_IMPORT_DATEORDER
[] = {
121 gchar
*CYA_IMPORT_OFXNAME
[] = {
127 gchar
*CYA_IMPORT_OFXMEMO
[] = {
129 N_("Append to Info"),
130 N_("Append to Memo"),
135 extern gchar
*CYA_CHART_COLORSCHEME
[];
136 extern gchar
*CYA_MONTHS
[];
143 //gchar *prefix_symbol; /* max symbol is 3 digits in unicode */
144 //gchar *suffix_symbol; /* but mostly is 1 digit */
148 gchar
*grouping_char
;
155 http://en.wikipedia.org/wiki/Currencies_of_the_European_Union
156 http://www.xe.com/euro.php
157 http://fr.wikipedia.org/wiki/Liste_des_unit%C3%A9s_mon%C3%A9taires_remplac%C3%A9es_par_l%27euro
158 http://www.inter-locale.com/LocalesDemo.jsp
160 static EuroParams euro_params
[] =
162 // , rate , symb , prfx , dec, grp, frac
163 // ---------------------------------------------------------------------
164 { "" , "--------" , 1.0 , "" , FALSE
, ",", ".", 2 },
165 { "ATS", "Austria" , 13.7603 , "S" , TRUE
, ",", ".", 2 }, // -S 1.234.567,89
166 { "BEF", "Belgium" , 40.3399 , "BF" , TRUE
, ",", ".", 2 }, // BF 1.234.567,89 -
167 { "FIM", "Finland" , 5.94573 , "mk" , FALSE
, ",", " ", 2 }, // -1 234 567,89 mk
168 { "FRF", "France" , 6.55957 , "F" , FALSE
, ",", " ", 2 }, // -1 234 567,89 F
169 { "DEM", "Germany" , 1.95583 , "DM" , FALSE
, ",", ".", 2 }, // -1.234.567,89 DM
170 { "GRD", "Greece" , 340.750 , "d" , TRUE
, ".", ",", 2 }, // ??
171 { "IEP", "Ireland" , 0.787564 , "£" , TRUE
, ".", ",", 2 }, // -£1,234,567.89
172 { "ITL", "Italy" , 1936.27 , "L" , TRUE
, "" , ".", 0 }, // L -1.234.567
173 { "LUF", "Luxembourg" , 40.3399 , "LU" , TRUE
, ",", ".", 2 }, // LU 1.234.567,89 -
174 { "NLG", "Netherlands" , 2.20371 , "F" , TRUE
, ",", ".", 2 }, // F 1.234.567,89-
175 { "PTE", "Portugal" , 200.482 , "Esc.", FALSE
, "$", ".", 2 }, // -1.234.567$89 Esc.
176 { "ESP", "Spain" , 166.386 , "Pts" , TRUE
, "" , ".", 0 }, // -Pts 1.234.567
178 { "SIT", "Slovenia" , 239.640 , "tol" , TRUE
, ",", ".", 2 }, //
180 { "CYP", "Cyprus" , 0.585274 , "" , TRUE
, ",", "" , 2 }, //
181 { "MTL", "Malta" , 0.429300 , "" , TRUE
, ",", "" , 2 }, //
183 { "SKK", "Slovaquia" , 30.12600 , "Sk" , FALSE
, ",", " ", 2 }, //
185 { "EEK", "Estonia" , 15.6466 , "kr" , FALSE
, ",", " ", 2 }, //
187 { "LVL", "Latvia" , 0.702804 , "lat.", FALSE
, ",", "" , 2 }, // 2014 target for euro earliest
190 { "CZK", "Czech republic", 28.36 , "Kč" , FALSE
, ",", " ", 2 }, // non-fixé - 2015 earliest
191 { "HUF", "Hungary" , 261.51 , "Ft" , TRUE
, ",", " ", 2 }, // non-fixé - No current target for euro
192 { "LTL", "Lithuania" , 3.45280 , "Lt." , TRUE
, ",", "" , 2 }, // 2014 target for euro earliest
193 { "PLN", "Poland" , 0.25 , "zł" , FALSE
, ",", "" , 2 }, // non-fixé - No current target for euro
194 { "BGN", "Bulgaria" , 1.95583 , "лв." , TRUE
, ",", " ", 2 }, // non-fixé - 2014 target for euro
195 { "RON", "Romania" , 3.5155 , "Leu" , FALSE
, ",", ".", 2 }, // non-fixé - 2015 target for euro earliest
196 { "HRK", "Croatia" , 1.0000 , "kn" , FALSE
, "" , ".", 0 }, // non-fixé - 2015 target for euro earliest
198 // { " ", "" , 1.00000 , "" , "" , FALSE, ",", "", 2 },
203 GtkWidget
*pref_list_create(void);
204 GtkWidget
*list_txn_colprefcreate(void);
206 static void list_txn_colpref_get(GtkTreeView
*treeview
, gboolean
*columns
);
208 static void list_ext_colpref_get(GtkTreeView
*treeview
, GList
**columns
);
213 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
221 static LangName languagenames
[] =
223 // 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
224 //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
227 { "ab", "Abkhazian" },
229 { "af", "Afrikaans" },
232 { "an", "Aragonese" },
234 { "as", "Assamese" },
235 { "ast", "Asturian, Bable, Leonese, Asturleonese" },
238 { "az", "Azerbaijani" },
240 { "be", "Belarusian" },
241 { "bg", "Bulgarian" },
251 { "ch", "Chamorro" },
252 { "co", "Corsican" },
255 { "cu", "Old Church Slavonic" },
261 { "dz", "Dzongkha" },
265 { "eo", "Esperanto" },
267 { "et", "Estonian" },
275 { "fy", "Western Frisian" },
277 { "gd", "Scottish Gaelic" },
278 { "gl", "Galician" },
280 { "gu", "Gujarati" },
285 { "ho", "Hiri Motu" },
286 { "hr", "Croatian" },
288 { "hu", "Hungarian" },
289 { "hy", "Armenian" },
291 { "ia", "Interlingua" },
292 { "id", "Indonesian" },
293 { "ie", "Interlingue" },
295 { "ii", "Sichuan Yi" },
298 { "is", "Icelandic" },
300 { "iu", "Inuktitut" },
301 { "ja", "Japanese" },
302 { "jv", "Javanese" },
303 { "ka", "Georgian" },
306 { "kj", "Kwanyama" },
308 { "kl", "Kalaallisut" },
313 { "ks", "Kashmiri" },
319 { "lb", "Luxembourgish" },
321 { "li", "Limburgish" },
324 { "lt", "Lithuanian" },
325 { "lu", "Luba-Katanga" },
327 { "mg", "Malagasy" },
328 { "mh", "Marshallese" },
330 { "mk", "Macedonian" },
331 { "ml", "Malayalam" },
332 { "mn", "Mongolian" },
333 { "mo", "Moldavian" },
339 { "nb", "Norwegian Bokmål" },
340 { "nd", "North Ndebele" },
341 { "nds", "Low German, Low Saxon" },
345 { "nn", "Norwegian Nynorsk" },
346 { "no", "Norwegian" },
347 { "nr", "South Ndebele" },
349 { "ny", "Chichewa" },
354 { "os", "Ossetian" },
359 { "pt", "Portuguese" },
363 { "ro", "Romanian" },
365 { "rw", "Kinyarwanda" },
366 { "sa", "Sanskrit" },
367 { "sc", "Sardinian" },
369 { "se", "Northern Sami" },
371 { "si", "Sinhalese" },
377 { "sq", "Albanian" },
381 { "su", "Sundanese" },
388 { "ti", "Tigrinya" },
397 { "ty", "Tahitian" },
399 { "uk", "Ukrainian" },
403 { "vi", "Viêt Namese" },
418 ui_language_combobox_compare_func (GtkTreeModel
*model
, GtkTreeIter
*a
, GtkTreeIter
*b
, gpointer userdata
)
421 gchar
*code1
, *code2
;
422 gchar
*name1
, *name2
;
424 gtk_tree_model_get(model
, a
, 0, &code1
, 1, &name1
, -1);
425 gtk_tree_model_get(model
, b
, 0, &code2
, 1, &name2
, -1);
427 //keep system laguage on top
428 if(code1
== NULL
) name1
= NULL
;
429 if(code2
== NULL
) name2
= NULL
;
431 retval
= hb_string_utf8_compare(name1
, name2
);
440 static gchar
*languagename_get(const gchar
*locale
)
444 for (i
= 0; i
< G_N_ELEMENTS (languagenames
); i
++)
446 if( g_ascii_strncasecmp(locale
, languagenames
[i
].locale
, -1) == 0 )
447 return languagenames
[i
].name
;
455 ui_language_combobox_get_name(const gchar
*locale
)
459 DB( g_print("[ui_language_combobox_get_name]\n") );
461 // A locale directory name is typically of the form language[_territory]
462 lang
= languagename_get (locale
);
465 const gchar
*delimiter
= strchr (locale
, '_'); // strip off the territory suffix
469 gchar
*copy
= g_strndup (locale
, delimiter
- locale
);
470 lang
= languagename_get (copy
);
476 g_warning(" locale name not found '%s'", locale
);
487 ui_language_combobox_populate(GtkWidget
*combobox
)
492 model
= gtk_combo_box_get_model(GTK_COMBO_BOX(combobox
));
493 gtk_list_store_append (GTK_LIST_STORE(model
), &iter
);
494 gtk_list_store_set (GTK_LIST_STORE(model
), &iter
,
496 1, _("System Language"),
499 GDir
*dir
= g_dir_open (homebank_app_get_locale_dir (), 0, NULL
);
500 const gchar
*dirname
;
505 while ((dirname
= g_dir_read_name (dir
)) != NULL
)
507 gchar
*filename
= g_build_filename (homebank_app_get_locale_dir (),
510 GETTEXT_PACKAGE
".mo",
512 //DB( g_print("- seek for '%s'\n", filename) );
513 if (g_file_test (filename
, G_FILE_TEST_EXISTS
))
518 gtk_list_store_append (GTK_LIST_STORE(model
), &iter
);
520 lang
= ui_language_combobox_get_name(dirname
);
521 label
= g_strdup_printf ("%s [%s]", lang
, dirname
);
523 gtk_list_store_set (GTK_LIST_STORE(model
), &iter
,
535 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model
), GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID
, GTK_SORT_ASCENDING
);
540 static gchar
*ui_language_combobox_get_active_id(GtkComboBox
*combobox
)
546 if( gtk_combo_box_get_active_iter(GTK_COMBO_BOX(combobox
), &iter
) )
548 model
= gtk_combo_box_get_model(GTK_COMBO_BOX(combobox
));
549 gtk_tree_model_get (GTK_TREE_MODEL(model
), &iter
,
558 static gint
ui_language_combobox_set_active_id(GtkComboBox
*combobox
, gchar
*id
)
566 model
= gtk_combo_box_get_model(GTK_COMBO_BOX(combobox
));
567 valid
= gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model
), &iter
);
571 gtk_tree_model_get(GTK_TREE_MODEL(model
), &iter
,
577 if( g_ascii_strncasecmp(id
, tmp_id
, -1) == 0 )
579 gtk_combo_box_set_active_iter(combobox
, &iter
);
584 valid
= gtk_tree_model_iter_next(GTK_TREE_MODEL(model
), &iter
);
593 ui_language_combobox_new(GtkWidget
*label
)
597 GtkCellRenderer
*renderer
;
599 store
= gtk_list_store_new (2,
603 gtk_tree_sortable_set_default_sort_func(GTK_TREE_SORTABLE(store
), ui_language_combobox_compare_func
, NULL
, NULL
);
605 combobox
= gtk_combo_box_new_with_model(GTK_TREE_MODEL(store
));
606 renderer
= gtk_cell_renderer_text_new ();
607 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox
), renderer
, TRUE
);
608 gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox
), renderer
, "text", 1, NULL
);
610 g_object_unref(store
);
613 gtk_label_set_mnemonic_widget (GTK_LABEL(label
), combobox
);
615 //gtk_widget_set_size_request(comboboxentry, HB_MINWIDTH_COMBO, -1);
616 ui_language_combobox_populate(combobox
);
618 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox
), 0);
624 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
625 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
626 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
635 static GtkWidget
*make_euro_presets(GtkWidget
*label
)
640 DB( g_print("\n[ui-pref] make euro preset\n") );
642 combobox
= gtk_combo_box_text_new();
643 for (i
= 0; i
< G_N_ELEMENTS (euro_params
); i
++)
645 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combobox
), euro_params
[i
].name
);
647 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox
), 0);
650 gtk_label_set_mnemonic_widget (GTK_LABEL(label
), combobox
);
656 static defpref_currency_display(GtkWidget *widget, gpointer user_data)
658 struct defpref_data *data;
659 struct iso4217format *curfmt;
661 DB( g_print("\n[ui-pref] display default currency\n") );
663 data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
665 curfmt = iso4217format_get(PREFS->curr_default);
668 gchar *name = g_strdup_printf("%s (%s)", curfmt->curr_iso_code, iso4217_get_name(curfmt->curr_iso_code));
670 gtk_label_set_label (data->LB_default, name);
677 static void defpref_currency_change(GtkWidget *widget, gpointer user_data)
679 struct defpref_data *data;
680 struct iso4217format *curfmt;
682 DB( g_print("\n[ui-pref] chnage default currency\n") );
684 data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
686 curfmt = ui_cur_select_dialog_new(data->window);
688 DB( g_print("(cur) return %s\n", curfmt) );
692 g_free(PREFS->curr_default);
693 PREFS->curr_default = g_strdup(curfmt->culture);
695 defpref_currency_display(widget, NULL);
703 static void defpref_pathselect(GtkWidget
*widget
, gpointer user_data
)
705 struct defpref_data
*data
;
706 gint type
= GPOINTER_TO_INT(user_data
);
712 DB( g_print("\n[ui-pref] path select\n") );
714 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), "inst_data");
719 path
= &PREFS
->path_hbfile
;
720 entry
= data
->ST_path_hbfile
;
721 title
= _("Choose a default HomeBank files folder");
724 path
= &PREFS
->path_import
;
725 entry
= data
->ST_path_import
;
726 title
= _("Choose a default import folder");
729 path
= &PREFS
->path_export
;
730 entry
= data
->ST_path_export
;
731 title
= _("Choose a default export folder");
737 DB( g_print(" - hbfile %p %s at %p\n" , PREFS
->path_hbfile
, PREFS
->path_hbfile
, &PREFS
->path_hbfile
) );
738 DB( g_print(" - import %p %s at %p\n" , PREFS
->path_import
, PREFS
->path_import
, &PREFS
->path_import
) );
739 DB( g_print(" - export %p %s at %p\n" , PREFS
->path_export
, PREFS
->path_export
, &PREFS
->path_export
) );
742 DB( g_print(" - before: %s %p\n" , *path
, path
) );
744 r
= ui_file_chooser_folder(GTK_WINDOW(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), title
, path
);
747 DB( g_print(" - after: %s\n", *path
) );
750 gtk_entry_set_text(GTK_ENTRY(entry
), *path
);
757 ** update the date sample label
759 static void defpref_date_sample(GtkWidget
*widget
, gpointer user_data
)
761 struct defpref_data
*data
;
766 DB( g_print("\n[ui-pref] date sample\n") );
768 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), "inst_data");
770 fmt
= gtk_entry_get_text(GTK_ENTRY(data
->ST_datefmt
));
771 date
= g_date_new_julian (GLOBALS
->today
);
772 g_date_strftime (buffer
, 256-1, fmt
, date
);
775 gtk_label_set_text(GTK_LABEL(data
->LB_date
), buffer
);
782 ** update the number sample label
784 static void defpref_numberbase_sample(GtkWidget
*widget
, gpointer user_data
)
786 struct defpref_data
*data
;
787 struct CurrencyFmt cur
;
788 gchar formatd_buf
[G_ASCII_DTOSTR_BUF_SIZE
];
789 gchar buf
[128], *ptr
;
791 DB( g_print("\n[ui-pref] number sample\n") );
793 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), "inst_data");
795 cur
.symbol
= (gchar
*)gtk_entry_get_text(GTK_ENTRY(data
->ST_num_symbol
));
796 cur
.is_prefix
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_num_isprefix
));
797 cur
.decimal_char
= (gchar
*)gtk_entry_get_text(GTK_ENTRY(data
->ST_num_decimalchar
));
798 cur
.grouping_char
= (gchar
*)gtk_entry_get_text(GTK_ENTRY(data
->ST_num_groupingchar
));
799 cur
.frac_digits
= gtk_spin_button_get_value(GTK_SPIN_BUTTON(data
->NB_num_fracdigits
));
800 g_snprintf(cur
.format
, 8-1, "%%.%df", cur
.frac_digits
);
805 ptr
= g_stpcpy(ptr
, cur
.symbol
);
806 ptr
= g_stpcpy(ptr
, " ");
808 ptr
= g_stpcpy(ptr
, "%s");
811 ptr
= g_stpcpy(ptr
, " ");
812 ptr
= g_stpcpy(ptr
, cur
.symbol
);
815 DB( g_print("fmt: %s\n", cur
.format
) );
816 DB( g_print("monfmt: %s\n", cur
.monfmt
) );
818 g_ascii_formatd(formatd_buf
, sizeof (formatd_buf
), cur
.format
, 12345.67);
820 real_mystrfmon(buf
, 127, formatd_buf
, &cur
);
821 gtk_label_set_text(GTK_LABEL(data
->LB_numberbase
), buf
);
826 ** update the number sample label
828 static void defpref_numbereuro_sample(GtkWidget
*widget
, gpointer user_data
)
830 struct defpref_data
*data
;
831 struct CurrencyFmt cur
;
832 gchar formatd_buf
[G_ASCII_DTOSTR_BUF_SIZE
];
833 gchar buf
[128], *ptr
;
835 DB( g_print("\n[ui-pref] number sample\n") );
837 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), "inst_data");
839 cur
.symbol
= (gchar
*)gtk_entry_get_text(GTK_ENTRY(data
->ST_euro_symbol
));
840 cur
.is_prefix
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_euro_isprefix
));
841 cur
.decimal_char
= (gchar
*)gtk_entry_get_text(GTK_ENTRY(data
->ST_euro_decimalchar
));
842 cur
.grouping_char
= (gchar
*)gtk_entry_get_text(GTK_ENTRY(data
->ST_euro_groupingchar
));
843 cur
.frac_digits
= gtk_spin_button_get_value(GTK_SPIN_BUTTON(data
->NB_euro_fracdigits
));
844 g_snprintf(cur
.format
, 8-1, "%%.%df", cur
.frac_digits
);
849 ptr
= g_stpcpy(ptr
, cur
.symbol
);
850 ptr
= g_stpcpy(ptr
, " ");
852 ptr
= g_stpcpy(ptr
, "%s");
855 ptr
= g_stpcpy(ptr
, " ");
856 ptr
= g_stpcpy(ptr
, cur
.symbol
);
859 DB( g_print("fmt: %s\n", cur
.format
) );
860 DB( g_print("monfmt: %s\n", cur
.monfmt
) );
862 g_ascii_formatd(formatd_buf
, sizeof (formatd_buf
), cur
.format
, 12345.67);
864 real_mystrfmon(buf
, 127, formatd_buf
, &cur
);
865 gtk_label_set_text(GTK_LABEL(data
->LB_numbereuro
), buf
);
871 ** enable/disable euro
873 static void defpref_eurotoggle(GtkWidget
*widget
, gpointer user_data
)
875 struct defpref_data
*data
;
878 DB( g_print("\n[ui-pref] euro toggle\n") );
880 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), "inst_data");
882 bool = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_euro_enable
));
886 gtk_widget_set_sensitive(data
->CY_euro_preset
, bool);
887 gtk_widget_set_sensitive(data
->ST_euro_country
, bool);
888 gtk_widget_set_sensitive(data
->NB_euro_value
, bool);
890 gtk_widget_set_sensitive(data
->ST_euro_symbol
, bool);
891 gtk_widget_set_sensitive(data
->CM_euro_isprefix
, bool);
892 gtk_widget_set_sensitive(data
->ST_euro_decimalchar
, bool);
893 gtk_widget_set_sensitive(data
->ST_euro_groupingchar
, bool);
894 gtk_widget_set_sensitive(data
->NB_euro_fracdigits
, bool);
895 gtk_widget_set_sensitive(data
->LB_numbereuro
, bool);
902 ** set euro value widget from a country
904 static void defpref_europreset(GtkWidget
*widget
, gpointer user_data
)
906 struct defpref_data
*data
;
909 DB( g_print("\n[ui-pref] euro preset\n") );
911 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), "inst_data");
913 country
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_euro_preset
));
915 gtk_label_set_text(GTK_LABEL(data
->ST_euro_country
), euro_params
[country
].name
);
917 gtk_spin_button_set_value(GTK_SPIN_BUTTON(data
->NB_euro_value
), euro_params
[country
].value
);
919 gtk_spin_button_set_value(GTK_SPIN_BUTTON(data
->NB_euro_fracdigits
), euro_params
[country
].frac_digits
);
921 gtk_entry_set_text(GTK_ENTRY(data
->ST_euro_symbol
) , euro_params
[country
].symbol
);
922 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_euro_isprefix
), euro_params
[country
].is_prefix
);
923 gtk_entry_set_text(GTK_ENTRY(data
->ST_euro_decimalchar
) , euro_params
[country
].decimal_char
);
924 gtk_entry_set_text(GTK_ENTRY(data
->ST_euro_groupingchar
), euro_params
[country
].grouping_char
);
929 ** set preset colors for amount display
931 static void defpref_colorpreset(GtkWidget
*widget
, gpointer user_data
)
933 struct defpref_data
*data
;
936 gchar
*expcol
, *inccol
, *wrncol
;
938 DB( g_print("\n[ui-pref] color preset\n") );
940 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), "inst_data");
942 preset
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_colors
));
947 expcol
= LIGHT_EXP_COLOR
;
948 inccol
= LIGHT_INC_COLOR
;
949 wrncol
= LIGHT_WARN_COLOR
;
953 expcol
= MEDIUM_EXP_COLOR
;
954 inccol
= MEDIUM_INC_COLOR
;
955 wrncol
= MEDIUM_WARN_COLOR
;
960 expcol
= DEFAULT_EXP_COLOR
;
961 inccol
= DEFAULT_INC_COLOR
;
962 wrncol
= DEFAULT_WARN_COLOR
;
967 gdk_color_parse(expcol
, &color
);
968 gtk_color_button_set_color(GTK_COLOR_BUTTON(data
->CP_exp_color
), &color
);
970 gdk_color_parse(inccol
, &color
);
971 gtk_color_button_set_color(GTK_COLOR_BUTTON(data
->CP_inc_color
), &color
);
973 gdk_color_parse(wrncol
, &color
);
974 gtk_color_button_set_color(GTK_COLOR_BUTTON(data
->CP_warn_color
), &color
);
983 static void setGdkColor_from_RGB(GdkColor *color, guint32 value)
988 color->red = tmp | tmp<<8;
990 tmp = value >> 8 & 0xFF;
991 color->green = tmp | tmp<<8;
994 color->blue = tmp | tmp<<8;
1000 ** set :: fill in widgets from PREFS structure
1002 static void defpref_entry_set_text(GtkWidget
*widget
, gchar
*text
)
1004 DB( g_print(" set text to '%s'\n", text
) );
1008 gtk_entry_set_text(GTK_ENTRY(widget
), text
);
1012 static void defpref_set(struct defpref_data
*data
)
1016 DB( g_print("\n[ui-pref] set\n") );
1018 if(PREFS
->language
!= NULL
)
1019 ui_language_combobox_set_active_id(GTK_COMBO_BOX(data
->CY_language
), PREFS
->language
);
1021 gtk_combo_box_set_active (GTK_COMBO_BOX(data
->CY_language
), 0);
1023 gtk_combo_box_set_active(GTK_COMBO_BOX(data
->CY_toolbar
), PREFS
->toolbar_style
);
1024 //gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_image_size), PREFS->image_size);
1026 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_custom_colors
), PREFS
->custom_colors
);
1028 gdk_color_parse(PREFS
->color_exp
, &color
);
1029 gtk_color_button_set_color(GTK_COLOR_BUTTON(data
->CP_exp_color
), &color
);
1031 gdk_color_parse(PREFS
->color_inc
, &color
);
1032 gtk_color_button_set_color(GTK_COLOR_BUTTON(data
->CP_inc_color
), &color
);
1034 gdk_color_parse(PREFS
->color_warn
, &color
);
1035 gtk_color_button_set_color(GTK_COLOR_BUTTON(data
->CP_warn_color
), &color
);
1037 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_ruleshint
), PREFS
->rules_hint
);
1039 gtk_spin_button_set_value(GTK_SPIN_BUTTON(data
->NB_fiscyearday
), PREFS
->fisc_year_day
);
1040 gtk_combo_box_set_active(GTK_COMBO_BOX(data
->CY_fiscyearmonth
), PREFS
->fisc_year_month
- 1);
1042 gtk_entry_set_text(GTK_ENTRY(data
->ST_path_hbfile
), PREFS
->path_hbfile
);
1043 gtk_entry_set_text(GTK_ENTRY(data
->ST_path_import
), PREFS
->path_import
);
1044 gtk_entry_set_text(GTK_ENTRY(data
->ST_path_export
), PREFS
->path_export
);
1045 //gtk_entry_set_text(GTK_ENTRY(data->ST_path_navigator), PREFS->path_navigator);
1047 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_load_last
), PREFS
->loadlast
);
1048 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_append_scheduled
), PREFS
->appendscheduled
);
1049 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_show_splash
), PREFS
->showsplash
);
1050 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_herit_date
), PREFS
->heritdate
);
1051 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_hide_reconciled
), PREFS
->hidereconciled
);
1054 gtk_entry_set_text(GTK_ENTRY(data
->ST_datefmt
), PREFS
->date_format
);
1056 defpref_entry_set_text(data
->ST_num_symbol
, PREFS
->base_cur
.symbol
);
1057 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_num_isprefix
), PREFS
->base_cur
.is_prefix
);
1058 defpref_entry_set_text(data
->ST_num_decimalchar
, PREFS
->base_cur
.decimal_char
);
1059 defpref_entry_set_text(data
->ST_num_groupingchar
, PREFS
->base_cur
.grouping_char
);
1060 gtk_spin_button_set_value(GTK_SPIN_BUTTON(data
->NB_num_fracdigits
), PREFS
->base_cur
.frac_digits
);
1062 //gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_numnbdec), PREFS->num_nbdecimal);
1063 //gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_numseparator), PREFS->num_separator);
1064 //gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_imperial), PREFS->imperial_unit);
1065 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_unitismile
), PREFS
->vehicle_unit_ismile
);
1066 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_unitisgal
), PREFS
->vehicle_unit_isgal
);
1068 gtk_combo_box_set_active(GTK_COMBO_BOX(data
->CY_daterange_wal
), PREFS
->date_range_wal
);
1069 gtk_combo_box_set_active(GTK_COMBO_BOX(data
->CY_daterange_txn
), PREFS
->date_range_txn
);
1070 gtk_combo_box_set_active(GTK_COMBO_BOX(data
->CY_daterange_rep
), PREFS
->date_range_rep
);
1073 //defpref_currency_display(data->LB_default, NULL);
1075 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_euro_enable
), PREFS
->euro_active
);
1076 //gtk_combo_box_set_active(GTK_COMBO_BOX(data->CY_euro_preset), PREFS->euro_country);
1078 buf
= g_strdup_printf("%s", euro_params
[PREFS
->euro_country
].name
);
1079 gtk_label_set_markup(GTK_LABEL(data
->ST_euro_country
), buf
);
1082 gtk_spin_button_set_value(GTK_SPIN_BUTTON(data
->NB_euro_value
), PREFS
->euro_value
);
1084 defpref_entry_set_text(data
->ST_euro_symbol
, PREFS
->minor_cur
.symbol
);
1085 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_euro_isprefix
), PREFS
->minor_cur
.is_prefix
);
1086 defpref_entry_set_text(data
->ST_euro_decimalchar
, PREFS
->minor_cur
.decimal_char
);
1087 defpref_entry_set_text(data
->ST_euro_groupingchar
, PREFS
->minor_cur
.grouping_char
);
1088 gtk_spin_button_set_value(GTK_SPIN_BUTTON(data
->NB_euro_fracdigits
), PREFS
->minor_cur
.frac_digits
);
1091 //gtk_entry_set_text(GTK_ENTRY(data->ST_euro_symbol), PREFS->euro_symbol);
1092 //gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_euro_nbdec), PREFS->euro_nbdec);
1093 //gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_euro_thsep), PREFS->euro_thsep);
1095 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_stat_byamount
), PREFS
->stat_byamount
);
1096 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_stat_showrate
), PREFS
->stat_showrate
);
1097 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_stat_showdetail
), PREFS
->stat_showdetail
);
1099 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
->CM_budg_showdetail
), PREFS
->budg_showdetail
);
1101 gtk_combo_box_set_active(GTK_COMBO_BOX(data
->CY_color_scheme
), PREFS
->report_color_scheme
);
1104 gtk_combo_box_set_active(GTK_COMBO_BOX(data
->CY_dtex_datefmt
), PREFS
->dtex_datefmt
);
1105 gtk_combo_box_set_active(GTK_COMBO_BOX(data
->CY_dtex_ofxmemo
), PREFS
->dtex_ofxmemo
);
1113 ** get :: fill PREFS structure from widgets
1117 static void defpref_entry_get_text(GtkWidget
*widget
, gchar
**storage
)
1122 DB( g_print("defpref_entry_get_text\n") );
1124 DB( g_print(" storage is '%p' at '%p'\n", *storage
, storage
) );
1126 /* free any previous string */
1127 if( *storage
!= NULL
)
1129 DB( g_print(" storage was not null, freeing\n") );
1137 text
= gtk_entry_get_text(GTK_ENTRY(widget
));
1138 *storage
= g_strdup(text
);
1139 DB( g_print(" storing %s at %p\n", *storage
, storage
) );
1141 DB( g_print(" get text to '%s' '%s'\n", text
, *storage
) );
1145 static void defpref_get(struct defpref_data
*data
)
1150 DB( g_print("\n[ui-pref] get\n") );
1152 g_free(PREFS
->language
);
1153 PREFS
->language
= NULL
;
1154 lang
= ui_language_combobox_get_active_id(GTK_COMBO_BOX(data
->CY_language
));
1157 PREFS
->language
= g_strdup(lang
);
1160 PREFS
->toolbar_style
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_toolbar
));
1161 //PREFS->image_size = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->NB_image_size));
1163 PREFS
->custom_colors
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_custom_colors
));
1165 gtk_color_button_get_color(GTK_COLOR_BUTTON(data
->CP_exp_color
), &color
);
1166 g_free(PREFS
->color_exp
);
1167 PREFS
->color_exp
= gdk_color_to_string(&color
);
1169 gtk_color_button_get_color(GTK_COLOR_BUTTON(data
->CP_inc_color
), &color
);
1170 g_free(PREFS
->color_inc
);
1171 PREFS
->color_inc
= gdk_color_to_string(&color
);
1173 gtk_color_button_get_color(GTK_COLOR_BUTTON(data
->CP_warn_color
), &color
);
1174 g_free(PREFS
->color_warn
);
1175 PREFS
->color_warn
= gdk_color_to_string(&color
);
1177 PREFS
->rules_hint
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_ruleshint
));
1179 PREFS
->fisc_year_day
= gtk_spin_button_get_value(GTK_SPIN_BUTTON(data
->NB_fiscyearday
));
1180 PREFS
->fisc_year_month
= 1 + gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_fiscyearmonth
));
1182 list_txn_colpref_get(GTK_TREE_VIEW(data
->LV_opecolumns
), PREFS
->lst_ope_columns
);
1184 g_free(PREFS
->path_hbfile
);
1185 PREFS
->path_hbfile
= g_strdup(gtk_entry_get_text(GTK_ENTRY(data
->ST_path_hbfile
)));
1187 defpref_entry_get_text(data
->ST_path_import
, &PREFS
->path_import
);
1189 defpref_entry_get_text(data
->ST_path_export
, &PREFS
->path_export
);
1191 PREFS
->loadlast
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_load_last
));
1192 PREFS
->appendscheduled
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_append_scheduled
));
1193 PREFS
->showsplash
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_show_splash
));
1194 PREFS
->heritdate
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_herit_date
));
1195 PREFS
->hidereconciled
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_hide_reconciled
));
1197 //g_free(PREFS->path_navigator);
1198 //PREFS->path_navigator = g_strdup(gtk_entry_get_text(GTK_ENTRY(data->ST_path_navigator)));
1200 g_free(PREFS
->date_format
);
1201 PREFS
->date_format
= g_strdup(gtk_entry_get_text(GTK_ENTRY(data
->ST_datefmt
)));
1203 defpref_entry_get_text(data
->ST_num_symbol
, &PREFS
->base_cur
.symbol
);
1204 PREFS
->base_cur
.is_prefix
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_num_isprefix
));
1205 defpref_entry_get_text(data
->ST_num_decimalchar
, &PREFS
->base_cur
.decimal_char
);
1206 defpref_entry_get_text(data
->ST_num_groupingchar
, &PREFS
->base_cur
.grouping_char
);
1207 PREFS
->base_cur
.frac_digits
= gtk_spin_button_get_value(GTK_SPIN_BUTTON(data
->NB_num_fracdigits
));
1209 //PREFS->num_nbdecimal = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->NB_numnbdec));
1210 //PREFS->num_separator = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_numseparator));
1211 //PREFS->imperial_unit = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_imperial));
1212 PREFS
->vehicle_unit_ismile
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_unitismile
));
1213 PREFS
->vehicle_unit_isgal
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_unitisgal
));
1215 PREFS
->date_range_wal
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_daterange_wal
));
1216 PREFS
->date_range_txn
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_daterange_txn
));
1217 PREFS
->date_range_rep
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_daterange_rep
));
1219 PREFS
->euro_active
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_euro_enable
));
1220 PREFS
->euro_country
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_euro_preset
));
1221 PREFS
->euro_value
= gtk_spin_button_get_value(GTK_SPIN_BUTTON(data
->NB_euro_value
));
1222 //strcpy(PREFS->euro_symbol, gtk_entry_get_text(GTK_ENTRY(data->ST_euro_symbol)));
1223 //PREFS->euro_nbdec = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->NB_euro_nbdec));
1224 //PREFS->euro_thsep = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_euro_thsep));
1226 defpref_entry_get_text(data
->ST_euro_symbol
, &PREFS
->minor_cur
.symbol
);
1227 PREFS
->minor_cur
.is_prefix
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_euro_isprefix
));
1229 g_free(PREFS
->minor_cur
.decimal_char
);
1230 PREFS
->minor_cur
.decimal_char
= g_strdup( gtk_entry_get_text(GTK_ENTRY(data
->ST_euro_decimalchar
)) );
1232 g_free(PREFS
->minor_cur
.grouping_char
);
1233 PREFS
->minor_cur
.grouping_char
= g_strdup( gtk_entry_get_text(GTK_ENTRY(data
->ST_euro_groupingchar
)) );
1234 PREFS
->minor_cur
.frac_digits
= gtk_spin_button_get_value(GTK_SPIN_BUTTON(data
->NB_euro_fracdigits
));
1236 PREFS
->stat_byamount
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_stat_byamount
));
1237 PREFS
->stat_showrate
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_stat_showrate
));
1238 PREFS
->stat_showdetail
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_stat_showdetail
));
1240 PREFS
->budg_showdetail
= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data
->CM_budg_showdetail
));
1242 PREFS
->report_color_scheme
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_color_scheme
));
1245 PREFS
->dtex_datefmt
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_dtex_datefmt
));
1246 PREFS
->dtex_ofxmemo
= gtk_combo_box_get_active(GTK_COMBO_BOX(data
->CY_dtex_ofxmemo
));
1249 //PREFS->chart_legend = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_chartlegend));
1251 list_ext_colpref_get(GTK_TREE_VIEW(data
->PI_plugin_columns
), &(PREFS
->ext_whitelist
));
1255 GtkWidget *defpref_page_charts (struct defpref_data *data)
1257 GtkWidget *container;
1258 GtkWidget *table, *label, *widget;
1261 container = gtk_hbox_new(FALSE, 0);
1263 table = gtk_table_new (2, 2, FALSE);
1264 gtk_container_set_border_width (GTK_CONTAINER (table), HB_BOX_SPACING);
1265 gtk_table_set_row_spacings (GTK_TABLE (table), HB_TABROW_SPACING);
1266 gtk_table_set_col_spacings (GTK_TABLE (table), HB_TABCOL_SPACING);
1268 gtk_box_pack_start (GTK_BOX (container), table, FALSE, FALSE, 0);
1271 widget = gtk_check_button_new_with_mnemonic (_("Show legend"));
1272 data->CM_chartlegend = widget;
1273 gtk_table_attach (GTK_TABLE (table), widget, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
1276 label = make_label(_("Bar width:"), 1.0, 0.5);
1277 //----------------------------------------- l, r, t, b
1278 gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
1279 widget = make_numeric(label, 8.0, 32.0);
1280 //data->NB_numnbdec = widget;
1281 gtk_table_attach (GTK_TABLE (table), widget, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
1290 static GtkWidget
*defpref_page_import (struct defpref_data
*data
)
1292 GtkWidget
*container
;
1293 GtkWidget
*table
, *hbox
, *label
, *widget
;
1296 container
= gtk_vbox_new(FALSE
, 0);
1298 table
= gtk_table_new (5, 3, FALSE
);
1299 //gtk_container_set_border_width (GTK_CONTAINER (table), HB_BOX_SPACING);
1300 gtk_table_set_row_spacings (GTK_TABLE (table
), HB_TABROW_SPACING
);
1301 gtk_table_set_col_spacings (GTK_TABLE (table
), HB_TABCOL_SPACING
);
1303 gtk_box_pack_start (GTK_BOX (container
), table
, FALSE
, FALSE
, 0);
1306 label
= make_label(_("Date options"), 0.0, 0.5);
1307 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
1308 gtk_table_attach_defaults (GTK_TABLE (table
), label
, 0, 3, row
, row
+1);
1311 label
= make_label(_("Date order:"), 0, 0.5);
1312 //----------------------------------------- l, r, t, b
1313 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1314 widget
= make_cycle(label
, CYA_IMPORT_DATEORDER
);
1315 data
->CY_dtex_datefmt
= widget
;
1316 //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1317 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
|GTK_EXPAND
), (GtkAttachOptions
) (0), 0, 0);
1321 label
= make_label(_("OFX/QFX options"), 0.0, 0.5);
1322 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
1323 gtk_table_attach_defaults (GTK_TABLE (table
), label
, 0, 3, row
, row
+1);
1326 label
= make_label(_("_Memo field:"), 0, 0.5);
1327 //----------------------------------------- l, r, t, b
1328 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1329 widget
= make_cycle(label
, CYA_IMPORT_OFXMEMO
);
1330 data
->CY_dtex_ofxmemo
= widget
;
1331 //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1332 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
|GTK_EXPAND
), (GtkAttachOptions
) (0), 0, 0);
1336 label
= make_label(_("Files folder"), 0.0, 0.5);
1337 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
1338 gtk_table_attach_defaults (GTK_TABLE (table
), label
, 0, 3, row
, row
+1);
1342 label
= make_label(_("_Import:"), 0, 0.5);
1343 //----------------------------------------- l, r, t, b
1344 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1346 hbox
= gtk_hbox_new(FALSE
, 0);
1347 gtk_table_attach (GTK_TABLE (table
), hbox
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), 0, 0);
1349 widget
= make_string(label
);
1350 data
->ST_path_import
= widget
;
1351 gtk_box_pack_start (GTK_BOX (hbox
), widget
, TRUE
, TRUE
, 0);
1353 widget
= gtk_button_new_with_label("...");
1354 data
->BT_path_import
= widget
;
1355 gtk_box_pack_start (GTK_BOX (hbox
), widget
, FALSE
, FALSE
, 0);
1358 label
= make_label(_("_Export:"), 0, 0.5);
1359 //----------------------------------------- l, r, t, b
1360 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1362 hbox
= gtk_hbox_new(FALSE
, 0);
1363 gtk_table_attach (GTK_TABLE (table
), hbox
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), 0, 0);
1365 widget
= make_string(label
);
1366 data
->ST_path_export
= widget
;
1367 gtk_box_pack_start (GTK_BOX (hbox
), widget
, TRUE
, TRUE
, 0);
1369 widget
= gtk_button_new_with_label("...");
1370 data
->BT_path_export
= widget
;
1371 gtk_box_pack_start (GTK_BOX (hbox
), widget
, FALSE
, FALSE
, 0);
1380 static GtkWidget
*defpref_page_reports (struct defpref_data
*data
)
1382 GtkWidget
*container
;
1383 GtkWidget
*table
, *label
, *widget
;
1386 container
= gtk_vbox_new(FALSE
, 0);
1388 table
= gtk_table_new (5, 3, FALSE
);
1389 //gtk_container_set_border_width (GTK_CONTAINER (table), HB_BOX_SPACING);
1390 gtk_table_set_row_spacings (GTK_TABLE (table
), HB_TABROW_SPACING
);
1391 gtk_table_set_col_spacings (GTK_TABLE (table
), HB_TABCOL_SPACING
);
1393 gtk_box_pack_start (GTK_BOX (container
), table
, FALSE
, FALSE
, 0);
1397 label
= make_label(_("Initial filter"), 0.0, 0.5);
1398 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
1399 gtk_table_attach_defaults (GTK_TABLE (table
), label
, 0, 3, row
, row
+1);
1402 label
= make_label(_("Date _range:"), 0, 0.5);
1403 //----------------------------------------- l, r, t, b
1404 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1405 widget
= make_daterange(label
, FALSE
);
1406 data
->CY_daterange_rep
= widget
;
1407 //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1408 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1412 label
= make_label(_("Charts options"), 0.0, 0.5);
1413 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
1414 gtk_table_attach_defaults (GTK_TABLE (table
), label
, 0, 3, row
, row
+1);
1417 label
= make_label(_("Color Scheme:"), 0, 0.5);
1418 //----------------------------------------- l, r, t, b
1419 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1420 widget
= make_cycle(label
, (gchar
**)chart_colors
);
1421 data
->CY_color_scheme
= widget
;
1422 //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1423 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
|GTK_EXPAND
), (GtkAttachOptions
) (0), 0, 0);
1427 label
= make_label(_("Statistics options"), 0.0, 0.5);
1428 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
1429 gtk_table_attach_defaults (GTK_TABLE (table
), label
, 0, 3, row
, row
+1);
1432 widget
= gtk_check_button_new_with_mnemonic (_("Show by _amount"));
1433 data
->CM_stat_byamount
= widget
;
1434 gtk_table_attach (GTK_TABLE (table
), widget
, 1, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
|GTK_EXPAND
), (GtkAttachOptions
) (0), 0, 0);
1437 widget
= gtk_check_button_new_with_mnemonic (_("Show _rate column"));
1438 data
->CM_stat_showrate
= widget
;
1439 gtk_table_attach (GTK_TABLE (table
), widget
, 1, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
|GTK_EXPAND
), (GtkAttachOptions
) (0), 0, 0);
1442 widget
= gtk_check_button_new_with_mnemonic (_("Show _details"));
1443 data
->CM_stat_showdetail
= widget
;
1444 gtk_table_attach (GTK_TABLE (table
), widget
, 1, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
|GTK_EXPAND
), (GtkAttachOptions
) (0), 0, 0);
1447 label
= make_label(_("Budget options"), 0.0, 0.5);
1448 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
1449 gtk_table_attach_defaults (GTK_TABLE (table
), label
, 0, 3, row
, row
+1);
1452 widget
= gtk_check_button_new_with_mnemonic (_("Show _details"));
1453 data
->CM_budg_showdetail
= widget
;
1454 gtk_table_attach (GTK_TABLE (table
), widget
, 1, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
|GTK_EXPAND
), (GtkAttachOptions
) (0), 0, 0);
1460 static GtkWidget
*defpref_page_euro (struct defpref_data
*data
)
1462 GtkWidget
*container
;
1463 GtkWidget
*table
, *label
, *widget
;
1466 container
= gtk_vbox_new(FALSE
, 0);
1468 table
= gtk_table_new (7, 3, FALSE
);
1469 //gtk_container_set_border_width (GTK_CONTAINER (table), HB_BOX_SPACING);
1470 gtk_table_set_row_spacings (GTK_TABLE (table
), HB_TABROW_SPACING
);
1471 gtk_table_set_col_spacings (GTK_TABLE (table
), HB_TABCOL_SPACING
);
1473 gtk_box_pack_start (GTK_BOX (container
), table
, FALSE
, FALSE
, 0);
1478 label = make_label(_("Default currency"), 0.0, 0.5);
1479 gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
1480 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
1483 label = make_label(_("Code:"), 0, 0.5);
1484 //----------------------------------------- l, r, t, b
1485 gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
1486 widget = make_label(NULL, 0.0, 0.0);
1487 data->LB_default = widget;
1488 gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
1493 widget = gtk_button_new_with_mnemonic (_("_Change"));
1494 data->BT_default = widget;
1495 gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
1501 label
= make_label(_("General"), 0.0, 0.5);
1502 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
1503 gtk_table_attach_defaults (GTK_TABLE (table
), label
, 0, 3, row
, row
+1);
1506 widget
= gtk_check_button_new_with_mnemonic (_("_Enable"));
1507 data
->CM_euro_enable
= widget
;
1508 gtk_table_attach (GTK_TABLE (table
), widget
, 1, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
|GTK_EXPAND
), (GtkAttachOptions
) (0), 0, 0);
1511 label
= make_label(_("Fill from:"), 0, 0.5);
1512 //----------------------------------------- l, r, t, b
1513 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1514 widget
= make_euro_presets(label
);
1515 data
->CY_euro_preset
= widget
;
1516 //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1517 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
|GTK_EXPAND
), (GtkAttachOptions
) (0), 0, 0);
1520 label
= make_label(_("Country:"), 0, 0.5);
1521 //----------------------------------------- l, r, t, b
1522 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1523 widget
= make_label(NULL
, 0.0, 0.0);
1524 data
->ST_euro_country
= widget
;
1525 //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1526 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
|GTK_EXPAND
), (GtkAttachOptions
) (0), 0, 0);
1529 label
= make_label(_("Value:"), 0, 0.5);
1530 //----------------------------------------- l, r, t, b
1531 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1532 widget
= make_euro(label
);
1533 data
->NB_euro_value
= widget
;
1534 //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1535 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
|GTK_EXPAND
), (GtkAttachOptions
) (0), 0, 0);
1538 label
= make_label(_("Numbers format"), 0.0, 0.5);
1539 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
1540 gtk_table_attach_defaults (GTK_TABLE (table
), label
, 0, 3, row
, row
+1);
1543 label
= make_label(_("Symbol:"), 0, 0.5);
1544 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1545 widget
= make_string_maxlength(label
, 3);
1546 data
->ST_euro_symbol
= widget
;
1547 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1550 widget
= gtk_check_button_new_with_mnemonic (_("Is prefix"));
1551 data
->CM_euro_isprefix
= widget
;
1552 gtk_table_attach (GTK_TABLE (table
), widget
, 1, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1555 label
= make_label(_("Decimal char:"), 0, 0.5);
1556 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1557 widget
= make_string_maxlength(label
, 1);
1558 data
->ST_euro_decimalchar
= widget
;
1559 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1562 label
= make_label(_("Grouping char:"), 0, 0.5);
1563 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1564 widget
= make_string_maxlength(label
, 1);
1565 data
->ST_euro_groupingchar
= widget
;
1566 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1569 label
= make_label(_("_Frac digits:"), 0, 0.5);
1570 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1571 widget
= make_numeric(label
, 0.0, 6.0);
1572 data
->NB_euro_fracdigits
= widget
;
1573 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1576 label
= make_label(NULL
, 0, 0.5);
1577 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1578 widget
= make_label(NULL
, 0, 0.5);
1579 data
->LB_numbereuro
= widget
;
1580 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1584 label = make_label(_("_Frac digits:"), 0, 0.5);
1585 //----------------------------------------- l, r, t, b
1586 gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
1587 widget = make_numeric(label, 0.0, 6.0);
1588 data->NB_euro_nbdec = widget;
1589 gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
1592 widget = gtk_check_button_new_with_mnemonic (_("Thousand separator"));
1593 data->CM_euro_thsep = widget;
1594 gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
1597 label = make_label(_("Symbol:"), 0, 0.5);
1598 //----------------------------------------- l, r, t, b
1599 gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
1600 widget = make_string_maxlength(label, 8);
1601 data->ST_euro_symbol = widget;
1602 //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1603 gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
1611 GtkWidget *defpref_page_help (struct defpref_data *data)
1613 GtkWidget *container;
1614 GtkWidget *table, *label, *widget;
1617 container = gtk_vbox_new(FALSE, 0);
1619 table = gtk_table_new (2, 2, FALSE);
1620 gtk_container_set_border_width (GTK_CONTAINER (table), HB_BOX_SPACING);
1621 gtk_table_set_row_spacings (GTK_TABLE (table), HB_TABROW_SPACING);
1622 gtk_table_set_col_spacings (GTK_TABLE (table), HB_TABCOL_SPACING);
1624 gtk_box_pack_start (GTK_BOX (container), table, FALSE, FALSE, 0);
1627 label = make_label(_("Web navigator"), 0.0, 0.5);
1628 gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
1629 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
1632 label = make_label("", 0.0, 0.5);
1633 gtk_misc_set_padding (GTK_MISC (label), HB_BOX_SPACING, 0);
1634 gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
1636 label = make_label(_("Web _navigator to use:"), 1.0, 0.5);
1637 //----------------------------------------- l, r, t, b
1638 gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
1639 widget = make_string(label);
1640 data->ST_path_navigator = widget;
1641 //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1642 gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
1651 static GtkWidget
*defpref_page_display (struct defpref_data
*data
)
1653 GtkWidget
*container
;
1654 GtkWidget
*table
, *label
, *widget
;
1657 container
= gtk_vbox_new(FALSE
, 0);
1659 table
= gtk_table_new (7, 3, FALSE
);
1660 //gtk_container_set_border_width (GTK_CONTAINER (table), HB_BOX_SPACING);
1661 gtk_table_set_row_spacings (GTK_TABLE (table
), HB_TABROW_SPACING
);
1662 gtk_table_set_col_spacings (GTK_TABLE (table
), HB_TABCOL_SPACING
);
1664 gtk_box_pack_start (GTK_BOX (container
), table
, FALSE
, FALSE
, 0);
1667 label
= make_label(_("Date options"), 0.0, 0.5);
1668 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
1669 gtk_table_attach_defaults (GTK_TABLE (table
), label
, 0, 3, row
, row
+1);
1672 label
= make_label(_("_Date format:"), 0, 0.5);
1673 //----------------------------------------- l, r, t, b
1674 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1675 widget
= make_string(label
);
1676 data
->ST_datefmt
= widget
;
1677 //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1678 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1680 gtk_widget_set_tooltip_text(widget
,
1681 _("%a locale's abbreviated weekday name.\n"
1682 "%A locale's full weekday name. \n"
1683 "%b locale's abbreviated month name. \n"
1684 "%B locale's full month name. \n"
1685 "%c locale's appropriate date and time representation. \n"
1686 "%C century number (the year divided by 100 and truncated to an integer) as a decimal number [00-99]. \n"
1687 "%d day of the month as a decimal number [01,31]. \n"
1688 "%D same as %m/%d/%y. \n"
1689 "%e day of the month as a decimal number [1,31]; a single digit is preceded by a space. \n"
1690 "%j day of the year as a decimal number [001,366]. \n"
1691 "%m month as a decimal number [01,12]. \n"
1692 "%p locale's appropriate date representation. \n"
1693 "%y year without century as a decimal number [00,99]. \n"
1694 "%Y year with century as a decimal number. \n")
1699 label
= make_label(NULL
, 0, 0.5);
1700 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1701 widget
= make_label(NULL
, 0, 0.5);
1702 data
->LB_date
= widget
;
1703 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1706 label
= make_label(_("Numbers options"), 0.0, 0.5);
1707 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
1708 gtk_table_attach_defaults (GTK_TABLE (table
), label
, 0, 3, row
, row
+1);
1711 label
= make_label(_("Symbol:"), 0, 0.5);
1712 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1713 widget
= make_string_maxlength(label
, 3);
1714 data
->ST_num_symbol
= widget
;
1715 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1718 widget
= gtk_check_button_new_with_mnemonic (_("Is prefix"));
1719 data
->CM_num_isprefix
= widget
;
1720 gtk_table_attach (GTK_TABLE (table
), widget
, 1, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1723 label
= make_label(_("Decimal char:"), 0, 0.5);
1724 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1725 widget
= make_string_maxlength(label
,1);
1726 data
->ST_num_decimalchar
= widget
;
1727 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1730 label
= make_label(_("Grouping char:"), 0, 0.5);
1731 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1732 widget
= make_string_maxlength(label
, 1);
1733 data
->ST_num_groupingchar
= widget
;
1734 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1737 label
= make_label(_("_Frac digits:"), 0, 0.5);
1738 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1740 widget
= make_numeric(label
, 0.0, 15.0);
1742 widget
= make_numeric(label
, 0.0, 6.0);
1744 data
->NB_num_fracdigits
= widget
;
1745 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1748 label
= make_label(NULL
, 0, 0.5);
1749 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1750 widget
= make_label(NULL
, 0, 0.5);
1751 data
->LB_numberbase
= widget
;
1752 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1758 label = make_label(_("_Frac digits:"), 0, 0.5);
1759 gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
1760 widget = make_numeric(label, 0.0, 6.0);
1761 data->NB_numnbdec = widget;
1762 gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
1765 widget = gtk_check_button_new_with_mnemonic (_("_Thousand separator"));
1766 data->CM_numseparator = widget;
1767 gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
1771 label
= make_label(_("Measurement units"), 0.0, 0.5);
1772 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
1773 gtk_table_attach_defaults (GTK_TABLE (table
), label
, 0, 3, row
, row
+1);
1776 widget = gtk_check_button_new_with_mnemonic (_("Use _Imperial units"));
1777 data->CM_imperial = widget;
1778 gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);*/
1781 widget
= gtk_check_button_new_with_mnemonic (_("Use _miles for meter"));
1782 data
->CM_unitismile
= widget
;
1783 gtk_table_attach (GTK_TABLE (table
), widget
, 1, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1786 widget
= gtk_check_button_new_with_mnemonic (_("Use _galons for fuel"));
1787 data
->CM_unitisgal
= widget
;
1788 gtk_table_attach (GTK_TABLE (table
), widget
, 1, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1794 static GtkWidget
*defpref_page_transactions (struct defpref_data
*data
)
1796 GtkWidget
*container
;
1797 GtkWidget
*table
, *label
, *sw
, *widget
;
1800 container
= gtk_vbox_new(FALSE
, 0);
1802 table
= gtk_table_new (3, 3, FALSE
);
1803 //gtk_container_set_border_width (GTK_CONTAINER (table), HB_BOX_SPACING);
1804 gtk_table_set_row_spacings (GTK_TABLE (table
), HB_TABROW_SPACING
);
1805 gtk_table_set_col_spacings (GTK_TABLE (table
), HB_TABCOL_SPACING
);
1807 gtk_box_pack_start (GTK_BOX (container
), table
, TRUE
, TRUE
, 0);
1810 label
= make_label(_("Transaction window"), 0.0, 0.5);
1811 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
1812 gtk_table_attach (GTK_TABLE (table
), label
, 0, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1815 label
= make_label(_("Date _range:"), 0, 0.5);
1816 //----------------------------------------- l, r, t, b
1817 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1818 widget
= make_daterange(label
, FALSE
);
1819 data
->CY_daterange_txn
= widget
;
1820 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1823 widget
= gtk_check_button_new_with_mnemonic (_("Hide reconciled transactions"));
1824 data
->CM_hide_reconciled
= widget
;
1825 gtk_table_attach (GTK_TABLE (table
), widget
, 1, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
|GTK_EXPAND
), (GtkAttachOptions
) (0), 0, 0);
1829 label
= make_label(_("Multiple add"), 0.0, 0.5);
1830 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
1831 gtk_table_attach (GTK_TABLE (table
), label
, 0, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1834 widget
= gtk_check_button_new_with_mnemonic (_("Keep the last date"));
1835 data
->CM_herit_date
= widget
;
1836 gtk_table_attach (GTK_TABLE (table
), widget
, 1, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
|GTK_EXPAND
), (GtkAttachOptions
) (0), 0, 0);
1840 label
= make_label(_("Column list"), 0.0, 0.5);
1841 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
1842 gtk_table_attach (GTK_TABLE (table
), label
, 0, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1845 sw
= gtk_scrolled_window_new (NULL
, NULL
);
1846 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw
), GTK_SHADOW_ETCHED_IN
);
1847 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw
), GTK_POLICY_NEVER
, GTK_POLICY_AUTOMATIC
);
1848 widget
= (GtkWidget
*)list_txn_colprefcreate();
1849 data
->LV_opecolumns
= widget
;
1850 gtk_container_add (GTK_CONTAINER (sw
), widget
);
1851 gtk_widget_set_tooltip_text(widget
, _("Drag & drop to change the order"));
1852 gtk_table_attach (GTK_TABLE (table
), sw
, 1, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), 0, 0);
1860 static GtkWidget
*defpref_page_interface (struct defpref_data
*data
)
1862 GtkWidget
*container
;
1863 GtkWidget
*table
, *hbox
, *label
, *widget
;
1866 container
= gtk_vbox_new(FALSE
, 0);
1868 table
= gtk_table_new (6, 3, FALSE
);
1869 //gtk_container_set_border_width (GTK_CONTAINER (table), HB_BOX_SPACING);
1870 gtk_table_set_row_spacings (GTK_TABLE (table
), HB_TABROW_SPACING
);
1871 gtk_table_set_col_spacings (GTK_TABLE (table
), HB_TABCOL_SPACING
);
1873 gtk_box_pack_start (GTK_BOX (container
), table
, FALSE
, FALSE
, 0);
1876 label
= make_label(_("Language"), 0.0, 0.5);
1877 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
1878 gtk_table_attach_defaults (GTK_TABLE (table
), label
, 0, 3, row
, row
+1);
1881 label
= make_label(_("_Language:"), 0, 0.5);
1882 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1883 widget
= ui_language_combobox_new(label
);
1884 data
->CY_language
= widget
;
1885 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1888 label
= make_label(_("General"), 0.0, 0.5);
1889 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
1890 gtk_table_attach_defaults (GTK_TABLE (table
), label
, 0, 3, row
, row
+1);
1893 label
= make_label(_("_Toolbar:"), 0, 0.5);
1894 //----------------------------------------- l, r, t, b
1895 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1896 widget
= make_cycle(label
, CYA_TOOLBAR_STYLE
);
1897 data
->CY_toolbar
= widget
;
1898 //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1899 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1903 label = make_label(_("_Size:"), 0, 0.5);
1904 gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
1905 hbox = gtk_hbox_new(FALSE, HB_BOX_SPACING);
1906 gtk_table_attach (GTK_TABLE (table), hbox, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
1908 widget = make_numeric(label, 16.0, 48.0);
1909 data->NB_image_size = widget;
1910 gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
1911 label = make_label(_("pixels"), 0, 0.5);
1912 gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
1916 label
= make_label(_("Treeview"), 0.0, 0.5);
1917 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
1918 gtk_table_attach_defaults (GTK_TABLE (table
), label
, 0, 3, row
, row
+1);
1921 widget
= gtk_check_button_new_with_mnemonic (_("Show rules hint"));
1922 data
->CM_ruleshint
= widget
;
1923 gtk_table_attach (GTK_TABLE (table
), widget
, 1, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
|GTK_EXPAND
), (GtkAttachOptions
) (0), 0, 0);
1927 label
= make_label(_("Amount colors"), 0.0, 0.5);
1928 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
1929 gtk_table_attach_defaults (GTK_TABLE (table
), label
, 0, 3, row
, row
+1);
1932 widget
= gtk_check_button_new_with_mnemonic (_("Uses custom colors"));
1933 data
->CM_custom_colors
= widget
;
1934 gtk_table_attach (GTK_TABLE (table
), widget
, 1, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
|GTK_EXPAND
), (GtkAttachOptions
) (0), 0, 0);
1937 label
= make_label(_("_Preset:"), 0, 0.5);
1938 //----------------------------------------- l, r, t, b
1939 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1940 widget
= make_cycle(label
, CYA_TANGO_COLORS
);
1941 data
->CY_colors
= widget
;
1942 //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
1943 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1946 label
= make_label(_("_Expense:"), 0, 0.5);
1947 //----------------------------------------- l, r, t, b
1948 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
1949 hbox
= gtk_hbox_new(FALSE
, HB_BOX_SPACING
);
1950 gtk_table_attach_defaults (GTK_TABLE (table
), hbox
, 2, 3, row
, row
+1);
1952 widget
= gtk_color_button_new ();
1953 data
->CP_exp_color
= widget
;
1954 gtk_box_pack_start (GTK_BOX (hbox
), widget
, FALSE
, FALSE
, 0);
1956 label
= make_label(_("_Income:"), 0, 0.5);
1957 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
1959 widget
= gtk_color_button_new ();
1960 data
->CP_inc_color
= widget
;
1961 gtk_box_pack_start (GTK_BOX (hbox
), widget
, FALSE
, FALSE
, 0);
1963 label
= make_label(_("_Warning:"), 0, 0.5);
1964 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
1966 widget
= gtk_color_button_new ();
1967 data
->CP_warn_color
= widget
;
1968 gtk_box_pack_start (GTK_BOX (hbox
), widget
, FALSE
, FALSE
, 0);
1974 static GtkWidget
*defpref_page_general (struct defpref_data
*data
)
1976 GtkWidget
*container
;
1977 GtkWidget
*table
, *label
, *widget
, *hbox
;
1980 container
= gtk_vbox_new(FALSE
, 0);
1982 table
= gtk_table_new (4, 3, FALSE
);
1983 //gtk_container_set_border_width (GTK_CONTAINER (table), HB_BOX_SPACING);
1984 gtk_table_set_row_spacings (GTK_TABLE (table
), HB_TABROW_SPACING
);
1985 gtk_table_set_col_spacings (GTK_TABLE (table
), HB_TABCOL_SPACING
);
1987 gtk_box_pack_start (GTK_BOX (container
), table
, FALSE
, FALSE
, 0);
1990 label
= make_label(_("Program start"), 0.0, 0.5);
1991 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
1992 gtk_table_attach_defaults (GTK_TABLE (table
), label
, 0, 3, row
, row
+1);
1995 widget
= gtk_check_button_new_with_mnemonic (_("Show splash screen"));
1996 data
->CM_show_splash
= widget
;
1997 gtk_table_attach (GTK_TABLE (table
), widget
, 1, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
|GTK_EXPAND
), (GtkAttachOptions
) (0), 0, 0);
2000 widget
= gtk_check_button_new_with_mnemonic (_("Load last opened file"));
2001 data
->CM_load_last
= widget
;
2002 gtk_table_attach (GTK_TABLE (table
), widget
, 1, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
|GTK_EXPAND
), (GtkAttachOptions
) (0), 0, 0);
2005 widget
= gtk_check_button_new_with_mnemonic (_("Post pending scheduled transactions"));
2006 data
->CM_append_scheduled
= widget
;
2007 gtk_table_attach (GTK_TABLE (table
), widget
, 1, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
|GTK_EXPAND
), (GtkAttachOptions
) (0), 0, 0);
2011 label
= make_label(_("Fiscal year"), 0.0, 0.5);
2012 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
2013 gtk_table_attach_defaults (GTK_TABLE (table
), label
, 0, 3, row
, row
+1);
2016 //TRANSLATORS: (fiscal year) starts on
2017 label
= make_label(_("Starts _on:"), 0.0, 0.5);
2018 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
2020 hbox
= gtk_hbox_new(FALSE
, HB_BOX_SPACING
);
2021 gtk_table_attach (GTK_TABLE (table
), hbox
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
|GTK_EXPAND
), (GtkAttachOptions
) (0), 0, 0);
2022 widget
= make_numeric (label
, 1, 28);
2023 data
->NB_fiscyearday
= widget
;
2024 gtk_box_pack_start (GTK_BOX (hbox
), widget
, FALSE
, FALSE
, 0);
2025 widget
= make_cycle (NULL
, CYA_MONTHS
);
2026 data
->CY_fiscyearmonth
= widget
;
2027 gtk_box_pack_start (GTK_BOX (hbox
), widget
, FALSE
, FALSE
, 0);
2030 label
= make_label(_("Main window reports"), 0.0, 0.5);
2031 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
2032 gtk_table_attach_defaults (GTK_TABLE (table
), label
, 0, 3, row
, row
+1);
2035 label
= make_label(_("Date _range:"), 0, 0.5);
2036 //----------------------------------------- l, r, t, b
2037 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
2038 widget
= make_daterange(label
, FALSE
);
2039 data
->CY_daterange_wal
= widget
;
2040 gtk_table_attach (GTK_TABLE (table
), widget
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
2044 label
= make_label(_("Files folder"), 0.0, 0.5);
2045 gimp_label_set_attributes(GTK_LABEL(label
), PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
, -1);
2046 gtk_table_attach_defaults (GTK_TABLE (table
), label
, 0, 3, row
, row
+1);
2049 label
= make_label(_("_Default:"), 0, 0.5);
2050 //----------------------------------------- l, r, t, b
2051 gtk_table_attach (GTK_TABLE (table
), label
, 1, 2, row
, row
+1, (GtkAttachOptions
) (GTK_FILL
), (GtkAttachOptions
) (0), 0, 0);
2053 hbox
= gtk_hbox_new(FALSE
, 0);
2054 gtk_table_attach (GTK_TABLE (table
), hbox
, 2, 3, row
, row
+1, (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), (GtkAttachOptions
) (GTK_EXPAND
|GTK_FILL
), 0, 0);
2056 widget
= make_string(label
);
2057 data
->ST_path_hbfile
= widget
;
2058 gtk_box_pack_start (GTK_BOX (hbox
), widget
, TRUE
, TRUE
, 0);
2060 widget
= gtk_button_new_with_label("...");
2061 data
->BT_path_hbfile
= widget
;
2062 gtk_box_pack_start (GTK_BOX (hbox
), widget
, FALSE
, FALSE
, 0);
2069 void plugin_execute_action(GtkTreeView
* treeview
, GtkTreePath
* path
, GtkTreeViewColumn
* col
, gpointer userdata
);
2072 toggle_plugin(GtkCellRendererToggle
*cell
, gchar
* path_str
, gpointer data
)
2074 GtkTreeModel
*model
= (GtkTreeModel
*)data
;
2076 GtkTreePath
*path
= gtk_tree_path_new_from_string(path_str
);
2078 const gchar
* plugin
;
2080 gtk_tree_model_get_iter(model
, &iter
, path
);
2081 gtk_tree_model_get(model
, &iter
, EXT_COLUMN_PLUGIN_NAME
, &plugin
, -1);
2083 gboolean enabled
= ext_is_plugin_loaded(plugin
);
2085 ext_unload_plugin(plugin
);
2088 enabled
= (ext_load_plugin(plugin
) == 0);
2090 ext_run_modal(_("Plugin Error"), _("The plugin failed to load properly."), "error");
2095 gtk_list_store_set(GTK_LIST_STORE (model
), &iter
, EXT_COLUMN_ENABLED
, enabled
, -1);
2098 gtk_tree_path_free(path
);
2102 void plugin_execute_action(GtkTreeView
* treeview
, GtkTreePath
* path
, GtkTreeViewColumn
* col
, gpointer userdata
)
2104 GtkTreeModel
* model
= gtk_tree_view_get_model(treeview
);
2107 if (gtk_tree_model_get_iter(model
, &iter
, path
)) {
2108 gchar
* plugin_filename
;
2109 gtk_tree_model_get(model
, &iter
, EXT_COLUMN_PLUGIN_NAME
, &plugin_filename
, -1);
2110 ext_execute_action(plugin_filename
);
2111 g_free(plugin_filename
);
2115 static GtkWidget
*defpref_page_plugins (struct defpref_data
*data
)
2117 GtkWidget
*container
;
2118 GtkListStore
*store
;
2122 container
= gtk_vbox_new(FALSE
, 0);
2124 store
= gtk_list_store_new(EXT_NUM_COLUMNS
, G_TYPE_BOOLEAN
, G_TYPE_STRING
, G_TYPE_STRING
, G_TYPE_STRING
);
2126 gchar
** plugins
= ext_list_plugins();
2128 for (plugins_it
= plugins
; *plugins_it
; ++plugins_it
) {
2130 gboolean enabled
= ext_is_plugin_loaded(*plugins_it
);
2131 GHashTable
* metadata
= ext_read_plugin_metadata(*plugins_it
);
2133 metadata
= g_hash_table_new(g_str_hash
, g_str_equal
);
2139 gchar
* name
= g_hash_table_lookup(metadata
, "name");
2140 if (!name
|| *name
== '\0') {
2143 name
= g_markup_escape_text(name
, -1);
2144 gchar
* label
= g_strdup_printf("<b>%s</b>", name
);
2145 gchar
* tooltip
= g_strdup_printf("<span size='x-large' weight='bold'>%s</span>", name
);
2149 gchar
* version
= g_hash_table_lookup(metadata
, "version");
2151 version
= g_markup_escape_text(version
, -1);
2153 label
= g_strdup_printf("%s %s", tmp
, version
);
2156 tooltip
= g_strdup_printf("%s %s", tmp
, version
);
2162 gchar
* abstract
= g_hash_table_lookup(metadata
, "abstract");
2164 abstract
= g_markup_escape_text(abstract
, -1);
2166 label
= g_strdup_printf("%s\n%s", tmp
, abstract
);
2172 gchar
* author
= g_hash_table_lookup(metadata
, "author");
2174 author
= g_markup_escape_text(author
, -1);
2176 tooltip
= g_strdup_printf("%s\n%s", tmp
, author
);
2182 gchar
* website
= g_hash_table_lookup(metadata
, "website");
2184 website
= g_markup_escape_text(website
, -1);
2186 tooltip
= g_strdup_printf("%s\n<b>%s:</b> %s", tmp
, _("Website"), website
);
2192 tmp
= ext_find_plugin(*plugins_it
);
2193 gchar
* full
= g_markup_escape_text(tmp
, -1);
2196 tooltip
= g_strdup_printf("%s\n<b>%s:</b> %s", tmp
, _("File"), full
);
2200 g_hash_table_unref(metadata
);
2202 gtk_list_store_append(store
, &it
);
2203 gtk_list_store_set(store
, &it
,
2204 EXT_COLUMN_ENABLED
, enabled
,
2205 EXT_COLUMN_LABEL
, label
,
2206 EXT_COLUMN_TOOLTIP
, tooltip
,
2207 EXT_COLUMN_PLUGIN_NAME
, *plugins_it
,
2213 g_strfreev(plugins
);
2215 view
= gtk_tree_view_new_with_model(GTK_TREE_MODEL(store
));
2216 g_object_unref(store
);
2218 g_signal_connect(view
, "row-activated", (GCallback
)plugin_execute_action
, NULL
);
2220 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(view
), TRUE
);
2221 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view
), TRUE
);
2222 gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(view
), EXT_COLUMN_TOOLTIP
);
2225 GtkTreeViewColumn
*col
;
2226 GtkCellRenderer
*renderer
;
2229 col
= gtk_tree_view_column_new();
2230 gtk_tree_view_column_set_title(col
, _("Enabled"));
2231 gtk_tree_view_column_set_sort_column_id(col
, EXT_COLUMN_ENABLED
);
2232 gtk_tree_view_append_column(GTK_TREE_VIEW(view
), col
);
2234 renderer
= gtk_cell_renderer_toggle_new();
2235 gtk_tree_view_column_pack_start(col
, renderer
, TRUE
);
2236 gtk_tree_view_column_add_attribute(col
, renderer
, "active", 0);
2237 g_signal_connect(renderer
, "toggled", G_CALLBACK(toggle_plugin
), store
);
2239 col
= gtk_tree_view_column_new();
2240 gtk_tree_view_column_set_title(col
, _("Plugin"));
2241 gtk_tree_view_column_set_sort_column_id(col
, EXT_COLUMN_LABEL
);
2242 gtk_tree_view_column_set_expand(col
, TRUE
);
2243 /*gtk_tree_view_column_set_sort_order(col, GTK_SORT_ASCENDING);*/
2244 gtk_tree_view_append_column(GTK_TREE_VIEW(view
), col
);
2246 renderer
= gtk_cell_renderer_text_new();
2247 g_object_set(renderer
, "ellipsize", PANGO_ELLIPSIZE_END
, NULL
);
2248 gtk_tree_view_column_pack_start(col
, renderer
, TRUE
);
2249 gtk_tree_view_column_add_attribute(col
, renderer
, "markup", EXT_COLUMN_LABEL
);
2251 data
->PI_plugin_columns
= view
;
2253 GtkWidget
* sw
= gtk_scrolled_window_new(NULL
, NULL
);
2254 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw
), GTK_SHADOW_ETCHED_IN
);
2255 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw
), GTK_POLICY_NEVER
, GTK_POLICY_AUTOMATIC
);
2256 gtk_container_add(GTK_CONTAINER(sw
), view
);
2258 gtk_box_pack_start(GTK_BOX(container
), sw
, TRUE
, TRUE
, 0);
2264 static void defpref_selection(GtkTreeSelection
*treeselection
, gpointer user_data
)
2266 struct defpref_data
*data
;
2267 GtkWidget
*notebook
;
2268 GtkTreeView
*treeview
;
2269 GtkTreeModel
*model
;
2272 GValue val
= { 0, };
2275 DB( g_print("\n[ui-pref] selection\n") );
2277 if (gtk_tree_selection_get_selected(treeselection
, &model
, &iter
))
2279 notebook
= GTK_WIDGET(user_data
);
2280 treeview
= gtk_tree_selection_get_tree_view(treeselection
);
2281 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(GTK_WIDGET(treeview
), GTK_TYPE_WINDOW
)), "inst_data");
2284 gtk_tree_model_get_value(model
, &iter
, LST_PREF_PAGE
, &val
);
2285 page
= g_value_get_int (&val
);
2286 DB( g_print(" - active is %d\n", page
) );
2287 g_value_unset (&val
);
2290 gtk_tree_model_get_value(model
, &iter
, LST_PREF_NAME
, &val
);
2291 gtk_label_set_text (GTK_LABEL (data
->label
), g_value_get_string (&val
));
2292 g_value_unset (&val
);
2294 gtk_tree_model_get_value(model
, &iter
, LST_PREF_ICON
, &val
);
2295 gtk_image_set_from_pixbuf (GTK_IMAGE (data
->image
),
2296 g_value_get_object (&val
));
2297 g_value_unset (&val
);
2301 gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook
), page
);
2303 //defpref_change_page(GTK_WIDGET(gtk_tree_selection_get_tree_view(treeselection)), GINT_TO_POINTER(page));
2310 ** set the notebook active page from treeview
2312 /*void defpref_change_page(GtkWidget *widget, gpointer user_data)
2314 struct defpref_data *data;
2315 gint page = GPOINTER_TO_INT(user_data);
2316 GtkTreeModel *model;
2319 DB( g_print("\n[ui-pref] page\n") );
2321 data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
2323 model = gtk_tree_view_get_model(GTK_TREE_VIEW(data->LV_page));
2331 gtk_notebook_set_current_page(GTK_NOTEBOOK(data->GR_page), page);
2337 ** add an empty new account to our temp GList and treeview
2339 static void defpref_clear(GtkWidget
*widget
, gpointer user_data
)
2341 struct defpref_data
*data
;
2344 data
= g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget
, GTK_TYPE_WINDOW
)), "inst_data");
2345 DB( g_print("\n(defpref_clear) (data=%p)\n", data
) );
2347 result
= ui_dialog_msg_question(
2348 GTK_WINDOW(data
->window
),
2349 _("Clear every preferences ?"),
2350 _("This will revert the preferences\nto its default values")
2352 if( result
== GTK_RESPONSE_YES
)
2354 homebank_pref_setdefault();
2361 // the window creation
2362 GtkWidget
*defpref_dialog_new (gint initial_selection
)
2364 struct defpref_data data
;
2365 GtkWidget
*window
, *content
, *mainvbox
;
2367 GtkWidget
*hbox
, *vbox
, *sw
, *widget
, *notebook
, *page
, *ebox
, *image
, *label
;
2369 window
= gtk_dialog_new_with_buttons (_("Preferences"),
2370 GTK_WINDOW(GLOBALS
->mainwindow
),
2373 GTK_RESPONSE_REJECT
,
2375 GTK_RESPONSE_ACCEPT
,
2378 data
.window
= window
;
2380 //store our window private data
2381 g_object_set_data(G_OBJECT(window
), "inst_data", (gpointer
)&data
);
2383 gtk_window_set_icon_name(GTK_WINDOW (window
), GTK_STOCK_PREFERENCES
);
2385 content
= gtk_dialog_get_content_area(GTK_DIALOG (window
));
2386 mainvbox
= gtk_vbox_new (FALSE
, 8);
2387 gtk_box_pack_start (GTK_BOX (content
), mainvbox
, TRUE
, TRUE
, 0);
2389 gtk_container_set_border_width(GTK_CONTAINER(mainvbox
), 8);
2391 hbox
= gtk_hbox_new (FALSE
, 8);
2392 gtk_box_pack_start (GTK_BOX (mainvbox
), hbox
, TRUE
, TRUE
, 0);
2395 vbox
= gtk_vbox_new (FALSE
, HB_BOX_SPACING
);
2396 gtk_box_pack_start (GTK_BOX (hbox
), vbox
, FALSE
, FALSE
, 0);
2399 sw
= gtk_scrolled_window_new (NULL
, NULL
);
2400 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw
), GTK_SHADOW_ETCHED_IN
);
2401 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw
), GTK_POLICY_NEVER
, GTK_POLICY_AUTOMATIC
);
2402 gtk_box_pack_start (GTK_BOX (vbox
), sw
, TRUE
, TRUE
, 0);
2403 widget
= pref_list_create();
2404 data
.LV_page
= widget
;
2405 gtk_container_add (GTK_CONTAINER (sw
), widget
);
2408 data
.BT_clear
= gtk_button_new_from_stock(GTK_STOCK_CLEAR
);
2409 gtk_box_pack_start (GTK_BOX (vbox
), data
.BT_clear
, FALSE
, TRUE
, 0);
2412 //right part : notebook
2413 vbox
= gtk_vbox_new (FALSE
, 12);
2414 gtk_box_pack_start (GTK_BOX (hbox
), vbox
, TRUE
, TRUE
, 0);
2415 gtk_widget_show (vbox
);
2417 ebox
= gtk_event_box_new();
2418 gtk_widget_set_state (ebox
, GTK_STATE_SELECTED
);
2419 gtk_box_pack_start (GTK_BOX (vbox
), ebox
, FALSE
, TRUE
, 0);
2420 gtk_widget_show (ebox
);
2422 hbox
= gtk_hbox_new (FALSE
, 6);
2423 gtk_container_set_border_width (GTK_CONTAINER (hbox
), 6);
2424 gtk_container_add (GTK_CONTAINER (ebox
), hbox
);
2425 gtk_widget_show (hbox
);
2427 label
= gtk_label_new (NULL
);
2428 gtk_misc_set_alignment (GTK_MISC (label
), 0.0, 0.5);
2430 gimp_label_set_attributes (GTK_LABEL (label
),
2431 PANGO_ATTR_SCALE
, PANGO_SCALE_LARGE
,
2432 PANGO_ATTR_WEIGHT
, PANGO_WEIGHT_BOLD
,
2435 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
2436 gtk_widget_show (label
);
2439 image
= gtk_image_new ();
2440 gtk_box_pack_end (GTK_BOX (hbox
), image
, FALSE
, FALSE
, 0);
2441 gtk_widget_show (image
);
2447 notebook
= gtk_notebook_new();
2448 data
.GR_page
= notebook
;
2449 gtk_widget_show(notebook
);
2450 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook
), FALSE
);
2451 gtk_notebook_set_show_border(GTK_NOTEBOOK(notebook
), FALSE
);
2452 gtk_box_pack_start (GTK_BOX (vbox
), notebook
, TRUE
, TRUE
, 0);
2464 page
= defpref_page_general(&data
);
2465 gtk_notebook_append_page (GTK_NOTEBOOK (notebook
), page
, NULL
);
2468 page
= defpref_page_interface(&data
);
2469 gtk_notebook_append_page (GTK_NOTEBOOK (notebook
), page
, NULL
);
2472 page
= defpref_page_transactions(&data
);
2473 gtk_notebook_append_page (GTK_NOTEBOOK (notebook
), page
, NULL
);
2476 page
= defpref_page_display(&data
);
2477 gtk_notebook_append_page (GTK_NOTEBOOK (notebook
), page
, NULL
);
2480 page
= defpref_page_import(&data
);
2481 gtk_notebook_append_page (GTK_NOTEBOOK (notebook
), page
, NULL
);
2484 page
= defpref_page_reports(&data
);
2485 gtk_notebook_append_page (GTK_NOTEBOOK (notebook
), page
, NULL
);
2488 page
= defpref_page_euro(&data
);
2489 gtk_notebook_append_page (GTK_NOTEBOOK (notebook
), page
, NULL
);
2492 page
= defpref_page_plugins(&data
);
2493 gtk_notebook_append_page (GTK_NOTEBOOK (notebook
), page
, NULL
);
2496 //todo:should move this
2497 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data
.CM_euro_enable
), PREFS
->euro_active
);
2499 //connect all our signals
2500 g_signal_connect (window
, "destroy", G_CALLBACK (gtk_widget_destroyed
), &window
);
2502 g_signal_connect (G_OBJECT (data
.BT_clear
), "clicked", G_CALLBACK (defpref_clear
), NULL
);
2505 g_signal_connect (data
.BT_path_hbfile
, "pressed", G_CALLBACK (defpref_pathselect
), GINT_TO_POINTER(1));
2506 g_signal_connect (data
.BT_path_import
, "pressed", G_CALLBACK (defpref_pathselect
), GINT_TO_POINTER(2));
2507 g_signal_connect (data
.BT_path_export
, "pressed", G_CALLBACK (defpref_pathselect
), GINT_TO_POINTER(3));
2509 g_signal_connect (data
.CY_colors
, "changed", G_CALLBACK (defpref_colorpreset
), NULL
);
2512 g_signal_connect (gtk_tree_view_get_selection(GTK_TREE_VIEW(data
.LV_page
)), "changed", G_CALLBACK (defpref_selection
), notebook
);
2514 g_signal_connect (data
.CM_euro_enable
, "toggled", G_CALLBACK (defpref_eurotoggle
), NULL
);
2516 g_signal_connect (data
.CY_euro_preset
, "changed", G_CALLBACK (defpref_europreset
), NULL
);
2519 g_signal_connect (data
.ST_datefmt
, "changed", G_CALLBACK (defpref_date_sample
), NULL
);
2522 g_signal_connect (data
.ST_num_symbol
, "changed", G_CALLBACK (defpref_numberbase_sample
), NULL
);
2523 g_signal_connect (data
.CM_num_isprefix
, "toggled", G_CALLBACK (defpref_numberbase_sample
), NULL
);
2524 g_signal_connect (data
.ST_num_decimalchar
, "changed", G_CALLBACK (defpref_numberbase_sample
), NULL
);
2525 g_signal_connect (data
.ST_num_groupingchar
, "changed", G_CALLBACK (defpref_numberbase_sample
), NULL
);
2526 g_signal_connect (data
.NB_num_fracdigits
, "value-changed", G_CALLBACK (defpref_numberbase_sample
), NULL
);
2529 g_signal_connect (data
.ST_euro_symbol
, "changed", G_CALLBACK (defpref_numbereuro_sample
), NULL
);
2530 g_signal_connect (data
.CM_euro_isprefix
, "toggled", G_CALLBACK (defpref_numbereuro_sample
), NULL
);
2531 g_signal_connect (data
.ST_euro_decimalchar
, "changed", G_CALLBACK (defpref_numbereuro_sample
), NULL
);
2532 g_signal_connect (data
.ST_euro_groupingchar
, "changed", G_CALLBACK (defpref_numbereuro_sample
), NULL
);
2533 g_signal_connect (data
.NB_euro_fracdigits
, "value-changed", G_CALLBACK (defpref_numbereuro_sample
), NULL
);
2535 //g_signal_connect (data.BT_default, "pressed", G_CALLBACK (defpref_currency_change), NULL);
2538 //setup, init and show window
2539 //defhbfile_setup(&data);
2540 //defhbfile_update(data.LV_arc, NULL);
2542 defpref_eurotoggle(window
, NULL
);
2546 gtk_window_resize(GTK_WINDOW(window
), 640, 256);
2550 GtkTreePath
*path
= gtk_tree_path_new_from_indices(initial_selection
, -1);
2553 gtk_tree_selection_select_path (gtk_tree_view_get_selection(GTK_TREE_VIEW(data
.LV_page
)), path
);
2557 gtk_tree_path_free(path
);
2559 gtk_widget_show_all (window
);
2560 gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook
), initial_selection
);
2567 result
= gtk_dialog_run (GTK_DIALOG (window
));
2571 case GTK_RESPONSE_ACCEPT
:
2572 old_lang
= g_strdup(PREFS
->language
);
2574 homebank_pref_save();
2575 ui_mainwindow_update(GLOBALS
->mainwindow
, GINT_TO_POINTER(UF_BALANCE
+UF_VISUAL
));
2577 DB( g_print("old='%s' new='%s'\n", old_lang
, PREFS
->language
) );
2579 if(g_ascii_strncasecmp(old_lang
== NULL
? "" : old_lang
, PREFS
->language
== NULL
? "" : PREFS
->language
, -1) != 0)
2581 ui_dialog_msg_infoerror(GTK_WINDOW(window
), GTK_MESSAGE_INFO
,
2583 _("You will have to restart HomeBank\nfor the language change to take effect.")
2593 // cleanup and destroy
2594 //defhbfile_cleanup(&data, result);
2595 gtk_widget_destroy (window
);
2600 // -------------------------------
2603 GtkWidget
*pref_list_create(void)
2605 GtkListStore
*store
;
2607 GtkCellRenderer
*renderer
;
2608 GtkTreeViewColumn
*column
;
2610 GtkWidget
*cellview
;
2613 /* create list store */
2614 store
= gtk_list_store_new(
2623 view
= gtk_tree_view_new_with_model(GTK_TREE_MODEL(store
));
2624 g_object_unref(store
);
2626 //gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE);
2627 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW (view
), FALSE
);
2628 gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(view
)), GTK_SELECTION_SINGLE
);
2630 /* column 1: icon */
2631 column
= gtk_tree_view_column_new();
2632 renderer
= gtk_cell_renderer_pixbuf_new ();
2633 gtk_tree_view_column_pack_start(column
, renderer
, FALSE
);
2634 gtk_tree_view_column_set_attributes(column
, renderer
, "pixbuf", LST_PREF_SMALLPIXBUF
, NULL
);
2636 renderer
= gtk_cell_renderer_text_new ();
2637 gtk_tree_view_column_pack_start(column
, renderer
, TRUE
);
2638 gtk_tree_view_column_set_attributes(column
, renderer
, "text", LST_PREF_NAME
, NULL
);
2640 gtk_tree_view_append_column (GTK_TREE_VIEW(view
), column
);
2643 cellview
= gtk_cell_view_new ();
2645 //populate our combobox model
2646 for(i
=0;i
<PREF_MAX
;i
++)
2648 GdkPixbuf
*small_pixbuf
= NULL
;
2650 gtk_list_store_append(store
, &iter
);
2653 if( pref_pixbuf[i] )
2654 small_pixbuf = gdk_pixbuf_scale_simple (pref_pixbuf[i], 24, 24, GDK_INTERP_BILINEAR);
2656 small_pixbuf
= gtk_widget_render_icon (cellview
, pref_pixname
[i
], GTK_ICON_SIZE_DND
, NULL
);
2658 gtk_list_store_set(store
, &iter
,
2659 LST_PREF_SMALLPIXBUF
, small_pixbuf
,
2660 LST_PREF_ICON
, pref_pixbuf
[i
],
2661 LST_PREF_NAME
, _(pref_name
[i
]),
2666 gtk_widget_destroy (cellview
);
2673 void free_pref_icons(void)
2677 for(i
=0;i
<PREF_MAX
;i
++)
2679 if(pref_pixbuf
[i
] != NULL
)
2680 g_object_unref(pref_pixbuf
[i
]);
2684 void load_pref_icons(void)
2686 //GError *error = NULL;
2687 GtkWidget
*cellview
;
2690 cellview
= gtk_cell_view_new ();
2692 for(i
=0;i
<PREF_MAX
;i
++)
2694 pref_pixbuf
[i
] = gtk_widget_render_icon (cellview
, pref_pixname
[i
], GTK_ICON_SIZE_DIALOG
, NULL
);
2697 gtk_widget_destroy (cellview
);
2701 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
2704 static gchar
*list_txn_column_label
[] = {
2721 //static gint n_ope_list_columns = G_N_ELEMENTS (ope_list_columns);
2725 list_txn_colpref_toggled_cell_data_function (GtkCellRendererToggle
*cell
,
2729 GtkTreeModel
*model
= (GtkTreeModel
*)data
;
2731 GtkTreePath
*path
= gtk_tree_path_new_from_string (path_str
);
2734 /* get toggled iter */
2735 gtk_tree_model_get_iter (model
, &iter
, path
);
2736 gtk_tree_model_get (model
, &iter
, COLUMN_VISIBLE
, &fixed
, -1);
2738 /* do something with the value */
2742 gtk_list_store_set (GTK_LIST_STORE (model
), &iter
, COLUMN_VISIBLE
, fixed
, -1);
2745 gtk_tree_path_free (path
);
2749 static void list_txn_colpref_get(GtkTreeView
*treeview
, gint
*columns
)
2751 GtkTreeModel
*model
;
2757 DB( g_print("[lst_txn-colpref] store column order \n") );
2760 model
= gtk_tree_view_get_model(GTK_TREE_VIEW(treeview
));
2761 valid
= gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model
), &iter
);
2765 gtk_tree_model_get(GTK_TREE_MODEL(model
), &iter
,
2766 COLUMN_VISIBLE
, &visible
,
2770 DB( g_print(" - column %d: %d\n",id
, visible
) );
2771 // start at index 2 (status, date always displayed
2772 columns
[i
+2] = visible
== TRUE
? id
: -id
;
2774 /* Make iter point to the next row in the list store */
2775 valid
= gtk_tree_model_iter_next(GTK_TREE_MODEL(model
), &iter
);
2784 GtkWidget
*list_txn_colprefcreate(void)
2786 GtkListStore
*store
;
2788 GtkCellRenderer
*renderer
;
2789 GtkTreeViewColumn
*column
;
2793 DB( g_print("[lst_txn-colpref] create\n") );
2796 /* create list store */
2797 store
= gtk_list_store_new(
2805 for(i
=0 ; i
< NUM_LST_DSPOPE
-1; i
++ ) //-1 cause account column avoid
2810 DB( g_print("eval %d, %s\n", i
, list_txn_column_label
[i
]) );
2812 if(i
<= LST_DSPOPE_DATE
) // status, date always displayed
2815 //[i-1] here because lst_ope_columns[] do not store LST_DSPOPE_DATAS
2816 id
= ABS(PREFS
->lst_ope_columns
[i
-1]);
2817 if(id
== 0) id
= i
; //if we pass here, new column or weird into pref file
2818 visible
= (PREFS
->lst_ope_columns
[i
-1] > 0) ? TRUE
: FALSE
;
2821 DB( g_print(" - pos=%2d, id=%2d - %d '%s'\n", i
, id
, visible
, list_txn_column_label
[id
]) );
2823 gtk_list_store_append (store
, &iter
);
2824 gtk_list_store_set (store
, &iter
,
2825 COLUMN_VISIBLE
, visible
,
2826 COLUMN_NAME
, list_txn_column_label
[id
],
2833 view
= gtk_tree_view_new_with_model(GTK_TREE_MODEL(store
));
2834 g_object_unref(store
);
2838 renderer
= gtk_cell_renderer_toggle_new ();
2839 column
= gtk_tree_view_column_new_with_attributes (_("Visible"),
2841 "active", COLUMN_VISIBLE
,
2843 gtk_tree_view_append_column (GTK_TREE_VIEW(view
), column
);
2845 g_signal_connect (renderer
, "toggled",
2846 G_CALLBACK (list_txn_colpref_toggled_cell_data_function
), store
);
2849 renderer
= gtk_cell_renderer_text_new ();
2850 column
= gtk_tree_view_column_new_with_attributes (_("Column"),
2852 "text", COLUMN_NAME
,
2854 gtk_tree_view_append_column (GTK_TREE_VIEW(view
), column
);
2856 gtk_tree_view_set_reorderable (GTK_TREE_VIEW(view
), TRUE
);
2863 static void list_ext_colpref_get(GtkTreeView
*treeview
, GList
**columns
)
2865 GtkTreeModel
*model
;
2868 g_list_free_full(*columns
, g_free
);
2871 model
= gtk_tree_view_get_model(GTK_TREE_VIEW(treeview
));
2873 gboolean valid
= gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model
), &iter
);
2875 gboolean enabled
= FALSE
;
2878 gtk_tree_model_get(GTK_TREE_MODEL(model
), &iter
,
2879 EXT_COLUMN_ENABLED
, &enabled
,
2880 EXT_COLUMN_PLUGIN_NAME
, &name
,
2884 *columns
= g_list_append(*columns
, g_strdup(name
));
2887 valid
= gtk_tree_model_iter_next(GTK_TREE_MODEL(model
), &iter
);