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_CFG_BOOLEAN,   /* cfg holds config database key for bool option */
00048     VALUE_CFG_STRING,    /* cfg holds config database key for gchar* option */
00049     VALUE_NULL,
00050 } ValueType;
00051 
00052 typedef struct {
00053     gpointer value;
00054     const gchar *label;
00055 } ComboBoxElements;
00056 
00057 struct _NotebookTab;
00058 
00059 struct _PreferencesWidget {
00060     WidgetType type;         /* widget type */
00061     char *label;             /* widget title (for SPIN_BTN it's text left to widget) */
00062     gpointer cfg;            /* connected config value */
00063     void (*callback) (void); /* this func will be called after value change, can be NULL */
00064     char *tooltip;           /* widget tooltip, can be NULL */
00065     gboolean child;
00066     union {
00067         struct {
00068             gdouble min, max, step;
00069             char *right_label;      /* text right to widget */
00070         } spin_btn;
00071 
00072         struct {
00073             struct _PreferencesWidget *elem;
00074             gint rows;
00075         } table;
00076 
00077         struct {
00078             char *stock_id;
00079             gboolean single_line; /* FALSE to enable line wrap */
00080         } label;
00081 
00082         struct {
00083             char *title;
00084         } font_btn;
00085 
00086         struct {
00087             gboolean password;
00088         } entry;
00089 
00090         struct {
00091             ComboBoxElements *elements;
00092             gint n_elements;
00093             gboolean enabled;
00094         } combo;
00095 
00096         struct {
00097             struct _PreferencesWidget *elem;
00098             gint n_elem;
00099 
00100             gboolean horizontal;  /* FALSE gives vertical, TRUE gives horizontal aligment of child widgets */
00101             gboolean frame;       /* whether to draw frame around box */
00102         } box;
00103 
00104         struct {
00105             struct _NotebookTab *tabs;
00106             gint n_tabs;
00107         } notebook;
00108 
00109         struct {
00110             gboolean horizontal; /* FALSE gives vertical, TRUE gives horizontal separator */
00111         } separator;
00112 
00113         /* for WIDGET_CUSTOM --nenolod */
00114         /* GtkWidget * (* populate) (void); */
00115         void * (* populate) (void);
00116     } data;
00117     ValueType cfg_type;      /* connected value type */
00118 };
00119 
00120 typedef struct _NotebookTab {
00121     gchar *name;
00122     PreferencesWidget *settings;
00123     gint n_settings;
00124 } NotebookTab;
00125 
00126 typedef enum {
00127     PREFERENCES_WINDOW,  /* displayed in seperate window */
00128 } PreferencesType;
00129 
00130 struct _PluginPreferences {
00131     gchar *title;
00132     gchar *imgurl;        /* Optional */
00133 
00134     PreferencesWidget *prefs;
00135     gint n_prefs;
00136 
00137     PreferencesType type;
00138 
00139     void (*init)(void);
00140     void (*apply)(void);
00141     void (*cancel)(void);
00142     void (*cleanup)(void);
00143 
00144     gpointer data;    /* for internal interface use only */
00145 };
00146 
00147 #endif /* AUDACIOUS_PREFERENCES_H */