aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2009-06-15 18:18:33 +0200
committerGuido Günther <agx@sigxcpu.org>2009-06-15 18:18:33 +0200
commit27053b1befc8380404f76c2c03c08eb3a7b0692d (patch)
tree10a748b4785cce56ed4b272844003611a489cc38 /src
parentImported Upstream version 0.10 (diff)
downloadkrb5-auth-dialog-27053b1befc8380404f76c2c03c08eb3a7b0692d.tar.gz
krb5-auth-dialog-27053b1befc8380404f76c2c03c08eb3a7b0692d.tar.bz2
krb5-auth-dialog-27053b1befc8380404f76c2c03c08eb3a7b0692d.zip
Imported Upstream version 0.11
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am4
-rw-r--r--src/Makefile.in27
-rw-r--r--src/dummy-strings.c5
-rw-r--r--src/krb5-auth-applet-dbus.xml5
-rw-r--r--src/krb5-auth-applet.c131
-rw-r--r--src/krb5-auth-applet.h2
-rw-r--r--src/krb5-auth-dbus.c22
-rw-r--r--src/krb5-auth-dbus.h2
-rw-r--r--src/krb5-auth-dialog.c30
-rw-r--r--src/krb5-auth-dialog.h2
-rw-r--r--src/krb5-auth-dialog.xml2
-rw-r--r--src/krb5-auth-tools.c58
-rw-r--r--src/krb5-auth-tools.h33
13 files changed, 274 insertions, 49 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index ed10e3f..cd016d3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -33,6 +33,8 @@ krb5_auth_dialog_SOURCES = \
krb5-auth-gconf-tools.h \
krb5-auth-dbus.c \
krb5-auth-dbus.h \
+ krb5-auth-tools.c \
+ krb5-auth-tools.h \
dummy-strings.c \
$(NULL)
@@ -40,7 +42,9 @@ krb5_auth_dialog_CPPFLAGS = \
-I$(top_srcdir)/gtksecentry \
-I$(top_srcdir)/secmem \
-DKA_DATA_DIR=\""$(pkgdatadir)"\" \
+ -DDATA_DIR=\""$(datadir)"\" \
-DLOCALE_DIR=\""$(localedir)/"\" \
+ -DBIN_DIR=\""$(bindir)/"\" \
$(AM_CPPFLAGS) \
$(NULL)
diff --git a/src/Makefile.in b/src/Makefile.in
index ff0bf8c..f3bb497 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -38,7 +38,8 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/krb5-auth-dialog.1.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/m4/compiler-flags.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/compiler-flags.m4 \
+ $(top_srcdir)/m4/gnome-doc-utils.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -57,6 +58,7 @@ am_krb5_auth_dialog_OBJECTS = \
krb5_auth_dialog-krb5-auth-gconf.$(OBJEXT) \
krb5_auth_dialog-krb5-auth-gconf-tools.$(OBJEXT) \
krb5_auth_dialog-krb5-auth-dbus.$(OBJEXT) \
+ krb5_auth_dialog-krb5-auth-tools.$(OBJEXT) \
krb5_auth_dialog-dummy-strings.$(OBJEXT) $(am__objects_1)
krb5_auth_dialog_OBJECTS = $(am_krb5_auth_dialog_OBJECTS)
am__DEPENDENCIES_1 =
@@ -125,6 +127,8 @@ DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@
+DOC_USER_FORMATS = @DOC_USER_FORMATS@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -148,6 +152,7 @@ GMSGFMT = @GMSGFMT@
GREP = @GREP@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
+HELP_DIR = @HELP_DIR@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -189,6 +194,7 @@ NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OMF_DIR = @OMF_DIR@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
@@ -294,6 +300,8 @@ krb5_auth_dialog_SOURCES = \
krb5-auth-gconf-tools.h \
krb5-auth-dbus.c \
krb5-auth-dbus.h \
+ krb5-auth-tools.c \
+ krb5-auth-tools.h \
dummy-strings.c \
$(NULL)
@@ -301,7 +309,9 @@ krb5_auth_dialog_CPPFLAGS = \
-I$(top_srcdir)/gtksecentry \
-I$(top_srcdir)/secmem \
-DKA_DATA_DIR=\""$(pkgdatadir)"\" \
+ -DDATA_DIR=\""$(datadir)"\" \
-DLOCALE_DIR=\""$(localedir)/"\" \
+ -DBIN_DIR=\""$(bindir)/"\" \
$(AM_CPPFLAGS) \
$(NULL)
@@ -439,6 +449,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/krb5_auth_dialog-krb5-auth-gconf-tools.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/krb5_auth_dialog-krb5-auth-gconf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/krb5_auth_dialog-krb5-auth-pwdialog.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/krb5_auth_dialog-krb5-auth-tools.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -545,6 +556,20 @@ krb5_auth_dialog-krb5-auth-dbus.obj: krb5-auth-dbus.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(krb5_auth_dialog_CPPFLAGS) $(CPPFLAGS) $(krb5_auth_dialog_CFLAGS) $(CFLAGS) -c -o krb5_auth_dialog-krb5-auth-dbus.obj `if test -f 'krb5-auth-dbus.c'; then $(CYGPATH_W) 'krb5-auth-dbus.c'; else $(CYGPATH_W) '$(srcdir)/krb5-auth-dbus.c'; fi`
+krb5_auth_dialog-krb5-auth-tools.o: krb5-auth-tools.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(krb5_auth_dialog_CPPFLAGS) $(CPPFLAGS) $(krb5_auth_dialog_CFLAGS) $(CFLAGS) -MT krb5_auth_dialog-krb5-auth-tools.o -MD -MP -MF $(DEPDIR)/krb5_auth_dialog-krb5-auth-tools.Tpo -c -o krb5_auth_dialog-krb5-auth-tools.o `test -f 'krb5-auth-tools.c' || echo '$(srcdir)/'`krb5-auth-tools.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/krb5_auth_dialog-krb5-auth-tools.Tpo $(DEPDIR)/krb5_auth_dialog-krb5-auth-tools.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='krb5-auth-tools.c' object='krb5_auth_dialog-krb5-auth-tools.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(krb5_auth_dialog_CPPFLAGS) $(CPPFLAGS) $(krb5_auth_dialog_CFLAGS) $(CFLAGS) -c -o krb5_auth_dialog-krb5-auth-tools.o `test -f 'krb5-auth-tools.c' || echo '$(srcdir)/'`krb5-auth-tools.c
+
+krb5_auth_dialog-krb5-auth-tools.obj: krb5-auth-tools.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(krb5_auth_dialog_CPPFLAGS) $(CPPFLAGS) $(krb5_auth_dialog_CFLAGS) $(CFLAGS) -MT krb5_auth_dialog-krb5-auth-tools.obj -MD -MP -MF $(DEPDIR)/krb5_auth_dialog-krb5-auth-tools.Tpo -c -o krb5_auth_dialog-krb5-auth-tools.obj `if test -f 'krb5-auth-tools.c'; then $(CYGPATH_W) 'krb5-auth-tools.c'; else $(CYGPATH_W) '$(srcdir)/krb5-auth-tools.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/krb5_auth_dialog-krb5-auth-tools.Tpo $(DEPDIR)/krb5_auth_dialog-krb5-auth-tools.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='krb5-auth-tools.c' object='krb5_auth_dialog-krb5-auth-tools.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(krb5_auth_dialog_CPPFLAGS) $(CPPFLAGS) $(krb5_auth_dialog_CFLAGS) $(CFLAGS) -c -o krb5_auth_dialog-krb5-auth-tools.obj `if test -f 'krb5-auth-tools.c'; then $(CYGPATH_W) 'krb5-auth-tools.c'; else $(CYGPATH_W) '$(srcdir)/krb5-auth-tools.c'; fi`
+
krb5_auth_dialog-dummy-strings.o: dummy-strings.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(krb5_auth_dialog_CPPFLAGS) $(CPPFLAGS) $(krb5_auth_dialog_CFLAGS) $(CFLAGS) -MT krb5_auth_dialog-dummy-strings.o -MD -MP -MF $(DEPDIR)/krb5_auth_dialog-dummy-strings.Tpo -c -o krb5_auth_dialog-dummy-strings.o `test -f 'dummy-strings.c' || echo '$(srcdir)/'`dummy-strings.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/krb5_auth_dialog-dummy-strings.Tpo $(DEPDIR)/krb5_auth_dialog-dummy-strings.Po
diff --git a/src/dummy-strings.c b/src/dummy-strings.c
index b5009ad..7f8bbee 100644
--- a/src/dummy-strings.c
+++ b/src/dummy-strings.c
@@ -1,7 +1,12 @@
/* Generated by hand via "cd etpo; make update-etpo" from /tmp/krb5-1.6.dfsg.4~beta1/ */
#include <glib/gi18n.h>
+
const char *dummy[] = {
+ /* Translators: files from dummy-strings.c are *all* possible errors
+ returned from Kerberos (since Kerberos itself doesn't handle i18n). If in
+ doubt please translate strings from files starting with krb5-auth
+ first since these are the ones the user will see in any case. */
N_("ASN.1 failed call to system time library"), /* asn1_err.et:asn1:ASN1_BAD_TIMEFORMAT */
N_("ASN.1 structure is missing a required field"), /* asn1_err.et:asn1:ASN1_MISSING_FIELD */
N_("ASN.1 unexpected field number"), /* asn1_err.et:asn1:ASN1_MISPLACED_FIELD */
diff --git a/src/krb5-auth-applet-dbus.xml b/src/krb5-auth-applet-dbus.xml
index eeb151d..c96126c 100644
--- a/src/krb5-auth-applet-dbus.xml
+++ b/src/krb5-auth-applet-dbus.xml
@@ -9,6 +9,11 @@
<arg type="s" name="principal" direction="in" />
<arg type="b" name="success" direction="out"/>
</method>
+ <method name="destroyCCache">
+ <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="ka_dbus_destroy_ccache"/>
+ <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
+ <arg type="b" name="success" direction="out"/>
+ </method>
</interface>
</node>
diff --git a/src/krb5-auth-applet.c b/src/krb5-auth-applet.c
index 5a8975c..d59dac8 100644
--- a/src/krb5-auth-applet.c
+++ b/src/krb5-auth-applet.c
@@ -26,6 +26,7 @@
#include "krb5-auth-dialog.h"
#include "krb5-auth-gconf-tools.h"
#include "krb5-auth-gconf.h"
+#include "krb5-auth-tools.h"
#ifdef HAVE_LIBNOTIFY
#include <libnotify/notify.h>
#endif
@@ -65,6 +66,7 @@ G_DEFINE_TYPE(KaApplet, ka_applet, G_TYPE_OBJECT);
struct _KaAppletPrivate
{
+ GtkBuilder *uixml;
GtkStatusIcon* tray_icon; /* the tray icon */
GtkWidget* context_menu; /* the tray icon's context menu */
const char* icons[3]; /* for invalid, expiring and valid tickts */
@@ -210,6 +212,10 @@ ka_applet_dispose(GObject* object)
g_object_unref(applet->priv->pwdialog);
applet->priv->pwdialog = NULL;
}
+ if (applet->priv->uixml) {
+ g_object_unref(applet->priv->uixml);
+ applet->priv->uixml = NULL;
+ }
if (parent_class->dispose != NULL)
parent_class->dispose (object);
@@ -344,6 +350,7 @@ ka_applet_tooltip_text(int remaining)
if (remaining >= 3600) {
hours = remaining / 3600;
minutes = (remaining % 3600) / 60;
+ /* Translators: First number is hours, second number is minutes */
tooltip_text = g_strdup_printf (_("Your credentials expire in %.2d:%.2dh"), hours, minutes);
} else {
minutes = remaining / 60;
@@ -429,7 +436,7 @@ ka_send_event_notification (KaApplet *applet,
g_object_unref (applet->priv->notification);
}
- notify_icon = icon ? icon : "gtk-dialog-authentication";
+ notify_icon = icon ? icon : "krb-valid-ticket";
applet->priv->notification = \
notify_notification_new_with_status_icon(summary,
@@ -479,7 +486,8 @@ ka_applet_update_status(KaApplet* applet, krb5_timestamp expiry)
ka_send_event_notification (applet,
_("Network credentials valid"),
_("You've refreshed your Kerberos credentials."),
- NULL, "dont-show-again");
+ "krb-valid-ticket",
+ "dont-show-again");
}
expiry_notified = FALSE;
} else if (remaining < applet->priv->pw_prompt_secs && (now - last_warn) > NOTIFY_SECONDS &&
@@ -492,7 +500,8 @@ ka_applet_update_status(KaApplet* applet, krb5_timestamp expiry)
ka_send_event_notification (applet,
_("Network credentials expiring"),
tooltip_text,
- NULL, "dont-show-again");
+ "krb-expiring-ticket",
+ "dont-show-again");
}
last_warn = now;
}
@@ -506,7 +515,8 @@ ka_applet_update_status(KaApplet* applet, krb5_timestamp expiry)
ka_send_event_notification (applet,
_("Network credentials expired"),
_("Your Kerberos credentails have expired."),
- NULL, "dont-show-again");
+ "krb-no-valid-ticket",
+ "dont-show-again");
}
expiry_notified = TRUE;
last_warn = 0;
@@ -534,7 +544,9 @@ static void
ka_applet_cb_preferences (GtkWidget* menuitem G_GNUC_UNUSED,
gpointer user_data G_GNUC_UNUSED)
{
- g_spawn_command_line_async ("krb5-auth-dialog-preferences", NULL);
+ g_spawn_command_line_async (BIN_DIR
+ G_DIR_SEPARATOR_S
+ "krb5-auth-dialog-preferences", NULL);
}
@@ -550,23 +562,81 @@ ka_applet_cb_quit (GtkMenuItem* menuitem G_GNUC_UNUSED, gpointer user_data)
static void
+ka_about_dialog_url_hook (GtkAboutDialog *about,
+ const gchar *alink,
+ gpointer data G_GNUC_UNUSED)
+{
+ GError *error = NULL;
+
+ gtk_show_uri(gtk_window_get_screen (GTK_WINDOW (about)),
+ alink, gtk_get_current_event_time(), &error);
+
+ if (error) {
+ GtkWidget *message_dialog;
+
+ message_dialog = gtk_message_dialog_new (GTK_WINDOW (about),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ _("There was an error displaying %s:\n%s"),
+ alink, 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_applet_cb_about_dialog (GtkMenuItem* menuitem G_GNUC_UNUSED,
gpointer user_data G_GNUC_UNUSED)
{
- const gchar* authors[] = { "Christopher Aillon <caillon@redhat.com>",
- "Colin Walters <walters@verbum.org>",
- "Guido Günther <agx@sigxpcu.org>",
- NULL };
+ const gchar* authors[] = {
+ "Christopher Aillon <caillon@redhat.com>",
+ "Jonathan Blandford <jrb@redhat.com>",
+ "Colin Walters <walters@verbum.org>",
+ "Guido Günther <agx@sigxpcu.org>",
+ NULL };
+
+ gtk_about_dialog_set_url_hook (ka_about_dialog_url_hook, NULL, NULL);
gtk_show_about_dialog (NULL,
"authors", authors,
"version", VERSION,
+ "logo-icon-name", "krb-valid-ticket",
"copyright",
- "Copyright (C) 2004,2005,2006 Red Hat, Inc.,\n"
- "2008,2009 Guido Günther",
+ "Copyright (C) 2004,2005,2006 Red Hat, Inc.,\n"
+ "2008,2009 Guido Günther",
+ "website-label", PACKAGE " website",
+ "website", "https://honk.sigxcpu.org/piki/projects/krb5-auth-dialog/",
+ "license", "GNU General Public License Version 2",
+ "translator-credits", _("translator-credits"),
NULL);
}
+static void
+ka_applet_cb_show_help (GtkMenuItem* menuitem G_GNUC_UNUSED,
+ gpointer user_data)
+{
+ KaApplet *applet = KA_APPLET(user_data);
+
+ ka_show_help (gtk_status_icon_get_screen(applet->priv->tray_icon), NULL, NULL);
+}
+
+
+static void
+ka_applet_cb_destroy_ccache(GtkMenuItem* menuitem G_GNUC_UNUSED,
+ gpointer user_data)
+{
+ KaApplet *applet = KA_APPLET(user_data);
+ ka_destroy_ccache(applet);
+}
+
+
/* The tray icon's context menu */
static gboolean
ka_applet_create_context_menu (KaApplet* applet)
@@ -579,7 +649,8 @@ ka_applet_create_context_menu (KaApplet* applet)
/* kdestroy */
menu_item = gtk_image_menu_item_new_with_mnemonic (_("Remove Credentials _Cache"));
- g_signal_connect (G_OBJECT (menu_item), "activate", G_CALLBACK (ka_destroy_cache), applet);
+ g_signal_connect (G_OBJECT (menu_item), "activate",
+ G_CALLBACK (ka_applet_cb_destroy_ccache), applet);
image = gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
@@ -587,27 +658,29 @@ ka_applet_create_context_menu (KaApplet* applet)
ka_applet_menu_add_separator_item (menu);
/* Preferences */
- menu_item = gtk_image_menu_item_new_with_mnemonic (_("_Preferences"));
- g_signal_connect (G_OBJECT (menu_item), "activate", G_CALLBACK (ka_applet_cb_preferences), applet);
- image = gtk_image_new_from_stock (GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image);
+ menu_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_PREFERENCES, NULL);
+ g_signal_connect (G_OBJECT (menu_item), "activate",
+ G_CALLBACK (ka_applet_cb_preferences), applet);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
+ /* About item */
+ menu_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_HELP, NULL);
+ g_signal_connect (G_OBJECT (menu_item), "activate",
+ G_CALLBACK (ka_applet_cb_show_help), applet);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
/* About item */
- menu_item = gtk_image_menu_item_new_with_mnemonic (_("_About"));
- g_signal_connect (G_OBJECT (menu_item), "activate", G_CALLBACK (ka_applet_cb_about_dialog), applet);
- image = gtk_image_new_from_stock (GTK_STOCK_ABOUT, GTK_ICON_SIZE_MENU);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image);
+ menu_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ABOUT, NULL);
+ g_signal_connect (G_OBJECT (menu_item), "activate",
+ G_CALLBACK (ka_applet_cb_about_dialog), applet);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
ka_applet_menu_add_separator_item (menu);
/* Quit */
- menu_item = gtk_image_menu_item_new_with_mnemonic (_("_Quit"));
- g_signal_connect (G_OBJECT (menu_item), "activate", G_CALLBACK (ka_applet_cb_quit), applet);
- image = gtk_image_new_from_stock (GTK_STOCK_QUIT, GTK_ICON_SIZE_MENU);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image);
+ menu_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, NULL);
+ g_signal_connect (G_OBJECT (menu_item), "activate",
+ G_CALLBACK (ka_applet_cb_quit), applet);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
gtk_widget_show_all (menu);
@@ -680,7 +753,7 @@ ka_applet_setup_icons (KaApplet* applet)
{
/* Add application specific icons to search path */
gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
- KA_DATA_DIR G_DIR_SEPARATOR_S "icons");
+ DATA_DIR G_DIR_SEPARATOR_S "icons");
applet->priv->icons[val_icon] = "krb-valid-ticket";
applet->priv->icons[exp_icon] = "krb-expiring-ticket";
applet->priv->icons[inv_icon] = "krb-no-valid-ticket";
@@ -719,7 +792,7 @@ ka_applet_get_pwdialog(const KaApplet* applet)
/* create the tray icon applet */
KaApplet*
-ka_applet_create(GtkBuilder *xml)
+ka_applet_create()
{
KaApplet* applet = ka_applet_new();
@@ -733,7 +806,11 @@ ka_applet_create(GtkBuilder *xml)
g_signal_connect (applet, "notify::show-trayicon",
G_CALLBACK (ka_applet_cb_show_trayicon), NULL);
- applet->priv->pwdialog = ka_pwdialog_create(xml);
+ applet->priv->uixml = gtk_builder_new();
+ g_assert(gtk_builder_add_from_file(applet->priv->uixml,
+ KA_DATA_DIR G_DIR_SEPARATOR_S
+ PACKAGE ".xml", NULL));
+ applet->priv->pwdialog = ka_pwdialog_create(applet->priv->uixml);
g_return_val_if_fail (applet->priv->pwdialog != NULL, NULL);
applet->priv->gconf = ka_gconf_init (applet);
diff --git a/src/krb5-auth-applet.h b/src/krb5-auth-applet.h
index 9f2dcf1..35679bc 100644
--- a/src/krb5-auth-applet.h
+++ b/src/krb5-auth-applet.h
@@ -56,7 +56,7 @@ guint ka_applet_get_pw_prompt_secs(const KaApplet* applet);
KaPwDialog* ka_applet_get_pwdialog(const KaApplet* applet);
/* create the applet */
-KaApplet* ka_applet_create(GtkBuilder* xml);
+KaApplet* ka_applet_create(void);
/* update tooltip and icon */
int ka_applet_update_status(KaApplet* applet, krb5_timestamp expiry);
diff --git a/src/krb5-auth-dbus.c b/src/krb5-auth-dbus.c
index 52dab46..4fd7e74 100644
--- a/src/krb5-auth-dbus.c
+++ b/src/krb5-auth-dbus.c
@@ -32,12 +32,24 @@ gboolean
ka_dbus_acquire_tgt (KaApplet *applet,
const gchar *principal, DBusGMethodInvocation *context)
{
- gboolean success;
+ gboolean success;
- KA_DEBUG("Getting TGT for '%s'", principal);
- success = ka_check_credentials(applet, principal);
- dbus_g_method_return(context, success);
- return TRUE;
+ KA_DEBUG("Getting TGT for '%s'", principal);
+ success = ka_check_credentials(applet, principal);
+ dbus_g_method_return(context, success);
+ return TRUE;
+}
+
+
+gboolean
+ka_dbus_destroy_ccache(KaApplet* applet, DBusGMethodInvocation *context)
+{
+ gboolean success;
+
+ KA_DEBUG("Destroying ticket cache");
+ success = ka_destroy_ccache (applet);
+ dbus_g_method_return(context, success);
+ return TRUE;
}
diff --git a/src/krb5-auth-dbus.h b/src/krb5-auth-dbus.h
index 2f0af61..0d3acd0 100644
--- a/src/krb5-auth-dbus.h
+++ b/src/krb5-auth-dbus.h
@@ -31,5 +31,7 @@ gboolean ka_dbus_service(KaApplet* applet);
gboolean ka_dbus_acquire_tgt (KaApplet *applet,
const gchar *principal,
DBusGMethodInvocation *context);
+gboolean ka_dbus_destroy_ccache(KaApplet* applet,
+ DBusGMethodInvocation *context);
#endif /* KRB5_AUTH_DBUS_H */
diff --git a/src/krb5-auth-dialog.c b/src/krb5-auth-dialog.c
index 56a3a8c..f163cd7 100644
--- a/src/krb5-auth-dialog.c
+++ b/src/krb5-auth-dialog.c
@@ -40,6 +40,7 @@
#include "krb5-auth-applet.h"
#include "krb5-auth-pwdialog.h"
#include "krb5-auth-dbus.h"
+#include "krb5-auth-tools.h"
#ifdef ENABLE_NETWORK_MANAGER
#include <libnm_glib.h>
@@ -49,6 +50,8 @@
# include <hx509_err.h>
#endif
+#define KA_NAME _("Network Authentication")
+
static krb5_context kcontext;
static krb5_principal kprincipal;
static krb5_timestamp creds_expiry;
@@ -784,11 +787,9 @@ using_krb5(void)
}
-void
-ka_destroy_cache (GtkMenuItem *menuitem G_GNUC_UNUSED,
- gpointer data)
+gboolean
+ka_destroy_ccache (KaApplet *applet)
{
- KaApplet *applet = KA_APPLET(data);
krb5_ccache ccache;
const char* cache;
krb5_error_code ret;
@@ -798,18 +799,26 @@ ka_destroy_cache (GtkMenuItem *menuitem G_GNUC_UNUSED,
ret = krb5_cc_destroy (kcontext, ccache);
credentials_expiring_real(applet);
+
+ if (ret)
+ return FALSE;
+ else
+ return TRUE;
}
static void
ka_error_dialog(int err)
{
- const char* msg = get_error_message(kcontext, err);
+ const char *msg = get_error_message(kcontext, err);
GtkWidget *dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
- _("Couldn't acquire kerberos ticket: '%s'"), _(msg));
+ "%s", KA_NAME);
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ _("Couldn't acquire kerberos ticket: '%s'"),
+ _(msg));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
@@ -939,7 +948,6 @@ main (int argc, char *argv[])
KaApplet *applet;
GOptionContext *context;
GError *error = NULL;
- GtkBuilder *xml;
guint status = 0;
gboolean run_auto = FALSE, run_always = FALSE;
@@ -976,12 +984,9 @@ main (int argc, char *argv[])
always_run = TRUE;
}
if (using_krb5 () || always_run) {
- g_set_application_name (_("Network Authentication"));
+ g_set_application_name (KA_NAME);
- xml = gtk_builder_new();
- g_assert(gtk_builder_add_from_file(xml, KA_DATA_DIR G_DIR_SEPARATOR_S
- PACKAGE ".xml", NULL));
- applet = ka_applet_create (xml);
+ applet = ka_applet_create ();
if (!applet)
return 1;
ka_nm_init();
@@ -992,7 +997,6 @@ main (int argc, char *argv[])
}
ka_dbus_service(applet);
gtk_main ();
- g_object_unref(xml);
}
return 0;
}
diff --git a/src/krb5-auth-dialog.h b/src/krb5-auth-dialog.h
index 3e1219d..814f617 100644
--- a/src/krb5-auth-dialog.h
+++ b/src/krb5-auth-dialog.h
@@ -23,7 +23,7 @@
#include "krb5-auth-applet.h"
-void ka_destroy_cache (GtkMenuItem *menuitem, gpointer user_data);
+gboolean ka_destroy_ccache (KaApplet* applet);
gboolean ka_grab_credentials(KaApplet* applet);
gboolean ka_check_credentials (KaApplet *applet, const char* principal);
int ka_tgt_valid_seconds(void);
diff --git a/src/krb5-auth-dialog.xml b/src/krb5-auth-dialog.xml
index 3f58588..792b389 100644
--- a/src/krb5-auth-dialog.xml
+++ b/src/krb5-auth-dialog.xml
@@ -21,7 +21,7 @@
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="yalign">0</property>
- <property name="stock">gtk-dialog-authentication</property>
+ <property name="icon_name">krb-valid-ticket</property>
<property name="icon-size">6</property>
</object>
<packing>
diff --git a/src/krb5-auth-tools.c b/src/krb5-auth-tools.c
new file mode 100644
index 0000000..3b0cbd4
--- /dev/null
+++ b/src/krb5-auth-tools.c
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+
+#include <glib/gi18n.h>
+#include "krb5-auth-tools.h"
+
+void
+ka_show_help (GdkScreen* screen, const char* chapter, GtkWindow* window)
+{
+ GError *error = NULL;
+ const char *section = "";
+ char *url;
+
+ if (chapter)
+ section = chapter;
+
+ url = g_strdup_printf("ghelp:krb5-auth-dialog%s", section);
+
+ gtk_show_uri (screen, url, gtk_get_current_event_time (), &error);
+
+ if (error) {
+ GtkWidget *message_dialog;
+
+ message_dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+ 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);
+ }
+ g_free (url);
+}
+
diff --git a/src/krb5-auth-tools.h b/src/krb5-auth-tools.h
new file mode 100644
index 0000000..ef777e6
--- /dev/null
+++ b/src/krb5-auth-tools.h
@@ -0,0 +1,33 @@
+/* Krb5 Auth Applet -- Acquire and release kerberos tickets
+ *
+ * (C) 2009 Guido Guenther <agx@sigxcpu.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, 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.
+ *
+ */
+
+#ifndef KRB5_AUTH_TOOLS
+#define KRB5_AUTH_TOOLS
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+void ka_show_help (GdkScreen* screen, const char* section, GtkWindow* window);
+
+G_END_DECLS
+
+#endif
+
bgstack15