/* HomeBank -- Free, easy, personal accounting for everyone.
- * Copyright (C) 1995-2016 Maxime DOYEN
+ * Copyright (C) 1995-2017 Maxime DOYEN
*
* This file is part of HomeBank.
*
#include "dsp_mainwindow.h"
#include "gtk-chart-colors.h"
+#include "ext.h"
+
#include "ui-currency.h"
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
};
"prf-import",
"prf-report",
"prf-euro", // to be renamed
+"prf-plugins",
//"prf_charts.svg"
};
N_("Display format"),
N_("Import/Export"),
N_("Report"),
-N_("Euro minor")
+N_("Euro minor"),
+N_("Plugins")
//
};
typedef struct
{
+ gshort id;
gchar *iso;
gchar *name;
gdouble value;
*/
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 , "Lm" , 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 }, // jan. 2014
-/* 2016 */
- { "LTL", "Lithuania" , 3.45280 , "Lt." , TRUE , ",", "" , 2 }, // jan. 2015
-
-/* future */
- { "BGN", "Bulgaria" , 1.95583 , "лв." , TRUE , ",", " ", 2 }, // non-fixé - 2014 target for euro
- { "HUF", "Hungary" , 261.51 , "Ft" , TRUE , ",", " ", 2 }, // non-fixé - No current target for euro
- { "RON", "Romania" , 3.5155 , "Leu" , FALSE, ",", ".", 2 }, // non-fixé - 2015 target for euro earliest
- { "CZK", "Czech republic", 28.36 , "Kč" , FALSE, ",", " ", 2 }, // non-fixé - 2015 earliest
- { "HRK", "Croatia" , 1.0000 , "kn" , FALSE, "" , ".", 0 }, // non-fixé - 2015 target for euro earliest
- { "PLN", "Poland" , 0.25 , "zł" , FALSE, ",", "" , 2 }, // non-fixé - No current target for euro
-
+ { 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 },
-
};
static void list_txn_colpref_get(GtkTreeView *treeview, gboolean *columns);
+static void list_ext_colpref_get(GtkTreeView *treeview, GList **columns);
{ "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 gint ui_euro_combobox_id_to_active(gint id)
+{
+guint i, retval;
-/*
-**
-*/
-static GtkWidget *make_euro_presets(GtkWidget *label)
+ DB( g_print("\n[ui-pref] ui_euro_combobox_id_to_active\n") );
+
+ retval = 0;
+ for (i = 0; i < G_N_ELEMENTS (euro_params); i++)
+ {
+ if( euro_params[i].id == id )
+ {
+ retval = i;
+ DB( g_print("- id (country)=%d => %d - %s\n", id, i, euro_params[i].name) );
+ break;
+ }
+ }
+
+ return retval;
+}
+
+
+
+static gint ui_euro_combobox_active_to_id(gint active)
+{
+gint id;
+
+ DB( g_print("\n[ui-pref] ui_euro_combobox_active_to_id\n") );
+
+ DB( g_print("- to %d\n", active) );
+
+ id = 0;
+ if( active < (gint)G_N_ELEMENTS (euro_params) )
+ {
+ id = euro_params[active].id;
+ DB( g_print("- id (country)=%d '%s'\n", id, euro_params[active].name) );
+ }
+ return id;
+}
+
+
+static GtkWidget *ui_euro_combobox_new(GtkWidget *label)
{
GtkWidget *combobox;
guint i;
/*
** set euro value widget from a country
*/
-static void defpref_eurosetcurrency(GtkWidget *widget, gpointer user_data)
+static void defpref_eurosetcurrency(GtkWidget *widget, gint country)
{
struct defpref_data *data;
-EuroParams *euro = user_data;
+EuroParams *euro;
gchar *buf;
-
+gint active;
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);
}
-
/*
** set euro value widget from a country
*/
static void defpref_europreset(GtkWidget *widget, gpointer user_data)
{
struct defpref_data *data;
-gint country;
+gint active;
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");
- country = gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_euro_preset));
- data->country = country;
+ 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, &euro_params[country]);
+ defpref_eurosetcurrency(widget, data->country);
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_euro_value), euro_params[country].value);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_euro_value), euro_params[active].value);
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_euro_fracdigits), euro_params[country].frac_digits);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_euro_fracdigits), euro_params[active].frac_digits);
- 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].sym_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);
+ 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);
}
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_rgba_parse(&rgba, PREFS->color_exp);
/* euro */
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);
-
data->country = PREFS->euro_country;
- defpref_eurosetcurrency(data->window, &euro_params[PREFS->euro_country]);
+ defpref_eurosetcurrency(data->window, data->country);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_euro_value), PREFS->euro_value);
//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));
}
label = make_label_widget(_("_Preset:"));
//----------------------------------------- l, r, t, b
gtk_grid_attach (GTK_GRID (group_grid), label, 2, row, 1, 1);
- widget = make_euro_presets(label);
+ 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);
return content_grid;
}
+
+void plugin_execute_action(GtkTreeView* treeview, GtkTreePath* path, GtkTreeViewColumn* col, gpointer userdata);
+
+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");
+ }
+ }
+
+ /* set new value */
+ gtk_list_store_set(GTK_LIST_STORE (model), &iter, EXT_COLUMN_ENABLED, enabled, -1);
+
+ /* 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;
// the window creation
-GtkWidget *defpref_dialog_new (void)
+GtkWidget *defpref_dialog_new (gint initial_selection)
{
struct defpref_data data;
GtkWidget *window, *content, *mainvbox;
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);
//select first row
- GtkTreePath *path = gtk_tree_path_new_first ();
+ 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;
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);
+ }
+}
+