[ create a new paste ] login | about

Link: http://codepad.org/HglORPKS    [ raw code | fork | 1 comment ]

Plain Text, pasted on Dec 23:
--- ./src/gtkconfigkcmodule.cpp	2013-03-18 15:02:39.000000000 +0400
+++ ./src/gtkconfigkcmodule.cpp.new	2013-12-22 22:54:03.936290692 +0400
@@ -113,8 +113,12 @@
     //preview updates
     connect(ui->cb_icon_fallback, SIGNAL(activated(QString)), this, SLOT(makePreviewIconTheme()));
     connect(ui->cb_icon, SIGNAL(activated(QString)), this, SLOT(makePreviewIconTheme()));
-    connect(ui->gtk2Preview, SIGNAL(clicked(bool)), this, SLOT(runGtk2IfNecessary(bool)));
-    connect(ui->gtk3Preview, SIGNAL(clicked(bool)), this, SLOT(runGtk3IfNecessary(bool)));
+    #ifdef WITH_GTK2_PREVIEW
+      connect(ui->gtk2Preview, SIGNAL(clicked(bool)), this, SLOT(runGtk2IfNecessary(bool)));
+    #endif
+    #ifdef WITH_GTK3_PREVIEW
+      connect(ui->gtk3Preview, SIGNAL(clicked(bool)), this, SLOT(runGtk3IfNecessary(bool)));
+    #endif
     
     QMenu* m = new QMenu(this);
     m->addAction(KIcon("get-hot-new-stuff"), i18n("Download GTK2 themes..."), this, SLOT(showThemeGHNS()));
@@ -270,12 +274,22 @@
 
 void GTKConfigKCModule::savePreviewConfig()
 {
-    if(!m_saveEnabled || !(ui->gtk2Preview->isChecked() || ui->gtk3Preview->isChecked()))
+    if(!m_saveEnabled)
         return;
+    #ifdef WITH_GTK2_PREVIEW
+      if (!ui->gtk2Preview->isChecked())
+        return;
+    #endif
+    #ifdef WITH_GTK3_PREVIEW
+      if (!ui->gtk3Preview->isChecked())
+	return;
+    #endif
+    
     kDebug() << "saving UI...";
     
     syncUI();
     
+    #ifdef WITH_GTK3_PREVIEW
     if(ui->gtk3Preview->isChecked()) {
         //we don't want to recursively loop between savePreviewConfig and runIfNecessary
         m_saveEnabled = false;
@@ -288,9 +302,13 @@
         m_p3->start();
         ui->gtk3Preview->setChecked(true);
         m_saveEnabled = true;
-    } else if(ui->gtk2Preview->isChecked()) {
+    }
+    #endif
+    #ifdef WITH_GTK2_PREVIEW
+    if(ui->gtk2Preview->isChecked()) {
         appareance->gtk2Appearance()->saveSettings(m_tempGtk2Preview);
     }
+    #endif
 }
 
 void GTKConfigKCModule::runGtk2IfNecessary(bool checked)
@@ -411,14 +429,18 @@
     bool wasenabled = m_saveEnabled;
     m_saveEnabled = false;
     
+    #ifdef WITH_GTK2_PREVIEW
     refreshComboSameCurrentValue(ui->cb_theme,
         useConfig ? appareance->getTheme() : ui->cb_theme->currentText(),
         appareance->gtk2Appearance()->installedThemesNames());
+    #endif
     
     //theme gtk3
+    #ifdef WITH_GTK3_PREVIEW
     refreshComboSameCurrentValue(ui->cb_theme_gtk3,
         useConfig ? appareance->getThemeGtk3() : ui->cb_theme_gtk3->currentText(),
         appareance->gtk3Appearance()->installedThemesNames());
+    #endif
     
     //icons
     QString currentIcon = useConfig ? appareance->getIcon() : ui->cb_icon->currentText(),
@@ -459,8 +481,13 @@
 
 void GTKConfigKCModule::untogglePreview()
 {
-    if(sender()==m_p2)
+    if(sender()==m_p2) {
+      #ifdef WITH_GTK2_PREVIEW
         ui->gtk2Preview->setChecked(false);
-    else
+      #endif
+    } else {
+      #ifdef WITH_GTK3_PREVIEW
         ui->gtk3Preview->setChecked(false);
+      #endif
+    }
 }


Create a new paste based on this one


Comments:
posted by danhuu on Dec 23
Сделано на основе https://git.reviewboard.kde.org/r/110636/diff/#0.1
reply