[kcm-gtk] * Fri Jan 06 2012 Kevin Kofler <Kevin at tigcc.ticalc.org> 0.5.3-8 - add support for GTK+ 3 (backported

Kevin Kofler kkofler at fedoraproject.org
Fri Jan 6 03:25:02 UTC 2012


commit 4e491c556252b2282235ec93d890f67e16a4c1d4
Author: Kevin Kofler <Kevin at tigcc.ticalc.org>
Date:   Fri Jan 6 04:24:48 2012 +0100

    * Fri Jan 06 2012 Kevin Kofler <Kevin at tigcc.ticalc.org> 0.5.3-8
    - add support for GTK+ 3 (backported from upstream bzr gtk3 branch)
    - drop ancient Fedora < 13 env_script conditional, now always in kde-settings

 kcm-gtk-0.5.3-gtk3.patch |  241 ++++++++++++++++++++++++++++++++++++++++++++++
 kcm-gtk.sh               |   12 ---
 kcm-gtk.spec             |   21 ++--
 3 files changed, 251 insertions(+), 23 deletions(-)
---
diff --git a/kcm-gtk-0.5.3-gtk3.patch b/kcm-gtk-0.5.3-gtk3.patch
new file mode 100644
index 0000000..34d902f
--- /dev/null
+++ b/kcm-gtk-0.5.3-gtk3.patch
@@ -0,0 +1,241 @@
+--- kcm-gtk-0.5.3/kcmgtk.cpp	2009-10-23 16:07:44.000000000 +0300
++++ kcm-gtk3/kcmgtk.cpp	2011-12-19 15:33:20.000000000 +0200
+@@ -37,6 +37,7 @@
+ 
+ 
+ const QString KcmGtk::k_gtkRcFileName(QDir::homePath() + "/.gtkrc-2.0-kde4");
++const QString KcmGtk::k_gtk3RcFileName(QDir::homePath() + "/.config/gtk-3.0/settings.ini");
+ const QString KcmGtk::k_qtThemeName("Qt4");
+ const QString KcmGtk::k_qtcurveThemeName("QtCurve");
+ 
+@@ -51,9 +52,11 @@ KcmGtk::KcmGtk(QWidget* parent, const QV
+ 	connect(m_ui.fontChange, SIGNAL(clicked()), SLOT(fontChangeClicked()));
+ 	connect(m_ui.fontKde, SIGNAL(clicked(bool)), SLOT(fontKdeClicked()));
+ 	connect(m_ui.styleBox, SIGNAL(activated(int)), SLOT(styleChanged()));
+-	
++	connect(m_ui.style3Box, SIGNAL(activated(int)), SLOT(style3Changed()));
++
+ 	m_gtkRc = new GtkRcFile(k_gtkRcFileName);
+-	
++	m_gtk3Rc = new KConfigGroup(KSharedConfig::openConfig(k_gtk3RcFileName, KConfig::SimpleConfig), "Settings");
++
+ 	m_searchPaths = new SearchPaths(this);
+ 	connect(m_searchPaths, SIGNAL(accepted()), SLOT(getInstalledThemes()));
+ 	connect(m_ui.warning3, SIGNAL(clicked()), m_searchPaths, SLOT(exec()));
+@@ -79,6 +82,7 @@ KcmGtk::KcmGtk(QWidget* parent, const QV
+ KcmGtk::~KcmGtk()
+ {
+ 	delete m_gtkRc;
++	delete m_gtk3Rc;
+ }
+ 
+ void KcmGtk::load()
+@@ -89,6 +93,7 @@ void KcmGtk::load()
+ 	checkQtCurve();
+ 
+ 	m_ui.styleBox->setCurrentIndex(m_themes.keys().indexOf(m_gtkRc->themeName()));
++	m_ui.style3Box->setCurrentIndex(m_gtk3themes.indexOf(m_gtk3Rc->readEntry("gtk-theme-name")));
+ 	
+ 	QFont defaultFont;
+ 	bool usingKdeFont = (m_gtkRc->font().family() == defaultFont.family() &&
+@@ -104,13 +109,21 @@ void KcmGtk::load()
+ void KcmGtk::updateFontPreview()
+ {
+ 	m_ui.fontPreview->setFont(m_gtkRc->font());
+-	m_ui.fontPreview->setText(i18n("%1 (size %2)", m_gtkRc->font().family(), QString::number(m_gtkRc->font().pointSize())));
++	m_ui.fontPreview->setText(i18n("%1 (size %2)", m_gtkRc->font().family(), m_gtkRc->font().pointSize()));
+ }
+ 
+ void KcmGtk::save()
+ {
+ 	// Write ~/.gtkrc-2.0-kde4
+ 	m_gtkRc->save();
++	const QFont & font = m_gtkRc->font();
++	QString fontName = font.family() + ' ' +
++	QLatin1String(font.bold() ? "Bold " : "") +
++	QLatin1String(font.italic() ? "Italic " : "") +
++	QString::number(font.pointSize());
++	m_gtk3Rc->writeEntry("gtk-theme-name", m_ui.style3Box->currentText());
++	m_gtk3Rc->writeEntry("gtk-font-name", fontName);
++	m_gtk3Rc->sync();
+ }
+ 
+ void KcmGtk::defaults()
+@@ -127,16 +140,16 @@ void KcmGtk::getInstalledThemes()
+ 		{
+ 			if (subdir.startsWith('.'))
+ 				continue;
+-			if (m_themes.contains(subdir))
+-				continue;
+-			if (!QFile::exists(path + subdir + "/gtk-2.0/gtkrc"))
+-				continue;
+-			m_themes[subdir] = path + subdir + "/gtk-2.0/gtkrc";
++			if (!m_themes.contains(subdir) && QFile::exists(path + subdir + "/gtk-2.0/gtkrc"))
++				m_themes[subdir] = path + subdir + "/gtk-2.0/gtkrc";
++			if (!m_gtk3themes.contains(subdir) && QFile::exists(path + subdir + "/gtk-3.0/gtk.css"))
++				m_gtk3themes.append(subdir);
+ 		}
+ 	}
+ 
+ 	m_ui.styleBox->clear();
+ 	m_ui.styleBox->addItems(m_themes.keys());
++	m_ui.style3Box->addItems(m_gtk3themes);
+ }
+ 
+ void KcmGtk::fontChangeClicked()
+@@ -165,6 +178,11 @@ void KcmGtk::styleChanged()
+ 	changed(true);
+ }
+ 
++void KcmGtk::style3Changed()
++{
++	changed(true);
++}
++
+ void KcmGtk::checkQtCurve()
+ {
+ 	if (m_gtkRc->themeName() == k_qtcurveThemeName)
+--- kcm-gtk-0.5.3/kcmgtk.h	2009-10-23 16:07:44.000000000 +0300
++++ kcm-gtk3/kcmgtk.h	2011-12-19 15:33:20.000000000 +0200
+@@ -18,15 +18,16 @@
+  *   51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.              *
+  ***************************************************************************/
+ 
+-#ifndef _KCMTEST_H_
+-#define _KCMTEST_H_
++#ifndef KCMGTK_H
++#define KCMGTK_H
+ 
+-#include <QStringList>
+ #include <kcmodule.h>
+ 
++#include <QStringList>
++
+ #include "ui_kcmgtkwidget.h"
+ 
+-class KConfig;
++class KConfigGroup;
+ class GtkRcFile;
+ class SearchPaths;
+ 
+@@ -45,6 +46,7 @@ private Q_SLOTS:
+ 	void fontChangeClicked();
+ 	void fontKdeClicked();
+ 	void styleChanged();
++	void style3Changed();
+ 	void getInstalledThemes();
+ 
+ private:
+@@ -54,10 +56,13 @@ private:
+ 	Ui_KcmGtkWidget m_ui;
+ 	
+ 	GtkRcFile* m_gtkRc;
++	KConfigGroup* m_gtk3Rc;
+ 	QMap<QString, QString> m_themes;
++	QList<QString> m_gtk3themes;
+ 	SearchPaths* m_searchPaths;
+ 	
+ 	static const QString k_gtkRcFileName;
++	static const QString k_gtk3RcFileName;
+ 	static const QString k_envFileName;
+ 	static const QString k_qtThemeName;
+ 	static const QString k_qtcurveThemeName;
+--- kcm-gtk-0.5.3/kcmgtkwidget.ui	2009-10-23 16:07:44.000000000 +0300
++++ kcm-gtk3/kcmgtkwidget.ui	2011-12-19 15:33:20.000000000 +0200
+@@ -19,7 +19,7 @@
+       <string>GTK+ Styles</string>
+      </property>
+      <layout class="QGridLayout" name="gridLayout">
+-      <item row="0" column="0" rowspan="2">
++      <item row="0" column="0" rowspan="4">
+        <layout class="QVBoxLayout">
+         <item>
+          <widget class="QLabel" name="styleIcon"/>
+@@ -39,20 +39,20 @@
+         </item>
+        </layout>
+       </item>
+-      <item row="0" column="1">
++      <item row="0" column="2">
+        <widget class="QLabel" name="label">
+         <property name="text">
+-         <string>&amp;Widget style:</string>
++         <string>GTK+2 &amp;Widget style:</string>
+         </property>
+         <property name="buddy">
+          <cstring>styleBox</cstring>
+         </property>
+        </widget>
+       </item>
+-      <item row="0" column="2">
+-       <widget class="QComboBox" name="styleBox"/>
+-      </item>
+       <item row="0" column="3">
++       <widget class="KComboBox" name="styleBox"/>
++      </item>
++      <item row="0" column="5">
+        <spacer>
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+@@ -65,14 +65,14 @@
+         </property>
+        </spacer>
+       </item>
+-      <item row="1" column="1" colspan="2">
++      <item row="3" column="2" colspan="2">
+        <widget class="QPushButton" name="warning3">
+         <property name="text">
+          <string>Change search paths...</string>
+         </property>
+        </widget>
+       </item>
+-      <item row="1" column="3">
++      <item row="3" column="5">
+        <spacer>
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+@@ -85,6 +85,32 @@
+         </property>
+        </spacer>
+       </item>
++      <item row="1" column="2">
++       <widget class="QLabel" name="label_3">
++        <property name="text">
++         <string>GTK+3 Widget &amp;style</string>
++        </property>
++        <property name="buddy">
++         <cstring>style3Box</cstring>
++        </property>
++       </widget>
++      </item>
++      <item row="1" column="3">
++       <widget class="KComboBox" name="style3Box"/>
++      </item>
++      <item row="1" column="5">
++       <spacer name="horizontalSpacer_2">
++        <property name="orientation">
++         <enum>Qt::Horizontal</enum>
++        </property>
++        <property name="sizeHint" stdset="0">
++         <size>
++          <width>40</width>
++          <height>20</height>
++         </size>
++        </property>
++       </spacer>
++      </item>
+      </layout>
+     </widget>
+    </item>
+@@ -205,6 +231,11 @@
+  </widget>
+  <customwidgets>
+   <customwidget>
++   <class>KComboBox</class>
++   <extends>QComboBox</extends>
++   <header>kcombobox.h</header>
++  </customwidget>
++  <customwidget>
+    <class>KSqueezedTextLabel</class>
+    <extends>QLabel</extends>
+    <header>ksqueezedtextlabel.h</header>
diff --git a/kcm-gtk.spec b/kcm-gtk.spec
index 77d35c0..8ad18f5 100644
--- a/kcm-gtk.spec
+++ b/kcm-gtk.spec
@@ -1,14 +1,10 @@
 
 # Fedora package review: http://bugzilla.redhat.com/530342
 
-%if 0%{?fedora} && 0%{?fedora} < 13
-%define env_script 1
-%endif
-
 Summary: Configure the appearance of GTK apps in KDE 
 Name:    kcm-gtk 
 Version: 0.5.3
-Release: 7%{?dist}
+Release: 8%{?dist}
 
 License: GPLv2+
 Group:   User Interface/Desktops
@@ -16,9 +12,6 @@ URL:     https://launchpad.net/kcm-gtk
 Source0: http://launchpad.net/kcm-gtk/0.5.x/%{version}/+download/kcm-gtk_%{version}.orig.tar.gz 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 
 
-# set GTK2_RC_FILES=~/.gtkrc-2.0-kde4
-Source1: kcm-gtk.sh
-
 ## upstreamable patches
 # Categories += Settings, else doesn't appear in systemsettings anywhere (?)
 Patch50: kcm-gtk-0.5.1-settings_category.patch
@@ -29,6 +22,10 @@ Patch51: kcm-gtk-0.5.3-gtkrc_setenv.patch
 # The translations need a lot more fixing than that, but this looks very broken!
 Patch52: kcm-gtk-0.5.3-fix-de.patch
 
+## upstream patches
+# add support for GTK+ 3 (backported from upstream bzr gtk3 branch)
+Patch100: kcm-gtk-0.5.3-gtk3.patch
+
 %if 0%{?fedora} > 11
 Obsoletes: gtk-qt-engine <= 1:1.1
 %endif
@@ -49,6 +46,7 @@ appearance of GTK apps in KDE.
 %patch50 -p1 -b .settings_category
 %patch51 -p1 -b .gtkrc_setenv
 %patch52 -p1 -b .fix-de
+%patch100 -p1 -b .gtk3
 
 %if "%{?_kde4_version}" > "4.5.0"
 # fixup for kde-4.5, see http://bugzilla.redhat.com/628381
@@ -74,8 +72,6 @@ make install/fast DESTDIR=%{buildroot} -C %{_target_platform}
 
 %find_lang kcm_gtk
 
-%{?env_script:install -p -m644 -D %{SOURCE1} %{buildroot}%{_sysconfdir}/kde/env/kcm-gtk.sh}
-
 
 %clean
 rm -rf %{buildroot} 
@@ -84,13 +80,16 @@ rm -rf %{buildroot}
 %files -f kcm_gtk.lang
 %defattr(-,root,root,-)
 %doc Changelog COPYING
-%{?env_script:%{_sysconfdir}/kde/env/kcm-gtk.sh}
 %{_kde4_libdir}/kde4/kcm_gtk.so
 %{_kde4_iconsdir}/kcm_gtk.png
 %{_kde4_datadir}/kde4/services/kcmgtk.desktop
 
 
 %changelog
+* Fri Jan 06 2012 Kevin Kofler <Kevin at tigcc.ticalc.org> 0.5.3-8
+- add support for GTK+ 3 (backported from upstream bzr gtk3 branch)
+- drop ancient Fedora < 13 env_script conditional, now always in kde-settings
+
 * Mon Mar 14 2011 Kevin Kofler <Kevin at tigcc.ticalc.org> 0.5.3-7
 - drop cursortheme patch, now set automatically by xsettings-kde (#591746)
 


More information about the scm-commits mailing list