Handle merge of app menu into gear menu

parent 3c46c0b5
......@@ -65,6 +65,7 @@ struct _GeditWindowPrivate
/* Widgets for fullscreen mode */
GtkWidget *fullscreen_controls;
GtkMenuButton *fullscreen_gear_button;
gboolean fullscreen_controls_setup;
guint fullscreen_animation_timeout_id;
gboolean fullscreen_animation_enter;
......@@ -88,7 +89,10 @@ struct _GeditWindowPrivate
GtkWidget *headerbar;
GtkWidget *open_button;
GtkWidget *open_menu;
GtkMenuButton *gear_button;
GMenuModel *gear_menu;
GMenuModel *gear_menu_win;
GMenuModel *gear_menu_app;
/* recent files */
......
......@@ -425,7 +425,9 @@ 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, gear_button);
gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, gear_menu_win);
gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, gear_menu_app);
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);
......@@ -433,6 +435,7 @@ gedit_window_class_init (GeditWindowClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, bottom_panel);
gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, statusbar);
gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, fullscreen_controls);
gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, fullscreen_gear_button);
}
static void
......@@ -2996,6 +2999,20 @@ gedit_window_init (GeditWindow *window)
setup_headerbar_open_button (window);
if (_gedit_app_has_app_menu (GEDIT_APP (g_application_get_default ())))
{
window->priv->gear_menu = window->priv->gear_menu_win;
}
else
{
window->priv->gear_menu = window->priv->gear_menu_app;
}
gtk_menu_button_set_menu_model (window->priv->gear_button,
window->priv->gear_menu);
gtk_menu_button_set_menu_model (window->priv->fullscreen_gear_button,
window->priv->gear_menu);
/* Setup status bar */
setup_statusbar (window);
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<menu id="gear_menu">
<menu id="gear_menu_win">
<section>
<attribute name="id">ext1</attribute>
</section>
......@@ -18,7 +18,6 @@
<item>
<attribute name="label" translatable="yes">Save _All</attribute>
<attribute name="action">win.save_all</attribute>
<attribute name="accel">&lt;Primary&gt;&lt;Shift&gt;l</attribute>
</item>
</section>
<section>
......@@ -86,10 +85,12 @@
</section>
<section>
<attribute name="id">ext12</attribute>
</section>
<section>
<attribute name="id">ext13</attribute>
<item>
<attribute name="label" translatable="yes">_Close All</attribute>
<attribute name="action">win.close_all</attribute>
<attribute name="accel">&lt;Primary&gt;&lt;Shift&gt;w</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Close</attribute>
......@@ -97,6 +98,119 @@
</item>
</section>
</menu>
<menu id="gear_menu_app">
<section>
<attribute name="id">ext1</attribute>
</section>
<section>
<attribute name="id">ext2</attribute>
<item>
<attribute name="label" translatable="yes">_Reload</attribute>
<attribute name="action">win.revert</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Save As…</attribute>
<attribute name="action">win.save_as</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Save _All</attribute>
<attribute name="action">win.save_all</attribute>
</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>
</item>
</section>
<section>
<attribute name="id">ext5</attribute>
</section>
<section>
<attribute name="id">ext6</attribute>
<item>
<attribute name="label" translatable="yes">Side _Panel</attribute>
<attribute name="action">win.side_panel</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Bottom Panel</attribute>
<attribute name="action">win.bottom_panel</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Fullscreen</attribute>
<attribute name="action">win.fullscreen</attribute>
</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>
</item>
<item>
<attribute name="label" translatable="yes">_Find and Replace…</attribute>
<attribute name="action">win.replace</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Clear Highlight</attribute>
<attribute name="action">win.clear_highlight</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Go to Line…</attribute>
<attribute name="action">win.goto_line</attribute>
</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>
<item>
<attribute name="label" translatable="yes">_Preferences</attribute>
<attribute name="action">app.preferences</attribute>
</item>
</section>
<section>
<attribute name="id">ext12</attribute>
<item>
<attribute name="label" translatable="yes">_Help</attribute>
<attribute name="action">app.help</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_About</attribute>
<attribute name="action">app.about</attribute>
</item>
</section>
<section>
<attribute name="id">ext13</attribute>
<item>
<attribute name="label" translatable="yes">_Close All</attribute>
<attribute name="action">win.close_all</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Close</attribute>
<attribute name="action">win.close</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">app.quit</attribute>
</item>
</section>
</menu>
<template class="GeditWindow" parent="GtkWindow">
<property name="can_focus">False</property>
<property name="has_focus">False</property>
......@@ -204,7 +318,6 @@
<object class="GtkMenuButton" id="gear_button">
<property name="visible">True</property>
<property name="valign">center</property>
<property name="menu_model">gear_menu</property>
<style>
<class name="image-button"/>
</style>
......@@ -386,7 +499,6 @@
<object class="GtkMenuButton" id="fullscreen_gear_button">
<property name="visible">True</property>
<property name="valign">center</property>
<property name="menu_model">gear_menu</property>
<style>
<class name="image-button"/>
</style>
......
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