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



CVS commit to /cvsroot/buoh/buoh/src by steve-0

Modified Files:
	buoh-comic.c buoh-comic.h buoh-properties-dialog.c 
	buoh-window.c 
Log Message:
2005-11-08  Esteban Sanchez <esteban steve-o org>
        * src/buoh-comic.[ch]: Clean up old code. Added a new method
        buoh_comic_get_filename.
        * src/buoh-comic.c: Fixed a memory leak.
        * src/buoh-window.c: The suggested name on the save dialog is now the
        same than the original but with the PNG extension. Added a function
        to set the sensitiveness of the browsing actions (Prev, Next, First &
        Last)
        * data/comics.xml: Removed duplicated strip.

===================================================================
RCS file: /cvsroot/buoh/buoh/src/buoh-comic.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- /cvsroot/buoh/buoh/src/buoh-comic.c	2005/09/30 09:17:33	1.7
+++ /cvsroot/buoh/buoh/src/buoh-comic.c	2005/11/08 00:42:57	1.8
@@ -89,9 +89,10 @@
 	   
 	buoh_comic->priv = BUOH_COMIC_GET_PRIVATE (buoh_comic);
 
-	buoh_comic->priv->id       = NULL;
-	buoh_comic->priv->uri       = NULL;
-	buoh_comic->priv->pixbuf   = NULL;
+	buoh_comic->priv->id     = NULL;
+	buoh_comic->priv->uri    = NULL;
+	buoh_comic->priv->pixbuf = NULL;
+	buoh_comic->priv->date   = NULL;
 }
 
 static void
@@ -153,7 +154,12 @@
 		g_object_unref (comic->priv->pixbuf);
 		comic->priv->pixbuf = NULL;
 	}
-					   
+	
+	if (comic->priv->date) {
+		g_date_free (comic->priv->date);
+		comic->priv->date = NULL;
+	}
+	
 	if (G_OBJECT_CLASS (parent_class)->finalize)
 		(* G_OBJECT_CLASS (parent_class)->finalize) (object);
 }
@@ -371,3 +377,13 @@
 
 	return NULL;
 }
+
+gchar *
+buoh_comic_get_filename (BuohComic *comic)
+{
+	gchar *filename;
+	
+	filename = g_path_get_basename (comic->priv->uri);
+	
+	return filename;
+}
===================================================================
RCS file: /cvsroot/buoh/buoh/src/buoh-comic.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /cvsroot/buoh/buoh/src/buoh-comic.h	2005/09/13 12:18:57	1.4
+++ /cvsroot/buoh/buoh/src/buoh-comic.h	2005/11/08 00:42:57	1.5
@@ -45,13 +45,6 @@
 
 struct _BuohComicClass {
 	GObjectClass      parent_class;
-
-	/* Point to functions that has to be redefined by the child class*/
-	gchar    *(* get_uri)     (BuohComic *comic);
-	void      (* go_next)     (BuohComic *comic);
-	void      (* go_previous) (BuohComic *comic);
-	gboolean  (* is_the_last) (BuohComic *comic);
-	gchar    *(* get_page)    (BuohComic *comic);
 };
 
 /* Public methods */
@@ -75,6 +68,7 @@
 GdkPixbuf *buoh_comic_get_pixbuf           (BuohComic   *comic);
 GDate     *buoh_comic_get_date             (BuohComic   *comic);
 GdkPixbuf *buoh_comic_get_thumbnail        (BuohComic   *comic);
+gchar     *buoh_comic_get_filename         (BuohComic   *comic);
 
 G_END_DECLS
 
===================================================================
RCS file: /cvsroot/buoh/buoh/src/buoh-properties-dialog.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- /cvsroot/buoh/buoh/src/buoh-properties-dialog.c	2005/09/30 16:13:46	1.13
+++ /cvsroot/buoh/buoh/src/buoh-properties-dialog.c	2005/11/08 00:42:57	1.14
@@ -157,7 +157,7 @@
 	gtk_misc_set_alignment (GTK_MISC (label_language), 0, 0.5);
 	g_free (str);
 
-	str = g_strdup_printf ("<b>%s:</b>", _("Publication date"));
+	str = g_strdup_printf ("<b>%s:</b>", _("Date of publication"));
 	label_date = gtk_label_new (NULL);	
 	gtk_label_set_markup (GTK_LABEL (label_date), str);
 	gtk_misc_set_alignment (GTK_MISC (label_date), 0, 0.5);
===================================================================
RCS file: /cvsroot/buoh/buoh/src/buoh-window.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- /cvsroot/buoh/buoh/src/buoh-window.c	2005/10/01 23:02:17	1.26
+++ /cvsroot/buoh/buoh/src/buoh-window.c	2005/11/08 00:42:57	1.27
@@ -27,6 +27,7 @@
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 #include <gconf/gconf-client.h>
+#include <string.h>
 
 #include "buoh.h"
 #include "buoh-window.h"
@@ -541,13 +542,12 @@
 	GtkWidget        *chooser;
 	GtkFileFilter    *filter;
 	gchar            *suggested;
-	gchar            *name;
-	gchar            *page;
+	gchar            *basename;
+	gchar            *extension;
 	gchar            *filename = NULL;
 	static gchar     *folder = NULL;
 	BuohWindow       *window = BUOH_WINDOW (gdata);
 	BuohComic        *comic;
-	BuohComicManager *cm;
 	GdkPixbuf        *pixbuf;
 	GtkWidget        *dialog;
 	gboolean          successful;
@@ -571,13 +571,18 @@
 							 folder);
 	}
 
-	comic     = buoh_view_get_comic (window->priv->view);
-	cm        = buoh_comic_list_get_selected (window->priv->comic_list);
-	name      = buoh_comic_manager_get_title (cm);
-	page      = buoh_comic_get_id (comic);
-	suggested = g_strconcat (name, " (", page, ").png", NULL);
-	pixbuf   = buoh_comic_get_pixbuf (comic);
-
+	comic  = buoh_view_get_comic (window->priv->view);
+	pixbuf = buoh_comic_get_pixbuf (comic);
+	
+	/* Change the extension to .png */
+	filename = buoh_comic_get_filename (comic);
+	extension = g_strrstr (filename, ".");
+	basename = g_strndup (filename, strlen (filename) - strlen (extension));
+	suggested = g_strconcat (basename, ".png", NULL);
+	
+	g_free (basename);
+	g_free (filename);
+	
 	gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (chooser),
 					   suggested);
 
@@ -618,8 +623,6 @@
 	} while (!successful);
 
 	g_object_unref (pixbuf);
-	g_free (name);
-	g_free (page);
 	g_free (suggested);
 	gtk_widget_destroy (chooser);
 }
@@ -883,7 +886,7 @@
 }
 
 static void
-buoh_window_comic_actions_set_sensitive (BuohWindow *window, gboolean sensitive)
+buoh_window_comic_browsing_actions_set_sensitive (BuohWindow *window, gboolean sensitive)
 {
 	BuohComicManager *cm;
 
@@ -905,6 +908,13 @@
 				   sensitive ?
 				   !buoh_comic_manager_is_the_last (cm) :
 				   sensitive);
+}
+
+static void
+buoh_window_comic_actions_set_sensitive (BuohWindow *window, gboolean sensitive)
+{
+	buoh_window_comic_browsing_actions_set_sensitive (window, sensitive);
+
 	buoh_window_set_sensitive (window, "ComicProperties", sensitive);
 	buoh_window_set_sensitive (window, "ComicCopyURI",    sensitive); 
 	buoh_window_set_sensitive (window, "ViewZoomIn",
@@ -1015,11 +1025,7 @@
 		break;
 	case STATE_MESSAGE_ERROR:
 		buoh_window_comic_actions_set_sensitive (window, FALSE);
-		buoh_window_set_sensitive (window, "GoPrevious",
-					   !buoh_comic_manager_is_the_first (cm));
-		buoh_window_set_sensitive (window, "GoNext", 
-					   !buoh_comic_manager_is_the_last (cm));
-		buoh_window_comic_save_to_disk_set_sensitive (window, FALSE);
+		buoh_window_comic_browsing_actions_set_sensitive (window, TRUE);
 		break;
 	case STATE_COMIC_LOADING:
 		comic = buoh_view_get_comic (view);



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