[Xfce4-commits] [apps/xfce4-screenshooter] 02/02: Don't save region/delay/show_mouse if region was specified from CLI

noreply at xfce.org noreply at xfce.org
Tue Aug 28 04:19:54 CEST 2018


This is an automated email from the git hooks/post-receive script.

a   n   d   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-screenshooter.

commit a570b0c90e4a4a4ad21cc9d7519fe1d6c47ce89b
Author: Andre Miranda <andreldm at xfce.org>
Date:   Mon Aug 27 23:18:41 2018 -0300

    Don't save region/delay/show_mouse if region was specified from CLI
---
 lib/screenshooter-global.h |  1 +
 lib/screenshooter-utils.c  | 17 ++++++++++++-----
 src/main.c                 |  4 ++++
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/lib/screenshooter-global.h b/lib/screenshooter-global.h
index bf072eb..1fc1c75 100644
--- a/lib/screenshooter-global.h
+++ b/lib/screenshooter-global.h
@@ -48,6 +48,7 @@ typedef struct
   gint action;
   gboolean plugin;
   gboolean action_specified;
+  gboolean region_specified;
   gboolean timestamp;
   gchar *screenshot_dir;
   gchar *title;
diff --git a/lib/screenshooter-utils.c b/lib/screenshooter-utils.c
index 7f94b28..91d3088 100644
--- a/lib/screenshooter-utils.c
+++ b/lib/screenshooter-utils.c
@@ -137,16 +137,23 @@ screenshooter_write_rc_file (const gchar *file, ScreenshotData *sd)
 
   TRACE ("Write the entries.");
 
-  xfce_rc_write_int_entry (rc, "delay", sd->delay);
-  xfce_rc_write_int_entry (rc, "region", sd->region);
-  xfce_rc_write_int_entry (rc, "show_mouse", sd->show_mouse);
-  xfce_rc_write_entry (rc, "screenshot_dir", sd->screenshot_dir);
   xfce_rc_write_entry (rc, "app", sd->app);
   xfce_rc_write_entry (rc, "last_user", sd->last_user);
+  xfce_rc_write_entry (rc, "screenshot_dir", sd->screenshot_dir);
 
-  /* do not save if the action was specified from cli */
+  /* do not save if action was specified from cli */
   if (!sd->action_specified)
+  {
     xfce_rc_write_int_entry (rc, "action", sd->action);
+  }
+
+  /* do not save if region was specified from cli */
+  if (!sd->region_specified)
+  {
+    xfce_rc_write_int_entry (rc, "delay", sd->delay);
+    xfce_rc_write_int_entry (rc, "region", sd->region);
+    xfce_rc_write_int_entry (rc, "show_mouse", sd->show_mouse);
+  }
 
   TRACE ("Flush and close the rc file");
   xfce_rc_close (rc);
diff --git a/src/main.c b/src/main.c
index cca7bf0..5e92cc3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -255,12 +255,16 @@ int main (int argc, char **argv)
   if (fullscreen || window || region)
     {
       /* Set the region to be captured */
+      sd->region_specified = TRUE;
+
       if (window)
         sd->region = ACTIVE_WINDOW;
       else if (fullscreen)
         sd->region = FULLSCREEN;
       else if (region)
         sd->region = SELECT;
+      else
+        sd->region_specified = FALSE;
 
       /* Whether to display the mouse pointer on the screenshot */
       mouse ? (sd->show_mouse = 1) : (sd->show_mouse = 0);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list