libgtk is now optional
Having the lib is no more needed.
This commit is contained in:
16
src/main.c
16
src/main.c
@@ -34,7 +34,9 @@
|
||||
|
||||
#include "prof_config.h"
|
||||
|
||||
#ifdef PROF_HAVE_GTK
|
||||
#include <gtk/gtk.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include <assert.h>
|
||||
@@ -50,7 +52,6 @@
|
||||
static gboolean version = FALSE;
|
||||
static char *log = "INFO";
|
||||
static char *account_name = NULL;
|
||||
static gboolean use_gtk = FALSE;
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
@@ -139,14 +140,21 @@ main(int argc, char **argv)
|
||||
g_print("Python plugins: Disabled\n");
|
||||
#endif
|
||||
|
||||
#ifdef PROF_HAVE_GTK
|
||||
g_print("GTK icons: Enabled\n");
|
||||
#else
|
||||
g_print("GTK icons: Disabled\n");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
use_gtk = gtk_init_check(&argc, &argv);
|
||||
if (use_gtk) {
|
||||
#ifdef PROF_HAVE_GTK
|
||||
if (gtk_init_check(&argc, &argv)) {
|
||||
gtk_init(&argc, &argv);
|
||||
}
|
||||
prof_run(log, account_name, use_gtk);
|
||||
#endif
|
||||
prof_run(log, account_name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "resource.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
|
||||
void prof_run(char *log_level, char *account_name, gboolean use_gtk);
|
||||
void prof_run(char *log_level, char *account_name);
|
||||
|
||||
void prof_handle_idle(void);
|
||||
void prof_handle_activity(void);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* tray.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 David Petroni <petrodavi@gmail.com>
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
@@ -32,6 +32,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "prof_config.h"
|
||||
|
||||
#ifdef PROF_HAVE_GTK
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib.h>
|
||||
#include <glib/gstdio.h>
|
||||
@@ -156,3 +159,4 @@ void destroy_tray(void)
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* tray.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 David Petroni <petrodavi@gmail.com>
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user