[gimp/blend-tool-fun: 28/163] app: some cleanup in the new file dialog classes
- From: Michael Henning <mhenning src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/blend-tool-fun: 28/163] app: some cleanup in the new file dialog classes
- Date: Mon, 26 Oct 2015 02:20:33 +0000 (UTC)
commit 7d6da2f8025fef067c97c0ec016bd049e97e3379
Author: Michael Natterer <mitch gimp org>
Date: Wed Sep 9 00:00:50 2015 +0200
app: some cleanup in the new file dialog classes
app/widgets/gimpexportdialog.c | 4 ++--
app/widgets/gimpfiledialog.c | 19 ++++++++++++-------
app/widgets/gimpfiledialog.h | 2 +-
app/widgets/gimpopendialog.c | 6 ++----
app/widgets/gimpsavedialog.c | 24 ++++++++----------------
5 files changed, 25 insertions(+), 30 deletions(-)
---
diff --git a/app/widgets/gimpexportdialog.c b/app/widgets/gimpexportdialog.c
index 76981a4..545c07f 100644
--- a/app/widgets/gimpexportdialog.c
+++ b/app/widgets/gimpexportdialog.c
@@ -52,6 +52,7 @@ G_DEFINE_TYPE (GimpExportDialog, gimp_export_dialog,
#define parent_class gimp_export_dialog_parent_class
+
static void
gimp_export_dialog_class_init (GimpExportDialogClass *klass)
{
@@ -62,6 +63,7 @@ gimp_export_dialog_init (GimpExportDialog *dialog)
{
}
+
/* public functions */
GtkWidget *
@@ -215,5 +217,3 @@ gimp_export_dialog_set_image (GimpExportDialog *dialog,
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), basename);
}
-
-/* private functions */
diff --git a/app/widgets/gimpfiledialog.c b/app/widgets/gimpfiledialog.c
index b83eebf..06b909c 100644
--- a/app/widgets/gimpfiledialog.c
+++ b/app/widgets/gimpfiledialog.c
@@ -49,15 +49,10 @@
#include "gimp-intl.h"
+
/* an arbitrary limit to keep the file dialog from becoming too wide */
#define MAX_EXTENSIONS 4
-typedef struct _GimpFileDialogState GimpFileDialogState;
-struct _GimpFileDialogState
-{
- gchar *filter_name;
-};
-
enum
{
PROP_0,
@@ -71,6 +66,14 @@ enum
PROP_FILE_PROCS_ALL_IMAGES
};
+typedef struct _GimpFileDialogState GimpFileDialogState;
+
+struct _GimpFileDialogState
+{
+ gchar *filter_name;
+};
+
+
static void gimp_file_dialog_progress_iface_init (GimpProgressInterface *iface);
static void gimp_file_dialog_set_property (GObject *object,
@@ -141,6 +144,7 @@ static void gimp_file_dialog_set_state (GimpFileDialog *d
static void gimp_file_dialog_state_destroy (GimpFileDialogState *state);
+
G_DEFINE_TYPE_WITH_CODE (GimpFileDialog, gimp_file_dialog,
GTK_TYPE_FILE_CHOOSER_DIALOG,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_PROGRESS,
@@ -637,7 +641,7 @@ gimp_file_dialog_get_default_folder (GimpFileDialog *dialog)
{
g_return_val_if_fail (GIMP_IS_FILE_DIALOG (dialog), NULL);
- GIMP_FILE_DIALOG_GET_CLASS (dialog)->get_default_folder (dialog);
+ return GIMP_FILE_DIALOG_GET_CLASS (dialog)->get_default_folder (dialog);
}
void
@@ -658,6 +662,7 @@ gimp_file_dialog_load_state (GimpFileDialog *dialog,
GIMP_FILE_DIALOG_GET_CLASS (dialog)->load_state (dialog, state_name);
}
+
/* private functions */
static void
diff --git a/app/widgets/gimpfiledialog.h b/app/widgets/gimpfiledialog.h
index fcee7e6..1b4e6ad 100644
--- a/app/widgets/gimpfiledialog.h
+++ b/app/widgets/gimpfiledialog.h
@@ -66,7 +66,7 @@ struct _GimpFileDialogClass
{
GtkFileChooserDialogClass parent_class;
- GFile * ( *get_default_folder) (GimpFileDialog *dialog);
+ GFile * (* get_default_folder) (GimpFileDialog *dialog);
void (* save_state) (GimpFileDialog *dialog,
const gchar *state_name);
diff --git a/app/widgets/gimpopendialog.c b/app/widgets/gimpopendialog.c
index a89896f..346b440 100644
--- a/app/widgets/gimpopendialog.c
+++ b/app/widgets/gimpopendialog.c
@@ -33,8 +33,6 @@
#include "core/gimp.h"
#include "core/gimpimage.h"
-#include "pdb/gimppdb.h"
-
#include "plug-in/gimppluginmanager.h"
#include "gimpfiledialog.h"
@@ -49,6 +47,7 @@ G_DEFINE_TYPE (GimpOpenDialog, gimp_open_dialog,
#define parent_class gimp_open_dialog_parent_class
+
static void
gimp_open_dialog_class_init (GimpOpenDialogClass *klass)
{
@@ -59,6 +58,7 @@ gimp_open_dialog_init (GimpOpenDialog *dialog)
{
}
+
/* public functions */
GtkWidget *
@@ -100,5 +100,3 @@ gimp_open_dialog_set_image (GimpOpenDialog *dialog,
GIMP_FILE_DIALOG (dialog)->image = image;
dialog->open_as_layers = open_as_layers;
}
-
-/* private functions */
diff --git a/app/widgets/gimpsavedialog.c b/app/widgets/gimpsavedialog.c
index 87ffb12..a5cc198 100644
--- a/app/widgets/gimpsavedialog.c
+++ b/app/widgets/gimpsavedialog.c
@@ -48,6 +48,7 @@
typedef struct _GimpSaveDialogState GimpSaveDialogState;
+
struct _GimpSaveDialogState
{
gchar *filter_name;
@@ -102,7 +103,8 @@ gimp_save_dialog_constructed (GObject *object)
GimpSaveDialog *dialog = GIMP_SAVE_DIALOG (object);
/* GimpFileDialog's constructed() is doing a few initialization
- * common to all file dialogs. */
+ * common to all file dialogs.
+ */
G_OBJECT_CLASS (parent_class)->constructed (object);
gimp_save_dialog_add_compat_toggle (dialog);
@@ -112,8 +114,6 @@ static void
gimp_save_dialog_save_state (GimpFileDialog *dialog,
const gchar *state_name)
{
- g_return_if_fail (GIMP_IS_SAVE_DIALOG (dialog));
-
g_object_set_data_full (G_OBJECT (dialog->gimp), state_name,
gimp_save_dialog_get_state (GIMP_SAVE_DIALOG (dialog)),
(GDestroyNotify) gimp_save_dialog_state_destroy);
@@ -125,8 +125,6 @@ gimp_save_dialog_load_state (GimpFileDialog *dialog,
{
GimpSaveDialogState *state;
- g_return_if_fail (GIMP_IS_SAVE_DIALOG (dialog));
-
state = g_object_get_data (G_OBJECT (dialog->gimp), state_name);
if (state)
@@ -187,10 +185,10 @@ gimp_save_dialog_set_image (GimpSaveDialog *dialog,
file_dialog = GIMP_FILE_DIALOG (dialog);
- file_dialog->image = image;
- dialog->save_a_copy = save_a_copy;
- dialog->close_after_saving = close_after_saving;
- dialog->display_to_close = display;
+ file_dialog->image = image;
+ dialog->save_a_copy = save_a_copy;
+ dialog->close_after_saving = close_after_saving;
+ dialog->display_to_close = display;
gimp_file_dialog_set_file_proc (file_dialog, NULL);
@@ -326,6 +324,7 @@ gimp_save_dialog_set_image (GimpSaveDialog *dialog,
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), basename);
}
+
/* private functions */
static void
@@ -355,8 +354,6 @@ gimp_save_dialog_get_state (GimpSaveDialog *dialog)
GimpSaveDialogState *state;
GtkFileFilter *filter;
- g_return_val_if_fail (GIMP_IS_SAVE_DIALOG (dialog), NULL);
-
state = g_slice_new0 (GimpSaveDialogState);
filter = gtk_file_chooser_get_filter (GTK_FILE_CHOOSER (dialog));
@@ -373,9 +370,6 @@ static void
gimp_save_dialog_set_state (GimpSaveDialog *dialog,
GimpSaveDialogState *state)
{
- g_return_if_fail (GIMP_IS_SAVE_DIALOG (dialog));
- g_return_if_fail (state != NULL);
-
if (state->filter_name)
{
GSList *filters;
@@ -404,8 +398,6 @@ gimp_save_dialog_set_state (GimpSaveDialog *dialog,
static void
gimp_save_dialog_state_destroy (GimpSaveDialogState *state)
{
- g_return_if_fail (state != NULL);
-
g_free (state->filter_name);
g_slice_free (GimpSaveDialogState, state);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]