commit 50dfde497e13179a607f7e4ff994558174b80e75 Author: phantomjinx <p.g.richard...@phantomjinx.co.uk> Date: Sun Jan 3 18:40:15 2010 +0000
Fixing outstanding bugs default.profile - Reversed plugins in profile as it seems they are processed in reverse order. - Playlist Display must be processed first since it is on the left and below the Sorttab Display gp_private.c - Error in placing these functions in gp_private.h Playlist Display - Given the plugin a title once again since it is used in the view menu - Given a minimum size to the playlist window Sorttab Display - More Filters Tabs skeleton action added - Fix for showing the root paned against the preferences rather than the maximum number anjuta_app.c - Replacing gtk_widget_show_all with gtk_widget_show since some child widgets are hidden according to preferences data/default.profile | 8 +- libgtkpod/Makefile.am | 1 + libgtkpod/gp_private.c | 117 +++++++++++++ libgtkpod/gp_private.h | 188 +++++---------------- plugins/playlist_display/plugin.c | 3 +- plugins/sorttab_display/Makefile.am | 1 + plugins/sorttab_display/plugin.c | 13 ++- plugins/sorttab_display/sorttab_display_actions.c | 40 +++++ plugins/sorttab_display/sorttab_display_actions.h | 41 +++++ src/anjuta-app.c | 6 +- src/display_itdb.c | 72 ++++---- src/display_sorttabs.c | 3 + src/file_itunesdb.c | 4 +- src/misc_track.c | 31 ++-- 14 files changed, 315 insertions(+), 213 deletions(-) --- diff --git a/data/default.profile b/data/default.profile index 32930a4..33f02b8 100644 --- a/data/default.profile +++ b/data/default.profile @@ -1,17 +1,17 @@ <?xml version="1.0"?> <anjuta> - <plugin name="Playlist Display Plugin" + <plugin name="Sorttab Display Plugin" url="http://www.gtkpod.org/plugins/" mandatory="yes"> <require group="Anjuta Plugin" attribute="Location" - value="playlist_display:PlaylistDisplayPlugin"/> + value="sorttab_display:SorttabDisplayPlugin"/> </plugin> - <plugin name="Sorttab Display Plugin" + <plugin name="Playlist Display Plugin" url="http://www.gtkpod.org/plugins/" mandatory="yes"> <require group="Anjuta Plugin" attribute="Location" - value="sorttab_display:SorttabDisplayPlugin"/> + value="playlist_display:PlaylistDisplayPlugin"/> </plugin> </anjuta> diff --git a/libgtkpod/Makefile.am b/libgtkpod/Makefile.am index e7bb9f1..0fe4fff 100644 --- a/libgtkpod/Makefile.am +++ b/libgtkpod/Makefile.am @@ -2,6 +2,7 @@ lib_LTLIBRARIES = libgtkpod.la libgtkpod_la_SOURCES = gtkpod_app_iface.h gtkpod_app_iface.c \ itdb.h file_convert_info.h \ + gp_private.h gp_private.c \ gp_itdb.h gp_itdb.c \ charset.h charset.c \ sha1.h sha1.c \ diff --git a/libgtkpod/gp_private.c b/libgtkpod/gp_private.c new file mode 100644 index 0000000..2b8f8ff --- /dev/null +++ b/libgtkpod/gp_private.c @@ -0,0 +1,117 @@ +/* Time-stamp: <2009-11-28 11:10:13 pgr> + | Copyright (C) 2002-2009 Jorg Schuler <jcsjcs at users sourceforge net> + | Copyright (C) 2009-2010 Paul Richardson <phantom_sf at users sourceforge net> + | Part of the gtkpod project. + | + | URL: http://www.gtkpod.org/ + | URL: http://gtkpod.sourceforge.net/ + | + | This program is free software; you can redistribute it and/or modify + | it under the terms of the GNU General Public License as published by + | the Free Software Foundation; either version 2 of the License, or + | (at your option) any later version. + | + | This program is distributed in the hope that it will be useful, + | but WITHOUT ANY WARRANTY; without even the implied warranty of + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + | GNU General Public License for more details. + | + | You should have received a copy of the GNU General Public License + | along with this program; if not, write to the Free Software + | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + | + | iTunes and iPod are trademarks of Apple + | + | This product is not supported/written/published by Apple! + | + | $Id$ + */ + +#include "gp_private.h" + +/* ------------------------------------------------------------ + + Functions for treeview autoscroll (during DND) + + ------------------------------------------------------------ */ + +static void _remove_scroll_row_timeout(GtkWidget *widget) { + g_return_if_fail(widget); + + g_object_set_data(G_OBJECT(widget), "scroll_row_timeout", NULL); + g_object_set_data(G_OBJECT(widget), "scroll_row_times", NULL); +} + +static gint gp_autoscroll_row_timeout(gpointer data) { + GtkTreeView *treeview = data; + gint px, py; + GdkModifierType mask; + GdkRectangle vis_rect; + guint times; + gboolean resp = TRUE; + const gint SCROLL_EDGE_SIZE = 12; + + g_return_val_if_fail(data, FALSE); + + gdk_threads_enter(); + + times = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(data), "scroll_row_times")); + + gdk_window_get_pointer(gtk_tree_view_get_bin_window(treeview), &px, &py, &mask); + gtk_tree_view_get_visible_rect(treeview, &vis_rect); + /* printf ("px/py, w/h, mask: %d/%d, %d/%d, %d\n", px, py, */ + /* vis_rect.width, vis_rect.height, mask); */ + if ((vis_rect.height > 2.2 * SCROLL_EDGE_SIZE) && ((py < SCROLL_EDGE_SIZE) || (py > vis_rect.height + - SCROLL_EDGE_SIZE))) { + GtkTreePath *path = NULL; + + if (py < SCROLL_EDGE_SIZE / 3) + ++times; + if (py > vis_rect.height - SCROLL_EDGE_SIZE / 3) + ++times; + + if (times > 0) { + if (gtk_tree_view_get_path_at_pos(treeview, px, py, &path, NULL, NULL, NULL)) { + if (py < SCROLL_EDGE_SIZE) + gtk_tree_path_prev(path); + if (py > vis_rect.height - SCROLL_EDGE_SIZE) + gtk_tree_path_next(path); + gtk_tree_view_scroll_to_cell(treeview, path, NULL, FALSE, 0, 0); + } + times = 0; + } + else { + ++times; + } + } + else { + times = 0; + } + g_object_set_data(G_OBJECT(data), "scroll_row_times", GUINT_TO_POINTER(times)); + if (mask == 0) { + _remove_scroll_row_timeout(data); + resp = FALSE; + } + gdk_threads_leave(); + return resp; +} + +void gp_install_autoscroll_row_timeout(GtkWidget *widget) { + if (!g_object_get_data(G_OBJECT(widget), "scroll_row_timeout")) { /* install timeout function for autoscroll */ + guint timeout = g_timeout_add(75, gp_autoscroll_row_timeout, widget); + g_object_set_data(G_OBJECT(widget), "scroll_row_timeout", GUINT_TO_POINTER(timeout)); + } +} + +void gp_remove_autoscroll_row_timeout(GtkWidget *widget) { + guint timeout; + + g_return_if_fail(widget); + + timeout = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(widget), "scroll_row_timeout")); + + if (timeout != 0) { + g_source_remove(timeout); + _remove_scroll_row_timeout(widget); + } +} diff --git a/libgtkpod/gp_private.h b/libgtkpod/gp_private.h index fe1fa08..07751aa 100644 --- a/libgtkpod/gp_private.h +++ b/libgtkpod/gp_private.h @@ -1,31 +1,31 @@ /* Time-stamp: <2009-11-28 11:10:13 pgr> -| -| Copyright (C) 2002-2009 Paul Richardson <phantom_sf at users sourceforge net> -| Part of the gtkpod project. -| -| URL: http://www.gtkpod.org/ -| URL: http://gtkpod.sourceforge.net/ -| -| This program is free software; you can redistribute it and/or modify -| it under the terms of the GNU General Public License as published by -| the Free Software Foundation; either version 2 of the License, or -| (at your option) any later version. -| -| This program is distributed in the hope that it will be useful, -| but WITHOUT ANY WARRANTY; without even the implied warranty of -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -| GNU General Public License for more details. -| -| You should have received a copy of the GNU General Public License -| along with this program; if not, write to the Free Software -| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -| -| iTunes and iPod are trademarks of Apple -| -| This product is not supported/written/published by Apple! -| -| $Id$ -*/ + | Copyright (C) 2002-2009 Jorg Schuler <jcsjcs at users sourceforge net> + | Copyright (C) 2009-2010 Paul Richardson <phantom_sf at users sourceforge net> + | Part of the gtkpod project. + | + | URL: http://www.gtkpod.org/ + | URL: http://gtkpod.sourceforge.net/ + | + | This program is free software; you can redistribute it and/or modify + | it under the terms of the GNU General Public License as published by + | the Free Software Foundation; either version 2 of the License, or + | (at your option) any later version. + | + | This program is distributed in the hope that it will be useful, + | but WITHOUT ANY WARRANTY; without even the implied warranty of + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + | GNU General Public License for more details. + | + | You should have received a copy of the GNU General Public License + | along with this program; if not, write to the Free Software + | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + | + | iTunes and iPod are trademarks of Apple + | + | This product is not supported/written/published by Apple! + | + | $Id$ + */ #ifndef GP_DEFINITIONS_H_ #define GP_DEFINITIONS_H_ @@ -34,6 +34,8 @@ # include <config.h> #endif +#include <gtk/gtk.h> + /* tree sort cannot be unsorted by choosing the default sort * column. Set to 1 if it's broken, 0 if it's not broken */ #define BROKEN_GTK_TREE_SORT (!RUNTIME_GTK_CHECK_VERSION(2,5,4)) @@ -46,20 +48,13 @@ /* Drag and drop types */ enum { - DND_GTKPOD_TRACKLIST = 1000, - DND_GTKPOD_TM_PATHLIST, - DND_GTKPOD_PLAYLISTLIST, - DND_TEXT_URI_LIST, - DND_TEXT_PLAIN, - DND_IMAGE_JPEG + DND_GTKPOD_TRACKLIST = 1000, DND_GTKPOD_TM_PATHLIST, DND_GTKPOD_PLAYLISTLIST, DND_TEXT_URI_LIST, DND_TEXT_PLAIN, DND_IMAGE_JPEG }; /* types for sort */ -enum -{ - SORT_ASCENDING = GTK_SORT_ASCENDING, - SORT_DESCENDING = GTK_SORT_DESCENDING, - SORT_NONE = 10*(GTK_SORT_ASCENDING+GTK_SORT_DESCENDING), +enum { + SORT_ASCENDING = GTK_SORT_ASCENDING, SORT_DESCENDING = GTK_SORT_DESCENDING, SORT_NONE = 10 * (GTK_SORT_ASCENDING + + GTK_SORT_DESCENDING), }; /* print some timing info for tuning purposes */ @@ -72,118 +67,19 @@ enum /* Prefs strings */ extern const gchar *TM_PREFS_SEARCH_COLUMN; -struct asf_data -{ +struct asf_data { GtkTreeIter *to_iter; GtkTreeViewDropPosition pos; }; /* ------------------------------------------------------------ - Functions for treeview autoscroll (during DND) - - ------------------------------------------------------------ */ - -static void _remove_scroll_row_timeout (GtkWidget *widget) -{ - g_return_if_fail (widget); - - g_object_set_data (G_OBJECT (widget), - "scroll_row_timeout", NULL); - g_object_set_data (G_OBJECT (widget), - "scroll_row_times", NULL); -} - -static gint gp_autoscroll_row_timeout (gpointer data) -{ - GtkTreeView *treeview = data; - gint px, py; - GdkModifierType mask; - GdkRectangle vis_rect; - guint times; - gboolean resp = TRUE; - const gint SCROLL_EDGE_SIZE = 12; - - g_return_val_if_fail (data, FALSE); - - gdk_threads_enter (); - - times = GPOINTER_TO_UINT(g_object_get_data (G_OBJECT (data), "scroll_row_times")); - - gdk_window_get_pointer (gtk_tree_view_get_bin_window (treeview), - &px, &py, &mask); - gtk_tree_view_get_visible_rect (treeview, &vis_rect); -/* printf ("px/py, w/h, mask: %d/%d, %d/%d, %d\n", px, py, */ -/* vis_rect.width, vis_rect.height, mask); */ - if ((vis_rect.height > 2.2 * SCROLL_EDGE_SIZE) && - ((py < SCROLL_EDGE_SIZE) || - (py > vis_rect.height-SCROLL_EDGE_SIZE))) - { - GtkTreePath *path = NULL; - - if (py < SCROLL_EDGE_SIZE/3) - ++times; - if (py > vis_rect.height-SCROLL_EDGE_SIZE/3) - ++times; - - if (times > 0) - { - if (gtk_tree_view_get_path_at_pos (treeview, px, py, - &path, NULL, NULL, NULL)) - { - if (py < SCROLL_EDGE_SIZE) - gtk_tree_path_prev (path); - if (py > vis_rect.height-SCROLL_EDGE_SIZE) - gtk_tree_path_next (path); - gtk_tree_view_scroll_to_cell (treeview, path, NULL, - FALSE, 0, 0); - } - times = 0; - } - else - { - ++times; - } - } - else - { - times = 0; - } - g_object_set_data (G_OBJECT (data), "scroll_row_times", - GUINT_TO_POINTER(times)); - if (mask == 0) - { - _remove_scroll_row_timeout (data); - resp = FALSE; - } - gdk_threads_leave (); - return resp; -} - -void gp_install_autoscroll_row_timeout (GtkWidget *widget) -{ - if (!g_object_get_data (G_OBJECT (widget), "scroll_row_timeout")) - { /* install timeout function for autoscroll */ - guint timeout = g_timeout_add (75, gp_autoscroll_row_timeout, - widget); - g_object_set_data (G_OBJECT (widget), "scroll_row_timeout", - GUINT_TO_POINTER(timeout)); - } -} - -void gp_remove_autoscroll_row_timeout (GtkWidget *widget) -{ - guint timeout; - - g_return_if_fail (widget); - - timeout = GPOINTER_TO_UINT(g_object_get_data (G_OBJECT (widget), - "scroll_row_timeout")); - - if (timeout != 0) - { - g_source_remove (timeout); - _remove_scroll_row_timeout (widget); - } -} + Functions for treeview autoscroll (during DND) + + ------------------------------------------------------------ */ + +void gp_install_autoscroll_row_timeout(GtkWidget *widget); + +void gp_remove_autoscroll_row_timeout(GtkWidget *widget); + #endif /* GP_DEFINITIONS_H_ */ diff --git a/plugins/playlist_display/plugin.c b/plugins/playlist_display/plugin.c index 98518f5..cbd3444 100644 --- a/plugins/playlist_display/plugin.c +++ b/plugins/playlist_display/plugin.c @@ -114,6 +114,7 @@ static gboolean activate_plugin(AnjutaPlugin *plugin) { playlist_display_plugin->pl_window = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (playlist_display_plugin->pl_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW (playlist_display_plugin->pl_window), GTK_SHADOW_IN); + gtk_widget_set_size_request(playlist_display_plugin->pl_window, 250, -1); playlist_display_plugin->playlist_view = pm_create_treeview(); @@ -122,7 +123,7 @@ static gboolean activate_plugin(AnjutaPlugin *plugin) { gtk_container_add(GTK_CONTAINER (playlist_display_plugin->pl_window), GTK_WIDGET (playlist_display_plugin->playlist_view)); gtk_widget_show_all(playlist_display_plugin->pl_window); - anjuta_shell_add_widget(plugin->shell, playlist_display_plugin->pl_window, "PlaylistDisplayPlugin", "", NULL, ANJUTA_SHELL_PLACEMENT_LEFT, NULL); + anjuta_shell_add_widget(plugin->shell, playlist_display_plugin->pl_window, "PlaylistDisplayPlugin", "iPod Repositories", NULL, ANJUTA_SHELL_PLACEMENT_LEFT, NULL); return TRUE; /* FALSE if activation failed */ } diff --git a/plugins/sorttab_display/Makefile.am b/plugins/sorttab_display/Makefile.am index 6dd4f58..5b129be 100644 --- a/plugins/sorttab_display/Makefile.am +++ b/plugins/sorttab_display/Makefile.am @@ -47,6 +47,7 @@ plugin_LTLIBRARIES = libsorttab_display.la # Plugin sources libsorttab_display_la_SOURCES = plugin.c plugin.h \ sorttab_conversion.c sorttab_conversion.h \ + sorttab_display_actions.c sorttab_display_actions.h \ display_sorttabs.c display_sorttabs.h \ date_parser2.l date_parser.l date_parser.h diff --git a/plugins/sorttab_display/plugin.c b/plugins/sorttab_display/plugin.c index 80e6d5f..73730a9 100644 --- a/plugins/sorttab_display/plugin.c +++ b/plugins/sorttab_display/plugin.c @@ -35,12 +35,21 @@ #include "libgtkpod/gtkpod_app_iface.h" #include "plugin.h" #include "display_sorttabs.h" +#include "sorttab_display_actions.h" /* Parent class. Part of standard class definition */ static gpointer parent_class; static GtkActionEntry sorttab_actions[] = { + { + "ActionViewMoreFilterTabs", /* Action name */ + NULL, /* Stock icon */ + N_("_More Filter Tabs"), /* Display label */ + NULL, /* short-cut */ + NULL, /* Tooltip */ + G_CALLBACK (on_more_sort_tabs_activate) /* callback */ + } }; static gboolean activate_plugin(AnjutaPlugin *plugin) { @@ -69,8 +78,8 @@ static gboolean activate_plugin(AnjutaPlugin *plugin) { // g_signal_connect (gtkpod_app, "sorttab_selected", G_CALLBACK (sorttab_display_select_sorttab_cb), NULL); // g_signal_connect (gtkpod_app, "itdb_updated", G_CALLBACK (sorttab_display_update_itdb_cb), NULL); - gtk_widget_show_all(sorttab_display_plugin->st_paned); - anjuta_shell_add_widget(plugin->shell, sorttab_display_plugin->st_paned, "SorttabDisplayPlugin", "", NULL, ANJUTA_SHELL_PLACEMENT_BOTTOM, NULL); + gtk_widget_show(sorttab_display_plugin->st_paned); + anjuta_shell_add_widget(plugin->shell, sorttab_display_plugin->st_paned, "SorttabDisplayPlugin", "Track Filter", NULL, ANJUTA_SHELL_PLACEMENT_BOTTOM, NULL); return TRUE; /* FALSE if activation failed */ } diff --git a/plugins/sorttab_display/sorttab_display_actions.c b/plugins/sorttab_display/sorttab_display_actions.c new file mode 100644 index 0000000..cfacdf5 --- /dev/null +++ b/plugins/sorttab_display/sorttab_display_actions.c @@ -0,0 +1,40 @@ +/* + | Copyright (C) 2002-2010 Jorg Schuler <jcsjcs at users sourceforge net> + | Paul Richardson <phantom_sf at users.sourceforge.net> + | Part of the gtkpod project. + | + | URL: http://www.gtkpod.org/ + | URL: http://gtkpod.sourceforge.net/ + | + | This program is free software; you can redistribute it and/or modify + | it under the terms of the GNU General Public License as published by + | the Free Software Foundation; either version 2 of the License, or + | (at your option) any later version. + | + | This program is distributed in the hope that it will be useful, + | but WITHOUT ANY WARRANTY; without even the implied warranty of + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + | GNU General Public License for more details. + | + | You should have received a copy of the GNU General Public License + | along with this program; if not, write to the Free Software + | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + | + | iTunes and iPod are trademarks of Apple + | + | This product is not supported/written/published by Apple! + | + | $Id$ + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "sorttab_display_actions.h" +#include "display_sorttabs.h" + +void on_more_sort_tabs_activate (GtkAction *action, SorttabDisplayPlugin* plugin) { +// prefs_set_int("sort_tab_num", prefs_get_int("sort_tab_num") + 1); +// st_show_visible(); +} diff --git a/plugins/sorttab_display/sorttab_display_actions.h b/plugins/sorttab_display/sorttab_display_actions.h new file mode 100644 index 0000000..6c47a48 --- /dev/null +++ b/plugins/sorttab_display/sorttab_display_actions.h @@ -0,0 +1,41 @@ +/* +| Copyright (C) 2002-2010 Jorg Schuler <jcsjcs at users sourceforge net> +| Paul Richardson <phantom_sf at users.sourceforge.net> +| Part of the gtkpod project. +| +| URL: http://www.gtkpod.org/ +| URL: http://gtkpod.sourceforge.net/ +| +| This program is free software; you can redistribute it and/or modify +| it under the terms of the GNU General Public License as published by +| the Free Software Foundation; either version 2 of the License, or +| (at your option) any later version. +| +| This program is distributed in the hope that it will be useful, +| but WITHOUT ANY WARRANTY; without even the implied warranty of +| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +| GNU General Public License for more details. +| +| You should have received a copy of the GNU General Public License +| along with this program; if not, write to the Free Software +| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +| +| iTunes and iPod are trademarks of Apple +| +| This product is not supported/written/published by Apple! +| +| $Id$ +*/ +#ifndef __SORTTAB_DISPLAY_H__ +#define __SORTTAB_DISPLAY_H__ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <gtk/gtk.h> +#include "plugin.h" + +void on_more_sort_tabs_activate (GtkAction *action, SorttabDisplayPlugin* plugin); + +#endif diff --git a/src/anjuta-app.c b/src/anjuta-app.c index 4def25d..30c438d 100644 --- a/src/anjuta-app.c +++ b/src/anjuta-app.c @@ -307,8 +307,8 @@ static void anjuta_app_finalize(GObject *widget) { app = ANJUTA_APP (widget); - gtk_widget_destroy(GTK_WIDGET (app->ui)); - gtk_widget_destroy(GTK_WIDGET (app->preferences)); + g_object_unref(G_OBJECT(app->ui)); + g_object_unref(G_OBJECT (app->preferences)); G_OBJECT_CLASS (parent_class)->finalize(widget); } @@ -756,7 +756,7 @@ static void anjuta_app_add_widget_full(AnjutaShell *shell, GtkWidget *widget, co if (locked) gdl_dock_item_set_default_position(GDL_DOCK_ITEM(item), GDL_DOCK_OBJECT(app->dock)); - gtk_widget_show_all(item); + gtk_widget_show(item); /* Add toggle button for the widget */ menuitem = GTK_CHECK_MENU_ITEM (gtk_check_menu_item_new_with_label (title)); diff --git a/src/display_itdb.c b/src/display_itdb.c index bdb33c0..d9e10cc 100644 --- a/src/display_itdb.c +++ b/src/display_itdb.c @@ -50,6 +50,7 @@ static struct itdbs_head *itdbs_head = NULL; /* for convenience */ struct itdbs_head *gp_get_itdbs_head() { + g_return_val_if_fail(gtkpod_app, NULL); return g_object_get_data(G_OBJECT (gtkpod_app), "itdbs_head"); } @@ -275,10 +276,10 @@ void gp_track_remove(Track *track) { void gp_track_unlink(Track *track) { g_warning("TODO need to remove track from playlists and details window if necessary"); /* the details window may be accessing the tracks */ -// details_remove_track(track); + // details_remove_track(track); g_warning("TODO signal that any file conversions on track be cancelled"); /* cancel pending conversions */ -// file_convert_cancel_track(track); + // file_convert_cancel_track(track); /* remove from SHA1 hash */ sha1_track_remove(track); /* remove from pc_path_hash */ @@ -415,7 +416,7 @@ void gp_replace_itdb(iTunesDB *old_itdb, iTunesDB *new_itdb) { set_itdb_prefs_string(new_itdb, "name", mpl->name); /* update ui */ - g_signal_emit (gtkpod_app, gtkpod_app_signals[ITDB_UPDATED], 0, old_itdb, new_itdb); + g_signal_emit(gtkpod_app, gtkpod_app_signals[ITDB_UPDATED], 0, old_itdb, new_itdb); /* reselect old playlist if still available */ if (old_pl_name) { @@ -976,7 +977,7 @@ gboolean gp_increase_playcount(gchar *sha1, gchar *file, gint num) { /* get the currently selected itdb. NULL is * returned if no itdb is active. */ iTunesDB *gp_get_selected_itdb(void) { - return gtkpod_get_current_itdb (); + return gtkpod_get_current_itdb(); } /* Get the "ipod" itdb. If only one iPod itdb exists, this itdb is @@ -984,39 +985,36 @@ iTunesDB *gp_get_selected_itdb(void) { * itdb is returned if it's an iPod itdb, otherwise NULL is returned. */ iTunesDB *gp_get_ipod_itdb(void) { - g_warning("gp_itdb : gp_get_ipod_itdb commented out\n"); - // struct itdbs_head *itdbs_head; - // iTunesDB *itdb; - // GList *gl; - // gint i; - // - // /* if an iPod itdb is selected, return this */ - // itdb = gp_get_selected_itdb (); - // if (itdb && (itdb->usertype & GP_ITDB_TYPE_IPOD)) - // return itdb; - // - // itdb = NULL; - // - // g_return_val_if_fail (gtkpod_app, NULL); - // itdbs_head = g_object_get_data (G_OBJECT (gtkpod_app), - // "itdbs_head"); - // - // if (itdbs_head == NULL) return NULL; - // - // i=0; - // for (gl=itdbs_head->itdbs; gl; gl=gl->next) - // { - // iTunesDB *itdbgl = gl->data; - // g_return_val_if_fail (itdbgl, NULL); - // if (itdbgl->usertype & GP_ITDB_TYPE_IPOD) - // { - // itdb = itdbgl; - // ++i; - // } - // } - // /* return iPod itdb if only one was found */ - // if (i == 1) - // return itdb; + struct itdbs_head *itdbs_head; + iTunesDB *itdb; + GList *gl; + gint i; + + /* if an iPod itdb is selected, return this */ + itdb = gp_get_selected_itdb(); + if (itdb && (itdb->usertype & GP_ITDB_TYPE_IPOD)) + return itdb; + + itdb = NULL; + + g_return_val_if_fail (gtkpod_app, NULL); + itdbs_head = gp_get_itdbs_head(); + + if (itdbs_head == NULL) + return NULL; + + i = 0; + for (gl = itdbs_head->itdbs; gl; gl = gl->next) { + iTunesDB *itdbgl = gl->data; + g_return_val_if_fail (itdbgl, NULL); + if (itdbgl->usertype & GP_ITDB_TYPE_IPOD) { + itdb = itdbgl; + ++i; + } + } + /* return iPod itdb if only one was found */ + if (i == 1) + return itdb; return NULL; } diff --git a/src/display_sorttabs.c b/src/display_sorttabs.c index 611c798..5c1c529 100644 --- a/src/display_sorttabs.c +++ b/src/display_sorttabs.c @@ -2894,6 +2894,9 @@ void st_update_paned_position() { GtkWidget *top = gtk_paned_get_child1(sorttab_parent); GtkWidget *bottom = gtk_paned_get_child2(sorttab_parent); + if (! top || ! bottom) + return; // sorttab_parent currently lacks either top or bottom panes + gboolean top_is_st_paned = g_object_get_data(G_OBJECT (top), "paned_id") != NULL; gboolean st_top = prefs_get_int("filter_tabs_top"); diff --git a/src/file_itunesdb.c b/src/file_itunesdb.c index 52ae486..321cadb 100644 --- a/src/file_itunesdb.c +++ b/src/file_itunesdb.c @@ -1846,7 +1846,7 @@ void handle_export(void) { g_return_if_fail (gtkpod_app); - itdbs_head = g_object_get_data(G_OBJECT (gtkpod_app), "itdbs_head"); + itdbs_head = gp_get_itdbs_head(); g_return_if_fail (itdbs_head); block_widgets(); /* block user input */ @@ -1918,7 +1918,7 @@ gboolean files_are_saved(void) { GList *gl; g_return_val_if_fail (gtkpod_app, TRUE); - itdbs_head = g_object_get_data(G_OBJECT (gtkpod_app), "itdbs_head"); + itdbs_head = gp_get_itdbs_head(); g_return_val_if_fail (itdbs_head, TRUE); for (gl = itdbs_head->itdbs; gl; gl = gl->next) { iTunesDB *itdb = gl->data; diff --git a/src/misc_track.c b/src/misc_track.c index bee8c42..79e3877 100644 --- a/src/misc_track.c +++ b/src/misc_track.c @@ -99,22 +99,19 @@ void gp_sha1_hash_tracks_itdb(iTunesDB *itdb) { * */ void gp_sha1_hash_tracks(void) { - // GList *gl; + GList *gl; struct itdbs_head *itdbs_head; - itdbs_head = NULL; - g_warning("TODO gp_sha1_hash_tracks - get itdbs_head from somewhere else"); - // g_return_if_fail (gtkpod_app); - // itdbs_head = g_object_get_data (G_OBJECT (gtkpod_app), - // "itdbs_head"); - // g_return_if_fail (itdbs_head); - // - // block_widgets (); - // for (gl=itdbs_head->itdbs; gl; gl=gl->next) - // { - // gp_sha1_hash_tracks_itdb (gl->data); - // } - // release_widgets (); + itdbs_head = gp_get_itdbs_head(); + g_return_if_fail (itdbs_head); + + g_warning("TODO block widgets in gp_sha1_hash_tracks"); + // block_widgets(); + for (gl = itdbs_head->itdbs; gl; gl = gl->next) { + gp_sha1_hash_tracks_itdb(gl->data); + } + g_warning("TODO release widgets in gp_sha1_hash_tracks"); + // release_widgets(); } static void rm_sha1(gpointer track, gpointer user_data) { @@ -134,10 +131,8 @@ void gp_sha1_free_hash(void) { struct itdbs_head *itdbs_head; itdbs_head = NULL; - g_warning("TODO gp_sha1_free_hash - get itdbs_head from somewhere else"); - // g_return_if_fail (gtkpod_app); - // itdbs_head = g_object_get_data (G_OBJECT (gtkpod_app), - // "itdbs_head"); + g_return_if_fail (gtkpod_app); + itdbs_head = gp_get_itdbs_head(); g_return_if_fail (itdbs_head); for (gl = itdbs_head->itdbs; gl; gl = gl->next) { ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ gtkpod-cvs2 mailing list gtkpod-cvs2@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2