[gimp: 11/27] app: Show the Export Image dialog on File -> Export...
- From: Martin Nordholts <martinn src gnome org>
- To: svn-commits-list gnome org
- Subject: [gimp: 11/27] app: Show the Export Image dialog on File -> Export...
- Date: Sat, 16 May 2009 07:25:17 -0400 (EDT)
commit 10226ae4531407de438d9c0d66a2d244eb1a4f07
Author: Martin Nordholts <martinn src gnome org>
Date: Sat Apr 25 10:54:56 2009 +0200
app: Show the Export Image dialog on File -> Export...
Create a export dialog constructor in the dialog factory and invoke it
on File -> Export
---
app/actions/file-commands.c | 59 ++++++++++++++++++++++++++++++++++++
app/dialogs/dialogs-constructors.c | 8 +++++
app/dialogs/dialogs-constructors.h | 3 ++
app/dialogs/dialogs.c | 2 +
4 files changed, 72 insertions(+), 0 deletions(-)
diff --git a/app/actions/file-commands.c b/app/actions/file-commands.c
index 88ad264..b2c5839 100644
--- a/app/actions/file-commands.c
+++ b/app/actions/file-commands.c
@@ -78,8 +78,13 @@ static void file_save_dialog_show (Gimp *gimp,
const gchar *title,
gboolean save_a_copy,
gboolean close_after_saving);
+static void file_export_dialog_show (Gimp *gimp,
+ GimpImage *image,
+ GtkWidget *parent);
static void file_save_dialog_destroyed (GtkWidget *dialog,
GimpImage *image);
+static void file_export_dialog_destroyed (GtkWidget *dialog,
+ GimpImage *image);
static void file_new_template_callback (GtkWidget *widget,
const gchar *name,
gpointer data);
@@ -274,6 +279,9 @@ file_save_cmd_callback (GtkAction *action,
break;
case GIMP_SAVE_MODE_EXPORT:
+ file_export_dialog_show (gimp, display->image, widget);
+ break;
+
case GIMP_SAVE_MODE_EXPORT_TO:
/* TODO */
break;
@@ -529,6 +537,57 @@ file_save_dialog_destroyed (GtkWidget *dialog,
}
static void
+file_export_dialog_show (Gimp *gimp,
+ GimpImage *image,
+ GtkWidget *parent)
+{
+ GtkWidget *dialog;
+
+ dialog = g_object_get_data (G_OBJECT (image), "gimp-file-export-dialog");
+
+ if (! dialog)
+ {
+ dialog = gimp_dialog_factory_dialog_new (global_dialog_factory,
+ gtk_widget_get_screen (parent),
+ "gimp-file-export-dialog",
+ -1, FALSE);
+
+ if (dialog)
+ {
+ gtk_window_set_transient_for (GTK_WINDOW (dialog),
+ GTK_WINDOW (parent));
+
+ g_object_set_data_full (G_OBJECT (image),
+ "gimp-file-export-dialog", dialog,
+ (GDestroyNotify) gtk_widget_destroy);
+ g_signal_connect (dialog, "destroy",
+ G_CALLBACK (file_export_dialog_destroyed),
+ image);
+ }
+ }
+
+ if (dialog)
+ {
+ gimp_file_dialog_set_save_image (GIMP_FILE_DIALOG (dialog),
+ gimp,
+ image,
+ FALSE,
+ TRUE,
+ FALSE);
+
+ gtk_window_present (GTK_WINDOW (dialog));
+ }
+}
+
+static void
+file_export_dialog_destroyed (GtkWidget *dialog,
+ GimpImage *image)
+{
+ if (GIMP_FILE_DIALOG (dialog)->image == image)
+ g_object_set_data (G_OBJECT (image), "gimp-file-export-dialog", NULL);
+}
+
+static void
file_new_template_callback (GtkWidget *widget,
const gchar *name,
gpointer data)
diff --git a/app/dialogs/dialogs-constructors.c b/app/dialogs/dialogs-constructors.c
index 329d3cb..6aa75b8 100644
--- a/app/dialogs/dialogs-constructors.c
+++ b/app/dialogs/dialogs-constructors.c
@@ -129,6 +129,14 @@ dialogs_file_save_new (GimpDialogFactory *factory,
}
GtkWidget *
+dialogs_file_export_new (GimpDialogFactory *factory,
+ GimpContext *context,
+ gint view_size)
+{
+ return file_save_dialog_new (context->gimp, TRUE);
+}
+
+GtkWidget *
dialogs_preferences_get (GimpDialogFactory *factory,
GimpContext *context,
gint view_size)
diff --git a/app/dialogs/dialogs-constructors.h b/app/dialogs/dialogs-constructors.h
index 730b3e4..9747162 100644
--- a/app/dialogs/dialogs-constructors.h
+++ b/app/dialogs/dialogs-constructors.h
@@ -33,6 +33,9 @@ GtkWidget * dialogs_file_open_location_new (GimpDialogFactory *factory,
GtkWidget * dialogs_file_save_new (GimpDialogFactory *factory,
GimpContext *context,
gint view_size);
+GtkWidget * dialogs_file_export_new (GimpDialogFactory *factory,
+ GimpContext *context,
+ gint view_size);
GtkWidget * dialogs_preferences_get (GimpDialogFactory *factory,
GimpContext *context,
gint view_size);
diff --git a/app/dialogs/dialogs.c b/app/dialogs/dialogs.c
index 0d17782..2c0d786 100644
--- a/app/dialogs/dialogs.c
+++ b/app/dialogs/dialogs.c
@@ -96,6 +96,8 @@ static const GimpDialogFactoryEntry toplevel_entries[] =
dialogs_file_open_location_new, FALSE, TRUE, FALSE),
TOPLEVEL ("gimp-file-save-dialog",
dialogs_file_save_new, FALSE, TRUE, TRUE),
+ TOPLEVEL ("gimp-file-export-dialog",
+ dialogs_file_export_new, FALSE, TRUE, TRUE),
/* singleton toplevels */
TOPLEVEL ("gimp-preferences-dialog",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]