aboutsummaryrefslogtreecommitdiff
path: root/preferences
diff options
context:
space:
mode:
Diffstat (limited to 'preferences')
-rw-r--r--preferences/Makefile.am42
-rw-r--r--preferences/krb5-auth-dialog-preferences.c627
-rw-r--r--preferences/krb5-auth-dialog-preferences.desktop.in12
-rw-r--r--preferences/krb5-auth-dialog-preferences.glade573
4 files changed, 1254 insertions, 0 deletions
diff --git a/preferences/Makefile.am b/preferences/Makefile.am
new file mode 100644
index 0000000..83541ea
--- /dev/null
+++ b/preferences/Makefile.am
@@ -0,0 +1,42 @@
+NULL =
+
+INCLUDES = \
+ -I $(top_srcdir)/src/ \
+ -DKA_DATA_DIR=\""$(pkgdatadir)"\" \
+ -DLOCALE_DIR=\""$(localedir)/"\" \
+ $(NULL)
+
+bin_PROGRAMS = krb5-auth-dialog-preferences
+
+schemadir = $(sysconfdir)/gconf/schemas
+
+krb5_auth_dialog_preferences_SOURCES = \
+ krb5-auth-dialog-preferences.c \
+ ../src/krb5-auth-gconf-tools.c \
+ ../src/krb5-auth-gconf-tools.h \
+ $(NULL)
+
+krb5_auth_dialog_preferences_LDADD = \
+ @GCONF_LIBS@ \
+ @GLADE_LIBS@ \
+ @GTK_LIBS@ \
+ $(NULL)
+
+desktopdir = $(datadir)/applications
+desktop_in_files = krb5-auth-dialog-preferences.desktop.in
+desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
+
+@INTLTOOL_DESKTOP_RULE@
+
+pkgdatadir = $(datadir)/krb5-auth-dialog
+pkgdata_DATA = \
+ krb5-auth-dialog-preferences.glade
+
+CLEANFILES = \
+ $(desktop_DATA) \
+ $(NULL)
+
+EXTRA_DIST = \
+ $(desktop_in_files) \
+ $(pkgdata_DATA) \
+ $(NULL)
diff --git a/preferences/krb5-auth-dialog-preferences.c b/preferences/krb5-auth-dialog-preferences.c
new file mode 100644
index 0000000..caf9ed9
--- /dev/null
+++ b/preferences/krb5-auth-dialog-preferences.c
@@ -0,0 +1,627 @@
+/*
+ * Copyright (C) 2009 Guido Guenther <agx@sigxcup.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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Author:
+ * Guido Guenther <agx@sigxcpu.org>
+ *
+ * based on the vino capplet which is:
+ *
+ * Copyright (C) 2003 Sun Microsystems, Inc.
+ * Copyright (C) 2006 Jonh Wendell <wendell@bani.com.br>
+ *
+ * Authors:
+ * Mark McLoughlin <mark@skynet.ie>
+ * Jonh Wendell <wendell@bani.com.br>
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include <glade/glade.h>
+
+#include "krb5-auth-gconf-tools.h"
+
+#define N_LISTENERS 7
+
+typedef struct {
+ GladeXML *xml;
+ GConfClient *client;
+
+ GtkWidget *dialog;
+ GtkWidget *principal_entry;
+ GtkWidget *pkuserid_entry;
+ GtkWidget *forwardable_toggle;
+ GtkWidget *proxiable_toggle;
+ GtkWidget *renewable_toggle;
+ GtkWidget *trayicon_toggle;
+ GtkWidget *prompt_mins_entry;
+
+ guint listeners [N_LISTENERS];
+ int n_listeners;
+} KaPreferencesDialog;
+
+
+static void
+ka_preferences_principal_notify (GConfClient *client G_GNUC_UNUSED,
+ guint cnx_id G_GNUC_UNUSED,
+ GConfEntry *entry,
+ KaPreferencesDialog *dialog)
+{
+ const char *principal;
+
+ if (!entry->value || entry->value->type != GCONF_VALUE_STRING)
+ return;
+
+ principal = gconf_value_get_string (entry->value);
+
+ if (!principal || !strlen(principal))
+ gtk_entry_set_text (GTK_ENTRY (dialog->principal_entry), "");
+ else {
+ const char *old_principal;
+
+ old_principal = gtk_entry_get_text (GTK_ENTRY (dialog->principal_entry));
+ if (!old_principal || (old_principal && strcmp (old_principal, principal)))
+ gtk_entry_set_text (GTK_ENTRY (dialog->principal_entry), principal);
+ }
+}
+
+
+static void
+ka_preferences_dialog_principal_changed (GtkEntry *entry,
+ KaPreferencesDialog *dialog)
+{
+ const char *principal;
+
+ principal = gtk_entry_get_text (entry);
+
+ if (!principal || !strlen(principal))
+ gconf_client_unset (dialog->client, KA_GCONF_KEY_PRINCIPAL, NULL);
+ else
+ gconf_client_set_string (dialog->client, KA_GCONF_KEY_PRINCIPAL, principal, NULL);
+}
+
+
+static void
+ka_preferences_dialog_setup_principal_entry (KaPreferencesDialog *dialog)
+{
+ char *principal = NULL;
+
+ dialog->principal_entry = glade_xml_get_widget (dialog->xml, "principal_entry");
+ g_assert (dialog->principal_entry != NULL);
+
+ if (!ka_gconf_get_string (dialog->client, KA_GCONF_KEY_PRINCIPAL, &principal))
+ g_warning ("Getting principal failed");
+
+ if (principal && strlen(principal))
+ gtk_entry_set_text (GTK_ENTRY (dialog->principal_entry), principal);
+ if (principal)
+ g_free (principal);
+
+ g_signal_connect (dialog->principal_entry, "changed",
+ G_CALLBACK (ka_preferences_dialog_principal_changed), dialog);
+
+ if (!gconf_client_key_is_writable (dialog->client, KA_GCONF_KEY_PRINCIPAL, NULL)) {
+ gtk_widget_set_sensitive (dialog->principal_entry, FALSE);
+ }
+
+ dialog->listeners [dialog->n_listeners] = gconf_client_notify_add (dialog->client,
+ KA_GCONF_KEY_PRINCIPAL,
+ (GConfClientNotifyFunc) ka_preferences_principal_notify,
+ dialog, NULL, NULL);
+ dialog->n_listeners++;
+}
+
+
+static void
+ka_preferences_pkuserid_notify (GConfClient *client G_GNUC_UNUSED,
+ guint cnx_id G_GNUC_UNUSED,
+ GConfEntry *entry,
+ KaPreferencesDialog *dialog)
+{
+ const char *pkuserid;
+
+ if (!entry->value || entry->value->type != GCONF_VALUE_STRING)
+ return;
+
+ pkuserid = gconf_value_get_string (entry->value);
+
+ if (!pkuserid || !strlen(pkuserid))
+ gtk_entry_set_text (GTK_ENTRY (dialog->pkuserid_entry), "");
+ else {
+ const char *old_pkuserid;
+
+ old_pkuserid = gtk_entry_get_text (GTK_ENTRY (dialog->pkuserid_entry));
+ if (!old_pkuserid || (old_pkuserid && strcmp (old_pkuserid, pkuserid)))
+ gtk_entry_set_text (GTK_ENTRY (dialog->pkuserid_entry), pkuserid);
+ }
+}
+
+
+static void
+ka_preferences_dialog_pkuserid_changed (GtkEntry *entry,
+ KaPreferencesDialog *dialog)
+{
+ const char *pkuserid;
+
+ pkuserid = gtk_entry_get_text (entry);
+
+ if (!pkuserid || !strlen(pkuserid))
+ gconf_client_unset (dialog->client, KA_GCONF_KEY_PK_USERID, NULL);
+ else
+ gconf_client_set_string (dialog->client, KA_GCONF_KEY_PK_USERID, pkuserid, NULL);
+}
+
+
+static void
+ka_preferences_dialog_setup_pkuserid_entry (KaPreferencesDialog *dialog)
+{
+ char *pkuserid = NULL;
+
+ dialog->pkuserid_entry = glade_xml_get_widget (dialog->xml, "pkuserid_entry");
+ g_assert (dialog->pkuserid_entry != NULL);
+
+ if (!ka_gconf_get_string (dialog->client, KA_GCONF_KEY_PK_USERID, &pkuserid))
+ g_warning ("Getting pkuserid failed");
+
+ if (pkuserid && strlen(pkuserid))
+ gtk_entry_set_text (GTK_ENTRY (dialog->pkuserid_entry), pkuserid);
+ if (pkuserid)
+ g_free (pkuserid);
+
+ g_signal_connect (dialog->pkuserid_entry, "changed",
+ G_CALLBACK (ka_preferences_dialog_pkuserid_changed), dialog);
+ if (!gconf_client_key_is_writable (dialog->client, KA_GCONF_KEY_PK_USERID, NULL)) {
+ gtk_widget_set_sensitive (dialog->pkuserid_entry, FALSE);
+ }
+
+ dialog->listeners [dialog->n_listeners] = gconf_client_notify_add (dialog->client,
+ KA_GCONF_KEY_PK_USERID,
+ (GConfClientNotifyFunc) ka_preferences_pkuserid_notify,
+ dialog, NULL, NULL);
+ dialog->n_listeners++;
+}
+
+
+static void
+ka_preferences_dialog_forwardable_toggled (GtkToggleButton *toggle,
+ KaPreferencesDialog *dialog)
+{
+ gboolean forwardable;
+
+ forwardable = gtk_toggle_button_get_active (toggle);
+
+ gconf_client_set_bool (dialog->client, KA_GCONF_KEY_FORWARDABLE, forwardable, NULL);
+}
+
+
+static void
+ka_preferences_dialog_forwardable_notify (GConfClient *client G_GNUC_UNUSED,
+ guint cnx_id G_GNUC_UNUSED,
+ GConfEntry *entry,
+ KaPreferencesDialog *dialog)
+{
+ gboolean forwardable;
+
+ if (!entry->value || entry->value->type != GCONF_VALUE_BOOL)
+ return;
+
+ forwardable = gconf_value_get_bool (entry->value) != FALSE;
+
+ if (forwardable != gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->forwardable_toggle)))
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->forwardable_toggle), forwardable);
+}
+
+
+static gboolean
+ka_preferences_dialog_setup_forwardable_toggle (KaPreferencesDialog *dialog)
+{
+ gboolean forwardable;
+
+ dialog->forwardable_toggle = glade_xml_get_widget (dialog->xml, "forwardable_toggle");
+ g_assert (dialog->forwardable_toggle != NULL);
+
+ forwardable = gconf_client_get_bool (dialog->client, KA_GCONF_KEY_FORWARDABLE, NULL);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->forwardable_toggle), forwardable);
+
+ g_signal_connect (dialog->forwardable_toggle, "toggled",
+ G_CALLBACK (ka_preferences_dialog_forwardable_toggled), dialog);
+
+ if (!gconf_client_key_is_writable (dialog->client, KA_GCONF_KEY_FORWARDABLE, NULL)) {
+ gtk_widget_set_sensitive (dialog->forwardable_toggle, FALSE);
+ }
+
+ dialog->listeners [dialog->n_listeners] = gconf_client_notify_add (dialog->client,
+ KA_GCONF_KEY_FORWARDABLE,
+ (GConfClientNotifyFunc) ka_preferences_dialog_forwardable_notify,
+ dialog, NULL, NULL);
+ dialog->n_listeners++;
+ return forwardable;
+}
+
+
+static void
+ka_preferences_dialog_proxiable_toggled (GtkToggleButton *toggle,
+ KaPreferencesDialog *dialog)
+{
+ gboolean proxiable;
+
+ proxiable = gtk_toggle_button_get_active (toggle);
+
+ gconf_client_set_bool (dialog->client, KA_GCONF_KEY_PROXIABLE, proxiable, NULL);
+}
+
+
+static void
+ka_preferences_dialog_proxiable_notify (GConfClient *client G_GNUC_UNUSED,
+ guint cnx_id G_GNUC_UNUSED,
+ GConfEntry *entry,
+ KaPreferencesDialog *dialog)
+{
+ gboolean proxiable;
+
+ if (!entry->value || entry->value->type != GCONF_VALUE_BOOL)
+ return;
+
+ proxiable = gconf_value_get_bool (entry->value) != FALSE;
+
+ if (proxiable != gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->proxiable_toggle)))
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->proxiable_toggle), proxiable);
+}
+
+
+static gboolean
+ka_preferences_dialog_setup_proxiable_toggle (KaPreferencesDialog *dialog)
+{
+ gboolean proxiable;
+
+ dialog->proxiable_toggle = glade_xml_get_widget (dialog->xml, "proxiable_toggle");
+ g_assert (dialog->proxiable_toggle != NULL);
+
+ proxiable = gconf_client_get_bool (dialog->client, KA_GCONF_KEY_PROXIABLE, NULL);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->proxiable_toggle), proxiable);
+
+ g_signal_connect (dialog->proxiable_toggle, "toggled",
+ G_CALLBACK (ka_preferences_dialog_proxiable_toggled), dialog);
+
+ if (!gconf_client_key_is_writable (dialog->client, KA_GCONF_KEY_PROXIABLE, NULL)) {
+ gtk_widget_set_sensitive (dialog->proxiable_toggle, FALSE);
+ }
+
+ dialog->listeners [dialog->n_listeners] = gconf_client_notify_add (dialog->client,
+ KA_GCONF_KEY_PROXIABLE,
+ (GConfClientNotifyFunc) ka_preferences_dialog_proxiable_notify,
+ dialog, NULL, NULL);
+ dialog->n_listeners++;
+ return proxiable;
+}
+
+
+static void
+ka_preferences_dialog_renewable_toggled (GtkToggleButton *toggle,
+ KaPreferencesDialog *dialog)
+{
+ gboolean renewable;
+
+ renewable = gtk_toggle_button_get_active (toggle);
+
+ gconf_client_set_bool (dialog->client, KA_GCONF_KEY_RENEWABLE, renewable, NULL);
+}
+
+
+static void
+ka_preferences_dialog_renewable_notify (GConfClient *client G_GNUC_UNUSED,
+ guint cnx_id G_GNUC_UNUSED,
+ GConfEntry *entry,
+ KaPreferencesDialog *dialog)
+{
+ gboolean renewable;
+
+ if (!entry->value || entry->value->type != GCONF_VALUE_BOOL)
+ return;
+
+ renewable = gconf_value_get_bool (entry->value) != FALSE;
+
+ if (renewable != gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->renewable_toggle)))
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->renewable_toggle), renewable);
+}
+
+
+static gboolean
+ka_preferences_dialog_setup_renewable_toggle (KaPreferencesDialog *dialog)
+{
+ gboolean renewable;
+
+ dialog->renewable_toggle = glade_xml_get_widget (dialog->xml, "renewable_toggle");
+ g_assert (dialog->renewable_toggle != NULL);
+
+ renewable = gconf_client_get_bool (dialog->client, KA_GCONF_KEY_RENEWABLE, NULL);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->renewable_toggle), renewable);
+
+ g_signal_connect (dialog->renewable_toggle, "toggled",
+ G_CALLBACK (ka_preferences_dialog_renewable_toggled), dialog);
+
+ if (!gconf_client_key_is_writable (dialog->client, KA_GCONF_KEY_RENEWABLE, NULL)) {
+ gtk_widget_set_sensitive (dialog->renewable_toggle, FALSE);
+ }
+
+ dialog->listeners [dialog->n_listeners] = gconf_client_notify_add (dialog->client,
+ KA_GCONF_KEY_RENEWABLE,
+ (GConfClientNotifyFunc) ka_preferences_dialog_renewable_notify,
+ dialog, NULL, NULL);
+ dialog->n_listeners++;
+ return renewable;
+}
+
+static void
+ka_preferences_dialog_trayicon_toggled (GtkToggleButton *toggle,
+ KaPreferencesDialog *dialog)
+{
+ gboolean trayicon;
+
+ trayicon = gtk_toggle_button_get_active (toggle);
+ gconf_client_set_bool (dialog->client, KA_GCONF_KEY_SHOW_TRAYICON, trayicon, NULL);
+}
+
+
+static void
+ka_preferences_dialog_trayicon_notify (GConfClient *client G_GNUC_UNUSED,
+ guint cnx_id G_GNUC_UNUSED,
+ GConfEntry *entry,
+ KaPreferencesDialog *dialog)
+{
+ gboolean trayicon;
+
+ if (!entry->value || entry->value->type != GCONF_VALUE_BOOL)
+ return;
+
+ trayicon = gconf_value_get_bool (entry->value) != FALSE;
+
+ if (trayicon != gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->trayicon_toggle)))
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->trayicon_toggle), trayicon);
+}
+
+
+static gboolean
+ka_preferences_dialog_setup_trayicon_toggle (KaPreferencesDialog *dialog)
+{
+ gboolean trayicon;
+
+ dialog->trayicon_toggle = glade_xml_get_widget (dialog->xml, "trayicon_toggle");
+ g_assert (dialog->trayicon_toggle != NULL);
+
+ trayicon = gconf_client_get_bool (dialog->client, KA_GCONF_KEY_SHOW_TRAYICON, NULL);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->trayicon_toggle), trayicon);
+
+ g_signal_connect (dialog->trayicon_toggle, "toggled",
+ G_CALLBACK (ka_preferences_dialog_trayicon_toggled), dialog);
+
+ if (!gconf_client_key_is_writable (dialog->client, KA_GCONF_KEY_SHOW_TRAYICON, NULL)) {
+ gtk_widget_set_sensitive (dialog->trayicon_toggle, FALSE);
+ }
+
+ dialog->listeners [dialog->n_listeners] = gconf_client_notify_add (dialog->client,
+ KA_GCONF_KEY_SHOW_TRAYICON,
+ (GConfClientNotifyFunc) ka_preferences_dialog_trayicon_notify,
+ dialog, NULL, NULL);
+ dialog->n_listeners++;
+ return trayicon;
+}
+
+
+static void
+ka_preferences_dialog_prompt_mins_changed (GtkSpinButton *button,
+ KaPreferencesDialog *dialog)
+{
+ gint prompt_mins;
+
+ prompt_mins = gtk_spin_button_get_value_as_int (button);
+ gconf_client_set_int (dialog->client, KA_GCONF_KEY_PROMPT_MINS, prompt_mins, NULL);
+}
+
+
+static void
+ka_preferences_dialog_prompt_mins_notify (GConfClient *client G_GNUC_UNUSED,
+ guint cnx_id G_GNUC_UNUSED,
+ GConfEntry *entry,
+ KaPreferencesDialog *dialog)
+{
+ gint prompt_mins;
+
+ if (!entry->value || entry->value->type != GCONF_VALUE_INT)
+ return;
+
+ prompt_mins = gconf_value_get_int (entry->value);
+
+ if (prompt_mins != gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dialog->prompt_mins_entry)))
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->prompt_mins_entry), prompt_mins);
+}
+
+
+static gint
+ka_preferences_dialog_setup_prompt_mins_entry (KaPreferencesDialog *dialog)
+{
+ gint prompt_mins;
+
+ dialog->prompt_mins_entry = glade_xml_get_widget (dialog->xml, "prompt_mins_entry");
+ g_assert (dialog->prompt_mins_entry != NULL);
+
+ prompt_mins = gconf_client_get_int (dialog->client, KA_GCONF_KEY_PROMPT_MINS, NULL);
+
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->prompt_mins_entry), prompt_mins);
+
+ g_signal_connect (dialog->prompt_mins_entry, "value-changed",
+ G_CALLBACK (ka_preferences_dialog_prompt_mins_changed), dialog);
+
+ if (!gconf_client_key_is_writable (dialog->client, KA_GCONF_KEY_PROMPT_MINS, NULL)) {
+ gtk_widget_set_sensitive (dialog->prompt_mins_entry, FALSE);
+ }
+
+ dialog->listeners [dialog->n_listeners] = gconf_client_notify_add (dialog->client,
+ KA_GCONF_KEY_PROMPT_MINS,
+ (GConfClientNotifyFunc) ka_preferences_dialog_prompt_mins_notify,
+ dialog, NULL, NULL);
+ dialog->n_listeners++;
+ return prompt_mins;
+}
+
+
+
+static void
+ka_preferences_dialog_response (GtkWidget *widget,
+ int response,
+ KaPreferencesDialog *dialog)
+{
+ GError *error = NULL;
+
+ if (response != GTK_RESPONSE_HELP) {
+ gtk_widget_destroy (widget);
+ return;
+ }
+
+ gtk_show_uri (gtk_window_get_screen (GTK_WINDOW (dialog->dialog)),
+ "ghelp:krb5-auth-dialog#preferences",
+ gtk_get_current_event_time (), &error);
+
+ if (error) {
+ GtkWidget *message_dialog;
+
+
+ message_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog->dialog),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ _("There was an error displaying help:\n%s"),
+ error->message);
+ gtk_window_set_resizable (GTK_WINDOW (message_dialog), FALSE);
+
+ g_signal_connect (message_dialog, "response",
+ G_CALLBACK (gtk_widget_destroy),
+ NULL);
+
+ gtk_widget_show (message_dialog);
+ g_error_free (error);
+ }
+}
+
+
+static void
+ka_preferences_dialog_destroyed (GtkWidget *widget G_GNUC_UNUSED,
+ KaPreferencesDialog *dialog)
+{
+ dialog->dialog = NULL;
+
+ gtk_main_quit ();
+}
+
+
+static gboolean
+ka_preferences_dialog_init(KaPreferencesDialog* dialog)
+{
+ dialog->xml = glade_xml_new (KA_DATA_DIR G_DIR_SEPARATOR_S
+ PACKAGE "-preferences.glade", NULL, NULL);
+
+ dialog->dialog = glade_xml_get_widget (dialog->xml, "krb5_auth_dialog_prefs");
+ g_assert (dialog->dialog);
+
+ g_signal_connect (dialog->dialog, "response",
+ G_CALLBACK (ka_preferences_dialog_response), dialog);
+ g_signal_connect (dialog->dialog, "destroy",
+ G_CALLBACK (ka_preferences_dialog_destroyed), dialog);
+
+ dialog->client = gconf_client_get_default ();
+ gconf_client_add_dir (dialog->client, KA_GCONF_PATH, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+
+ ka_preferences_dialog_setup_principal_entry (dialog);
+ ka_preferences_dialog_setup_pkuserid_entry (dialog);
+ ka_preferences_dialog_setup_forwardable_toggle (dialog);
+ ka_preferences_dialog_setup_proxiable_toggle (dialog);
+ ka_preferences_dialog_setup_renewable_toggle (dialog);
+ ka_preferences_dialog_setup_trayicon_toggle (dialog);
+ ka_preferences_dialog_setup_prompt_mins_entry (dialog);
+
+ g_assert (dialog->n_listeners == N_LISTENERS);
+
+ gtk_widget_show (dialog->dialog);
+ return TRUE;
+}
+
+
+static void
+ka_preferences_dialog_finalize (KaPreferencesDialog *dialog)
+{
+ if (dialog->dialog)
+ gtk_widget_destroy (dialog->dialog);
+ dialog->dialog = NULL;
+
+ if (dialog->client) {
+ int i;
+
+ for (i = 0; i < dialog->n_listeners; i++) {
+ if (dialog->listeners [i])
+ gconf_client_notify_remove (dialog->client, dialog->listeners [i]);
+ dialog->listeners [i] = 0;
+ }
+ dialog->n_listeners = 0;
+
+ gconf_client_remove_dir (dialog->client, KA_GCONF_PATH, NULL);
+
+ g_object_unref (dialog->client);
+ dialog->client = NULL;
+ }
+
+ if (dialog->xml)
+ g_object_unref (dialog->xml);
+ dialog->xml = NULL;
+}
+
+int
+main (int argc, char *argv[])
+{
+ GOptionContext *context;
+ GError *error = NULL;
+ KaPreferencesDialog dialog = { NULL, };
+
+ const char *help_msg = "Run '" PACKAGE " --help' to see a full list of available command line options";
+ const GOptionEntry options [] = {
+ { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
+ };
+
+ context = g_option_context_new ("- Kerberos Authentication Configuration");
+ g_option_context_add_main_entries (context, options, NULL);
+ g_option_context_add_group (context, gtk_get_option_group (TRUE));
+ g_option_context_parse (context, &argc, &argv, &error);
+ if (error) {
+ g_print ("%s\n%s\n",
+ error->message,
+ help_msg);
+ g_error_free (error);
+ return 1;
+ }
+ textdomain (PACKAGE);
+ bind_textdomain_codeset (PACKAGE, "UTF-8");
+ bindtextdomain (PACKAGE, LOCALE_DIR);
+
+ ka_preferences_dialog_init(&dialog);
+ gtk_main ();
+ ka_preferences_dialog_finalize(&dialog);
+ return 0;
+}
diff --git a/preferences/krb5-auth-dialog-preferences.desktop.in b/preferences/krb5-auth-dialog-preferences.desktop.in
new file mode 100644
index 0000000..d87e1e7
--- /dev/null
+++ b/preferences/krb5-auth-dialog-preferences.desktop.in
@@ -0,0 +1,12 @@
+[Desktop Entry]
+_Name=Network Authentication
+_Comment=Set your Kerberos network authenticaion preferences
+Exec=krb5-auth-dialog-preferences
+Icon=gtk-dialog-authentication
+Terminal=false
+Type=Application
+StartupNotify=true
+Categories=GNOME;GTK;Settings;X-GNOME-NetworkSettings;
+OnlyShowIn=GNOME;
+X-GNOME-Bugzilla-Bugzilla=GNOME
+X-GNOME-Bugzilla-Product=krb5-auth-dialog
diff --git a/preferences/krb5-auth-dialog-preferences.glade b/preferences/krb5-auth-dialog-preferences.glade
new file mode 100644
index 0000000..b4e5cd5
--- /dev/null
+++ b/preferences/krb5-auth-dialog-preferences.glade
@@ -0,0 +1,573 @@
+<?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 -->
+<glade-interface>
+ <widget class="GtkDialog" id="krb5_auth_dialog_prefs">
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Kerberos Authentication Configuration</property>
+ <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+ <property name="icon_name">gtk-dialog-authentication</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkNotebook" id="notebook1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child>
+ <widget class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">18</property>
+ <child>
+ <widget class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;b&gt;Kerberos User&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkImage" id="access">
+ <property name="visible">True</property>
+ <property name="yalign">0</property>
+ <property name="icon_size">6</property>
+ <property name="icon_name">gtk-dialog-authentication</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox5">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Kerberos principal:</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox5">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label8">
+ <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="principal_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">PKINIT userid: </property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox6">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label9">
+ <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="pkuserid_entry">
+ <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>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;b&gt;Ticket Options&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="yalign">0</property>
+ <property name="icon_size">6</property>
+ <property name="icon_name">system-lock-screen</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox4">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label10">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Requested Kerberos tickets should be:</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkLabel" id="label11">
+ <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="GtkCheckButton" id="forwardable_toggle">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip" translatable="yes">If checked, request forwardable tickets</property>
+ <property name="label" translatable="yes">forwardable</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkLabel" id="label12">
+ <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="GtkCheckButton" id="renewable_toggle">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip" translatable="yes">If checked, request renewable tickets</property>
+ <property name="label" translatable="yes">renewable</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox11">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkLabel" id="label19">
+ <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="GtkCheckButton" id="proxiable_toggle">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip" translatable="yes">If checked, request proxiable tickets</property>
+ <property name="label" translatable="yes">proxiable</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Kerberos</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox9">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">18</property>
+ <child>
+ <widget class="GtkVBox" id="vbox8">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label17">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;b&gt;Notifications&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox9">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="yalign">0</property>
+ <property name="stock">gtk-dialog-warning</property>
+ <property name="icon_size">6</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox8">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label14">
+ <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="GtkLabel" id="label15">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Warn</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton" id="prompt_mins_entry">
+ <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="adjustment">0 0 100 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label16">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">minutes before expiry</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox10">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label18">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;b&gt;Appearance&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox10">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="stock">gtk-zoom-in</property>
+ <property name="icon_size">6</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox7">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkHBox" id="hbox7">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label13">
+ <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="GtkCheckButton" id="trayicon_toggle">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip" translatable="yes">If checked, display the tray icon in the status bar.</property>
+ <property name="label" translatable="yes">Show tray icon</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Applet</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <child>
+ <widget class="GtkButton" id="button2">
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">gtk-help</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">-11</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">gtk-close</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">0</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+</glade-interface>
bgstack15