Code

Track selection changes for updating in icon preview.
authorJon A. Cruz <jon@joncruz.org>
Thu, 6 May 2010 08:49:03 +0000 (01:49 -0700)
committerJon A. Cruz <jon@joncruz.org>
Thu, 6 May 2010 08:49:03 +0000 (01:49 -0700)
src/ui/dialog/icon-preview.cpp
src/ui/dialog/icon-preview.h

index 946eed4ca64cd32066fc0a27e92c4695e0e6ee71..9a46254abaa39b25a07c127a289b7720e439cd3e 100644 (file)
@@ -90,7 +90,8 @@ IconPreviewPanel::IconPreviewPanel() :
     selectionButton(0),
     desktopChangeConn(),
     docReplacedConn(),
-    docModConn()
+    docModConn(),
+    selChangedConn()
 {
     Inkscape::Preferences *prefs = Inkscape::Preferences::get();
     numEntries = 0;
@@ -242,6 +243,7 @@ IconPreviewPanel::~IconPreviewPanel()
         timer = 0;
     }
 
+    selChangedConn.disconnect();
     docModConn.disconnect();
     docReplacedConn.disconnect();
     desktopChangeConn.disconnect();
@@ -261,10 +263,14 @@ void IconPreviewPanel::setDesktop( SPDesktop* desktop )
 
     if ( desktop != this->desktop ) {
         docReplacedConn.disconnect();
+        selChangedConn.disconnect();
 
         this->desktop = Panel::getDesktop();
         if ( this->desktop ) {
             docReplacedConn = this->desktop->connectDocumentReplaced(sigc::hide<0>(sigc::mem_fun(this, &IconPreviewPanel::setDocument)));
+            if (this->desktop->selection) {
+                selChangedConn = desktop->selection->connectChanged(sigc::hide(sigc::mem_fun(this, &IconPreviewPanel::queueRefresh)));
+            }
         }
     }
     setDocument(newDoc);
index a0f813b94e2cf6583a9b1e6f9287627cfebfac89..9de8825697fa2349b23cd0a69974f24a8d460563 100644 (file)
@@ -84,6 +84,7 @@ private:
     sigc::connection desktopChangeConn;
     sigc::connection docReplacedConn;
     sigc::connection docModConn;
+    sigc::connection selChangedConn;
 
 
     void setDocument( SPDocument *document );