Mercurial > audlegacy
annotate src/audacious/interface.c @ 4725:4e38324b5e9f
add copyright line
| author | Tomasz Mon <desowin@gmail.com> |
|---|---|
| date | Sun, 13 Jul 2008 13:07:27 +0200 |
| parents | 07b4e2a5eedb |
| children | ad06ffc54c23 |
| 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> |
| 4725 | 4 * Copyright (c) 2008 Tomasz Moń <desowin@gmail.com> |
|
4666
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
5 * |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
6 * 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
|
7 * 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
|
8 * the Free Software Foundation; under version 3 of the License. |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
9 * |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
10 * 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
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
13 * GNU General Public License for more details. |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
14 * |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
15 * 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
|
16 * 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
|
17 * |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
18 * The Audacious team does not consider modular code linking to |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
19 * Audacious or using our public API to be a derived work. |
|
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 |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
22 #include <glib.h> |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
23 #include <mowgli.h> |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
24 |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
25 #include "interface.h" |
|
4723
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
26 #include "ui_fileopener.h" |
|
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
27 #include "ui_urlopener.h" |
|
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
28 #include "ui_preferences.h" |
|
4666
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
29 |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
30 static mowgli_dictionary_t *interface_dict_ = NULL; |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
31 |
|
4723
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
32 static InterfaceOps interface_ops = { |
|
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
33 .create_prefs_window = create_prefs_window, |
|
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
34 .show_prefs_window = show_prefs_window, |
|
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
35 .hide_prefs_window = hide_prefs_window, |
|
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
36 |
|
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
37 .filebrowser_show = run_filebrowser, |
|
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
38 .urlopener_show = show_add_url_window, |
|
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
39 }; |
|
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
40 |
|
4666
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
41 void |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
42 interface_register(Interface *i) |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
43 { |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
44 if (interface_dict_ == NULL) |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
45 interface_dict_ = mowgli_dictionary_create(g_ascii_strcasecmp); |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
46 |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
47 mowgli_dictionary_add(interface_dict_, i->id, i); |
|
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 |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
50 void |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
51 interface_deregister(Interface *i) |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
52 { |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
53 g_return_if_fail(interface_dict_ != NULL); |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
54 |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
55 mowgli_dictionary_delete(interface_dict_, i->id); |
|
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 |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
58 void |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
59 interface_run(Interface *i) |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
60 { |
|
4723
07b4e2a5eedb
commit initial version of InterfaceOps
Tomasz Mon <desowin@gmail.com>
parents:
4675
diff
changeset
|
61 i->ops = &interface_ops; |
|
4666
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
62 i->init(); |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
63 } |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
64 |
| 4675 | 65 void |
| 66 interface_destroy(Interface *i) | |
| 67 { | |
| 68 if (i->fini != NULL) | |
| 69 i->fini(); | |
| 70 } | |
| 71 | |
|
4666
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
72 Interface * |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
73 interface_get(gchar *id) |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
74 { |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
75 if (interface_dict_ == NULL) |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
76 return NULL; |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
77 |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
78 return mowgli_dictionary_retrieve(interface_dict_, id); |
|
742abc97b3ab
Add preliminary Interface API.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
79 } |
