1 /* totem-playlist.h: Simple playlist dialog 2 3 Copyright (C) 2002, 2003, 2004, 2005 Bastien Nocera <hadess@hadess.net> 4 5 The Gnome Library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Library General Public License as 7 published by the Free Software Foundation; either version 2 of the 8 License, or (at your option) any later version. 9 10 The Gnome Library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Library General Public License for more details. 14 15 You should have received a copy of the GNU Library General Public 16 License along with the Gnome Library; see the file COPYING.LIB. If not, 17 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 Boston, MA 02110-1301 USA. 19 20 Author: Bastien Nocera <hadess@hadess.net> 21 */ 22 23 #ifndef TOTEM_PLAYLIST_H 24 #define TOTEM_PLAYLIST_H 25 26 #include <gtk/gtk.h> 27 #include <totem-pl-parser.h> 28 #include <gio/gio.h> 29 30 G_BEGIN_DECLS 31 32 #define TOTEM_TYPE_PLAYLIST (totem_playlist_get_type ()) 33 #define TOTEM_PLAYLIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOTEM_TYPE_PLAYLIST, TotemPlaylist)) 34 #define TOTEM_PLAYLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOTEM_TYPE_PLAYLIST, TotemPlaylistClass)) 35 #define TOTEM_IS_PLAYLIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOTEM_TYPE_PLAYLIST)) 36 #define TOTEM_IS_PLAYLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOTEM_TYPE_PLAYLIST)) 37 38 typedef enum { 39 TOTEM_PLAYLIST_STATUS_NONE, 40 TOTEM_PLAYLIST_STATUS_PLAYING, 41 TOTEM_PLAYLIST_STATUS_PAUSED 42 } TotemPlaylistStatus; 43 44 typedef enum { 45 TOTEM_PLAYLIST_DIRECTION_NEXT, 46 TOTEM_PLAYLIST_DIRECTION_PREVIOUS 47 } TotemPlaylistDirection; 48 49 typedef enum { 50 TOTEM_PLAYLIST_DIALOG_SELECTED, 51 TOTEM_PLAYLIST_DIALOG_PLAYING 52 } TotemPlaylistSelectDialog; 53 54 55 typedef struct TotemPlaylist TotemPlaylist; 56 typedef struct TotemPlaylistClass TotemPlaylistClass; 57 typedef struct TotemPlaylistPrivate TotemPlaylistPrivate; 58 59 typedef void (*TotemPlaylistForeachFunc) (TotemPlaylist *playlist, 60 const gchar *filename, 61 const gchar *uri, 62 gpointer user_data); 63 64 struct TotemPlaylist { 65 GtkBox parent; 66 TotemPlaylistPrivate *priv; 67 }; 68 69 struct TotemPlaylistClass { 70 GtkBoxClass parent_class; 71 72 void (*changed) (TotemPlaylist *playlist); 73 void (*item_activated) (TotemPlaylist *playlist); 74 void (*active_name_changed) (TotemPlaylist *playlist); 75 void (*current_removed) (TotemPlaylist *playlist); 76 void (*subtitle_changed) (TotemPlaylist *playlist); 77 void (*item_added) (TotemPlaylist *playlist, const gchar *filename, const gchar *uri); 78 void (*item_removed) (TotemPlaylist *playlist, const gchar *filename, const gchar *uri); 79 }; 80 81 GType totem_playlist_get_type (void); 82 GtkWidget *totem_playlist_new (void); 83 84 /* The application is responsible for checking that the mrl is correct 85 * @display_name is if you have a preferred display string for the mrl, 86 * NULL otherwise 87 */ 88 void totem_playlist_add_mrl (TotemPlaylist *playlist, 89 const char *mrl, 90 const char *display_name, 91 gboolean cursor, 92 GCancellable *cancellable, 93 GAsyncReadyCallback callback, 94 gpointer user_data); 95 gboolean totem_playlist_add_mrl_finish (TotemPlaylist *playlist, 96 GAsyncResult *result, 97 GError **error); 98 gboolean totem_playlist_add_mrl_sync (TotemPlaylist *playlist, 99 const char *mrl); 100 101 typedef struct TotemPlaylistMrlData TotemPlaylistMrlData; 102 103 TotemPlaylistMrlData *totem_playlist_mrl_data_new (const gchar *mrl, 104 const gchar *display_name); 105 void totem_playlist_mrl_data_free (TotemPlaylistMrlData *data); 106 107 void totem_playlist_add_mrls (TotemPlaylist *self, 108 GList *mrls, 109 gboolean cursor, 110 GCancellable *cancellable, 111 GAsyncReadyCallback callback, 112 gpointer user_data); 113 gboolean totem_playlist_add_mrls_finish (TotemPlaylist *self, 114 GAsyncResult *result, 115 GError **error); 116 117 void totem_playlist_save_session_playlist (TotemPlaylist *playlist, 118 GFile *output, 119 gint64 starttime); 120 void totem_playlist_select_subtitle_dialog (TotemPlaylist *playlist, 121 TotemPlaylistSelectDialog mode); 122 123 /* totem_playlist_clear doesn't emit the current_removed signal, even if it does 124 * because the caller should know what to do after it's done with clearing */ 125 gboolean totem_playlist_clear (TotemPlaylist *playlist); 126 void totem_playlist_clear_with_g_mount (TotemPlaylist *playlist, 127 GMount *mount); 128 char *totem_playlist_get_current_mrl (TotemPlaylist *playlist, 129 char **subtitle); 130 char *totem_playlist_get_current_title (TotemPlaylist *playlist); 131 char *totem_playlist_get_current_content_type (TotemPlaylist *playlist); 132 gint64 totem_playlist_steal_current_starttime (TotemPlaylist *playlist); 133 char *totem_playlist_get_title (TotemPlaylist *playlist, 134 guint title_index); 135 136 gboolean totem_playlist_set_title (TotemPlaylist *playlist, 137 const char *title); 138 void totem_playlist_set_current_subtitle (TotemPlaylist *playlist, 139 const char *subtitle_uri); 140 141 #define totem_playlist_has_direction(playlist, direction) (direction == TOTEM_PLAYLIST_DIRECTION_NEXT ? totem_playlist_has_next_mrl (playlist) : totem_playlist_has_previous_mrl (playlist)) 142 gboolean totem_playlist_has_previous_mrl (TotemPlaylist *playlist); 143 gboolean totem_playlist_has_next_mrl (TotemPlaylist *playlist); 144 145 #define totem_playlist_set_direction(playlist, direction) (direction == TOTEM_PLAYLIST_DIRECTION_NEXT ? totem_playlist_set_next (playlist) : totem_playlist_set_previous (playlist)) 146 void totem_playlist_set_previous (TotemPlaylist *playlist); 147 void totem_playlist_set_next (TotemPlaylist *playlist); 148 149 gboolean totem_playlist_get_repeat (TotemPlaylist *playlist); 150 void totem_playlist_set_repeat (TotemPlaylist *playlist, gboolean repeat); 151 152 gboolean totem_playlist_set_playing (TotemPlaylist *playlist, TotemPlaylistStatus state); 153 TotemPlaylistStatus totem_playlist_get_playing (TotemPlaylist *playlist); 154 155 void totem_playlist_set_at_start (TotemPlaylist *playlist); 156 void totem_playlist_set_at_end (TotemPlaylist *playlist); 157 158 int totem_playlist_get_current (TotemPlaylist *playlist); 159 int totem_playlist_get_last (TotemPlaylist *playlist); 160 void totem_playlist_set_current (TotemPlaylist *playlist, guint current_index); 161 162 G_END_DECLS 163 164 #endif /* TOTEM_PLAYLIST_H */ 165