changeset 31641:ab33554f97d2

fix another error introduced in changeset ad014fc78bd6 * gui-settings.cc (gui_settings::config_icon_theme): Use value of global_all_icon_themes from settings if it exists.
author John W. Eaton <jwe@octave.org>
date Tue, 06 Dec 2022 11:10:48 -0500
parents e518e1f7e944
children 91680d96c860
files libgui/src/gui-settings.cc
diffstat 1 files changed, 19 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/gui-settings.cc	Mon Dec 05 10:17:17 2022 -0500
+++ b/libgui/src/gui-settings.cc	Tue Dec 06 11:10:48 2022 -0500
@@ -135,27 +135,32 @@
 
   void gui_settings::config_icon_theme (void)
   {
-    int theme = global_icon_theme_index.def.toInt ();
+    int theme_index;
 
-    // check for new and old setting and use old if required
-    if (! contains (global_icon_theme_index.key))
+    if (contains (global_icon_theme_index.key))
+      theme_index = value (global_icon_theme_index).toInt ();
+    else
       {
-        // new pref does not exist
+        // New pref does not exist.  Use old if required.  Add new and
+        // remove deprecated key.
+
         if (value (global_icon_theme).toBool ())
-          theme = ICON_THEME_SYSTEM;
+          theme_index = ICON_THEME_SYSTEM;
         else
-          theme = ICON_THEME_OCTAVE;
-        setValue (global_icon_theme_index.key, theme);  // add new
-        remove (global_icon_theme.key); // remove deprecated key
+          theme_index = ICON_THEME_OCTAVE;
+
+        setValue (global_icon_theme_index.key, theme_index);
+        remove (global_icon_theme.key);
       }
 
-   QIcon::setThemeName (global_all_icon_themes.at (theme));
+    QIcon::setThemeName (global_all_icon_themes.at (theme_index));
 
-   QStringList icon_fallbacks;
+    QStringList icon_fallbacks;
 
-   // set the required fallback search paths
-   switch (theme)
-    {
+    // Set the required fallback search paths.
+
+    switch (theme_index)
+      {
       case ICON_THEME_SYSTEM:
         icon_fallbacks << global_icon_paths.at (ICON_THEME_OCTAVE);
         icon_fallbacks << global_icon_paths.at (ICON_THEME_TANGO);
@@ -166,7 +171,7 @@
       case ICON_THEME_OCTAVE:
         icon_fallbacks << global_icon_paths.at (ICON_THEME_TANGO);
         break;
-    }
+      }
 
     icon_fallbacks << global_icon_paths.at (ICON_THEME_CURSORS);