app/config/gimpguiconfig.[ch] added "gboolean save_accels" and "gboolean

2003-04-08  Michael Natterer  <mitch@gimp.org>

	* app/config/gimpguiconfig.[ch]
	* app/config/gimprc-blurbs.h: added "gboolean save_accels" and
	"gboolean restore_accels".

	* app/gui/menus.[ch]: added menus_restore(), menus_save() and
	menus_clear().

	* app/gui/session.[ch]: added session_clear().

	* app/gui/gui.c: call menus_restore() and menus_save().

	* app/gui/preferences-dialog.c: brought the full core config
	options overkill to the GUI. Needs to be simplified. Cleaned
	up the "Interface" page a bit.
This commit is contained in:
Michael Natterer 2003-04-08 10:02:42 +00:00 committed by Michael Natterer
parent 0dd49fd559
commit 5797c03295
13 changed files with 257 additions and 52 deletions

View File

@ -1,3 +1,20 @@
2003-04-08 Michael Natterer <mitch@gimp.org>
* app/config/gimpguiconfig.[ch]
* app/config/gimprc-blurbs.h: added "gboolean save_accels" and
"gboolean restore_accels".
* app/gui/menus.[ch]: added menus_restore(), menus_save() and
menus_clear().
* app/gui/session.[ch]: added session_clear().
* app/gui/gui.c: call menus_restore() and menus_save().
* app/gui/preferences-dialog.c: brought the full core config
options overkill to the GUI. Needs to be simplified. Cleaned
up the "Interface" page a bit.
2003-04-07 Sven Neumann <sven@gimp.org>
* app/tools/gimpeditselectiontool.c (selection_transform_segs):

View File

@ -66,6 +66,8 @@ enum
PROP_SHOW_TOOL_TIPS,
PROP_TEAROFF_MENUS,
PROP_CAN_CHANGE_ACCELS,
PROP_SAVE_ACCELS,
PROP_RESTORE_ACCELS,
PROP_LAST_OPENED_SIZE,
PROP_MAX_NEW_IMAGE_SIZE,
PROP_THEME_PATH,
@ -170,6 +172,14 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
"can-change-accels", CAN_CHANGE_ACCELS_BLURB,
FALSE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SAVE_ACCELS,
"save-accels", SAVE_ACCELS_BLURB,
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RESTORE_ACCELS,
"restore-accels", RESTORE_ACCELS_BLURB,
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_LAST_OPENED_SIZE,
"last-opened-size", LAST_OPENED_SIZE_BLURB,
0, 1024, 4,
@ -260,6 +270,12 @@ gimp_gui_config_set_property (GObject *object,
case PROP_CAN_CHANGE_ACCELS:
gui_config->can_change_accels = g_value_get_boolean (value);
break;
case PROP_SAVE_ACCELS:
gui_config->save_accels = g_value_get_boolean (value);
break;
case PROP_RESTORE_ACCELS:
gui_config->restore_accels = g_value_get_boolean (value);
break;
case PROP_LAST_OPENED_SIZE:
gui_config->last_opened_size = g_value_get_int (value);
break;
@ -335,6 +351,12 @@ gimp_gui_config_get_property (GObject *object,
case PROP_CAN_CHANGE_ACCELS:
g_value_set_boolean (value, gui_config->can_change_accels);
break;
case PROP_SAVE_ACCELS:
g_value_set_boolean (value, gui_config->save_accels);
break;
case PROP_RESTORE_ACCELS:
g_value_set_boolean (value, gui_config->restore_accels);
break;
case PROP_LAST_OPENED_SIZE:
g_value_set_int (value, gui_config->last_opened_size);
break;

View File

@ -52,6 +52,8 @@ struct _GimpGuiConfig
gboolean show_tool_tips;
gboolean tearoff_menus;
gboolean can_change_accels;
gboolean save_accels;
gboolean restore_accels;
gint last_opened_size;
gulong max_new_image_size;
gchar *theme_path;

View File

@ -280,6 +280,12 @@ N_("When enabled, menus can be torn off.")
#define CAN_CHANGE_ACCELS_BLURB \
N_("When enabled, you can change keyboard shortcuts for menu items on the fly.")
#define SAVE_ACCELS_BLURB \
N_("Save changed keyboard shortcuts when the GIMP exits.")
#define RESTORE_ACCELS_BLURB \
N_("Restore saved keyboard shortcuts on each GIMP startup.")
#define TEMP_PATH_BLURB \
N_("Sets the temporary storage directory. Files will appear here " \
"during the course of running the GIMP. Most files will disappear " \

View File

@ -42,6 +42,7 @@
#include "widgets/gimppropwidgets.h"
#include "gui.h"
#include "menus.h"
#include "resolution-calibrate-dialog.h"
#include "session.h"
@ -1092,13 +1093,13 @@ prefs_dialog_new (Gimp *gimp,
page_index++);
/* General */
vbox2 = prefs_frame_new (_("General"), GTK_CONTAINER (vbox), FALSE);
vbox2 = prefs_frame_new (_("Previews"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "layer-previews",
_("_Enable Layer & Channel Previews"),
GTK_BOX (vbox2));
table = prefs_table_new (4, GTK_CONTAINER (vbox2), FALSE);
table = prefs_table_new (2, GTK_CONTAINER (vbox2), FALSE);
prefs_enum_option_menu_add (config, "layer-preview-size", 0, 0,
_("_Layer & Channel Preview Size:"),
@ -1106,9 +1107,6 @@ prefs_dialog_new (Gimp *gimp,
prefs_enum_option_menu_add (config, "navigation-preview-size", 0, 0,
_("_Navigation Preview Size:"),
GTK_TABLE (table), 1);
prefs_spin_button_add (config, "last-opened-size", 1.0, 5.0, 0,
_("_Recent Documents List Size:"),
GTK_TABLE (table), 3);
/* Dialog Bahavior */
vbox2 = prefs_frame_new (_("Dialog Behavior"), GTK_CONTAINER (vbox), FALSE);
@ -1124,9 +1122,47 @@ prefs_dialog_new (Gimp *gimp,
_("Enable _Tearoff Menus"),
GTK_BOX (vbox2));
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
prefs_spin_button_add (config, "last-opened-size", 1.0, 5.0, 0,
_("Open _Recent Menu Size:"),
GTK_TABLE (table), 3);
/* Keyboard Shortcuts */
vbox2 = prefs_frame_new (_("Keyboard Shortcuts"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "can-change-accels",
_("Dynamic _Keyboard Shortcuts"),
GTK_BOX (vbox2));
prefs_check_button_add (config, "save-accels",
_("Save Keyboard Shortcuts on Exit"),
GTK_BOX (vbox2));
prefs_check_button_add (config, "restore-accels",
_("Restore Saved Keyboard Shortcuts on Start-up"),
GTK_BOX (vbox2));
hbox = gtk_hbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
button = gtk_button_new_with_label (_("Save Keyboard Shortcuts Now"));
gtk_misc_set_padding (GTK_MISC (GTK_BIN (button)->child), 2, 0);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
gtk_widget_show (button);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (menus_save),
gimp);
button = gtk_button_new_with_label (_("Clear Saved Keyboard Shortcuts Now"));
gtk_misc_set_padding (GTK_MISC (GTK_BIN (button)->child), 2, 0);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
gtk_widget_show (button);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (menus_clear),
gimp);
/* Window Positions */
vbox2 = prefs_frame_new (_("Window Positions"), GTK_CONTAINER (vbox), FALSE);
@ -1138,19 +1174,28 @@ prefs_dialog_new (Gimp *gimp,
_("R_estore Saved Window Positions on Start-up"),
GTK_BOX (vbox2));
hbox = gtk_hbox_new (FALSE, 2);
hbox = gtk_hbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
button = gtk_button_new_with_label (_("Clear Saved Window Positions Now"));
button = gtk_button_new_with_label (_("Save Window Positions Now"));
gtk_misc_set_padding (GTK_MISC (GTK_BIN (button)->child), 2, 0);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
gtk_widget_show (button);
g_signal_connect (button, "clicked",
G_CALLBACK (gimp_dialog_factories_session_clear),
NULL);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (session_save),
gimp);
button = gtk_button_new_with_label (_("Clear Saved Window Positions Now"));
gtk_misc_set_padding (GTK_MISC (GTK_BIN (button)->child), 2, 0);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
gtk_widget_show (button);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (session_clear),
gimp);
/*****************************/

View File

@ -290,6 +290,8 @@ gui_restore (Gimp *gimp,
gimp->message_handler = GIMP_MESSAGE_BOX;
menus_restore (gimp);
toolbox_item_factory = gimp_menu_factory_menu_new (global_menu_factory,
"<Toolbox>",
GTK_TYPE_MENU_BAR,
@ -329,10 +331,8 @@ gui_post_init (Gimp *gimp)
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (GIMP_GUI_CONFIG (gimp->config)->show_tips)
{
gimp_dialog_factory_dialog_new (global_dialog_factory,
"gimp-tips-dialog", -1);
}
gimp_dialog_factory_dialog_new (global_dialog_factory,
"gimp-tips-dialog", -1);
}
void
@ -561,6 +561,7 @@ gui_exit_callback (Gimp *gimp,
gimp->message_handler = GIMP_CONSOLE;
session_save (gimp);
menus_save (gimp);
if (GIMP_GUI_CONFIG (gimp->config)->save_device_status)
gimp_devices_save (gimp);

View File

@ -91,8 +91,6 @@ static gboolean menus_initialized = FALSE;
void
menus_init (Gimp *gimp)
{
gchar *filename;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (menus_initialized == FALSE);
@ -234,23 +232,13 @@ menus_init (Gimp *gimp)
NULL, qmask_menu_update, TRUE,
n_qmask_menu_entries,
qmask_menu_entries);
filename = gimp_personal_rc_file ("menurc");
gtk_accel_map_load (filename);
g_free (filename);
}
void
menus_exit (Gimp *gimp)
{
gchar *filename;
g_return_if_fail (GIMP_IS_GIMP (gimp));
filename = gimp_personal_rc_file ("menurc");
gtk_accel_map_save (filename);
g_free (filename);
g_object_unref (global_menu_factory);
global_menu_factory = NULL;
@ -259,6 +247,44 @@ menus_exit (Gimp *gimp)
NULL);
}
void
menus_restore (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (GIMP_GUI_CONFIG (gimp->config)->restore_accels)
{
gchar *filename;
filename = gimp_personal_rc_file ("menurc");
gtk_accel_map_load (filename);
g_free (filename);
}
}
void
menus_save (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (GIMP_GUI_CONFIG (gimp->config)->save_accels)
{
gchar *filename;
filename = gimp_personal_rc_file ("menurc");
gtk_accel_map_save (filename);
g_free (filename);
}
}
void
menus_clear (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_print ("TODO: implement menus_clear()\n");
}
void
menus_last_opened_add (GimpItemFactory *item_factory,
Gimp *gimp)

View File

@ -32,6 +32,9 @@ extern GimpMenuFactory *global_menu_factory;
void menus_init (Gimp *gimp);
void menus_exit (Gimp *gimp);
void menus_restore (Gimp *gimp);
void menus_save (Gimp *gimp);
void menus_clear (Gimp *gimp);
void menus_last_opened_add (GimpItemFactory *item_factory,
Gimp *gimp);

View File

@ -42,6 +42,7 @@
#include "widgets/gimppropwidgets.h"
#include "gui.h"
#include "menus.h"
#include "resolution-calibrate-dialog.h"
#include "session.h"
@ -1092,13 +1093,13 @@ prefs_dialog_new (Gimp *gimp,
page_index++);
/* General */
vbox2 = prefs_frame_new (_("General"), GTK_CONTAINER (vbox), FALSE);
vbox2 = prefs_frame_new (_("Previews"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "layer-previews",
_("_Enable Layer & Channel Previews"),
GTK_BOX (vbox2));
table = prefs_table_new (4, GTK_CONTAINER (vbox2), FALSE);
table = prefs_table_new (2, GTK_CONTAINER (vbox2), FALSE);
prefs_enum_option_menu_add (config, "layer-preview-size", 0, 0,
_("_Layer & Channel Preview Size:"),
@ -1106,9 +1107,6 @@ prefs_dialog_new (Gimp *gimp,
prefs_enum_option_menu_add (config, "navigation-preview-size", 0, 0,
_("_Navigation Preview Size:"),
GTK_TABLE (table), 1);
prefs_spin_button_add (config, "last-opened-size", 1.0, 5.0, 0,
_("_Recent Documents List Size:"),
GTK_TABLE (table), 3);
/* Dialog Bahavior */
vbox2 = prefs_frame_new (_("Dialog Behavior"), GTK_CONTAINER (vbox), FALSE);
@ -1124,9 +1122,47 @@ prefs_dialog_new (Gimp *gimp,
_("Enable _Tearoff Menus"),
GTK_BOX (vbox2));
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
prefs_spin_button_add (config, "last-opened-size", 1.0, 5.0, 0,
_("Open _Recent Menu Size:"),
GTK_TABLE (table), 3);
/* Keyboard Shortcuts */
vbox2 = prefs_frame_new (_("Keyboard Shortcuts"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "can-change-accels",
_("Dynamic _Keyboard Shortcuts"),
GTK_BOX (vbox2));
prefs_check_button_add (config, "save-accels",
_("Save Keyboard Shortcuts on Exit"),
GTK_BOX (vbox2));
prefs_check_button_add (config, "restore-accels",
_("Restore Saved Keyboard Shortcuts on Start-up"),
GTK_BOX (vbox2));
hbox = gtk_hbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
button = gtk_button_new_with_label (_("Save Keyboard Shortcuts Now"));
gtk_misc_set_padding (GTK_MISC (GTK_BIN (button)->child), 2, 0);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
gtk_widget_show (button);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (menus_save),
gimp);
button = gtk_button_new_with_label (_("Clear Saved Keyboard Shortcuts Now"));
gtk_misc_set_padding (GTK_MISC (GTK_BIN (button)->child), 2, 0);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
gtk_widget_show (button);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (menus_clear),
gimp);
/* Window Positions */
vbox2 = prefs_frame_new (_("Window Positions"), GTK_CONTAINER (vbox), FALSE);
@ -1138,19 +1174,28 @@ prefs_dialog_new (Gimp *gimp,
_("R_estore Saved Window Positions on Start-up"),
GTK_BOX (vbox2));
hbox = gtk_hbox_new (FALSE, 2);
hbox = gtk_hbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
button = gtk_button_new_with_label (_("Clear Saved Window Positions Now"));
button = gtk_button_new_with_label (_("Save Window Positions Now"));
gtk_misc_set_padding (GTK_MISC (GTK_BIN (button)->child), 2, 0);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
gtk_widget_show (button);
g_signal_connect (button, "clicked",
G_CALLBACK (gimp_dialog_factories_session_clear),
NULL);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (session_save),
gimp);
button = gtk_button_new_with_label (_("Clear Saved Window Positions Now"));
gtk_misc_set_padding (GTK_MISC (GTK_BIN (button)->child), 2, 0);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
gtk_widget_show (button);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (session_clear),
gimp);
/*****************************/

View File

@ -236,6 +236,14 @@ session_save (Gimp *gimp)
gimp_config_writer_finish (writer, "end of sessionrc", NULL);
}
void
session_clear (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_print ("TODO: implement session_clear()\n");
}
/* private functions */

View File

@ -23,6 +23,7 @@
void session_init (Gimp *gimp);
void session_restore (Gimp *gimp);
void session_save (Gimp *gimp);
void session_clear (Gimp *gimp);
#endif /* __SESSION_H__ */

View File

@ -91,8 +91,6 @@ static gboolean menus_initialized = FALSE;
void
menus_init (Gimp *gimp)
{
gchar *filename;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (menus_initialized == FALSE);
@ -234,23 +232,13 @@ menus_init (Gimp *gimp)
NULL, qmask_menu_update, TRUE,
n_qmask_menu_entries,
qmask_menu_entries);
filename = gimp_personal_rc_file ("menurc");
gtk_accel_map_load (filename);
g_free (filename);
}
void
menus_exit (Gimp *gimp)
{
gchar *filename;
g_return_if_fail (GIMP_IS_GIMP (gimp));
filename = gimp_personal_rc_file ("menurc");
gtk_accel_map_save (filename);
g_free (filename);
g_object_unref (global_menu_factory);
global_menu_factory = NULL;
@ -259,6 +247,44 @@ menus_exit (Gimp *gimp)
NULL);
}
void
menus_restore (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (GIMP_GUI_CONFIG (gimp->config)->restore_accels)
{
gchar *filename;
filename = gimp_personal_rc_file ("menurc");
gtk_accel_map_load (filename);
g_free (filename);
}
}
void
menus_save (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (GIMP_GUI_CONFIG (gimp->config)->save_accels)
{
gchar *filename;
filename = gimp_personal_rc_file ("menurc");
gtk_accel_map_save (filename);
g_free (filename);
}
}
void
menus_clear (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_print ("TODO: implement menus_clear()\n");
}
void
menus_last_opened_add (GimpItemFactory *item_factory,
Gimp *gimp)

View File

@ -32,6 +32,9 @@ extern GimpMenuFactory *global_menu_factory;
void menus_init (Gimp *gimp);
void menus_exit (Gimp *gimp);
void menus_restore (Gimp *gimp);
void menus_save (Gimp *gimp);
void menus_clear (Gimp *gimp);
void menus_last_opened_add (GimpItemFactory *item_factory,
Gimp *gimp);