mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
fix no gtk init
This commit is contained in:
parent
24c5d3882c
commit
028d24283e
@ -50,6 +50,7 @@
|
||||
static gboolean version = FALSE;
|
||||
static char *log = "INFO";
|
||||
static char *account_name = NULL;
|
||||
static gboolean use_gtk = FALSE;
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
@ -141,9 +142,11 @@ main(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
assert (gtk_init_check(&argc, &argv) == true);
|
||||
gtk_init(&argc, &argv);
|
||||
prof_run(log, account_name);
|
||||
use_gtk = gtk_init_check(&argc, &argv);
|
||||
if (use_gtk) {
|
||||
gtk_init(&argc, &argv);
|
||||
}
|
||||
prof_run(log, account_name, use_gtk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -94,13 +94,17 @@ 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)
|
||||
prof_run(char *log_level, char *account_name, gboolean use_gtk)
|
||||
{
|
||||
gtk_enabled = use_gtk;
|
||||
_init(log_level);
|
||||
plugins_on_start();
|
||||
gtk_main_iteration_do(false);
|
||||
if (gtk_enabled) {
|
||||
gtk_main_iteration_do(false);
|
||||
}
|
||||
_connect_default(account_name);
|
||||
|
||||
ui_update();
|
||||
@ -356,7 +360,9 @@ _init(char *log_level)
|
||||
#endif
|
||||
atexit(_shutdown);
|
||||
plugins_init();
|
||||
create_tray();
|
||||
if (gtk_enabled) {
|
||||
create_tray();
|
||||
}
|
||||
inp_nonblocking(TRUE);
|
||||
}
|
||||
|
||||
@ -375,8 +381,9 @@ _shutdown(void)
|
||||
if (conn_status == JABBER_CONNECTED) {
|
||||
cl_ev_disconnect();
|
||||
}
|
||||
|
||||
destroy_tray();
|
||||
if (gtk_enabled) {
|
||||
destroy_tray();
|
||||
}
|
||||
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);
|
||||
void prof_run(char *log_level, char *account_name, gboolean use_gtk);
|
||||
|
||||
void prof_handle_idle(void);
|
||||
void prof_handle_activity(void);
|
||||
|
Loading…
Reference in New Issue
Block a user