app/app_procs.[ch] app/main.c app/core/gimp.[ch] app/gui/gui.c allow to

2003-11-13  Sven Neumann  <sven@gimp.org>

	* app/app_procs.[ch]
	* app/main.c
	* app/core/gimp.[ch]
	* app/gui/gui.c
	* app/gui/session.[ch]: allow to pass a session name on the
	command-line. This causes a different sessionrc to be used. This
	is a bit hackish but our power users will probably love it.
	Also removed the useless --restore-session command-line option.

	* docs/gimp-1.3.1.in: changed accordingly.

	* app/core/gimpmarshal.list: removed obsolete marshaller.

	* app/config/gimprc.c (gimp_rc_new): improved gtk-doc comment.
This commit is contained in:
Sven Neumann 2003-11-13 14:14:20 +00:00 committed by Sven Neumann
parent ff9cf41f9f
commit a843b2adfd
12 changed files with 106 additions and 59 deletions

View File

@ -1,3 +1,20 @@
2003-11-13 Sven Neumann <sven@gimp.org>
* app/app_procs.[ch]
* app/main.c
* app/core/gimp.[ch]
* app/gui/gui.c
* app/gui/session.[ch]: allow to pass a session name on the
command-line. This causes a different sessionrc to be used. This
is a bit hackish but our power users will probably love it.
Also removed the useless --restore-session command-line option.
* docs/gimp-1.3.1.in: changed accordingly.
* app/core/gimpmarshal.list: removed obsolete marshaller.
* app/config/gimprc.c (gimp_rc_new): improved gtk-doc comment.
2003-11-13 Sven Neumann <sven@gimp.org>
* app/gui/stroke-dialog.c: remember the stroke settings in a less

View File

@ -84,6 +84,7 @@ app_init (const gchar *full_prog_name,
gchar **gimp_argv,
const gchar *alternate_system_gimprc,
const gchar *alternate_gimprc,
const gchar *session_name,
const gchar **batch_cmds,
gboolean no_interface,
gboolean no_data,
@ -94,8 +95,7 @@ app_init (const gchar *full_prog_name,
gboolean use_shm,
gboolean use_mmx,
gboolean console_messages,
GimpStackTraceMode stack_trace_mode,
gboolean restore_session)
GimpStackTraceMode stack_trace_mode)
{
GimpInitStatusFunc update_status_func = NULL;
@ -103,6 +103,7 @@ app_init (const gchar *full_prog_name,
* core object system
*/
the_gimp = gimp_new (full_prog_name,
session_name,
be_verbose,
no_data,
no_fonts,
@ -222,7 +223,7 @@ app_init (const gchar *full_prog_name,
/* Load all data files
*/
gimp_restore (the_gimp, update_status_func, restore_session);
gimp_restore (the_gimp, update_status_func);
/* enable autosave late so we don't autosave when the
* monitor resolution is set in gui_init()

View File

@ -38,6 +38,7 @@ void app_init (const gchar *full_prog_name,
gchar **gimp_argv,
const gchar *alternate_system_gimprc,
const gchar *alternate_gimprc,
const gchar *session_name,
const gchar **batch_cmds,
gboolean no_interface,
gboolean no_data,
@ -48,8 +49,7 @@ void app_init (const gchar *full_prog_name,
gboolean use_shm,
gboolean use_mmx,
gboolean console_messages,
GimpStackTraceMode stack_trace_mode,
gboolean restore_session);
GimpStackTraceMode stack_trace_mode);
#endif /* __APP_PROCS_H__ */

View File

@ -392,9 +392,9 @@ gimp_rc_notify (GimpRc *rc,
* gimp_rc_new:
* @system_gimprc: the name of the system-wide gimprc file or %NULL to
* use the standard location
* @user_gimprc: the name of the user gimprc file or %NULL to use the
* standard location
* @verbose:
* @user_gimprc: the name of the user gimprc file or %NULL to use the
* standard location
* @verbose: enable console messages about loading and saving
*
* Creates a new GimpRc object and loads the system-wide and the user
* configuration files.
@ -445,7 +445,7 @@ gimp_rc_set_autosave (GimpRc *rc,
/**
* gimp_rc_query:
* @rc: a #GimpRc object.
* @rc: a #GimpRc object.
* @key: a string used as a key for the lookup.
*
* This function looks up @key in the object properties of @rc. If

View File

@ -94,8 +94,7 @@ static gsize gimp_get_memsize (GimpObject *object,
static void gimp_real_initialize (Gimp *gimp,
GimpInitStatusFunc status_callback);
static void gimp_real_restore (Gimp *gimp,
GimpInitStatusFunc status_callback,
gboolean restore_session);
GimpInitStatusFunc status_callback);
static gboolean gimp_real_exit (Gimp *gimp,
gboolean kill_it);
@ -183,10 +182,9 @@ gimp_class_init (GimpClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GimpClass, restore),
NULL, NULL,
gimp_marshal_VOID__POINTER_BOOLEAN,
G_TYPE_NONE, 2,
G_TYPE_POINTER,
G_TYPE_BOOLEAN);
gimp_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
gimp_signals[EXIT] =
g_signal_new ("exit",
@ -211,7 +209,8 @@ gimp_class_init (GimpClass *klass)
static void
gimp_init (Gimp *gimp)
{
gimp->config = NULL;
gimp->config = NULL;
gimp->session_name = NULL;
gimp->be_verbose = FALSE;
gimp->no_data = FALSE;
@ -328,9 +327,7 @@ gimp_dispose (GObject *object)
static void
gimp_finalize (GObject *object)
{
Gimp *gimp;
gimp = GIMP (object);
Gimp *gimp = GIMP (object);
gimp_set_current_context (gimp, NULL);
gimp_set_user_context (gimp, NULL);
@ -473,6 +470,12 @@ gimp_finalize (GObject *object)
gimp->edit_config = NULL;
}
if (gimp->session_name)
{
g_free (gimp->session_name);
gimp->session_name = NULL;
}
if (gimp->user_units)
gimp_units_exit (gimp);
@ -673,8 +676,7 @@ gimp_real_initialize (Gimp *gimp,
static void
gimp_real_restore (Gimp *gimp,
GimpInitStatusFunc status_callback,
gboolean restore_session)
GimpInitStatusFunc status_callback)
{
if (gimp->be_verbose)
g_print ("INIT: gimp_real_restore\n");
@ -708,6 +710,7 @@ gimp_real_exit (Gimp *gimp,
Gimp *
gimp_new (const gchar *name,
const gchar *session_name,
gboolean be_verbose,
gboolean no_data,
gboolean no_fonts,
@ -720,8 +723,11 @@ gimp_new (const gchar *name,
g_return_val_if_fail (name != NULL, NULL);
gimp = g_object_new (GIMP_TYPE_GIMP, "name", name, NULL);
gimp = g_object_new (GIMP_TYPE_GIMP,
"name", name,
NULL);
gimp->session_name = g_strdup (session_name);
gimp->be_verbose = be_verbose ? TRUE : FALSE;
gimp->no_data = no_data ? TRUE : FALSE;
gimp->no_fonts = no_fonts ? TRUE : FALSE;
@ -865,8 +871,7 @@ gimp_initialize (Gimp *gimp,
void
gimp_restore (Gimp *gimp,
GimpInitStatusFunc status_callback,
gboolean restore_session)
GimpInitStatusFunc status_callback)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (status_callback != NULL);
@ -910,8 +915,7 @@ gimp_restore (Gimp *gimp,
(* status_callback) (NULL, _("Modules"), 0.8);
gimp_modules_load (gimp);
g_signal_emit (gimp, gimp_signals[RESTORE], 0,
status_callback, restore_session);
g_signal_emit (gimp, gimp_signals[RESTORE], 0, status_callback);
}
void

View File

@ -81,6 +81,7 @@ struct _Gimp
GimpCoreConfig *edit_config; /* don't use this one, it's just
* for the preferences dialog
*/
gchar *session_name;
gboolean be_verbose;
gboolean no_data;
@ -199,8 +200,7 @@ struct _GimpClass
void (* initialize) (Gimp *gimp,
GimpInitStatusFunc status_callback);
void (* restore) (Gimp *gimp,
GimpInitStatusFunc status_callback,
gboolean restore_session);
GimpInitStatusFunc status_callback);
gboolean (* exit) (Gimp *gimp,
gboolean kill_it);
};
@ -209,6 +209,7 @@ struct _GimpClass
GType gimp_get_type (void) G_GNUC_CONST;
Gimp * gimp_new (const gchar *name,
const gchar *session_name,
gboolean be_verbose,
gboolean no_data,
gboolean no_fonts,
@ -224,8 +225,7 @@ void gimp_load_config (Gimp *gimp,
void gimp_initialize (Gimp *gimp,
GimpInitStatusFunc status_callback);
void gimp_restore (Gimp *gimp,
GimpInitStatusFunc status_callback,
gboolean restore_session);
GimpInitStatusFunc status_callback);
void gimp_exit (Gimp *gimp,
gboolean kill_it);

View File

@ -41,6 +41,5 @@ VOID: OBJECT
VOID: OBJECT, INT
VOID: OBJECT, POINTER
VOID: POINTER
VOID: POINTER, BOOLEAN
VOID: STRING, FLAGS
VOID: VOID

View File

@ -78,11 +78,9 @@ static void gui_initialize_after_callback (Gimp *gimp,
GimpInitStatusFunc callback);
static void gui_restore_callback (Gimp *gimp,
GimpInitStatusFunc callback,
gboolean restore_session);
GimpInitStatusFunc callback);
static void gui_restore_after_callback (Gimp *gimp,
GimpInitStatusFunc callback,
gboolean restore_session);
GimpInitStatusFunc callback);
static gboolean gui_exit_callback (Gimp *gimp,
gboolean kill_it);
@ -311,8 +309,7 @@ gui_initialize_after_callback (Gimp *gimp,
static void
gui_restore_callback (Gimp *gimp,
GimpInitStatusFunc status_callback,
gboolean restore_session)
GimpInitStatusFunc status_callback)
{
GimpDisplayConfig *display_config = GIMP_DISPLAY_CONFIG (gimp->config);
GimpGuiConfig *gui_config = GIMP_GUI_CONFIG (gimp->config);
@ -368,8 +365,7 @@ gui_restore_callback (Gimp *gimp,
static void
gui_restore_after_callback (Gimp *gimp,
GimpInitStatusFunc status_callback,
gboolean restore_session)
GimpInitStatusFunc status_callback)
{
GimpGuiConfig *gui_config = GIMP_GUI_CONFIG (gimp->config);
@ -398,7 +394,7 @@ gui_restore_after_callback (Gimp *gimp,
if (status_callback == splash_update)
splash_destroy ();
if (gui_config->restore_session || restore_session)
if (gui_config->restore_session)
session_restore (gimp);
dialogs_show_toolbox ();

View File

@ -55,6 +55,9 @@ enum
};
static gchar * session_filename (Gimp *gimp);
/* public functions */
void
@ -67,7 +70,8 @@ session_init (Gimp *gimp)
g_return_if_fail (GIMP_IS_GIMP (gimp));
filename = gimp_personal_rc_file ("sessionrc");
filename = session_filename (gimp);
scanner = gimp_scanner_new_file (filename, &error);
if (! scanner && error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT)
@ -187,7 +191,7 @@ session_save (Gimp *gimp)
g_return_if_fail (GIMP_IS_GIMP (gimp));
filename = gimp_personal_rc_file ("sessionrc");
filename = session_filename (gimp);
writer =
gimp_config_writer_new_file (filename,
@ -229,3 +233,20 @@ session_clear (Gimp *gimp)
g_print ("TODO: implement session_clear()\n");
}
static gchar *
session_filename (Gimp *gimp)
{
gchar *filename = gimp_personal_rc_file ("sessionrc");
if (gimp->session_name)
{
gchar *tmp = g_strconcat (filename, ".", gimp->session_name, NULL);
g_free (filename);
filename = tmp;
}
return filename;
}

View File

@ -93,6 +93,7 @@ main (int argc,
gchar *full_prog_name = NULL;
gchar *alternate_system_gimprc = NULL;
gchar *alternate_gimprc = NULL;
gchar *session_name = NULL;
gchar **batch_cmds = NULL;
gboolean show_help = FALSE;
gboolean no_interface = FALSE;
@ -106,8 +107,7 @@ main (int argc,
gboolean console_messages = FALSE;
gboolean use_debug_handler = FALSE;
GimpStackTraceMode stack_trace_mode = GIMP_STACK_TRACE_QUERY;
gboolean restore_session = FALSE;
gint i, j;
gint i, j;
#if 0
g_mem_set_vtable (glib_mem_profiler_table);
@ -322,11 +322,18 @@ main (int argc,
console_messages = TRUE;
argv[i] = NULL;
}
else if ((strcmp (argv[i], "--restore-session") == 0) ||
(strcmp (argv[i], "-r") == 0))
else if (strcmp (argv[i], "--session") == 0)
{
restore_session = TRUE;
argv[i] = NULL;
argv[i] = NULL;
if (argc <= ++i)
{
show_help = TRUE;
}
else
{
session_name = argv[i];
argv[i] = NULL;
}
}
else if (strcmp (argv[i], "--enable-stack-trace") == 0)
{
@ -428,6 +435,7 @@ main (int argc,
argv + 1,
alternate_system_gimprc,
alternate_gimprc,
session_name,
(const gchar **) batch_cmds,
no_interface,
no_data,
@ -438,8 +446,7 @@ main (int argc,
use_shm,
use_mmx,
console_messages,
stack_trace_mode,
restore_session);
stack_trace_mode);
g_free (batch_cmds);
@ -471,7 +478,7 @@ gimp_show_help (const gchar *progname)
g_print (_(" --display <display> Use the designated X display.\n"));
g_print (_(" -s, --no-splash Do not show the startup window.\n"));
g_print (_(" -S, --no-splash-image Do not add an image to the startup window.\n"));
g_print (_(" -r, --restore-session Try to restore saved session.\n"));
g_print (_(" --session <name> Use an alternate sessionrc file.\n"));
g_print (_(" -g, --gimprc <gimprc> Use an alternate gimprc file.\n"));
g_print (_(" --system-gimprc <gimprc> Use an alternate system gimprc file.\n"));
g_print (_(" --dump-gimprc Output a gimprc file with default settings.\n"));

View File

@ -1,4 +1,4 @@
.TH GIMP 1 "5 November 2003" "Version @GIMP_VERSION@" "GIMP Manual Pages"
.TH GIMP 1 "13 November 2003" "Version @GIMP_VERSION@" "GIMP Manual Pages"
.SH NAME
gimp - an image manipulation and paint program.
.SH SYNOPSIS
@ -6,7 +6,7 @@ gimp - an image manipulation and paint program.
[\-h] [\-\-help] [-v] [\-\-version] [\-\-verbose] [\-\-no\-shm]
[\-\-no\-mmx] [\-\-display \fIdisplay\fP] [\-d] [\-\-no\-data]
[\-f] [\-\-no\-fonts] [\-i] [\-\-no\-interface] [\-s] [\-\-no\-splash]
[\-S] [\-\-no\-splash\-image] [\-r] [\-\-restore\-session]
[\-S] [\-\-no\-splash\-image] [\-\-session \fI<name>\fP]
[\-g] [\-\-gimprc \fI<gimprc>\fP] [\-\-system\-gimprc \fI<gimprc>\fP]
[\-\-dump\-gimprc\fP] [\-\-console\-messages] [\-\-debug\-handlers]
[\-b] [\-\-batch \fI<commands>\fP]
@ -73,8 +73,9 @@ Do not show the splash screen.
.B \-S, \-\-no\-splash\-image
Do not show the splash screen image as part of the splash screen.
.TP 8
.B \-r, \-\-restore\-session
Try to restore saved session.
.B \-\-session \fI<name>\fP
Use a different sessionrc for this GIMP session. The given session
name is appended to the default sessionrc filename.
.TP 8
.B \-g, \-\-gimprc \fI<gimprc>\fP
Use an alternative gimprc instead of the default one. Useful in

View File

@ -1,4 +1,4 @@
.TH GIMP 1 "5 November 2003" "Version @GIMP_VERSION@" "GIMP Manual Pages"
.TH GIMP 1 "13 November 2003" "Version @GIMP_VERSION@" "GIMP Manual Pages"
.SH NAME
gimp - an image manipulation and paint program.
.SH SYNOPSIS
@ -6,7 +6,7 @@ gimp - an image manipulation and paint program.
[\-h] [\-\-help] [-v] [\-\-version] [\-\-verbose] [\-\-no\-shm]
[\-\-no\-mmx] [\-\-display \fIdisplay\fP] [\-d] [\-\-no\-data]
[\-f] [\-\-no\-fonts] [\-i] [\-\-no\-interface] [\-s] [\-\-no\-splash]
[\-S] [\-\-no\-splash\-image] [\-r] [\-\-restore\-session]
[\-S] [\-\-no\-splash\-image] [\-\-session \fI<name>\fP]
[\-g] [\-\-gimprc \fI<gimprc>\fP] [\-\-system\-gimprc \fI<gimprc>\fP]
[\-\-dump\-gimprc\fP] [\-\-console\-messages] [\-\-debug\-handlers]
[\-b] [\-\-batch \fI<commands>\fP]
@ -73,8 +73,9 @@ Do not show the splash screen.
.B \-S, \-\-no\-splash\-image
Do not show the splash screen image as part of the splash screen.
.TP 8
.B \-r, \-\-restore\-session
Try to restore saved session.
.B \-\-session \fI<name>\fP
Use a different sessionrc for this GIMP session. The given session
name is appended to the default sessionrc filename.
.TP 8
.B \-g, \-\-gimprc \fI<gimprc>\fP
Use an alternative gimprc instead of the default one. Useful in