summaryrefslogtreecommitdiff
path: root/src/applet-main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/applet-main.c')
-rw-r--r--src/applet-main.c67
1 files changed, 38 insertions, 29 deletions
diff --git a/src/applet-main.c b/src/applet-main.c
index 7cbc18a..36a165d 100644
--- a/src/applet-main.c
+++ b/src/applet-main.c
@@ -551,6 +551,43 @@ load_module (const gchar * name, GtkWidget * menubar)
}
static void
+load_modules (GtkWidget *menubar, gint *indicators_loaded)
+{
+ if (g_file_test(INDICATOR_DIR, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) {
+ GDir * dir = g_dir_open(INDICATOR_DIR, 0, NULL);
+
+ const gchar * name;
+ gint count = 0;
+ while ((name = g_dir_read_name(dir)) != NULL) {
+#ifdef INDICATOR_APPLET_APPMENU
+ if (g_strcmp0(name, "libappmenu.so")) {
+ continue;
+ }
+#else
+ if (!g_strcmp0(name, "libappmenu.so")) {
+ continue;
+ }
+#endif
+#ifdef INDICATOR_APPLET
+ if (!g_strcmp0(name, "libme.so")) {
+ continue;
+ }
+ if (!g_strcmp0(name, "libdatetime.so")) {
+ continue;
+ }
+#endif
+ if (load_module(name, menubar)) {
+ count++;
+ }
+ }
+
+ *indicators_loaded = count;
+
+ g_dir_close (dir);
+ }
+}
+
+static void
hotkey_filter (char * keystring G_GNUC_UNUSED, gpointer data)
{
g_return_if_fail(GTK_IS_MENU_SHELL(data));
@@ -903,35 +940,7 @@ applet_fill_cb (MatePanelApplet * applet, const gchar * iid G_GNUC_UNUSED,
/* Add in filter func */
tomboy_keybinder_bind(hotkey_keycode, hotkey_filter, menubar);
- /* load 'em */
- if (g_file_test(INDICATOR_DIR, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) {
- GDir * dir = g_dir_open(INDICATOR_DIR, 0, NULL);
-
- const gchar * name;
- while ((name = g_dir_read_name(dir)) != NULL) {
-#ifdef INDICATOR_APPLET_APPMENU
- if (g_strcmp0(name, "libappmenu.so")) {
- continue;
- }
-#else
- if (!g_strcmp0(name, "libappmenu.so")) {
- continue;
- }
-#endif
-#ifdef INDICATOR_APPLET
- if (!g_strcmp0(name, "libme.so")) {
- continue;
- }
- if (!g_strcmp0(name, "libdatetime.so")) {
- continue;
- }
-#endif
- if (load_module(name, menubar)) {
- indicators_loaded++;
- }
- }
- g_dir_close (dir);
- }
+ load_modules(menubar, &indicators_loaded);
if (indicators_loaded == 0) {
/* A label to allow for click through */