~ubuntu-branches/ubuntu/precise/xchat-gnome/precise

« back to all changes in this revision

Viewing changes to plugins/notification/notification.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2006-01-23 10:38:23 UTC
  • mto: (2.1.1 etch) (1.1.19 upstream)
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20060123103823-qnje8vlt9kpfqsk4
Tags: upstream-0.9
ImportĀ upstreamĀ versionĀ 0.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
        NOTIF_NONE = 0,
47
47
        NOTIF_DATA,
48
48
        NOTIF_MSG,
49
 
        NOTIF_NICK
 
49
        NOTIF_NICK,
 
50
        N_NOTIF
50
51
} NotifStatus;
51
52
 
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));
75
76
        } else {
76
 
                gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbufs[0]);
 
77
                gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbufs[NOTIF_NONE]);
77
78
 
78
79
                /* Show the notification icon. */
79
80
                gtk_widget_show_all (GTK_WIDGET (notification));
92
93
static int
93
94
new_msg_cb (char **word, void *msg_lvl)
94
95
{
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);
203
204
        }
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);
 
205
 
 
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);
208
210
 
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]);
213
215
 
214
216
        g_signal_connect (G_OBJECT (box), "button-press-event", G_CALLBACK (notification_clicked_cb), NULL);
215
217
 
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);
234
236
 
235
237
        xchat_print (ph, _("Notification plugin loaded.\n"));
236
238