[Rhythmbox-devel] Limit by Date Added and option to show Date Added column



Hi everyone,

this is my first real patch for rhythmbox!
It's a patch against CVS that enables the use of the Date Added
property in the UI.
You can show the column, sort by it, search for it with an automatic playlist
and limit to the most recently or oldest songs added to the library.

Also changes some properties in the rhythmdb entry to glong from gulong.
That should maybe be reverted or fixed... comments?

Regards,
///ernst
? daapsharing/.deps
? daapsharing/.libs
? daapsharing/libdaapsharing.la
? iradio/librbiradio.la
? iradio/rb-new-station-dialog.lo
? iradio/rb-station-properties-dialog.lo
? lib/librb.la
? lib/rb-cut-and-paste-code.lo
? lib/rb-debug.lo
? lib/rb-file-helpers.lo
? lib/rb-glade-helpers.lo
? lib/rb-marshal.lo
? lib/rb-stock-icons.lo
? lib/rb-string-helpers.lo
? lib/rb-tree-dnd.lo
? lib/rb-util.lo
? metadata/.deps
? metadata/.libs
? metadata/librbmetadata.la
? metadata/rb-metadata-common.lo
? metadata/rb-metadata-gst.lo
? player/.deps
? player/.libs
? player/librbplayer.la
? player/rb-player-gst.lo
? player/rb-recorder-gst.lo
? po/.intltool-merge-cache
? remote/.deps
? remote/.libs
? remote/librbremote.la
? remote/rb-remote-client-proxy.lo
? remote/rb-remote-common.lo
? remote/rb-remote-proxy.lo
? remote/bonobo/.deps
? remote/bonobo/.libs
? remote/bonobo/Rhythmbox-common.lo
? remote/bonobo/Rhythmbox-skels.lo
? remote/bonobo/Rhythmbox-stubs.lo
? remote/bonobo/libmain.lo
? remote/bonobo/librb-nautilus-context-menu.la
? remote/bonobo/librbbonobo.la
? remote/bonobo/librbcorba.la
? remote/bonobo/rb-nautilus-context-menu.lo
? remote/bonobo/rb-remote-bonobo.lo
? rhythmdb/.deps
? rhythmdb/.libs
? rhythmdb/gsequence.lo
? rhythmdb/librhythmdb.la
? rhythmdb/rb-refstring.lo
? rhythmdb/rhythmdb-property-model.lo
? rhythmdb/rhythmdb-query-model.lo
? rhythmdb/rhythmdb-tree.lo
? rhythmdb/rhythmdb.lo
? shell/.deps
? shell/.libs
? sources/.deps
? sources/.libs
? sources/itunesdb.lo
? sources/libsources.la
? sources/libsourcesimpl.la
? sources/rb-ipod-source.lo
? sources/rb-iradio-source.lo
? sources/rb-library-source.lo
? sources/rb-playlist-source-recorder.lo
? sources/rb-playlist-source.lo
? sources/rb-removable-media-source.lo
? sources/rb-source.lo
? sources/rb-sourcelist-model.lo
? sources/rb-sourcelist.lo
? widgets/.deps
? widgets/.libs
? widgets/bacon-volume.lo
? widgets/disclosure-widget.lo
? widgets/eel-gconf-extensions.lo
? widgets/eggnotificationbubble.lo
? widgets/eggtrayicon.lo
? widgets/librbwidgets.la
? widgets/rb-cell-renderer-pixbuf.lo
? widgets/rb-cell-renderer-rating.lo
? widgets/rb-dialog.lo
? widgets/rb-druid.lo
? widgets/rb-entry-view.lo
? widgets/rb-header.lo
? widgets/rb-load-failure-dialog.lo
? widgets/rb-property-view.lo
? widgets/rb-query-creator-properties.lo
? widgets/rb-query-creator.lo
? widgets/rb-rating-helper.lo
? widgets/rb-rating.lo
? widgets/rb-search-entry.lo
? widgets/rb-song-display-box.lo
? widgets/rb-song-info.lo
Index: data/glade/general-prefs.glade
===================================================================
RCS file: /cvs/gnome/rhythmbox/data/glade/general-prefs.glade,v
retrieving revision 1.6
diff -u -r1.6 general-prefs.glade
--- data/glade/general-prefs.glade	26 Jun 2005 21:49:57 -0000	1.6
+++ data/glade/general-prefs.glade	11 Sep 2005 23:28:34 -0000
@@ -12,6 +12,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 +51,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 +82,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 +119,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>
@@ -298,6 +316,29 @@
 				  <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="first_seen_check">
+				  <property name="visible">True</property>
+				  <property name="can_focus">True</property>
+				  <property name="label" translatable="yes">_Date Added</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: rhythmdb/rhythmdb-tree.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/rhythmdb/rhythmdb-tree.c,v
retrieving revision 1.70
diff -u -r1.70 rhythmdb-tree.c
--- rhythmdb/rhythmdb-tree.c	3 Sep 2005 13:18:55 -0000	1.70
+++ rhythmdb/rhythmdb-tree.c	11 Sep 2005 23:28:36 -0000
@@ -404,6 +404,7 @@
 		case RHYTHMDB_PROP_LAST_PLAYED_STR:
 		case RHYTHMDB_PROP_HIDDEN:
 		case RHYTHMDB_PROP_PLAYBACK_ERROR:
+		case RHYTHMDB_PROP_FIRST_SEEN_STR:
 		case RHYTHMDB_NUM_PROPERTIES:
 			g_assert_not_reached ();
 			break;
@@ -714,6 +715,7 @@
 		case RHYTHMDB_PROP_LAST_PLAYED_STR:
 		case RHYTHMDB_PROP_HIDDEN:
 		case RHYTHMDB_PROP_PLAYBACK_ERROR:
+		case RHYTHMDB_PROP_FIRST_SEEN_STR:
 		case RHYTHMDB_NUM_PROPERTIES:
 			break;
 		}
Index: rhythmdb/rhythmdb.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/rhythmdb/rhythmdb.c,v
retrieving revision 1.115
diff -u -r1.115 rhythmdb.c
--- rhythmdb/rhythmdb.c	4 Sep 2005 23:17:15 -0000	1.115
+++ rhythmdb/rhythmdb.c	11 Sep 2005 23:28:37 -0000
@@ -2133,6 +2133,16 @@
 		}
 		break;
 	}
+	case RHYTHMDB_PROP_FIRST_SEEN:
+	{
+		if (entry->first_seen_str)
+			rb_refstring_unref (entry->first_seen_str);
+		
+		val = eel_strdup_strftime (_("%Y-%m-%d %H:%M"), localtime (&entry->first_seen));
+		entry->first_seen_str = rb_refstring_new_full (val, FALSE);
+		g_free (val);
+		break;
+	}
 	default:
 		break;
 	}
@@ -2761,6 +2771,7 @@
 			ENUM_ENTRY (RHYTHMDB_PROP_LAST_PLAYED_STR, "Last Played (gchararray) [last-played-str]"),
 			ENUM_ENTRY (RHYTHMDB_PROP_PLAYBACK_ERROR, "Playback error string (gchararray) [playback-error]"),
 			ENUM_ENTRY (RHYTHMDB_PROP_HIDDEN, "Visibility (gboolean) [visibility]"),
+			ENUM_ENTRY (RHYTHMDB_PROP_FIRST_SEEN_STR, "Time Added to Library (gchararray) [first-seen-str]"),
 			{ 0, 0, 0 }
 		};
 		g_assert ((sizeof (values) / sizeof (values[0]) - 1) == RHYTHMDB_NUM_PROPERTIES);
Index: rhythmdb/rhythmdb.h
===================================================================
RCS file: /cvs/gnome/rhythmbox/rhythmdb/rhythmdb.h,v
retrieving revision 1.47
diff -u -r1.47 rhythmdb.h
--- rhythmdb/rhythmdb.h	29 Aug 2005 23:19:41 -0000	1.47
+++ rhythmdb/rhythmdb.h	11 Sep 2005 23:28:37 -0000
@@ -100,7 +100,8 @@
 	RHYTHMDB_PROP_LAST_PLAYED_STR,
 	RHYTHMDB_PROP_HIDDEN,
 	RHYTHMDB_PROP_PLAYBACK_ERROR,
-
+	RHYTHMDB_PROP_FIRST_SEEN_STR,
+	
 	RHYTHMDB_NUM_PROPERTIES
 } RhythmDBPropType;
 
@@ -151,9 +152,9 @@
 	dev_t device;
 	GnomeVFSInodeNumber inode;
 #endif
-	gulong mtime;
-	gulong first_seen;
-	gulong last_seen;
+	glong mtime;
+	glong first_seen;
+	glong last_seen;
 
 	/* user data */
 	gdouble rating;
@@ -163,6 +164,7 @@
 
 	/* cached data */
 	RBRefString *last_played_str;
+	RBRefString *first_seen_str;
 
 	/* playback error string */
 	char *playback_error;
@@ -225,6 +227,8 @@
 		return rb_refstring_get (entry->last_played_str);
 	case RHYTHMDB_PROP_PLAYBACK_ERROR:
 		return entry->playback_error;
+	case RHYTHMDB_PROP_FIRST_SEEN_STR:
+		return rb_refstring_get (entry->first_seen_str);
 	default:
 		g_assert_not_reached ();
 		return NULL;
Index: shell/rb-shell-preferences.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-shell-preferences.c,v
retrieving revision 1.44
diff -u -r1.44 rb-shell-preferences.c
--- shell/rb-shell-preferences.c	10 Sep 2005 07:12:23 -0000	1.44
+++ shell/rb-shell-preferences.c	11 Sep 2005 23:28:37 -0000
@@ -86,6 +86,7 @@
 	GtkWidget *rating_check;
 	GtkWidget *play_count_check;
 	GtkWidget *last_played_check;
+	GtkWidget *first_seen_check;
 	GtkWidget *quality_check;
 
 	gboolean loading;
@@ -224,6 +225,8 @@
 		glade_xml_get_widget (xml, "last_played_check");
 	shell_preferences->priv->quality_check =
 		glade_xml_get_widget (xml, "quality_check");
+	shell_preferences->priv->first_seen_check =
+		glade_xml_get_widget (xml, "first_seen_check");
 
 	gtk_notebook_append_page (GTK_NOTEBOOK (shell_preferences->priv->notebook),
 				  glade_xml_get_widget (xml, "general_vbox"),
@@ -441,6 +444,8 @@
 	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->first_seen_check))
+		colname = "RHYTHMDB_PROP_FIRST_SEEN";
 	else
 		g_assert_not_reached ();
 
@@ -505,6 +510,9 @@
 			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->first_seen_check),
+			 strstr (columns, "RHYTHMDB_PROP_FIRST_SEEN") != NULL);
 	}
 
 	g_free (columns);
Index: sources/rb-library-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-library-source.c,v
retrieving revision 1.117
diff -u -r1.117 rb-library-source.c
--- sources/rb-library-source.c	11 Sep 2005 03:05:11 -0000	1.117
+++ sources/rb-library-source.c	11 Sep 2005 23:28:38 -0000
@@ -546,6 +546,7 @@
 	rb_entry_view_append_column (source->priv->songs, RB_ENTRY_VIEW_COL_RATING);
 	rb_entry_view_append_column (source->priv->songs, RB_ENTRY_VIEW_COL_PLAY_COUNT);
 	rb_entry_view_append_column (source->priv->songs, RB_ENTRY_VIEW_COL_LAST_PLAYED);
+	rb_entry_view_append_column (source->priv->songs, RB_ENTRY_VIEW_COL_FIRST_SEEN);
 
 	g_signal_connect_object (G_OBJECT (source->priv->songs), "show_popup",
 				 G_CALLBACK (rb_library_source_songs_show_popup_cb), source, 0);
Index: sources/rb-playlist-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-playlist-source.c,v
retrieving revision 1.74
diff -u -r1.74 rb-playlist-source.c
--- sources/rb-playlist-source.c	9 Sep 2005 10:08:53 -0000	1.74
+++ sources/rb-playlist-source.c	11 Sep 2005 23:28:39 -0000
@@ -326,6 +326,7 @@
 	rb_entry_view_append_column (source->priv->songs, RB_ENTRY_VIEW_COL_RATING);
 	rb_entry_view_append_column (source->priv->songs, RB_ENTRY_VIEW_COL_PLAY_COUNT);
 	rb_entry_view_append_column (source->priv->songs, RB_ENTRY_VIEW_COL_LAST_PLAYED);
+	rb_entry_view_append_column (source->priv->songs, RB_ENTRY_VIEW_COL_FIRST_SEEN);
 
 	g_signal_connect_object (G_OBJECT (source->priv->songs), "show_popup",
 				 G_CALLBACK (rb_playlist_source_songs_show_popup_cb), source, 0);
Index: widgets/rb-entry-view.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/widgets/rb-entry-view.c,v
retrieving revision 1.95
diff -u -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	11 Sep 2005 23:28:40 -0000
@@ -1292,6 +1292,15 @@
 		title = _("L_ast Played");
 		key = "LastPlayed";
 		break;
+	case RB_ENTRY_VIEW_COL_FIRST_SEEN:
+		propid = RHYTHMDB_PROP_FIRST_SEEN;
+		cell_data->propid = RHYTHMDB_PROP_FIRST_SEEN_STR;
+		cell_data_func = (GtkTreeCellDataFunc) rb_entry_view_string_cell_data_func;				
+		sort_data->propid = RHYTHMDB_PROP_FIRST_SEEN;
+		sort_func = (GCompareDataFunc) rb_entry_view_ulong_sort_func;
+		title = _("_Date Added");
+		key = "FirstSeen";
+		break;
 	case RB_ENTRY_VIEW_COL_RATING:
 	default:
 		g_assert_not_reached ();
Index: widgets/rb-entry-view.h
===================================================================
RCS file: /cvs/gnome/rhythmbox/widgets/rb-entry-view.h,v
retrieving revision 1.22
diff -u -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	11 Sep 2005 23:28:40 -0000
@@ -51,6 +51,7 @@
 	RB_ENTRY_VIEW_COL_RATING,
 	RB_ENTRY_VIEW_COL_PLAY_COUNT,
 	RB_ENTRY_VIEW_COL_LAST_PLAYED,
+	RB_ENTRY_VIEW_COL_FIRST_SEEN
 } RBEntryViewColumn;
 
 typedef struct RBEntryViewPrivate RBEntryViewPrivate;
Index: widgets/rb-query-creator-properties.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/widgets/rb-query-creator-properties.c,v
retrieving revision 1.2
diff -u -r1.2 rb-query-creator-properties.c
--- widgets/rb-query-creator-properties.c	29 Aug 2005 00:42:16 -0000	1.2
+++ widgets/rb-query-creator-properties.c	11 Sep 2005 23:28:40 -0000
@@ -94,6 +94,7 @@
 	{ N_("Duration"), "Time", N_("W_ith longer tracks first") },
 	{ N_("Track Number"), "Track", N_("_In decreasing order")},
 	{ N_("Last Played"), "LastPlayed", N_("W_ith more recently played tracks first") },
+	{ N_("Date Added"), "FirstSeen", N_("W_ith more recently added tracks first") },
 };
 
 const int num_sort_options = G_N_ELEMENTS (sort_options);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]