kov changed libgksu/branches/libgksu2/ChangeLog,
libgksu/branches/libgksu2/libgksu/libgksu.c,
libgksu/branches/libgksu2/libgksu/libgksu.h,
libgksu/branches/libgksu2/libgksuui/gksuui-dialog.c
Gustavo Noronha
kov at costa.debian.org
Sun Apr 30 18:56:23 UTC 2006
Mensagem de log:
accepted changes from the Ubuntu people to make the dialog
and messages be more beatiful; also provide an API that
enables specifying a descriptional name for the command, that
is used automatically in the message
-----
Modified: libgksu/branches/libgksu2/ChangeLog
===================================================================
--- libgksu/branches/libgksu2/ChangeLog 2006-04-30 18:38:52 UTC (rev 577)
+++ libgksu/branches/libgksu2/ChangeLog 2006-04-30 18:56:21 UTC (rev 578)
@@ -1,5 +1,11 @@
2006-04-30 Gustavo Noronha Silva <kov at debian.org>
+ * libgksuui/libgksu.{c,h}, libgksuui/gksuui-dialog.c:
+ - accepted changes from the Ubuntu people to make the dialog
+ and messages be more beatiful; also provide an API that
+ enables specifying a descriptional name for the command, that
+ is used automatically in the message
+
* libgksuui/gksuui-dialog.c:
- do not center the label that is used to display
the message
Modified: libgksu/branches/libgksu2/libgksu/libgksu.c
===================================================================
--- libgksu/branches/libgksu2/libgksu/libgksu.c 2006-04-30 18:38:52 UTC (rev 577)
+++ libgksu/branches/libgksu2/libgksu/libgksu.c 2006-04-30 18:56:21 UTC (rev 578)
@@ -46,9 +46,6 @@
#include "libgksu.h"
#include "../libgksuui/gksuui-dialog.h"
-/* GLOBALS */
-gboolean message_changed = FALSE;
-
GType
gksu_error_get_type (void)
{
@@ -828,16 +825,42 @@
gksuui_dialog_set_message (GKSUUI_DIALOG(dialog), context->message);
else
{
+ gchar *command = NULL;
+ if (context->description)
+ command = context->description;
+ else
+ command = context->command;
+
if (context->sudo_mode)
- msg = g_strdup_printf (_("<b>Please enter your password\n"
- "to run %s as user %s</b>"),
- context->command,
- context->user);
+ {
+ if (!strcmp(context->user, "root"))
+ msg = g_strdup_printf (_("<b><big>Enter your password to perform"
+ " administrative tasks</big></b>\n\n"
+ "The application '%s' lets you "
+ "modify essential parts of your "
+ "system."),
+ command);
+ else
+ msg = g_strdup_printf (_("<b><big>Enter your password to run "
+ "the application \"%s\" as user %s"
+ "</big></b>"),
+ command, context->user);
+ }
else
- msg = g_strdup_printf (_("<b>To run the program \"%s\" you need to "
- "enter the %s password</b>"),
- context->command,
- context->user);
+ {
+ if (strcmp(gksu_context_get_user (context), "root") == 0)
+ msg = g_strdup_printf (_("<b><big>Enter the administrative password"
+ "</big></b>\n\n"
+ "The application '%s' lets you "
+ "modify essential parts of your "
+ "system."),
+ command);
+ else
+ msg = g_strdup_printf (_("<b><big>Enter the password of %s to run "
+ "the application \"%s\""
+ "</big></b>"),
+ command, context->user);
+ }
gksuui_dialog_set_message (GKSUUI_DIALOG(dialog), msg);
g_free (msg);
@@ -1227,6 +1250,7 @@
context->login_shell = FALSE;
context->keep_env = FALSE;
+ context->description = NULL;
context->message = NULL;
context->grab = TRUE;
@@ -1367,6 +1391,41 @@
}
/**
+ * gksu_context_set_description:
+ * @context: the #GksuContext you want to modify
+ * @description: a string to set the description for
+ *
+ * Set the nice name for the action that is being run 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.
+ */
+void
+gksu_context_set_description (GksuContext *context, gchar *description)
+{
+ if (context->description)
+ g_free (context->description);
+ context->description = g_strdup (description);
+}
+
+/**
+ * gksu_context_get_description:
+ * @context: the #GksuContext you want to get the description from.
+ *
+ * Get the description that the window will have when the
+ * default function for requesting the password is
+ * called.
+ *
+ * Returns: a string with the description.
+ */
+gchar*
+gksu_context_get_description (GksuContext *context)
+{
+ if (context->description)
+ return context->description;
+ return "";
+}
+
+/**
* gksu_context_set_message:
* @context: the #GksuContext you want to modify
* @message: a string to set the message for
@@ -1471,6 +1530,7 @@
g_object_unref (context->gconf_client);
+ g_free (context->description);
g_free (context->message);
g_free (context->user);
Modified: libgksu/branches/libgksu2/libgksu/libgksu.h
===================================================================
--- libgksu/branches/libgksu2/libgksu/libgksu.h 2006-04-30 18:38:52 UTC (rev 577)
+++ libgksu/branches/libgksu2/libgksu/libgksu.h 2006-04-30 18:56:21 UTC (rev 578)
@@ -56,6 +56,7 @@
gboolean keep_env;
/* UI options */
+ gchar *description;
gchar *message;
gboolean grab;
@@ -121,6 +122,12 @@
gksu_context_get_keep_env (GksuContext *context);
void
+gksu_context_set_description (GksuContext *context, gchar *description);
+
+gchar*
+gksu_context_get_description (GksuContext *context);
+
+void
gksu_context_set_message (GksuContext *context, gchar *message);
gchar*
Modified: libgksu/branches/libgksu2/libgksuui/gksuui-dialog.c
===================================================================
--- libgksu/branches/libgksu2/libgksuui/gksuui-dialog.c 2006-04-30 18:38:52 UTC (rev 577)
+++ libgksu/branches/libgksu2/libgksuui/gksuui-dialog.c 2006-04-30 18:56:21 UTC (rev 578)
@@ -175,9 +175,14 @@
gtk_dialog_set_has_separator (GTK_DIALOG(gksuui_dialog), FALSE);
gtk_container_set_border_width (GTK_CONTAINER(gksuui_dialog), 6);
gtk_box_set_spacing (GTK_BOX(gksuui_dialog->main_vbox), 12);
+ gtk_window_set_resizable (GTK_WINDOW(gksuui_dialog), FALSE);
+ /* skip taskbar and pager hint */
+ gtk_window_set_skip_pager_hint (GTK_WINDOW(gksuui_dialog), TRUE);
+ gtk_window_set_skip_taskbar_hint (GTK_WINDOW(gksuui_dialog), TRUE);
+
+
/* center window */
- gtk_window_set_default_size (GTK_WINDOW(gksuui_dialog), 250, 100);
gtk_window_set_position (GTK_WINDOW(gksuui_dialog), GTK_WIN_POS_CENTER);
/* the action buttons */
@@ -187,7 +192,7 @@
GTK_RESPONSE_CANCEL);
/* the ok button */
gksuui_dialog->ok_button = gtk_dialog_add_button (dialog,
- _("Continue"),
+ GTK_STOCK_OK,
GTK_RESPONSE_OK);
gtk_widget_grab_default (gksuui_dialog->ok_button);
More information about the gksu-commits
mailing list