[Goodies-commits] r6338 - in xfce4-screenshooter-plugin/trunk: . src

Jerome Guelfucci jeromeg at xfce.org
Sat Dec 20 15:18:20 CET 2008


Author: jeromeg
Date: 2008-12-20 14:18:20 +0000 (Sat, 20 Dec 2008)
New Revision: 6338

Modified:
   xfce4-screenshooter-plugin/trunk/ChangeLog
   xfce4-screenshooter-plugin/trunk/src/main.c
Log:
  * src/main.c:
    - add a CLI option to open the screenshot with an application.
    - add a CLI option to take the screenshot of a region.
    - set a warning string as translatable.
    - update the description of the CLI options.
    - use screenshooter_take_and_output_screenshot


Modified: xfce4-screenshooter-plugin/trunk/ChangeLog
===================================================================
--- xfce4-screenshooter-plugin/trunk/ChangeLog	2008-12-20 13:22:21 UTC (rev 6337)
+++ xfce4-screenshooter-plugin/trunk/ChangeLog	2008-12-20 14:18:20 UTC (rev 6338)
@@ -1,5 +1,14 @@
 2008-12-20 jeromeg
 
+  * src/main.c:
+    - add a CLI option to open the screenshot with an application.
+    - add a CLI option to take the screenshot of a region.
+    - set a warning string as translatable.
+    - update the description of the CLI options.
+    - use screenshooter_take_and_output_screenshot
+
+2008-12-20 jeromeg
+
   * src/main.c (cb_dialog_response): only sleep one second if mode is not
     rectangular selection.
 

Modified: xfce4-screenshooter-plugin/trunk/src/main.c
===================================================================
--- xfce4-screenshooter-plugin/trunk/src/main.c	2008-12-20 13:22:21 UTC (rev 6337)
+++ xfce4-screenshooter-plugin/trunk/src/main.c	2008-12-20 14:18:20 UTC (rev 6338)
@@ -28,9 +28,11 @@
 /* Set default values for cli args */
 gboolean version = FALSE;
 gboolean window = FALSE;
+gboolean region = FALSE;
 gboolean fullscreen = FALSE;
 gboolean no_save_dialog = FALSE;
 gchar *screenshot_dir;
+gchar *application;
 gint delay = 0;
 
 
@@ -50,13 +52,18 @@
         NULL
     },
     {   "fullscreen", 'f', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &fullscreen,
-        N_("Take a screenshot of the whole screen"),
+        N_("Take a screenshot of the entire screen"),
         NULL
     },
+    {   "region", 'r', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &region,
+        N_("Select a region to be captured by clicking a point of the screen "
+           "without releasing the mouse button, dragging your mouse to the "
+           "other corner of the region, and releasing the mouse button."),
+        NULL
+    },
     {		"delay", 'd', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_INT, &delay,
        N_("Delay in seconds before taking the screenshot"),
        NULL
-    
     },
     {   "hide", 'h', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &no_save_dialog,
         N_("Do not display the save dialog"),
@@ -66,6 +73,10 @@
         N_("Directory where the screenshot will be saved"),
         NULL
     },
+    {   "open", 'o', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, &application,
+        N_("Application to open the screenshot"),
+        NULL
+    },
     { NULL }
 };
 
@@ -189,9 +200,9 @@
     {
       sd->mode = FULLSCREEN;
     }
-  else
+  else if (region)
     {
-      sd->mode = FULLSCREEN;
+      sd->mode = RECTANGLE;
     }
   
   /* Wether to show the save dialog allowing to choose a filename and a save 
@@ -207,6 +218,17 @@
 
   sd->delay = delay;
   
+  if (application != NULL)
+    {
+      sd->app = application;
+      sd->action = OPEN;
+    }
+  else
+    {
+      sd->app = g_strdup ("none");
+      sd->action = SAVE;
+    }
+  
   /* If the user gave a directory name, verify that it is valid */
   if (screenshot_dir != NULL)  
     {
@@ -216,32 +238,35 @@
           if (g_path_is_absolute (screenshot_dir))
             { 
               g_free (sd->screenshot_dir);
+              
               sd->screenshot_dir = screenshot_dir;              
             }
           else
             {
               g_free (sd->screenshot_dir);
+              
               sd->screenshot_dir = 
-              g_build_filename (g_get_current_dir (), screenshot_dir, NULL);
+                g_build_filename (g_get_current_dir (), 
+                                  screenshot_dir, 
+                                  NULL);
+              
               g_free (screenshot_dir);
             }
         }
       else
         {
-          g_warning ("%s is not a valid directory, the default directory will be used.", 
+          g_warning (_("%s is not a valid directory, the default directory"
+                       " will be used."), 
                      screenshot_dir);
+          
           g_free (screenshot_dir);
         }
     }
   
   /* If a mode cli option is given, take the screenshot accordingly. */
-  if (fullscreen || window)
+  if (fullscreen || window || region)
     {
-      screenshot = screenshooter_take_screenshot (sd->mode, sd->delay);
-      screenshooter_save_screenshot (screenshot, sd->show_save_dialog, 
-                                     sd->screenshot_dir);
-    
-      g_object_unref (screenshot);
+      screenshooter_take_and_output_screenshot (sd);
     }
   /* Else we just show up the main application */
   else




More information about the Goodies-commits mailing list