changeset 4723:07b4e2a5eedb

commit initial version of InterfaceOps
author Tomasz Mon <desowin@gmail.com>
date Sun, 13 Jul 2008 12:50:31 +0200
parents 1a13d88b72f3
children 8817a9fd9b5e
files src/audacious/interface.c src/audacious/interface.h
diffstat 2 files changed, 26 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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 <mowgli.h>
 
 #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();
 }
 
--- 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 <gtk/gtk.h>
+
 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);