aboutsummaryrefslogtreecommitdiff
path: root/libindicator
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2013-05-24 17:10:40 -0400
committerLars Uebernickel <lars.uebernickel@canonical.com>2013-05-24 17:10:40 -0400
commit2712010f2411973ff1687be63e3961f5c76acec3 (patch)
tree7f27f257dd14f4c0c37c1e38bf8e413ac493defd /libindicator
parentae198af4a8d3ea34d308aff1754052f364f398d6 (diff)
downloadlibayatana-indicator-2712010f2411973ff1687be63e3961f5c76acec3.tar.gz
libayatana-indicator-2712010f2411973ff1687be63e3961f5c76acec3.tar.bz2
libayatana-indicator-2712010f2411973ff1687be63e3961f5c76acec3.zip
refactor indicator_ng_initable_init
This makes the flow a bit more apparent. Also gets rid of a goto.
Diffstat (limited to 'libindicator')
-rw-r--r--libindicator/indicator-ng.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/libindicator/indicator-ng.c b/libindicator/indicator-ng.c
index fd78662..0bd3981 100644
--- a/libindicator/indicator-ng.c
+++ b/libindicator/indicator-ng.c
@@ -468,30 +468,24 @@ indicator_ng_initable_init (GInitable *initable,
GKeyFile *keyfile;
keyfile = g_key_file_new ();
- 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)))
- goto out;
-
- self->entry.name_hint = self->name;
-
- if (!(self->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,
- self->bus_name,
- G_BUS_NAME_WATCHER_FLAGS_AUTO_START,
- indicator_ng_service_appeared,
- indicator_ng_service_vanished,
- self, NULL);
+ if (g_key_file_load_from_file (keyfile, self->service_file, G_KEY_FILE_NONE, error))
+ {
+ if ((self->name = g_key_file_get_string (keyfile, "Indicator Service", "Name", error)) &&
+ (self->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,
+ self->bus_name,
+ G_BUS_NAME_WATCHER_FLAGS_AUTO_START,
+ indicator_ng_service_appeared,
+ indicator_ng_service_vanished,
+ self, NULL);
+ }
+ }
-out:
g_key_file_free (keyfile);
-
return self->name_watch_id > 0;
}