[gimp] app: some formatting cleanup in the file dialog widgets



commit eee29e6793228913592b9edc3bcd04c8376ab9f0
Author: Michael Natterer <mitch gimp org>
Date:   Wed Jan 6 14:10:36 2016 +0100

    app: some formatting cleanup in the file dialog widgets
    
    and remove "Gimp*" parameter from gimp_save,export_dialog_set_image(),
    the dialog already knows its Gimp.

 app/actions/file-commands.c    |    5 +--
 app/widgets/gimpexportdialog.c |   15 ++++--------
 app/widgets/gimpexportdialog.h |   11 ++++-----
 app/widgets/gimpfiledialog.c   |   47 +++++++++++++++++++++++++--------------
 app/widgets/gimpfiledialog.h   |   30 ++++++++++++------------
 app/widgets/gimpopendialog.h   |   12 +++++-----
 app/widgets/gimpsavedialog.c   |   38 +++++++++++++++-----------------
 app/widgets/gimpsavedialog.h   |   17 ++++++-------
 8 files changed, 89 insertions(+), 86 deletions(-)
---
diff --git a/app/actions/file-commands.c b/app/actions/file-commands.c
index 7f261f3..9b71bba 100644
--- a/app/actions/file-commands.c
+++ b/app/actions/file-commands.c
@@ -671,7 +671,7 @@ file_save_dialog_show (Gimp        *gimp,
       gtk_window_set_title (GTK_WINDOW (dialog), title);
 
       gimp_save_dialog_set_image (GIMP_SAVE_DIALOG (dialog),
-                                  gimp, image, save_a_copy,
+                                  image, save_a_copy,
                                   close_after_saving, GIMP_OBJECT (display));
 
       gtk_window_present (GTK_WINDOW (dialog));
@@ -758,8 +758,7 @@ file_export_dialog_show (Gimp      *gimp,
 
   if (dialog)
     {
-      gimp_export_dialog_set_image (GIMP_EXPORT_DIALOG (dialog),
-                                    gimp, image);
+      gimp_export_dialog_set_image (GIMP_EXPORT_DIALOG (dialog), image);
 
       gtk_window_present (GTK_WINDOW (dialog));
     }
diff --git a/app/widgets/gimpexportdialog.c b/app/widgets/gimpexportdialog.c
index 5cb5143..ba8c68c 100644
--- a/app/widgets/gimpexportdialog.c
+++ b/app/widgets/gimpexportdialog.c
@@ -20,8 +20,6 @@
 
 #include "config.h"
 
-#include <string.h>
-
 #include <gegl.h>
 #include <gtk/gtk.h>
 
@@ -36,8 +34,6 @@
 
 #include "file/gimp-file.h"
 
-#include "pdb/gimppdb.h"
-
 #include "plug-in/gimppluginmanager.h"
 
 #include "gimpexportdialog.h"
@@ -96,7 +92,6 @@ gimp_export_dialog_new (Gimp *gimp)
 
 void
 gimp_export_dialog_set_image (GimpExportDialog *dialog,
-                              Gimp             *gimp,
                               GimpImage        *image)
 {
   GimpFileDialog *file_dialog;
@@ -114,8 +109,7 @@ gimp_export_dialog_set_image (GimpExportDialog *dialog,
 
   gimp_file_dialog_set_file_proc (file_dialog, NULL);
 
-  /*
-   * Priority of default paths for Export:
+  /* Priority of default paths for Export:
    *
    *   1. Last Export path
    *   2. Path of import source
@@ -138,11 +132,11 @@ gimp_export_dialog_set_image (GimpExportDialog *dialog,
     dir_file = gimp_image_get_file (image);
 
   if (! dir_file)
-    dir_file = g_object_get_data (G_OBJECT (gimp),
+    dir_file = g_object_get_data (G_OBJECT (file_dialog->gimp),
                                   GIMP_FILE_SAVE_LAST_FILE_KEY);
 
   if (! dir_file)
-    dir_file = g_object_get_data (G_OBJECT (gimp),
+    dir_file = g_object_get_data (G_OBJECT (file_dialog->gimp),
                                   GIMP_FILE_EXPORT_LAST_FILE_KEY);
 
   if (! dir_file)
@@ -175,13 +169,14 @@ gimp_export_dialog_set_image (GimpExportDialog *dialog,
    *   3. Type of latest Export of any document
    *   4. .png
    */
+
   ext_file = gimp_image_get_exported_file (image);
 
   if (! ext_file)
     ext_file = gimp_image_get_imported_file (image);
 
   if (! ext_file)
-    ext_file = g_object_get_data (G_OBJECT (gimp),
+    ext_file = g_object_get_data (G_OBJECT (file_dialog->gimp),
                                   GIMP_FILE_EXPORT_LAST_FILE_KEY);
 
   if (ext_file)
diff --git a/app/widgets/gimpexportdialog.h b/app/widgets/gimpexportdialog.h
index 1280c74..a937a9f 100644
--- a/app/widgets/gimpexportdialog.h
+++ b/app/widgets/gimpexportdialog.h
@@ -33,7 +33,7 @@ G_BEGIN_DECLS
 #define GIMP_EXPORT_DIALOG_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_EXPORT_DIALOG, 
GimpExportDialogClass))
 
 
-typedef struct _GimpExportDialogClass  GimpExportDialogClass;
+typedef struct _GimpExportDialogClass GimpExportDialogClass;
 
 struct _GimpExportDialog
 {
@@ -46,13 +46,12 @@ struct _GimpExportDialogClass
 };
 
 
-GType       gimp_export_dialog_get_type         (void) G_GNUC_CONST;
+GType       gimp_export_dialog_get_type  (void) G_GNUC_CONST;
 
-GtkWidget * gimp_export_dialog_new              (Gimp                 *gimp);
+GtkWidget * gimp_export_dialog_new       (Gimp             *gimp);
 
-void        gimp_export_dialog_set_image        (GimpExportDialog      *dialog,
-                                                 Gimp                  *gimp,
-                                                 GimpImage             *image);
+void        gimp_export_dialog_set_image (GimpExportDialog *dialog,
+                                          GimpImage        *image);
 
 G_END_DECLS
 
diff --git a/app/widgets/gimpfiledialog.c b/app/widgets/gimpfiledialog.c
index 3b3a7c8..52ca211 100644
--- a/app/widgets/gimpfiledialog.c
+++ b/app/widgets/gimpfiledialog.c
@@ -178,6 +178,7 @@ gimp_file_dialog_class_init (GimpFileDialogClass *klass)
                                                         GIMP_TYPE_GIMP,
                                                         GIMP_PARAM_READWRITE |
                                                         G_PARAM_CONSTRUCT_ONLY));
+
   g_object_class_install_property (object_class, PROP_HELP_ID,
                                    g_param_spec_string ("help-id", NULL, NULL,
                                                         NULL,
@@ -187,32 +188,41 @@ gimp_file_dialog_class_init (GimpFileDialogClass *klass)
   g_object_class_install_property (object_class, PROP_STOCK_ID,
                                    g_param_spec_string ("stock-id", NULL, NULL,
                                                         NULL,
-                                                        GIMP_PARAM_READWRITE |
+                                                        GIMP_PARAM_READABLE |
                                                         G_PARAM_CONSTRUCT_ONLY));
+
   g_object_class_install_property (object_class, PROP_AUTOMATIC_HELP_ID,
-                                   g_param_spec_string ("automatic-help-id", NULL, NULL,
+                                   g_param_spec_string ("automatic-help-id",
+                                                        NULL, NULL,
                                                         NULL,
-                                                        GIMP_PARAM_READWRITE |
+                                                        GIMP_PARAM_READABLE |
                                                         G_PARAM_CONSTRUCT_ONLY));
+
   g_object_class_install_property (object_class, PROP_AUTOMATIC_LABEL,
-                                   g_param_spec_string ("automatic-label", NULL, NULL,
+                                   g_param_spec_string ("automatic-label",
+                                                        NULL, NULL,
                                                         NULL,
-                                                        GIMP_PARAM_READWRITE |
+                                                        GIMP_PARAM_READABLE |
                                                         G_PARAM_CONSTRUCT_ONLY));
 
   g_object_class_install_property (object_class, PROP_FILE_FILTER_LABEL,
-                                   g_param_spec_string ("file-filter-label", NULL, NULL,
+                                   g_param_spec_string ("file-filter-label",
+                                                        NULL, NULL,
                                                         NULL,
-                                                        GIMP_PARAM_READWRITE |
+                                                        GIMP_PARAM_READABLE |
                                                         G_PARAM_CONSTRUCT_ONLY));
+
   g_object_class_install_property (object_class, PROP_FILE_PROCS,
-                                   g_param_spec_pointer ("file-procs", NULL, NULL,
-                                                        GIMP_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT_ONLY));
+                                   g_param_spec_pointer ("file-procs",
+                                                         NULL, NULL,
+                                                         GIMP_PARAM_READABLE |
+                                                         G_PARAM_CONSTRUCT_ONLY));
+
   g_object_class_install_property (object_class, PROP_FILE_PROCS_ALL_IMAGES,
-                                   g_param_spec_pointer ("file-procs-all-images", NULL, NULL,
-                                                        GIMP_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT_ONLY));
+                                   g_param_spec_pointer ("file-procs-all-images",
+                                                         NULL, NULL,
+                                                         GIMP_PARAM_READABLE |
+                                                         G_PARAM_CONSTRUCT_ONLY));
 }
 
 static void
@@ -240,7 +250,7 @@ gimp_file_dialog_set_property (GObject      *object,
                                const GValue *value,
                                GParamSpec   *pspec)
 {
-  GimpFileDialog        *dialog  = GIMP_FILE_DIALOG (object);
+  GimpFileDialog *dialog = GIMP_FILE_DIALOG (object);
 
   switch (property_id)
     {
@@ -281,7 +291,7 @@ gimp_file_dialog_get_property (GObject    *object,
                                GValue     *value,
                                GParamSpec *pspec)
 {
-  GimpFileDialog        *dialog  = GIMP_FILE_DIALOG (object);
+  GimpFileDialog *dialog = GIMP_FILE_DIALOG (object);
 
   switch (property_id)
     {
@@ -453,10 +463,12 @@ gimp_file_dialog_real_get_default_folder (GimpFileDialog *dialog)
           file = g_file_new_for_path (path);
           g_free (path);
 
-          g_object_set_data_full (G_OBJECT (dialog->gimp), "gimp-documents-folder",
+          g_object_set_data_full (G_OBJECT (dialog->gimp),
+                                  "gimp-documents-folder",
                                   file, (GDestroyNotify) g_object_unref);
         }
     }
+
   return file;
 }
 
@@ -881,7 +893,8 @@ gimp_file_dialog_add_proc_selection (GimpFileDialog *dialog)
 
   gtk_widget_set_size_request (scrolled_window, -1, 200);
 
-  dialog->proc_view = gimp_file_proc_view_new (dialog->gimp, dialog->file_procs,
+  dialog->proc_view = gimp_file_proc_view_new (dialog->gimp,
+                                               dialog->file_procs,
                                                dialog->automatic_label,
                                                dialog->automatic_help_id);
   gtk_container_add (GTK_CONTAINER (scrolled_window), dialog->proc_view);
diff --git a/app/widgets/gimpfiledialog.h b/app/widgets/gimpfiledialog.h
index 1b4e6ad..9108926 100644
--- a/app/widgets/gimpfiledialog.h
+++ b/app/widgets/gimpfiledialog.h
@@ -75,26 +75,26 @@ struct _GimpFileDialogClass
 };
 
 
-GType       gimp_file_dialog_get_type           (void) G_GNUC_CONST;
+GType   gimp_file_dialog_get_type           (void) G_GNUC_CONST;
 
-void        gimp_file_dialog_add_extra_widget   (GimpFileDialog       *dialog,
-                                                 GtkWidget            *widget,
-                                                 gboolean              expand,
-                                                 gboolean              fill,
-                                                 guint                 padding);
+void    gimp_file_dialog_add_extra_widget   (GimpFileDialog      *dialog,
+                                             GtkWidget           *widget,
+                                             gboolean             expand,
+                                             gboolean             fill,
+                                             guint                padding);
 
-void        gimp_file_dialog_set_sensitive      (GimpFileDialog       *dialog,
-                                                 gboolean              sensitive);
+void    gimp_file_dialog_set_sensitive      (GimpFileDialog      *dialog,
+                                             gboolean             sensitive);
 
-void        gimp_file_dialog_set_file_proc      (GimpFileDialog       *dialog,
-                                                 GimpPlugInProcedure  *file_proc);
+void    gimp_file_dialog_set_file_proc      (GimpFileDialog      *dialog,
+                                             GimpPlugInProcedure *file_proc);
 
-GFile     * gimp_file_dialog_get_default_folder (GimpFileDialog       *dialog);
+GFile * gimp_file_dialog_get_default_folder (GimpFileDialog      *dialog);
 
-void        gimp_file_dialog_save_state         (GimpFileDialog       *dialog,
-                                                 const gchar          *state_name);
-void        gimp_file_dialog_load_state         (GimpFileDialog       *dialog,
-                                                 const gchar          *state_name);
+void    gimp_file_dialog_save_state         (GimpFileDialog      *dialog,
+                                             const gchar         *state_name);
+void    gimp_file_dialog_load_state         (GimpFileDialog      *dialog,
+                                             const gchar         *state_name);
 
 
 G_END_DECLS
diff --git a/app/widgets/gimpopendialog.h b/app/widgets/gimpopendialog.h
index 8a1c246..7b35d41 100644
--- a/app/widgets/gimpopendialog.h
+++ b/app/widgets/gimpopendialog.h
@@ -31,7 +31,7 @@ G_BEGIN_DECLS
 #define GIMP_OPEN_DIALOG_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPEN_DIALOG, 
GimpOpenDialogClass))
 
 
-typedef struct _GimpOpenDialogClass  GimpOpenDialogClass;
+typedef struct _GimpOpenDialogClass GimpOpenDialogClass;
 
 struct _GimpOpenDialog
 {
@@ -46,13 +46,13 @@ struct _GimpOpenDialogClass
 };
 
 
-GType       gimp_open_dialog_get_type       (void) G_GNUC_CONST;
+GType       gimp_open_dialog_get_type   (void) G_GNUC_CONST;
 
-GtkWidget * gimp_open_dialog_new            (Gimp                 *gimp);
+GtkWidget * gimp_open_dialog_new        (Gimp           *gimp);
 
-void        gimp_open_dialog_set_image      (GimpOpenDialog       *dialog,
-                                             GimpImage            *image,
-                                             gboolean              open_as_layers);
+void        gimp_open_dialog_set_image  (GimpOpenDialog *dialog,
+                                         GimpImage      *image,
+                                         gboolean        open_as_layers);
 
 G_END_DECLS
 
diff --git a/app/widgets/gimpsavedialog.c b/app/widgets/gimpsavedialog.c
index 0d0e25a..3083a56 100644
--- a/app/widgets/gimpsavedialog.c
+++ b/app/widgets/gimpsavedialog.c
@@ -20,8 +20,6 @@
 
 #include "config.h"
 
-#include <string.h>
-
 #include <gegl.h>
 #include <gtk/gtk.h>
 
@@ -37,8 +35,6 @@
 
 #include "file/gimp-file.h"
 
-#include "pdb/gimppdb.h"
-
 #include "plug-in/gimppluginmanager.h"
 
 #include "gimpfiledialog.h"
@@ -57,22 +53,22 @@ struct _GimpSaveDialogState
 };
 
 
-static void     gimp_save_dialog_constructed         (GObject             *object);
+static void     gimp_save_dialog_constructed       (GObject             *object);
 
-static void     gimp_save_dialog_save_state          (GimpFileDialog      *dialog,
-                                                      const gchar         *state_name);
-static void     gimp_save_dialog_load_state          (GimpFileDialog      *dialog,
-                                                      const gchar         *state_name);
+static void     gimp_save_dialog_save_state        (GimpFileDialog      *dialog,
+                                                    const gchar         *state_name);
+static void     gimp_save_dialog_load_state        (GimpFileDialog      *dialog,
+                                                    const gchar         *state_name);
 
-static void     gimp_save_dialog_add_compat_toggle   (GimpSaveDialog      *dialog);
-static void     gimp_save_dialog_compat_toggled      (GtkToggleButton     *button,
-                                                      GimpSaveDialog      *dialog);
+static void     gimp_save_dialog_add_compat_toggle (GimpSaveDialog      *dialog);
+static void     gimp_save_dialog_compat_toggled    (GtkToggleButton     *button,
+                                                    GimpSaveDialog      *dialog);
 
 static GimpSaveDialogState
-              * gimp_save_dialog_get_state           (GimpSaveDialog      *dialog);
-static void     gimp_save_dialog_set_state           (GimpSaveDialog      *dialog,
-                                                      GimpSaveDialogState *state);
-static void     gimp_save_dialog_state_destroy       (GimpSaveDialogState *state);
+              * gimp_save_dialog_get_state         (GimpSaveDialog      *dialog);
+static void     gimp_save_dialog_set_state         (GimpSaveDialog      *dialog,
+                                                    GimpSaveDialogState *state);
+static void     gimp_save_dialog_state_destroy     (GimpSaveDialogState *state);
 
 
 G_DEFINE_TYPE (GimpSaveDialog, gimp_save_dialog,
@@ -165,7 +161,6 @@ gimp_save_dialog_new (Gimp *gimp)
 
 void
 gimp_save_dialog_set_image (GimpSaveDialog *dialog,
-                            Gimp           *gimp,
                             GimpImage      *image,
                             gboolean        save_a_copy,
                             gboolean        close_after_saving,
@@ -218,7 +213,7 @@ gimp_save_dialog_set_image (GimpSaveDialog *dialog,
     dir_file = gimp_image_get_imported_file (image);
 
   if (! dir_file)
-    dir_file = g_object_get_data (G_OBJECT (gimp),
+    dir_file = g_object_get_data (G_OBJECT (file_dialog->gimp),
                                   GIMP_FILE_SAVE_LAST_FILE_KEY);
 
   if (! dir_file)
@@ -255,6 +250,7 @@ gimp_save_dialog_set_image (GimpSaveDialog *dialog,
    *   1. Type of last Save
    *   2. .xcf (which we don't explicitly append)
    */
+
   ext_file = gimp_image_get_file (image);
 
   if (ext_file)
@@ -302,8 +298,10 @@ gimp_save_dialog_set_image (GimpSaveDialog *dialog,
   gtk_widget_show (dialog->compat_info);
 
   /* We set the compatibility mode by default either if the image was
-  * previously saved with the compatibility mode, or if it has never been
-  * saved and the last GimpSaveDialogState had compatibility mode ON. */
+   * previously saved with the compatibility mode, or if it has never
+   * been saved and the last GimpSaveDialogState had compatibility
+   * mode ON.
+   */
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->compat_toggle),
                                 gtk_widget_get_sensitive (dialog->compat_toggle) &&
                                 (gimp_image_get_xcf_compat_mode (image) ||
diff --git a/app/widgets/gimpsavedialog.h b/app/widgets/gimpsavedialog.h
index a410a41..fce26e5 100644
--- a/app/widgets/gimpsavedialog.h
+++ b/app/widgets/gimpsavedialog.h
@@ -33,7 +33,7 @@ G_BEGIN_DECLS
 #define GIMP_SAVE_DIALOG_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_SAVE_DIALOG, 
GimpSaveDialogClass))
 
 
-typedef struct _GimpSaveDialogClass  GimpSaveDialogClass;
+typedef struct _GimpSaveDialogClass GimpSaveDialogClass;
 
 struct _GimpSaveDialog
 {
@@ -54,16 +54,15 @@ struct _GimpSaveDialogClass
 };
 
 
-GType       gimp_save_dialog_get_type       (void) G_GNUC_CONST;
+GType       gimp_save_dialog_get_type  (void) G_GNUC_CONST;
 
-GtkWidget * gimp_save_dialog_new            (Gimp                 *gimp);
+GtkWidget * gimp_save_dialog_new       (Gimp           *gimp);
 
-void        gimp_save_dialog_set_image      (GimpSaveDialog       *dialog,
-                                             Gimp                 *gimp,
-                                             GimpImage            *image,
-                                             gboolean              save_a_copy,
-                                             gboolean              close_after_saving,
-                                             GimpObject           *display);
+void        gimp_save_dialog_set_image (GimpSaveDialog *dialog,
+                                        GimpImage      *image,
+                                        gboolean        save_a_copy,
+                                        gboolean        close_after_saving,
+                                        GimpObject     *display);
 
 G_END_DECLS
 


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