[Xfce4-commits] <xfdesktop:master> Include the chronological option in the combobox
Eric Koegel
noreply at xfce.org
Sun Oct 27 19:42:07 CET 2013
Updating branch refs/heads/master
to 715985a0cfdcabe4eacc391c8f37690d343351e7 (commit)
from 751d6e29c1ad3e02d7fdaaf873ff3c3285cc568a (commit)
commit 715985a0cfdcabe4eacc391c8f37690d343351e7
Author: Eric Koegel <eric.koegel at gmail.com>
Date: Tue Oct 22 21:08:23 2013 +0300
Include the chronological option in the combobox
settings/main.c | 49 ++++--------
.../xfdesktop-settings-appearance-frame-ui.glade | 18 +----
src/xfce-backdrop.c | 79 +++-----------------
src/xfce-backdrop.h | 7 +-
src/xfce-workspace.c | 5 --
5 files changed, 28 insertions(+), 130 deletions(-)
diff --git a/settings/main.c b/settings/main.c
index 3e92b16..b63ee3c 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -116,7 +116,6 @@ typedef struct
GtkWidget *combo_backdrop_cycle_period;
GtkWidget *backdrop_cycle_spinbox;
GtkWidget *random_backdrop_order_chkbox;
- GtkWidget *chrono_backdrop_order_chkbox;
GThread *preview_thread;
GAsyncQueue *preview_queue;
@@ -884,43 +883,41 @@ cb_xfdesktop_chk_button_toggled(GtkCheckButton *button,
}
static void
-update_backdrop_cycle_spinbox(AppearancePanel *panel)
+update_backdrop_random_order_chkbox(AppearancePanel *panel)
{
gboolean sensitive = FALSE;
gint period;
- /* For the spinbox to be active the combo_backdrop_cycle_period needs to be
- * active and needs to be set to something where the spinbox would apply */
+ /* For the random check box to be active the combo_backdrop_cycle_period
+ * needs to be active and needs to not be set to chronological */
if(gtk_widget_get_sensitive(panel->combo_backdrop_cycle_period)) {
period = gtk_combo_box_get_active(GTK_COMBO_BOX(panel->combo_backdrop_cycle_period));
- if(period == XFCE_BACKDROP_PERIOD_SECONDS ||
- period == XFCE_BACKDROP_PERIOD_MINUES ||
- period == XFCE_BACKDROP_PERIOD_HOURS)
- {
+ if(period != XFCE_BACKDROP_PERIOD_CHRONOLOGICAL)
sensitive = TRUE;
- }
}
- gtk_widget_set_sensitive(panel->backdrop_cycle_spinbox, sensitive);
+ gtk_widget_set_sensitive(panel->random_backdrop_order_chkbox, sensitive);
}
static void
-update_backdrop_chrono_order_chkbox(AppearancePanel *panel)
+update_backdrop_cycle_spinbox(AppearancePanel *panel)
{
gboolean sensitive = FALSE;
gint period;
- /* For this check box to be active the combo_backdrop_cycle_period needs
- * to be active and needs to be set to hourly so it would apply */
+ /* For the spinbox to be active the combo_backdrop_cycle_period needs to be
+ * active and needs to be set to something where the spinbox would apply */
if(gtk_widget_get_sensitive(panel->combo_backdrop_cycle_period)) {
period = gtk_combo_box_get_active(GTK_COMBO_BOX(panel->combo_backdrop_cycle_period));
- if(period == XFCE_BACKDROP_PERIOD_HOURLY)
+ if(period == XFCE_BACKDROP_PERIOD_SECONDS ||
+ period == XFCE_BACKDROP_PERIOD_MINUES ||
+ period == XFCE_BACKDROP_PERIOD_HOURS)
{
sensitive = TRUE;
}
}
- gtk_widget_set_sensitive(panel->chrono_backdrop_order_chkbox, sensitive);
+ gtk_widget_set_sensitive(panel->backdrop_cycle_spinbox, sensitive);
}
static void
@@ -931,8 +928,8 @@ cb_combo_backdrop_cycle_period_change(GtkComboBox *combo,
/* determine if the spin box should be sensitive */
update_backdrop_cycle_spinbox(panel);
- /* same with the chronological backdrop order */
- update_backdrop_chrono_order_chkbox(panel);
+ /* determine if the random check box should be sensitive */
+ update_backdrop_random_order_chkbox(panel);
}
static void
@@ -950,11 +947,10 @@ cb_xfdesktop_chk_cycle_backdrop_toggled(GtkCheckButton *button,
/* The cycle backdrop toggles the period and random widgets */
gtk_widget_set_sensitive(panel->combo_backdrop_cycle_period, sensitive);
- gtk_widget_set_sensitive(panel->random_backdrop_order_chkbox, sensitive);
/* determine if the spin box should be sensitive */
update_backdrop_cycle_spinbox(panel);
- /* same with the chronological backdrop order */
- update_backdrop_chrono_order_chkbox(panel);
+ /* determine if the random check box should be sensitive */
+ update_backdrop_random_order_chkbox(panel);
}
static gboolean
@@ -1343,17 +1339,6 @@ xfdesktop_settings_background_tab_change_bindings(AppearancePanel *panel,
G_OBJECT(panel->random_backdrop_order_chkbox), "active");
}
g_free(buf);
-
- /* chronological order check box */
- buf = xfdesktop_settings_generate_per_workspace_binding_string(panel, "backdrop-cycle-chronological-order");
- if(remove_binding) {
- xfconf_g_property_unbind_by_property(channel, buf,
- G_OBJECT(panel->chrono_backdrop_order_chkbox), "active");
- } else {
- xfconf_g_property_bind(channel, buf, G_TYPE_BOOLEAN,
- G_OBJECT(panel->chrono_backdrop_order_chkbox), "active");
- }
- g_free(buf);
}
static void
@@ -1774,8 +1759,6 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder *main_gxml,
"spin_backdrop_time"));
panel->random_backdrop_order_chkbox = GTK_WIDGET(gtk_builder_get_object(appearance_gxml,
"chk_random_backdrop_order"));
- panel->chrono_backdrop_order_chkbox = GTK_WIDGET(gtk_builder_get_object(appearance_gxml,
- "chk_chrono_backdrop_order"));
/* Pick the first entry so something shows up */
gtk_combo_box_set_active(GTK_COMBO_BOX(panel->combo_backdrop_cycle_period), XFCE_BACKDROP_PERIOD_MINUES);
diff --git a/settings/xfdesktop-settings-appearance-frame-ui.glade b/settings/xfdesktop-settings-appearance-frame-ui.glade
index bfa1f66..f992dae 100644
--- a/settings/xfdesktop-settings-appearance-frame-ui.glade
+++ b/settings/xfdesktop-settings-appearance-frame-ui.glade
@@ -96,7 +96,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="tooltip-text" translatable="yes">Add an image to the list</property>
+ <property name="tooltip-text" translatable="yes">Choose the folder to select wallpapers from</property>
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
</object>
<packing>
@@ -296,6 +296,7 @@
<item translatable="yes">at start up</item>
<item translatable="yes">every hour</item>
<item translatable="yes">every day</item>
+ <item translatable="yes">chronologically</item>
</items>
</object>
<packing>
@@ -331,21 +332,6 @@
<property name="expand">False</property>
</packing>
</child>
- <child>
- <object class="GtkCheckButton" id="chk_chrono_backdrop_order">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">C_hronological</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="tooltip-text" translatable="yes">Chronologically maps images in the folder to specific hours of the day. When every hour is selected the first image in the folder will be displayed from midnight to one in the morning, the second image will show at two in the morning, etc. If there are fewer items in the folder than hours in the day, the images will be spaced out accordingly. I.e. a folder with 4 items will display the first image from midnight to six in the morning, the second image will then be displayed until noon, etc. If there are more images than hours in the day then they won't be displayed with this option selected.</property>
- </object>
- <packing>
- <property name="expand">False</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">False</property>
diff --git a/src/xfce-backdrop.c b/src/xfce-backdrop.c
index 10c146c..14ce700 100644
--- a/src/xfce-backdrop.c
+++ b/src/xfce-backdrop.c
@@ -108,7 +108,6 @@ struct _XfceBackdropPriv
guint cycle_timer_id;
XfceBackdropCyclePeriod cycle_period;
gboolean random_backdrop_order;
- gboolean chrono_backdrop_order;
};
struct _XfceBackdropImageData
@@ -143,7 +142,6 @@ enum
PROP_BACKDROP_CYCLE_PERIOD,
PROP_BACKDROP_CYCLE_TIMER,
PROP_BACKDROP_RANDOM_ORDER,
- PROP_BACKDROP_CHRONO_ORDER,
};
static guint backdrop_signals[LAST_SIGNAL] = { 0, };
@@ -543,13 +541,6 @@ xfce_backdrop_class_init(XfceBackdropClass *klass)
FALSE,
XFDESKTOP_PARAM_FLAGS));
- g_object_class_install_property(gobject_class, PROP_BACKDROP_CHRONO_ORDER,
- g_param_spec_boolean("backdrop-cycle-chronological-order",
- "backdrop-cycle-chronological-order",
- "backdrop-cycle-chronological-order",
- FALSE,
- XFDESKTOP_PARAM_FLAGS));
-
#undef XFDESKTOP_PARAM_FLAGS
}
@@ -640,10 +631,6 @@ xfce_backdrop_set_property(GObject *object,
xfce_backdrop_set_random_order(backdrop, g_value_get_boolean(value));
break;
- case PROP_BACKDROP_CHRONO_ORDER:
- xfce_backdrop_set_chronological_order(backdrop, g_value_get_boolean(value));
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
break;
@@ -696,10 +683,6 @@ xfce_backdrop_get_property(GObject *object,
g_value_set_boolean(value, xfce_backdrop_get_random_order(backdrop));
break;
- case PROP_BACKDROP_CHRONO_ORDER:
- g_value_set_boolean(value, xfce_backdrop_get_chronological_order(backdrop));
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
break;
@@ -974,17 +957,13 @@ xfce_backdrop_cycle_backdrop(XfceBackdrop *backdrop)
if(current_backdrop == NULL || !backdrop->priv->cycle_backdrop)
return;
- if(backdrop->priv->random_backdrop_order) {
- /* Random always takes priority */
- new_backdrop = xfce_backdrop_choose_random(current_backdrop);
- }
- else if(backdrop->priv->chrono_backdrop_order && period == XFCE_BACKDROP_PERIOD_HOURLY)
- {
- /* chronological */
+ if(period == XFCE_BACKDROP_PERIOD_CHRONOLOGICAL) {
+ /* chronological first */
new_backdrop = xfce_backdrop_choose_chronological(current_backdrop);
- }
- else
- {
+ } else if(backdrop->priv->random_backdrop_order) {
+ /* then random */
+ new_backdrop = xfce_backdrop_choose_random(current_backdrop);
+ } else {
/* sequential, the default */
new_backdrop = xfce_backdrop_choose_next(current_backdrop);
}
@@ -1019,8 +998,8 @@ xfce_backdrop_timer(XfceBackdrop *backdrop)
continue_cycling = FALSE;
break;
+ case XFCE_BACKDROP_PERIOD_CHRONOLOGICAL:
case XFCE_BACKDROP_PERIOD_HOURLY:
- TRACE("XFCE_BACKDROP_PERIOD_HOURLY");
local_time = g_date_time_new_now_local();
minute = g_date_time_get_minute(local_time);
second = g_date_time_get_second(local_time);
@@ -1033,7 +1012,6 @@ xfce_backdrop_timer(XfceBackdrop *backdrop)
break;
case XFCE_BACKDROP_PERIOD_DAILY:
- TRACE("XFCE_BACKDROP_PERIOD_DAILY");
local_time = g_date_time_new_now_local();
hour = g_date_time_get_hour (local_time);
minute = g_date_time_get_minute(local_time);
@@ -1117,8 +1095,8 @@ xfce_backdrop_set_cycle_timer(XfceBackdrop *backdrop, guint cycle_timer)
cycle_interval = 1;
break;
+ case XFCE_BACKDROP_PERIOD_CHRONOLOGICAL:
case XFCE_BACKDROP_PERIOD_HOURLY:
- TRACE("XFCE_BACKDROP_PERIOD_HOURLY");
local_time = g_date_time_new_now_local();
minute = g_date_time_get_minute(local_time);
second = g_date_time_get_second(local_time);
@@ -1128,7 +1106,6 @@ xfce_backdrop_set_cycle_timer(XfceBackdrop *backdrop, guint cycle_timer)
break;
case XFCE_BACKDROP_PERIOD_DAILY:
- TRACE("XFCE_BACKDROP_PERIOD_DAILY");
local_time = g_date_time_new_now_local();
hour = g_date_time_get_hour (local_time);
minute = g_date_time_get_minute(local_time);
@@ -1234,8 +1211,7 @@ xfce_backdrop_get_cycle_period(XfceBackdrop *backdrop)
*
* When cycling backdrops, they will either be show sequentially (and this value
* will be FALSE) or they will be selected at random. The images are choosen from
- * the same folder the current backdrop image file is in. This option overrides
- * the chronological order if it is also set.
+ * the same folder the current backdrop image file is in.
**/
void
xfce_backdrop_set_random_order(XfceBackdrop *backdrop,
@@ -1256,43 +1232,6 @@ xfce_backdrop_get_random_order(XfceBackdrop *backdrop)
return backdrop->priv->random_backdrop_order;
}
-/**
- * xfce_backdrop_set_chronological_order:
- * @backdrop: An #XfceBackdrop.
- * @chronological_order: When TRUE and the backdrops are set to cycle and
- * the period is set to XFCE_BACKDROP_PERIOD_HOURLY
- * then the backdrops in the folder will be mapped at
- * the next hour.
- *
- * When cycling backdrops sequentially with a period of XFCE_BACKDROP_PERIOD_HOURLY,
- * setting this option causes xfdesktop to map files in the selected directory
- * to hours of the day. Fewer images in the directory than hours in the day are
- * handled by repeating images to scale them over the time range. That means
- * there will be at most 24 images displayed showing the first image from
- * midnight to one, the second from one until two o'clock, etc. If there were 6
- * images in the directory then every image would be displayed for 4 hour time
- * intervals before advancing. If there's more images in the folder than hours
- * then they won't be shown.
- **/
-void
-xfce_backdrop_set_chronological_order(XfceBackdrop *backdrop,
- gboolean chronological_order)
-{
- g_return_if_fail(XFCE_IS_BACKDROP(backdrop));
-
- TRACE("entering");
-
- backdrop->priv->chrono_backdrop_order = chronological_order;
-}
-
-gboolean
-xfce_backdrop_get_chronological_order(XfceBackdrop *backdrop)
-{
- g_return_val_if_fail(XFCE_IS_BACKDROP(backdrop), FALSE);
-
- return backdrop->priv->chrono_backdrop_order;
-}
-
/* Generates the background that will either be displayed or will have the
* image drawn on top of */
static GdkPixbuf *
diff --git a/src/xfce-backdrop.h b/src/xfce-backdrop.h
index 5e89a09..85707ae 100644
--- a/src/xfce-backdrop.h
+++ b/src/xfce-backdrop.h
@@ -68,6 +68,7 @@ typedef enum
XFCE_BACKDROP_PERIOD_STARTUP,
XFCE_BACKDROP_PERIOD_HOURLY,
XFCE_BACKDROP_PERIOD_DAILY,
+ XFCE_BACKDROP_PERIOD_CHRONOLOGICAL,
} XfceBackdropCyclePeriod;
struct _XfceBackdrop
@@ -142,12 +143,6 @@ void xfce_backdrop_set_random_order (XfceBackdrop *backdrop,
gboolean random_order);
gboolean xfce_backdrop_get_random_order (XfceBackdrop *backdrop);
-void xfce_backdrop_set_chronological_order
- (XfceBackdrop *backdrop,
- gboolean random_order);
-gboolean xfce_backdrop_get_chronological_order
- (XfceBackdrop *backdrop);
-
GdkPixbuf *xfce_backdrop_get_pixbuf (XfceBackdrop *backdrop);
void xfce_backdrop_generate_async (XfceBackdrop *backdrop);
diff --git a/src/xfce-workspace.c b/src/xfce-workspace.c
index af21f7a..b9f5cf8 100644
--- a/src/xfce-workspace.c
+++ b/src/xfce-workspace.c
@@ -546,11 +546,6 @@ xfce_workspace_connect_backdrop_settings(XfceWorkspace *workspace,
G_OBJECT(backdrop), "backdrop-cycle-random-order");
buf[pp_len] = 0;
- g_strlcat(buf, "backdrop-cycle-chronological-order", sizeof(buf));
- xfconf_g_property_bind(channel, buf, G_TYPE_BOOLEAN,
- G_OBJECT(backdrop), "backdrop-cycle-chronological-order");
-
- buf[pp_len] = 0;
g_strlcat(buf, "last-image", sizeof(buf));
xfconf_g_property_bind(channel, buf, G_TYPE_STRING,
G_OBJECT(backdrop), "image-filename");
More information about the Xfce4-commits
mailing list