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

Jerome Guelfucci jeromeg at xfce.org
Fri Jun 27 17:35:07 CEST 2008


Author: jeromeg
Date: 2008-06-27 15:35:07 +0000 (Fri, 27 Jun 2008)
New Revision: 4999

Modified:
   xfce4-screenshooter-plugin/trunk/ChangeLog
   xfce4-screenshooter-plugin/trunk/po/POTFILES.in
   xfce4-screenshooter-plugin/trunk/src/screenshooter-utils.c
Log:
Clean generate_filename_for_uri using g_access

Modified: xfce4-screenshooter-plugin/trunk/ChangeLog
===================================================================
--- xfce4-screenshooter-plugin/trunk/ChangeLog	2008-06-26 22:00:51 UTC (rev 4998)
+++ xfce4-screenshooter-plugin/trunk/ChangeLog	2008-06-27 15:35:07 UTC (rev 4999)
@@ -1,3 +1,7 @@
+2008-06-27 jeromeg
+
+	* src/screenshooter-utils.c: clean generate_filename_for_uri using g_access.
+
 2008-06-20 09:19 jeromeg
 
 	* NEWS: updated.

Modified: xfce4-screenshooter-plugin/trunk/po/POTFILES.in
===================================================================
--- xfce4-screenshooter-plugin/trunk/po/POTFILES.in	2008-06-26 22:00:51 UTC (rev 4998)
+++ xfce4-screenshooter-plugin/trunk/po/POTFILES.in	2008-06-27 15:35:07 UTC (rev 4999)
@@ -1,4 +1,3 @@
 src/screenshooter-plugin.c
 src/main.c
 src/screenshooter.desktop.in.in
-

Modified: xfce4-screenshooter-plugin/trunk/src/screenshooter-utils.c
===================================================================
--- xfce4-screenshooter-plugin/trunk/src/screenshooter-utils.c	2008-06-26 22:00:51 UTC (rev 4998)
+++ xfce4-screenshooter-plugin/trunk/src/screenshooter-utils.c	2008-06-27 15:35:07 UTC (rev 4999)
@@ -27,8 +27,6 @@
 
 #include <screenshooter-utils.h>
 
-#define MODE 0644
-
 /* Prototypes */
 
 static Window get_window_property (Window xwindow, Atom atom);
@@ -151,22 +149,29 @@
 
 gchar *generate_filename_for_uri(char *uri)
 {
-    int test;
-    gchar *file_name;
-    unsigned int i = 0;
-    if(uri == NULL)
-        return NULL;
-    file_name = g_strdup ("Screenshot.png");
-    if((test=open(g_build_filename(uri, file_name, NULL),O_RDWR,MODE))==-1) 
-    {
-        return file_name;
-    }
-    do
-    {
-        i++;
-        g_free (file_name);
-        file_name = g_strdup_printf ("Screenshot-%d.png",i);
-    }
-    while((test=open(g_build_filename(uri, file_name, NULL),O_RDWR,MODE))!=-1);
+  int test;
+  gchar *file_name;
+  unsigned int i = 0;
+    
+  if ( uri == NULL )
+  {
+  	return NULL;
+  }      
+  
+  file_name = g_strdup ("Screenshot.png");
+    
+  if( ( test = g_access ( g_build_filename (uri, file_name, NULL), F_OK ) ) != 0 ) 
+  {
     return file_name;
+  }
+    
+  do
+  {
+    i++;
+    g_free (file_name);
+    file_name = g_strdup_printf ("Screenshot-%d.png", i);
+  }
+  while( ( test = g_access ( g_build_filename (uri, file_name, NULL), F_OK ) ) == -1 );
+    
+  return file_name;
 }




More information about the Goodies-commits mailing list