From 1522904e12470f9e632c32c2b44555e41e11d15a Mon Sep 17 00:00:00 2001 From: monsta Date: Wed, 8 Jun 2016 14:17:45 +0300 Subject: move indicator loading/setup code into separate function --- src/applet-main.c | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/applet-main.c b/src/applet-main.c index 36a165d..385c21a 100644 --- a/src/applet-main.c +++ b/src/applet-main.c @@ -505,24 +505,9 @@ update_accessible_desc(IndicatorObjectEntry * entry, GtkWidget * menuitem) return; } - -static gboolean -load_module (const gchar * name, GtkWidget * menubar) +static void +load_indicator (GtkWidget * menubar, IndicatorObject *io, const gchar *name) { - g_debug("Looking at Module: %s", name); - g_return_val_if_fail(name != NULL, FALSE); - - if (!g_str_has_suffix(name, G_MODULE_SUFFIX)) { - return FALSE; - } - - g_debug("Loading Module: %s", name); - - /* Build the object for the module */ - gchar * fullpath = g_build_filename(INDICATOR_DIR, name, NULL); - IndicatorObject * io = indicator_object_new_from_file(fullpath); - g_free(fullpath); - /* Set the environment it's in */ indicator_object_set_environment(io, (const GStrv)indicator_env); @@ -546,6 +531,26 @@ load_module (const gchar * name, GtkWidget * menubar) } g_list_free(entries); +} + +static gboolean +load_module (const gchar * name, GtkWidget * menubar) +{ + g_debug("Looking at Module: %s", name); + g_return_val_if_fail(name != NULL, FALSE); + + if (!g_str_has_suffix(name, G_MODULE_SUFFIX)) { + return FALSE; + } + + g_debug("Loading Module: %s", name); + + /* Build the object for the module */ + gchar * fullpath = g_build_filename(INDICATOR_DIR, name, NULL); + IndicatorObject * io = indicator_object_new_from_file(fullpath); + g_free(fullpath); + + load_indicator(menubar, io, name); return TRUE; } -- cgit v1.2.1