2001-04-17 Michael Natterer <mitch@gimp.org> * app/session.[ch] * app/gimprc.c: removed the old dialog session management code... * app/widgets/gimpdialogfactory.[ch]: ...and manage all dialogs here. * app/gui/dialogs-constructors.[ch]: dialog factory compliant constructors for all session managed toplevel dialogs. * app/brush_select.[ch] * app/devices.[ch] * app/docindex.[ch] * app/errorconsole.[ch] * app/gradient_select.[ch] * app/info_dialog.c * app/lc_dialog.[ch] * app/palette.[ch] * app/pattern_select.[ch] * app/toolbox.[ch] * app/tools/tool_options_dialog.[ch]: all dialog constructors have to return the dialog now (even the legacy ones that will go away). Removed the session management code as this is now done for the dialogs, not by them. * app/app_procs.c * app/color_select.c * app/commands.[ch] * app/indicator_area.c * app/menus.c * app/palette_select.c * app/preferences_dialog.c * app/gui/dialogs.c * app/gui/dialogs-commands.[ch] * app/gui/gui.c * app/tools/gimptool.c * app/widgets/gimpdock.c: changed accordingly.
169 lines
3.4 KiB
C
169 lines
3.4 KiB
C
/* The GIMP -- an image manipulation program
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
#include "apptypes.h"
|
|
|
|
#include "tools/tool_options_dialog.h"
|
|
|
|
#include "widgets/gimpdialogfactory.h"
|
|
|
|
#include "devices.h"
|
|
#include "dialogs.h"
|
|
#include "docindex.h"
|
|
#include "gimprc.h"
|
|
#include "gui.h"
|
|
#include "gximage.h"
|
|
#include "image_render.h"
|
|
#include "lc_dialog.h"
|
|
#include "menus.h"
|
|
#include "session.h"
|
|
#include "toolbox.h"
|
|
|
|
#include "app_procs.h"
|
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
|
static void really_quit_callback (GtkWidget *button,
|
|
gboolean quit,
|
|
gpointer data);
|
|
|
|
|
|
/* public functions */
|
|
|
|
void
|
|
gui_init (void)
|
|
{
|
|
menus_reorder_plugins ();
|
|
|
|
gximage_init ();
|
|
render_setup (transparency_type, transparency_size);
|
|
|
|
dialogs_init ();
|
|
|
|
devices_init ();
|
|
session_init ();
|
|
|
|
gimp_dialog_factory_dialog_new (global_dialog_factory, "gimp:toolbox");
|
|
|
|
/* Fill the "last opened" menu items with the first last_opened_size
|
|
* elements of the docindex
|
|
*/
|
|
{
|
|
FILE *fp;
|
|
gchar **filenames = g_new0 (gchar *, last_opened_size);
|
|
gint i;
|
|
|
|
if ((fp = document_index_parse_init ()))
|
|
{
|
|
/* read the filenames... */
|
|
for (i = 0; i < last_opened_size; i++)
|
|
if ((filenames[i] = document_index_parse_line (fp)) == NULL)
|
|
break;
|
|
|
|
/* ...and add them in reverse order */
|
|
for (--i; i >= 0; i--)
|
|
{
|
|
menus_last_opened_add (filenames[i]);
|
|
g_free (filenames[i]);
|
|
}
|
|
|
|
fclose (fp);
|
|
}
|
|
|
|
g_free (filenames);
|
|
}
|
|
}
|
|
|
|
void
|
|
gui_restore (void)
|
|
{
|
|
devices_restore ();
|
|
session_restore ();
|
|
}
|
|
|
|
void
|
|
gui_shutdown (void)
|
|
{
|
|
session_save ();
|
|
device_status_free ();
|
|
}
|
|
|
|
void
|
|
gui_exit (void)
|
|
{
|
|
menus_quit ();
|
|
gximage_free ();
|
|
render_free ();
|
|
|
|
dialogs_exit ();
|
|
|
|
/* handle this in the dialog factory: */
|
|
lc_dialog_free ();
|
|
document_index_free ();
|
|
tool_options_dialog_free ();
|
|
toolbox_free ();
|
|
}
|
|
|
|
void
|
|
really_quit_dialog (void)
|
|
{
|
|
GtkWidget *dialog;
|
|
|
|
menus_set_sensitive ("<Toolbox>/File/Quit", FALSE);
|
|
menus_set_sensitive ("<Image>/File/Quit", FALSE);
|
|
|
|
dialog = gimp_query_boolean_box (_("Really Quit?"),
|
|
gimp_standard_help_func,
|
|
"dialogs/really_quit.html",
|
|
TRUE,
|
|
_("Some files unsaved.\n\nQuit the GIMP?"),
|
|
_("Quit"), _("Cancel"),
|
|
NULL, NULL,
|
|
really_quit_callback,
|
|
NULL);
|
|
|
|
gtk_widget_show (dialog);
|
|
}
|
|
|
|
|
|
/* private functions */
|
|
|
|
static void
|
|
really_quit_callback (GtkWidget *button,
|
|
gboolean quit,
|
|
gpointer data)
|
|
{
|
|
if (quit)
|
|
{
|
|
app_exit_finish ();
|
|
}
|
|
else
|
|
{
|
|
menus_set_sensitive ("<Toolbox>/File/Quit", TRUE);
|
|
menus_set_sensitive ("<Image>/File/Quit", TRUE);
|
|
}
|
|
}
|