changeset 1622:fee96b7345e8

Add an option to Image preferences to restrict custom border to fullscreen mode only. Bug 2798062.
author zas_
date Thu, 04 Jun 2009 19:51:20 +0000
parents 397c25f6c9d6
children 66d4bd637fd7
files src/fullscreen.c src/image.c src/image.h src/img-view.c src/layout.c src/layout_image.c src/options.c src/options.h src/preferences.c src/rcfile.c
diffstat 10 files changed, 40 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/fullscreen.c	Thu Jun 04 16:07:41 2009 +0000
+++ b/src/fullscreen.c	Thu Jun 04 19:51:20 2009 +0000
@@ -291,11 +291,7 @@
 
 	gtk_container_add(GTK_CONTAINER(fs->window), fs->imd->widget);
 
-	if (options->image.use_custom_border_color)
-		{
-		image_background_set_color(fs->imd, &options->image.border_color);
-		}
-
+	image_background_set_color_from_options(fs->imd, TRUE);
 	image_set_delay_flip(fs->imd, options->fullscreen.clean_flip);
 	image_auto_refresh_enable(fs->imd, fs->normal_imd->auto_refresh);
 
--- a/src/image.c	Thu Jun 04 16:07:41 2009 +0000
+++ b/src/image.c	Thu Jun 04 19:51:20 2009 +0000
@@ -1441,6 +1441,19 @@
 	pixbuf_renderer_set_color((PixbufRenderer *)imd->pr, color);
 }
 
+void image_background_set_color_from_options(ImageWindow *imd, gboolean fullscreen)
+{
+	GdkColor *color = NULL;
+
+	if (options->image.use_custom_border_color
+	    && (!options->image.custom_border_fullscreen_only || fullscreen))
+		{
+		color = &options->image.border_color;
+		}
+
+	image_background_set_color(imd, color);
+}
+
 void image_color_profile_set(ImageWindow *imd,
 			     gint input_type, gint screen_type,
 			     gboolean use_image)
--- a/src/image.h	Thu Jun 04 16:07:41 2009 +0000
+++ b/src/image.h	Thu Jun 04 19:51:20 2009 +0000
@@ -100,6 +100,7 @@
 
 /* background of image */
 void image_background_set_color(ImageWindow *imd, GdkColor *color);
+void image_background_set_color_from_options(ImageWindow *imd, gboolean fullscreen);
 
 /* color profiles */
 void image_color_profile_set(ImageWindow *imd,
--- a/src/img-view.c	Thu Jun 04 16:07:41 2009 +0000
+++ b/src/img-view.c	Thu Jun 04 19:51:20 2009 +0000
@@ -848,7 +848,7 @@
 
 	vw->imd = image_new(FALSE);
 
-	image_background_set_color(vw->imd, options->image.use_custom_border_color ? &options->image.border_color : NULL);
+	image_background_set_color_from_options(vw->imd, FALSE);
 
 	image_attach_window(vw->imd, vw->window, NULL, GQ_APPNAME, TRUE);
 
@@ -1002,8 +1002,8 @@
 		{
 		ViewWindow *vw = work->data;
 		work = work->next;
-
-		image_background_set_color(vw->imd, options->image.use_custom_border_color ? &options->image.border_color : NULL);
+		
+		image_background_set_color_from_options(vw->imd, !!vw->fs);
 		}
 }
 
--- a/src/layout.c	Thu Jun 04 16:07:41 2009 +0000
+++ b/src/layout.c	Thu Jun 04 19:51:20 2009 +0000
@@ -1875,11 +1875,19 @@
 	work = layout_window_list;
 	while (work)
 		{
+		gint i;
 		LayoutWindow *lw = work->data;
 		work = work->next;
-
+		
 		if (!lw->image) continue;
-		image_background_set_color(lw->image, options->image.use_custom_border_color ? &options->image.border_color : NULL);
+
+		for (i = 0; i < MAX_SPLIT_IMAGES; i++)
+			{
+			if (!lw->split_images[i]) continue;
+			image_background_set_color_from_options(lw->split_images[i], !!lw->full_screen);
+			}
+		
+		image_background_set_color_from_options(lw->image, !!lw->full_screen);
 		}
 }
 
--- a/src/layout_image.c	Thu Jun 04 16:07:41 2009 +0000
+++ b/src/layout_image.c	Thu Jun 04 19:51:20 2009 +0000
@@ -1611,7 +1611,7 @@
 		g_signal_connect(G_OBJECT(lw->split_images[i]->pr), "update-pixel",
 				 G_CALLBACK(layout_status_update_pixel_cb), lw);
 
-		image_background_set_color(lw->split_images[i], options->image.use_custom_border_color ? &options->image.border_color : NULL);
+		image_background_set_color_from_options(lw->split_images[i], FALSE);
 
 		image_auto_refresh_enable(lw->split_images[i], TRUE);
 
--- a/src/options.c	Thu Jun 04 16:07:41 2009 +0000
+++ b/src/options.c	Thu Jun 04 19:51:20 2009 +0000
@@ -75,6 +75,7 @@
 	options->image.tile_cache_max = 10;
 	options->image.image_cache_max = 128; /* 4 x 10MPix */
 	options->image.use_custom_border_color = FALSE;
+	options->image.custom_border_fullscreen_only = FALSE;
 	options->image.zoom_2pass = TRUE;
 	options->image.zoom_increment = 5;
 	options->image.zoom_mode = ZOOM_RESET_NONE;
--- a/src/options.h	Thu Jun 04 16:07:41 2009 +0000
+++ b/src/options.h	Thu Jun 04 19:51:20 2009 +0000
@@ -68,7 +68,8 @@
 		guint zoom_quality;
 		gint zoom_increment;	/* 10 is 1.0, 5 is 0.05, 20 is 2.0, etc. */
 
-		gint use_custom_border_color;
+		gboolean custom_border_fullscreen_only;
+		gboolean use_custom_border_color;
 		GdkColor border_color;
 	} image;
 
--- a/src/preferences.c	Thu Jun 04 16:07:41 2009 +0000
+++ b/src/preferences.c	Thu Jun 04 19:51:20 2009 +0000
@@ -314,9 +314,12 @@
 
 	options->image.enable_read_ahead = c_options->image.enable_read_ahead;
 
+	
 	if (options->image.use_custom_border_color != c_options->image.use_custom_border_color
+	    || options->image.custom_border_fullscreen_only != c_options->image.custom_border_fullscreen_only
 	    || !gdk_color_equal(&options->image.border_color, &c_options->image.border_color))
 		{
+		options->image.custom_border_fullscreen_only = c_options->image.custom_border_fullscreen_only;
 		options->image.use_custom_border_color = c_options->image.use_custom_border_color;
 		options->image.border_color = c_options->image.border_color;
 		layout_colors_update();
@@ -1328,6 +1331,9 @@
 
 	pref_checkbox_new_int(group, _("Custom border color"),
 			      options->image.use_custom_border_color, &c_options->image.use_custom_border_color);
+	
+	pref_checkbox_new_int(group, _("Apply custom border to fullscreen mode only"),
+			      options->image.custom_border_fullscreen_only, &c_options->image.custom_border_fullscreen_only);
 
 	pref_color_button_new(group, _("Border color"), &options->image.border_color,
 			      G_CALLBACK(pref_color_button_set_cb), &c_options->image.border_color);
--- a/src/rcfile.c	Thu Jun 04 16:07:41 2009 +0000
+++ b/src/rcfile.c	Thu Jun 04 19:51:20 2009 +0000
@@ -330,6 +330,7 @@
 	WRITE_NL(); WRITE_BOOL(*options, image.enable_read_ahead);
 	WRITE_NL(); WRITE_BOOL(*options, image.exif_rotate_enable);
 	WRITE_NL(); WRITE_BOOL(*options, image.use_custom_border_color);
+	WRITE_NL(); WRITE_BOOL(*options, image.custom_border_fullscreen_only);
 	WRITE_NL(); WRITE_COLOR(*options, image.border_color);
 
 //	WRITE_SUBTITLE("Thumbnails Options");
@@ -613,6 +614,7 @@
 		if (READ_BOOL(*options, image.enable_read_ahead)) continue;
 		if (READ_BOOL(*options, image.exif_rotate_enable)) continue;
 		if (READ_BOOL(*options, image.use_custom_border_color)) continue;
+		if (READ_BOOL(*options, image.custom_border_fullscreen_only)) continue;
 		if (READ_COLOR(*options, image.border_color)) continue;
 
 		/* thumbnails options */