[kcm-gtk/el6] change conditionals for rhel re-enable cursortheme patch for rhel

nucleo nucleo at fedoraproject.org
Wed Jul 13 13:15:14 UTC 2011


commit 3b55691d38553407feb9fad39ca9143789276489
Author: nucleo <nucleo at fedoraproject.org>
Date:   Wed Jul 13 16:14:56 2011 +0300

    change conditionals for rhel
    re-enable cursortheme patch for rhel

 kcm-gtk-0.5.3-cursortheme.patch |  266 +++++++++++++++++++++++++++++++++++++++
 kcm-gtk.spec                    |   15 ++-
 2 files changed, 279 insertions(+), 2 deletions(-)
---
diff --git a/kcm-gtk-0.5.3-cursortheme.patch b/kcm-gtk-0.5.3-cursortheme.patch
new file mode 100644
index 0000000..9b67b2c
--- /dev/null
+++ b/kcm-gtk-0.5.3-cursortheme.patch
@@ -0,0 +1,266 @@
+https://bugs.launchpad.net/kcm-gtk/+bug/505988
+https://bugs.launchpad.net/kcm-gtk/+bug/505988/comments/4
+
+diff -up kcm-gtk-0.5.3/gtkrcfile.cpp.cursortheme kcm-gtk-0.5.3/gtkrcfile.cpp
+--- kcm-gtk-0.5.3/gtkrcfile.cpp.cursortheme	2010-07-06 21:53:45.363892421 +0300
++++ kcm-gtk-0.5.3/gtkrcfile.cpp	2010-07-06 21:54:28.198889669 +0300
+@@ -44,6 +44,7 @@ void GtkRcFile::load()
+ 	
+ 	QRegExp includeRe("include\\s*\"([^\"]*)\"");
+ 	QRegExp fontRe("gtk-font-name\\s*=\\s*\"([^\"]*)\"");
++	QRegExp cursorRe("gtk-cursor-theme-name\\s*=\\s*\"([^\"]*)\"");
+ 	
+ 	
+ 	QStringList includes;
+@@ -75,6 +76,13 @@ void GtkRcFile::load()
+ 			// Assume there will only be one font line
+ 			parseFont(fontRe.cap(1));
+ 		}
++		if (line.startsWith("gtk-cursor-theme-name"))
++		{
++			if (cursorRe.indexIn(line) == -1)
++				continue;
++			// Assume there will only be one cursor theme line
++			setCursor(cursorRe.cap(1));
++		}
+ 	}
+ 	
+ 	file.close();
+@@ -136,6 +144,7 @@ void GtkRcFile::save()
+ 	stream << "\n";
+ 	stream << "gtk-theme-name=\"" << m_themeName << "\"\n";
+ 	stream << "gtk-font-name=\"" << fontName << "\"\n";
++	stream << "gtk-cursor-theme-name = \"" << m_cursorName << "\"\n";
+ 	
+ 	QByteArray gtkrc = getenv("GTK2_RC_FILES");
+ 	QStringList list = QFile::decodeName(gtkrc).split( ':');
+diff -up kcm-gtk-0.5.3/gtkrcfile.h.cursortheme kcm-gtk-0.5.3/gtkrcfile.h
+--- kcm-gtk-0.5.3/gtkrcfile.h.cursortheme	2009-10-23 16:07:44.000000000 +0300
++++ kcm-gtk-0.5.3/gtkrcfile.h	2010-07-06 21:54:55.959889181 +0300
+@@ -34,10 +34,12 @@ public:
+ 	
+ 	QString fileName() const { return m_fileName; }
+ 	QString themeName() const { return m_themeName; }
++	QString cursorName() const { return m_cursorName; }
+ 	QString themePath() const { return m_themePath; }
+ 	QFont font() const { return m_font; }
+ 	
+ 	void setTheme(const QString& path);
++	void setCursor(const QString& cursor) { m_cursorName = cursor; };
+ 	void setFont(const QFont& font) { m_font = font; }
+ 	void setFont(const QString& family, int pointSize, bool bold, bool italic);
+ 	
+@@ -46,6 +48,7 @@ private:
+ 	
+ 	QString m_fileName;
+ 	QString m_themeName;
++	QString m_cursorName;
+ 	QString m_themePath;
+ 	QFont m_font;
+ 	
+diff -up kcm-gtk-0.5.3/kcmgtk.cpp.cursortheme kcm-gtk-0.5.3/kcmgtk.cpp
+--- kcm-gtk-0.5.3/kcmgtk.cpp.cursortheme	2009-10-23 16:07:44.000000000 +0300
++++ kcm-gtk-0.5.3/kcmgtk.cpp	2010-07-06 21:54:55.960890384 +0300
+@@ -51,11 +51,13 @@ 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.cursorBox, SIGNAL(activated(int)), SLOT(cursorChanged()));
+ 	
+ 	m_gtkRc = new GtkRcFile(k_gtkRcFileName);
+ 	
+ 	m_searchPaths = new SearchPaths(this);
+ 	connect(m_searchPaths, SIGNAL(accepted()), SLOT(getInstalledThemes()));
++	connect(m_searchPaths, SIGNAL(accepted()), SLOT(getInstalledCursors()));
+ 	connect(m_ui.warning3, SIGNAL(clicked()), m_searchPaths, SLOT(exec()));
+ 	
+ 	// Load icons
+@@ -72,6 +74,7 @@ KcmGtk::KcmGtk(QWidget* parent, const QV
+ 	
+ 	// Load GTK settings
+ 	getInstalledThemes();
++	getInstalledCursors();
+ 	load();
+ 	setButtons(Apply);
+ }
+@@ -89,6 +92,7 @@ void KcmGtk::load()
+ 	checkQtCurve();
+ 
+ 	m_ui.styleBox->setCurrentIndex(m_themes.keys().indexOf(m_gtkRc->themeName()));
++	m_ui.cursorBox->setCurrentIndex(m_cursors.keys().indexOf(m_gtkRc->cursorName()));
+ 	
+ 	QFont defaultFont;
+ 	bool usingKdeFont = (m_gtkRc->font().family() == defaultFont.family() &&
+@@ -117,6 +121,40 @@ void KcmGtk::defaults()
+ {
+ }
+ 
++void KcmGtk::getInstalledCursors()
++{
++	m_cursors.clear();
++	Q_FOREACH (QString path, m_searchPaths->paths())
++	{
++		path += "/share/icons/";
++		Q_FOREACH (QString subdir, QDir(path).entryList(QDir::Dirs, QDir::Unsorted))
++		{
++			if (subdir.startsWith('.'))
++				continue;
++			if (m_cursors.contains(subdir))
++				continue;
++			if (QFile::exists(path + subdir + "/cursors"))
++				m_cursors[subdir] = subdir;
++		}
++	}
++
++	/* search user home dir for any custom icons too. user changes
++     * override the system cursor icons if the same exists in user home dir */
++	QString apath = QDir::homePath() + "/.icons/";
++	Q_FOREACH (QString subdir, QDir(apath).entryList(QDir::Dirs, QDir::Unsorted))
++		{
++			if (subdir.startsWith('.'))
++				continue;
++			if (m_cursors.contains(subdir))
++				continue;
++			if (QFile::exists(apath + subdir + "/cursors"))
++				m_cursors[subdir] = subdir;
++		}
++
++	m_ui.cursorBox->clear();
++	m_ui.cursorBox->addItems(m_cursors.keys());
++}
++
+ void KcmGtk::getInstalledThemes()
+ {
+ 	m_themes.clear();
+@@ -157,6 +195,12 @@ void KcmGtk::fontKdeClicked()
+ 	updateFontPreview();
+ 	changed(true);
+ }
++ 
++void KcmGtk::cursorChanged()
++{
++	m_gtkRc->setCursor(m_cursors[m_ui.cursorBox->currentText()]);
++	changed(true);
++}
+ 
+ void KcmGtk::styleChanged()
+ {
+diff -up kcm-gtk-0.5.3/kcmgtk.h.cursortheme kcm-gtk-0.5.3/kcmgtk.h
+--- kcm-gtk-0.5.3/kcmgtk.h.cursortheme	2009-10-23 16:07:44.000000000 +0300
++++ kcm-gtk-0.5.3/kcmgtk.h	2010-07-06 21:54:55.961889910 +0300
+@@ -45,7 +45,9 @@ private Q_SLOTS:
+ 	void fontChangeClicked();
+ 	void fontKdeClicked();
+ 	void styleChanged();
++	void cursorChanged();
+ 	void getInstalledThemes();
++	void getInstalledCursors();
+ 
+ private:
+ 	void updateFontPreview();
+@@ -55,6 +57,7 @@ private:
+ 	
+ 	GtkRcFile* m_gtkRc;
+ 	QMap<QString, QString> m_themes;
++	QMap<QString, QString> m_cursors;
+ 	SearchPaths* m_searchPaths;
+ 	
+ 	static const QString k_gtkRcFileName;
+diff -up kcm-gtk-0.5.3/kcmgtkwidget.ui.cursortheme kcm-gtk-0.5.3/kcmgtkwidget.ui
+--- kcm-gtk-0.5.3/kcmgtkwidget.ui.cursortheme	2009-10-23 16:07:44.000000000 +0300
++++ kcm-gtk-0.5.3/kcmgtkwidget.ui	2010-07-06 21:54:55.962890275 +0300
+@@ -6,11 +6,12 @@
+    <rect>
+     <x>0</x>
+     <y>0</y>
+-    <width>543</width>
++    <width>549</width>
+     <height>429</height>
+    </rect>
+   </property>
+   <property name="windowTitle">
++   <string/>
+   </property>
+   <layout class="QVBoxLayout">
+    <item>
+@@ -19,7 +20,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,7 +40,7 @@
+         </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>
+@@ -49,10 +50,10 @@
+         </property>
+        </widget>
+       </item>
+-      <item row="0" column="2">
++      <item row="0" column="3">
+        <widget class="QComboBox" name="styleBox"/>
+       </item>
+-      <item row="0" column="3">
++      <item row="0" column="5">
+        <spacer>
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+@@ -65,14 +66,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 +86,32 @@
+         </property>
+        </spacer>
+       </item>
++      <item row="1" column="2">
++       <widget class="QLabel" name="label_2">
++        <property name="text">
++         <string>&amp;Cursor Style</string>
++        </property>
++        <property name="buddy">
++         <cstring>cursorBox</cstring>
++        </property>
++       </widget>
++      </item>
++      <item row="1" column="3">
++       <widget class="QComboBox" name="cursorBox"/>
++      </item>
++      <item row="1" column="5">
++       <spacer name="horizontalSpacer">
++        <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>
diff --git a/kcm-gtk.spec b/kcm-gtk.spec
index 77d35c0..af66917 100644
--- a/kcm-gtk.spec
+++ b/kcm-gtk.spec
@@ -1,14 +1,14 @@
 
 # Fedora package review: http://bugzilla.redhat.com/530342
 
-%if 0%{?fedora} && 0%{?fedora} < 13
+%if 0%{?rhel}
 %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
@@ -28,6 +28,10 @@ Patch51: kcm-gtk-0.5.3-gtkrc_setenv.patch
 # fix missing umlauts and sharp s in the German translation
 # The translations need a lot more fixing than that, but this looks very broken!
 Patch52: kcm-gtk-0.5.3-fix-de.patch
+# https://bugs.launchpad.net/kcm-gtk/+bug/505988, already upstream
+# Modified so that it applies over the setenv patch, and removed index.theme
+# existence check: https://bugs.launchpad.net/kcm-gtk/+bug/505988/comments/4
+Patch53: kcm-gtk-0.5.3-cursortheme.patch
 
 %if 0%{?fedora} > 11
 Obsoletes: gtk-qt-engine <= 1:1.1
@@ -49,6 +53,9 @@ appearance of GTK apps in KDE.
 %patch50 -p1 -b .settings_category
 %patch51 -p1 -b .gtkrc_setenv
 %patch52 -p1 -b .fix-de
+%if 0%{?rhel}
+%patch53 -p1 -b .cursortheme
+%endif
 
 %if "%{?_kde4_version}" > "4.5.0"
 # fixup for kde-4.5, see http://bugzilla.redhat.com/628381
@@ -91,6 +98,10 @@ rm -rf %{buildroot}
 
 
 %changelog
+* Wed Jul 13 2011 Alexey Kurov <nucleo at fedoraproject.org> - 0.5.3-8
+- change conditionals for rhel
+- re-enable cursortheme patch for rhel
+
 * 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