about summary refs log tree commit diff stats
path: root/src/profanity.c
diff options
context:
space:
mode:
authorDavid <petrodavi@gmail.com>2016-03-30 22:18:45 +0200
committerDavid <petrodavi@gmail.com>2016-03-30 23:21:41 +0200
commit1e60d17d7c32194aa090f8d2ba7d5be4bffc0a44 (patch)
tree884eec01bb1255cf24b712256f5059fa1948f556 /src/profanity.c
parentbdad30b2d9111a5c86edeabf811481469ef0f8b4 (diff)
downloadprofani-tty-1e60d17d7c32194aa090f8d2ba7d5be4bffc0a44.tar.gz
libgtk is now optional
Having the lib is no more needed.
Diffstat (limited to 'src/profanity.c')
-rw-r--r--src/profanity.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/profanity.c b/src/profanity.c
index 50f564c7..d6c39f06 100644
--- a/src/profanity.c
+++ b/src/profanity.c
@@ -37,7 +37,9 @@
 #include "gitversion.h"
 #endif
 
+#ifdef PROF_HAVE_GTK
 #include <gtk/gtk.h>
+#endif
 #include <locale.h>
 #include <signal.h>
 #include <stdlib.h>
@@ -73,7 +75,9 @@
 #include "window_list.h"
 #include "event/client_events.h"
 #include "config/tlscerts.h"
+#ifdef PROF_HAVE_GTK
 #include "tray.h"
+#endif
 
 static void _check_autoaway(void);
 static void _init(char *log_level);
@@ -94,17 +98,15 @@ char *saved_status;
 
 static gboolean cont = TRUE;
 static gboolean force_quit = FALSE;
-static gboolean gtk_enabled = FALSE;
 
 void
-prof_run(char *log_level, char *account_name, gboolean use_gtk)
+prof_run(char *log_level, char *account_name)
 {
-    gtk_enabled = use_gtk;
     _init(log_level);
     plugins_on_start();
-    if (gtk_enabled) {
-        gtk_main_iteration_do(false);
-    }
+#ifdef PROF_HAVE_GTK
+    gtk_main_iteration_do(false);
+#endif
     _connect_default(account_name);
 
     ui_update();
@@ -137,9 +139,9 @@ prof_run(char *log_level, char *account_name, gboolean use_gtk)
         jabber_process_events(10);
         iq_autoping_check();
         ui_update();
-        if (gtk_enabled) {
-            gtk_main_iteration_do(false);
-        }
+#ifdef PROF_HAVE_GTK
+        gtk_main_iteration_do(false);
+#endif
     }
 }
 
@@ -362,9 +364,9 @@ _init(char *log_level)
 #endif
     atexit(_shutdown);
     plugins_init();
-    if (gtk_enabled) {
-        create_tray();
-    }
+#ifdef PROF_HAVE_GTK
+    create_tray();
+#endif
     inp_nonblocking(TRUE);
 }
 
@@ -383,9 +385,9 @@ _shutdown(void)
     if (conn_status == JABBER_CONNECTED) {
         cl_ev_disconnect();
     }
-    if (gtk_enabled) {
-        destroy_tray();
-    }
+#ifdef PROF_HAVE_GTK
+    destroy_tray();
+#endif
     jabber_shutdown();
     plugins_on_shutdown();
     muc_close();