[Xfce4-commits] <ristretto:ristretto-0.0> Add wrap-images setting
Stephan Arts
noreply at xfce.org
Sun Oct 23 19:22:47 CEST 2011
Updating branch refs/heads/ristretto-0.0
to 535dd6f1961a1e729d6fcaafc288f6a1a91f611a (commit)
from 735d8fd9583ca1d123c9d0d3e273b51720f2f5ff (commit)
commit 535dd6f1961a1e729d6fcaafc288f6a1a91f611a
Author: Stephan Arts <stephan at xfce.org>
Date: Sun Oct 25 18:34:34 2009 +0100
Add wrap-images setting
ChangeLog | 12 ++++++++----
src/image_list.c | 26 ++++++++++++--------------
src/image_list.h | 4 ----
src/preferences_dialog.c | 24 ++++++++++++++++++++++++
src/settings.c | 19 +++++++++++++++++++
5 files changed, 63 insertions(+), 22 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c98fe84..17e70a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-10-25 Stephan Arts <stephan at xfce.org>
+
+ * src/image_list.c,
+ src/image_list.h,
+ src/settings.c,
+ src/preferences_dialog.c: Add wrap-images setting
+
+
2009-10-24 Stephan Arts <stephan at xfce.org>
* src/image_cache.c: Make image-cache cache one less image to prevent it
@@ -5,10 +13,6 @@
* src/image_list.c: Move the iterators around before removing the image
from the image-list, this prevents the iterators from jumping to the
start or end of the list.
- * src/image_list.c
- src/image_list.h,
- src/settings.c: Add a wrap-images setting
-
2009-10-16 Stephan Arts <stephan at xfce.org>
diff --git a/src/image_list.c b/src/image_list.c
index 34c8d65..5a64e68 100644
--- a/src/image_list.c
+++ b/src/image_list.c
@@ -83,8 +83,6 @@ struct _RsttoImageListPriv
GSList *iterators;
GCompareFunc cb_rstto_image_list_compare_func;
-
- gboolean wrap_images;
};
static gint rstto_image_list_signals[RSTTO_IMAGE_LIST_SIGNAL_COUNT];
@@ -119,13 +117,9 @@ rstto_image_list_get_type (void)
static void
rstto_image_list_init(RsttoImageList *image_list)
{
- RsttoSettings *settings = rstto_settings_new();
image_list->priv = g_new0 (RsttoImageListPriv, 1);
image_list->priv->cb_rstto_image_list_compare_func = (GCompareFunc)cb_rstto_image_list_image_name_compare_func;
-
- image_list->priv->wrap_images = rstto_settings_get_boolean_property (settings, "wrap-images");
- g_object_unref (settings);
}
static void
@@ -458,6 +452,7 @@ void
rstto_image_list_iter_next (RsttoImageListIter *iter)
{
GList *position = NULL;
+ RsttoSettings *settings = NULL;
g_signal_emit (G_OBJECT (iter), rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_PREPARE_CHANGE], 0, NULL);
@@ -472,7 +467,9 @@ rstto_image_list_iter_next (RsttoImageListIter *iter)
iter->priv->image = position->data;
else
{
- if (rstto_image_list_get_wrap_images (iter->priv->image_list))
+ settings = rstto_settings_new();
+
+ if (rstto_settings_get_boolean_property (settings, "wrap-images"))
position = g_list_first (iter->priv->image_list->priv->images);
else
position = g_list_last (iter->priv->image_list->priv->images);
@@ -481,6 +478,8 @@ rstto_image_list_iter_next (RsttoImageListIter *iter)
iter->priv->image = position->data;
else
iter->priv->image = NULL;
+
+ g_object_unref (settings);
}
g_signal_emit (G_OBJECT (iter), rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_CHANGED], 0, NULL);
@@ -490,6 +489,7 @@ void
rstto_image_list_iter_previous (RsttoImageListIter *iter)
{
GList *position = NULL;
+ RsttoSettings *settings = NULL;
g_signal_emit (G_OBJECT (iter), rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_PREPARE_CHANGE], 0, NULL);
@@ -504,7 +504,9 @@ rstto_image_list_iter_previous (RsttoImageListIter *iter)
iter->priv->image = position->data;
else
{
- if (rstto_image_list_get_wrap_images (iter->priv->image_list))
+ settings = rstto_settings_new();
+
+ if (rstto_settings_get_boolean_property (settings, "wrap-images"))
position = g_list_last (iter->priv->image_list->priv->images);
else
position = g_list_first (iter->priv->image_list->priv->images);
@@ -513,6 +515,8 @@ rstto_image_list_iter_previous (RsttoImageListIter *iter)
iter->priv->image = position->data;
else
iter->priv->image = NULL;
+
+ g_object_unref (settings);
}
g_signal_emit (G_OBJECT (iter), rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_CHANGED], 0, NULL);
@@ -624,9 +628,3 @@ cb_rstto_image_list_file_compare_func (RsttoImage *a, GFile *file)
g_free (b_base);
return result;
}
-
-gboolean
-rstto_image_list_get_wrap_images (RsttoImageList *image_list)
-{
- return image_list->priv->wrap_images;
-}
diff --git a/src/image_list.h b/src/image_list.h
index f1c8145..2011824 100644
--- a/src/image_list.h
+++ b/src/image_list.h
@@ -98,10 +98,6 @@ RsttoImageList *rstto_image_list_new ();
gint rstto_image_list_get_n_images (RsttoImageList *image_list);
gboolean rstto_image_list_add_file (RsttoImageList *image_list, GFile *file, GError **);
-gboolean
-rstto_image_list_get_wrap_images (RsttoImageList *image_list);
-
-
GCompareFunc rstto_image_list_get_compare_func (RsttoImageList *image_list);
void rstto_image_list_set_compare_func (RsttoImageList *image_list, GCompareFunc func);
diff --git a/src/preferences_dialog.c b/src/preferences_dialog.c
index 9290761..e4cad7e 100644
--- a/src/preferences_dialog.c
+++ b/src/preferences_dialog.c
@@ -69,6 +69,9 @@ cb_rstto_preferences_dialog_hide_thumbnails_fullscreen_check_button_toggled (
static void
cb_rstto_preferences_dialog_open_entire_folder_check_button_toggled (GtkToggleButton *button,
gpointer user_data);
+static void
+cb_rstto_preferences_dialog_wrap_images_check_button_toggled (GtkToggleButton *button,
+ gpointer user_data);
static void
cb_rstto_preferences_dialog_slideshow_timeout_value_changed (GtkRange *, gpointer);
@@ -113,6 +116,7 @@ struct _RsttoPreferencesDialogPriv
GtkWidget *no_scrollwheel_action_radio_button;
GtkWidget *zoom_scrollwheel_action_radio_button;
GtkWidget *switch_scrollwheel_action_radio_button;
+
} control_tab;
struct
@@ -125,6 +129,7 @@ struct _RsttoPreferencesDialogPriv
GtkWidget *startup_vbox;
GtkWidget *resize_window_on_startup_check_button;
GtkWidget *open_entire_folder_check_button;
+ GtkWidget *wrap_images_check_button;
} behaviour_tab;
struct
@@ -182,6 +187,7 @@ rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog)
gboolean bool_hide_thumbnailbar_fullscreen;
gboolean bool_show_preview;
gboolean bool_open_entire_folder;
+ gboolean bool_wrap_images;
GdkColor *bgcolor;
GtkWidget *timeout_lbl, *timeout_hscale;
@@ -216,6 +222,7 @@ rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog)
"slideshow-timeout", &uint_slideshow_timeout,
"hide-thumbnailbar-fullscreen", &bool_hide_thumbnailbar_fullscreen,
"open-entire-folder", &bool_open_entire_folder,
+ "wrap-images", &bool_wrap_images,
NULL);
/*****************/
@@ -428,8 +435,16 @@ rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog)
gtk_container_add (GTK_CONTAINER (dialog->priv->behaviour_tab.startup_vbox), dialog->priv->behaviour_tab.open_entire_folder_check_button);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->behaviour_tab.open_entire_folder_check_button),
bool_open_entire_folder);
+
+ dialog->priv->behaviour_tab.wrap_images_check_button = gtk_check_button_new_with_label (_("Wrap around images"));
+ gtk_container_add (GTK_CONTAINER (dialog->priv->behaviour_tab.startup_vbox), dialog->priv->behaviour_tab.wrap_images_check_button);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->behaviour_tab.wrap_images_check_button),
+ bool_wrap_images);
+
g_signal_connect (G_OBJECT (dialog->priv->behaviour_tab.open_entire_folder_check_button),
"toggled", (GCallback)cb_rstto_preferences_dialog_open_entire_folder_check_button_toggled, dialog);
+ g_signal_connect (G_OBJECT (dialog->priv->behaviour_tab.wrap_images_check_button),
+ "toggled", (GCallback)cb_rstto_preferences_dialog_wrap_images_check_button_toggled, dialog);
@@ -734,3 +749,12 @@ cb_rstto_preferences_dialog_open_entire_folder_check_button_toggled (GtkToggleBu
rstto_settings_set_boolean_property (dialog->priv->settings, "open-entire-folder", gtk_toggle_button_get_active(button));
}
+
+static void
+cb_rstto_preferences_dialog_wrap_images_check_button_toggled (GtkToggleButton *button,
+ gpointer user_data)
+{
+ RsttoPreferencesDialog *dialog = RSTTO_PREFERENCES_DIALOG (user_data);
+
+ rstto_settings_set_boolean_property (dialog->priv->settings, "wrap-images", gtk_toggle_button_get_active(button));
+}
diff --git a/src/settings.c b/src/settings.c
index f994c95..669797e 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -74,6 +74,7 @@ enum
PROP_SCROLLWHEEL_PRIMARY_ACTION,
PROP_SCROLLWHEEL_SECONDARY_ACTION,
PROP_OPEN_ENTIRE_FOLDER,
+ PROP_WRAP_IMAGES,
};
GType
@@ -126,6 +127,7 @@ struct _RsttoSettingsPriv
GdkColor *bgcolor_fullscreen;
gchar *scrollwheel_primary_action;
gchar *scrollwheel_secondary_action;
+ gboolean wrap_images;
};
@@ -156,6 +158,7 @@ rstto_settings_init (GObject *object)
settings->priv->show_nav_toolbar = TRUE;
settings->priv->window_width = 600;
settings->priv->window_height = 400;
+ settings->priv->wrap_images = TRUE;
xfconf_g_property_bind (settings->priv->channel, "/window/width", G_TYPE_UINT, settings, "window-width");
xfconf_g_property_bind (settings->priv->channel, "/window/height", G_TYPE_UINT, settings, "window-height");
@@ -182,6 +185,7 @@ rstto_settings_init (GObject *object)
xfconf_g_property_bind (settings->priv->channel, "/image/cache", G_TYPE_BOOLEAN, settings, "enable-cache");
xfconf_g_property_bind (settings->priv->channel, "/image/cache-size", G_TYPE_UINT, settings, "cache-size");
xfconf_g_property_bind (settings->priv->channel, "/image/quality", G_TYPE_UINT, settings, "image-quality");
+ xfconf_g_property_bind (settings->priv->channel, "/image/wrap", G_TYPE_BOOLEAN, settings, "wrap-images");
}
@@ -391,6 +395,15 @@ rstto_settings_class_init (GObjectClass *object_class)
g_object_class_install_property (object_class,
PROP_BGCOLOR_FULLSCREEN,
pspec);
+
+ pspec = g_param_spec_boolean ("wrap-images",
+ "",
+ "",
+ TRUE,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (object_class,
+ PROP_WRAP_IMAGES,
+ pspec);
}
/**
@@ -549,6 +562,9 @@ rstto_settings_set_property (GObject *object,
g_free (settings->priv->scrollwheel_secondary_action);
settings->priv->scrollwheel_secondary_action = g_value_dup_string (value);
break;
+ case PROP_WRAP_IMAGES:
+ settings->priv->wrap_images = g_value_get_boolean (value);
+ break;
default:
break;
}
@@ -624,6 +640,9 @@ rstto_settings_get_property (GObject *object,
break;
case PROP_SCROLLWHEEL_SECONDARY_ACTION:
g_value_set_string (value, settings->priv->scrollwheel_secondary_action);
+ case PROP_WRAP_IMAGES:
+ g_value_set_boolean (value, settings->priv->wrap_images);
+ break;
break;
default:
break;
More information about the Xfce4-commits
mailing list