diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2014-01-02 22:30:23 +0000 |
|---|---|---|
| committer | Johan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl> | 2014-01-02 22:30:23 +0000 |
| commit | 5b77fe5686a3162e9bda07bb9f3b322c31d8a565 (patch) | |
| tree | 80af6490d1cb3f622229f6f8e8d3bdb85717b788 /src/widgets/icon.cpp | |
| parent | fix Windows build (constness) (diff) | |
| download | inkscape-5b77fe5686a3162e9bda07bb9f3b322c31d8a565.tar.gz inkscape-5b77fe5686a3162e9bda07bb9f3b322c31d8a565.zip | |
try to improve some error-prone piece of code (icon name related)
(bzr r12870)
Diffstat (limited to 'src/widgets/icon.cpp')
| -rw-r--r-- | src/widgets/icon.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index db9f219e9..6d8ffae2b 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -1624,26 +1624,27 @@ void IconImpl::imageMapNamedCB(GtkWidget* widget, gpointer user_data) GtkImageType type = gtk_image_get_storage_type( GTK_IMAGE(img) ); if ( type == GTK_IMAGE_ICON_NAME ) { - gint iconSize = 0; - gchar* iconName = NULL; + GtkIconSize iconSize = GTK_ICON_SIZE_INVALID; + gchar const* iconName_two = NULL; { g_object_get(G_OBJECT(widget), - "icon-name", &iconName, + "icon-name", &iconName_two, "icon-size", &iconSize, NULL); } for ( std::vector<preRenderItem>::iterator it = pendingRenders.begin(); it != pendingRenders.end(); ++it ) { - if ( (it->_name == iconName) && (it->_lsize == size) ) { - int psize = getPhysSize(size); - prerenderIcon(iconName, size, psize); + /// @todo fix pointer string comparison here!!! "it->_name == iconName_two", that seems very bug-prone + if ( (it->_name == iconName_two) && (it->_lsize == iconSize) ) { + int psize = getPhysSize(iconSize); + prerenderIcon(iconName_two, iconSize, psize); pendingRenders.erase(it); break; } } - gtk_image_set_from_icon_name(img, "", (GtkIconSize)iconSize); - gtk_image_set_from_icon_name(img, iconName, (GtkIconSize)iconSize); + gtk_image_set_from_icon_name(img, "", iconSize); + gtk_image_set_from_icon_name(img, iconName_two, iconSize); } else { g_warning("UNEXPECTED TYPE of %d", (int)type); } |
