annotate plugins/notify.c @ 3566:1496be1c345c

[gaim-migrate @ 3661] Yay for broken stuff. Thanks Ethan. I just hope we find a better way of dealing with this problem. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sat, 28 Sep 2002 22:12:57 +0000
parents 154c4a9d9b6d
children 03ba413ca20b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
1 /* Rewritten by Etan Reisner <deryni@eden.rutgers.edu>
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
2 *
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
3 * Added config dialog
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
4 * Added control over notification method
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
5 * Added control over when to release notification
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
6 *
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
7 * Thanks to Carles Pina i Estany <carles@pinux.info>
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
8 * for count of new messages option
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
9 */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
10
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
11 /* if my flash messages patch gets merged in can use cnv->local
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
12 * to notify on new messages also
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
13 */
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
14
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 #define GAIM_PLUGINS
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 #include "gaim.h"
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17
3428
0202b5e1af69 [gaim-migrate @ 3454]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
18 #include <string.h>
0202b5e1af69 [gaim-migrate @ 3454]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
19 #include <ctype.h>
0202b5e1af69 [gaim-migrate @ 3454]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
20 #include <stdlib.h>
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21 #include <gtk/gtk.h>
3385
7931eb8bba19 [gaim-migrate @ 3404]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
22 #include <X11/Xlib.h>
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
23 #include <X11/Xutil.h>
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
24 #include <X11/Xatom.h>
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
25 #include <gdk/gdkx.h>
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
26
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
27 guint choice = 1;
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
28 #define NOTIFY_FOCUS 0x00000001
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
29 #define NOTIFY_TYPE 0x00000002
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
30 #define NOTIFY_IN_FOCUS 0x00000004
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
31
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
32 guint method = 1;
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
33 #define METHOD_STRING 0x00000001
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
34 #define METHOD_QUOTE 0x00000002
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
35 #define METHOD_URGENT 0x00000004
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
36 #define METHOD_COUNT 0x00000008
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
38 void *handle;
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
39 /* I really don't like this but I was having trouble getting any
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
40 * other way of removing the signal callbacks to work and not crash gaim
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
41 */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
42 GtkWidget *really_evil_hack;
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
43 /* GHashTable *hash = NULL; */
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
44 GtkWidget *Entry;
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
45 gchar *title_string = "(*) ";
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
46
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
47 /* predefine some functions, less warnings */
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
48 void options(GtkWidget *widget, gpointer data);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
49 void un_star(GtkWidget *widget, gpointer data);
3511
7e1c6c16dd41 [gaim-migrate @ 3583]
Sean Egan <seanegan@gmail.com>
parents: 3428
diff changeset
50 int un_star_window(GtkWidget *widget, gpointer data);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
51 void string_remove(GtkWidget *widget);
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
52 void count_remove(GtkWidget *widget);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
53 void quote_remove(GtkWidget *widget);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
54 void urgent_remove(struct conversation *c);
3428
0202b5e1af69 [gaim-migrate @ 3454]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
55 int counter (char *buf, int *length);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
56
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
57 int received_im(struct gaim_connection *gc, char **who, char **what, void *m) {
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
58 char buf[256];
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
59 struct conversation *cnv = find_conversation(*who);
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
60 GtkWindow *win;
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
61 char *me = g_strdup(normalize(gc->username));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
62 int revert_to_return;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
63 Window focus_return;
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
64 int c, length;
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
65
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
66 if (!strcmp(me, normalize(*who))) {
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
67 g_free(me);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
68 return 0;
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
69 }
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
70 g_free(me);
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
71
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
72 if (cnv == NULL)
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
73 {
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
74 if (away_options & OPT_AWAY_QUEUE)
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
75 return 0;
1835
34afd5adaae8 [gaim-migrate @ 1845]
Rob Flynn <gaim@robflynn.com>
parents: 1052
diff changeset
76
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
77 cnv = new_conversation(*who);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
78 }
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
79
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
80 win = (GtkWindow *)cnv->window;
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
81
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
82 XGetInputFocus(GDK_WINDOW_XDISPLAY(cnv->window->window), &focus_return, &revert_to_return);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
83
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
84 if ((choice & NOTIFY_IN_FOCUS) || focus_return != GDK_WINDOW_XWINDOW(cnv->window->window)) {
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
85 if (method & METHOD_STRING) {
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
86 strncpy(buf, win->title, sizeof(buf));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
87 if (!strstr(buf, title_string)) {
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
88 g_snprintf(buf, sizeof(buf), "%s%s", title_string, win->title);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
89 gtk_window_set_title(win, buf);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
90 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
91 }
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
92 if (method & METHOD_COUNT) {
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
93 strncpy(buf, win->title, sizeof(buf));
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
94 c = counter(buf, &length);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
95 if (!c) {
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
96 g_snprintf(buf, sizeof(buf), "[1] %s", win->title);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
97 }
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
98 else if (!g_strncasecmp(buf, "[", 1)) {
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
99 g_snprintf(buf, sizeof(buf), "[%d] %s", c+1, &win->title[3+length]);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
100 }
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
101 gtk_window_set_title(win, buf);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
102 }
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
103 if (method & METHOD_QUOTE) {
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
104 strncpy(buf, win->title, sizeof(buf));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
105 if (g_strncasecmp(buf, "\"", 1)) {
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
106 g_snprintf(buf, sizeof(buf), "\"%s\"", win->title);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
107 gtk_window_set_title(win, buf);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
108 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
109 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
110 if (method & METHOD_URGENT) {
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
111 /* do it the gdk way for windows compatibility(?) if I can figure it out */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
112 /* Sean says this is a bad thing, and I should try using gtk_property_get first */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
113 /* I'll want to pay attention to note on dev.gnome.org though */
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
114 /* gdk_property_change(win->window, WM_HINTS, WM_HINTS, 32, GDK_PROP_MODE_REPLACE, XUrgencyHint, 1); */
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
115 XWMHints *hints = XGetWMHints(GDK_WINDOW_XDISPLAY(cnv->window->window), GDK_WINDOW_XWINDOW(cnv->window->window));
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
116 hints->flags |= XUrgencyHint;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
117 XSetWMHints(GDK_WINDOW_XDISPLAY(cnv->window->window), GDK_WINDOW_XWINDOW(cnv->window->window), hints);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
118 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
119 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
120
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
121 return 0;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
122 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
123
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
124 int sent_im(struct gaim_connection *gc, char *who, char **what, void *m) {
3428
0202b5e1af69 [gaim-migrate @ 3454]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
125 /* char buf[256]; */
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
126 struct conversation *c = find_conversation(who);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
127
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
128 if (method & METHOD_QUOTE)
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
129 quote_remove(c->window);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
130 if (method & METHOD_COUNT)
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
131 count_remove(c->window);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
132 if (method & METHOD_STRING)
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
133 string_remove(c->window);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
134 if (method & METHOD_URGENT)
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
135 urgent_remove(c);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
136 return 0;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
137 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
138
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
139 int new_conv(char *who) {
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
140 struct conversation *c = find_conversation(who);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
141
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
142 /* g_hash_table_insert(hash, who, GINT_TO_POINTER(choice)); */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
143
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
144 if (choice & NOTIFY_FOCUS) {
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
145 gtk_signal_connect_while_alive(GTK_OBJECT(c->window), "focus-in-event", GTK_SIGNAL_FUNC(un_star), NULL, GTK_OBJECT(really_evil_hack));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
146 gtk_object_set_user_data(GTK_OBJECT(c->window), c);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
147 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
148 else {
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
149 gtk_signal_connect_while_alive(GTK_OBJECT(c->window), "button_press_event", GTK_SIGNAL_FUNC(un_star), NULL, GTK_OBJECT(really_evil_hack));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
150 gtk_object_set_user_data(GTK_OBJECT(c->window), c);
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
151 gtk_signal_connect_while_alive(GTK_OBJECT(c->text), "button_press_event", GTK_SIGNAL_FUNC(un_star_window), NULL, GTK_OBJECT(really_evil_hack));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
152 gtk_object_set_user_data(GTK_OBJECT(c->text), c);
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
153 gtk_signal_connect_while_alive(GTK_OBJECT(c->entry), "button_press_event", GTK_SIGNAL_FUNC(un_star_window), NULL, GTK_OBJECT(really_evil_hack));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
154 gtk_object_set_user_data(GTK_OBJECT(c->entry), c);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
155 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
156
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
157 if (choice & NOTIFY_TYPE) {
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
158 gtk_signal_connect_while_alive(GTK_OBJECT(c->entry), "key-press-event", GTK_SIGNAL_FUNC(un_star_window), NULL, GTK_OBJECT(really_evil_hack));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
159 gtk_object_set_user_data(GTK_OBJECT(c->entry), (gpointer) c);
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
160 }
3428
0202b5e1af69 [gaim-migrate @ 3454]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
161 return 0;
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
162 }
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
163
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
164 void un_star(GtkWidget *widget, gpointer data) {
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
165 struct conversation *c = gtk_object_get_user_data(GTK_OBJECT(widget));
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
166
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
167 if (method & METHOD_QUOTE)
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
168 quote_remove(widget);
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
169 if (method & METHOD_COUNT)
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
170 count_remove(widget);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
171 if (method & METHOD_STRING)
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
172 string_remove(widget);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
173 if (method & METHOD_URGENT)
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
174 urgent_remove(c);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
175 return;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
176 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
177
3511
7e1c6c16dd41 [gaim-migrate @ 3583]
Sean Egan <seanegan@gmail.com>
parents: 3428
diff changeset
178 int un_star_window(GtkWidget *widget, gpointer data) {
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
179 GtkWidget *parent = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
180 gtk_object_set_user_data(GTK_OBJECT(parent), gtk_object_get_user_data(GTK_OBJECT(widget)));
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
181 un_star(parent, data);
3511
7e1c6c16dd41 [gaim-migrate @ 3583]
Sean Egan <seanegan@gmail.com>
parents: 3428
diff changeset
182 return 0;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
183 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
184
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
185 /* This function returns the number in [ ]'s or 0 */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
186 int counter (char *buf, int *length) {
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
187 char temp[256];
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
188 int i = 1;
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
189 *length = 0;
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
190
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
191 /* if (buf[0] != '[') */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
192 /* return (0); */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
193
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
194 while (isdigit(buf[i]) && i<sizeof(buf)) {
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
195 temp[i-1] = buf[i];
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
196 (*length)++;
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
197 i++;
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
198 }
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
199 temp[i] = '\0';
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
200
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
201 if (buf[i] != ']') {
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
202 *length = 0;
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
203 return (0);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
204 }
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
205
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
206 return (atoi(temp));
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
207 }
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
208
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
209 void string_remove(GtkWidget *widget) {
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
210 char buf[256];
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
211 GtkWindow *win = GTK_WINDOW(widget);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
212
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
213 strncpy(buf, win->title, sizeof(buf));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
214 if (strstr(buf, title_string)) {
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
215 g_snprintf(buf, sizeof(buf), "%s", &win->title[strlen(title_string)]);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
216 gtk_window_set_title(win, buf);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
217 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
218 return;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
219 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
220
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
221 void count_remove(GtkWidget *widget) {
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
222 char buf[256];
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
223 GtkWindow *win = GTK_WINDOW(widget);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
224 int length;
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
225
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
226 strncpy(buf, win->title, sizeof(buf));
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
227 if (!g_strncasecmp(buf, "[", 1)) {
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
228 counter(buf, &length);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
229 g_snprintf(buf, sizeof(buf), "%s", &win->title[3+length]);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
230 gtk_window_set_title(win, buf);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
231 }
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
232 return;
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
233 }
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
234
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
235 void quote_remove(GtkWidget *widget) {
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
236 char buf[256];
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
237 GtkWindow *win = GTK_WINDOW(widget);
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
238
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
239 strncpy(buf, win->title, sizeof(buf));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
240 if (!g_strncasecmp(buf, "\"", 1)) {
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
241 g_snprintf(buf, strlen(buf) - 1, "%s", &win->title[1]);
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
242 gtk_window_set_title(win, buf);
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
243 }
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
244 return;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
245 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
246
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
247 void urgent_remove(struct conversation *c) {
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
248 GdkWindow *win = c->window->window;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
249
3428
0202b5e1af69 [gaim-migrate @ 3454]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
250 XWMHints *hints = XGetWMHints(GDK_WINDOW_XDISPLAY(win), GDK_WINDOW_XWINDOW(win));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
251 hints->flags &= ~XUrgencyHint;
3428
0202b5e1af69 [gaim-migrate @ 3454]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
252 XSetWMHints(GDK_WINDOW_XDISPLAY(win), GDK_WINDOW_XWINDOW(win), hints);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
253 return;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
254 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
255
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
256 void save_notify_prefs() {
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
257 gchar buf[1000];
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
258 FILE *fp;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
259
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
260 snprintf(buf, 1000, "%s/.gaim/.notify", getenv("HOME"));
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
261 if (!(fp = fopen(buf, "w"))) {
3561
333551497ff8 [gaim-migrate @ 3655]
Sean Egan <seanegan@gmail.com>
parents: 3551
diff changeset
262 do_error_dialog(_("Unable to write to config file"), _("Notify plugin"), GAIM_ERROR);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
263 return;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
264 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
265
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
266 fprintf(fp, "%d=CHOICE\n", choice);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
267 fprintf(fp, "%d=METHOD\n", method);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
268 fprintf(fp, "%s=STRING\n", title_string);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
269 fclose(fp);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
270 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
271
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
272 void load_notify_prefs() {
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
273 gchar buf[1000];
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
274 gchar **parsed;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
275 FILE *fp;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
276
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
277 g_snprintf(buf, sizeof(buf), "%s/.gaim/.notify", getenv("HOME"));
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
278 if (!(fp = fopen(buf, "r")))
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
279 return;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
280
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
281 while (fgets(buf, 1000, fp) != NULL) {
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
282 parsed = g_strsplit(g_strchomp(buf), "=", 2);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
283 if (parsed[0] && parsed[1]) {
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
284 if (!strcmp(parsed[1], "CHOICE"))
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
285 choice = atoi(parsed[0]);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
286 if (!strcmp(parsed[1], "METHOD"))
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
287 method = atoi(parsed[0]);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
288 if (!strcmp(parsed[1], "STRING"))
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
289 if (title_string != NULL) g_free(title_string);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
290 title_string = g_strdup(parsed[0]);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
291 }
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
292 g_strfreev(parsed);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
293 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
294 fclose(fp);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
295 return;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
296 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
297
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
298 void options(GtkWidget *widget, gpointer data) {
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
299 gint option = GPOINTER_TO_INT(data);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
300
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
301 if (option == 0)
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
302 choice ^= NOTIFY_FOCUS;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
303 else if (option == 1)
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
304 choice ^= NOTIFY_TYPE;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
305 else if (option == 2) {
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
306 method ^= METHOD_STRING;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
307 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
308 gtk_widget_set_sensitive(Entry, TRUE);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
309 else
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
310 gtk_widget_set_sensitive(Entry, FALSE);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
311 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
312 else if (option == 3)
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
313 method ^= METHOD_QUOTE;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
314 else if (option == 4)
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
315 method ^= METHOD_URGENT;
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
316 else if (option == 5)
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
317 choice ^= NOTIFY_IN_FOCUS;
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
318 else if (option == 6)
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
319 method ^= METHOD_COUNT;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
320 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
321
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
322 char *gaim_plugin_init(GModule *hndl) {
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
323 handle = hndl;
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
324
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
325 really_evil_hack = gtk_label_new("");
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
326 /* hash = g_hash_table_new(g_str_hash, g_int_equal); */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
327
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
328 load_notify_prefs();
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
329
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
330 gaim_signal_connect(handle, event_im_recv, received_im, NULL);
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
331 gaim_signal_connect(handle, event_im_send, sent_im, NULL);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
332 gaim_signal_connect(handle, event_new_conversation, new_conv, NULL);
1052
25f121faa75e [gaim-migrate @ 1062]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
333
25f121faa75e [gaim-migrate @ 1062]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
334 return NULL;
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
335 }
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
336
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
337 void gaim_plugin_remove() {
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
338 GList *c = conversations;
3428
0202b5e1af69 [gaim-migrate @ 3454]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
339 /* guint options; */
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
340
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
341 gtk_widget_destroy(really_evil_hack);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
342
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
343 while (c) {
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
344 struct conversation *cnv = (struct conversation *)c->data;
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
345 /* if (options = GPOINTER_TO_INT(g_hash_table_lookup(hash, cnv->name))) { */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
346 un_star(cnv->window, NULL);
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
347 /* if (options & REMOVE_FOCUS) */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
348 /* gtk_signal_disconnect_by_func(GTK_OBJECT(cnv->window), GTK_SIGNAL_FUNC(un_star), NULL); */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
349 /* else { */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
350 /* gtk_signal_disconnect_by_func(GTK_OBJECT(cnv->window), GTK_SIGNAL_FUNC(un_star), NULL); */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
351 /* gtk_signal_disconnect_by_func(GTK_OBJECT(cnv->text), GTK_SIGNAL_FUNC(un_star_window), NULL); */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
352 /* gtk_signal_disconnect_by_func(GTK_OBJECT(cnv->entry), GTK_SIGNAL_FUNC(un_star_window), NULL); */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
353 /* } */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
354 /* if (options & REMOVE_TYPE) */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
355 /* gtk_signal_disconnect_by_func(GTK_OBJECT(cnv->entry), GTK_SIGNAL_FUNC(un_star_window), NULL); */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
356 /* } */
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
357 c = c->next;
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
358 }
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
359 }
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
360
3551
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3511
diff changeset
361 struct gaim_plugin_description desc;
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3511
diff changeset
362 struct gaim_plugin_description *gaim_plugin_desc() {
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3511
diff changeset
363 desc.api_version = PLUGIN_API_VERSION;
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3511
diff changeset
364 desc.name = g_strdup("Message Notification");
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3511
diff changeset
365 desc.version = g_strdup(VERSION);
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3511
diff changeset
366 desc.description = g_strdup("Provides a variety of ways of notifying you of unread messages.");
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3511
diff changeset
367 desc.authors = g_strdup("Etan Reisner &lt;deryni@eden.rutgers.edu>");
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3511
diff changeset
368 desc.url = g_strdup(WEBSITE);
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3511
diff changeset
369 return &desc;
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3511
diff changeset
370 }
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3511
diff changeset
371
191
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
372 char *name() {
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
373 return "Visual Notification";
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
374 }
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
375
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
376 char *description() {
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
377 return "Puts an asterisk in the title bar of all conversations"
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
378 " where you have not responded to a message yet.";
948100a8cb23 [gaim-migrate @ 201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
379 }
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
380
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
381 GtkWidget *gaim_plugin_config_gtk() {
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
382 GtkWidget *ret;
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
383 GtkWidget *vbox, *hbox;
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
384 GtkWidget *toggle;
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
385 ret = gtk_vbox_new(FALSE, 18);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
386 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
387
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
388 vbox = make_frame(ret, _("Notification Methods"));
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
389 hbox = gtk_hbox_new(FALSE, 18);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
390 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
391 toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title:"));
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
392 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_STRING);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
393 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(2));
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
394 gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
395 Entry = gtk_entry_new_with_max_length(7);
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
396 gtk_widget_set_sensitive(GTK_WIDGET(Entry), method & METHOD_STRING);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
397 gtk_box_pack_start(GTK_BOX(hbox), Entry, FALSE, FALSE, 0);
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
398 gtk_entry_set_text(GTK_ENTRY(Entry), title_string);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
399
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
400 toggle = gtk_check_button_new_with_mnemonic(_("_Quote window title."));
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
401 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
402 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_QUOTE);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
403 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(3));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
404
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
405 toggle = gtk_check_button_new_with_mnemonic(_("Set Window Manager \"_URGENT\" Hint"));
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
406 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
407 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_URGENT);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
408 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(4));
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
409
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
410 toggle = gtk_check_button_new_with_mnemonic(_("Insert _count of new messages into window title"));
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
411 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_COUNT);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
412 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
413 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(6));
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
414
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
415 toggle = gtk_check_button_new_with_mnemonic(_("_Notify even if conversation is in focus."));
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
416 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_IN_FOCUS);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
417 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
418 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(5));
3392
5a5df7968b6e [gaim-migrate @ 3411]
Sean Egan <seanegan@gmail.com>
parents: 3385
diff changeset
419
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
420 /*--------------*/
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
421 vbox = make_frame(ret, _("Notification Removal"));
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
422 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window gains _focus."));
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
423 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
424 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_FOCUS);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
425 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(0));
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
426
3565
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
427 toggle = gtk_check_button_new_with_mnemonic(_("Remove when _typing in conversation window"));
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
428 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
429 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_TYPE);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
430 gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(1));
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
431
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
432 gtk_widget_show_all(ret);
154c4a9d9b6d [gaim-migrate @ 3660]
Sean Egan <seanegan@gmail.com>
parents: 3561
diff changeset
433 return ret;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 2313
diff changeset
434 }