summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2014-01-30 15:14:28 +0100
committerStefano Karapetsas <[email protected]>2014-01-30 15:14:28 +0100
commit99c48b1ee683814d250e06da860d484b408866a5 (patch)
tree8f9747890141ecb2239159bba04f51e84703bc5a /src
parent50c379c71b53373aabae771aa205ee68cc554747 (diff)
downloadeom-99c48b1ee683814d250e06da860d484b408866a5.tar.bz2
eom-99c48b1ee683814d250e06da860d484b408866a5.tar.xz
Add random mode in slideshow mode
Closes #20 https://github.com/mate-desktop/eom/issues/20
Diffstat (limited to 'src')
-rw-r--r--src/eom-config-keys.h1
-rw-r--r--src/eom-preferences-dialog.c21
-rw-r--r--src/eom-window.c12
3 files changed, 34 insertions, 0 deletions
diff --git a/src/eom-config-keys.h b/src/eom-config-keys.h
index c4a35ae..c69d0cf 100644
--- a/src/eom-config-keys.h
+++ b/src/eom-config-keys.h
@@ -47,6 +47,7 @@
#define EOM_CONF_VIEW_USE_BG_COLOR "use-background-color"
#define EOM_CONF_FULLSCREEN_SCHEMA "org.mate.eom.full-screen"
+#define EOM_CONF_FULLSCREEN_RANDOM "random"
#define EOM_CONF_FULLSCREEN_LOOP "loop"
#define EOM_CONF_FULLSCREEN_UPSCALE "upscale"
#define EOM_CONF_FULLSCREEN_SECONDS "seconds"
diff --git a/src/eom-preferences-dialog.c b/src/eom-preferences-dialog.c
index e11847b..0a46606 100644
--- a/src/eom-preferences-dialog.c
+++ b/src/eom-preferences-dialog.c
@@ -95,6 +95,12 @@ pd_radio_toggle_cb (GtkWidget *widget, GSettings *settings)
}
static void
+random_change_cb (GSettings *settings, gchar *key, GtkWidget *widget)
+{
+ gtk_widget_set_sensitive (widget, !g_settings_get_boolean (settings, key));
+}
+
+static void
eom_preferences_response_cb (GtkDialog *dlg, gint res_id, gpointer data)
{
switch (res_id) {
@@ -125,6 +131,7 @@ eom_preferences_dialog_constructor (GType type,
GtkWidget *background_radio;
GtkWidget *color_button;
GtkWidget *upscale_check;
+ GtkWidget *random_check;
GtkWidget *loop_check;
GtkWidget *seconds_spin;
GtkWidget *plugin_manager;
@@ -154,6 +161,7 @@ eom_preferences_dialog_constructor (GType type,
"background_radio", &background_radio,
"color_button", &color_button,
"upscale_check", &upscale_check,
+ "random_check", &random_check,
"loop_check", &loop_check,
"seconds_spin", &seconds_spin,
"plugin_manager_container", &plugin_manager_container,
@@ -288,6 +296,19 @@ eom_preferences_dialog_constructor (GType type,
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (priv->fullscreen_settings,
+ EOM_CONF_FULLSCREEN_RANDOM,
+ G_OBJECT (random_check),
+ "active",
+ G_SETTINGS_BIND_DEFAULT);
+ g_signal_connect (priv->fullscreen_settings,
+ "changed::" EOM_CONF_FULLSCREEN_RANDOM,
+ G_CALLBACK (random_change_cb),
+ loop_check);
+ random_change_cb (priv->fullscreen_settings,
+ EOM_CONF_FULLSCREEN_RANDOM,
+ loop_check);
+
+ g_settings_bind (priv->fullscreen_settings,
EOM_CONF_FULLSCREEN_SECONDS,
G_OBJECT (seconds_spin),
"value",
diff --git a/src/eom-window.c b/src/eom-window.c
index b159e13..366b2dc 100644
--- a/src/eom-window.c
+++ b/src/eom-window.c
@@ -153,6 +153,7 @@ struct _EomWindowPrivate {
GtkWidget *fullscreen_popup;
GSource *fullscreen_timeout_source;
+ gboolean slideshow_random;
gboolean slideshow_loop;
gint slideshow_switch_timeout;
GSource *slideshow_switch_source;
@@ -1918,6 +1919,12 @@ slideshow_switch_cb (gpointer data)
eom_debug (DEBUG_WINDOW);
+ if (priv->slideshow_random) {
+ eom_thumb_view_select_single (EOM_THUMB_VIEW (priv->thumbview),
+ EOM_THUMB_VIEW_SELECT_RANDOM);
+ return TRUE;
+ }
+
if (!priv->slideshow_loop && slideshow_is_loop_end (window)) {
eom_window_stop_fullscreen (window, TRUE);
return FALSE;
@@ -2239,6 +2246,10 @@ eom_window_run_fullscreen (EomWindow *window, gboolean slideshow)
fullscreen_set_timeout (window);
if (slideshow) {
+ priv->slideshow_random =
+ g_settings_get_boolean (priv->fullscreen_settings,
+ EOM_CONF_FULLSCREEN_RANDOM);
+
priv->slideshow_loop =
g_settings_get_boolean (priv->fullscreen_settings,
EOM_CONF_FULLSCREEN_LOOP);
@@ -4653,6 +4664,7 @@ eom_window_init (EomWindow *window)
window->priv->fullscreen_popup = NULL;
window->priv->fullscreen_timeout_source = NULL;
+ window->priv->slideshow_random = FALSE;
window->priv->slideshow_loop = FALSE;
window->priv->slideshow_switch_timeout = 0;
window->priv->slideshow_switch_source = NULL;