commit de6df5dac6313bcb5e31294439c73a045f299e6d
Author: phantomjinx <[email protected]>
Date: Tue Jul 13 21:40:07 2010 +0100
Remove itdb callback and photo support
* gtkpod_app_iface.*
* itdb setting implied by the setting of the playlist so no need for the
separate setter function or callback
* playlist_display/plugin.c
* Playlist display has no need to worry about tracks being removed since
the view never displays tracks
* display_playlists.c
* pm_remove_track and pm_add_track simply notify other UI components so
no longer necessary
* file_itunesdb.c
* display_photo.c
* Re-implement photo database support
* Add load_photodb function from display_photo since it is a library
function that has no UI elments
* display_photo to become core of photo plugin
TODO | 23 +++
libgtkpod/gtkpod_app_iface.c | 17 +--
libgtkpod/gtkpod_app_iface.h | 1 -
plugins/info_display/plugin.c | 1 -
plugins/playlist_display/plugin.c | 2 -
src/display_photo.c | 307 ++++++++++++++++---------------------
src/display_playlists.c | 108 ++------------
src/file_itunesdb.c | 52 ++++++-
8 files changed, 214 insertions(+), 297 deletions(-)
---
diff --git a/TODO b/TODO
index 011b76e..67204d6 100644
--- a/TODO
+++ b/TODO
@@ -96,3 +96,26 @@ Notes on trial build using ubuntu 910
# Change configure.in to signal at the bottom status of webkit
#- pkconfig.pc for libgtkpod
+1) Deleted Music Library
+2) Created Music Library
+3) Added localmusic
+
+
+** Message: TODO signal all things such as conversions to cancel
+
+(lt-gtkpod:12130): GLib-GObject-WARNING **: invalid unclassed pointer in cast
to `GtkFileChooser'
+
+(lt-gtkpod:12130): Gtk-CRITICAL **: gtk_file_chooser_get_current_folder:
assertion `GTK_IS_FILE_CHOOSER (chooser)' failed
+
+** (lt-gtkpod:12130): WARNING **: busy push XXX
+** Message: TODO load photodb handle
+
+** Message: TODO signal all things such as conversions to cancel
+
+** (lt-gtkpod:12130): CRITICAL **: coverart_select_cover: assertion `key'
failed
+** Message: TODO - update smart playlists before writing
+
+
+(lt-gtkpod:12130): GLib-GObject-CRITICAL **: g_object_ref: assertion
`G_IS_OBJECT (object)' failed
+** Message: TODO - cleanup gphoto_window on shutdown
+
diff --git a/libgtkpod/gtkpod_app_iface.c b/libgtkpod/gtkpod_app_iface.c
index 254bf58..7a4e9b6 100644
--- a/libgtkpod/gtkpod_app_iface.c
+++ b/libgtkpod/gtkpod_app_iface.c
@@ -251,18 +251,6 @@ iTunesDB* gtkpod_get_current_itdb() {
return GTKPOD_APP_GET_INTERFACE (gtkpod_app)->current_itdb;
}
-void gtkpod_set_current_itdb(iTunesDB* itdb) {
- g_return_if_fail (GTKPOD_IS_APP(gtkpod_app));
- GTKPOD_APP_GET_INTERFACE (gtkpod_app)->current_itdb = itdb;
-
- if (!itdb) // If setting itdb to null then set playlist to null too
- gtkpod_set_current_playlist(NULL);
-
- if (itdb && g_list_index(itdb->playlists, gtkpod_get_current_playlist())
== -1)
- // if playlist is not in itdb then set it to null
- gtkpod_set_current_playlist(NULL);
-}
-
Playlist* gtkpod_get_current_playlist() {
g_return_val_if_fail (GTKPOD_IS_APP(gtkpod_app), NULL);
return GTKPOD_APP_GET_INTERFACE (gtkpod_app)->current_playlist;
@@ -273,8 +261,11 @@ void gtkpod_set_current_playlist(Playlist* playlist) {
GTKPOD_APP_GET_INTERFACE (gtkpod_app)->current_playlist = playlist;
if (playlist) {// if playlist not null then set its itdb as current
- gtkpod_set_current_itdb(playlist->itdb);
+ GTKPOD_APP_GET_INTERFACE (gtkpod_app)->current_itdb = playlist->itdb;
gtkpod_set_displayed_tracks(playlist->members);
+ } else {
+ GTKPOD_APP_GET_INTERFACE (gtkpod_app)->current_itdb = NULL;
+ gtkpod_set_displayed_tracks(NULL);
}
g_signal_emit(gtkpod_app, gtkpod_app_signals[PLAYLIST_SELECTED], 0,
playlist);
diff --git a/libgtkpod/gtkpod_app_iface.h b/libgtkpod/gtkpod_app_iface.h
index 88403d0..52c7053 100644
--- a/libgtkpod/gtkpod_app_iface.h
+++ b/libgtkpod/gtkpod_app_iface.h
@@ -174,7 +174,6 @@ void gtkpod_notify_data_changed(iTunesDB *itdb);
void gtkpod_notify_data_unchanged(iTunesDB *itdb);
iTunesDB* gtkpod_get_current_itdb();
-void gtkpod_set_current_itdb(iTunesDB* itdb);
Playlist* gtkpod_get_current_playlist();
void gtkpod_set_current_playlist(Playlist* playlist);
diff --git a/plugins/info_display/plugin.c b/plugins/info_display/plugin.c
index de6941a..cd968a8 100644
--- a/plugins/info_display/plugin.c
+++ b/plugins/info_display/plugin.c
@@ -74,7 +74,6 @@ static gboolean activate_plugin(AnjutaPlugin *plugin) {
g_signal_connect (gtkpod_app, SIGNAL_PLAYLIST_SELECTED, G_CALLBACK
(info_display_playlist_selected_cb), NULL);
g_signal_connect (gtkpod_app, SIGNAL_PLAYLIST_ADDED, G_CALLBACK
(info_display_playlist_added_cb), NULL);
g_signal_connect (gtkpod_app, SIGNAL_PLAYLIST_REMOVED, G_CALLBACK
(info_display_playlist_removed_cb), NULL);
-
g_signal_connect (gtkpod_app, SIGNAL_TRACK_UPDATED, G_CALLBACK
(info_display_track_updated_cb), NULL);
g_signal_connect (gtkpod_app, SIGNAL_TRACK_REMOVED, G_CALLBACK
(info_display_track_removed_cb), NULL);
g_signal_connect (gtkpod_app, SIGNAL_TRACKS_DISPLAYED, G_CALLBACK
(info_display_tracks_displayed_cb), NULL);
diff --git a/plugins/playlist_display/plugin.c
b/plugins/playlist_display/plugin.c
index 02e27bf..c58b174 100644
--- a/plugins/playlist_display/plugin.c
+++ b/plugins/playlist_display/plugin.c
@@ -335,7 +335,6 @@ static gboolean activate_plugin(AnjutaPlugin *plugin) {
g_signal_connect (gtkpod_app, SIGNAL_PLAYLIST_SELECTED, G_CALLBACK
(playlist_display_select_playlist_cb), NULL);
g_signal_connect (gtkpod_app, SIGNAL_PLAYLIST_ADDED, G_CALLBACK
(playlist_display_playlist_added_cb), NULL);
g_signal_connect (gtkpod_app, SIGNAL_PLAYLIST_REMOVED, G_CALLBACK
(playlist_display_playlist_removed_cb), NULL);
- g_signal_connect (gtkpod_app, SIGNAL_TRACK_REMOVED, G_CALLBACK
(playlist_display_track_removed_cb), NULL);
g_signal_connect (gtkpod_app, SIGNAL_ITDB_ADDED, G_CALLBACK
(playlist_display_itdb_added_cb), NULL);
g_signal_connect (gtkpod_app, SIGNAL_ITDB_REMOVED, G_CALLBACK
(playlist_display_itdb_removed_cb), NULL);
g_signal_connect (gtkpod_app, SIGNAL_ITDB_UPDATED, G_CALLBACK
(playlist_display_update_itdb_cb), NULL);
@@ -360,7 +359,6 @@ static gboolean deactivate_plugin(AnjutaPlugin *plugin) {
g_signal_handlers_disconnect_by_func (plugin->shell, G_CALLBACK
(playlist_display_select_playlist_cb), plugin);
g_signal_handlers_disconnect_by_func (plugin->shell, G_CALLBACK
(playlist_display_playlist_added_cb), plugin);
g_signal_handlers_disconnect_by_func (plugin->shell, G_CALLBACK
(playlist_display_playlist_removed_cb), plugin);
- g_signal_handlers_disconnect_by_func (plugin->shell, G_CALLBACK
(playlist_display_track_removed_cb), plugin);
g_signal_handlers_disconnect_by_func (plugin->shell, G_CALLBACK
(playlist_display_itdb_added_cb), plugin);
g_signal_handlers_disconnect_by_func (plugin->shell, G_CALLBACK
(playlist_display_itdb_removed_cb), plugin);
g_signal_handlers_disconnect_by_func (plugin->shell, G_CALLBACK
(playlist_display_update_itdb_cb), plugin);
diff --git a/src/display_photo.c b/src/display_photo.c
index 65ce748..07c4d7b 100644
--- a/src/display_photo.c
+++ b/src/display_photo.c
@@ -1,7 +1,7 @@
/*
|Copyright (C) 2007 P.G. Richardson <phantom_sf at users.sourceforge.net>
|Part of the gtkpod project.
- |
+ |
|URL: http://www.gtkpod.org/
|URL: http://gtkpod.sourceforge.net/
|
@@ -125,59 +125,12 @@ enum
};
/**
- * gphoto_load_photodb:
- *
- * Using the info in the provided itunes db, load the photo db
- * from the ipod if there is one present. Reference it in the
- * extra itunes db data structure for later use.
- *
- * @ itdb: itunes database
- *
- */
-void gphoto_load_photodb(iTunesDB *itdb)
-{
- ExtraiTunesDBData *eitdb;
- PhotoDB *db;
- const gchar *mp;
- GError *error= NULL;
-
- g_return_if_fail (itdb);
-
- eitdb = itdb->userdata;
- g_return_if_fail (eitdb);
- g_return_if_fail (eitdb->photodb == NULL);
-
- mp = itdb_get_mountpoint (itdb);
- db = itdb_photodb_parse (mp, &error);
- if (db == NULL)
- {
- if (itdb_device_supports_photo (itdb->device))
- {
- if (error)
- {
- gtkpod_warning (_("Error reading iPod photo database
(%s).\n"), error->message);
- } else
- {
- gtkpod_warning (_("Error reading iPod photo
database.\n"));
- }
- }
- }
- if (error)
- {
- g_error_free (error);
- error = NULL;
- }
- /* Set the reference to the photo database */
- eitdb->photodb = db;
-}
-
-/**
* gphoto_display_photo_window
*
* When the photo playlist is clicked on, it hands off to this
* function which changes the entire display to the photo
* window
- *
+ *
* @itdb: itunes db associated with the photo playlist clicked on
*/
void gphoto_display_photo_window(iTunesDB *itdb)
@@ -217,7 +170,7 @@ void gphoto_display_photo_window(iTunesDB *itdb)
* When the photo playlist is NOT clicked on;
* this changes the entire display back to original
* rather than the photo window.
- *
+ *
*/
void gphoto_change_to_photo_window(gboolean showflag)
{
@@ -292,7 +245,7 @@ void gphoto_change_to_photo_window(gboolean showflag)
photo_remove_image_menuItem = GTK_MENU_ITEM
(gtkpod_xml_get_widget (photo_xml, "photo_remove_image_menuItem"));
photo_view_full_size_menuItem = GTK_MENU_ITEM
(gtkpod_xml_get_widget (photo_xml, "photo_view_full_size_menuItem"));
photo_rename_album_menuItem = GTK_MENU_ITEM
(gtkpod_xml_get_widget (photo_xml, "photo_rename_album_menuItem"));
-
+
photo_viewport = gtkpod_xml_get_widget (photo_xml,
"photo_viewport");
g_object_ref (photo_album_window);
g_object_ref (photo_thumb_window);
@@ -303,17 +256,17 @@ void gphoto_change_to_photo_window(gboolean showflag)
gtk_widget_destroy (photowin);
/* Bring the menus to life */
- g_signal_connect (G_OBJECT(photo_add_album_menuItem),
"activate", G_CALLBACK(on_photodb_add_album_menuItem_activate),
+ g_signal_connect (G_OBJECT(photo_add_album_menuItem),
"activate", G_CALLBACK(on_photodb_add_album_menuItem_activate),
NULL);
- g_signal_connect (G_OBJECT(photo_add_image_menuItem),
"activate", G_CALLBACK(on_photodb_add_image_menuItem_activate),
+ g_signal_connect (G_OBJECT(photo_add_image_menuItem),
"activate", G_CALLBACK(on_photodb_add_image_menuItem_activate),
NULL);
- g_signal_connect
(G_OBJECT(photo_add_image_dir_menuItem), "activate",
G_CALLBACK(on_photodb_add_image_dir_menuItem_activate),
+ g_signal_connect
(G_OBJECT(photo_add_image_dir_menuItem), "activate",
G_CALLBACK(on_photodb_add_image_dir_menuItem_activate),
NULL);
- g_signal_connect
(G_OBJECT(photo_remove_album_menuItem), "activate",
G_CALLBACK(on_photodb_remove_album_menuItem_activate),
+ g_signal_connect
(G_OBJECT(photo_remove_album_menuItem), "activate",
G_CALLBACK(on_photodb_remove_album_menuItem_activate),
NULL);
- g_signal_connect
(G_OBJECT(photo_remove_image_menuItem), "activate",
G_CALLBACK(on_photodb_remove_image_menuItem_activate),
+ g_signal_connect
(G_OBJECT(photo_remove_image_menuItem), "activate",
G_CALLBACK(on_photodb_remove_image_menuItem_activate),
NULL);
- g_signal_connect
(G_OBJECT(photo_view_full_size_menuItem), "activate",
G_CALLBACK(on_photodb_view_full_size_menuItem_activate),
+ g_signal_connect
(G_OBJECT(photo_view_full_size_menuItem), "activate",
G_CALLBACK(on_photodb_view_full_size_menuItem_activate),
NULL);
g_signal_connect
(G_OBJECT(photo_rename_album_menuItem), "activate",
G_CALLBACK(on_photodb_rename_album_menuItem_activate),
NULL);
@@ -321,7 +274,7 @@ void gphoto_change_to_photo_window(gboolean showflag)
if (gtk_widget_get_parent (photo_viewport) == NULL)
gtk_container_add (GTK_CONTAINER (main_vbox),
photo_viewport);
-
+
} else
{
if (!GTK_WIDGET_VISIBLE (paned1))
@@ -373,7 +326,7 @@ void gphoto_change_to_photo_window(gboolean showflag)
* Construct the album tree based upon the albums
* stored on the iPod. If necessary destory and old
* existing tree object.
- *
+ *
*/
static void gphoto_create_albumview()
{
@@ -401,7 +354,7 @@ static void gphoto_create_albumview()
gtk_widget_set_events (GTK_WIDGET(album_view),
GDK_KEY_PRESS_MASK);
renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_insert_column_with_attributes (album_view, -1, _("Photo
Albums"), renderer, "text", COL_ALBUM_NAME,
+ gtk_tree_view_insert_column_with_attributes (album_view, -1, _("Photo
Albums"), renderer, "text", COL_ALBUM_NAME,
NULL);
/* create model */
@@ -429,7 +382,7 @@ static void gphoto_create_albumview()
/* function to be enacted when the album is changed */
selection = gtk_tree_view_get_selection (album_view);
- g_signal_connect (G_OBJECT (selection), "changed", G_CALLBACK
(gphoto_album_selection_changed),
+ g_signal_connect (G_OBJECT (selection), "changed", G_CALLBACK
(gphoto_album_selection_changed),
NULL);
g_signal_connect (G_OBJECT (album_view), "button-press-event",
G_CALLBACK (gphoto_button_press), (gpointer) GPHOTO_ALBUM_VIEW);
@@ -439,18 +392,18 @@ static void gphoto_create_albumview()
/* Dnd destinaton for album view */
gtk_drag_dest_set (
- GTK_WIDGET (album_view),
- GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT,
- photo_drop_types,
- TGNR (photo_drop_types),
+ GTK_WIDGET (album_view),
+ GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT,
+ photo_drop_types,
+ TGNR (photo_drop_types),
GDK_ACTION_COPY|GDK_ACTION_MOVE);
g_signal_connect ((gpointer) album_view, "drag-drop",
- G_CALLBACK (dnd_album_drag_drop),
+ G_CALLBACK (dnd_album_drag_drop),
NULL);
-
+
g_signal_connect ((gpointer) album_view, "drag-data-received",
- G_CALLBACK (dnd_album_drag_data_received),
+ G_CALLBACK (dnd_album_drag_data_received),
NULL);
}
@@ -460,7 +413,7 @@ static void gphoto_create_albumview()
* Construct the thumbnail tree based upon the
* photos stored on the iPod associated with the
* selected album.
- *
+ *
*/
static void gphoto_create_thumbnailview()
{
@@ -489,12 +442,12 @@ static void gphoto_create_thumbnailview()
gtk_drag_source_set (
GTK_WIDGET (thumbnail_view),
GDK_BUTTON1_MASK,
- photo_drag_types,
+ photo_drag_types,
TGNR (photo_drag_types),
GDK_ACTION_COPY|GDK_ACTION_MOVE);
- g_signal_connect ((gpointer) thumbnail_view, "drag-data-get",
- G_CALLBACK (dnd_images_drag_data_get),
+ g_signal_connect ((gpointer) thumbnail_view, "drag-data-get",
+ G_CALLBACK (dnd_images_drag_data_get),
NULL);
}
@@ -503,9 +456,9 @@ static void gphoto_create_thumbnailview()
*
* Create the model for the thumbnail view
* based upon the selected album.
- *
+ *
* @ album_name: name of the selected album or null if none selected
- *
+ *
*/
static void gphoto_build_thumbnail_model(gchar *album_name)
{
@@ -547,7 +500,7 @@ static void gphoto_build_thumbnail_model(gchar *album_name)
gtk_icon_view_set_item_width(thumbnail_view, -1); // let the model
decide how wide
/* function to be enacted when the thumbnail is changed */
- g_signal_connect (thumbnail_view, "selection-changed", G_CALLBACK
(gphoto_thumb_selection_changed),
+ g_signal_connect (thumbnail_view, "selection-changed", G_CALLBACK
(gphoto_thumb_selection_changed),
NULL);
/* Disable the remove image menu item until an image is selected */
@@ -563,10 +516,10 @@ static void gphoto_build_thumbnail_model(gchar
*album_name)
*
* When the album selection is changed, rebuild the thumbnail model
* to display those thumbnails only associated with the album.
- *
+ *
* @ selection: album name selection
* @ user_data: not used.
- *
+ *
*/
static void gphoto_album_selection_changed(GtkTreeSelection *selection,
gpointer user_data)
{
@@ -582,7 +535,7 @@ static void gphoto_album_selection_changed(GtkTreeSelection
*selection, gpointer
{
/* Enable the remove album menu item now that one is selected */
gtk_widget_set_sensitive
(GTK_WIDGET(photo_remove_album_menuItem), TRUE);
-
+
selected_album = itdb_photodb_photoalbum_by_name (photodb,
album_name);
g_free (album_name);
@@ -604,10 +557,10 @@ static void
gphoto_album_selection_changed(GtkTreeSelection *selection, gpointer
*
* When the thumb view selection is changed, update the
* preview image to display that which is selected.
- *
+ *
* @ iconview: thumbnail view
* @ user_data: not used
- *
+ *
*/
static void gphoto_thumb_selection_changed(GtkIconView *iconview, gpointer
user_data)
{
@@ -637,18 +590,18 @@ static void gphoto_thumb_selection_changed(GtkIconView
*iconview, gpointer user_
* gphoto_display_photo_preview:
*
* Display the supplied photo is the preview window.
- *
+ *
* @ artwork: photo to be displayed
- *
+ *
*/
static void gphoto_display_photo_preview(Artwork *artwork)
{
GdkPixbuf *pixbuf;
-
+
g_return_if_fail (artwork);
pixbuf = itdb_artwork_get_pixbuf (device, artwork,
- PHOTO_FULL_SCREEN_WIDTH,
+ PHOTO_FULL_SCREEN_WIDTH,
PHOTO_FULL_SCREEN_HEIGHT);
g_return_if_fail (pixbuf);
@@ -658,12 +611,12 @@ static void gphoto_display_photo_preview(Artwork *artwork)
}
/**
- *
+ *
* signal_data_changed:
- *
+ *
* Convenience function that sets the flags on the Extra iTunes Database
* that the photo database has changed and will need saving
- *
+ *
*/
static void signal_data_changed()
{
@@ -672,7 +625,7 @@ static void signal_data_changed()
eitdb = ipod_itdb->userdata;
eitdb->photo_data_changed = TRUE;
eitdb->data_changed = TRUE;
-
+
gtk_image_clear (photo_preview_image);
}
@@ -681,9 +634,9 @@ static void signal_data_changed()
*
* Given the selection of the album_treeview,
* return the album name selected..
- *
+ *
* @ selection: GtkTreeSelection
- *
+ *
* Returns:
* string value representing the album name selected. Must be
* g_free()ed after use.
@@ -710,7 +663,7 @@ static gchar
*gphoto_get_selected_album_name(GtkTreeSelection *selection)
*
* Function to return the number of photos
* currently selected in the iconview.
- *
+ *
*/
gint gphoto_get_selected_photo_count ()
{
@@ -720,7 +673,7 @@ gint gphoto_get_selected_photo_count ()
if (selected_items == NULL)
return 0;
-
+
return g_list_length (selected_items);
}
@@ -730,9 +683,9 @@ gint gphoto_get_selected_photo_count ()
* Add a photo from file name to the photo database and
* hence to the gui. If an album is selected other than the
* Photo Library then the photo is added to it.
- *
+ *
* @ photo_filename: gchar *
- *
+ *
*/
static void gphoto_add_image_to_database(gchar *photo_filename)
{
@@ -743,7 +696,7 @@ static void gphoto_add_image_to_database(gchar
*photo_filename)
g_return_if_fail (photo_filename);
- /* Add the photo to the photo database and the
+ /* Add the photo to the photo database and the
* default photo library album
*/
image = itdb_photodb_add_photo (photodb, photo_filename, -1,
GDK_PIXBUF_ROTATE_NONE, &error);
@@ -769,7 +722,7 @@ static void gphoto_add_image_to_database(gchar
*photo_filename)
if (selected_album->album_type != 0x01)
{
- /* Add the photo to the selected album only if it is not
+ /* Add the photo to the selected album only if it is not
* the Photo Library, as already done that.
*/
itdb_photodb_photoalbum_add_photo (photodb, selected_album,
image, -1);
@@ -784,9 +737,9 @@ static void gphoto_add_image_to_database(gchar
*photo_filename)
* gphoto_add_image_to_iconview
*
* Add an Artwork image to the icon_view
- *
+ *
* @ photo: Artwork
- *
+ *
*/
static void gphoto_add_image_to_iconview(Artwork *photo, gint index)
{
@@ -805,7 +758,7 @@ static void gphoto_add_image_to_iconview(Artwork *photo,
gint index)
gchar *index_str= NULL;
index_str = g_strdup_printf ("%d", index);
-
+
/* Add a new row to the model */
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter, COL_THUMB_NAIL, pixbuf,
COL_THUMB_FILENAME, index_str, COL_THUMB_ARTWORK, photo, -1);
@@ -817,7 +770,7 @@ static void gphoto_add_image_to_iconview(Artwork *photo,
gint index)
* gphoto_remove_album_from_database
*
* Remove the selected album from the photo database and the view
- *
+ *
*/
void gphoto_remove_album_from_database()
{
@@ -835,14 +788,14 @@ void gphoto_remove_album_from_database()
gtk_tree_model_get (album_model, &iter, COL_ALBUM_NAME,
&album_name, -1);
else
return;
-
+
g_return_if_fail (album_name);
/* Find the selected album. If no selection then returns the Main Album
*/
selected_album = itdb_photodb_photoalbum_by_name (photodb, album_name);
g_return_if_fail (selected_album);
g_free (album_name);
-
+
if (selected_album->album_type == 0x01)
{
gtkpod_warning (_("The Photo Library album cannot be removed"));
@@ -875,7 +828,7 @@ void gphoto_remove_album_from_database()
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
_("Yes. Do Not Display Again"),
PHOTO_YES_DONT_DISPLAY_RESPONSE,
NULL);
-
+
result = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@@ -895,7 +848,7 @@ void gphoto_remove_album_from_database()
break;
}
}
-
+
album_model = gtk_tree_view_get_model (album_view);
gtk_list_store_remove (GTK_LIST_STORE(album_model), &iter);
@@ -911,7 +864,7 @@ void gphoto_remove_album_from_database()
* gphoto_remove_image_from_album
*
* Remove the selected image from the album
- *
+ *
*/
void gphoto_remove_selected_photos_from_album (gboolean show_dialogs)
{
@@ -935,7 +888,7 @@ void gphoto_remove_selected_photos_from_album (gboolean
show_dialogs)
GtkWindow *parent = GTK_WINDOW (gtkpod_xml_get_widget (main_window_xml,
"gtkpod"));
GtkWidget *dialog;
gboolean delete_pics = FALSE;
-
+
if (show_dialogs)
{
if (selected_album != NULL&& selected_album->album_type != 0x01)
@@ -945,7 +898,7 @@ void gphoto_remove_selected_photos_from_album (gboolean
show_dialogs)
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_NONE,
_("This will remove the photo selection
from the selected album.\n Do you want to delete them from the database as
well?"));
-
+
gtk_dialog_add_buttons (
GTK_DIALOG (dialog),
GTK_STOCK_YES, GTK_RESPONSE_YES,
@@ -960,7 +913,7 @@ void gphoto_remove_selected_photos_from_album (gboolean
show_dialogs)
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_NONE,
_("This will delete the photo selection
from the Photo Library and all albums. Are you sure?"));
-
+
gtk_dialog_add_buttons (
GTK_DIALOG (dialog),
GTK_STOCK_YES, GTK_RESPONSE_YES,
@@ -989,7 +942,7 @@ void gphoto_remove_selected_photos_from_album (gboolean
show_dialogs)
{
delete_pics = FALSE;
}
-
+
thumbnail_model = gtk_icon_view_get_model (thumbnail_view);
for (i = 0; i < g_list_length (selected_images); ++i)
{
@@ -1013,7 +966,7 @@ void gphoto_remove_selected_photos_from_album (gboolean
show_dialogs)
* gphoto_rename_selected_album
*
* Remove the selected image from the album
- *
+ *
*/
void gphoto_rename_selected_album ()
{
@@ -1026,22 +979,22 @@ void gphoto_rename_selected_album ()
/* Find the selected album. If no selection then returns the Main Album
*/
selected_album = itdb_photodb_photoalbum_by_name (photodb, album_name);
g_return_if_fail (selected_album);
-
+
if (selected_album->album_type == 0x01)
{
/* Dont rename the Photo Library */
return;
}
-
+
gchar *new_album_name = get_user_string (_("New Photo Album Name"),
-
_("Please enter a new name for the photo album"),
-
NULL,
-
NULL,
+
_("Please enter a new name for the photo album"),
+
NULL,
+
NULL,
NULL,
GTK_STOCK_ADD);
if (new_album_name == NULL|| strlen (new_album_name) == 0)
return;
-
+
/* Check an album with this name doesnt already exist */
PhotoAlbum *curr_album;
curr_album = itdb_photodb_photoalbum_by_name (photodb, new_album_name);
@@ -1051,35 +1004,35 @@ void gphoto_rename_selected_album ()
g_free (new_album_name);
return;
}
-
+
/* Rename the album in the database */
selected_album->name = g_strdup (new_album_name);
-
+
/* Update the row in the album view */
GtkTreeModel *album_model;
GtkTreeIter iter;
-
+
album_model = gtk_tree_view_get_model (album_view);
if (gtk_tree_selection_get_selected (selection, &album_model, &iter) ==
TRUE)
{
gtk_list_store_set (GTK_LIST_STORE(album_model), &iter,
COL_ALBUM_NAME, new_album_name, -1);;
}
-
+
g_free (new_album_name);
-
+
signal_data_changed();
-
+
/* Using the existing selection, reselect the album so it reloads the
preview of the first image */
gphoto_album_selection_changed (selection, NULL);
}
/**
- *
+ *
* gphoto_button_press:
- *
+ *
* When right mouse button is pressed on one of the widgets,
* a popup menu is displayed.
- *
+ *
* @ w: widget upon which button press has occurred
* @ e: button event
* @ data: not used
@@ -1104,10 +1057,10 @@ static gboolean gphoto_button_press(GtkWidget *w,
GdkEventButton *e, gpointer da
* on_photodb_add_album_menuItem_activate:
*
* Callback for add album menu item
- *
+ *
* @ menuitem: add album menu item
* @ user_data: not used
- *
+ *
*/
void on_photodb_add_album_menuItem_activate(GtkMenuItem *menuItem, gpointer
user_data)
{
@@ -1117,9 +1070,9 @@ void on_photodb_add_album_menuItem_activate(GtkMenuItem
*menuItem, gpointer user
gchar *album_name;
album_name = get_user_string (_("New Photo Album"),
- _("Please enter a name for the new photo
album"),
- FALSE,
- NULL,
+ _("Please enter a name for the new photo
album"),
+ FALSE,
+ NULL,
NULL,
GTK_STOCK_ADD);
@@ -1156,14 +1109,14 @@ void on_photodb_add_album_menuItem_activate(GtkMenuItem
*menuItem, gpointer user
* on_photodb_add_image_menuItem_activate:
*
* Callback for add image menu item
- *
+ *
* @ menuitem: add image menu item
* @ user_data: not used
- *
+ *
*/
void on_photodb_add_image_menuItem_activate(GtkMenuItem *menuItem, gpointer
user_data)
{
- gchar *image_name = fileselection_get_file_or_dir (_("Add Image to
iPod"),
+ gchar *image_name = fileselection_get_file_or_dir (_("Add Image to
iPod"),
NULL, GTK_FILE_CHOOSER_ACTION_OPEN);
if (image_name == NULL)
@@ -1179,10 +1132,10 @@ void on_photodb_add_image_menuItem_activate(GtkMenuItem
*menuItem, gpointer user
*
* Comparision function for comparing the filenames
* of newly added images.
- *
+ *
* @ a: filename 1
* @ b: filename 2
- *
+ *
*/
static int _strptrcmp(const void* _a, const void* _b)
{
@@ -1207,10 +1160,10 @@ static int _strptrcmp(const void* _a, const void* _b)
* on_photodb_add_image_dir_menuItem_activate:
*
* Callback for add image directory menu item
- *
+ *
* @ menuitem: add album menu item
* @ user_data: not used
- *
+ *
*/
void on_photodb_add_image_dir_menuItem_activate(GtkMenuItem *menuItem,
gpointer user_data)
{
@@ -1218,7 +1171,7 @@ void
on_photodb_add_image_dir_menuItem_activate(GtkMenuItem *menuItem, gpointer
GError *error= NULL;
/* Open a dialog directory chooser window */
- gchar*dir_name = fileselection_get_file_or_dir (_("Add a Directory of
Images to the iPod. Select the Directory."),
+ gchar*dir_name = fileselection_get_file_or_dir (_("Add a Directory of
Images to the iPod. Select the Directory."),
NULL, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
if (dir_name == NULL)
@@ -1252,7 +1205,7 @@ void
on_photodb_add_image_dir_menuItem_activate(GtkMenuItem *menuItem, gpointer
G_CONST_RETURN gchar *filename;
GPtrArray* filename_arr = g_ptr_array_new();
unsigned u;
-
+
do
{
filename = g_dir_read_name(directory);
@@ -1261,7 +1214,7 @@ void
on_photodb_add_image_dir_menuItem_activate(GtkMenuItem *menuItem, gpointer
g_ptr_array_add(filename_arr, (void*) filename);
}
} while (filename != NULL);
-
+
/* Conduct an alphabetical sort on the filenames so
* they are added in order.
*/
@@ -1295,10 +1248,10 @@ void
on_photodb_add_image_dir_menuItem_activate(GtkMenuItem *menuItem, gpointer
* on_photodb_remove_album_menuItem_activate:
*
* Callback for remove album menu item
- *
+ *
* @ menuitem: remove album menu item
* @ user_data: not used
- *
+ *
*/
void on_photodb_remove_album_menuItem_activate(GtkMenuItem *menuItem, gpointer
user_data)
{
@@ -1309,10 +1262,10 @@ void
on_photodb_remove_album_menuItem_activate(GtkMenuItem *menuItem, gpointer u
* on_photodb_remove_image_menuItem_activate:
*
* Callback for remove image menu item
- *
+ *
* @ menuitem: remove image menu item
* @ user_data: not used
- *
+ *
*/
void on_photodb_remove_image_menuItem_activate(GtkMenuItem *menuItem, gpointer
user_data)
{
@@ -1322,13 +1275,13 @@ void
on_photodb_remove_image_menuItem_activate(GtkMenuItem *menuItem, gpointer u
/**
* on_photodb_view_full_size_menuItem_activate
*
- * Callback used to display a dialog contain a full
+ * Callback used to display a dialog contain a full
* size / screen size version of the selected image.
* Same as that used in coverart display.
- *
+ *
* @ menuitem: remove image menu item
* @ user_data: not used
- *
+ *
*/
void on_photodb_view_full_size_menuItem_activate (GtkMenuItem *menuItem,
gpointer user_data)
{
@@ -1338,7 +1291,7 @@ void on_photodb_view_full_size_menuItem_activate
(GtkMenuItem *menuItem, gpointe
GtkTreeIter iter;
Artwork *artwork = NULL;
GdkPixbuf * pixbuf;
-
+
/* Find which images are selected */
selected_images = gtk_icon_view_get_selected_items
(GTK_ICON_VIEW(thumbnail_view));
if (selected_images == NULL|| g_list_length (selected_images) == 0)
@@ -1349,14 +1302,14 @@ void on_photodb_view_full_size_menuItem_activate
(GtkMenuItem *menuItem, gpointe
* correctly.
*/
model = gtk_icon_view_get_model (GTK_ICON_VIEW(thumbnail_view));
-
+
treePath = g_list_nth_data (selected_images, 0);
gtk_tree_model_get_iter (model, &iter, treePath);
gtk_tree_model_get (model, &iter, COL_THUMB_ARTWORK, &artwork, -1);
-
+
pixbuf = itdb_artwork_get_pixbuf (device, artwork, -1, -1);
g_return_if_fail (pixbuf);
-
+
display_image_dialog (pixbuf);
g_object_unref (pixbuf);
@@ -1366,10 +1319,10 @@ void on_photodb_view_full_size_menuItem_activate
(GtkMenuItem *menuItem, gpointe
* on_photodb_rename_album_menuItem_activate
*
* Callback used to rename an album.
- *
+ *
* @ menuitem: remove image menu item
* @ user_data: not used
- *
+ *
*/
void on_photodb_rename_album_menuItem_activate (GtkMenuItem *menuItem,
gpointer user_data)
{
@@ -1387,7 +1340,7 @@ void on_photodb_rename_album_menuItem_activate
(GtkMenuItem *menuItem, gpointer
* Allow dnd of an image onto an album row in the
* album tree. Gives ability to add an image to a
* different album.
- *
+ *
*/
static gboolean dnd_album_drag_drop(GtkWidget *widget, GdkDragContext
*drag_context, gint x, gint y, guint time, gpointer user_data)
{
@@ -1397,7 +1350,7 @@ static gboolean dnd_album_drag_drop(GtkWidget *widget,
GdkDragContext *drag_cont
if (target != GDK_NONE)
{
gboolean rowfound;
-
+
/* determine whether a row has been dropped over in album view
*/
rowfound = gtk_tree_view_get_dest_row_at_pos
(GTK_TREE_VIEW(widget), x, y, NULL, NULL);
if (rowfound == TRUE)
@@ -1416,7 +1369,7 @@ static gboolean dnd_album_drag_drop(GtkWidget *widget,
GdkDragContext *drag_cont
*
* Provide the images which are to be dnded
* onto the new album in the album tree.
- *
+ *
*/
static void dnd_images_drag_data_get(GtkWidget *widget, GdkDragContext *dc,
GtkSelectionData *data, guint info, guint time,
gpointer user_data)
@@ -1424,7 +1377,7 @@ static void dnd_images_drag_data_get(GtkWidget *widget,
GdkDragContext *dc, GtkS
GtkTreeModel *model;
GList *selected_images;
gint i;
-
+
if (!data)
return;
@@ -1434,12 +1387,12 @@ static void dnd_images_drag_data_get(GtkWidget *widget,
GdkDragContext *dc, GtkS
return;
model = gtk_icon_view_get_model (GTK_ICON_VIEW(widget));
-
+
GtkTreePath *treePath = NULL;
GtkTreeIter iter;
Artwork *artwork = NULL;
GString *reply = g_string_sized_new (2000);
-
+
for (i = 0; i < g_list_length(selected_images); ++i)
{
treePath = g_list_nth_data (selected_images, i);
@@ -1447,7 +1400,7 @@ static void dnd_images_drag_data_get(GtkWidget *widget,
GdkDragContext *dc, GtkS
gtk_tree_model_get (model, &iter, COL_THUMB_ARTWORK, &artwork,
-1);
g_string_append_printf (reply, "%p\n", artwork);
}
-
+
switch (info)
{
case DND_GTKPOD_PHOTOIMAGELIST:
@@ -1466,7 +1419,7 @@ static void dnd_images_drag_data_get(GtkWidget *widget,
GdkDragContext *dc, GtkS
* The final part of the dnd images onto album dnd
* operation. This uses the data received and adds
* the images to the new album.
- *
+ *
*/
static void dnd_album_drag_data_received(GtkWidget *widget, GdkDragContext
*dc, gint x, gint y, GtkSelectionData *data, guint info,
guint time, gpointer user_data)
@@ -1486,7 +1439,7 @@ static void dnd_album_drag_data_received(GtkWidget
*widget, GdkDragContext *dc,
gchar *src_name;
PhotoAlbum *tgt_album;
PhotoAlbum *src_album;
-
+
/* determine whether a row has been dropped over in album view */
rowfound = gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW(widget), x,
y, &treepath, NULL);
if (! rowfound)
@@ -1494,24 +1447,24 @@ static void dnd_album_drag_data_received(GtkWidget
*widget, GdkDragContext *dc,
gtk_drag_finish (dc, FALSE, FALSE, time);
return;
}
-
+
g_return_if_fail (treepath);
-
+
model = gtk_tree_view_get_model (GTK_TREE_VIEW(widget));
-
+
/* Find the target album to drop the artwork into */
if(gtk_tree_model_get_iter (model, &iter, treepath))
gtk_tree_model_get (model, &iter, COL_ALBUM_NAME, &tgt_name,
-1);
-
+
gtk_tree_path_free (treepath);
treepath = NULL;
g_return_if_fail (tgt_name);
-
+
tgt_album = itdb_photodb_photoalbum_by_name (photodb, tgt_name);
g_return_if_fail (tgt_album);
if (tgt_name != NULL)
g_free (tgt_name);
-
+
/* Find the selected album, ie. the source, or else the Photo Library
if no selection */
GtkTreeSelection *selection = NULL;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(widget));
@@ -1519,28 +1472,28 @@ static void dnd_album_drag_data_received(GtkWidget
*widget, GdkDragContext *dc,
src_name = gphoto_get_selected_album_name (selection);
else
src_name = NULL;
-
+
/* Find the selected album. If no selection then returns the Photo
Library */
src_album = itdb_photodb_photoalbum_by_name (photodb, src_name);
g_return_if_fail (src_album);
if (src_name != NULL)
g_free (src_name);
-
+
if (src_album == tgt_album)
{
gtk_drag_finish (dc, FALSE, FALSE, time);
return;
}
-
+
Artwork *artwork;
GList *artwork_list = NULL;
gchar *datap = data->data;
gint i = 0;
-
+
/* parse artwork and add each one to a GList */
while (parse_artwork_from_string (&datap, &artwork))
artwork_list = g_list_append (artwork_list, artwork);
-
+
if (tgt_album->album_type != 0x01)
{
/* Only if the target is not the Photo Library (which should
have the photo
@@ -1552,11 +1505,11 @@ static void dnd_album_drag_data_received(GtkWidget
*widget, GdkDragContext *dc,
itdb_photodb_photoalbum_add_photo (photodb, tgt_album,
artwork, -1);
}
}
-
- /* Remove the artwork from the selected album if it is not the Photo
Library */
+
+ /* Remove the artwork from the selected album if it is not the Photo
Library */
if (src_album->album_type != 0x01)
gphoto_remove_selected_photos_from_album (FALSE);
-
+
signal_data_changed ();
}
@@ -1603,4 +1556,4 @@ static void debug_list_photos(iTunesDB *itdb)
}
}
#endif
-
+
diff --git a/src/display_playlists.c b/src/display_playlists.c
index 118004a..30de8bd 100644
--- a/src/display_playlists.c
+++ b/src/display_playlists.c
@@ -91,34 +91,29 @@ static gboolean pm_get_iter_for_playlist(Playlist *pl,
GtkTreeIter *iter);
* pressed)
*
* ---------------------------------------------------------------- */
-static void pm_drag_begin (GtkWidget *widget, GdkDragContext *drag_context,
gpointer user_data) {
-/* puts ("drag_begin"); */
+static void pm_drag_begin(GtkWidget *widget, GdkDragContext *drag_context,
gpointer user_data) {
+ /* puts ("drag_begin"); */
}
static void pm_drag_data_delete_remove_playlist(GtkTreeModel *tm, GtkTreePath
*tp, GtkTreeIter *iter, gpointer data) {
Playlist *pl;
g_return_if_fail (tm);
g_return_if_fail (iter);
- gtk_tree_model_get (tm, iter, PM_COLUMN_PLAYLIST, &pl, -1);
+ gtk_tree_model_get(tm, iter, PM_COLUMN_PLAYLIST, &pl, -1);
g_return_if_fail (pl);
- gp_playlist_remove (pl);
+ gp_playlist_remove(pl);
}
/* remove dragged playlist after successful MOVE */
-static void pm_drag_data_delete (GtkWidget *widget,
- GdkDragContext *drag_context,
- gpointer user_data)
-{
+static void pm_drag_data_delete(GtkWidget *widget, GdkDragContext
*drag_context, gpointer user_data) {
g_return_if_fail (widget);
g_return_if_fail (drag_context);
-/* printf ("drag_data_delete: %d\n", drag_context->action); */
+ /* printf ("drag_data_delete: %d\n", drag_context->action); */
- if (drag_context->action == GDK_ACTION_MOVE)
- {
- GtkTreeSelection *ts = gtk_tree_view_get_selection(
- GTK_TREE_VIEW (widget));
- gtk_tree_selection_selected_foreach (ts,
pm_drag_data_delete_remove_playlist, NULL);
+ if (drag_context->action == GDK_ACTION_MOVE) {
+ GtkTreeSelection *ts = gtk_tree_view_get_selection(GTK_TREE_VIEW
(widget));
+ gtk_tree_selection_selected_foreach(ts,
pm_drag_data_delete_remove_playlist, NULL);
}
}
@@ -918,38 +913,6 @@ static gboolean pm_get_iter_for_playlist(Playlist
*playlist, GtkTreeIter *pl_ite
/* Section for playlist display */
/* ---------------------------------------------------------------- */
-/* remove a track from a current playlist (model) */
-void pm_remove_track(Playlist *playlist, Track *track) {
- g_return_if_fail (playlist);
- g_return_if_fail (track);
-
- Playlist *current_playlist = gtkpod_get_current_playlist();
- /* notify sort tab if currently selected playlist is affected */
- if (current_playlist) { /* only remove if selected playlist is in same
itdb as track */
- if (track->itdb == current_playlist->itdb) {
- if ((playlist == current_playlist) ||
itdb_playlist_is_mpl(current_playlist)) {
- // if (prefs_get_int(KEY_DISPLAY_COVERART)) {
- // coverart_track_changed(track,
COVERART_REMOVE_SIGNAL);
- // }
- // st_remove_track(track, 0);
- }
- }
- }
-}
-
-/* Add track to the display if it's in the currently displayed playlist.
- * @display: TRUE: add to track model (i.e. display it) */
-void pm_add_track(Playlist *playlist, Track *track, gboolean display) {
- // if (playlist == current_playlist) {
- // st_add_track(track, TRUE, display, 0); /* Add to first sort tab
*/
- //
- // /* As with add_track above, only add to the playlist if it is
the current one */
- // if (prefs_get_int(KEY_DISPLAY_COVERART)) {
- // coverart_track_changed(track, COVERART_CREATE_SIGNAL);
- // }
- // }
-}
-
/* One of the playlist names has changed (this happens when the
Itdb_iTunesDB is read */
void pm_itdb_name_changed(Itdb_iTunesDB *itdb) {
@@ -1035,24 +998,6 @@ void pm_add_child(Itdb_iTunesDB *itdb, PM_column_type
type, gpointer item, gint
gtk_tree_store_insert(GTK_TREE_STORE (model), &iter, mpli, pos);
gtk_tree_store_set(GTK_TREE_STORE (model), &iter, PM_COLUMN_ITDB, itdb,
PM_COLUMN_TYPE, type, type, item, -1);
-
-#if 0
- /* If the current_playlist is "playlist", we select it. This can
- happen during a display_reset */
- if (current_playlist == playlist)
- {
- selection = gtk_tree_view_get_selection (playlist_treeview);
- gtk_tree_selection_select_iter (selection, &iter);
- }
-#endif
- /* else if (current_playlist == NULL)
- {
- if (itdb_playlist_is_mpl(playlist) && prefs_get_int("mpl_autoselect"))
- {
- selection = gtk_tree_view_get_selection (playlist_treeview);
- gtk_tree_selection_select_iter (selection, &iter);
- }
- } */
}
/* Remove "playlist" from the display model.
@@ -1180,16 +1125,9 @@ static gboolean pm_selection_changed_cb(gpointer data) {
time.tv_sec % 3600, time.tv_usec);
#endif
- /* Avoid track selection errors on coverart while enacting a change
- * in playlist
- */
- // coverart_block_change (TRUE);
-
if (gtk_tree_selection_get_selected(selection, &model, &iter) == FALSE) {
/* no selection -> reset sort tabs */
// gphoto_change_to_photo_window (FALSE);
- // st_init (-1, 0);
gtkpod_set_current_playlist(NULL);
- gtkpod_set_current_itdb(NULL);
}
else {
Playlist *new_playlist = NULL;
@@ -1200,7 +1138,6 @@ static gboolean pm_selection_changed_cb(gpointer data) {
gtk_tree_model_get(model, &iter, PM_COLUMN_TYPE, &type,
PM_COLUMN_ITDB, &itdb, PM_COLUMN_PLAYLIST, &new_playlist, PM_COLUMN_PHOTOS,
&photodb, -1);
gtkpod_set_current_playlist(new_playlist);
- gtkpod_set_current_itdb(itdb);
switch (type) {
case PM_COLUMN_PLAYLIST:
@@ -1209,15 +1146,6 @@ static gboolean pm_selection_changed_cb(gpointer data) {
// gphoto_change_to_photo_window (FALSE);
- /* If new playlist is in an iPod itdb, set the mountpoint for
- * the free space display to this iPod (there may be several
- * iPods connected */
- //
- // if (itdb->usertype & GP_ITDB_TYPE_IPOD)
- // {
- // space_set_ipod_itdb (itdb);
- // }
-
if (new_playlist->is_spl && new_playlist->splpref.liveupdate)
itdb_spl_update(new_playlist);
@@ -1303,11 +1231,6 @@ void pm_add_itdb(Itdb_iTunesDB *itdb, gint pos) {
pm_add_child(itdb, PM_COLUMN_PLAYLIST, pl, -1);
}
}
- /* eitdb->photodb might be NULL: the itdb is added before the iPod
- * is parsed */
- if (itdb_device_supports_photo(itdb->device) && eitdb->photodb) {
- pm_add_child(itdb, PM_COLUMN_PHOTOS, eitdb->photodb, -1);
- }
/* expand the itdb */
if (pm_get_iter_for_itdb(itdb, &mpl_iter)) {
@@ -1674,7 +1597,7 @@ static void pm_set_playlist_renderer_pix(GtkCellRenderer
*renderer, Playlist *pl
g_return_if_fail (renderer);
stock_id = return_playlist_stock_image(playlist);
- if (! stock_id)
+ if (!stock_id)
return;
g_object_set(G_OBJECT (renderer), "stock-id", stock_id, NULL);
@@ -2117,7 +2040,7 @@ void playlist_display_itdb_added_cb(GtkPodApp *app,
gpointer itdb, gint32 pos, g
return;
}
- pm_add_itdb (new_itdb, pos);
+ pm_add_itdb(new_itdb, pos);
}
void playlist_display_itdb_removed_cb(GtkPodApp *app, gpointer itdb, gpointer
data) {
@@ -2126,7 +2049,7 @@ void playlist_display_itdb_removed_cb(GtkPodApp *app,
gpointer itdb, gpointer da
return;
}
- pm_remove_playlist (itdb_playlist_mpl (old_itdb), FALSE);
+ pm_remove_playlist(itdb_playlist_mpl(old_itdb), FALSE);
}
void playlist_display_select_playlist_cb(GtkPodApp *app, gpointer pl, gpointer
data) {
@@ -2155,13 +2078,6 @@ void playlist_display_playlist_removed_cb(GtkPodApp
*app, gpointer pl, gpointer
pm_remove_playlist(old_playlist, TRUE);
}
-void playlist_display_track_removed_cb(GtkPodApp *app, gpointer tk, gpointer
data) {
- Track *old_track = tk;
- Playlist *current_playlist = gtkpod_get_current_playlist();
-
- pm_remove_track(current_playlist, old_track);
-}
-
void playlist_display_preference_changed_cb(GtkPodApp *app, gpointer pfname,
gint32 value, gpointer data) {
gchar *pref_name = pfname;
if (g_str_equal(pref_name, "pm_sort")) {
diff --git a/src/file_itunesdb.c b/src/file_itunesdb.c
index 1654c72..e6921c5 100644
--- a/src/file_itunesdb.c
+++ b/src/file_itunesdb.c
@@ -371,6 +371,47 @@ static gboolean read_extended_info(gchar *name, gchar
*itunes) {
return success;
}
+/**
+ * load_photodb:
+ *
+ * Using the info in the provided itunes db, load the photo db
+ * from the ipod if there is one present. Reference it in the
+ * extra itunes db data structure for later use.
+ *
+ * @ itdb: itunes database
+ *
+ */
+static void load_photodb(iTunesDB *itdb) {
+ ExtraiTunesDBData *eitdb;
+ PhotoDB *db;
+ const gchar *mp;
+ GError *error = NULL;
+
+ g_return_if_fail (itdb);
+
+ if (!itdb_device_supports_photo(itdb->device))
+ return;
+
+ eitdb = itdb->userdata;
+ g_return_if_fail (eitdb);
+ g_return_if_fail (eitdb->photodb == NULL);
+
+ mp = itdb_get_mountpoint(itdb);
+ db = itdb_photodb_parse(mp, &error);
+ if (error) {
+ gtkpod_warning(_("Error reading iPod photo database (%s).\n"),
error->message);
+ g_error_free(error);
+ error = NULL;
+ }
+ else if (db == NULL) {
+ gtkpod_warning(_("Error reading iPod photo database. (No error
message)\n"));
+ }
+ else {
+ /* Set the reference to the photo database */
+ eitdb->photodb = db;
+ }
+}
+
/* Import an iTunesDB and return an iTunesDB structure.
* If @old_itdb is set, it will be merged into the newly imported
* one. @old_itdb will not be changed.
@@ -422,10 +463,7 @@ iTunesDB *gp_import_itdb(iTunesDB *old_itdb, const gint
type, const gchar *mp, c
*msg =
g_strdup_printf(_("The repository %s does
not have a readable extended database.\n"), name_db);
msg
- = g_strconcat(msg, _("This database identifies the
track on disk with the track data in the repository database."),
- _("Any tracks already in the database
cannot be transferred between repositories without the extended database."),
- _("A new extended database will be created
upon saving but existing tracks will need to be reimported to be linked to the
file on disk."),
- NULL);
+ = g_strconcat(msg, _("This database identifies the
track on disk with the track data in the repository database."), _("Any tracks
already in the database cannot be transferred between repositories without the
extended database."), _("A new extended database will be created upon saving
but existing tracks will need to be reimported to be linked to the file on
disk."), NULL);
gtkpod_warning(msg);
}
@@ -650,6 +688,9 @@ iTunesDB *gp_import_itdb(iTunesDB *old_itdb, const gint
type, const gchar *mp, c
}
}
+ /* Add photo database */
+ load_photodb(itdb);
+
release_widgets();
return itdb;
@@ -704,9 +745,6 @@ static iTunesDB *gp_merge_itdb(iTunesDB *old_itdb) {
g_return_val_if_fail (old_eitdb->offline_filename, NULL);
new_itdb = gp_import_itdb(old_itdb, old_itdb->usertype, mountpoint,
old_eitdb->offline_filename, NULL);
- g_message("TODO load photodb handle\n");
- // if (new_itdb)
- // gphoto_load_photodb(new_itdb);
}
else {
g_return_val_if_reached (NULL);
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2