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 typedef enum {
00024     WIDGET_NONE,
00025     WIDGET_CHK_BTN,
00026     WIDGET_LABEL,
00027     WIDGET_RADIO_BTN,
00028     WIDGET_SPIN_BTN,
00029     WIDGET_CUSTOM,           /* 'custom' widget, you hand back the widget you want to add --nenolod */
00030     WIDGET_FONT_BTN,
00031     WIDGET_TABLE,
00032     WIDGET_ENTRY,
00033     WIDGET_COMBO_BOX,
00034     WIDGET_BOX,
00035     WIDGET_NOTEBOOK,
00036     WIDGET_SEPARATOR,
00037 } WidgetType;
00038 
00039 typedef enum {
00040     VALUE_INT,
00041     VALUE_FLOAT,
00042     VALUE_BOOLEAN,
00043     VALUE_STRING,
00044     VALUE_NULL,
00045 } ValueType;
00046 
00047 typedef struct {
00048     gpointer value;
00049     const char *label;
00050 } ComboBoxElements;
00051 
00052 struct _NotebookTab;
00053 
00054 struct _PreferencesWidget {
00055     WidgetType type;         /* widget type */
00056     char *label;             /* widget title (for SPIN_BTN it's text left to widget) */
00057     gpointer cfg;            /* connected config value */
00058     void (*callback) (void); /* this func will be called after value change, can be NULL */
00059     char *tooltip;           /* widget tooltip, can be NULL */
00060     bool_t child;
00061     ValueType cfg_type;      /* connected value type */
00062     const char * csect;     /* config file section */
00063     const char * cname;     /* config file key name */
00064 
00065     union {
00066         struct {
00067             double min, max, step;
00068             char *right_label;      /* text right to widget */
00069         } spin_btn;
00070 
00071         struct {
00072             struct _PreferencesWidget *elem;
00073             int rows;
00074         } table;
00075 
00076         struct {
00077             char *stock_id;
00078             bool_t single_line; /* FALSE to enable line wrap */
00079         } label;
00080 
00081         struct {
00082             char *title;
00083         } font_btn;
00084 
00085         struct {
00086             bool_t password;
00087         } entry;
00088 
00089         struct {
00090             ComboBoxElements *elements;
00091             int n_elements;
00092             bool_t enabled;
00093         } combo;
00094 
00095         struct {
00096             struct _PreferencesWidget *elem;
00097             int n_elem;
00098 
00099             bool_t horizontal;  /* FALSE gives vertical, TRUE gives horizontal aligment of child widgets */
00100             bool_t frame;       /* whether to draw frame around box */
00101         } box;
00102 
00103         struct {
00104             struct _NotebookTab *tabs;
00105             int n_tabs;
00106         } notebook;
00107 
00108         struct {
00109             bool_t horizontal; /* FALSE gives vertical, TRUE gives horizontal separator */
00110         } separator;
00111 
00112         /* for WIDGET_CUSTOM --nenolod */
00113         /* GtkWidget * (* populate) (void); */
00114         void * (* populate) (void);
00115     } data;
00116 };
00117 
00118 typedef struct _NotebookTab {
00119     char *name;
00120     PreferencesWidget *settings;
00121     int n_settings;
00122 } NotebookTab;
00123 
00124 typedef enum {
00125     PREFERENCES_WINDOW,  /* displayed in seperate window */
00126 } PreferencesType;
00127 
00128 struct _PluginPreferences {
00129     const char * domain;
00130     const char * title;
00131     const char * imgurl;
00132 
00133     PreferencesWidget *prefs;
00134     int 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 */