diff options
author | Miguel de Icaza <miguel@gnu.org> | 2001-01-17 15:41:23 +0800 |
---|---|---|
committer | Miguel de Icaza <miguel@src.gnome.org> | 2001-01-17 15:41:23 +0800 |
commit | 8063555853d12b632539322d0e8b927b4a0d73cf (patch) | |
tree | 8c5af31785a422f6c180aac444f77ba8557185d6 /widgets | |
parent | d645d1f2362a623b037cbfa09405e09b0f530c71 (diff) | |
download | gsoc2013-evolution-8063555853d12b632539322d0e8b927b4a0d73cf.tar.gz gsoc2013-evolution-8063555853d12b632539322d0e8b927b4a0d73cf.tar.zst gsoc2013-evolution-8063555853d12b632539322d0e8b927b4a0d73cf.zip |
Simplify column grabbing code and drop item layout code.
2001-01-17 Miguel de Icaza <miguel@gnu.org>
* e-table-config.c (config_sort_info_update): Simplify column
grabbing code and drop item layout code.
(config_group_info_update): ditto.
* e-table-config.c: Get correct translation setup working.
svn path=/trunk/; revision=7564
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/table/e-table-config.c | 86 |
1 files changed, 52 insertions, 34 deletions
diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c index af31e1e788..a8c413dd98 100644 --- a/widgets/table/e-table-config.c +++ b/widgets/table/e-table-config.c @@ -56,6 +56,21 @@ config_clear_group (GtkWidget *widget, ETableConfig *config) gtk_object_unref (GTK_OBJECT (config)); } +static ETableColumnSpecification * +find_column_in_spec (ETableSpecification *spec, int model_col) +{ + ETableColumnSpecification **column; + + for (column = spec->columns; *column; column++){ + if ((*column)->model_col != model_col) + continue; + + return *column; + } + + return NULL; +} + static void config_sort_config_show (GtkWidget *widget, ETableConfig *config) { @@ -71,6 +86,13 @@ config_sort_config_show (GtkWidget *widget, ETableConfig *config) gboolean sensitive = (i <= count); gtk_widget_set_sensitive (config->frames [i], sensitive); + + /* + * Sorting is set, auto select the text + */ + if ((i + 1) >= count){ + + } } button = gnome_dialog_run (dialog); @@ -86,30 +108,29 @@ config_sort_info_update (ETableConfig *config) { ETableSortInfo *info = config->state->sort_info; GString *res; - int count, i, items = 0; + int count, i; count = e_table_sort_info_sorting_get_count (info); res = g_string_new (""); for (i = 0; i < count; i++) { ETableSortColumn col = e_table_sort_info_sorting_get_nth (info, i); - ETableColumnSpecification **column; - - for (column = config->spec->columns; *column; column++) { - if (col.column != (*column)->model_col) - continue; - - g_string_append (res, _((*column)->title)); - g_string_append_c (res, ' '); - g_string_append ( - res, - col.ascending ? - _("(Ascending)") : _("(Descending)")); - items++; - if (items > 4) - g_string_append_c (res, '\n'); + ETableColumnSpecification *column; + + column = find_column_in_spec (config->spec, col.column); + if (!column){ + g_warning ("Could not find column model in specification"); + continue; } + + g_string_append (res, gettext ((column)->title)); + g_string_append_c (res, ' '); + g_string_append ( + res, + col.ascending ? + _("(Ascending)") : _("(Descending)")); } + if (res->str [0] == 0) g_string_append (res, _("Not sorted")); @@ -123,30 +144,27 @@ config_group_info_update (ETableConfig *config) { ETableSortInfo *info = config->state->sort_info; GString *res; - int count, i, items = 0; + int count, i; count = e_table_sort_info_grouping_get_count (info); res = g_string_new (""); for (i = 0; i < count; i++) { ETableSortColumn col = e_table_sort_info_grouping_get_nth (info, i); - ETableColumnSpecification **column; + ETableColumnSpecification *column; - for (column = config->spec->columns; *column; column++) { - if (col.column != (*column)->model_col) - continue; - - g_string_append (res, _((*column)->title)); - g_string_append_c (res, ' '); - g_string_append ( - res, - col.ascending ? - _("(Ascending)") : _("(Descending)")); - - items++; - if (items > 4) - g_string_append_c (res, '\n'); + column = find_column_in_spec (config->spec, col.column); + if (!column){ + g_warning ("Could not find model column in specification"); + continue; } + + g_string_append (res, gettext ((column)->title)); + g_string_append_c (res, ' '); + g_string_append ( + res, + col.ascending ? + _("(Ascending)") : _("(Descending)")); } if (res->str [0] == 0) g_string_append (res, _("No grouping")); @@ -168,7 +186,7 @@ config_fields_info_update (ETableConfig *config) if (config->state->columns [i] != (*column)->model_col) continue; - g_string_append (res, _((*column)->title)); + g_string_append (res, gettext ((*column)->title)); if (column [1]) g_string_append (res, ", "); items++; @@ -249,7 +267,7 @@ configure_sort_dialog (ETableConfig *config, GladeXML *gui) for (i = 0; i < 4; i++){ gtk_combo_text_add_item ( config->sort_combos [i], - _(label), label); + gettext (label), label); } } } |