Update of /cvsroot/gtkpod/gtkpod/src
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv27163/src
Modified Files:
Tag: fetchcover_development_branch
main.c display_coverart.c details.c fetchcover.c
display_coverart.h fetchcover.h
Log Message:
* main.c:
init_default_file renamed to coverart_init_default_file
* fetchcover.h:
fetchcover_start renamed to fetchcover_display_dialog
* display_coverart.h:
get_default_cover_file_path reworked to return a pixbuf as
coverart_get_default_track_thumb
init_default_file renamed to coverart_init_default_file
* display_coverart.c:
removal of get_default_file_path
get_thumb changed to coverart_get_track_thumb
addition of coverart_get_default_track_thumb for easy acquisition of
default file pixbuf
Itdb_Track references changed to Track in line with rest of application
* details.c:
fixed FIXME for freeing detail->xml
* fetchcover.c:
new includes required for stdio and gprintf
change from url array to glist of fetchcover structs
addition of free_fetchcover_list and free_fetchcover for disposing of
any recoved image covers
next function split into fethcover_next, net_search_track and
net_retrieve_image
GTK window reworked to be GtkDialog that displays as modal
Status bar used instead of warning windows so avoiding violating
modality of dialog
Fetch_Cover struct introduced for storing a recoved image and related
metadata
Removal of glade window and creation wholly programmatically of dialog
Index: main.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/main.c,v
retrieving revision 1.60.2.1
retrieving revision 1.60.2.2
diff -u -d -r1.60.2.1 -r1.60.2.2
--- main.c 12 Mar 2007 22:14:41 -0000 1.60.2.1
+++ main.c 25 Mar 2007 22:53:14 -0000 1.60.2.2
@@ -127,7 +127,7 @@
init_prefs(argc, argv);
- init_default_file (argv[0]);
+ coverart_init_default_file (argv[0]);
display_create ();
Index: display_coverart.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display_coverart.c,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -u -d -r1.7.2.1 -r1.7.2.2
--- display_coverart.c 12 Mar 2007 21:57:39 -0000 1.7.2.1
+++ display_coverart.c 25 Mar 2007 22:53:14 -0000 1.7.2.2
@@ -38,13 +38,13 @@
#include "display_coverart.h"
/* Declarations */
-static gint sort_tracks (Itdb_Track *a, Itdb_Track *b);
+static gint sort_tracks (Track *a, Track *b);
static void set_display_dimensions ();
static GdkPixbuf *draw_blank_cdimage ();
static void set_highlight (Cover_Item *cover);
static void raise_cdimages (GPtrArray *cdcovers);
-static GdkPixbuf *get_thumb (Itdb_Track *track);
/*static void scroll_covers (gint direction);*/
+static GdkPixbuf *coverart_get_track_thumb (Track *track);
static void on_cover_display_button_clicked (GtkWidget *widget, gpointer data);
static void on_main_cover_image_clicked (GnomeCanvas *canvas, GdkEvent *event,
gpointer data);
static void on_cover_display_slider_value_changed (GtkRange *range, gpointer
user_data);
@@ -78,7 +78,7 @@
{
gint i;
Cover_Item *cover;
- Itdb_Track *track;
+ Track *track;
printf("Album list\n");
for(i = 0; i < g_list_length(cdwidget->displaytracks); ++i)
@@ -103,18 +103,6 @@
#endif
/**
- * get_default_file_path:
- *
- * Uitlity method to allow other functions to access the path
- * initilialised as DEFAULT_COVER_FILE
- *
- */
- gchar *get_default_cover_file_path ()
- {
- return DEFAULT_FILE;
- }
-
-/**
* draw_blank_cdimage:
*
* creates a blank "black" pixbuf cd image to represent the
@@ -234,7 +222,7 @@
{
GdkPixbuf *imgbuf, *reflection;
gint i, dataindex;
- Itdb_Track *track;
+ Track *track;
Cover_Item *cover;
for(i = 0; i < IMG_TOTAL; ++i)
@@ -250,7 +238,7 @@
}
else
{
- imgbuf = get_thumb (track);
+ imgbuf = coverart_get_track_thumb (track);
gnome_canvas_item_show (cover->highlight);
}
@@ -484,7 +472,7 @@
}
/**
- * get_thumb:
+ * coverart_get_track_thumb:
*
* Retrieve the artwork pixbuf from the given track.
*
@@ -494,11 +482,10 @@
* pixbuf referenced by the provided track or the pixbuf of the
* default file if track has no cover art.
*/
-static GdkPixbuf *get_thumb (Itdb_Track *track)
+static GdkPixbuf *coverart_get_track_thumb (Track *track)
{
Itdb_Thumb *thumb = NULL;
GdkPixbuf *pixbuf = NULL;
- GError *error = NULL;
thumb = itdb_artwork_get_thumb_by_type (track->artwork,
ITDB_THUMB_COVER_LARGE);
if(thumb == NULL)
@@ -514,17 +501,38 @@
else
{
/* Could not get a viable thumbnail so get default pixbuf */
- pixbuf = gdk_pixbuf_new_from_file(DEFAULT_FILE, &error);
- if (error != NULL)
- {
+ pixbuf = coverart_get_default_track_thumb ();
+ }
+
+ return pixbuf;
+}
+
+/**
+ * coverart_get_default_track_thumb:
+ *
+ * Retrieve the artwork pixbuf from the default image file.
+ *
+ * Returns:
+ * pixbuf of the default file for tracks with no cover art.
+ */
+GdkPixbuf *coverart_get_default_track_thumb (void)
+{
+ GdkPixbuf *pixbuf = NULL;
+ GError *error = NULL;
+
+ pixbuf = gdk_pixbuf_new_from_file(DEFAULT_FILE, &error);
+ if (error != NULL)
+ {
printf("Error occurred loading the default file -
\nCode: %d\nMessage: %s\n", error->code, error->message);
g_return_val_if_fail(pixbuf, NULL);
- }
}
-
+
return pixbuf;
}
+
+
+
/**
* search_tracks:
*
@@ -539,7 +547,7 @@
* -1 if the two tracks are different
*
*/
-static gint search_tracks (Itdb_Track *a, Itdb_Track *b)
+static gint search_tracks (Track *a, Track *b)
{
if(a == NULL || b == NULL)
return -1;
@@ -561,7 +569,7 @@
* @progpath: path of the gtkpod binary being loaded.
*
*/
-void init_default_file (gchar *progpath)
+void coverart_init_default_file (gchar *progpath)
{
gchar *progname;
@@ -1003,7 +1011,7 @@
* integer indicating order of tracks
*
*/
-static gint sort_tracks (Itdb_Track *a, Itdb_Track *b)
+static gint sort_tracks (Track *a, Track *b)
{
gint artistval;
@@ -1028,7 +1036,7 @@
* @track: chosen album
*
*/
-void coverart_select_cover (Itdb_Track *track)
+void coverart_select_cover (Track *track)
{
GList *selectedtrk;
gint displaytotal, index;
@@ -1113,7 +1121,7 @@
{
gint i;
GList *tracks;
- Itdb_Track *track;
+ Track *track;
Playlist *playlist;
/* initialize display if not already done */
Index: details.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/details.c,v
retrieving revision 1.20.2.1
retrieving revision 1.20.2.2
diff -u -d -r1.20.2.1 -r1.20.2.2
--- details.c 12 Mar 2007 21:57:39 -0000 1.20.2.1
+++ details.c 25 Mar 2007 22:53:14 -0000 1.20.2.2
@@ -1365,7 +1365,7 @@
{
g_return_if_fail (detail);
- /* FIXME: how do we free the detail->xml? */
+ g_object_unref (detail->xml);
if (detail->window)
{
Index: fetchcover.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/Attic/fetchcover.c,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- fetchcover.c 12 Mar 2007 21:57:39 -0000 1.1.2.1
+++ fetchcover.c 25 Mar 2007 22:53:14 -0000 1.1.2.2
@@ -4,6 +4,8 @@
#include "fetchcover.h"
#include "display_coverart.h"
+#include <glib/gprintf.h>
+#include <glib/gstdio.h>
#define FETCHCOVER_DEBUG 1
@@ -12,15 +14,17 @@
/* Declarations */
[...1073 lines suppressed...]
- fetchcover_start(track);
+ GtkDialog *dialog = fetchcover_display_dialog (detail);
+
+ g_return_if_fail (dialog);
+
+ gint result = gtk_dialog_run (GTK_DIALOG (dialog));
+ switch (result)
+ {
+ case GTK_RESPONSE_ACCEPT:
+ fetchcover_save (detail);
+ break;
+ default:
+ fetchcover_cancel ();
+ break;
+ }
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+
#endif /* HAVE_CURL */
}
Index: display_coverart.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display_coverart.h,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -u -d -r1.4.2.1 -r1.4.2.2
--- display_coverart.h 12 Mar 2007 21:57:39 -0000 1.4.2.1
+++ display_coverart.h 25 Mar 2007 22:53:14 -0000 1.4.2.2
@@ -41,8 +41,8 @@
extern const gchar *DISPLAY_COVER_SHOW;
-gchar *get_default_cover_file_path ();
-void init_default_file (gchar *progpath);
+GdkPixbuf *coverart_get_default_track_thumb (void);
+void coverart_init_default_file (gchar *progpath);
void coverart_sort_images (GtkSortType order);
void coverart_select_cover (Itdb_Track *track);
void coverart_set_images ();
Index: fetchcover.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/Attic/fetchcover.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- fetchcover.h 12 Mar 2007 21:57:39 -0000 1.1.2.1
+++ fetchcover.h 25 Mar 2007 22:53:14 -0000 1.1.2.2
@@ -14,7 +14,7 @@
#include "prefs.h"
-void fetchcover_start (Track *track);
+GtkDialog *fetchcover_display_dialog(Detail *detail);
void on_fetchcover_fetch_button (GtkWidget *widget, gpointer data);
#endif
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2