aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2002-05-02 07:26:42 +0800
committerChris Lahey <clahey@src.gnome.org>2002-05-02 07:26:42 +0800
commite1f208de7dfadbd84d2e5aa75204f04f60ad49e0 (patch)
tree08088fc548e31986fc29b715d489eb6389fd77d4 /widgets/table
parent6be9006f3fa356bf1402067ec60aa278871562bb (diff)
downloadgsoc2013-evolution-e1f208de7dfadbd84d2e5aa75204f04f60ad49e0.tar.gz
gsoc2013-evolution-e1f208de7dfadbd84d2e5aa75204f04f60ad49e0.tar.zst
gsoc2013-evolution-e1f208de7dfadbd84d2e5aa75204f04f60ad49e0.zip
Set the gettext-domain here.
2002-05-01 Christopher James Lahey <clahey@ximian.com> * gal/e-text/e-completion-view.c (simple_spec), gal/widgets/e-categories-master-list-dialog.c (SPEC), gal/widgets/e-categories.c (INITIAL_SPEC): Set the gettext-domain here. * gal/util/e-i18n.h (E_I18N_DOMAIN): #define as makes sense in the different cases. From gal/e-table/ChangeLog: 2002-05-01 Christopher James Lahey <clahey@ximian.com> * e-table-config.c, e-table-config.h, e-table-specification.c, e-table-specification.h, e-table-utils.c, e-table-utils.h, e-table.c, e-table.h: Made these pay attention to the gettext-domain in the etspec. * e-table-config.c: Set the gettext-domain in the etspec here. From gal/menus/ChangeLog: 2002-05-01 Christopher James Lahey <clahey@ximian.com> * gal-define-views-dialog.c (SPEC), gal-view-instance-save-as-dialog.c (SPEC): Set the gettext-domain here. svn path=/trunk/; revision=16658
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-table-config.c46
-rw-r--r--widgets/table/e-table-config.h1
-rw-r--r--widgets/table/e-table-specification.c16
-rw-r--r--widgets/table/e-table-specification.h1
-rw-r--r--widgets/table/e-table-utils.c11
-rw-r--r--widgets/table/e-table-utils.h10
-rw-r--r--widgets/table/e-table.c9
-rw-r--r--widgets/table/e-table.h2
8 files changed, 66 insertions, 30 deletions
diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c
index b9922a2d38..05e5b09ddf 100644
--- a/widgets/table/e-table-config.c
+++ b/widgets/table/e-table-config.c
@@ -74,9 +74,13 @@ config_destroy (GtkObject *object)
gtk_object_unref (GTK_OBJECT (config->source_state));
gtk_object_unref (GTK_OBJECT (config->source_spec));
g_free (config->header);
+ config->header = NULL;
g_slist_free (config->column_names);
config->column_names = NULL;
+
+ g_free (config->domain);
+ config->domain = NULL;
GTK_OBJECT_CLASS (config_parent_class)->destroy (object);
}
@@ -132,6 +136,8 @@ config_class_init (GtkObjectClass *object_class)
gtk_object_add_arg_type ("ETableConfig::state", E_TABLE_STATE_TYPE,
GTK_ARG_READABLE, ARG_STATE);
+
+ glade_gnome_init ();
}
static ETableColumnSpecification *
@@ -222,7 +228,7 @@ update_sort_and_group_config_dialog (ETableConfig *config, gboolean is_sort)
continue;
}
- text = gettext (column->title);
+ text = dgettext (config->domain, column->title);
/*
* Update radio buttons
@@ -278,7 +284,7 @@ config_sort_info_update (ETableConfig *config)
continue;
}
- g_string_append (res, gettext ((column)->title));
+ g_string_append (res, dgettext (config->domain, (column)->title));
g_string_append_c (res, ' ');
g_string_append (
res,
@@ -319,8 +325,8 @@ config_group_info_update (ETableConfig *config)
g_warning ("Could not find model column in specification");
continue;
}
-
- g_string_append (res, gettext ((column)->title));
+
+ g_string_append (res, dgettext (config->domain, (column)->title));
g_string_append_c (res, ' ');
g_string_append (
res,
@@ -368,8 +374,8 @@ config_fields_info_update (ETableConfig *config)
if (config->state->columns [i] != (*column)->model_col)
continue;
-
- g_string_append (res, gettext ((*column)->title));
+
+ g_string_append (res, dgettext (config->domain, (*column)->title));
if (column [1])
g_string_append (res, ", ");
}
@@ -496,12 +502,13 @@ create_global_store (ETableConfig *config)
}
}
-char *spec = "<ETableSpecification no-headers=\"true\" cursor-mode=\"line\" draw-grid=\"false\" draw-focus=\"true\" selection-mode=\"browse\"> \
- <ETableColumn model_col= \"0\" _title=\"Name\" minimum_width=\"30\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableState> <column source=\"0\"/> \
- <grouping/> \
- </ETableState> \
- </ETableSpecification>";
+char *spec = "<ETableSpecification gettext-domain=\"" E_I18N_DOMAIN "\" no-headers=\"true\" cursor-mode=\"line\" "
+ " draw-grid=\"false\" draw-focus=\"true\" selection-mode=\"browse\">"
+ "<ETableColumn model_col= \"0\" _title=\"Name\" minimum_width=\"30\" resizable=\"true\" cell=\"string\" compare=\"string\"/>"
+ "<ETableState> <column source=\"0\"/>"
+ "<grouping/>"
+ "</ETableState>"
+ "</ETableSpecification>";
GtkWidget *e_table_proxy_etable_shown_new (void);
@@ -680,9 +687,8 @@ configure_sort_dialog (ETableConfig *config, GladeXML *gui)
char *label = l->data;
for (i = 0; i < 4; i++){
- gtk_combo_text_add_item (
- config->sort [i].combo,
- gettext (label), label);
+ gtk_combo_text_add_item (config->sort [i].combo,
+ dgettext (config->domain, label), label);
}
}
@@ -792,7 +798,7 @@ configure_group_dialog (ETableConfig *config, GladeXML *gui)
for (i = 0; i < 4; i++){
gtk_combo_text_add_item (
config->group [i].combo,
- gettext (label), label);
+ dgettext (config->domain, label), label);
}
}
@@ -996,9 +1002,9 @@ setup_gui (ETableConfig *config)
create_global_store (config);
if (e_table_sort_info_get_can_group (config->state->sort_info)) {
- gui = glade_xml_new_with_domain (ETABLE_GLADEDIR "/e-table-config.glade", NULL, PACKAGE);
+ gui = glade_xml_new_with_domain (ETABLE_GLADEDIR "/e-table-config.glade", NULL, E_I18N_DOMAIN);
} else {
- gui = glade_xml_new_with_domain (ETABLE_GLADEDIR "/e-table-config-no-group.glade", NULL, PACKAGE);
+ gui = glade_xml_new_with_domain (ETABLE_GLADEDIR "/e-table-config-no-group.glade", NULL, E_I18N_DOMAIN);
}
gtk_object_unref (GTK_OBJECT (global_store));
@@ -1052,7 +1058,7 @@ setup_gui (ETableConfig *config)
static void
config_init (ETableConfig *config)
{
- glade_gnome_init ();
+ config->domain = NULL;
}
ETableConfig *
@@ -1077,6 +1083,8 @@ e_table_config_construct (ETableConfig *config,
config->state = e_table_state_duplicate (state);
+ config->domain = g_strdup (spec->domain);
+
for (column = config->source_spec->columns; *column; column++){
char *label = (*column)->title;
diff --git a/widgets/table/e-table-config.h b/widgets/table/e-table-config.h
index 46bf1507ac..d5640f73cd 100644
--- a/widgets/table/e-table-config.h
+++ b/widgets/table/e-table-config.h
@@ -82,6 +82,7 @@ typedef struct {
ETableWithout *available_model;
ETable *shown;
ETableSubsetVariable *shown_model;
+ char *domain;
/*
* List of valid column names
diff --git a/widgets/table/e-table-specification.c b/widgets/table/e-table-specification.c
index e449d4e9b7..4c04d78c80 100644
--- a/widgets/table/e-table-specification.c
+++ b/widgets/table/e-table-specification.c
@@ -54,9 +54,12 @@ etsp_destroy (GtkObject *object)
gtk_object_unref (GTK_OBJECT (etsp->state));
g_free (etsp->click_to_add_message);
+ g_free (etsp->domain);
+
etsp->columns = NULL;
etsp->state = NULL;
etsp->click_to_add_message = NULL;
+ etsp->domain = NULL;
GTK_OBJECT_CLASS (etsp_parent_class)->destroy (object);
}
@@ -90,6 +93,7 @@ etsp_init (ETableSpecification *etsp)
etsp->selection_mode = GTK_SELECTION_MULTIPLE;
etsp->click_to_add_message = NULL;
+ etsp->domain = NULL;
}
E_MAKE_TYPE (e_table_specification, "ETableSpecification", ETableSpecification, etsp_class_init, etsp_init, PARENT_TYPE)
@@ -214,12 +218,21 @@ e_table_specification_load_from_node (ETableSpecification *specification,
specification->cursor_mode = E_CURSOR_SPREADSHEET;
}
g_free (temp);
- g_free (specification->click_to_add_message);
+ g_free (specification->click_to_add_message);
specification->click_to_add_message =
e_xml_get_string_prop_by_name (
node, "_click-to-add-message");
+ g_free (specification->domain);
+ specification->domain =
+ e_xml_get_string_prop_by_name (
+ node, "gettext-domain");
+ if (specification->domain && !*specification->domain) {
+ g_free (specification->domain);
+ specification->domain = NULL;
+ }
+
if (specification->state)
gtk_object_unref (GTK_OBJECT (specification->state));
specification->state = NULL;
@@ -359,6 +372,7 @@ e_table_specification_save_to_node (ETableSpecification *specification,
xmlSetProp (node, "cursor-mode", s);
xmlSetProp (node, "_click-to-add-message", specification->click_to_add_message);
+ xmlSetProp (node, "gettext-domain", specification->domain);
if (specification->columns){
int i;
diff --git a/widgets/table/e-table-specification.h b/widgets/table/e-table-specification.h
index 35425fe0af..3f21426390 100644
--- a/widgets/table/e-table-specification.h
+++ b/widgets/table/e-table-specification.h
@@ -61,6 +61,7 @@ typedef struct {
ECursorMode cursor_mode;
char *click_to_add_message;
+ char *domain;
} ETableSpecification;
typedef struct {
diff --git a/widgets/table/e-table-utils.c b/widgets/table/e-table-utils.c
index a155d49b0a..c013a806b2 100644
--- a/widgets/table/e-table-utils.c
+++ b/widgets/table/e-table-utils.c
@@ -68,7 +68,8 @@ e_table_state_to_header (GtkWidget *widget, ETableHeader *full_header, ETableSta
static ETableCol *
et_col_spec_to_col (ETableColumnSpecification *col_spec,
- ETableExtras *ete)
+ ETableExtras *ete,
+ const char *domain)
{
ETableCol *col = NULL;
ECell *cell = NULL;
@@ -83,6 +84,8 @@ et_col_spec_to_col (ETableColumnSpecification *col_spec,
search = e_table_extras_get_search(ete, col_spec->search);
if (cell && compare) {
+ const char *title = dgettext (domain, col_spec->title);
+
if (col_spec->pixbuf && *col_spec->pixbuf) {
GdkPixbuf *pixbuf;
@@ -90,7 +93,7 @@ et_col_spec_to_col (ETableColumnSpecification *col_spec,
ete, col_spec->pixbuf);
if (pixbuf) {
col = e_table_col_new_with_pixbuf (
- col_spec->model_col, gettext (col_spec->title),
+ col_spec->model_col, title,
pixbuf, col_spec->expansion,
col_spec->minimum_width,
cell, compare, col_spec->resizable, col_spec->disabled, col_spec->priority);
@@ -98,7 +101,7 @@ et_col_spec_to_col (ETableColumnSpecification *col_spec,
}
if (col == NULL && col_spec->title && *col_spec->title) {
col = e_table_col_new (
- col_spec->model_col, gettext (col_spec->title),
+ col_spec->model_col, title,
col_spec->expansion, col_spec->minimum_width,
cell, compare, col_spec->resizable, col_spec->disabled, col_spec->priority);
}
@@ -121,7 +124,7 @@ e_table_spec_to_full_header (ETableSpecification *spec,
for (column = 0; spec->columns[column]; column++) {
ETableCol *col = et_col_spec_to_col (
- spec->columns[column], ete);
+ spec->columns[column], ete, spec->domain);
if (col)
e_table_header_add_column (nh, col, -1);
diff --git a/widgets/table/e-table-utils.h b/widgets/table/e-table-utils.h
index e5ac1d8a72..7438a9c759 100644
--- a/widgets/table/e-table-utils.h
+++ b/widgets/table/e-table-utils.h
@@ -32,12 +32,12 @@
BEGIN_GNOME_DECLS
-ETableHeader *e_table_state_to_header (GtkWidget *widget,
- ETableHeader *full_header,
- ETableState *state);
+ETableHeader *e_table_state_to_header (GtkWidget *widget,
+ ETableHeader *full_header,
+ ETableState *state);
-ETableHeader *e_table_spec_to_full_header (ETableSpecification *spec,
- ETableExtras *ete);
+ETableHeader *e_table_spec_to_full_header (ETableSpecification *spec,
+ ETableExtras *ete);
END_GNOME_DECLS
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index 7106400d29..f80c2b6a04 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -327,6 +327,10 @@ et_destroy (GtkObject *object)
}
g_free(et->click_to_add_message);
+ et->click_to_add_message = NULL;
+
+ g_free(et->domain);
+ et->domain = NULL;
(*parent_class->destroy)(object);
}
@@ -447,6 +451,7 @@ e_table_init (GtkObject *object)
e_table->horizontal_resize = FALSE;
e_table->click_to_add_message = NULL;
+ e_table->domain = NULL;
e_table->drag_get_data_row = -1;
e_table->drag_get_data_col = -1;
@@ -1372,9 +1377,11 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete,
else
ete = e_table_extras_new();
+ e_table->domain = g_strdup (specification->domain);
+
e_table->use_click_to_add = specification->click_to_add;
e_table->use_click_to_add_end = specification->click_to_add_end;
- e_table->click_to_add_message = e_utf8_from_locale_string (gettext (specification->click_to_add_message));
+ e_table->click_to_add_message = e_utf8_from_locale_string (dgettext (e_table->domain, specification->click_to_add_message));
e_table->alternating_row_colors = specification->alternating_row_colors;
e_table->horizontal_draw_grid = specification->horizontal_draw_grid;
e_table->vertical_draw_grid = specification->vertical_draw_grid;
diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h
index 8ffdee7771..58c88d2a0e 100644
--- a/widgets/table/e-table.h
+++ b/widgets/table/e-table.h
@@ -154,6 +154,8 @@ typedef struct {
ETableDragSourceSite *site;
int header_width;
+
+ char *domain;
} ETable;
typedef struct {