[Xfce4-commits] <ristretto:ristretto-0.0> Implement slideshow-timeout slider
Stephan Arts
noreply at xfce.org
Sun Oct 23 19:17:47 CEST 2011
Updating branch refs/heads/ristretto-0.0
to 54560c4bab54160935322d2f2bc796def94f86e3 (commit)
from 692ce7e6229f1ef0e4a4867447567cb316d36d9e (commit)
commit 54560c4bab54160935322d2f2bc796def94f86e3
Author: Stephan Arts <stephan at xfce.org>
Date: Sat Sep 5 08:46:56 2009 +0200
Implement slideshow-timeout slider
ChangeLog | 6 ++++++
src/main_window.c | 2 +-
src/preferences_dialog.c | 40 ++++++++++++++++++++++++++++++++--------
src/settings.c | 6 +++---
4 files changed, 42 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 42d2d65..794e17b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2009-09-05 Stephan Arts <stephan at xfce.org>
+ * src/preferences_dialog.c
+ src/settings.c,
+ src/main_window.c: Implement slideshow timeout slider
+
+2009-09-05 Stephan Arts <stephan at xfce.org>
+
* src/picture_viewer.c,
src/settings.c,
src/preferences_dialog.c: Implement scrollwheel action on picture-viewer
diff --git a/src/main_window.c b/src/main_window.c
index 40df463..1755c15 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -1417,7 +1417,7 @@ cb_rstto_main_window_play (GtkWidget *widget, RsttoMainWindow *window)
g_object_get_property (G_OBJECT(window->priv->settings_manager), "slideshow-timeout", &timeout);
window->priv->playing = TRUE;
- window->priv->play_timeout_id = g_timeout_add (g_value_get_uint (&timeout), (GSourceFunc)cb_rstto_main_window_play_slideshow, window);
+ window->priv->play_timeout_id = g_timeout_add (g_value_get_uint (&timeout)*1000, (GSourceFunc)cb_rstto_main_window_play_slideshow, window);
}
/**
diff --git a/src/preferences_dialog.c b/src/preferences_dialog.c
index 9fbeb7e..ef3de73 100644
--- a/src/preferences_dialog.c
+++ b/src/preferences_dialog.c
@@ -58,6 +58,9 @@ cb_rstto_preferences_dialog_zoom_scrollwheel_action_radio_button_toggled (GtkTog
static void
cb_rstto_preferences_dialog_switch_scrollwheel_action_radio_button_toggled (GtkToggleButton *, gpointer );
+static void
+cb_rstto_preferences_dialog_slideshow_timeout_value_changed (GtkRange *, gpointer);
+
static GtkWidgetClass *parent_class = NULL;
struct _RsttoPreferencesDialogPriv
@@ -82,6 +85,12 @@ struct _RsttoPreferencesDialogPriv
struct
{
+ GtkWidget *timeout_vbox;
+ GtkWidget *timeout_frame;
+ } slideshow_tab;
+
+ struct
+ {
GtkWidget *scroll_frame;
GtkWidget *scroll_vbox;
GtkWidget *no_scrollwheel_action_radio_button;
@@ -140,8 +149,10 @@ rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog)
gboolean bool_enable_cache;
gboolean bool_bgcolor_override;
gchar *scrollwheel_primary_action;
+ guint uint_slideshow_timeout;
+
GdkColor *bgcolor;
- GtkWidget *timeout_frame, *timeout_vbox, *timeout_lbl, *timeout_hscale;
+ GtkWidget *timeout_lbl, *timeout_hscale;
GtkWidget *scaling_frame, *scaling_vbox;
GtkWidget *widget;
GtkObject *cache_adjustment;
@@ -167,6 +178,7 @@ rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog)
"bgcolor-override", &bool_bgcolor_override,
"bgcolor", &bgcolor,
"scrollwheel-primary-action", &scrollwheel_primary_action,
+ "slideshow-timeout", &uint_slideshow_timeout,
NULL);
/*****************/
@@ -260,20 +272,23 @@ rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog)
slideshow_main_vbox = gtk_vbox_new(FALSE, 0);
slideshow_main_lbl = gtk_label_new(_("Slideshow"));
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), slideshow_main_vbox, slideshow_main_lbl);
- /* not used */
- gtk_widget_set_sensitive (slideshow_main_vbox, FALSE);
- timeout_vbox = gtk_vbox_new(FALSE, 0);
- timeout_frame = xfce_create_framebox_with_content (_("Timeout"), timeout_vbox);
- gtk_box_pack_start (GTK_BOX (slideshow_main_vbox), timeout_frame, FALSE, FALSE, 0);
+ dialog->priv->slideshow_tab.timeout_vbox = gtk_vbox_new(FALSE, 0);
+ dialog->priv->slideshow_tab.timeout_frame = xfce_create_framebox_with_content (_("Timeout"), dialog->priv->slideshow_tab.timeout_vbox);
+ gtk_box_pack_start (GTK_BOX (slideshow_main_vbox), dialog->priv->slideshow_tab.timeout_frame, FALSE, FALSE, 0);
timeout_lbl = gtk_label_new(_("The time period an individual image is displayed during a slideshow\n(in seconds)"));
timeout_hscale = gtk_hscale_new_with_range(1, 60, 1);
gtk_misc_set_alignment(GTK_MISC(timeout_lbl), 0, 0.5);
gtk_misc_set_padding(GTK_MISC(timeout_lbl), 2, 2);
- gtk_box_pack_start(GTK_BOX(timeout_vbox), timeout_lbl, TRUE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX(timeout_vbox), timeout_hscale, FALSE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(dialog->priv->slideshow_tab.timeout_vbox), timeout_lbl, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(dialog->priv->slideshow_tab.timeout_vbox), timeout_hscale, FALSE, TRUE, 0);
+
+
+ gtk_range_set_value (GTK_RANGE (timeout_hscale), (gdouble)uint_slideshow_timeout);
+ g_signal_connect (G_OBJECT (timeout_hscale),
+ "value-changed", (GCallback)cb_rstto_preferences_dialog_slideshow_timeout_value_changed, dialog);
/********************************************/
@@ -597,3 +612,12 @@ cb_rstto_preferences_dialog_switch_scrollwheel_action_radio_button_toggled (GtkT
rstto_settings_set_string_property (dialog->priv->settings, "scrollwheel-primary-action", "switch");
}
}
+
+static void
+cb_rstto_preferences_dialog_slideshow_timeout_value_changed (GtkRange *range, gpointer user_data)
+{
+ RsttoPreferencesDialog *dialog = RSTTO_PREFERENCES_DIALOG (user_data);
+
+ rstto_settings_set_uint_property (dialog->priv->settings, "slideshow-timeout", (guint)gtk_range_get_value (range));
+
+}
diff --git a/src/settings.c b/src/settings.c
index e9bd00f..7abb621 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -316,9 +316,9 @@ rstto_settings_class_init (GObjectClass *object_class)
pspec = g_param_spec_uint ("slideshow-timeout",
"",
"",
- 1000,
- G_MAXUINT,
- 5000,
+ 1,
+ 300,
+ 5,
G_PARAM_READWRITE);
g_object_class_install_property (object_class,
PROP_SLIDESHOW_TIMEOUT,
More information about the Xfce4-commits
mailing list