kov changed libgksu/branches/libgksu2/ChangeLog, libgksu/branches/libgksu2/docs/libgksu-sections.txt, libgksu/branches/libgksu2/docs/libgksu-undocumented.txt, libgksu/branches/libgksu2/libgksu/libgksu.c, libgksu/branches/libgksu2/libgksu/libgksu.h

Gustavo Noronha kov at costa.debian.org
Tue Apr 25 02:06:15 UTC 2006


Mensagem de log: 
implemented the message setting and getting
functions, and use the message that is given
when creating the dialog


-----


Modified: libgksu/branches/libgksu2/ChangeLog
===================================================================
--- libgksu/branches/libgksu2/ChangeLog	2006-04-24 10:59:36 UTC (rev 570)
+++ libgksu/branches/libgksu2/ChangeLog	2006-04-25 02:06:11 UTC (rev 571)
@@ -1,5 +1,10 @@
 2006-04-24  Gustavo Noronha Silva  <kov at debian.org>
 
+	* libgksu/libgksu.{c.h}:
+	- implemented the message setting and getting
+	  functions, and use the message that is given
+	  when creating the dialog
+
 	* Release 1.9.1
 
 2006-04-23  Gustavo Noronha Silva  <kov at debian.org>

Modified: libgksu/branches/libgksu2/docs/libgksu-sections.txt
===================================================================
--- libgksu/branches/libgksu2/docs/libgksu-sections.txt	2006-04-24 10:59:36 UTC (rev 570)
+++ libgksu/branches/libgksu2/docs/libgksu-sections.txt	2006-04-25 02:06:11 UTC (rev 571)
@@ -9,6 +9,8 @@
 gksu_context_get_command
 gksu_context_set_keep_env
 gksu_context_get_keep_env
+gksu_context_set_message
+gksu_context_get_message
 gksu_context_set_login_shell
 gksu_context_get_login_shell
 gksu_context_set_grab

Modified: libgksu/branches/libgksu2/docs/libgksu-undocumented.txt
===================================================================
--- libgksu/branches/libgksu2/docs/libgksu-undocumented.txt	2006-04-24 10:59:36 UTC (rev 570)
+++ libgksu/branches/libgksu2/docs/libgksu-undocumented.txt	2006-04-25 02:06:11 UTC (rev 571)
@@ -1,12 +1,10 @@
-83% symbol docs coverage.
-19 symbols documented.
+88% symbol docs coverage.
+22 symbols documented.
 0 symbols incomplete.
-4 not documented.
+3 not documented.
 
 
 GksuError
-gksu_context_get_grab
-gksu_context_set_grab
 
 
 libgksu:Short_Description

Modified: libgksu/branches/libgksu2/libgksu/libgksu.c
===================================================================
--- libgksu/branches/libgksu2/libgksu/libgksu.c	2006-04-24 10:59:36 UTC (rev 570)
+++ libgksu/branches/libgksu2/libgksu/libgksu.c	2006-04-25 02:06:11 UTC (rev 571)
@@ -794,11 +794,13 @@
  * su_ask_password:
  * @context: a #GksuContext
  * @prompt: the prompt that should be used instead of "Password: "
- * @grab: should the X keyboard and mouse inputs be grabbed
+ * @data: data that is passed by gksu_*_full
+ * @error: a pointer to pointer #GError that will be filled with
+ * data if an error happens.
  *
  * This is a convenience function to create a #GksuuiDialog and
+ * request the password.
  *
- *
  * Returns: a newly allocated gchar containing the password
  * or NULL if an error happens or the user cancels the action
  */
@@ -822,20 +824,24 @@
   if (prompt)
     gksuui_dialog_set_prompt (GKSUUI_DIALOG(dialog), prompt);
 
-
-  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 (context->message)
+    gksuui_dialog_set_message (GKSUUI_DIALOG(dialog), context->message);
   else
-    msg = g_strdup_printf (_("<b>To run the program \"%s\" you need to "
-			     "enter the %s password</b>"),
-			   context->command,
-			   context->user);
+    {
+      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);
+      else
+	msg = g_strdup_printf (_("<b>To run the program \"%s\" you need to "
+				 "enter the %s password</b>"),
+			       context->command,
+			       context->user);
 
-  gksuui_dialog_set_message (GKSUUI_DIALOG(dialog), msg);
-  g_free (msg);
+      gksuui_dialog_set_message (GKSUUI_DIALOG(dialog), msg);
+      g_free (msg);
+    }
 
   if (context->grab)
     lock = grab_keyboard_and_mouse (dialog);
@@ -1221,6 +1227,7 @@
   context->login_shell = FALSE;
   context->keep_env = FALSE;
 
+  context->message = NULL;
   context->grab = TRUE;
 
   context->debug = FALSE;
@@ -1360,6 +1367,40 @@
 }
 
 /**
+ * gksu_context_set_message:
+ * @context: the #GksuContext you want to modify
+ * @message: a string to set the message for
+ *
+ * Set the message 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_message (GksuContext *context, gchar *message)
+{
+  if (context->message)
+    g_free (context->message);
+  context->message = g_strdup (message);
+}
+
+/**
+ * gksu_context_get_message:
+ * @context: the #GksuContext you want to get the message from.
+ *
+ * Get the message that the window will have when the
+ * default function for requesting the password is
+ * called.
+ *
+ * Returns: a string with the message.
+ */
+gchar*
+gksu_context_get_message (GksuContext *context)
+{
+  if (context->message)
+    return context->message;
+  return "";
+}
+
+/**
  * gksu_context_set_debug:
  * @context: the #GksuContext you want to modify
  * @value: TRUE or FALSE
@@ -1372,6 +1413,15 @@
   context->grab = value;
 }
 
+/**
+ * gksu_context_get_grab:
+ * @context: the #GksuContext you want to ask whether a grab will be done.
+ *
+ * Returns TRUE if gksu has been asked to do a grab on keyboard and mouse
+ * when asking for the password.
+ *
+ * Returns: TRUE if yes, FALSE otherwise.
+ */
 gboolean
 gksu_context_get_grab (GksuContext *context)
 {
@@ -1421,6 +1471,8 @@
 
   g_object_unref (context->gconf_client);
 
+  g_free (context->message);
+
   g_free (context->user);
   g_free (context->command);
 

Modified: libgksu/branches/libgksu2/libgksu/libgksu.h
===================================================================
--- libgksu/branches/libgksu2/libgksu/libgksu.h	2006-04-24 10:59:36 UTC (rev 570)
+++ libgksu/branches/libgksu2/libgksu/libgksu.h	2006-04-25 02:06:11 UTC (rev 571)
@@ -56,6 +56,7 @@
   gboolean keep_env;
 
   /* UI options */
+  gchar *message;
   gboolean grab;
 
   /* startup notification */
@@ -120,6 +121,12 @@
 gksu_context_get_keep_env (GksuContext *context);
 
 void
+gksu_context_set_message (GksuContext *context, gchar *message);
+
+gchar*
+gksu_context_get_message (GksuContext *context);
+
+void
 gksu_context_set_grab (GksuContext *context, gboolean value);
 
 gboolean




More information about the gksu-commits mailing list