[Xfce4-commits] <xfce4-screenshooter:master> Add a default comment for the ZimageZ information.

Jérôme Guelfucci jeromeg at xfce.org
Fri Aug 14 00:26:21 CEST 2009


Updating branch refs/heads/master
         to 142fd437a7403aed38097a653743aea106bbe048 (commit)
       from 6230d14f6d542149f4b066355a1a74fd88ed1da8 (commit)

commit 142fd437a7403aed38097a653743aea106bbe048
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Sat Aug 8 23:29:34 2009 +0200

    Add a default comment for the ZimageZ information.

 ChangeLog                   |    4 ++++
 lib/screenshooter-dialogs.c |    2 +-
 lib/screenshooter-utils.c   |   13 +++++++++----
 lib/screenshooter-utils.h   |    2 +-
 lib/screenshooter-zimagez.c |    4 +++-
 5 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4aafc89..0a8ca6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2009-08-08 jeromeg
 
+Add a default comment for the ZimageZ information.
+
+2009-08-08 jeromeg
+
 Split the function to get the date and the time.
 
 2009-08-08 jeromeg
diff --git a/lib/screenshooter-dialogs.c b/lib/screenshooter-dialogs.c
index 20aae37..c5938f8 100644
--- a/lib/screenshooter-dialogs.c
+++ b/lib/screenshooter-dialogs.c
@@ -231,7 +231,7 @@ static gchar *generate_filename_for_uri (const gchar *uri,
   GFile *directory;
   GFile *file;
   gchar *base_name;
-  const gchar *date = screenshooter_get_date ();
+  const gchar *date = screenshooter_get_date (TRUE);
   const gchar *current_time = screenshooter_get_time ();
   gint i;
 
diff --git a/lib/screenshooter-utils.c b/lib/screenshooter-utils.c
index 6e80741..3289a3d 100644
--- a/lib/screenshooter-utils.c
+++ b/lib/screenshooter-utils.c
@@ -309,11 +309,11 @@ gchar *screenshooter_get_time (void)
   return result;
 }
 
-gchar *screenshooter_get_date (void)
+gchar *screenshooter_get_date (gboolean strip_slashes)
 {
   GDate *date = g_date_new ();
   gchar *result;
-  gchar **split;
+  gchar **split = NULL;
   gchar buffer[512];
   gsize length;
 
@@ -327,8 +327,13 @@ gchar *screenshooter_get_date (void)
       buffer[0] = '\0';
     }
 
-  split = g_strsplit (buffer, "/", 0);
-  result = g_strjoinv (NULL, split);
+  if (strip_slashes)
+    {
+      split = g_strsplit (buffer, "/", 0);
+      result = g_strjoinv (NULL, split);
+    }
+  else
+    result = g_strdup (buffer);
 
   g_strfreev (split);
   g_free (date);
diff --git a/lib/screenshooter-utils.h b/lib/screenshooter-utils.h
index 90d6e53..3fa1355 100644
--- a/lib/screenshooter-utils.h
+++ b/lib/screenshooter-utils.h
@@ -48,7 +48,7 @@ gboolean screenshooter_is_remote_uri       (const gchar    *uri);
 gchar *rot13                               (gchar          *string);
 void screenshooter_error                   (const gchar    *format,
                                             ...);
-gchar *screenshooter_get_date              (void);
+gchar *screenshooter_get_date              (gboolean strip_slashes);
 gchar *screenshooter_get_time              (void);
 
 
diff --git a/lib/screenshooter-zimagez.c b/lib/screenshooter-zimagez.c
index ab24edb..e0baab7 100644
--- a/lib/screenshooter-zimagez.c
+++ b/lib/screenshooter-zimagez.c
@@ -218,7 +218,9 @@ zimagez_upload_job (ScreenshooterJob *job, GValueArray *param_values, GError **e
   const gchar *encoded_data;
   const gchar *image_path;
   const gchar *last_user;
-  gchar *comment = g_strdup ("");
+  const gchar *date = screenshooter_get_date (FALSE);
+  const gchar *current_time = screenshooter_get_time ();
+  gchar *comment = g_strdup_printf (_("Taken on %s, at %s"), date, current_time);
   gchar *data = NULL;
   gchar *encoded_password = NULL;
   gchar *file_name = NULL;



More information about the Xfce4-commits mailing list