1998-06-23 01:30:40 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2001-12-18 20:39:45 +08:00
|
|
|
* Session-managment stuff
|
|
|
|
* Copyright (C) 1998 Sven Neumann <sven@gimp.org>
|
|
|
|
*
|
1998-06-23 01:30:40 +08:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
1999-03-07 20:56:03 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
1998-06-23 01:30:40 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
|
1998-07-19 20:02:29 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-05-22 04:30:16 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2001-04-18 00:00:27 +08:00
|
|
|
|
2001-08-17 22:27:31 +08:00
|
|
|
#include "gui-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-10-24 00:23:32 +08:00
|
|
|
#include "core/gimp.h"
|
|
|
|
|
2001-04-17 02:49:29 +08:00
|
|
|
#include "widgets/gimpdialogfactory.h"
|
|
|
|
|
2001-04-18 05:43:29 +08:00
|
|
|
#include "color-notebook.h"
|
|
|
|
#include "session.h"
|
|
|
|
|
1998-06-23 01:30:40 +08:00
|
|
|
#include "gimprc.h"
|
|
|
|
|
2000-02-12 23:01:33 +08:00
|
|
|
|
1998-06-23 01:30:40 +08:00
|
|
|
|
2001-01-16 22:47:09 +08:00
|
|
|
/* public functions */
|
|
|
|
|
2001-04-18 00:00:27 +08:00
|
|
|
void
|
2001-10-24 00:23:32 +08:00
|
|
|
session_init (Gimp *gimp)
|
1998-06-23 01:30:40 +08:00
|
|
|
{
|
2001-04-18 00:00:27 +08:00
|
|
|
gchar *filename;
|
1998-07-12 06:23:23 +08:00
|
|
|
|
2001-10-24 00:23:32 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
2001-04-18 00:00:27 +08:00
|
|
|
filename = gimp_personal_rc_file ("sessionrc");
|
2000-03-25 06:10:28 +08:00
|
|
|
|
removed the gimp_busy boolean, check whether user_installation is needed
2001-07-10 Michael Natterer <mitch@gimp.org>
* app/app_procs.[ch]: removed the gimp_busy boolean, check whether
user_installation is needed here, not in user_install.c, parse
gtkrc an friends only if(!no_interface), create the Gimp object
before parsing gimp's rc files an pas it to the parse functions,
many other cleanups.
* app/appenums.h: added MessageHandlerType and StackTraceMode.
* app/appenv.h: removed MessageHandlerType, declare all global
variables from main.c (no more hidden global stuff please).
* app/errors.[ch]: added the fatal message func here (from main.c),
removed the StackTraceMode enum.
* app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp
pointer to some functions.
* app/gimpunit.c
* app/unitrc.h: ok, this is ugly: renamed all functions to
_gimp_unit_*() and made them public. The unit list is part
of the Gimp object now, so pass a Gimp* to all functions.
* app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*()
functions which are used by widgets.
* app/main.c: cleaned up the global variables, removed the fatal
message handler, call app_init() directly, not via the
user_install stuff, misc. cleanups.
* app/user_install.[ch]: removed the check if user_installation is
needed (done by app_procs.c now).
* app/core/gimp.[ch]: added the user_unit list and the "busy"
boolean. Moved gimp_[set|unset]_busy() here. Added
gimp_initialize() which is called after unitrc and gimprc are
parsed.
* app/batch.c
* app/colormaps.c
* app/devices.c
* app/disp_callbacks.c
* app/gdisplay_ops.c
* app/gimphelp.c
* app/module_db.c
* app/nav_window.c
* app/plug_in.c
* app/core/gimpcontext.c
* app/core/gimpdatafiles.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage.c
* app/core/gimpparasite.c
* app/core/gimpparasitelist.h
* app/gui/file-open-dialog.c
* app/gui/gui.[ch]
* app/gui/info-dialog.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/session.c
* app/gui/tips-dialog.c
* app/gui/toolbox.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimptransformtool.c
* app/tools/tool_manager.c
* app/widgets/gimpcolorpanel.c
* app/widgets/gimpcursor.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/xcf/xcf.c
* tools/pdbgen/Makefile.am
* tools/pdbgen/app.pl
* tools/pdbgen/enums.pl
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/message.pdb
* tools/pdbgen/pdb/unit.pdb
* app/pdb/image_cmds.c
* app/pdb/message_cmds.c
* app/pdb/unit_cmds.c: changed accordingly, minor cleanups.
2001-07-11 03:16:16 +08:00
|
|
|
if (! gimprc_parse_file (filename))
|
2000-03-25 06:10:28 +08:00
|
|
|
{
|
2001-04-18 00:00:27 +08:00
|
|
|
/* always show L&C&P, Tool Options and Brushes on first invocation */
|
1998-06-23 01:30:40 +08:00
|
|
|
|
2001-04-18 00:00:27 +08:00
|
|
|
/* TODO */
|
2000-03-25 06:10:28 +08:00
|
|
|
}
|
|
|
|
|
2001-04-18 00:00:27 +08:00
|
|
|
g_free (filename);
|
|
|
|
}
|
2000-03-25 06:10:28 +08:00
|
|
|
|
2001-04-18 00:00:27 +08:00
|
|
|
void
|
2001-10-24 00:23:32 +08:00
|
|
|
session_restore (Gimp *gimp)
|
2001-04-18 00:00:27 +08:00
|
|
|
{
|
2001-10-24 00:23:32 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
2001-10-22 20:13:44 +08:00
|
|
|
gimp_dialog_factories_session_restore ();
|
1998-06-23 01:30:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-10-24 00:23:32 +08:00
|
|
|
session_save (Gimp *gimp)
|
1998-06-23 01:30:40 +08:00
|
|
|
{
|
2000-02-12 23:01:33 +08:00
|
|
|
gchar *filename;
|
|
|
|
FILE *fp;
|
1998-06-23 01:30:40 +08:00
|
|
|
|
2001-10-24 00:23:32 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
1999-03-07 20:56:03 +08:00
|
|
|
filename = gimp_personal_rc_file ("sessionrc");
|
1998-06-23 01:30:40 +08:00
|
|
|
|
1999-06-28 01:37:47 +08:00
|
|
|
fp = fopen (filename, "wt");
|
1999-03-07 20:56:03 +08:00
|
|
|
g_free (filename);
|
|
|
|
if (!fp)
|
|
|
|
return;
|
1998-06-24 06:50:16 +08:00
|
|
|
|
2000-02-12 23:01:33 +08:00
|
|
|
fprintf (fp, ("# GIMP sessionrc\n"
|
|
|
|
"# This file takes session-specific info (that is info,\n"
|
|
|
|
"# you want to keep between two gimp-sessions). You are\n"
|
|
|
|
"# not supposed to edit it manually, but of course you\n"
|
|
|
|
"# can do. This file will be entirely rewritten every time\n"
|
|
|
|
"# you quit the gimp. If this file isn't found, defaults\n"
|
|
|
|
"# are used.\n\n"));
|
|
|
|
|
2001-04-17 02:49:29 +08:00
|
|
|
gimp_dialog_factories_session_save (fp);
|
|
|
|
|
1999-03-07 20:56:03 +08:00
|
|
|
/* save last tip shown */
|
2001-06-04 04:40:50 +08:00
|
|
|
fprintf (fp, "(last-tip-shown %d)\n\n", gimprc.last_tip + 1);
|
2001-01-16 22:47:09 +08:00
|
|
|
|
|
|
|
color_history_write (fp);
|
2000-02-12 23:01:33 +08:00
|
|
|
|
1999-03-07 20:56:03 +08:00
|
|
|
fclose (fp);
|
1998-06-23 01:30:40 +08:00
|
|
|
}
|