[gthumb] image_print: added some special code to the header and footer



commit 5f5d5566666ade4acfc6baa4ab7b8747ea8a7f6b
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat Feb 5 14:11:04 2011 +0100

    image_print: added some special code to the header and footer
    
    added some special codes to specify the current page, the total
    number of pages, the tottal number of files and the event name.

 extensions/image_print/actions.c                   |    1 +
 .../image_print/data/gthumb_image_print.schemas.in |   26 +++
 extensions/image_print/data/ui/print-layout.ui     |  205 +++++++++++++++++++-
 extensions/image_print/gth-image-print-job.c       |  184 ++++++++++++++++--
 extensions/image_print/gth-image-print-job.h       |    1 +
 extensions/image_print/preferences.h               |    4 +
 6 files changed, 405 insertions(+), 16 deletions(-)
---
diff --git a/extensions/image_print/actions.c b/extensions/image_print/actions.c
index 58fe34d..5bb3472 100644
--- a/extensions/image_print/actions.c
+++ b/extensions/image_print/actions.c
@@ -58,6 +58,7 @@ gth_browser_activate_action_file_print (GtkAction  *action,
 		print_job = gth_image_print_job_new (file_list,
 						     gth_browser_get_current_file (browser),
 						     current_image,
+						     g_file_info_get_display_name (gth_browser_get_location_data (browser)->info),
 						     &error);
 		if (print_job != NULL)
 			gth_image_print_job_run (print_job,
diff --git a/extensions/image_print/data/gthumb_image_print.schemas.in b/extensions/image_print/data/gthumb_image_print.schemas.in
index 5d9504e..ec5492c 100644
--- a/extensions/image_print/data/gthumb_image_print.schemas.in
+++ b/extensions/image_print/data/gthumb_image_print.schemas.in
@@ -54,6 +54,32 @@
       </schema>
 
       <schema>
+	<key>/schemas/apps/gthumb/ext/image_print/header</key>
+	<applyto>/apps/gthumb/ext/image_print/header</applyto>
+	<owner>gthumb</owner>
+	<type>string</type>
+	<default></default>
+	<locale name="C">
+	  <short></short>
+	  <long>
+	  </long>
+	</locale>
+      </schema>
+
+      <schema>
+	<key>/schemas/apps/gthumb/ext/image_print/footer</key>
+	<applyto>/apps/gthumb/ext/image_print/footer</applyto>
+	<owner>gthumb</owner>
+	<type>string</type>
+	<default></default>
+	<locale name="C">
+	  <short></short>
+	  <long>
+	  </long>
+	</locale>
+      </schema>
+
+      <schema>
 	<key>/schemas/apps/gthumb/ext/image_print/n_rows</key>
 	<applyto>/apps/gthumb/ext/image_print/n_rows</applyto>
 	<owner>gthumb</owner>
diff --git a/extensions/image_print/data/ui/print-layout.ui b/extensions/image_print/data/ui/print-layout.ui
index 4f59d29..3bde0c8 100644
--- a/extensions/image_print/data/ui/print-layout.ui
+++ b/extensions/image_print/data/ui/print-layout.ui
@@ -82,7 +82,7 @@
         <child>
           <object class="GtkTable" id="table3">
             <property name="visible">True</property>
-            <property name="n_rows">2</property>
+            <property name="n_rows">3</property>
             <property name="n_columns">2</property>
             <property name="column_spacing">6</property>
             <property name="row_spacing">6</property>
@@ -117,6 +117,10 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="invisible_char">&#x25CF;</property>
+                <property name="secondary_icon_stock">gtk-help</property>
+                <property name="secondary_icon_activatable">True</property>
+                <property name="secondary_icon_sensitive">True</property>
+                <property name="secondary_icon_tooltip_text">Help</property>
               </object>
               <packing>
                 <property name="left_attach">1</property>
@@ -128,6 +132,10 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="invisible_char">&#x25CF;</property>
+                <property name="secondary_icon_stock">gtk-help</property>
+                <property name="secondary_icon_activatable">True</property>
+                <property name="secondary_icon_sensitive">True</property>
+                <property name="secondary_icon_tooltip_text">Help</property>
               </object>
               <packing>
                 <property name="left_attach">1</property>
@@ -136,6 +144,201 @@
                 <property name="bottom_attach">2</property>
               </packing>
             </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <object class="GtkTable" id="page_footer_help_table">
+                <property name="n_rows">6</property>
+                <property name="n_columns">2</property>
+                <property name="column_spacing">12</property>
+                <property name="row_spacing">6</property>
+                <child>
+                  <object class="GtkLabel" id="label6">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="yalign">0.49000000953674316</property>
+                    <property name="label">%p</property>
+                    <attributes>
+                      <attribute name="size" value="8000"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label13">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label">%P</property>
+                    <attributes>
+                      <attribute name="size" value="8000"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label14">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">The current page number</property>
+                    <attributes>
+                      <attribute name="size" value="8000"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label15">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">The total number of pages</property>
+                    <attributes>
+                      <attribute name="size" value="8000"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label16">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Special code</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                      <attribute name="size" value="8000"/>
+                    </attributes>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label17">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Description</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                      <attribute name="size" value="8000"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label18">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes" comments="translate only the text in the curly brackets">%D{ format }</property>
+                    <attributes>
+                      <attribute name="size" value="8000"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="top_attach">3</property>
+                    <property name="bottom_attach">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label20">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">The current date</property>
+                    <attributes>
+                      <attribute name="size" value="8000"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">3</property>
+                    <property name="bottom_attach">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label21">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label">%F</property>
+                    <attributes>
+                      <attribute name="size" value="8000"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="top_attach">4</property>
+                    <property name="bottom_attach">5</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label22">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label">%E</property>
+                    <attributes>
+                      <attribute name="size" value="8000"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="top_attach">5</property>
+                    <property name="bottom_attach">6</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label23">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">The total number of files</property>
+                    <attributes>
+                      <attribute name="size" value="8000"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">4</property>
+                    <property name="bottom_attach">5</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label24">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">The event description</property>
+                    <attributes>
+                      <attribute name="size" value="8000"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">5</property>
+                    <property name="bottom_attach">6</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">False</property>
diff --git a/extensions/image_print/gth-image-print-job.c b/extensions/image_print/gth-image-print-job.c
index 5e9912a..676104e 100644
--- a/extensions/image_print/gth-image-print-job.c
+++ b/extensions/image_print/gth-image-print-job.c
@@ -43,6 +43,7 @@ struct _GthImagePrintJobPrivate {
 	GtkBuilder         *builder;
 	GtkWidget          *caption_chooser;
 	GthImageInfo       *selected;
+	char               *event_name;
 
 	gulong              rotation_combobox_changed_event;
 	gulong              scale_adjustment_value_changed_event;
@@ -68,6 +69,8 @@ struct _GthImagePrintJobPrivate {
 	char               *footer_font_name;
 	double              scale_factor;
 	int                 dpi;
+	char               *header_template;
+	char               *footer_template;
 	char               *header;
 	char               *footer;
 
@@ -82,6 +85,7 @@ struct _GthImagePrintJobPrivate {
 	GthRectangle        footer_rectangle;
 	int                 n_pages;
 	int                 current_page;
+	gboolean            printing;
 };
 
 
@@ -94,14 +98,21 @@ gth_image_print_job_finalize (GObject *base)
 	self = GTH_IMAGE_PRINT_JOB (base);
 
 	_g_object_unref (self->priv->task);
-	_g_object_unref (self->priv->print_operation);
-	_g_object_unref (self->priv->builder);
+	g_free (self->priv->footer);
+	g_free (self->priv->header);
+	g_free (self->priv->footer_template);
+	g_free (self->priv->header_template);
+	g_free (self->priv->footer_font_name);
+	g_free (self->priv->header_font_name);
+	g_free (self->priv->caption_font_name);
+	g_free (self->priv->caption_attributes);
+	_g_object_unref (self->priv->page_setup);
 	for (i = 0; i < self->priv->n_images; i++)
 		gth_image_info_unref (self->priv->images[i]);
 	g_free (self->priv->images);
-	_g_object_unref (self->priv->page_setup);
-	g_free (self->priv->caption_attributes);
-	g_free (self->priv->caption_font_name);
+	_g_object_unref (self->priv->print_operation);
+	_g_object_unref (self->priv->builder);
+	g_free (self->priv->event_name);
 
 	G_OBJECT_CLASS (parent_class)->finalize (base);
 }
@@ -124,6 +135,7 @@ static void
 gth_image_print_job_init (GthImagePrintJob *self)
 {
 	self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTH_TYPE_IMAGE_PRINT_JOB, GthImagePrintJobPrivate);
+	self->priv->event_name = NULL;
 	self->priv->builder = NULL;
 	self->priv->task = NULL;
 	self->priv->page_setup = NULL;
@@ -138,6 +150,11 @@ gth_image_print_job_init (GthImagePrintJob *self)
 	self->priv->unit = eel_gconf_get_enum (PREF_IMAGE_PRINT_UNIT, GTH_TYPE_METRIC, GTH_METRIC_PIXELS);
 	self->priv->header_rectangle.height = 0;
 	self->priv->footer_rectangle.height = 0;
+	self->priv->header_template = eel_gconf_get_string (PREF_IMAGE_PRINT_HEADER, DEFAULT_HEADER);
+	self->priv->footer_template = eel_gconf_get_string (PREF_IMAGE_PRINT_FOOTER, DEFAULT_FOOTER);
+	self->priv->header = NULL;
+	self->priv->footer = NULL;
+	self->priv->printing = FALSE;
 }
 
 
@@ -223,6 +240,97 @@ gth_image_print_job_set_font_options (GthImagePrintJob *self,
 }
 
 
+static gboolean
+template_eval_cb (const GMatchInfo *match_info,
+		  GString          *result,
+		  gpointer          user_data)
+{
+	GthImagePrintJob *self = user_data;
+	char             *r = NULL;
+	char             *match;
+
+	match = g_match_info_fetch (match_info, 0);
+	if (strcmp (match, "%p") == 0) {
+		r = g_strdup_printf ("%d", self->priv->current_page + 1);
+	}
+	else if (strcmp (match, "%P") == 0) {
+		r = g_strdup_printf ("%d", self->priv->n_pages);
+	}
+	else if (strcmp (match, "%F") == 0) {
+		r = g_strdup_printf ("%d", self->priv->n_images);
+	}
+	else if (strncmp (match, "%D", 2) == 0) {
+		GTimeVal   timeval;
+		GRegex    *re;
+		char     **a;
+		char      *format = NULL;
+
+		g_get_current_time (&timeval);
+
+		/* Get the date format */
+
+		re = g_regex_new ("%[A-Z]\\{([^}]+)\\}", 0, 0, NULL);
+		a = g_regex_split (re, match, 0);
+		if (g_strv_length (a) >= 2)
+			format = g_strstrip (a[1]);
+		r = _g_time_val_strftime (&timeval, format);
+
+		g_strfreev (a);
+		g_regex_unref (re);
+	}
+	else if (strcmp (match, "%E") == 0) {
+		if (self->priv->event_name != NULL)
+			r = g_strdup (self->priv->event_name);
+		else
+			r = g_strdup ("");
+	}
+
+	if (r != NULL)
+		g_string_append (result, r);
+
+	g_free (r);
+	g_free (match);
+
+	return FALSE;
+}
+
+
+static char *
+get_text_from_template (GthImagePrintJob *self,
+			const char       *text)
+{
+	GRegex *re;
+	char   *new_text;
+
+	if (text == NULL)
+		return NULL;
+
+	if (g_utf8_strchr (text,  -1, '%') == NULL)
+		return g_strdup (text);
+
+	re = g_regex_new ("%[DEFPp](\\{[^}]+\\})?", 0, 0, NULL);
+	new_text = g_regex_replace_eval (re, text, -1, 0, 0, template_eval_cb, self, NULL);
+	g_regex_unref (re);
+
+	return new_text;
+}
+
+
+static void
+update_header_and_footer_texts (GthImagePrintJob *self)
+{
+	g_free (self->priv->header);
+	self->priv->header = NULL;
+	if ((self->priv->header_template != NULL) && (g_strcmp0 (self->priv->header_template, "") != 0))
+		self->priv->header = get_text_from_template (self, self->priv->header_template);
+
+	g_free (self->priv->footer);
+	self->priv->footer = NULL;
+	if ((self->priv->footer_template != NULL) && (g_strcmp0 (self->priv->footer_template, "") != 0))
+		self->priv->footer = get_text_from_template (self, self->priv->footer_template);
+}
+
+
 static void
 gth_image_print_job_update_layout_info (GthImagePrintJob   *self,
 				        gdouble             page_width,
@@ -243,6 +351,8 @@ gth_image_print_job_update_layout_info (GthImagePrintJob   *self,
 	self->priv->x_padding = page_width / 40.0;
 	self->priv->y_padding = page_height / 40.0;
 
+	/* header */
+
 	gth_image_print_job_set_font_options (self, pango_layout, self->priv->header_font_name, preview);
 	height = get_text_height (self, pango_layout, self->priv->header, page_width);
 	if (height != self->priv->header_rectangle.height)
@@ -252,7 +362,9 @@ gth_image_print_job_update_layout_info (GthImagePrintJob   *self,
 	self->priv->header_rectangle.x = 0.0;
 	self->priv->header_rectangle.width = page_width;
 
-	gth_image_print_job_set_font_options (self, pango_layout, self->priv->header_font_name, preview);
+	/* footer */
+
+	gth_image_print_job_set_font_options (self, pango_layout, self->priv->footer_font_name, preview);
 	height = get_text_height (self, pango_layout, self->priv->footer, page_width);
 	if (height != self->priv->footer_rectangle.height)
 		height_changed = TRUE;
@@ -261,7 +373,9 @@ gth_image_print_job_update_layout_info (GthImagePrintJob   *self,
 	self->priv->footer_rectangle.x = 0.0;
 	self->priv->footer_rectangle.width = page_width;
 
-	if (height_changed) {
+	/* images */
+
+	if (! self->priv->printing && height_changed) {
 		for (i = 0; i < self->priv->n_images; i++)
 			gth_image_info_reset (self->priv->images[i]);
 	}
@@ -476,6 +590,8 @@ gth_image_print_job_update_layout (GthImagePrintJob   *self,
 {
 	PangoLayout *pango_layout;
 
+	update_header_and_footer_texts (self);
+
 	pango_layout = gtk_widget_create_pango_layout (GTK_WIDGET (self->priv->browser), NULL);
 	gth_image_print_job_update_layout_info (self,
 						page_width,
@@ -1204,10 +1320,10 @@ header_entry_changed_cb (GtkEditable *editable,
 {
 	GthImagePrintJob *self = user_data;
 
-	_g_strset (&self->priv->header, gtk_entry_get_text (GTK_ENTRY (editable)));
-	if (g_strcmp0 (self->priv->header, "") == 0) {
-		g_free (self->priv->header);
-		self->priv->header = NULL;
+	_g_strset (&self->priv->header_template, gtk_entry_get_text (GTK_ENTRY (editable)));
+	if (g_strcmp0 (self->priv->header_template, "") == 0) {
+		g_free (self->priv->header_template);
+		self->priv->header_template = NULL;
 	}
 
 	gth_image_print_job_update_preview (self);
@@ -1220,10 +1336,10 @@ footer_entry_changed_cb (GtkEditable *editable,
 {
 	GthImagePrintJob *self = user_data;
 
-	_g_strset (&self->priv->footer, gtk_entry_get_text (GTK_ENTRY (editable)));
-	if (g_strcmp0 (self->priv->footer, "") == 0) {
-		g_free (self->priv->footer);
-		self->priv->footer = NULL;
+	_g_strset (&self->priv->footer_template, gtk_entry_get_text (GTK_ENTRY (editable)));
+	if (g_strcmp0 (self->priv->footer_template, "") == 0) {
+		g_free (self->priv->footer_template);
+		self->priv->footer_template = NULL;
 	}
 
 	gth_image_print_job_update_preview (self);
@@ -1231,6 +1347,23 @@ footer_entry_changed_cb (GtkEditable *editable,
 
 
 static void
+header_or_footer_icon_press_cb (GtkEntry            *entry,
+				GtkEntryIconPosition icon_pos,
+				GdkEvent            *event,
+				gpointer             user_data)
+{
+	GthImagePrintJob *self = user_data;
+	GtkWidget        *help_table;
+
+	help_table = GET_WIDGET ("page_footer_help_table");
+	if (gtk_widget_get_visible (help_table))
+		gtk_widget_hide (help_table);
+	else
+		gtk_widget_show (help_table);
+}
+
+
+static void
 rotation_combobox_changed_cb (GtkComboBox *combo_box,
 			      gpointer     user_data)
 {
@@ -1437,6 +1570,14 @@ operation_create_custom_widget_cb (GtkPrintOperation *operation,
 			  "changed",
 	                  G_CALLBACK (footer_entry_changed_cb),
 	                  self);
+	g_signal_connect (GET_WIDGET ("header_entry"),
+			  "icon-press",
+	                  G_CALLBACK (header_or_footer_icon_press_cb),
+	                  self);
+	g_signal_connect (GET_WIDGET ("footer_entry"),
+			  "icon-press",
+	                  G_CALLBACK (header_or_footer_icon_press_cb),
+	                  self);
 
 	self->priv->rotation_combobox_changed_event =
 			g_signal_connect (GET_WIDGET ("rotation_combobox"),
@@ -1514,6 +1655,9 @@ operation_update_custom_widget_cb (GtkPrintOperation *operation,
 	gtk_widget_set_size_request (GET_WIDGET ("preview_drawingarea"),
 				     gtk_page_setup_get_paper_width (setup, GTK_UNIT_MM),
 				     gtk_page_setup_get_paper_height (setup, GTK_UNIT_MM));
+	gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("header_entry")), self->priv->header_template);
+	gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("footer_entry")), self->priv->footer_template);
+
 	for (i = 0; i < self->priv->n_images; i++)
 		gth_image_info_reset (self->priv->images[i]);
 	gth_image_print_job_update_preview (self);
@@ -1530,6 +1674,8 @@ operation_custom_widget_apply_cb (GtkPrintOperation *operation,
 	eel_gconf_set_integer (PREF_IMAGE_PRINT_N_ROWS, self->priv->n_rows);
 	eel_gconf_set_integer (PREF_IMAGE_PRINT_N_COLUMNS, self->priv->n_columns);
 	eel_gconf_set_enum (PREF_IMAGE_PRINT_UNIT, GTH_TYPE_METRIC, gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("unit_combobox"))));
+	eel_gconf_set_string (PREF_IMAGE_PRINT_HEADER, gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("header_entry"))));
+	eel_gconf_set_string (PREF_IMAGE_PRINT_FOOTER, gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("footer_entry"))));
 }
 
 
@@ -1555,6 +1701,8 @@ print_operation_begin_print_cb (GtkPrintOperation *operation,
 	gtk_page_setup_to_file (self->priv->page_setup, filename, NULL);
 	g_free (filename);
 
+	self->priv->printing = TRUE;
+
 	pango_layout = gtk_print_context_create_pango_layout (context);
 	gth_image_print_job_update_layout_info (self,
 						gtk_print_context_get_width (context),
@@ -1583,6 +1731,9 @@ print_operation_draw_page_cb (GtkPrintOperation *operation,
 	pango_layout = gtk_print_context_create_pango_layout (context);
 	setup = gtk_print_context_get_page_setup (context);
 
+	self->priv->current_page = page_nr;
+	update_header_and_footer_texts (self);
+
 	gth_image_print_job_update_page_layout (self,
 						page_nr,
 						gtk_print_context_get_width (context),
@@ -1634,6 +1785,7 @@ GthImagePrintJob *
 gth_image_print_job_new (GList        *file_data_list,
 			 GthFileData  *current,
 			 GdkPixbuf    *current_image,
+			 const char   *event_name,
 			 GError      **error)
 {
 	GthImagePrintJob *self;
@@ -1659,6 +1811,8 @@ gth_image_print_job_new (GList        *file_data_list,
 	}
 	self->priv->images[n] = NULL;
 	self->priv->n_images = n;
+	self->priv->event_name = g_strdup (event_name);
+
 	self->priv->image_width = 0;
 	self->priv->image_height = 0;
 
diff --git a/extensions/image_print/gth-image-print-job.h b/extensions/image_print/gth-image-print-job.h
index 2ad7ebc..4dce857 100644
--- a/extensions/image_print/gth-image-print-job.h
+++ b/extensions/image_print/gth-image-print-job.h
@@ -51,6 +51,7 @@ GType              gth_image_print_job_get_type (void);
 GthImagePrintJob * gth_image_print_job_new      (GList                    *file_data_list,
 						 GthFileData              *current,
 						 GdkPixbuf                *current_image,
+						 const char               *event_name,
 						 GError                  **error);
 void               gth_image_print_job_run      (GthImagePrintJob         *self,
 						 GtkPrintOperationAction   action,
diff --git a/extensions/image_print/preferences.h b/extensions/image_print/preferences.h
index f18234e..0db5bf1 100644
--- a/extensions/image_print/preferences.h
+++ b/extensions/image_print/preferences.h
@@ -30,6 +30,8 @@ G_BEGIN_DECLS
 #define PREF_IMAGE_PRINT_FONT_NAME         "/apps/gthumb/ext/image_print/font_name"
 #define PREF_IMAGE_PRINT_HEADER_FONT_NAME  "/apps/gthumb/ext/image_print/header_font_name"
 #define PREF_IMAGE_PRINT_FOOTER_FONT_NAME  "/apps/gthumb/ext/image_print/footer_font_name"
+#define PREF_IMAGE_PRINT_HEADER            "/apps/gthumb/ext/image_print/header"
+#define PREF_IMAGE_PRINT_FOOTER            "/apps/gthumb/ext/image_print/footer"
 #define PREF_IMAGE_PRINT_N_ROWS            "/apps/gthumb/ext/image_print/n_rows"
 #define PREF_IMAGE_PRINT_N_COLUMNS         "/apps/gthumb/ext/image_print/n_columns"
 #define PREF_IMAGE_PRINT_UNIT              "/apps/gthumb/ext/image_print/unit"
@@ -37,6 +39,8 @@ G_BEGIN_DECLS
 #define DEFAULT_CAPTION_FONT_NAME "sans normal 10"
 #define DEFAULT_HEADER_FONT_NAME  "sans bold 12"
 #define DEFAULT_FOOTER_FONT_NAME  "sans normal 8"
+#define DEFAULT_HEADER            ""
+#define DEFAULT_FOOTER            ""
 
 void ip__dlg_preferences_construct_cb (GtkWidget  *dialog,
 				       GthBrowser *browser,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]