52
53
static EggTrayIcon* notification; /* Notification area icon. */
53
54
static gboolean focused = TRUE; /* GTK_WIDGET_HAS_FOCUS doesn't seem to be working... */
54
55
static gboolean persistant; /* Keep the icon in the tray at all times? */
55
56
static gboolean hidden = FALSE; /* True when the main window is hidden. */
56
static GdkPixbuf* pixbufs[4]; /* Pixbufs */
57
static GdkPixbuf* pixbufs[N_NOTIF]; /* Pixbufs */
57
58
static GtkWidget* image; /* The image displayed by the icon. */
58
59
static GtkWidget* main_window; /* xchat-gnome's main window. */
59
60
static NotifStatus status = NOTIF_NONE; /* Current status level. */
73
74
/* Hide the notification icon. */
74
75
gtk_widget_hide_all (GTK_WIDGET (notification));
76
gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbufs[0]);
77
gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbufs[NOTIF_NONE]);
78
79
/* Show the notification icon. */
79
80
gtk_widget_show_all (GTK_WIDGET (notification));
93
94
new_msg_cb (char **word, void *msg_lvl)
95
if (status <= (NotifStatus) msg_lvl && !focused) {
96
if (status <= (NotifStatus) msg_lvl && (NotifStatus) msg_lvl < N_NOTIF && !focused) {
96
97
status = (NotifStatus) msg_lvl;
97
98
gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbufs[status]);
98
99
gtk_widget_show_all (GTK_WIDGET (notification));
201
202
global = gdk_pixbuf_new_from_file (XCHATSHAREDIR "/global-message.png", 0);
202
203
nicksaid = gdk_pixbuf_new_from_file (XCHATSHAREDIR "/nicksaid.png", 0);
204
pixbufs[0] = gdk_pixbuf_scale_simple (icon, 16, 16, GDK_INTERP_BILINEAR);
205
pixbufs[1] = gdk_pixbuf_scale_simple (newdata, 16, 16, GDK_INTERP_BILINEAR);
206
pixbufs[2] = gdk_pixbuf_scale_simple (global, 16, 16, GDK_INTERP_BILINEAR);
207
pixbufs[3] = gdk_pixbuf_scale_simple (nicksaid, 16, 16, GDK_INTERP_BILINEAR);
206
pixbufs[NOTIF_NONE] = gdk_pixbuf_scale_simple (icon, 16, 16, GDK_INTERP_BILINEAR);
207
pixbufs[NOTIF_DATA] = gdk_pixbuf_scale_simple (newdata, 16, 16, GDK_INTERP_BILINEAR);
208
pixbufs[NOTIF_MSG] = gdk_pixbuf_scale_simple (global, 16, 16, GDK_INTERP_BILINEAR);
209
pixbufs[NOTIF_NICK] = gdk_pixbuf_scale_simple (nicksaid, 16, 16, GDK_INTERP_BILINEAR);
209
211
/* Create the notification icon. */
210
212
notification = egg_tray_icon_new ("xchat-gnome");
211
213
box = gtk_event_box_new ();
212
image = gtk_image_new_from_pixbuf (pixbufs[0]);
214
image = gtk_image_new_from_pixbuf (pixbufs[NOTIF_NONE]);
214
216
g_signal_connect (G_OBJECT (box), "button-press-event", G_CALLBACK (notification_clicked_cb), NULL);
230
232
xchat_hook_print (ph, "Channel Action", XCHAT_PRI_NORM, new_msg_cb, (gpointer) NOTIF_MSG);
231
233
xchat_hook_print (ph, "Channel Msg Hilight", XCHAT_PRI_NORM, new_msg_cb, (gpointer) NOTIF_NICK);
232
234
xchat_hook_print (ph, "Channel Action Hilight", XCHAT_PRI_NORM, new_msg_cb, (gpointer) NOTIF_NICK);
233
xchat_hook_print (ph, "Private Message to Dialog", XCHAT_PRI_NORM, new_msg_cb, (gpointer) NOTIF_MSG);
235
xchat_hook_print (ph, "Private Message to Dialog", XCHAT_PRI_NORM, new_msg_cb, (gpointer) NOTIF_NICK);
235
237
xchat_print (ph, _("Notification plugin loaded.\n"));