changeset 468:2df505c60459

Replace fullscreen.info and fullscreen.show_info options by: image_overlay.common.enabled => to save last state to rc file image_overlay.common.show_at_startup => overrides .common.enabled at startup image_overlay.common.template_string => replace fullscreen.info common is used since for now there is only one image overlay setup, later specific setups may be added.
author zas_
date Mon, 21 Apr 2008 20:01:22 +0000
parents 6624477decc8
children a05c72927e23
files src/fullscreen.c src/globals.c src/image-overlay.c src/main.c src/preferences.c src/rcfile.c src/typedefs.h
diffstat 7 files changed, 47 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/src/fullscreen.c	Mon Apr 21 19:42:58 2008 +0000
+++ b/src/fullscreen.c	Mon Apr 21 20:01:22 2008 +0000
@@ -34,8 +34,8 @@
 
 void set_default_fullscreen_info(ConfOptions *options)
 {
-	if (options->fullscreen.info) g_free(options->fullscreen.info);
-	options->fullscreen.info = g_strdup(DEFAULT_OVERLAY_INFO);
+	if (options->image_overlay.common.template_string) g_free(options->image_overlay.common.template_string);
+	options->image_overlay.common.template_string = g_strdup(DEFAULT_OVERLAY_INFO);
 }
 
 static void clear_mouse_cursor(GtkWidget *widget, gint state)
--- a/src/globals.c	Mon Apr 21 19:42:58 2008 +0000
+++ b/src/globals.c	Mon Apr 21 20:01:22 2008 +0000
@@ -51,9 +51,9 @@
 	options->fullscreen.above = FALSE;
 	options->fullscreen.clean_flip = FALSE;
 	options->fullscreen.disable_saver = TRUE;
-	options->fullscreen.info = NULL;
+	options->image_overlay.common.template_string = NULL;
 	options->fullscreen.screen = -1;
-	options->fullscreen.show_info = TRUE;
+	options->image_overlay.common.show_at_startup = TRUE;
 
 	memset(&options->image.border_color, 0, sizeof(options->image.border_color));
 	options->image.dither_quality = (gint)GDK_RGB_DITHER_NORMAL;
--- a/src/image-overlay.c	Mon Apr 21 19:42:58 2008 +0000
+++ b/src/image-overlay.c	Mon Apr 21 20:01:22 2008 +0000
@@ -335,7 +335,7 @@
  		}
  	else
  		{
- 		text = image_osd_mkinfo(options->fullscreen.info, imd, vars);
+ 		text = image_osd_mkinfo(options->image_overlay.common.template_string, imd, vars);
 		}
 
 	g_free(size);
--- a/src/main.c	Mon Apr 21 19:42:58 2008 +0000
+++ b/src/main.c	Mon Apr 21 20:01:22 2008 +0000
@@ -1261,7 +1261,7 @@
 			layout_geometry_get(NULL, &options->layout.main_window.x, &options->layout.main_window.y,
 					    &options->layout.main_window.w, &options->layout.main_window.h);
 			}
-		options->fullscreen.show_info = image_osd_get(lw->image, NULL, NULL);
+		options->image_overlay.common.enabled = image_osd_get(lw->image, NULL, NULL);
 		}
 
 	layout_geometry_get_dividers(NULL, &options->layout.main_window.hdivider_pos, &options->layout.main_window.vdivider_pos);
@@ -1532,7 +1532,7 @@
 						    collection_get_first(first_collection));
 			}
 		}
-	image_osd_set(lw->image, FALSE, options->fullscreen.show_info);
+	image_osd_set(lw->image, FALSE, (options->image_overlay.common.show_at_startup || options->image_overlay.common.enabled));
 
 	g_free(geometry);
 	g_free(cmd_path);
--- a/src/preferences.c	Mon Apr 21 19:42:58 2008 +0000
+++ b/src/preferences.c	Mon Apr 21 20:01:22 2008 +0000
@@ -252,11 +252,11 @@
 	options->fullscreen.clean_flip = c_options->fullscreen.clean_flip;
 	options->fullscreen.disable_saver = c_options->fullscreen.disable_saver;
 	options->fullscreen.above = c_options->fullscreen.above;
-	options->fullscreen.show_info = c_options->fullscreen.show_info;
-	if (c_options->fullscreen.info)
+	options->image_overlay.common.show_at_startup = c_options->image_overlay.common.show_at_startup;
+	if (c_options->image_overlay.common.template_string)
 		{
-		g_free(options->fullscreen.info);
-		options->fullscreen.info = g_strdup(c_options->fullscreen.info);
+		g_free(options->image_overlay.common.template_string);
+		options->image_overlay.common.template_string = g_strdup(c_options->image_overlay.common.template_string);
 		}
 
 	options->update_on_time_change = c_options->update_on_time_change;
@@ -775,7 +775,7 @@
 	gtk_widget_show(gd->dialog);
 }
 
-static void fullscreen_info_view_changed_cb(GtkWidget* widget, gpointer data)
+static void image_overlay_template_view_changed_cb(GtkWidget* widget, gpointer data)
 {
 	GtkWidget *pTextView;
 	GtkTextBuffer* pTextBuffer;
@@ -788,8 +788,8 @@
 	gtk_text_buffer_get_start_iter(pTextBuffer, &iStart);
 	gtk_text_buffer_get_end_iter(pTextBuffer, &iEnd);
 
-	if (c_options->fullscreen.info) g_free(c_options->fullscreen.info);
-	c_options->fullscreen.info = gtk_text_buffer_get_text(pTextBuffer, &iStart, &iEnd, TRUE);
+	if (c_options->image_overlay.common.template_string) g_free(c_options->image_overlay.common.template_string);
+	c_options->image_overlay.common.template_string = gtk_text_buffer_get_text(pTextBuffer, &iStart, &iEnd, TRUE);
 }
 
 static void fullscreen_info_default_ok_cb(GenericDialog *gd, gpointer data)
@@ -801,7 +801,7 @@
 	if (!configwindow) return;
 
 	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_view));
-	gtk_text_buffer_set_text(buffer, options->fullscreen.info, -1);
+	gtk_text_buffer_set_text(buffer, options->image_overlay.common.template_string, -1);
 }
 
 static void fullscreen_info_default_cb(GtkWidget *widget, gpointer data)
@@ -1278,7 +1278,7 @@
 	GtkWidget *spin;
 	GtkWidget *scrolled;
 	GtkWidget *viewport;
-	GtkWidget *fullscreen_info_view;
+	GtkWidget *image_overlay_template_view;
 	GtkTextBuffer *buffer;
 	gint i;
 
@@ -1311,9 +1311,9 @@
 			      options->fullscreen.clean_flip, &c_options->fullscreen.clean_flip);
 	pref_checkbox_new_int(group, _("Disable screen saver"),
 			      options->fullscreen.disable_saver, &c_options->fullscreen.disable_saver);
-	pref_checkbox_new_int(group, _("Always show fullscreen info"),
-			      options->fullscreen.show_info, &c_options->fullscreen.show_info);
-	pref_label_new(group, _("Fullscreen info string"));
+	pref_checkbox_new_int(group, _("Always show image overlay at startup"),
+			      options->image_overlay.common.show_at_startup, &c_options->image_overlay.common.show_at_startup);
+	pref_label_new(group, _("Image overlay template"));
 
 	scrolled = gtk_scrolled_window_new(NULL, NULL);
 	gtk_widget_set_size_request(scrolled, 200, 150);
@@ -1323,10 +1323,10 @@
 	gtk_box_pack_start(GTK_BOX(group), scrolled, TRUE, TRUE, 5);
 	gtk_widget_show(scrolled);
 
-	fullscreen_info_view = gtk_text_view_new();
+	image_overlay_template_view = gtk_text_view_new();
 
 #if GTK_CHECK_VERSION(2,12,0)
-	gtk_widget_set_tooltip_markup(fullscreen_info_view,
+	gtk_widget_set_tooltip_markup(image_overlay_template_view,
 	_("<i>%name%</i> results in the filename of the picture.\n"
 	  "Also available: <i>%collection%</i>, <i>%number%</i>, <i>%total%</i>, <i>%date%</i>,\n"
 	  "<i>%size%</i> (filesize), <i>%width%</i>, <i>%height%</i>, <i>%res%</i> (resolution)\n"
@@ -1339,20 +1339,20 @@
 	  "If a line is empty, it is removed. This allows to add lines that totally disappear when no data is available.\n"
 ));
 #endif
-	gtk_container_add(GTK_CONTAINER(scrolled), fullscreen_info_view);
-	gtk_widget_show(fullscreen_info_view);
+	gtk_container_add(GTK_CONTAINER(scrolled), image_overlay_template_view);
+	gtk_widget_show(image_overlay_template_view);
 
 	hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_BUTTON_GAP);
 
 	button = pref_button_new(NULL, NULL, _("Defaults"), FALSE,
-				 G_CALLBACK(fullscreen_info_default_cb), fullscreen_info_view);
+				 G_CALLBACK(fullscreen_info_default_cb), image_overlay_template_view);
 	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
 	gtk_widget_show(button);
 
-	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(fullscreen_info_view));
-	if (options->fullscreen.info) gtk_text_buffer_set_text(buffer, options->fullscreen.info, -1);
+	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(image_overlay_template_view));
+	if (options->image_overlay.common.template_string) gtk_text_buffer_set_text(buffer, options->image_overlay.common.template_string, -1);
 	g_signal_connect(G_OBJECT(buffer), "changed",
-			 G_CALLBACK(fullscreen_info_view_changed_cb), fullscreen_info_view);
+			 G_CALLBACK(image_overlay_template_view_changed_cb), image_overlay_template_view);
 
 	group = pref_group_new(vbox, FALSE, _("Delete"), GTK_ORIENTATION_VERTICAL);
 
--- a/src/rcfile.c	Mon Apr 21 19:42:58 2008 +0000
+++ b/src/rcfile.c	Mon Apr 21 20:01:22 2008 +0000
@@ -427,8 +427,11 @@
 	WRITE_BOOL(fullscreen.clean_flip);
 	WRITE_BOOL(fullscreen.disable_saver);
 	WRITE_BOOL(fullscreen.above);
-	WRITE_BOOL(fullscreen.show_info);
-	WRITE_CHAR(fullscreen.info);
+
+	WRITE_SUBTITLE("Image Overlay Options");
+	WRITE_BOOL(image_overlay.common.enabled);
+	WRITE_BOOL(image_overlay.common.show_at_startup);
+	WRITE_CHAR(image_overlay.common.template_string);
 
 	WRITE_SUBTITLE("Slideshow Options");
 
@@ -703,11 +706,13 @@
 		READ_BOOL(fullscreen.clean_flip);
 		READ_BOOL(fullscreen.disable_saver);
 		READ_BOOL(fullscreen.above);
-		READ_BOOL(fullscreen.show_info);
-		READ_CHAR(fullscreen.info);
+
+		/* image overlay */
+		READ_BOOL(image_overlay.common.enabled);
+		READ_BOOL(image_overlay.common.show_at_startup);
+		READ_CHAR(image_overlay.common.template_string);
 
 		/* slideshow options */
-
 		READ_INT_UNIT(slideshow.delay, SLIDESHOW_SUBSECOND_PRECISION);
 		READ_BOOL(slideshow.random);
 		READ_BOOL(slideshow.repeat);
--- a/src/typedefs.h	Mon Apr 21 19:42:58 2008 +0000
+++ b/src/typedefs.h	Mon Apr 21 20:01:22 2008 +0000
@@ -843,15 +843,22 @@
 	} slideshow;
 
 	/* fullscreen */
-	struct 	{
+	struct {
 		gint screen;
 		gint clean_flip;
 		gint disable_saver;
 		gint above;
-		gint show_info;
-		gchar *info;
 	} fullscreen;
 
+	/* image overlay */
+	struct {
+		struct {
+			gint enabled;
+			gint show_at_startup;
+			gchar *template_string;
+		} common;
+	} image_overlay;
+
 	/* layout */
 	struct {
 		gchar *order;