g_thread_init should not be called since 2.31 (and not 2.32).
[psensor.git] / src / main.c
index ae63a1e..32d8927 100644 (file)
@@ -376,14 +376,26 @@ static gboolean initial_window_show(gpointer data)
        return FALSE;
 }
 
+static void log_glib_info()
+{
+       log_debug("Compiled with GLib %d.%d.%d",
+                 GLIB_MAJOR_VERSION,
+                 GLIB_MINOR_VERSION,
+                 GLIB_MICRO_VERSION);
+
+       log_debug("Running with GLib %d.%d.%d",
+                 glib_major_version,
+                 glib_minor_version,
+                 glib_micro_version);
+}
+
 int main(int argc, char **argv)
 {
        struct ui_psensor ui;
        GError *error;
        GThread *thread;
-       int optc;
+       int optc, cmdok;
        char *url = NULL;
-       int cmdok = 1;
 
        program_name = argv[0];
 
@@ -394,6 +406,7 @@ int main(int argc, char **argv)
        textdomain(PACKAGE);
 #endif
 
+       cmdok = 1;
        while ((optc = getopt_long(argc, argv, "vhd:u:", long_options,
                                   NULL)) != -1) {
                switch (optc) {
@@ -408,8 +421,8 @@ int main(int argc, char **argv)
                        print_version();
                        exit(EXIT_SUCCESS);
                case 'd':
-                       printf(_("Enables debug mode.\n"));
                        log_level = atoi(optarg);
+                       log_printf(LOG_INFO, _("Enables debug mode."));
                        break;
                default:
                        cmdok = 0;
@@ -425,7 +438,17 @@ int main(int argc, char **argv)
 
        log_init();
 
+       log_glib_info();
+#if !(GLIB_CHECK_VERSION(2, 31, 0))
+       /*
+        * Since GLib 2.32 g_thread_init call is deprecated and not
+        * needed. Documentation of this method is not clear whether
+        * it is also useless with 2.3.31.
+        */
+       log_debug("Calling g_thread_init(NULL)");
        g_thread_init(NULL);
+#endif
+
        gdk_threads_init();
        /* gdk_threads_enter(); */