[gthumb/ext] Splitted the metadata editor in a different extension



commit fc24ccf133741764784ce1a19b322c87d12962ae
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Tue Dec 29 21:37:37 2009 +0100

    Splitted the metadata editor in a different extension
    
    the metadata editor and the comment metadata provider are in two
    different extensions now, this way the comment provider can be
    disactivated without losing the exif/iptc/xmp editor.

 configure.ac                                       |    5 +-
 extensions/Makefile.am                             |    1 +
 extensions/catalogs/catalogs.extension.in.in       |    4 +-
 extensions/comments/Makefile.am                    |    4 -
 extensions/comments/comments.extension.in.in       |    2 +-
 extensions/comments/main.c                         |    4 +-
 extensions/edit_metadata/Makefile.am               |   38 ++++
 .../edit_metadata/actions.c                        |   16 +-
 .../edit_metadata/actions.h                        |   14 +-
 extensions/edit_metadata/callbacks.c               |  204 ++++++++++++++++++++
 .../edit_metadata/callbacks.h                      |   14 +-
 .../{comments => edit_metadata}/data/Makefile.am   |    0
 .../data/ui/Makefile.am                            |    0
 .../data/ui/edit-comment-page.ui                   |    2 +-
 .../edit_metadata}/dlg-edit-metadata.c             |    7 +-
 .../edit_metadata}/dlg-edit-metadata.h             |    2 +-
 .../edit_metadata/edit_metadata.extension.in.in    |   11 +
 .../gth-edit-comment-page.c                        |    3 +-
 .../gth-edit-comment-page.h                        |    0
 .../edit_metadata}/gth-edit-metadata-dialog.c      |    1 -
 .../edit_metadata}/gth-edit-metadata-dialog.h      |    6 +-
 extensions/edit_metadata/main.c                    |   58 ++++++
 extensions/list_tools/callbacks.c                  |    2 +-
 gthumb/Makefile.am                                 |    4 -
 gthumb/gth-browser-actions-callbacks.c             |    9 -
 gthumb/gth-browser-actions-entries.h               |    5 -
 gthumb/gth-browser-ui.h                            |   19 +--
 gthumb/gth-browser.c                               |    3 -
 gthumb/gth-file-properties.c                       |   23 ---
 po/POTFILES.in                                     |   20 ++-
 30 files changed, 375 insertions(+), 106 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5d83307..de2f48d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -321,9 +321,10 @@ extensions/catalogs/Makefile
 extensions/catalogs/data/Makefile
 extensions/catalogs/data/ui/Makefile
 extensions/comments/Makefile
-extensions/comments/data/Makefile
-extensions/comments/data/ui/Makefile
 extensions/desktop_background/Makefile
+extensions/edit_metadata/Makefile
+extensions/edit_metadata/data/Makefile
+extensions/edit_metadata/data/ui/Makefile
 extensions/exiv2/Makefile
 extensions/file_manager/Makefile
 extensions/file_tools/Makefile
diff --git a/extensions/Makefile.am b/extensions/Makefile.am
index df88586..62a37c7 100644
--- a/extensions/Makefile.am
+++ b/extensions/Makefile.am
@@ -3,6 +3,7 @@ SUBDIRS = 			\
 	catalogs		\
 	comments		\
 	desktop_background	\
+	edit_metadata		\
 	exiv2			\
 	file_manager		\
 	file_tools		\
diff --git a/extensions/catalogs/catalogs.extension.in.in b/extensions/catalogs/catalogs.extension.in.in
index 9c0547e..5536a2c 100644
--- a/extensions/catalogs/catalogs.extension.in.in
+++ b/extensions/catalogs/catalogs.extension.in.in
@@ -1,8 +1,8 @@
 [Extension]
 _Name=Catalogs
 _Description=Create file collections.
-_Authors=Paolo Bacchilega <paobac src gnome org>
-Copyright=Copyright © 2008-2009 The Free Software Foundation, Inc.
+_Authors=gthumb development team
+Copyright=Copyright © 2008-2010 The Free Software Foundation, Inc.
 Version=1.0
 URL=http://live.gnome.org/gthumb
 
diff --git a/extensions/comments/Makefile.am b/extensions/comments/Makefile.am
index 4e18639..c61d896 100644
--- a/extensions/comments/Makefile.am
+++ b/extensions/comments/Makefile.am
@@ -1,13 +1,9 @@
-SUBDIRS = data
-
 extensiondir = $(libdir)/gthumb-2.0/extensions
 extension_LTLIBRARIES = libcomments.la
 
 libcomments_la_SOURCES = 			\
 	gth-comment.c				\
 	gth-comment.h				\
-	gth-edit-comment-page.c			\
-	gth-edit-comment-page.h			\
 	gth-metadata-provider-comment.c		\
 	gth-metadata-provider-comment.h		\
 	gth-test-category.c			\
diff --git a/extensions/comments/comments.extension.in.in b/extensions/comments/comments.extension.in.in
index bdb6409..f8c4b65 100644
--- a/extensions/comments/comments.extension.in.in
+++ b/extensions/comments/comments.extension.in.in
@@ -1,6 +1,6 @@
 [Extension]
 _Name=Comments and tags
-_Description=Add comments and tags to files.
+_Description=Add comments and tags to any type of file.
 _Authors=gthumb development team
 Copyright=Copyright © 2009 The Free Software Foundation, Inc.
 Version=1.0
diff --git a/extensions/comments/main.c b/extensions/comments/main.c
index 082f6bf..07b33c9 100644
--- a/extensions/comments/main.c
+++ b/extensions/comments/main.c
@@ -25,7 +25,6 @@
 #include <gtk/gtk.h>
 #include <gthumb.h>
 #include "gth-comment.h"
-#include "gth-edit-comment-page.h"
 #include "gth-metadata-provider-comment.h"
 #include "gth-test-category.h"
 
@@ -176,12 +175,11 @@ gthumb_extension_activate (void)
 	gth_main_register_metadata_category (comments_metadata_category);
 	gth_main_register_metadata_info_v (comments_metadata_info);
 	gth_main_register_metadata_provider (GTH_TYPE_METADATA_PROVIDER_COMMENT);
-	gth_main_register_type ("edit-metadata-dialog-page", GTH_TYPE_EDIT_COMMENT_PAGE);
 	gth_main_register_object (GTH_TYPE_TEST,
 				  "comment::note",
 				  GTH_TYPE_TEST_SIMPLE,
 				  "attributes", "comment::note",
-				  "display-name", _("Comment"),
+				  "display-name", _("Description"),
 				  "data-type", GTH_TEST_DATA_TYPE_STRING,
 				  "get-data-func", get_comment_for_test,
 				  NULL);
diff --git a/extensions/edit_metadata/Makefile.am b/extensions/edit_metadata/Makefile.am
new file mode 100644
index 0000000..1416fdc
--- /dev/null
+++ b/extensions/edit_metadata/Makefile.am
@@ -0,0 +1,38 @@
+SUBDIRS = data
+
+extensiondir = $(libdir)/gthumb-2.0/extensions
+extension_LTLIBRARIES = libedit_metadata.la
+
+libedit_metadata_la_SOURCES = 		\
+	actions.c			\
+	actions.h			\
+	callbacks.c			\
+	callbacks.h			\
+	dlg-edit-metadata.c		\
+	dlg-edit-metadata.h		\
+	gth-edit-comment-page.c		\
+	gth-edit-comment-page.h		\
+	gth-edit-metadata-dialog.c	\
+	gth-edit-metadata-dialog.h	\
+	main.c
+
+libedit_metadata_la_CFLAGS = $(GTHUMB_CFLAGS) $(WARNINGS) -I$(top_srcdir) -I$(top_builddir)/gthumb 
+libedit_metadata_la_LDFLAGS = $(EXTENSION_LIBTOOL_FLAGS)
+libedit_metadata_la_LIBADD = $(GTHUMB_LIBS)
+libedit_metadata_la_DEPENDENCIES = $(top_builddir)/gthumb/gthumb$(EXEEXT)
+
+extensioninidir = $(extensiondir)
+extensionini_in_files = edit_metadata.extension.in.in
+extensionini_DATA = $(extensionini_in_files:.extension.in.in=.extension)
+
+%.extension.in: %.extension.in.in $(extension_LTLIBRARIES)
+	sed -e "s|%LIBRARY%|`. ./$(extension_LTLIBRARIES) && echo $$dlname`|" \
+	$< > $@
+
+%.extension: %.extension.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
+
+EXTRA_DIST = $(extensionini_in_files) 
+
+DISTCLEANFILES = $(extensionini_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/gthumb/dlg-edit-metadata.h b/extensions/edit_metadata/actions.c
similarity index 76%
copy from gthumb/dlg-edit-metadata.h
copy to extensions/edit_metadata/actions.c
index 9fa3740..17ebe80 100644
--- a/gthumb/dlg-edit-metadata.h
+++ b/extensions/edit_metadata/actions.c
@@ -3,7 +3,7 @@
 /*
  *  GThumb
  *
- *  Copyright (C) 2009 The Free Software Foundation, Inc.
+ *  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
@@ -20,11 +20,15 @@
  *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
  */
 
-#ifndef DLG_EDIT_METADATA_H
-#define DLG_EDIT_METADATA_H
 
-#include "gth-browser.h"
+#include <config.h>
+#include <gthumb.h>
+#include "dlg-edit-metadata.h"
 
-void dlg_edit_metadata (GthBrowser *browser);
 
-#endif /* DLG_EDIT_METADATA_H */
+void
+gth_browser_activate_action_edit_metadata (GtkAction  *action,
+				 	   GthBrowser *browser)
+{
+	dlg_edit_metadata (browser);
+}
diff --git a/gthumb/dlg-edit-metadata.h b/extensions/edit_metadata/actions.h
similarity index 76%
copy from gthumb/dlg-edit-metadata.h
copy to extensions/edit_metadata/actions.h
index 9fa3740..96777e2 100644
--- a/gthumb/dlg-edit-metadata.h
+++ b/extensions/edit_metadata/actions.h
@@ -3,7 +3,7 @@
 /*
  *  GThumb
  *
- *  Copyright (C) 2009 The Free Software Foundation, Inc.
+ *  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
@@ -20,11 +20,13 @@
  *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
  */
 
-#ifndef DLG_EDIT_METADATA_H
-#define DLG_EDIT_METADATA_H
+#ifndef ACTIONS_H
+#define ACTIONS_H
 
-#include "gth-browser.h"
+#include <gtk/gtk.h>
 
-void dlg_edit_metadata (GthBrowser *browser);
+#define DEFINE_ACTION(x) void x (GtkAction *action, gpointer data);
 
-#endif /* DLG_EDIT_METADATA_H */
+DEFINE_ACTION(gth_browser_activate_action_edit_metadata)
+
+#endif /* ACTIONS_H */
diff --git a/extensions/edit_metadata/callbacks.c b/extensions/edit_metadata/callbacks.c
new file mode 100644
index 0000000..9d4ef8f
--- /dev/null
+++ b/extensions/edit_metadata/callbacks.c
@@ -0,0 +1,204 @@
+/* -*- 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 <glib-object.h>
+#include <gthumb.h>
+#include "actions.h"
+
+
+#define BROWSER_DATA_KEY "edit-metadata-data"
+
+
+static const char *fixed_ui_info =
+"<ui>"
+"  <menubar name='MenuBar'>"
+"    <menu name='Edit' action='EditMenu'>"
+"      <placeholder name='Edit_Actions'>"
+"        <menuitem action='Edit_Metadata'/>"
+"      </placeholder>"
+"    </menu>"
+"  </menubar>"
+"  <toolbar name='ViewerToolBar'>"
+"    <placeholder name='Edit_Actions'>"
+"      <toolitem action='Edit_Metadata'/>"
+"    </placeholder>"
+"  </toolbar>"
+"  <toolbar name='Fullscreen_ToolBar'>"
+"    <placeholder name='Edit_Actions'>"
+"      <toolitem action='Edit_Metadata'/>"
+"    </placeholder>"
+"  </toolbar>"
+"  <popup name='FileListPopup'>"
+"    <placeholder name='File_LastActions'>"
+"      <menuitem action='Edit_Metadata'/>"
+"    </placeholder>"
+"  </popup>"
+"  <popup name='FilePopup'>"
+"    <placeholder name='File_LastActions'>"
+"      <menuitem action='Edit_Metadata'/>"
+"    </placeholder>"
+"  </popup>"
+"</ui>";
+
+
+static const char *browser_ui_info =
+"<ui>"
+"  <toolbar name='ToolBar'>"
+"    <placeholder name='Edit_Actions'>"
+"      <toolitem action='Edit_Metadata'/>"
+"    </placeholder>"
+"  </toolbar>"
+"</ui>";
+
+
+static const char *viewer_ui_info =
+"<ui>"
+"  <menubar name='MenuBar'>"
+"    <menu name='Edit' action='EditMenu'>"
+"      <placeholder name='Edit_Actions'>"
+"        <menuitem action='Edit_Metadata'/>"
+"      </placeholder>"
+"    </menu>"
+"  </menubar>"
+"</ui>";
+
+
+static GtkActionEntry edit_metadata_action_entries[] = {
+	{ "Edit_Metadata", GTK_STOCK_EDIT,
+	  N_("Metadata"), "<control>M",
+	  N_("Edit file metadata"),
+	  G_CALLBACK (gth_browser_activate_action_edit_metadata) }
+};
+
+
+typedef struct {
+	GthBrowser     *browser;
+	GtkActionGroup *actions;
+	guint           browser_ui_merge_id;
+	guint           viewer_ui_merge_id;
+} BrowserData;
+
+
+static void
+browser_data_free (BrowserData *data)
+{
+	g_free (data);
+}
+
+
+void
+edit_metadata__gth_browser_construct_cb (GthBrowser *browser)
+{
+	BrowserData *data;
+	GError      *error = NULL;
+
+	g_return_if_fail (GTH_IS_BROWSER (browser));
+
+	data = g_new0 (BrowserData, 1);
+	data->browser = browser;
+
+	data->actions = gtk_action_group_new ("Edit Metadata Actions");
+	gtk_action_group_set_translation_domain (data->actions, NULL);
+	gtk_action_group_add_actions (data->actions,
+				      edit_metadata_action_entries,
+				      G_N_ELEMENTS (edit_metadata_action_entries),
+				      browser);
+	gtk_ui_manager_insert_action_group (gth_browser_get_ui_manager (browser), data->actions, 0);
+
+	if (! gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager (browser), fixed_ui_info, -1, &error)) {
+		g_message ("building menus failed: %s", error->message);
+		g_error_free (error);
+	}
+
+	gtk_tool_item_set_is_important (GTK_TOOL_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/Fullscreen_ToolBar/Edit_Actions/Edit_Metadata")), TRUE);
+
+	g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);
+}
+
+
+void
+edit_metadata__gth_browser_set_current_page_cb (GthBrowser *browser)
+{
+	BrowserData *data;
+	GError      *error = NULL;
+
+	data = g_object_get_data (G_OBJECT (browser), BROWSER_DATA_KEY);
+	g_return_if_fail (data != NULL);
+
+	switch (gth_window_get_current_page (GTH_WINDOW (browser))) {
+	case GTH_BROWSER_PAGE_BROWSER:
+		if (data->viewer_ui_merge_id != 0) {
+			gtk_ui_manager_remove_ui (gth_browser_get_ui_manager (browser), data->viewer_ui_merge_id);
+			data->viewer_ui_merge_id = 0;
+		}
+		if (data->browser_ui_merge_id != 0)
+			return;
+		data->browser_ui_merge_id = gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager (browser), browser_ui_info, -1, &error);
+		if (data->browser_ui_merge_id == 0) {
+			g_warning ("ui building failed: %s", error->message);
+			g_clear_error (&error);
+		}
+		gtk_tool_item_set_is_important (GTK_TOOL_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ToolBar/Edit_Actions/Edit_Metadata")), TRUE);
+		break;
+
+	case GTH_BROWSER_PAGE_VIEWER:
+		if (data->browser_ui_merge_id != 0) {
+			gtk_ui_manager_remove_ui (gth_browser_get_ui_manager (browser), data->browser_ui_merge_id);
+			data->browser_ui_merge_id = 0;
+		}
+		if (data->viewer_ui_merge_id != 0)
+			return;
+		data->viewer_ui_merge_id = gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager (browser), viewer_ui_info, -1, &error);
+		if (data->viewer_ui_merge_id == 0) {
+			g_warning ("ui building failed: %s", error->message);
+			g_clear_error (&error);
+		}
+		gtk_tool_item_set_is_important (GTK_TOOL_ITEM (gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ViewerToolBar/Edit_Actions/Edit_Metadata")), TRUE);
+
+		break;
+
+	default:
+		break;
+	}
+}
+
+
+void
+edit_metadata__gth_browser_update_sensitivity_cb (GthBrowser *browser)
+{
+	BrowserData *data;
+	GtkAction   *action;
+	int          n_selected;
+	gboolean     sensitive;
+
+	data = g_object_get_data (G_OBJECT (browser), BROWSER_DATA_KEY);
+	g_return_if_fail (data != NULL);
+
+	n_selected = gth_file_selection_get_n_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
+
+	action = gtk_action_group_get_action (data->actions, "Edit_Metadata");
+	sensitive = (n_selected == 1);
+	g_object_set (action, "sensitive", sensitive, NULL);
+}
diff --git a/gthumb/dlg-edit-metadata.h b/extensions/edit_metadata/callbacks.h
similarity index 69%
copy from gthumb/dlg-edit-metadata.h
copy to extensions/edit_metadata/callbacks.h
index 9fa3740..2a6e334 100644
--- a/gthumb/dlg-edit-metadata.h
+++ b/extensions/edit_metadata/callbacks.h
@@ -3,7 +3,7 @@
 /*
  *  GThumb
  *
- *  Copyright (C) 2009 The Free Software Foundation, Inc.
+ *  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
@@ -20,11 +20,13 @@
  *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
  */
 
-#ifndef DLG_EDIT_METADATA_H
-#define DLG_EDIT_METADATA_H
+#ifndef CALLBACKS_H
+#define CALLBACKS_H
 
-#include "gth-browser.h"
+#include <gthumb.h>
 
-void dlg_edit_metadata (GthBrowser *browser);
+void edit_metadata__gth_browser_construct_cb          (GthBrowser *browser);
+void edit_metadata__gth_browser_set_current_page_cb   (GthBrowser *browser);
+void edit_metadata__gth_browser_update_sensitivity_cb (GthBrowser *browser);
 
-#endif /* DLG_EDIT_METADATA_H */
+#endif /* CALLBACKS_H */
diff --git a/extensions/comments/data/Makefile.am b/extensions/edit_metadata/data/Makefile.am
similarity index 100%
rename from extensions/comments/data/Makefile.am
rename to extensions/edit_metadata/data/Makefile.am
diff --git a/extensions/comments/data/ui/Makefile.am b/extensions/edit_metadata/data/ui/Makefile.am
similarity index 100%
rename from extensions/comments/data/ui/Makefile.am
rename to extensions/edit_metadata/data/ui/Makefile.am
diff --git a/extensions/comments/data/ui/edit-comment-page.ui b/extensions/edit_metadata/data/ui/edit-comment-page.ui
similarity index 98%
rename from extensions/comments/data/ui/edit-comment-page.ui
rename to extensions/edit_metadata/data/ui/edit-comment-page.ui
index 27bf093..d3b889e 100644
--- a/extensions/comments/data/ui/edit-comment-page.ui
+++ b/extensions/edit_metadata/data/ui/edit-comment-page.ui
@@ -13,7 +13,7 @@
         <property name="visible">True</property>
         <property name="xalign">0</property>
         <property name="yalign">0</property>
-        <property name="label" translatable="yes">Co_mment:</property>
+        <property name="label" translatable="yes">D_escription:</property>
         <property name="use_underline">True</property>
         <property name="mnemonic_widget">scrolledwindow3</property>
       </object>
diff --git a/gthumb/dlg-edit-metadata.c b/extensions/edit_metadata/dlg-edit-metadata.c
similarity index 95%
rename from gthumb/dlg-edit-metadata.c
rename to extensions/edit_metadata/dlg-edit-metadata.c
index c317311..ee216b8 100644
--- a/gthumb/dlg-edit-metadata.c
+++ b/extensions/edit_metadata/dlg-edit-metadata.c
@@ -22,12 +22,9 @@
 
 #include <config.h>
 #include <gtk/gtk.h>
+#include <gthumb.h>
 #include "dlg-edit-metadata.h"
-#include "glib-utils.h"
 #include "gth-edit-metadata-dialog.h"
-#include "gth-main.h"
-#include "gth-metadata-provider.h"
-#include "gtk-utils.h"
 
 
 typedef struct {
@@ -56,7 +53,7 @@ write_metadata_ready_cb (GError   *error,
 	GList      *files;
 
 	if (error != NULL) {
-		_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not save file properties"), &error);
+		_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not save the file metadata"), &error);
 		return;
 	}
 
diff --git a/gthumb/dlg-edit-metadata.h b/extensions/edit_metadata/dlg-edit-metadata.h
similarity index 97%
rename from gthumb/dlg-edit-metadata.h
rename to extensions/edit_metadata/dlg-edit-metadata.h
index 9fa3740..5208078 100644
--- a/gthumb/dlg-edit-metadata.h
+++ b/extensions/edit_metadata/dlg-edit-metadata.h
@@ -23,7 +23,7 @@
 #ifndef DLG_EDIT_METADATA_H
 #define DLG_EDIT_METADATA_H
 
-#include "gth-browser.h"
+#include <gthumb.h>
 
 void dlg_edit_metadata (GthBrowser *browser);
 
diff --git a/extensions/edit_metadata/edit_metadata.extension.in.in b/extensions/edit_metadata/edit_metadata.extension.in.in
new file mode 100644
index 0000000..ef023b7
--- /dev/null
+++ b/extensions/edit_metadata/edit_metadata.extension.in.in
@@ -0,0 +1,11 @@
+[Extension]
+_Name=Edit Metadata
+_Description=Allow to edit files metadata.
+_Authors=gthumb development team
+Copyright=Copyright © 2009-2010 The Free Software Foundation, Inc.
+Version=1.0
+URL=http://live.gnome.org/gthumb
+
+[Loader]
+Type=module
+File=%LIBRARY%
diff --git a/extensions/comments/gth-edit-comment-page.c b/extensions/edit_metadata/gth-edit-comment-page.c
similarity index 99%
rename from extensions/comments/gth-edit-comment-page.c
rename to extensions/edit_metadata/gth-edit-comment-page.c
index ba960fa..be38ba2 100644
--- a/extensions/comments/gth-edit-comment-page.c
+++ b/extensions/edit_metadata/gth-edit-comment-page.c
@@ -24,6 +24,7 @@
 #include <glib/gi18n.h>
 #include <gio/gio.h>
 #include "gth-edit-comment-page.h"
+#include "gth-edit-metadata-dialog.h"
 
 
 #define GTH_EDIT_COMMENT_PAGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTH_TYPE_EDIT_COMMENT_PAGE, GthEditCommentPagePrivate))
@@ -290,7 +291,7 @@ gth_edit_comment_page_init (GthEditCommentPage *self)
 
 	gtk_container_set_border_width (GTK_CONTAINER (self), 12);
 
-	self->priv->builder = _gtk_builder_new_from_file ("edit-comment-page.ui", "comments");
+	self->priv->builder = _gtk_builder_new_from_file ("edit-comment-page.ui", "edit_metadata");
   	gtk_box_pack_start (GTK_BOX (self), _gtk_builder_get_widget (self->priv->builder, "content"), TRUE, TRUE, 0);
 
   	self->priv->date_combobox = gtk_combo_box_new_text ();
diff --git a/extensions/comments/gth-edit-comment-page.h b/extensions/edit_metadata/gth-edit-comment-page.h
similarity index 100%
rename from extensions/comments/gth-edit-comment-page.h
rename to extensions/edit_metadata/gth-edit-comment-page.h
diff --git a/gthumb/gth-edit-metadata-dialog.c b/extensions/edit_metadata/gth-edit-metadata-dialog.c
similarity index 99%
rename from gthumb/gth-edit-metadata-dialog.c
rename to extensions/edit_metadata/gth-edit-metadata-dialog.c
index f22c1c4..b96689d 100644
--- a/gthumb/gth-edit-metadata-dialog.c
+++ b/extensions/edit_metadata/gth-edit-metadata-dialog.c
@@ -23,7 +23,6 @@
 #include <config.h>
 #include <glib/gi18n.h>
 #include "gth-edit-metadata-dialog.h"
-#include "gth-main.h"
 
 
 #define GTH_EDIT_METADATA_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTH_TYPE_EDIT_METADATA_DIALOG, GthEditMetadataDialogPrivate))
diff --git a/gthumb/gth-edit-metadata-dialog.h b/extensions/edit_metadata/gth-edit-metadata-dialog.h
similarity index 98%
rename from gthumb/gth-edit-metadata-dialog.h
rename to extensions/edit_metadata/gth-edit-metadata-dialog.h
index fa272cc..f96f8cd 100644
--- a/gthumb/gth-edit-metadata-dialog.h
+++ b/extensions/edit_metadata/gth-edit-metadata-dialog.h
@@ -24,7 +24,7 @@
 #define GTH_EDIT_METADATA_DIALOG_H
 
 #include <gtk/gtk.h>
-#include "gth-file-data.h"
+#include <gthumb.h>
 
 G_BEGIN_DECLS
 
@@ -65,6 +65,8 @@ struct _GthEditMetadataPageIface {
 	const char * (*get_name)    (GthEditMetadataPage *self);
 };
 
+/* GthEditMetadataDialog */
+
 GType          gth_edit_metadata_dialog_get_type    (void);
 GtkWidget *    gth_edit_metadata_dialog_new         (void);
 void           gth_edit_metadata_dialog_set_file    (GthEditMetadataDialog *dialog,
@@ -72,6 +74,8 @@ void           gth_edit_metadata_dialog_set_file    (GthEditMetadataDialog *dial
 void           gth_edit_metadata_dialog_update_info (GthEditMetadataDialog *dialog,
 						     GFileInfo             *info);
 
+/* GthEditMetadataPage */
+
 GType          gth_edit_metadata_page_get_type      (void);
 void           gth_edit_metadata_page_set_file      (GthEditMetadataPage   *self,
 		 			             GthFileData           *file_data);
diff --git a/extensions/edit_metadata/main.c b/extensions/edit_metadata/main.c
new file mode 100644
index 0000000..972bf3a
--- /dev/null
+++ b/extensions/edit_metadata/main.c
@@ -0,0 +1,58 @@
+/* -*- 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 <gtk/gtk.h>
+#include <gthumb.h>
+#include "callbacks.h"
+#include "gth-edit-comment-page.h"
+
+
+G_MODULE_EXPORT void
+gthumb_extension_activate (void)
+{
+	gth_main_register_type ("edit-metadata-dialog-page", GTH_TYPE_EDIT_COMMENT_PAGE);
+	gth_hook_add_callback ("gth-browser-construct", 5, G_CALLBACK (edit_metadata__gth_browser_construct_cb), NULL);
+	gth_hook_add_callback ("gth-browser-set-current-page", 5, G_CALLBACK (edit_metadata__gth_browser_set_current_page_cb), NULL);
+	gth_hook_add_callback ("gth-browser-update-sensitivity", 10, G_CALLBACK (edit_metadata__gth_browser_update_sensitivity_cb), NULL);
+
+}
+
+
+G_MODULE_EXPORT void
+gthumb_extension_deactivate (void)
+{
+}
+
+
+G_MODULE_EXPORT gboolean
+gthumb_extension_is_configurable (void)
+{
+	return FALSE;
+}
+
+
+G_MODULE_EXPORT void
+gthumb_extension_configure (GtkWindow *parent)
+{
+}
diff --git a/extensions/list_tools/callbacks.c b/extensions/list_tools/callbacks.c
index 4fce6c6..5f11013 100644
--- a/extensions/list_tools/callbacks.c
+++ b/extensions/list_tools/callbacks.c
@@ -242,7 +242,7 @@ list_tools__gth_browser_construct_cb (GthBrowser *browser)
 	gth_toggle_menu_tool_button_set_menu (GTH_TOGGLE_MENU_TOOL_BUTTON (tool_item), gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ListToolsPopup"));
 	gtk_tool_item_set_is_important (GTK_TOOL_ITEM (tool_item), TRUE);
 	gtk_widget_show (GTK_WIDGET (tool_item));
-	gtk_toolbar_insert (GTK_TOOLBAR (gth_browser_get_viewer_toolbar (browser)), tool_item, 9);
+	gtk_toolbar_insert (GTK_TOOLBAR (gth_browser_get_viewer_toolbar (browser)), tool_item, 11);
 
 	g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);
 
diff --git a/gthumb/Makefile.am b/gthumb/Makefile.am
index cce8a86..3ad027b 100644
--- a/gthumb/Makefile.am
+++ b/gthumb/Makefile.am
@@ -36,7 +36,6 @@ PUBLIC_HEADER_FILES = 					\
 	gth-cursors.h					\
 	gth-dumb-notebook.h				\
 	gth-duplicable.h				\
-	gth-edit-metadata-dialog.h			\
 	gth-embedded-dialog.h				\
 	gth-empty-list.h				\
 	gth-extensions.h				\
@@ -113,7 +112,6 @@ PUBLIC_HEADER_FILES = 					\
 	$(NULL)
 	
 PRIVATE_HEADER_FILES = 					\
-	dlg-edit-metadata.h				\
 	dlg-extensions.h				\
 	gth-browser-actions-callbacks.h			\
 	gth-browser-actions-entries.h			\
@@ -132,7 +130,6 @@ gthumb_SOURCES = 					\
 	$(EXTERNAL)					\
 	$(PUBLIC_HEADER_FILES)				\
 	$(PRIVATE_HEADER_FILES)				\
-	dlg-edit-metadata.c				\
 	dlg-extensions.c				\
 	dlg-personalize-filters.c			\
 	dlg-preferences.c				\
@@ -149,7 +146,6 @@ gthumb_SOURCES = 					\
 	gth-cursors.c					\
 	gth-dumb-notebook.c				\
 	gth-duplicable.c				\
-	gth-edit-metadata-dialog.c			\
 	gth-embedded-dialog.c				\
 	gth-empty-list.c				\
 	gth-error.c					\
diff --git a/gthumb/gth-browser-actions-callbacks.c b/gthumb/gth-browser-actions-callbacks.c
index 3b93761..d538c75 100644
--- a/gthumb/gth-browser-actions-callbacks.c
+++ b/gthumb/gth-browser-actions-callbacks.c
@@ -23,7 +23,6 @@
 #include <config.h>
 #include <glib/gi18n.h>
 #include "dlg-extensions.h"
-#include "dlg-edit-metadata.h"
 #include "dlg-personalize-filters.h"
 #include "dlg-preferences.h"
 #include "dlg-sort-order.h"
@@ -335,14 +334,6 @@ gth_browser_activate_action_viewer_tools (GtkAction  *action,
 
 
 void
-gth_browser_activate_action_edit_metadata (GtkAction  *action,
-				 	   GthBrowser *browser)
-{
-	dlg_edit_metadata (browser);
-}
-
-
-void
 gth_browser_activate_action_edit_select_all (GtkAction  *action,
 				 	     GthBrowser *browser)
 {
diff --git a/gthumb/gth-browser-actions-entries.h b/gthumb/gth-browser-actions-entries.h
index 620c6ba..355cec8 100644
--- a/gthumb/gth-browser-actions-entries.h
+++ b/gthumb/gth-browser-actions-entries.h
@@ -86,11 +86,6 @@ static GtkActionEntry gth_browser_action_entries[] = {
 	  NULL,
 	  G_CALLBACK (gth_browser_activate_action_edit_select_all) },
 
-	{ "Edit_Metadata", GTK_STOCK_EDIT,
-	  N_("Metadata"), "<control>M",
-	  N_("Edit file metadata"),
-	  G_CALLBACK (gth_browser_activate_action_edit_metadata) },
-
 	{ "View_Sort_By", NULL,
 	  N_("_Sort By..."), NULL,
 	  NULL,
diff --git a/gthumb/gth-browser-ui.h b/gthumb/gth-browser-ui.h
index 51c8971..3ca465c 100644
--- a/gthumb/gth-browser-ui.h
+++ b/gthumb/gth-browser-ui.h
@@ -107,6 +107,8 @@ static const char *fixed_ui_info =
 "    <placeholder name='SourceCommands'/>"
 "    <separator/>"
 "    <placeholder name='BrowserCommands'/>"
+"    <separator/>"
+"    <placeholder name='Edit_Actions'/>"
 "  </toolbar>"
 
 "  <toolbar name='ViewerToolBar'>"
@@ -117,7 +119,6 @@ static const char *fixed_ui_info =
 "    <separator/>"
 "    <placeholder name='ViewerCommands'/>"
 "    <separator/>"
-"    <toolitem action='Edit_Metadata'/>"
 "    <placeholder name='Edit_Actions'/>"
 "    <separator expand='true'/>"
 "    <placeholder name='ViewerCommandsSecondary'/>"
@@ -132,7 +133,7 @@ static const char *fixed_ui_info =
 "    <separator/>"
 "    <placeholder name='ViewerCommands'/>"
 "    <separator/>"
-"    <toolitem action='Edit_Metadata'/>"
+"    <placeholder name='Edit_Actions'/>"
 "    <separator expand='true'/>"
 "    <placeholder name='ViewerCommandsSecondary'/>"
 "    <toolitem action='Viewer_Properties'/>"
@@ -161,7 +162,7 @@ static const char *fixed_ui_info =
 "    <separator/>"
 "    <placeholder name='Folder_Actions2'/>"
 "    <separator/>"
-"    <menuitem action='Edit_Metadata'/>"
+"    <placeholder name='File_LastActions'/>"
 "  </popup>"
 
 "  <popup name='FilePopup'>"
@@ -177,7 +178,7 @@ static const char *fixed_ui_info =
 "    <separator/>"
 "    <placeholder name='Folder_Actions2'/>"
 "    <separator/>"
-"    <menuitem action='Edit_Metadata'/>"
+"    <placeholder name='File_LastActions'/>"
 "  </popup>"
 
 "  <popup name='FolderListPopup'>"
@@ -201,7 +202,6 @@ static const char *browser_ui_info =
 "        <menuitem action='Edit_SelectAll'/>"
 "      </placeholder>"
 "      <placeholder name='Edit_Actions'>"
-"        <menuitem action='Edit_Metadata'/>"
 "      </placeholder>"
 "    </menu>"
 "    <menu name='View' action='ViewMenu'>"
@@ -216,8 +216,6 @@ static const char *browser_ui_info =
 "  <toolbar name='ToolBar'>"
 "    <placeholder name='BrowserCommands'>"
 "      <toolitem action='View_Fullscreen'/>"
-"      <separator/>"
-"      <toolitem action='Edit_Metadata'/>"
 "    </placeholder>"
 "  </toolbar>"
 "</ui>";
@@ -226,13 +224,6 @@ static const char *browser_ui_info =
 static const char *viewer_ui_info =
 "<ui>"
 "  <menubar name='MenuBar'>"
-"    <menu name='File' action='FileMenu'>"
-"    </menu>"
-"    <menu name='Edit' action='EditMenu'>"
-"      <placeholder name='Edit_Actions'>"
-"        <menuitem action='Edit_Metadata'/>"
-"      </placeholder>"
-"    </menu>"
 "    <menu name='View' action='ViewMenu'>"
 "      <placeholder name='Folder_Actions'>"
 "        <menuitem action='View_BrowserMode'/>"
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index a596e21..8776c80 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -518,7 +518,6 @@ gth_browser_update_sensitivity (GthBrowser *browser)
 	_gth_browser_set_action_sensitive (browser, "View_Stop", browser->priv->fullscreen || (browser->priv->activity_ref > 0));
 	_gth_browser_set_action_sensitive (browser, "View_Prev", current_file_pos > 0);
 	_gth_browser_set_action_sensitive (browser, "View_Next", (current_file_pos != -1) && (current_file_pos < n_files - 1));
-	_gth_browser_set_action_sensitive (browser, "Edit_Metadata", n_selected == 1);
 
 	gth_sidebar_update_sensitivity (GTH_SIDEBAR (browser->priv->viewer_sidebar));
 	if (browser->priv->viewer_page != NULL)
@@ -3184,10 +3183,8 @@ _gth_browser_construct (GthBrowser *browser)
 
 	gtk_tool_item_set_is_important (GTK_TOOL_ITEM (gtk_ui_manager_get_widget (browser->priv->ui, "/ViewerToolBar/View_Prev")), TRUE);
 	gtk_tool_item_set_is_important (GTK_TOOL_ITEM (gtk_ui_manager_get_widget (browser->priv->ui, "/ViewerToolBar/View_Next")), TRUE);
-	gtk_tool_item_set_is_important (GTK_TOOL_ITEM (gtk_ui_manager_get_widget (browser->priv->ui, "/ViewerToolBar/Edit_Metadata")), TRUE);
 	gtk_tool_item_set_is_important (GTK_TOOL_ITEM (gtk_ui_manager_get_widget (browser->priv->ui, "/Fullscreen_ToolBar/View_Prev")), TRUE);
 	gtk_tool_item_set_is_important (GTK_TOOL_ITEM (gtk_ui_manager_get_widget (browser->priv->ui, "/Fullscreen_ToolBar/View_Next")), TRUE);
-	gtk_tool_item_set_is_important (GTK_TOOL_ITEM (gtk_ui_manager_get_widget (browser->priv->ui, "/Fullscreen_ToolBar/Edit_Metadata")), TRUE);
 
 	/* content */
 
diff --git a/gthumb/gth-file-properties.c b/gthumb/gth-file-properties.c
index 05aea95..77b1761 100644
--- a/gthumb/gth-file-properties.c
+++ b/gthumb/gth-file-properties.c
@@ -22,7 +22,6 @@
 
 #include <config.h>
 #include <glib/gi18n.h>
-#include "dlg-edit-metadata.h"
 #include "glib-utils.h"
 #include "gth-file-properties.h"
 #include "gth-main.h"
@@ -220,23 +219,12 @@ gth_file_properties_class_init (GthFilePropertiesClass *klass)
 
 
 static void
-edit_properties_clicked_cb (GtkButton *button,
-			    gpointer   user_data)
-{
-	GthFileProperties *file_properties = user_data;
-
-	dlg_edit_metadata (GTH_BROWSER (gtk_widget_get_toplevel (GTK_WIDGET (file_properties))));
-}
-
-
-static void
 gth_file_properties_init (GthFileProperties *file_properties)
 {
 	GtkWidget         *vpaned;
 	GtkWidget         *scrolled_win;
 	GtkCellRenderer   *renderer;
 	GtkTreeViewColumn *column;
-	GtkWidget         *button;
 
 	file_properties->priv = GTH_FILE_PROPERTIES_GET_PRIVATE (file_properties);
 
@@ -322,17 +310,6 @@ gth_file_properties_init (GthFileProperties *file_properties)
 	gtk_widget_set_size_request (file_properties->priv->comment_view, -1, COMMENT_HEIGHT);
 	gtk_widget_show (file_properties->priv->comment_view);
 	gtk_container_add (GTK_CONTAINER (file_properties->priv->comment_win), file_properties->priv->comment_view);
-
-	/* edit button */
-
-	button = gtk_button_new_from_stock (GTK_STOCK_EDIT);
-	/*gtk_widget_show (button); FIXME */
-	gtk_box_pack_start (GTK_BOX (file_properties), button, FALSE, FALSE, 0);
-
-	g_signal_connect (button,
-			  "clicked",
-			  G_CALLBACK (edit_properties_clicked_cb),
-			  file_properties);
 }
 
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 530a6ae..f7db1d2 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -48,11 +48,8 @@ extensions/catalogs/gth-organize-task.c
 extensions/catalogs/gth-organize-task.h
 extensions/catalogs/main.c
 extensions/comments/comments.extension.in.in
-[type: gettext/glade]extensions/comments/data/ui/edit-comment-page.ui
 extensions/comments/gth-comment.c
 extensions/comments/gth-comment.h
-extensions/comments/gth-edit-comment-page.c
-extensions/comments/gth-edit-comment-page.h
 extensions/comments/gth-metadata-provider-comment.c
 extensions/comments/gth-metadata-provider-comment.h
 extensions/comments/gth-test-category.c
@@ -64,6 +61,19 @@ extensions/desktop_background/callbacks.c
 extensions/desktop_background/callbacks.h
 extensions/desktop_background/desktop_background.extension.in.in
 extensions/desktop_background/main.c
+extensions/edit_metadata/actions.c
+extensions/edit_metadata/actions.h
+extensions/edit_metadata/callbacks.c
+extensions/edit_metadata/callbacks.h
+[type: gettext/glade]extensions/edit_metadata/data/ui/edit-comment-page.ui
+extensions/edit_metadata/dlg-edit-metadata.c
+extensions/edit_metadata/dlg-edit-metadata.h
+extensions/edit_metadata/edit_metadata.extension.in.in
+extensions/edit_metadata/gth-edit-comment-page.c
+extensions/edit_metadata/gth-edit-comment-page.h
+extensions/edit_metadata/gth-edit-metadata-dialog.c
+extensions/edit_metadata/gth-edit-metadata-dialog.h
+extensions/edit_metadata/main.c
 extensions/exiv2/exiv2.extension.in.in
 extensions/exiv2/exiv2-utils.cpp
 extensions/exiv2/exiv2-utils.h
@@ -289,8 +299,6 @@ extensions/slideshow/main.c
 extensions/slideshow/preferences.c
 extensions/slideshow/preferences.h
 extensions/slideshow/slideshow.extension.in.in
-gthumb/dlg-edit-metadata.c
-gthumb/dlg-edit-metadata.h
 gthumb/dlg-extensions.c
 gthumb/dlg-extensions.h
 gthumb/dlg-personalize-filters.c
@@ -333,8 +341,6 @@ gthumb/gth-dumb-notebook.c
 gthumb/gth-dumb-notebook.h
 gthumb/gth-duplicable.c
 gthumb/gth-duplicable.h
-gthumb/gth-edit-metadata-dialog.c
-gthumb/gth-edit-metadata-dialog.h
 gthumb/gth-embedded-dialog.c
 gthumb/gth-embedded-dialog.h
 gthumb/gth-empty-list.c



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