[gedit/wip/redesign2: 11/13] Add get_gear_menu to window and menu extension points
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/redesign2: 11/13] Add get_gear_menu to window and menu extension points
- Date: Thu, 26 Dec 2013 13:46:29 +0000 (UTC)
commit 1263c7a4a7d66663e9c44758fd4ec764d52b4d25
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Wed Dec 25 20:43:02 2013 +0100
Add get_gear_menu to window and menu extension points
gedit/gedit-window-private.h | 1 +
gedit/gedit-window.c | 17 +++++++++++++++++
gedit/gedit-window.h | 2 ++
gedit/gedit-window.ui | 30 +++++++++++++++++++++++++++---
4 files changed, 47 insertions(+), 3 deletions(-)
---
diff --git a/gedit/gedit-window-private.h b/gedit/gedit-window-private.h
index e61974b..a5229f7 100644
--- a/gedit/gedit-window-private.h
+++ b/gedit/gedit-window-private.h
@@ -92,6 +92,7 @@ struct _GeditWindowPrivate
GtkWidget *headerbar;
GtkWidget *open_button;
GtkWidget *open_menu;
+ GMenuModel *gear_menu;
/* recent files */
guint update_documents_list_menu_id;
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 5704bb0..00d2108 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -432,6 +432,7 @@ gedit_window_class_init (GeditWindowClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, side_headerbar);
gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, headerbar);
gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, open_menu);
+ gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, gear_menu);
gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, hpaned);
gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, side_panel);
gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, vpaned);
@@ -4120,4 +4121,20 @@ gedit_window_get_message_bus (GeditWindow *window)
return window->priv->message_bus;
}
+/**
+ * gedit_window_get_gear_menu:
+ * @window: a #GeditWindow.
+ *
+ * Gets the gear menu model.
+ *
+ * Returns: (transfer none): the #GMenuModel of the gear menu button.
+ */
+GMenuModel *
+gedit_window_get_gear_menu (GeditWindow *window)
+{
+ g_return_val_if_fail (GEDIT_IS_WINDOW (window), NULL);
+
+ return window->priv->gear_menu;
+}
+
/* ex:set ts=8 noet: */
diff --git a/gedit/gedit-window.h b/gedit/gedit-window.h
index 9ed77dd..9e4ac6c 100644
--- a/gedit/gedit-window.h
+++ b/gedit/gedit-window.h
@@ -150,6 +150,8 @@ GeditTab *gedit_window_get_tab_from_location (GeditWindow *window
/* Message bus */
GeditMessageBus *gedit_window_get_message_bus (GeditWindow *window);
+GMenuModel *gedit_window_get_gear_menu (GeditWindow *window);
+
/*
* Non exported functions
*/
diff --git a/gedit/gedit-window.ui b/gedit/gedit-window.ui
index 9300ead..0461dfd 100644
--- a/gedit/gedit-window.ui
+++ b/gedit/gedit-window.ui
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
- <menu id="gear-menu">
+ <menu id="gear_menu">
<section>
+ <attribute name="id">ext1</attribute>
+ </section>
+ <section>
+ <attribute name="id">ext2</attribute>
<item>
<attribute name="label" translatable="yes">_Save As…</attribute>
<attribute name="action">win.save_as</attribute>
@@ -14,6 +18,10 @@
</item>
</section>
<section>
+ <attribute name="id">ext3</attribute>
+ </section>
+ <section>
+ <attribute name="id">ext4</attribute>
<item>
<attribute name="label" translatable="yes">_Print</attribute>
<attribute name="action">win.print</attribute>
@@ -21,6 +29,10 @@
</item>
</section>
<section>
+ <attribute name="id">ext5</attribute>
+ </section>
+ <section>
+ <attribute name="id">ext6</attribute>
<item>
<attribute name="label" translatable="yes">_Fullscreen</attribute>
<attribute name="action">win.fullscreen</attribute>
@@ -28,6 +40,10 @@
</item>
</section>
<section>
+ <attribute name="id">ext7</attribute>
+ </section>
+ <section>
+ <attribute name="id">ext8</attribute>
<item>
<attribute name="label" translatable="yes">_Find…</attribute>
<attribute name="action">win.find</attribute>
@@ -50,12 +66,20 @@
</item>
</section>
<section>
+ <attribute name="id">ext9</attribute>
+ </section>
+ <section>
+ <attribute name="id">ext10</attribute>
<item>
<attribute name="label" translatable="yes">_Highlight Mode…</attribute>
<attribute name="action">win.highlight_mode</attribute>
</item>
</section>
<section>
+ <attribute name="id">ext11</attribute>
+ </section>
+ <section>
+ <attribute name="id">ext12</attribute>
<item>
<attribute name="label" translatable="yes">_Close</attribute>
<attribute name="action">win.close</attribute>
@@ -167,7 +191,7 @@
<object class="GtkMenuButton" id="gear_button">
<property name="visible">True</property>
<property name="valign">center</property>
- <property name="menu_model">gear-menu</property>
+ <property name="menu_model">gear_menu</property>
<style>
<class name="image-button"/>
</style>
@@ -367,7 +391,7 @@
<object class="GtkMenuButton" id="fullscreen_gear_button">
<property name="visible">True</property>
<property name="valign">center</property>
- <property name="menu_model">gear-menu</property>
+ <property name="menu_model">gear_menu</property>
<style>
<class name="image-button"/>
</style>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]