Update of /cvsroot/gtkpod/gtkpod/src
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv30988/src

Modified Files:
      Tag: fetchcover_development_branch
        context_menus.h display_coverart.c fetchcover.c 
        display_coverart.h context_menus.c 
Log Message:
gtkpod.glade:
        * rename Fetch Cover button
context_menus.c:
        * create context menu for main coverart display image
        * new context action hooks to display artwork in a dialog
display_coverart.c:
        * coverart_display_big_artwork() for displaying a dialog containing an 
originally sized coverart image
        * coverart_get_displayed_tracks() for returning all tracks relating to 
the main coverart display image
fetchcover.c
        * completed functionality, including next, previous, cancel and save 
buttons
        * status bar to indicate whether images have been recovered

Index: context_menus.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/context_menus.h,v
retrieving revision 1.5
retrieving revision 1.5.8.1
diff -u -d -r1.5 -r1.5.8.1
--- context_menus.h     17 Jan 2004 09:37:48 -0000      1.5
+++ context_menus.h     1 Apr 2007 19:47:10 -0000       1.5.8.1
@@ -32,5 +32,6 @@
 void tm_context_menu_init(void);
 void st_context_menu_init(gint inst);
 void pm_context_menu_init(void);
+void cad_context_menu_init(void);
 
 #endif

Index: display_coverart.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display_coverart.c,v
retrieving revision 1.7.2.2
retrieving revision 1.7.2.3
diff -u -d -r1.7.2.2 -r1.7.2.3
--- display_coverart.c  25 Mar 2007 22:53:14 -0000      1.7.2.2
+++ display_coverart.c  1 Apr 2007 19:47:10 -0000       1.7.2.3
@@ -36,6 +36,8 @@
 #include "itdb.h"
 #include "prefs.h"
 #include "display_coverart.h"
+#include "context_menus.h"
+#include "details.h"
 
 /* Declarations */
 static gint sort_tracks (Track *a, Track *b);
@@ -46,11 +48,12 @@
 /*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 gint on_main_cover_image_clicked (GnomeCanvasItem *canvasitem, GdkEvent 
*event, gpointer data);
 static void on_cover_display_slider_value_changed (GtkRange *range, gpointer 
user_data);
 static void set_cover_dimensions (Cover_Item *cover, int cover_index);
 static void prepare_canvas ();
 static void set_covers ();
+static gint search_tracks (Track *a, Track *b);
 
 /* Prefs keys */
 const gchar *KEY_DISPLAY_COVERART="display_coverart";
@@ -283,55 +286,6 @@
     }
 }
 
-#if 0
-/**
- * scroll_covers:
- *
- * Performs the work of cycling the cd covers when the left or
- * right buttons are clicked.
- * 
- * @direction: the direction of the cycling of the covers, either
- * IMG_PREV or IMG_NEXT.
- */
-static void scroll_covers(gint direction)
-{
-       gint displaytotal;
-  
-  displaytotal = g_list_length(cdwidget->displaytracks);
-  
-  if (displaytotal <= 0)
-       return;
-  
-  switch (direction)
-       {
-               case IMG_NEXT:
-               cdwidget->first_imgindex++;
-               /* Check there is another possible image to display */
-               if ((cdwidget->first_imgindex + IMG_TOTAL) > displaytotal)
-               {
-                       /* Return to as it was and get out */
-                       cdwidget->first_imgindex--;
-                       return;
-               }
-               break;
-       case IMG_PREV:
-               cdwidget->first_imgindex--;
-               /* Check the index has not dropped below 0 */
-               if (cdwidget->first_imgindex < 0)
-               {
-                       /* Return to as it was and get out */
-                       cdwidget->first_imgindex++;
-                       return;
-               }
-               break;
-       }
-  
-  set_covers();
-  
-}
-#endif
-
-
 /**
  * on_cover_display_slider_value_changed:
  *
@@ -405,28 +359,49 @@
  * @data: any data needed by the function (not required) 
  *  
  */
-static void on_main_cover_image_clicked (GnomeCanvas *canvas, GdkEvent *event, 
gpointer data)
+static gint on_main_cover_image_clicked (GnomeCanvasItem *canvasitem, GdkEvent 
*event, gpointer data)
 {
        Cover_Item *cover;
        gboolean status;
+       guint mbutton;
        
        if(event->type != GDK_BUTTON_PRESS)
-               return;
-       
-       cover = g_ptr_array_index(cdwidget->cdcovers, IMG_MAIN);
+               return FALSE;
+               
+       mbutton = event->button.button;
        
-       /* Stop redisplay of the artwork as its already
-        * in the correct location
-        */
-       coverart_block_change (TRUE);
+       if (mbutton == 1)
+       {
+               /* Left mouse button clicked so find all tracks with displayed 
cover */
+               
+               cover = g_ptr_array_index(cdwidget->cdcovers, IMG_MAIN);
+               /* Stop redisplay of the artwork as its already
+                * in the correct location
+                */
+               coverart_block_change (TRUE);
        
-       /* Select the correct track in the sorttabs */
-       status = st_set_selection (cover->track);
+               /* Select the correct track in the sorttabs */
+               status = st_set_selection (cover->track);
        
-       /* Turn the display change back on */
-       coverart_block_change (FALSE);
+               /* Turn the display change back on */
+               coverart_block_change (FALSE);
+       }
+       else if ((mbutton == 3) && (event->button.state & GDK_SHIFT_MASK))
+       {
+               /* Right mouse button clicked and shift pressed.
+                * Go straight to edit details window
+                */
+               details_edit (coverart_get_displayed_tracks());
+       }
+       else if (mbutton == 3)
+       {
+               /* Right mouse button clicked on its own so display
+                * popup menu
+                */
+               cad_context_menu_init ();
+       }
        
-       g_return_if_fail (status);
+       return FALSE;
 }
 
 /**
@@ -508,6 +483,130 @@
 }
 
 /**
+ * coverart_get_displayed_tracks:
+ *
+ * Get all tracks suggested by the displayed album cover.
+ * 
+ * Returns:
+ * GList containing references to all the displayed covered tracks
+ */
+GList *coverart_get_displayed_tracks (void)
+{
+       Playlist *playlist;
+       Cover_Item *cover;
+       GList *tracks;
+       GList *matches = NULL;
+       Track *track;
+       
+       /* Find the selected playlist */
+       playlist = pm_get_selected_playlist ();
+       if (playlist == NULL)
+               g_return_val_if_fail (playlist, NULL);
+
+       tracks = playlist->members;
+       g_return_val_if_fail (tracks, NULL);
+       
+       cover = g_ptr_array_index(cdwidget->cdcovers, IMG_MAIN);
+       g_return_val_if_fail (cover, NULL);
+       
+       /* Need to search through the list of tracks in the selected playlist
+        * for all tracks matching artist and then album
+        */
+       while (tracks)
+       {
+               track = tracks->data;
+               
+               if (search_tracks (cover->track, track) == 0)
+               {
+                       /* Track details match the displayed cover->track */
+                       matches = g_list_prepend (matches, track);
+               }       
+               tracks = tracks->next;
+       }
+       
+       matches = g_list_reverse(matches);
+       
+       return matches;
+}
+
+void coverart_display_big_artwork (GList *tracks)
+{
+       GtkWidget *dialog;
+       Cover_Item *cover;
+       GdkPixbuf *imgbuf;
+       
+       cover = g_ptr_array_index(cdwidget->cdcovers, IMG_MAIN);
+       g_return_if_fail (cover);
+       
+       /* Set the dialog title */
+       gchar *text = g_strconcat (cover->track->artist, ": ", 
cover->track->album, NULL);
+       dialog = gtk_dialog_new_with_buttons (  text,
+                                                                               
                                                                                
                                                                                
                        GTK_WINDOW (gtkpod_xml_get_widget (main_window_xml, 
"gtkpod")),
+                                                                               
                                                                                
                                                                                
                        GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                                               
                                                                                
                                                                                
                        "_Close",
+                                                                               
                                                                                
                                                                                
                        GTK_RESPONSE_CLOSE,
+                                                                               
                                                                                
                                                                                
                        NULL);
+       
+       g_free (text);
+       
+       /* Get the filename of the cover art from the track's thumb */
+       Itdb_Thumb *thumb = itdb_artwork_get_thumb_by_type 
(cover->track->artwork, ITDB_THUMB_COVER_LARGE);
+       GError *error = NULL;
+       if (thumb)
+       {
+               gchar *artpath = itdb_thumb_get_filename 
(cover->track->itdb->device, thumb);
+               imgbuf = gdk_pixbuf_new_from_file(artpath, &error);
+               if (error != NULL)
+               {
+                       printf("Error occurred loading the default file - 
\nCode: %d\nMessage: %s\n", error->code, error->message);
+                       /* Artwork failed to load from file so try loading 
default */
+                       imgbuf = coverart_get_default_track_thumb ();
+                       g_error_free (error);
+               }
+               g_free(artpath);
+       }
+       else
+       {
+               /* No thumb extractable from track */
+               imgbuf = coverart_get_default_track_thumb ();
+       }
+       
+       gint pixheight = gdk_pixbuf_get_height (imgbuf);
+       gint pixwidth = gdk_pixbuf_get_width (imgbuf);
+       
+       gtk_window_resize ( GTK_WINDOW(dialog), pixwidth, pixheight + 40);
+       
+       GnomeCanvas *canvas;
+       canvas = GNOME_CANVAS (gnome_canvas_new());
+       gtk_widget_set_size_request ( GTK_WIDGET(canvas),
+                                                                               
                                                                                
                                        pixwidth,
+                                                                               
                                                                                
                                        pixheight);
+       gnome_canvas_set_scroll_region (        canvas,
+                                                                               
                                                                                
                                                                        0.0, 
0.0, 
+                                                                               
                                                                                
                                                                        
pixwidth,
+                                                                               
                                                                                
                                                                        
pixheight);
+       GnomeCanvasItem *canvasitem;                                            
                                        
+       canvasitem = gnome_canvas_item_new(     gnome_canvas_root(canvas),
+                                                                               
                                                                                
                                                                                
                                GNOME_TYPE_CANVAS_PIXBUF, NULL);
+       
+       /* Apply the image to the canvas */
+       gnome_canvas_item_set ( canvasitem,
+                                                                               
                                                                                
                "pixbuf", imgbuf);
+
+       gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), 
GTK_WIDGET(canvas));
+       gdk_pixbuf_unref (imgbuf);
+       
+       /* Display the dialog and block everything else until the
+        * dialog is closed.
+        */
+       gtk_widget_show_all (dialog);
+       gtk_dialog_run (GTK_DIALOG(dialog));
+       
+       /* Destroy the dialog as no longer required */
+       gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+
+/**
  * coverart_get_default_track_thumb:
  *
  * Retrieve the artwork pixbuf from the default image file.
@@ -530,9 +629,6 @@
        return pixbuf;
 }
 
-
-
-
 /**
  * search_tracks:
  *
@@ -631,7 +727,6 @@
   }
 }
 
-
 /**
  * on_cover_up_button_clicked:
  *

Index: fetchcover.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/Attic/fetchcover.c,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -d -r1.1.2.3 -r1.1.2.4
--- fetchcover.c        28 Mar 2007 18:31:32 -0000      1.1.2.3
+++ fetchcover.c        1 Apr 2007 19:47:10 -0000       1.1.2.4
@@ -9,28 +9,8 @@
 
 #define FETCHCOVER_DEBUG 1
 
-#ifdef HAVE_CURL
-#include <curl/curl.h>
-
-/* Declarations */
-static void fetchcover_debug(const gchar *format, ...);
-static void free_fetchcover_list();
-static void *safe_realloc(void *ptr, size_t size);
-static size_t curl_write_fetchcover_func(void *ptr, size_t itemsize, size_t 
numitems, void *data);
-static void net_search_track ();
-static void net_retrieve_image (GString *url);
-static void fetchcover_next_button_clicked (GtkWidget *widget, gpointer data);
-static void fetchcover_prev_button_clicked (GtkWidget *widget, gpointer data);
-static void fetchcover_cleanup();
-static void fetchcover_cancel ();
-static void fetchcover_save (Detail *detail);
 static void fetchcover_statusbar_update (gchar *message);
-
-struct chunk
-{
-       gchar *memory;
-       size_t size;
-};
+static void fetchcover_cancel ();
 
 typedef struct
 {
@@ -40,19 +20,12 @@
        gchar *filename;
 } Fetch_Cover;
 
-#define FETCHCOVER_MAXURL 16
-#define IMGSCALE 256
-
 /* Track to search for a cover for */
 static Track *fetchcover_track = NULL;
 /* List of possible covers, including existing one (maybe default cover) */
 static GList *fetchcover_image_list = NULL;
 /* Index for controlling which cover image to display */
 static gint displayed_cover_index = 0;
-/* Flag indicating whether a new net search should be initiated */
-static gboolean netsearched = FALSE;
-/* Data structure for use with curl */
-struct chunk fetchcover_curl_data;
 /* Pointer to the currently display cover */
 static Fetch_Cover *displayed_cover;
 /* Canvas widget for display of cover */
@@ -65,57 +38,34 @@
 /* Status bar for displaying status messages */
 static GtkWidget *fetchcover_statusbar;
 
-/**
- * free_fetchcover:
- * 
- * @Fetch_Cover: fcover
- * 
- * Free the elements of the passed in Fetch_Cover structure
- */
-static void free_fetchcover (Fetch_Cover *fcover)
-{
-       if (! fcover)
-               return;
-               
-       if (fcover->url)
-               g_string_free (fcover->url, TRUE);
-       
-       if (fcover->image)
-               gdk_pixbuf_unref (fcover->image);
-               
-       if (fcover->dir && fcover->filename)
-       {
-               gint status;
-               gchar *path;
-               path = g_build_filename (fcover->dir, fcover->filename, NULL);
-               status = g_remove (path);
-               g_free(path);
-               g_free (fcover->dir);
-               g_free (fcover->filename);
-       }
-}
+#ifdef HAVE_CURL
 
-/**
- * free_fetchcover_list:
- *
- * Nullify all the urls in the url list as part of
- * cleaning up.
- * 
- */
-static void free_fetchcover_list()
+#include <curl/curl.h>
+
+/* Declarations */
+static void fetchcover_debug(const gchar *format, ...);
+static void free_fetchcover_list();
+static void *safe_realloc(void *ptr, size_t size);
+static size_t curl_write_fetchcover_func(void *ptr, size_t itemsize, size_t 
numitems, void *data);
+static void net_search_track ();
+static void net_retrieve_image (GString *url);
+static void fetchcover_next_button_clicked (GtkWidget *widget, gpointer data);
+static void fetchcover_prev_button_clicked (GtkWidget *widget, gpointer data);
+static void fetchcover_cleanup();
+static void fetchcover_save (Detail *detail);
+
+struct chunk
 {
-       fetchcover_debug("free_fetchcover_list");
-       
-       gint i;
-       Fetch_Cover *fcover = NULL;
-       for (i = 0; i < g_list_length (fetchcover_image_list); ++i)
-       {
-               fcover = g_list_nth_data (fetchcover_image_list, i);
-               free_fetchcover (fcover);
-       }
-       g_list_free (fetchcover_image_list);
-       fetchcover_image_list = NULL;
-}
+       gchar *memory;
+       size_t size;
+};
+
+#define IMGSCALE 256
+
+/* Flag indicating whether a new net search should be initiated */
+static gboolean netsearched = FALSE;
+/* Data structure for use with curl */
+struct chunk fetchcover_curl_data;
 
 /**
  * safe_realloc:
@@ -318,7 +268,7 @@
  *
  * @GString: url
  *
- * Use the url acquited from the net search to fetch the image,
+ * Use the url acquired from the net search to fetch the image,
  * save it to a file inside the track's parent directory then display
  * it as a pixbuf
  */
@@ -443,6 +393,8 @@
  */
 static void fetchcover_next_button_clicked (GtkWidget *widget, gpointer data)
 {
+       GdkWindow *window = gtk_widget_get_parent_window (widget);
+       gdk_window_set_cursor (window, gdk_cursor_new (GDK_WATCH));
        fetchcover_debug("fetchcover_next_button: getting cover for:\n- Artist: 
%s\n- Album:  %s",
                                                                                
                                                                        
fetchcover_track->artist, fetchcover_track->album);
        
@@ -492,6 +444,8 @@
        GdkPixbuf *scaled = gdk_pixbuf_scale_simple(displayed_cover->image, 
IMGSCALE, IMGSCALE, GDK_INTERP_NEAREST);
        gnome_canvas_item_set(fetchcover_canvasitem, "pixbuf", scaled);
        
+       gdk_window_set_cursor (window, gdk_cursor_new (GDK_LEFT_PTR));
+       
        return;
 }
 
@@ -539,6 +493,90 @@
        return;
 }
 
+static void fetchcover_debug(const gchar *format, ...)
+{
+       if (FETCHCOVER_DEBUG)
+       {
+               va_list args;
+               va_start(args, format);
+               gchar *s = g_strdup_vprintf(format, args);
+               va_end(args);
+               printf("%s\n", s);
+               fflush(stdout);
+               g_free(s);
+       }
+}
+
+#endif /* HAVE_CURL */
+
+/**
+ * fetchcover_statusbar_update:
+ * 
+ * @gchar*: messagel
+ *
+ * Display a message in the status bar component of the dialog
+ */
+static void fetchcover_statusbar_update (gchar *message)
+{
+       if (fetchcover_statusbar)
+       {
+               gtk_statusbar_pop(GTK_STATUSBAR(fetchcover_statusbar), 1);
+               gtk_statusbar_push(GTK_STATUSBAR(fetchcover_statusbar), 1,  
message);
+       }
+}
+
+/**
+ * free_fetchcover:
+ * 
+ * @Fetch_Cover: fcover
+ * 
+ * Free the elements of the passed in Fetch_Cover structure
+ */
+static void free_fetchcover (Fetch_Cover *fcover)
+{
+       if (! fcover)
+               return;
+               
+       if (fcover->url)
+               g_string_free (fcover->url, TRUE);
+       
+       if (fcover->image)
+               gdk_pixbuf_unref (fcover->image);
+               
+       if (fcover->dir && fcover->filename)
+       {
+               gint status;
+               gchar *path;
+               path = g_build_filename (fcover->dir, fcover->filename, NULL);
+               status = g_remove (path);
+               g_free(path);
+               g_free (fcover->dir);
+               g_free (fcover->filename);
+       }
+}
+
+/**
+ * free_fetchcover_list:
+ *
+ * Nullify all the urls in the url list as part of
+ * cleaning up.
+ * 
+ */
+static void free_fetchcover_list()
+{
+       fetchcover_debug("free_fetchcover_list");
+       
+       gint i;
+       Fetch_Cover *fcover = NULL;
+       for (i = 0; i < g_list_length (fetchcover_image_list); ++i)
+       {
+               fcover = g_list_nth_data (fetchcover_image_list, i);
+               free_fetchcover (fcover);
+       }
+       g_list_free (fetchcover_image_list);
+       fetchcover_image_list = NULL;
+}
+
 /**
  * fetchcover_cleanup:
  *
@@ -546,12 +584,14 @@
  */
 static void fetchcover_cleanup()
 {      
+       #ifdef HAVE_CURL
        if (fetchcover_curl_data.memory)
        {
                g_free (fetchcover_curl_data.memory);
                fetchcover_curl_data.memory = NULL;
                fetchcover_curl_data.size = 0;
        }
+       #endif /* CURL */
        free_fetchcover_list();
                
        /* Clear the status bar */
@@ -578,7 +618,8 @@
  * Called on response to the clicking of the save button in the dialog
  */
 static void fetchcover_save (Detail *detail)
-{      
+{
+       #ifdef HAVE_CURL        
        /* The default cover image will have both dir and filename set
         * to null because no need to save because it is already saved (!!)
         * Thus, this whole process is avoided. Added bonus that pressing
@@ -646,30 +687,12 @@
                details_update_thumbnail(detail);
                details_update_buttons(detail);
        }
-       
+       #endif /* HAVE_CURL */
        
        fetchcover_cleanup();
 }
 
 /**
- * fetchcover_statusbar_update:
- * 
- * @gchar*: messagel
- *
- * Display a message in the status bar component of the dialog
- */
-static void fetchcover_statusbar_update (gchar *message)
-{
-       if (fetchcover_statusbar)
-       {
-               gtk_statusbar_pop(GTK_STATUSBAR(fetchcover_statusbar), 1);
-               gtk_statusbar_push(GTK_STATUSBAR(fetchcover_statusbar), 1,  
message);
-       }
-}
-
-//#endif /* HAVE_CURL */
-
-/**
  * fetchcover_display_dialog:
  *
  * Create fetchcover_window, get album cover from Amazon
@@ -678,7 +701,6 @@
  */
 GtkDialog *fetchcover_display_dialog (Detail *detail)
 {
-//#ifdef HAVE_CURL
        GtkBox *canvasbutton_hbox, *panelbox, *buttonbox;
        GtkWidget *fetchcover_dialog;
        
@@ -709,7 +731,7 @@
                        imgbuf = gdk_pixbuf_new_from_file(artpath, &error);
                        if (error != NULL)
                        {
-                               printf("Error occurred loading the default file 
- \nCode: %d\nMessage: %s\n", error->code, error->message);
+                               printf("Error occurred loading the artwork file 
- \nCode: %d\nMessage: %s\n", error->code, error->message);
                                /* Artwork failed to load from file */
                                trkartfail = TRUE;
                                g_error_free (error);
@@ -794,6 +816,7 @@
        gtk_container_add (     GTK_CONTAINER 
(GTK_DIALOG(fetchcover_dialog)->vbox),
                                                                        
GTK_WIDGET (panelbox));
   
+  #ifdef HAVE_CURL
   g_signal_connect (G_OBJECT(next_button), "clicked",
                      G_CALLBACK(fetchcover_next_button_clicked), NULL);        
        
@@ -815,11 +838,16 @@
                fetchcover_statusbar_update (buf);
                g_free (buf);
        }
+       #else
+               gtk_widget_set_sensitive (next_button, FALSE);
+               gtk_widget_set_sensitive (prev_button, FALSE):
+               fetchcover_statusbar_update ("CURL has not been installed so 
recovery of album covers cannot be performed");
+       #endif /* HAVE_CURL */
+       
        
   gtk_widget_show_all (fetchcover_dialog);
   
        return GTK_DIALOG(fetchcover_dialog);
-#endif /* HAVE_CURL */
 }
 
 /**
@@ -833,7 +861,6 @@
  */
 void on_fetchcover_fetch_button (GtkWidget *widget, gpointer data)
 {
-#ifdef HAVE_CURL
        Detail *detail = details_get_selected_detail ();
        GtkDialog *dialog = fetchcover_display_dialog (detail);
        
@@ -850,20 +877,4 @@
      break;
        }
   gtk_widget_destroy (GTK_WIDGET (dialog));
-
-#endif /* HAVE_CURL */
-}
-
-static void fetchcover_debug(const gchar *format, ...)
-{
-       if (FETCHCOVER_DEBUG)
-       {
-               va_list args;
-               va_start(args, format);
-               gchar *s = g_strdup_vprintf(format, args);
-               va_end(args);
-               printf("%s\n", s);
-               fflush(stdout);
-               g_free(s);
-       }
 }

Index: display_coverart.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display_coverart.h,v
retrieving revision 1.4.2.2
retrieving revision 1.4.2.3
diff -u -d -r1.4.2.2 -r1.4.2.3
--- display_coverart.h  25 Mar 2007 22:53:14 -0000      1.4.2.2
+++ display_coverart.h  1 Apr 2007 19:47:10 -0000       1.4.2.3
@@ -41,12 +41,14 @@
 
 extern const gchar *DISPLAY_COVER_SHOW;
 
+void coverart_display_big_artwork (GList *tracks);
+GList *coverart_get_displayed_tracks (void);
 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 ();
 void coverart_clear_images ();
-void coverart_block_change ();
+void coverart_block_change (gboolean val);
 void coverart_init_display ();
 #endif

Index: context_menus.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/context_menus.c,v
retrieving revision 1.67
retrieving revision 1.67.4.1
diff -u -d -r1.67 -r1.67.4.1
--- context_menus.c     24 Nov 2006 11:18:21 -0000      1.67
+++ context_menus.c     1 Apr 2007 19:47:10 -0000       1.67.4.1
@@ -42,6 +42,7 @@
 #include "tools.h"
 #include "repository.h"
 #include "syncdir.h"
+#include "display_coverart.h"
 
 #define LOCALDEBUG 0
 
@@ -55,7 +56,8 @@
     CM_PL = 0,
     CM_ST,
     CM_TM,
-    CM_NUM
+    CM_NUM,
+    CM_CAD
 } CM_type;
 
 
@@ -77,7 +79,6 @@
        gchar *mp;
        Track *tr = gl->data;
        g_return_if_fail (tr);
-
        g_object_get (tr->itdb->device, "mount-point", &mp, NULL);
        printf ("mountpoint: %s\n", mp);
        g_free (mp);
@@ -166,6 +167,18 @@
 }
 
 /*
+ * display the dialog with the full size cd artwork cover
+ * @mi - the menu item selected
+ * @data - Ignored, should be NULL
+ */
+static void
+display_track_artwork(GtkMenuItem *mi, gpointer data)
+{
+       if (selected_tracks)
+               coverart_display_big_artwork (selected_tracks);
+}
+
+/*
  * update_entries - update the entries currently selected
  * @mi - the menu item selected
  * @data - Ignored, should be NULL
@@ -496,6 +509,13 @@
                      G_CALLBACK (edit_details_entries), NULL);
 }
 
+static GtkWidget *add_display_big_coverart (GtkWidget *menu)
+{
+    return hookup_mi (menu,  _("View Full Size Artwork"),
+                     GTK_STOCK_EDIT,
+                     G_CALLBACK (display_track_artwork), NULL);        
+}
+
 static GtkWidget *add_check_ipod_files (GtkWidget *menu)
 {
     /* FIXME */
@@ -767,6 +787,10 @@
            }
 #endif
            break;
+       case CM_CAD:
+                       add_display_big_coverart (menu);
+                       add_edit_track_details (menu);
+                       break;
        case CM_NUM:
            g_return_if_reached ();
        }
@@ -805,6 +829,27 @@
     }
 }
 /**
+ * cad_context_menu_init - initialize the right click menu for coverart 
display 
+ */
+void
+cad_context_menu_init(void)
+{
+    if (widgets_blocked) return;
+    
+    selected_entry = NULL; 
+    selected_playlist = NULL;
+    active_itdb = gp_get_selected_itdb ();
+    entry_inst = -1;
+    
+    if (selected_tracks)  g_list_free (selected_tracks);
+    selected_tracks = coverart_get_displayed_tracks();
+    
+    if(selected_tracks)
+    {
+                       create_context_menu (CM_CAD);
+    }
+}
+/**
  * pm_context_menu_init - initialize the right click menu for playlists 
  */
 void


-------------------------------------------------------------------------
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

Reply via email to