summaryrefslogtreecommitdiffstats
path: root/widgets/src/StandaloneWindow.c
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2012-01-13 15:26:56 -0500
committerChris Lumens <clumens@redhat.com>2012-01-13 15:31:03 -0500
commit81c6ec6bf8c46caf24d8f994d96b3deff3e07c44 (patch)
tree6f925067aeebcf9577fae7063bed84448b2247bc /widgets/src/StandaloneWindow.c
parentcaa26aa16c8d78dce88a84ae4172a903989fce4a (diff)
downloadanaconda-81c6ec6bf8c46caf24d8f994d96b3deff3e07c44.tar.gz
anaconda-81c6ec6bf8c46caf24d8f994d96b3deff3e07c44.tar.xz
anaconda-81c6ec6bf8c46caf24d8f994d96b3deff3e07c44.zip
Add support to some widgets for retranslating the UI on language change.
GTK doesn't really make this easy on us. The only thing we can do is tear everything down and rebuild, which is not at all an optimal solution. Alternatively, we can maintain lists of original strings and the widgets that contain them, and do it on demand by hand. Not everything is supported yet. I'll add support as needed.
Diffstat (limited to 'widgets/src/StandaloneWindow.c')
-rw-r--r--widgets/src/StandaloneWindow.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/widgets/src/StandaloneWindow.c b/widgets/src/StandaloneWindow.c
index 5ceddd4c4..cc2b1a57c 100644
--- a/widgets/src/StandaloneWindow.c
+++ b/widgets/src/StandaloneWindow.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Red Hat, Inc.
+ * Copyright (C) 2011-2012 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -49,6 +49,9 @@ enum {
LAST_SIGNAL
};
+#define QUIT_TEXT "_QUIT"
+#define CONTINUE_TEXT "_CONTINUE"
+
static guint window_signals[LAST_SIGNAL] = { 0 };
struct _AnacondaStandaloneWindowPrivate {
@@ -125,8 +128,8 @@ static void anaconda_standalone_window_init(AnacondaStandaloneWindow *win) {
AnacondaStandaloneWindowPrivate);
/* Create the buttons. */
- win->priv->quit_button = gtk_button_new_with_mnemonic(_("_QUIT"));
- win->priv->continue_button = gtk_button_new_with_mnemonic(_("_CONTINUE"));
+ win->priv->quit_button = gtk_button_new_with_mnemonic(_(QUIT_TEXT));
+ win->priv->continue_button = gtk_button_new_with_mnemonic(_(CONTINUE_TEXT));
/* Hook up some signals for those buttons. The signal handlers here will
* just raise our own custom signals for the whole window.
@@ -190,3 +193,20 @@ void anaconda_standalone_window_set_may_continue(AnacondaStandaloneWindow *win,
gboolean may_continue) {
gtk_widget_set_sensitive(win->priv->continue_button, may_continue);
}
+
+/**
+ * anaconda_standalone_window_retranslate
+ * @win: a #AnacondaStaldaloneWindow
+ *
+ * Reload translations for this widget as needed. Generally, this is not
+ * needed. However when changing the language during installation, we need
+ * to be able to make sure the screen gets retranslated. This function is
+ * kind of ugly but avoids having to destroy and reload the screen.
+ *
+ * Since: 1.0
+ */
+void anaconda_standalone_window_retranslate(AnacondaStandaloneWindow *win) {
+ anaconda_base_window_retranslate(ANACONDA_BASE_WINDOW(win));
+ gtk_button_set_label(GTK_BUTTON(win->priv->quit_button), _(QUIT_TEXT));
+ gtk_button_set_label(GTK_BUTTON(win->priv->continue_button), _(CONTINUE_TEXT));
+}