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



commit b3a4ff25b244c2cb8e579272e62fa1669323455b
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

 src/meson.build                 |  1 +
 src/photos-main-primary-menu.ui | 24 ++++++++++++++++++++++++
 src/photos-main-toolbar.c       | 25 ++++++++++++++++++++++++-
 src/photos-menus.ui             | 18 ------------------
 src/photos.gresource.xml        |  1 +
 5 files changed, 50 insertions(+), 19 deletions(-)
---
diff --git a/src/meson.build b/src/meson.build
index 645b1d73..8b978a8d 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -285,6 +285,7 @@ resource_data = files(
   'photos-import-dialog.ui',
   'photos-main-toolbar.ui',
   'photos-main-window.ui',
+  'photos-main-primary-menu.ui',
   'photos-menus.ui',
   'photos-preview-menu.ui',
   'photos-removable-devices-button.ui',
diff --git a/src/photos-main-primary-menu.ui b/src/photos-main-primary-menu.ui
new file mode 100644
index 00000000..21d2b20a
--- /dev/null
+++ b/src/photos-main-primary-menu.ui
@@ -0,0 +1,24 @@
+<interface>
+  <menu id="primary-menu">
+    <section>
+      <item>
+        <attribute name="action">app.fullscreen</attribute>
+        <attribute name="label" translatable="yes">Fullscreen</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="action">win.show-help-overlay</attribute>
+        <attribute name="label" translatable="yes">Keyboard Shortcuts</attribute>
+      </item>
+      <item>
+        <attribute name="action">app.help</attribute>
+        <attribute name="label" translatable="yes">_Help</attribute>
+      </item>
+      <item>
+        <attribute name="action">app.about</attribute>
+        <attribute name="label" translatable="yes">About Photos</attribute>
+      </item>
+    </section>
+  </menu>
+</interface>
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-menus.ui b/src/photos-menus.ui
index db26442c..be135ad7 100644
--- a/src/photos-menus.ui
+++ b/src/photos-menus.ui
@@ -1,24 +1,6 @@
 <interface>
   <menu id="app-menu">
     <section>
-      <item>
-        <attribute name="action">app.fullscreen</attribute>
-        <attribute name="label" translatable="yes">Fullscreen</attribute>
-      </item>
-    </section>
-    <section>
-      <item>
-        <attribute name="action">win.show-help-overlay</attribute>
-       <attribute name="label" translatable="yes">Keyboard Shortcuts</attribute>
-      </item>
-      <item>
-        <attribute name="action">app.help</attribute>
-        <attribute name="label" translatable="yes">_Help</attribute>
-      </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>
diff --git a/src/photos.gresource.xml b/src/photos.gresource.xml
index 76a81df4..719d9954 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>


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