From 7c6ca6948f81dc4ee6430d46aeae7f7de806a251 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Wed, 15 Sep 2010 19:42:18 +0200
Subject: Attempt to show icon in Snarl config dialog.

Doesn't work though. Need to find out why.

diff --git a/SwifTools/Notifier/SnarlNotifier.cpp b/SwifTools/Notifier/SnarlNotifier.cpp
index 86069c9..ccdf26c 100644
--- a/SwifTools/Notifier/SnarlNotifier.cpp
+++ b/SwifTools/Notifier/SnarlNotifier.cpp
@@ -17,9 +17,10 @@
 
 namespace Swift {
 
-SnarlNotifier::SnarlNotifier(const String& name, Win32NotifierWindow* window) : window(window) {
+SnarlNotifier::SnarlNotifier(const String& name, Win32NotifierWindow* window, const boost::filesystem::path& icon) : window(window) {
 	window->onMessageReceived.connect(boost::bind(&SnarlNotifier::handleMessageReceived, this, _1));
-	snarl.RegisterConfig(window->getID(), name.getUTF8Data(), 0);
+	// FIXME: Not sure why the icon doesn't show
+	snarl.RegisterConfig2(window->getID(), name.getUTF8Data(), 0, icon.string().c_str());
 	foreach(Notifier::Type type, getAllTypes()) {
 		snarl.RegisterAlert(name.getUTF8Data(), typeToString(type).getUTF8Data());
 	}
diff --git a/SwifTools/Notifier/SnarlNotifier.h b/SwifTools/Notifier/SnarlNotifier.h
index 45408ec..d744023 100644
--- a/SwifTools/Notifier/SnarlNotifier.h
+++ b/SwifTools/Notifier/SnarlNotifier.h
@@ -16,7 +16,7 @@ namespace Swift {
 
 	class SnarlNotifier : public Notifier {
 		public:
-			SnarlNotifier(const String& name, Win32NotifierWindow* window);
+			SnarlNotifier(const String& name, Win32NotifierWindow* window, const boost::filesystem::path& icon);
 			~SnarlNotifier();
 
 			virtual void showMessage(Type type, const String& subject, const String& description, const boost::filesystem::path& picture, boost::function<void()> callback);
diff --git a/Swift/Packaging/nsis/swift.nsi b/Swift/Packaging/nsis/swift.nsi
index 74c987b..6a5be12 100644
--- a/Swift/Packaging/nsis/swift.nsi
+++ b/Swift/Packaging/nsis/swift.nsi
@@ -65,6 +65,9 @@ File "..\..\QtUI\Swift\imageformats\qtiff4.dll"
 SetOutPath $INSTDIR\sounds
 File "..\..\QtUI\Swift\sounds\message-received.wav"
 
+SetOutPath $INSTDIR\images
+File "..\..\QtUI\Swift\images\logo-icon-32.png"
+
 # create start menu item
 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
 	     CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index 0118416..13543af 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -102,7 +102,7 @@ QtSwift::QtSwift(po::variables_map options) : autoUpdater_(NULL) {
 	notifier_ = new GrowlNotifier(SWIFT_APPLICATION_NAME);
 #elif defined(HAVE_SNARL)
 	notifierWindow_ = new QtWin32NotifierWindow();
-	notifier_ = new SnarlNotifier(SWIFT_APPLICATION_NAME, notifierWindow_);
+	notifier_ = new SnarlNotifier(SWIFT_APPLICATION_NAME, notifierWindow_, applicationPathProvider_->getResourcePath("/images/logo-icon-32.png"));
 #else
 	notifier_ = new NullNotifier();
 #endif
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index 933133d..609eb5d 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -162,7 +162,7 @@ if env["PLATFORM"] == "win32" :
     myenv.WindowsBundle("Swift", resources = [
         os.path.join(env["OPENSSL_DIR"], "bin", "ssleay32.dll"),  
         os.path.join(env["OPENSSL_DIR"], "bin", "libeay32.dll"),
-      ] + commonResources,  
+      ] + commonResources + ["../resources/images"],  
       qtimageformats = ["gif", "ico", "jpeg", "mng", "svg", "tiff"],
       qtlibs = ["QtCore4", "QtGui4", "QtNetwork4", "QtWebKit4", "QtXMLPatterns4", "phonon4"])
 
diff --git a/Swift/resources/images/logo-icon-32.png b/Swift/resources/images/logo-icon-32.png
new file mode 100644
index 0000000..156dc87
Binary files /dev/null and b/Swift/resources/images/logo-icon-32.png differ
-- 
cgit v0.10.2-6-g49f6