Updating branch refs/heads/ristretto-0.0 to 91325112789b59dcc988461afdf877f17a832037 (commit) from d9351b358ffd7ebbd3cdf00524ba27d80215c993 (commit)
commit 91325112789b59dcc988461afdf877f17a832037 Author: Stephan Arts <step...@xfce.org> Date: Sat Sep 19 00:54:19 2009 +0200 Implement option to toggle 'preview' ChangeLog | 7 +++++++ src/main_window.c | 21 +++++++++++++-------- src/picture_viewer.c | 18 +++++++++++------- src/preferences_dialog.c | 22 ++++++++++++++++++++++ src/settings.c | 18 ++++++++++++++++++ 5 files changed, 71 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index a24e047..989b8b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2009-09-19 Stephan Arts <step...@xfce.org> + * src/main_window.c, + src/picture_viewer.c, + src/preferences_dialog.c, + src/settings.c: Implement option to toggle 'preview' + +2009-09-19 Stephan Arts <step...@xfce.org> + * po/*.po: Update .po files * po/ristretto.pot: Add .pot file diff --git a/src/main_window.c b/src/main_window.c index 2a8a6c1..3bc4a0a 100644 --- a/src/main_window.c +++ b/src/main_window.c @@ -148,7 +148,7 @@ cb_rstto_main_window_image_list_iter_changed (RsttoImageListIter *iter, RsttoMai static void cb_rstto_main_window_image_list_iter_prepare_change (RsttoImageListIter *iter, RsttoMainWindow *window); static void -cb_rstto_main_window_image_prepared(RsttoImage *image, RsttoMainWindow *window); +cb_rstto_main_window_image_updated (RsttoImage *image, RsttoMainWindow *window); static void cb_rstto_main_window_image_list_new_image (RsttoImageList *image_list, RsttoImage *image, RsttoMainWindow *window); @@ -713,7 +713,7 @@ rstto_main_window_image_list_iter_changed (RsttoMainWindow *window) if (cur_image) { - g_signal_connect (G_OBJECT (cur_image), "prepared", G_CALLBACK (cb_rstto_main_window_image_prepared), window); + g_signal_connect (G_OBJECT (cur_image), "updated", G_CALLBACK (cb_rstto_main_window_image_updated), window); width = rstto_image_get_width(cur_image); height = rstto_image_get_height(cur_image); @@ -758,7 +758,7 @@ cb_rstto_main_window_image_list_iter_prepare_change (RsttoImageListIter *iter, R RsttoImage *image = rstto_image_list_iter_get_image (iter); if (image) { - g_signal_handlers_disconnect_by_func (image, cb_rstto_main_window_image_prepared, window); + g_signal_handlers_disconnect_by_func (image, cb_rstto_main_window_image_updated, window); } } @@ -2298,14 +2298,19 @@ cb_rstto_main_window_toggle_show_thumbnailbar (GtkWidget *widget, RsttoMainWindo } static void -cb_rstto_main_window_image_prepared (RsttoImage *image, RsttoMainWindow *window) +cb_rstto_main_window_image_updated (RsttoImage *image, RsttoMainWindow *window) { gint width = rstto_image_get_width (image); gint height = rstto_image_get_height (image); - gchar *status = g_strdup_printf ("%d x %d", width, height); + gchar *status; - gtk_statusbar_pop (GTK_STATUSBAR (window->priv->statusbar), window->priv->statusbar_context_id); - gtk_statusbar_push (GTK_STATUSBAR (window->priv->statusbar), window->priv->statusbar_context_id, status); + if (width > 0) + { + status = g_strdup_printf ("%d x %d", width, height); + + gtk_statusbar_pop (GTK_STATUSBAR (window->priv->statusbar), window->priv->statusbar_context_id); + gtk_statusbar_push (GTK_STATUSBAR (window->priv->statusbar), window->priv->statusbar_context_id, status); - g_free (status); + g_free (status); + } } diff --git a/src/picture_viewer.c b/src/picture_viewer.c index a900129..63d934c 100644 --- a/src/picture_viewer.c +++ b/src/picture_viewer.c @@ -950,7 +950,7 @@ cb_rstto_picture_viewer_motion_notify_event (RsttoPictureViewer *viewer, static void rstto_picture_viewer_calculate_adjustments (RsttoPictureViewer *viewer, gdouble scale) { - GdkPixbuf *p_src_pixbuf; + GdkPixbuf *p_src_pixbuf = NULL; GtkWidget *widget = GTK_WIDGET (viewer); gdouble image_width, image_height; gdouble pixbuf_width, pixbuf_height; @@ -1093,6 +1093,7 @@ cb_rstto_picture_viewer_queued_repaint (RsttoPictureViewer *viewer) gdouble thumb_scale = 1; gdouble thumb_width = 0; gboolean fit_to_screen = FALSE; + gboolean show_preview = rstto_settings_get_boolean_property (viewer->priv->settings, "show-preview"); gdouble image_width = 0, image_height = 0; gdouble pixbuf_width, pixbuf_height; GtkWidget *widget = GTK_WIDGET (viewer); @@ -1115,14 +1116,17 @@ cb_rstto_picture_viewer_queued_repaint (RsttoPictureViewer *viewer) } break; case RSTTO_PICTURE_VIEWER_STATE_PREVIEW: - p_src_pixbuf = rstto_image_get_thumbnail (viewer->priv->image); - if (p_src_pixbuf) + if (show_preview == TRUE) { - thumb_width = (gdouble)gdk_pixbuf_get_width (p_src_pixbuf); - thumb_scale = (thumb_width / image_width); + p_src_pixbuf = rstto_image_get_thumbnail (viewer->priv->image); + if (p_src_pixbuf) + { + thumb_width = (gdouble)gdk_pixbuf_get_width (p_src_pixbuf); + thumb_scale = (thumb_width / image_width); + } + else + return FALSE; } - else - return FALSE; break; default: break; diff --git a/src/preferences_dialog.c b/src/preferences_dialog.c index aed517d..6c54616 100644 --- a/src/preferences_dialog.c +++ b/src/preferences_dialog.c @@ -52,6 +52,9 @@ cb_rstto_preferences_dialog_cache_spin_button_value_changed (GtkSpinButton *, gp static void cb_rstto_preferences_dialog_image_quality_combo_box_changed (GtkComboBox *, gpointer); static void +cb_rstto_preferences_dialog_image_preview_toggled (GtkToggleButton *button, + gpointer user_data); +static void cb_rstto_preferences_dialog_no_scrollwheel_action_radio_button_toggled (GtkToggleButton *, gpointer); static void cb_rstto_preferences_dialog_zoom_scrollwheel_action_radio_button_toggled (GtkToggleButton *, gpointer); @@ -86,6 +89,7 @@ struct _RsttoPreferencesDialogPriv GtkWidget *image_quality_hbox; GtkWidget *image_quality_label; GtkWidget *image_quality_combo; + GtkWidget *image_preview_check_button; } display_tab; struct @@ -160,6 +164,7 @@ rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog) gchar *scrollwheel_primary_action; guint uint_slideshow_timeout; gboolean bool_hide_thumbnailbar_fullscreen; + gboolean bool_show_preview; GdkColor *bgcolor; GtkWidget *timeout_lbl, *timeout_hscale; @@ -184,6 +189,7 @@ rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog) g_object_get (G_OBJECT (dialog->priv->settings), "image-quality", &uint_image_quality, "cache-size", &uint_cache_size, + "show-preview", &bool_show_preview, "preload-images", &uint_preload_images, "enable-cache", &bool_enable_cache, "bgcolor-override", &bool_bgcolor_override, @@ -241,6 +247,10 @@ rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog) dialog->priv->display_tab.image_quality_label = gtk_label_new (_("Maximum render quality:")); dialog->priv->display_tab.image_quality_hbox= gtk_hbox_new (FALSE, 4); dialog->priv->display_tab.image_quality_combo= gtk_combo_box_new_text (); + dialog->priv->display_tab.image_preview_check_button = gtk_check_button_new_with_label (_("Show preview when loading image")); + + g_signal_connect (G_OBJECT (dialog->priv->display_tab.image_preview_check_button), + "toggled", (GCallback)cb_rstto_preferences_dialog_image_preview_toggled, dialog); gtk_combo_box_append_text (GTK_COMBO_BOX (dialog->priv->display_tab.image_quality_combo), _("Best")); gtk_combo_box_append_text (GTK_COMBO_BOX (dialog->priv->display_tab.image_quality_combo), _("High")); @@ -249,6 +259,9 @@ rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog) gtk_box_pack_start (GTK_BOX (dialog->priv->display_tab.image_quality_vbox), dialog->priv->display_tab.image_quality_hbox, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (dialog->priv->display_tab.image_quality_vbox), + dialog->priv->display_tab.image_preview_check_button, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (dialog->priv->display_tab.image_quality_hbox), dialog->priv->display_tab.image_quality_label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (dialog->priv->display_tab.image_quality_hbox), @@ -606,6 +619,15 @@ cb_rstto_preferences_dialog_image_quality_combo_box_changed (GtkComboBox *combo_ } static void +cb_rstto_preferences_dialog_image_preview_toggled (GtkToggleButton *button, + gpointer user_data) +{ + RsttoPreferencesDialog *dialog = RSTTO_PREFERENCES_DIALOG (user_data); + + rstto_settings_set_boolean_property (dialog->priv->settings, "show-preview", gtk_toggle_button_get_active (button)); +} + +static void cb_rstto_preferences_dialog_no_scrollwheel_action_radio_button_toggled (GtkToggleButton *button, gpointer user_data) { diff --git a/src/settings.c b/src/settings.c index fdeb36f..5629fc5 100644 --- a/src/settings.c +++ b/src/settings.c @@ -57,6 +57,7 @@ enum PROP_SHOW_NAV_TOOLBAR, PROP_NAVBAR_POSITION, PROP_SHOW_THUMBNAILBAR, + PROP_SHOW_PREVIEW, PROP_HIDE_THUMBNAILBAR_FULLSCREEN, PROP_TOOLBAR_OPEN, PROP_ENABLE_CACHE, @@ -107,6 +108,7 @@ struct _RsttoSettingsPriv gboolean show_file_toolbar; gboolean show_nav_toolbar; gboolean show_thumbnailbar; + gboolean show_preview; gboolean hide_thumbnailbar_fullscreen; gchar *navigationbar_position; guint preload_images; @@ -158,6 +160,7 @@ rstto_settings_init (GObject *object) xfconf_g_property_bind (settings->priv->channel, "/window/show-thumbnailbar", G_TYPE_BOOLEAN, settings, "show-thumbnailbar"); xfconf_g_property_bind (settings->priv->channel, "/window/hide-thumbnailbar-fullscreen", G_TYPE_BOOLEAN, settings, "hide-thumbnailbar-fullscreen"); xfconf_g_property_bind (settings->priv->channel, "/window/navigationbar-position", G_TYPE_STRING, settings, "navigationbar-position"); + xfconf_g_property_bind (settings->priv->channel, "/window/show-preview", G_TYPE_BOOLEAN, settings, "show-preview"); xfconf_g_property_bind (settings->priv->channel, "/window/scrollwheel-primary-action", G_TYPE_STRING, settings, "scrollwheel-primary-action"); xfconf_g_property_bind (settings->priv->channel, "/window/scrollwheel-secondary-action", G_TYPE_STRING, settings, "scrollwheel-secondary-action"); @@ -256,6 +259,15 @@ rstto_settings_class_init (GObjectClass *object_class) PROP_NAVBAR_POSITION, pspec); + pspec = g_param_spec_boolean ("show-preview", + "", + "", + TRUE, + G_PARAM_READWRITE); + g_object_class_install_property (object_class, + PROP_SHOW_PREVIEW, + pspec); + pspec = g_param_spec_uint ("preload-images", "", "", @@ -463,6 +475,9 @@ rstto_settings_set_property (GObject *object, settings->priv->navigationbar_position = g_strdup (str_val); } break; + case PROP_SHOW_PREVIEW: + settings->priv->show_preview = g_value_get_boolean (value); + break; case PROP_PRELOAD_IMAGES: settings->priv->preload_images = g_value_get_uint (value); break; @@ -545,6 +560,9 @@ rstto_settings_get_property (GObject *object, case PROP_NAVBAR_POSITION: g_value_set_string (value, settings->priv->navigationbar_position); break; + case PROP_SHOW_PREVIEW: + g_value_set_boolean (value, settings->priv->show_preview); + break; case PROP_PRELOAD_IMAGES: g_value_set_uint (value, settings->priv->preload_images); break; _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits