Mercurial > audlegacy-plugins
annotate src/skins/plugin.c @ 3052:95b34f46a231
Comment out MPEG2/MPEG4 determination using the variable id. It is not used anywhere. Code analysis run, unique ID 6nYoHM.
author | Tony Vroon <chainsaw@gentoo.org> |
---|---|
date | Sat, 18 Apr 2009 19:06:20 +0100 |
parents | 3134a0987162 |
children | 1ffcad5f406c |
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" |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
2592
diff
changeset
|
25 #include "ui_manager.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
2592
diff
changeset
|
26 #include "icons-stock.h" |
2633
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2608
diff
changeset
|
27 #include "ui_main_evlisteners.h" |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2608
diff
changeset
|
28 #include "ui_playlist_evlisteners.h" |
2971
3134a0987162
- changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2912
diff
changeset
|
29 #include <audlegacy/i18n.h> |
2572
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
30 #include <libintl.h> |
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
31 |
2675 | 32 gchar *skins_paths[SKINS_PATH_COUNT] = {}; |
33 | |
2816 | 34 Interface skins_interface = |
2572
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
35 { |
2762
22d73f09eecc
change GeneralPlugin to Interface plugin
Tomasz Mon <desowin@gmail.com>
parents:
2690
diff
changeset
|
36 .id = "skinned", |
22d73f09eecc
change GeneralPlugin to Interface plugin
Tomasz Mon <desowin@gmail.com>
parents:
2690
diff
changeset
|
37 .desc = "Audacious Skinned GUI", |
2572
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
38 .init = skins_init, |
2816 | 39 .fini = skins_cleanup |
2572
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
40 }; |
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
41 |
2816 | 42 SIMPLE_INTERFACE_PLUGIN("skinned", &skins_interface); |
2572
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
43 gboolean plugin_is_active = FALSE; |
2816 | 44 static GtkWidget *cfgdlg; |
2572
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
45 |
2675 | 46 static void skins_free_paths(void) { |
47 int i; | |
48 | |
2676
096aa996e4fa
clean some more stuff at skins_cleanup()
Tomasz Mon <desowin@gmail.com>
parents:
2675
diff
changeset
|
49 for (i = 0; i < SKINS_PATH_COUNT; i++) { |
2675 | 50 g_free(skins_paths[i]); |
2676
096aa996e4fa
clean some more stuff at skins_cleanup()
Tomasz Mon <desowin@gmail.com>
parents:
2675
diff
changeset
|
51 skins_paths[i] = NULL; |
2675 | 52 } |
53 } | |
54 | |
55 static void skins_init_paths() { | |
56 char *xdg_data_home; | |
57 char *xdg_cache_home; | |
58 | |
59 xdg_data_home = (getenv("XDG_DATA_HOME") == NULL | |
60 ? g_build_filename(g_get_home_dir(), ".local", "share", NULL) | |
61 : g_strdup(getenv("XDG_DATA_HOME"))); | |
62 xdg_cache_home = (getenv("XDG_CACHE_HOME") == NULL | |
63 ? g_build_filename(g_get_home_dir(), ".cache", NULL) | |
64 : g_strdup(getenv("XDG_CACHE_HOME"))); | |
65 | |
66 skins_paths[SKINS_PATH_USER_SKIN_DIR] = | |
67 g_build_filename(xdg_data_home, "audacious", "Skins", NULL); | |
68 skins_paths[SKINS_PATH_SKIN_THUMB_DIR] = | |
69 g_build_filename(xdg_cache_home, "audacious", "thumbs", NULL); | |
70 | |
71 g_free(xdg_data_home); | |
72 g_free(xdg_cache_home); | |
73 } | |
74 | |
2762
22d73f09eecc
change GeneralPlugin to Interface plugin
Tomasz Mon <desowin@gmail.com>
parents:
2690
diff
changeset
|
75 gboolean skins_init(void) { |
2572
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
76 plugin_is_active = TRUE; |
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
77 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
|
78 |
2675 | 79 skins_init_paths(); |
2582
9b4dfc007b87
use more local configuration options
Tomasz Mon <desowin@gmail.com>
parents:
2579
diff
changeset
|
80 skins_cfg_load(); |
2572
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
81 |
2844
d75f0db10f53
remove few not needed anymore #if 0
Tomasz Mon <desowin@gmail.com>
parents:
2816
diff
changeset
|
82 ui_main_check_theme_engine(); |
d75f0db10f53
remove few not needed anymore #if 0
Tomasz Mon <desowin@gmail.com>
parents:
2816
diff
changeset
|
83 |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
2592
diff
changeset
|
84 register_aud_stock_icons(); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
2592
diff
changeset
|
85 ui_manager_init(); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
2592
diff
changeset
|
86 ui_manager_create_menus(); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
2592
diff
changeset
|
87 |
2592
8f5999909416
add ui_main - with huge amount of #if 0 to sort out later
Tomasz Mon <desowin@gmail.com>
parents:
2582
diff
changeset
|
88 init_skins(config.skin); |
2765
ffb79e3d133a
fix segfault when starting with shaded windows
Tomasz Mon <desowin@gmail.com>
parents:
2762
diff
changeset
|
89 mainwin_setup_menus(); |
2572
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
90 |
2912 | 91 gint h_vol[2]; |
92 aud_input_get_volume(&h_vol[0], &h_vol[1]); | |
93 aud_hook_call("volume set", h_vol); | |
94 | |
2816 | 95 skins_interface.ops->create_prefs_window(); |
96 cfgdlg = skins_configure(); | |
97 aud_prefswin_page_new(cfgdlg, N_("Skinned Interface"), DATA_DIR "/images/appearance.png"); | |
98 | |
2793 | 99 aud_hook_call("create prefswin", NULL); |
100 | |
2635
b990e7eb0c25
save config on plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2633
diff
changeset
|
101 if (config.player_visible) mainwin_real_show(); |
b990e7eb0c25
save config on plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2633
diff
changeset
|
102 if (config.equalizer_visible) equalizerwin_show(TRUE); |
b990e7eb0c25
save config on plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2633
diff
changeset
|
103 if (config.playlist_visible) playlistwin_show(); |
2572
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
104 |
2762
22d73f09eecc
change GeneralPlugin to Interface plugin
Tomasz Mon <desowin@gmail.com>
parents:
2690
diff
changeset
|
105 g_message("Entering Gtk+ main loop!"); |
22d73f09eecc
change GeneralPlugin to Interface plugin
Tomasz Mon <desowin@gmail.com>
parents:
2690
diff
changeset
|
106 gtk_main(); |
22d73f09eecc
change GeneralPlugin to Interface plugin
Tomasz Mon <desowin@gmail.com>
parents:
2690
diff
changeset
|
107 |
22d73f09eecc
change GeneralPlugin to Interface plugin
Tomasz Mon <desowin@gmail.com>
parents:
2690
diff
changeset
|
108 return TRUE; |
2572
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
109 } |
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
110 |
2762
22d73f09eecc
change GeneralPlugin to Interface plugin
Tomasz Mon <desowin@gmail.com>
parents:
2690
diff
changeset
|
111 gboolean skins_cleanup(void) { |
2572
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
112 if (plugin_is_active == TRUE) { |
2872
469f7e596a20
hide widgets before performing skin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2859
diff
changeset
|
113 gtk_widget_hide(mainwin); |
469f7e596a20
hide widgets before performing skin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2859
diff
changeset
|
114 gtk_widget_hide(equalizerwin); |
469f7e596a20
hide widgets before performing skin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2859
diff
changeset
|
115 gtk_widget_hide(playlistwin); |
2635
b990e7eb0c25
save config on plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2633
diff
changeset
|
116 skins_cfg_save(); |
2859
312ba23cbb87
transform UiSkinnedButton into windowless widget
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
117 cleanup_skins(); |
2675 | 118 skins_free_paths(); |
2633
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2608
diff
changeset
|
119 ui_main_evlistener_dissociate(); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2608
diff
changeset
|
120 ui_playlist_evlistener_dissociate(); |
2582
9b4dfc007b87
use more local configuration options
Tomasz Mon <desowin@gmail.com>
parents:
2579
diff
changeset
|
121 skins_cfg_free(); |
2676
096aa996e4fa
clean some more stuff at skins_cleanup()
Tomasz Mon <desowin@gmail.com>
parents:
2675
diff
changeset
|
122 ui_manager_destroy(); |
2608
857910a58188
don't quit audacious if skins plugin gets unloaded
Tomasz Mon <desowin@gmail.com>
parents:
2602
diff
changeset
|
123 mainwin = NULL; |
857910a58188
don't quit audacious if skins plugin gets unloaded
Tomasz Mon <desowin@gmail.com>
parents:
2602
diff
changeset
|
124 equalizerwin = NULL; |
2637 | 125 playlistwin = NULL; |
126 mainwin_info = NULL; | |
2572
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
127 plugin_is_active = FALSE; |
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
128 } |
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
129 |
2762
22d73f09eecc
change GeneralPlugin to Interface plugin
Tomasz Mon <desowin@gmail.com>
parents:
2690
diff
changeset
|
130 gtk_main_quit(); |
22d73f09eecc
change GeneralPlugin to Interface plugin
Tomasz Mon <desowin@gmail.com>
parents:
2690
diff
changeset
|
131 |
22d73f09eecc
change GeneralPlugin to Interface plugin
Tomasz Mon <desowin@gmail.com>
parents:
2690
diff
changeset
|
132 return TRUE; |
2572
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
133 } |
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
134 |
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
135 void skins_about(void) { |
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
136 static GtkWidget* about_window = NULL; |
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
137 |
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
138 if (about_window) { |
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
139 gtk_window_present(GTK_WINDOW(about_window)); |
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
140 return; |
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
141 } |
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
142 |
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
143 about_window = audacious_info_dialog(_("About Skinned GUI"), |
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
144 _("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
|
145 _("OK"), FALSE, NULL, NULL); |
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
146 |
d0daee216c8d
stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
147 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
|
148 } |