From d7b8bd608ec43222691c8fba856b5b82a753492c Mon Sep 17 00:00:00 2001 From: JucaBlues Date: Tue, 27 Jan 2009 21:05:05 +0000 Subject: [PATCH] draw red X icon while dragging the "remove color" item --- src/dialogs/swatches.cpp | 17 +++++++++++++++++ src/dialogs/swatches.h | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/dialogs/swatches.cpp b/src/dialogs/swatches.cpp index 13c65f707..1a0db9a8a 100644 --- a/src/dialogs/swatches.cpp +++ b/src/dialogs/swatches.cpp @@ -198,6 +198,23 @@ static void dragBegin( GtkWidget *widget, GdkDragContext* dc, gpointer data ) ColorItem* item = reinterpret_cast(data); if ( item ) { + if (item->isRemove()){ + GError *error = NULL; + gchar *filepath = (gchar *) g_strdup_printf("%s/remove-color.png", INKSCAPE_PIXMAPDIR); + gsize bytesRead = 0; + gsize bytesWritten = 0; + gchar *localFilename = g_filename_from_utf8( filepath, + -1, + &bytesRead, + &bytesWritten, + &error); + GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_scale(localFilename, 32, 24, FALSE, &error); + g_free(localFilename); + g_free(filepath); + gtk_drag_set_icon_pixbuf( dc, pixbuf, 0, 0 ); + return; + } + Glib::RefPtr thumb = Gdk::Pixbuf::create( Gdk::COLORSPACE_RGB, false, 8, 32, 24 ); guint32 fillWith = (0xff000000 & (item->def.getR() << 24)) | (0x00ff0000 & (item->def.getG() << 16)) diff --git a/src/dialogs/swatches.h b/src/dialogs/swatches.h index cc0cf8956..00c73ff84 100644 --- a/src/dialogs/swatches.h +++ b/src/dialogs/swatches.h @@ -44,7 +44,7 @@ public: ::PreviewSize size, guint ratio); void buttonClicked(bool secondary = false); - + bool isRemove(){ return _isRemove; } ColorDef def; private: -- 2.30.2