Don't rewrite icon image if _lxpanel_button_set_icon() got no changes.
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Thu, 13 Feb 2014 11:16:38 +0000 (13:16 +0200)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Thu, 13 Feb 2014 11:16:38 +0000 (13:16 +0200)
src/misc.c

index 4acbdc8..58536af 100644 (file)
@@ -911,10 +911,15 @@ static void _lxpanel_button_set_icon(GtkWidget* btn, FmIcon* icon, gint size)
     {
         ImgData * data = (ImgData *) g_object_get_qdata(G_OBJECT(img), img_data_id);
 
-        g_object_unref(data->icon);
-        data->icon = icon;
-        data->size = size;
-        _gtk_image_set_from_file_scaled(img, data);
+        if (icon != data->icon || size != data->size) /* something was changed */
+        {
+            g_object_unref(data->icon);
+            data->icon = icon;
+            data->size = size;
+            _gtk_image_set_from_file_scaled(img, data);
+        }
+        else
+            g_object_unref(icon);
     }
     else
         g_object_unref(icon);