![]() |
![]() |
![]() |
Rhythmbox Development Reference Manual | ![]() |
---|---|---|---|---|
rb-entry-viewrb-entry-view — a GtkTreeView for displaying track listings |
RBEntryView; RBEntryViewClass; enum RBEntryViewColumn; RBEntryView* rb_entry_view_new (RhythmDB *db, GObject *shell_player, const char *sort_key, gboolean is_drag_source, gboolean is_drag_dest); void rb_entry_view_append_column (RBEntryView *view, RBEntryViewColumn coltype, gboolean always_visible); void rb_entry_view_append_column_custom (RBEntryView *view, GtkTreeViewColumn *column, const char *title, const char *key, GCompareDataFunc sort_func, gpointer data, GDestroyNotify data_destroy); void rb_entry_view_insert_column_custom (RBEntryView *view, GtkTreeViewColumn *column, const char *title, const char *key, GCompareDataFunc sort_func, gpointer data, GDestroyNotify data_destroy, gint position); void rb_entry_view_set_columns_clickable (RBEntryView *view, gboolean clickable); void rb_entry_view_set_model (RBEntryView *view, RhythmDBQueryModel *model); void rb_entry_view_set_state (RBEntryView *view, RBEntryViewState state); gboolean rb_entry_view_have_selection (RBEntryView *view); gboolean rb_entry_view_have_complete_selection (RBEntryView *view); GList* rb_entry_view_get_selected_entries (RBEntryView *view); void rb_entry_view_select_all (RBEntryView *view); void rb_entry_view_select_none (RBEntryView *view); void rb_entry_view_select_entry (RBEntryView *view, RhythmDBEntry *entry); gboolean rb_entry_view_get_entry_contained (RBEntryView *view, RhythmDBEntry *entry); gboolean rb_entry_view_get_entry_visible (RBEntryView *view, RhythmDBEntry *entry); void rb_entry_view_scroll_to_entry (RBEntryView *view, RhythmDBEntry *entry); void rb_entry_view_enable_drag_source (RBEntryView *view, const GtkTargetEntry *targets, int n_targets); void rb_entry_view_get_sorting_order (RBEntryView *view, char **column_name, gint *sort_order); void rb_entry_view_set_sorting_order (RBEntryView *view, const char *column_name, gint sort_order); char* rb_entry_view_get_sorting_type (RBEntryView *view); void rb_entry_view_set_sorting_type (RBEntryView *view, const char *sorttype); void rb_entry_view_set_fixed_column_width (RBEntryView *view, GtkTreeViewColumn *column, GtkCellRenderer *renderer, const gchar **strings); const char* rb_entry_view_get_time_date_column_sample (void); void rb_entry_view_resort_model (RBEntryView *view);
GObject +----GInitiallyUnowned +----GtkObject +----GtkWidget +----GtkContainer +----GtkBin +----GtkScrolledWindow +----RBEntryView
"db" RhythmDB* : Read / Write / Construct Only "is-drag-dest" gboolean : Read / Write / Construct Only "is-drag-source" gboolean : Read / Write / Construct Only "model" RhythmDBQueryModel* : Read / Write "playing-state" gint : Read / Write "shell-player" RBShellPlayer* : Read / Write / Construct Only "sort-key" gchar* : Read / Write
"entries-replaced" : Run Last "entry-activated" : Run Last "entry-added" : Run Last "entry-deleted" : Run Last "have-selection-changed" : Run Last "selection-changed" : Run Last "show-popup" : Run Last "sort-order-changed" : Run Last
This class provides a predefined set of columns for displaying the common set of RhythmDBEntry properties, but also allows custom columns to be appended. The 'playing' column is always created as the first column in the tree view, displaying a playing or paused image next to the currently playing entry, and also an error image next to entries for which a playback error message has been set. Clicking on the error image opens a dialog displaying the full message.
All columns added to entry view columns should be expandable, or have a fixed minimum width set. Otherwise, the tree view must measure the contents of each row to assign sizes, which is very slow for large track lists. All the predefined column types handle this correctly.
The set of visible columns is controlled by a (single) GConf key, which contains a comma-delimited list of property names for which the associated columns are visible. The entry view object tracks this automatically.
If a GConf key for sorting is provided when constructing the entry view, it is watched and updated. The sort settings consist of a column name and an order (ascending or descending).
typedef struct { GtkScrolledWindowClass parent; void (*entry_added) (RBEntryView *view, RhythmDBEntry *entry); void (*entry_deleted) (RBEntryView *view, RhythmDBEntry *entry); void (*entries_replaced) (RBEntryView *view); void (*entry_activated) (RBEntryView *view, RhythmDBEntry *entry); void (*have_selection_changed) (RBEntryView *view, gboolean have_selection); void (*selection_changed) (RBEntryView *view); void (*sort_order_changed) (RBEntryView *view); void (*show_popup) (RBEntryView *view, gboolean over_entry); } RBEntryViewClass;
typedef enum { RB_ENTRY_VIEW_COL_TRACK_NUMBER, RB_ENTRY_VIEW_COL_TITLE, RB_ENTRY_VIEW_COL_ARTIST, RB_ENTRY_VIEW_COL_ALBUM, RB_ENTRY_VIEW_COL_GENRE, RB_ENTRY_VIEW_COL_DURATION, RB_ENTRY_VIEW_COL_QUALITY, RB_ENTRY_VIEW_COL_RATING, RB_ENTRY_VIEW_COL_PLAY_COUNT, RB_ENTRY_VIEW_COL_YEAR, RB_ENTRY_VIEW_COL_LAST_PLAYED, RB_ENTRY_VIEW_COL_FIRST_SEEN, RB_ENTRY_VIEW_COL_LAST_SEEN, RB_ENTRY_VIEW_COL_LOCATION, RB_ENTRY_VIEW_COL_ERROR } RBEntryViewColumn;
Predefined column types to use in RBEntryViews. Use rb_entry_view_append_column to add these to an entry view. The predefined column names map directly to the RhythmDBEntry properties the columns display.
RBEntryView* rb_entry_view_new (RhythmDB *db, GObject *shell_player, const char *sort_key, gboolean is_drag_source, gboolean is_drag_dest);
Creates a new entry view. If it makes sense to allow the user to drag entries
from this entry view to other sources, is_drag_source
should be TRUE. If it
makes sense to allow the user to drag entries from other sources to this view,
is_drag_dest
should be TRUE. Drag and drop in this sense is used for two purposes:
to transfer tracks between the filesystem and removable devices, and to add tracks
to playlists.
|
the RhythmDB instance |
|
the RBShellPlayer instance |
|
the GConf key controlling the sort order for the view |
|
if TRUE, the view should act as a drag and drop data source |
|
if TRUE, the view should act as a drag and drop destination |
Returns : |
the new entry view |
void rb_entry_view_append_column (RBEntryView *view, RBEntryViewColumn coltype, gboolean always_visible);
Appends a predefined column type to the set of columns already present
in the entry view. If always_visible
is TRUE, the column will ignore
the user's coulmn visibility settings and will always be visible.
This should only be used when it is vital for the purpose of the
source that the column be visible.
|
a RBEntryView |
|
type of column to append |
|
if TRUE, ignore the user's column visibility settings |
void rb_entry_view_append_column_custom (RBEntryView *view, GtkTreeViewColumn *column, const char *title, const char *key, GCompareDataFunc sort_func, gpointer data, GDestroyNotify data_destroy);
Appends a custom column to the entry view.
|
a RBEntryView |
|
a GtkTreeViewColumn to append |
|
title for the column (translated) |
|
sort key for the column (not translated) |
|
comparison function to use for sorting on the column |
|
data to pass to the sort function |
|
function to use to destroy the sort data |
void rb_entry_view_insert_column_custom (RBEntryView *view, GtkTreeViewColumn *column, const char *title, const char *key, GCompareDataFunc sort_func, gpointer data, GDestroyNotify data_destroy, gint position);
Inserts a custom column at the specified position.
|
a RBEntryView |
|
a GtkTreeViewColumn to append |
|
title for the column (translated) |
|
sort key for the column (not translated) |
|
comparison function to use for sorting on the column |
|
data to pass to the sort function |
|
function to use to destroy the sort data |
|
position at which to insert the column (-1 to insert at the end) |
void rb_entry_view_set_columns_clickable (RBEntryView *view, gboolean clickable);
Makes the headers for sortable columns (those for which a sort function was provided) clickable, so the user can set the sort order.
|
a RBEntryView |
|
if TRUE, sortable columns will be made clickable |
void rb_entry_view_set_model (RBEntryView *view, RhythmDBQueryModel *model);
Replaces the model backing the entry view.
|
the RBEntryView |
|
the new RhythmDBQueryModel to use for the view |
void rb_entry_view_set_state (RBEntryView *view, RBEntryViewState state);
Sets the icon to be drawn in the 'playing' column next to the current playing entry. RB_ENTRY_VIEW_PLAYING and RB_ENTRY_VIEW_PAUSED should be used when the source containing the entry view is playing, and RB_ENTRY_VIEW_NOT_PLAYING otherwise.
|
a RBEntryView |
|
the new playing entry state |
gboolean rb_entry_view_have_selection (RBEntryView *view);
|
a RBEntryView |
Returns : |
TRUE if one or more rows are selected in the view |
gboolean rb_entry_view_have_complete_selection (RBEntryView *view);
|
a RBEntryView |
Returns : |
TRUE if all rows in the view are selected |
GList* rb_entry_view_get_selected_entries (RBEntryView *view);
|
a RBEntryView |
Returns : |
a GList containing the currently selected entries in the view (must be freed) |
void rb_entry_view_select_all (RBEntryView *view);
Selects all rows in the view
|
a RBEntryView |
void rb_entry_view_select_none (RBEntryView *view);
Deselects all rows in the view.
|
a RBEntryView |
void rb_entry_view_select_entry (RBEntryView *view, RhythmDBEntry *entry);
If the specified entry is present in the view, it is added to the selection.
|
a RBEntryView |
|
a RhythmDBEntry to select |
gboolean rb_entry_view_get_entry_contained (RBEntryView *view, RhythmDBEntry *entry);
|
a RBEntryView |
|
a RhythmDBEntry to check |
Returns : |
TRUE if the entry is present in the view |
gboolean rb_entry_view_get_entry_visible (RBEntryView *view, RhythmDBEntry *entry);
|
a RBEntryView |
|
a RhythmDBEntry to check |
Returns : |
TRUE if the entry is present in the view and is currently visible |
void rb_entry_view_scroll_to_entry (RBEntryView *view, RhythmDBEntry *entry);
If the specified entry is present in the view, the view will be scrolled so that the entry is visible.
|
a RBEntryView |
|
a RhythmDBEntry to scroll to |
void rb_entry_view_enable_drag_source (RBEntryView *view, const GtkTargetEntry *targets, int n_targets);
Enables the entry view to act as a data source for drag an drop operations, using a specified set of data targets.
|
a RBEntryView |
|
an array of GtkTargetEntry structures defining the drag data targets |
|
the number of entries in the target array |
void rb_entry_view_get_sorting_order (RBEntryView *view, char **column_name, gint *sort_order);
Retrieves the sort settings for the view.
|
a RBEntryView |
|
returns the sort column name |
|
returns the sort ordering as a GtkSortType value |
void rb_entry_view_set_sorting_order (RBEntryView *view, const char *column_name, gint sort_order);
Sets the sort order for the entry view.
|
a RBEntryView |
|
name of the column to sort on |
|
order to sort in, as a GtkSortOrder |
char* rb_entry_view_get_sorting_type (RBEntryView *view);
Constructs a string that describes the sort settings for the entry view. This consists of a column name and an order ('ascending' or 'descending') separated by a comma.
|
an RBEntryView |
Returns : |
sort order description (must be freed) |
void rb_entry_view_set_sorting_type (RBEntryView *view, const char *sorttype);
Changes the sort order for the entry view. The sort order description must be a column name, followed by a comma, followed by an order description ('ascending' or 'descending').
|
a RBEntryView |
|
sort order description |
void rb_entry_view_set_fixed_column_width (RBEntryView *view, GtkTreeViewColumn *column, GtkCellRenderer *renderer, const gchar **strings);
Helper function for calling rb_set_tree_view_column_fixed_width
on
a column. This is important for performance reasons, as having the
tree view measure the strings in each of 20000 rows is very slow.
|
a RBEntryView |
|
the column to set the width for |
|
a temporary cell renderer to use |
|
a NULL-terminated array of strings that will be displayed in the column |
const char* rb_entry_view_get_time_date_column_sample (void);
Returns a sample string for use in columns displaying times
and dates in 'friendly' form (see rb_utf_friendly_time
).
For use with rb_entry_view_set_fixed_column_width
.
Returns : |
sample date string |
void rb_entry_view_resort_model (RBEntryView *view);
Resorts the entries in the entry view. Mostly to be used when a new model is associated with the view.
|
a RBEntryView to resort |
"is-drag-dest"
property"is-drag-dest" gboolean : Read / Write / Construct Only
If TRUE, the view acts as a destination for drag and drop operations.
Default value: FALSE
"is-drag-source"
property"is-drag-source" gboolean : Read / Write / Construct Only
If TRUE, the view acts as a data source for drag and drop operations.
Default value: FALSE
"model"
property"model" RhythmDBQueryModel* : Read / Write
The RhythmDBQueryModel backing the view
"playing-state"
property"playing-state" gint : Read / Write
Determines the icon to show in the 'playing' column next to the current playing entry.
Allowed values: [0,2]
Default value: 0
"shell-player"
property"shell-player" RBShellPlayer* : Read / Write / Construct Only
RBShellPlayer instance
"sort-key"
property"sort-key" gchar* : Read / Write
The GConf key that controls the sort order for the view
Default value: ""
"entries-replaced"
signalvoid user_function (RBEntryView *view, gpointer user_data) : Run Last
Emitted when the model backing the entry view is replaced.
|
the RBEntryView |
|
user data set when the signal handler was connected. |
"entry-activated"
signalvoid user_function (RBEntryView *view, RhythmDBEntry *entry, gpointer user_data) : Run Last
Emitted when an entry in the view is activated (by double clicking or by various key presses)
|
the RBEntryView |
|
the RhythmDBEntry that was activated |
|
user data set when the signal handler was connected. |
"entry-added"
signalvoid user_function (RBEntryView *view, RhythmDBEntry *entry, gpointer user_data) : Run Last
Emitted when an entry is added to the view
|
the RBEntryView |
|
the RhythmDBEntry that was added |
|
user data set when the signal handler was connected. |
"entry-deleted"
signalvoid user_function (RBEntryView *view, RhythmDBEntry *entry, gpointer user_data) : Run Last
Emitted when an entry has been removed from the view
|
the RBEntryView |
|
the RhythmDBEntry that was removed |
|
user data set when the signal handler was connected. |
"have-selection-changed"
signalvoid user_function (RBEntryView *view, gboolean have_selection, gpointer user_data) : Run Last
Emitted when the user first selects a row, or when no rows are selected any more.
|
the RBEntryView |
|
TRUE if one or more rows are selected |
|
user data set when the signal handler was connected. |
"selection-changed"
signalvoid user_function (RBEntryView *view, gpointer user_data) : Run Last
Emitted when the set of selected entries changes
|
the RBEntryView |
|
user data set when the signal handler was connected. |
"show-popup"
signalvoid user_function (RBEntryView *view, gboolean over_entry, gpointer user_data) : Run Last
Emitted when the user performs an action that should result in a popup menu appearing. If the action was a mouse button click, over_entry is FALSE if the mouse pointer was in the blank space after the last row in the view. If the action was a key press, over_entry is FALSE if no rows in the view are selected.
|
the RBEntryView |
|
if TRUE, the popup request was made while pointing at an entry in the view |
|
user data set when the signal handler was connected. |
"sort-order-changed"
signalvoid user_function (RBEntryView *view, gpointer user_data) : Run Last
Emitted when the user changes the sort order for the view
|
the RBEntryView |
|
user data set when the signal handler was connected. |