[Xfce4-commits] <xfce4-screenshooter:master> Add a clipboard CLI option (bug #8483).

Jérôme Guelfucci noreply at xfce.org
Sun Feb 19 14:44:01 CET 2012


Updating branch refs/heads/master
         to 0f1e8cc275d97a6a63955ebb10362ad73f6dd95a (commit)
       from 3ed26722a511114d45cf66649b68b06dc33a13af (commit)

commit 0f1e8cc275d97a6a63955ebb10362ad73f6dd95a
Author: Tom Hope <tjlhope at gmail.com>
Date:   Sun Feb 19 14:41:28 2012 +0100

    Add a clipboard CLI option (bug #8483).

 src/main.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/src/main.c b/src/main.c
index 1ae982e..a0759fb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -34,6 +34,7 @@ gboolean region = FALSE;
 gboolean fullscreen = FALSE;
 gboolean mouse = FALSE;
 gboolean upload = FALSE;
+gboolean clipboard = FALSE;
 gchar *screenshot_dir;
 gchar *application;
 gint delay = 0;
@@ -44,6 +45,11 @@ gint delay = 0;
 static GOptionEntry entries[] =
 {
   {
+    "clipboard", 'c', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &clipboard,
+    N_("Copy the screenshot to the clipboard"),
+    NULL
+  },
+  {
     "delay", 'd', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_INT, &delay,
     N_("Delay in seconds before taking the screenshot"),
     NULL
@@ -196,6 +202,13 @@ int main (int argc, char **argv)
       g_free (sd);
       return EXIT_FAILURE;
     }
+  else if (upload && clipboard)
+    {
+      g_printerr (conflict_error, "upload", "clipboard");
+
+      g_free (sd);
+      return EXIT_FAILURE;
+    }
   else if ((application != NULL) && (screenshot_dir != NULL))
     {
       g_printerr (conflict_error, "open", "save");
@@ -203,6 +216,20 @@ int main (int argc, char **argv)
       g_free (sd);
       return EXIT_FAILURE;
     }
+  else if ((application != NULL) && clipboard)
+    {
+      g_printerr (conflict_error, "open", "clipboard");
+
+      g_free (sd);
+      return EXIT_FAILURE;
+    }
+  else if ((screenshot_dir != NULL) && clipboard)
+    {
+      g_printerr (conflict_error, "save", "clipboard");
+
+      g_free (sd);
+      return EXIT_FAILURE;
+    }
 
   /* Warn that action options, mouse and delay will be ignored in
    * non-cli mode */
@@ -212,6 +239,8 @@ int main (int argc, char **argv)
     g_printerr (ignore_error, "save");
   if (upload && !(fullscreen || window || region))
     g_printerr (ignore_error, "upload");
+  if (clipboard && !(fullscreen || window || region))
+    g_printerr (ignore_error, "clipboard");
   if (delay && !(fullscreen || window || region))
     g_printerr (ignore_error, "delay");
   if (mouse && !(fullscreen || window || region))
@@ -276,6 +305,12 @@ int main (int argc, char **argv)
           sd->action = UPLOAD;
           sd->action_specified = TRUE;
         }
+      else if (clipboard)
+        {
+          sd->app = g_strdup ("none");
+          sd->action = CLIPBOARD;
+          sd->action_specified = TRUE;
+        }
       else
         {
           sd->app = g_strdup ("none");


More information about the Xfce4-commits mailing list