summaryrefslogtreecommitdiff
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
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
-rw-r--r--data/eom-preferences-dialog.ui17
-rw-r--r--data/org.mate.eom.gschema.xml.in.in5
-rw-r--r--src/eom-config-keys.h1
-rw-r--r--src/eom-preferences-dialog.c21
-rw-r--r--src/eom-window.c12
5 files changed, 55 insertions, 1 deletions
diff --git a/data/eom-preferences-dialog.ui b/data/eom-preferences-dialog.ui
index 6509845..fff0a3e 100644
--- a/data/eom-preferences-dialog.ui
+++ b/data/eom-preferences-dialog.ui
@@ -523,6 +523,21 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="random_check">
+ <property name="label" translatable="yes">_Random sequence</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkCheckButton" id="loop_check">
<property name="label" translatable="yes">_Loop sequence</property>
<property name="visible">True</property>
@@ -534,7 +549,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
diff --git a/data/org.mate.eom.gschema.xml.in.in b/data/org.mate.eom.gschema.xml.in.in
index 80b0369..92ede90 100644
--- a/data/org.mate.eom.gschema.xml.in.in
+++ b/data/org.mate.eom.gschema.xml.in.in
@@ -53,6 +53,11 @@
</key>
</schema>
<schema id="org.mate.eom.full-screen" path="/org/mate/eom/full-screen/">
+ <key name="random" type="b">
+ <default>false</default>
+ <_summary>Randomize the image sequence</_summary>
+ <_description>Whether the sequence of images should be shown in an random loop.</_description>
+ </key>
<key name="loop" type="b">
<default>true</default>
<_summary>Loop through the image sequence</_summary>
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;