[gnome-shell] st/icon: Simplify property setting in set_gicon()



commit c0fcf2d3a841dd0bb9c4b4cde526be6d5781fe61
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Thu Nov 21 17:17:44 2019 +0700

    st/icon: Simplify property setting in set_gicon()
    
    We can easily use `g_set_object()` to set the gicon property here.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/888

 src/st/st-icon.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
---
diff --git a/src/st/st-icon.c b/src/st/st-icon.c
index 133209d1e6..0f9aa43d22 100644
--- a/src/st/st-icon.c
+++ b/src/st/st-icon.c
@@ -572,15 +572,7 @@ st_icon_set_gicon (StIcon *icon, GIcon *gicon)
   if (g_icon_equal (icon->priv->gicon, gicon)) /* do nothing */
     return;
 
-  if (icon->priv->gicon)
-    {
-      g_object_unref (icon->priv->gicon);
-      icon->priv->gicon = NULL;
-    }
-
-  if (gicon)
-    icon->priv->gicon = g_object_ref (gicon);
-
+  g_set_object (&icon->priv->gicon, gicon);
   g_object_notify_by_pspec (G_OBJECT (icon), props[PROP_GICON]);
 
   st_icon_update (icon);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]