0 | |
From: =?utf-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
|
1 | |
Date: Thu, 2 Apr 2009 16:48:38 +0200
|
2 | |
Subject: [PATCH] add preferences dialog
|
3 | |
|
4 | |
Closes: #521251
|
5 | |
---
|
6 | |
Makefile.am | 2 +-
|
7 | |
configure.ac | 1 +
|
8 | |
po/POTFILES.in | 5 +-
|
9 | |
preferences/Makefile.am | 42 ++
|
10 | |
preferences/krb5-auth-dialog-preferences.c | 618 ++++++++++++++++++++
|
11 | |
.../krb5-auth-dialog-preferences.desktop.in | 12 +
|
12 | |
preferences/krb5-auth-dialog-preferences.glade | 565 ++++++++++++++++++
|
13 | |
src/Makefile.am | 2 +
|
14 | |
src/krb5-auth-applet.c | 83 +++-
|
15 | |
src/krb5-auth-dialog.c | 49 ++-
|
16 | |
src/krb5-auth-dialog.schemas.in | 39 ++
|
17 | |
src/krb5-auth-gconf-tools.c | 103 ++++
|
18 | |
src/krb5-auth-gconf-tools.h | 41 ++
|
19 | |
src/krb5-auth-gconf.c | 135 ++---
|
20 | |
14 files changed, 1594 insertions(+), 103 deletions(-)
|
21 | |
create mode 100644 preferences/Makefile.am
|
22 | |
create mode 100644 preferences/krb5-auth-dialog-preferences.c
|
23 | |
create mode 100644 preferences/krb5-auth-dialog-preferences.desktop.in
|
24 | |
create mode 100644 preferences/krb5-auth-dialog-preferences.glade
|
25 | |
create mode 100644 src/krb5-auth-gconf-tools.c
|
26 | |
create mode 100644 src/krb5-auth-gconf-tools.h
|
27 | |
|
28 | |
diff --git a/Makefile.am b/Makefile.am
|
29 | |
index 51c4e5b..2be06e7 100644
|
30 | |
--- a/Makefile.am
|
31 | |
+++ b/Makefile.am
|
32 | |
@@ -1,4 +1,4 @@
|
33 | |
-SUBDIRS = secmem gtksecentry src po etpo icons
|
34 | |
+SUBDIRS = secmem gtksecentry src po etpo icons preferences
|
35 | |
|
36 | |
EXTRA_DIST = \
|
37 | |
krb5-auth-dialog.spec
|
38 | |
diff --git a/configure.ac b/configure.ac
|
39 | |
index 89fb2fa..be95999 100644
|
40 | |
--- a/configure.ac
|
41 | |
+++ b/configure.ac
|
42 | |
@@ -218,6 +218,7 @@ gtksecentry/Makefile
|
43 | |
icons/Makefile
|
44 | |
etpo/Makefile
|
45 | |
po/Makefile.in
|
46 | |
+preferences/Makefile
|
47 | |
])
|
48 | |
|
49 | |
AC_MSG_NOTICE([])
|
50 | |
diff --git a/po/POTFILES.in b/po/POTFILES.in
|
51 | |
index 8ee65fd..70977d4 100644
|
52 | |
--- a/po/POTFILES.in
|
53 | |
+++ b/po/POTFILES.in
|
54 | |
@@ -4,6 +4,9 @@ src/krb5-auth-pwdialog.c
|
55 | |
src/dummy-strings.c
|
56 | |
src/krb5-auth-applet.c
|
57 | |
src/krb5-auth-dialog.desktop.in
|
58 | |
+src/krb5-auth-dialog.schemas.in
|
59 | |
gtksecentry/gtksecentry.c
|
60 | |
secmem/util.c
|
61 | |
-src/krb5-auth-dialog.schemas.in
|
62 | |
+preferences/krb5-auth-dialog-preferences.c
|
63 | |
+preferences/krb5-auth-dialog-preferences.desktop.in
|
64 | |
+preferences/krb5-auth-dialog-preferences.glade
|
65 | |
diff --git a/preferences/Makefile.am b/preferences/Makefile.am
|
66 | |
new file mode 100644
|
67 | |
index 0000000..83541ea
|
68 | |
--- /dev/null
|
69 | |
+++ b/preferences/Makefile.am
|
70 | |
@@ -0,0 +1,42 @@
|
71 | |
+NULL =
|
72 | |
+
|
73 | |
+INCLUDES = \
|
74 | |
+ -I $(top_srcdir)/src/ \
|
75 | |
+ -DKA_DATA_DIR=\""$(pkgdatadir)"\" \
|
76 | |
+ -DLOCALE_DIR=\""$(localedir)/"\" \
|
77 | |
+ $(NULL)
|
78 | |
+
|
79 | |
+bin_PROGRAMS = krb5-auth-dialog-preferences
|
80 | |
+
|
81 | |
+schemadir = $(sysconfdir)/gconf/schemas
|
82 | |
+
|
83 | |
+krb5_auth_dialog_preferences_SOURCES = \
|
84 | |
+ krb5-auth-dialog-preferences.c \
|
85 | |
+ ../src/krb5-auth-gconf-tools.c \
|
86 | |
+ ../src/krb5-auth-gconf-tools.h \
|
87 | |
+ $(NULL)
|
88 | |
+
|
89 | |
+krb5_auth_dialog_preferences_LDADD = \
|
90 | |
+ @GCONF_LIBS@ \
|
91 | |
+ @GLADE_LIBS@ \
|
92 | |
+ @GTK_LIBS@ \
|
93 | |
+ $(NULL)
|
94 | |
+
|
95 | |
+desktopdir = $(datadir)/applications
|
96 | |
+desktop_in_files = krb5-auth-dialog-preferences.desktop.in
|
97 | |
+desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
|
98 | |
+
|
99 | |
+@INTLTOOL_DESKTOP_RULE@
|
100 | |
+
|
101 | |
+pkgdatadir = $(datadir)/krb5-auth-dialog
|
102 | |
+pkgdata_DATA = \
|
103 | |
+ krb5-auth-dialog-preferences.glade
|
104 | |
+
|
105 | |
+CLEANFILES = \
|
106 | |
+ $(desktop_DATA) \
|
107 | |
+ $(NULL)
|
108 | |
+
|
109 | |
+EXTRA_DIST = \
|
110 | |
+ $(desktop_in_files) \
|
111 | |
+ $(pkgdata_DATA) \
|
112 | |
+ $(NULL)
|
113 | |
diff --git a/preferences/krb5-auth-dialog-preferences.c b/preferences/krb5-auth-dialog-preferences.c
|
114 | |
new file mode 100644
|
115 | |
index 0000000..e4d8a48
|
116 | |
--- /dev/null
|
117 | |
+++ b/preferences/krb5-auth-dialog-preferences.c
|
118 | |
@@ -0,0 +1,618 @@
|
119 | |
+/*
|
120 | |
+ * Copyright (C) 2009 Guido Guenther <agx@sigxcup.org>
|
121 | |
+ *
|
122 | |
+ * This program is free software; you can redistribute it and/or modify
|
123 | |
+ * it under the terms of the GNU General Public License as published by
|
124 | |
+ * the Free Software Foundation; either version 2, or (at your option)
|
125 | |
+ * any later version.
|
126 | |
+ *
|
127 | |
+ * This program is distributed in the hope that it will be useful,
|
128 | |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
129 | |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
130 | |
+ * GNU General Public License for more details.
|
131 | |
+ *
|
132 | |
+ * You should have received a copy of the GNU General Public License
|
133 | |
+ * along with this program; if not, write to the Free Software
|
134 | |
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
135 | |
+ *
|
136 | |
+ */
|
137 | |
+
|
138 | |
+#include "config.h"
|
139 | |
+
|
140 | |
+#include <gtk/gtk.h>
|
141 | |
+#include <glib/gi18n.h>
|
142 | |
+#include <glade/glade.h>
|
143 | |
+
|
144 | |
+#include "krb5-auth-gconf-tools.h"
|
145 | |
+
|
146 | |
+#define N_LISTENERS 7
|
147 | |
+
|
148 | |
+typedef struct {
|
149 | |
+ GladeXML *xml;
|
150 | |
+ GConfClient *client;
|
151 | |
+
|
152 | |
+ GtkWidget *dialog;
|
153 | |
+ GtkWidget *principal_entry;
|
154 | |
+ GtkWidget *pkuserid_entry;
|
155 | |
+ GtkWidget *forwardable_toggle;
|
156 | |
+ GtkWidget *proxiable_toggle;
|
157 | |
+ GtkWidget *renewable_toggle;
|
158 | |
+ GtkWidget *trayicon_toggle;
|
159 | |
+ GtkWidget *prompt_mins_entry;
|
160 | |
+
|
161 | |
+ guint listeners [N_LISTENERS];
|
162 | |
+ int n_listeners;
|
163 | |
+} KaPreferencesDialog;
|
164 | |
+
|
165 | |
+
|
166 | |
+static void
|
167 | |
+ka_preferences_principal_notify (GConfClient *client G_GNUC_UNUSED,
|
168 | |
+ guint cnx_id G_GNUC_UNUSED,
|
169 | |
+ GConfEntry *entry,
|
170 | |
+ KaPreferencesDialog *dialog)
|
171 | |
+{
|
172 | |
+ const char *principal;
|
173 | |
+
|
174 | |
+ if (!entry->value || entry->value->type != GCONF_VALUE_STRING)
|
175 | |
+ return;
|
176 | |
+
|
177 | |
+ principal = gconf_value_get_string (entry->value);
|
178 | |
+
|
179 | |
+ if (!principal || !strlen(principal))
|
180 | |
+ gtk_entry_set_text (GTK_ENTRY (dialog->principal_entry), "");
|
181 | |
+ else {
|
182 | |
+ const char *old_principal;
|
183 | |
+
|
184 | |
+ old_principal = gtk_entry_get_text (GTK_ENTRY (dialog->principal_entry));
|
185 | |
+ if (!old_principal || (old_principal && strcmp (old_principal, principal)))
|
186 | |
+ gtk_entry_set_text (GTK_ENTRY (dialog->principal_entry), principal);
|
187 | |
+ }
|
188 | |
+}
|
189 | |
+
|
190 | |
+
|
191 | |
+static void
|
192 | |
+ka_preferences_dialog_principal_changed (GtkEntry *entry,
|
193 | |
+ KaPreferencesDialog *dialog)
|
194 | |
+{
|
195 | |
+ const char *principal;
|
196 | |
+
|
197 | |
+ principal = gtk_entry_get_text (entry);
|
198 | |
+
|
199 | |
+ if (!principal || !strlen(principal))
|
200 | |
+ gconf_client_unset (dialog->client, KA_GCONF_KEY_PRINCIPAL, NULL);
|
201 | |
+ else
|
202 | |
+ gconf_client_set_string (dialog->client, KA_GCONF_KEY_PRINCIPAL, principal, NULL);
|
203 | |
+}
|
204 | |
+
|
205 | |
+
|
206 | |
+static void
|
207 | |
+ka_preferences_dialog_setup_principal_entry (KaPreferencesDialog *dialog)
|
208 | |
+{
|
209 | |
+ char *principal = NULL;
|
210 | |
+
|
211 | |
+ dialog->principal_entry = glade_xml_get_widget (dialog->xml, "principal_entry");
|
212 | |
+ g_assert (dialog->principal_entry != NULL);
|
213 | |
+
|
214 | |
+ if (!ka_gconf_get_string (dialog->client, KA_GCONF_KEY_PRINCIPAL, &principal))
|
215 | |
+ g_warning ("Getting principal failed");
|
216 | |
+
|
217 | |
+ if (principal && strlen(principal))
|
218 | |
+ gtk_entry_set_text (GTK_ENTRY (dialog->principal_entry), principal);
|
219 | |
+ if (principal)
|
220 | |
+ g_free (principal);
|
221 | |
+
|
222 | |
+ g_signal_connect (dialog->principal_entry, "changed",
|
223 | |
+ G_CALLBACK (ka_preferences_dialog_principal_changed), dialog);
|
224 | |
+
|
225 | |
+ if (!gconf_client_key_is_writable (dialog->client, KA_GCONF_KEY_PRINCIPAL, NULL)) {
|
226 | |
+ gtk_widget_set_sensitive (dialog->principal_entry, FALSE);
|
227 | |
+ }
|
228 | |
+
|
229 | |
+ dialog->listeners [dialog->n_listeners] = gconf_client_notify_add (dialog->client,
|
230 | |
+ KA_GCONF_KEY_PRINCIPAL,
|
231 | |
+ (GConfClientNotifyFunc) ka_preferences_principal_notify,
|
232 | |
+ dialog, NULL, NULL);
|
233 | |
+ dialog->n_listeners++;
|
234 | |
+}
|
235 | |
+
|
236 | |
+
|
237 | |
+static void
|
238 | |
+ka_preferences_pkuserid_notify (GConfClient *client G_GNUC_UNUSED,
|
239 | |
+ guint cnx_id G_GNUC_UNUSED,
|
240 | |
+ GConfEntry *entry,
|
241 | |
+ KaPreferencesDialog *dialog)
|
242 | |
+{
|
243 | |
+ const char *pkuserid;
|
244 | |
+
|
245 | |
+ if (!entry->value || entry->value->type != GCONF_VALUE_STRING)
|
246 | |
+ return;
|
247 | |
+
|
248 | |
+ pkuserid = gconf_value_get_string (entry->value);
|
249 | |
+
|
250 | |
+ if (!pkuserid || !strlen(pkuserid))
|
251 | |
+ gtk_entry_set_text (GTK_ENTRY (dialog->pkuserid_entry), "");
|
252 | |
+ else {
|
253 | |
+ const char *old_pkuserid;
|
254 | |
+
|
255 | |
+ old_pkuserid = gtk_entry_get_text (GTK_ENTRY (dialog->pkuserid_entry));
|
256 | |
+ if (!old_pkuserid || (old_pkuserid && strcmp (old_pkuserid, pkuserid)))
|
257 | |
+ gtk_entry_set_text (GTK_ENTRY (dialog->pkuserid_entry), pkuserid);
|
258 | |
+ }
|
259 | |
+}
|
260 | |
+
|
261 | |
+
|
262 | |
+static void
|
263 | |
+ka_preferences_dialog_pkuserid_changed (GtkEntry *entry,
|
264 | |
+ KaPreferencesDialog *dialog)
|
265 | |
+{
|
266 | |
+ const char *pkuserid;
|
267 | |
+
|
268 | |
+ pkuserid = gtk_entry_get_text (entry);
|
269 | |
+
|
270 | |
+ if (!pkuserid || !strlen(pkuserid))
|
271 | |
+ gconf_client_unset (dialog->client, KA_GCONF_KEY_PK_USERID, NULL);
|
272 | |
+ else
|
273 | |
+ gconf_client_set_string (dialog->client, KA_GCONF_KEY_PK_USERID, pkuserid, NULL);
|
274 | |
+}
|
275 | |
+
|
276 | |
+
|
277 | |
+static void
|
278 | |
+ka_preferences_dialog_setup_pkuserid_entry (KaPreferencesDialog *dialog)
|
279 | |
+{
|
280 | |
+ char *pkuserid = NULL;
|
281 | |
+
|
282 | |
+ dialog->pkuserid_entry = glade_xml_get_widget (dialog->xml, "pkuserid_entry");
|
283 | |
+ g_assert (dialog->pkuserid_entry != NULL);
|
284 | |
+
|
285 | |
+ if (!ka_gconf_get_string (dialog->client, KA_GCONF_KEY_PK_USERID, &pkuserid))
|
286 | |
+ g_warning ("Getting pkuserid failed");
|
287 | |
+
|
288 | |
+ if (pkuserid && strlen(pkuserid))
|
289 | |
+ gtk_entry_set_text (GTK_ENTRY (dialog->pkuserid_entry), pkuserid);
|
290 | |
+ if (pkuserid)
|
291 | |
+ g_free (pkuserid);
|
292 | |
+
|
293 | |
+ g_signal_connect (dialog->pkuserid_entry, "changed",
|
294 | |
+ G_CALLBACK (ka_preferences_dialog_pkuserid_changed), dialog);
|
295 | |
+ if (!gconf_client_key_is_writable (dialog->client, KA_GCONF_KEY_PK_USERID, NULL)) {
|
296 | |
+ gtk_widget_set_sensitive (dialog->pkuserid_entry, FALSE);
|
297 | |
+ }
|
298 | |
+
|
299 | |
+ dialog->listeners [dialog->n_listeners] = gconf_client_notify_add (dialog->client,
|
300 | |
+ KA_GCONF_KEY_PK_USERID,
|
301 | |
+ (GConfClientNotifyFunc) ka_preferences_pkuserid_notify,
|
302 | |
+ dialog, NULL, NULL);
|
303 | |
+ dialog->n_listeners++;
|
304 | |
+}
|
305 | |
+
|
306 | |
+
|
307 | |
+static void
|
308 | |
+ka_preferences_dialog_forwardable_toggled (GtkToggleButton *toggle,
|
309 | |
+ KaPreferencesDialog *dialog)
|
310 | |
+{
|
311 | |
+ gboolean forwardable;
|
312 | |
+
|
313 | |
+ forwardable = gtk_toggle_button_get_active (toggle);
|
314 | |
+
|
315 | |
+ gconf_client_set_bool (dialog->client, KA_GCONF_KEY_FORWARDABLE, forwardable, NULL);
|
316 | |
+}
|
317 | |
+
|
318 | |
+
|
319 | |
+static void
|
320 | |
+ka_preferences_dialog_forwardable_notify (GConfClient *client G_GNUC_UNUSED,
|
321 | |
+ guint cnx_id G_GNUC_UNUSED,
|
322 | |
+ GConfEntry *entry,
|
323 | |
+ KaPreferencesDialog *dialog)
|
324 | |
+{
|
325 | |
+ gboolean forwardable;
|
326 | |
+
|
327 | |
+ if (!entry->value || entry->value->type != GCONF_VALUE_BOOL)
|
328 | |
+ return;
|
329 | |
+
|
330 | |
+ forwardable = gconf_value_get_bool (entry->value) != FALSE;
|
331 | |
+
|
332 | |
+ if (forwardable != gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->forwardable_toggle)))
|
333 | |
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->forwardable_toggle), forwardable);
|
334 | |
+}
|
335 | |
+
|
336 | |
+
|
337 | |
+static gboolean
|
338 | |
+ka_preferences_dialog_setup_forwardable_toggle (KaPreferencesDialog *dialog)
|
339 | |
+{
|
340 | |
+ gboolean forwardable;
|
341 | |
+
|
342 | |
+ dialog->forwardable_toggle = glade_xml_get_widget (dialog->xml, "forwardable_toggle");
|
343 | |
+ g_assert (dialog->forwardable_toggle != NULL);
|
344 | |
+
|
345 | |
+ forwardable = gconf_client_get_bool (dialog->client, KA_GCONF_KEY_FORWARDABLE, NULL);
|
346 | |
+
|
347 | |
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->forwardable_toggle), forwardable);
|
348 | |
+
|
349 | |
+ g_signal_connect (dialog->forwardable_toggle, "toggled",
|
350 | |
+ G_CALLBACK (ka_preferences_dialog_forwardable_toggled), dialog);
|
351 | |
+
|
352 | |
+ if (!gconf_client_key_is_writable (dialog->client, KA_GCONF_KEY_FORWARDABLE, NULL)) {
|
353 | |
+ gtk_widget_set_sensitive (dialog->forwardable_toggle, FALSE);
|
354 | |
+ }
|
355 | |
+
|
356 | |
+ dialog->listeners [dialog->n_listeners] = gconf_client_notify_add (dialog->client,
|
357 | |
+ KA_GCONF_KEY_FORWARDABLE,
|
358 | |
+ (GConfClientNotifyFunc) ka_preferences_dialog_forwardable_notify,
|
359 | |
+ dialog, NULL, NULL);
|
360 | |
+ dialog->n_listeners++;
|
361 | |
+ return forwardable;
|
362 | |
+}
|
363 | |
+
|
364 | |
+
|
365 | |
+static void
|
366 | |
+ka_preferences_dialog_proxiable_toggled (GtkToggleButton *toggle,
|
367 | |
+ KaPreferencesDialog *dialog)
|
368 | |
+{
|
369 | |
+ gboolean proxiable;
|
370 | |
+
|
371 | |
+ proxiable = gtk_toggle_button_get_active (toggle);
|
372 | |
+
|
373 | |
+ gconf_client_set_bool (dialog->client, KA_GCONF_KEY_PROXIABLE, proxiable, NULL);
|
374 | |
+}
|
375 | |
+
|
376 | |
+
|
377 | |
+static void
|
378 | |
+ka_preferences_dialog_proxiable_notify (GConfClient *client G_GNUC_UNUSED,
|
379 | |
+ guint cnx_id G_GNUC_UNUSED,
|
380 | |
+ GConfEntry *entry,
|
381 | |
+ KaPreferencesDialog *dialog)
|
382 | |
+{
|
383 | |
+ gboolean proxiable;
|
384 | |
+
|
385 | |
+ if (!entry->value || entry->value->type != GCONF_VALUE_BOOL)
|
386 | |
+ return;
|
387 | |
+
|
388 | |
+ proxiable = gconf_value_get_bool (entry->value) != FALSE;
|
389 | |
+
|
390 | |
+ if (proxiable != gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->proxiable_toggle)))
|
391 | |
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->proxiable_toggle), proxiable);
|
392 | |
+}
|
393 | |
+
|
394 | |
+
|
395 | |
+static gboolean
|
396 | |
+ka_preferences_dialog_setup_proxiable_toggle (KaPreferencesDialog *dialog)
|
397 | |
+{
|
398 | |
+ gboolean proxiable;
|
399 | |
+
|
400 | |
+ dialog->proxiable_toggle = glade_xml_get_widget (dialog->xml, "proxiable_toggle");
|
401 | |
+ g_assert (dialog->proxiable_toggle != NULL);
|
402 | |
+
|
403 | |
+ proxiable = gconf_client_get_bool (dialog->client, KA_GCONF_KEY_PROXIABLE, NULL);
|
404 | |
+
|
405 | |
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->proxiable_toggle), proxiable);
|
406 | |
+
|
407 | |
+ g_signal_connect (dialog->proxiable_toggle, "toggled",
|
408 | |
+ G_CALLBACK (ka_preferences_dialog_proxiable_toggled), dialog);
|
409 | |
+
|
410 | |
+ if (!gconf_client_key_is_writable (dialog->client, KA_GCONF_KEY_PROXIABLE, NULL)) {
|
411 | |
+ gtk_widget_set_sensitive (dialog->proxiable_toggle, FALSE);
|
412 | |
+ }
|
413 | |
+
|
414 | |
+ dialog->listeners [dialog->n_listeners] = gconf_client_notify_add (dialog->client,
|
415 | |
+ KA_GCONF_KEY_PROXIABLE,
|
416 | |
+ (GConfClientNotifyFunc) ka_preferences_dialog_proxiable_notify,
|
417 | |
+ dialog, NULL, NULL);
|
418 | |
+ dialog->n_listeners++;
|
419 | |
+ return proxiable;
|
420 | |
+}
|
421 | |
+
|
422 | |
+
|
423 | |
+static void
|
424 | |
+ka_preferences_dialog_renewable_toggled (GtkToggleButton *toggle,
|
425 | |
+ KaPreferencesDialog *dialog)
|
426 | |
+{
|
427 | |
+ gboolean renewable;
|
428 | |
+
|
429 | |
+ renewable = gtk_toggle_button_get_active (toggle);
|
430 | |
+
|
431 | |
+ gconf_client_set_bool (dialog->client, KA_GCONF_KEY_RENEWABLE, renewable, NULL);
|
432 | |
+}
|
433 | |
+
|
434 | |
+
|
435 | |
+static void
|
436 | |
+ka_preferences_dialog_renewable_notify (GConfClient *client G_GNUC_UNUSED,
|
437 | |
+ guint cnx_id G_GNUC_UNUSED,
|
438 | |
+ GConfEntry *entry,
|
439 | |
+ KaPreferencesDialog *dialog)
|
440 | |
+{
|
441 | |
+ gboolean renewable;
|
442 | |
+
|
443 | |
+ if (!entry->value || entry->value->type != GCONF_VALUE_BOOL)
|
444 | |
+ return;
|
445 | |
+
|
446 | |
+ renewable = gconf_value_get_bool (entry->value) != FALSE;
|
447 | |
+
|
448 | |
+ if (renewable != gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->renewable_toggle)))
|
449 | |
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->renewable_toggle), renewable);
|
450 | |
+}
|
451 | |
+
|
452 | |
+
|
453 | |
+static gboolean
|
454 | |
+ka_preferences_dialog_setup_renewable_toggle (KaPreferencesDialog *dialog)
|
455 | |
+{
|
456 | |
+ gboolean renewable;
|
457 | |
+
|
458 | |
+ dialog->renewable_toggle = glade_xml_get_widget (dialog->xml, "renewable_toggle");
|
459 | |
+ g_assert (dialog->renewable_toggle != NULL);
|
460 | |
+
|
461 | |
+ renewable = gconf_client_get_bool (dialog->client, KA_GCONF_KEY_RENEWABLE, NULL);
|
462 | |
+
|
463 | |
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->renewable_toggle), renewable);
|
464 | |
+
|
465 | |
+ g_signal_connect (dialog->renewable_toggle, "toggled",
|
466 | |
+ G_CALLBACK (ka_preferences_dialog_renewable_toggled), dialog);
|
467 | |
+
|
468 | |
+ if (!gconf_client_key_is_writable (dialog->client, KA_GCONF_KEY_RENEWABLE, NULL)) {
|
469 | |
+ gtk_widget_set_sensitive (dialog->renewable_toggle, FALSE);
|
470 | |
+ }
|
471 | |
+
|
472 | |
+ dialog->listeners [dialog->n_listeners] = gconf_client_notify_add (dialog->client,
|
473 | |
+ KA_GCONF_KEY_RENEWABLE,
|
474 | |
+ (GConfClientNotifyFunc) ka_preferences_dialog_renewable_notify,
|
475 | |
+ dialog, NULL, NULL);
|
476 | |
+ dialog->n_listeners++;
|
477 | |
+ return renewable;
|
478 | |
+}
|
479 | |
+
|
480 | |
+static void
|
481 | |
+ka_preferences_dialog_trayicon_toggled (GtkToggleButton *toggle,
|
482 | |
+ KaPreferencesDialog *dialog)
|
483 | |
+{
|
484 | |
+ gboolean trayicon;
|
485 | |
+
|
486 | |
+ trayicon = gtk_toggle_button_get_active (toggle);
|
487 | |
+ gconf_client_set_bool (dialog->client, KA_GCONF_KEY_SHOW_TRAYICON, trayicon, NULL);
|
488 | |
+}
|
489 | |
+
|
490 | |
+
|
491 | |
+static void
|
492 | |
+ka_preferences_dialog_trayicon_notify (GConfClient *client G_GNUC_UNUSED,
|
493 | |
+ guint cnx_id G_GNUC_UNUSED,
|
494 | |
+ GConfEntry *entry,
|
495 | |
+ KaPreferencesDialog *dialog)
|
496 | |
+{
|
497 | |
+ gboolean trayicon;
|
498 | |
+
|
499 | |
+ if (!entry->value || entry->value->type != GCONF_VALUE_BOOL)
|
500 | |
+ return;
|
501 | |
+
|
502 | |
+ trayicon = gconf_value_get_bool (entry->value) != FALSE;
|
503 | |
+
|
504 | |
+ if (trayicon != gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->trayicon_toggle)))
|
505 | |
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->trayicon_toggle), trayicon);
|
506 | |
+}
|
507 | |
+
|
508 | |
+
|
509 | |
+static gboolean
|
510 | |
+ka_preferences_dialog_setup_trayicon_toggle (KaPreferencesDialog *dialog)
|
511 | |
+{
|
512 | |
+ gboolean trayicon;
|
513 | |
+
|
514 | |
+ dialog->trayicon_toggle = glade_xml_get_widget (dialog->xml, "trayicon_toggle");
|
515 | |
+ g_assert (dialog->trayicon_toggle != NULL);
|
516 | |
+
|
517 | |
+ trayicon = gconf_client_get_bool (dialog->client, KA_GCONF_KEY_SHOW_TRAYICON, NULL);
|
518 | |
+
|
519 | |
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->trayicon_toggle), trayicon);
|
520 | |
+
|
521 | |
+ g_signal_connect (dialog->trayicon_toggle, "toggled",
|
522 | |
+ G_CALLBACK (ka_preferences_dialog_trayicon_toggled), dialog);
|
523 | |
+
|
524 | |
+ if (!gconf_client_key_is_writable (dialog->client, KA_GCONF_KEY_SHOW_TRAYICON, NULL)) {
|
525 | |
+ gtk_widget_set_sensitive (dialog->trayicon_toggle, FALSE);
|
526 | |
+ }
|
527 | |
+
|
528 | |
+ dialog->listeners [dialog->n_listeners] = gconf_client_notify_add (dialog->client,
|
529 | |
+ KA_GCONF_KEY_SHOW_TRAYICON,
|
530 | |
+ (GConfClientNotifyFunc) ka_preferences_dialog_trayicon_notify,
|
531 | |
+ dialog, NULL, NULL);
|
532 | |
+ dialog->n_listeners++;
|
533 | |
+ return trayicon;
|
534 | |
+}
|
535 | |
+
|
536 | |
+
|
537 | |
+static void
|
538 | |
+ka_preferences_dialog_prompt_mins_changed (GtkSpinButton *button,
|
539 | |
+ KaPreferencesDialog *dialog)
|
540 | |
+{
|
541 | |
+ gint prompt_mins;
|
542 | |
+
|
543 | |
+ prompt_mins = gtk_spin_button_get_value_as_int (button);
|
544 | |
+ gconf_client_set_int (dialog->client, KA_GCONF_KEY_PROMPT_MINS, prompt_mins, NULL);
|
545 | |
+}
|
546 | |
+
|
547 | |
+
|
548 | |
+static void
|
549 | |
+ka_preferences_dialog_prompt_mins_notify (GConfClient *client G_GNUC_UNUSED,
|
550 | |
+ guint cnx_id G_GNUC_UNUSED,
|
551 | |
+ GConfEntry *entry,
|
552 | |
+ KaPreferencesDialog *dialog)
|
553 | |
+{
|
554 | |
+ gint prompt_mins;
|
555 | |
+
|
556 | |
+ if (!entry->value || entry->value->type != GCONF_VALUE_INT)
|
557 | |
+ return;
|
558 | |
+
|
559 | |
+ prompt_mins = gconf_value_get_int (entry->value);
|
560 | |
+
|
561 | |
+ if (prompt_mins != gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dialog->prompt_mins_entry)))
|
562 | |
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->prompt_mins_entry), prompt_mins);
|
563 | |
+}
|
564 | |
+
|
565 | |
+
|
566 | |
+static gint
|
567 | |
+ka_preferences_dialog_setup_prompt_mins_entry (KaPreferencesDialog *dialog)
|
568 | |
+{
|
569 | |
+ gint prompt_mins;
|
570 | |
+
|
571 | |
+ dialog->prompt_mins_entry = glade_xml_get_widget (dialog->xml, "prompt_mins_entry");
|
572 | |
+ g_assert (dialog->prompt_mins_entry != NULL);
|
573 | |
+
|
574 | |
+ prompt_mins = gconf_client_get_int (dialog->client, KA_GCONF_KEY_PROMPT_MINS, NULL);
|
575 | |
+
|
576 | |
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->prompt_mins_entry), prompt_mins);
|
577 | |
+
|
578 | |
+ g_signal_connect (dialog->prompt_mins_entry, "value-changed",
|
579 | |
+ G_CALLBACK (ka_preferences_dialog_prompt_mins_changed), dialog);
|
580 | |
+
|
581 | |
+ if (!gconf_client_key_is_writable (dialog->client, KA_GCONF_KEY_PROMPT_MINS, NULL)) {
|
582 | |
+ gtk_widget_set_sensitive (dialog->prompt_mins_entry, FALSE);
|
583 | |
+ }
|
584 | |
+
|
585 | |
+ dialog->listeners [dialog->n_listeners] = gconf_client_notify_add (dialog->client,
|
586 | |
+ KA_GCONF_KEY_PROMPT_MINS,
|
587 | |
+ (GConfClientNotifyFunc) ka_preferences_dialog_prompt_mins_notify,
|
588 | |
+ dialog, NULL, NULL);
|
589 | |
+ dialog->n_listeners++;
|
590 | |
+ return prompt_mins;
|
591 | |
+}
|
592 | |
+
|
593 | |
+
|
594 | |
+
|
595 | |
+static void
|
596 | |
+ka_preferences_dialog_response (GtkWidget *widget,
|
597 | |
+ int response,
|
598 | |
+ KaPreferencesDialog *dialog)
|
599 | |
+{
|
600 | |
+ GError *error = NULL;
|
601 | |
+
|
602 | |
+ if (response != GTK_RESPONSE_HELP) {
|
603 | |
+ gtk_widget_destroy (widget);
|
604 | |
+ return;
|
605 | |
+ }
|
606 | |
+
|
607 | |
+ gtk_show_uri (gtk_window_get_screen (GTK_WINDOW (dialog->dialog)),
|
608 | |
+ "ghelp:krb5-auth-dialog#preferences",
|
609 | |
+ gtk_get_current_event_time (), &error);
|
610 | |
+
|
611 | |
+ if (error) {
|
612 | |
+ GtkWidget *message_dialog;
|
613 | |
+
|
614 | |
+
|
615 | |
+ message_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog->dialog),
|
616 | |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
|
617 | |
+ GTK_MESSAGE_ERROR,
|
618 | |
+ GTK_BUTTONS_CLOSE,
|
619 | |
+ _("There was an error displaying help:\n%s"),
|
620 | |
+ error->message);
|
621 | |
+ gtk_window_set_resizable (GTK_WINDOW (message_dialog), FALSE);
|
622 | |
+
|
623 | |
+ g_signal_connect (message_dialog, "response",
|
624 | |
+ G_CALLBACK (gtk_widget_destroy),
|
625 | |
+ NULL);
|
626 | |
+
|
627 | |
+ gtk_widget_show (message_dialog);
|
628 | |
+ g_error_free (error);
|
629 | |
+ }
|
630 | |
+}
|
631 | |
+
|
632 | |
+
|
633 | |
+static void
|
634 | |
+ka_preferences_dialog_destroyed (GtkWidget *widget G_GNUC_UNUSED,
|
635 | |
+ KaPreferencesDialog *dialog)
|
636 | |
+{
|
637 | |
+ dialog->dialog = NULL;
|
638 | |
+
|
639 | |
+ gtk_main_quit ();
|
640 | |
+}
|
641 | |
+
|
642 | |
+
|
643 | |
+static gboolean
|
644 | |
+ka_preferences_dialog_init(KaPreferencesDialog* dialog)
|
645 | |
+{
|
646 | |
+ dialog->xml = glade_xml_new (KA_DATA_DIR G_DIR_SEPARATOR_S
|
647 | |
+ PACKAGE "-preferences.glade", NULL, NULL);
|
648 | |
+
|
649 | |
+ dialog->dialog = glade_xml_get_widget (dialog->xml, "krb5_auth_dialog_prefs");
|
650 | |
+ g_assert (dialog->dialog);
|
651 | |
+
|
652 | |
+ g_signal_connect (dialog->dialog, "response",
|
653 | |
+ G_CALLBACK (ka_preferences_dialog_response), dialog);
|
654 | |
+ g_signal_connect (dialog->dialog, "destroy",
|
655 | |
+ G_CALLBACK (ka_preferences_dialog_destroyed), dialog);
|
656 | |
+
|
657 | |
+ dialog->client = gconf_client_get_default ();
|
658 | |
+ gconf_client_add_dir (dialog->client, KA_GCONF_PATH, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
659 | |
+
|
660 | |
+ ka_preferences_dialog_setup_principal_entry (dialog);
|
661 | |
+ ka_preferences_dialog_setup_pkuserid_entry (dialog);
|
662 | |
+ ka_preferences_dialog_setup_forwardable_toggle (dialog);
|
663 | |
+ ka_preferences_dialog_setup_proxiable_toggle (dialog);
|
664 | |
+ ka_preferences_dialog_setup_renewable_toggle (dialog);
|
665 | |
+ ka_preferences_dialog_setup_trayicon_toggle (dialog);
|
666 | |
+ ka_preferences_dialog_setup_prompt_mins_entry (dialog);
|
667 | |
+
|
668 | |
+ g_assert (dialog->n_listeners == N_LISTENERS);
|
669 | |
+
|
670 | |
+ gtk_widget_show (dialog->dialog);
|
671 | |
+ return TRUE;
|
672 | |
+}
|
673 | |
+
|
674 | |
+
|
675 | |
+static void
|
676 | |
+ka_preferences_dialog_finalize (KaPreferencesDialog *dialog)
|
677 | |
+{
|
678 | |
+ if (dialog->dialog)
|
679 | |
+ gtk_widget_destroy (dialog->dialog);
|
680 | |
+ dialog->dialog = NULL;
|
681 | |
+
|
682 | |
+ if (dialog->client) {
|
683 | |
+ int i;
|
684 | |
+
|
685 | |
+ for (i = 0; i < dialog->n_listeners; i++) {
|
686 | |
+ if (dialog->listeners [i])
|
687 | |
+ gconf_client_notify_remove (dialog->client, dialog->listeners [i]);
|
688 | |
+ dialog->listeners [i] = 0;
|
689 | |
+ }
|
690 | |
+ dialog->n_listeners = 0;
|
691 | |
+
|
692 | |
+ gconf_client_remove_dir (dialog->client, KA_GCONF_PATH, NULL);
|
693 | |
+
|
694 | |
+ g_object_unref (dialog->client);
|
695 | |
+ dialog->client = NULL;
|
696 | |
+ }
|
697 | |
+
|
698 | |
+ if (dialog->xml)
|
699 | |
+ g_object_unref (dialog->xml);
|
700 | |
+ dialog->xml = NULL;
|
701 | |
+}
|
702 | |
+
|
703 | |
+int
|
704 | |
+main (int argc, char *argv[])
|
705 | |
+{
|
706 | |
+ GOptionContext *context;
|
707 | |
+ GError *error = NULL;
|
708 | |
+ KaPreferencesDialog dialog = { NULL, };
|
709 | |
+
|
710 | |
+ const char *help_msg = "Run '" PACKAGE " --help' to see a full list of available command line options";
|
711 | |
+ const GOptionEntry options [] = {
|
712 | |
+ { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
|
713 | |
+ };
|
714 | |
+
|
715 | |
+ context = g_option_context_new ("- Kerberos Authentication Configuration");
|
716 | |
+ g_option_context_add_main_entries (context, options, NULL);
|
717 | |
+ g_option_context_add_group (context, gtk_get_option_group (TRUE));
|
718 | |
+ g_option_context_parse (context, &argc, &argv, &error);
|
719 | |
+ if (error) {
|
720 | |
+ g_print ("%s\n%s\n",
|
721 | |
+ error->message,
|
722 | |
+ help_msg);
|
723 | |
+ g_error_free (error);
|
724 | |
+ return 1;
|
725 | |
+ }
|
726 | |
+ textdomain (PACKAGE);
|
727 | |
+ bind_textdomain_codeset (PACKAGE, "UTF-8");
|
728 | |
+ bindtextdomain (PACKAGE, LOCALE_DIR);
|
729 | |
+
|
730 | |
+ g_set_application_name (_("Kerberos Authentication Configuration"));
|
731 | |
+
|
732 | |
+ ka_preferences_dialog_init(&dialog);
|
733 | |
+ gtk_main ();
|
734 | |
+ ka_preferences_dialog_finalize(&dialog);
|
735 | |
+ return 0;
|
736 | |
+}
|
737 | |
diff --git a/preferences/krb5-auth-dialog-preferences.desktop.in b/preferences/krb5-auth-dialog-preferences.desktop.in
|
738 | |
new file mode 100644
|
739 | |
index 0000000..d87e1e7
|
740 | |
--- /dev/null
|
741 | |
+++ b/preferences/krb5-auth-dialog-preferences.desktop.in
|
742 | |
@@ -0,0 +1,12 @@
|
743 | |
+[Desktop Entry]
|
744 | |
+_Name=Network Authentication
|
745 | |
+_Comment=Set your Kerberos network authenticaion preferences
|
746 | |
+Exec=krb5-auth-dialog-preferences
|
747 | |
+Icon=gtk-dialog-authentication
|
748 | |
+Terminal=false
|
749 | |
+Type=Application
|
750 | |
+StartupNotify=true
|
751 | |
+Categories=GNOME;GTK;Settings;X-GNOME-NetworkSettings;
|
752 | |
+OnlyShowIn=GNOME;
|
753 | |
+X-GNOME-Bugzilla-Bugzilla=GNOME
|
754 | |
+X-GNOME-Bugzilla-Product=krb5-auth-dialog
|
755 | |
diff --git a/preferences/krb5-auth-dialog-preferences.glade b/preferences/krb5-auth-dialog-preferences.glade
|
756 | |
new file mode 100644
|
757 | |
index 0000000..128229d
|
758 | |
--- /dev/null
|
759 | |
+++ b/preferences/krb5-auth-dialog-preferences.glade
|
760 | |
@@ -0,0 +1,565 @@
|
761 | |
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
762 | |
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
763 | |
+<!--Generated with glade3 3.4.5 on Thu Apr 2 16:29:44 2009 -->
|
764 | |
+<glade-interface>
|
765 | |
+ <widget class="GtkDialog" id="krb5_auth_dialog_prefs">
|
766 | |
+ <property name="border_width">5</property>
|
767 | |
+ <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
|
768 | |
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
769 | |
+ <property name="has_separator">False</property>
|
770 | |
+ <child internal-child="vbox">
|
771 | |
+ <widget class="GtkVBox" id="dialog-vbox1">
|
772 | |
+ <property name="visible">True</property>
|
773 | |
+ <property name="spacing">2</property>
|
774 | |
+ <child>
|
775 | |
+ <widget class="GtkNotebook" id="notebook1">
|
776 | |
+ <property name="visible">True</property>
|
777 | |
+ <property name="can_focus">True</property>
|
778 | |
+ <child>
|
779 | |
+ <widget class="GtkVBox" id="vbox1">
|
780 | |
+ <property name="visible">True</property>
|
781 | |
+ <property name="border_width">12</property>
|
782 | |
+ <property name="spacing">18</property>
|
783 | |
+ <child>
|
784 | |
+ <widget class="GtkVBox" id="vbox2">
|
785 | |
+ <property name="visible">True</property>
|
786 | |
+ <property name="spacing">12</property>
|
787 | |
+ <child>
|
788 | |
+ <widget class="GtkLabel" id="label4">
|
789 | |
+ <property name="visible">True</property>
|
790 | |
+ <property name="xalign">0</property>
|
791 | |
+ <property name="label" translatable="yes"><b>Kerberos User</b></property>
|
792 | |
+ <property name="use_markup">True</property>
|
793 | |
+ </widget>
|
794 | |
+ <packing>
|
795 | |
+ <property name="expand">False</property>
|
796 | |
+ <property name="fill">False</property>
|
797 | |
+ </packing>
|
798 | |
+ </child>
|
799 | |
+ <child>
|
800 | |
+ <widget class="GtkHBox" id="hbox1">
|
801 | |
+ <property name="visible">True</property>
|
802 | |
+ <property name="spacing">12</property>
|
803 | |
+ <child>
|
804 | |
+ <widget class="GtkImage" id="access">
|
805 | |
+ <property name="visible">True</property>
|
806 | |
+ <property name="yalign">0</property>
|
807 | |
+ <property name="icon_size">6</property>
|
808 | |
+ <property name="icon_name">gtk-dialog-authentication</property>
|
809 | |
+ </widget>
|
810 | |
+ <packing>
|
811 | |
+ <property name="expand">False</property>
|
812 | |
+ <property name="fill">False</property>
|
813 | |
+ </packing>
|
814 | |
+ </child>
|
815 | |
+ <child>
|
816 | |
+ <widget class="GtkVBox" id="vbox5">
|
817 | |
+ <property name="visible">True</property>
|
818 | |
+ <property name="spacing">6</property>
|
819 | |
+ <child>
|
820 | |
+ <widget class="GtkLabel" id="label6">
|
821 | |
+ <property name="visible">True</property>
|
822 | |
+ <property name="xalign">0</property>
|
823 | |
+ <property name="label" translatable="yes">Kerberos principal:</property>
|
824 | |
+ </widget>
|
825 | |
+ <packing>
|
826 | |
+ <property name="expand">False</property>
|
827 | |
+ <property name="fill">False</property>
|
828 | |
+ </packing>
|
829 | |
+ </child>
|
830 | |
+ <child>
|
831 | |
+ <widget class="GtkHBox" id="hbox5">
|
832 | |
+ <property name="visible">True</property>
|
833 | |
+ <property name="spacing">6</property>
|
834 | |
+ <child>
|
835 | |
+ <widget class="GtkLabel" id="label8">
|
836 | |
+ <property name="visible">True</property>
|
837 | |
+ <property name="label" translatable="yes"> </property>
|
838 | |
+ </widget>
|
839 | |
+ <packing>
|
840 | |
+ <property name="expand">False</property>
|
841 | |
+ <property name="fill">False</property>
|
842 | |
+ </packing>
|
843 | |
+ </child>
|
844 | |
+ <child>
|
845 | |
+ <widget class="GtkEntry" id="principal_entry">
|
846 | |
+ <property name="visible">True</property>
|
847 | |
+ <property name="can_focus">True</property>
|
848 | |
+ </widget>
|
849 | |
+ <packing>
|
850 | |
+ <property name="position">1</property>
|
851 | |
+ </packing>
|
852 | |
+ </child>
|
853 | |
+ </widget>
|
854 | |
+ <packing>
|
855 | |
+ <property name="position">1</property>
|
856 | |
+ </packing>
|
857 | |
+ </child>
|
858 | |
+ <child>
|
859 | |
+ <widget class="GtkLabel" id="label7">
|
860 | |
+ <property name="visible">True</property>
|
861 | |
+ <property name="xalign">0</property>
|
862 | |
+ <property name="label" translatable="yes">Pkinit userid: </property>
|
863 | |
+ </widget>
|
864 | |
+ <packing>
|
865 | |
+ <property name="expand">False</property>
|
866 | |
+ <property name="fill">False</property>
|
867 | |
+ <property name="position">2</property>
|
868 | |
+ </packing>
|
869 | |
+ </child>
|
870 | |
+ <child>
|
871 | |
+ <widget class="GtkHBox" id="hbox6">
|
872 | |
+ <property name="visible">True</property>
|
873 | |
+ <property name="spacing">6</property>
|
874 | |
+ <child>
|
875 | |
+ <widget class="GtkLabel" id="label9">
|
876 | |
+ <property name="visible">True</property>
|
877 | |
+ <property name="label" translatable="yes"> </property>
|
878 | |
+ </widget>
|
879 | |
+ <packing>
|
880 | |
+ <property name="expand">False</property>
|
881 | |
+ <property name="fill">False</property>
|
882 | |
+ </packing>
|
883 | |
+ </child>
|
884 | |
+ <child>
|
885 | |
+ <widget class="GtkEntry" id="pkuserid_entry">
|
886 | |
+ <property name="visible">True</property>
|
887 | |
+ <property name="can_focus">True</property>
|
888 | |
+ </widget>
|
889 | |
+ <packing>
|
890 | |
+ <property name="position">1</property>
|
891 | |
+ </packing>
|
892 | |
+ </child>
|
893 | |
+ </widget>
|
894 | |
+ <packing>
|
895 | |
+ <property name="position">3</property>
|
896 | |
+ </packing>
|
897 | |
+ </child>
|
898 | |
+ </widget>
|
899 | |
+ <packing>
|
900 | |
+ <property name="position">1</property>
|
901 | |
+ </packing>
|
902 | |
+ </child>
|
903 | |
+ </widget>
|
904 | |
+ <packing>
|
905 | |
+ <property name="position">1</property>
|
906 | |
+ </packing>
|
907 | |
+ </child>
|
908 | |
+ </widget>
|
909 | |
+ <packing>
|
910 | |
+ <property name="expand">False</property>
|
911 | |
+ </packing>
|
912 | |
+ </child>
|
913 | |
+ <child>
|
914 | |
+ <widget class="GtkVBox" id="vbox3">
|
915 | |
+ <property name="visible">True</property>
|
916 | |
+ <property name="spacing">12</property>
|
917 | |
+ <child>
|
918 | |
+ <widget class="GtkLabel" id="label5">
|
919 | |
+ <property name="visible">True</property>
|
920 | |
+ <property name="xalign">0</property>
|
921 | |
+ <property name="label" translatable="yes"><b>Ticket Options</b></property>
|
922 | |
+ <property name="use_markup">True</property>
|
923 | |
+ </widget>
|
924 | |
+ <packing>
|
925 | |
+ <property name="expand">False</property>
|
926 | |
+ </packing>
|
927 | |
+ </child>
|
928 | |
+ <child>
|
929 | |
+ <widget class="GtkHBox" id="hbox2">
|
930 | |
+ <property name="visible">True</property>
|
931 | |
+ <property name="spacing">12</property>
|
932 | |
+ <child>
|
933 | |
+ <widget class="GtkImage" id="image1">
|
934 | |
+ <property name="visible">True</property>
|
935 | |
+ <property name="yalign">0</property>
|
936 | |
+ <property name="icon_size">6</property>
|
937 | |
+ <property name="icon_name">system-lock-screen</property>
|
938 | |
+ </widget>
|
939 | |
+ <packing>
|
940 | |
+ <property name="expand">False</property>
|
941 | |
+ <property name="fill">False</property>
|
942 | |
+ </packing>
|
943 | |
+ </child>
|
944 | |
+ <child>
|
945 | |
+ <widget class="GtkVBox" id="vbox4">
|
946 | |
+ <property name="visible">True</property>
|
947 | |
+ <property name="spacing">6</property>
|
948 | |
+ <child>
|
949 | |
+ <widget class="GtkLabel" id="label10">
|
950 | |
+ <property name="visible">True</property>
|
951 | |
+ <property name="label" translatable="yes">Requested Kerberos tickets should be:</property>
|
952 | |
+ </widget>
|
953 | |
+ <packing>
|
954 | |
+ <property name="expand">False</property>
|
955 | |
+ <property name="fill">False</property>
|
956 | |
+ </packing>
|
957 | |
+ </child>
|
958 | |
+ <child>
|
959 | |
+ <widget class="GtkHBox" id="hbox3">
|
960 | |
+ <property name="visible">True</property>
|
961 | |
+ <child>
|
962 | |
+ <widget class="GtkLabel" id="label11">
|
963 | |
+ <property name="visible">True</property>
|
964 | |
+ <property name="label" translatable="yes"> </property>
|
965 | |
+ </widget>
|
966 | |
+ <packing>
|
967 | |
+ <property name="expand">False</property>
|
968 | |
+ <property name="fill">False</property>
|
969 | |
+ </packing>
|
970 | |
+ </child>
|
971 | |
+ <child>
|
972 | |
+ <widget class="GtkCheckButton" id="forwardable_toggle">
|
973 | |
+ <property name="visible">True</property>
|
974 | |
+ <property name="can_focus">True</property>
|
975 | |
+ <property name="label" translatable="yes">forwardable</property>
|
976 | |
+ <property name="response_id">0</property>
|
977 | |
+ <property name="draw_indicator">True</property>
|
978 | |
+ </widget>
|
979 | |
+ <packing>
|
980 | |
+ <property name="position">1</property>
|
981 | |
+ </packing>
|
982 | |
+ </child>
|
983 | |
+ </widget>
|
984 | |
+ <packing>
|
985 | |
+ <property name="expand">False</property>
|
986 | |
+ <property name="fill">False</property>
|
987 | |
+ <property name="position">1</property>
|
988 | |
+ </packing>
|
989 | |
+ </child>
|
990 | |
+ <child>
|
991 | |
+ <widget class="GtkHBox" id="hbox4">
|
992 | |
+ <property name="visible">True</property>
|
993 | |
+ <child>
|
994 | |
+ <widget class="GtkLabel" id="label12">
|
995 | |
+ <property name="visible">True</property>
|
996 | |
+ <property name="label" translatable="yes"> </property>
|
997 | |
+ </widget>
|
998 | |
+ <packing>
|
999 | |
+ <property name="expand">False</property>
|
1000 | |
+ <property name="fill">False</property>
|
1001 | |
+ </packing>
|
1002 | |
+ </child>
|
1003 | |
+ <child>
|
1004 | |
+ <widget class="GtkCheckButton" id="renewable_toggle">
|
1005 | |
+ <property name="visible">True</property>
|
1006 | |
+ <property name="can_focus">True</property>
|
1007 | |
+ <property name="label" translatable="yes">renewable</property>
|
1008 | |
+ <property name="response_id">0</property>
|
1009 | |
+ <property name="draw_indicator">True</property>
|
1010 | |
+ </widget>
|
1011 | |
+ <packing>
|
1012 | |
+ <property name="expand">False</property>
|
1013 | |
+ <property name="fill">False</property>
|
1014 | |
+ <property name="position">1</property>
|
1015 | |
+ </packing>
|
1016 | |
+ </child>
|
1017 | |
+ </widget>
|
1018 | |
+ <packing>
|
1019 | |
+ <property name="position">2</property>
|
1020 | |
+ </packing>
|
1021 | |
+ </child>
|
1022 | |
+ <child>
|
1023 | |
+ <widget class="GtkHBox" id="hbox11">
|
1024 | |
+ <property name="visible">True</property>
|
1025 | |
+ <child>
|
1026 | |
+ <widget class="GtkLabel" id="label19">
|
1027 | |
+ <property name="visible">True</property>
|
1028 | |
+ <property name="label" translatable="yes"> </property>
|
1029 | |
+ </widget>
|
1030 | |
+ <packing>
|
1031 | |
+ <property name="expand">False</property>
|
1032 | |
+ <property name="fill">False</property>
|
1033 | |
+ </packing>
|
1034 | |
+ </child>
|
1035 | |
+ <child>
|
1036 | |
+ <widget class="GtkCheckButton" id="proxiable_toggle">
|
1037 | |
+ <property name="visible">True</property>
|
1038 | |
+ <property name="can_focus">True</property>
|
1039 | |
+ <property name="label" translatable="yes">proxiable</property>
|
1040 | |
+ <property name="response_id">0</property>
|
1041 | |
+ <property name="draw_indicator">True</property>
|
1042 | |
+ </widget>
|
1043 | |
+ <packing>
|
1044 | |
+ <property name="expand">False</property>
|
1045 | |
+ <property name="fill">False</property>
|
1046 | |
+ <property name="position">1</property>
|
1047 | |
+ </packing>
|
1048 | |
+ </child>
|
1049 | |
+ </widget>
|
1050 | |
+ <packing>
|
1051 | |
+ <property name="position">3</property>
|
1052 | |
+ </packing>
|
1053 | |
+ </child>
|
1054 | |
+ </widget>
|
1055 | |
+ <packing>
|
1056 | |
+ <property name="position">1</property>
|
1057 | |
+ </packing>
|
1058 | |
+ </child>
|
1059 | |
+ </widget>
|
1060 | |
+ <packing>
|
1061 | |
+ <property name="position">1</property>
|
1062 | |
+ </packing>
|
1063 | |
+ </child>
|
1064 | |
+ </widget>
|
1065 | |
+ <packing>
|
1066 | |
+ <property name="expand">False</property>
|
1067 | |
+ <property name="position">1</property>
|
1068 | |
+ </packing>
|
1069 | |
+ </child>
|
1070 | |
+ </widget>
|
1071 | |
+ </child>
|
1072 | |
+ <child>
|
1073 | |
+ <widget class="GtkLabel" id="label1">
|
1074 | |
+ <property name="visible">True</property>
|
1075 | |
+ <property name="label" translatable="yes">Kerberos</property>
|
1076 | |
+ </widget>
|
1077 | |
+ <packing>
|
1078 | |
+ <property name="type">tab</property>
|
1079 | |
+ <property name="tab_fill">False</property>
|
1080 | |
+ </packing>
|
1081 | |
+ </child>
|
1082 | |
+ <child>
|
1083 | |
+ <widget class="GtkVBox" id="vbox9">
|
1084 | |
+ <property name="visible">True</property>
|
1085 | |
+ <property name="border_width">12</property>
|
1086 | |
+ <property name="spacing">18</property>
|
1087 | |
+ <child>
|
1088 | |
+ <widget class="GtkVBox" id="vbox8">
|
1089 | |
+ <property name="visible">True</property>
|
1090 | |
+ <property name="spacing">12</property>
|
1091 | |
+ <child>
|
1092 | |
+ <widget class="GtkLabel" id="label17">
|
1093 | |
+ <property name="visible">True</property>
|
1094 | |
+ <property name="xalign">0</property>
|
1095 | |
+ <property name="label" translatable="yes"><b>Notifications</b></property>
|
1096 | |
+ <property name="use_markup">True</property>
|
1097 | |
+ </widget>
|
1098 | |
+ <packing>
|
1099 | |
+ <property name="expand">False</property>
|
1100 | |
+ <property name="fill">False</property>
|
1101 | |
+ </packing>
|
1102 | |
+ </child>
|
1103 | |
+ <child>
|
1104 | |
+ <widget class="GtkHBox" id="hbox9">
|
1105 | |
+ <property name="visible">True</property>
|
1106 | |
+ <property name="spacing">12</property>
|
1107 | |
+ <child>
|
1108 | |
+ <widget class="GtkImage" id="image3">
|
1109 | |
+ <property name="visible">True</property>
|
1110 | |
+ <property name="yalign">0</property>
|
1111 | |
+ <property name="stock">gtk-dialog-warning</property>
|
1112 | |
+ <property name="icon_size">6</property>
|
1113 | |
+ </widget>
|
1114 | |
+ <packing>
|
1115 | |
+ <property name="expand">False</property>
|
1116 | |
+ <property name="fill">False</property>
|
1117 | |
+ </packing>
|
1118 | |
+ </child>
|
1119 | |
+ <child>
|
1120 | |
+ <widget class="GtkHBox" id="hbox8">
|
1121 | |
+ <property name="visible">True</property>
|
1122 | |
+ <property name="spacing">6</property>
|
1123 | |
+ <child>
|
1124 | |
+ <widget class="GtkLabel" id="label14">
|
1125 | |
+ <property name="visible">True</property>
|
1126 | |
+ <property name="label" translatable="yes"> </property>
|
1127 | |
+ </widget>
|
1128 | |
+ <packing>
|
1129 | |
+ <property name="expand">False</property>
|
1130 | |
+ <property name="fill">False</property>
|
1131 | |
+ </packing>
|
1132 | |
+ </child>
|
1133 | |
+ <child>
|
1134 | |
+ <widget class="GtkLabel" id="label15">
|
1135 | |
+ <property name="visible">True</property>
|
1136 | |
+ <property name="label" translatable="yes">Warn every</property>
|
1137 | |
+ </widget>
|
1138 | |
+ <packing>
|
1139 | |
+ <property name="expand">False</property>
|
1140 | |
+ <property name="fill">False</property>
|
1141 | |
+ <property name="position">1</property>
|
1142 | |
+ </packing>
|
1143 | |
+ </child>
|
1144 | |
+ <child>
|
1145 | |
+ <widget class="GtkSpinButton" id="prompt_mins_entry">
|
1146 | |
+ <property name="visible">True</property>
|
1147 | |
+ <property name="can_focus">True</property>
|
1148 | |
+ <property name="adjustment">0 0 100 1 10 10</property>
|
1149 | |
+ </widget>
|
1150 | |
+ <packing>
|
1151 | |
+ <property name="expand">False</property>
|
1152 | |
+ <property name="fill">False</property>
|
1153 | |
+ <property name="position">2</property>
|
1154 | |
+ </packing>
|
1155 | |
+ </child>
|
1156 | |
+ <child>
|
1157 | |
+ <widget class="GtkLabel" id="label16">
|
1158 | |
+ <property name="visible">True</property>
|
1159 | |
+ <property name="label" translatable="yes">minutes</property>
|
1160 | |
+ </widget>
|
1161 | |
+ <packing>
|
1162 | |
+ <property name="expand">False</property>
|
1163 | |
+ <property name="fill">False</property>
|
1164 | |
+ <property name="position">3</property>
|
1165 | |
+ </packing>
|
1166 | |
+ </child>
|
1167 | |
+ </widget>
|
1168 | |
+ <packing>
|
1169 | |
+ <property name="expand">False</property>
|
1170 | |
+ <property name="position">1</property>
|
1171 | |
+ </packing>
|
1172 | |
+ </child>
|
1173 | |
+ </widget>
|
1174 | |
+ <packing>
|
1175 | |
+ <property name="expand">False</property>
|
1176 | |
+ <property name="position">1</property>
|
1177 | |
+ </packing>
|
1178 | |
+ </child>
|
1179 | |
+ </widget>
|
1180 | |
+ <packing>
|
1181 | |
+ <property name="expand">False</property>
|
1182 | |
+ </packing>
|
1183 | |
+ </child>
|
1184 | |
+ <child>
|
1185 | |
+ <widget class="GtkVBox" id="vbox10">
|
1186 | |
+ <property name="visible">True</property>
|
1187 | |
+ <property name="spacing">12</property>
|
1188 | |
+ <child>
|
1189 | |
+ <widget class="GtkLabel" id="label18">
|
1190 | |
+ <property name="visible">True</property>
|
1191 | |
+ <property name="xalign">0</property>
|
1192 | |
+ <property name="label" translatable="yes"><b>Appearance</b></property>
|
1193 | |
+ <property name="use_markup">True</property>
|
1194 | |
+ </widget>
|
1195 | |
+ <packing>
|
1196 | |
+ <property name="expand">False</property>
|
1197 | |
+ <property name="fill">False</property>
|
1198 | |
+ </packing>
|
1199 | |
+ </child>
|
1200 | |
+ <child>
|
1201 | |
+ <widget class="GtkHBox" id="hbox10">
|
1202 | |
+ <property name="visible">True</property>
|
1203 | |
+ <property name="spacing">12</property>
|
1204 | |
+ <child>
|
1205 | |
+ <widget class="GtkImage" id="image2">
|
1206 | |
+ <property name="visible">True</property>
|
1207 | |
+ <property name="xalign">0</property>
|
1208 | |
+ <property name="yalign">0</property>
|
1209 | |
+ <property name="stock">gtk-zoom-in</property>
|
1210 | |
+ <property name="icon_size">6</property>
|
1211 | |
+ </widget>
|
1212 | |
+ <packing>
|
1213 | |
+ <property name="expand">False</property>
|
1214 | |
+ <property name="fill">False</property>
|
1215 | |
+ </packing>
|
1216 | |
+ </child>
|
1217 | |
+ <child>
|
1218 | |
+ <widget class="GtkVBox" id="vbox7">
|
1219 | |
+ <property name="visible">True</property>
|
1220 | |
+ <child>
|
1221 | |
+ <widget class="GtkHBox" id="hbox7">
|
1222 | |
+ <property name="visible">True</property>
|
1223 | |
+ <property name="spacing">6</property>
|
1224 | |
+ <child>
|
1225 | |
+ <widget class="GtkLabel" id="label13">
|
1226 | |
+ <property name="visible">True</property>
|
1227 | |
+ <property name="label" translatable="yes"> </property>
|
1228 | |
+ </widget>
|
1229 | |
+ <packing>
|
1230 | |
+ <property name="expand">False</property>
|
1231 | |
+ <property name="fill">False</property>
|
1232 | |
+ </packing>
|
1233 | |
+ </child>
|
1234 | |
+ <child>
|
1235 | |
+ <widget class="GtkCheckButton" id="trayicon_toggle">
|
1236 | |
+ <property name="visible">True</property>
|
1237 | |
+ <property name="can_focus">True</property>
|
1238 | |
+ <property name="label" translatable="yes">Show tray icon</property>
|
1239 | |
+ <property name="response_id">0</property>
|
1240 | |
+ <property name="draw_indicator">True</property>
|
1241 | |
+ </widget>
|
1242 | |
+ <packing>
|
1243 | |
+ <property name="expand">False</property>
|
1244 | |
+ <property name="position">1</property>
|
1245 | |
+ </packing>
|
1246 | |
+ </child>
|
1247 | |
+ </widget>
|
1248 | |
+ </child>
|
1249 | |
+ </widget>
|
1250 | |
+ <packing>
|
1251 | |
+ <property name="expand">False</property>
|
1252 | |
+ <property name="fill">False</property>
|
1253 | |
+ <property name="position">1</property>
|
1254 | |
+ </packing>
|
1255 | |
+ </child>
|
1256 | |
+ </widget>
|
1257 | |
+ <packing>
|
1258 | |
+ <property name="expand">False</property>
|
1259 | |
+ <property name="fill">False</property>
|
1260 | |
+ <property name="position">1</property>
|
1261 | |
+ </packing>
|
1262 | |
+ </child>
|
1263 | |
+ </widget>
|
1264 | |
+ <packing>
|
1265 | |
+ <property name="expand">False</property>
|
1266 | |
+ <property name="position">1</property>
|
1267 | |
+ </packing>
|
1268 | |
+ </child>
|
1269 | |
+ </widget>
|
1270 | |
+ <packing>
|
1271 | |
+ <property name="position">1</property>
|
1272 | |
+ </packing>
|
1273 | |
+ </child>
|
1274 | |
+ <child>
|
1275 | |
+ <widget class="GtkLabel" id="label2">
|
1276 | |
+ <property name="visible">True</property>
|
1277 | |
+ <property name="label" translatable="yes">Applet</property>
|
1278 | |
+ </widget>
|
1279 | |
+ <packing>
|
1280 | |
+ <property name="type">tab</property>
|
1281 | |
+ <property name="position">1</property>
|
1282 | |
+ <property name="tab_fill">False</property>
|
1283 | |
+ </packing>
|
1284 | |
+ </child>
|
1285 | |
+ </widget>
|
1286 | |
+ <packing>
|
1287 | |
+ <property name="position">1</property>
|
1288 | |
+ </packing>
|
1289 | |
+ </child>
|
1290 | |
+ <child internal-child="action_area">
|
1291 | |
+ <widget class="GtkHButtonBox" id="dialog-action_area1">
|
1292 | |
+ <property name="visible">True</property>
|
1293 | |
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
|
1294 | |
+ <child>
|
1295 | |
+ <widget class="GtkButton" id="button2">
|
1296 | |
+ <property name="can_focus">True</property>
|
1297 | |
+ <property name="receives_default">True</property>
|
1298 | |
+ <property name="label" translatable="yes">gtk-help</property>
|
1299 | |
+ <property name="use_stock">True</property>
|
1300 | |
+ <property name="response_id">-11</property>
|
1301 | |
+ </widget>
|
1302 | |
+ </child>
|
1303 | |
+ <child>
|
1304 | |
+ <widget class="GtkButton" id="button1">
|
1305 | |
+ <property name="visible">True</property>
|
1306 | |
+ <property name="can_focus">True</property>
|
1307 | |
+ <property name="receives_default">True</property>
|
1308 | |
+ <property name="label" translatable="yes">gtk-close</property>
|
1309 | |
+ <property name="use_stock">True</property>
|
1310 | |
+ <property name="response_id">0</property>
|
1311 | |
+ </widget>
|
1312 | |
+ <packing>
|
1313 | |
+ <property name="position">1</property>
|
1314 | |
+ </packing>
|
1315 | |
+ </child>
|
1316 | |
+ </widget>
|
1317 | |
+ <packing>
|
1318 | |
+ <property name="expand">False</property>
|
1319 | |
+ <property name="pack_type">GTK_PACK_END</property>
|
1320 | |
+ </packing>
|
1321 | |
+ </child>
|
1322 | |
+ </widget>
|
1323 | |
+ </child>
|
1324 | |
+ </widget>
|
1325 | |
+</glade-interface>
|
1326 | |
diff --git a/src/Makefile.am b/src/Makefile.am
|
1327 | |
index 1c74c84..4c16102 100644
|
1328 | |
--- a/src/Makefile.am
|
1329 | |
+++ b/src/Makefile.am
|
1330 | |
@@ -33,6 +33,8 @@ krb5_auth_dialog_SOURCES = \
|
1331 | |
krb5-auth-pwdialog.h \
|
1332 | |
krb5-auth-gconf.c \
|
1333 | |
krb5-auth-gconf.h \
|
1334 | |
+ krb5-auth-gconf-tools.c \
|
1335 | |
+ krb5-auth-gconf-tools.h \
|
1336 | |
krb5-auth-dbus.c \
|
1337 | |
krb5-auth-dbus.h \
|
1338 | |
dummy-strings.c
|
1339 | |
diff --git a/src/krb5-auth-applet.c b/src/krb5-auth-applet.c
|
1340 | |
index 34524df..daaef2e 100644
|
1341 | |
--- a/src/krb5-auth-applet.c
|
1342 | |
+++ b/src/krb5-auth-applet.c
|
1343 | |
@@ -43,6 +43,9 @@ enum
|
1344 | |
KA_PROP_PK_USERID,
|
1345 | |
KA_PROP_TRAYICON,
|
1346 | |
KA_PROP_PW_PROMPT_MINS,
|
1347 | |
+ KA_PROP_TGT_FORWARDABLE,
|
1348 | |
+ KA_PROP_TGT_PROXIABLE,
|
1349 | |
+ KA_PROP_TGT_RENEWABLE,
|
1350 | |
};
|
1351 | |
|
1352 | |
struct _KaApplet {
|
1353 | |
@@ -73,6 +76,9 @@ struct _KaAppletPrivate
|
1354 | |
char* principal; /* the principal to request */
|
1355 | |
gboolean renewable; /* credentials renewable? */
|
1356 | |
char* pk_userid; /* "userid" for pkint */
|
1357 | |
+ gboolean tgt_forwardable; /* request a forwardable ticket */
|
1358 | |
+ gboolean tgt_renewable; /* request a renewable ticket */
|
1359 | |
+ gboolean tgt_proxiable; /* request a proxiable ticket */
|
1360 | |
};
|
1361 | |
|
1362 | |
static void
|
1363 | |
@@ -106,6 +112,21 @@ ka_applet_set_property (GObject *object,
|
1364 | |
KA_DEBUG ("%s: %d", pspec->name, self->priv->pw_prompt_secs/60);
|
1365 | |
break;
|
1366 | |
|
1367 | |
+ case KA_PROP_TGT_FORWARDABLE:
|
1368 | |
+ self->priv->tgt_forwardable = g_value_get_boolean (value);
|
1369 | |
+ KA_DEBUG ("%s: %s", pspec->name, self->priv->tgt_forwardable ? "True" : "False");
|
1370 | |
+ break;
|
1371 | |
+
|
1372 | |
+ case KA_PROP_TGT_PROXIABLE:
|
1373 | |
+ self->priv->tgt_proxiable = g_value_get_boolean (value);
|
1374 | |
+ KA_DEBUG ("%s: %s", pspec->name, self->priv->tgt_proxiable ? "True" : "False");
|
1375 | |
+ break;
|
1376 | |
+
|
1377 | |
+ case KA_PROP_TGT_RENEWABLE:
|
1378 | |
+ self->priv->tgt_renewable = g_value_get_boolean (value);
|
1379 | |
+ KA_DEBUG ("%s: %s", pspec->name, self->priv->tgt_renewable ? "True" : "False");
|
1380 | |
+ break;
|
1381 | |
+
|
1382 | |
default:
|
1383 | |
/* We don't have any other property... */
|
1384 | |
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
1385 | |
@@ -139,6 +160,18 @@ ka_applet_get_property (GObject *object,
|
1386 | |
g_value_set_uint (value, self->priv->pw_prompt_secs / 60);
|
1387 | |
break;
|
1388 | |
|
1389 | |
+ case KA_PROP_TGT_FORWARDABLE:
|
1390 | |
+ g_value_set_boolean (value, self->priv->tgt_forwardable);
|
1391 | |
+ break;
|
1392 | |
+
|
1393 | |
+ case KA_PROP_TGT_PROXIABLE:
|
1394 | |
+ g_value_set_boolean (value, self->priv->tgt_proxiable);
|
1395 | |
+ break;
|
1396 | |
+
|
1397 | |
+ case KA_PROP_TGT_RENEWABLE:
|
1398 | |
+ g_value_set_boolean (value, self->priv->tgt_renewable);
|
1399 | |
+ break;
|
1400 | |
+
|
1401 | |
default:
|
1402 | |
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
1403 | |
break;
|
1404 | |
@@ -203,7 +236,7 @@ ka_applet_class_init(KaAppletClass *klass)
|
1405 | |
|
1406 | |
pspec = g_param_spec_string ("principal",
|
1407 | |
"Principal",
|
1408 | |
- "Get/Set Kerberos Principal",
|
1409 | |
+ "Get/Set Kerberos principal",
|
1410 | |
"",
|
1411 | |
G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
|
1412 | |
g_object_class_install_property (object_class,
|
1413 | |
@@ -211,7 +244,7 @@ ka_applet_class_init(KaAppletClass *klass)
|
1414 | |
pspec);
|
1415 | |
|
1416 | |
pspec = g_param_spec_string ("pk-userid",
|
1417 | |
- "PKinit Identifier",
|
1418 | |
+ "PKinit identifier",
|
1419 | |
"Get/Set Pkinit identifier",
|
1420 | |
"",
|
1421 | |
G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
|
1422 | |
@@ -229,13 +262,40 @@ ka_applet_class_init(KaAppletClass *klass)
|
1423 | |
pspec);
|
1424 | |
|
1425 | |
pspec = g_param_spec_uint ("pw-prompt-mins",
|
1426 | |
- "Password Prompting Interval",
|
1427 | |
- "Password Prompting Interval in Minutes",
|
1428 | |
+ "Password prompting interval",
|
1429 | |
+ "Password prompting interval in minutes",
|
1430 | |
0, G_MAXUINT, MINUTES_BEFORE_PROMPTING,
|
1431 | |
G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
|
1432 | |
g_object_class_install_property (object_class,
|
1433 | |
KA_PROP_PW_PROMPT_MINS,
|
1434 | |
pspec);
|
1435 | |
+
|
1436 | |
+ pspec = g_param_spec_boolean("tgt-forwardable",
|
1437 | |
+ "Forwardable ticket",
|
1438 | |
+ "wether to request forwardable tickets",
|
1439 | |
+ FALSE,
|
1440 | |
+ G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
|
1441 | |
+ g_object_class_install_property (object_class,
|
1442 | |
+ KA_PROP_TGT_FORWARDABLE,
|
1443 | |
+ pspec);
|
1444 | |
+
|
1445 | |
+ pspec = g_param_spec_boolean("tgt-proxiable",
|
1446 | |
+ "Proxiable ticket",
|
1447 | |
+ "wether to request proxiable tickets",
|
1448 | |
+ FALSE,
|
1449 | |
+ G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
|
1450 | |
+ g_object_class_install_property (object_class,
|
1451 | |
+ KA_PROP_TGT_PROXIABLE,
|
1452 | |
+ pspec);
|
1453 | |
+
|
1454 | |
+ pspec = g_param_spec_boolean("tgt-renewable",
|
1455 | |
+ "Renewable ticket",
|
1456 | |
+ "wether to request renewable tickets",
|
1457 | |
+ FALSE,
|
1458 | |
+ G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
|
1459 | |
+ g_object_class_install_property (object_class,
|
1460 | |
+ KA_PROP_TGT_RENEWABLE,
|
1461 | |
+ pspec);
|
1462 | |
}
|
1463 | |
|
1464 | |
|
1465 | |
@@ -372,6 +432,13 @@ ka_applet_menu_add_separator_item (GtkWidget* menu)
|
1466 | |
gtk_widget_show (menu_item);
|
1467 | |
}
|
1468 | |
|
1469 | |
+static void
|
1470 | |
+ka_applet_cb_preferences (GtkWidget* menuitem G_GNUC_UNUSED,
|
1471 | |
+ gpointer user_data G_GNUC_UNUSED)
|
1472 | |
+{
|
1473 | |
+ g_spawn_command_line_async ("krb5-auth-dialog-preferences", NULL);
|
1474 | |
+}
|
1475 | |
+
|
1476 | |
|
1477 | |
/* Free all resources and quit */
|
1478 | |
static void
|
1479 | |
@@ -421,6 +488,14 @@ ka_applet_create_context_menu (KaApplet* applet)
|
1480 | |
|
1481 | |
ka_applet_menu_add_separator_item (menu);
|
1482 | |
|
1483 | |
+ /* Preferences */
|
1484 | |
+ menu_item = gtk_image_menu_item_new_with_mnemonic (_("_Preferences"));
|
1485 | |
+ g_signal_connect (G_OBJECT (menu_item), "activate", G_CALLBACK (ka_applet_cb_preferences), applet);
|
1486 | |
+ image = gtk_image_new_from_stock (GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU);
|
1487 | |
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image);
|
1488 | |
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
|
1489 | |
+
|
1490 | |
+
|
1491 | |
/* About item */
|
1492 | |
menu_item = gtk_image_menu_item_new_with_mnemonic (_("_About"));
|
1493 | |
g_signal_connect (G_OBJECT (menu_item), "activate", G_CALLBACK (ka_applet_cb_about_dialog), applet);
|
1494 | |
diff --git a/src/krb5-auth-dialog.c b/src/krb5-auth-dialog.c
|
1495 | |
index be6c29f..6b48d2b 100644
|
1496 | |
--- a/src/krb5-auth-dialog.c
|
1497 | |
+++ b/src/krb5-auth-dialog.c
|
1498 | |
@@ -378,9 +378,40 @@ out:
|
1499 | |
}
|
1500 | |
|
1501 | |
|
1502 | |
+/*
|
1503 | |
+ * set ticket options by looking at krb5.conf and gconf
|
1504 | |
+ */
|
1505 | |
+static void
|
1506 | |
+ka_set_ticket_options(KaApplet* applet,
|
1507 | |
+ krb5_get_init_creds_opt *out)
|
1508 | |
+{
|
1509 | |
+ gboolean flag;
|
1510 | |
+
|
1511 | |
+#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_DEFAULT_FLAGS
|
1512 | |
+ krb5_get_init_creds_opt_set_default_flags(kcontext, PACKAGE,
|
1513 | |
+ krb5_principal_get_realm(kcontext, kprincipal), out);
|
1514 | |
+#endif
|
1515 | |
+ g_object_get(applet, "tgt-forwardable", &flag, NULL);
|
1516 | |
+ if (flag)
|
1517 | |
+ krb5_get_init_creds_opt_set_forwardable(out, flag);
|
1518 | |
+ g_object_get(applet, "tgt-proxiable", &flag, NULL);
|
1519 | |
+ if (flag)
|
1520 | |
+ krb5_get_init_creds_opt_set_proxiable(out, flag);
|
1521 | |
+ g_object_get(applet, "tgt-renewable", &flag, NULL);
|
1522 | |
+ if (flag) {
|
1523 | |
+ krb5_deltat r = 3600*24*30; /* 1 month */
|
1524 | |
+ krb5_get_init_creds_opt_set_renew_life (out, r);
|
1525 | |
+ }
|
1526 | |
+}
|
1527 | |
+
|
1528 | |
+
|
1529 | |
+/*
|
1530 | |
+ * set ticket options
|
1531 | |
+ * by looking at krb5.conf, the passed in creds and gconf
|
1532 | |
+ */
|
1533 | |
static void
|
1534 | |
set_options_from_creds(const KaApplet* applet,
|
1535 | |
- krb5_context context G_GNUC_UNUSED,
|
1536 | |
+ krb5_context context,
|
1537 | |
krb5_creds *in,
|
1538 | |
krb5_get_init_creds_opt *out)
|
1539 | |
{
|
1540 | |
@@ -388,8 +419,8 @@ set_options_from_creds(const KaApplet* applet,
|
1541 | |
int flag;
|
1542 | |
|
1543 | |
#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_DEFAULT_FLAGS
|
1544 | |
- krb5_get_init_creds_opt_set_default_flags(kcontext, PACKAGE,
|
1545 | |
- krb5_principal_get_realm(kcontext, kprincipal), out);
|
1546 | |
+ krb5_get_init_creds_opt_set_default_flags(context, PACKAGE,
|
1547 | |
+ krb5_principal_get_realm(context, kprincipal), out);
|
1548 | |
#endif
|
1549 | |
|
1550 | |
flag = get_cred_forwardable(in) != 0;
|
1551 | |
@@ -426,7 +457,7 @@ ka_auth_pkinit(KaApplet* applet, krb5_creds* creds, const char* pk_userid)
|
1552 | |
retval = krb5_get_init_creds_opt_alloc (kcontext, &opts);
|
1553 | |
if (retval)
|
1554 | |
goto out;
|
1555 | |
- set_options_from_creds (applet, kcontext, creds, opts);
|
1556 | |
+ ka_set_ticket_options (applet, opts);
|
1557 | |
|
1558 | |
retval = krb5_get_init_creds_opt_set_pkinit(kcontext, opts,
|
1559 | |
kprincipal,
|
1560 | |
@@ -461,7 +492,7 @@ ka_auth_password(KaApplet* applet, krb5_creds* creds)
|
1561 | |
retval = krb5_get_init_creds_opt_alloc (kcontext, &opts);
|
1562 | |
if (retval)
|
1563 | |
goto out;
|
1564 | |
- set_options_from_creds (applet, kcontext, creds, opts);
|
1565 | |
+ ka_set_ticket_options (applet, opts);
|
1566 | |
retval = krb5_get_init_creds_password(kcontext, creds, kprincipal,
|
1567 | |
NULL, auth_dialog_prompter, applet,
|
1568 | |
0, NULL, opts);
|
1569 | |
@@ -477,9 +508,7 @@ ka_parse_name(KaApplet* applet, krb5_context krbcontext, krb5_principal* kprinc)
|
1570 | |
krb5_error_code ret;
|
1571 | |
gchar *principal = NULL;
|
1572 | |
|
1573 | |
- g_object_get(applet, "principal", &principal,
|
1574 | |
- NULL);
|
1575 | |
-
|
1576 | |
+ g_object_get(applet, "principal", &principal, NULL);
|
1577 | |
ret = krb5_parse_name(krbcontext, principal,
|
1578 | |
kprinc);
|
1579 | |
|
1580 | |
@@ -773,8 +802,7 @@ ka_check_credentials (KaApplet *applet, const char* newprincipal)
|
1581 | |
int retval;
|
1582 | |
char* principal;
|
1583 | |
|
1584 | |
- g_object_get(applet, "principal", &principal,
|
1585 | |
- NULL);
|
1586 | |
+ g_object_get(applet, "principal", &principal, NULL);
|
1587 | |
|
1588 | |
if (strlen(newprincipal)) {
|
1589 | |
krb5_principal knewprinc;
|
1590 | |
@@ -817,7 +845,6 @@ gboolean
|
1591 | |
ka_grab_credentials (KaApplet* applet)
|
1592 | |
{
|
1593 | |
int retval;
|
1594 | |
- gboolean retry;
|
1595 | |
int success = FALSE;
|
1596 | |
KaPwDialog *pwdialog = ka_applet_get_pwdialog(applet);
|
1597 | |
|
1598 | |
diff --git a/src/krb5-auth-dialog.schemas.in b/src/krb5-auth-dialog.schemas.in
|
1599 | |
index 2a3a707..13b05b2 100644
|
1600 | |
--- a/src/krb5-auth-dialog.schemas.in
|
1601 | |
+++ b/src/krb5-auth-dialog.schemas.in
|
1602 | |
@@ -51,5 +51,44 @@
|
1603 | |
<long>Start prompting/displaying notifications that many minutes before expiry</long>
|
1604 | |
</locale>
|
1605 | |
</schema>
|
1606 | |
+
|
1607 | |
+ <schema>
|
1608 | |
+ <key>/schemas/apps/::PACKAGE::/forwardable</key>
|
1609 | |
+ <applyto>/apps/::PACKAGE::/forwardable</applyto>
|
1610 | |
+ <owner>::PACKAGE::</owner>
|
1611 | |
+ <type>bool</type>
|
1612 | |
+ <default>0</default>
|
1613 | |
+
|
1614 | |
+ <locale name="C">
|
1615 | |
+ <short>Forwardable ticket</short>
|
1616 | |
+ <long>Requested tickets should be forwardable</long>
|
1617 | |
+ </locale>
|
1618 | |
+ </schema>
|
1619 | |
+
|
1620 | |
+ <schema>
|
1621 | |
+ <key>/schemas/apps/::PACKAGE::/renewable</key>
|
1622 | |
+ <applyto>/apps/::PACKAGE::/renewable</applyto>
|
1623 | |
+ <owner>::PACKAGE::</owner>
|
1624 | |
+ <type>bool</type>
|
1625 | |
+ <default>0</default>
|
1626 | |
+
|
1627 | |
+ <locale name="C">
|
1628 | |
+ <short>Renewable ticket</short>
|
1629 | |
+ <long>Requested tickets should be renewable</long>
|
1630 | |
+ </locale>
|
1631 | |
+ </schema>
|
1632 | |
+
|
1633 | |
+ <schema>
|
1634 | |
+ <key>/schemas/apps/::PACKAGE::/proxiable</key>
|
1635 | |
+ <applyto>/apps/::PACKAGE::/proxiable</applyto>
|
1636 | |
+ <owner>::PACKAGE::</owner>
|
1637 | |
+ <type>bool</type>
|
1638 | |
+ <default>0</default>
|
1639 | |
+
|
1640 | |
+ <locale name="C">
|
1641 | |
+ <short>Proxiable ticket</short>
|
1642 | |
+ <long>Requested tickets should be proxiable</long>
|
1643 | |
+ </locale>
|
1644 | |
+ </schema>
|
1645 | |
</schemalist>
|
1646 | |
</gconfschemafile>
|
1647 | |
diff --git a/src/krb5-auth-gconf-tools.c b/src/krb5-auth-gconf-tools.c
|
1648 | |
new file mode 100644
|
1649 | |
index 0000000..e6541c1
|
1650 | |
--- /dev/null
|
1651 | |
+++ b/src/krb5-auth-gconf-tools.c
|
1652 | |
@@ -0,0 +1,103 @@
|
1653 | |
+/* Krb5 Auth Applet -- Acquire and release kerberos tickets
|
1654 | |
+ *
|
1655 | |
+ * (C) 2008,2009 Guido Guenther <agx@sigxcpu.org>
|
1656 | |
+ *
|
1657 | |
+ * This program is free software; you can redistribute it and/or modify
|
1658 | |
+ * it under the terms of the GNU General Public License as published by
|
1659 | |
+ * the Free Software Foundation; either version 2 of the License, or
|
1660 | |
+ * (at your option) any later version.
|
1661 | |
+ *
|
1662 | |
+ * This program is distributed in the hope that it will be useful,
|
1663 | |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
1664 | |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
1665 | |
+ * GNU General Public License for more details.
|
1666 | |
+ *
|
1667 | |
+ * You should have received a copy of the GNU General Public License
|
1668 | |
+ * along with this program; if not, write to the Free Software
|
1669 | |
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1670 | |
+ *
|
1671 | |
+ */
|
1672 | |
+#include "config.h"
|
1673 | |
+
|
1674 | |
+#include <gconf/gconf-client.h>
|
1675 | |
+#include <krb5-auth-gconf-tools.h>
|
1676 | |
+
|
1677 | |
+gboolean
|
1678 | |
+ka_gconf_get_string (GConfClient* client,
|
1679 | |
+ const char* key,
|
1680 | |
+ char** value)
|
1681 | |
+{
|
1682 | |
+ GError* error = NULL;
|
1683 | |
+ gboolean success = FALSE;
|
1684 | |
+ GConfValue* gc_value;
|
1685 | |
+
|
1686 | |
+ g_return_val_if_fail (key != NULL, FALSE);
|
1687 | |
+ g_return_val_if_fail (*value == NULL, FALSE);
|
1688 | |
+
|
1689 | |
+ if ((gc_value = gconf_client_get (client, key, &error))) {
|
1690 | |
+ if (gc_value->type == GCONF_VALUE_STRING) {
|
1691 | |
+ *value = g_strdup (gconf_value_get_string (gc_value));
|
1692 | |
+ success = TRUE;
|
1693 | |
+ } else if (error) {
|
1694 | |
+ g_print (error->message);
|
1695 | |
+ g_error_free (error);
|
1696 | |
+ }
|
1697 | |
+ gconf_value_free (gc_value);
|
1698 | |
+ }
|
1699 | |
+ return success;
|
1700 | |
+}
|
1701 | |
+
|
1702 | |
+
|
1703 | |
+gboolean
|
1704 | |
+ka_gconf_get_int (GConfClient* client,
|
1705 | |
+ const char* key,
|
1706 | |
+ int* value)
|
1707 | |
+{
|
1708 | |
+ GError* error = NULL;
|
1709 | |
+ gboolean success = FALSE;
|
1710 | |
+ GConfValue* gc_value;
|
1711 | |
+
|
1712 | |
+ g_return_val_if_fail (key != NULL, FALSE);
|
1713 | |
+ g_return_val_if_fail (value != NULL, FALSE);
|
1714 | |
+
|
1715 | |
+ if ((gc_value = gconf_client_get (client, key, &error)))
|
1716 | |
+ {
|
1717 | |
+ if (gc_value->type == GCONF_VALUE_INT) {
|
1718 | |
+ *value = gconf_value_get_int (gc_value);
|
1719 | |
+ success = TRUE;
|
1720 | |
+ } else if (error) {
|
1721 | |
+ g_print (error->message);
|
1722 | |
+ g_error_free (error);
|
1723 | |
+ }
|
1724 | |
+ gconf_value_free (gc_value);
|
1725 | |
+ }
|
1726 | |
+ return success;
|
1727 | |
+}
|
1728 | |
+
|
1729 | |
+
|
1730 | |
+gboolean
|
1731 | |
+ka_gconf_get_bool (GConfClient* client,
|
1732 | |
+ const char* key,
|
1733 | |
+ gboolean* value)
|
1734 | |
+{
|
1735 | |
+ GError* error = NULL;
|
1736 | |
+ gboolean success = FALSE;
|
1737 | |
+ GConfValue* gc_value;
|
1738 | |
+
|
1739 | |
+ g_return_val_if_fail (key != NULL, FALSE);
|
1740 | |
+ g_return_val_if_fail (value != NULL, FALSE);
|
1741 | |
+
|
1742 | |
+ if ((gc_value = gconf_client_get (client, key, &error)))
|
1743 | |
+ {
|
1744 | |
+ if (gc_value->type == GCONF_VALUE_BOOL) {
|
1745 | |
+ *value = gconf_value_get_bool (gc_value);
|
1746 | |
+ success = TRUE;
|
1747 | |
+ } else if (error) {
|
1748 | |
+ g_print (error->message);
|
1749 | |
+ g_error_free (error);
|
1750 | |
+ }
|
1751 | |
+ gconf_value_free (gc_value);
|
1752 | |
+ }
|
1753 | |
+ return success;
|
1754 | |
+}
|
1755 | |
+
|
1756 | |
diff --git a/src/krb5-auth-gconf-tools.h b/src/krb5-auth-gconf-tools.h
|
1757 | |
new file mode 100644
|
1758 | |
index 0000000..9786b2f
|
1759 | |
--- /dev/null
|
1760 | |
+++ b/src/krb5-auth-gconf-tools.h
|
1761 | |
@@ -0,0 +1,41 @@
|
1762 | |
+/* Krb5 Auth Applet -- Acquire and release kerberos tickets
|
1763 | |
+ *
|
1764 | |
+ * (C) 2008,2009 Guido Guenther <agx@sigxcpu.org>
|
1765 | |
+ *
|
1766 | |
+ * This program is free software; you can redistribute it and/or modify
|
1767 | |
+ * it under the terms of the GNU General Public License as published by
|
1768 | |
+ * the Free Software Foundation; either version 2 of the License, or
|
1769 | |
+ * (at your option) any later version.
|
1770 | |
+ *
|
1771 | |
+ * This program is distributed in the hope that it will be useful,
|
1772 | |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
1773 | |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
1774 | |
+ * GNU General Public License for more details.
|
1775 | |
+ *
|
1776 | |
+ * You should have received a copy of the GNU General Public License
|
1777 | |
+ * along with this program; if not, write to the Free Software
|
1778 | |
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1779 | |
+ *
|
1780 | |
+ */
|
1781 | |
+
|
1782 | |
+#ifndef KRB5_AUTH_GCONF_TOOLS_H
|
1783 | |
+#define KRB5_AUTH_GCONF_TOOLS_H
|
1784 | |
+
|
1785 | |
+#include "config.h"
|
1786 | |
+
|
1787 | |
+#include <gconf/gconf-client.h>
|
1788 | |
+
|
1789 | |
+#define KA_GCONF_PATH "/apps/" PACKAGE
|
1790 | |
+#define KA_GCONF_KEY_PRINCIPAL KA_GCONF_PATH "/principal"
|
1791 | |
+#define KA_GCONF_KEY_PK_USERID KA_GCONF_PATH "/pk_userid"
|
1792 | |
+#define KA_GCONF_KEY_PROMPT_MINS KA_GCONF_PATH "/prompt_minutes"
|
1793 | |
+#define KA_GCONF_KEY_SHOW_TRAYICON KA_GCONF_PATH "/show_trayicon"
|
1794 | |
+#define KA_GCONF_KEY_FORWARDABLE KA_GCONF_PATH "/forwardable"
|
1795 | |
+#define KA_GCONF_KEY_RENEWABLE KA_GCONF_PATH "/renewable"
|
1796 | |
+#define KA_GCONF_KEY_PROXIABLE KA_GCONF_PATH "/proxiable"
|
1797 | |
+
|
1798 | |
+gboolean ka_gconf_get_string (GConfClient* client, const char* key, char** value);
|
1799 | |
+gboolean ka_gconf_get_int (GConfClient* client, const char* key, int* value);
|
1800 | |
+gboolean ka_gconf_get_bool (GConfClient* client, const char* key, gboolean* value);
|
1801 | |
+
|
1802 | |
+#endif
|
1803 | |
diff --git a/src/krb5-auth-gconf.c b/src/krb5-auth-gconf.c
|
1804 | |
index 1481591..25eb555 100644
|
1805 | |
--- a/src/krb5-auth-gconf.c
|
1806 | |
+++ b/src/krb5-auth-gconf.c
|
1807 | |
@@ -22,94 +22,9 @@
|
1808 | |
#include <gconf/gconf-client.h>
|
1809 | |
|
1810 | |
#include "krb5-auth-applet.h"
|
1811 | |
+#include "krb5-auth-gconf-tools.h"
|
1812 | |
#include "krb5-auth-gconf.h"
|
1813 | |
|
1814 | |
-#define KA_GCONF_PATH "/apps/" PACKAGE
|
1815 | |
-#define KA_GCONF_KEY_PRINCIPAL KA_GCONF_PATH "/principal"
|
1816 | |
-#define KA_GCONF_KEY_PK_USERID KA_GCONF_PATH "/pk_userid"
|
1817 | |
-#define KA_GCONF_KEY_PROMPT_MINS KA_GCONF_PATH "/prompt_minutes"
|
1818 | |
-#define KA_GCONF_KEY_SHOW_TRAYICON KA_GCONF_PATH "/show_trayicon"
|
1819 | |
-
|
1820 | |
-static gboolean
|
1821 | |
-ka_gconf_get_string (GConfClient* client,
|
1822 | |
- const char* key,
|
1823 | |
- char** value)
|
1824 | |
-{
|
1825 | |
- GError* error = NULL;
|
1826 | |
- gboolean success = FALSE;
|
1827 | |
- GConfValue* gc_value;
|
1828 | |
-
|
1829 | |
- g_return_val_if_fail (key != NULL, FALSE);
|
1830 | |
- g_return_val_if_fail (*value == NULL, FALSE);
|
1831 | |
-
|
1832 | |
- if ((gc_value = gconf_client_get (client, key, &error))) {
|
1833 | |
- if (gc_value->type == GCONF_VALUE_STRING) {
|
1834 | |
- *value = g_strdup (gconf_value_get_string (gc_value));
|
1835 | |
- success = TRUE;
|
1836 | |
- } else if (error) {
|
1837 | |
- g_print (error->message);
|
1838 | |
- g_error_free (error);
|
1839 | |
- }
|
1840 | |
- gconf_value_free (gc_value);
|
1841 | |
- }
|
1842 | |
- return success;
|
1843 | |
-}
|
1844 | |
-
|
1845 | |
-
|
1846 | |
-static gboolean
|
1847 | |
-ka_gconf_get_int (GConfClient* client,
|
1848 | |
- const char* key,
|
1849 | |
- int* value)
|
1850 | |
-{
|
1851 | |
- GError* error = NULL;
|
1852 | |
- gboolean success = FALSE;
|
1853 | |
- GConfValue* gc_value;
|
1854 | |
-
|
1855 | |
- g_return_val_if_fail (key != NULL, FALSE);
|
1856 | |
- g_return_val_if_fail (value != NULL, FALSE);
|
1857 | |
-
|
1858 | |
- if ((gc_value = gconf_client_get (client, key, &error)))
|
1859 | |
- {
|
1860 | |
- if (gc_value->type == GCONF_VALUE_INT) {
|
1861 | |
- *value = gconf_value_get_int (gc_value);
|
1862 | |
- success = TRUE;
|
1863 | |
- } else if (error) {
|
1864 | |
- g_print (error->message);
|
1865 | |
- g_error_free (error);
|
1866 | |
- }
|
1867 | |
- gconf_value_free (gc_value);
|
1868 | |
- }
|
1869 | |
- return success;
|
1870 | |
-}
|
1871 | |
-
|
1872 | |
-
|
1873 | |
-static gboolean
|
1874 | |
-ka_gconf_get_bool (GConfClient* client,
|
1875 | |
- const char* key,
|
1876 | |
- gboolean* value)
|
1877 | |
-{
|
1878 | |
- GError* error = NULL;
|
1879 | |
- gboolean success = FALSE;
|
1880 | |
- GConfValue* gc_value;
|
1881 | |
-
|
1882 | |
- g_return_val_if_fail (key != NULL, FALSE);
|
1883 | |
- g_return_val_if_fail (value != NULL, FALSE);
|
1884 | |
-
|
1885 | |
- if ((gc_value = gconf_client_get (client, key, &error)))
|
1886 | |
- {
|
1887 | |
- if (gc_value->type == GCONF_VALUE_BOOL) {
|
1888 | |
- *value = gconf_value_get_bool (gc_value);
|
1889 | |
- success = TRUE;
|
1890 | |
- } else if (error) {
|
1891 | |
- g_print (error->message);
|
1892 | |
- g_error_free (error);
|
1893 | |
- }
|
1894 | |
- gconf_value_free (gc_value);
|
1895 | |
- }
|
1896 | |
- return success;
|
1897 | |
-}
|
1898 | |
-
|
1899 | |
-
|
1900 | |
static gboolean
|
1901 | |
ka_gconf_set_principal (GConfClient* client, KaApplet* applet)
|
1902 | |
{
|
1903 | |
@@ -164,6 +79,45 @@ ka_gconf_set_show_trayicon (GConfClient* client, KaApplet* applet)
|
1904 | |
}
|
1905 | |
|
1906 | |
|
1907 | |
+static gboolean
|
1908 | |
+ka_gconf_set_tgt_forwardable (GConfClient* client, KaApplet* applet)
|
1909 | |
+{
|
1910 | |
+ gboolean forwardable = FALSE;
|
1911 | |
+
|
1912 | |
+ if(!ka_gconf_get_bool(client, KA_GCONF_KEY_FORWARDABLE, &forwardable)) {
|
1913 | |
+ forwardable = TRUE;
|
1914 | |
+ }
|
1915 | |
+ g_object_set(applet, "tgt-forwardable", forwardable, NULL);
|
1916 | |
+ return TRUE;
|
1917 | |
+}
|
1918 | |
+
|
1919 | |
+
|
1920 | |
+static gboolean
|
1921 | |
+ka_gconf_set_tgt_renewable (GConfClient* client, KaApplet* applet)
|
1922 | |
+{
|
1923 | |
+ gboolean renewable = FALSE;
|
1924 | |
+
|
1925 | |
+ if(!ka_gconf_get_bool(client, KA_GCONF_KEY_RENEWABLE, &renewable)) {
|
1926 | |
+ renewable = TRUE;
|
1927 | |
+ }
|
1928 | |
+ g_object_set(applet, "tgt-renewable", renewable, NULL);
|
1929 | |
+ return TRUE;
|
1930 | |
+}
|
1931 | |
+
|
1932 | |
+
|
1933 | |
+static gboolean
|
1934 | |
+ka_gconf_set_tgt_proxiable (GConfClient* client, KaApplet* applet)
|
1935 | |
+{
|
1936 | |
+ gboolean proxiable = FALSE;
|
1937 | |
+
|
1938 | |
+ if(!ka_gconf_get_bool(client, KA_GCONF_KEY_PROXIABLE, &proxiable)) {
|
1939 | |
+ proxiable = TRUE;
|
1940 | |
+ }
|
1941 | |
+ g_object_set(applet, "tgt-proxiable", proxiable, NULL);
|
1942 | |
+ return TRUE;
|
1943 | |
+}
|
1944 | |
+
|
1945 | |
+
|
1946 | |
static void
|
1947 | |
ka_gconf_key_changed_callback (GConfClient* client,
|
1948 | |
guint cnxn_id G_GNUC_UNUSED,
|
1949 | |
@@ -186,6 +140,12 @@ ka_gconf_key_changed_callback (GConfClient* client,
|
1950 | |
ka_gconf_set_show_trayicon (client, applet);
|
1951 | |
} else if (g_strcmp0 (key, KA_GCONF_KEY_PK_USERID) == 0) {
|
1952 | |
ka_gconf_set_pk_userid (client, applet);
|
1953 | |
+ } else if (g_strcmp0 (key, KA_GCONF_KEY_FORWARDABLE) == 0) {
|
1954 | |
+ ka_gconf_set_tgt_forwardable (client, applet);
|
1955 | |
+ } else if (g_strcmp0 (key, KA_GCONF_KEY_RENEWABLE) == 0) {
|
1956 | |
+ ka_gconf_set_tgt_renewable (client, applet);
|
1957 | |
+ } else if (g_strcmp0 (key, KA_GCONF_KEY_PROXIABLE) == 0) {
|
1958 | |
+ ka_gconf_set_tgt_proxiable (client, applet);
|
1959 | |
} else
|
1960 | |
g_warning("Received notification for unknown gconf key %s", key);
|
1961 | |
return;
|
1962 | |
@@ -216,6 +176,9 @@ ka_gconf_init (KaApplet* applet,
|
1963 | |
ka_gconf_set_prompt_mins (client, applet);
|
1964 | |
ka_gconf_set_show_trayicon (client, applet);
|
1965 | |
ka_gconf_set_pk_userid(client, applet);
|
1966 | |
+ ka_gconf_set_tgt_forwardable(client, applet);
|
1967 | |
+ ka_gconf_set_tgt_renewable(client, applet);
|
1968 | |
+ ka_gconf_set_tgt_proxiable(client, applet);
|
1969 | |
|
1970 | |
success = TRUE;
|
1971 | |
out:
|
1972 | |
--
|