Hi all, I finally had time to finish the initial podcast support for rhythmbox. Attached there are the diff against the CVS HEAD and a tarball with the new files. To test it just apply the patch and decompress the tarball inside your rhythmbox devel src dir. Please let me know what you think about it. Any doubt and suggestions are welcome. I will be glad to fix the bugs and add new features as needed. BR, Renato Araujo INdT - Instituto Nokia de Tecnologia reanato filho indt org br
Index: Makefile.am =================================================================== RCS file: /cvs/gnome/rhythmbox/Makefile.am,v retrieving revision 1.39 diff -u -3 -p -r1.39 Makefile.am --- Makefile.am 3 Sep 2004 03:14:32 -0000 1.39 +++ Makefile.am 1 Sep 2005 14:21:56 -0000 @@ -4,7 +4,7 @@ AUTOMAKE_OPTIONS = 1.7 DISTCHECK_CONFIGURE_FLAGS = --disable-schemas-install -SUBDIRS = lib metadata player rhythmdb widgets sources iradio remote shell data po help tests +SUBDIRS = lib metadata player rhythmdb widgets sources iradio podcast remote shell data po help tests EXTRA_DIST = \ autogen.sh \ Index: configure.ac =================================================================== RCS file: /cvs/gnome/rhythmbox/configure.ac,v retrieving revision 1.157 diff -u -3 -p -r1.157 configure.ac --- configure.ac 31 Aug 2005 23:42:04 -0000 1.157 +++ configure.ac 1 Sep 2005 14:21:56 -0000 @@ -457,6 +457,7 @@ player/Makefile rhythmdb/Makefile widgets/Makefile iradio/Makefile +podcast/Makefile remote/Makefile remote/bonobo/Makefile remote/dbus/Makefile Index: data/rhythmbox.schemas =================================================================== RCS file: /cvs/gnome/rhythmbox/data/rhythmbox.schemas,v retrieving revision 1.46 diff -u -3 -p -r1.46 rhythmbox.schemas --- data/rhythmbox.schemas 30 Aug 2005 21:03:28 -0000 1.46 +++ data/rhythmbox.schemas 1 Sep 2005 14:21:56 -0000 @@ -199,7 +199,7 @@ <applyto>/apps/rhythmbox/ui/columns_setup</applyto> <owner>rhythmbox</owner> <type>string</type> - <default>RB_TREE_MODEL_NODE_COL_TRACK_NUMBER_STR,RB_TREE_MODEL_NODE_COL_ARTIST,RB_TREE_MODEL_NODE_COL_ALBUM,RB_TREE_MODEL_NODE_COL_GENRE,RB_TREE_MODEL_NODE_COL_DURATION</default> + <default>RHYTHMDB_PROP_STATUS,RHYTHMDB_PROP_DATE_STR,RB_TREE_MODEL_NODE_COL_TRACK_NUMBER_STR,RB_TREE_MODEL_NODE_COL_ARTIST,RB_TREE_MODEL_NODE_COL_ALBUM,RB_TREE_MODEL_NODE_COL_GENRE,RB_TREE_MODEL_NODE_COL_DURATION</default> <locale name="C"> <short>(obsolete) List of active columns.</short> <long>The list of columns that will be shown for Rhythmbox versions < 0.6.0. If a source @@ -211,7 +211,7 @@ <applyto>/apps/rhythmbox/ui/rhythmdb_columns_setup</applyto> <owner>rhythmbox</owner> <type>string</type> - <default>RHYTHMDB_PROP_TRACK_NUMBER,RHYTHMDB_PROP_ARTIST,RHYTHMDB_PROP_ALBUM,RHYTHMDB_PROP_GENRE,RHYTHMDB_PROP_DURATION</default> + <default>RHYTHMDB_PROP_STATUS,RHYTHMDB_PROP_DATE_STR,RHYTHMDB_PROP_TRACK_NUMBER,RHYTHMDB_PROP_ARTIST,RHYTHMDB_PROP_ALBUM,RHYTHMDB_PROP_GENRE,RHYTHMDB_PROP_DURATION</default> <locale name="C"> <short>List of active columns.</short> <long>The list of columns that will be shown. If a source @@ -244,6 +244,40 @@ <schema> <key>/schemas/apps/rhythmbox/state/iradio/sorting</key> <applyto>/apps/rhythmbox/state/iradio/sorting</applyto> + <owner>rhythmbox</owner> + <type>string</type> + <default>Title,ascending</default> + <locale name="C"> + <short>The sorting order</short> + <long>A comma-separated list. The first is the title of the + column to sort on, the second is the sort type.</long> + </locale> + </schema> + <schema> + <key>/schemas/apps/rhythmbox/state/podcast/search_text</key> + <applyto>/apps/rhythmbox/state/podcast/search_text</applyto> + <owner>rhythmbox</owner> + <type>string</type> + <default></default> + <locale name="C"> + <short>String used for filtering podcast view.</short> + <long>String used for filtering podcast view.</long> + </locale> + </schema> + <schema> + <key>/schemas/apps/rhythmbox/state/podcast/show_browser</key> + <applyto>/apps/rhythmbox/state/podcast/show_browser</applyto> + <owner>rhythmbox</owner> + <type>bool</type> + <default>0</default> + <locale name="C"> + <short>Show browser in podcast display</short> + <long>Show the album browser in the Podcast display.</long> + </locale> + </schema> + <schema> + <key>/schemas/apps/rhythmbox/state/podcast/sorting</key> + <applyto>/apps/rhythmbox/state/podcast/sorting</applyto> <owner>rhythmbox</owner> <type>string</type> <default>Title,ascending</default> Index: data/art/Makefile.am =================================================================== RCS file: /cvs/gnome/rhythmbox/data/art/Makefile.am,v retrieving revision 1.20 diff -u -3 -p -r1.20 Makefile.am --- data/art/Makefile.am 8 Feb 2005 19:04:38 -0000 1.20 +++ data/art/Makefile.am 1 Sep 2005 14:21:56 -0000 @@ -24,6 +24,7 @@ art_DATA = rhythmbox-shuffle.png \ rhythmbox-audiocd.png \ rhythmbox-dnd.png \ rhythmbox-ipod.png \ + rhythmbox-podcast.png \ about-logo.png artdir = $(pkgdatadir)/art Index: data/glade/Makefile.am =================================================================== RCS file: /cvs/gnome/rhythmbox/data/glade/Makefile.am,v retrieving revision 1.16 diff -u -3 -p -r1.16 Makefile.am --- data/glade/Makefile.am 16 Sep 2004 19:16:07 -0000 1.16 +++ data/glade/Makefile.am 1 Sep 2005 14:21:56 -0000 @@ -2,11 +2,14 @@ glade_DATA = general-prefs.glade \ library-prefs.glade \ + podcast-prefs.glade \ song-info.glade \ song-info-multiple.glade \ load-failure.glade \ station-new.glade \ station-properties.glade \ + podcast-new.glade \ + podcast-properties.glade \ create-playlist.glade \ druid.glade \ recorder.glade \ Index: data/glade/general-prefs.glade =================================================================== RCS file: /cvs/gnome/rhythmbox/data/glade/general-prefs.glade,v retrieving revision 1.6 diff -u -3 -p -r1.6 general-prefs.glade --- data/glade/general-prefs.glade 26 Jun 2005 21:49:57 -0000 1.6 +++ data/glade/general-prefs.glade 1 Sep 2005 14:21:56 -0000 @@ -2,7 +2,6 @@ <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> <glade-interface> -<requires lib="gnome"/> <widget class="GtkWindow" id="preferences"> <property name="visible">True</property> @@ -12,6 +11,12 @@ <property name="modal">False</property> <property name="resizable">False</property> <property name="destroy_with_parent">False</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="focus_on_map">True</property> <child> <widget class="GtkVBox" id="general_vbox"> @@ -45,6 +50,10 @@ <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> @@ -72,6 +81,10 @@ <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> @@ -105,6 +118,10 @@ <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> @@ -116,7 +133,7 @@ <child> <widget class="GtkTable" id="table1"> <property name="visible">True</property> - <property name="n_rows">5</property> + <property name="n_rows">6</property> <property name="n_columns">2</property> <property name="homogeneous">True</property> <property name="row_spacing">6</property> @@ -298,6 +315,52 @@ <property name="right_attach">2</property> <property name="top_attach">3</property> <property name="bottom_attach">4</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkCheckButton" id="status_check"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">_Status</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="rb_shell_preferences_column_check_changed_cb" last_modification_time="Fri, 02 May 2003 04:26:32 GMT"/> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkCheckButton" id="date_check"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Da_te</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="rb_shell_preferences_column_check_changed_cb" last_modification_time="Fri, 02 May 2003 04:26:32 GMT"/> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> Index: data/ui/rhythmbox-ui.xml =================================================================== RCS file: /cvs/gnome/rhythmbox/data/ui/rhythmbox-ui.xml,v retrieving revision 1.20 diff -u -3 -p -r1.20 rhythmbox-ui.xml --- data/ui/rhythmbox-ui.xml 26 Jul 2005 14:07:28 -0000 1.20 +++ data/ui/rhythmbox-ui.xml 1 Sep 2005 14:21:56 -0000 @@ -15,6 +15,7 @@ <menuitem name="MusicPlaylistDeletePlaylistMenu" action="MusicPlaylistDeletePlaylist"/> </menu> <menuitem name="MusicNewInternetRadioStationMenu" action="MusicNewInternetRadioStation"/> + <menuitem name="MusicNewPodcastMenu" action="MusicNewPodcast"/> <separator/> <menuitem name="MusicPropertiesMenu" action="MusicProperties"/> <separator/> Index: lib/rb-stock-icons.c =================================================================== RCS file: /cvs/gnome/rhythmbox/lib/rb-stock-icons.c,v retrieving revision 1.17 diff -u -3 -p -r1.17 rb-stock-icons.c --- lib/rb-stock-icons.c 8 Feb 2005 19:04:39 -0000 1.17 +++ lib/rb-stock-icons.c 1 Sep 2005 14:21:56 -0000 @@ -60,7 +60,8 @@ rb_stock_icons_init (void) RB_STOCK_NO_STAR, RB_STOCK_DND_ICON, RB_STOCK_AUDIOCD, - RB_STOCK_IPOD + RB_STOCK_IPOD, + RB_STOCK_PODCAST }; g_return_if_fail (factory == NULL); Index: lib/rb-stock-icons.h =================================================================== RCS file: /cvs/gnome/rhythmbox/lib/rb-stock-icons.h,v retrieving revision 1.17 diff -u -3 -p -r1.17 rb-stock-icons.h --- lib/rb-stock-icons.h 8 Feb 2005 19:04:39 -0000 1.17 +++ lib/rb-stock-icons.h 1 Sep 2005 14:21:56 -0000 @@ -50,6 +50,7 @@ G_BEGIN_DECLS #define RB_STOCK_AUDIOCD "rhythmbox-audiocd" #define RB_STOCK_DND_ICON "rhythmbox-dnd" #define RB_STOCK_IPOD "rhythmbox-ipod" +#define RB_STOCK_PODCAST "rhythmbox-podcast" void rb_stock_icons_init (void); Index: rhythmdb/rhythmdb-property-model.c =================================================================== RCS file: /cvs/gnome/rhythmbox/rhythmdb/rhythmdb-property-model.c,v retrieving revision 1.21 diff -u -3 -p -r1.21 rhythmdb-property-model.c --- rhythmdb/rhythmdb-property-model.c 25 Aug 2005 02:47:32 -0000 1.21 +++ rhythmdb/rhythmdb-property-model.c 1 Sep 2005 14:21:56 -0000 @@ -510,6 +510,7 @@ rhythmdb_property_model_insert_prop (Rhy prop->refcount = 1; iter.stamp = model->priv->stamp; + ptr = g_sequence_insert_sorted (model->priv->properties, prop, (GCompareDataFunc) rhythmdb_property_model_compare, model); Index: rhythmdb/rhythmdb-query-model.c =================================================================== RCS file: /cvs/gnome/rhythmbox/rhythmdb/rhythmdb-query-model.c,v retrieving revision 1.75 diff -u -3 -p -r1.75 rhythmdb-query-model.c --- rhythmdb/rhythmdb-query-model.c 27 Aug 2005 12:12:12 -0000 1.75 +++ rhythmdb/rhythmdb-query-model.c 1 Sep 2005 14:21:56 -0000 @@ -713,6 +713,7 @@ rhythmdb_query_model_insert_into_main_li rhythmdb_entry_ref (model->priv->db, entry); if (model->priv->sort_func) { + ptr = g_sequence_insert_sorted (model->priv->entries, entry, model->priv->sort_func, model->priv->sort_user_data); @@ -736,6 +737,7 @@ rhythmdb_query_model_insert_into_limited rhythmdb_entry_ref (model->priv->db, entry); if (model->priv->sort_func) { + ptr = g_sequence_insert_sorted (model->priv->limited_entries, entry, model->priv->sort_func, model->priv->sort_user_data); Index: rhythmdb/rhythmdb-tree.c =================================================================== RCS file: /cvs/gnome/rhythmbox/rhythmdb/rhythmdb-tree.c,v retrieving revision 1.69 diff -u -3 -p -r1.69 rhythmdb-tree.c --- rhythmdb/rhythmdb-tree.c 29 Aug 2005 22:00:42 -0000 1.69 +++ rhythmdb/rhythmdb-tree.c 1 Sep 2005 14:21:56 -0000 @@ -249,6 +249,10 @@ rhythmdb_tree_parser_start_element (stru type = RHYTHMDB_ENTRY_TYPE_SONG; else if (!strcmp (typename, "iradio")) type = RHYTHMDB_ENTRY_TYPE_IRADIO_STATION; + else if (!strcmp (typename, "podcast")) + type = RHYTHMDB_ENTRY_TYPE_PODCAST_POST; + else if (!strcmp (typename, "podcast-head")) + type = RHYTHMDB_ENTRY_TYPE_PODCAST_HEAD; else return; type_set = TRUE; @@ -393,6 +397,31 @@ rhythmdb_tree_parser_end_element (struct case RHYTHMDB_PROP_MIMETYPE: ctx->entry->mimetype = rb_refstring_new (ctx->buf->str); break; + case RHYTHMDB_PROP_STATUS: + ctx->entry->status = g_ascii_strtod (ctx->buf->str, NULL); + break; + case RHYTHMDB_PROP_DATE_STR: + ctx->entry->date_str = rb_refstring_new (ctx->buf->str); + break; + case RHYTHMDB_PROP_DESCRIPTION: + ctx->entry->description = rb_refstring_new (ctx->buf->str); + break; + case RHYTHMDB_PROP_SUBTITLE: + ctx->entry->subtitle = rb_refstring_new (ctx->buf->str); + break; + case RHYTHMDB_PROP_SUMMARY: + ctx->entry->summary = rb_refstring_new (ctx->buf->str); + break; + case RHYTHMDB_PROP_LANG: + ctx->entry->lang = rb_refstring_new (ctx->buf->str); + break; + case RHYTHMDB_PROP_COPYRIGHT: + ctx->entry->copyright = rb_refstring_new (ctx->buf->str); + break; + case RHYTHMDB_PROP_IMAGE: + ctx->entry->image = rb_refstring_new (ctx->buf->str); + break; + case RHYTHMDB_PROP_TITLE_SORT_KEY: case RHYTHMDB_PROP_GENRE_SORT_KEY: case RHYTHMDB_PROP_ARTIST_SORT_KEY: @@ -615,6 +644,10 @@ save_entry (RhythmDBTree *db, RhythmDBEn RHYTHMDB_FWRITE_STATICSTR ("song", ctx->handle, ctx->error); } else if (entry->type == RHYTHMDB_ENTRY_TYPE_IRADIO_STATION) { RHYTHMDB_FWRITE_STATICSTR ("iradio", ctx->handle, ctx->error); + } else if (entry->type == RHYTHMDB_ENTRY_TYPE_PODCAST_POST) { + RHYTHMDB_FWRITE_STATICSTR ("podcast", ctx->handle, ctx->error); + } else if (entry->type == RHYTHMDB_ENTRY_TYPE_PODCAST_HEAD) { + RHYTHMDB_FWRITE_STATICSTR ("podcast-head", ctx->handle, ctx->error); } else g_assert_not_reached (); @@ -703,6 +736,37 @@ save_entry (RhythmDBTree *db, RhythmDBEn case RHYTHMDB_PROP_LAST_PLAYED: save_entry_ulong(ctx, elt_name, entry->last_played); break; + case RHYTHMDB_PROP_STATUS: + save_entry_double(ctx, elt_name, entry->status); + break; + case RHYTHMDB_PROP_DATE_STR: + if (entry->date_str) + save_entry_string(ctx, elt_name, rb_refstring_get (entry->date_str)); + break; + case RHYTHMDB_PROP_DESCRIPTION: + if (entry->description) + save_entry_string(ctx, elt_name, rb_refstring_get (entry->description)); + break; + case RHYTHMDB_PROP_SUBTITLE: + if (entry->subtitle) + save_entry_string(ctx, elt_name, rb_refstring_get (entry->subtitle)); + break; + case RHYTHMDB_PROP_SUMMARY: + if (entry->summary) + save_entry_string(ctx, elt_name, rb_refstring_get (entry->summary)); + break; + case RHYTHMDB_PROP_LANG: + if (entry->lang) + save_entry_string(ctx, elt_name, rb_refstring_get (entry->lang)); + break; + case RHYTHMDB_PROP_COPYRIGHT: + if (entry->copyright) + save_entry_string(ctx, elt_name, rb_refstring_get (entry->copyright)); + break; + case RHYTHMDB_PROP_IMAGE: + if (entry->image) + save_entry_string(ctx, elt_name, rb_refstring_get (entry->image)); + break; case RHYTHMDB_PROP_TITLE_SORT_KEY: case RHYTHMDB_PROP_GENRE_SORT_KEY: case RHYTHMDB_PROP_ARTIST_SORT_KEY: @@ -754,6 +818,12 @@ rhythmdb_tree_save (RhythmDB *rdb) (RBTreeEntryItFunc)save_entry, NULL, NULL, NULL, &ctx); rhythmdb_hash_tree_foreach (rdb, RHYTHMDB_ENTRY_TYPE_IRADIO_STATION, + (RBTreeEntryItFunc)save_entry, + NULL, NULL, NULL, &ctx); + rhythmdb_hash_tree_foreach (rdb, RHYTHMDB_ENTRY_TYPE_PODCAST_POST, + (RBTreeEntryItFunc)save_entry, + NULL, NULL, NULL, &ctx); + rhythmdb_hash_tree_foreach (rdb, RHYTHMDB_ENTRY_TYPE_PODCAST_HEAD, (RBTreeEntryItFunc)save_entry, NULL, NULL, NULL, &ctx); Index: rhythmdb/rhythmdb.c =================================================================== RCS file: /cvs/gnome/rhythmbox/rhythmdb/rhythmdb.c,v retrieving revision 1.114 diff -u -3 -p -r1.114 rhythmdb.c --- rhythmdb/rhythmdb.c 30 Aug 2005 01:40:09 -0000 1.114 +++ rhythmdb/rhythmdb.c 1 Sep 2005 14:21:57 -0000 @@ -867,8 +867,17 @@ rhythmdb_entry_allocate (RhythmDB *db, R ret->album = rb_refstring_ref (db->priv->empty_string); ret->mimetype = rb_refstring_ref (db->priv->octet_stream_str); - rhythmdb_entry_sync_mirrored (db, ret, RHYTHMDB_PROP_LAST_PLAYED); + /* + ret->description = rb_refstring_ref (db->priv->empty_string); + ret->subtitle = rb_refstring_ref (db->priv->empty_string); + ret->summary = rb_refstring_ref (db->priv->empty_string); + ret->lang = rb_refstring_ref (db->priv->empty_string); + ret->copyright = rb_refstring_ref (db->priv->empty_string); + ret->image = rb_refstring_ref (db->priv->empty_string); + */ + rhythmdb_entry_sync_mirrored (db, ret, RHYTHMDB_PROP_LAST_PLAYED); + /* The refcount is initially 0, we want to set it to 1 */ g_atomic_int_inc (&ret->refcount); return ret; @@ -919,6 +928,12 @@ rhythmdb_entry_finalize (RhythmDBEntry * rb_refstring_unref (entry->artist); rb_refstring_unref (entry->album); rb_refstring_unref (entry->mimetype); + rb_refstring_unref (entry->description); + rb_refstring_unref (entry->subtitle); + rb_refstring_unref (entry->summary); + rb_refstring_unref (entry->lang); + rb_refstring_unref (entry->copyright); + rb_refstring_unref (entry->image); } void @@ -2103,6 +2118,37 @@ rhythmdb_entry_set_internal (RhythmDB *d case RHYTHMDB_PROP_HIDDEN: entry->hidden = g_value_get_boolean (value); break; + case RHYTHMDB_PROP_STATUS: + entry->status = g_value_get_double (value); + break; + case RHYTHMDB_PROP_DATE_STR: + rb_refstring_unref (entry->date_str); + entry->date_str = rb_refstring_new (g_value_get_string (value)); + break; + case RHYTHMDB_PROP_DESCRIPTION: + rb_refstring_unref (entry->description); + entry->description = rb_refstring_new (g_value_get_string (value)); + break; + case RHYTHMDB_PROP_SUBTITLE: + rb_refstring_unref (entry->subtitle); + entry->subtitle = rb_refstring_new (g_value_get_string (value)); + break; + case RHYTHMDB_PROP_SUMMARY: + rb_refstring_unref (entry->summary); + entry->summary = rb_refstring_new (g_value_get_string (value)); + break; + case RHYTHMDB_PROP_LANG: + rb_refstring_unref (entry->lang); + entry->lang = rb_refstring_new (g_value_get_string (value)); + break; + case RHYTHMDB_PROP_COPYRIGHT: + rb_refstring_unref (entry->copyright); + entry->copyright = rb_refstring_new (g_value_get_string (value)); + break; + case RHYTHMDB_PROP_IMAGE: + rb_refstring_unref (entry->image); + entry->image = rb_refstring_new (g_value_get_string (value)); + break; case RHYTHMDB_NUM_PROPERTIES: g_assert_not_reached (); break; @@ -2759,8 +2805,16 @@ rhythmdb_prop_get_type (void) ENUM_ENTRY (RHYTHMDB_PROP_ARTIST_FOLDED, "Artist folded (gchararray) [artist-folded]"), ENUM_ENTRY (RHYTHMDB_PROP_ALBUM_FOLDED, "Album folded (gchararray) [album-folded]"), ENUM_ENTRY (RHYTHMDB_PROP_LAST_PLAYED_STR, "Last Played (gchararray) [last-played-str]"), + ENUM_ENTRY (RHYTHMDB_PROP_DATE_STR, "Date of file (gchararray) [date-of-file]"), ENUM_ENTRY (RHYTHMDB_PROP_PLAYBACK_ERROR, "Playback error string (gchararray) [playback-error]"), ENUM_ENTRY (RHYTHMDB_PROP_HIDDEN, "Visibility (gboolean) [visibility]"), + ENUM_ENTRY (RHYTHMDB_PROP_STATUS, "Status of file (gdouble) [status]"), + ENUM_ENTRY (RHYTHMDB_PROP_DESCRIPTION, "Podcast description(gchararray) [description]"), + ENUM_ENTRY (RHYTHMDB_PROP_SUBTITLE, "Podcast subtitle (gchararray) [subtitle]"), + ENUM_ENTRY (RHYTHMDB_PROP_SUMMARY, "Podcast summary (gchararray) [summary]"), + ENUM_ENTRY (RHYTHMDB_PROP_LANG, "Podcast language (gchararray) [lang]"), + ENUM_ENTRY (RHYTHMDB_PROP_COPYRIGHT, "Podcast copyright (gchararray) [copyright]"), + ENUM_ENTRY (RHYTHMDB_PROP_IMAGE, "Podcast image(gchararray) [image]"), { 0, 0, 0 } }; g_assert ((sizeof (values) / sizeof (values[0]) - 1) == RHYTHMDB_NUM_PROPERTIES); @@ -2903,6 +2957,33 @@ RhythmDBEntryType rhythmdb_entry_iradio_ return iradio_type; } + +RhythmDBEntryType rhythmdb_entry_podcast_post_get_type (void) +{ + static RhythmDBEntryType podcast_post_type = -1; + + g_static_mutex_lock (&entry_type_mutex); + if (podcast_post_type == -1) { + podcast_post_type = rhythmdb_entry_register_type (); + } + g_static_mutex_unlock (&entry_type_mutex); + + return podcast_post_type; +} + +RhythmDBEntryType rhythmdb_entry_podcast_head_get_type (void) +{ + static RhythmDBEntryType podcast_head_type = -1; + + g_static_mutex_lock (&entry_type_mutex); + if (podcast_head_type == -1) { + podcast_head_type = rhythmdb_entry_register_type (); + } + g_static_mutex_unlock (&entry_type_mutex); + + return podcast_head_type; +} + struct MountCtxt { RhythmDB *db; Index: rhythmdb/rhythmdb.h =================================================================== RCS file: /cvs/gnome/rhythmbox/rhythmdb/rhythmdb.h,v retrieving revision 1.47 diff -u -3 -p -r1.47 rhythmdb.h --- rhythmdb/rhythmdb.h 29 Aug 2005 23:19:41 -0000 1.47 +++ rhythmdb/rhythmdb.h 1 Sep 2005 14:21:57 -0000 @@ -48,6 +48,8 @@ typedef gint32 RhythmDBEntryType; #define RHYTHMDB_ENTRY_TYPE_SONG (rhythmdb_entry_song_get_type ()) #define RHYTHMDB_ENTRY_TYPE_IRADIO_STATION (rhythmdb_entry_iradio_get_type ()) +#define RHYTHMDB_ENTRY_TYPE_PODCAST_POST (rhythmdb_entry_podcast_post_get_type ()) +#define RHYTHMDB_ENTRY_TYPE_PODCAST_HEAD (rhythmdb_entry_podcast_head_get_type ()) typedef enum { @@ -98,9 +100,17 @@ typedef enum RHYTHMDB_PROP_ARTIST_FOLDED, RHYTHMDB_PROP_ALBUM_FOLDED, RHYTHMDB_PROP_LAST_PLAYED_STR, + RHYTHMDB_PROP_DATE_STR, RHYTHMDB_PROP_HIDDEN, RHYTHMDB_PROP_PLAYBACK_ERROR, - +//podcast propriets + RHYTHMDB_PROP_STATUS, + RHYTHMDB_PROP_DESCRIPTION, + RHYTHMDB_PROP_SUBTITLE, + RHYTHMDB_PROP_SUMMARY, + RHYTHMDB_PROP_LANG, + RHYTHMDB_PROP_COPYRIGHT, + RHYTHMDB_PROP_IMAGE, RHYTHMDB_NUM_PROPERTIES } RhythmDBPropType; @@ -164,11 +174,25 @@ typedef struct { /* cached data */ RBRefString *last_played_str; + /* cached data */ + RBRefString *date_str; + + /* playback error string */ char *playback_error; /* visibility (to hide entries on unmounted volumes) */ gboolean hidden; + + /* podcast */ + RBRefString *description; + RBRefString *subtitle; + RBRefString *summary; + RBRefString *lang; + RBRefString *copyright; + RBRefString *image; + gdouble status; + } RhythmDBEntry; typedef struct { @@ -223,8 +247,23 @@ rhythmdb_entry_get_string (RhythmDBEntry return rb_refstring_get (entry->mountpoint); case RHYTHMDB_PROP_LAST_PLAYED_STR: return rb_refstring_get (entry->last_played_str); + case RHYTHMDB_PROP_DATE_STR: + return rb_refstring_get (entry->date_str); case RHYTHMDB_PROP_PLAYBACK_ERROR: return entry->playback_error; +//podcast propriets + case RHYTHMDB_PROP_DESCRIPTION: + return rb_refstring_get (entry->description); + case RHYTHMDB_PROP_SUBTITLE: + return rb_refstring_get (entry->subtitle); + case RHYTHMDB_PROP_SUMMARY: + return rb_refstring_get (entry->summary); + case RHYTHMDB_PROP_LANG: + return rb_refstring_get (entry->lang); + case RHYTHMDB_PROP_COPYRIGHT: + return rb_refstring_get (entry->copyright); + case RHYTHMDB_PROP_IMAGE: + return rb_refstring_get (entry->image); default: g_assert_not_reached (); return NULL; @@ -297,6 +336,8 @@ rhythmdb_entry_get_double (RhythmDBEntry return entry->album_gain; case RHYTHMDB_PROP_ALBUM_PEAK: return entry->album_peak; + case RHYTHMDB_PROP_STATUS: + return entry->status; case RHYTHMDB_PROP_RATING: return entry->rating; default: @@ -356,7 +397,7 @@ typedef struct void (*impl_entry_delete_by_type) (RhythmDB *db, RhythmDBEntryType type); RhythmDBEntry * (*impl_lookup_by_location)(RhythmDB *db, const char *uri); - + gboolean (*impl_evaluate_query) (RhythmDB *db, GPtrArray *query, RhythmDBEntry *entry); void (*impl_entry_foreach) (RhythmDB *db, GFunc func, gpointer data); @@ -464,6 +505,8 @@ RhythmDBEntryType rhythmdb_entry_registe RhythmDBEntryType rhythmdb_entry_song_get_type (void); RhythmDBEntryType rhythmdb_entry_iradio_get_type (void); +RhythmDBEntryType rhythmdb_entry_podcast_post_get_type (void); +RhythmDBEntryType rhythmdb_entry_podcast_head_get_type (void); RhythmDBEntryType rhythmdb_entry_icecast_get_type (void); extern GType rhythmdb_property_type_map[RHYTHMDB_NUM_PROPERTIES]; Index: shell/Makefile.am =================================================================== RCS file: /cvs/gnome/rhythmbox/shell/Makefile.am,v retrieving revision 1.54 diff -u -3 -p -r1.54 Makefile.am --- shell/Makefile.am 29 Aug 2005 21:08:29 -0000 1.54 +++ shell/Makefile.am 1 Sep 2005 14:21:57 -0000 @@ -69,6 +69,7 @@ rhythmbox_LDADD = \ $(top_builddir)/sources/libsourcesimpl.la \ $(top_builddir)/rhythmdb/librhythmdb.la \ $(top_builddir)/iradio/librbiradio.la \ + $(top_builddir)/podcast/librbpodcast.la \ $(top_builddir)/remote/librbremote.la \ $(top_builddir)/player/librbplayer.la \ $(top_builddir)/metadata/librbmetadata.la \ @@ -111,6 +112,7 @@ INCLUDES = \ -I$(top_srcdir)/widgets \ -I$(top_srcdir)/sources \ -I$(top_srcdir)/iradio \ + -I$(top_srcdir)/podcast \ -I$(top_srcdir)/remote \ -I$(top_builddir)/remote \ -DPIXMAP_DIR=\""$(datadir)/pixmaps"\" \ Index: shell/rb-playlist-manager.c =================================================================== RCS file: /cvs/gnome/rhythmbox/shell/rb-playlist-manager.c,v retrieving revision 1.55 diff -u -3 -p -r1.55 rb-playlist-manager.c --- shell/rb-playlist-manager.c 30 Aug 2005 20:22:38 -0000 1.55 +++ shell/rb-playlist-manager.c 1 Sep 2005 14:21:57 -0000 @@ -95,6 +95,7 @@ struct RBPlaylistManagerPrivate RBLibrarySource *libsource; RBIRadioSource *iradio_source; + RBPodcastSource *podcast_source; GtkWindow *window; guint playlist_serial; @@ -123,6 +124,7 @@ enum PROP_SOURCELIST, PROP_LIBRARY_SOURCE, PROP_IRADIO_SOURCE, + PROP_PODCAST_SOURCE, }; enum @@ -242,6 +244,16 @@ rb_playlist_manager_class_init (RBPlayli "IRadioSource", RB_TYPE_IRADIO_SOURCE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + + g_object_class_install_property (object_class, + PROP_PODCAST_SOURCE, + g_param_spec_object ("podcast-source", + "PodcastSource", + "PodcastSource", + RB_TYPE_PODCAST_SOURCE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (object_class, PROP_SOURCELIST, g_param_spec_object ("sourcelist", @@ -457,6 +469,9 @@ rb_playlist_manager_set_property (GObjec case PROP_IRADIO_SOURCE: mgr->priv->iradio_source = g_value_get_object (value); break; + case PROP_PODCAST_SOURCE: + mgr->priv->podcast_source = g_value_get_object (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -488,6 +503,9 @@ rb_playlist_manager_get_property (GObjec case PROP_IRADIO_SOURCE: g_value_set_object (value, mgr->priv->iradio_source); break; + case PROP_PODCAST_SOURCE: + g_value_set_object (value, mgr->priv->podcast_source); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -509,13 +527,15 @@ RBPlaylistManager * rb_playlist_manager_new (RBShell *shell, RBSourceList *sourcelist, RBLibrarySource *libsource, - RBIRadioSource *iradio_source) + RBIRadioSource *iradio_source, + RBPodcastSource *podcast_source) { return g_object_new (RB_TYPE_PLAYLIST_MANAGER, "shell", shell, "sourcelist", sourcelist, "library_source", libsource, "iradio_source", iradio_source, + "podcast_source", podcast_source, NULL); } Index: shell/rb-playlist-manager.h =================================================================== RCS file: /cvs/gnome/rhythmbox/shell/rb-playlist-manager.h,v retrieving revision 1.17 diff -u -3 -p -r1.17 rb-playlist-manager.h --- shell/rb-playlist-manager.h 30 Aug 2005 20:22:38 -0000 1.17 +++ shell/rb-playlist-manager.h 1 Sep 2005 14:21:57 -0000 @@ -27,6 +27,7 @@ #include "rb-sourcelist.h" #include "rb-library-source.h" #include "rb-iradio-source.h" +#include "rb-podcast-source.h" G_BEGIN_DECLS @@ -71,7 +72,8 @@ GType rb_playlist_manager_get_type (vo RBPlaylistManager * rb_playlist_manager_new (RBShell *shell, RBSourceList *sourcelist, RBLibrarySource *libsource, - RBIRadioSource *iradio_source); + RBIRadioSource *iradio_source, + RBPodcastSource *podcast_source); gboolean rb_playlist_manager_parse_file (RBPlaylistManager *mgr, const char *uri, Index: shell/rb-shell-player.c =================================================================== RCS file: /cvs/gnome/rhythmbox/shell/rb-shell-player.c,v retrieving revision 1.169 diff -u -3 -p -r1.169 rb-shell-player.c --- shell/rb-shell-player.c 30 Aug 2005 20:22:37 -0000 1.169 +++ shell/rb-shell-player.c 1 Sep 2005 14:21:57 -0000 @@ -59,6 +59,7 @@ #include "rb-util.h" #include "rb-play-order.h" #include "rb-statusbar.h" +#include "rhythmdb.h" #ifdef HAVE_XIDLE_EXTENSION #include <X11/extensions/xidle.h> @@ -1055,7 +1056,10 @@ rb_shell_player_open_location (RBShellPl static gboolean rb_shell_player_open_entry (RBShellPlayer *player, RhythmDBEntry *entry, GError **error) { - return rb_shell_player_open_location (player, entry->location, error); + if (entry->type == RHYTHMDB_ENTRY_TYPE_PODCAST_POST) + return rb_shell_player_open_location (player, rb_refstring_get (entry->mountpoint), error); + else + return rb_shell_player_open_location (player, entry->location, error); } static gboolean Index: shell/rb-shell-preferences.c =================================================================== RCS file: /cvs/gnome/rhythmbox/shell/rb-shell-preferences.c,v retrieving revision 1.42 diff -u -3 -p -r1.42 rb-shell-preferences.c --- shell/rb-shell-preferences.c 30 Aug 2005 21:08:14 -0000 1.42 +++ shell/rb-shell-preferences.c 1 Sep 2005 14:21:57 -0000 @@ -84,6 +84,8 @@ struct RBShellPreferencesPrivate GtkWidget *play_count_check; GtkWidget *last_played_check; GtkWidget *quality_check; + GtkWidget *date_check; + GtkWidget *status_check; gboolean loading; }; @@ -221,6 +223,11 @@ rb_shell_preferences_init (RBShellPrefer glade_xml_get_widget (xml, "last_played_check"); shell_preferences->priv->quality_check = glade_xml_get_widget (xml, "quality_check"); + shell_preferences->priv->date_check = + glade_xml_get_widget (xml, "date_check"); + shell_preferences->priv->status_check = + glade_xml_get_widget (xml, "status_check"); + gtk_notebook_append_page (GTK_NOTEBOOK (shell_preferences->priv->notebook), glade_xml_get_widget (xml, "general_vbox"), @@ -358,6 +365,10 @@ rb_shell_preferences_column_check_change else if (shell_preferences->priv->quality_check && butt == GTK_CHECK_BUTTON (shell_preferences->priv->quality_check)) colname = "RHYTHMDB_PROP_BITRATE"; + else if (butt == GTK_CHECK_BUTTON (shell_preferences->priv->date_check)) + colname = "RHYTHMDB_PROP_DATE_STR"; + else if (butt == GTK_CHECK_BUTTON (shell_preferences->priv->status_check)) + colname = "RHYTHMDB_PROP_STATUS"; else g_assert_not_reached (); @@ -422,6 +433,13 @@ rb_shell_preferences_sync (RBShellPrefer gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell_preferences->priv->quality_check), strstr (columns, "RHYTHMDB_PROP_BITRATE") != NULL); + gtk_toggle_button_set_active + (GTK_TOGGLE_BUTTON (shell_preferences->priv->date_check), + strstr (columns, "RHYTHMDB_PROP_DATE_STR") != NULL); + gtk_toggle_button_set_active + (GTK_TOGGLE_BUTTON (shell_preferences->priv->status_check), + strstr (columns, "RHYTHMDB_PROP_STATUS") != NULL); + } g_free (columns); Index: shell/rb-shell.c =================================================================== RCS file: /cvs/gnome/rhythmbox/shell/rb-shell.c,v retrieving revision 1.326 diff -u -3 -p -r1.326 rb-shell.c --- shell/rb-shell.c 31 Aug 2005 18:04:38 -0000 1.326 +++ shell/rb-shell.c 1 Sep 2005 14:21:57 -0000 @@ -64,6 +64,7 @@ #include "rb-statusbar.h" #include "rb-shell-preferences.h" #include "rb-library-source.h" +#include "rb-podcast-source.h" #include "totem-pl-parser.h" #ifdef WITH_IPOD_SUPPORT #include "rb-ipod-source.h" @@ -71,6 +72,9 @@ #include "rb-load-failure-dialog.h" #include "rb-new-station-dialog.h" #include "rb-iradio-source.h" + +#include "rb-new-podcast-dialog.h" + #ifdef HAVE_AUDIOCD #include "rb-audiocd-source.h" #endif @@ -156,6 +160,9 @@ static void rb_shell_cmd_add_file_to_lib RBShell *shell); static void rb_shell_cmd_new_station (GtkAction *action, RBShell *shell); +static void rb_shell_cmd_new_podcast (GtkAction *action, + RBShell *shell); + static void rb_shell_cmd_extract_cd (GtkAction *action, RBShell *shell); static void rb_shell_cmd_current_song (GtkAction *action, @@ -315,7 +322,10 @@ struct RBShellPrivate RBLibrarySource *library_source; RBIRadioSource *iradio_source; + RBPodcastSource *podcast_source; +#ifdef WITH_IPOD_SUPPORT RBiPodSource *ipod_source; +#endif #ifdef HAVE_AUDIOCD MonkeyMediaAudioCD *cd; @@ -343,6 +353,10 @@ static GtkActionEntry rb_shell_actions [ N_("Create a new Internet Radio station"), G_CALLBACK (rb_shell_cmd_new_station) }, + { "MusicNewPodcast", GTK_STOCK_NEW, N_("Subscribe _Podcast"), "<control>P", + N_("Create a new Podcast Feed"), + G_CALLBACK (rb_shell_cmd_new_podcast) }, + { "MusicImportFolder", GTK_STOCK_OPEN, N_("_Import Folder..."), "<control>O", N_("Choose folder to be added to the Library"), G_CALLBACK (rb_shell_cmd_add_folder_to_library) }, @@ -785,12 +799,19 @@ rb_shell_constructor (GType type, guint shell = RB_SHELL (parent_class->constructor (type, n_construct_properties, construct_properties)); - rb_debug ("Constructing shell"); + rb_debug ("Constructing shell RENTO"); /* initialize UI */ win = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL)); + + + rb_debug ("UI initialized"); + gtk_window_set_title (win, _("Music Player")); + + rb_debug ("UI initialized"); + shell->priv->window = GTK_WIDGET (win); shell->priv->visible = TRUE; @@ -804,6 +825,9 @@ rb_shell_constructor (GType type, guint shell->priv->ui_manager = gtk_ui_manager_new (); + + rb_debug ("UI Manager create"); + shell->priv->actiongroup = gtk_action_group_new ("MainActions"); gtk_action_group_set_translation_domain (shell->priv->actiongroup, GETTEXT_PACKAGE); @@ -953,6 +977,9 @@ rb_shell_constructor (GType type, guint rb_shell_append_source (shell, RB_SOURCE (shell->priv->library_source)); shell->priv->iradio_source = RB_IRADIO_SOURCE (rb_iradio_source_new (shell)); rb_shell_append_source (shell, RB_SOURCE (shell->priv->iradio_source)); + shell->priv->podcast_source = RB_PODCAST_SOURCE (rb_podcast_source_new (shell)); + rb_shell_append_source (shell, RB_SOURCE (shell->priv->podcast_source)); + #ifdef WITH_IPOD_SUPPORT shell->priv->ipod_source = RB_IPOD_SOURCE (rb_ipod_source_new (shell)); rb_shell_append_source (shell, RB_SOURCE (shell->priv->ipod_source)); @@ -963,7 +990,8 @@ rb_shell_constructor (GType type, guint shell->priv->playlist_manager = rb_playlist_manager_new (shell, RB_SOURCELIST (shell->priv->sourcelist), shell->priv->library_source, - shell->priv->iradio_source); + shell->priv->iradio_source, + shell->priv->podcast_source); g_signal_connect_object (G_OBJECT (shell->priv->playlist_manager), "playlist_added", G_CALLBACK (rb_shell_playlist_added_cb), shell, 0); @@ -1571,6 +1599,7 @@ add_to_library_response_cb (GtkDialog *d int response_id, RBShell *shell) { + char *current_dir = NULL; GSList *uri_list = NULL, *uris = NULL; @@ -1653,6 +1682,18 @@ rb_shell_cmd_new_station (GtkAction *act gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } + +static void +rb_shell_cmd_new_podcast (GtkAction *action, + RBShell *shell) +{ + GtkWidget *dialog; + rb_debug ("Got new podcast command"); + dialog = rb_new_podcast_dialog_new (shell->priv->db); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); +} + static void rb_shell_cmd_extract_cd (GtkAction *action, Index: sources/Makefile.am =================================================================== RCS file: /cvs/gnome/rhythmbox/sources/Makefile.am,v retrieving revision 1.21 diff -u -3 -p -r1.21 Makefile.am --- sources/Makefile.am 29 Aug 2005 21:08:23 -0000 1.21 +++ sources/Makefile.am 1 Sep 2005 14:21:57 -0000 @@ -13,6 +13,8 @@ libsourcesimpl_la_SOURCES = \ rb-library-source.h \ rb-iradio-source.c \ rb-iradio-source.h \ + rb-podcast-source.c \ + rb-podcast-source.h \ rb-playlist-source.c \ rb-playlist-source.h @@ -29,7 +31,9 @@ INCLUDES = \ -I$(top_srcdir)/library \ -I$(top_srcdir)/player \ -I$(top_srcdir)/iradio \ + -I$(top_srcdir)/podcast \ -I$(top_srcdir)/shell \ + -I$(top_srcdir)/metadata \ -DPIXMAP_DIR=\""$(datadir)/pixmaps"\" \ -DSHARE_DIR=\"$(pkgdatadir)\" \ -DDATADIR=\""$(datadir)"\" \ Index: sources/rb-library-source.c =================================================================== RCS file: /cvs/gnome/rhythmbox/sources/rb-library-source.c,v retrieving revision 1.112 diff -u -3 -p -r1.112 rb-library-source.c --- sources/rb-library-source.c 30 Aug 2005 21:03:27 -0000 1.112 +++ sources/rb-library-source.c 1 Sep 2005 14:21:57 -0000 @@ -1187,6 +1187,7 @@ rb_library_source_add_location (RBLibrar g_return_if_fail (dialog != NULL); + open_button = gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_OPEN, GTK_RESPONSE_OK); @@ -1215,6 +1216,8 @@ rb_library_source_add_location (RBLibrar "changed", G_CALLBACK (rb_library_source_add_location_entry_changed_cb), open_button, 0); + + switch (gtk_dialog_run (GTK_DIALOG (dialog))) { case GTK_RESPONSE_OK: Index: widgets/rb-entry-view.c =================================================================== RCS file: /cvs/gnome/rhythmbox/widgets/rb-entry-view.c,v retrieving revision 1.95 diff -u -3 -p -r1.95 rb-entry-view.c --- widgets/rb-entry-view.c 29 Aug 2005 22:00:32 -0000 1.95 +++ widgets/rb-entry-view.c 1 Sep 2005 14:21:57 -0000 @@ -24,6 +24,7 @@ #include <gtk/gtktreeselection.h> #include <gtk/gtkcellrenderertext.h> +#include <gtk/gtkcellrendererprogress.h> #include <gtk/gtkiconfactory.h> #include <gtk/gtkstock.h> #include <gtk/gtktooltips.h> @@ -34,6 +35,8 @@ #include <string.h> #include <stdlib.h> #include <math.h> +#define __USE_XOPEN +#include <time.h> #include "rb-tree-dnd.h" #include "rb-entry-view.h" @@ -841,6 +844,7 @@ rb_entry_view_string_sort_func (RhythmDB { const char *a_val; const char *b_val; + gint ret; a_val = rhythmdb_entry_get_string (a, data->propid); @@ -849,6 +853,34 @@ rb_entry_view_string_sort_func (RhythmDB ret = strcmp (a_val, b_val); return ret; + +} +static gint +rb_entry_view_date_sort_func (RhythmDBEntry *a, RhythmDBEntry *b, + struct RBEntryViewCellDataFuncData *data) +{ + const char *a_val; + const char *b_val; + struct tm a_tm; + struct tm b_tm; + time_t a_time; + time_t b_time; + + gint ret; + + a_val = rhythmdb_entry_get_string (a, data->propid); + strptime(a_val, "%d/%m/%Y %H:%M", &a_tm); + a_tm.tm_sec = 0; + a_time = mktime(&a_tm); + + b_val = rhythmdb_entry_get_string (b, data->propid); + strptime(b_val, "%d/%m/%Y %H:%M", &b_tm); + b_tm.tm_sec = 0; + b_time = mktime(&b_tm); + + ret = difftime(a_time, b_time); + ret = (ret == 0 ? 0 : (ret > 0 ? 1 : -1)); + return ret; } static void @@ -1006,6 +1038,39 @@ rb_entry_view_string_cell_data_func (Gtk } static void +rb_entry_view_status_cell_data_func (GtkTreeViewColumn *column, GtkCellRenderer *renderer, + GtkTreeModel *tree_model, GtkTreeIter *iter, + RBEntryView *view) + +{ + RhythmDBEntry *entry; + guint value; + + entry = entry_from_tree_iter (view, iter); + if (entry->status == 0) { + g_object_set (G_OBJECT (renderer), "text", _("Waiting"), NULL); + value = 0; + } + else if (entry->status == 100) { + g_object_set (G_OBJECT (renderer), "text", _("Completed"), NULL); + value = 100; + } + else if (entry->status == -1) { + g_object_set (G_OBJECT (renderer), "text", _("Failed"), NULL); + value = 0; + } + else { + g_object_set (G_OBJECT (renderer), "text", NULL, NULL); + value = entry->status; + } + + + g_object_set (G_OBJECT (renderer), "value", value, NULL); + + +} + +static void rb_entry_view_sync_sorting (RBEntryView *view) { GtkTreeViewColumn *column; @@ -1193,7 +1258,38 @@ rb_entry_view_append_column (RBEntryView key = "Rating"; goto append; } + else if (coltype == RB_ENTRY_VIEW_COL_STATUS) { + gint width; + + propid = RHYTHMDB_PROP_STATUS; + + sort_data = g_new0 (struct RBEntryViewCellDataFuncData, 1); + sort_data->view = view; + sort_data->propid = propid; + sort_func = (GCompareDataFunc) rb_entry_view_double_ceiling_sort_func; + + renderer = gtk_cell_renderer_progress_new(); + + gtk_tree_view_column_pack_start (column, renderer, TRUE); + gtk_tree_view_column_set_cell_data_func (column, renderer, + (GtkTreeCellDataFunc) + rb_entry_view_status_cell_data_func, + view, + NULL); + gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED); + gtk_tree_view_column_set_clickable (column, TRUE); + gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, NULL); + gtk_tree_view_column_set_fixed_width (column, width * 5 + 5); + real_sort_data = sort_data; + title = _("_Status"); + key = "Status"; + + + goto append; + + } + cell_data = g_new0 (struct RBEntryViewCellDataFuncData, 1); cell_data->view = view; sort_data = g_new0 (struct RBEntryViewCellDataFuncData, 1); @@ -1292,6 +1388,27 @@ rb_entry_view_append_column (RBEntryView title = _("L_ast Played"); key = "LastPlayed"; break; + case RB_ENTRY_VIEW_COL_DATE_STR: + propid = RHYTHMDB_PROP_DATE_STR; + cell_data->propid = RHYTHMDB_PROP_DATE_STR; + cell_data_func = (GtkTreeCellDataFunc) rb_entry_view_string_cell_data_func; + sort_data->propid = RHYTHMDB_PROP_DATE_STR; + sort_func = (GCompareDataFunc) rb_entry_view_date_sort_func; + title = _("_Date"); + key = "Date"; + break; + case RB_ENTRY_VIEW_COL_STATUS: +#if 0 + propid = RHYTHMDB_PROP_STATUS; + cell_data->propid = RHYTHMDB_PROP_STATUS; + cell_data_func = (gtktreecelldatafunc) rb_entry_view_status_cell_data_func; + ng_sort_func + sort_data->propid = RHYTHMDB_PROP_STATUS; + sort_func = (GCompareDataFunc) rb_entry_view_ulong_sort_func; + title = _("_Status"); + key = "Status"; + break; +#endif case RB_ENTRY_VIEW_COL_RATING: default: g_assert_not_reached (); @@ -1300,6 +1417,7 @@ rb_entry_view_append_column (RBEntryView } renderer = gtk_cell_renderer_text_new (); + if (ellipsize) { g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL); gtk_tree_view_column_set_expand (GTK_TREE_VIEW_COLUMN (column), TRUE); @@ -1312,9 +1430,11 @@ rb_entry_view_append_column (RBEntryView gtk_tree_view_column_set_resizable (column, TRUE); append: + g_hash_table_insert (view->priv->propid_column_map, GINT_TO_POINTER (propid), column); rb_entry_view_append_column_custom (view, column, title, key, sort_func, real_sort_data ? real_sort_data : sort_data); + } void Index: widgets/rb-entry-view.h =================================================================== RCS file: /cvs/gnome/rhythmbox/widgets/rb-entry-view.h,v retrieving revision 1.22 diff -u -3 -p -r1.22 rb-entry-view.h --- widgets/rb-entry-view.h 7 Jul 2005 12:57:44 -0000 1.22 +++ widgets/rb-entry-view.h 1 Sep 2005 14:21:57 -0000 @@ -51,6 +51,8 @@ typedef enum { RB_ENTRY_VIEW_COL_RATING, RB_ENTRY_VIEW_COL_PLAY_COUNT, RB_ENTRY_VIEW_COL_LAST_PLAYED, + RB_ENTRY_VIEW_COL_DATE_STR, + RB_ENTRY_VIEW_COL_STATUS } RBEntryViewColumn; typedef struct RBEntryViewPrivate RBEntryViewPrivate; @@ -77,8 +79,10 @@ typedef struct void (*changed) (RBEntryView *view); void (*have_selection_changed) (RBEntryView *view, gboolean have_selection); void (*sort_order_changed) (RBEntryView *view); + void (*status_changed) (RBEntryView *view, guint status); void (*show_popup) (RBEntryView *view); + } RBEntryViewClass; GType rb_entry_view_get_type (void);
Attachment:
podcast.tar.gz
Description: GNU Zip compressed data