Commit f284aa3c authored by Leesoo Ahn's avatar Leesoo Ahn Committed by Debarshi Ray

Remove app menu

According to the design guidelines [1], the app menu has been removed.
A primary menu is shown in the COLLECTION_VIEW, COLLECTIONS,
FAVORITES, OVERVIEW and SEARCH modes, when the selection mode isn't
active. The same F10 accelerator is used as the existing preview menu.

[1] https://gitlab.gnome.org/GNOME/Initiatives/wikis/App-Menu-Retirement

GNOME/gnome-photos#117
parent 2d7a9a33
Pipeline #52048 passed with stage
in 9 minutes and 57 seconds
......@@ -24,10 +24,10 @@ src/photos-item-manager.c
src/photos-local-item.c
src/photos-main-toolbar.c
src/photos-main-window.c
src/photos-menus.ui
src/photos-organize-collection-dialog.c
src/photos-preview-menu.ui
src/photos-preview-nav-buttons.c
src/photos-primary-menu.ui
src/photos-print-notification.c
src/photos-print-operation.c
src/photos-print-setup.c
......
......@@ -455,8 +455,8 @@ EXTRA_DIST = \
photos-main-toolbar.ui \
photos-main-window.ui \
photos-marshalers.list \
photos-menus.ui \
photos-preview-menu.ui \
photos-primary-menu.ui \
photos-removable-device-widget.ui \
photos-removable-devices-button.ui \
photos-selection-menu.ui \
......
......@@ -284,8 +284,8 @@ resource_data = files(
'photos-import-dialog.ui',
'photos-main-toolbar.ui',
'photos-main-window.ui',
'photos-menus.ui',
'photos-preview-menu.ui',
'photos-primary-menu.ui',
'photos-removable-devices-button.ui',
'photos-removable-device-widget.ui',
'photos-selection-menu.ui',
......
......@@ -98,6 +98,7 @@ struct _PhotosApplication
GSimpleAction *load_next_action;
GSimpleAction *load_previous_action;
GSimpleAction *open_action;
GSimpleAction *primary_menu_action;
GSimpleAction *print_action;
GSimpleAction *properties_action;
GSimpleAction *saturation_action;
......@@ -485,6 +486,14 @@ photos_application_actions_update (PhotosApplication *self)
g_simple_action_set_enabled (self->shadows_highlights_action, enable);
g_simple_action_set_enabled (self->sharpen_action, enable);
enable = ((mode == PHOTOS_WINDOW_MODE_COLLECTION_VIEW
|| mode == PHOTOS_WINDOW_MODE_COLLECTIONS
|| mode == PHOTOS_WINDOW_MODE_FAVORITES
|| mode == PHOTOS_WINDOW_MODE_OVERVIEW
|| mode == PHOTOS_WINDOW_MODE_SEARCH)
&& !selection_mode);
g_simple_action_set_enabled (self->primary_menu_action, enable);
enable = (((mode == PHOTOS_WINDOW_MODE_COLLECTION_VIEW
|| mode == PHOTOS_WINDOW_MODE_COLLECTIONS
|| mode == PHOTOS_WINDOW_MODE_FAVORITES
......@@ -2599,8 +2608,8 @@ photos_application_startup (GApplication *application)
const gchar *delete_accels[3] = {"Delete", "KP_Delete", NULL};
const gchar *edit_accels[2] = {"<Primary>e", NULL};
const gchar *fullscreen_accels[2] = {"F11", NULL};
const gchar *gear_menu_accels[2] = {"F10", NULL};
const gchar *help_menu_accels[2] = {"F1", NULL};
const gchar *menu_accels[2] = {"F10", NULL};
const gchar *print_current_accels[2] = {"<Primary>p", NULL};
const gchar *quit_accels[2] = {"<Primary>q", NULL};
const gchar *save_accels[2] = {"<Primary>x", NULL};
......@@ -2746,6 +2755,10 @@ photos_application_startup (GApplication *application)
g_signal_connect_swapped (self->open_action, "activate", G_CALLBACK (photos_application_open_current), self);
g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (self->open_action));
state = g_variant_new ("b", FALSE);
self->primary_menu_action = g_simple_action_new_stateful ("primary-menu", NULL, state);
g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (self->primary_menu_action));
self->print_action = g_simple_action_new ("print-current", NULL);
g_signal_connect_swapped (self->print_action, "activate", G_CALLBACK (photos_application_print_current), self);
g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (self->print_action));
......@@ -2869,8 +2882,9 @@ photos_application_startup (GApplication *application)
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.delete", delete_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.edit-current", edit_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.fullscreen", fullscreen_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.gear-menu", gear_menu_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.gear-menu", menu_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.help", help_menu_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.primary-menu", menu_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.print-current", print_current_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.save-current", save_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.search", search_accels);
......@@ -2962,6 +2976,7 @@ photos_application_dispose (GObject *object)
g_clear_object (&self->load_next_action);
g_clear_object (&self->load_previous_action);
g_clear_object (&self->open_action);
g_clear_object (&self->primary_menu_action);
g_clear_object (&self->print_action);
g_clear_object (&self->properties_action);
g_clear_object (&self->saturation_action);
......
......@@ -232,6 +232,26 @@ photos_main_toolbar_add_devices_button (PhotosMainToolbar *self)
}
static void
photos_main_toolbar_add_primary_menu_button (PhotosMainToolbar *self)
{
GMenu *primary_menu;
g_autoptr (GtkBuilder) builder = NULL;
GtkWidget *menu_button;
GtkWidget *image;
builder = gtk_builder_new_from_resource ("/org/gnome/Photos/primary-menu.ui");
primary_menu = G_MENU (gtk_builder_get_object (builder, "primary-menu"));
image = gtk_image_new_from_icon_name ("open-menu-symbolic", GTK_ICON_SIZE_BUTTON);
menu_button = gtk_menu_button_new ();
gtk_actionable_set_action_name (GTK_ACTIONABLE (menu_button), "app.primary-menu");
gtk_button_set_image (GTK_BUTTON (menu_button), image);
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (menu_button), G_MENU_MODEL (primary_menu));
gtk_header_bar_pack_end (GTK_HEADER_BAR (self->header_bar), menu_button);
}
static void
photos_main_toolbar_remote_display_button_clicked (PhotosMainToolbar *self)
{
......@@ -441,6 +461,7 @@ photos_main_toolbar_populate_for_collection_view (PhotosMainToolbar *self)
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (self->header_bar), TRUE);
photos_main_toolbar_add_back_button (self);
photos_main_toolbar_add_primary_menu_button (self);
photos_main_toolbar_add_selection_button (self);
photos_main_toolbar_add_search_button (self);
}
......@@ -453,6 +474,7 @@ photos_main_toolbar_populate_for_collections (PhotosMainToolbar *self)
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (self->header_bar), TRUE);
photos_main_toolbar_add_devices_button (self);
photos_main_toolbar_add_primary_menu_button (self);
photos_main_toolbar_add_selection_button (self);
photos_main_toolbar_add_search_button (self);
}
......@@ -484,6 +506,7 @@ photos_main_toolbar_populate_for_favorites (PhotosMainToolbar *self)
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (self->header_bar), TRUE);
photos_main_toolbar_add_devices_button (self);
photos_main_toolbar_add_primary_menu_button (self);
photos_main_toolbar_add_selection_button (self);
photos_main_toolbar_add_search_button (self);
}
......@@ -523,6 +546,7 @@ photos_main_toolbar_populate_for_overview (PhotosMainToolbar *self)
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (self->header_bar), TRUE);
photos_main_toolbar_add_devices_button (self);
photos_main_toolbar_add_primary_menu_button (self);
photos_main_toolbar_add_selection_button (self);
photos_main_toolbar_add_search_button (self);
}
......@@ -547,7 +571,7 @@ photos_main_toolbar_populate_for_preview (PhotosMainToolbar *self)
photos_main_toolbar_add_back_button (self);
preview_menu = photos_main_toolbar_create_preview_menu (self);
image = gtk_image_new_from_icon_name ("open-menu-symbolic", GTK_ICON_SIZE_BUTTON);
image = gtk_image_new_from_icon_name ("view-more-symbolic", GTK_ICON_SIZE_BUTTON);
menu_button = gtk_menu_button_new ();
gtk_actionable_set_action_name (GTK_ACTIONABLE (menu_button), "app.gear-menu");
gtk_button_set_image (GTK_BUTTON (menu_button), image);
......@@ -596,6 +620,7 @@ photos_main_toolbar_populate_for_search (PhotosMainToolbar *self)
gtk_header_bar_set_custom_title (GTK_HEADER_BAR (self->header_bar), self->stack_switcher);
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (self->header_bar), TRUE);
photos_main_toolbar_add_primary_menu_button (self);
photos_main_toolbar_add_selection_button (self);
photos_main_toolbar_add_search_button (self);
}
......
......@@ -36,6 +36,10 @@
<attribute name="action">app.properties</attribute>
<attribute name="label" translatable="yes">Properties</attribute>
</item>
<item>
<attribute name="action">app.fullscreen</attribute>
<attribute name="label" translatable="yes">Fullscreen</attribute>
</item>
</section>
</menu>
</interface>
<interface>
<menu id="app-menu">
<section>
<item>
<attribute name="action">app.fullscreen</attribute>
<attribute name="label" translatable="yes">Fullscreen</attribute>
</item>
</section>
<menu id="primary-menu">
<section>
<item>
<attribute name="action">win.show-help-overlay</attribute>
<attribute name="label" translatable="yes">Keyboard Shortcuts</attribute>
<attribute name="label" translatable="yes">Keyboard Shortcuts</attribute>
</item>
<item>
<attribute name="action">app.help</attribute>
......@@ -17,11 +11,7 @@
</item>
<item>
<attribute name="action">app.about</attribute>
<attribute name="label" translatable="yes">About</attribute>
</item>
<item>
<attribute name="action">app.quit</attribute>
<attribute name="label" translatable="yes">Quit</attribute>
<attribute name="label" translatable="yes">About Photos</attribute>
</item>
</section>
</menu>
......
......@@ -28,6 +28,7 @@
<file alias="main-toolbar.ui" preprocess="xml-stripblanks" compressed="true">photos-main-toolbar.ui</file>
<file alias="main-window.ui" preprocess="xml-stripblanks" compressed="true">photos-main-window.ui</file>
<file alias="preview-menu.ui" preprocess="xml-stripblanks" compressed="true">photos-preview-menu.ui</file>
<file alias="primary-menu.ui" preprocess="xml-stripblanks" compressed="true">photos-primary-menu.ui</file>
<file alias="removable-device-widget.ui" preprocess="xml-stripblanks" compressed="true">photos-removable-device-widget.ui</file>
<file alias="removable-devices-button.ui" preprocess="xml-stripblanks" compressed="true">photos-removable-devices-button.ui</file>
<file alias="selection-menu.ui" preprocess="xml-stripblanks" compressed="true">photos-selection-menu.ui</file>
......@@ -38,7 +39,6 @@
<gresource prefix="/org/gnome/Photos/gtk">
<file alias="help-overlay.ui" preprocess="xml-stripblanks" compressed="true">photos-help-overlay.ui</file>
<file alias="menus.ui" preprocess="xml-stripblanks" compressed="true">photos-menus.ui</file>
</gresource>
<gresource prefix="/org/gnome/Photos/icons">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment