mirror of
https://github.com/moparisthebest/hexchat
synced 2024-11-25 10:42:18 -05:00
Have tray respect system icons
todo win32
This commit is contained in:
parent
ed395a094e
commit
320e058240
@ -11,10 +11,6 @@
|
|||||||
<file alias="ulist_founder.png" preprocess="to-pixdata" compressed="true">icons/ulist_founder.png</file>
|
<file alias="ulist_founder.png" preprocess="to-pixdata" compressed="true">icons/ulist_founder.png</file>
|
||||||
<file alias="ulist_netop.png" preprocess="to-pixdata" compressed="true">icons/ulist_netop.png</file>
|
<file alias="ulist_netop.png" preprocess="to-pixdata" compressed="true">icons/ulist_netop.png</file>
|
||||||
|
|
||||||
<file alias="tray_fileoffer.png" preprocess="to-pixdata" compressed="true">icons/tray_fileoffer.png</file>
|
|
||||||
<file alias="tray_highlight.png" preprocess="to-pixdata" compressed="true">icons/tray_highlight.png</file>
|
|
||||||
<file alias="tray_message.png" preprocess="to-pixdata" compressed="true">icons/tray_message.png</file>
|
|
||||||
|
|
||||||
<file alias="tree_channel.png" preprocess="to-pixdata">icons/tree_channel.png</file>
|
<file alias="tree_channel.png" preprocess="to-pixdata">icons/tree_channel.png</file>
|
||||||
<file alias="tree_dialog.png" preprocess="to-pixdata" compressed="true">icons/tree_dialog.png</file>
|
<file alias="tree_dialog.png" preprocess="to-pixdata" compressed="true">icons/tree_dialog.png</file>
|
||||||
<file alias="tree_server.png" preprocess="to-pixdata" compressed="true">icons/tree_server.png</file>
|
<file alias="tree_server.png" preprocess="to-pixdata" compressed="true">icons/tree_server.png</file>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
icon_DATA = hexchat.png
|
icon_DATA = hexchat.png hexchat-tray-message.png hexchat-tray-hilight.png hexchat-tray-fileoffer.png
|
||||||
icondir = $(datadir)/icons/hicolor/48x48/apps
|
icondir = $(datadir)/icons/hicolor/48x48/apps
|
||||||
|
|
||||||
hicolor_DATA = hexchat.svg
|
hicolor_DATA = hexchat.svg
|
||||||
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
@ -35,10 +35,6 @@ GdkPixbuf *pix_ulist_owner;
|
|||||||
GdkPixbuf *pix_ulist_founder;
|
GdkPixbuf *pix_ulist_founder;
|
||||||
GdkPixbuf *pix_ulist_netop;
|
GdkPixbuf *pix_ulist_netop;
|
||||||
|
|
||||||
GdkPixbuf *pix_tray_fileoffer;
|
|
||||||
GdkPixbuf *pix_tray_highlight;
|
|
||||||
GdkPixbuf *pix_tray_message;
|
|
||||||
|
|
||||||
GdkPixbuf *pix_tree_channel;
|
GdkPixbuf *pix_tree_channel;
|
||||||
GdkPixbuf *pix_tree_dialog;
|
GdkPixbuf *pix_tree_dialog;
|
||||||
GdkPixbuf *pix_tree_server;
|
GdkPixbuf *pix_tree_server;
|
||||||
@ -115,10 +111,6 @@ pixmaps_init (void)
|
|||||||
pix_ulist_founder = load_pixmap ("ulist_founder");
|
pix_ulist_founder = load_pixmap ("ulist_founder");
|
||||||
pix_ulist_netop = load_pixmap ("ulist_netop");
|
pix_ulist_netop = load_pixmap ("ulist_netop");
|
||||||
|
|
||||||
pix_tray_fileoffer = load_pixmap ("tray_fileoffer");
|
|
||||||
pix_tray_highlight = load_pixmap ("tray_highlight");
|
|
||||||
pix_tray_message = load_pixmap ("tray_message");
|
|
||||||
|
|
||||||
pix_tree_channel = load_pixmap ("tree_channel");
|
pix_tree_channel = load_pixmap ("tree_channel");
|
||||||
pix_tree_dialog = load_pixmap ("tree_dialog");
|
pix_tree_dialog = load_pixmap ("tree_dialog");
|
||||||
pix_tree_server = load_pixmap ("tree_server");
|
pix_tree_server = load_pixmap ("tree_server");
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include "../common/util.h"
|
#include "../common/util.h"
|
||||||
#include "../common/outbound.h"
|
#include "../common/outbound.h"
|
||||||
#include "fe-gtk.h"
|
#include "fe-gtk.h"
|
||||||
#include "pixmaps.h"
|
|
||||||
#include "maingui.h"
|
#include "maingui.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
|
|
||||||
@ -47,10 +46,10 @@ typedef enum /* current icon status */
|
|||||||
TS_CUSTOM /* plugin */
|
TS_CUSTOM /* plugin */
|
||||||
} TrayStatus;
|
} TrayStatus;
|
||||||
|
|
||||||
#define ICON_NORMAL pix_hexchat
|
#define ICON_NORMAL "hexchat-tray"
|
||||||
#define ICON_MSG pix_tray_message
|
#define ICON_MSG "hexchat-tray-message"
|
||||||
#define ICON_HILIGHT pix_tray_highlight
|
#define ICON_HILIGHT "hexchat-tray-hilight"
|
||||||
#define ICON_FILE pix_tray_fileoffer
|
#define ICON_FILE "hexchat-tray-fileoffer"
|
||||||
#define TIMEOUT 500
|
#define TIMEOUT 500
|
||||||
|
|
||||||
static hexchat_plugin *ph;
|
static hexchat_plugin *ph;
|
||||||
@ -177,7 +176,7 @@ tray_stop_flash (void)
|
|||||||
|
|
||||||
if (sticon)
|
if (sticon)
|
||||||
{
|
{
|
||||||
gtk_status_icon_set_from_pixbuf (sticon, ICON_NORMAL);
|
gtk_status_icon_set_from_icon_name (sticon, ICON_NORMAL);
|
||||||
nets = tray_count_networks ();
|
nets = tray_count_networks ();
|
||||||
chans = tray_count_channels ();
|
chans = tray_count_channels ();
|
||||||
if (nets)
|
if (nets)
|
||||||
@ -212,40 +211,43 @@ tray_reset_counts (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tray_timeout_cb (GdkPixbuf *icon)
|
tray_timeout_cb (const char *icon)
|
||||||
{
|
{
|
||||||
if (custom_icon1)
|
/*if (custom_icon1)
|
||||||
{
|
{
|
||||||
if (gtk_status_icon_get_pixbuf (sticon) == custom_icon1)
|
if (gtk_status_icon_get_pixbuf (sticon) == custom_icon1)
|
||||||
{
|
{
|
||||||
if (custom_icon2)
|
if (custom_icon2)
|
||||||
gtk_status_icon_set_from_pixbuf (sticon, custom_icon2);
|
gtk_status_icon_set_from_pixbuf (sticon, custom_icon2);
|
||||||
else
|
else
|
||||||
gtk_status_icon_set_from_pixbuf (sticon, ICON_NORMAL);
|
gtk_status_icon_set_from_icon_name (sticon, ICON_NORMAL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_status_icon_set_from_pixbuf (sticon, custom_icon1);
|
gtk_status_icon_set_from_pixbuf (sticon, custom_icon1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else*/
|
||||||
{
|
{
|
||||||
if (gtk_status_icon_get_pixbuf (sticon) == ICON_NORMAL)
|
/*if (gtk_status_icon_get_pixbuf (sticon) == ICON_NORMAL)
|
||||||
gtk_status_icon_set_from_pixbuf (sticon, icon);
|
gtk_status_icon_set_from_pixbuf (sticon, icon);
|
||||||
else
|
else*/
|
||||||
gtk_status_icon_set_from_pixbuf (sticon, ICON_NORMAL);
|
gtk_status_icon_set_from_icon_name (sticon, ICON_NORMAL);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tray_set_flash (GdkPixbuf *icon)
|
tray_set_flash (char *icon)
|
||||||
{
|
{
|
||||||
|
const char *curr_icon;
|
||||||
|
|
||||||
if (!sticon)
|
if (!sticon)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* already flashing the same icon */
|
/* already flashing the same icon */
|
||||||
if (flash_tag && gtk_status_icon_get_pixbuf (sticon) == icon)
|
curr_icon = gtk_status_icon_get_icon_name (sticon);
|
||||||
|
if (flash_tag && (curr_icon && !g_strcmp0 (curr_icon, icon)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* no flashing if window is focused */
|
/* no flashing if window is focused */
|
||||||
@ -254,7 +256,7 @@ tray_set_flash (GdkPixbuf *icon)
|
|||||||
|
|
||||||
tray_stop_flash ();
|
tray_stop_flash ();
|
||||||
|
|
||||||
gtk_status_icon_set_from_pixbuf (sticon, icon);
|
gtk_status_icon_set_from_icon_name (sticon, icon);
|
||||||
if (prefs.hex_gui_tray_blink)
|
if (prefs.hex_gui_tray_blink)
|
||||||
flash_tag = g_timeout_add (TIMEOUT, (GSourceFunc) tray_timeout_cb, icon);
|
flash_tag = g_timeout_add (TIMEOUT, (GSourceFunc) tray_timeout_cb, icon);
|
||||||
}
|
}
|
||||||
@ -270,7 +272,7 @@ fe_tray_set_flash (const char *filename1, const char *filename2, int tout)
|
|||||||
|
|
||||||
if (tout == -1)
|
if (tout == -1)
|
||||||
tout = TIMEOUT;
|
tout = TIMEOUT;
|
||||||
|
#if 0
|
||||||
custom_icon1 = gdk_pixbuf_new_from_file (filename1, NULL);
|
custom_icon1 = gdk_pixbuf_new_from_file (filename1, NULL);
|
||||||
if (filename2)
|
if (filename2)
|
||||||
custom_icon2 = gdk_pixbuf_new_from_file (filename2, NULL);
|
custom_icon2 = gdk_pixbuf_new_from_file (filename2, NULL);
|
||||||
@ -278,6 +280,7 @@ fe_tray_set_flash (const char *filename1, const char *filename2, int tout)
|
|||||||
gtk_status_icon_set_from_pixbuf (sticon, custom_icon1);
|
gtk_status_icon_set_from_pixbuf (sticon, custom_icon1);
|
||||||
flash_tag = g_timeout_add (tout, (GSourceFunc) tray_timeout_cb, NULL);
|
flash_tag = g_timeout_add (tout, (GSourceFunc) tray_timeout_cb, NULL);
|
||||||
tray_status = TS_CUSTOM;
|
tray_status = TS_CUSTOM;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -316,9 +319,11 @@ fe_tray_set_file (const char *filename)
|
|||||||
|
|
||||||
if (filename)
|
if (filename)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
custom_icon1 = gdk_pixbuf_new_from_file (filename, NULL);
|
custom_icon1 = gdk_pixbuf_new_from_file (filename, NULL);
|
||||||
gtk_status_icon_set_from_pixbuf (sticon, custom_icon1);
|
gtk_status_icon_set_from_pixbuf (sticon, custom_icon1);
|
||||||
tray_status = TS_CUSTOM;
|
tray_status = TS_CUSTOM;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,7 +379,7 @@ fe_tray_set_icon (feicon icon)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tray_set_flash (GdkPixbuf *icon)
|
tray_set_flash (const char *icon)
|
||||||
{
|
{
|
||||||
if (sticon)
|
if (sticon)
|
||||||
{
|
{
|
||||||
@ -650,7 +655,7 @@ tray_init (void)
|
|||||||
custom_icon1 = NULL;
|
custom_icon1 = NULL;
|
||||||
custom_icon2 = NULL;
|
custom_icon2 = NULL;
|
||||||
|
|
||||||
sticon = gtk_status_icon_new_from_pixbuf (ICON_NORMAL);
|
sticon = gtk_status_icon_new_from_icon_name (ICON_NORMAL);
|
||||||
if (!sticon)
|
if (!sticon)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -708,9 +713,9 @@ make_menu ()
|
|||||||
static void
|
static void
|
||||||
tray_init (void)
|
tray_init (void)
|
||||||
{
|
{
|
||||||
sticon = app_indicator_new ("hexchat", "hexchat-tray", APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
|
sticon = app_indicator_new ("hexchat", ICON_NORMAL, APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
|
||||||
app_indicator_set_status (sticon, APP_INDICATOR_STATUS_ACTIVE);
|
app_indicator_set_status (sticon, APP_INDICATOR_STATUS_ACTIVE);
|
||||||
//app_indicator_set_attention_icon_full (sticon, "/usr/share/icons/hicolor/32x32/apps/hexchat-attention.png", "");
|
app_indicator_set_attention_icon_full (sticon, ICON_HILIGHT, "");
|
||||||
app_indicator_set_menu (sticon, make_menu ());
|
app_indicator_set_menu (sticon, make_menu ());
|
||||||
}
|
}
|
||||||
#endif /* End AppIndicator */
|
#endif /* End AppIndicator */
|
||||||
|
Loading…
Reference in New Issue
Block a user