# HG changeset patch # User Tomasz Mon # Date 1215946231 -7200 # Node ID 07b4e2a5eedb54e9a4e173fc11b61cc9a2c142ed # Parent 1a13d88b72f394941840168a6318038c3dfc687e commit initial version of InterfaceOps diff -r 1a13d88b72f3 -r 07b4e2a5eedb src/audacious/interface.c --- a/src/audacious/interface.c Sun Jul 13 12:44:23 2008 +0200 +++ b/src/audacious/interface.c Sun Jul 13 12:50:31 2008 +0200 @@ -22,9 +22,21 @@ #include #include "interface.h" +#include "ui_fileopener.h" +#include "ui_urlopener.h" +#include "ui_preferences.h" static mowgli_dictionary_t *interface_dict_ = NULL; +static InterfaceOps interface_ops = { + .create_prefs_window = create_prefs_window, + .show_prefs_window = show_prefs_window, + .hide_prefs_window = hide_prefs_window, + + .filebrowser_show = run_filebrowser, + .urlopener_show = show_add_url_window, +}; + void interface_register(Interface *i) { @@ -42,13 +54,10 @@ mowgli_dictionary_delete(interface_dict_, i->id); } -/* - * TODO: - * - set up InterfaceOps struct for the Interface to use - */ void interface_run(Interface *i) { + i->ops = &interface_ops; i->init(); } diff -r 1a13d88b72f3 -r 07b4e2a5eedb src/audacious/interface.h --- a/src/audacious/interface.h Sun Jul 13 12:44:23 2008 +0200 +++ b/src/audacious/interface.h Sun Jul 13 12:50:31 2008 +0200 @@ -28,11 +28,24 @@ #ifndef __AUDACIOUS2_INTERFACE_H__ #define __AUDACIOUS2_INTERFACE_H__ +#include + typedef struct { + void (*create_prefs_window)(void); + void (*show_prefs_window)(void); + void (*hide_prefs_window)(void); + + void (*filebrowser_show)(gboolean play_button); + void (*urlopener_show)(void); +} InterfaceOps; + +typedef struct _Interface { gchar *id; /* simple ID like 'skinned' */ gchar *desc; /* description like 'Skinned Interface' */ gboolean (*init)(void); /* init UI */ gboolean (*fini)(void); /* shutdown UI */ + + InterfaceOps *ops; } Interface; void interface_register(Interface *i);