annotate src/skins/plugin.c @ 2579:8fba3fbf1a0f

add vis and svis
author Tomasz Mon <desowin@gmail.com>
date Mon, 19 May 2008 18:05:54 +0200
parents c0b08527b121
children 9b4dfc007b87
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1 /*
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
2 * Audacious - a cross-platform multimedia player
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
3 * Copyright (c) 2008 Tomasz Moń
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
4 *
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation; under version 3 of the License.
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
8 *
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful,
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
12 * GNU General Public License for more details.
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
13 *
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
15 * along with this program. If not, see <http://www.gnu.org/licenses>.
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
16 *
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
17 * The Audacious team does not consider modular code linking to
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
18 * Audacious or using our public API to be a derived work.
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
19 */
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
20
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
21
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
22 #include "plugin.h"
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
23 #include "skins_cfg.h"
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
24 #include "ui_skin.h"
2579
8fba3fbf1a0f add vis and svis
Tomasz Mon <desowin@gmail.com>
parents: 2573
diff changeset
25 #include "ui_skinned_window.h"
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
26 #include <audacious/i18n.h>
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
27 #include <libintl.h>
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
28
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
29 #define PACKAGE "audacious-plugins"
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
30
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
31 GeneralPlugin skins_gp =
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
32 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
33 .description= "Audacious Skinned GUI",
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
34 .init = skins_init,
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
35 .about = skins_about,
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
36 .configure = skins_configure,
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
37 .cleanup = skins_cleanup
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
38 };
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
39
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
40 GeneralPlugin *skins_gplist[] = { &skins_gp, NULL };
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
41 SIMPLE_GENERAL_PLUGIN(skins, skins_gplist);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
42 GtkWidget *mainwin;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
43 skins_cfg_t * config = NULL;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
44 gboolean plugin_is_active = FALSE;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
45
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
46 void skins_init(void) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
47 plugin_is_active = TRUE;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
48 g_log_set_handler(NULL, G_LOG_LEVEL_WARNING, g_log_default_handler, NULL);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
49
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
50 config = skins_cfg_new();
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
51 skins_cfg_load(config);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
52
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
53 gint width, height;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
54
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
55 mainwin = ui_skinned_window_new("player");
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
56 gtk_window_set_title(GTK_WINDOW(mainwin), "Audacious");
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
57 gtk_window_set_role(GTK_WINDOW(mainwin), "player");
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
58 gtk_window_set_resizable(GTK_WINDOW(mainwin), FALSE);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
59
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
60
2573
c0b08527b121 allow loading compressed skins
Tomasz Mon <desowin@gmail.com>
parents: 2572
diff changeset
61 init_skins(config->skin);
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
62 width = aud_active_skin->properties.mainwin_width;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
63 height = aud_active_skin->properties.mainwin_height;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
64
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
65 gtk_widget_set_size_request(mainwin, width, height);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
66 gtk_widget_show_all(mainwin);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
67
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
68 return;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
69 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
70
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
71 void skins_cleanup(void) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
72 if (plugin_is_active == TRUE) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
73
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
74 if (config != NULL) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
75 skins_cfg_delete(config);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
76 config = NULL;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
77 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
78 gtk_widget_destroy(mainwin);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
79 skin_free(aud_active_skin);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
80 aud_active_skin = NULL;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
81 plugin_is_active = FALSE;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
82 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
83
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
84 return;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
85 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
86
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
87
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
88 void skins_configure(void) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
89 return;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
90 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
91
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
92 void skins_about(void) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
93 static GtkWidget* about_window = NULL;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
94
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
95 if (about_window) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
96 gtk_window_present(GTK_WINDOW(about_window));
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
97 return;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
98 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
99
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
100 about_window = audacious_info_dialog(_("About Skinned GUI"),
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
101 _("Copyright (c) 2008, by Tomasz Moń <desowin@gmail.com>\n\n"),
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
102 _("OK"), FALSE, NULL, NULL);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
103
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
104 g_signal_connect(G_OBJECT(about_window), "destroy", G_CALLBACK(gtk_widget_destroyed), &about_window);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
105 }