# HG changeset patch
# User Darren Salt <[EMAIL PROTECTED]>
# Date 1170806476 0
# Node ID 556693380139627a62ffcde565febc1c430dee66
# Parent  d108e0381f76cc5f7968d90ce467e2f712788344
Fix configuration issues wrt changed defaults when upgrading from 0.5.x.
This requires use of some xine-lib internals - for details, see
src/utils.c:config_update_default.

diff -r 556693380139627a62ffcde565febc1c430dee66 -r 
d108e0381f76cc5f7968d90ce467e2f712788344 src/globals.h
--- a/src/globals.h     Wed Feb 07 00:01:16 2007 +0000
+++ b/src/globals.h     Tue Feb 06 23:45:13 2007 +0000
@@ -40,6 +40,16 @@
 #include "info_widgets.h"
 
 #include "defs.h"
+
+typedef enum {
+  CONFIG_VERSION_BASE,
+  CONFIG_VERSION_0_6_0,
+  CONFIG_VERSION_CURRENT = CONFIG_VERSION_0_6_0
+} config_version_t;
+
+extern int config_version;
+#define CONFIG_VERSION_ATLEAST(EPOCH, MAJOR, MINOR) \
+  (config_version >= CONFIG_VERSION_##EPOCH##_##MAJOR##_##MINOR)
 
 extern GtkWidget      *app;
 extern GtkWidget      *gtv; /* GtkVideo widget */
diff -r 556693380139627a62ffcde565febc1c430dee66 -r 
d108e0381f76cc5f7968d90ce467e2f712788344 src/player.c
--- a/src/player.c      Wed Feb 07 00:01:16 2007 +0000
+++ b/src/player.c      Tue Feb 06 23:45:13 2007 +0000
@@ -1190,11 +1190,12 @@ void player_init (void)
        _("The main window's default size"),
        NULL, 0, NULL, NULL);
     xine_config_register_bool
-      (xine, "gui.magnify_lowres_video", 1,
+      (xine, "gui.magnify_lowres_video", CONFIG_VERSION_ATLEAST (0, 6, 0),
        _("Double the size of small video streams"),
        _("This affects video streams whose dimensions are at most ⅓ "
         "of those of the display."),
-       0, gtk_true, NULL);
+       0, gtk_true, NULL);       
+    config_update_default ("gui.magnify_lowres_video", 1);
     xine_config_register_bool
       (xine, "gui.subtitle_autoload", 1,
        _("Subtitle autoloading"),
diff -r 556693380139627a62ffcde565febc1c430dee66 -r 
d108e0381f76cc5f7968d90ce467e2f712788344 src/ui.c
--- a/src/ui.c  Wed Feb 07 00:01:16 2007 +0000
+++ b/src/ui.c  Tue Feb 06 23:45:13 2007 +0000
@@ -42,6 +42,8 @@
  * Playback status
  * UI button & adjustment handling
  */
+
+int config_version = 0;
 
 gboolean no_recursion = FALSE;
 
@@ -716,6 +718,15 @@ void ui_preferences_register (xine_t *th
   const char **vis_labels, *const *vis_src;
   unsigned int i;
 
+  config_version = xine_config_register_num
+    (this, "misc.gxine_config", 0, "gxine internal", NULL, 32767, NULL, NULL);
+  xine_cfg_entry_t entry;
+  if (xine_config_lookup_entry (xine, "misc.gxine_config", &entry))
+  {
+    entry.num_value = CONFIG_VERSION_CURRENT;
+    xine_config_update_entry (xine, &entry);
+  }
+
   /* Register the experience level setting */
   xine_config_register_enum
     (this, "gui.experience_level", 0, experience_labels,
@@ -753,9 +764,10 @@ void ui_preferences_register (xine_t *th
      40, post_plugins_video_cb, CONFIG_DATA_NONE);
 
   xine_config_register_bool
-    (this, "gui.post_plugins.video_enable", 1,
+    (this, "gui.post_plugins.video_enable", CONFIG_VERSION_ATLEAST (0, 6, 0),
      _("Enable video post-processing at startup"), NULL,
      30, NULL, NULL);
+  config_update_default ("gui.post_plugins.video_enable", 1);
 
   xine_config_register_string
     (this, "gui.post_plugins.audio", "",
@@ -764,9 +776,10 @@ void ui_preferences_register (xine_t *th
      40, post_plugins_audio_cb, CONFIG_DATA_NONE);
 
   xine_config_register_bool
-    (this, "gui.post_plugins.audio_enable", 1,
+    (this, "gui.post_plugins.audio_enable", CONFIG_VERSION_ATLEAST (0, 6, 0),
      _("Enable audio post-processing at startup"), NULL,
      30, NULL, NULL);
+  config_update_default ("gui.post_plugins.audio_enable", 1);
 
   vis_src = xine_list_post_plugins_typed
              (xine, XINE_POST_TYPE_AUDIO_VISUALIZATION);
@@ -792,14 +805,16 @@ void ui_preferences_register (xine_t *th
      NULL, 0, NULL, NULL);
 
   xine_config_register_bool
-    (this, "gui.windowedmode_separate_toolbar", 1,
+    (this, "gui.windowedmode_separate_toolbar", CONFIG_VERSION_ATLEAST (0, 6, 
0),
      _("In windowed mode, whether the toolbar is in a separate window"), NULL,
      0, NULL, NULL);
+  config_update_default ("gui.windowedmode_separate_toolbar", 1);
 
   xine_config_register_bool
-    (this, "gui.windowedmode_unblank", 1,
+    (this, "gui.windowedmode_unblank", CONFIG_VERSION_ATLEAST (0, 6, 0),
      _("In windowed mode, prevent blanking when playing video"), NULL,
      0, NULL, NULL);
+  config_update_default ("gui.windowedmode_unblank", 1);
 
   xine_config_register_bool
     (this, "gui.show_splash", 1,
diff -r 556693380139627a62ffcde565febc1c430dee66 -r 
d108e0381f76cc5f7968d90ce467e2f712788344 src/utils.c
--- a/src/utils.c       Wed Feb 07 00:01:16 2007 +0000
+++ b/src/utils.c       Tue Feb 06 23:45:13 2007 +0000
@@ -555,3 +555,13 @@ const char *get_copyright_notice (void)
                                 2006);
   return copyright;
 }
+
+#include <xine/xine_internal.h>
+#include <xine/configfile.h>
+void config_update_default (const char *key, int value)
+{
+  /* warning: accesses xine internals */
+  cfg_entry_t *entry = xine->config->lookup_entry (xine->config, key);
+  if (entry)
+    entry->num_default = value;
+}
diff -r 556693380139627a62ffcde565febc1c430dee66 -r 
d108e0381f76cc5f7968d90ce467e2f712788344 src/utils.h
--- a/src/utils.h       Wed Feb 07 00:01:16 2007 +0000
+++ b/src/utils.h       Tue Feb 06 23:45:13 2007 +0000
@@ -104,4 +104,6 @@ void do_pending_events (void);
 
 const char *get_copyright_notice (void);
 
+void config_update_default (const char *key, int value);
+
 #endif

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Xine-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xine-cvslog

Reply via email to