[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [qtcurve] gtk2/style: A modification after #e3e2325e8d7a2170e054ca4dee6941ba98250c7d intro-
From:       René J.V. Bertin <rjvbertin () gmail ! com>
Date:       2016-10-31 17:56:04
Message-ID: E1c1GoW-00030w-NI () code ! kde ! org
[Download RAW message or body]

Git commit 438553dfa702c43240257fe61935c9ab10563cc2 by René J.V. Bertin.
Committed on 31/10/2016 at 17:55.
Pushed by rjvbb into branch 'master'.

A modification after #e3e2325e8d7a2170e054ca4dee6941ba98250c7d intro-
duced a regression that caused the GTk2 style to ignore certain
settings like whether buttons should have icons. It seems this was
caused simply because readKdeGlobals() overwrote settings read from
a kdeglobals file found in a previous location if it doesn't exist in
a possible location specified subsequently. This patch prevents that
by applying the defaults only once, when the function's <first> option
is true.
In addition it introduces functions to provide the path to the KDE4 and
KF5 versions of the kdeglobals file, and sends any debug output to
stderr,

M  +25   -10   gtk2/style/qt_settings.cpp

http://commits.kde.org/qtcurve/438553dfa702c43240257fe61935c9ab10563cc2

diff --git a/gtk2/style/qt_settings.cpp b/gtk2/style/qt_settings.cpp
index cb079fc..303c148 100644
--- a/gtk2/style/qt_settings.cpp
+++ b/gtk2/style/qt_settings.cpp
@@ -67,7 +67,9 @@ getKdeHome()
         if ((res = getenv(getuid() ? "KDEHOME" : "KDEROOTHOME"))) {
             return strdup(res);
         }
-        return Str::cat(getHome(), ".kde4");
+        // according to kdecore/kernel/kstandarddirs.h, ~/.kde is the default for \
KDEHOME +        // distributions using the default should not have to patch this \
code. +        return Str::cat(getHome(), ".kde");
     };
     return dir.get();
 }
@@ -80,12 +82,19 @@ kdeFile(const char *f)
 }
 
 static const char*
-kdeGlobals()
+kde4Globals()
 {
     return kdeFile(KDEGLOBALS_FILE);
 }
 
 static const char*
+kde5Globals()
+{
+    static Str::Buff<1024> buff;
+    return buff.cat(getHome(), ".config/", KDEGLOBALS_FILE);;
+}
+
+static const char*
 kwinrc()
 {
     return kdeFile("kwinrc");
@@ -460,7 +469,7 @@ setFont(QtFontDetails *font, int f)
                 weightStr(WEIGHT_BOLD), italicStr(font->italic), font->size);
     }
     if (qtSettings.debug) {
-        printf(DEBUG_PREFIX"Font[%d] - %s\n", f, qtSettings.fonts[f]);
+        fprintf(stderr, DEBUG_PREFIX"Font[%d] - %s\n", f, qtSettings.fonts[f]);
     }
 }
 
@@ -492,7 +501,7 @@ static void readKwinrc()
         char line[MAX_CONFIG_INPUT_LINE_LEN + 1];
 
         if (qtSettings.debug)
-            printf(DEBUG_PREFIX "Reading kwinrc\n");
+            fprintf(stderr, DEBUG_PREFIX "Reading kwinrc\n");
 
         while(nullptr!=fgets(line, MAX_CONFIG_INPUT_LINE_LEN, f))
             if(line[0]=='[')
@@ -574,7 +583,7 @@ static void readKdeGlobals(const char *rc, int rd, bool first)
         int section=SECT_NONE;
 
         if(qtSettings.debug)
-            printf(DEBUG_PREFIX"Reading kdeglobals - %s\n", rc);
+            fprintf(stderr, DEBUG_PREFIX"Reading kdeglobals - %s\n", rc);
 
         while(found!=rd && nullptr!=fgets(line, MAX_CONFIG_INPUT_LINE_LEN, f))
             if(line[0]=='[')
@@ -829,6 +838,11 @@ static void readKdeGlobals(const char *rc, int rd, bool first)
 
         fclose(f);
     }
+    else if (!first)
+    {
+        // don't repeat the settings below, as that would probably override settings \
read from file. +        return;
+    }
 
     int eff = 0;
     double contrast = 0.1 * opts.contrast;
@@ -996,7 +1010,7 @@ getIconPath()
     }
     buff.append("\"");
     if (qtSettings.debug) {
-        printf(DEBUG_PREFIX "%s\n", buff.get());
+        fprintf(stderr, DEBUG_PREFIX "%s\n", buff.get());
     }
     return buff.get();
 }
@@ -1134,7 +1148,8 @@ qtSettingsInit()
                                  QTC_KDE4_PREFIX KDE4_SYS_CFG_DIR KDEGLOBALS_FILE,
                                  QTC_KDE4_PREFIX KDE4_SYS_CFG_DIR
                                  KDEGLOBALS_SYS_FILE,
-                                 kdeGlobals(),
+                                 kde4Globals(),
+                                 kde5Globals(),
                                  nullptr};
 
             for(f=0; 0!=files[f]; ++f)
@@ -1231,7 +1246,7 @@ qtSettingsInit()
             }
 
             if(qtSettings.debug)
-                printf(DEBUG_PREFIX"Application name: \"%s\"\n", qtSettings.appName \
? qtSettings.appName : "<unknown>"); +                fprintf(stderr, \
DEBUG_PREFIX"Application name: \"%s\"\n", qtSettings.appName ? qtSettings.appName : \
"<unknown>");  
             /* Eclipse sets a application name, so if this is set then we're not a \
                Swing java app */
             if(GTK_APP_JAVA==qtSettings.app && g_get_application_name() && \
0!=strcmp(g_get_application_name(), "<unknown>")) @@ -1429,10 +1444,10 @@ \
                qtSettingsInit()
                     g_object_set(settings, "gtk-font-name", \
qtSettings.fonts[FONT_GENERAL], nullptr);  
                 gtk_settings_set_long_property(settings, "gtk-toolbar-style", \
                qtSettings.toolbarStyle, "KDE-Settings");
-                if(qtSettings.debug) printf(DEBUG_PREFIX "gtk-toolbar-style %d\n", \
qtSettings.toolbarStyle); +                if(qtSettings.debug) fprintf(stderr, \
DEBUG_PREFIX "gtk-toolbar-style %d\n", qtSettings.toolbarStyle);  if \
                (gtk_check_version(2, 4, 0) == nullptr) {
                     /* The following settings only apply for GTK>=2.4.0 */
-                    if(qtSettings.debug) printf(DEBUG_PREFIX "gtk-button-images \
%d\n", qtSettings.buttonIcons); +                    if(qtSettings.debug) \
                fprintf(stderr, DEBUG_PREFIX "gtk-button-images %d\n", \
                qtSettings.buttonIcons);
                     gtk_settings_set_long_property(settings, "gtk-button-images", \
qtSettings.buttonIcons, "KDE-Settings");  #if 0
                     if(opts.drawStatusBarFrames)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic