aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2002-05-03 04:32:19 +0800
committerChris Lahey <clahey@src.gnome.org>2002-05-03 04:32:19 +0800
commit874390a8376202f138266bdd641e810db93a3136 (patch)
tree1e19721ead0b36bade4cc011313b0c70b5c71a5d
parentcad5e25f863f3bf643a2c7a7b4a77be0bc9db130 (diff)
downloadgsoc2013-evolution-874390a8376202f138266bdd641e810db93a3136.tar
gsoc2013-evolution-874390a8376202f138266bdd641e810db93a3136.tar.gz
gsoc2013-evolution-874390a8376202f138266bdd641e810db93a3136.tar.bz2
gsoc2013-evolution-874390a8376202f138266bdd641e810db93a3136.tar.lz
gsoc2013-evolution-874390a8376202f138266bdd641e810db93a3136.tar.xz
gsoc2013-evolution-874390a8376202f138266bdd641e810db93a3136.tar.zst
gsoc2013-evolution-874390a8376202f138266bdd641e810db93a3136.zip
Added this function that lets you specify the translation domain.
2002-05-02 Christopher James Lahey <clahey@ximian.com> * gal/widgets/e-popup-menu.c, gal/widgets/e-popup-menu.h (e_popup_menu_create_with_domain): Added this function that lets you specify the translation domain. From gal/e-table/ChangeLog: 2002-05-02 Christopher James Lahey <clahey@ximian.com> * e-table-click-to-add.c (finish_editing): Add horizontal dividers here too. * e-table-config.c (create_global_store): Translate column headers here. * e-table-header-item.c (ethi_header_context_menu): Use e_popup_menu_create_with_domain here. * e-table-header-utils.c (e_table_header_draw_button): Translate from utf8 here before drawing. * e-table-memory-store.c, e-table-memory-store.h (e_table_memory_store_insert_adopt_array): Changed the name of this function from e_table_memory_store_insert_adopt. (e_table_memory_store_insert_adopt): Added this function which takes a ... list. * e-table-utils.c (et_col_spec_to_col): Translate column titles to utf8 here. svn path=/trunk/; revision=16668
-rw-r--r--widgets/misc/e-popup-menu.c46
-rw-r--r--widgets/misc/e-popup-menu.h33
-rw-r--r--widgets/table/e-table-click-to-add.c2
-rw-r--r--widgets/table/e-table-config.c6
-rw-r--r--widgets/table/e-table-header-item.c14
-rw-r--r--widgets/table/e-table-header-utils.c14
-rw-r--r--widgets/table/e-table-memory-store.c22
-rw-r--r--widgets/table/e-table-memory-store.h50
-rw-r--r--widgets/table/e-table-utils.c7
-rw-r--r--widgets/table/e-tree-selection-model.c11
10 files changed, 121 insertions, 84 deletions
diff --git a/widgets/misc/e-popup-menu.c b/widgets/misc/e-popup-menu.c
index 86a07a74c8..1ce38c4d02 100644
--- a/widgets/misc/e-popup-menu.c
+++ b/widgets/misc/e-popup-menu.c
@@ -40,30 +40,6 @@
#include <libgnome/gnome-i18n.h>
-#ifndef GNOME_APP_HELPER_H
-/* Copied this i18n function to use for the same purpose */
-
-#ifdef ENABLE_NLS
-#define L_(x) gnome_app_helper_gettext(x)
-
-static gchar *
-gnome_app_helper_gettext (const gchar *str)
-{
- char *s;
-
- s = gettext (str);
- if ( s == str )
- s = dgettext (PACKAGE, str);
-
- return s;
-}
-
-#else
-#define L_(x) x
-#endif
-
-#endif
-
/*
* Creates an item with an optional icon
*/
@@ -99,7 +75,25 @@ make_item (GtkMenu *menu, GtkMenuItem *item, const char *name, GtkWidget *pixmap
}
GtkMenu *
-e_popup_menu_create (EPopupMenu *menu_list, guint32 disable_mask, guint32 hide_mask, void *default_closure)
+e_popup_menu_create (EPopupMenu *menu_list,
+ guint32 disable_mask,
+ guint32 hide_mask,
+ void *default_closure)
+{
+ return e_popup_menu_create_with_domain (menu_list,
+ disable_mask,
+ hide_mask,
+ default_closure,
+ NULL);
+}
+
+
+GtkMenu *
+e_popup_menu_create_with_domain (EPopupMenu *menu_list,
+ guint32 disable_mask,
+ guint32 hide_mask,
+ void *default_closure,
+ const char *domain)
{
GtkMenu *menu = GTK_MENU (gtk_menu_new ());
GSList *group = NULL;
@@ -133,7 +127,7 @@ e_popup_menu_create (EPopupMenu *menu_list, guint32 disable_mask, guint32 hide_m
if (menu_list[i].is_radio)
group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
- make_item (menu, GTK_MENU_ITEM (item), L_(menu_list[i].name), menu_list[i].pixmap_widget);
+ make_item (menu, GTK_MENU_ITEM (item), dgettext(domain, menu_list[i].name), menu_list[i].pixmap_widget);
} else {
item = gtk_menu_item_new ();
}
diff --git a/widgets/misc/e-popup-menu.h b/widgets/misc/e-popup-menu.h
index 50fb7c23e5..d096efa06d 100644
--- a/widgets/misc/e-popup-menu.h
+++ b/widgets/misc/e-popup-menu.h
@@ -91,24 +91,29 @@ struct _EPopupMenu {
};
-GtkMenu *e_popup_menu_create (EPopupMenu *menu_list,
- guint32 disable_mask,
- guint32 hide_mask,
- void *default_closure);
-void e_popup_menu_run (EPopupMenu *menu_list,
- GdkEvent *event,
- guint32 disable_mask,
- guint32 hide_mask,
- void *default_closure);
+GtkMenu *e_popup_menu_create (EPopupMenu *menu_list,
+ guint32 disable_mask,
+ guint32 hide_mask,
+ void *default_closure);
+GtkMenu *e_popup_menu_create_with_domain (EPopupMenu *menu_list,
+ guint32 disable_mask,
+ guint32 hide_mask,
+ void *default_closure,
+ const char *domain);
+void e_popup_menu_run (EPopupMenu *menu_list,
+ GdkEvent *event,
+ guint32 disable_mask,
+ guint32 hide_mask,
+ void *default_closure);
/* Doesn't copy or free the memory. Just the contents. */
-void e_popup_menu_copy_1 (EPopupMenu *destination,
- const EPopupMenu *menu_item);
-void e_popup_menu_free_1 (EPopupMenu *menu_item);
+void e_popup_menu_copy_1 (EPopupMenu *destination,
+ const EPopupMenu *menu_item);
+void e_popup_menu_free_1 (EPopupMenu *menu_item);
/* Copies or frees the entire structure. */
-EPopupMenu *e_popup_menu_copy (const EPopupMenu *menu_item);
-void e_popup_menu_free (EPopupMenu *menu_item);
+EPopupMenu *e_popup_menu_copy (const EPopupMenu *menu_item);
+void e_popup_menu_free (EPopupMenu *menu_item);
END_GNOME_DECLS
diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c
index db3ca1d944..d0fa452f40 100644
--- a/widgets/table/e-table-click-to-add.c
+++ b/widgets/table/e-table-click-to-add.c
@@ -317,7 +317,7 @@ finish_editing (ETableClickToAdd *etcta)
"ETableHeader", etcta->eth,
"ETableModel", etcta->one,
"minimum_width", etcta->width,
- "horizontal_draw_grid", FALSE,
+ "horizontal_draw_grid", TRUE,
"vertical_draw_grid", TRUE,
"selection_model", etcta->selection,
"cursor_mode", E_CURSOR_SPREADSHEET,
diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c
index 05e5b09ddf..a3e9554d3a 100644
--- a/widgets/table/e-table-config.c
+++ b/widgets/table/e-table-config.c
@@ -43,6 +43,7 @@
#include <glade/glade.h>
#include "gal/util/e-util.h"
#include "gal/util/e-i18n.h"
+#include "gal/widgets/e-unicode.h"
#include <e-table-scrolled.h>
#include <e-table-without.h>
@@ -498,7 +499,10 @@ create_global_store (ETableConfig *config)
global_store = e_table_memory_store_new (store_columns);
for (i = 0; config->source_spec->columns[i]; i++) {
- e_table_memory_store_insert (E_TABLE_MEMORY_STORE (global_store), i, NULL, config->source_spec->columns[i]->title);
+ char *text = e_utf8_from_locale_string (dgettext (config->domain,
+ config->source_spec->columns[i]->title));
+
+ e_table_memory_store_insert_adopt (E_TABLE_MEMORY_STORE (global_store), i, NULL, text);
}
}
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index ac9512d765..66b570ce10 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -1478,13 +1478,13 @@ ethi_header_context_menu (ETableHeaderItem *ethi, GdkEventButton *event)
info->col = ethi_find_col_by_x (ethi, event->x);
col = e_table_header_get_column (ethi->eth, info->col);
- popup = e_popup_menu_create (ethi_context_menu,
- 1 +
- (col->sortable ? 0 : 2) +
- ((ethi->table || ethi->tree) ? 0 : 4) +
- ((e_table_header_count (ethi->eth) > 1) ? 0 : 8),
- ((e_table_sort_info_get_can_group (ethi->sort_info)) ? 0 : 16) +
- 128, info);
+ popup = e_popup_menu_create_with_domain (ethi_context_menu,
+ 1 +
+ (col->sortable ? 0 : 2) +
+ ((ethi->table || ethi->tree) ? 0 : 4) +
+ ((e_table_header_count (ethi->eth) > 1) ? 0 : 8),
+ ((e_table_sort_info_get_can_group (ethi->sort_info)) ? 0 : 16) +
+ 128, info, E_I18N_DOMAIN);
gtk_signal_connect (GTK_OBJECT (popup), "selection-done",
GTK_SIGNAL_FUNC (free_popup_info), info);
e_popup_menu (popup, (GdkEvent *) event);
diff --git a/widgets/table/e-table-header-utils.c b/widgets/table/e-table-header-utils.c
index d5000a9800..9668250961 100644
--- a/widgets/table/e-table-header-utils.c
+++ b/widgets/table/e-table-header-utils.c
@@ -27,10 +27,12 @@
#include <config.h>
#endif
+#include "e-table-header-utils.h"
+
#include <string.h> /* strlen() */
#include <glib.h>
#include "e-table-defines.h"
-#include "e-table-header-utils.h"
+#include <gal/widgets/e-unicode.h>
@@ -225,6 +227,7 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
int inner_x, inner_y;
int inner_width, inner_height;
GdkGC *gc;
+ char *text;
g_return_if_fail (drawable != NULL);
g_return_if_fail (ecol != NULL);
@@ -302,6 +305,8 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
/* Pixbuf or label */
+ text = e_utf8_to_gtk_string (widget, ecol->text);
+
if (ecol->is_pixbuf) {
int pwidth, pheight;
int clip_width, clip_height;
@@ -323,7 +328,7 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
int width;
int ypos;
- gdk_string_extents (font, ecol->text, NULL, &rbearing, &width, NULL, NULL);
+ gdk_string_extents (font, text, NULL, &rbearing, &width, NULL, NULL);
if (rbearing < inner_width - (pwidth + 1)) {
xpos = inner_x + (inner_width - width - (pwidth + 1)) / 2;
}
@@ -332,7 +337,7 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
e_table_draw_elided_string (drawable, font, gc,
xpos + pwidth + 1, ypos,
- ecol->text, inner_width - (xpos - inner_x), FALSE);
+ text, inner_width - (xpos - inner_x), FALSE);
}
pixmap = make_composite_pixmap (drawable, gc,
@@ -355,8 +360,9 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
e_table_draw_elided_string (drawable, font, gc,
inner_x, ypos,
- ecol->text, inner_width, TRUE);
+ text, inner_width, TRUE);
}
+ g_free (text);
}
/* Computes the length of a string that needs to be trimmed for elision */
diff --git a/widgets/table/e-table-memory-store.c b/widgets/table/e-table-memory-store.c
index a16bb104b1..e36a0e1558 100644
--- a/widgets/table/e-table-memory-store.c
+++ b/widgets/table/e-table-memory-store.c
@@ -372,7 +372,7 @@ e_table_memory_store_insert (ETableMemoryStore *etms, int row, gpointer data, ..
}
void
-e_table_memory_store_insert_adopt (ETableMemoryStore *etms, int row, void **store, gpointer data)
+e_table_memory_store_insert_adopt_array (ETableMemoryStore *etms, int row, void **store, gpointer data)
{
int row_count;
int i;
@@ -393,6 +393,26 @@ e_table_memory_store_insert_adopt (ETableMemoryStore *etms, int row, void **stor
}
void
+e_table_memory_store_insert_adopt (ETableMemoryStore *etms, int row, gpointer data, ...)
+{
+ void **store;
+ va_list args;
+ int i;
+
+ store = g_new (void *, etms->priv->col_count + 1);
+
+ va_start (args, data);
+ for (i = 0; i < etms->priv->col_count; i++) {
+ store[i] = va_arg (args, void *);
+ }
+ va_end (args);
+
+ e_table_memory_store_insert_adopt_array (etms, row, store, data);
+
+ g_free (store);
+}
+
+void
e_table_memory_store_remove (ETableMemoryStore *etms, int row)
{
int row_count;
diff --git a/widgets/table/e-table-memory-store.h b/widgets/table/e-table-memory-store.h
index 2c088815de..c4d7f2bfe3 100644
--- a/widgets/table/e-table-memory-store.h
+++ b/widgets/table/e-table-memory-store.h
@@ -83,35 +83,39 @@ typedef struct {
ETableMemoryClass parent_class;
} ETableMemoryStoreClass;
-GtkType e_table_memory_store_get_type (void);
+GtkType e_table_memory_store_get_type (void);
/* Object Creation */
-ETableModel *e_table_memory_store_new (ETableMemoryStoreColumnInfo *columns);
-ETableModel *e_table_memory_store_construct (ETableMemoryStore *store,
- ETableMemoryStoreColumnInfo *columns);
+ETableModel *e_table_memory_store_new (ETableMemoryStoreColumnInfo *columns);
+ETableModel *e_table_memory_store_construct (ETableMemoryStore *store,
+ ETableMemoryStoreColumnInfo *columns);
/* Adopt a value instead of copying it. */
-void e_table_memory_store_adopt_value_at (ETableMemoryStore *etms,
- int col,
- int row,
- void *value);
+void e_table_memory_store_adopt_value_at (ETableMemoryStore *etms,
+ int col,
+ int row,
+ void *value);
/* The size of these arrays is the number of columns. */
-void e_table_memory_store_insert_array (ETableMemoryStore *etms,
- int row,
- void **store,
- gpointer data);
-void e_table_memory_store_insert (ETableMemoryStore *etms,
- int row,
- gpointer data,
- ...);
-void e_table_memory_store_insert_adopt (ETableMemoryStore *etms,
- int row,
- void **store,
- gpointer data);
-void e_table_memory_store_remove (ETableMemoryStore *etms,
- int row);
-void e_table_memory_store_clear (ETableMemoryStore *etms);
+void e_table_memory_store_insert_array (ETableMemoryStore *etms,
+ int row,
+ void **store,
+ gpointer data);
+void e_table_memory_store_insert (ETableMemoryStore *etms,
+ int row,
+ gpointer data,
+ ...);
+void e_table_memory_store_insert_adopt (ETableMemoryStore *etms,
+ int row,
+ gpointer data,
+ ...);
+void e_table_memory_store_insert_adopt_array (ETableMemoryStore *etms,
+ int row,
+ void **store,
+ gpointer data);
+void e_table_memory_store_remove (ETableMemoryStore *etms,
+ int row);
+void e_table_memory_store_clear (ETableMemoryStore *etms);
END_GNOME_DECLS
diff --git a/widgets/table/e-table-utils.c b/widgets/table/e-table-utils.c
index c013a806b2..8ae460681f 100644
--- a/widgets/table/e-table-utils.c
+++ b/widgets/table/e-table-utils.c
@@ -24,6 +24,7 @@
#include <config.h>
#include "gal/util/e-i18n.h"
#include "gal/util/e-util.h"
+#include "gal/widgets/e-unicode.h"
#include "e-table-utils.h"
#include "e-table-header-utils.h"
@@ -84,7 +85,9 @@ 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);
+ char *title = dgettext (domain, col_spec->title);
+
+ title = e_utf8_from_locale_string (title);
if (col_spec->pixbuf && *col_spec->pixbuf) {
GdkPixbuf *pixbuf;
@@ -106,6 +109,8 @@ et_col_spec_to_col (ETableColumnSpecification *col_spec,
cell, compare, col_spec->resizable, col_spec->disabled, col_spec->priority);
}
col->search = search;
+
+ g_free (title);
}
return col;
}
diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c
index c7799313f4..4e1b626259 100644
--- a/widgets/table/e-tree-selection-model.c
+++ b/widgets/table/e-tree-selection-model.c
@@ -887,13 +887,14 @@ etsm_selected_count_recurse (ETreeSelectionModel *etsm,
etsm_selected_count_all_recurse(etsm, path, count);
return;
}
- if (!selection_node->any_children_selected)
- return;
if (selection_node->selected) {
(*count) ++;
}
+ if (!selection_node->any_children_selected)
+ return;
+
if (selection_node->children) {
ETreePath child = e_tree_model_node_get_first_child(E_TREE_MODEL(etsm->priv->model), path);
int i;
@@ -955,10 +956,8 @@ etsm_select_all (ESelectionModel *selection)
etsm->priv->root->any_children_selected = TRUE;
e_tree_selection_model_node_fill_children(etsm, root, etsm->priv->root);
- etsm->priv->root->all_children_selected_array = e_bit_array_new(etsm->priv->root->num_children);
- etsm->priv->root->any_children_selected_array = e_bit_array_new(etsm->priv->root->num_children);
- e_bit_array_select_all(etsm->priv->root->all_children_selected_array);
- e_bit_array_select_all(etsm->priv->root->any_children_selected_array);
+ etsm->priv->root->all_children_selected_array = NULL;
+ etsm->priv->root->any_children_selected_array = NULL;
if (etsm->priv->cursor_col == -1)
etsm->priv->cursor_col = 0;