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

List:       kde-commits
Subject:    [kde-gtk-config] src: Check in runtime whether the previews are installed
From:       Aleix Pol <aleixpol () kde ! org>
Date:       2012-11-15 18:44:21
Message-ID: 20121115184421.CE1EBA6091 () git ! kde ! org
[Download RAW message or body]

Git commit 3417ee1dae31f08e04ff6beb93c9af8bab71d68f by Aleix Pol.
Committed on 15/11/2012 at 18:31.
Pushed by apol into branch 'master'.

Check in runtime whether the previews are installed

Thanks to Boris Pek for the patch

CCMAIL: tehnick-8@mail.ru

M  +14   -5    src/gtkconfigkcmodule.cpp

http://commits.kde.org/kde-gtk-config/3417ee1dae31f08e04ff6beb93c9af8bab71d68f

diff --git a/src/gtkconfigkcmodule.cpp b/src/gtkconfigkcmodule.cpp
index 6289373..ba2f600 100644
--- a/src/gtkconfigkcmodule.cpp
+++ b/src/gtkconfigkcmodule.cpp
@@ -80,13 +80,25 @@ GTKConfigKCModule::GTKConfigKCModule(QWidget* parent, const \
QVariantList& args )  ui->gtk2Preview->setIcon(previewIcon);
     ui->gtk3Preview->setIcon(previewIcon);
     
+    QString gtk2Preview = KStandardDirs::findExe("gtk_preview");
+    QString gtk3Preview = KStandardDirs::findExe("gtk3_preview");
+    
     m_p2 = new KProcess(this);
     m_p2->setEnv("GTK2_RC_FILES", m_tempGtk2Preview, true);
-    *m_p2 << KStandardDirs::findExe("gtk_preview");
+    if(!gtk2Preview.isEmpty()) {
+        *m_p2 << gtk2Preview;
+        connect(m_p2, SIGNAL(finished(int)), this, SLOT(untogglePreview()));
+    }
     
     m_p3 = new KProcess(this);
     m_p3->setEnv("XDG_CONFIG_HOME", KGlobal::dirs()->saveLocation("tmp", \
                ".config"));
-    *m_p3 << KStandardDirs::findExe("gtk3_preview");
+    if(gtk3Preview.isEmpty()) {
+        *m_p3 << gtk3Preview;
+        connect(m_p3, SIGNAL(finished(int)), this, SLOT(untogglePreview()));
+    }
+    
+    ui->gtk2Preview->setVisible(!gtk2Preview.isEmpty());
+    ui->gtk3Preview->setVisible(!gtk3Preview.isEmpty());
     
     //UI changes
     connect(ui->cb_theme, SIGNAL(currentIndexChanged(int)), this, \
SLOT(appChanged())); @@ -104,9 +116,6 @@ \
                GTKConfigKCModule::GTKConfigKCModule(QWidget* parent, const \
                QVariantList& args )
     connect(ui->gtk2Preview, SIGNAL(clicked(bool)), this, \
                SLOT(runGtk2IfNecessary(bool)));
     connect(ui->gtk3Preview, SIGNAL(clicked(bool)), this, \
SLOT(runGtk3IfNecessary(bool)));  
-    connect(m_p2, SIGNAL(finished(int)), this, SLOT(untogglePreview()));
-    connect(m_p3, SIGNAL(finished(int)), this, SLOT(untogglePreview()));
-    
     QMenu* m = new QMenu(this);
     m->addAction(KIcon("get-hot-new-stuff"), i18n("Download GTK2 themes..."), this, \
                SLOT(showThemeGHNS()));
     m->addAction(KIcon("get-hot-new-stuff"), i18n("Download GTK3 themes..."), this, \
SLOT(installThemeGTK3GHNS()));


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

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