Mercurial > audlegacy
annotate src/audacious/interface.c @ 4723:07b4e2a5eedb
commit initial version of InterfaceOps
author | Tomasz Mon <desowin@gmail.com> |
---|---|
date | Sun, 13 Jul 2008 12:50:31 +0200 |
parents | 48cdebc174ef |
children | 4e38324b5e9f |
rev | line source |
---|---|
4666
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
1 /* |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
2 * Audacious2 |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
3 * Copyright (c) 2008 William Pitcock <nenolod@dereferenced.org> |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
4 * |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
5 * This program is free software; you can redistribute it and/or modify |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
6 * it under the terms of the GNU General Public License as published by |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
7 * the Free Software Foundation; under version 3 of the License. |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
8 * |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
9 * This program is distributed in the hope that it will be useful, |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
12 * GNU General Public License for more details. |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
13 * |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
14 * You should have received a copy of the GNU General Public License |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
15 * along with this program. If not, see <http://www.gnu.org/licenses>. |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
16 * |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
17 * The Audacious team does not consider modular code linking to |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
18 * Audacious or using our public API to be a derived work. |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
19 */ |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
20 |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
21 #include <glib.h> |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
22 #include <mowgli.h> |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
23 |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
24 #include "interface.h" |
4723
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
25 #include "ui_fileopener.h" |
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
26 #include "ui_urlopener.h" |
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
27 #include "ui_preferences.h" |
4666
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
28 |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
29 static mowgli_dictionary_t *interface_dict_ = NULL; |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
30 |
4723
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
31 static InterfaceOps interface_ops = { |
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
32 .create_prefs_window = create_prefs_window, |
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
33 .show_prefs_window = show_prefs_window, |
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
34 .hide_prefs_window = hide_prefs_window, |
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
35 |
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
36 .filebrowser_show = run_filebrowser, |
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
37 .urlopener_show = show_add_url_window, |
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
38 }; |
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
39 |
4666
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
40 void |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
41 interface_register(Interface *i) |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
42 { |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
43 if (interface_dict_ == NULL) |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
44 interface_dict_ = mowgli_dictionary_create(g_ascii_strcasecmp); |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
45 |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
46 mowgli_dictionary_add(interface_dict_, i->id, i); |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
47 } |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
48 |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
49 void |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
50 interface_deregister(Interface *i) |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
51 { |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
52 g_return_if_fail(interface_dict_ != NULL); |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
53 |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
54 mowgli_dictionary_delete(interface_dict_, i->id); |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
55 } |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
56 |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
57 void |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
58 interface_run(Interface *i) |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
59 { |
4723
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
60 i->ops = &interface_ops; |
4666
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
61 i->init(); |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
62 } |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
63 |
4675 | 64 void |
65 interface_destroy(Interface *i) | |
66 { | |
67 if (i->fini != NULL) | |
68 i->fini(); | |
69 } | |
70 | |
4666
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
71 Interface * |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
72 interface_get(gchar *id) |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
73 { |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
74 if (interface_dict_ == NULL) |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
75 return NULL; |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
76 |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
77 return mowgli_dictionary_retrieve(interface_dict_, id); |
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
78 } |