[krb5-auth-dialog] enable help in applet and prefs dialog
- From: Guido Günther <guidog src gnome org>
- To: svn-commits-list gnome org
- Subject: [krb5-auth-dialog] enable help in applet and prefs dialog
- Date: Tue, 2 Jun 2009 17:03:38 -0400 (EDT)
commit 5a338d29dc08867b277de20efd3d9edd8171d1a1
Author: Guido Günther <agx sigxcpu org>
Date: Fri May 29 18:37:39 2009 +0200
enable help in applet and prefs dialog
---
ChangeLog | 17 ++++++++
po/POTFILES.in | 2 +-
preferences/Makefile.am | 2 +
preferences/krb5-auth-dialog-preferences.c | 32 +-------------
preferences/krb5-auth-dialog-preferences.xml | 1 +
src/Makefile.am | 2 +
src/krb5-auth-applet.c | 23 +++++++++-
src/krb5-auth-tools.c | 58 ++++++++++++++++++++++++++
src/krb5-auth-tools.h | 33 +++++++++++++++
9 files changed, 137 insertions(+), 33 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c614c67..d0dc297 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+Mon Jun 1 20:05:17 CEST 2009 Guido Günther <agx sigxcpu org>
+
+ enable help in applet and prefs dialog
+ * src/krb5-auth-tools.c: new file
+ * src/krb5-auth-tools.h: likewise
+ * po/POTFILES.in: add src/krb5-auth-tools.h, remove duplicate
+ src/krb5-auth-dialog.schemas.in
+ * preferences/Makefile.am (krb5_auth_dialog_sources): add
+ krb5-auth-tools.[ch]
+ * src/Makefile.am (krb5_auth_dialog_preferences_SOURCES): add
+ $(top_srcdir)/krb5-auth-tools.[ch]
+ * preferences/krb5-auth-dialog-preferences.c
+ (ka_preferences_dialog_response): call ka_show_help
+ * preferences/krb5-auth-dialog-preferences.xml: show help button
+ * src/krb5-auth-applet.c (ka_applet_cb_show_help): new function
+ (ka_applet_create_context_menu): add help menu entry
+
Mon Jun 1 19:56:35 CEST 2009 Guido Günther <agx sigxcpu org>
add user manual
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7fca337..ba42050 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,9 +1,9 @@
-src/krb5-auth-dialog.schemas.in
[type: gettext/glade]src/krb5-auth-dialog.xml
src/krb5-auth-dialog.c
src/krb5-auth-pwdialog.c
src/dummy-strings.c
src/krb5-auth-applet.c
+src/krb5-auth-tools.c
src/krb5-auth-dialog.desktop.in
src/krb5-auth-dialog.schemas.in
gtksecentry/gtksecentry.c
diff --git a/preferences/Makefile.am b/preferences/Makefile.am
index 56d93cb..48c9be0 100644
--- a/preferences/Makefile.am
+++ b/preferences/Makefile.am
@@ -6,6 +6,8 @@ krb5_auth_dialog_preferences_SOURCES = \
krb5-auth-dialog-preferences.c \
$(top_srcdir)/src/krb5-auth-gconf-tools.c \
$(top_srcdir)/src/krb5-auth-gconf-tools.h \
+ $(top_srcdir)/src/krb5-auth-tools.c \
+ $(top_srcdir)/src/krb5-auth-tools.h \
$(NULL)
krb5_auth_dialog_preferences_CPPFLAGS = \
diff --git a/preferences/krb5-auth-dialog-preferences.c b/preferences/krb5-auth-dialog-preferences.c
index c0d75c6..4edd565 100644
--- a/preferences/krb5-auth-dialog-preferences.c
+++ b/preferences/krb5-auth-dialog-preferences.c
@@ -34,6 +34,7 @@
#include <glib/gi18n.h>
#include "krb5-auth-gconf-tools.h"
+#include "krb5-auth-tools.h"
#define N_LISTENERS 8
@@ -560,40 +561,13 @@ ka_preferences_dialog_response (GtkWidget *widget,
int response,
KaPreferencesDialog *dialog)
{
- GError *error = NULL;
-
if (response != GTK_RESPONSE_HELP) {
gtk_widget_destroy (widget);
return;
}
-#if GTK_CHECK_VERSION(2, 14, 0)
- gtk_show_uri (gtk_window_get_screen (GTK_WINDOW (dialog->dialog)),
- "ghelp:krb5-auth-dialog#preferences",
- gtk_get_current_event_time (), &error);
-#else
- g_warning("gtk_show_uri unavailable");
-#endif
-
- if (error) {
- GtkWidget *message_dialog;
-
-
- message_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog->dialog),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("There was an error displaying help:\n%s"),
- error->message);
- gtk_window_set_resizable (GTK_WINDOW (message_dialog), FALSE);
-
- g_signal_connect (message_dialog, "response",
- G_CALLBACK (gtk_widget_destroy),
- NULL);
-
- gtk_widget_show (message_dialog);
- g_error_free (error);
- }
+ ka_show_help (gtk_window_get_screen (GTK_WINDOW (dialog->dialog)),
+ "#preferences", GTK_WINDOW(dialog->dialog));
}
diff --git a/preferences/krb5-auth-dialog-preferences.xml b/preferences/krb5-auth-dialog-preferences.xml
index 5bb48bd..5c70ff3 100644
--- a/preferences/krb5-auth-dialog-preferences.xml
+++ b/preferences/krb5-auth-dialog-preferences.xml
@@ -608,6 +608,7 @@
<child>
<object class="GtkButton" id="button2">
<property name="label" translatable="yes">gtk-help</property>
+ <property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
diff --git a/src/Makefile.am b/src/Makefile.am
index ed10e3f..03d58ae 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)
diff --git a/src/krb5-auth-applet.c b/src/krb5-auth-applet.c
index b1d6579..63c8df4 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
@@ -551,13 +552,13 @@ ka_applet_cb_quit (GtkMenuItem* menuitem G_GNUC_UNUSED, gpointer user_data)
static void
ka_about_dialog_url_hook (GtkAboutDialog *about,
- const gchar *link,
+ const gchar *alink,
gpointer data G_GNUC_UNUSED)
{
GError *error = NULL;
gtk_show_uri(gtk_window_get_screen (GTK_WINDOW (about)),
- link, gtk_get_current_event_time(), &error);
+ alink, gtk_get_current_event_time(), &error);
if (error) {
GtkWidget *message_dialog;
@@ -567,7 +568,7 @@ ka_about_dialog_url_hook (GtkAboutDialog *about,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
_("There was an error displaying %s:\n%s"),
- link, error->message);
+ alink, error->message);
gtk_window_set_resizable (GTK_WINDOW (message_dialog), FALSE);
g_signal_connect (message_dialog, "response",
@@ -605,6 +606,16 @@ ka_applet_cb_about_dialog (GtkMenuItem* menuitem G_GNUC_UNUSED,
}
+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);
+}
+
+
/* The tray icon's context menu */
static gboolean
ka_applet_create_context_menu (KaApplet* applet)
@@ -631,6 +642,12 @@ ka_applet_create_context_menu (KaApplet* applet)
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
+ /* About item */
+ menu_item = gtk_image_menu_item_new_with_mnemonic (_("_Help"));
+ g_signal_connect (G_OBJECT (menu_item), "activate", G_CALLBACK (ka_applet_cb_show_help), applet);
+ image = gtk_image_new_from_stock (GTK_STOCK_HELP, 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);
/* About item */
menu_item = gtk_image_menu_item_new_with_mnemonic (_("_About"));
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
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]