/* HomeBank -- Free, easy, personal accounting for everyone.
- * Copyright (C) 1995-2014 Maxime DOYEN
+ * Copyright (C) 1995-2019 Maxime DOYEN
*
* This file is part of HomeBank.
*
#include "homebank.h"
#include "ui-pref.h"
-#include "dsp_mainwindow.h"
+#include "dsp-mainwindow.h"
#include "gtk-chart-colors.h"
+#include "ext.h"
+
+#include "ui-currency.h"
+
/****************************************************************************/
/* Debug macros */
enum {
- LST_PREF_SMALLPIXBUF,
- LST_PREF_ICON,
+ LST_PREF_ICONNAME,
LST_PREF_NAME,
LST_PREF_PAGE,
LST_PREF_MAX
};
-enum
-{
- COLUMN_VISIBLE,
- COLUMN_NAME,
- COLUMN_ID,
- NUM_COLUMNS
-};
enum
{
- PREF_GENERAL,
- PREF_INTERFACE,
- PREF_COLUMNS,
- PREF_DISPLAY,
- PREF_IMPORT,
- PREF_REPORT,
- PREF_EURO,
- PREF_MAX
+ EXT_COLUMN_ENABLED = 0,
+ EXT_COLUMN_LABEL,
+ EXT_COLUMN_TOOLTIP,
+ EXT_COLUMN_PLUGIN_NAME,
+ EXT_NUM_COLUMNS
};
-GdkPixbuf *pref_pixbuf[PREF_MAX];
-
-static gchar *pref_pixname[PREF_MAX] = {
+static gchar *pref_iconname[PREF_MAX] = {
"prf-general",
"prf-interface",
+"prf-locale",
"prf-columns",
-"prf-display",
+//"prf-display",
"prf-import",
"prf-report",
+"prf-backup",
+"prf-folder",
"prf-euro", // to be renamed
+"prf-plugins",
//"prf_charts.svg"
};
static gchar *pref_name[PREF_MAX] = {
N_("General"),
N_("Interface"),
+N_("Locale"),
N_("Transactions"),
-N_("Display format"),
N_("Import/Export"),
N_("Report"),
-N_("Euro minor")
+N_("Backup"),
+N_("Folders"),
+N_("Euro minor"),
+N_("Plugins")
//
};
NULL
};
+static gchar *CYA_GRID_LINES[] = {
+N_("None"),
+N_("Horizontal"),
+N_("Vertical"),
+N_("Both"),
+NULL
+};
+
+
gchar *CYA_TANGO_COLORS[] = {
"----",
N_("Tango light"),
};
gchar *CYA_IMPORT_OFXNAME[] = {
+N_("Ignore"),
N_("Memo"),
N_("Payee"),
+N_("Info"),
NULL
};
N_("Ignore"),
N_("Append to Info"),
N_("Append to Memo"),
+N_("Append to Payee"),
+NULL
+};
+
+gchar *CYA_IMPORT_CSVSEPARATOR[] = {
+N_("Tab"),
+N_("Comma"),
+N_("Semicolon"),
+N_("Space"),
NULL
};
+
extern gchar *CYA_CHART_COLORSCHEME[];
extern gchar *CYA_MONTHS[];
-typedef struct
-{
- gchar *iso;
- gchar *name;
- gdouble value;
- //gchar *prefix_symbol; /* max symbol is 3 digits in unicode */
- //gchar *suffix_symbol; /* but mostly is 1 digit */
- gchar *symbol;
- gboolean is_prefix;
- gchar *decimal_char;
- gchar *grouping_char;
- gshort frac_digits;
-} EuroParams;
+
/*
*/
static EuroParams euro_params[] =
{
-// , rate , symb , prfx , dec, grp, frac
+// , rate , symb , prfx , dec, grp, frac
// ---------------------------------------------------------------------
- { "" , "--------" , 1.0 , "" , FALSE, ",", ".", 2 },
- { "ATS", "Austria" , 13.7603 , "S" , TRUE , ",", ".", 2 }, // -S 1.234.567,89
- { "BEF", "Belgium" , 40.3399 , "BF" , TRUE , ",", ".", 2 }, // BF 1.234.567,89 -
- { "FIM", "Finland" , 5.94573 , "mk" , FALSE, ",", " ", 2 }, // -1 234 567,89 mk
- { "FRF", "France" , 6.55957 , "F" , FALSE, ",", " ", 2 }, // -1 234 567,89 F
- { "DEM", "Germany" , 1.95583 , "DM" , FALSE, ",", ".", 2 }, // -1.234.567,89 DM
- { "GRD", "Greece" , 340.750 , "d" , TRUE , ".", ",", 2 }, // ??
- { "IEP", "Ireland" , 0.787564 , "£" , TRUE , ".", ",", 2 }, // -£1,234,567.89
- { "ITL", "Italy" , 1936.27 , "L" , TRUE , "" , ".", 0 }, // L -1.234.567
- { "LUF", "Luxembourg" , 40.3399 , "LU" , TRUE , ",", ".", 2 }, // LU 1.234.567,89 -
- { "NLG", "Netherlands" , 2.20371 , "F" , TRUE , ",", ".", 2 }, // F 1.234.567,89-
- { "PTE", "Portugal" , 200.482 , "Esc.", FALSE, "$", ".", 2 }, // -1.234.567$89 Esc.
- { "ESP", "Spain" , 166.386 , "Pts" , TRUE , "" , ".", 0 }, // -Pts 1.234.567
-/* 2007 */
- { "SIT", "Slovenia" , 239.640 , "tol" , TRUE , ",", ".", 2 }, //
-/* 2008 */
- { "CYP", "Cyprus" , 0.585274 , "" , TRUE , ",", "" , 2 }, //
- { "MTL", "Malta" , 0.429300 , "" , TRUE , ",", "" , 2 }, //
-/* 2009 */
- { "SKK", "Slovaquia" , 30.12600 , "Sk" , FALSE, ",", " ", 2 }, //
-/* 2011 */
- { "EEK", "Estonia" , 15.6466 , "kr" , FALSE, ",", " ", 2 }, //
-/* 2014 */
- { "LVL", "Latvia" , 0.702804 , "lat.", FALSE, ",", "" , 2 }, // 2014 target for euro earliest
-
-/* future */
- { "CZK", "Czech republic", 28.36 , "Kč" , FALSE, ",", " ", 2 }, // non-fixé - 2015 earliest
- { "HUF", "Hungary" , 261.51 , "Ft" , TRUE , ",", " ", 2 }, // non-fixé - No current target for euro
- { "LTL", "Lithuania" , 3.45280 , "Lt." , TRUE , ",", "" , 2 }, // 2014 target for euro earliest
- { "PLN", "Poland" , 0.25 , "zł" , FALSE, ",", "" , 2 }, // non-fixé - No current target for euro
- { "BGN", "Bulgaria" , 1.95583 , "лв." , TRUE , ",", " ", 2 }, // non-fixé - 2014 target for euro
- { "RON", "Romania" , 3.5155 , "Leu" , FALSE, ",", ".", 2 }, // non-fixé - 2015 target for euro earliest
- { "HRK", "Croatia" , 1.0000 , "kn" , FALSE, "" , ".", 0 }, // non-fixé - 2015 target for euro earliest
-
+ { 0, "" , "--------" , 1.0 , "" , FALSE, ",", ".", 2 },
+ { 1, "ATS", "Austria" , 13.7603 , "S" , TRUE , ",", ".", 2 }, // -S 1.234.567,89
+ { 2, "BEF", "Belgium" , 40.3399 , "BF" , TRUE , ",", ".", 2 }, // BF 1.234.567,89 -
+ { 20, "BGN", "Bulgaria" , 1.95583 , "лв." , TRUE , ",", " ", 2 }, // non-fixé - 2014 target for euro
+ { 24, "HRK", "Croatia" , 1.0000 , "kn" , FALSE, "" , ".", 0 }, // non-fixé - 2015 target for euro earliest
+ { 14, "CYP", "Cyprus" , 0.585274 , "£" , TRUE , ",", "" , 2 }, //
+ { 23, "CZK", "Czech Republic" , 28.36 , "Kč" , FALSE, ",", " ", 2 }, // non-fixé - 2015 earliest
+ // Denmark
+ { 17, "EEK", "Estonia" , 15.6466 , "kr" , FALSE, ",", " ", 2 }, //
+ { 3, "FIM", "Finland" , 5.94573 , "mk" , FALSE, ",", " ", 2 }, // -1 234 567,89 mk
+ { 4, "FRF", "France" , 6.55957 , "F" , FALSE, ",", " ", 2 }, // -1 234 567,89 F
+ { 5, "DEM", "Germany" , 1.95583 , "DM" , FALSE, ",", ".", 2 }, // -1.234.567,89 DM
+ { 6, "GRD", "Greece" , 340.750 , "d" , TRUE , ".", ",", 2 }, // ??
+ { 21, "HUF", "Hungary" , 261.51 , "Ft" , TRUE , ",", " ", 2 }, // non-fixé - No current target for euro
+ { 7, "IEP", "Ireland" , 0.787564 , "£" , TRUE , ".", ",", 2 }, // -£1,234,567.89
+ { 8, "ITL", "Italy" , 1936.27 , "L" , TRUE , "" , ".", 0 }, // L -1.234.567
+ { 18, "LVL", "Latvia" , 0.702804 , "lat.", FALSE, ",", "" , 2 }, // jan. 2014
+ { 19, "LTL", "Lithuania" , 3.45280 , "Lt" , FALSE, ",", "" , 2 }, // jan. 2015
+ { 9, "LUF", "Luxembourg" , 40.3399 , "LU" , TRUE , ",", ".", 2 }, // LU 1.234.567,89 -
+ { 15, "MTL", "Malta" , 0.429300 , "Lm" , TRUE , ",", "" , 2 }, //
+ { 10, "NLG", "Netherlands" , 2.20371 , "F" , TRUE , ",", ".", 2 }, // F 1.234.567,89-
+ { 25, "PLN", "Poland" , 0.25 , "zł" , FALSE, ",", "" , 2 }, // non-fixé - No current target for euro
+ { 11, "PTE", "Portugal" , 200.482 , "Esc.", FALSE, "$", ".", 2 }, // -1.234.567$89 Esc.
+ { 22, "RON", "Romania" , 3.5155 , "Leu" , FALSE, ",", ".", 2 }, // non-fixé - 2015 target for euro earliest
+ { 16, "SKK", "Slovak Republic", 30.12600 , "Sk" , FALSE, ",", " ", 2 }, //
+ { 13, "SIT", "Slovenia" , 239.640 , "tol" , TRUE , ",", ".", 2 }, //
+ { 12, "ESP", "Spain" , 166.386 , "Pts" , TRUE , "" , ".", 0 }, // -Pts 1.234.567
+ //Sweden
+ //United Kingdom
// { " ", "" , 1.00000 , "" , "" , FALSE, ",", "", 2 },
-
};
-GtkWidget *pref_list_create(void);
-GtkWidget *list_txn_colprefcreate(void);
-
-static void list_txn_colpref_get(GtkTreeView *treeview, gboolean *columns);
-
-
-
+static void list_ext_colpref_get(GtkTreeView *treeview, GList **columns);
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
-typedef struct
-{
- gchar *locale;
- gchar *name;
-
-} LangName;
+
static LangName languagenames[] =
{
{ "an", "Aragonese" },
{ "ar", "Arabic" },
{ "as", "Assamese" },
- { "ast", "Asturian, Bable, Leonese, Asturleonese" },
+ { "ast", "Asturian, Bable, Leonese, Asturleonese" },
{ "av", "Avaric" },
{ "ay", "Aymara" },
{ "az", "Azerbaijani" },
{ "na", "Nauru" },
{ "nb", "Norwegian Bokmål" },
{ "nd", "North Ndebele" },
- { "nds", "Low German, Low Saxon" },
+ { "nds", "Low German, Low Saxon" },
{ "ne", "Nepali" },
{ "ng", "Ndonga" },
{ "nl", "Dutch" },
};
+static GtkWidget *pref_list_create(void);
+
+
static gint
ui_language_combobox_compare_func (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer userdata)
{
}
-static gchar *ui_language_combobox_get_active_id(GtkComboBox *combobox)
-{
-GtkTreeModel *model;
-GtkTreeIter iter;
-gchar *id = 0;
-
- if( gtk_combo_box_get_active_iter(GTK_COMBO_BOX(combobox), &iter) )
- {
- model = gtk_combo_box_get_model(GTK_COMBO_BOX(combobox));
- gtk_tree_model_get (GTK_TREE_MODEL(model), &iter,
- 0, &id,
- -1);
- }
-
- return id;
-}
-
-
-static gint ui_language_combobox_set_active_id(GtkComboBox *combobox, gchar *id)
-{
-GtkTreeModel *model;
-GtkTreeIter iter;
-gboolean valid;
-gchar *tmp_id;
-gint i;
-
- model = gtk_combo_box_get_model(GTK_COMBO_BOX(combobox));
- valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter);
- i = 0;
- while (valid)
- {
- gtk_tree_model_get(GTK_TREE_MODEL(model), &iter,
- 0, &tmp_id,
- -1);
-
- if( tmp_id != NULL)
- {
- if( g_ascii_strncasecmp(id, tmp_id, -1) == 0 )
- {
- gtk_combo_box_set_active_iter(combobox, &iter);
- return i;
- }
- }
-
- valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter);
- i++;
- }
- return i;
-}
-
-
static GtkWidget *
ui_language_combobox_new(GtkWidget *label)
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), renderer, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer, "text", 1, NULL);
+ gtk_combo_box_set_id_column( GTK_COMBO_BOX(combobox), 0);
+
g_object_unref(store);
if(label)
gtk_label_set_mnemonic_widget (GTK_LABEL(label), combobox);
- //gtk_widget_set_size_request(comboboxentry, HB_MINWIDTH_COMBO, -1);
ui_language_combobox_populate(combobox);
gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 0);
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
-
-
-
-
-/*
-**
-*/
-static GtkWidget *make_euro_presets(GtkWidget *label)
+static gint ui_euro_combobox_id_to_active(gint id)
{
-GtkWidget *combobox;
-guint i;
+guint i, retval;
- DB( g_print("\n[ui-pref] make euro preset\n") );
+ DB( g_print("\n[ui-pref] ui_euro_combobox_id_to_active\n") );
- combobox = gtk_combo_box_text_new();
+ retval = 0;
for (i = 0; i < G_N_ELEMENTS (euro_params); i++)
{
- gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combobox), euro_params[i].name);
+ if( euro_params[i].id == id )
+ {
+ retval = i;
+ DB( g_print("- id (country)=%d => %d - %s\n", id, i, euro_params[i].name) );
+ break;
+ }
}
- gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 0);
- if(label)
- gtk_label_set_mnemonic_widget (GTK_LABEL(label), combobox);
-
- return combobox;
+ return retval;
}
-/*
-static defpref_currency_display(GtkWidget *widget, gpointer user_data)
+
+
+static gint ui_euro_combobox_active_to_id(gint active)
{
-struct defpref_data *data;
-struct iso4217format *curfmt;
+gint id;
- DB( g_print("\n[ui-pref] display default currency\n") );
+ DB( g_print("\n[ui-pref] ui_euro_combobox_active_to_id\n") );
- data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
+ DB( g_print("- to %d\n", active) );
- curfmt = iso4217format_get(PREFS->curr_default);
- if(curfmt != NULL)
+ id = 0;
+ if( active < (gint)G_N_ELEMENTS (euro_params) )
{
- gchar *name = g_strdup_printf("%s (%s)", curfmt->curr_iso_code, iso4217_get_name(curfmt->curr_iso_code));
-
- gtk_label_set_label (data->LB_default, name);
- g_free(name);
+ id = euro_params[active].id;
+ DB( g_print("- id (country)=%d '%s'\n", id, euro_params[active].name) );
}
-
+ return id;
}
-static void defpref_currency_change(GtkWidget *widget, gpointer user_data)
+static GtkWidget *ui_euro_combobox_new(GtkWidget *label)
{
-struct defpref_data *data;
-struct iso4217format *curfmt;
-
- DB( g_print("\n[ui-pref] chnage default currency\n") );
-
- data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
-
- curfmt = ui_cur_select_dialog_new(data->window);
+GtkWidget *combobox;
+guint i;
- DB( g_print("(cur) return %s\n", curfmt) );
+ DB( g_print("\n[ui-pref] make euro preset\n") );
- if( curfmt != NULL )
+ combobox = gtk_combo_box_text_new();
+ for (i = 0; i < G_N_ELEMENTS (euro_params); i++)
{
- g_free(PREFS->curr_default);
- PREFS->curr_default = g_strdup(curfmt->culture);
-
- defpref_currency_display(widget, NULL);
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combobox), euro_params[i].name);
}
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 0);
-}
-*/
+ if(label)
+ gtk_label_set_mnemonic_widget (GTK_LABEL(label), combobox);
+ return combobox;
+}
static void defpref_pathselect(GtkWidget *widget, gpointer user_data)
switch( type )
{
- case 1:
+ case PRF_PATH_WALLET:
path = &PREFS->path_hbfile;
entry = data->ST_path_hbfile;
title = _("Choose a default HomeBank files folder");
break;
- case 2:
+ case PRF_PATH_IMPORT:
path = &PREFS->path_import;
entry = data->ST_path_import;
title = _("Choose a default import folder");
break;
- case 3:
+ case PRF_PATH_EXPORT:
path = &PREFS->path_export;
entry = data->ST_path_export;
title = _("Choose a default export folder");
}
-
/*
** update the number sample label
*/
-static void defpref_numberbase_sample(GtkWidget *widget, gpointer user_data)
+static void defpref_numbereuro_sample(GtkWidget *widget, gpointer user_data)
{
struct defpref_data *data;
-struct CurrencyFmt cur;
+Currency cur;
gchar formatd_buf[G_ASCII_DTOSTR_BUF_SIZE];
-gchar buf[128], *ptr;
+gchar buf[128];
DB( g_print("\n[ui-pref] number sample\n") );
data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
- cur.symbol = (gchar *)gtk_entry_get_text(GTK_ENTRY(data->ST_num_symbol));
- cur.is_prefix = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_num_isprefix));
- cur.decimal_char = (gchar *)gtk_entry_get_text(GTK_ENTRY(data->ST_num_decimalchar));
- cur.grouping_char = (gchar *)gtk_entry_get_text(GTK_ENTRY(data->ST_num_groupingchar));
- cur.frac_digits = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->NB_num_fracdigits));
- g_snprintf(cur.format, 8-1, "%%.%df", cur.frac_digits);
+ cur.symbol = (gchar *)gtk_entry_get_text(GTK_ENTRY(data->ST_euro_symbol));
+ cur.sym_prefix = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_euro_isprefix));
+ cur.decimal_char = (gchar *)gtk_entry_get_text(GTK_ENTRY(data->ST_euro_decimalchar));
+ cur.grouping_char = (gchar *)gtk_entry_get_text(GTK_ENTRY(data->ST_euro_groupingchar));
+ cur.frac_digits = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->NB_euro_fracdigits));
- ptr = cur.monfmt;
- if(cur.is_prefix)
- {
- ptr = g_stpcpy(ptr, cur.symbol);
- ptr = g_stpcpy(ptr, " ");
- }
- ptr = g_stpcpy(ptr, "%s");
- if(!cur.is_prefix)
- {
- ptr = g_stpcpy(ptr, " ");
- ptr = g_stpcpy(ptr, cur.symbol);
- }
+ da_cur_initformat (&cur);
DB( g_print("fmt: %s\n", cur.format) );
- DB( g_print("monfmt: %s\n", cur.monfmt) );
- g_ascii_formatd(formatd_buf, sizeof (formatd_buf), cur.format, 12345.67);
-
- real_mystrfmon(buf, 127, formatd_buf, &cur);
- gtk_label_set_text(GTK_LABEL(data->LB_numberbase), buf);
+ g_ascii_formatd(formatd_buf, sizeof (formatd_buf), cur.format, HB_NUMBER_SAMPLE);
+ hb_str_formatd(buf, 127, formatd_buf, &cur, TRUE);
+
+ gtk_label_set_text(GTK_LABEL(data->LB_numbereuro), buf);
}
+
/*
-** update the number sample label
+** enable/disable euro
*/
-static void defpref_numbereuro_sample(GtkWidget *widget, gpointer user_data)
+static void defpref_eurotoggle(GtkWidget *widget, gpointer user_data)
{
struct defpref_data *data;
-struct CurrencyFmt cur;
-gchar formatd_buf[G_ASCII_DTOSTR_BUF_SIZE];
-gchar buf[128], *ptr;
+gboolean sensitive;
- DB( g_print("\n[ui-pref] number sample\n") );
+ DB( g_print("\n[ui-pref] euro toggle\n") );
data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
- cur.symbol = (gchar *)gtk_entry_get_text(GTK_ENTRY(data->ST_euro_symbol));
- cur.is_prefix = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_euro_isprefix));
- cur.decimal_char = (gchar *)gtk_entry_get_text(GTK_ENTRY(data->ST_euro_decimalchar));
- cur.grouping_char = (gchar *)gtk_entry_get_text(GTK_ENTRY(data->ST_euro_groupingchar));
- cur.frac_digits = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->NB_euro_fracdigits));
- g_snprintf(cur.format, 8-1, "%%.%df", cur.frac_digits);
-
- ptr = cur.monfmt;
- if(cur.is_prefix)
- {
- ptr = g_stpcpy(ptr, cur.symbol);
- ptr = g_stpcpy(ptr, " ");
- }
- ptr = g_stpcpy(ptr, "%s");
- if(!cur.is_prefix)
- {
- ptr = g_stpcpy(ptr, " ");
- ptr = g_stpcpy(ptr, cur.symbol);
- }
-
- DB( g_print("fmt: %s\n", cur.format) );
- DB( g_print("monfmt: %s\n", cur.monfmt) );
-
- g_ascii_formatd(formatd_buf, sizeof (formatd_buf), cur.format, 12345.67);
+ sensitive = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_euro_enable));
+
+ gtk_widget_set_sensitive(data->GRP_currency , sensitive);
+ gtk_widget_set_sensitive(data->GRP_rate , sensitive);
+ gtk_widget_set_sensitive(data->GRP_format , sensitive);
+}
+
+
+/*
+** set euro value widget from a country
+*/
+static void defpref_eurosetcurrency(GtkWidget *widget, gint country)
+{
+struct defpref_data *data;
+EuroParams *euro;
+gchar *buf;
+gint active;
- real_mystrfmon(buf, 127, formatd_buf, &cur);
- gtk_label_set_text(GTK_LABEL(data->LB_numbereuro), buf);
+ DB( g_print("\n[ui-pref] eurosetcurrency\n") );
+ data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
+
+ active = ui_euro_combobox_id_to_active(country);
+ euro = &euro_params[active];
+ buf = g_strdup_printf("%s - %s", euro->iso, euro->name);
+ gtk_label_set_markup(GTK_LABEL(data->ST_euro_country), buf);
+ g_free(buf);
}
/*
-** enable/disable euro
+** set euro value widget from a country
*/
-static void defpref_eurotoggle(GtkWidget *widget, gpointer user_data)
+static void defpref_europreset(GtkWidget *widget, gpointer user_data)
{
struct defpref_data *data;
-gboolean bool;
+gint active;
- DB( g_print("\n[ui-pref] euro toggle\n") );
+ DB( g_print("\n[ui-pref] euro preset\n") );
data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
- bool = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_euro_enable));
+ active = gtk_combo_box_get_active (GTK_COMBO_BOX(data->CY_euro_preset));
+ data->country = ui_euro_combobox_active_to_id (active);;
+ defpref_eurosetcurrency(widget, data->country);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_euro_value), euro_params[active].value);
- gtk_widget_set_sensitive(data->CY_euro_preset , bool);
- gtk_widget_set_sensitive(data->ST_euro_country , bool);
- gtk_widget_set_sensitive(data->NB_euro_value , bool);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_euro_fracdigits), euro_params[active].frac_digits);
- gtk_widget_set_sensitive(data->ST_euro_symbol, bool);
- gtk_widget_set_sensitive(data->CM_euro_isprefix, bool);
- gtk_widget_set_sensitive(data->ST_euro_decimalchar, bool);
- gtk_widget_set_sensitive(data->ST_euro_groupingchar, bool);
- gtk_widget_set_sensitive(data->NB_euro_fracdigits, bool);
- gtk_widget_set_sensitive(data->LB_numbereuro, bool);
+ gtk_entry_set_text(GTK_ENTRY(data->ST_euro_symbol) , euro_params[active].symbol);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_euro_isprefix), euro_params[active].sym_prefix);
+ gtk_entry_set_text(GTK_ENTRY(data->ST_euro_decimalchar) , euro_params[active].decimal_char);
+ gtk_entry_set_text(GTK_ENTRY(data->ST_euro_groupingchar), euro_params[active].grouping_char);
}
-
-/*
-** set euro value widget from a country
-*/
-static void defpref_europreset(GtkWidget *widget, gpointer user_data)
+static void defpref_colortoggle(GtkWidget *widget, gpointer user_data)
{
struct defpref_data *data;
-gint country;
+gboolean sensitive;
- DB( g_print("\n[ui-pref] euro preset\n") );
+ DB( g_print("\n[ui-pref] color toggle\n") );
data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
- country = gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_euro_preset));
+ sensitive = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_custom_colors));
+
+ gtk_widget_set_sensitive(data->LB_colors , sensitive);
+ gtk_widget_set_sensitive(data->CY_colors , sensitive);
+ gtk_widget_set_sensitive(data->LB_exp_color , sensitive);
+ gtk_widget_set_sensitive(data->GR_colors , sensitive);
+}
- gtk_label_set_text(GTK_LABEL(data->ST_euro_country), euro_params[country].name);
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_euro_value), euro_params[country].value);
+static void defpref_backuptoggle(GtkWidget *widget, gpointer user_data)
+{
+struct defpref_data *data;
+gboolean sensitive;
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_euro_fracdigits), euro_params[country].frac_digits);
+ DB( g_print("\n[ui-pref] backup toggle\n") );
- gtk_entry_set_text(GTK_ENTRY(data->ST_euro_symbol) , euro_params[country].symbol);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_euro_isprefix), euro_params[country].is_prefix);
- gtk_entry_set_text(GTK_ENTRY(data->ST_euro_decimalchar) , euro_params[country].decimal_char);
- gtk_entry_set_text(GTK_ENTRY(data->ST_euro_groupingchar), euro_params[country].grouping_char);
+ data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
+ sensitive = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_bak_is_automatic));
+ gtk_widget_set_sensitive(data->LB_bak_max_num_copies, sensitive);
+ gtk_widget_set_sensitive(data->NB_bak_max_num_copies, sensitive);
+ gtk_widget_set_sensitive(data->GR_bak_freq , sensitive);
}
+
/*
** set preset colors for amount display
*/
static void defpref_colorpreset(GtkWidget *widget, gpointer user_data)
{
struct defpref_data *data;
-GdkColor color;
+GdkRGBA rgba;
gint preset;
gchar *expcol, *inccol, *wrncol;
}
- gdk_color_parse(expcol, &color);
- gtk_color_button_set_color(GTK_COLOR_BUTTON(data->CP_exp_color), &color);
+ gdk_rgba_parse(&rgba, expcol);
+ gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(data->CP_exp_color), &rgba);
+
+ gdk_rgba_parse(&rgba, inccol);
+ gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(data->CP_inc_color), &rgba);
+
+ gdk_rgba_parse(&rgba, wrncol);
+ gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(data->CP_warn_color), &rgba);
+
- gdk_color_parse(inccol, &color);
- gtk_color_button_set_color(GTK_COLOR_BUTTON(data->CP_inc_color), &color);
+}
+
+
+static void defpref_color_scheme_changed(GtkWidget *widget, gpointer user_data)
+{
+struct defpref_data *data;
- gdk_color_parse(wrncol, &color);
- gtk_color_button_set_color(GTK_COLOR_BUTTON(data->CP_warn_color), &color);
+ DB( g_print("\n[ui-pref] color scheme chnaged\n") );
+ data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
+ gtk_widget_queue_draw (data->DA_colors);
+
}
/*
** set :: fill in widgets from PREFS structure
*/
-static void defpref_entry_set_text(GtkWidget *widget, gchar *text)
-{
- DB( g_print(" set text to '%s'\n", text) );
-
- if( text != NULL )
- {
- gtk_entry_set_text(GTK_ENTRY(widget), text);
- }
-}
static void defpref_set(struct defpref_data *data)
{
-GdkColor color;
+GdkRGBA rgba;
DB( g_print("\n[ui-pref] set\n") );
+ // general
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_show_splash), PREFS->showsplash);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_load_last), PREFS->loadlast);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_append_scheduled), PREFS->appendscheduled);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_do_update_currency), PREFS->do_update_currency);
+ hbtk_combo_box_set_active_id(GTK_COMBO_BOX_TEXT(data->CY_daterange_wal), PREFS->date_range_wal);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_fiscyearday), PREFS->fisc_year_day );
+ gtk_combo_box_set_active(GTK_COMBO_BOX(data->CY_fiscyearmonth), PREFS->fisc_year_month - 1);
+
+ // files/backup
+ gtk_entry_set_text(GTK_ENTRY(data->ST_path_hbfile), PREFS->path_hbfile);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_bak_is_automatic), PREFS->bak_is_automatic);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_bak_max_num_copies), PREFS->bak_max_num_copies);
+
+ // interface
if(PREFS->language != NULL)
- ui_language_combobox_set_active_id(GTK_COMBO_BOX(data->CY_language), PREFS->language);
+ gtk_combo_box_set_active_id(GTK_COMBO_BOX(data->CY_language), PREFS->language);
else
gtk_combo_box_set_active (GTK_COMBO_BOX(data->CY_language), 0);
-
gtk_combo_box_set_active(GTK_COMBO_BOX(data->CY_toolbar), PREFS->toolbar_style);
//gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_image_size), PREFS->image_size);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_custom_colors), PREFS->custom_colors);
-
- gdk_color_parse(PREFS->color_exp, &color);
- gtk_color_button_set_color(GTK_COLOR_BUTTON(data->CP_exp_color), &color);
-
- gdk_color_parse(PREFS->color_inc, &color);
- gtk_color_button_set_color(GTK_COLOR_BUTTON(data->CP_inc_color), &color);
-
- gdk_color_parse(PREFS->color_warn, &color);
- gtk_color_button_set_color(GTK_COLOR_BUTTON(data->CP_warn_color), &color);
-
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_ruleshint), PREFS->rules_hint);
-
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_fiscyearday), PREFS->fisc_year_day );
- gtk_combo_box_set_active(GTK_COMBO_BOX(data->CY_fiscyearmonth), PREFS->fisc_year_month - 1);
-
- gtk_entry_set_text(GTK_ENTRY(data->ST_path_hbfile), PREFS->path_hbfile);
- gtk_entry_set_text(GTK_ENTRY(data->ST_path_import), PREFS->path_import);
- gtk_entry_set_text(GTK_ENTRY(data->ST_path_export), PREFS->path_export);
- //gtk_entry_set_text(GTK_ENTRY(data->ST_path_navigator), PREFS->path_navigator);
-
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_load_last), PREFS->loadlast);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_append_scheduled), PREFS->appendscheduled);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_show_splash), PREFS->showsplash);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_herit_date), PREFS->heritdate);
+ gdk_rgba_parse(&rgba, PREFS->color_exp);
+ gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(data->CP_exp_color), &rgba);
+ gdk_rgba_parse(&rgba, PREFS->color_inc);
+ gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(data->CP_inc_color), &rgba);
+ gdk_rgba_parse(&rgba, PREFS->color_warn);
+ gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(data->CP_warn_color), &rgba);
+ //gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_ruleshint), PREFS->rules_hint);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(data->CY_gridlines), PREFS->grid_lines);
+
+ // transactions
+ hbtk_combo_box_set_active_id(GTK_COMBO_BOX_TEXT(data->CY_daterange_txn), PREFS->date_range_txn);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->ST_datefuture_nbdays), PREFS->date_future_nbdays);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_hide_reconciled), PREFS->hidereconciled);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_show_remind), PREFS->showremind);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_herit_date), PREFS->heritdate);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_memoacp), PREFS->txn_memoacp);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->ST_memoacp_days), PREFS->txn_memoacp_days);
- /* display */
+ // display format
gtk_entry_set_text(GTK_ENTRY(data->ST_datefmt), PREFS->date_format);
-
- defpref_entry_set_text(data->ST_num_symbol, PREFS->base_cur.symbol);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_num_isprefix), PREFS->base_cur.is_prefix);
- defpref_entry_set_text(data->ST_num_decimalchar, PREFS->base_cur.decimal_char);
- defpref_entry_set_text(data->ST_num_groupingchar, PREFS->base_cur.grouping_char);
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_num_fracdigits), PREFS->base_cur.frac_digits);
-
- //gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_numnbdec), PREFS->num_nbdecimal);
- //gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_numseparator), PREFS->num_separator);
- //gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_imperial), PREFS->imperial_unit);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_unitismile), PREFS->vehicle_unit_ismile);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_unitisgal), PREFS->vehicle_unit_isgal);
- gtk_combo_box_set_active(GTK_COMBO_BOX(data->CY_daterange_wal), PREFS->date_range_wal);
- gtk_combo_box_set_active(GTK_COMBO_BOX(data->CY_daterange_txn), PREFS->date_range_txn);
- gtk_combo_box_set_active(GTK_COMBO_BOX(data->CY_daterange_rep), PREFS->date_range_rep);
-
+ // import/export
+ gtk_combo_box_set_active(GTK_COMBO_BOX(data->CY_dtex_datefmt), PREFS->dtex_datefmt);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_dtex_ucfirst), PREFS->dtex_ucfirst);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(data->CY_dtex_ofxname), PREFS->dtex_ofxname);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(data->CY_dtex_ofxmemo), PREFS->dtex_ofxmemo);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_dtex_qifmemo), PREFS->dtex_qifmemo);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_dtex_qifswap), PREFS->dtex_qifswap);
+ gtk_entry_set_text(GTK_ENTRY(data->ST_path_import), PREFS->path_import);
+ gtk_entry_set_text(GTK_ENTRY(data->ST_path_export), PREFS->path_export);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(data->CY_dtex_csvsep), PREFS->dtex_csvsep);
+
+ // report
+ hbtk_combo_box_set_active_id(GTK_COMBO_BOX_TEXT(data->CY_daterange_rep), PREFS->date_range_rep);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(data->CY_color_scheme), PREFS->report_color_scheme);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_stat_byamount), PREFS->stat_byamount);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_stat_showrate), PREFS->stat_showrate);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_stat_showdetail), PREFS->stat_showdetail);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_budg_showdetail), PREFS->budg_showdetail);
+
/* euro */
- //defpref_currency_display(data->LB_default, NULL);
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_euro_enable), PREFS->euro_active);
//gtk_combo_box_set_active(GTK_COMBO_BOX(data->CY_euro_preset), PREFS->euro_country);
- gchar *buf;
- buf = g_strdup_printf("%s", euro_params[PREFS->euro_country].name);
- gtk_label_set_markup(GTK_LABEL(data->ST_euro_country), buf);
- g_free(buf);
-
+ data->country = PREFS->euro_country;
+ defpref_eurosetcurrency(data->window, data->country);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_euro_value), PREFS->euro_value);
-
- defpref_entry_set_text(data->ST_euro_symbol, PREFS->minor_cur.symbol);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_euro_isprefix), PREFS->minor_cur.is_prefix);
- defpref_entry_set_text(data->ST_euro_decimalchar, PREFS->minor_cur.decimal_char);
- defpref_entry_set_text(data->ST_euro_groupingchar, PREFS->minor_cur.grouping_char);
+ ui_gtk_entry_set_text(data->ST_euro_symbol, PREFS->minor_cur.symbol);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_euro_isprefix), PREFS->minor_cur.sym_prefix);
+ ui_gtk_entry_set_text(data->ST_euro_decimalchar, PREFS->minor_cur.decimal_char);
+ ui_gtk_entry_set_text(data->ST_euro_groupingchar, PREFS->minor_cur.grouping_char);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_euro_fracdigits), PREFS->minor_cur.frac_digits);
-
//gtk_entry_set_text(GTK_ENTRY(data->ST_euro_symbol), PREFS->euro_symbol);
//gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_euro_nbdec), PREFS->euro_nbdec);
//gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_euro_thsep), PREFS->euro_thsep);
-
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_stat_byamount), PREFS->stat_byamount);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_stat_showrate), PREFS->stat_showrate);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_stat_showdetail), PREFS->stat_showdetail);
-
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_budg_showdetail), PREFS->budg_showdetail);
-
- gtk_combo_box_set_active(GTK_COMBO_BOX(data->CY_color_scheme), PREFS->report_color_scheme);
-
- /* import */
- gtk_combo_box_set_active(GTK_COMBO_BOX(data->CY_dtex_datefmt), PREFS->dtex_datefmt);
- gtk_combo_box_set_active(GTK_COMBO_BOX(data->CY_dtex_ofxmemo), PREFS->dtex_ofxmemo);
-
-
-
}
/*
** get :: fill PREFS structure from widgets
*/
+#define RGBA_TO_INT(x) (int)(x*255)
-
-static void defpref_entry_get_text(GtkWidget *widget, gchar **storage)
+static gchar *gdk_rgba_to_hex(GdkRGBA *rgba)
{
-const gchar *text;
-
-
- DB( g_print("defpref_entry_get_text\n") );
-
- DB( g_print(" storage is '%p' at '%p'\n", *storage, storage) );
-
- /* free any previous string */
- if( *storage != NULL )
- {
- DB( g_print(" storage was not null, freeing\n") );
-
- g_free(*storage);
-
- }
-
- *storage = NULL;
-
- text = gtk_entry_get_text(GTK_ENTRY(widget));
- *storage = g_strdup(text);
- DB( g_print(" storing %s at %p\n", *storage, storage) );
-
- DB( g_print(" get text to '%s' '%s'\n", text, *storage) );
+ return g_strdup_printf("#%02x%02x%02x", RGBA_TO_INT(rgba->red), RGBA_TO_INT(rgba->green), RGBA_TO_INT(rgba->blue));
}
static void defpref_get(struct defpref_data *data)
{
-GdkColor color;
+GdkRGBA rgba;
const gchar *lang;
DB( g_print("\n[ui-pref] get\n") );
+ // general
+ PREFS->showsplash = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_show_splash));
+ PREFS->loadlast = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_load_last));
+ PREFS->appendscheduled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_append_scheduled));
+ PREFS->do_update_currency = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_do_update_currency));
+ PREFS->date_range_wal = hbtk_combo_box_get_active_id(GTK_COMBO_BOX_TEXT(data->CY_daterange_wal));
+ PREFS->fisc_year_day = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->NB_fiscyearday));
+ PREFS->fisc_year_month = 1 + gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_fiscyearmonth));
+
+ // files/backup
+ ui_gtk_entry_replace_text(data->ST_path_hbfile, &PREFS->path_hbfile);
+
+ PREFS->bak_is_automatic = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_bak_is_automatic));
+ PREFS->bak_max_num_copies = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->NB_bak_max_num_copies));
+
g_free(PREFS->language);
PREFS->language = NULL;
- lang = ui_language_combobox_get_active_id(GTK_COMBO_BOX(data->CY_language));
+ lang = gtk_combo_box_get_active_id(GTK_COMBO_BOX(data->CY_language));
if(lang != NULL)
{
PREFS->language = g_strdup(lang);
//PREFS->image_size = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->NB_image_size));
PREFS->custom_colors = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_custom_colors));
-
- gtk_color_button_get_color(GTK_COLOR_BUTTON(data->CP_exp_color), &color);
+ gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(data->CP_exp_color), &rgba);
g_free(PREFS->color_exp);
- PREFS->color_exp = gdk_color_to_string(&color);
-
- gtk_color_button_get_color(GTK_COLOR_BUTTON(data->CP_inc_color), &color);
+ PREFS->color_exp = gdk_rgba_to_hex(&rgba);
+ gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(data->CP_inc_color), &rgba);
g_free(PREFS->color_inc);
- PREFS->color_inc = gdk_color_to_string(&color);
-
- gtk_color_button_get_color(GTK_COLOR_BUTTON(data->CP_warn_color), &color);
+ PREFS->color_inc = gdk_rgba_to_hex(&rgba);
+ gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(data->CP_warn_color), &rgba);
g_free(PREFS->color_warn);
- PREFS->color_warn = gdk_color_to_string(&color);
-
- PREFS->rules_hint = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_ruleshint));
-
- PREFS->fisc_year_day = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->NB_fiscyearday));
- PREFS->fisc_year_month = 1 + gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_fiscyearmonth));
-
- list_txn_colpref_get(GTK_TREE_VIEW(data->LV_opecolumns), PREFS->lst_ope_columns);
-
- g_free(PREFS->path_hbfile);
- PREFS->path_hbfile = g_strdup(gtk_entry_get_text(GTK_ENTRY(data->ST_path_hbfile)));
-
- defpref_entry_get_text(data->ST_path_import, &PREFS->path_import);
-
- defpref_entry_get_text(data->ST_path_export, &PREFS->path_export);
-
- PREFS->loadlast = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_load_last));
- PREFS->appendscheduled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_append_scheduled));
- PREFS->showsplash = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_show_splash));
- PREFS->heritdate = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_herit_date));
+ PREFS->color_warn = gdk_rgba_to_hex(&rgba);
+ //PREFS->rules_hint = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_ruleshint));
+ PREFS->grid_lines = gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_gridlines));
+ //list_txn_colpref_get(GTK_TREE_VIEW(data->LV_opecolumns), PREFS->lst_ope_columns);
+
+ // transaction
+ PREFS->date_range_txn = hbtk_combo_box_get_active_id(GTK_COMBO_BOX_TEXT(data->CY_daterange_txn));
+ PREFS->date_future_nbdays = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->ST_datefuture_nbdays));
PREFS->hidereconciled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_hide_reconciled));
+ PREFS->showremind = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_show_remind));
+ PREFS->heritdate = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_herit_date));
+ PREFS->txn_memoacp = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_memoacp));
+ PREFS->txn_memoacp_days = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->ST_memoacp_days));
- //g_free(PREFS->path_navigator);
- //PREFS->path_navigator = g_strdup(gtk_entry_get_text(GTK_ENTRY(data->ST_path_navigator)));
-
+ // display format
g_free(PREFS->date_format);
PREFS->date_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(data->ST_datefmt)));
-
- defpref_entry_get_text(data->ST_num_symbol, &PREFS->base_cur.symbol);
- PREFS->base_cur.is_prefix = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_num_isprefix));
- defpref_entry_get_text(data->ST_num_decimalchar, &PREFS->base_cur.decimal_char);
- defpref_entry_get_text(data->ST_num_groupingchar, &PREFS->base_cur.grouping_char);
- PREFS->base_cur.frac_digits = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->NB_num_fracdigits));
-
- //PREFS->num_nbdecimal = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->NB_numnbdec));
- //PREFS->num_separator = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_numseparator));
- //PREFS->imperial_unit = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_imperial));
PREFS->vehicle_unit_ismile = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_unitismile));
PREFS->vehicle_unit_isgal = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_unitisgal));
- PREFS->date_range_wal = gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_daterange_wal));
- PREFS->date_range_txn = gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_daterange_txn));
- PREFS->date_range_rep = gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_daterange_rep));
+ // import/export
+ PREFS->dtex_datefmt = gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_dtex_datefmt));
+ PREFS->dtex_ucfirst = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_dtex_ucfirst));
+ PREFS->dtex_ofxname = gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_dtex_ofxname));
+ PREFS->dtex_ofxmemo = gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_dtex_ofxmemo));
+ PREFS->dtex_qifmemo = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_dtex_qifmemo));
+ PREFS->dtex_qifswap = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_dtex_qifswap));
+ ui_gtk_entry_replace_text(data->ST_path_import, &PREFS->path_import);
+ ui_gtk_entry_replace_text(data->ST_path_export, &PREFS->path_export);
+ PREFS->dtex_csvsep = gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_dtex_csvsep));
+
+ // report
+ PREFS->date_range_rep = hbtk_combo_box_get_active_id(GTK_COMBO_BOX_TEXT(data->CY_daterange_rep));
+ PREFS->report_color_scheme = gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_color_scheme));
+ PREFS->stat_byamount = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_stat_byamount));
+ PREFS->stat_showrate = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_stat_showrate));
+ PREFS->stat_showdetail = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_stat_showdetail));
+ PREFS->budg_showdetail = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_budg_showdetail));
+ // euro minor
PREFS->euro_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_euro_enable));
- PREFS->euro_country = gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_euro_preset));
+ PREFS->euro_country = data->country;
PREFS->euro_value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->NB_euro_value));
//strcpy(PREFS->euro_symbol, gtk_entry_get_text(GTK_ENTRY(data->ST_euro_symbol)));
//PREFS->euro_nbdec = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->NB_euro_nbdec));
//PREFS->euro_thsep = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_euro_thsep));
-
- defpref_entry_get_text(data->ST_euro_symbol, &PREFS->minor_cur.symbol);
- PREFS->minor_cur.is_prefix = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_euro_isprefix));
-
- g_free(PREFS->minor_cur.decimal_char);
- PREFS->minor_cur.decimal_char = g_strdup( gtk_entry_get_text(GTK_ENTRY(data->ST_euro_decimalchar)) );
-
- g_free(PREFS->minor_cur.grouping_char);
- PREFS->minor_cur.grouping_char = g_strdup( gtk_entry_get_text(GTK_ENTRY(data->ST_euro_groupingchar)) );
+ ui_gtk_entry_replace_text(data->ST_euro_symbol, &PREFS->minor_cur.symbol);
+ PREFS->minor_cur.sym_prefix = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_euro_isprefix));
+ ui_gtk_entry_replace_text(data->ST_euro_decimalchar, &PREFS->minor_cur.decimal_char);
+ ui_gtk_entry_replace_text(data->ST_euro_groupingchar, &PREFS->minor_cur.grouping_char);
PREFS->minor_cur.frac_digits = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->NB_euro_fracdigits));
-
- PREFS->stat_byamount = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_stat_byamount));
- PREFS->stat_showrate = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_stat_showrate));
- PREFS->stat_showdetail = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_stat_showdetail));
-
- PREFS->budg_showdetail = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_budg_showdetail));
-
- PREFS->report_color_scheme = gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_color_scheme));
-
- /* import */
- PREFS->dtex_datefmt = gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_dtex_datefmt));
- PREFS->dtex_ofxmemo = gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_dtex_ofxmemo));
-
-
//PREFS->chart_legend = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_chartlegend));
+ list_ext_colpref_get(GTK_TREE_VIEW(data->PI_plugin_columns), &(PREFS->ext_whitelist));
}
-/*
-GtkWidget *defpref_page_charts (struct defpref_data *data)
-{
-GtkWidget *container;
-GtkWidget *table, *label, *widget;
-gint row;
-
- container = gtk_hbox_new(FALSE, 0);
-
- table = gtk_table_new (2, 2, FALSE);
- gtk_container_set_border_width (GTK_CONTAINER (table), HB_BOX_SPACING);
- gtk_table_set_row_spacings (GTK_TABLE (table), HB_TABROW_SPACING);
- gtk_table_set_col_spacings (GTK_TABLE (table), HB_TABCOL_SPACING);
-
- gtk_box_pack_start (GTK_BOX (container), table, FALSE, FALSE, 0);
-
- row = 0;
- widget = gtk_check_button_new_with_mnemonic (_("Show legend"));
- data->CM_chartlegend = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
-
- row++;
- label = make_label(_("Bar width:"), 1.0, 0.5);
- //----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = make_numeric(label, 8.0, 32.0);
- //data->NB_numnbdec = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
-
-
-
- return(container);
-}
-*/
-
static GtkWidget *defpref_page_import (struct defpref_data *data)
{
-GtkWidget *container;
-GtkWidget *table, *hbox, *label, *widget;
-gint row;
-
- container = gtk_vbox_new(FALSE, 0);
-
- table = gtk_table_new (5, 3, FALSE);
- //gtk_container_set_border_width (GTK_CONTAINER (table), HB_BOX_SPACING);
- gtk_table_set_row_spacings (GTK_TABLE (table), HB_TABROW_SPACING);
- gtk_table_set_col_spacings (GTK_TABLE (table), HB_TABCOL_SPACING);
-
- gtk_box_pack_start (GTK_BOX (container), table, FALSE, FALSE, 0);
-
- row = 0;
- label = make_label(_("Date options"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
-
- row++;
- label = make_label(_("Date order:"), 0, 0.5);
+GtkWidget *content_grid, *group_grid, *label, *widget;
+gint crow, row;
+
+ content_grid = gtk_grid_new();
+ gtk_grid_set_row_spacing (GTK_GRID (content_grid), SPACING_LARGE);
+ gtk_orientable_set_orientation(GTK_ORIENTABLE(content_grid), GTK_ORIENTATION_VERTICAL);
+
+ crow = 0;
+ // group :: Date options
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("General options"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
+
+ row = 1;
+ label = make_label_widget(_("Date order:"));
//----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
widget = make_cycle(label, CYA_IMPORT_DATEORDER);
data->CY_dtex_datefmt = widget;
- //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
-
+ //gtk_grid_attach (GTK_GRID (group_grid), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
row++;
- label = make_label(_("OFX/QFX options"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
+ widget = gtk_check_button_new_with_mnemonic (_("Sentence _case memo/payee"));
+ data->CM_dtex_ucfirst = widget;
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 2, 1);
+
+
+ // group :: OFX/QFX options
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("OFX/QFX options"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
+
+ row = 1;
+ label = make_label_widget(_("OFX _Name:"));
+ //----------------------------------------- l, r, t, b
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
+ widget = make_cycle(label, CYA_IMPORT_OFXNAME);
+ data->CY_dtex_ofxname = widget;
+ //gtk_grid_attach (GTK_GRID (group_grid), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
row++;
- label = make_label(_("_Memo field:"), 0, 0.5);
+ label = make_label_widget(_("OFX _Memo:"));
//----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
widget = make_cycle(label, CYA_IMPORT_OFXMEMO);
data->CY_dtex_ofxmemo = widget;
- //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
-
-
- row++;
- label = make_label(_("Files folder"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
+ //gtk_grid_attach (GTK_GRID (group_grid), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
+
+ // group :: QIF options
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("QIF options"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
+
+ row = 1;
+ widget = gtk_check_button_new_with_mnemonic (_("_Import memos"));
+ data->CM_dtex_qifmemo = widget;
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 1, 1);
+ widget = gtk_check_button_new_with_mnemonic (_("_Swap memos with payees"));
+ data->CM_dtex_qifswap = widget;
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
+
+ // group :: other options
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("CSV options"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
+ row = 1;
+ label = make_label(_("(transaction import only)"), 0.0, 0.5);
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 2, 1);
row++;
- label = make_label(_("_Import:"), 0, 0.5);
+ label = make_label_widget(_("Separator:"));
//----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
-
- hbox = gtk_hbox_new(FALSE, 0);
- gtk_table_attach (GTK_TABLE (table), hbox, 2, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), 0, 0);
-
- widget = make_string(label);
- data->ST_path_import = widget;
- gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
-
- widget = gtk_button_new_with_label("...");
- data->BT_path_import = widget;
- gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
+ widget = make_cycle(label, CYA_IMPORT_CSVSEPARATOR);
+ data->CY_dtex_csvsep = widget;
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
- row++;
- label = make_label(_("_Export:"), 0, 0.5);
- //----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ return content_grid;
+}
- hbox = gtk_hbox_new(FALSE, 0);
- gtk_table_attach (GTK_TABLE (table), hbox, 2, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), 0, 0);
+#define cube_dim 16
- widget = make_string(label);
- data->ST_path_export = widget;
- gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
+static gboolean
+draw_callback (GtkWidget *widget,
+ cairo_t *cr,
+ gpointer user_data)
+{
+struct defpref_data *data = user_data;
+gint index;
+GtkColorScheme scheme;
+gint w, h;
+gint i, x, y;
- widget = gtk_button_new_with_label("...");
- data->BT_path_export = widget;
- gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
+ index = gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_color_scheme));
+ colorscheme_init(&scheme, index);
+
+ gtk_widget_get_size_request (widget, &w, &h);
+ x = y = 0;
+ for(i=0;i<scheme.nb_cols;i++)
+ {
+ cairo_user_set_rgbcol (cr, &scheme.colors[i]);
+ cairo_rectangle(cr, x, y, cube_dim, cube_dim);
+ cairo_fill(cr);
+ x += 1 + cube_dim;
+ if( i == 15 )
+ { x = 0; y = 1 + cube_dim; }
+ }
- return(container);
+ return TRUE;
}
-
static GtkWidget *defpref_page_reports (struct defpref_data *data)
{
-GtkWidget *container;
-GtkWidget *table, *label, *widget;
-gint row;
-
- container = gtk_vbox_new(FALSE, 0);
-
- table = gtk_table_new (5, 3, FALSE);
- //gtk_container_set_border_width (GTK_CONTAINER (table), HB_BOX_SPACING);
- gtk_table_set_row_spacings (GTK_TABLE (table), HB_TABROW_SPACING);
- gtk_table_set_col_spacings (GTK_TABLE (table), HB_TABCOL_SPACING);
-
- gtk_box_pack_start (GTK_BOX (container), table, FALSE, FALSE, 0);
-
-
- row = 0;
- label = make_label(_("Initial filter"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
-
- row++;
- label = make_label(_("Date _range:"), 0, 0.5);
+GtkWidget *content_grid, *group_grid, *label, *widget;
+gint crow, row;
+
+ content_grid = gtk_grid_new();
+ gtk_grid_set_row_spacing (GTK_GRID (content_grid), SPACING_LARGE);
+ gtk_orientable_set_orientation(GTK_ORIENTABLE(content_grid), GTK_ORIENTATION_VERTICAL);
+
+ crow = 0;
+ // group :: Initial filter
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("Initial filter"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
+
+ row = 1;
+ label = make_label_widget(_("_Range:"));
//----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = make_daterange(label, FALSE);
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
+ widget = make_daterange(label, DATE_RANGE_CUSTOM_HIDE);
data->CY_daterange_rep = widget;
- //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
-
-
- row++;
- label = make_label(_("Charts options"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
-
- row++;
- label = make_label(_("Color Scheme:"), 0, 0.5);
+ //gtk_grid_attach (GTK_GRID (group_grid), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
+
+ // group ::Charts options
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("Charts options"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
+
+ row = 1;
+ label = make_label_widget(_("Color scheme:"));
//----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = make_cycle(label, (gchar **)chart_colors);
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
+ widget = make_cycle(label, chart_colors);
data->CY_color_scheme = widget;
- //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
-
+ //gtk_grid_attach (GTK_GRID (group_grid), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
row++;
- label = make_label(_("Statistics options"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
+ widget = gtk_drawing_area_new ();
+ data->DA_colors = widget;
+ gtk_widget_set_size_request (widget, (1+cube_dim)*16, (1+cube_dim)*2);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
- row++;
+ g_signal_connect (data->DA_colors, "draw", G_CALLBACK (draw_callback), data);
+
+ // group :: Statistics options
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("Statistics options"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
+
+ row = 1;
widget = gtk_check_button_new_with_mnemonic (_("Show by _amount"));
data->CM_stat_byamount = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 2, 1);
row++;
widget = gtk_check_button_new_with_mnemonic (_("Show _rate column"));
data->CM_stat_showrate = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 2, 1);
row++;
widget = gtk_check_button_new_with_mnemonic (_("Show _details"));
data->CM_stat_showdetail = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 2, 1);
- row++;
- label = make_label(_("Budget options"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
-
- row++;
+ // group :: Budget options
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("Budget options"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
+
+ row = 1;
widget = gtk_check_button_new_with_mnemonic (_("Show _details"));
data->CM_budg_showdetail = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 2, 1);
- return(container);
+ return content_grid;
}
static GtkWidget *defpref_page_euro (struct defpref_data *data)
{
-GtkWidget *container;
-GtkWidget *table, *label, *widget;
-gint row;
-
- container = gtk_vbox_new(FALSE, 0);
-
- table = gtk_table_new (7, 3, FALSE);
- //gtk_container_set_border_width (GTK_CONTAINER (table), HB_BOX_SPACING);
- gtk_table_set_row_spacings (GTK_TABLE (table), HB_TABROW_SPACING);
- gtk_table_set_col_spacings (GTK_TABLE (table), HB_TABCOL_SPACING);
-
- gtk_box_pack_start (GTK_BOX (container), table, FALSE, FALSE, 0);
-
- row = 0;
-
-/*
- label = make_label(_("Default currency"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
-
- row++;
- label = make_label(_("Code:"), 0, 0.5);
- //----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = make_label(NULL, 0.0, 0.0);
- data->LB_default = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
-
-
-
- row++;
- widget = gtk_button_new_with_mnemonic (_("_Change"));
- data->BT_default = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
-
-
- row++;
-*/
-
- label = make_label(_("General"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
+GtkWidget *content_grid, *group_grid, *label, *widget, *expander;
+gint crow, row;
+
+ content_grid = gtk_grid_new();
+ gtk_grid_set_row_spacing (GTK_GRID (content_grid), SPACING_LARGE);
+ gtk_orientable_set_orientation(GTK_ORIENTABLE(content_grid), GTK_ORIENTATION_VERTICAL);
+
+ crow = 0;
+ // group :: General
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("General"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
- row++;
+ row=1;
widget = gtk_check_button_new_with_mnemonic (_("_Enable"));
data->CM_euro_enable = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
-
- row++;
- label = make_label(_("Fill from:"), 0, 0.5);
- //----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = make_euro_presets(label);
- data->CY_euro_preset = widget;
- //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 2, 1);
+
+ // group :: Currency
+ group_grid = gtk_grid_new ();
+ data->GRP_currency = group_grid;
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("Currency"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 4, 1);
- row++;
- label = make_label(_("Country:"), 0, 0.5);
- //----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = make_label(NULL, 0.0, 0.0);
+ row=1;
+ widget = make_label(NULL, 0.0, 0.5);
data->ST_euro_country = widget;
- //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
+ //gtk_grid_attach (GTK_GRID (group_grid), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 1, 1);
- row++;
- label = make_label(_("Value:"), 0, 0.5);
+ //row++;
+ label = make_label_widget(_("_Preset:"));
//----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = make_euro(label);
+ gtk_grid_attach (GTK_GRID (group_grid), label, 2, row, 1, 1);
+ widget = ui_euro_combobox_new (label);
+ data->CY_euro_preset = widget;
+ gtk_widget_set_margin_left (label, 2*SPACING_LARGE);
+ //gtk_grid_attach (GTK_GRID (group_grid), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 3, row, 1, 1);
+
+
+ // group :: Exchange rate
+ group_grid = gtk_grid_new ();
+ data->GRP_rate = group_grid;
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("Exchange rate"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
+
+ row=1;
+ label = make_label_widget("1 EUR _=");
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
+ widget = make_exchange_rate(label);
data->NB_euro_value = widget;
- //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
+ //gtk_grid_attach (GTK_GRID (group_grid), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
+
+ // group :: Numbers format
+ group_grid = gtk_grid_new ();
+ data->GRP_format = group_grid;
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("Format"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
- row++;
- label = make_label(_("Numbers format"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
+ row = 1;
+ widget = make_label(NULL, 0, 0.0);
+ data->LB_numbereuro = widget;
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 1, 1);
row++;
- label = make_label(_("Symbol:"), 0, 0.5);
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ expander = gtk_expander_new_with_mnemonic(_("_Customize"));
+ gtk_grid_attach (GTK_GRID (group_grid), expander, 1, row, 1, 1);
+
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_container_add (GTK_CONTAINER (expander), group_grid);
+
+ row = 0;
+ label = make_label_widget(_("_Symbol:"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
widget = make_string_maxlength(label, 3);
data->ST_euro_symbol = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
row++;
- widget = gtk_check_button_new_with_mnemonic (_("Is prefix"));
+ widget = gtk_check_button_new_with_mnemonic (_("Is pre_fix"));
data->CM_euro_isprefix = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
row++;
- label = make_label(_("Decimal char:"), 0, 0.5);
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ label = make_label_widget(_("_Decimal char:"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
widget = make_string_maxlength(label, 1);
data->ST_euro_decimalchar = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
-
- row++;
- label = make_label(_("Grouping char:"), 0, 0.5);
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = make_string_maxlength(label, 1);
- data->ST_euro_groupingchar = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
row++;
- label = make_label(_("_Frac digits:"), 0, 0.5);
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ label = make_label_widget(_("_Frac digits:"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
widget = make_numeric(label, 0.0, 6.0);
data->NB_euro_fracdigits = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
-
- row++;
- label = make_label(NULL, 0, 0.5);
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = make_label(NULL, 0, 0.5);
- data->LB_numbereuro = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
-
-/*
- row++;
- label = make_label(_("_Frac digits:"), 0, 0.5);
- //----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = make_numeric(label, 0.0, 6.0);
- data->NB_euro_nbdec = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
row++;
- widget = gtk_check_button_new_with_mnemonic (_("Thousand separator"));
- data->CM_euro_thsep = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
-
- row++;
- label = make_label(_("Symbol:"), 0, 0.5);
- //----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = make_string_maxlength(label, 8);
- data->ST_euro_symbol = widget;
- //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
-*/
+ label = make_label_widget(_("_Grouping char:"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
+ widget = make_string_maxlength(label, 1);
+ data->ST_euro_groupingchar = widget;
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
- return(container);
+ return content_grid;
}
-/*
-GtkWidget *defpref_page_help (struct defpref_data *data)
-{
-GtkWidget *container;
-GtkWidget *table, *label, *widget;
-gint row;
-
- container = gtk_vbox_new(FALSE, 0);
-
- table = gtk_table_new (2, 2, FALSE);
- gtk_container_set_border_width (GTK_CONTAINER (table), HB_BOX_SPACING);
- gtk_table_set_row_spacings (GTK_TABLE (table), HB_TABROW_SPACING);
- gtk_table_set_col_spacings (GTK_TABLE (table), HB_TABCOL_SPACING);
-
- gtk_box_pack_start (GTK_BOX (container), table, FALSE, FALSE, 0);
-
- row = 0;
- label = make_label(_("Web navigator"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
-
- row++;
- label = make_label("", 0.0, 0.5);
- gtk_misc_set_padding (GTK_MISC (label), HB_BOX_SPACING, 0);
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
-
- label = make_label(_("Web _navigator to use:"), 1.0, 0.5);
- //----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = make_string(label);
- data->ST_path_navigator = widget;
- //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
-
-
-
-
- return(container);
-}
-*/
-
static GtkWidget *defpref_page_display (struct defpref_data *data)
{
-GtkWidget *container;
-GtkWidget *table, *label, *widget;
-gint row;
+GtkWidget *content_grid, *group_grid, *label, *widget, *expander, *hbox;
+gint crow, row;
+
+ content_grid = gtk_grid_new();
+ gtk_grid_set_row_spacing (GTK_GRID (content_grid), SPACING_LARGE);
+ gtk_orientable_set_orientation(GTK_ORIENTABLE(content_grid), GTK_ORIENTATION_VERTICAL);
+
+ crow = 0;
+ // group :: General
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("User interface"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
- container = gtk_vbox_new(FALSE, 0);
+ row = 1;
+ label = make_label(_("_Language:"), 0, 0.5);
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
+ widget = ui_language_combobox_new(label);
+ data->CY_language = widget;
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
- table = gtk_table_new (7, 3, FALSE);
- //gtk_container_set_border_width (GTK_CONTAINER (table), HB_BOX_SPACING);
- gtk_table_set_row_spacings (GTK_TABLE (table), HB_TABROW_SPACING);
- gtk_table_set_col_spacings (GTK_TABLE (table), HB_TABCOL_SPACING);
+ row++;
+ row++;
+ label = make_label(_("_Date display:"), 0, 0.5);
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
+ widget = make_label(NULL, 0, 0.5);
+ data->LB_date = widget;
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
- gtk_box_pack_start (GTK_BOX (container), table, FALSE, FALSE, 0);
+ row++;
+ expander = gtk_expander_new_with_mnemonic(_("_Customize"));
+ gtk_grid_attach (GTK_GRID (group_grid), expander, 2, row, 1, 1);
- row = 0;
- label = make_label(_("Date options"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_container_add (GTK_CONTAINER (expander), group_grid);
row++;
- label = make_label(_("_Date format:"), 0, 0.5);
+ label = make_label_widget(_("_Format:"));
//----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
widget = make_string(label);
data->ST_datefmt = widget;
- //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ //gtk_grid_attach (GTK_GRID (group_grid), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
+ widget = gtk_image_new_from_icon_name (ICONNAME_INFO, GTK_ICON_SIZE_BUTTON);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 3, row, 1, 1);
+
+
gtk_widget_set_tooltip_text(widget,
_("%a locale's abbreviated weekday name.\n"
"%A locale's full weekday name. \n"
"%m month as a decimal number [01,12]. \n"
"%p locale's appropriate date representation. \n"
"%y year without century as a decimal number [00,99]. \n"
-"%Y year with century as a decimal number. \n")
+"%Y year with century as a decimal number.")
);
-
- row++;
- label = make_label(NULL, 0, 0.5);
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = make_label(NULL, 0, 0.5);
- data->LB_date = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
-
- row++;
- label = make_label(_("Numbers options"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
-
row++;
- label = make_label(_("Symbol:"), 0, 0.5);
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = make_string_maxlength(label, 3);
- data->ST_num_symbol = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ widget = make_label(NULL, 0.0, 0.5);
+ gtk_label_set_markup (GTK_LABEL(widget), "<small><a href=\"http://man7.org/linux/man-pages/man3/strftime.3.html\">online reference</a></small>");
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
- row++;
- widget = gtk_check_button_new_with_mnemonic (_("Is prefix"));
- data->CM_num_isprefix = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- row++;
- label = make_label(_("Decimal char:"), 0, 0.5);
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = make_string_maxlength(label,1);
- data->ST_num_decimalchar = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- row++;
- label = make_label(_("Grouping char:"), 0, 0.5);
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = make_string_maxlength(label, 1);
- data->ST_num_groupingchar = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- row++;
- label = make_label(_("_Frac digits:"), 0, 0.5);
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- #if MYDEBUG
- widget = make_numeric(label, 0.0, 15.0);
- #else
- widget = make_numeric(label, 0.0, 6.0);
- #endif
- data->NB_num_fracdigits = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ // group :: Fiscal year
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
- row++;
- label = make_label(NULL, 0, 0.5);
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = make_label(NULL, 0, 0.5);
- data->LB_numberbase = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ label = make_label_group(_("Fiscal year"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
- /* obsolete */
+ row = 1;
+ //TRANSLATORS: (fiscal year) starts on
+ label = make_label_widget(_("Starts _on:"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
- /*
- row++;
- label = make_label(_("_Frac digits:"), 0, 0.5);
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = make_numeric(label, 0.0, 6.0);
- data->NB_numnbdec = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, SPACING_SMALL);
+ gtk_grid_attach (GTK_GRID (group_grid), hbox, 2, row, 1, 1);
+ widget = make_numeric (label, 1, 28);
+ data->NB_fiscyearday = widget;
+ gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
+ widget = make_cycle (NULL, CYA_MONTHS);
+ data->CY_fiscyearmonth = widget;
+ gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
- row++;
- widget = gtk_check_button_new_with_mnemonic (_("_Thousand separator"));
- data->CM_numseparator = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- */
- row++;
- label = make_label(_("Measurement units"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
- /*row++;
- widget = gtk_check_button_new_with_mnemonic (_("Use _Imperial units"));
- data->CM_imperial = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);*/
+ // group :: Measurement units
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("Measurement units"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
- row++;
+ row = 1;
widget = gtk_check_button_new_with_mnemonic (_("Use _miles for meter"));
data->CM_unitismile = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 2, 1);
row++;
- widget = gtk_check_button_new_with_mnemonic (_("Use _galons for fuel"));
+ widget = gtk_check_button_new_with_mnemonic (_("Use _gallon for fuel"));
data->CM_unitisgal = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 2, 1);
- return(container);
+ return content_grid;
}
static GtkWidget *defpref_page_transactions (struct defpref_data *data)
{
-GtkWidget *container;
-GtkWidget *table, *label, *sw, *widget;
-gint row;
-
- container = gtk_vbox_new(FALSE, 0);
-
- table = gtk_table_new (3, 3, FALSE);
- //gtk_container_set_border_width (GTK_CONTAINER (table), HB_BOX_SPACING);
- gtk_table_set_row_spacings (GTK_TABLE (table), HB_TABROW_SPACING);
- gtk_table_set_col_spacings (GTK_TABLE (table), HB_TABCOL_SPACING);
-
- gtk_box_pack_start (GTK_BOX (container), table, TRUE, TRUE, 0);
+GtkWidget *content_grid, *group_grid, *label, *widget;
+gint crow, row;
+
+ content_grid = gtk_grid_new();
+ gtk_grid_set_row_spacing (GTK_GRID (content_grid), SPACING_LARGE);
+ gtk_orientable_set_orientation(GTK_ORIENTABLE(content_grid), GTK_ORIENTATION_VERTICAL);
+
+ crow = 0;
+ // group :: Transaction window
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("Transaction window"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
- row = 0;
- label = make_label(_("Transaction window"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach (GTK_TABLE (table), label, 0, 3, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ row = 1;
+ label = make_label(_("_Range:"), 0, 0.5);
+ //----------------------------------------- l, r, t, b
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
+ widget = make_daterange(label, DATE_RANGE_CUSTOM_HIDE);
+ data->CY_daterange_txn = widget;
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
row++;
- label = make_label(_("Date _range:"), 0, 0.5);
+ label = make_label(_("_Show future:"), 0, 0.5);
//----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = make_daterange(label, FALSE);
- data->CY_daterange_txn = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
+ widget = make_numeric(NULL, 0, 366);
+
+ data->ST_datefuture_nbdays = widget;
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
+
+ //TRANSLATORS: there is a spinner on the left of this label, and so you have 0....x days in advance the current date
+ label = make_label(_("days ahead"), 0, 0.5);
+ gtk_grid_attach (GTK_GRID (group_grid), label, 3, row, 1, 1);
row++;
widget = gtk_check_button_new_with_mnemonic (_("Hide reconciled transactions"));
data->CM_hide_reconciled = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
-
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 3, 1);
row++;
- label = make_label(_("Multiple add"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach (GTK_TABLE (table), label, 0, 3, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ widget = gtk_check_button_new_with_mnemonic (_("Always show remind transactions"));
+ data->CM_show_remind = widget;
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 3, 1);
- row++;
+ // group :: Multiple add
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("Multiple add"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
+
+ row = 1;
widget = gtk_check_button_new_with_mnemonic (_("Keep the last date"));
data->CM_herit_date = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 2, 1);
+
+ // group :: Memo autocomplete
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("Memo autocomplete"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
+ row = 1;
+ widget = gtk_check_button_new_with_mnemonic (_("Active"));
+ data->CM_memoacp = widget;
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 2, 1);
row++;
- label = make_label(_("Column list"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach (GTK_TABLE (table), label, 0, 3, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ widget = make_numeric(NULL, 0, 1460);
+ data->ST_memoacp_days = widget;
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
+ label = make_label(_("rolling days"), 0, 0.5);
+ gtk_grid_attach (GTK_GRID (group_grid), label, 3, row, 1, 1);
- row++;
+ // group :: Column list
+ /*
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("Column list"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
+
+ row = 1;
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
widget = (GtkWidget *)list_txn_colprefcreate();
data->LV_opecolumns = widget;
+ gtk_widget_set_size_request(data->LV_opecolumns, HB_MINWIDTH_LIST, -1);
gtk_container_add (GTK_CONTAINER (sw), widget);
+ gtk_widget_set_vexpand (sw, TRUE);
+ gtk_grid_attach (GTK_GRID (group_grid), sw, 1, row, 2, 1);
gtk_widget_set_tooltip_text(widget, _("Drag & drop to change the order"));
- gtk_table_attach (GTK_TABLE (table), sw, 1, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), 0, 0);
-
+ */
- return(container);
+ return content_grid;
}
static GtkWidget *defpref_page_interface (struct defpref_data *data)
{
-GtkWidget *container;
-GtkWidget *table, *hbox, *label, *widget;
-gint row;
-
- container = gtk_vbox_new(FALSE, 0);
-
- table = gtk_table_new (6, 3, FALSE);
- //gtk_container_set_border_width (GTK_CONTAINER (table), HB_BOX_SPACING);
- gtk_table_set_row_spacings (GTK_TABLE (table), HB_TABROW_SPACING);
- gtk_table_set_col_spacings (GTK_TABLE (table), HB_TABCOL_SPACING);
-
- gtk_box_pack_start (GTK_BOX (container), table, FALSE, FALSE, 0);
-
- row = 0;
- label = make_label(_("Language"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
-
- row++;
- label = make_label(_("_Language:"), 0, 0.5);
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = ui_language_combobox_new(label);
- data->CY_language = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+GtkWidget *content_grid, *group_grid, *hbox, *label, *widget;
+gint crow, row;
+
+ content_grid = gtk_grid_new();
+ gtk_grid_set_row_spacing (GTK_GRID (content_grid), SPACING_LARGE);
+ gtk_orientable_set_orientation(GTK_ORIENTABLE(content_grid), GTK_ORIENTATION_VERTICAL);
+
+ crow = 0;
+ // group :: General
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
- row++;
- label = make_label(_("General"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
+ label = make_label_group(_("General"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
- row++;
+ row = 1;
label = make_label(_("_Toolbar:"), 0, 0.5);
- //----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
widget = make_cycle(label, CYA_TOOLBAR_STYLE);
data->CY_toolbar = widget;
- //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
+
- /*
- row++;
- label = make_label(_("_Size:"), 0, 0.5);
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- hbox = gtk_hbox_new(FALSE, HB_BOX_SPACING);
- gtk_table_attach (GTK_TABLE (table), hbox, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
- widget = make_numeric(label, 16.0, 48.0);
- data->NB_image_size = widget;
- gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
- label = make_label(_("pixels"), 0, 0.5);
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- */
- row++;
- label = make_label(_("Treeview"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
- row++;
- widget = gtk_check_button_new_with_mnemonic (_("Show rules hint"));
- data->CM_ruleshint = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
- row++;
- label = make_label(_("Amount colors"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
row++;
+ //widget = gtk_check_button_new_with_mnemonic (_("Enable rows in alternating colors"));
+ //data->CM_ruleshint = widget;
+ label = make_label(_("_Grid line:"), 0, 0.5);
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
+ widget = make_cycle(label, CYA_GRID_LINES);
+ data->CY_gridlines = widget;
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
+
+ // group :: Amount colors
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("Amount colors"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
+
+ row = 1;
widget = gtk_check_button_new_with_mnemonic (_("Uses custom colors"));
data->CM_custom_colors = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 2, 1);
row++;
label = make_label(_("_Preset:"), 0, 0.5);
+ data->LB_colors = label;
//----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
widget = make_cycle(label, CYA_TANGO_COLORS);
data->CY_colors = widget;
- //gtk_table_attach_defaults (GTK_TABLE (table), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ //gtk_grid_attach (GTK_GRID (group_grid), data->CY_option[FILTER_DATE], 1, 2, row, row+1);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
row++;
label = make_label(_("_Expense:"), 0, 0.5);
+ data->LB_exp_color = label;
//----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- hbox = gtk_hbox_new(FALSE, HB_BOX_SPACING);
- gtk_table_attach_defaults (GTK_TABLE (table), hbox, 2, 3, row, row+1);
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, SPACING_SMALL);
+ data->GR_colors = hbox;
+ gtk_grid_attach (GTK_GRID (group_grid), hbox, 2, row, 1, 1);
widget = gtk_color_button_new ();
data->CP_exp_color = widget;
gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
- label = make_label(_("_Income:"), 0, 0.5);
+ label = make_label_widget(_("_Income:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
widget = gtk_color_button_new ();
data->CP_inc_color = widget;
gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
- label = make_label(_("_Warning:"), 0, 0.5);
+ label = make_label_widget(_("_Warning:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
widget = gtk_color_button_new ();
data->CP_warn_color = widget;
gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
+ return content_grid;
+}
- return(container);
+
+static GtkWidget *defpref_page_filebackup (struct defpref_data *data)
+{
+GtkWidget *content_grid, *group_grid, *hbox, *label, *widget;
+gint crow, row;
+
+ content_grid = gtk_grid_new();
+ gtk_grid_set_row_spacing (GTK_GRID (content_grid), SPACING_LARGE);
+ gtk_orientable_set_orientation(GTK_ORIENTABLE(content_grid), GTK_ORIENTATION_VERTICAL);
+
+ crow = 0;
+ // group :: Backup
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("Backup"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
+
+ row = 1;
+ widget = gtk_check_button_new_with_mnemonic (_("_Enable automatic backups"));
+ data->CM_bak_is_automatic = widget;
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 2, 1);
+
+ row++;
+ label = make_label_widget(_("_Number of backups to keep:"));
+ data->LB_bak_max_num_copies = label;
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
+ widget = make_numeric (label, 1, 99);
+ data->NB_bak_max_num_copies = widget;
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
+
+ row++;
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, SPACING_SMALL);
+ data->GR_bak_freq = hbox;
+ //gtk_widget_set_hexpand (hbox, TRUE);
+ gtk_grid_attach (GTK_GRID (group_grid), hbox, 1, row, 2, 1);
+
+ widget = gtk_image_new_from_icon_name (ICONNAME_INFO, GTK_ICON_SIZE_BUTTON);
+ gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
+ label = make_label_widget(_("Backup frequency is once a day"));
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+
+ return content_grid;
}
-static GtkWidget *defpref_page_general (struct defpref_data *data)
+
+static GtkWidget *defpref_page_folders (struct defpref_data *data)
{
-GtkWidget *container;
-GtkWidget *table, *label, *widget, *hbox;
-gint row;
+GtkWidget *content_grid, *group_grid, *hbox, *label, *widget;
+gint crow, row;
+
+ content_grid = gtk_grid_new();
+ gtk_grid_set_row_spacing (GTK_GRID (content_grid), SPACING_LARGE);
+ gtk_orientable_set_orientation(GTK_ORIENTABLE(content_grid), GTK_ORIENTATION_VERTICAL);
+
+ crow = 0;
+ // group :: Files folder
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("HomeBank files"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
- container = gtk_vbox_new(FALSE, 0);
+ row = 1;
+ label = make_label_widget(_("_Wallets:"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
+
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_widget_set_hexpand (hbox, TRUE);
+ gtk_grid_attach (GTK_GRID (group_grid), hbox, 2, row, 1, 1);
- table = gtk_table_new (4, 3, FALSE);
- //gtk_container_set_border_width (GTK_CONTAINER (table), HB_BOX_SPACING);
- gtk_table_set_row_spacings (GTK_TABLE (table), HB_TABROW_SPACING);
- gtk_table_set_col_spacings (GTK_TABLE (table), HB_TABCOL_SPACING);
+ widget = make_string(label);
+ data->ST_path_hbfile = widget;
+ gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET(widget)), GTK_STYLE_CLASS_LINKED);
+ gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (container), table, FALSE, FALSE, 0);
+ //widget = gtk_button_new_with_label("...");
+ widget = gtk_button_new_from_icon_name(ICONNAME_FOLDER, GTK_ICON_SIZE_BUTTON);
+ data->BT_path_hbfile = widget;
+ gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
- row = 0;
- label = make_label(_("Program start"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
+
+ // group :: Files folder
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("Exchange files"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
+
+ row = 1;
+ label = make_label_widget(_("_Import:"));
+ //----------------------------------------- l, r, t, b
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
+
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_widget_set_hexpand (hbox, TRUE);
+ gtk_grid_attach (GTK_GRID (group_grid), hbox, 2, row, 1, 1);
+
+ widget = make_string(label);
+ data->ST_path_import = widget;
+ gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET(widget)), GTK_STYLE_CLASS_LINKED);
+ gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
+
+ //widget = gtk_button_new_with_label("...");
+ widget = gtk_button_new_from_icon_name(ICONNAME_FOLDER, GTK_ICON_SIZE_BUTTON);
+ data->BT_path_import = widget;
+ gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
row++;
+ label = make_label_widget(_("_Export:"));
+ //----------------------------------------- l, r, t, b
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
+
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_widget_set_hexpand (hbox, TRUE);
+ gtk_grid_attach (GTK_GRID (group_grid), hbox, 2, row, 1, 1);
+
+ widget = make_string(label);
+ data->ST_path_export = widget;
+ gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET(widget)), GTK_STYLE_CLASS_LINKED);
+ gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
+
+ //widget = gtk_button_new_with_label("...");
+ widget = gtk_button_new_from_icon_name(ICONNAME_FOLDER, GTK_ICON_SIZE_BUTTON);
+ data->BT_path_export = widget;
+ gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
+
+
+
+ return content_grid;
+}
+
+
+static GtkWidget *defpref_page_general (struct defpref_data *data)
+{
+GtkWidget *content_grid, *group_grid, *label, *widget;
+gint crow, row;
+
+ content_grid = gtk_grid_new();
+ gtk_grid_set_row_spacing (GTK_GRID (content_grid), SPACING_LARGE);
+ gtk_orientable_set_orientation(GTK_ORIENTABLE(content_grid), GTK_ORIENTATION_VERTICAL);
+
+ crow = 0;
+ // group :: Program start
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("Program start"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
+
+ row = 1;
widget = gtk_check_button_new_with_mnemonic (_("Show splash screen"));
data->CM_show_splash = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 2, 1);
row++;
widget = gtk_check_button_new_with_mnemonic (_("Load last opened file"));
data->CM_load_last = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 2, 1);
row++;
widget = gtk_check_button_new_with_mnemonic (_("Post pending scheduled transactions"));
data->CM_append_scheduled = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
-
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 2, 1);
row++;
- label = make_label(_("Fiscal year"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
+ widget = gtk_check_button_new_with_mnemonic (_("Update currencies online"));
+ data->CM_do_update_currency = widget;
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 1, row, 2, 1);
- row++;
- //TRANSLATORS: (fiscal year) starts on
- label = make_label(_("Starts _on:"), 0.0, 0.5);
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
-
- hbox = gtk_hbox_new(FALSE, HB_BOX_SPACING);
- gtk_table_attach (GTK_TABLE (table), hbox, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (0), 0, 0);
- widget = make_numeric (label, 1, 28);
- data->NB_fiscyearday = widget;
- gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
- widget = make_cycle (NULL, CYA_MONTHS);
- data->CY_fiscyearmonth = widget;
- gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
- row++;
- label = make_label(_("Main window reports"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
+ // group :: Main window reports
+ group_grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (group_grid), SPACING_SMALL);
+ gtk_grid_set_column_spacing (GTK_GRID (group_grid), SPACING_MEDIUM);
+ gtk_grid_attach (GTK_GRID (content_grid), group_grid, 0, crow++, 1, 1);
+
+ label = make_label_group(_("Main window reports"));
+ gtk_grid_attach (GTK_GRID (group_grid), label, 0, 0, 3, 1);
- row++;
- label = make_label(_("Date _range:"), 0, 0.5);
- //----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- widget = make_daterange(label, FALSE);
+ row = 1;
+ label = make_label(_("_Range:"), 0, 0.5);
+ gtk_grid_attach (GTK_GRID (group_grid), label, 1, row, 1, 1);
+ widget = make_daterange(label, DATE_RANGE_CUSTOM_HIDE);
data->CY_daterange_wal = widget;
- gtk_table_attach (GTK_TABLE (table), widget, 2, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (group_grid), widget, 2, row, 1, 1);
+ return content_grid;
+}
- row++;
- label = make_label(_("Files folder"), 0.0, 0.5);
- gimp_label_set_attributes(GTK_LABEL(label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 3, row, row+1);
- row++;
- label = make_label(_("_Default:"), 0, 0.5);
- //----------------------------------------- l, r, t, b
- gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
+void plugin_execute_action(GtkTreeView* treeview, GtkTreePath* path, GtkTreeViewColumn* col, gpointer userdata);
- hbox = gtk_hbox_new(FALSE, 0);
- gtk_table_attach (GTK_TABLE (table), hbox, 2, 3, row, row+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), 0, 0);
+static void
+toggle_plugin(GtkCellRendererToggle *cell, gchar* path_str, gpointer data)
+{
+ GtkTreeModel *model = (GtkTreeModel*)data;
+ GtkTreeIter iter;
+ GtkTreePath *path = gtk_tree_path_new_from_string(path_str);
+
+ const gchar* plugin;
+
+ gtk_tree_model_get_iter(model, &iter, path);
+ gtk_tree_model_get(model, &iter, EXT_COLUMN_PLUGIN_NAME, &plugin, -1);
+
+ gboolean enabled = ext_is_plugin_loaded(plugin);
+ if (enabled) {
+ ext_unload_plugin(plugin);
+ enabled = FALSE;
+ } else {
+ enabled = (ext_load_plugin(plugin) == 0);
+ if (!enabled) {
+ ext_run_modal(_("Plugin Error"), _("The plugin failed to load properly."), "error");
+ }
+ }
- widget = make_string(label);
- data->ST_path_hbfile = widget;
- gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
+ /* set new value */
+ gtk_list_store_set(GTK_LIST_STORE (model), &iter, EXT_COLUMN_ENABLED, enabled, -1);
- widget = gtk_button_new_with_label("...");
- data->BT_path_hbfile = widget;
- gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
+ /* clean up */
+ gtk_tree_path_free(path);
+}
+
+
+void plugin_execute_action(GtkTreeView* treeview, GtkTreePath* path, GtkTreeViewColumn* col, gpointer userdata)
+{
+ GtkTreeModel* model = gtk_tree_view_get_model(treeview);
+ GtkTreeIter iter;
+
+ if (gtk_tree_model_get_iter(model, &iter, path)) {
+ gchar* plugin_filename;
+ gtk_tree_model_get(model, &iter, EXT_COLUMN_PLUGIN_NAME, &plugin_filename, -1);
+ ext_execute_action(plugin_filename);
+ g_free(plugin_filename);
+ }
+}
+
+static GtkWidget *defpref_page_plugins (struct defpref_data *data)
+{
+ GtkWidget *container;
+ GtkListStore *store;
+ GtkTreeIter it;
+ GtkWidget* view;
+
+ container = gtk_vbox_new(FALSE, 0);
+
+ store = gtk_list_store_new(EXT_NUM_COLUMNS, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+
+ gchar** plugins = ext_list_plugins();
+ gchar** plugins_it;
+ for (plugins_it = plugins; *plugins_it; ++plugins_it) {
+
+ gboolean enabled = ext_is_plugin_loaded(*plugins_it);
+ GHashTable* metadata = ext_read_plugin_metadata(*plugins_it);
+ if (!metadata) {
+ metadata = g_hash_table_new(g_str_hash, g_str_equal);
+ }
+
+ gchar* tmp = NULL;
+
+ // NAME
+ gchar* name = g_hash_table_lookup(metadata, "name");
+ if (!name || *name == '\0') {
+ name = *plugins_it;
+ }
+ name = g_markup_escape_text(name, -1);
+ gchar* label = g_strdup_printf("<b>%s</b>", name);
+ gchar* tooltip = g_strdup_printf("<span size='x-large' weight='bold'>%s</span>", name);
+ g_free(name);
+
+ // VERSION
+ gchar* version = g_hash_table_lookup(metadata, "version");
+ if (version) {
+ version = g_markup_escape_text(version, -1);
+ tmp = label;
+ label = g_strdup_printf("%s %s", tmp, version);
+ g_free(tmp);
+ tmp = tooltip;
+ tooltip = g_strdup_printf("%s %s", tmp, version);
+ g_free(tmp);
+ g_free(version);
+ }
+
+ // ABSTRACT
+ gchar* abstract = g_hash_table_lookup(metadata, "abstract");
+ if (abstract) {
+ abstract = g_markup_escape_text(abstract, -1);
+ tmp = label;
+ label = g_strdup_printf("%s\n%s", tmp, abstract);
+ g_free(tmp);
+ g_free(abstract);
+ }
+
+ // AUTHOR
+ gchar* author = g_hash_table_lookup(metadata, "author");
+ if (author) {
+ author = g_markup_escape_text(author, -1);
+ tmp = tooltip;
+ tooltip = g_strdup_printf("%s\n%s", tmp, author);
+ g_free(tmp);
+ g_free(author);
+ }
+
+ // WEBSITE
+ gchar* website = g_hash_table_lookup(metadata, "website");
+ if (website) {
+ website = g_markup_escape_text(website, -1);
+ tmp = tooltip;
+ tooltip = g_strdup_printf("%s\n<b>%s:</b> %s", tmp, _("Website"), website);
+ g_free(tmp);
+ g_free(website);
+ }
+
+ // FILEPATH
+ tmp = ext_find_plugin(*plugins_it);
+ gchar* full = g_markup_escape_text(tmp, -1);
+ g_free(tmp);
+ tmp = tooltip;
+ tooltip = g_strdup_printf("%s\n<b>%s:</b> %s", tmp, _("File"), full);
+ g_free(tmp);
+ g_free(full);
+
+ g_hash_table_unref(metadata);
+
+ gtk_list_store_append(store, &it);
+ gtk_list_store_set(store, &it,
+ EXT_COLUMN_ENABLED, enabled,
+ EXT_COLUMN_LABEL, label,
+ EXT_COLUMN_TOOLTIP, tooltip,
+ EXT_COLUMN_PLUGIN_NAME, *plugins_it,
+ -1);
+
+ g_free(label);
+ g_free(tooltip);
+ }
+ g_strfreev(plugins);
+
+ view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
+ g_object_unref(store);
+
+ g_signal_connect(view, "row-activated", (GCallback)plugin_execute_action, NULL);
+
+ gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(view), TRUE);
+ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), TRUE);
+ gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(view), EXT_COLUMN_TOOLTIP);
+
+
+ GtkTreeViewColumn *col;
+ GtkCellRenderer *renderer;
+ col = gtk_tree_view_column_new();
+ gtk_tree_view_column_set_title(col, _("Enabled"));
+ gtk_tree_view_column_set_sort_column_id(col, EXT_COLUMN_ENABLED);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
+
+ renderer = gtk_cell_renderer_toggle_new();
+ gtk_tree_view_column_pack_start(col, renderer, TRUE);
+ gtk_tree_view_column_add_attribute(col, renderer, "active", 0);
+ g_signal_connect(renderer, "toggled", G_CALLBACK(toggle_plugin), store);
+
+ col = gtk_tree_view_column_new();
+ gtk_tree_view_column_set_title(col, _("Plugin"));
+ gtk_tree_view_column_set_sort_column_id(col, EXT_COLUMN_LABEL);
+ gtk_tree_view_column_set_expand(col, TRUE);
+ /*gtk_tree_view_column_set_sort_order(col, GTK_SORT_ASCENDING);*/
+ gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
+
+ renderer = gtk_cell_renderer_text_new();
+ g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+ gtk_tree_view_column_pack_start(col, renderer, TRUE);
+ gtk_tree_view_column_add_attribute(col, renderer, "markup", EXT_COLUMN_LABEL);
+
+ data->PI_plugin_columns = view;
+
+ GtkWidget* sw = gtk_scrolled_window_new(NULL, NULL);
+ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN);
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ gtk_container_add(GTK_CONTAINER(sw), view);
+
+ gtk_box_pack_start(GTK_BOX(container), sw, TRUE, TRUE, 0);
+
return(container);
}
+
static void defpref_selection(GtkTreeSelection *treeselection, gpointer user_data)
{
struct defpref_data *data;
gtk_label_set_text (GTK_LABEL (data->label), g_value_get_string (&val));
g_value_unset (&val);
- gtk_tree_model_get_value(model, &iter, LST_PREF_ICON, &val);
- gtk_image_set_from_pixbuf (GTK_IMAGE (data->image),
- g_value_get_object (&val));
+ gtk_tree_model_get_value(model, &iter, LST_PREF_ICONNAME, &val);
+ //gtk_image_set_from_pixbuf (GTK_IMAGE (data->image), g_value_get_object (&val));
+ gtk_image_set_from_icon_name(GTK_IMAGE (data->image), g_value_get_string (&val), GTK_ICON_SIZE_DIALOG);
g_value_unset (&val);
/*
** add an empty new account to our temp GList and treeview
*/
-static void defpref_clear(GtkWidget *widget, gpointer user_data)
+static void defpref_reset(GtkWidget *widget, gpointer user_data)
{
struct defpref_data *data;
gint result;
data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
- DB( g_print("\n(defpref_clear) (data=%p)\n", data) );
+ DB( g_print("\n(defpref_reset) (data=%p)\n", data) );
- result = ui_dialog_msg_question(
+ result = ui_dialog_msg_confirm_alert(
GTK_WINDOW(data->window),
- _("Clear every preferences ?"),
- _("This will revert the preferences\nto its default values")
+ _("Reset All Preferences"),
+ _("Do you really want to reset\nall preferences to default\nvalues?"),
+ _("_Reset")
);
- if( result == GTK_RESPONSE_YES )
+ if( result == GTK_RESPONSE_OK )
{
homebank_pref_setdefault();
defpref_set(data);
// the window creation
-GtkWidget *defpref_dialog_new (void)
+GtkWidget *defpref_dialog_new (gint initial_selection)
{
struct defpref_data data;
GtkWidget *window, *content, *mainvbox;
-
GtkWidget *hbox, *vbox, *sw, *widget, *notebook, *page, *ebox, *image, *label;
window = gtk_dialog_new_with_buttons (_("Preferences"),
GTK_WINDOW(GLOBALS->mainwindow),
0,
- GTK_STOCK_CANCEL,
+ _("_Reset"),
+ 55,
+ _("_Cancel"),
GTK_RESPONSE_REJECT,
- GTK_STOCK_OK,
+ _("_OK"),
GTK_RESPONSE_ACCEPT,
NULL);
//store our window private data
g_object_set_data(G_OBJECT(window), "inst_data", (gpointer)&data);
- gtk_window_set_icon_name(GTK_WINDOW (window), GTK_STOCK_PREFERENCES);
+ gtk_window_set_icon_name(GTK_WINDOW (window), ICONNAME_PREFERENCES);
- content = gtk_dialog_get_content_area(GTK_DIALOG (window));
- mainvbox = gtk_vbox_new (FALSE, 8);
+ content = gtk_dialog_get_content_area(GTK_DIALOG (window)); // return a vbox
+ mainvbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, SPACING_MEDIUM);
gtk_box_pack_start (GTK_BOX (content), mainvbox, TRUE, TRUE, 0);
- gtk_container_set_border_width(GTK_CONTAINER(mainvbox), 8);
+ gtk_container_set_border_width(GTK_CONTAINER(mainvbox), SPACING_MEDIUM);
- hbox = gtk_hbox_new (FALSE, 8);
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, SPACING_MEDIUM);
gtk_box_pack_start (GTK_BOX (mainvbox), hbox, TRUE, TRUE, 0);
//left part
- vbox = gtk_vbox_new (FALSE, HB_BOX_SPACING);
+ vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, SPACING_SMALL);
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
//list
data.LV_page = widget;
gtk_container_add (GTK_CONTAINER (sw), widget);
- // clear button
- data.BT_clear = gtk_button_new_from_stock(GTK_STOCK_CLEAR);
- gtk_box_pack_start (GTK_BOX (vbox), data.BT_clear, FALSE, TRUE, 0);
-
//right part : notebook
- vbox = gtk_vbox_new (FALSE, 12);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, SPACING_MEDIUM);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
gtk_widget_show (vbox);
ebox = gtk_event_box_new();
- gtk_widget_set_state (ebox, GTK_STATE_SELECTED);
+ gtk_widget_set_name(ebox, "hbebox");
+ GtkStyleContext *context = gtk_widget_get_style_context (ebox);
+ #if GTK_MINOR_VERSION <= 18
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_LIST_ROW);
+ gtk_widget_set_state_flags(ebox, GTK_STATE_FLAG_SELECTED, TRUE);
+ #else
+ GtkCssProvider *provider;
+ provider = gtk_css_provider_new ();
+ gtk_css_provider_load_from_data (provider,
+ "#hbebox { color: @theme_selected_fg_color; background-color: @theme_selected_bg_color; }"
+ , -1, NULL);
+ gtk_style_context_add_provider (context, GTK_STYLE_PROVIDER(provider), G_MAXUINT);
+
+ // gtk_style_context_set_state(context, GTK_STATE_FLAG_SELECTED);
+ #endif
+
gtk_box_pack_start (GTK_BOX (vbox), ebox, FALSE, TRUE, 0);
gtk_widget_show (ebox);
- hbox = gtk_hbox_new (FALSE, 6);
- gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
- gtk_container_add (GTK_CONTAINER (ebox), hbox);
- gtk_widget_show (hbox);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, SPACING_SMALL);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), SPACING_SMALL);
+ gtk_container_add (GTK_CONTAINER (ebox), hbox);
+ gtk_widget_show (hbox);
- label = gtk_label_new (NULL);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-
- gimp_label_set_attributes (GTK_LABEL (label),
- PANGO_ATTR_SCALE, PANGO_SCALE_LARGE,
+ label = gtk_label_new (NULL);
+ gtk_widget_set_margin_left(label, SPACING_MEDIUM);
+ gimp_label_set_attributes (GTK_LABEL (label),
+ PANGO_ATTR_SCALE, PANGO_SCALE_XX_LARGE,
PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
-1);
gtk_box_pack_start (GTK_BOX (vbox), notebook, TRUE, TRUE, 0);
/*
-"general",
-"interface",
-"display",
-"help",
-"euro",
-"report"
+ PREF_GENERAL,
+ PREF_INTERFACE,
+ PREF_LOCALE, //old DISPLAY
+ PREF_TXN, //old COLUMNS
+ PREF_IMPORT,
+ PREF_REPORT,
+ PREF_BACKUP,
+ PREF_FOLDERS,
+ PREF_EURO,
+ PREF_MAX
*/
//general
page = defpref_page_interface(&data);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, NULL);
- //columns
- page = defpref_page_transactions(&data);
+ //locale
+ page = defpref_page_display(&data);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, NULL);
- //display
- page = defpref_page_display(&data);
+ //transaction
+ page = defpref_page_transactions(&data);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, NULL);
//import
page = defpref_page_reports(&data);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, NULL);
+ //backup
+ page = defpref_page_filebackup(&data);
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, NULL);
+
+ //folders
+ page = defpref_page_folders(&data);
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, NULL);
+
//euro
page = defpref_page_euro(&data);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, NULL);
+ //plugins
+ page = defpref_page_plugins(&data);
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, NULL);
+
//todo:should move this
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data.CM_euro_enable), PREFS->euro_active);
//connect all our signals
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
- g_signal_connect (G_OBJECT (data.BT_clear), "clicked", G_CALLBACK (defpref_clear), NULL);
+ g_signal_connect (data.CM_bak_is_automatic, "toggled", G_CALLBACK (defpref_backuptoggle), NULL);
+
//path selector
- g_signal_connect (data.BT_path_hbfile, "pressed", G_CALLBACK (defpref_pathselect), GINT_TO_POINTER(1));
- g_signal_connect (data.BT_path_import, "pressed", G_CALLBACK (defpref_pathselect), GINT_TO_POINTER(2));
- g_signal_connect (data.BT_path_export, "pressed", G_CALLBACK (defpref_pathselect), GINT_TO_POINTER(3));
+ g_signal_connect (data.BT_path_hbfile, "pressed", G_CALLBACK (defpref_pathselect), GINT_TO_POINTER(PRF_PATH_WALLET));
+ g_signal_connect (data.BT_path_import, "pressed", G_CALLBACK (defpref_pathselect), GINT_TO_POINTER(PRF_PATH_IMPORT));
+ g_signal_connect (data.BT_path_export, "pressed", G_CALLBACK (defpref_pathselect), GINT_TO_POINTER(PRF_PATH_EXPORT));
+ g_signal_connect (data.CM_custom_colors, "toggled", G_CALLBACK (defpref_colortoggle), NULL);
g_signal_connect (data.CY_colors, "changed", G_CALLBACK (defpref_colorpreset), NULL);
+
g_signal_connect (gtk_tree_view_get_selection(GTK_TREE_VIEW(data.LV_page)), "changed", G_CALLBACK (defpref_selection), notebook);
g_signal_connect (data.CM_euro_enable, "toggled", G_CALLBACK (defpref_eurotoggle), NULL);
//date
g_signal_connect (data.ST_datefmt, "changed", G_CALLBACK (defpref_date_sample), NULL);
- //base number
- g_signal_connect (data.ST_num_symbol , "changed", G_CALLBACK (defpref_numberbase_sample), NULL);
- g_signal_connect (data.CM_num_isprefix, "toggled", G_CALLBACK (defpref_numberbase_sample), NULL);
- g_signal_connect (data.ST_num_decimalchar, "changed", G_CALLBACK (defpref_numberbase_sample), NULL);
- g_signal_connect (data.ST_num_groupingchar, "changed", G_CALLBACK (defpref_numberbase_sample), NULL);
- g_signal_connect (data.NB_num_fracdigits, "value-changed", G_CALLBACK (defpref_numberbase_sample), NULL);
+ //report
+ g_signal_connect (data.CY_color_scheme, "changed", G_CALLBACK (defpref_color_scheme_changed), NULL);
+
//euro number
g_signal_connect (data.ST_euro_symbol , "changed", G_CALLBACK (defpref_numbereuro_sample), NULL);
//defhbfile_setup(&data);
//defhbfile_update(data.LV_arc, NULL);
- defpref_eurotoggle(window, NULL);
-
defpref_set(&data);
+ defpref_colortoggle(window, NULL);
+ defpref_eurotoggle(window, NULL);
+
gtk_window_resize(GTK_WINDOW(window), 640, 256);
- //select first row
- GtkTreePath *path = gtk_tree_path_new_first ();
+ //select initial row
+ GtkTreePath *path = gtk_tree_path_new_from_indices(initial_selection, -1);
gtk_tree_selection_select_path (gtk_tree_view_get_selection(GTK_TREE_VIEW(data.LV_page)), path);
gtk_tree_path_free(path);
gtk_widget_show_all (window);
+ gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), initial_selection);
gint result;
gchar *old_lang;
g_free(old_lang);
break;
+
+ case 55:
+ defpref_reset (window, NULL);
+ break;
}
// -------------------------------
-GtkWidget *pref_list_create(void)
+static GtkWidget *pref_list_create(void)
{
GtkListStore *store;
GtkWidget *view;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
GtkTreeIter iter;
-GtkWidget *cellview;
gint i;
/* create list store */
store = gtk_list_store_new(
LST_PREF_MAX,
- GDK_TYPE_PIXBUF,
- GDK_TYPE_PIXBUF,
+ G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_INT
);
view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
g_object_unref(store);
- //gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW (view), FALSE);
gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(view)), GTK_SELECTION_SINGLE);
/* column 1: icon */
column = gtk_tree_view_column_new();
renderer = gtk_cell_renderer_pixbuf_new ();
+ g_object_set(renderer, "stock-size", GTK_ICON_SIZE_DND, NULL);
gtk_tree_view_column_pack_start(column, renderer, FALSE);
- gtk_tree_view_column_set_attributes(column, renderer, "pixbuf", LST_PREF_SMALLPIXBUF, NULL);
+ gtk_tree_view_column_set_attributes(column, renderer, "icon-name", LST_PREF_ICONNAME, NULL);
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start(column, renderer, TRUE);
gtk_tree_view_append_column (GTK_TREE_VIEW(view), column);
-
- cellview = gtk_cell_view_new ();
-
//populate our combobox model
for(i=0;i<PREF_MAX;i++)
{
- GdkPixbuf *small_pixbuf = NULL;
-
gtk_list_store_append(store, &iter);
- /*
- if( pref_pixbuf[i] )
- small_pixbuf = gdk_pixbuf_scale_simple (pref_pixbuf[i], 24, 24, GDK_INTERP_BILINEAR);
- */
- small_pixbuf = gtk_widget_render_icon (cellview, pref_pixname[i], GTK_ICON_SIZE_DND, NULL);
-
gtk_list_store_set(store, &iter,
- LST_PREF_SMALLPIXBUF, small_pixbuf,
- LST_PREF_ICON, pref_pixbuf[i],
+ LST_PREF_ICONNAME, pref_iconname[i],
LST_PREF_NAME, _(pref_name[i]),
LST_PREF_PAGE, i,
-1);
}
- gtk_widget_destroy (cellview);
-
return(view);
}
-
-void free_pref_icons(void)
-{
-guint i;
-
- for(i=0;i<PREF_MAX;i++)
- {
- if(pref_pixbuf[i] != NULL)
- g_object_unref(pref_pixbuf[i]);
- }
-}
-
-void load_pref_icons(void)
-{
-//GError *error = NULL;
-GtkWidget *cellview;
-guint i;
-
- cellview = gtk_cell_view_new ();
-
- for(i=0;i<PREF_MAX;i++)
- {
- pref_pixbuf[i] = gtk_widget_render_icon (cellview, pref_pixname[i], GTK_ICON_SIZE_DIALOG, NULL);
- }
-
- gtk_widget_destroy (cellview);
-}
-
-
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
-
-static gchar *list_txn_column_label[] = {
- "----", //datas
- "----", //status
- "----", //date
- N_("Info" ),
- N_("Payee" ),
- N_("Memo" ),
- N_("Amount" ),
- N_("Expense" ),
- N_("Income" ),
- N_("Category"),
- N_("Tags" ),
- N_("Balance" ),
- NULL
-};
-
-
-//static gint n_ope_list_columns = G_N_ELEMENTS (ope_list_columns);
+/*
+extern gchar *list_txn_column_label[];
static void
GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
gboolean fixed;
- /* get toggled iter */
+ // get toggled iter
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter, COLUMN_VISIBLE, &fixed, -1);
- /* do something with the value */
+ // do something with the value
fixed ^= 1;
- /* set new value */
+ // set new value
gtk_list_store_set (GTK_LIST_STORE (model), &iter, COLUMN_VISIBLE, fixed, -1);
- /* clean up */
+ // clean up
gtk_tree_path_free (path);
}
gint i, id;
DB( g_print("[lst_txn-colpref] store column order \n") );
-
model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter);
// start at index 2 (status, date always displayed
columns[i+2] = visible == TRUE ? id : -id;
- /* Make iter point to the next row in the list store */
+ // Make iter point to the next row in the list store
valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter);
i++;
}
-
-
-
}
DB( g_print("[lst_txn-colpref] create\n") );
- /* create list store */
+ // create list store
store = gtk_list_store_new(
3,
G_TYPE_BOOLEAN,
G_TYPE_UINT
);
- /* populate */
+ // populate
for(i=0 ; i < NUM_LST_DSPOPE-1; i++ ) //-1 cause account column avoid
{
gint id;
if(i <= LST_DSPOPE_DATE) // status, date always displayed
continue;
- //[i-1] here because lst_ope_columns[] do not store LST_DSPOPE_DATAS
+ //[i-1] here because lst_ope_columns[] do not store MODEL_TXN_POINTER
id = ABS(PREFS->lst_ope_columns[i-1]);
if(id == 0) id = i; //if we pass here, new column or weird into pref file
visible = (PREFS->lst_ope_columns[i-1] > 0) ? TRUE : FALSE;
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
COLUMN_VISIBLE, visible,
- COLUMN_NAME, list_txn_column_label[id],
+ COLUMN_NAME, _(list_txn_column_label[id]),
COLUMN_ID , id,
-1);
return(view);
}
+*/
+
+
+static void list_ext_colpref_get(GtkTreeView *treeview, GList **columns)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ g_list_free_full(*columns, g_free);
+ *columns = NULL;
+
+ model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
+
+ gboolean valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter);
+ while (valid) {
+ gboolean enabled = FALSE;
+ const gchar* name;
+
+ gtk_tree_model_get(GTK_TREE_MODEL(model), &iter,
+ EXT_COLUMN_ENABLED, &enabled,
+ EXT_COLUMN_PLUGIN_NAME, &name,
+ -1);
+
+ if (enabled) {
+ *columns = g_list_append(*columns, g_strdup(name));
+ }
+
+ valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter);
+ }
+}