Use GtkApplication built-in for loading app menu.

* src/client/application/geary-application.vala (GearyApplication): Set
  the resource_base_path to comply with the expected modern app id, so
  the app menu will be automatically loaded.

* ui/CMakeLists.txt: Replace app_menu.interface with gtk/menus.ui. Don't
  try ot copy interface files now that there aren't any.

* gtk/menus.ui: Replaces app_menu.interface.
This commit is contained in:
Michael James Gratton 2016-09-25 01:05:29 +10:00
parent ee61c084e7
commit a3e0e474e7
4 changed files with 44 additions and 34 deletions

View file

@ -88,8 +88,10 @@ public class GearyApplication : Gtk.Application {
private bool is_destroyed = false;
public GearyApplication() {
Object(application_id: APP_ID);
Object(
application_id: APP_ID,
resource_base_path: "/org/gnome/Geary" // XXX remove this when Bug 766196 is fixed
);
_instance = this;
}

View file

@ -4,7 +4,6 @@ set(RESOURCE_LIST
STRIPBLANKS "account_cannot_remove.glade"
STRIPBLANKS "account_list.glade"
STRIPBLANKS "account_spinner.glade"
STRIPBLANKS "app_menu.interface"
STRIPBLANKS "certificate_warning_dialog.glade"
STRIPBLANKS "composer-headerbar.ui"
STRIPBLANKS "composer-menus.ui"
@ -12,6 +11,7 @@ set(RESOURCE_LIST
STRIPBLANKS "edit_alternate_emails.glade"
STRIPBLANKS "find_bar.glade"
STRIPBLANKS "folder-popover.ui"
STRIPBLANKS "gtk/menus.ui"
STRIPBLANKS "login.glade"
STRIPBLANKS "password-dialog.glade"
STRIPBLANKS "preferences.glade"
@ -50,7 +50,7 @@ add_custom_target(resource_copy ALL
COMMAND
cp ${RESOURCES_XML} ${CMAKE_BINARY_DIR}/ui
COMMAND
cp ${CMAKE_SOURCE_DIR}/ui/*.glade ${CMAKE_SOURCE_DIR}/ui/*.interface ${CMAKE_SOURCE_DIR}/ui/*.ui ${CMAKE_BINARY_DIR}/ui
cp ${CMAKE_SOURCE_DIR}/ui/*.glade ${CMAKE_SOURCE_DIR}/ui/*.ui ${CMAKE_BINARY_DIR}/ui
COMMAND
cp ${CMAKE_SOURCE_DIR}/ui/*.css ${CMAKE_BINARY_DIR}/ui
)

View file

@ -1,30 +0,0 @@
<interface>
<menu id='app-menu'>
<section>
<item>
<attribute name='label' translatable='yes'>A_ccounts</attribute>
<attribute name='action'>app.GearyAccounts</attribute>
</item>
<item>
<attribute name='label' translatable='yes'>_Preferences</attribute>
<attribute name='action'>app.GearyPreferences</attribute>
</item>
</section>
<section>
<item>
<attribute name='label' translatable='yes'>_Help</attribute>
<attribute name='action'>app.GearyHelp</attribute>
<attribute name='accel'>F1</attribute>
</item>
<item>
<attribute name='label' translatable='yes'>_About</attribute>
<attribute name='action'>app.GearyAbout</attribute>
</item>
<item>
<attribute name='label' translatable='yes'>_Quit</attribute>
<attribute name='action'>app.GearyQuit</attribute>
<attribute name='accel'>&lt;Primary&gt;Q</attribute>
</item>
</section>
</menu>
</interface>

38
ui/gtk/menus.ui Normal file
View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id='app-menu'>
<section>
<item>
<attribute name='label' translatable='yes'>Compose Message</attribute>
<attribute name='action'>app.compose</attribute>
</item>
</section>
<section>
<item>
<attribute name='label' translatable='yes'>A_ccounts</attribute>
<attribute name='action'>app.accounts</attribute>
</item>
<item>
<attribute name='label' translatable='yes'>_Preferences</attribute>
<attribute name='action'>app.preferences</attribute>
</item>
</section>
<section>
<item>
<attribute name='label' translatable='yes'>_Help</attribute>
<attribute name='action'>app.help</attribute>
<attribute name='accel'>F1</attribute>
</item>
<item>
<attribute name='label' translatable='yes'>_About</attribute>
<attribute name='action'>app.about</attribute>
</item>
<item>
<attribute name='label' translatable='yes'>_Quit</attribute>
<attribute name='action'>app.quit</attribute>
<attribute name='accel'>&lt;Primary&gt;Q</attribute>
</item>
</section>
</menu>
</interface>