kov changed gksu/branches/gksu2/ChangeLog, gksu/branches/gksu2/gksu/gksu.c

Gustavo Noronha kov at costa.debian.org
Sun Apr 30 19:49:34 UTC 2006


Mensagem de log: 
- reimplemented the --desktop functionality by using
  the new set_description API
- reimplemented the --print-pass functionality by
  using the new ask_password API;


-----


Modified: gksu/branches/gksu2/ChangeLog
===================================================================
--- gksu/branches/gksu2/ChangeLog	2006-04-30 19:46:58 UTC (rev 580)
+++ gksu/branches/gksu2/ChangeLog	2006-04-30 19:49:33 UTC (rev 581)
@@ -3,6 +3,8 @@
 	* gksu/gksu.c:
 	- reimplemented the --desktop functionality by using
 	  the new set_description API
+	- reimplemented the --print-pass functionality by
+	  using the new ask_password API;
 
 2006-04-25  Gustavo Noronha Silva  <kov at debian.org>
 

Modified: gksu/branches/gksu2/gksu/gksu.c
===================================================================
--- gksu/branches/gksu2/gksu/gksu.c	2006-04-30 19:46:58 UTC (rev 580)
+++ gksu/branches/gksu2/gksu/gksu.c	2006-04-30 19:49:33 UTC (rev 581)
@@ -277,7 +277,6 @@
 	  gksu_context_set_login_shell (context, TRUE);
 	  break;
 	case 'p':
-	  /* FIXME - reimplement */
 	  print_pass = TRUE;
 	  break;
 	case 'm':
@@ -369,6 +368,36 @@
       gtk_widget_destroy (d);
     }
 
+  if (print_pass)
+    {
+      gchar *password = NULL;
+
+      if ((gksu_context_get_message (context) == NULL) &&
+	  (gksu_context_get_description (context) == NULL) &&
+	  (gksu_context_get_command (context) == NULL))
+	{
+	  gk_dialog (GTK_MESSAGE_ERROR,
+		     _("<big><b>Missing options or arguments</b></big>\n\n"
+		       "You need to provide --description or --message."));
+	  return 1;
+	}
+
+      password = gksu_ask_password_full (context, NULL, &error);
+
+      if (error)
+	{
+	  gk_dialog (GTK_MESSAGE_ERROR,
+		     _("<b>Failed to request password.</b>\n\n%s"),
+		     error->message);
+	  return 3;
+	}
+
+      if (password)
+	printf ("%s\n", password);
+
+      return 0;
+    }
+
   /* now we can begin to care about a command */
   if (newargc <= optind)
     {




More information about the gksu-commits mailing list