added new function gimp_dialog_factory_add_foreign() which adds a dialog
2003-05-02 Michael Natterer <mitch@gimp.org> * app/widgets/gimpdialogfactory.[ch]: added new function gimp_dialog_factory_add_foreign() which adds a dialog that was not created by the factory itself. Its identifier however must be registered with the factory. Connect to all toplevel dialogs' "configure_event" and remember the resulting window geometry so we get session management for *all* dialogs, not only for those which were open on exit. * app/gui/dialogs.c: added the "File New" dialog. Added foreign entries (without constructor) for all dialogs opened by tools. * app/gui/dialogs-constructors.[ch]: added a constructor for the file_new dialog. * app/gui/file-new-dialog.[ch]: renamed file_new_dialog_create() to file_new_dialog_new() and removed the gimage and template paramaters. Adder new function file_new_dialog_set() to set gimage and template after creation. * app/gui/file-commands.c * app/gui/templates-commands.c: changed accordingly. * app/tools/gimpimagemaptool.[ch] * app/tools/gimptransformtool.[ch]: added "const gchar *shell_identifier" to the tool structs. Register the tool dialogs using gimp_dialog_factory_add_foreign(). * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpperspectivetool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/tools/gimpsheartool.c * app/tools/gimpthresholdtool.c: set "shell_identifier" so the dialogs become session managed. Fixes bug #61091. * app/tools/gimpcroptool.c: register the crop dialog with the dialog factory. Fixes bug #52849. * app/tools/gimpcolorpickertool.c: ditto. Unrelated: * app/tools/gimptool.c: no need to cast the return value of g_object_new().
This commit is contained in:
committed by
Michael Natterer
parent
a115c7b5ab
commit
fefaf61b28
@ -76,19 +76,15 @@ static void file_new_create_image (FileNewDialog *dialog);
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
file_new_dialog_create (Gimp *gimp,
|
||||
GimpImage *gimage,
|
||||
GimpTemplate *template)
|
||||
GtkWidget *
|
||||
file_new_dialog_new (Gimp *gimp)
|
||||
{
|
||||
FileNewDialog *dialog;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *table;
|
||||
GtkWidget *optionmenu;
|
||||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (gimage == NULL || GIMP_IS_IMAGE (gimage));
|
||||
g_return_if_fail (template == NULL || GIMP_IS_TEMPLATE (template));
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
dialog = g_new0 (FileNewDialog, 1);
|
||||
|
||||
@ -114,6 +110,10 @@ file_new_dialog_create (Gimp *gimp,
|
||||
|
||||
NULL);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (dialog->dialog),
|
||||
"gimp-file-new-dialog", dialog,
|
||||
(GDestroyNotify) g_free);
|
||||
|
||||
gtk_window_set_resizable (GTK_WINDOW (dialog->dialog), FALSE);
|
||||
|
||||
/* vbox holding the rest of the dialog */
|
||||
@ -154,6 +154,26 @@ file_new_dialog_create (Gimp *gimp,
|
||||
G_CALLBACK (file_new_template_notify),
|
||||
dialog);
|
||||
|
||||
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (GIMP_TEMPLATE_EDITOR (dialog->editor)->size_se));
|
||||
|
||||
return dialog->dialog;
|
||||
}
|
||||
|
||||
void
|
||||
file_new_dialog_set (GtkWidget *widget,
|
||||
GimpImage *gimage,
|
||||
GimpTemplate *template)
|
||||
{
|
||||
FileNewDialog *dialog;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
g_return_if_fail (gimage == NULL || GIMP_IS_IMAGE (gimage));
|
||||
g_return_if_fail (template == NULL || GIMP_IS_TEMPLATE (template));
|
||||
|
||||
dialog = g_object_get_data (G_OBJECT (widget), "gimp-file-new-dialog");
|
||||
|
||||
g_return_if_fail (dialog != NULL);
|
||||
|
||||
if (template)
|
||||
{
|
||||
gimp_container_menu_select_item (GIMP_CONTAINER_MENU (dialog->template_menu),
|
||||
@ -161,15 +181,11 @@ file_new_dialog_create (Gimp *gimp,
|
||||
}
|
||||
else
|
||||
{
|
||||
template = gimp_image_new_get_last_template (gimp, gimage);
|
||||
template = gimp_image_new_get_last_template (dialog->gimp, gimage);
|
||||
gimp_template_editor_set_template (GIMP_TEMPLATE_EDITOR (dialog->editor),
|
||||
template);
|
||||
g_object_unref (template);
|
||||
}
|
||||
|
||||
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (GIMP_TEMPLATE_EDITOR (dialog->editor)->size_se));
|
||||
|
||||
gtk_widget_show (dialog->dialog);
|
||||
}
|
||||
|
||||
|
||||
@ -191,7 +207,6 @@ file_new_cancel_callback (GtkWidget *widget,
|
||||
FileNewDialog *dialog)
|
||||
{
|
||||
gtk_widget_destroy (dialog->dialog);
|
||||
g_free (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -299,15 +314,16 @@ static void
|
||||
file_new_create_image (FileNewDialog *dialog)
|
||||
{
|
||||
GimpTemplate *template;
|
||||
Gimp *gimp;
|
||||
|
||||
template =
|
||||
gimp_template_editor_get_template (GIMP_TEMPLATE_EDITOR (dialog->editor));
|
||||
|
||||
gimp = dialog->gimp;
|
||||
|
||||
gtk_widget_destroy (dialog->dialog);
|
||||
|
||||
gimp_template_create_image (dialog->gimp, template);
|
||||
gimp_image_new_set_last_template (dialog->gimp, template);
|
||||
gimp_template_create_image (gimp, template);
|
||||
gimp_image_new_set_last_template (gimp, template);
|
||||
g_object_unref (template);
|
||||
|
||||
g_free (dialog);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user