[gnome-photos/menu-retirement: 17/17] Remove app menu



commit 8e7cc7b4252d820c89bbfa09b73214149eb97186
Author: Yi-Soo An <yisooan gmail com>
Date:   Tue Nov 20 17:29:36 2018 +0900

    Remove app menu
    
    According to the design guidelines[1], we remove app menu.
    This patch includes below parts,
    - Remove the app menu
    - Add a primary menu to the main toolbar
    - Change the menu icon in the image view to view-more-symbolic
    
    [1]: https://gitlab.gnome.org/GNOME/Initiatives/wikis/App-Menu-Retirement
    
    https://gitlab.gnome.org/GNOME/gnome-photos/issues/117

 po/POTFILES.in                                     |  1 -
 src/Makefile.am                                    |  1 -
 src/meson.build                                    |  2 +-
 ...photos-menus.ui => photos-main-primary-menu.ui} | 10 +++------
 src/photos-main-toolbar.c                          | 25 +++++++++++++++++++++-
 src/photos.gresource.xml                           |  2 +-
 6 files changed, 29 insertions(+), 12 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 919b9c18..b6ac6b73 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -24,7 +24,6 @@ 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
diff --git a/src/Makefile.am b/src/Makefile.am
index 744249e9..1bc375b1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -457,7 +457,6 @@ EXTRA_DIST = \
        photos-main-toolbar.ui \
        photos-main-window.ui \
        photos-marshalers.list \
-       photos-menus.ui \
        photos-preview-menu.ui \
        photos-removable-device-widget.ui \
        photos-removable-devices-button.ui \
diff --git a/src/meson.build b/src/meson.build
index 645b1d73..a4b81c10 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -285,7 +285,7 @@ resource_data = files(
   'photos-import-dialog.ui',
   'photos-main-toolbar.ui',
   'photos-main-window.ui',
-  'photos-menus.ui',
+  'photos-main-primary-menu.ui',
   'photos-preview-menu.ui',
   'photos-removable-devices-button.ui',
   'photos-removable-device-widget.ui',
diff --git a/src/photos-menus.ui b/src/photos-main-primary-menu.ui
similarity index 64%
rename from src/photos-menus.ui
rename to src/photos-main-primary-menu.ui
index db26442c..21d2b20a 100644
--- a/src/photos-menus.ui
+++ b/src/photos-main-primary-menu.ui
@@ -1,5 +1,5 @@
 <interface>
-  <menu id="app-menu">
+  <menu id="primary-menu">
     <section>
       <item>
         <attribute name="action">app.fullscreen</attribute>
@@ -9,7 +9,7 @@
     <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 +17,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>
diff --git a/src/photos-main-toolbar.c b/src/photos-main-toolbar.c
index 6f35e329..c5877c62 100644
--- a/src/photos-main-toolbar.c
+++ b/src/photos-main-toolbar.c
@@ -335,6 +335,26 @@ photos_main_toolbar_add_selection_button (PhotosMainToolbar *self)
   return selection_button;
 }
 
+static GtkWidget *
+photos_main_toolbar_add_primary_menu_button (PhotosMainToolbar *self)
+{
+  g_autoptr (GtkBuilder) builder = NULL;
+  g_autoptr (GMenu) primary_menu = NULL;
+  GtkWidget *menu_button;
+  GtkWidget *image;
+
+  builder = gtk_builder_new_from_resource ("/org/gnome/Photos/main-primary-menu.ui");
+  primary_menu = G_MENU (g_object_ref (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_widget_set_tooltip_text (menu_button, _("Open 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);
+
+  return menu_button;
+}
 
 static void
 photos_main_toolbar_clear_state_data (PhotosMainToolbar *self)
@@ -452,6 +472,7 @@ photos_main_toolbar_populate_for_collections (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_devices_button (self);
   photos_main_toolbar_add_selection_button (self);
   photos_main_toolbar_add_search_button (self);
@@ -483,6 +504,7 @@ photos_main_toolbar_populate_for_favorites (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_devices_button (self);
   photos_main_toolbar_add_selection_button (self);
   photos_main_toolbar_add_search_button (self);
@@ -522,6 +544,7 @@ photos_main_toolbar_populate_for_overview (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_devices_button (self);
   photos_main_toolbar_add_selection_button (self);
   photos_main_toolbar_add_search_button (self);
@@ -547,7 +570,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);
diff --git a/src/photos.gresource.xml b/src/photos.gresource.xml
index 76a81df4..98b0bbf6 100644
--- a/src/photos.gresource.xml
+++ b/src/photos.gresource.xml
@@ -27,6 +27,7 @@
     <file alias="import-dialog.ui" preprocess="xml-stripblanks" 
compressed="true">photos-import-dialog.ui</file>
     <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="main-primary-menu.ui" preprocess="xml-stripblanks" 
compressed="true">photos-main-primary-menu.ui</file>
     <file alias="preview-menu.ui" preprocess="xml-stripblanks" 
compressed="true">photos-preview-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>
@@ -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">


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]