commit 02753e77d45043e5d3c4fe95cc9b0ebf938d7848 Author: phantomjinx <p.g.richard...@phantomjinx.co.uk> Date: Wed Apr 7 21:58:17 2010 +0100
Repository editor - fixes - gtkpod_app_iface.* Use repository editor rather than the interface as the parameter - repository_editor.c On receiving an itdb update, ensure that the index of the repository combo box is found and the set it after re initiating the combo Have the editor respond to added and removed itdbs too libgtkpod/gtkpod_app_iface.c | 2 +- libgtkpod/gtkpod_app_iface.h | 4 +- plugins/repository_editor/plugin.c | 2 +- plugins/repository_editor/repository_editor.c | 26 ++++++++++++++---------- 4 files changed, 19 insertions(+), 15 deletions(-) --- diff --git a/libgtkpod/gtkpod_app_iface.c b/libgtkpod/gtkpod_app_iface.c index c39702a..4505c84 100644 --- a/libgtkpod/gtkpod_app_iface.c +++ b/libgtkpod/gtkpod_app_iface.c @@ -343,7 +343,7 @@ void gtkpod_display_widget(GtkWidget *widget) { GTKPOD_APP_GET_INTERFACE(gtkpod_app)->display_widget(widget); } -void gtkpod_register_repository_editor(RepositoryEditorInterface *editor) { +void gtkpod_register_repository_editor(RepositoryEditor *editor) { g_return_if_fail (GTKPOD_IS_APP(gtkpod_app)); g_return_if_fail (REPOSITORY_EDITOR_IS_EDITOR(editor)); GTKPOD_APP_GET_INTERFACE (gtkpod_app)->repository_editor = editor; diff --git a/libgtkpod/gtkpod_app_iface.h b/libgtkpod/gtkpod_app_iface.h index 01c4310..0c71b3f 100644 --- a/libgtkpod/gtkpod_app_iface.h +++ b/libgtkpod/gtkpod_app_iface.h @@ -109,7 +109,7 @@ struct _GtkPodAppInterface { /* xml filename */ gchar *xml_file; /* Repository Editor */ - RepositoryEditorInterface *repository_editor; + RepositoryEditor *repository_editor; void (*itdb_updated)(GtkPodApp *obj, iTunesDB *oldItdb, iTunesDB *newItbd); void (*statusbar_message)(GtkPodApp *obj, gchar* message); @@ -165,7 +165,7 @@ GList *gtkpod_export_tracks_as_gchar(iTunesDB *source_db, iTunesDB *dest_db, gch GList *gtkpod_export_tracks_as_glist(iTunesDB *source_db, iTunesDB *dest_d, GList *tracks); void gtkpod_display_widget(GtkWidget *widget); -void gtkpod_register_repository_editor(RepositoryEditorInterface *editor); +void gtkpod_register_repository_editor(RepositoryEditor *editor); void gtkpod_unregister_repository_editor(); void gtkpod_edit_repository(iTunesDB *itdb, Playlist *playlist); gboolean gtkpod_init_repository(iTunesDB *itdb); diff --git a/plugins/repository_editor/plugin.c b/plugins/repository_editor/plugin.c index 74bf891..badcf5e 100644 --- a/plugins/repository_editor/plugin.c +++ b/plugins/repository_editor/plugin.c @@ -60,7 +60,7 @@ static gboolean activate_plugin(AnjutaPlugin *plugin) { g_return_val_if_fail(REPOSITORY_EDITOR_IS_EDITOR(repository_editor_plugin), TRUE); - gtkpod_register_repository_editor (repository_editor_plugin); + gtkpod_register_repository_editor (REPOSITORY_EDITOR(repository_editor_plugin)); return TRUE; /* FALSE if activation failed */ } diff --git a/plugins/repository_editor/repository_editor.c b/plugins/repository_editor/repository_editor.c index 3cddfee..6133822 100644 --- a/plugins/repository_editor/repository_editor.c +++ b/plugins/repository_editor/repository_editor.c @@ -109,6 +109,7 @@ static void select_repository(iTunesDB *itdb, Playlist *playlist); static void display_repository_info(); static void display_playlist_info(); static void update_buttons(); +static void repository_combo_changed_cb(GtkComboBox *cb); /* callbacks */ /** @@ -117,14 +118,15 @@ static void update_buttons(); * defunct playlists and itdbs. */ static void repository_update_itdb_cb(GtkPodApp *app, gpointer olditdb, gpointer newitdb, gpointer data) { - if (repository_view->itdb == newitdb) { - // repository changed will not be called if the current - // repository is selected so need to init the playlist combo - // manually. Need to do this before init repository combo - // since the latter set the repository_view-> itdb to NULL - init_playlist_combo(); - } + gint index; + + index = gtk_combo_box_get_active(repository_view->repository_combo_box); + init_repository_combo(); + + if (index >= 0) { + gtk_combo_box_set_active(repository_view->repository_combo_box, index); + } } /** @@ -1454,9 +1456,11 @@ static void create_repository_editor_view() { repository_view->extra_prefs = temp_prefs_create(); g_signal_connect (gtkpod_app, SIGNAL_PLAYLIST_SELECTED, G_CALLBACK (repository_playlist_selected_cb), NULL); - g_signal_connect (gtkpod_app, SIGNAL_ITDB_UPDATED, G_CALLBACK (repository_update_itdb_cb), NULL); g_signal_connect (gtkpod_app, SIGNAL_PLAYLIST_ADDED, G_CALLBACK (repository_playlist_changed_cb), NULL); g_signal_connect (gtkpod_app, SIGNAL_PLAYLIST_REMOVED, G_CALLBACK (repository_playlist_changed_cb), NULL); + g_signal_connect (gtkpod_app, SIGNAL_ITDB_UPDATED, G_CALLBACK (repository_update_itdb_cb), NULL); + g_signal_connect (gtkpod_app, SIGNAL_ITDB_ADDED, G_CALLBACK (repository_update_itdb_cb), NULL); + g_signal_connect (gtkpod_app, SIGNAL_ITDB_REMOVED, G_CALLBACK (repository_update_itdb_cb), NULL); } @@ -1504,9 +1508,9 @@ void open_repository_editor(iTunesDB *itdb, Playlist *playlist) { } g_return_if_fail (itdb); - select_repository(itdb, playlist); + gtk_widget_show_all(repository_view->window); + select_repository(itdb, playlist); + display_repository_info(); update_buttons(); - - gtk_widget_show_all(repository_view->window); } ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ gtkpod-cvs2 mailing list gtkpod-cvs2@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2