add marshaller BOOLEAN__STRING for the change below.
2008-06-25 Michael Natterer <mitch@gimp.org> * app/core/gimpmarshal.list: add marshaller BOOLEAN__STRING for the change below. * app/widgets/gimpsettingsbox.[ch]: add the import/export dialogs here. Add a bunch of parameters to new() to be used by the dialogs, they are not properties yet. Changed import() and export() signals to pass the selected filename and return a boolean indicating success. * app/tools/gimpimagemaptool-settings.c: remove the dialog code here and connect the import/export functions directly to above GimpSettingsBox signals. * app/tools/gimpimagemaptool.[ch]: remove file dialog member. svn path=/trunk/; revision=25991
This commit is contained in:

committed by
Michael Natterer

parent
7df6950e19
commit
4bdf9a6d2a
17
ChangeLog
17
ChangeLog
@ -1,3 +1,20 @@
|
||||
2008-06-25 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/gimpmarshal.list: add marshaller BOOLEAN__STRING for
|
||||
the change below.
|
||||
|
||||
* app/widgets/gimpsettingsbox.[ch]: add the import/export dialogs
|
||||
here. Add a bunch of parameters to new() to be used by the
|
||||
dialogs, they are not properties yet. Changed import() and
|
||||
export() signals to pass the selected filename and return a
|
||||
boolean indicating success.
|
||||
|
||||
* app/tools/gimpimagemaptool-settings.c: remove the dialog code
|
||||
here and connect the import/export functions directly to above
|
||||
GimpSettingsBox signals.
|
||||
|
||||
* app/tools/gimpimagemaptool.[ch]: remove file dialog member.
|
||||
|
||||
2008-06-25 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/tools/gimpcurvestool.c (gimp_curves_tool_settings_import):
|
||||
|
@ -26,6 +26,7 @@ BOOLEAN: BOOLEAN
|
||||
BOOLEAN: ENUM, INT
|
||||
BOOLEAN: OBJECT, POINTER
|
||||
BOOLEAN: OBJECT, POINTER, STRING
|
||||
BOOLEAN: STRING
|
||||
|
||||
VOID: BOOLEAN
|
||||
VOID: BOOLEAN, INT, INT, INT, INT
|
||||
|
@ -49,20 +49,13 @@
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_image_map_tool_import_activate (GtkWidget *widget,
|
||||
static gboolean gimp_image_map_tool_settings_import (GimpSettingsBox *box,
|
||||
const gchar *filename,
|
||||
GimpImageMapTool *tool);
|
||||
static void gimp_image_map_tool_export_activate (GtkWidget *widget,
|
||||
static gboolean gimp_image_map_tool_settings_export (GimpSettingsBox *box,
|
||||
const gchar *filename,
|
||||
GimpImageMapTool *tool);
|
||||
|
||||
static void gimp_image_map_tool_settings_dialog (GimpImageMapTool *im_tool,
|
||||
const gchar *title,
|
||||
gboolean save);
|
||||
|
||||
static gboolean gimp_image_map_tool_settings_import (GimpImageMapTool *tool,
|
||||
const gchar *filename);
|
||||
static gboolean gimp_image_map_tool_settings_export (GimpImageMapTool *tool,
|
||||
const gchar *filename);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
@ -74,6 +67,7 @@ gimp_image_map_tool_add_settings_gui (GimpImageMapTool *image_map_tool)
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
gchar *filename;
|
||||
gchar *folder;
|
||||
|
||||
klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (image_map_tool);
|
||||
|
||||
@ -93,26 +87,33 @@ gimp_image_map_tool_add_settings_gui (GimpImageMapTool *image_map_tool)
|
||||
g_object_unref (image_map_tool->label_group);
|
||||
|
||||
filename = gimp_tool_info_build_options_filename (tool_info, ".settings");
|
||||
folder = g_build_filename (gimp_directory (), klass->settings_name, NULL);
|
||||
|
||||
image_map_tool->settings_box = gimp_settings_box_new (tool_info->gimp,
|
||||
image_map_tool->config,
|
||||
klass->recent_settings,
|
||||
filename);
|
||||
filename,
|
||||
klass->import_dialog_title,
|
||||
klass->export_dialog_title,
|
||||
tool_info->help_id,
|
||||
folder,
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), image_map_tool->settings_box,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (image_map_tool->settings_box);
|
||||
|
||||
g_free (filename);
|
||||
g_free (folder);
|
||||
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label),
|
||||
GIMP_SETTINGS_BOX (image_map_tool->settings_box)->combo);
|
||||
|
||||
g_signal_connect (image_map_tool->settings_box, "import",
|
||||
G_CALLBACK (gimp_image_map_tool_import_activate),
|
||||
G_CALLBACK (gimp_image_map_tool_settings_import),
|
||||
image_map_tool);
|
||||
|
||||
g_signal_connect (image_map_tool->settings_box, "export",
|
||||
G_CALLBACK (gimp_image_map_tool_export_activate),
|
||||
G_CALLBACK (gimp_image_map_tool_settings_export),
|
||||
image_map_tool);
|
||||
|
||||
return TRUE;
|
||||
@ -165,144 +166,10 @@ gimp_image_map_tool_real_settings_export (GimpImageMapTool *tool,
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
gimp_image_map_tool_import_activate (GtkWidget *widget,
|
||||
GimpImageMapTool *tool)
|
||||
{
|
||||
GimpImageMapToolClass *klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool);
|
||||
|
||||
gimp_image_map_tool_settings_dialog (tool, klass->import_dialog_title, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_image_map_tool_export_activate (GtkWidget *widget,
|
||||
GimpImageMapTool *tool)
|
||||
{
|
||||
GimpImageMapToolClass *klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool);
|
||||
|
||||
gimp_image_map_tool_settings_dialog (tool, klass->export_dialog_title, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
settings_dialog_response (GtkWidget *dialog,
|
||||
gint response_id,
|
||||
GimpImageMapTool *tool)
|
||||
{
|
||||
gboolean save;
|
||||
|
||||
save = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dialog), "save"));
|
||||
|
||||
if (response_id == GTK_RESPONSE_OK)
|
||||
{
|
||||
gchar *filename;
|
||||
|
||||
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
||||
|
||||
if (save)
|
||||
gimp_image_map_tool_settings_export (tool, filename);
|
||||
else
|
||||
gimp_image_map_tool_settings_import (tool, filename);
|
||||
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
if (save)
|
||||
gtk_widget_set_sensitive (GIMP_SETTINGS_BOX (tool->settings_box)->import_item, TRUE);
|
||||
else
|
||||
gtk_widget_set_sensitive (GIMP_SETTINGS_BOX (tool->settings_box)->export_item, TRUE);
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_image_map_tool_settings_dialog (GimpImageMapTool *tool,
|
||||
const gchar *title,
|
||||
gboolean save)
|
||||
{
|
||||
GimpImageMapOptions *options = GIMP_IMAGE_MAP_TOOL_GET_OPTIONS (tool);
|
||||
GtkFileChooser *chooser;
|
||||
const gchar *settings_name;
|
||||
gchar *folder;
|
||||
|
||||
settings_name = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->settings_name;
|
||||
|
||||
g_return_if_fail (settings_name != NULL);
|
||||
|
||||
if (tool->settings_dialog)
|
||||
{
|
||||
gtk_window_present (GTK_WINDOW (tool->settings_dialog));
|
||||
return;
|
||||
}
|
||||
|
||||
if (save)
|
||||
gtk_widget_set_sensitive (GIMP_SETTINGS_BOX (tool->settings_box)->import_item, FALSE);
|
||||
else
|
||||
gtk_widget_set_sensitive (GIMP_SETTINGS_BOX (tool->settings_box)->export_item, FALSE);
|
||||
|
||||
tool->settings_dialog =
|
||||
gtk_file_chooser_dialog_new (title, GTK_WINDOW (tool->shell),
|
||||
save ?
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE :
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
save ? GTK_STOCK_SAVE : GTK_STOCK_OPEN,
|
||||
GTK_RESPONSE_OK,
|
||||
|
||||
NULL);
|
||||
|
||||
chooser = GTK_FILE_CHOOSER (tool->settings_dialog);
|
||||
|
||||
g_object_set_data (G_OBJECT (chooser), "save", GINT_TO_POINTER (save));
|
||||
|
||||
gtk_window_set_role (GTK_WINDOW (chooser), "gimp-import-export-settings");
|
||||
gtk_window_set_position (GTK_WINDOW (chooser), GTK_WIN_POS_MOUSE);
|
||||
|
||||
g_object_add_weak_pointer (G_OBJECT (chooser),
|
||||
(gpointer) &tool->settings_dialog);
|
||||
|
||||
gtk_window_set_destroy_with_parent (GTK_WINDOW (chooser), TRUE);
|
||||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_OK);
|
||||
|
||||
if (save)
|
||||
gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE);
|
||||
|
||||
g_signal_connect (chooser, "response",
|
||||
G_CALLBACK (settings_dialog_response),
|
||||
tool);
|
||||
g_signal_connect (chooser, "delete-event",
|
||||
G_CALLBACK (gtk_true),
|
||||
NULL);
|
||||
|
||||
folder = g_build_filename (gimp_directory (), settings_name, NULL);
|
||||
|
||||
if (g_file_test (folder, G_FILE_TEST_IS_DIR))
|
||||
{
|
||||
gtk_file_chooser_add_shortcut_folder (chooser, folder, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_free (folder);
|
||||
folder = g_strdup (g_get_home_dir ());
|
||||
}
|
||||
|
||||
if (options->settings)
|
||||
gtk_file_chooser_set_filename (chooser, options->settings);
|
||||
else
|
||||
gtk_file_chooser_set_current_folder (chooser, folder);
|
||||
|
||||
g_free (folder);
|
||||
|
||||
gimp_help_connect (tool->settings_dialog, gimp_standard_help_func,
|
||||
GIMP_TOOL (tool)->tool_info->help_id, NULL);
|
||||
|
||||
gtk_widget_show (tool->settings_dialog);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_image_map_tool_settings_import (GimpImageMapTool *tool,
|
||||
const gchar *filename)
|
||||
gimp_image_map_tool_settings_import (GimpSettingsBox *box,
|
||||
const gchar *filename,
|
||||
GimpImageMapTool *tool)
|
||||
{
|
||||
GimpImageMapToolClass *tool_class = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool);
|
||||
GError *error = NULL;
|
||||
@ -328,8 +195,9 @@ gimp_image_map_tool_settings_import (GimpImageMapTool *tool,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_image_map_tool_settings_export (GimpImageMapTool *tool,
|
||||
const gchar *filename)
|
||||
gimp_image_map_tool_settings_export (GimpSettingsBox *box,
|
||||
const gchar *filename,
|
||||
GimpImageMapTool *tool)
|
||||
{
|
||||
GimpImageMapToolClass *tool_class = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool);
|
||||
GError *error = NULL;
|
||||
|
@ -190,16 +190,15 @@ gimp_image_map_tool_init (GimpImageMapTool *image_map_tool)
|
||||
GIMP_DIRTY_DRAWABLE |
|
||||
GIMP_DIRTY_SELECTION);
|
||||
|
||||
image_map_tool->drawable = NULL;
|
||||
image_map_tool->operation = NULL;
|
||||
image_map_tool->config = NULL;
|
||||
image_map_tool->image_map = NULL;
|
||||
image_map_tool->drawable = NULL;
|
||||
image_map_tool->operation = NULL;
|
||||
image_map_tool->config = NULL;
|
||||
image_map_tool->image_map = NULL;
|
||||
|
||||
image_map_tool->shell = NULL;
|
||||
image_map_tool->main_vbox = NULL;
|
||||
image_map_tool->settings_box = NULL;
|
||||
image_map_tool->label_group = NULL;
|
||||
image_map_tool->settings_dialog = NULL;
|
||||
image_map_tool->shell = NULL;
|
||||
image_map_tool->main_vbox = NULL;
|
||||
image_map_tool->settings_box = NULL;
|
||||
image_map_tool->label_group = NULL;
|
||||
}
|
||||
|
||||
static GObject *
|
||||
|
@ -53,9 +53,6 @@ struct _GimpImageMapTool
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *settings_box;
|
||||
GtkSizeGroup *label_group;
|
||||
|
||||
/* settings file dialog */
|
||||
GtkWidget *settings_dialog;
|
||||
};
|
||||
|
||||
struct _GimpImageMapToolClass
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimplist.h"
|
||||
#include "core/gimpmarshal.h"
|
||||
|
||||
#include "gimpcontainercombobox.h"
|
||||
#include "gimpcontainerview.h"
|
||||
@ -101,6 +102,12 @@ static void gimp_settings_box_manage_activate (GtkWidget *widget,
|
||||
static void gimp_settings_box_favorite_callback (GtkWidget *query_box,
|
||||
const gchar *string,
|
||||
gpointer data);
|
||||
static void gimp_settings_box_file_dialog (GimpSettingsBox *box,
|
||||
const gchar *title,
|
||||
gboolean save);
|
||||
static void gimp_settings_box_file_response (GtkWidget *dialog,
|
||||
gint response_id,
|
||||
GimpSettingsBox *box);
|
||||
static void gimp_settings_box_toplevel_unmap (GtkWidget *widget,
|
||||
GimpSettingsBox *box);
|
||||
static void gimp_settings_box_manage_response (GtkWidget *widget,
|
||||
@ -123,26 +130,31 @@ gimp_settings_box_class_init (GimpSettingsBoxClass *klass)
|
||||
settings_box_signals[IMPORT] =
|
||||
g_signal_new ("import",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GimpSettingsBoxClass, import),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
gimp_marshal_BOOLEAN__STRING,
|
||||
G_TYPE_BOOLEAN, 1,
|
||||
G_TYPE_STRING);
|
||||
|
||||
settings_box_signals[EXPORT] =
|
||||
g_signal_new ("export",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GimpSettingsBoxClass, export),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
gimp_marshal_BOOLEAN__STRING,
|
||||
G_TYPE_BOOLEAN, 1,
|
||||
G_TYPE_STRING);
|
||||
|
||||
object_class->constructor = gimp_settings_box_constructor;
|
||||
object_class->finalize = gimp_settings_box_finalize;
|
||||
object_class->set_property = gimp_settings_box_set_property;
|
||||
object_class->get_property = gimp_settings_box_get_property;
|
||||
|
||||
klass->import = NULL;
|
||||
klass->export = NULL;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_GIMP,
|
||||
g_param_spec_object ("gimp",
|
||||
NULL, NULL,
|
||||
@ -302,6 +314,12 @@ gimp_settings_box_finalize (GObject *object)
|
||||
box->filename = NULL;
|
||||
}
|
||||
|
||||
g_free (box->import_dialog_title);
|
||||
g_free (box->export_dialog_title);
|
||||
g_free (box->file_dialog_help_id);
|
||||
g_free (box->default_folder);
|
||||
g_free (box->last_filename);
|
||||
|
||||
if (box->editor_dialog)
|
||||
{
|
||||
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (box));
|
||||
@ -556,14 +574,14 @@ static void
|
||||
gimp_settings_box_import_activate (GtkWidget *widget,
|
||||
GimpSettingsBox *box)
|
||||
{
|
||||
g_signal_emit (box, settings_box_signals[IMPORT], 0);
|
||||
gimp_settings_box_file_dialog (box, box->import_dialog_title, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_settings_box_export_activate (GtkWidget *widget,
|
||||
GimpSettingsBox *box)
|
||||
{
|
||||
g_signal_emit (box, settings_box_signals[EXPORT], 0);
|
||||
gimp_settings_box_file_dialog (box, box->export_dialog_title, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -626,6 +644,126 @@ gimp_settings_box_favorite_callback (GtkWidget *query_box,
|
||||
gimp_settings_box_serialize (box);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_settings_box_file_dialog (GimpSettingsBox *box,
|
||||
const gchar *title,
|
||||
gboolean save)
|
||||
{
|
||||
GtkWidget *toplevel;
|
||||
GtkWidget *dialog;
|
||||
|
||||
if (box->file_dialog)
|
||||
{
|
||||
gtk_window_present (GTK_WINDOW (box->file_dialog));
|
||||
return;
|
||||
}
|
||||
|
||||
if (save)
|
||||
gtk_widget_set_sensitive (box->import_item, FALSE);
|
||||
else
|
||||
gtk_widget_set_sensitive (box->export_item, FALSE);
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (box));
|
||||
|
||||
box->file_dialog = dialog =
|
||||
gtk_file_chooser_dialog_new (title, GTK_WINDOW (toplevel),
|
||||
save ?
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE :
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
save ? GTK_STOCK_SAVE : GTK_STOCK_OPEN,
|
||||
GTK_RESPONSE_OK,
|
||||
|
||||
NULL);
|
||||
|
||||
g_object_set_data (G_OBJECT (dialog), "save", GINT_TO_POINTER (save));
|
||||
|
||||
gtk_window_set_role (GTK_WINDOW (dialog), "gimp-import-export-settings");
|
||||
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
||||
|
||||
g_object_add_weak_pointer (G_OBJECT (dialog), (gpointer) &box->file_dialog);
|
||||
|
||||
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
||||
|
||||
if (save)
|
||||
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog),
|
||||
TRUE);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gimp_settings_box_file_response),
|
||||
box);
|
||||
g_signal_connect (dialog, "delete-event",
|
||||
G_CALLBACK (gtk_true),
|
||||
NULL);
|
||||
|
||||
if (box->default_folder &&
|
||||
g_file_test (box->default_folder, G_FILE_TEST_IS_DIR))
|
||||
{
|
||||
gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (dialog),
|
||||
box->default_folder, NULL);
|
||||
|
||||
if (! box->last_filename)
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog),
|
||||
box->default_folder);
|
||||
}
|
||||
else if (! box->last_filename)
|
||||
{
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog),
|
||||
g_get_home_dir ());
|
||||
}
|
||||
|
||||
if (box->last_filename)
|
||||
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog),
|
||||
box->last_filename);
|
||||
|
||||
gimp_help_connect (box->file_dialog, gimp_standard_help_func,
|
||||
box->file_dialog_help_id, NULL);
|
||||
|
||||
gtk_widget_show (box->file_dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_settings_box_file_response (GtkWidget *dialog,
|
||||
gint response_id,
|
||||
GimpSettingsBox *box)
|
||||
{
|
||||
gboolean save;
|
||||
|
||||
save = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dialog), "save"));
|
||||
|
||||
if (response_id == GTK_RESPONSE_OK)
|
||||
{
|
||||
gchar *filename;
|
||||
gboolean success = FALSE;
|
||||
|
||||
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
||||
|
||||
if (save)
|
||||
g_signal_emit (box, settings_box_signals[EXPORT], 0, filename,
|
||||
&success);
|
||||
else
|
||||
g_signal_emit (box, settings_box_signals[IMPORT], 0, filename,
|
||||
&success);
|
||||
|
||||
if (success)
|
||||
{
|
||||
g_free (box->last_filename);
|
||||
box->last_filename = g_strdup (filename);
|
||||
}
|
||||
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
if (save)
|
||||
gtk_widget_set_sensitive (box->import_item, TRUE);
|
||||
else
|
||||
gtk_widget_set_sensitive (box->export_item, TRUE);
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_settings_box_toplevel_unmap (GtkWidget *widget,
|
||||
GimpSettingsBox *box)
|
||||
@ -656,19 +794,34 @@ GtkWidget *
|
||||
gimp_settings_box_new (Gimp *gimp,
|
||||
GObject *config,
|
||||
GimpContainer *container,
|
||||
const gchar *filename)
|
||||
const gchar *filename,
|
||||
const gchar *import_dialog_title,
|
||||
const gchar *export_dialog_title,
|
||||
const gchar *file_dialog_help_id,
|
||||
const gchar *default_folder,
|
||||
const gchar *last_filename)
|
||||
{
|
||||
GimpSettingsBox *box;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_CONFIG (config), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
|
||||
g_return_val_if_fail (filename != NULL, NULL);
|
||||
|
||||
return g_object_new (GIMP_TYPE_SETTINGS_BOX,
|
||||
"gimp", gimp,
|
||||
"config", config,
|
||||
"container", container,
|
||||
"filename", filename,
|
||||
NULL);
|
||||
box = g_object_new (GIMP_TYPE_SETTINGS_BOX,
|
||||
"gimp", gimp,
|
||||
"config", config,
|
||||
"container", container,
|
||||
"filename", filename,
|
||||
NULL);
|
||||
|
||||
box->import_dialog_title = g_strdup (import_dialog_title);
|
||||
box->export_dialog_title = g_strdup (export_dialog_title);
|
||||
box->file_dialog_help_id = g_strdup (file_dialog_help_id);
|
||||
box->default_folder = g_strdup (default_folder);
|
||||
box->last_filename = g_strdup (last_filename);
|
||||
|
||||
return GTK_WIDGET (box);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -41,20 +41,29 @@ struct _GimpSettingsBox
|
||||
GtkWidget *menu;
|
||||
GtkWidget *import_item;
|
||||
GtkWidget *export_item;
|
||||
GtkWidget *file_dialog;
|
||||
GtkWidget *editor_dialog;
|
||||
|
||||
Gimp *gimp;
|
||||
GObject *config;
|
||||
GimpContainer *container;
|
||||
gchar *filename;
|
||||
|
||||
gchar *import_dialog_title;
|
||||
gchar *export_dialog_title;
|
||||
gchar *file_dialog_help_id;
|
||||
gchar *default_folder;
|
||||
gchar *last_filename;
|
||||
};
|
||||
|
||||
struct _GimpSettingsBoxClass
|
||||
{
|
||||
GtkHBoxClass parent_class;
|
||||
|
||||
void (* import) (GimpSettingsBox *box);
|
||||
void (* export) (GimpSettingsBox *box);
|
||||
void (* import) (GimpSettingsBox *box,
|
||||
const gchar *filename);
|
||||
void (* export) (GimpSettingsBox *box,
|
||||
const gchar *filename);
|
||||
};
|
||||
|
||||
|
||||
@ -63,7 +72,12 @@ GType gimp_settings_box_get_type (void) G_GNUC_CONST;
|
||||
GtkWidget * gimp_settings_box_new (Gimp *gimp,
|
||||
GObject *config,
|
||||
GimpContainer *container,
|
||||
const gchar *filename);
|
||||
const gchar *filename,
|
||||
const gchar *import_dialog_title,
|
||||
const gchar *export_dialog_title,
|
||||
const gchar *file_dialog_help_id,
|
||||
const gchar *default_folder,
|
||||
const gchar *last_filename);
|
||||
|
||||
void gimp_settings_box_add_current (GimpSettingsBox *box);
|
||||
|
||||
|
Reference in New Issue
Block a user