[gnome-logs] Use new GtkApplication appmenu resource handling



commit e2da1ed571f7fdbf2ffdc840268d3276eddc472f
Author: David King <davidk gnome org>
Date:   Thu Jul 10 12:44:23 2014 +0100

    Use new GtkApplication appmenu resource handling
    
    Bump dependency on GTK+ to 3.13.4.

 configure.ac                      |    2 +-
 data/{appmenu.ui => menus.ui}     |    4 ++--
 data/org.gnome.Logs.gresource.xml |    4 +++-
 po/POTFILES.in                    |    2 +-
 src/gl-application.c              |   19 -------------------
 5 files changed, 7 insertions(+), 24 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 22cf7bf..4f42f71 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,7 +88,7 @@ AM_CONDITIONAL([LOGS_ENABLE_TESTS], [test "x$testing_utilities" = "xyes"])
 
 dnl Libraries
 GIO_REQUIRED="gio-unix-2.0 >= 2.39.90"
-GTK_REQUIRED="gtk+-3.0 >= 3.13.2"
+GTK_REQUIRED="gtk+-3.0 >= 3.13.4"
 SYSTEMD_JOURNAL_REQUIRED="libsystemd-journal"
 PKG_CHECK_MODULES([LOGS], [$GIO_REQUIRED $GTK_REQUIRED $SYSTEMD_JOURNAL_REQUIRED])
 
diff --git a/data/appmenu.ui b/data/menus.ui
similarity index 94%
rename from data/appmenu.ui
rename to data/menus.ui
index 15f4031..bc9b17f 100644
--- a/data/appmenu.ui
+++ b/data/menus.ui
@@ -1,5 +1,5 @@
-<interface>
-    <menu id='appmenu'>
+<interface domain='gnome-logs'>
+    <menu id='app-menu'>
         <section>
             <item>
                 <attribute name="accel">&lt;Primary&gt;n</attribute>
diff --git a/data/org.gnome.Logs.gresource.xml b/data/org.gnome.Logs.gresource.xml
index 03ec9ad..2b0ec8a 100644
--- a/data/org.gnome.Logs.gresource.xml
+++ b/data/org.gnome.Logs.gresource.xml
@@ -1,11 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
   <gresource prefix='/org/gnome/Logs'>
-    <file preprocess='xml-stripblanks'>appmenu.ui</file>
     <file preprocess='xml-stripblanks'>gl-categorylist.ui</file>
     <file preprocess='xml-stripblanks'>gl-eventtoolbar.ui</file>
     <file preprocess='xml-stripblanks'>gl-eventviewdetail.ui</file>
     <file>gl-style.css</file>
     <file preprocess='xml-stripblanks'>gl-window.ui</file>
   </gresource>
+  <gresource prefix='/org/gnome/Logs/gtk'>
+    <file preprocess='xml-stripblanks'>menus.ui</file>
+  </gresource>
 </gresources>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e4e5d9c..d1dfd10 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,7 +1,7 @@
-[type: gettext/glade]data/appmenu.ui
 [type: gettext/glade]data/gl-categorylist.ui
 [type: gettext/glade]data/gl-eventtoolbar.ui
 [type: gettext/glade]data/gl-eventviewdetail.ui
+[type: gettext/glade]data/menus.ui
 data/org.gnome.Logs.appdata.xml.in
 data/org.gnome.Logs.desktop.in
 src/gl-application.c
diff --git a/src/gl-application.c b/src/gl-application.c
index b64bc16..3395170 100644
--- a/src/gl-application.c
+++ b/src/gl-application.c
@@ -164,10 +164,6 @@ static GActionEntry actions[] = {
 static void
 gl_application_startup (GApplication *application)
 {
-    GtkBuilder *builder;
-    GError *error = NULL;
-    GMenuModel *appmenu;
-
     g_action_map_add_action_entries (G_ACTION_MAP (application), actions,
                                      G_N_ELEMENTS (actions), application);
 
@@ -177,21 +173,6 @@ gl_application_startup (GApplication *application)
     /* gtk_init() calls setlocale(), so gettext must be called after that. */
     g_set_application_name (_(PACKAGE_NAME));
 
-    builder = gtk_builder_new ();
-    gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
-    gtk_builder_add_from_resource (builder, "/org/gnome/Logs/appmenu.ui",
-                                   &error);
-
-    if (error != NULL)
-    {
-        g_error ("Unable to get app menu from resource: %s", error->message);
-    }
-
-    appmenu = G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu"));
-    gtk_application_set_app_menu (GTK_APPLICATION (application), appmenu);
-
-    g_object_unref (builder);
-
     /* Must register custom types before using them from GtkBuilder. */
     gl_window_get_type ();
     gl_category_list_get_type ();


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