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 | |
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')
-rw-r--r-- | preferences/krb5-auth-dialog-preferences.c | 74 | ||||
-rw-r--r-- | preferences/krb5-auth-dialog-preferences.glade | 49 |
2 files changed, 121 insertions, 2 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); diff --git a/preferences/krb5-auth-dialog-preferences.glade b/preferences/krb5-auth-dialog-preferences.glade index b4e5cd5..8e23b2f 100644 --- a/preferences/krb5-auth-dialog-preferences.glade +++ b/preferences/krb5-auth-dialog-preferences.glade @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> -<!--Generated with glade3 3.4.5 on Thu Apr 2 18:10:14 2009 --> +<!--Generated with glade3 3.4.5 on Tue Apr 14 22:22:46 2009 --> <glade-interface> <widget class="GtkDialog" id="krb5_auth_dialog_prefs"> <property name="border_width">5</property> @@ -87,6 +87,7 @@ <widget class="GtkEntry" id="principal_entry"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="activates_default">True</property> </widget> <packing> <property name="position">1</property> @@ -128,6 +129,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="tooltip" translatable="yes">The principal's public/private/certificate identifier. Leave empty if not using PKINIT.</property> + <property name="activates_default">True</property> </widget> <packing> <property name="position">1</property> @@ -138,6 +140,48 @@ <property name="position">3</property> </packing> </child> + <child> + <widget class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">PKINT anchors:</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">4</property> + </packing> + </child> + <child> + <widget class="GtkHBox" id="hbox12"> + <property name="visible">True</property> + <property name="spacing">6</property> + <child> + <widget class="GtkLabel" id="label20"> + <property name="visible">True</property> + <property name="label" translatable="yes"> </property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + <child> + <widget class="GtkEntry" id="pkanchors_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip" translatable="yes">Path to CA certificates used as trust anchors for PKINIT</property> + <property name="activates_default">True</property> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> + </widget> + <packing> + <property name="position">5</property> + </packing> + </child> </widget> <packing> <property name="position">1</property> @@ -392,6 +436,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="tooltip" translatable="yes">Send notification about ticket expiry that many minutes before it finally expires. </property> + <property name="activates_default">True</property> <property name="adjustment">0 0 100 1 10 10</property> </widget> <packing> @@ -552,6 +597,8 @@ <widget class="GtkButton" id="button1"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="label" translatable="yes">gtk-close</property> <property name="use_stock">True</property> |