[SCM] breeze packaging branch, kubuntu_utopic_next, updated. f8a09dd322c3e3d4160704e519abc4fee7d5bc58

Jonathan Riddell jriddell-guest at moszumanska.debian.org
Fri Oct 17 16:02:50 UTC 2014


Gitweb-URL: http://git.debian.org/?p=pkg-kde/plasma/breeze.git;a=commitdiff;h=f8a09dd

The following commit has been merged in the kubuntu_utopic_next branch:
commit f8a09dd322c3e3d4160704e519abc4fee7d5bc58
Author: Jonathan Riddell <jr at jriddell.org>
Date:   Fri Oct 17 18:02:45 2014 +0200

    Add upstream_gtkbreeze.diff from upstream to set gtk theme
---
 debian/changelog                       |   1 +
 debian/patches/series                  |   1 +
 debian/patches/upstream_gtkbreeze.diff | 249 +++++++++++++++++++++++++++++++++
 3 files changed, 251 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index cd17828..f403c7a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,7 @@ breeze (4:5.1.0.1-0ubuntu1) UNRELEASED; urgency=medium
   * Add translations to kde-style-breeze
   * breeze metapackage depends on Qt 4 build kde-style-breeze-qt4
   * Build-dep on pkg-config
+  * Add upstream_gtkbreeze.diff from upstream to set gtk theme
 
   [ Harald Sitter ]
   * Breeze is not a metapackage.
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..648ae1e
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+upstream_gtkbreeze.diff
diff --git a/debian/patches/upstream_gtkbreeze.diff b/debian/patches/upstream_gtkbreeze.diff
new file mode 100644
index 0000000..84bda0e
--- /dev/null
+++ b/debian/patches/upstream_gtkbreeze.diff
@@ -0,0 +1,249 @@
+Description: add gtkbreeze
+ gtkbreeze sets default settings for breeze on first login
+Author: Jonathan Riddell <jriddell at ubuntu.com>
+Origin: upstream, https://git.reviewboard.kde.org/r/120624/
+Bug: https://bugs.kde.org/show_bug.cgi?id=339868
+Forwarded: not-needed, it came from upstream
+Last-Update: 2014-10-17
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+diff --git a/misc/CMakeLists.txt b/misc/CMakeLists.txt
+index ff891a9..4cb1ba9 100644
+--- a/misc/CMakeLists.txt
++++ b/misc/CMakeLists.txt
+@@ -1,2 +1,3 @@
+ add_subdirectory(qtcurvepreset)
+ add_subdirectory(kde4breeze)
++add_subdirectory(gtkbreeze)
+diff --git a/misc/gtkbreeze/CMakeLists.txt b/misc/gtkbreeze/CMakeLists.txt
+new file mode 100644
+index 0000000..82bd68f
+--- /dev/null
++++ b/misc/gtkbreeze/CMakeLists.txt
+@@ -0,0 +1,49 @@
++project(gtkbreeze)
++
++find_package(ECM 0.0.13 REQUIRED NO_MODULE)
++
++set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
++
++include(KDEInstallDirs)
++include(KDEFrameworkCompilerSettings)
++include(KDECMakeSettings)
++
++find_package(Qt5 REQUIRED COMPONENTS Core Widgets)
++find_package(KF5 REQUIRED COMPONENTS CoreAddons Config)
++
++include(KDEInstallDirs)
++include(KDECMakeSettings)
++include(KDECompilerSettings)
++include(ECMPackageConfigHelpers)
++include(ECMMarkNonGuiExecutable)
++include(CMakePackageConfigHelpers)
++include(WriteBasicConfigVersionFile)
++include(CheckIncludeFiles)
++include(FeatureSummary)
++include(KDEFrameworkCompilerSettings)
++
++add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0)
++
++add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
++add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
++
++remove_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_STRICT_ITERATORS -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_KEYWORDS)
++
++# In this CMakeLists.txt we define which files
++# are used to compile the application
++set(gtkbreeze_SRCS
++   main.cpp
++ )
++
++# Set the name of the application
++add_executable(gtkbreeze ${gtkbreeze_SRCS})
++
++# Select which libraries we need to link to
++target_link_libraries(gtkbreeze Qt5::Widgets KF5::CoreAddons KF5::ConfigCore)
++
++# Tell cmake to install the application binary
++install(TARGETS gtkbreeze DESTINATION ${LIB_INSTALL_DIR}/kconf_update_bin/)
++install(FILES gtkbreeze.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR})
++
++# Install the color scheme?
++
+diff --git a/misc/gtkbreeze/gtkbreeze.upd b/misc/gtkbreeze/gtkbreeze.upd
+new file mode 100644
+index 0000000..165308b
+--- /dev/null
++++ b/misc/gtkbreeze/gtkbreeze.upd
+@@ -0,0 +1,2 @@
++Id=GTKBreeze
++Script=gtkbreeze
+diff --git a/misc/gtkbreeze/main.cpp b/misc/gtkbreeze/main.cpp
+new file mode 100644
+index 0000000..dd108a7
+--- /dev/null
++++ b/misc/gtkbreeze/main.cpp
+@@ -0,0 +1,163 @@
++/*
++ Copyright 2014 Jonathan Riddell <jriddell at ubuntu.com>
++
++ This program is free software; you can redistribute it and/or
++ modify it under the terms of the GNU General Public License as
++ published by the Free Software Foundation; either version 2 of 
++ the License, or (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program.  If not, see <http://www.gnu.org/licenses/>.
++*/
++
++// Wee program to be run at login by kconf_update
++// checks if gtk theme is set
++// if not or if it is set to oxygen, update to new theme which matches breeze theme
++
++#include <QCoreApplication>
++#include <QStandardPaths>
++#include <QDebug>
++#include <QFile>
++#include <QLoggingCategory>
++#include <QSettings>
++
++Q_DECLARE_LOGGING_CATEGORY(GTKBREEZE)
++Q_LOGGING_CATEGORY(GTKBREEZE, "gtkbreeze")
++
++/*
++ * returns a path to the installed gtk if it can be found
++ * themeName: gtk theme
++ * settingsFile: a file installed with the theme to set default options
++ */
++QString isGtkThemeInstalled(QString themeName, QString settingsFile)
++{
++    foreach(const QString& themesDir, QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "themes", QStandardPaths::LocateDirectory)) {
++        if (QFile::exists(themesDir+ "/" + themeName + "/" + settingsFile)) {
++            return themesDir + "/" + themeName;
++        }
++    }
++    return 0;
++}
++
++/*
++ * Check if gtk theme is already set to oxygen, if it is then we want to upgrade to the breeze theme
++ * gtkSettingsFile: filename to use
++ * settingsKey: ini group to read from
++ * returns: full path to settings file
++ */
++QString isGtkThemeSetToOxygen(QString gtkSettingsFile, QString settingsKey)
++{
++    QString gtkSettingsPath = QStandardPaths::standardLocations(QStandardPaths::HomeLocation).first() + "/" + gtkSettingsFile;
++    qCDebug(GTKBREEZE) << "looking for" << gtkSettingsPath;
++    if (QFile::exists(gtkSettingsPath)) {
++        qCDebug(GTKBREEZE) << "found settings file" << gtkSettingsPath;
++        QSettings gtkrcSettings(gtkSettingsPath, QSettings::IniFormat);
++        if (!settingsKey.isNull()) {
++            gtkrcSettings.beginGroup(settingsKey);
++        }
++        if (gtkrcSettings.value("gtk-theme-name") != "oxygen-gtk") {
++            qCDebug(GTKBREEZE) << "gtk settings file " + gtkSettingsFile + " already exist and is not using oxygen, will not change";
++            return QString();
++        }
++    }
++    return gtkSettingsPath;
++}
++
++/*
++ * Set gtk2 theme if no theme is set or if oxygen is set and gtk theme is installed
++ */
++void setGtk2()
++{
++    QString gtk2Theme = "Orion"; // Orion looks kindae like breeze
++    QString gtk2ThemeSettings = "gtk-2.0/gtkrc"; // file to check for
++    QString gtkThemeDirectory = isGtkThemeInstalled(gtk2Theme, gtk2ThemeSettings);
++
++    if (gtkThemeDirectory == 0) {
++        qCDebug(GTKBREEZE) << "not found, quitting";
++        return;
++    }
++    qCDebug(GTKBREEZE) << "found gtktheme: " << gtkThemeDirectory;
++
++    QString gtkrc2path = isGtkThemeSetToOxygen(".gtkrc-2.0", QString());
++    if ( gtkrc2path.isEmpty() ) {
++        qCDebug(GTKBREEZE) << "gtkrc2 already exists and is not using oxygen, quitting";
++        return;
++    }
++
++    qCDebug(GTKBREEZE) << "no gtkrc2 file or oxygen being used, setting to new theme";
++    QFile gtkrc2writer(gtkrc2path);
++    gtkrc2writer.open(QIODevice::WriteOnly | QIODevice::Text);
++    QTextStream out(&gtkrc2writer);
++    out << "include \"" << gtkThemeDirectory << "/gtk-2.0/gtkrc\"
";
++    out << "style \"user-font\"
";
++    out << "{
";
++    out << "    font_name=\"Oxygen-Sans Sans-Book\"
";
++    out << "}
";
++    out << "widget_class \"*\" style \"user-font\"
";
++    out << "gtk-font-name=\"Oxygen-Sans Sans-Book 10\"
"; // matches plasma-workspace:startkde/startkde.cmake
++    out << "gtk-theme-name=\"Orion\"
";
++    out << "gtk-icon-theme-name=\"oxygen\"
"; // breeze icons don't seem to work with gtk
++    out << "gtk-fallback-icon-theme=\"gnome\"
";
++    out << "gtk-toolbar-style=GTK_TOOLBAR_ICONS
";
++    out << "gtk-menu-images=1
";
++    out << "gtk-button-images=1
";
++
++    gtkrc2writer.close();
++    qCDebug(GTKBREEZE) << "gtk2rc written";
++}
++
++/*
++ * Set gtk3 theme if no theme is set or if oxygen is set and gtk theme is installed
++ */
++void setGtk3()
++{
++    qCDebug(GTKBREEZE) << "setGtk3()";
++
++    QString gtk3Theme = "Orion"; // Orion looks kindae like breeze
++    QString gtk3ThemeSettings = "gtk-3.0/settings.ini"; // Orion looks kindae like breeze
++
++    QString gtkThemeDirectory = isGtkThemeInstalled(gtk3Theme, gtk3ThemeSettings);
++    if (gtkThemeDirectory == 0) {
++        qCDebug(GTKBREEZE) << "not found, quitting";
++        return;
++    }
++    qCDebug(GTKBREEZE) << "found gtk3theme:" << gtkThemeDirectory;
++
++    QString gtkrc3path = isGtkThemeSetToOxygen(".config/gtk-3.0/settings.ini", "Settings");
++    if ( gtkrc3path.isEmpty() ) {
++        qCDebug(GTKBREEZE) << "gtkrc3 already exists and is not using oxygen, quitting";
++        return;
++    }
++
++    qCDebug(GTKBREEZE) << "no gtkrc3 file or oxygen being used, setting to new theme";
++    QFile gtkrc3writer(gtkrc3path);
++    gtkrc3writer.open(QIODevice::WriteOnly | QIODevice::Text);
++    QTextStream out(&gtkrc3writer);
++    out << "[Settings]
";
++    out << "gtk-font-name=Ubuntu 10
"; // matches plasma-workspace:startkde/startkde.cmake
++    out << "gtk-theme-name="+gtk3Theme+"
";
++    out << "gtk-icon-theme-name=oxygen
"; // breeze icons don't seem to work with gtk
++    out << "gtk-fallback-icon-theme=gnome
";
++    out << "gtk-toolbar-style=GTK_TOOLBAR_ICONS
";
++    out << "gtk-menu-images=1
";
++    out << "gtk-button-images=1
";
++    gtkrc3writer.close();
++    qCDebug(GTKBREEZE) << "gtk3rc written";
++}
++
++int main(int argc, char **argv)
++{
++    QCoreApplication app(argc, argv);
++    QLoggingCategory::setFilterRules(QStringLiteral("gtkbreeze.debug = true"));
++    qCDebug(GTKBREEZE) << "updateGtk2()";
++
++    setGtk2();
++    setGtk3();
++
++    return 0;
++}

-- 
breeze packaging



More information about the pkg-kde-commits mailing list