[Buoh-dev] CVS commit to /cvsroot/buoh/buoh/src by carlosgc



CVS commit to /cvsroot/buoh/buoh/src by carlosgc

Modified Files:
	buoh-view-comic.c buoh-window.c buoh.c 
Log Message:
2005-11-16  Bastien Nocera <hadess hadess net>
	* configure.in:
	* src/buoh-view-comic.c:
	* src/buoh-window.c:
	* src/buoh.c:
	Make buoh work with GTK+ 2.6

===================================================================
RCS file: /cvsroot/buoh/buoh/src/buoh-view-comic.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- /cvsroot/buoh/buoh/src/buoh-view-comic.c	2005/11/16 20:29:28	1.13
+++ /cvsroot/buoh/buoh/src/buoh-view-comic.c	2005/11/16 20:40:22	1.14
@@ -407,7 +407,13 @@
 	gtk_adjustment_set_value (hadjustment, 0.0);
 	gtk_adjustment_set_value (vadjustment, 0.0);
 
+#if GTK_CHECK_VERSION(2,8,0)
 	gtk_image_clear (GTK_IMAGE (c_view->priv->image));
+#else 
+	gtk_image_set_from_stock (GTK_IMAGE (c_view->priv->image),
+				  GTK_STOCK_MISSING_IMAGE,
+				  GTK_ICON_SIZE_DIALOG);
+#endif
 	
 }
 static void
===================================================================
RCS file: /cvsroot/buoh/buoh/src/buoh-window.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- /cvsroot/buoh/buoh/src/buoh-window.c	2005/11/16 20:29:28	1.29
+++ /cvsroot/buoh/buoh/src/buoh-window.c	2005/11/16 20:40:22	1.30
@@ -561,7 +561,9 @@
 					       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 					       GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
 					       NULL);
+#if GTK_CHECK_VERSION(2,8,0)
 	gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (chooser), TRUE);
+#endif
 	gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
 
 	if (folder) {
===================================================================
RCS file: /cvsroot/buoh/buoh/src/buoh.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- /cvsroot/buoh/buoh/src/buoh.c	2005/11/16 20:29:28	1.25
+++ /cvsroot/buoh/buoh/src/buoh.c	2005/11/16 20:40:22	1.26
@@ -22,6 +22,11 @@
 #include <config.h>
 #endif
 
+#include <string.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <glib/gstdio.h>
@@ -340,6 +345,31 @@
 	xmlFreeTextWriter (writer);
 }
 
+static gboolean
+buoh_create_comics_file (Buoh *buoh, const char *filename, const char *contents)
+{
+#if GTK_CHECK_VERSION(2,8,0)
+	return g_file_set_contents (filename, contents, -1, NULL);
+#else
+	int fd;
+
+	if ((fd = open (filename, O_CREAT | O_WRONLY, 0755)) < 0) {
+		return FALSE;
+	}
+
+	if (write (fd, contents, strlen (contents)) < 0) {
+		close (fd);
+		return FALSE;
+	}
+
+	if (close (fd) < 0) {
+		return FALSE;
+	}
+
+	return TRUE;
+#endif
+}
+
 static void
 buoh_create_user_dir (Buoh *buoh)
 {
@@ -358,7 +388,7 @@
 	
 	if (!g_file_test (filename, G_FILE_TEST_IS_REGULAR)) {
 		buoh_debug ("User comics file doesn't exist, creating it ...");
-		if (!g_file_set_contents (filename, contents, -1, NULL)) {
+		if (!buoh_create_comics_file (buoh, filename, contents)) {
 			g_free (filename);
 			g_error ("Cannot create user's comics list file");
 		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]