Commit bd9afce9 authored by Michael Natterer's avatar Michael Natterer 😴

app: some cleanup in the new file dialog classes

parent d1e2b2c1
......@@ -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 */
......@@ -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
......
......@@ -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);
......
......@@ -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 */
......@@ -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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment