[krb5-auth-dialog] Retrieve app-menu via GResource
- From: Guido Günther <guidog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [krb5-auth-dialog] Retrieve app-menu via GResource
- Date: Sun, 26 Oct 2014 13:51:02 +0000 (UTC)
commit 643fc595e87c907d97c490a2911dc950ea46d7ca
Author: Guido Günther <agx sigxcpu org>
Date: Thu Oct 23 23:31:59 2014 +0200
Retrieve app-menu via GResource
Not using a external glade file makes it simpler to run from the source
tree.
src/Makefile.am | 2 ++
src/ka-applet.c | 19 ++++++++++++-------
src/krb5-auth-dialog.gresource.xml | 1 +
src/krb5-auth-dialog.ui | 24 ------------------------
src/resources/ui/app-menu.ui | 28 ++++++++++++++++++++++++++++
5 files changed, 43 insertions(+), 31 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 8d0a062..3f4cd88 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -111,6 +111,8 @@ EXTRA_DIST = \
org.gnome.KrbAuthDialog.gschema.xml \
krb5-auth-dialog.1.in \
krb5-auth-dialog.gresource.xml \
+ resources/ui/app-menu.ui \
+ resources/ui/ka-pwdialog.ui \
$(NULL)
CLEANFILES = $(schema_DATA) \
diff --git a/src/ka-applet.c b/src/ka-applet.c
index 610663d..a12ef3a 100644
--- a/src/ka-applet.c
+++ b/src/ka-applet.c
@@ -245,19 +245,23 @@ static GActionEntry app_entries[] = {
};
static void
-ka_applet_app_menu_create(KaApplet *self,
- GtkBuilder *uixml)
+ka_applet_app_menu_create(KaApplet *self)
+
{
const gchar *debug_no_app_menu;
- GMenuModel *model = G_MENU_MODEL(gtk_builder_get_object (uixml,
- "app-menu"));
+ GMenuModel *app_menu;
+ GtkBuilder *builder;
+
+ builder = gtk_builder_new_from_resource ("/org/gnome/krb5-auth-dialog/ui/app-menu.ui");
+ app_menu = G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu"));
+
g_action_map_add_action_entries (G_ACTION_MAP (self),
app_entries, G_N_ELEMENTS (app_entries),
self);
- g_assert (model != NULL);
+ g_assert (app_menu != NULL);
gtk_application_set_app_menu (GTK_APPLICATION(self),
- model);
+ app_menu);
debug_no_app_menu = g_getenv ("KRB5_AUTH_DIALOG_DEBUG_NO_APP_MENU");
if (debug_no_app_menu) {
@@ -266,6 +270,7 @@ ka_applet_app_menu_create(KaApplet *self,
"gtk-shell-shows-app-menu", FALSE,
NULL);
}
+ g_object_unref (builder);
}
static void
@@ -281,7 +286,7 @@ ka_applet_startup (GApplication *application)
ka_main_window_create (self, self->priv->uixml);
ka_preferences_window_create (self, self->priv->uixml);
- ka_applet_app_menu_create(self, self->priv->uixml);
+ ka_applet_app_menu_create(self);
}
static void
diff --git a/src/krb5-auth-dialog.gresource.xml b/src/krb5-auth-dialog.gresource.xml
index a6f3eea..6c72b32 100644
--- a/src/krb5-auth-dialog.gresource.xml
+++ b/src/krb5-auth-dialog.gresource.xml
@@ -2,5 +2,6 @@
<gresources>
<gresource prefix="/org/gnome/krb5-auth-dialog">
<file preprocess="xml-stripblanks">ui/ka-pwdialog.ui</file>
+ <file preprocess="xml-stripblanks">ui/app-menu.ui</file>
</gresource>
</gresources>
diff --git a/src/krb5-auth-dialog.ui b/src/krb5-auth-dialog.ui
index 50fd5bc..eb4eb1f 100644
--- a/src/krb5-auth-dialog.ui
+++ b/src/krb5-auth-dialog.ui
@@ -1,30 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
- <menu id="app-menu">
- <section>
- <item>
- <attribute name="action">app.preferences</attribute>
- <attribute name="label" translatable="yes">Prefere_nces</attribute>
- </item>
- </section>
- <section>
- <item>
- <attribute name="action">app.about</attribute>
- <attribute name="label" translatable="yes">_About</attribute>
- </item>
- <item>
- <attribute name="action">app.help</attribute>
- <attribute name="label" translatable="yes">_Help</attribute>
- </item>
- </section>
- <section>
- <item>
- <attribute name="action">app.quit</attribute>
- <attribute name="label" translatable="yes">_Quit</attribute>
- </item>
- </section>
- </menu>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">100</property>
<property name="step_increment">1</property>
diff --git a/src/resources/ui/app-menu.ui b/src/resources/ui/app-menu.ui
new file mode 100644
index 0000000..c61e580
--- /dev/null
+++ b/src/resources/ui/app-menu.ui
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <menu id="app-menu">
+ <section>
+ <item>
+ <attribute name="action">app.preferences</attribute>
+ <attribute name="label" translatable="yes">Prefere_nces</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="action">app.about</attribute>
+ <attribute name="label" translatable="yes">_About</attribute>
+ </item>
+ <item>
+ <attribute name="action">app.help</attribute>
+ <attribute name="label" translatable="yes">_Help</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="action">app.quit</attribute>
+ <attribute name="label" translatable="yes">_Quit</attribute>
+ </item>
+ </section>
+ </menu>
+</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]