when 'hide window on startup' is set, it will
[psensor.git] / src / main.c
index 10baa51..4c16bf7 100644 (file)
@@ -573,7 +573,10 @@ int main(int argc, char **argv)
        associate_cb_alarm_raised(ui.sensors, &ui);
 
        if (ui.config->slog_enabled)
-               slog_activate(NULL, ui.sensors, &ui.sensors_mutex, 5);
+               slog_activate(NULL,
+                             ui.sensors,
+                             &ui.sensors_mutex,
+                             config_get_slog_interval());
 
 #if !defined(HAVE_APPINDICATOR) && !defined(HAVE_APPINDICATOR_029)
        ui_status_init(&ui);
@@ -610,20 +613,27 @@ int main(int argc, char **argv)
 
        /*
         * hack, did not find a cleaner solution.
-        * wait 2s to ensure that the status icon is attempted to be
+        * wait 30s to ensure that the status icon is attempted to be
         * drawn before determining whether the main window must be
         * show.
         */
-       g_timeout_add(2000, (GSourceFunc)initial_window_show, &ui);
+       if  (ui.config->hide_on_startup)
+               g_timeout_add(30000, (GSourceFunc)initial_window_show, &ui);
+       else
+               initial_window_show(&ui);
 
+       printf("main loop\n");
        /* main loop */
        gtk_main();
 
-       g_object_ref(app);
+       g_object_unref(app);
        cleanup(&ui);
 
        log_debug("Quitting...");
        log_close();
 
+       if (url)
+               free(url);
+
        return 0;
 }