kov changed libgksu/trunk/ChangeLog, libgksu/trunk/configure.ac,
libgksu/trunk/libgksu/libgksu.c, libgksu/trunk/libgksu/libgksu.h,
libgksu/trunk/libgksuui/gksuui-dialog.c,
libgksu/trunk/libgksuui/gksuui-dialog.h
Gustavo Noronha
kov at costa.debian.org
Tue Jul 11 00:30:33 UTC 2006
Mensagem de log:
implement a new alert label to allow applications displaying
arbitrary messages along with the main message/description
-----
Modified: libgksu/trunk/ChangeLog
===================================================================
--- libgksu/trunk/ChangeLog 2006-07-10 17:16:58 UTC (rev 647)
+++ libgksu/trunk/ChangeLog 2006-07-11 00:30:32 UTC (rev 648)
@@ -1,3 +1,12 @@
+2006-07-10 Gustavo Noronha Silva <kov at debian.org>
+
+ * configure.ac:
+ - increment version to 1.9.5
+
+ * libgksu/libgksu.{c,h}, libgksuui/gksu-dialog.{c,h}:
+ - implement a new 'alert' label, to allow applications showing
+ messages like 'wrong password, try again'
+
2006-07-05 Gustavo Noronha Silva <kov at debian.org>
* gksu.png, gksu-properties/{Makefile.am,gksu-properties.desktop.in,
Modified: libgksu/trunk/configure.ac
===================================================================
--- libgksu/trunk/configure.ac 2006-07-10 17:16:58 UTC (rev 647)
+++ libgksu/trunk/configure.ac 2006-07-11 00:30:32 UTC (rev 648)
@@ -3,7 +3,7 @@
AC_PREREQ(2.57)
-AC_INIT(libgksu, 1.9.4, kov at debian.org)
+AC_INIT(libgksu, 1.9.5, kov at debian.org)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
AC_CONFIG_SRCDIR(libgksu/libgksu.c)
AM_CONFIG_HEADER(config.h)
Modified: libgksu/trunk/libgksu/libgksu.c
===================================================================
--- libgksu/trunk/libgksu/libgksu.c 2006-07-10 17:16:58 UTC (rev 647)
+++ libgksu/trunk/libgksu/libgksu.c 2006-07-11 00:30:32 UTC (rev 648)
@@ -877,6 +877,9 @@
g_free (msg);
}
+ if (context->alert)
+ gksuui_dialog_set_alert (GKSUUI_DIALOG(dialog), context->alert);
+
if (context->grab)
lock = grab_keyboard_and_mouse (dialog);
retvalue = gtk_dialog_run (GTK_DIALOG(dialog));
@@ -1273,6 +1276,7 @@
context->description = NULL;
context->message = NULL;
+ context->alert = NULL;
context->grab = TRUE;
context->debug = FALSE;
@@ -1477,6 +1481,40 @@
}
/**
+ * gksu_context_set_alert:
+ * @context: the #GksuContext you want to modify
+ * @alert: a string to set the alert for
+ *
+ * Set the alert that the window that asks for the password will have.
+ * This is only meant to be used if the default window is used, of course.
+ * This alert should be used to display messages such as 'incorrect password',
+ * for instance.
+ */
+void
+gksu_context_set_alert (GksuContext *context, gchar *alert)
+{
+ if (context->alert)
+ g_free (context->alert);
+ context->alert = g_strdup (alert);
+}
+
+/**
+ * gksu_context_get_alert:
+ * @context: the #GksuContext you want to get the alert from.
+ *
+ * Get the alert that the window will have when the
+ * default function for requesting the password is
+ * called.
+ *
+ * Returns: a string with the alert or NULL if not set.
+ */
+gchar*
+gksu_context_get_alert (GksuContext *context)
+{
+ return context->alert;
+}
+
+/**
* gksu_context_set_debug:
* @context: the #GksuContext you want to modify
* @value: TRUE or FALSE
@@ -1747,7 +1785,7 @@
used_gnome_keyring = TRUE;
if (context->debug)
fprintf (stderr, "tmp: %s\n", tmp);
- if (tmp == NULL || (*error))
+ if (tmp == NULL || (error && (*error)))
{
if (context->debug)
fprintf (stderr, "gksu_su_full: problem getting password - getting out\n");
Modified: libgksu/trunk/libgksu/libgksu.h
===================================================================
--- libgksu/trunk/libgksu/libgksu.h 2006-07-10 17:16:58 UTC (rev 647)
+++ libgksu/trunk/libgksu/libgksu.h 2006-07-11 00:30:32 UTC (rev 648)
@@ -58,6 +58,7 @@
/* UI options */
gchar *description;
gchar *message;
+ gchar *alert;
gboolean grab;
/* startup notification */
@@ -135,6 +136,12 @@
gksu_context_get_message (GksuContext *context);
void
+gksu_context_set_alert (GksuContext *context, gchar *alert);
+
+gchar*
+gksu_context_get_alert (GksuContext *context);
+
+void
gksu_context_set_grab (GksuContext *context, gboolean value);
gboolean
Modified: libgksu/trunk/libgksuui/gksuui-dialog.c
===================================================================
--- libgksu/trunk/libgksuui/gksuui-dialog.c 2006-07-10 17:16:58 UTC (rev 647)
+++ libgksu/trunk/libgksuui/gksuui-dialog.c 2006-07-11 00:30:32 UTC (rev 648)
@@ -229,6 +229,11 @@
gksuui_dialog->label, TRUE, TRUE, 0);
gtk_widget_show (gksuui_dialog->label);
+ /* alert */
+ gksuui_dialog->alert = gtk_label_new (NULL);
+ gtk_box_pack_start (GTK_BOX(gksuui_dialog->entry_vbox),
+ gksuui_dialog->alert, TRUE, TRUE, 0);
+
/* hbox for entry and label */
hbox = gtk_hbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (gksuui_dialog->entry_vbox), hbox,
@@ -364,6 +369,45 @@
}
/**
+ * gksuui_dialog_set_alert:
+ * @dialog: the dialog on which to set the alert
+ * @alert: the alert to be set on the dialog
+ *
+ * Sets the alert that is displayed to the user when
+ * requesting a password. You can use Pango markup to
+ * modify font attributes. This alert should be used
+ * to display messages like 'wrong password' on password
+ * retry, for example.
+ *
+ */
+void
+gksuui_dialog_set_alert (GksuuiDialog *dialog, gchar *alert)
+{
+ GtkWidget *label = dialog->alert;
+
+ gtk_label_set_markup (GTK_LABEL(label), alert);
+}
+
+/**
+ * gksuui_dialog_get_alert:
+ * @dialog: the dialog from which to get the alert
+ *
+ * Gets the current alert that the dialog will use
+ * when run.
+ *
+ * Returns: a pointer to the string containing the
+ * alert. You need to make a copy of the string to
+ * keep it.
+ */
+const gchar*
+gksuui_dialog_get_alert (GksuuiDialog *dialog)
+{
+ GtkWidget *label = dialog->alert;
+
+ return gtk_label_get_text (GTK_LABEL(label));
+}
+
+/**
* gksuui_dialog_set_icon:
* @dialog: the dialog on which the icon will be set
* @icon: a #GdkPixbuf from which to set the image
Modified: libgksu/trunk/libgksuui/gksuui-dialog.h
===================================================================
--- libgksu/trunk/libgksuui/gksuui-dialog.h 2006-07-10 17:16:58 UTC (rev 647)
+++ libgksu/trunk/libgksuui/gksuui-dialog.h 2006-07-11 00:30:32 UTC (rev 648)
@@ -63,6 +63,7 @@
GtkWidget *hbox;
GtkWidget *image;
GtkWidget *entry_vbox;
+ GtkWidget *alert;
GtkWidget *label;
GtkWidget *label_warn_capslock;
GtkWidget *entry;
@@ -84,6 +85,12 @@
gksuui_dialog_get_message (GksuuiDialog *dialog);
void
+gksuui_dialog_set_alert (GksuuiDialog *dialog, gchar *alert);
+
+const gchar*
+gksuui_dialog_get_alert (GksuuiDialog *dialog);
+
+void
gksuui_dialog_set_icon (GksuuiDialog *dialog, GdkPixbuf *icon);
GtkWidget*
More information about the gksu-commits
mailing list