mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Merge branch 'master' into osx-functional
This commit is contained in:
commit
35a471baa7
@ -1253,6 +1253,19 @@ static struct cmd_t command_defs[] =
|
||||
CMD_NOEXAMPLES
|
||||
},
|
||||
|
||||
{ "/tray",
|
||||
cmd_tray, parse_args, 1, 1, &cons_tray_setting,
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
"/tray on|off")
|
||||
CMD_DESC(
|
||||
"Display an icon in the tray that will indicate new messages.")
|
||||
CMD_ARGS(
|
||||
{ "on|off", "Enable or disable tray icon." })
|
||||
CMD_NOEXAMPLES
|
||||
},
|
||||
|
||||
{ "/intype",
|
||||
cmd_intype, parse_args, 1, 1, &cons_intype_setting,
|
||||
CMD_TAGS(
|
||||
@ -3061,9 +3074,9 @@ _cmd_complete_parameters(ProfWin *window, const char *const input)
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
// autocomplete boolean settings
|
||||
gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype",
|
||||
"/flash", "/splash", "/chlog", "/grlog", "/history", "/vercheck",
|
||||
"/privileges", "/presence", "/wrap", "/winstidy", "/carbons", "/encwarn", "/lastactivity" };
|
||||
gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype", "/flash", "/splash", "/chlog", "/grlog",
|
||||
"/history", "/vercheck", "/privileges", "/presence", "/wrap", "/winstidy", "/carbons", "/encwarn",
|
||||
"/lastactivity", "/tray" };
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
|
||||
result = autocomplete_param_with_func(input, boolean_choices[i], prefs_autocomplete_boolean_choice);
|
||||
|
@ -77,6 +77,9 @@
|
||||
#include "ui/ui.h"
|
||||
#include "window_list.h"
|
||||
#include "event/client_events.h"
|
||||
#ifdef HAVE_GTK
|
||||
#include "tray.h"
|
||||
#endif
|
||||
|
||||
static void _update_presence(const resource_presence_t presence,
|
||||
const char *const show, gchar **args);
|
||||
@ -5525,6 +5528,27 @@ cmd_flash(ProfWin *window, const char *const command, gchar **args)
|
||||
return _cmd_set_boolean_preference(args[0], command, "Screen flash", PREF_FLASH);
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_tray(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
#ifdef HAVE_GTK
|
||||
gboolean old = prefs_get_boolean(PREF_TRAY);
|
||||
gboolean ret = _cmd_set_boolean_preference(args[0], command, "Tray icon", PREF_TRAY);
|
||||
gboolean new = prefs_get_boolean(PREF_TRAY);
|
||||
if (old != new) {
|
||||
if (new) {
|
||||
create_tray();
|
||||
} else {
|
||||
destroy_tray();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
#else
|
||||
cons_show("This version of Profanity has not been built with GTK Tray Icon support enabled");
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_intype(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
|
@ -89,6 +89,7 @@ gboolean cmd_lastactivity(ProfWin *window, const char *const command, gchar **ar
|
||||
gboolean cmd_disconnect(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_dnd(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_flash(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_tray(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_gone(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_grlog(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_group(ProfWin *window, const char *const command, gchar **args);
|
||||
|
@ -1239,6 +1239,7 @@ _get_group(preference_t pref)
|
||||
case PREF_NOTIFY_SUB:
|
||||
case PREF_NOTIFY_MENTION_CASE_SENSITIVE:
|
||||
case PREF_NOTIFY_MENTION_WHOLE_WORD:
|
||||
case PREF_TRAY:
|
||||
return PREF_GROUP_NOTIFICATIONS;
|
||||
case PREF_CHLOG:
|
||||
case PREF_GRLOG:
|
||||
@ -1289,6 +1290,8 @@ _get_key(preference_t pref)
|
||||
return "titlebar.goodbye";
|
||||
case PREF_FLASH:
|
||||
return "flash";
|
||||
case PREF_TRAY:
|
||||
return "tray";
|
||||
case PREF_INTYPE:
|
||||
return "intype";
|
||||
case PREF_HISTORY:
|
||||
@ -1502,6 +1505,7 @@ _get_default_boolean(preference_t pref)
|
||||
case PREF_TLS_SHOW:
|
||||
case PREF_LASTACTIVITY:
|
||||
case PREF_NOTIFY_MENTION_WHOLE_WORD:
|
||||
case PREF_TRAY:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
|
@ -52,6 +52,7 @@ typedef enum {
|
||||
PREF_TITLEBAR_SHOW,
|
||||
PREF_TITLEBAR_GOODBYE,
|
||||
PREF_FLASH,
|
||||
PREF_TRAY,
|
||||
PREF_INTYPE,
|
||||
PREF_HISTORY,
|
||||
PREF_CARBONS,
|
||||
|
@ -373,7 +373,7 @@ _init(char *log_level)
|
||||
atexit(_shutdown);
|
||||
plugins_init();
|
||||
#ifdef HAVE_GTK
|
||||
if (gtk_ready) {
|
||||
if (gtk_ready && prefs_get_boolean(PREF_TRAY)) {
|
||||
log_debug("Building GTK icon");
|
||||
create_tray();
|
||||
}
|
||||
@ -397,7 +397,7 @@ _shutdown(void)
|
||||
cl_ev_disconnect();
|
||||
}
|
||||
#ifdef HAVE_GTK
|
||||
if (gtk_ready) {
|
||||
if (gtk_ready && prefs_get_boolean(PREF_TRAY)) {
|
||||
destroy_tray();
|
||||
}
|
||||
#endif
|
||||
|
@ -1182,6 +1182,15 @@ cons_flash_setting(void)
|
||||
cons_show("Terminal flash (/flash) : OFF");
|
||||
}
|
||||
|
||||
void
|
||||
cons_tray_setting(void)
|
||||
{
|
||||
if (prefs_get_boolean(PREF_TRAY))
|
||||
cons_show("Tray icon (/tray) : ON");
|
||||
else
|
||||
cons_show("Tray icon (/tray) : OFF");
|
||||
}
|
||||
|
||||
void
|
||||
cons_splash_setting(void)
|
||||
{
|
||||
@ -1611,6 +1620,7 @@ cons_show_desktop_prefs(void)
|
||||
cons_show("Desktop notification preferences:");
|
||||
cons_show("");
|
||||
cons_notify_setting();
|
||||
cons_tray_setting();
|
||||
|
||||
cons_alert();
|
||||
}
|
||||
|
@ -284,6 +284,7 @@ void cons_privileges_setting(void);
|
||||
void cons_beep_setting(void);
|
||||
void cons_console_setting(void);
|
||||
void cons_flash_setting(void);
|
||||
void cons_tray_setting(void);
|
||||
void cons_splash_setting(void);
|
||||
void cons_encwarn_setting(void);
|
||||
void cons_tlsshow_setting(void);
|
||||
|
@ -444,6 +444,7 @@ void cons_reconnect_setting(void) {}
|
||||
void cons_autoping_setting(void) {}
|
||||
void cons_autoconnect_setting(void) {}
|
||||
void cons_inpblock_setting(void) {}
|
||||
void cons_tray_setting(void) {}
|
||||
|
||||
void cons_show_contact_online(PContact contact, Resource *resource, GDateTime *last_activity)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user