Mercurial > geeqie.yaz
changeset 1471:65a5c27823c2
update translated pane titles
author | nadvornik |
---|---|
date | Sat, 21 Mar 2009 17:47:50 +0000 |
parents | 38925ff71a46 |
children | b4001cb9fbc4 |
files | src/bar.c src/bar.h src/bar_comment.c src/bar_exif.c src/bar_histogram.c src/bar_keywords.c |
diffstat | 6 files changed, 49 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/bar.c Fri Mar 20 22:48:01 2009 +0000 +++ b/src/bar.c Sat Mar 21 17:47:50 2009 +0000 @@ -30,9 +30,24 @@ #include "histogram.h" #include "rcfile.h" -//#define BAR_SIZE_INCREMENT 48 -//#define BAR_ARROW_SIZE 7 +typedef struct _KnownPanes KnownPanes; +struct _KnownPanes +{ + PaneType type; + gchar *id; + gchar *title; +}; +static const KnownPanes known_panes[] = { +/* default sidebar */ + {PANE_HISTOGRAM, "histogram", N_("Histogram")}, + {PANE_COMMENT, "title", N_("Title")}, + {PANE_KEYWORDS, "keywords", N_("Keywords")}, + {PANE_COMMENT, "comment", N_("Comment")}, + {PANE_EXIF, "exif", N_("Exif")}, + + {PANE_UNDEF, NULL, NULL} +}; typedef struct _BarData BarData; struct _BarData @@ -445,4 +460,23 @@ return widget; } +gboolean bar_pane_translate_title(PaneType type, const gchar *id, gchar **title) +{ + const KnownPanes *pane = known_panes; + + if (!title) return FALSE; + while (pane->id) + { + if (pane->type == type && strcmp(pane->id, id) == 0) break; + pane++; + } + if (!pane->id) return FALSE; + + if (*title && **title && strcmp(pane->title, *title) != 0) return FALSE; + + g_free(*title); + *title = g_strdup(_(pane->title)); + return TRUE; +} + /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/bar.h Fri Mar 20 22:48:01 2009 +0000 +++ b/src/bar.h Sat Mar 21 17:47:50 2009 +0000 @@ -15,6 +15,7 @@ #define BAR_H typedef enum { + PANE_UNDEF = 0, PANE_COMMENT, PANE_EXIF, PANE_HISTOGRAM, @@ -62,5 +63,6 @@ GtkWidget *bar_pane_expander_title(const gchar *title); void bar_update_expander(GtkWidget *pane); +gboolean bar_pane_translate_title(PaneType type, const gchar *id, gchar **title); #endif /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/bar_comment.c Fri Mar 20 22:48:01 2009 +0000 +++ b/src/bar_comment.c Sat Mar 21 17:47:50 2009 +0000 @@ -263,7 +263,7 @@ GtkWidget *bar_pane_comment_new_from_config(const gchar **attribute_names, const gchar **attribute_values) { - gchar *title = g_strdup(_("Comment")); + gchar *title = NULL; gchar *key = g_strdup(COMMENT_KEY); gboolean expanded = TRUE; gint height = 50; @@ -285,6 +285,7 @@ log_printf("unknown attribute %s = %s\n", option, value); } + bar_pane_translate_title(PANE_COMMENT, id, &title); ret = bar_pane_comment_new(id, title, key, expanded, height); g_free(title); g_free(key); @@ -318,6 +319,7 @@ if (title) { + bar_pane_translate_title(PANE_COMMENT, pcd->pane.id, &title); gtk_label_set_text(GTK_LABEL(pcd->pane.title), title); g_free(title); }
--- a/src/bar_exif.c Fri Mar 20 22:48:01 2009 +0000 +++ b/src/bar_exif.c Sat Mar 21 17:47:50 2009 +0000 @@ -775,7 +775,7 @@ GtkWidget *bar_pane_exif_new_from_config(const gchar **attribute_names, const gchar **attribute_values) { - gchar *title = g_strdup(_("Exif")); + gchar *title = NULL; gchar *id = g_strdup("exif"); gboolean expanded = TRUE; GtkWidget *ret; @@ -792,6 +792,7 @@ log_printf("unknown attribute %s = %s\n", option, value); } + bar_pane_translate_title(PANE_EXIF, id, &title); ret = bar_pane_exif_new(id, title, expanded, FALSE); g_free(title); g_free(id); @@ -822,6 +823,7 @@ if (title) { + bar_pane_translate_title(PANE_EXIF, ped->pane.id, &title); gtk_label_set_text(GTK_LABEL(ped->pane.title), title); g_free(title); }
--- a/src/bar_histogram.c Fri Mar 20 22:48:01 2009 +0000 +++ b/src/bar_histogram.c Sat Mar 21 17:47:50 2009 +0000 @@ -379,7 +379,7 @@ GtkWidget *bar_pane_histogram_new_from_config(const gchar **attribute_names, const gchar **attribute_values) { - gchar *title = g_strdup(_("NoName")); + gchar *title = NULL; gchar *id = g_strdup("histogram"); gboolean expanded = TRUE; gint height = 80; @@ -401,6 +401,7 @@ log_printf("unknown attribute %s = %s\n", option, value); } + bar_pane_translate_title(PANE_HISTOGRAM, id, &title); ret = bar_pane_histogram_new(id, title, height, expanded, histogram_channel, histogram_mode); g_free(title); g_free(id);
--- a/src/bar_keywords.c Fri Mar 20 22:48:01 2009 +0000 +++ b/src/bar_keywords.c Sat Mar 21 17:47:50 2009 +0000 @@ -1350,7 +1350,7 @@ GtkWidget *bar_pane_keywords_new_from_config(const gchar **attribute_names, const gchar **attribute_values) { gchar *id = g_strdup("keywords"); - gchar *title = g_strdup(_("Keywords")); + gchar *title = NULL; gchar *key = g_strdup(COMMENT_KEY); gboolean expanded = TRUE; GtkWidget *ret; @@ -1369,6 +1369,7 @@ log_printf("unknown attribute %s = %s\n", option, value); } + bar_pane_translate_title(PANE_KEYWORDS, id, &title); ret = bar_pane_keywords_new(id, title, key, expanded); g_free(id); g_free(title); @@ -1401,6 +1402,7 @@ if (title) { + bar_pane_translate_title(PANE_KEYWORDS, pkd->pane.id, &title); gtk_label_set_text(GTK_LABEL(pkd->pane.title), title); g_free(title); }