mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-30 11:06:21 +00:00
fix no gtk init
This commit is contained in:
@@ -50,6 +50,7 @@
|
|||||||
static gboolean version = FALSE;
|
static gboolean version = FALSE;
|
||||||
static char *log = "INFO";
|
static char *log = "INFO";
|
||||||
static char *account_name = NULL;
|
static char *account_name = NULL;
|
||||||
|
static gboolean use_gtk = FALSE;
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
@@ -141,9 +142,11 @@ main(int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert (gtk_init_check(&argc, &argv) == true);
|
use_gtk = gtk_init_check(&argc, &argv);
|
||||||
gtk_init(&argc, &argv);
|
if (use_gtk) {
|
||||||
prof_run(log, account_name);
|
gtk_init(&argc, &argv);
|
||||||
|
}
|
||||||
|
prof_run(log, account_name, use_gtk);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,13 +94,17 @@ char *saved_status;
|
|||||||
|
|
||||||
static gboolean cont = TRUE;
|
static gboolean cont = TRUE;
|
||||||
static gboolean force_quit = FALSE;
|
static gboolean force_quit = FALSE;
|
||||||
|
static gboolean gtk_enabled = FALSE;
|
||||||
|
|
||||||
void
|
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);
|
_init(log_level);
|
||||||
plugins_on_start();
|
plugins_on_start();
|
||||||
gtk_main_iteration_do(false);
|
if (gtk_enabled) {
|
||||||
|
gtk_main_iteration_do(false);
|
||||||
|
}
|
||||||
_connect_default(account_name);
|
_connect_default(account_name);
|
||||||
|
|
||||||
ui_update();
|
ui_update();
|
||||||
@@ -356,7 +360,9 @@ _init(char *log_level)
|
|||||||
#endif
|
#endif
|
||||||
atexit(_shutdown);
|
atexit(_shutdown);
|
||||||
plugins_init();
|
plugins_init();
|
||||||
create_tray();
|
if (gtk_enabled) {
|
||||||
|
create_tray();
|
||||||
|
}
|
||||||
inp_nonblocking(TRUE);
|
inp_nonblocking(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,8 +381,9 @@ _shutdown(void)
|
|||||||
if (conn_status == JABBER_CONNECTED) {
|
if (conn_status == JABBER_CONNECTED) {
|
||||||
cl_ev_disconnect();
|
cl_ev_disconnect();
|
||||||
}
|
}
|
||||||
|
if (gtk_enabled) {
|
||||||
destroy_tray();
|
destroy_tray();
|
||||||
|
}
|
||||||
jabber_shutdown();
|
jabber_shutdown();
|
||||||
plugins_on_shutdown();
|
plugins_on_shutdown();
|
||||||
muc_close();
|
muc_close();
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "xmpp/xmpp.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_idle(void);
|
||||||
void prof_handle_activity(void);
|
void prof_handle_activity(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user