changeset 2635:b990e7eb0c25

save config on plugin cleanup
author Tomasz Mon <desowin@gmail.com>
date Fri, 23 May 2008 11:50:18 +0200
parents 43a07a0607da
children 1aa52f6d547a
files src/skins/plugin.c src/skins/plugin.h src/skins/skins_cfg.c src/skins/ui_skinned_textbox.c
diffstat 4 files changed, 11 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/skins/plugin.c	Thu May 22 21:42:31 2008 +0200
+++ b/src/skins/plugin.c	Fri May 23 11:50:18 2008 +0200
@@ -59,13 +59,16 @@
 
     init_skins(config.skin);
 
-    mainwin_real_show();
+    if (config.player_visible) mainwin_real_show();
+    if (config.equalizer_visible) equalizerwin_show(TRUE);
+    if (config.playlist_visible) playlistwin_show();
 
     return;
 }
 
 void skins_cleanup(void) {
     if (plugin_is_active == TRUE) {
+        skins_cfg_save();
         ui_main_evlistener_dissociate();
         ui_playlist_evlistener_dissociate();
         skins_cfg_free();
--- a/src/skins/plugin.h	Thu May 22 21:42:31 2008 +0200
+++ b/src/skins/plugin.h	Fri May 23 11:50:18 2008 +0200
@@ -26,6 +26,8 @@
 #include "skins_cfg.h"
 #include "ui_main.h"
 #include "ui_equalizer.h"
+#include "ui_playlist.h"
+#include "ui_skin.h"
 
 #define PACKAGE_NAME "audacious-plugins"
 
--- a/src/skins/skins_cfg.c	Thu May 22 21:42:31 2008 +0200
+++ b/src/skins/skins_cfg.c	Fri May 23 11:50:18 2008 +0200
@@ -167,23 +167,15 @@
 void skins_cfg_load() {
     mcs_handle_t *cfgfile = aud_cfg_db_open();
 
-  /* if (!aud_cfg_db_get_int(cfgfile, "skins", "field_name", &(cfg->where)))
-         cfg->where = default value
-     if (!aud_cfg_db_get_string(cfgfile, "skins", "field_name", &(cfg->where)))
-         cfg->where = g_strdup("defaul");
-     if (!aud_cfg_db_get_bool(cfgfile, "skins", "field_name", &(cfg->where)))
-         cfg->where = FALSE / TRUE;
-  */
-  
     memcpy(&config, &skins_default_config, sizeof(skins_cfg_t));
     int i;
-    
+
     for (i = 0; i < ncfgbent; ++i) {
         aud_cfg_db_get_bool(cfgfile, "skins",
                             skins_boolents[i].be_vname,
                             skins_boolents[i].be_vloc);
     }
-    
+
     for (i = 0; i < ncfgient; ++i) {
         aud_cfg_db_get_int(cfgfile, "skins",
                            skins_numents[i].ie_vname,
@@ -200,16 +192,9 @@
 }
 
 
-void skins_cfg_save(skins_cfg_t * cfg) {
+void skins_cfg_save() {
     mcs_handle_t *cfgfile = aud_cfg_db_open();
 
-/*
-    aud_cfg_db_set_int(cfgfile, "skins", "field_name", cfg->where);
-    aud_cfg_db_set_string(cfgfile, "skins", "field_name", cfg->where);
-    aud_cfg_db_set_bool(cfgfile, "skins", "field_name", cfg->where);
-*/
-    aud_cfg_db_set_string(cfgfile, "skins", "skin", cfg->skin);
-
     int i;
 
     for (i = 0; i < ncfgbent; ++i)
--- a/src/skins/ui_skinned_textbox.c	Thu May 22 21:42:31 2008 +0200
+++ b/src/skins/ui_skinned_textbox.c	Fri May 23 11:50:18 2008 +0200
@@ -707,6 +707,8 @@
 
 void ui_skinned_textbox_set_scroll(GtkWidget *widget, gboolean scroll) {
     g_return_if_fail(widget != NULL);
+    g_return_if_fail(UI_SKINNED_IS_TEXTBOX(widget));
+
     UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX(widget);
     UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox);