1
0
mirror of https://github.com/profanity-im/profanity.git synced 2025-01-03 14:57:42 -05:00

Moved libnotify checks to _notify

This commit is contained in:
James Booth 2012-12-11 23:48:12 +00:00
parent bcfe39e593
commit 253eb453f2

View File

@ -106,13 +106,11 @@ static void _win_show_history(WINDOW *win, int win_index,
static gboolean _new_release(char *found_version); static gboolean _new_release(char *found_version);
static void _ui_draw_win_title(void); static void _ui_draw_win_title(void);
#ifdef HAVE_LIBNOTIFY
static void _notify(const char * const message, int timeout, static void _notify(const char * const message, int timeout,
const char * const category); const char * const category);
static void _notify_remind(gint unread); static void _notify_remind(gint unread);
static void _notify_message(const char * const short_from); static void _notify_message(const char * const short_from);
static void _notify_typing(const char * const from); static void _notify_typing(const char * const from);
#endif
void void
ui_init(void) ui_init(void)
@ -288,10 +286,8 @@ ui_show_typing(const char * const from)
} }
} }
#ifdef HAVE_LIBNOTIFY
if (prefs_get_notify_typing()) if (prefs_get_notify_typing())
_notify_typing(from); _notify_typing(from);
#endif
} }
void void
@ -440,10 +436,8 @@ ui_show_incoming_msg(const char * const from, const char * const message,
if (prefs_get_beep()) if (prefs_get_beep())
beep(); beep();
#ifdef HAVE_LIBNOTIFY
if (prefs_get_notify_message()) if (prefs_get_notify_message())
_notify_message(from); _notify_message(from);
#endif
} }
void void
@ -1022,11 +1016,9 @@ win_show_room_message(const char * const room_jid, const char * const nick,
if (prefs_get_beep()) { if (prefs_get_beep()) {
beep(); beep();
} }
#ifdef HAVE_LIBNOTIFY
if (prefs_get_notify_message()) { if (prefs_get_notify_message()) {
_notify_message(nick); _notify_message(nick);
} }
#endif
} }
} }
@ -1658,19 +1650,17 @@ cons_check_version(gboolean not_available_msg)
void void
notify_remind(void) notify_remind(void)
{ {
#ifdef HAVE_LIBNOTIFY
gint unread = _win_get_unread(); gint unread = _win_get_unread();
if (unread > 0) { if (unread > 0) {
_notify_remind(unread); _notify_remind(unread);
} }
#endif
} }
#ifdef HAVE_LIBNOTIFY
static void static void
_notify(const char * const message, int timeout, _notify(const char * const message, int timeout,
const char * const category) const char * const category)
{ {
#ifdef HAVE_LIBNOTIFY
gboolean notify_initted = notify_is_initted(); gboolean notify_initted = notify_is_initted();
if (!notify_initted) { if (!notify_initted) {
@ -1695,6 +1685,7 @@ _notify(const char * const message, int timeout,
} else { } else {
log_error("Libnotify initialisation error."); log_error("Libnotify initialisation error.");
} }
#endif
} }
static void static void
@ -1727,7 +1718,6 @@ _notify_typing(const char * const from)
_notify(message, 10000, "Incoming message"); _notify(message, 10000, "Incoming message");
} }
#endif
static void static void
_create_windows(void) _create_windows(void)