[gthumb/ext] Added ability to change IPTC fields



commit 4993cf29b27f136741c9aaa0232f7b7a680db682
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Fri Jan 1 18:02:53 2010 +0100

    Added ability to change IPTC fields

 configure.ac                                |    2 +
 extensions/exiv2/Makefile.am                |    4 +
 extensions/exiv2/data/Makefile.am           |    2 +
 extensions/exiv2/data/ui/Makefile.am        |    5 +
 extensions/exiv2/data/ui/edit-exiv2-page.ui |  395 +++++++++++++++++++++++++++
 extensions/exiv2/gth-edit-exiv2-page.c      |  244 +++++++++++++++++
 extensions/exiv2/gth-edit-exiv2-page.h      |   54 ++++
 7 files changed, 706 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index de2f48d..dbe65a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -326,6 +326,8 @@ extensions/edit_metadata/Makefile
 extensions/edit_metadata/data/Makefile
 extensions/edit_metadata/data/ui/Makefile
 extensions/exiv2/Makefile
+extensions/exiv2/data/Makefile
+extensions/exiv2/data/ui/Makefile
 extensions/file_manager/Makefile
 extensions/file_tools/Makefile
 extensions/file_tools/data/Makefile
diff --git a/extensions/exiv2/Makefile.am b/extensions/exiv2/Makefile.am
index 5def504..f9b4407 100644
--- a/extensions/exiv2/Makefile.am
+++ b/extensions/exiv2/Makefile.am
@@ -1,11 +1,15 @@
 if ENABLE_EXIV2
 
+SUBDIRS = data
+
 extensiondir = $(libdir)/gthumb-2.0/extensions
 extension_LTLIBRARIES = libexiv2.la
 
 libexiv2_la_SOURCES = 			\
 	exiv2-utils.h			\
 	exiv2-utils.cpp			\
+	gth-edit-exiv2-page.c		\
+	gth-edit-exiv2-page.h		\
 	gth-metadata-provider-exiv2.c	\
 	gth-metadata-provider-exiv2.h	\
 	main.c
diff --git a/extensions/exiv2/data/Makefile.am b/extensions/exiv2/data/Makefile.am
new file mode 100644
index 0000000..4d5385d
--- /dev/null
+++ b/extensions/exiv2/data/Makefile.am
@@ -0,0 +1,2 @@
+SUBDIRS = ui
+-include $(top_srcdir)/git.mk
diff --git a/extensions/exiv2/data/ui/Makefile.am b/extensions/exiv2/data/ui/Makefile.am
new file mode 100644
index 0000000..4bb8beb
--- /dev/null
+++ b/extensions/exiv2/data/ui/Makefile.am
@@ -0,0 +1,5 @@
+uidir = $(datadir)/gthumb-2.0/ui
+ui_DATA = edit-exiv2-page.ui
+EXTRA_DIST = $(ui_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/extensions/exiv2/data/ui/edit-exiv2-page.ui b/extensions/exiv2/data/ui/edit-exiv2-page.ui
new file mode 100644
index 0000000..8deb068
--- /dev/null
+++ b/extensions/exiv2/data/ui/edit-exiv2-page.ui
@@ -0,0 +1,395 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkTable" id="content">
+    <property name="visible">True</property>
+    <property name="n_rows">10</property>
+    <property name="n_columns">2</property>
+    <property name="column_spacing">6</property>
+    <property name="row_spacing">6</property>
+    <child>
+      <object class="GtkEntry" id="copyright_entry">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="max_length">128</property>
+        <property name="invisible_char">&#x25CF;</property>
+        <property name="activates_default">True</property>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="right_attach">2</property>
+        <property name="y_options"></property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label1">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">C_opyright:</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">byline_entry</property>
+      </object>
+      <packing>
+        <property name="x_options">GTK_FILL</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label4">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">Co_untry:</property>
+        <property name="use_underline">True</property>
+      </object>
+      <packing>
+        <property name="top_attach">3</property>
+        <property name="bottom_attach">4</property>
+        <property name="x_options">GTK_FILL</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label7">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">_Language:</property>
+        <property name="use_underline">True</property>
+      </object>
+      <packing>
+        <property name="top_attach">5</property>
+        <property name="bottom_attach">6</property>
+        <property name="x_options">GTK_FILL</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkHBox" id="hbox2">
+        <property name="visible">True</property>
+        <property name="spacing">6</property>
+        <child>
+          <object class="GtkEntry" id="country_name_entry">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="max_length">64</property>
+            <property name="invisible_char">&#x25CF;</property>
+          </object>
+          <packing>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label3">
+            <property name="visible">True</property>
+            <property name="xalign">0</property>
+            <property name="label" translatable="yes">_Code:</property>
+            <property name="use_underline">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkEntry" id="country_code_entry">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="invisible_char">&#x25CF;</property>
+            <property name="width_chars">5</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </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>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkEntry" id="credit_entry">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="max_length">32</property>
+        <property name="invisible_char">&#x25CF;</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="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label5">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">Cr_edit:</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">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkEntry" id="destination_entry">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="max_length">1024</property>
+        <property name="invisible_char">&#x25CF;</property>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="right_attach">2</property>
+        <property name="top_attach">8</property>
+        <property name="bottom_attach">9</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label6">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">_Destination:</property>
+        <property name="use_underline">True</property>
+      </object>
+      <packing>
+        <property name="top_attach">8</property>
+        <property name="bottom_attach">9</property>
+        <property name="x_options">GTK_FILL</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkEntry" id="source_entry">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="max_length">1024</property>
+        <property name="invisible_char">&#x25CF;</property>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="right_attach">2</property>
+        <property name="top_attach">7</property>
+        <property name="bottom_attach">8</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label11">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">_Source:</property>
+        <property name="use_underline">True</property>
+      </object>
+      <packing>
+        <property name="top_attach">7</property>
+        <property name="bottom_attach">8</property>
+        <property name="x_options">GTK_FILL</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkHBox" id="hbox4">
+        <property name="visible">True</property>
+        <child>
+          <object class="GtkSpinButton" id="urgency_spinbutton">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="invisible_char">&#x25CF;</property>
+            <property name="adjustment">urgency_adjustment</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="right_attach">2</property>
+        <property name="top_attach">9</property>
+        <property name="bottom_attach">10</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label12">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">_Urgency:</property>
+        <property name="use_underline">True</property>
+      </object>
+      <packing>
+        <property name="top_attach">9</property>
+        <property name="bottom_attach">10</property>
+        <property name="x_options">GTK_FILL</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label13">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">_Object Name:</property>
+        <property name="use_underline">True</property>
+      </object>
+      <packing>
+        <property name="top_attach">6</property>
+        <property name="bottom_attach">7</property>
+        <property name="x_options">GTK_FILL</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkEntry" id="object_name_entry">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="max_length">1024</property>
+        <property name="invisible_char">&#x25CF;</property>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="right_attach">2</property>
+        <property name="top_attach">6</property>
+        <property name="bottom_attach">7</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkHBox" id="hbox5">
+        <property name="visible">True</property>
+        <property name="spacing">6</property>
+        <child>
+          <object class="GtkEntry" id="byline_entry">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="max_length">32</property>
+            <property name="invisible_char">&#x25CF;</property>
+            <property name="activates_default">True</property>
+          </object>
+          <packing>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label8">
+            <property name="visible">True</property>
+            <property name="xalign">0</property>
+            <property name="label" translatable="yes">Byline _Title:</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">byline_entry</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkEntry" id="byline_title_entry">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="max_length">32</property>
+            <property name="invisible_char">&#x25CF;</property>
+            <property name="activates_default">True</property>
+            <property name="width_chars">16</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">2</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"></property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label10">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">_Byline:</property>
+        <property name="use_underline">True</property>
+      </object>
+      <packing>
+        <property name="top_attach">2</property>
+        <property name="bottom_attach">3</property>
+        <property name="x_options">GTK_FILL</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkEntry" id="city_entry">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="max_length">32</property>
+        <property name="invisible_char">&#x25CF;</property>
+        <property name="activates_default">True</property>
+      </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>
+        <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">_City:</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">byline_entry</property>
+      </object>
+      <packing>
+        <property name="top_attach">4</property>
+        <property name="bottom_attach">5</property>
+        <property name="x_options">GTK_FILL</property>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkHBox" id="hbox1">
+        <property name="visible">True</property>
+        <child>
+          <object class="GtkEntry" id="language_entry">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="max_length">3</property>
+            <property name="invisible_char">&#x25CF;</property>
+            <property name="width_chars">3</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </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>
+        <property name="y_options">GTK_FILL</property>
+      </packing>
+    </child>
+  </object>
+  <object class="GtkAdjustment" id="urgency_adjustment">
+    <property name="upper">9</property>
+    <property name="step_increment">1</property>
+  </object>
+</interface>
diff --git a/extensions/exiv2/gth-edit-exiv2-page.c b/extensions/exiv2/gth-edit-exiv2-page.c
new file mode 100644
index 0000000..03265e0
--- /dev/null
+++ b/extensions/exiv2/gth-edit-exiv2-page.c
@@ -0,0 +1,244 @@
+/* -*- 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.
+ */
+
+#include <config.h>
+#include <glib/gi18n.h>
+#include <gio/gio.h>
+#include <extensions/edit_metadata/gth-edit-metadata-dialog.h>
+#include "exiv2-utils.h"
+#include "gth-edit-exiv2-page.h"
+
+
+#define GTH_EDIT_EXIV2_PAGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTH_TYPE_EDIT_EXIV2_PAGE, GthEditExiv2PagePrivate))
+#define GET_WIDGET(name) _gtk_builder_get_widget (self->priv->builder, (name))
+
+
+static gpointer gth_edit_exiv2_page_parent_class = NULL;
+
+
+struct _GthEditExiv2PagePrivate {
+	GtkBuilder  *builder;
+	gboolean     supported;
+};
+
+
+static void
+set_entry_value (GthEditExiv2Page *self,
+		 GthFileData      *file_data,
+		 const char       *attribute,
+		 const char       *widget_id)
+{
+	GthMetadata *metadata;
+
+	metadata = (GthMetadata *) g_file_info_get_attribute_object (file_data->info, attribute);
+	if (metadata != NULL)
+		gtk_entry_set_text (GTK_ENTRY (GET_WIDGET (widget_id)), gth_metadata_get_formatted (metadata));
+	else
+		gtk_entry_set_text (GTK_ENTRY (GET_WIDGET (widget_id)), "");
+}
+
+
+void
+gth_edit_exiv2_page_real_set_file (GthEditMetadataPage *base,
+		 		   GthFileData         *file_data)
+{
+	GthEditExiv2Page *self;
+	GthMetadata      *metadata;
+
+	self = GTH_EDIT_EXIV2_PAGE (base);
+
+	self->priv->supported = exiv2_supports_writes (gth_file_data_get_mime_type (file_data));
+	if (! self->priv->supported) {
+		gtk_widget_hide (GTK_WIDGET (base));
+		return;
+	}
+
+	set_entry_value (self, file_data, "Iptc::Application2::Copyright", "copyright_entry");
+	set_entry_value (self, file_data, "Iptc::Application2::Credit", "credit_entry");
+	set_entry_value (self, file_data, "Iptc::Application2::Byline", "byline_entry");
+	set_entry_value (self, file_data, "Iptc::Application2::BylineTitle", "byline_title_entry");
+	set_entry_value (self, file_data, "Iptc::Application2::CountryName", "country_name_entry");
+	set_entry_value (self, file_data, "Iptc::Application2::CountryCode", "country_code_entry");
+	set_entry_value (self, file_data, "Iptc::Application2::City", "city_entry");
+	set_entry_value (self, file_data, "Iptc::Application2::Language", "language_entry");
+	set_entry_value (self, file_data, "Iptc::Application2::ObjectName", "object_name_entry");
+	set_entry_value (self, file_data, "Iptc::Application2::Source", "source_entry");
+	set_entry_value (self, file_data, "Iptc::Envelope::Destination", "destination_entry");
+
+	metadata = (GthMetadata *) g_file_info_get_attribute_object (file_data->info, "Iptc::Application2::Urgency");
+	if (metadata != NULL) {
+		float v;
+
+		if (sscanf (gth_metadata_get_formatted (metadata), "%f", &v) == 1)
+			gtk_adjustment_set_value (GTK_ADJUSTMENT (GET_WIDGET ("urgency_adjustment")), (double) v);
+		else
+			gtk_adjustment_set_value (GTK_ADJUSTMENT (GET_WIDGET ("urgency_adjustment")), 0.0);
+	}
+	else
+		gtk_adjustment_set_value (GTK_ADJUSTMENT (GET_WIDGET ("urgency_adjustment")), 0.0);
+
+	gtk_widget_show (GTK_WIDGET (base));
+}
+
+
+static void
+set_attribute_from_entry (GthEditExiv2Page *self,
+			  GFileInfo        *info,
+			  const char       *attribute,
+			  const char       *widget_id)
+{
+	GthMetadata *metadata;
+
+	metadata = g_object_new (GTH_TYPE_METADATA,
+				 "id", attribute,
+				 "raw", gtk_entry_get_text (GTK_ENTRY (GET_WIDGET (widget_id))),
+				 "formatted", gtk_entry_get_text (GTK_ENTRY (GET_WIDGET (widget_id))),
+				 NULL);
+	g_file_info_set_attribute_object (info, attribute, G_OBJECT (metadata));
+	g_object_unref (metadata);
+}
+
+
+void
+gth_edit_exiv2_page_real_update_info (GthEditMetadataPage *base,
+				      GFileInfo           *info)
+{
+	GthEditExiv2Page *self;
+	double            v;
+	char             *s;
+	GthMetadata      *metadata;
+
+	self = GTH_EDIT_EXIV2_PAGE (base);
+
+	if (! self->priv->supported)
+		return;
+
+	set_attribute_from_entry (self, info, "Iptc::Application2::Copyright", "copyright_entry");
+	set_attribute_from_entry (self, info, "Iptc::Application2::Credit", "credit_entry");
+	set_attribute_from_entry (self, info, "Iptc::Application2::Byline", "byline_entry");
+	set_attribute_from_entry (self, info, "Iptc::Application2::BylineTitle", "byline_title_entry");
+	set_attribute_from_entry (self, info, "Iptc::Application2::CountryName", "country_name_entry");
+	set_attribute_from_entry (self, info, "Iptc::Application2::CountryCode", "country_code_entry");
+	set_attribute_from_entry (self, info, "Iptc::Application2::City", "city_entry");
+	set_attribute_from_entry (self, info, "Iptc::Application2::Language", "language_entry");
+	set_attribute_from_entry (self, info, "Iptc::Application2::ObjectName", "object_name_entry");
+	set_attribute_from_entry (self, info, "Iptc::Application2::Source", "source_entry");
+	set_attribute_from_entry (self, info, "Iptc::Envelope::Destination", "destination_entry");
+
+	/* urgency */
+
+	v = gtk_adjustment_get_value (GTK_ADJUSTMENT (GET_WIDGET ("urgency_adjustment")));
+	s = g_strdup_printf ("%1.g", v);
+	metadata = g_object_new (GTH_TYPE_METADATA,
+				 "id", "Iptc::Application2::Urgency",
+				 "raw", s,
+				 "formatted", s,
+				 NULL);
+	g_file_info_set_attribute_object (info, "Iptc::Application2::Urgency", G_OBJECT (metadata));
+	g_object_unref (metadata);
+	g_free (s);
+}
+
+
+const char *
+gth_edit_exiv2_page_real_get_name (GthEditMetadataPage *self)
+{
+	return _("Other");
+}
+
+
+static void
+gth_edit_exiv2_page_finalize (GObject *object)
+{
+	GthEditExiv2Page *self;
+
+	self = GTH_EDIT_EXIV2_PAGE (object);
+
+	g_object_unref (self->priv->builder);
+
+	G_OBJECT_CLASS (gth_edit_exiv2_page_parent_class)->finalize (object);
+}
+
+
+static void
+gth_edit_exiv2_page_class_init (GthEditExiv2PageClass *klass)
+{
+	gth_edit_exiv2_page_parent_class = g_type_class_peek_parent (klass);
+	g_type_class_add_private (klass, sizeof (GthEditExiv2PagePrivate));
+
+	G_OBJECT_CLASS (klass)->finalize = gth_edit_exiv2_page_finalize;
+}
+
+
+static void
+gth_edit_exiv2_page_init (GthEditExiv2Page *self)
+{
+	self->priv = GTH_EDIT_EXIV2_PAGE_GET_PRIVATE (self);
+
+	gtk_container_set_border_width (GTK_CONTAINER (self), 12);
+
+	self->priv->builder = _gtk_builder_new_from_file ("edit-exiv2-page.ui", "exiv2");
+  	gtk_box_pack_start (GTK_BOX (self), _gtk_builder_get_widget (self->priv->builder, "content"), TRUE, TRUE, 0);
+}
+
+
+static void
+gth_edit_exiv2_page_gth_edit_exiv2_page_interface_init (GthEditMetadataPageIface *iface)
+{
+	iface->set_file = gth_edit_exiv2_page_real_set_file;
+	iface->update_info = gth_edit_exiv2_page_real_update_info;
+	iface->get_name = gth_edit_exiv2_page_real_get_name;
+}
+
+
+GType
+gth_edit_exiv2_page_get_type (void)
+{
+	static GType type = 0;
+
+	if (type == 0) {
+		static const GTypeInfo g_define_type_info = {
+			sizeof (GthEditExiv2PageClass),
+			(GBaseInitFunc) NULL,
+			(GBaseFinalizeFunc) NULL,
+			(GClassInitFunc) gth_edit_exiv2_page_class_init,
+			(GClassFinalizeFunc) NULL,
+			NULL,
+			sizeof (GthEditExiv2Page),
+			0,
+			(GInstanceInitFunc) gth_edit_exiv2_page_init,
+			NULL
+		};
+		static const GInterfaceInfo gth_edit_exiv2_page_info = {
+			(GInterfaceInitFunc) gth_edit_exiv2_page_gth_edit_exiv2_page_interface_init,
+			(GInterfaceFinalizeFunc) NULL,
+			NULL
+		};
+		type = g_type_register_static (GTK_TYPE_VBOX,
+					       "GthEditExiv2Page",
+					       &g_define_type_info,
+					       0);
+		g_type_add_interface_static (type, GTH_TYPE_EDIT_METADATA_PAGE, &gth_edit_exiv2_page_info);
+	}
+
+	return type;
+}
diff --git a/extensions/exiv2/gth-edit-exiv2-page.h b/extensions/exiv2/gth-edit-exiv2-page.h
new file mode 100644
index 0000000..09b2081
--- /dev/null
+++ b/extensions/exiv2/gth-edit-exiv2-page.h
@@ -0,0 +1,54 @@
+/* -*- 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 GTH_EDIT_EXIV2_PAGE_H
+#define GTH_EDIT_EXIV2_PAGE_H
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gthumb.h>
+
+#define GTH_TYPE_EDIT_EXIV2_PAGE         (gth_edit_exiv2_page_get_type ())
+#define GTH_EDIT_EXIV2_PAGE(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GTH_TYPE_EDIT_EXIV2_PAGE, GthEditExiv2Page))
+#define GTH_EDIT_EXIV2_PAGE_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), GTH_TYPE_EDIT_EXIV2_PAGE, GthEditExiv2PageClass))
+#define GTH_IS_EDIT_EXIV2_PAGE(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTH_TYPE_EDIT_EXIV2_PAGE))
+#define GTH_IS_EDIT_EXIV2_PAGE_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GTH_TYPE_EDIT_EXIV2_PAGE))
+#define GTH_EDIT_EXIV2_PAGE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GTH_TYPE_EDIT_EXIV2_PAGE, GthEditExiv2PageClass))
+
+typedef struct _GthEditExiv2Page         GthEditExiv2Page;
+typedef struct _GthEditExiv2PagePrivate  GthEditExiv2PagePrivate;
+typedef struct _GthEditExiv2PageClass    GthEditExiv2PageClass;
+
+struct _GthEditExiv2Page
+{
+	GtkVBox __parent;
+	GthEditExiv2PagePrivate *priv;
+};
+
+struct _GthEditExiv2PageClass
+{
+	GtkVBoxClass __parent_class;	
+};
+
+GType gth_edit_exiv2_page_get_type (void) G_GNUC_CONST;
+
+#endif /* GTH_EDIT_EXIV2_PAGE_H */



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