[gnome-builder] menus: synchronize window menu between greeter and workbench
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] menus: synchronize window menu between greeter and workbench
- Date: Wed, 19 Sep 2018 20:14:46 +0000 (UTC)
commit 6530353b19f86aad21c1ce2ad0132690b51ab847
Author: Christian Hergert <chergert redhat com>
Date: Wed Sep 19 13:14:15 2018 -0700
menus: synchronize window menu between greeter and workbench
We might want to add conditional support to dazzle menus so that we can
disable more things (or change wording?) depending what state we're in.
Also, we could just duplicate the menus which is probably simpler.
src/libide/greeter/ide-greeter-perspective.ui | 4 ++-
src/libide/workbench/ide-workbench-header-bar.c | 37 ------------------------
src/libide/workbench/ide-workbench-header-bar.ui | 14 ++++-----
3 files changed, 9 insertions(+), 46 deletions(-)
---
diff --git a/src/libide/greeter/ide-greeter-perspective.ui b/src/libide/greeter/ide-greeter-perspective.ui
index 3cf112e1d..40176d325 100644
--- a/src/libide/greeter/ide-greeter-perspective.ui
+++ b/src/libide/greeter/ide-greeter-perspective.ui
@@ -276,9 +276,11 @@
</child>
<child>
<object class="DzlMenuButton" id="gear_button">
+ <property name="show-accels">true</property>
+ <property name="show-icons">true</property>
<property name="icon-name">open-menu-symbolic</property>
- <property name="visible">true</property>
<property name="menu-id">gear-menu</property>
+ <property name="visible">true</property>
<style>
<class name="image-button"/>
</style>
diff --git a/src/libide/workbench/ide-workbench-header-bar.c b/src/libide/workbench/ide-workbench-header-bar.c
index f08ce325f..dade5d231 100644
--- a/src/libide/workbench/ide-workbench-header-bar.c
+++ b/src/libide/workbench/ide-workbench-header-bar.c
@@ -71,23 +71,6 @@ apply_quirks (IdeWorkbenchHeaderBar *self)
gtk_widget_hide (GTK_WIDGET (priv->fullscreen_button));
}
-static void
-ide_workbench_header_bar_menu_items_changed (IdeWorkbenchHeaderBar *self,
- guint position,
- guint removed,
- guint added,
- GMenu *menu)
-{
- IdeWorkbenchHeaderBarPrivate *priv = ide_workbench_header_bar_get_instance_private (self);
- gboolean visible;
-
- g_assert (IDE_IS_WORKBENCH_HEADER_BAR (self));
- g_assert (G_IS_MENU (menu));
-
- visible = g_menu_model_get_n_items (G_MENU_MODEL (menu)) > 0;
- gtk_widget_set_visible (GTK_WIDGET (priv->menu_button), visible);
-}
-
static void
search_popover_position_func (DzlSuggestionEntry *entry,
GdkRectangle *area,
@@ -140,32 +123,12 @@ static void
ide_workbench_header_bar_init (IdeWorkbenchHeaderBar *self)
{
IdeWorkbenchHeaderBarPrivate *priv = ide_workbench_header_bar_get_instance_private (self);
- GtkWidget *popover;
- GMenu *model;
gtk_widget_init_template (GTK_WIDGET (self));
- model = dzl_application_get_menu_by_id (DZL_APPLICATION_DEFAULT, "gear-menu");
- popover = gtk_popover_new_from_model (NULL, G_MENU_MODEL (model));
- gtk_widget_set_size_request (popover, 225, -1);
- gtk_menu_button_set_popover (priv->menu_button, popover);
- gtk_container_set_border_width (GTK_CONTAINER (popover), 10);
-
dzl_suggestion_entry_set_position_func (DZL_SUGGESTION_ENTRY (priv->search_entry),
search_popover_position_func, NULL, NULL);
- /*
- * We want to track whether or not there are any menu items
- * in the workbench menu. If there are no items, then we will
- * hide the menu.
- */
- g_signal_connect_object (model,
- "items-changed",
- G_CALLBACK (ide_workbench_header_bar_menu_items_changed),
- self,
- G_CONNECT_SWAPPED);
- ide_workbench_header_bar_menu_items_changed (self, 0, 0, 0, model);
-
apply_quirks (self);
}
diff --git a/src/libide/workbench/ide-workbench-header-bar.ui
b/src/libide/workbench/ide-workbench-header-bar.ui
index 53927febe..8f31e39f8 100644
--- a/src/libide/workbench/ide-workbench-header-bar.ui
+++ b/src/libide/workbench/ide-workbench-header-bar.ui
@@ -69,19 +69,17 @@
</object>
</child>
<child>
- <object class="GtkMenuButton" id="menu_button">
- <property name="tooltip-text" translatable="yes">Show workbench menu</property>
+ <object class="DzlMenuButton" id="menu_button">
<property name="focus-on-click">false</property>
+ <property name="icon-name">open-menu-symbolic</property>
+ <property name="menu-id">gear-menu</property>
+ <property name="show-accels">true</property>
+ <property name="show-icons">true</property>
+ <property name="tooltip-text" translatable="yes">Show workbench menu</property>
<property name="visible">true</property>
<style>
<class name="image-button"/>
</style>
- <child>
- <object class="GtkImage">
- <property name="icon-name">open-menu-symbolic</property>
- <property name="visible">true</property>
- </object>
- </child>
</object>
<packing>
<property name="pack-type">end</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]