[krb5-auth-dialog: 8/15] applet: Drop app menu and use hamburger menu instead
- From: Guido Günther <guidog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [krb5-auth-dialog: 8/15] applet: Drop app menu and use hamburger menu instead
- Date: Sat, 6 Feb 2021 19:16:58 +0000 (UTC)
commit 385289182c664833ca2463c19427b38016b26e08
Author: Guido Günther <agx sigxcpu org>
Date: Sat Feb 6 17:47:06 2021 +0100
applet: Drop app menu and use hamburger menu instead
This makes things usable when there's no app-menu availabe and
better matches mobile patterns.
po/POTFILES.in | 3 +-
src/Makefile.am | 1 -
src/ka-applet.c | 59 ++------------------------------------
src/krb5-auth-dialog.gresource.xml | 1 -
src/resources/ui/app-menu.ui | 28 ------------------
src/resources/ui/ka-main-window.ui | 55 +++++++++++++++++++++++++++++++++++
6 files changed, 59 insertions(+), 88 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a5bda55..010ba73 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,4 +1,3 @@
-[type: gettext/glade]src/resources/ui/app-menu.ui
[type: gettext/glade]src/resources/ui/ka-main-window.ui
[type: gettext/glade]src/resources/ui/ka-preferences.ui
[type: gettext/glade]src/resources/ui/ka-pwdialog.ui
@@ -12,4 +11,4 @@ src/ka-pwdialog.c
src/ka-tools.c
src/krb5-auth-dialog.appdata.xml.in
src/krb5-auth-dialog.desktop.in
-src/org.gnome.KrbAuthDialog.gschema.xml
\ No newline at end of file
+src/org.gnome.KrbAuthDialog.gschema.xml
diff --git a/src/Makefile.am b/src/Makefile.am
index 25782a5..188cf76 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -96,7 +96,6 @@ 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-main-window.ui \
resources/ui/ka-preferences.ui \
resources/ui/ka-pwdialog.ui \
diff --git a/src/ka-applet.c b/src/ka-applet.c
index a87a229..2fca2be 100644
--- a/src/ka-applet.c
+++ b/src/ka-applet.c
@@ -54,11 +54,6 @@ enum {
};
-enum {
- KA_DEBUG_NO_APP_MENU = 1, /* Disable gtk-shell-shows-app-menu gtk setting */
-};
-
-
const gchar *ka_signal_names[KA_SIGNAL_COUNT] = {
"krb-tgt-acquired",
"krb-tgt-renewed",
@@ -261,33 +256,6 @@ setup_signal_handlers (KaApplet *applet)
}
-static void
-ka_applet_handle_debug(KaApplet *self)
-{
- const gchar* debug;
- gchar **debug_opts, **opt;
-
- debug = g_getenv ("KRB5_AUTH_DIALOG_DEBUG");
- if (!debug)
- return;
-
- debug_opts = g_strsplit(debug, ",", -1);
- for (opt = debug_opts; *opt != NULL; opt++) {
- if (!g_strcmp0(*opt, "no-app-menu")) {
- KA_DEBUG ("Disabling app menu Gtk setting as requested...");
- g_object_set (gtk_settings_get_default (),
- "gtk-shell-shows-app-menu", FALSE,
- NULL);
- self->priv->debug_flags |= KA_DEBUG_NO_APP_MENU;
- } else {
- g_warning ("Unhandled debug options %s", *opt);
- }
- }
-
- g_strfreev (debug_opts);
-}
-
-
static void
ka_list_tickets_action (GSimpleAction *action G_GNUC_UNUSED,
GVariant *parameter G_GNUC_UNUSED,
@@ -332,27 +300,6 @@ static GActionEntry app_entries[] = {
};
-static void
-ka_applet_app_menu_create(KaApplet *self)
-
-{
- 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 (app_menu != NULL);
- gtk_application_set_app_menu (GTK_APPLICATION(self),
- app_menu);
-
- g_object_unref (builder);
-}
-
static void
ka_applet_startup (GApplication *application)
{
@@ -370,7 +317,9 @@ ka_applet_startup (GApplication *application)
self->priv->prefs = ka_preferences_new (self);
- ka_applet_app_menu_create(self);
+ g_action_map_add_action_entries (G_ACTION_MAP (self),
+ app_entries, G_N_ELEMENTS (app_entries),
+ self);
}
static void
@@ -887,8 +836,6 @@ ka_applet_create ()
{
KaApplet *applet = ka_applet_new ();
- ka_applet_handle_debug(applet);
-
if (!(ka_applet_setup_icons (applet)))
g_error ("Failure to setup icons");
gtk_window_set_default_icon_name (applet->priv->icons[val_icon]);
diff --git a/src/krb5-auth-dialog.gresource.xml b/src/krb5-auth-dialog.gresource.xml
index e941cb3..93a5089 100644
--- a/src/krb5-auth-dialog.gresource.xml
+++ b/src/krb5-auth-dialog.gresource.xml
@@ -4,6 +4,5 @@
<file preprocess="xml-stripblanks">ui/ka-main-window.ui</file>
<file preprocess="xml-stripblanks">ui/ka-pwdialog.ui</file>
<file preprocess="xml-stripblanks">ui/ka-preferences.ui</file>
- <file preprocess="xml-stripblanks">ui/app-menu.ui</file>
</gresource>
</gresources>
diff --git a/src/resources/ui/ka-main-window.ui b/src/resources/ui/ka-main-window.ui
index 4c99b79..985e81b 100644
--- a/src/resources/ui/ka-main-window.ui
+++ b/src/resources/ui/ka-main-window.ui
@@ -2,6 +2,43 @@
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.14"/>
+ <object class="GtkPopoverMenu" id="menu_main">
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="margin">10</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkModelButton">
+ <property name="visible">True</property>
+ <property name="action-name">app.preferences</property>
+ <property name="text" translatable="yes">Prefere_nces</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkModelButton">
+ <property name="visible">True</property>
+ <property name="action-name">app.about</property>
+ <property name="text" translatable="yes">_About</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkModelButton">
+ <property name="visible">True</property>
+ <property name="action-name">app.help</property>
+ <property name="text" translatable="yes">_Help</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkModelButton">
+ <property name="visible">True</property>
+ <property name="action-name">app.quit</property>
+ <property name="text" translatable="yes">_Quit</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">100</property>
<property name="step_increment">1</property>
@@ -46,6 +83,24 @@
<property name="label" translatable="yes">Get Ticket</property>
</object>
</child>
+ <child>
+ <object class="GtkMenuButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="popover">menu_main</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">open-menu-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]