Bug 657505 - Strange behaviour with SWM
when window positions aren't automatically saved. Save "hide-docks" and "single-window-mode" in sessionrc instead of gimprc, so a session layout is always saved either completely or not at all. Also change "last-tip-shown" saving a bit so all three session-saved gimprc properties are implemented the same.
This commit is contained in:
@ -51,8 +51,6 @@ enum
|
||||
PROP_RESTORE_SESSION,
|
||||
PROP_SAVE_TOOL_OPTIONS,
|
||||
PROP_SHOW_TOOLTIPS,
|
||||
PROP_HIDE_DOCKS,
|
||||
PROP_SINGLE_WINDOW_MODE,
|
||||
PROP_TEAROFF_MENUS,
|
||||
PROP_CAN_CHANGE_ACCELS,
|
||||
PROP_SAVE_ACCELS,
|
||||
@ -75,6 +73,10 @@ enum
|
||||
PROP_CURSOR_FORMAT,
|
||||
PROP_CURSOR_HANDEDNESS,
|
||||
|
||||
PROP_HIDE_DOCKS,
|
||||
PROP_SINGLE_WINDOW_MODE,
|
||||
PROP_LAST_TIP_SHOWN,
|
||||
|
||||
/* ignored, only for backward compatibility: */
|
||||
PROP_INFO_WINDOW_PER_DISPLAY,
|
||||
PROP_MENU_MNEMONICS,
|
||||
@ -151,15 +153,6 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
|
||||
TRUE,
|
||||
GIMP_PARAM_STATIC_STRINGS |
|
||||
GIMP_CONFIG_PARAM_RESTART);
|
||||
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_HIDE_DOCKS,
|
||||
"hide-docks", HIDE_DOCKS_BLURB,
|
||||
FALSE,
|
||||
GIMP_PARAM_STATIC_STRINGS |
|
||||
GIMP_CONFIG_PARAM_RESTART);
|
||||
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SINGLE_WINDOW_MODE,
|
||||
"single-window-mode", SINGLE_WINDOW_MODE_BLURB,
|
||||
FALSE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TEAROFF_MENUS,
|
||||
"tearoff-menus", TEAROFF_MENUS_BLURB,
|
||||
TRUE,
|
||||
@ -262,6 +255,30 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
|
||||
GIMP_HANDEDNESS_RIGHT,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_property (object_class, PROP_HIDE_DOCKS,
|
||||
g_param_spec_boolean ("hide-docks",
|
||||
NULL,
|
||||
HIDE_DOCKS_BLURB,
|
||||
FALSE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT |
|
||||
GIMP_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (object_class, PROP_SINGLE_WINDOW_MODE,
|
||||
g_param_spec_boolean ("single-window-mode",
|
||||
NULL,
|
||||
SINGLE_WINDOW_MODE_BLURB,
|
||||
FALSE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT |
|
||||
GIMP_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (object_class, PROP_LAST_TIP_SHOWN,
|
||||
g_param_spec_int ("last-tip-shown",
|
||||
NULL, NULL,
|
||||
0, G_MAXINT, 0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT |
|
||||
GIMP_PARAM_STATIC_STRINGS));
|
||||
|
||||
/* only for backward compatibility: */
|
||||
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_INFO_WINDOW_PER_DISPLAY,
|
||||
"info-window-per-display",
|
||||
@ -356,12 +373,6 @@ gimp_gui_config_set_property (GObject *object,
|
||||
case PROP_SHOW_TOOLTIPS:
|
||||
gui_config->show_tooltips = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_HIDE_DOCKS:
|
||||
gui_config->hide_docks = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_SINGLE_WINDOW_MODE:
|
||||
gui_config->single_window_mode = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_TEAROFF_MENUS:
|
||||
gui_config->tearoff_menus = g_value_get_boolean (value);
|
||||
break;
|
||||
@ -430,6 +441,16 @@ gimp_gui_config_set_property (GObject *object,
|
||||
gui_config->cursor_handedness = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
case PROP_HIDE_DOCKS:
|
||||
gui_config->hide_docks = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_SINGLE_WINDOW_MODE:
|
||||
gui_config->single_window_mode = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_LAST_TIP_SHOWN:
|
||||
gui_config->last_tip_shown = g_value_get_int (value);
|
||||
break;
|
||||
|
||||
case PROP_INFO_WINDOW_PER_DISPLAY:
|
||||
case PROP_MENU_MNEMONICS:
|
||||
case PROP_SHOW_TOOL_TIPS:
|
||||
@ -480,12 +501,6 @@ gimp_gui_config_get_property (GObject *object,
|
||||
case PROP_SHOW_TOOLTIPS:
|
||||
g_value_set_boolean (value, gui_config->show_tooltips);
|
||||
break;
|
||||
case PROP_HIDE_DOCKS:
|
||||
g_value_set_boolean (value, gui_config->hide_docks);
|
||||
break;
|
||||
case PROP_SINGLE_WINDOW_MODE:
|
||||
g_value_set_boolean (value, gui_config->single_window_mode);
|
||||
break;
|
||||
case PROP_TEAROFF_MENUS:
|
||||
g_value_set_boolean (value, gui_config->tearoff_menus);
|
||||
break;
|
||||
@ -550,6 +565,16 @@ gimp_gui_config_get_property (GObject *object,
|
||||
g_value_set_enum (value, gui_config->cursor_handedness);
|
||||
break;
|
||||
|
||||
case PROP_HIDE_DOCKS:
|
||||
g_value_set_boolean (value, gui_config->hide_docks);
|
||||
break;
|
||||
case PROP_SINGLE_WINDOW_MODE:
|
||||
g_value_set_boolean (value, gui_config->single_window_mode);
|
||||
break;
|
||||
case PROP_LAST_TIP_SHOWN:
|
||||
g_value_set_int (value, gui_config->last_tip_shown);
|
||||
break;
|
||||
|
||||
case PROP_INFO_WINDOW_PER_DISPLAY:
|
||||
case PROP_MENU_MNEMONICS:
|
||||
case PROP_SHOW_TOOL_TIPS:
|
||||
|
@ -45,8 +45,6 @@ struct _GimpGuiConfig
|
||||
gboolean restore_session;
|
||||
gboolean save_tool_options;
|
||||
gboolean show_tooltips;
|
||||
gboolean hide_docks;
|
||||
gboolean single_window_mode;
|
||||
gboolean tearoff_menus;
|
||||
gboolean can_change_accels;
|
||||
gboolean save_accels;
|
||||
@ -70,7 +68,10 @@ struct _GimpGuiConfig
|
||||
GimpCursorFormat cursor_format;
|
||||
GimpHandedness cursor_handedness;
|
||||
|
||||
gint last_tip; /* saved in sessionrc */
|
||||
/* saved in sessionrc */
|
||||
gboolean hide_docks;
|
||||
gboolean single_window_mode;
|
||||
gint last_tip_shown;
|
||||
};
|
||||
|
||||
struct _GimpGuiConfigClass
|
||||
|
@ -117,10 +117,10 @@ tips_dialog_create (Gimp *gimp)
|
||||
|
||||
config = GIMP_GUI_CONFIG (gimp->config);
|
||||
|
||||
if (config->last_tip >= tips_count || config->last_tip < 0)
|
||||
config->last_tip = 0;
|
||||
if (config->last_tip_shown >= tips_count || config->last_tip_shown < 0)
|
||||
config->last_tip_shown = 0;
|
||||
|
||||
current_tip = g_list_nth (tips, config->last_tip);
|
||||
current_tip = g_list_nth (tips, config->last_tip_shown);
|
||||
|
||||
if (tips_dialog)
|
||||
return tips_dialog;
|
||||
@ -208,7 +208,7 @@ tips_dialog_destroy (GtkWidget *widget,
|
||||
GimpGuiConfig *config)
|
||||
{
|
||||
/* the last-shown-tip is saved in sessionrc */
|
||||
config->last_tip = g_list_position (tips, current_tip);
|
||||
config->last_tip_shown = g_list_position (tips, current_tip);
|
||||
|
||||
tips_dialog = NULL;
|
||||
current_tip = NULL;
|
||||
|
@ -58,6 +58,8 @@
|
||||
enum
|
||||
{
|
||||
SESSION_INFO = 1,
|
||||
HIDE_DOCKS,
|
||||
SINGLE_WINDOW_MODE,
|
||||
LAST_TIP_SHOWN
|
||||
};
|
||||
|
||||
@ -108,6 +110,10 @@ session_init (Gimp *gimp)
|
||||
|
||||
g_scanner_scope_add_symbol (scanner, 0, "session-info",
|
||||
GINT_TO_POINTER (SESSION_INFO));
|
||||
g_scanner_scope_add_symbol (scanner, 0, "hide-docks",
|
||||
GINT_TO_POINTER (HIDE_DOCKS));
|
||||
g_scanner_scope_add_symbol (scanner, 0, "single-window-mode",
|
||||
GINT_TO_POINTER (SINGLE_WINDOW_MODE));
|
||||
g_scanner_scope_add_symbol (scanner, 0, "last-tip-shown",
|
||||
GINT_TO_POINTER (LAST_TIP_SHOWN));
|
||||
|
||||
@ -215,14 +221,44 @@ session_init (Gimp *gimp)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (scanner->value.v_symbol == GINT_TO_POINTER (HIDE_DOCKS))
|
||||
{
|
||||
gboolean hide_docks;
|
||||
|
||||
token = G_TOKEN_IDENTIFIER;
|
||||
|
||||
if (! gimp_scanner_parse_boolean (scanner, &hide_docks))
|
||||
break;
|
||||
|
||||
g_object_set (gimp->config,
|
||||
"hide-docks", hide_docks,
|
||||
NULL);
|
||||
}
|
||||
else if (scanner->value.v_symbol == GINT_TO_POINTER (SINGLE_WINDOW_MODE))
|
||||
{
|
||||
gboolean single_window_mode;
|
||||
|
||||
token = G_TOKEN_IDENTIFIER;
|
||||
|
||||
if (! gimp_scanner_parse_boolean (scanner, &single_window_mode))
|
||||
break;
|
||||
|
||||
g_object_set (gimp->config,
|
||||
"single-window-mode", single_window_mode,
|
||||
NULL);
|
||||
}
|
||||
else if (scanner->value.v_symbol == GINT_TO_POINTER (LAST_TIP_SHOWN))
|
||||
{
|
||||
GimpGuiConfig *config = GIMP_GUI_CONFIG (gimp->config);
|
||||
gint last_tip_shown;
|
||||
|
||||
token = G_TOKEN_INT;
|
||||
|
||||
if (! gimp_scanner_parse_int (scanner, &config->last_tip))
|
||||
if (! gimp_scanner_parse_int (scanner, &last_tip_shown))
|
||||
break;
|
||||
|
||||
g_object_set (gimp->config,
|
||||
"last-tip-shown", last_tip_shown,
|
||||
NULL);
|
||||
}
|
||||
token = G_TOKEN_RIGHT_PAREN;
|
||||
break;
|
||||
@ -310,14 +346,21 @@ session_save (Gimp *gimp,
|
||||
gimp_dialog_factory_save (gimp_dialog_factory_get_singleton (), writer);
|
||||
gimp_config_writer_linefeed (writer);
|
||||
|
||||
/* save last tip shown
|
||||
*
|
||||
* FIXME: Make last-tip-shown increment only when used within the
|
||||
* session
|
||||
*/
|
||||
gimp_config_writer_open (writer, "hide-docks");
|
||||
gimp_config_writer_identifier (writer,
|
||||
GIMP_GUI_CONFIG (gimp->config)->hide_docks ?
|
||||
"yes" : "no");
|
||||
gimp_config_writer_close (writer);
|
||||
|
||||
gimp_config_writer_open (writer, "single-window-mode");
|
||||
gimp_config_writer_identifier (writer,
|
||||
GIMP_GUI_CONFIG (gimp->config)->single_window_mode ?
|
||||
"yes" : "no");
|
||||
gimp_config_writer_close (writer);
|
||||
|
||||
gimp_config_writer_open (writer, "last-tip-shown");
|
||||
gimp_config_writer_printf (writer, "%d",
|
||||
GIMP_GUI_CONFIG (gimp->config)->last_tip);
|
||||
GIMP_GUI_CONFIG (gimp->config)->last_tip_shown);
|
||||
gimp_config_writer_close (writer);
|
||||
|
||||
if (! gimp_config_writer_finish (writer, "end of sessionrc", &error))
|
||||
|
Reference in New Issue
Block a user