[gnome-photos] spinner-box: Don't set any extra properties in g_object_new



commit 3723741d4d2245e57a7bad1811c4add6ecad6ee9
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Mar 28 11:35:45 2017 +0200

    spinner-box: Don't set any extra properties in g_object_new
    
    The GObject recommendation is that the C convenience wrapper,
    foo_bar_new (), should be same as g_object_new (FOO_TYPE_BAR, NULL).
    In this case, it ensures that there is no difference between a
    SpinnerBox that's created using the C convenience wrapper and one
    created via a GtkBuilder template.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780424

 src/photos-spinner-box.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/photos-spinner-box.c b/src/photos-spinner-box.c
index 7f5659a..c87906d 100644
--- a/src/photos-spinner-box.c
+++ b/src/photos-spinner-box.c
@@ -63,6 +63,8 @@ photos_spinner_box_constructed (GObject *object)
 
   G_OBJECT_CLASS (photos_spinner_box_parent_class)->constructed (object);
 
+  gtk_revealer_set_transition_type (GTK_REVEALER (self), GTK_REVEALER_TRANSITION_TYPE_CROSSFADE);
+
   self->spinner = gtk_spinner_new ();
   gtk_widget_set_size_request (self->spinner, 128, 128);
   gtk_widget_set_halign (self->spinner, GTK_ALIGN_CENTER);
@@ -74,6 +76,8 @@ photos_spinner_box_constructed (GObject *object)
 static void
 photos_spinner_box_init (PhotosSpinnerBox *self)
 {
+  gtk_widget_set_halign (GTK_WIDGET (self), GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (GTK_WIDGET (self), GTK_ALIGN_CENTER);
 }
 
 
@@ -89,11 +93,7 @@ photos_spinner_box_class_init (PhotosSpinnerBoxClass *class)
 GtkWidget *
 photos_spinner_box_new (void)
 {
-  return g_object_new (PHOTOS_TYPE_SPINNER_BOX,
-                       "halign", GTK_ALIGN_CENTER,
-                       "transition-type", GTK_REVEALER_TRANSITION_TYPE_CROSSFADE,
-                       "valign", GTK_ALIGN_CENTER,
-                       NULL);
+  return g_object_new (PHOTOS_TYPE_SPINNER_BOX, NULL);
 }
 
 


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