diff src/preferences.c @ 733:57f759d012c7

Modify set_default_image_overlay_template_string() to accept the pointer to the string to modify and add a generic function to set template_string value.
author zas_
date Thu, 22 May 2008 10:09:07 +0000
parents 2d8a8e892b5e
children a7289f9e8d29
line wrap: on
line diff
--- a/src/preferences.c	Thu May 22 09:22:29 2008 +0000
+++ b/src/preferences.c	Thu May 22 10:09:07 2008 +0000
@@ -283,11 +283,9 @@
 	options->fullscreen.above = c_options->fullscreen.above;
 	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->image_overlay.common.template_string);
-		options->image_overlay.common.template_string = g_strdup(c_options->image_overlay.common.template_string);
-		}
-
+		set_image_overlay_template_string(&options->image_overlay.common.template_string,
+						  c_options->image_overlay.common.template_string);
+		
 	options->update_on_time_change = c_options->update_on_time_change;
 	options->image.exif_rotate_enable = c_options->image.exif_rotate_enable;
 
@@ -825,8 +823,8 @@
 	gtk_text_buffer_get_start_iter(pTextBuffer, &iStart);
 	gtk_text_buffer_get_end_iter(pTextBuffer, &iEnd);
 
-	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);
+	set_image_overlay_template_string(&c_options->image_overlay.common.template_string,
+					  gtk_text_buffer_get_text(pTextBuffer, &iStart, &iEnd, TRUE));
 }
 
 static void image_overlay_default_template_ok_cb(GenericDialog *gd, gpointer data)
@@ -834,7 +832,7 @@
 	GtkTextView *text_view = data;
 	GtkTextBuffer *buffer;
 
-	set_default_image_overlay_template_string(options);
+	set_default_image_overlay_template_string(&options->image_overlay.common.template_string);
 	if (!configwindow) return;
 
 	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_view));