diff options
author | Philip Chimento <philip@endlessm.com> | 2013-08-28 14:26:07 -0700 |
---|---|---|
committer | Philip Chimento <philip@endlessm.com> | 2013-08-28 14:26:07 -0700 |
commit | 6937613bf3839f701878b5468b1f349a0b24b7b1 (patch) | |
tree | 1a533709b7c88bac69e56981d9bbf023e2c1896e /endless/eoswindow.c | |
parent | 0e45b609b3b74745277c255cc5b1f6104de7c72a (diff) |
Create private method for setting 'EosWindow:application'
In order to avoid lots of code in the switch statement in
eos_window_set_property()
[endlessm/eos-shell#853]
Diffstat (limited to 'endless/eoswindow.c')
-rw-r--r-- | endless/eoswindow.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/endless/eoswindow.c b/endless/eoswindow.c index f6451e2..0f507e0 100644 --- a/endless/eoswindow.c +++ b/endless/eoswindow.c @@ -369,6 +369,18 @@ eos_window_get_property (GObject *object, } static void +set_application (EosWindow *self, + EosApplication *application) +{ + self->priv->application = application; + gtk_window_set_application (GTK_WINDOW (self), + GTK_APPLICATION (self->priv->application)); + if (self->priv->application == NULL) + g_error ("In order to create a window, you must have an application " + "for it to connect to."); +} + +static void eos_window_set_property (GObject *object, guint property_id, const GValue *value, @@ -379,12 +391,7 @@ eos_window_set_property (GObject *object, switch (property_id) { case PROP_APPLICATION: - self->priv->application = g_value_get_object (value); - gtk_window_set_application (GTK_WINDOW (self), - GTK_APPLICATION (self->priv->application)); - if (self->priv->application == NULL) - g_error ("In order to create a window, you must have an application " - "for it to connect to."); + set_application (self, g_value_get_object (value)); break; case PROP_PAGE_MANAGER: |