[Goodies-commits] r3977 - ristretto/trunk/src
Stephan Arts
stephan at xfce.org
Thu Feb 21 11:02:32 CET 2008
Author: stephan
Date: 2008-02-21 10:02:32 +0000 (Thu, 21 Feb 2008)
New Revision: 3977
Modified:
ristretto/trunk/src/main.c
ristretto/trunk/src/main_window.c
ristretto/trunk/src/main_window.h
ristretto/trunk/src/navigator.c
ristretto/trunk/src/picture_viewer.c
Log:
Add resize on maximize option (should find a better name for it)
Modified: ristretto/trunk/src/main.c
===================================================================
--- ristretto/trunk/src/main.c 2008-02-20 07:36:42 UTC (rev 3976)
+++ ristretto/trunk/src/main.c 2008-02-21 10:02:32 UTC (rev 3977)
@@ -238,6 +238,7 @@
gint max_cache = xfce_rc_read_int_entry(xfce_rc, "MaxImagesCacheSize", 64);
gboolean preload_during_slideshow = xfce_rc_read_bool_entry (xfce_rc, "PreloadDuringSlideShow", FALSE);
gboolean override_bg_color = xfce_rc_read_bool_entry (xfce_rc, "OverrideBgColor", FALSE);
+ gboolean scale_to_100 = xfce_rc_read_bool_entry (xfce_rc, "ScaleTo100", FALSE);
if (override_bg_color)
{
@@ -258,6 +259,7 @@
rstto_main_window_set_max_cache_size(RSTTO_MAIN_WINDOW(window), max_cache);
rstto_main_window_set_slideshow_timeout(RSTTO_MAIN_WINDOW(window), (gdouble)slideshow_timeout);
+ rstto_main_window_set_scale_to_100(RSTTO_MAIN_WINDOW(window), scale_to_100);
GtkRecentManager *recent_manager = rstto_main_window_get_recent_manager(RSTTO_MAIN_WINDOW(window));
rstto_navigator_set_timeout(navigator, slideshow_timeout);
@@ -479,6 +481,7 @@
bg_color = (GdkColor *)rstto_main_window_get_pv_bg_color(RSTTO_MAIN_WINDOW(window));
xfce_rc_write_bool_entry(xfce_rc, "ShowToolBar", rstto_main_window_get_show_toolbar(RSTTO_MAIN_WINDOW(window)));
+ xfce_rc_write_bool_entry(xfce_rc, "ScaleTo100", rstto_main_window_get_scale_to_100(RSTTO_MAIN_WINDOW(window)));
xfce_rc_write_bool_entry(xfce_rc, "PreloadDuringSlideShow", navigator->preload);
xfce_rc_write_bool_entry(xfce_rc, "ShowThumbnailViewer", rstto_main_window_get_show_thumbnail_viewer(RSTTO_MAIN_WINDOW(window)));
if (bg_color)
Modified: ristretto/trunk/src/main_window.c
===================================================================
--- ristretto/trunk/src/main_window.c 2008-02-20 07:36:42 UTC (rev 3976)
+++ ristretto/trunk/src/main_window.c 2008-02-21 10:02:32 UTC (rev 3977)
@@ -59,6 +59,7 @@
gint max_cache_size;
gdouble slideshow_timeout;
const GdkColor *bg_color;
+ gboolean scale_to_100;
} settings;
struct {
@@ -292,6 +293,8 @@
window->priv->mime_dbase = thunar_vfs_mime_database_get_default();
window->priv->icon_theme = gtk_icon_theme_get_default();
+
+ window->priv->settings.scale_to_100 = TRUE;
GtkAccelGroup *accel_group = gtk_accel_group_new();
@@ -979,6 +982,18 @@
rstto_navigator_set_max_history_size(window->priv->navigator, max_cache_size * 1000000);
}
+void
+rstto_main_window_set_scale_to_100 (RsttoMainWindow *window, gboolean scale_to_100)
+{
+ window->priv->settings.scale_to_100 = scale_to_100;
+}
+
+gboolean
+rstto_main_window_get_scale_to_100 (RsttoMainWindow *window)
+{
+ return window->priv->settings.scale_to_100;
+}
+
/* CALLBACK FUNCTIONS */
static void
@@ -1127,6 +1142,17 @@
}
}
}
+ if (event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED)
+ {
+ RsttoNavigatorEntry *entry = rstto_navigator_get_file(window->priv->navigator);
+
+ if (window->priv->settings.scale_to_100 == TRUE)
+ {
+ rstto_picture_viewer_set_zoom_mode(RSTTO_PICTURE_VIEWER(window->priv->picture_viewer), RSTTO_ZOOM_MODE_CUSTOM);
+ rstto_navigator_entry_set_scale(entry, 0);
+ }
+
+ }
}
static void
@@ -1161,6 +1187,12 @@
GtkWidget *slideshow_main_lbl;
GtkWidget *display_main_vbox;
GtkWidget *display_main_lbl;
+ GtkWidget *behaviour_main_vbox;
+ GtkWidget *behaviour_main_lbl;
+
+ GtkWidget *resize_to_content_vbox, *resize_to_content_frame;
+ GtkWidget *resize_on_maximize_check;
+
GtkWidget *bg_color_vbox;
GtkWidget *bg_color_hbox;
GtkWidget *bg_color_frame;
@@ -1192,6 +1224,11 @@
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), notebook, TRUE, TRUE, 0);
+/** Add notebook pages */
+ behaviour_main_vbox = gtk_vbox_new(FALSE, 0);
+ behaviour_main_lbl = gtk_label_new(_("Behaviour"));
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebook), behaviour_main_vbox, behaviour_main_lbl);
+
slideshow_main_vbox = gtk_vbox_new(FALSE, 0);
slideshow_main_lbl = gtk_label_new(_("Slideshow"));
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), slideshow_main_vbox, slideshow_main_lbl);
@@ -1200,6 +1237,19 @@
display_main_lbl = gtk_label_new(_("Display"));
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), display_main_vbox, display_main_lbl);
+/** Add content for behaviour page */
+ resize_to_content_vbox = gtk_vbox_new(FALSE, 0);
+ resize_to_content_frame = xfce_create_framebox_with_content(_("Resize to content"), resize_to_content_vbox);
+
+ resize_on_maximize_check = gtk_check_button_new_with_mnemonic(_("Resize on maximize"));
+ gtk_box_pack_start(GTK_BOX(resize_to_content_vbox), resize_on_maximize_check, FALSE, TRUE, 0);
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resize_on_maximize_check), window->priv->settings.scale_to_100);
+
+ gtk_container_set_border_width (GTK_CONTAINER (resize_to_content_frame), 8);
+ gtk_box_pack_start(GTK_BOX(behaviour_main_vbox), resize_to_content_frame, FALSE, TRUE, 0);
+
+/** Add content for display page */
bg_color_vbox = gtk_vbox_new(FALSE, 0);
bg_color_frame = xfce_create_framebox_with_content (_("Background Color"), bg_color_vbox);
@@ -1244,6 +1294,7 @@
gtk_box_pack_start(GTK_BOX(display_main_vbox), bg_color_frame, FALSE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(display_main_vbox), cache_frame, FALSE, TRUE, 0);
+/** Add content for slideshow page */
GtkWidget *slideshow_vbox = gtk_vbox_new(FALSE, 0);
GtkWidget *slideshow_frame = xfce_create_framebox_with_content (_("Timeout"), slideshow_vbox);
@@ -1301,6 +1352,8 @@
}
rstto_picture_viewer_redraw(RSTTO_PICTURE_VIEWER(window->priv->picture_viewer));
rstto_main_window_set_max_cache_size(window, GTK_ADJUSTMENT(cache_adjustment)->value);
+
+ window->priv->settings.scale_to_100 = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resize_on_maximize_check));
default:
break;
}
Modified: ristretto/trunk/src/main_window.h
===================================================================
--- ristretto/trunk/src/main_window.h 2008-02-20 07:36:42 UTC (rev 3976)
+++ ristretto/trunk/src/main_window.h 2008-02-21 10:02:32 UTC (rev 3977)
@@ -93,6 +93,11 @@
const GdkColor *
rstto_main_window_get_pv_bg_color (RsttoMainWindow *window);
+void
+rstto_main_window_set_scale_to_100 (RsttoMainWindow *window, gboolean scale_to_100);
+gboolean
+rstto_main_window_get_scale_to_100 (RsttoMainWindow *window);
+
G_END_DECLS
#endif /* __RISTRETTO_MAIN_WINDOW_H__ */
Modified: ristretto/trunk/src/navigator.c
===================================================================
--- ristretto/trunk/src/navigator.c 2008-02-20 07:36:42 UTC (rev 3976)
+++ ristretto/trunk/src/navigator.c 2008-02-21 10:02:32 UTC (rev 3977)
@@ -899,6 +899,11 @@
void
rstto_navigator_entry_set_scale (RsttoNavigatorEntry *entry, gdouble scale)
{
+ if (scale == 0.0)
+ {
+ entry->scale = scale;
+ return;
+ }
/* Max scale 1600% */
if (scale > 16)
scale = 16;
Modified: ristretto/trunk/src/picture_viewer.c
===================================================================
--- ristretto/trunk/src/picture_viewer.c 2008-02-20 07:36:42 UTC (rev 3976)
+++ ristretto/trunk/src/picture_viewer.c 2008-02-21 10:02:32 UTC (rev 3977)
@@ -12,6 +12,8 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Drag-n-Drop support taken from Thunar, written by Benedict Meurer
*/
#include <config.h>
@@ -31,7 +33,16 @@
RSTTO_PICTURE_VIEWER_STATE_BOX_ZOOM
} RsttoPictureViewerState;
+enum
+{
+ TARGET_TEXT_URI_LIST,
+};
+static const GtkTargetEntry drop_targets[] = {
+ {"text/uri-list", 0, TARGET_TEXT_URI_LIST},
+};
+
+
struct _RsttoPictureViewerPriv
{
RsttoNavigator *navigator;
@@ -107,6 +118,21 @@
static void
cb_rstto_picture_viewer_popup_menu (RsttoPictureViewer *viewer, gboolean user_data);
+static gboolean
+rstto_picture_viewer_drag_drop (GtkWidget *widget,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ guint time);
+static gboolean
+rstto_picture_viewer_drag_motion (GtkWidget *widget,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ guint time);
+static void
+rstto_picture_viewer_drag_data_received();
+
static GtkWidgetClass *parent_class = NULL;
GType
@@ -157,6 +183,9 @@
g_signal_connect(G_OBJECT(viewer), "button_release_event", G_CALLBACK(cb_rstto_picture_viewer_button_release_event), NULL);
g_signal_connect(G_OBJECT(viewer), "motion_notify_event", G_CALLBACK(cb_rstto_picture_viewer_motion_notify_event), NULL);
g_signal_connect(G_OBJECT(viewer), "popup-menu", G_CALLBACK(cb_rstto_picture_viewer_popup_menu), NULL);
+
+ gtk_drag_dest_set(GTK_WIDGET(viewer), 0, drop_targets, G_N_ELEMENTS(drop_targets),
+ GDK_ACTION_COPY | GDK_ACTION_LINK | GDK_ACTION_MOVE);
}
static void
@@ -174,9 +203,11 @@
widget_class->realize = rstto_picture_viewer_realize;
widget_class->expose_event = rstto_picture_viewer_expose;
-
widget_class->size_request = rstto_picture_viewer_size_request;
widget_class->size_allocate = rstto_picture_viewer_size_allocate;
+ widget_class->drag_drop = rstto_picture_viewer_drag_drop;
+ widget_class->drag_motion = rstto_picture_viewer_drag_motion;
+ widget_class->drag_data_received = rstto_picture_viewer_drag_data_received;
object_class->destroy = rstto_picture_viewer_destroy;
@@ -616,6 +647,7 @@
{
scale = 1.0;
rstto_navigator_entry_set_scale(entry, scale);
+ rstto_navigator_entry_set_fit_to_screen(entry, FALSE);
fit_to_screen = FALSE;
}
else
@@ -1179,3 +1211,32 @@
{
viewer->priv->zoom_mode = mode;
}
+
+static void
+rstto_picture_viewer_drag_data_received()
+{
+ g_debug("%s", __FUNCTION__);
+}
+
+static gboolean
+rstto_picture_viewer_drag_drop (GtkWidget *widget,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ guint time)
+{
+ g_debug("%s", __FUNCTION__);
+ gtk_drag_finish(context, FALSE, FALSE, time);
+ return TRUE;
+}
+
+static gboolean
+rstto_picture_viewer_drag_motion (GtkWidget *widget,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ guint time)
+{
+ g_debug("%s", __FUNCTION__);
+ return TRUE;
+}
More information about the Goodies-commits
mailing list