Code

noop: dialogs/rdf.cpp: Mark a few pointers as not being written through. Make rdf_ma...
[inkscape.git] / src / dialogs / iconpreview.cpp
index b3ea55df333085e363c3080482b1912d58027878..d0b8b4a8fff87510715f38e8c9b195346085dd9d 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <gtk/gtk.h>
 
+#include <glib/gmem.h>
 #include <gtk/gtkdialog.h> //for GTK_RESPONSE* types
 #include <glibmm/i18n.h>
 #include <gtkmm/buttonbox.h>
@@ -48,16 +49,16 @@ namespace Dialogs {
 
 IconPreviewPanel* IconPreviewPanel::instance = 0;
 
-
-IconPreviewPanel& IconPreviewPanel::getInstance()
+IconPreviewPanel*
+IconPreviewPanel::create(Inkscape::UI::Dialog::Behavior::BehaviorFactory behavior_factory)
 {
     if ( !instance ) {
-        instance = new IconPreviewPanel();
+        instance = new IconPreviewPanel(behavior_factory);
     }
 
     instance->refreshPreview();
 
-    return *instance;
+    return instance;
 }
 
 //#########################################################################
@@ -71,7 +72,7 @@ void IconPreviewPanel::on_button_clicked(int which)
 
         hot = which;
         updateMagnify();
-        queue_draw();
+        get_vbox()->queue_draw();
     }
 }
 
@@ -84,8 +85,8 @@ void IconPreviewPanel::on_button_clicked(int which)
 /**
  * Constructor
  */
-IconPreviewPanel::IconPreviewPanel() :
-    Panel(),
+IconPreviewPanel::IconPreviewPanel(Inkscape::UI::Dialog::Behavior::BehaviorFactory behavior_factory) :
+    Inkscape::UI::Dialog::Dialog(behavior_factory, "dialogs.iconpreview", SP_VERB_VIEW_ICON_PREVIEW),
     hot(1),
     refreshButton(0),
     selectionButton(0)
@@ -160,7 +161,7 @@ IconPreviewPanel::IconPreviewPanel() :
         pixMem[i] = new guchar[4 * sizes[i] * sizes[i]];
         memset( pixMem[i], 0x00, 4 *  sizes[i] * sizes[i] );
 
-        GdkPixbuf *pb = gdk_pixbuf_new_from_data( pixMem[i], GDK_COLORSPACE_RGB, TRUE, 8, sizes[i], sizes[i], sizes[i] * 4, /*(GdkPixbufDestroyNotify)nr_free*/NULL, NULL );
+        GdkPixbuf *pb = gdk_pixbuf_new_from_data( pixMem[i], GDK_COLORSPACE_RGB, TRUE, 8, sizes[i], sizes[i], sizes[i] * 4, /*(GdkPixbufDestroyNotify)g_free*/NULL, NULL );
         GtkImage* img = GTK_IMAGE( gtk_image_new_from_pixbuf( pb ) );
         images[i] = Glib::wrap(img);
         Glib::ustring label(*labels[i]);
@@ -185,7 +186,7 @@ IconPreviewPanel::IconPreviewPanel() :
 
 
     Gtk::HButtonBox* holder = new Gtk::HButtonBox( Gtk::BUTTONBOX_END );
-    pack_end( *holder, false, false );
+    get_vbox()->pack_end( *holder, false, false );
 
     selectionButton = new Gtk::ToggleButton(_("Selection")); // , GTK_RESPONSE_APPLY
     holder->pack_start( *selectionButton, false, false );
@@ -201,7 +202,7 @@ IconPreviewPanel::IconPreviewPanel() :
     refreshButton->signal_clicked().connect( sigc::mem_fun(*this, &IconPreviewPanel::refreshPreview) );
 
 
-    pack_start(iconBox, Gtk::PACK_EXPAND_WIDGET);
+    get_vbox()->pack_start(iconBox, Gtk::PACK_EXPAND_WIDGET);
 
     show_all_children();
 }
@@ -218,7 +219,7 @@ void IconPreviewPanel::refreshPreview()
 
         if ( selectionButton && selectionButton->get_active() )
         {
-            Inkscape::Selection * sel = SP_DT_SELECTION(desktop);
+            Inkscape::Selection * sel = sp_desktop_selection(desktop);
             if ( sel ) {
                 //g_message("found a selection to play with");