1 /* 2 * Copyright (C) 2005 Marc Pavot <marc.pavot@gmail.com> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2, or (at your option) 7 * any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * 18 */ 19 20 #ifndef __ARIO_SERVER_INTERFACE_H 21 #define __ARIO_SERVER_INTERFACE_H 22 23 #include <glib-object.h> 24 #include "ario-server.h" 25 26 G_BEGIN_DECLS 27 28 #define TYPE_ARIO_SERVER_INTERFACE (ario_server_interface_get_type ()) 29 #define ARIO_SERVER_INTERFACE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_ARIO_SERVER_INTERFACE, ArioServerInterface)) 30 #define ARIO_SERVER_INTERFACE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), TYPE_ARIO_SERVER_INTERFACE, ArioServerInterfaceClass)) 31 #define IS_ARIO_SERVER_INTERFACE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_ARIO_SERVER_INTERFACE)) 32 #define IS_ARIO_SERVER_INTERFACE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_ARIO_SERVER_INTERFACE)) 33 #define ARIO_SERVER_INTERFACE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_ARIO_SERVER_INTERFACE, ArioServerInterfaceClass)) 34 35 typedef struct 36 { 37 GObject parent; 38 39 int song_id; 40 guint state; 41 int volume; 42 guint elapsed; 43 44 ArioServerSong *server_song; 45 gint64 playlist_id; 46 int playlist_length; 47 48 gboolean consume; 49 gboolean random; 50 gboolean repeat; 51 52 guint updatingdb; 53 int crossfade; 54 55 GSList *queue; 56 57 gboolean connecting; 58 59 int signals_to_emit; 60 } ArioServerInterface; 61 62 typedef struct 63 { 64 GObjectClass parent; 65 66 /* Virtual public methods */ 67 void (*connect) (void); 68 69 void (*disconnect) (void); 70 71 gboolean (*is_connected) (void); 72 73 gboolean (*update_status) (void); 74 75 void (*update_db) (const gchar* path); 76 77 GSList * (*list_tags) (const ArioServerTag tag, 78 const ArioServerCriteria *criteria); 79 80 GSList * (*get_albums) (const ArioServerCriteria *criteria); 81 82 GSList * (*get_songs) (const ArioServerCriteria *criteria, 83 const gboolean exact); 84 GSList * (*get_songs_from_playlist) (char *playlist); 85 86 GSList * (*get_playlists) (void); 87 88 GSList * (*get_playlist_changes) (gint64 playlist_id); 89 90 ArioServerSong * (*get_current_song_on_server) (void); 91 92 int (*get_current_playlist_total_time) (void); 93 94 unsigned long (*get_last_update) (void); 95 96 void (*do_next) (void); 97 98 void (*do_prev) (void); 99 100 void (*do_play) (void); 101 102 void (*do_play_pos) (gint id); 103 void (*do_pause) (void); 104 105 void (*do_stop) (void); 106 void (*set_current_elapsed) (const gint elapsed); 107 void (*set_current_volume) (const gint volume); 108 void (*set_current_consume) (const gboolean consume); 109 void (*set_current_random) (const gboolean random); 110 void (*set_current_repeat) (const gboolean repeat); 111 void (*set_crossfadetime) (const int crossfadetime); 112 void (*clear) (void); 113 void (*shuffle) (void); 114 115 void (*queue_commit) (void); 116 117 void (*insert_at) (const GSList *songs, 118 const gint pos); 119 int (*save_playlist) (const char *name); 120 void (*delete_playlist) (const char *name); 121 122 GSList * (*get_outputs) (void); 123 124 void (*enable_output) (const int id, 125 const gboolean enabled); 126 ArioServerStats * (*get_stats) (void); 127 128 GList * (*get_songs_info) (GSList *paths); 129 130 ArioServerFileList* (*list_files) (const char *path, 131 const gboolean recursive); 132 } ArioServerInterfaceClass; 133 134 GType ario_server_interface_get_type (void) G_GNUC_CONST; 135 136 void ario_server_interface_set_default (ArioServerInterface *server_interface); 137 138 void ario_server_interface_emit (ArioServerInterface *server_interface, 139 ArioServer *server); 140 G_END_DECLS 141 142 #endif /* __ARIO_SERVER_INTERFACE_H */ 143