Esempio n. 1
0
void
fe_tray_set_balloon (const char *title, const char *text)
{
#ifndef WIN32
#if 0
	const char *argv[8];
	const char *path;
	char time[16];
#endif
	WinStatus ws;

	/* no balloons if the window is focused */
	ws = tray_get_window_status ();
	if ((prefs.hex_away_omit_alerts && hexchat_get_info(ph, "away")) ||
		(prefs.hex_gui_focus_omitalerts && ws == WS_FOCUSED))
		return;

	/* bit 1 of flags means "no balloons unless hidden/iconified" */
	if (ws != WS_HIDDEN && prefs.hex_gui_tray_quiet)
		return;

	/* FIXME: this should close the current balloon */
	if (!text)
		return;

#ifdef USE_LIBNOTIFY
	NotifyNotification *notification;
	char *notify_text, *notify_title;

	if (!notify_is_initted())
		notify_init(PACKAGE_NAME);

	notify_text = strip_color (text, -1, STRIP_ALL|STRIP_ESCMARKUP);
	notify_title = strip_color (title, -1, STRIP_ALL);

	notification = XC_NOTIFY_NEW (notify_title, notify_text, HEXCHATSHAREDIR "/icons/hicolor/scalable/apps/hexchat.svg", NULL);

#if NOTIFY_CHECK_VERSION(0,7,0)
	notify_notification_set_hint (notification, "desktop-entry", g_variant_new_string ("hexchat"));
#endif

	g_free ((char *)notify_title);
	g_free ((char *)notify_text);

	notify_notification_set_timeout (notification, prefs.hex_input_balloon_time*1000);
	notify_notification_show (notification, NULL);

	g_object_unref (notification);
#endif
#endif
}
Esempio n. 2
0
void
fe_tray_set_balloon (const char *title, const char *text)
{
#ifndef WIN32
#if 0
	const char *argv[8];
	const char *path;
	char time[16];
#endif
	WinStatus ws;

	/* no balloons if the window is focused */
	ws = tray_get_window_status ();
	if (ws == WS_FOCUSED)
		return;

	/* bit 1 of flags means "no balloons unless hidden/iconified" */
	if (ws != WS_HIDDEN && prefs.hex_gui_tray_quiet)
		return;

	/* FIXME: this should close the current balloon */
	if (!text)
		return;

#ifdef USE_LIBNOTIFY
	NotifyNotification *notification;
	char *notify_text, *notify_title;

	if (!notify_is_initted())
		notify_init(PACKAGE_NAME);

	notify_text = strip_color (text, -1, STRIP_ALL|STRIP_ESCMARKUP);
	notify_title = strip_color (title, -1, STRIP_ALL);

	notification = XC_NOTIFY_NEW (notify_title, notify_text, HEXCHATSHAREDIR "/pixmaps/hexchat.png", NULL);

	g_free ((char *)notify_title);
	g_free ((char *)notify_text);

	notify_notification_set_timeout (notification, prefs.hex_input_balloon_time*1000);
	notify_notification_show (notification, NULL);

	g_object_unref (notification);
#endif
#endif
}