diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2013-01-30 17:49:32 +0100 |
---|---|---|
committer | Lars Uebernickel <lars.uebernickel@canonical.com> | 2013-01-30 17:49:32 +0100 |
commit | 8ff25e5375c3a0cb399fa687bf541f1cc0f4a020 (patch) | |
tree | cf6fa48ac7ae61720cadcf68040cfe51dac124ed /libindicator/indicator-ng.c | |
parent | dce947bb991d5d3f6cca2752da17afd186e42acd (diff) | |
download | libayatana-indicator-8ff25e5375c3a0cb399fa687bf541f1cc0f4a020.tar.gz libayatana-indicator-8ff25e5375c3a0cb399fa687bf541f1cc0f4a020.tar.bz2 libayatana-indicator-8ff25e5375c3a0cb399fa687bf541f1cc0f4a020.zip |
indicator-ng: simplify flow in initable_init
Diffstat (limited to 'libindicator/indicator-ng.c')
-rw-r--r-- | libindicator/indicator-ng.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/libindicator/indicator-ng.c b/libindicator/indicator-ng.c index bd0a19c..6ec02b4 100644 --- a/libindicator/indicator-ng.c +++ b/libindicator/indicator-ng.c @@ -362,29 +362,28 @@ indicator_ng_initable_init (GInitable *initable, gchar *bus_name = NULL; keyfile = g_key_file_new (); - if (!g_key_file_load_from_file (keyfile, - self->service_file, - G_KEY_FILE_NONE, - error)) - { - g_key_file_free (keyfile); - return FALSE; - } + if (!g_key_file_load_from_file (keyfile, self->service_file, G_KEY_FILE_NONE, error)) + goto out; - if ((self->name = g_key_file_get_string (keyfile, "Indicator Service", "Name", error)) && - (bus_name = g_key_file_get_string (keyfile, "Indicator Service", "BusName", error)) && - (self->object_path = g_key_file_get_string (keyfile, "Indicator Service", "ObjectPath", error))) - { - self->entry.name_hint = self->name; - - self->name_watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION, - bus_name, - G_BUS_NAME_WATCHER_FLAGS_AUTO_START, - indicator_ng_service_appeared, - indicator_ng_service_vanished, - self, NULL); - } + if (!(self->name = g_key_file_get_string (keyfile, "Indicator Service", "Name", error))) + goto out; + + self->entry.name_hint = self->name; + + if (!(bus_name = g_key_file_get_string (keyfile, "Indicator Service", "BusName", error))) + goto out; + + if (!(self->object_path = g_key_file_get_string (keyfile, "Indicator Service", "ObjectPath", error))) + goto out; + + self->name_watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION, + bus_name, + G_BUS_NAME_WATCHER_FLAGS_AUTO_START, + indicator_ng_service_appeared, + indicator_ng_service_vanished, + self, NULL); +out: g_free (bus_name); g_key_file_free (keyfile); |