The name of the 2 settings have been changed:
 - enable: MiniwindowApercuBalloons -> MiniwindowPreviewBalloons
 - size: ApercuSize -> MiniPreviewSize

The old name is still supported to avoid breaking user's configuration, but
WPrefs will update the setting to the new names when updating the
configuration.

Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>
---
 NEWS               |  9 +++++++++
 WPrefs.app/Icons.c | 38 +++++++++++++++++++++++++++--------
 src/defaults.c     | 58 +++++++++++++++++++++++++++++++++++++++++++-----------
 3 files changed, 86 insertions(+), 19 deletions(-)

diff --git a/NEWS b/NEWS
index 889d019..172c970 100644
--- a/NEWS
+++ b/NEWS
@@ -47,6 +47,15 @@ WPrefs.app, the option to "Open dialogs in the same 
workspace as their owners"
 ~/GNUstep/Defaults/WindowMaker) has been moved to "Expert User Preferences".
 
 
+Mini-Previews instead of Apercus
+--------------------------------
+
+Since the original name was not really clear because it is a French word that
+is rarely used by British people, it was decided to change it to the more usual
+Mini-Preview name. The setting is configurable with WPrefs in the Icon
+Preferences tab, the size is now expressed in pixels directly.
+
+
 --- 0.95.6
 
 More image format supported
diff --git a/WPrefs.app/Icons.c b/WPrefs.app/Icons.c
index d8e11ab..a58630a 100644
--- a/WPrefs.app/Icons.c
+++ b/WPrefs.app/Icons.c
@@ -198,13 +198,35 @@ static void showData(_Panel * panel)
        WMSetPopUpButtonSelectedItem(panel->sizeP, i);
 
        /* Mini-Previews for Icons */
-       b = GetBoolForKey("MiniwindowApercuBalloons");
-       if (b) {
-               i = GetIntegerForKey("ApercuSize");
-               if (i <= minipreview_minimum_size)
+
+       /*
+        * Backward Compatibility:
+        * These settings changed names after 0.95.6, so to avoid breaking 
user's
+        * config we still support the old names, and silently convert them to 
the
+        * new settings
+        * This hack should be kept for at least 2 years, that means >= 2017.
+        */
+       str = GetStringForKey("MiniwindowPreviewBalloons");
+       if (str != NULL) {
+               /* New names found, use them in priority */
+               b = GetBoolForKey("MiniwindowPreviewBalloons");
+               if (b) {
+                       i = GetIntegerForKey("MiniPreviewSize");
+                       if (i <= minipreview_minimum_size)
+                               i = minipreview_minimum_size;
+               } else {
                        i = minipreview_minimum_size;
+               }
        } else {
-               i = minipreview_minimum_size;
+               /* No new names, try the legacy names */
+               b = GetBoolForKey("MiniwindowApercuBalloons");
+               if (b) {
+                       i = GetIntegerForKey("ApercuSize");
+                       if (i <= minipreview_minimum_size)
+                               i = minipreview_minimum_size;
+               } else {
+                       i = minipreview_minimum_size;
+               }
        }
        WMSetSliderValue(panel->minipreview.slider, i);
        minipreview_slider_changed(panel->minipreview.slider, panel);
@@ -431,9 +453,9 @@ static void storeData(_Panel * panel)
 
        i = WMGetSliderValue(panel->minipreview.slider);
        if (i <= minipreview_minimum_size) {
-               SetBoolForKey(False, "MiniwindowApercuBalloons");
+               SetBoolForKey(False, "MiniwindowPreviewBalloons");
        } else {
-               SetBoolForKey(True, "MiniwindowApercuBalloons");
+               SetBoolForKey(True, "MiniwindowPreviewBalloons");
                if (i < minipreview_maximum_size) {
                        /*
                         * If the value is bigger, it means it was edited by 
the user manually
@@ -442,7 +464,7 @@ static void storeData(_Panel * panel)
                         */
                        i &= ~7;
                }
-               SetIntegerForKey(i, "ApercuSize");
+               SetIntegerForKey(i, "MiniPreviewSize");
        }
 
        for (i = 0; i < wlengthof(icon_animation); i++) {
diff --git a/src/defaults.c b/src/defaults.c
index a6bffeb..ee027dc 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -319,6 +319,17 @@ static WOptionEnumeration seDragMaximizedWindow[] = {
 };
 
 /*
+ * Backward Compatibility:
+ * The Mini-Previews were introduced in 0.95.6 under the name "Apercu".
+ * For compatibility, we still support the old names in configuration files,
+ * which are loaded in this structure, so this should stay for at least
+ * 2 years (that means until 2017) */
+static struct {
+       char enable;
+       int  size;
+} legacy_minipreview_config;
+
+/*
  * ALL entries in the tables bellow, NEED to have a default value
  * defined, and this value needs to be correct.
  */
@@ -485,7 +496,7 @@ WDefaultEntry optionList[] = {
            &wPreferences.window_balloon, getBool, NULL, NULL, NULL},
        {"MiniwindowTitleBalloons", "NO", NULL,
            &wPreferences.miniwin_title_balloon, getBool, NULL, NULL, NULL},
-       {"MiniwindowApercuBalloons", "NO", NULL,
+       {"MiniwindowPreviewBalloons", "NO", NULL,
            &wPreferences.miniwin_preview_balloon, getBool, NULL, NULL, NULL},
        {"AppIconBalloons", "NO", NULL,
            &wPreferences.appicon_balloon, getBool, NULL, NULL, NULL},
@@ -505,9 +516,20 @@ WDefaultEntry optionList[] = {
            &wPreferences.strict_windoze_cycle, getBool, NULL, NULL, NULL},
        {"SwitchPanelOnlyOpen", "NO",   NULL,
            &wPreferences.panel_only_open, getBool, NULL, NULL, NULL},
-       {"ApercuSize", "128", NULL,
+       {"MiniPreviewSize", "128", NULL,
            &wPreferences.minipreview_size, getInt, NULL, NULL, NULL},
 
+       /*
+        * Backward Compatibility:
+        * The Mini-Previews were introduced in 0.95.6 under the name "Apercu".
+        * For compatibility, we still support the old names in configuration 
files,
+        * so this should stay for at least 2 years (that means until 2017)
+        */
+       {"MiniwindowApercuBalloons", "NO", NULL,
+           &legacy_minipreview_config.enable, getBool, NULL, NULL, NULL},
+       {"ApercuSize", "128", NULL,
+           &legacy_minipreview_config.size, getInt, NULL, NULL, NULL},
+
        /* style options */
 
        {"MenuStyle", "normal", seMenuStyles,
@@ -1131,6 +1153,10 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
        void *tdata;
        WMPropList *old_dict = (w_global.domain.wmaker->dictionary != new_dict 
? w_global.domain.wmaker->dictionary : NULL);
 
+       /* Backward Compatibility: init array to special value to detect if 
they changed */
+       legacy_minipreview_config.enable = 99;
+       legacy_minipreview_config.size   = -1;
+
        needs_refresh = 0;
 
        for (i = 0; i < wlengthof(optionList); i++) {
@@ -1190,18 +1216,28 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
 
        /*
         * Backward Compatibility:
-        * the option 'minipreview_size' used to be coded as a multiple of the 
icon size in v0.95.6
-        * it is now expressed directly in pixels, but to avoid breaking user's 
setting we check
-        * for old coding and convert it now.
+        * Support the old setting names for Apercu, now called Mini-Preview
+        *
         * This code should probably stay for at least 2 years, you should not 
consider removing
         * it before year 2017
         */
-       if (wPreferences.minipreview_size < 24) {
-               /* 24 is the minimum icon size proposed in WPref's settings */
-               wPreferences.minipreview_size *= wPreferences.icon_size;
-               if (wPreferences.miniwin_preview_balloon)
-                       wwarning(_("your ApercuSize setting is using old 
syntax, it is converted to %d pixels; consider running WPrefs.app to update 
your settings"),
-                                wPreferences.minipreview_size);
+       if (legacy_minipreview_config.enable != 99) {
+               wwarning(_("your configuration is using old syntax for 
Mini-Preview settings; consider running WPrefs.app to update"));
+               wPreferences.miniwin_preview_balloon = 
legacy_minipreview_config.enable;
+
+               if (legacy_minipreview_config.size >= 0) {
+                       /*
+                        * the option 'ApercuSize' used to be coded as a 
multiple of the icon size in v0.95.6
+                        * it is now expressed directly in pixels, but to avoid 
breaking user's setting we check
+                        * for old coding and convert it now.
+                        */
+                       if (legacy_minipreview_config.size < 24) {
+                               /* 24 is the minimum icon size proposed in 
WPref's settings */
+                               wPreferences.minipreview_size = 
legacy_minipreview_config.size * wPreferences.icon_size;
+                       } else {
+                               wPreferences.minipreview_size = 
legacy_minipreview_config.size;
+                       }
+               }
        }
 
        if (needs_refresh != 0 && !scr->flags.startup) {
-- 
2.1.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to