Index: app/dialogs/preferences-dialog.c =================================================================== --- app/dialogs/preferences-dialog.c (revision 25899) +++ app/dialogs/preferences-dialog.c (working copy) @@ -1282,6 +1282,9 @@ _("Show _menubar"), GTK_BOX (checks_vbox)); #endif /* !GDK_WINDOWING_QUARTZ */ + prefs_check_button_add (object, "show-toolbar", + _("Show t_oolbar"), + GTK_BOX (checks_vbox)); prefs_check_button_add (object, "show-rulers", _("Show _rulers"), GTK_BOX (checks_vbox)); @@ -1299,6 +1302,9 @@ prefs_check_button_add (object, "show-selection", _("Show s_election"), GTK_BOX (checks_vbox)); + prefs_check_button_add (object, "show-secondary-toolbar", + _("Show se_condary toolbar"), + GTK_BOX (checks_vbox)); prefs_check_button_add (object, "show-layer-boundary", _("Show _layer boundary"), GTK_BOX (checks_vbox)); @@ -2720,6 +2726,10 @@ GIMP_HELP_PREFS_FOLDERS_MODULES, N_("Select Module Folders"), "module-path", NULL }, + { N_("Menus"), N_("Menu Folders"), "folders-menus", + GIMP_HELP_PREFS_FOLDERS_MENUS, + N_("Select Menu Folders"), + "menu-path", NULL }, { N_("Interpreters"), N_("Interpreter Folders"), "folders-interp", GIMP_HELP_PREFS_FOLDERS_INTERPRETERS, N_("Select Interpreter Folders"), Index: app/menus/menus.c =================================================================== --- app/menus/menus.c (revision 25899) +++ app/menus/menus.c (working copy) @@ -117,6 +117,10 @@ "image-menu.xml", image_menu_setup, "/quick-mask-popup", "quick-mask-menu.xml", NULL, + "/image-toolbar", + "image-toolbar.xml", NULL, + "/image-secondary-toolbar", + "image-secondary-toolbar.xml", NULL, NULL); gimp_menu_factory_manager_register (global_menu_factory, "", Index: app/actions/view-actions.c =================================================================== --- app/actions/view-actions.c (revision 25899) +++ app/actions/view-actions.c (working copy) @@ -205,6 +205,20 @@ TRUE, GIMP_HELP_VIEW_SHOW_MENUBAR }, + { "view-show-toolbar", NULL, + N_("Show Primary T_oolbar"), NULL, + N_("Show this window's toolbar"), + G_CALLBACK (view_toggle_toolbar_cmd_callback), + TRUE, + GIMP_HELP_VIEW_SHOW_TOOLBAR }, + + { "view-show-secondary-toolbar", NULL, + N_("Show Se_condary Toolbar"), NULL, + N_("Show this window's secondary toolbar"), + G_CALLBACK (view_toggle_secondary_toolbar_cmd_callback), + TRUE, + GIMP_HELP_VIEW_SHOW_SECONDARY_TOOLBAR }, + { "view-show-rulers", NULL, N_("Show R_ulers"), "R", N_("Show this window's rulers"), @@ -646,6 +660,10 @@ SET_SENSITIVE ("view-show-menubar", image); SET_ACTIVE ("view-show-menubar", display && options->show_menubar); + SET_SENSITIVE ("view-show-toolbar", image); + SET_ACTIVE ("view-show-toolbar", display && options->show_toolbar); + SET_SENSITIVE ("view-show-secondary-toolbar", image); + SET_ACTIVE ("view-show-secondary-toolbar", display && options->show_secondary_toolbar); SET_SENSITIVE ("view-show-rulers", image); SET_ACTIVE ("view-show-rulers", display && options->show_rulers); SET_SENSITIVE ("view-show-scrollbars", image); Index: app/actions/view-commands.c =================================================================== --- app/actions/view-commands.c (revision 25899) +++ app/actions/view-commands.c (working copy) @@ -380,6 +380,38 @@ } void +view_toggle_toolbar_cmd_callback (GtkAction *action, + gpointer data) +{ + GimpDisplay *display; + GimpDisplayShell *shell; + gboolean active; + return_if_no_display (display, data); + + shell = GIMP_DISPLAY_SHELL (display->shell); + + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + + gimp_display_shell_set_show_toolbar (shell, active); +} + +void +view_toggle_secondary_toolbar_cmd_callback (GtkAction *action, + gpointer data) +{ + GimpDisplay *display; + GimpDisplayShell *shell; + gboolean active; + return_if_no_display (display, data); + + shell = GIMP_DISPLAY_SHELL (display->shell); + + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + + gimp_display_shell_set_show_secondary_toolbar (shell, active); +} + +void view_toggle_rulers_cmd_callback (GtkAction *action, gpointer data) { Index: app/actions/view-commands.h =================================================================== --- app/actions/view-commands.h (revision 25899) +++ app/actions/view-commands.h (working copy) @@ -57,6 +57,10 @@ gpointer data); void view_toggle_menubar_cmd_callback (GtkAction *action, gpointer data); +void view_toggle_toolbar_cmd_callback (GtkAction *action, + gpointer data); +void view_toggle_secondary_toolbar_cmd_callback (GtkAction *action, + gpointer data); void view_toggle_rulers_cmd_callback (GtkAction *action, gpointer data); void view_toggle_scrollbars_cmd_callback (GtkAction *action, Index: app/display/gimpdisplayshell.c =================================================================== --- app/display/gimpdisplayshell.c (revision 25899) +++ app/display/gimpdisplayshell.c (working copy) @@ -903,6 +903,14 @@ shell); } + shell->toolbar = gtk_ui_manager_get_widget(GTK_UI_MANAGER (shell->menubar_manager), "/image-toolbar"); + gtk_box_pack_start (GTK_BOX (main_vbox), shell->toolbar, FALSE, FALSE, 0); + gtk_widget_show_all (shell->toolbar); + + shell->secondary_toolbar = gtk_ui_manager_get_widget(GTK_UI_MANAGER (shell->menubar_manager), "/image-secondary-toolbar"); + gtk_box_pack_start (GTK_BOX (main_vbox), shell->secondary_toolbar, FALSE, FALSE, 0); + gtk_widget_show_all (shell->secondary_toolbar); + /* another vbox for everything except the statusbar */ disp_vbox = gtk_vbox_new (FALSE, 1); gtk_box_pack_start (GTK_BOX (main_vbox), disp_vbox, TRUE, TRUE, 0); Index: app/display/gimpdisplayshell.h =================================================================== --- app/display/gimpdisplayshell.h (revision 25899) +++ app/display/gimpdisplayshell.h (working copy) @@ -128,6 +128,8 @@ GtkWidget *nav_ebox; /* SE: navigation event box */ GtkWidget *menubar; /* menubar */ + GtkWidget *toolbar; /* toolbar */ + GtkWidget *secondary_toolbar;/* toolbar */ GtkWidget *statusbar; /* statusbar */ guchar *render_buf; /* buffer for rendering the image */ Index: app/display/gimpdisplayoptions.c =================================================================== --- app/display/gimpdisplayoptions.c (revision 25899) +++ app/display/gimpdisplayoptions.c (working copy) @@ -42,6 +42,8 @@ { PROP_0, PROP_SHOW_MENUBAR, + PROP_SHOW_TOOLBAR, + PROP_SHOW_SECONDARY_TOOLBAR, PROP_SHOW_RULERS, PROP_SHOW_SCROLLBARS, PROP_SHOW_STATUSBAR, @@ -106,6 +108,14 @@ "show-menubar", SHOW_MENUBAR_BLURB, TRUE, GIMP_PARAM_STATIC_STRINGS); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_TOOLBAR, + "show-toolbar", SHOW_TOOLBAR_BLURB, + TRUE, + GIMP_PARAM_STATIC_STRINGS); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_SECONDARY_TOOLBAR, + "show-secondary-toolbar", SHOW_SECONDARY_TOOLBAR_BLURB, + TRUE, + GIMP_PARAM_STATIC_STRINGS); GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_RULERS, "show-rulers", SHOW_RULERS_BLURB, TRUE, @@ -164,6 +174,14 @@ "show-menubar", SHOW_MENUBAR_BLURB, FALSE, GIMP_PARAM_STATIC_STRINGS); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_TOOLBAR, + "show-toolbar", SHOW_TOOLBAR_BLURB, + FALSE, + GIMP_PARAM_STATIC_STRINGS); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_SECONDARY_TOOLBAR, + "show-secondary-toolbar", SHOW_SECONDARY_TOOLBAR_BLURB, + FALSE, + GIMP_PARAM_STATIC_STRINGS); GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_RULERS, "show-rulers", SHOW_RULERS_BLURB, FALSE, @@ -264,6 +282,12 @@ case PROP_SHOW_MENUBAR: options->show_menubar = g_value_get_boolean (value); break; + case PROP_SHOW_TOOLBAR: + options->show_toolbar = g_value_get_boolean (value); + break; + case PROP_SHOW_SECONDARY_TOOLBAR: + options->show_secondary_toolbar = g_value_get_boolean (value); + break; case PROP_SHOW_RULERS: options->show_rulers = g_value_get_boolean (value); break; @@ -314,6 +338,12 @@ case PROP_SHOW_MENUBAR: g_value_set_boolean (value, options->show_menubar); break; + case PROP_SHOW_TOOLBAR: + g_value_set_boolean (value, options->show_toolbar); + break; + case PROP_SHOW_SECONDARY_TOOLBAR: + g_value_set_boolean (value, options->show_secondary_toolbar); + break; case PROP_SHOW_RULERS: g_value_set_boolean (value, options->show_rulers); break; Index: app/display/gimpdisplayoptions.h =================================================================== --- app/display/gimpdisplayoptions.h (revision 25899) +++ app/display/gimpdisplayoptions.h (working copy) @@ -42,6 +42,8 @@ /* GimpDisplayShell options */ gboolean show_menubar; + gboolean show_toolbar; + gboolean show_secondary_toolbar; gboolean show_rulers; gboolean show_scrollbars; gboolean show_statusbar; Index: app/display/gimpdisplayshell-appearance.c =================================================================== --- app/display/gimpdisplayshell-appearance.c (revision 25899) +++ app/display/gimpdisplayshell-appearance.c (working copy) @@ -168,6 +168,74 @@ } void +gimp_display_shell_set_show_toolbar (GimpDisplayShell *shell, + gboolean show) +{ + GimpDisplayOptions *options; + + g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); + + options = GET_OPTIONS (shell); + + g_object_set (options, "show-toolbar", show, NULL); + + if (shell->toolbar) + { + if (show) + gtk_widget_show (shell->toolbar); + else + gtk_widget_hide (shell->toolbar); + } + + SET_ACTIVE (shell->menubar_manager, "view-show-toolbar", show); + + if (IS_ACTIVE_DISPLAY (shell)) + SET_ACTIVE (shell->popup_manager, "view-show-toolbar", show); +} + +void +gimp_display_shell_set_show_secondary_toolbar (GimpDisplayShell *shell, + gboolean show) +{ + GimpDisplayOptions *options; + + g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); + + options = GET_OPTIONS (shell); + + g_object_set (options, "show-secondary-toolbar", show, NULL); + + if (shell->secondary_toolbar) + { + if (show) + gtk_widget_show (shell->secondary_toolbar); + else + gtk_widget_hide (shell->secondary_toolbar); + } + + SET_ACTIVE (shell->menubar_manager, "view-show-secondary-toolbar", show); + + if (IS_ACTIVE_DISPLAY (shell)) + SET_ACTIVE (shell->popup_manager, "view-show-secondary-toolbar", show); +} + +gboolean +gimp_display_shell_get_show_toolbar (GimpDisplayShell *shell) +{ + g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE); + + return GET_OPTIONS (shell)->show_toolbar; +} + +gboolean +gimp_display_shell_get_show_secondary_toolbar (GimpDisplayShell *shell) +{ + g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE); + + return GET_OPTIONS (shell)->show_secondary_toolbar; +} + +void gimp_display_shell_set_show_rulers (GimpDisplayShell *shell, gboolean show) { Index: app/display/gimpdisplayshell-appearance.h =================================================================== --- app/display/gimpdisplayshell-appearance.h (revision 25899) +++ app/display/gimpdisplayshell-appearance.h (working copy) @@ -30,6 +30,14 @@ gboolean show); gboolean gimp_display_shell_get_show_menubar (GimpDisplayShell *shell); +void gimp_display_shell_set_show_toolbar (GimpDisplayShell *shell, + gboolean show); +gboolean gimp_display_shell_get_show_toolbar (GimpDisplayShell *shell); + +void gimp_display_shell_set_show_secondary_toolbar(GimpDisplayShell *shell, + gboolean show); +gboolean gimp_display_shell_get_show_secondary_toolbar(GimpDisplayShell *shell); + void gimp_display_shell_set_show_rulers (GimpDisplayShell *shell, gboolean show); gboolean gimp_display_shell_get_show_rulers (GimpDisplayShell *shell); Index: app/config/gimpcoreconfig.h =================================================================== --- app/config/gimpcoreconfig.h (revision 25899) +++ app/config/gimpcoreconfig.h (working copy) @@ -43,6 +43,7 @@ GimpInterpolationType interpolation_type; gchar *plug_in_path; gchar *module_path; + gchar *menu_path; gchar *interpreter_path; gchar *environ_path; gchar *brush_path; Index: app/config/gimprc-blurbs.h =================================================================== --- app/config/gimprc-blurbs.h (revision 25899) +++ app/config/gimprc-blurbs.h (working copy) @@ -191,6 +191,9 @@ #define MODULE_PATH_BLURB \ "Sets the module search path." +#define MENU_PATH_BLURB \ +"Sets the menu search path." + #define MONITOR_RES_FROM_GDK_BLURB \ "When enabled, GIMP will use the monitor resolution from the windowing system." @@ -295,6 +298,14 @@ N_("When enabled, the menubar is visible by default. This can also be " \ "toggled with the \"View->Show Menubar\" command.") +#define SHOW_TOOLBAR_BLURB \ +N_("When enabled, the toolbar is visible by default. This can also be " \ + "toggled with the \"View->Show Toolbar\" command.") + +#define SHOW_SECONDARY_TOOLBAR_BLURB \ +N_("When enabled, the secondary toolbar is visible by default. This can also be " \ + "toggled with the \"View->Show Secondary Toolbar\" command.") + #define SHOW_RULERS_BLURB \ N_("When enabled, the rulers are visible by default. This can also be " \ "toggled with the \"View->Show Rulers\" command.") Index: app/config/gimpcoreconfig.c =================================================================== --- app/config/gimpcoreconfig.c (revision 25899) +++ app/config/gimpcoreconfig.c (working copy) @@ -52,6 +52,7 @@ PROP_INTERPOLATION_TYPE, PROP_PLUG_IN_PATH, PROP_MODULE_PATH, + PROP_MENU_PATH, PROP_INTERPRETER_PATH, PROP_ENVIRON_PATH, PROP_BRUSH_PATH, @@ -149,6 +150,13 @@ GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_RESTART); g_free (path); + path = gimp_config_build_data_path ("menus"); + GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_MENU_PATH, + "menu-path", MENU_PATH_BLURB, + GIMP_CONFIG_PATH_DIR_LIST, path, + GIMP_PARAM_STATIC_STRINGS | + GIMP_CONFIG_PARAM_RESTART); + g_free (path); path = gimp_config_build_plug_in_path ("interpreters"); GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_INTERPRETER_PATH, "interpreter-path", INTERPRETER_PATH_BLURB, @@ -398,6 +406,7 @@ g_free (core_config->plug_in_path); g_free (core_config->module_path); + g_free (core_config->menu_path); g_free (core_config->interpreter_path); g_free (core_config->environ_path); g_free (core_config->brush_path); @@ -450,6 +459,10 @@ g_free (core_config->module_path); core_config->module_path = g_value_dup_string (value); break; + case PROP_MENU_PATH: + g_free (core_config->menu_path); + core_config->menu_path = g_value_dup_string (value); + break; case PROP_INTERPRETER_PATH: g_free (core_config->interpreter_path); core_config->interpreter_path = g_value_dup_string (value); @@ -617,6 +630,9 @@ case PROP_MODULE_PATH: g_value_set_string (value, core_config->module_path); break; + case PROP_MENU_PATH: + g_value_set_string (value, core_config->menu_path); + break; case PROP_INTERPRETER_PATH: g_value_set_string (value, core_config->interpreter_path); break; Index: app/widgets/gimphelp-ids.h =================================================================== --- app/widgets/gimphelp-ids.h (revision 25899) +++ app/widgets/gimphelp-ids.h (working copy) @@ -91,6 +91,8 @@ #define GIMP_HELP_VIEW_SNAP_TO_CANVAS "gimp-view-snap-to-canvas" #define GIMP_HELP_VIEW_SNAP_TO_VECTORS "gimp-view-snap-to-vectors" #define GIMP_HELP_VIEW_SHOW_MENUBAR "gimp-view-show-menubar" +#define GIMP_HELP_VIEW_SHOW_TOOLBAR "gimp-view-show-toolbar" +#define GIMP_HELP_VIEW_SHOW_SECONDARY_TOOLBAR "gimp-view-show-secondary-toolbar" #define GIMP_HELP_VIEW_SHOW_RULERS "gimp-view-show-rulers" #define GIMP_HELP_VIEW_SHOW_SCROLLBARS "gimp-view-show-scrollbars" #define GIMP_HELP_VIEW_SHOW_STATUSBAR "gimp-view-show-statusbar" @@ -426,6 +428,7 @@ #define GIMP_HELP_PREFS_FOLDERS_PLUG_INS "gimp-prefs-folders-plug-ins" #define GIMP_HELP_PREFS_FOLDERS_SCRIPTS "gimp-prefs-folders-scripts" #define GIMP_HELP_PREFS_FOLDERS_MODULES "gimp-prefs-folders-modules" +#define GIMP_HELP_PREFS_FOLDERS_MENUS "gimp-prefs-folders-menus" #define GIMP_HELP_PREFS_FOLDERS_INTERPRETERS "gimp-prefs-folders-interpreters" #define GIMP_HELP_PREFS_FOLDERS_ENVIRONMENT "gimp-prefs-folders-environment" #define GIMP_HELP_PREFS_FOLDERS_THEMES "gimp-prefs-folders-themes" Index: app/widgets/gimpuimanager.c =================================================================== --- app/widgets/gimpuimanager.c (revision 25899) +++ app/widgets/gimpuimanager.c (working copy) @@ -25,12 +25,18 @@ #include #include +#include +#include +#include #include "libgimpbase/gimpbase.h" #include "libgimpwidgets/gimpwidgets.h" +#include "libgimpconfig/gimpconfig-path.h" #include "widgets-types.h" +#include "config/gimpcoreconfig.h" + #include "core/gimp.h" #include "core/gimpmarshal.h" @@ -688,24 +694,67 @@ GimpUIManagerUIEntry *entry, GError **error) { - gchar *filename; + GList *menu_path_list; + gchar *menu_path; + GList *list; + gboolean success = FALSE; - filename = g_build_filename (gimp_data_directory (), "menus", - entry->basename, NULL); + menu_path = gimp_config_path_expand (manager->gimp->config->menu_path, TRUE, NULL); + menu_path_list = gimp_path_parse(menu_path, 16, FALSE, NULL); - if (manager->gimp->be_verbose) - g_print ("loading menu '%s' for %s\n", - gimp_filename_to_utf8 (filename), entry->ui_path); + if (0) + { + g_print ("start: %s\n", menu_path); + for (list = menu_path_list; list; list = g_list_next (list)) + { + g_print ("item: '%s'\n", gimp_filename_to_utf8(list->data)); + } + g_print ("end\n"); + } + for (list = menu_path_list; list; list = g_list_next (list)) + { + gchar *filename = g_build_filename (list->data, entry->basename, NULL); - entry->merge_id = gtk_ui_manager_add_ui_from_file (GTK_UI_MANAGER (manager), - filename, error); + //g_print ("trying '%s'\n", gimp_filename_to_utf8(filename)); + + if (g_access (filename, R_OK) == 0) + { + //g_print ("opening '%s'\n", gimp_filename_to_utf8(filename)); - g_free (filename); + if (manager->gimp->be_verbose) + g_print ("loading menu '%s' for %s\n", + gimp_filename_to_utf8 (filename), entry->ui_path); + + entry->merge_id = gtk_ui_manager_add_ui_from_file (GTK_UI_MANAGER (manager), + filename, error); - if (! entry->merge_id) - return FALSE; + if (entry->merge_id) + success = TRUE; + else + success = FALSE; - return TRUE; + //g_print ("success '%d'\n", (int)success); + + g_free (filename); + break; + } + + g_free (filename); + } + + gimp_path_free(menu_path_list); + + if (!success && !*error) // FATAL: must allocate error for when the list is empty + { // If we had no success and no error (happens when no .xml file + // could be found at all) we try to old default directory as a fallback + gchar *filename = g_build_filename (gimp_data_directory (), "menus", NULL); + + entry->merge_id = gtk_ui_manager_add_ui_from_file (GTK_UI_MANAGER (manager), + filename, error); + g_free(filename); + } + + return success; } static GimpUIManagerUIEntry * Index: docs/gimprc.5.in =================================================================== --- docs/gimprc.5.in (revision 25899) +++ docs/gimprc.5.in (working copy) @@ -89,6 +89,12 @@ search. .TP +(menu-path "${gimp_dir}/menus:${gimp_plug_in_dir}/menus") + +Sets the menus search path. This is a colon-separated list of folders to +search. + +.TP (interpreter-path "${gimp_dir}/interpreters:${gimp_plug_in_dir}/interpreters") Sets the interpreter search path. This is a colon-separated list of folders Index: menus/image-toolbar.xml =================================================================== --- menus/image-toolbar.xml (revision 0) +++ menus/image-toolbar.xml (revision 0) @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: menus/image-menu.xml.in =================================================================== --- menus/image-menu.xml.in (revision 25899) +++ menus/image-menu.xml.in (working copy) @@ -283,6 +283,8 @@ + + Index: menus/image-secondary-toolbar.xml =================================================================== --- menus/image-secondary-toolbar.xml (revision 0) +++ menus/image-secondary-toolbar.xml (revision 0) @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: menus/Makefile.am =================================================================== --- menus/Makefile.am (revision 25899) +++ menus/Makefile.am (working copy) @@ -22,6 +22,8 @@ gradient-editor-menu.xml \ gradients-menu.xml \ images-menu.xml \ + image-toolbar.xml \ + image-secondary-toolbar.xml \ layers-menu.xml \ palette-editor-menu.xml \ palettes-menu.xml \ Index: etc/gimprc =================================================================== --- etc/gimprc (revision 25899) +++ etc/gimprc (working copy) @@ -59,6 +59,11 @@ # # (module-path "${gimp_dir}/modules:${gimp_plug_in_dir}/modules") +# Sets the menu search path. This is a colon-separated list of folders to +# search. +# +# (menu-path "${gimp_dir}/menus:${gimp_data_in_dir}/menus") + # Sets the interpreter search path. This is a colon-separated list of # folders to search. #