listitemwidget: Avoid more paramspec lookups
authorMatthias Clasen <mclasen@redhat.com>
Sat, 7 May 2022 02:28:14 +0000 (22:28 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 7 May 2022 02:28:14 +0000 (22:28 -0400)
We can use the same helper function in all
places where we notify all three listitem
properties.

gtk/gtklistitemwidget.c

index 959d56fb4d6374f65aa1e973beb99fa8f20b0898..5a866d291c2c4fa4212ea2d155c9a8d68ec3c2a1 100644 (file)
@@ -522,12 +522,10 @@ gtk_list_item_widget_default_setup (GtkListItemWidget *self,
 
   gtk_list_item_widget_set_activatable (self, list_item->activatable);
 
-  if (priv->item)
-    g_object_notify (G_OBJECT (list_item), "item");
-  if (priv->position != GTK_INVALID_LIST_POSITION)
-    g_object_notify (G_OBJECT (list_item), "position");
-  if (priv->selected)
-    g_object_notify (G_OBJECT (list_item), "selected");
+  gtk_list_item_do_notify (list_item,
+                           priv->item != NULL,
+                           priv->position != GTK_INVALID_LIST_POSITION,
+                           priv->selected);
 }
 
 void
@@ -546,12 +544,10 @@ gtk_list_item_widget_default_teardown (GtkListItemWidget *self,
 
   gtk_list_item_widget_set_activatable (self, FALSE);
 
-  if (priv->item)
-    g_object_notify (G_OBJECT (list_item), "item");
-  if (priv->position != GTK_INVALID_LIST_POSITION)
-    g_object_notify (G_OBJECT (list_item), "position");
-  if (priv->selected)
-    g_object_notify (G_OBJECT (list_item), "selected");
+  gtk_list_item_do_notify (list_item,
+                           priv->item != NULL,
+                           priv->position != GTK_INVALID_LIST_POSITION,
+                           priv->selected);
 }
 
 void