[eog] Replace slideshow timeout spinbutton with a scale
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] Replace slideshow timeout spinbutton with a scale
- Date: Fri, 6 Apr 2012 17:29:15 +0000 (UTC)
commit a8c7091fae2075adf0a8d66017736c52832d1126
Author: Felix Riemann <friemann gnome org>
Date: Fri Apr 6 19:22:03 2012 +0200
Replace slideshow timeout spinbutton with a scale
This should make it easier for translators to handle this UI part
as the time unit is decoupled from the description.
https://bugzilla.gnome.org/show_bug.cgi?id=658127
data/eog-preferences-dialog.ui | 43 +++++++++++++++++----------------------
src/eog-preferences-dialog.c | 22 +++++++++++++++++--
2 files changed, 38 insertions(+), 27 deletions(-)
---
diff --git a/data/eog-preferences-dialog.ui b/data/eog-preferences-dialog.ui
index c979cc3..c014845 100644
--- a/data/eog-preferences-dialog.ui
+++ b/data/eog-preferences-dialog.ui
@@ -461,17 +461,17 @@
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
- <object class="GtkHBox" id="seconds_hbox">
+ <object class="GtkBox" id="seconds_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">6</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label36">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes" context="PrefDlgSlideSwitchPrefix" comments="I18N: This sentence will be displayed before a GtkSpinButton to select a number of seconds in eog's preferences dialog. The context is applied to avoid ambiguity with possible similar translations. See bug 654548 for details.">_Switch image after:</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes" comments="I18N: This sentence will be displayed above a horizonzal scale to select a number of seconds in eog's preferences dialog.">_Time between images:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">seconds_spin</property>
</object>
<packing>
<property name="expand">False</property>
@@ -480,37 +480,32 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="seconds_spin">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">â</property>
- <property name="invisible_char_set">True</property>
- <property name="adjustment">adjustment1</property>
- <property name="climb_rate">1</property>
- <property name="numeric">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label18">
+ <object class="GtkAlignment" id="alignment6">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes" context="PrefDlgSlideSwitchPostfix" comments="I18N: This sentence will be displayed after a GtkSpinButton to select a number of seconds in eog's preferences dialog. The context is applied to avoid ambiguity with possible similar translations. See bug 654548 for details.">seconds</property>
+ <property name="left_padding">16</property>
+ <child>
+ <object class="GtkScale" id="seconds_scale">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">adjustment1</property>
+ <property name="show_fill_level">True</property>
+ <property name="fill_level">100</property>
+ <property name="round_digits">0</property>
+ <property name="digits">0</property>
+ </object>
+ </child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">2</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
diff --git a/src/eog-preferences-dialog.c b/src/eog-preferences-dialog.c
index 1912e03..565723b 100644
--- a/src/eog-preferences-dialog.c
+++ b/src/eog-preferences-dialog.c
@@ -106,6 +106,15 @@ pd_transp_radio_toggle_cb (GtkWidget *widget, gpointer data)
GPOINTER_TO_INT (value));
}
+static gchar*
+pd_seconds_scale_format_value_cb (GtkScale *scale, gdouble value, gpointer ptr)
+{
+ gulong int_val = (gulong) value;
+
+ return g_strdup_printf (ngettext("%lu second", "%lu seconds", int_val),
+ int_val);
+}
+
static void
eog_preferences_response_cb (GtkDialog *dlg, gint res_id, gpointer data)
{
@@ -138,9 +147,10 @@ eog_preferences_dialog_constructor (GType type,
GtkWidget *color_button;
GtkWidget *upscale_check;
GtkWidget *loop_check;
- GtkWidget *seconds_spin;
+ GtkWidget *seconds_scale;
GtkWidget *plugin_manager;
GtkWidget *plugin_manager_container;
+ GtkAdjustment *scale_adjustment;
GObject *object;
object = G_OBJECT_CLASS (eog_preferences_dialog_parent_class)->constructor
@@ -168,7 +178,7 @@ eog_preferences_dialog_constructor (GType type,
"color_button", &color_button,
"upscale_check", &upscale_check,
"loop_check", &loop_check,
- "seconds_spin", &seconds_spin,
+ "seconds_scale", &seconds_scale,
"plugin_manager_container", &plugin_manager_container,
NULL);
@@ -221,6 +231,10 @@ eog_preferences_dialog_constructor (GType type,
G_CALLBACK (pd_transp_radio_toggle_cb),
priv->view_settings);
+ g_signal_connect (G_OBJECT (seconds_scale), "format-value",
+ G_CALLBACK (pd_seconds_scale_format_value_cb),
+ NULL);
+
switch (g_settings_get_enum (priv->view_settings,
EOG_CONF_VIEW_TRANSPARENCY))
{
@@ -252,8 +266,10 @@ eog_preferences_dialog_constructor (GType type,
g_settings_bind (priv->fullscreen_settings, EOG_CONF_FULLSCREEN_LOOP,
loop_check, "active", G_SETTINGS_BIND_DEFAULT);
+ scale_adjustment = gtk_range_get_adjustment (GTK_RANGE (seconds_scale));
+
g_settings_bind (priv->fullscreen_settings, EOG_CONF_FULLSCREEN_SECONDS,
- seconds_spin, "value", G_SETTINGS_BIND_DEFAULT);
+ scale_adjustment, "value", G_SETTINGS_BIND_DEFAULT);
plugin_manager = peas_gtk_plugin_manager_new (NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]