[gimp: 9/27] app: Introduce and use GimpFileChooserAction



commit 3025dac65379c6e37aded06369208e1750a8862c
Author: Martin Nordholts <martinn src gnome org>
Date:   Fri Apr 24 07:36:41 2009 +0200

    app: Introduce and use GimpFileChooserAction
    
    Introduce and use GimpFileChooserAction in the core so that we can
    differentiate Save from Export later.
---
 app/dialogs/file-open-dialog.c |    2 +-
 app/dialogs/file-save-dialog.c |    2 +-
 app/widgets/gimpfiledialog.c   |   31 +++++++++++++++++--------------
 app/widgets/gimpfiledialog.h   |    2 +-
 app/widgets/widgets-enums.h    |    7 +++++++
 5 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/app/dialogs/file-open-dialog.c b/app/dialogs/file-open-dialog.c
index 8e12c0a..e523c84 100644
--- a/app/dialogs/file-open-dialog.c
+++ b/app/dialogs/file-open-dialog.c
@@ -73,7 +73,7 @@ file_open_dialog_new (Gimp *gimp)
   g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
 
   dialog = gimp_file_dialog_new (gimp,
-                                 GTK_FILE_CHOOSER_ACTION_OPEN,
+                                 GIMP_FILE_CHOOSER_ACTION_OPEN,
                                  _("Open Image"), "gimp-file-open",
                                  GTK_STOCK_OPEN,
                                  GIMP_HELP_FILE_OPEN);
diff --git a/app/dialogs/file-save-dialog.c b/app/dialogs/file-save-dialog.c
index 2f2606e..60c3890 100644
--- a/app/dialogs/file-save-dialog.c
+++ b/app/dialogs/file-save-dialog.c
@@ -87,7 +87,7 @@ file_save_dialog_new (Gimp *gimp)
   g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
 
   dialog = gimp_file_dialog_new (gimp,
-                                 GTK_FILE_CHOOSER_ACTION_SAVE,
+                                 GIMP_FILE_CHOOSER_ACTION_SAVE,
                                  _("Save Image"), "gimp-file-save",
                                  GTK_STOCK_SAVE,
                                  GIMP_HELP_FILE_SAVE);
diff --git a/app/widgets/gimpfiledialog.c b/app/widgets/gimpfiledialog.c
index 9310f94..e7244e3 100644
--- a/app/widgets/gimpfiledialog.c
+++ b/app/widgets/gimpfiledialog.c
@@ -286,18 +286,19 @@ gimp_file_dialog_progress_get_window (GimpProgress *progress)
 /*  public functions  */
 
 GtkWidget *
-gimp_file_dialog_new (Gimp                 *gimp,
-                      GtkFileChooserAction  action,
-                      const gchar          *title,
-                      const gchar          *role,
-                      const gchar          *stock_id,
-                      const gchar          *help_id)
-{
-  GimpFileDialog *dialog;
-  GSList         *file_procs;
-  const gchar    *automatic;
-  const gchar    *automatic_help_id;
-  gboolean        local_only;
+gimp_file_dialog_new (Gimp                  *gimp,
+                      GimpFileChooserAction  action,
+                      const gchar           *title,
+                      const gchar           *role,
+                      const gchar           *stock_id,
+                      const gchar           *help_id)
+{
+  GimpFileDialog       *dialog;
+  GSList               *file_procs;
+  const gchar          *automatic;
+  const gchar          *automatic_help_id;
+  gboolean              local_only;
+  GtkFileChooserAction  gtk_action;
 
   g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
   g_return_val_if_fail (title != NULL, NULL);
@@ -307,7 +308,8 @@ gimp_file_dialog_new (Gimp                 *gimp,
 
   switch (action)
     {
-    case GTK_FILE_CHOOSER_ACTION_OPEN:
+    case GIMP_FILE_CHOOSER_ACTION_OPEN:
+      gtk_action = GTK_FILE_CHOOSER_ACTION_OPEN;
       file_procs = gimp->plug_in_manager->load_procs;
       automatic  = _("Automatically Detected");
       automatic_help_id = GIMP_HELP_FILE_OPEN_BY_EXTENSION;
@@ -317,7 +319,8 @@ gimp_file_dialog_new (Gimp                 *gimp,
                                                "file-uri-load") == NULL);
       break;
 
-    case GTK_FILE_CHOOSER_ACTION_SAVE:
+    case GIMP_FILE_CHOOSER_ACTION_SAVE:
+      gtk_action = GTK_FILE_CHOOSER_ACTION_SAVE;
       file_procs = gimp->plug_in_manager->save_procs;
       automatic  = _("By Extension");
       automatic_help_id = GIMP_HELP_FILE_SAVE_BY_EXTENSION;
@@ -335,7 +338,7 @@ gimp_file_dialog_new (Gimp                 *gimp,
   dialog = g_object_new (GIMP_TYPE_FILE_DIALOG,
                          "title",                     title,
                          "role",                      role,
-                         "action",                    action,
+                         "action",                    gtk_action,
                          "local-only",                local_only,
                          "do-overwrite-confirmation", TRUE,
                          NULL);
diff --git a/app/widgets/gimpfiledialog.h b/app/widgets/gimpfiledialog.h
index 391bdaf..34c6d1a 100644
--- a/app/widgets/gimpfiledialog.h
+++ b/app/widgets/gimpfiledialog.h
@@ -66,7 +66,7 @@ typedef struct _GimpFileDialogState GimpFileDialogState;
 GType       gimp_file_dialog_get_type       (void) G_GNUC_CONST;
 
 GtkWidget * gimp_file_dialog_new            (Gimp                 *gimp,
-                                             GtkFileChooserAction  action,
+                                             GimpFileChooserAction action,
                                              const gchar          *title,
                                              const gchar          *role,
                                              const gchar          *stock_id,
diff --git a/app/widgets/widgets-enums.h b/app/widgets/widgets-enums.h
index bdcd93b..13df471 100644
--- a/app/widgets/widgets-enums.h
+++ b/app/widgets/widgets-enums.h
@@ -307,5 +307,12 @@ typedef enum  /*< skip >*/
   GIMP_DEVICE_VALUE_GRADIENT   = 1 << 8
 } GimpDeviceValues;
 
+typedef enum  /*< skip >*/
+{
+  GIMP_FILE_CHOOSER_ACTION_OPEN,
+  GIMP_FILE_CHOOSER_ACTION_SAVE,
+  GIMP_FILE_CHOOSER_ACTION_EXPORT
+} GimpFileChooserAction;
+
 
 #endif /* __WIDGETS_ENUMS_H__ */



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