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
This commit is contained in:
Christopher James Lahey
2002-05-01 23:26:42 +00:00
committed by Chris Lahey
parent 6be9006f3f
commit e1f208de7d
12 changed files with 87 additions and 36 deletions

View File

@ -45,8 +45,12 @@ BEGIN_GNOME_DECLS
# undef _
# ifdef GNOME_EXPLICIT_TRANSLATION_DOMAIN
# define _(String) dgettext (GNOME_EXPLICIT_TRANSLATION_DOMAIN, String)
/* No parentheses allowed here since that breaks string concatenation. */
# define E_I18N_DOMAIN GNOME_EXPLICIT_TRANSLATION_DOMAIN
# else
# define _(String) dgettext (PACKAGE, String)
/* No parentheses allowed here since that breaks string concatenation. */
# define E_I18N_DOMAIN PACKAGE
# endif
# ifdef gettext_noop
# define N_(String) gettext_noop (String)
@ -62,6 +66,8 @@ BEGIN_GNOME_DECLS
# define bindtextdomain(Domain,Directory) (Domain)
# define _(String) (String)
# define N_(String) (String)
/* No parentheses allowed here since that breaks string concatenation. */
# define E_I18N_DOMAIN ""
#endif
/*

View File

@ -22,12 +22,15 @@
*/
#include <config.h>
#include "gal-define-views-dialog.h"
#include <libgnomeui/gnome-dialog.h>
#include <libgnomeui/gnome-stock.h>
#include "gal-define-views-dialog.h"
#include "gal-define-views-model.h"
#include "gal-view-new-dialog.h"
#include <gal/e-table/e-table-scrolled.h>
#include <gal/util/e-i18n.h>
static void gal_define_views_dialog_init (GalDefineViewsDialog *card);
static void gal_define_views_dialog_class_init (GalDefineViewsDialogClass *klass);
@ -92,7 +95,7 @@ gal_define_views_dialog_class_init (GalDefineViewsDialogClass *klass)
}
/* ETable creation */
#define SPEC "<ETableSpecification cursor-mode=\"line\" draw-grid=\"true\" selection-mode=\"single\">" \
#define SPEC "<ETableSpecification cursor-mode=\"line\" draw-grid=\"true\" selection-mode=\"single\" gettext-domain=\"" E_I18N_DOMAIN "\">" \
"<ETableColumn model_col= \"0\" _title=\"Name\" expansion=\"1.0\" minimum_width=\"18\" resizable=\"true\" cell=\"string\" compare=\"string\"/>" \
"<ETableState> <column source=\"0\"/> <grouping> </grouping> </ETableState>" \
"</ETableSpecification>"

View File

@ -22,12 +22,15 @@
*/
#include <config.h>
#include "gal-view-instance-save-as-dialog.h"
#include <libgnomeui/gnome-dialog.h>
#include <libgnomeui/gnome-stock.h>
#include "gal-view-instance-save-as-dialog.h"
#include "gal-define-views-model.h"
#include "gal-view-new-dialog.h"
#include <gal/e-table/e-table-scrolled.h>
#include <gal/util/e-i18n.h>
static GnomeDialogClass *parent_class = NULL;
#define PARENT_TYPE gnome_dialog_get_type()
@ -218,7 +221,7 @@ gal_view_instance_save_as_dialog_init (GalViewInstanceSaveAsDialog *dialog)
/* For use from libglade. */
/* ETable creation */
#define SPEC "<ETableSpecification no-header=\"true\" cursor-mode=\"line\" draw-grid=\"false\" selection-mode=\"single\">" \
#define SPEC "<ETableSpecification no-header=\"true\" cursor-mode=\"line\" draw-grid=\"false\" selection-mode=\"single\" gettext-domain=\"" E_I18N_DOMAIN "\">" \
"<ETableColumn model_col= \"0\" _title=\"Name\" expansion=\"1.0\" minimum_width=\"18\" resizable=\"true\" cell=\"string\" compare=\"string\"/>" \
"<ETableState> <column source=\"0\"/> <grouping> </grouping> </ETableState>" \
"</ETableSpecification>"

View File

@ -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;

View File

@ -82,6 +82,7 @@ typedef struct {
ETableWithout *available_model;
ETable *shown;
ETableSubsetVariable *shown_model;
char *domain;
/*
* List of valid column names

View File

@ -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;

View File

@ -61,6 +61,7 @@ typedef struct {
ECursorMode cursor_mode;
char *click_to_add_message;
char *domain;
} ETableSpecification;
typedef struct {

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -154,6 +154,8 @@ typedef struct {
ETableDragSourceSite *site;
int header_width;
char *domain;
} ETable;
typedef struct {

View File

@ -23,11 +23,14 @@
*/
#include <config.h>
#include "e-completion-view.h"
#include <math.h>
#include <gdk/gdkkeysyms.h>
#include <gal/e-table/e-table-simple.h>
#include <gal/e-table/e-table-scrolled.h>
#include "e-completion-view.h"
#include <gal/util/e-i18n.h>
enum {
E_COMPLETION_VIEW_NONEMPTY,
@ -677,7 +680,7 @@ lost_completion_cb (ECompletion *completion, ECompletionMatch *match, gpointer u
/*** Table Callbacks ***/
static char *simple_spec =
"<ETableSpecification no-headers=\"true\" draw-grid=\"false\" cursor-mode=\"line\" alternating-row-colors=\"false\">"
"<ETableSpecification no-headers=\"true\" draw-grid=\"false\" cursor-mode=\"line\" alternating-row-colors=\"false\" gettext-domain=\"" E_I18N_DOMAIN "\">"
" <ETableColumn model_col=\"0\" _title=\"Node\" expansion=\"1.0\" "
" minimum_width=\"16\" resizable=\"true\" cell=\"string\" "
" compare=\"string\"/> "