[krb5-auth-dialog] More generic debug/test option handling
- From: Guido Günther <guidog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [krb5-auth-dialog] More generic debug/test option handling
- Date: Sat, 1 Nov 2014 21:15:14 +0000 (UTC)
commit f9d341f91787581f5a55ff03dd275104a417530f
Author: Guido Günther <agx sigxcpu org>
Date: Sat Nov 1 14:00:18 2014 +0100
More generic debug/test option handling
KRB5_AUTH_DIALOG_DEBUG_NO_APP_MENU
is now
KRB5_AUTH_DIALOG_DEBUG=no-app-menu
This will allow to extend this to more options
src/ka-applet.c | 50 +++++++++++++++++++++++++++++++++++---------------
1 files changed, 35 insertions(+), 15 deletions(-)
---
diff --git a/src/ka-applet.c b/src/ka-applet.c
index 841c62e..721a0fa 100644
--- a/src/ka-applet.c
+++ b/src/ka-applet.c
@@ -55,6 +55,11 @@ 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",
@@ -88,9 +93,10 @@ struct _KaAppletPrivate {
int pw_prompt_secs; /* when to start sending notifications */
KaPluginLoader *loader; /* Plugin loader */
- /* command line handling */
+ /* command line and env handling */
gboolean startup_ccache; /* ccache found on startup */
gboolean auto_run; /* only start with valid ccache */
+ gint debug_flags; /* Debug options from environment */
NotifyNotification *notification; /* notification messages */
char *krb_msg; /* Additional banner delivered by Kerberos */
@@ -264,18 +270,37 @@ setup_signal_handlers (KaApplet *applet)
}
-static GActionEntry app_entries[] = {
- { "preferences", action_preferences, NULL, NULL, NULL, {0} },
- { "about", action_about, NULL, NULL, NULL, {0} },
- { "help", action_help, NULL, NULL, NULL, {0} },
- { "quit", action_quit, NULL, NULL, NULL, {0} },
-};
+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_applet_app_menu_create(KaApplet *self)
{
- const gchar *debug_no_app_menu;
GMenuModel *app_menu;
GtkBuilder *builder;
@@ -290,13 +315,6 @@ ka_applet_app_menu_create(KaApplet *self)
gtk_application_set_app_menu (GTK_APPLICATION(self),
app_menu);
- debug_no_app_menu = g_getenv ("KRB5_AUTH_DIALOG_DEBUG_NO_APP_MENU");
- if (debug_no_app_menu) {
- KA_DEBUG ("Disabling app menu GtkSetting as requested...");
- g_object_set (gtk_settings_get_default (),
- "gtk-shell-shows-app-menu", FALSE,
- NULL);
- }
g_object_unref (builder);
}
@@ -1203,6 +1221,8 @@ 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]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]