Audacious  $Id:Doxyfile42802007-03-2104:39:00Znenolod$
preferences.h
Go to the documentation of this file.
00001 /*  Audacious - Cross-platform multimedia player
00002  *  Copyright (C) 2008  Audacious development team.
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; under version 3 of the License.
00007  *
00008  *  This program is distributed in the hope that it will be useful,
00009  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  *  GNU General Public License for more details.
00012  *
00013  *  You should have received a copy of the GNU General Public License
00014  *  along with this program.  If not, see <http://www.gnu.org/licenses>.
00015  *
00016  *  The Audacious team does not consider modular code linking to
00017  *  Audacious or using our public API to be a derived work.
00018  */
00019 
00020 #ifndef AUDACIOUS_PREFERENCES_H
00021 #define AUDACIOUS_PREFERENCES_H
00022 
00023 #include <glib.h>
00024 #include <audacious/types.h>
00025 
00026 typedef enum {
00027     WIDGET_NONE,
00028     WIDGET_CHK_BTN,
00029     WIDGET_LABEL,
00030     WIDGET_RADIO_BTN,
00031     WIDGET_SPIN_BTN,
00032     WIDGET_CUSTOM,           /* 'custom' widget, you hand back the widget you want to add --nenolod */
00033     WIDGET_FONT_BTN,
00034     WIDGET_TABLE,
00035     WIDGET_ENTRY,
00036     WIDGET_COMBO_BOX,
00037     WIDGET_BOX,
00038     WIDGET_NOTEBOOK,
00039     WIDGET_SEPARATOR,
00040 } WidgetType;
00041 
00042 typedef enum {
00043     VALUE_INT,
00044     VALUE_FLOAT,
00045     VALUE_BOOLEAN,
00046     VALUE_STRING,
00047     VALUE_NULL,
00048 } ValueType;
00049 
00050 typedef struct {
00051     gpointer value;
00052     const gchar *label;
00053 } ComboBoxElements;
00054 
00055 struct _NotebookTab;
00056 
00057 struct _PreferencesWidget {
00058     WidgetType type;         /* widget type */
00059     char *label;             /* widget title (for SPIN_BTN it's text left to widget) */
00060     gpointer cfg;            /* connected config value */
00061     void (*callback) (void); /* this func will be called after value change, can be NULL */
00062     char *tooltip;           /* widget tooltip, can be NULL */
00063     gboolean child;
00064     union {
00065         struct {
00066             gdouble min, max, step;
00067             char *right_label;      /* text right to widget */
00068         } spin_btn;
00069 
00070         struct {
00071             struct _PreferencesWidget *elem;
00072             gint rows;
00073         } table;
00074 
00075         struct {
00076             char *stock_id;
00077             gboolean single_line; /* FALSE to enable line wrap */
00078         } label;
00079 
00080         struct {
00081             char *title;
00082         } font_btn;
00083 
00084         struct {
00085             gboolean password;
00086         } entry;
00087 
00088         struct {
00089             ComboBoxElements *elements;
00090             gint n_elements;
00091             gboolean enabled;
00092         } combo;
00093 
00094         struct {
00095             struct _PreferencesWidget *elem;
00096             gint n_elem;
00097 
00098             gboolean horizontal;  /* FALSE gives vertical, TRUE gives horizontal aligment of child widgets */
00099             gboolean frame;       /* whether to draw frame around box */
00100         } box;
00101 
00102         struct {
00103             struct _NotebookTab *tabs;
00104             gint n_tabs;
00105         } notebook;
00106 
00107         struct {
00108             gboolean horizontal; /* FALSE gives vertical, TRUE gives horizontal separator */
00109         } separator;
00110 
00111         /* for WIDGET_CUSTOM --nenolod */
00112         /* GtkWidget * (* populate) (void); */
00113         void * (* populate) (void);
00114     } data;
00115     ValueType cfg_type;      /* connected value type */
00116 };
00117 
00118 typedef struct _NotebookTab {
00119     gchar *name;
00120     PreferencesWidget *settings;
00121     gint n_settings;
00122 } NotebookTab;
00123 
00124 typedef enum {
00125     PREFERENCES_WINDOW,  /* displayed in seperate window */
00126 } PreferencesType;
00127 
00128 struct _PluginPreferences {
00129     const gchar * domain;
00130     const gchar * title;
00131     const gchar * imgurl;
00132 
00133     PreferencesWidget *prefs;
00134     gint n_prefs;
00135 
00136     PreferencesType type;
00137 
00138     void (*init)(void);
00139     void (*apply)(void);
00140     void (*cancel)(void);
00141     void (*cleanup)(void);
00142 
00143     gpointer data;    /* for internal interface use only */
00144 };
00145 
00146 #endif /* AUDACIOUS_PREFERENCES_H */