comparison src/skins/plugin.c @ 2572:d0daee216c8d

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