diff --git a/ChangeLog b/ChangeLog index 7c482638cc..3e4e10383c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2003-04-01 Manish Singh + + * config/gimpguiconfig.[ch]: added gboolean can_change_accels + + * config/gimprc-blurbs.h: blurb for the above + + * gui/preferences-dialog.c: UI for the above. Has warning about + not working in GNOME2 yet (pending resolution of Bug #109653) + + * gui/menus.c: use can_change_accels. It simply parses the rc + string gtk-can-change-accels = [0|1] depending on the state + of can_change_accels in the gui config. + + * etc/gimprc + * docs/gimprc-1.3.5.in: regenerated + 2003-04-01 Sven Neumann * app/text/gimptext-compat.c (text_render): strip the size from diff --git a/app/config/gimpguiconfig.c b/app/config/gimpguiconfig.c index 5ffdc5a148..98edb29924 100644 --- a/app/config/gimpguiconfig.c +++ b/app/config/gimpguiconfig.c @@ -65,6 +65,7 @@ enum PROP_SHOW_TIPS, PROP_SHOW_TOOL_TIPS, PROP_TEAROFF_MENUS, + PROP_CAN_CHANGE_ACCELS, PROP_LAST_OPENED_SIZE, PROP_MAX_NEW_IMAGE_SIZE, PROP_THEME_PATH, @@ -165,6 +166,10 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass) "tearoff-menus", TEAROFF_MENUS_BLURB, TRUE, GIMP_PARAM_RESTART); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_CAN_CHANGE_ACCELS, + "can-change-accels", CAN_CHANGE_ACCELS_BLURB, + FALSE, + 0); GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_LAST_OPENED_SIZE, "last-opened-size", LAST_OPENED_SIZE_BLURB, 0, 1024, 4, @@ -252,6 +257,9 @@ gimp_gui_config_set_property (GObject *object, case PROP_TEAROFF_MENUS: gui_config->tearoff_menus = g_value_get_boolean (value); break; + case PROP_CAN_CHANGE_ACCELS: + gui_config->can_change_accels = g_value_get_boolean (value); + break; case PROP_LAST_OPENED_SIZE: gui_config->last_opened_size = g_value_get_int (value); break; @@ -324,6 +332,9 @@ gimp_gui_config_get_property (GObject *object, case PROP_TEAROFF_MENUS: g_value_set_boolean (value, gui_config->tearoff_menus); break; + case PROP_CAN_CHANGE_ACCELS: + g_value_set_boolean (value, gui_config->can_change_accels); + break; case PROP_LAST_OPENED_SIZE: g_value_set_int (value, gui_config->last_opened_size); break; diff --git a/app/config/gimpguiconfig.h b/app/config/gimpguiconfig.h index e503d97f46..9dc3102f40 100644 --- a/app/config/gimpguiconfig.h +++ b/app/config/gimpguiconfig.h @@ -51,6 +51,7 @@ struct _GimpGuiConfig gboolean show_tips; gboolean show_tool_tips; gboolean tearoff_menus; + gboolean can_change_accels; gint last_opened_size; gulong max_new_image_size; gchar *theme_path; diff --git a/app/config/gimprc-blurbs.h b/app/config/gimprc-blurbs.h index 7651372378..62c72c2ce5 100644 --- a/app/config/gimprc-blurbs.h +++ b/app/config/gimprc-blurbs.h @@ -270,19 +270,22 @@ N_("Sets the swap file location. The gimp uses a tile based memory " \ "a directory that is mounted over NFS. For these reasons, it may " \ "be desirable to put your swap file in \"/tmp\".") -#define TEAROFF_MENUS_BLURB \ +#define TEAROFF_MENUS_BLURB \ 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 TEMP_PATH_BLURB \ N_("Sets the temporary storage directory. Files will appear here " \ "during the course of running the GIMP. Most files will disappear " \ "when the GIMP exits, but some files are likely to remain, so it is " \ "best if this directory not be one that is shared by other users.") -#define THEME_BLURB \ +#define THEME_BLURB \ "The name of the theme to use." -#define THEME_PATH_BLURB \ +#define THEME_PATH_BLURB \ "Sets the theme search path." #define THUMBNAIL_SIZE_BLURB \ diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c index e42dc57230..feb1760163 100644 --- a/app/dialogs/preferences-dialog.c +++ b/app/dialogs/preferences-dialog.c @@ -1124,6 +1124,10 @@ prefs_dialog_new (Gimp *gimp, _("Enable _Tearoff Menus"), GTK_BOX (vbox2)); + prefs_check_button_add (config, "can-change-accels", + _("Dynamic _Keyboard Shortcuts (does not work in GNOME2 yet)"), + GTK_BOX (vbox2)); + /* Window Positions */ vbox2 = prefs_frame_new (_("Window Positions"), GTK_CONTAINER (vbox), FALSE); diff --git a/app/gui/menus.c b/app/gui/menus.c index cd48c7977e..50200852eb 100644 --- a/app/gui/menus.c +++ b/app/gui/menus.c @@ -72,6 +72,8 @@ static void menus_last_opened_reorder (GimpContainer *container, gint unused2, GimpItemFactory *item_factory); +static void menu_can_change_accels (GimpGuiConfig *config); + /* global variables */ @@ -95,6 +97,11 @@ menus_init (Gimp *gimp) menus_initialized = TRUE; + g_signal_connect (gimp->config, "notify::can-change-accels", + G_CALLBACK (menu_can_change_accels), NULL); + + menu_can_change_accels (GIMP_GUI_CONFIG (gimp->config)); + global_menu_factory = gimp_menu_factory_new (gimp); gimp_menu_factory_menu_register (global_menu_factory, @@ -236,6 +243,10 @@ menus_exit (Gimp *gimp) g_object_unref (global_menu_factory); global_menu_factory = NULL; + + g_signal_handlers_disconnect_by_func (gimp->config, + menu_can_change_accels, + NULL); } void @@ -422,3 +433,16 @@ menus_last_opened_reorder (GimpContainer *container, { menus_last_opened_update (container, unused1, item_factory); } + +static void +menu_can_change_accels (GimpGuiConfig *config) +{ + gchar *rc_string; + + rc_string = g_strdup_printf ("gtk-can-change-accels = %s", + config->can_change_accels ? "1" : "0"); + + gtk_rc_parse_string (rc_string); + + g_free (rc_string); +} diff --git a/app/gui/preferences-dialog.c b/app/gui/preferences-dialog.c index e42dc57230..feb1760163 100644 --- a/app/gui/preferences-dialog.c +++ b/app/gui/preferences-dialog.c @@ -1124,6 +1124,10 @@ prefs_dialog_new (Gimp *gimp, _("Enable _Tearoff Menus"), GTK_BOX (vbox2)); + prefs_check_button_add (config, "can-change-accels", + _("Dynamic _Keyboard Shortcuts (does not work in GNOME2 yet)"), + GTK_BOX (vbox2)); + /* Window Positions */ vbox2 = prefs_frame_new (_("Window Positions"), GTK_CONTAINER (vbox), FALSE); diff --git a/app/menus/menus.c b/app/menus/menus.c index cd48c7977e..50200852eb 100644 --- a/app/menus/menus.c +++ b/app/menus/menus.c @@ -72,6 +72,8 @@ static void menus_last_opened_reorder (GimpContainer *container, gint unused2, GimpItemFactory *item_factory); +static void menu_can_change_accels (GimpGuiConfig *config); + /* global variables */ @@ -95,6 +97,11 @@ menus_init (Gimp *gimp) menus_initialized = TRUE; + g_signal_connect (gimp->config, "notify::can-change-accels", + G_CALLBACK (menu_can_change_accels), NULL); + + menu_can_change_accels (GIMP_GUI_CONFIG (gimp->config)); + global_menu_factory = gimp_menu_factory_new (gimp); gimp_menu_factory_menu_register (global_menu_factory, @@ -236,6 +243,10 @@ menus_exit (Gimp *gimp) g_object_unref (global_menu_factory); global_menu_factory = NULL; + + g_signal_handlers_disconnect_by_func (gimp->config, + menu_can_change_accels, + NULL); } void @@ -422,3 +433,16 @@ menus_last_opened_reorder (GimpContainer *container, { menus_last_opened_update (container, unused1, item_factory); } + +static void +menu_can_change_accels (GimpGuiConfig *config) +{ + gchar *rc_string; + + rc_string = g_strdup_printf ("gtk-can-change-accels = %s", + config->can_change_accels ? "1" : "0"); + + gtk_rc_parse_string (rc_string); + + g_free (rc_string); +} diff --git a/docs/gimprc-1.3.5.in b/docs/gimprc-1.3.5.in index fa16593384..d4d29a2096 100644 --- a/docs/gimprc-1.3.5.in +++ b/docs/gimprc-1.3.5.in @@ -157,6 +157,12 @@ palette path. This is a string value. Specify a default gradient. The gradient is searched for in the specified gradient path. This is a string value. +.TP +(default-font "Sans") + +Specify a default font. The font is searched for in the fontconfig font path. + This is a string value. + .TP (default-comment "Created with The GIMP") @@ -565,6 +571,12 @@ Enable to display tooltips. Possible values are yes and no. When enabled, menus can be torn off. Possible values are yes and no. +.TP +(can-change-accels no) + +When enabled, you can change keyboard shortcuts for menu items on the fly. +Possible values are yes and no. + .TP (last-opened-size 4) diff --git a/docs/gimprc.5.in b/docs/gimprc.5.in index fa16593384..d4d29a2096 100644 --- a/docs/gimprc.5.in +++ b/docs/gimprc.5.in @@ -157,6 +157,12 @@ palette path. This is a string value. Specify a default gradient. The gradient is searched for in the specified gradient path. This is a string value. +.TP +(default-font "Sans") + +Specify a default font. The font is searched for in the fontconfig font path. + This is a string value. + .TP (default-comment "Created with The GIMP") @@ -565,6 +571,12 @@ Enable to display tooltips. Possible values are yes and no. When enabled, menus can be torn off. Possible values are yes and no. +.TP +(can-change-accels no) + +When enabled, you can change keyboard shortcuts for menu items on the fly. +Possible values are yes and no. + .TP (last-opened-size 4) diff --git a/etc/gimprc b/etc/gimprc index 636d2f55f9..e9cc00f90c 100644 --- a/etc/gimprc +++ b/etc/gimprc @@ -117,6 +117,11 @@ # # (default-gradient "FG to BG (RGB)") +# Specify a default font. The font is searched for in the fontconfig font +# path. This is a string value. +# +# (default-font "Sans") + # Sets the default comment. This is a string value. # # (default-comment "Created with The GIMP") @@ -433,6 +438,11 @@ # # (tearoff-menus yes) +# When enabled, you can change keyboard shortcuts for menu items on the fly. +# Possible values are yes and no. +# +# (can-change-accels no) + # How many recently opened image filenames to keep on the File menu. This is # an integer value. #