summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2016-10-26 20:10:39 +0200
committerCarlos Soriano <csoriano@gnome.org>2016-10-26 20:10:39 +0200
commitebaa70c16770bd4214b339d9e7390510ed7e7b80 (patch)
tree04d192a497225394e2388d7852a39ccfae016d44
parentfc4135d8124157d2435d66aceea5958ed643227d (diff)
downloadnautilus-ebaa70c16770bd4214b339d9e7390510ed7e7b80.tar.gz
progress-info-widget: use constructed instead of new for initialization
As recommended in the docs, constructed should be used for initialize the class when it needs some construct-only properties set (or not) The new handler should only be a wrapper around g_object_new. Patch made by Nacho, thanks!
-rw-r--r--src/nautilus-progress-info-widget.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/nautilus-progress-info-widget.c b/src/nautilus-progress-info-widget.c
index 1cf350ba5..3d241336f 100644
--- a/src/nautilus-progress-info-widget.c
+++ b/src/nautilus-progress-info-widget.c
@@ -123,6 +123,15 @@ nautilus_progress_info_widget_constructed (GObject *obj)
G_OBJECT_CLASS (nautilus_progress_info_widget_parent_class)->constructed (obj);
+ if (nautilus_progress_info_get_is_finished (self->priv->info))
+ {
+ gtk_button_set_image (GTK_BUTTON (self->priv->button), self->priv->done_image);
+ }
+
+ gtk_widget_set_sensitive (self->priv->button,
+ !nautilus_progress_info_get_is_finished (self->priv->info) &&
+ !nautilus_progress_info_get_is_cancelled (self->priv->info));
+
g_signal_connect_swapped (self->priv->info,
"changed",
G_CALLBACK (update_data), self);
@@ -210,20 +219,7 @@ nautilus_progress_info_widget_class_init (NautilusProgressInfoWidgetClass *klass
GtkWidget *
nautilus_progress_info_widget_new (NautilusProgressInfo *info)
{
- NautilusProgressInfoWidget *self;
-
- self = g_object_new (NAUTILUS_TYPE_PROGRESS_INFO_WIDGET,
+ return g_object_new (NAUTILUS_TYPE_PROGRESS_INFO_WIDGET,
"info", info,
NULL);
-
- if (nautilus_progress_info_get_is_finished (self->priv->info))
- {
- gtk_button_set_image (GTK_BUTTON (self->priv->button), self->priv->done_image);
- }
-
- gtk_widget_set_sensitive (self->priv->button,
- !nautilus_progress_info_get_is_finished (self->priv->info) &&
- !nautilus_progress_info_get_is_cancelled (self->priv->info));
-
- return GTK_WIDGET (self);
}