Merge remote-tracking branch 'asdil12/tray_config'

This commit is contained in:
James Booth
2016-04-17 23:17:43 +01:00
9 changed files with 60 additions and 5 deletions

View File

@@ -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)
{