diff options
author | Guido Günther <agx@sigxcpu.org> | 2009-04-18 00:24:56 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2009-04-18 00:24:56 +0200 |
commit | d6eee4e647348875912d9c6853a8de0a7d6069ad (patch) | |
tree | 752fa2997f98bd625f83846e813c907eceed8233 /preferences/krb5-auth-dialog-preferences.c | |
parent | Imported Upstream version 0.8+svn141 (diff) | |
download | krb5-auth-dialog-d6eee4e647348875912d9c6853a8de0a7d6069ad.tar.gz krb5-auth-dialog-d6eee4e647348875912d9c6853a8de0a7d6069ad.tar.bz2 krb5-auth-dialog-d6eee4e647348875912d9c6853a8de0a7d6069ad.zip |
Imported Upstream version 0.9~rc1
Diffstat (limited to 'preferences/krb5-auth-dialog-preferences.c')
-rw-r--r-- | preferences/krb5-auth-dialog-preferences.c | 74 |
1 files changed, 73 insertions, 1 deletions
diff --git a/preferences/krb5-auth-dialog-preferences.c b/preferences/krb5-auth-dialog-preferences.c index caf9ed9..ab463a0 100644 --- a/preferences/krb5-auth-dialog-preferences.c +++ b/preferences/krb5-auth-dialog-preferences.c @@ -36,7 +36,7 @@ #include "krb5-auth-gconf-tools.h" -#define N_LISTENERS 7 +#define N_LISTENERS 8 typedef struct { GladeXML *xml; @@ -45,6 +45,7 @@ typedef struct { GtkWidget *dialog; GtkWidget *principal_entry; GtkWidget *pkuserid_entry; + GtkWidget *pkanchors_entry; GtkWidget *forwardable_toggle; GtkWidget *proxiable_toggle; GtkWidget *renewable_toggle; @@ -198,6 +199,76 @@ ka_preferences_dialog_setup_pkuserid_entry (KaPreferencesDialog *dialog) static void +ka_preferences_pkanchors_notify (GConfClient *client G_GNUC_UNUSED, + guint cnx_id G_GNUC_UNUSED, + GConfEntry *entry, + KaPreferencesDialog *dialog) +{ + const char *pkanchors; + + if (!entry->value || entry->value->type != GCONF_VALUE_STRING) + return; + + pkanchors = gconf_value_get_string (entry->value); + + if (!pkanchors || !strlen(pkanchors)) + gtk_entry_set_text (GTK_ENTRY (dialog->pkanchors_entry), ""); + else { + const char *old_pkanchors; + + old_pkanchors = gtk_entry_get_text (GTK_ENTRY (dialog->pkanchors_entry)); + if (!old_pkanchors || (old_pkanchors && strcmp (old_pkanchors, pkanchors))) + gtk_entry_set_text (GTK_ENTRY (dialog->pkanchors_entry), pkanchors); + } +} + + +static void +ka_preferences_dialog_pkanchors_changed (GtkEntry *entry, + KaPreferencesDialog *dialog) +{ + const char *pkanchors; + + pkanchors = gtk_entry_get_text (entry); + + if (!pkanchors || !strlen(pkanchors)) + gconf_client_unset (dialog->client, KA_GCONF_KEY_PK_ANCHORS, NULL); + else + gconf_client_set_string (dialog->client, KA_GCONF_KEY_PK_ANCHORS, pkanchors, NULL); +} + + +static void +ka_preferences_dialog_setup_pkanchors_entry (KaPreferencesDialog *dialog) +{ + char *pkanchors = NULL; + + dialog->pkanchors_entry = glade_xml_get_widget (dialog->xml, "pkanchors_entry"); + g_assert (dialog->pkanchors_entry != NULL); + + if (!ka_gconf_get_string (dialog->client, KA_GCONF_KEY_PK_ANCHORS, &pkanchors)) + g_warning ("Getting pkanchors failed"); + + if (pkanchors && strlen(pkanchors)) + gtk_entry_set_text (GTK_ENTRY (dialog->pkanchors_entry), pkanchors); + if (pkanchors) + g_free (pkanchors); + + g_signal_connect (dialog->pkanchors_entry, "changed", + G_CALLBACK (ka_preferences_dialog_pkanchors_changed), dialog); + if (!gconf_client_key_is_writable (dialog->client, KA_GCONF_KEY_PK_ANCHORS, NULL)) { + gtk_widget_set_sensitive (dialog->pkanchors_entry, FALSE); + } + + dialog->listeners [dialog->n_listeners] = gconf_client_notify_add (dialog->client, + KA_GCONF_KEY_PK_ANCHORS, + (GConfClientNotifyFunc) ka_preferences_pkanchors_notify, + dialog, NULL, NULL); + dialog->n_listeners++; +} + + +static void ka_preferences_dialog_forwardable_toggled (GtkToggleButton *toggle, KaPreferencesDialog *dialog) { @@ -552,6 +623,7 @@ ka_preferences_dialog_init(KaPreferencesDialog* dialog) ka_preferences_dialog_setup_principal_entry (dialog); ka_preferences_dialog_setup_pkuserid_entry (dialog); + ka_preferences_dialog_setup_pkanchors_entry(dialog); ka_preferences_dialog_setup_forwardable_toggle (dialog); ka_preferences_dialog_setup_proxiable_toggle (dialog); ka_preferences_dialog_setup_renewable_toggle (dialog); |