2006-12-14 Francisco Javier F. Serrador <serrador@openshine.com>
[rhythmbox.git] / shell / rb-shell-player.h
bloba2a0cf613724480c49f295946fedaaf40eb75703
1 /*
2 * arch-tag: Header for object implementing main playback logic
4 * Copyright (C) 2002 Jorn Baayen <jorn@nl.linux.org>
5 * Copyright (C) 2003,2004 Colin Walters <walters@verbum.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include <gtk/gtkhbox.h>
24 #include <gtk/gtkuimanager.h>
25 #include <gtk/gtkactiongroup.h>
27 #include "rb-source.h"
28 #include "rhythmdb.h"
30 #ifndef __RB_SHELL_PLAYER_H
31 #define __RB_SHELL_PLAYER_H
33 G_BEGIN_DECLS
35 #define RB_TYPE_SHELL_PLAYER (rb_shell_player_get_type ())
36 #define RB_SHELL_PLAYER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), RB_TYPE_SHELL_PLAYER, RBShellPlayer))
37 #define RB_SHELL_PLAYER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), RB_TYPE_SHELL_PLAYER, RBShellPlayerClass))
38 #define RB_IS_SHELL_PLAYER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), RB_TYPE_SHELL_PLAYER))
39 #define RB_IS_SHELL_PLAYER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), RB_TYPE_SHELL_PLAYER))
40 #define RB_SHELL_PLAYER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), RB_TYPE_SHELL_PLAYER, RBShellPlayerClass))
42 typedef enum
44 RB_SHELL_PLAYER_ERROR_PLAYLIST_PARSE_ERROR,
45 RB_SHELL_PLAYER_ERROR_END_OF_PLAYLIST,
46 RB_SHELL_PLAYER_ERROR_NOT_PLAYING,
47 RB_SHELL_PLAYER_ERROR_NOT_SEEKABLE,
48 } RBShellPlayerError;
50 GType rb_shell_player_error_get_type (void);
51 #define RB_TYPE_SHELL_PLAYER_ERROR (rb_shell_player_error_get_type())
53 #define RB_SHELL_PLAYER_ERROR rb_shell_player_error_quark ()
55 GQuark rb_shell_player_error_quark (void);
57 typedef struct RBShellPlayerPrivate RBShellPlayerPrivate;
59 typedef struct
61 GtkHBox parent;
63 RBShellPlayerPrivate *priv;
64 } RBShellPlayer;
66 typedef struct
68 GtkHBoxClass parent_class;
70 void (*window_title_changed) (RBShellPlayer *player, const char *window_title);
71 void (*elapsed_changed) (RBShellPlayer *player, guint elapsed);
72 void (*playing_changed) (RBShellPlayer *player, gboolean playing);
73 void (*playing_source_changed) (RBShellPlayer *player, RBSource *source);
74 void (*playing_uri_changed) (RBShellPlayer *player, const char *uri);
75 void (*playing_song_changed) (RBShellPlayer *player, RhythmDBEntry *entry);
76 void (*playing_song_property_changed) (RBShellPlayer *player,
77 const char *uri,
78 const char *property,
79 GValue *old,
80 GValue *newValue);
81 } RBShellPlayerClass;
83 GType rb_shell_player_get_type (void);
85 RBShellPlayer * rb_shell_player_new (RhythmDB *db,
86 GtkUIManager *mgr,
87 GtkActionGroup *actiongroup);
89 void rb_shell_player_set_selected_source (RBShellPlayer *shell_player,
90 RBSource *player);
91 void rb_shell_player_set_playing_source (RBShellPlayer *player,
92 RBSource *source);
94 RBSource * rb_shell_player_get_playing_source (RBShellPlayer *shell_player);
95 RBSource * rb_shell_player_get_active_source (RBShellPlayer *shell_player);
97 void rb_shell_player_jump_to_current (RBShellPlayer *player);
99 void rb_shell_player_play_entry (RBShellPlayer *player,
100 RhythmDBEntry *entry,
101 RBSource *source);
102 gboolean rb_shell_player_play (RBShellPlayer *player, GError **error);
103 gboolean rb_shell_player_pause (RBShellPlayer *player, GError **error);
104 gboolean rb_shell_player_playpause (RBShellPlayer *player, gboolean unused, GError **error);
105 void rb_shell_player_stop (RBShellPlayer *player);
106 gboolean rb_shell_player_do_previous (RBShellPlayer *player, GError **error);
107 gboolean rb_shell_player_do_next (RBShellPlayer *player, GError **error);
109 char * rb_shell_player_get_playing_time_string (RBShellPlayer *player);
110 gboolean rb_shell_player_get_playing_time(RBShellPlayer *player,
111 guint *time,
112 GError **error);
113 gboolean rb_shell_player_set_playing_time(RBShellPlayer *player,
114 guint time,
115 GError **error);
116 void rb_shell_player_seek (RBShellPlayer *player, long offset);
117 long rb_shell_player_get_playing_song_duration (RBShellPlayer *player);
119 gboolean rb_shell_player_get_playing (RBShellPlayer *shell_player,
120 gboolean *playing,
121 GError **error);
123 gboolean rb_shell_player_get_playing_path(RBShellPlayer *shell_player,
124 const gchar **path,
125 GError **error);
127 void rb_shell_player_set_playback_state(RBShellPlayer *player,
128 gboolean shuffle, gboolean repeat);
130 gboolean rb_shell_player_get_playback_state(RBShellPlayer *player,
131 gboolean *shuffle,
132 gboolean *repeat);
134 RhythmDBEntry * rb_shell_player_get_playing_entry (RBShellPlayer *player);
136 void rb_shell_player_toggle_mute (RBShellPlayer *player);
138 gboolean rb_shell_player_set_volume (RBShellPlayer *player,
139 gdouble volume,
140 GError **error);
142 gboolean rb_shell_player_get_volume (RBShellPlayer *player,
143 gdouble *volume,
144 GError **error);
146 gboolean rb_shell_player_set_volume_relative (RBShellPlayer *player,
147 gdouble volume,
148 GError **error);
150 gboolean rb_shell_player_set_mute (RBShellPlayer *player,
151 gboolean mute,
152 GError **error);
154 gboolean rb_shell_player_get_mute (RBShellPlayer *player,
155 gboolean *mute,
156 GError **error);
158 G_END_DECLS
160 #endif /* __RB_SHELL_PLAYER_H */