[gthumb/ext: 11/20] [image_print] load the selected metadata
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gthumb/ext: 11/20] [image_print] load the selected metadata
- Date: Wed, 25 Nov 2009 17:13:45 +0000 (UTC)
commit b1cbb5e652b5ce9c82e4265336763362794bb680
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Nov 22 23:32:27 2009 +0100
[image_print] load the selected metadata
.../comments/gth-metadata-provider-comment.c | 2 +-
extensions/exiv2/gth-metadata-provider-exiv2.c | 2 +-
extensions/image_print/Makefile.am | 1 +
extensions/image_print/data/Makefile.am | 15 +
.../image_print/data/gthumb_image_print.schemas.in | 18 +
extensions/image_print/data/ui/print-layout.ui | 429 +++++++++++---------
extensions/image_print/gth-image-print-job.c | 46 ++-
extensions/image_print/gth-load-image-info-task.c | 57 +++-
extensions/image_print/gth-load-image-info-task.h | 3 +-
extensions/image_print/preferences.h | 34 ++
gthumb/glib-utils.c | 28 +-
gthumb/gth-main-default-metadata.c | 4 +-
12 files changed, 413 insertions(+), 226 deletions(-)
---
diff --git a/extensions/comments/gth-metadata-provider-comment.c b/extensions/comments/gth-metadata-provider-comment.c
index 42e6af0..18b2154 100644
--- a/extensions/comments/gth-metadata-provider-comment.c
+++ b/extensions/comments/gth-metadata-provider-comment.c
@@ -214,7 +214,7 @@ gth_metadata_provider_constructor (GType type,
obj = parent_class->constructor (type, n_construct_properties, construct_properties);
self = GTH_METADATA_PROVIDER (obj);
- g_object_set (self, "readable-attributes", "comment::*", NULL);
+ g_object_set (self, "readable-attributes", "comment::*,Embedded::Image::*", NULL);
g_object_set (self, "writable-attributes", "comment::*,Embedded::Image::*", NULL);
return obj;
diff --git a/extensions/exiv2/gth-metadata-provider-exiv2.c b/extensions/exiv2/gth-metadata-provider-exiv2.c
index 1e749cc..b65c44c 100644
--- a/extensions/exiv2/gth-metadata-provider-exiv2.c
+++ b/extensions/exiv2/gth-metadata-provider-exiv2.c
@@ -188,7 +188,7 @@ gth_metadata_provider_constructor (GType type,
obj = parent_class->constructor (type, n_construct_properties, construct_properties);
self = GTH_METADATA_PROVIDER (obj);
- g_object_set (self, "readable-attributes", "Exif::*,Xmp::*,Iptc::*", NULL);
+ g_object_set (self, "readable-attributes", "Exif::*,Xmp::*,Iptc::*,Embedded::Image::*", NULL);
g_object_set (self, "writable-attributes", "Exif::*,Xmp::*,Iptc::*,Embedded::Image::*", NULL);
return obj;
diff --git a/extensions/image_print/Makefile.am b/extensions/image_print/Makefile.am
index 39641c1..d8d4f85 100644
--- a/extensions/image_print/Makefile.am
+++ b/extensions/image_print/Makefile.am
@@ -14,6 +14,7 @@ libimage_print_la_SOURCES = \
gth-image-print-job.h \
gth-load-image-info-task.c \
gth-load-image-info-task.h \
+ preferences.h \
main.c
libimage_print_la_CPPFLAGS = $(GTHUMB_CFLAGS) $(DISABLE_DEPRECATED) $(WARNINGS) -I$(top_srcdir) -I$(top_builddir)/gthumb
diff --git a/extensions/image_print/data/Makefile.am b/extensions/image_print/data/Makefile.am
index c1713cf..d207b33 100644
--- a/extensions/image_print/data/Makefile.am
+++ b/extensions/image_print/data/Makefile.am
@@ -1,3 +1,18 @@
SUBDIRS = ui
+schemadir = @GCONF_SCHEMA_FILE_DIR@
+schema_in_files = gthumb_image_print.schemas.in
+schema_DATA = $(schema_in_files:.schemas.in=.schemas)
+
+ INTLTOOL_SCHEMAS_RULE@
+
+if GCONF_SCHEMAS_INSTALL
+install-data-local:
+ GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(top_builddir)/extensions/image_print/data/$(schema_DATA)
+endif
+
+EXTRA_DIST = $(schema_in_files)
+
+CLEANFILES = $(schema_DATA)
+
-include $(top_srcdir)/git.mk
diff --git a/extensions/image_print/data/gthumb_image_print.schemas.in b/extensions/image_print/data/gthumb_image_print.schemas.in
new file mode 100644
index 0000000..a9027a8
--- /dev/null
+++ b/extensions/image_print/data/gthumb_image_print.schemas.in
@@ -0,0 +1,18 @@
+<gconfschemafile>
+ <schemalist>
+
+ <schema>
+ <key>/schemas/apps/gthumb/ext/image_print/caption</key>
+ <applyto>/apps/gthumb/ext/image_print/caption</applyto>
+ <owner>gthumb</owner>
+ <type>string</type>
+ <default></default>
+ <locale name="C">
+ <short></short>
+ <long>
+ </long>
+ </locale>
+ </schema>
+
+ </schemalist>
+</gconfschemafile>
diff --git a/extensions/image_print/data/ui/print-layout.ui b/extensions/image_print/data/ui/print-layout.ui
index e18d34f..d178622 100644
--- a/extensions/image_print/data/ui/print-layout.ui
+++ b/extensions/image_print/data/ui/print-layout.ui
@@ -2,7 +2,6 @@
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
- <object class="GtkListStore" id="caption_liststore"/>
<object class="GtkListStore" id="unit_liststore">
<columns>
<!-- column-name Name -->
@@ -29,20 +28,28 @@
</columns>
<data>
<row>
- <col id="0" translatable="yes">Custom position</col>
+ <col id="0" translatable="yes">Centered</col>
<col id="1">0</col>
</row>
<row>
- <col id="0" translatable="yes">Aligned to left</col>
+ <col id="0" translatable="yes">Custom</col>
<col id="1">1</col>
</row>
<row>
- <col id="0" translatable="yes">Aligned to right</col>
+ <col id="0" translatable="yes">Top</col>
<col id="1">2</col>
</row>
<row>
- <col id="0" translatable="yes">Centered</col>
- <col id="1">0</col>
+ <col id="0" translatable="yes">Bottom</col>
+ <col id="1">3</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Left</col>
+ <col id="1">4</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Right</col>
+ <col id="1">5</col>
</row>
</data>
</object>
@@ -157,7 +164,7 @@
<child>
<object class="GtkScrolledWindow" id="caption_scrolledwindow">
<property name="width_request">300</property>
- <property name="height_request">150</property>
+ <property name="height_request">190</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">automatic</property>
@@ -178,7 +185,8 @@
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Font:</property>
+ <property name="label" translatable="yes">_Font:</property>
+ <property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -216,13 +224,14 @@
</child>
<child>
<object class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Image size</property>
+ <property name="label" translatable="yes">Image</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@@ -241,89 +250,117 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
- <object class="GtkTable" id="img_size_manual_table1">
+ <object class="GtkTable" id="table2">
<property name="visible">True</property>
<property name="n_rows">2</property>
- <property name="n_columns">3</property>
- <property name="column_spacing">5</property>
- <property name="row_spacing">5</property>
+ <property name="n_columns">4</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">6</property>
<child>
- <object class="GtkLabel" id="label12">
+ <object class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">_Width:</property>
+ <property name="label" translatable="yes">_Position:</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="label13">
+ <object class="GtkLabel" id="label15">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">_Height:</property>
+ <property name="label" translatable="yes">_Scale:</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="img_width_spinbutton3">
+ <object class="GtkComboBox" id="combobox2">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="climb_rate">1</property>
- <property name="digits">1</property>
+ <property name="model">align_liststore</property>
+ <property name="active">0</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext3"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="img_height_spinbutton3">
+ <object class="GtkHBox" id="scale_image_box2">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="climb_rate">1</property>
- <property name="digits">1</property>
+ <child>
+ <object class="GtkHScale" id="image_scale2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">scale_adjustment</property>
+ <property name="digits">0</property>
+ <property name="value_pos">right</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label14">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">%</property>
+ <property name="justify">center</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
</packing>
</child>
<child>
- <object class="GtkComboBox" id="combobox1">
+ <object class="GtkComboBox" id="rotation_combobox">
<property name="visible">True</property>
- <property name="model">unit_liststore</property>
+ <property name="model">rotation_liststore</property>
<property name="active">0</property>
<child>
- <object class="GtkCellRendererText" id="cellrenderertext1"/>
+ <object class="GtkCellRendererText" id="cellrenderertext2"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
</packing>
</child>
<child>
- <placeholder/>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Rotation:</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
</child>
</object>
<packing>
@@ -333,61 +370,156 @@
<child>
<object class="GtkAlignment" id="alignment4">
<property name="visible">True</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <child>
+ <object class="GtkHSeparator" id="hseparator1">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="alignment3">
+ <property name="visible">True</property>
<child>
- <object class="GtkTable" id="img_size_manual_box1">
+ <object class="GtkTable" id="table1">
<property name="visible">True</property>
- <property name="n_columns">3</property>
- <property name="column_spacing">5</property>
- <property name="row_spacing">5</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">5</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">6</property>
<child>
- <object class="GtkHBox" id="scale_image_box2">
+ <object class="GtkLabel" id="label12">
<property name="visible">True</property>
- <child>
- <object class="GtkHScale" id="image_scale2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="adjustment">scale_adjustment</property>
- <property name="digits">0</property>
- <property name="value_pos">right</property>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label14">
- <property name="visible">True</property>
- <property name="label" translatable="yes">%</property>
- <property name="justify">center</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Width:</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="img_width_spinbutton3">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">1</property>
</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="label13">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Height:</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
<property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="img_height_spinbutton3">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Left:</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="img_width_spinbutton1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="label15">
+ <object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">_Scale:</property>
+ <property name="label" translatable="yes">_Top:</property>
<property name="use_underline">True</property>
</object>
<packing>
- <property name="x_options">GTK_FILL</property>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="img_height_spinbutton1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="combobox1">
+ <property name="visible">True</property>
+ <property name="model">unit_liststore</property>
+ <property name="active">0</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext1"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
</object>
</child>
</object>
<packing>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
@@ -403,131 +535,6 @@
<property name="position">2</property>
</packing>
</child>
- <child>
- <object class="GtkVBox" id="vbox1">
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Image position</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="alignment3">
- <property name="visible">True</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkVBox" id="vbox5">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkComboBox" id="combobox2">
- <property name="visible">True</property>
- <property name="model">align_liststore</property>
- <property name="active">3</property>
- <child>
- <object class="GtkCellRendererText" id="cellrenderertext3"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkTable" id="img_size_manual_table">
- <property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">5</property>
- <property name="row_spacing">5</property>
- <child>
- <object class="GtkSpinButton" id="img_height_spinbutton1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="climb_rate">1</property>
- <property name="digits">1</property>
- </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>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Top:</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="img_width_spinbutton1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="climb_rate">1</property>
- <property name="digits">1</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Left:</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">3</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">False</property>
@@ -667,4 +674,30 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
+ <object class="GtkListStore" id="rotation_liststore">
+ <columns>
+ <!-- column-name gchararray1 -->
+ <column type="gchararray"/>
+ <!-- column-name gint1 -->
+ <column type="gint"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">0°</col>
+ <col id="1">0</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">90°</col>
+ <col id="1">90</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">180°</col>
+ <col id="1">180</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">270°</col>
+ <col id="1">270</col>
+ </row>
+ </data>
+ </object>
</interface>
diff --git a/extensions/image_print/gth-image-print-job.c b/extensions/image_print/gth-image-print-job.c
index efc3e9c..19ed25e 100644
--- a/extensions/image_print/gth-image-print-job.c
+++ b/extensions/image_print/gth-image-print-job.c
@@ -28,10 +28,11 @@
#include "gth-image-info.h"
#include "gth-image-print-job.h"
#include "gth-load-image-info-task.h"
+#include "preferences.h"
#define GET_WIDGET(name) _gtk_builder_get_widget (self->priv->builder, (name))
-#define DEFAULT_PADDING 20.0
+#define PREVIEW_SCALE_FACTOR 3.0 /* FIXME: why 3.0 ? */
enum {
@@ -54,6 +55,7 @@ struct _GthImagePrintJobPrivate {
GtkPrintOperation *print_operation;
GtkBuilder *builder;
GtkWidget *caption_chooser;
+ GthImageInfo *selected;
/* settings */
@@ -121,7 +123,8 @@ gth_image_print_job_init (GthImagePrintJob *self)
self->priv->task = NULL;
self->priv->page_setup = NULL;
self->priv->current_page = 0;
- self->priv->caption_attributes = g_strdup (""); /* FIXME: load from a gconf key */
+ self->priv->caption_attributes = eel_gconf_get_string (PREF_IMAGE_PRINT_CAPTION, "");
+ self->priv->selected = NULL;
}
@@ -317,7 +320,11 @@ gth_image_print_job_update_page_layout (GthImagePrintJob *self,
if (image_info->page != page)
continue;
+ if (self->priv->selected == NULL)
+ self->priv->selected = image_info;
+
gth_image_info_rotate (image_info, (360 - image_info->rotation) % 360);
+ /*
if (((self->priv->max_image_width > self->priv->max_image_height)
&& (image_info->pixbuf_width < image_info->pixbuf_height))
|| ((self->priv->max_image_width < self->priv->max_image_height)
@@ -325,6 +332,7 @@ gth_image_print_job_update_page_layout (GthImagePrintJob *self,
{
gth_image_info_rotate (image_info, 270);
}
+ */
image_info->zoom = 1.0;
image_info->boundary.x = (image_info->col - 1) * (self->priv->max_image_width + self->priv->x_padding);
@@ -403,9 +411,6 @@ gth_image_print_job_update_page_layout (GthImagePrintJob *self,
}
-#define PREVIEW_SCALE_FACTOR 3.0 /* FIXME: why 3.0 ? */
-
-
static void
gth_image_print_job_update_layout (GthImagePrintJob *self,
gdouble page_width,
@@ -446,7 +451,10 @@ gth_image_print_job_paint (GthImagePrintJob *self,
cairo_save (cr);
cairo_set_line_width (cr, 0.5);
- cairo_set_source_rgb (cr, .5, .5, .5);
+ if (image_info == self->priv->selected)
+ cairo_set_source_rgb (cr, 1.0, .0, .0);
+ else
+ cairo_set_source_rgb (cr, .5, .5, .5);
cairo_rectangle (cr,
x_offset + image_info->boundary.x,
y_offset + image_info->boundary.y,
@@ -641,6 +649,19 @@ gth_image_print_job_update_status (GthImagePrintJob *self)
static void
+gth_image_print_job_update_image_controls (GthImagePrintJob *self)
+{
+ int idx;
+
+ if (self->priv->selected == NULL)
+ return;
+
+ idx = self->priv->selected->rotation / 90;
+ gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("rotation_combobox")), idx);
+}
+
+
+static void
gth_image_print_job_update_preview (GthImagePrintJob *self)
{
char *text;
@@ -652,9 +673,10 @@ gth_image_print_job_update_preview (GthImagePrintJob *self)
gtk_page_setup_get_orientation (self->priv->page_setup));
gtk_widget_queue_draw (GET_WIDGET ("preview_drawingarea"));
+ gth_image_print_job_update_image_controls (self);
+
text = g_strdup_printf (_("Page %d of %d"), self->priv->current_page + 1, self->priv->n_pages);
gtk_label_set_text (GTK_LABEL (GET_WIDGET ("page_label")), text);
-
gtk_widget_set_sensitive (GET_WIDGET ("next_page_button"), self->priv->current_page < self->priv->n_pages - 1);
gtk_widget_set_sensitive (GET_WIDGET ("prev_page_button"), self->priv->current_page > 0);
@@ -714,6 +736,7 @@ next_page_button_clicked_cb (GtkWidget *widget,
GthImagePrintJob *self = user_data;
self->priv->current_page = MIN (self->priv->current_page + 1, self->priv->n_pages - 1);
+ self->priv->selected = NULL;
gth_image_print_job_update_preview (self);
}
@@ -725,6 +748,7 @@ prev_page_button_clicked_cb (GtkWidget *widget,
GthImagePrintJob *self = user_data;
self->priv->current_page = MAX (0, self->priv->current_page - 1);
+ self->priv->selected = NULL;
gth_image_print_job_update_preview (self);
}
@@ -773,6 +797,7 @@ caption_chooser_changed_cb (GthMetadataChooser *chooser,
reload_required = attribute_list_reaload_required (self->priv->caption_attributes, new_caption_attributes);
g_free (self->priv->caption_attributes);
self->priv->caption_attributes = new_caption_attributes;
+ eel_gconf_set_string (PREF_IMAGE_PRINT_CAPTION, self->priv->caption_attributes);
if (reload_required)
gth_image_print_job_load_metadata (self);
@@ -792,6 +817,8 @@ operation_create_custom_widget_cb (GtkPrintOperation *operation,
gtk_widget_show (self->priv->caption_chooser);
gtk_container_add (GTK_CONTAINER (GET_WIDGET ("caption_scrolledwindow")), self->priv->caption_chooser);
+ gth_metadata_chooser_set_selection (GTH_METADATA_CHOOSER (self->priv->caption_chooser), self->priv->caption_attributes);
+
g_signal_connect (GET_WIDGET ("preview_drawingarea"),
"expose_event",
G_CALLBACK (preview_expose_event_cb),
@@ -844,6 +871,7 @@ 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));
+
gth_image_print_job_update_preview (self);
}
@@ -1005,7 +1033,9 @@ gth_image_print_job_run (GthImagePrintJob *self,
self->priv->action = action;
self->priv->browser = browser;
- self->priv->task = gth_load_image_info_task_new (self->priv->images, self->priv->n_images);
+ self->priv->task = gth_load_image_info_task_new (self->priv->images,
+ self->priv->n_images,
+ self->priv->caption_attributes);
g_signal_connect (self->priv->task,
"completed",
G_CALLBACK (load_image_info_task_completed_cb),
diff --git a/extensions/image_print/gth-load-image-info-task.c b/extensions/image_print/gth-load-image-info-task.c
index 5ad21c9..efa1a4c 100644
--- a/extensions/image_print/gth-load-image-info-task.c
+++ b/extensions/image_print/gth-load-image-info-task.c
@@ -30,6 +30,7 @@ struct _GthLoadImageInfoTaskPrivate {
GthImageInfo **images;
int n_images;
int current;
+ char *attributes;
GthImageLoader *loader;
};
@@ -48,6 +49,7 @@ gth_load_image_info_task_finalize (GObject *object)
for (i = 0; i < self->priv->n_images; i++)
gth_image_info_unref (self->priv->images[i]);
g_free (self->priv->images);
+ g_free (self->priv->attributes);
g_object_unref (self->priv->loader);
G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -58,26 +60,52 @@ static void load_current_image (GthLoadImageInfoTask *self);
static void
+load_next_image (GthLoadImageInfoTask *self)
+{
+ self->priv->current++;
+ load_current_image (self);
+}
+
+
+static void
+metadata_ready_cb (GList *files,
+ GError *error,
+ gpointer user_data)
+{
+ GthLoadImageInfoTask *self = user_data;
+
+ if (error != NULL) {
+ gth_task_completed (GTH_TASK (self), error);
+ return;
+ }
+
+ load_next_image (self);
+}
+
+
+static void
image_loader_ready_cb (GthImageLoader *loader,
GError *error,
gpointer user_data)
{
GthLoadImageInfoTask *self = user_data;
+ GthImageInfo *image_info;
GdkPixbuf *pixbuf;
+ if (error == NULL)
+ g_cancellable_set_error_if_cancelled (gth_task_get_cancellable (GTH_TASK (self)), &error);
+
if (error != NULL) {
gth_task_completed (GTH_TASK (self), error);
return;
}
+ image_info = self->priv->images[self->priv->current];
pixbuf = gth_image_loader_get_pixbuf (loader);
if (pixbuf != NULL) {
- GthImageInfo *image_info;
- int thumb_w, thumb_h;
+ int thumb_w, thumb_h;
- image_info = self->priv->images[self->priv->current];
image_info->pixbuf = g_object_ref (pixbuf);
-
thumb_w = image_info->pixbuf_width = gdk_pixbuf_get_width (pixbuf);
thumb_h = image_info->pixbuf_height = gdk_pixbuf_get_height (pixbuf);
if (scale_keeping_ratio (&thumb_w, &thumb_h, THUMBNAIL_SIZE, THUMBNAIL_SIZE, FALSE))
@@ -94,8 +122,20 @@ image_loader_ready_cb (GthImageLoader *loader,
}
}
- self->priv->current++;
- load_current_image (self);
+ if (strcmp (self->priv->attributes, "") != 0) {
+ GList *files;
+
+ files = g_list_prepend (NULL, image_info->file_data);
+ _g_query_metadata_async (files,
+ self->priv->attributes,
+ gth_task_get_cancellable (GTH_TASK (self)),
+ metadata_ready_cb,
+ self);
+
+ g_list_free (files);
+ }
+ else
+ load_next_image (self);
}
@@ -106,7 +146,6 @@ load_current_image (GthLoadImageInfoTask *self)
char *details;
if (self->priv->current >= self->priv->n_images) {
- /* FIXME: read the required metadata as well */
gth_task_completed (GTH_TASK (self), NULL);
return;
}
@@ -208,7 +247,8 @@ gth_load_image_info_task_get_type (void)
GthTask *
gth_load_image_info_task_new (GthImageInfo **images,
- int n_images)
+ int n_images,
+ const char *attributes)
{
GthLoadImageInfoTask *self;
int n;
@@ -219,6 +259,7 @@ gth_load_image_info_task_new (GthImageInfo **images,
self->priv->images[n] = gth_image_info_ref (images[n]);
self->priv->images[n] = NULL;
self->priv->n_images = n;
+ self->priv->attributes = g_strdup (attributes);
self->priv->current = 0;
return (GthTask *) self;
diff --git a/extensions/image_print/gth-load-image-info-task.h b/extensions/image_print/gth-load-image-info-task.h
index 4a47e9b..cbc1f84 100644
--- a/extensions/image_print/gth-load-image-info-task.h
+++ b/extensions/image_print/gth-load-image-info-task.h
@@ -51,7 +51,8 @@ struct _GthLoadImageInfoTaskClass {
GType gth_load_image_info_task_get_type (void);
GthTask * gth_load_image_info_task_new (GthImageInfo **images,
- int n_images);
+ int n_images,
+ const char *attributes);
G_END_DECLS
diff --git a/extensions/image_print/preferences.h b/extensions/image_print/preferences.h
new file mode 100644
index 0000000..0b4d600
--- /dev/null
+++ b/extensions/image_print/preferences.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 Street #330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef PREFERENCES_H
+#define PREFERENCES_H
+
+#include <gthumb.h>
+
+G_BEGIN_DECLS
+
+#define PREF_IMAGE_PRINT_CAPTION "/apps/gthumb/ext/image_print/caption"
+
+G_END_DECLS
+
+#endif /* PREFERENCES_H */
diff --git a/gthumb/glib-utils.c b/gthumb/glib-utils.c
index 0b5dc45..be711cb 100644
--- a/gthumb/glib-utils.c
+++ b/gthumb/glib-utils.c
@@ -2108,6 +2108,20 @@ _g_file_append_path (GFile *file,
static gboolean
+attribute_matches_mask (const char *attribute,
+ const char *mask)
+{
+ char *pattern_end;
+
+ pattern_end = g_strstr_len (mask, -1, "*");
+ if (pattern_end == NULL)
+ return strcmp (attribute, mask) == 0;
+ else
+ return strncmp (attribute, mask, pattern_end - mask) == 0;
+}
+
+
+static gboolean
_g_file_attributes_matches_mask (const char *attributes,
const char *mask)
{
@@ -2119,14 +2133,14 @@ _g_file_attributes_matches_mask (const char *attributes,
attributes_v = g_strsplit (attributes, ",", -1);
mask_v = g_strsplit (mask, ",", -1);
for (i = 0; ! matches && (mask_v[i] != NULL); i++) {
- GFileAttributeMatcher *matcher;
- int j;
-
- matcher = g_file_attribute_matcher_new (mask_v[i]);
- for (j = 0; ! matches && (attributes_v[j] != NULL); j++)
- matches = g_file_attribute_matcher_matches (matcher, attributes_v[j]);
+ int j;
- g_file_attribute_matcher_unref (matcher);
+ for (j = 0; ! matches && (attributes_v[j] != NULL); j++) {
+ matches = attribute_matches_mask (attributes_v[j], mask_v[i]);
+#if 0
+ g_print ("attr: %s <=> mask: %s : %d\n", attributes_v[j], mask_v[i], matches);
+#endif
+ }
}
g_strfreev (mask_v);
diff --git a/gthumb/gth-main-default-metadata.c b/gthumb/gth-main-default-metadata.c
index 4475293..0f8a39c 100644
--- a/gthumb/gth-main-default-metadata.c
+++ b/gthumb/gth-main-default-metadata.c
@@ -48,9 +48,9 @@ GthMetadataInfo file_metadata_info[] = {
{ "general::format", N_("Format"), "general", 12, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
{ "Embedded::Image::DateTime", "", "", 0, GTH_METADATA_ALLOW_NOWHERE },
- { "Embedded::Image::Comment", "", "", 0, GTH_METADATA_ALLOW_NOWHERE },
+ { "Embedded::Image::Comment", N_("Comment"), "general", 14, GTH_METADATA_ALLOW_IN_PRINT },
{ "Embedded::Image::Location", "", "", 0, GTH_METADATA_ALLOW_NOWHERE },
- { "Embedded::Image::Keywords", "", "", 0, GTH_METADATA_ALLOW_NOWHERE },
+ { "Embedded::Image::Keywords", N_("Tags"), "general", 16, GTH_METADATA_ALLOW_IN_PRINT },
{ "Embedded::Image::Orientation", "", "", 0, GTH_METADATA_ALLOW_NOWHERE },
{ "Embedded::Photo::DateTimeOriginal", "", "", 0, GTH_METADATA_ALLOW_NOWHERE },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]