aboutsummaryrefslogtreecommitdiff
path: root/src/krb5-auth-gconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/krb5-auth-gconf.c')
-rw-r--r--src/krb5-auth-gconf.c55
1 files changed, 29 insertions, 26 deletions
diff --git a/src/krb5-auth-gconf.c b/src/krb5-auth-gconf.c
index 7353471..fd573c1 100644
--- a/src/krb5-auth-gconf.c
+++ b/src/krb5-auth-gconf.c
@@ -1,6 +1,6 @@
/* Krb5 Auth Applet -- Acquire and release kerberos tickets
*
- * (C) 2008 Guido Guenther <agx@sigxcpu.org>
+ * (C) 2008,2009 Guido Guenther <agx@sigxcpu.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -111,52 +111,55 @@ ka_gconf_get_bool (GConfClient* client,
static gboolean
-ka_gconf_set_principal (GConfClient* client, Krb5AuthApplet* applet)
+ka_gconf_set_principal (GConfClient* client, KaApplet* applet)
{
- g_free (applet->principal);
- applet->principal = NULL;
- if(!ka_gconf_get_string (client, KA_GCONF_KEY_PRINCIPAL, &applet->principal)) {
- applet->principal = g_strdup (g_get_user_name());
+ gchar* principal = NULL;
+
+ if(!ka_gconf_get_string (client, KA_GCONF_KEY_PRINCIPAL, &principal)) {
+ principal = g_strdup (g_get_user_name());
}
- KA_DEBUG("Setting principal to '%s'", applet->principal);
- // FIXME: need to send set-principal signal
+ g_object_set(applet, "principal", principal, NULL);
+ g_free (principal);
return TRUE;
}
static gboolean
-ka_gconf_set_pk_userid (GConfClient* client, Krb5AuthApplet* applet)
+ka_gconf_set_pk_userid (GConfClient* client, KaApplet* applet)
{
- g_free (applet->pk_userid);
- if(!ka_gconf_get_string (client, KA_GCONF_KEY_PK_USERID, &applet->pk_userid)) {
- applet->pk_userid = NULL;
+ gchar* pk_userid = NULL;
+
+ if(!ka_gconf_get_string (client, KA_GCONF_KEY_PK_USERID, &pk_userid)) {
+ pk_userid = g_strdup ("");
}
- KA_DEBUG("Setting pk_userid to '%s'", applet->pk_userid ? applet->pk_userid : "<disabled>");
+ g_object_set(applet, "pk_userid", pk_userid, NULL);
+ g_free (pk_userid);
return TRUE;
}
static gboolean
-ka_gconf_set_prompt_mins (GConfClient* client, Krb5AuthApplet* applet)
+ka_gconf_set_prompt_mins (GConfClient* client, KaApplet* applet)
{
- if(!ka_gconf_get_int (client, KA_GCONF_KEY_PROMPT_MINS, &applet->pw_prompt_secs)) {
- applet->pw_prompt_secs = MINUTES_BEFORE_PROMPTING;
+ gint prompt_mins = 0;
+
+ if(!ka_gconf_get_int (client, KA_GCONF_KEY_PROMPT_MINS, &prompt_mins)) {
+ prompt_mins = MINUTES_BEFORE_PROMPTING;
}
- applet->pw_prompt_secs *= 60;
- KA_DEBUG("Setting prompting timer to %d seconds", applet->pw_prompt_secs);
+ g_object_set(applet, "pw-prompt-mins", prompt_mins, NULL);
return TRUE;
}
static gboolean
-ka_gconf_set_show_trayicon (GConfClient* client, Krb5AuthApplet* applet)
+ka_gconf_set_show_trayicon (GConfClient* client, KaApplet* applet)
{
- if(!ka_gconf_get_bool(client, KA_GCONF_KEY_SHOW_TRAYICON, &applet->show_trayicon)) {
- applet->show_trayicon = TRUE;
+ gboolean show_trayicon = FALSE;
+
+ if(!ka_gconf_get_bool(client, KA_GCONF_KEY_SHOW_TRAYICON, &show_trayicon)) {
+ show_trayicon = TRUE;
}
- KA_DEBUG("Show trayicon: %s", (applet->show_trayicon ? "yes" : "no" ));
- // FIXME: send show trayicon signal
- ka_show_tray_icon(applet);
+ g_object_set(applet, "show-trayicon", show_trayicon, NULL);
return TRUE;
}
@@ -169,7 +172,7 @@ ka_gconf_key_changed_callback (GConfClient* client,
{
const char* key;
- Krb5AuthApplet* applet = (Krb5AuthApplet*)user_data;
+ KaApplet* applet = KA_APPLET(user_data);
key = gconf_entry_get_key (entry);
if (!key)
return;
@@ -190,7 +193,7 @@ ka_gconf_key_changed_callback (GConfClient* client,
gboolean
-ka_gconf_init (Krb5AuthApplet* applet, int argc, char* argv[])
+ka_gconf_init (KaApplet* applet, int argc, char* argv[])
{
GError *error = NULL;
GConfClient* client;