[gthumb/ext] [file tool] added the "save as" command



commit a9bc442f2acdda670ae08c796a89924d3168cc52
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Fri Sep 11 13:43:54 2009 +0200

    [file tool] added the "save as" command

 extensions/file_tools/Makefile.am             |    2 +
 extensions/file_tools/gth-file-tool-save-as.c |   84 +++++++++++++++++++++++++
 extensions/file_tools/gth-file-tool-save-as.h |   52 +++++++++++++++
 extensions/file_tools/main.c                  |    4 +-
 4 files changed, 141 insertions(+), 1 deletions(-)
---
diff --git a/extensions/file_tools/Makefile.am b/extensions/file_tools/Makefile.am
index 276897b..fbe3d19 100644
--- a/extensions/file_tools/Makefile.am
+++ b/extensions/file_tools/Makefile.am
@@ -16,6 +16,8 @@ libfile_tools_la_SOURCES = 		\
 	gth-file-tool-redo.h		\
 	gth-file-tool-save.c		\
 	gth-file-tool-save.h		\
+	gth-file-tool-save-as.c		\
+	gth-file-tool-save-as.h		\
 	gth-file-tool-undo.c		\
 	gth-file-tool-undo.h		\
 	main.c
diff --git a/extensions/file_tools/gth-file-tool-save-as.c b/extensions/file_tools/gth-file-tool-save-as.c
new file mode 100644
index 0000000..07ab5ba
--- /dev/null
+++ b/extensions/file_tools/gth-file-tool-save-as.c
@@ -0,0 +1,84 @@
+/* -*- 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 <gthumb.h>
+#include "gth-file-tool-save-as.h"
+
+
+static void
+gth_file_tool_save_as_update_sensitivity (GthFileTool *base)
+{
+	GtkWidget *window;
+
+	window = gth_file_tool_get_window (base);
+	gtk_widget_set_sensitive (GTK_WIDGET (base), gth_browser_get_file_modified (GTH_BROWSER (window)));
+}
+
+
+static void
+gth_file_tool_save_as_activate (GthFileTool *tool)
+{
+	GtkWidget *window;
+	GtkWidget *viewer_page;
+
+	window = gth_file_tool_get_window (tool);
+	viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
+	gth_viewer_page_save_as (GTH_VIEWER_PAGE (viewer_page), NULL, NULL);
+}
+
+
+static void
+gth_file_tool_save_as_instance_init (GthFileToolSaveAs *self)
+{
+	gth_file_tool_construct (GTH_FILE_TOOL (self), GTK_STOCK_SAVE_AS, _("Save As"), NULL, FALSE);
+}
+
+
+static void
+gth_file_tool_save_as_class_init (GthFileToolClass *klass)
+{
+	klass->update_sensitivity = gth_file_tool_save_as_update_sensitivity;
+	klass->activate = gth_file_tool_save_as_activate;
+}
+
+
+GType
+gth_file_tool_save_as_get_type (void) {
+	static GType type_id = 0;
+	if (type_id == 0) {
+		static const GTypeInfo g_define_type_info = {
+			sizeof (GthFileToolSaveAsClass),
+			(GBaseInitFunc) NULL,
+			(GBaseFinalizeFunc) NULL,
+			(GClassInitFunc) gth_file_tool_save_as_class_init,
+			(GClassFinalizeFunc) NULL,
+			NULL,
+			sizeof (GthFileToolSaveAs),
+			0,
+			(GInstanceInitFunc) gth_file_tool_save_as_instance_init,
+			NULL
+		};
+		type_id = g_type_register_static (GTH_TYPE_FILE_TOOL, "GthFileToolSaveAs", &g_define_type_info, 0);
+	}
+	return type_id;
+}
diff --git a/extensions/file_tools/gth-file-tool-save-as.h b/extensions/file_tools/gth-file-tool-save-as.h
new file mode 100644
index 0000000..5f47c51
--- /dev/null
+++ b/extensions/file_tools/gth-file-tool-save-as.h
@@ -0,0 +1,52 @@
+/* -*- 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_FILE_TOOL_SAVE_AS_H
+#define GTH_FILE_TOOL_SAVE_AS_H
+
+#include <gthumb.h>
+
+G_BEGIN_DECLS
+
+#define GTH_TYPE_FILE_TOOL_SAVE_AS (gth_file_tool_save_as_get_type ())
+#define GTH_FILE_TOOL_SAVE_AS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_FILE_TOOL_SAVE_AS, GthFileToolSaveAs))
+#define GTH_FILE_TOOL_SAVE_AS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTH_TYPE_FILE_TOOL_SAVE_AS, GthFileToolSaveAsClass))
+#define GTH_IS_FILE_TOOL_SAVE_AS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTH_TYPE_FILE_TOOL_SAVE_AS))
+#define GTH_IS_FILE_TOOL_SAVE_AS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTH_TYPE_FILE_TOOL_SAVE_AS))
+#define GTH_FILE_TOOL_SAVE_AS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTH_TYPE_FILE_TOOL_SAVE_AS, GthFileToolSaveAsClass))
+
+typedef struct _GthFileToolSaveAs GthFileToolSaveAs;
+typedef struct _GthFileToolSaveAsClass GthFileToolSaveAsClass;
+
+struct _GthFileToolSaveAs {
+	GthFileTool parent_instance;
+};
+
+struct _GthFileToolSaveAsClass {
+	GthFileToolClass parent_class;
+};
+
+GType  gth_file_tool_save_as_get_type  (void);
+
+G_END_DECLS
+
+#endif /* GTH_FILE_TOOL_SAVE_AS_H */
diff --git a/extensions/file_tools/main.c b/extensions/file_tools/main.c
index 8a34fde..8c3f75e 100644
--- a/extensions/file_tools/main.c
+++ b/extensions/file_tools/main.c
@@ -30,15 +30,17 @@
 #include "gth-file-tool-equalize.h"
 #include "gth-file-tool-redo.h"
 #include "gth-file-tool-save.h"
+#include "gth-file-tool-save-as.h"
 #include "gth-file-tool-undo.h"
 
 
 G_MODULE_EXPORT void
 gthumb_extension_activate (void)
 {
+	gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_SAVE);
+	gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_SAVE_AS);
 	gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_UNDO);
 	gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_REDO);
-	gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_SAVE);
 	gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_CROP);
 	gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_DESATURATE);
 	gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_ENHANCE);



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