mirror of https://github.com/GNOME/gimp.git
app, menus: add an application menu for systems which wants this.
In particular on macOS, we want to show some default common actions (see comments in !837) but gtk_application_prefers_app_menu() docs says that it will always return FALSE on this OS. So we ignore this call on macOS.
This commit is contained in:
parent
634bb0836e
commit
a752ad5e07
|
@ -351,6 +351,7 @@ gimp_image_window_constructed (GObject *object)
|
||||||
GimpGuiConfig *config;
|
GimpGuiConfig *config;
|
||||||
GimpMenuModel *model;
|
GimpMenuModel *model;
|
||||||
gboolean use_gtk_menubar = TRUE;
|
gboolean use_gtk_menubar = TRUE;
|
||||||
|
gboolean use_app_menu = TRUE;
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->constructed (object);
|
G_OBJECT_CLASS (parent_class)->constructed (object);
|
||||||
|
|
||||||
|
@ -425,6 +426,25 @@ gimp_image_window_constructed (GObject *object)
|
||||||
window);
|
window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef GDK_WINDOWING_QUARTZ
|
||||||
|
/* Docs says that macOS always returns FALSE but we actually want to create
|
||||||
|
* our custom macOS menu.
|
||||||
|
*/
|
||||||
|
use_app_menu = gtk_application_prefers_app_menu (GTK_APPLICATION (private->gimp->app));
|
||||||
|
#endif /* !GDK_WINDOWING_QUARTZ */
|
||||||
|
|
||||||
|
if (use_app_menu)
|
||||||
|
{
|
||||||
|
GimpUIManager *app_menu_manager;
|
||||||
|
GimpMenuModel *app_menu_model;
|
||||||
|
|
||||||
|
app_menu_manager = gimp_menu_factory_get_manager (menus_get_global_menu_factory (private->gimp),
|
||||||
|
"<AppMenu>", private->gimp);
|
||||||
|
app_menu_model = gimp_ui_manager_get_model (app_menu_manager, "/app-menu");
|
||||||
|
gtk_application_set_app_menu (GTK_APPLICATION (private->gimp->app),
|
||||||
|
G_MENU_MODEL (app_menu_model));
|
||||||
|
}
|
||||||
|
|
||||||
/* Create the hbox that contains docks and images */
|
/* Create the hbox that contains docks and images */
|
||||||
private->hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
private->hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
gtk_box_pack_start (GTK_BOX (private->main_vbox), private->hbox,
|
gtk_box_pack_start (GTK_BOX (private->main_vbox), private->hbox,
|
||||||
|
|
|
@ -98,6 +98,14 @@ menus_init (Gimp *gimp)
|
||||||
"quick-mask-menu", NULL,
|
"quick-mask-menu", NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
gimp_menu_factory_manager_register (global_menu_factory, "<AppMenu>",
|
||||||
|
"file",
|
||||||
|
"dialogs",
|
||||||
|
NULL,
|
||||||
|
"/app-menu",
|
||||||
|
"app-menu", NULL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
gimp_menu_factory_manager_register (global_menu_factory, "<Toolbox>",
|
gimp_menu_factory_manager_register (global_menu_factory, "<Toolbox>",
|
||||||
"file",
|
"file",
|
||||||
"context",
|
"context",
|
||||||
|
|
|
@ -10,23 +10,24 @@ menudata_built_files = $(menudata_in_files:.ui.in.in=.ui)
|
||||||
|
|
||||||
menudata_DATA = \
|
menudata_DATA = \
|
||||||
$(menudata_built_files) \
|
$(menudata_built_files) \
|
||||||
|
app-menu.ui \
|
||||||
brush-editor-menu.ui \
|
brush-editor-menu.ui \
|
||||||
brushes-menu.ui \
|
brushes-menu.ui \
|
||||||
buffers-menu.ui \
|
buffers-menu.ui \
|
||||||
channels-menu.ui \
|
channels-menu.ui \
|
||||||
colormap-menu.ui \
|
colormap-menu.ui \
|
||||||
cursor-info-menu.ui \
|
cursor-info-menu.ui \
|
||||||
dashboard-menu.ui \
|
dashboard-menu.ui \
|
||||||
documents-menu.ui \
|
documents-menu.ui \
|
||||||
dynamics-editor-menu.ui \
|
dynamics-editor-menu.ui \
|
||||||
dynamics-menu.ui \
|
dynamics-menu.ui \
|
||||||
error-console-menu.ui \
|
error-console-menu.ui \
|
||||||
fonts-menu.ui \
|
fonts-menu.ui \
|
||||||
gradient-editor-menu.ui \
|
gradient-editor-menu.ui \
|
||||||
gradients-menu.ui \
|
gradients-menu.ui \
|
||||||
images-menu.ui \
|
images-menu.ui \
|
||||||
layers-menu.ui \
|
layers-menu.ui \
|
||||||
mypaint-brushes-menu.ui \
|
mypaint-brushes-menu.ui \
|
||||||
palette-editor-menu.ui \
|
palette-editor-menu.ui \
|
||||||
palettes-menu.ui \
|
palettes-menu.ui \
|
||||||
patterns-menu.ui \
|
patterns-menu.ui \
|
||||||
|
@ -40,7 +41,7 @@ menudata_DATA = \
|
||||||
text-tool-menu.ui \
|
text-tool-menu.ui \
|
||||||
tool-options-menu.ui \
|
tool-options-menu.ui \
|
||||||
undo-menu.ui \
|
undo-menu.ui \
|
||||||
vector-toolpath-menu.ui \
|
vector-toolpath-menu.ui \
|
||||||
vectors-menu.ui
|
vectors-menu.ui
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<interface>
|
||||||
|
<menu id="/app-menu">
|
||||||
|
<item><attribute name="action">app.dialogs-about</attribute></item>
|
||||||
|
<item><attribute name="action">app.dialogs-welcome</attribute></item>
|
||||||
|
<section>
|
||||||
|
<item><attribute name="action">app.dialogs-preferences</attribute></item>
|
||||||
|
<item><attribute name="action">app.dialogs-input-devices</attribute></item>
|
||||||
|
<item><attribute name="action">app.dialogs-keyboard-shortcuts</attribute></item>
|
||||||
|
</section>
|
||||||
|
<item><attribute name="action">app.file-quit</attribute></item>
|
||||||
|
</menu>
|
||||||
|
</interface>
|
|
@ -1,6 +1,7 @@
|
||||||
menus_dir = prefix / gimpdatadir / 'menus'
|
menus_dir = prefix / gimpdatadir / 'menus'
|
||||||
|
|
||||||
ui_menus_files = files(
|
ui_menus_files = files(
|
||||||
|
'app-menu.ui',
|
||||||
'brush-editor-menu.ui',
|
'brush-editor-menu.ui',
|
||||||
'brushes-menu.ui',
|
'brushes-menu.ui',
|
||||||
'buffers-menu.ui',
|
'buffers-menu.ui',
|
||||||
|
|
Loading…
Reference in New Issue