musicus mpd client 0.1d
definitions.h
Go to the documentation of this file.
00001 
00008 /**********************************************************************
00009  * Copyright 2006 - 2008 by Simon Gerber <simugerber@student.ethz.ch>
00010  *
00011  * This file is part of Musicus.
00012  * Musicus is free software: you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation, either version 3 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * Musicus is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with Musicus.  If not, see <http://www.gnu.org/licenses/>.
00024  **********************************************************************/
00025 
00042 #ifndef __definitions_h
00043 #define __definitions_h
00044 
00049 
00050 #include "../config.h"
00051 
00052 #include <stdio.h>
00053 #include <libmpd-1.0/libmpd/libmpd.h>
00054 #include <libmpd-1.0/libmpd/libmpdclient.h>
00055 #include <glib.h>
00056 
00057 #define AUTHORS "Simon Gerber <simugerber@student.ethz.ch>"
00058 #define DOCUMENTERS "Simon Gerber <simugerber@student.ethz.ch>"
00059 #define LOGO "musicus-mpc"
00060 
00065 int debug;
00070 int verbose;
00071 
00075 FILE *err_file;
00079 FILE *log_file;
00080 
00081 #define BUF_LEN 256
00082 
00086 char title_text[BUF_LEN];
00087 
00088 /* mpd related */
00089 
00093 typedef struct {
00095     gboolean random;
00097     gboolean repeat;
00099     gint xfade;
00101     gboolean update;
00102 } MpdPlayState;
00103 
00107 typedef struct {
00109     gboolean connected;
00111     GString *host;
00113     gint port;
00115     gint timeout;
00117     GString *pw;
00118 } MpdStateInfo;
00119 
00123 typedef struct {
00125     GString *title_fmt;
00127     GString *statusbar_fmt;
00129     GString *tooltip_fmt;
00131     GString *applet_fmt;
00132 } MpdStatusFmt;
00133 
00137 enum {
00139     FMT_TOOLTIP,
00141     FMT_TITLE,
00143     FMT_STATUSBAR,
00145     FMT_APPLET
00146 };
00147 
00151 enum {
00153     HAS_NOTHING = 0,
00155     HAS_STATE = 1 << 0,
00157     HAS_CURRENT_TIME = 1 << 1,
00159     HAS_SONG_TIME = 1 << 2,
00161     HAS_ALL = HAS_STATE|HAS_CURRENT_TIME|HAS_SONG_TIME
00162 };
00163 
00167 typedef struct {
00169     GString *config_file;
00171     gboolean auto_connect;
00173     MpdObj *obj;
00175     MpdStateInfo msi;
00177     MpdPlayState mps;
00179     MpdStatusFmt msf;
00181     gint update_interval;
00183     gint xfade_secs;
00185     GList *update_routines;
00188     GList *period_funcs;
00189 } MpdInfo;
00190 
00194 MpdInfo mpd_info;
00195 
00196 /*
00197  * convenience macros for mpd_info fields, read-only
00198  */
00200 #define HOST mpd_info.msi.host->str
00201 
00202 #define PORT mpd_info.msi.port
00203 
00204 #define TIMEOUT mpd_info.msi.timeout
00205 
00206 #define PASSWORD mpd_info.msi.pw->str
00207 
00208 
00210 #endif
00211 
00212 /* vim:softtabstop=4:shiftwidth=4
00213  */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines