Mercurial > pidgin
annotate console/plugins/gntgf.c @ 14223:7c560c01b8f9
[gaim-migrate @ 16904]
Add a plugin gnthistory. The plugin is a core plugin, but does not look good
in gtkgaim.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sun, 20 Aug 2006 16:45:57 +0000 |
parents | d822e68acb3e |
children | d9aa45c10588 |
rev | line source |
---|---|
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 /** |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 * @file gntgf.c Minimal toaster plugin in Gnt. |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 * |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 * Copyright (C) 2006 Sadrul Habib Chowdhury <sadrul@users.sourceforge.net> |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 * |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 * This program is free software; you can redistribute it and/or modify |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 * it under the terms of the GNU General Public License as published by |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 * the Free Software Foundation; either version 2 of the License, or |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 * (at your option) any later version. |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 * |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 * This program is distributed in the hope that it will be useful, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 * GNU General Public License for more details. |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 * |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
16 * You should have received a copy of the GNU General Public License |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 * along with this program; if not, write to the Free Software |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 */ |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
20 |
14223
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14157
diff
changeset
|
21 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14157
diff
changeset
|
22 #include "internal.h" |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
23 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
24 #define PLUGIN_STATIC_NAME "GntGf" |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 |
14157
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
26 #define PREFS_PREFIX "/plugins/gnt/gntgf" |
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
27 #define PREFS_EVENT PREFS_PREFIX "/events" |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 #define PREFS_EVENT_SIGNONF PREFS_EVENT "/signonf" |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 #define PREFS_EVENT_IM_MSG PREFS_EVENT "/immsg" |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 #define PREFS_EVENT_CHAT_MSG PREFS_EVENT "/chatmsg" |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 #define PREFS_EVENT_CHAT_NICK PREFS_EVENT "/chatnick" |
14157
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
32 #define PREFS_BEEP PREFS_PREFIX "/beep" |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 #include <glib.h> |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 #include <plugin.h> |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 #include <version.h> |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 #include <blist.h> |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 #include <conversation.h> |
14146
55e3db9db9f6
[gaim-migrate @ 16789]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
40 #include <util.h> |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 #include <gnt.h> |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 #include <gntbox.h> |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 #include <gntbutton.h> |
14157
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
45 #include <gntcheckbox.h> |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 #include <gntlabel.h> |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 #include <gnttree.h> |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 #include <gntplugin.h> |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 typedef struct |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
52 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 GntWidget *window; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 int timer; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 } GntToast; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 static GList *toasters; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 static int gpsy; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 static void |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 destroy_toaster(GntToast *toast) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
63 toasters = g_list_remove(toasters, toast); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 gnt_widget_destroy(toast->window); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 g_source_remove(toast->timer); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 g_free(toast); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
69 static gboolean |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
70 remove_toaster(GntToast *toast) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
71 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
72 GList *iter; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
73 int h; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
74 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 gnt_widget_get_size(toast->window, NULL, &h); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 gpsy -= h; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
77 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
78 destroy_toaster(toast); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
79 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
80 for (iter = toasters; iter; iter = iter->next) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
81 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
82 int x, y; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
83 toast = iter->data; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
84 gnt_widget_get_position(toast->window, &x, &y); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
85 y += h; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
86 gnt_screen_move_widget(toast->window, x, y); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
87 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
88 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
89 return FALSE; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
90 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
91 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
92 static void |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
93 notify(const char *fmt, ...) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
94 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
95 GntWidget *window; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
96 GntToast *toast = g_new0(GntToast, 1); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
97 char *str; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
98 int h, w; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
99 va_list args; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
100 |
14157
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
101 if (gaim_prefs_get_bool(PREFS_BEEP)) |
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
102 beep(); |
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
103 |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
104 toast->window = window = gnt_vbox_new(FALSE); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
105 GNT_WIDGET_SET_FLAGS(window, GNT_WIDGET_TRANSIENT); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
106 GNT_WIDGET_UNSET_FLAGS(window, GNT_WIDGET_NO_BORDER); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
107 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
108 va_start(args, fmt); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
109 str = g_strdup_vprintf(fmt, args); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
110 va_end(args); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
111 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
112 gnt_box_add_widget(GNT_BOX(window), |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
113 gnt_label_new_with_format(str, GNT_TEXT_FLAG_HIGHLIGHT)); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
114 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
115 g_free(str); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
116 gnt_widget_size_request(window); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
117 gnt_widget_get_size(window, &w, &h); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
118 gpsy += h; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
119 gnt_widget_set_position(window, getmaxx(stdscr) - w - 1, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
120 getmaxy(stdscr) - gpsy - 1); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
121 gnt_widget_draw(window); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
122 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
123 toast->timer = g_timeout_add(4000, (GSourceFunc)remove_toaster, toast); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
124 toasters = g_list_prepend(toasters, toast); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
125 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
126 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
127 static void |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
128 buddy_signed_on(GaimBuddy *buddy, gpointer null) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
129 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
130 if (gaim_prefs_get_bool(PREFS_EVENT_SIGNONF)) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
131 notify(_("%s just signed on"), gaim_buddy_get_alias(buddy)); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
132 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
133 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
134 static void |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
135 buddy_signed_off(GaimBuddy *buddy, gpointer null) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
136 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
137 if (gaim_prefs_get_bool(PREFS_EVENT_SIGNONF)) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
138 notify(_("%s just signed off"), gaim_buddy_get_alias(buddy)); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
139 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
140 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
141 static void |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
142 received_im_msg(GaimAccount *account, const char *sender, const char *msg, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
143 GaimConversation *conv, GaimMessageFlags flags, gpointer null) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
144 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
145 if (gaim_prefs_get_bool(PREFS_EVENT_IM_MSG)) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
146 notify(_("%s sent you a message"), sender); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
147 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
148 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
149 static void |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
150 received_chat_msg(GaimAccount *account, const char *sender, const char *msg, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
151 GaimConversation *conv, GaimMessageFlags flags, gpointer null) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
152 { |
14146
55e3db9db9f6
[gaim-migrate @ 16789]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
153 const char *nick; |
55e3db9db9f6
[gaim-migrate @ 16789]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
154 |
55e3db9db9f6
[gaim-migrate @ 16789]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
155 if (flags & GAIM_MESSAGE_WHISPER) |
55e3db9db9f6
[gaim-migrate @ 16789]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
156 return; |
55e3db9db9f6
[gaim-migrate @ 16789]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
157 |
55e3db9db9f6
[gaim-migrate @ 16789]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
158 nick = GAIM_CONV_CHAT(conv)->nick; |
55e3db9db9f6
[gaim-migrate @ 16789]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
159 |
55e3db9db9f6
[gaim-migrate @ 16789]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
160 if (g_utf8_collate(sender, nick) == 0) |
55e3db9db9f6
[gaim-migrate @ 16789]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
161 return; |
55e3db9db9f6
[gaim-migrate @ 16789]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
162 |
55e3db9db9f6
[gaim-migrate @ 16789]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
163 if (gaim_prefs_get_bool(PREFS_EVENT_CHAT_NICK) && |
55e3db9db9f6
[gaim-migrate @ 16789]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
164 (gaim_utf8_has_word(msg, nick))) |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
165 notify(_("%s said your nick in %s"), sender, gaim_conversation_get_name(conv)); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
166 else if (gaim_prefs_get_bool(PREFS_EVENT_CHAT_MSG)) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
167 notify(_("%s sent a message in %s"), sender, gaim_conversation_get_name(conv)); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
168 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
169 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
170 static gboolean |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
171 plugin_load(GaimPlugin *plugin) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
172 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
173 gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-on", plugin, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
174 GAIM_CALLBACK(buddy_signed_on), NULL); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
175 gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-off", plugin, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
176 GAIM_CALLBACK(buddy_signed_off), NULL); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
177 gaim_signal_connect(gaim_conversations_get_handle(), "received-im-msg", plugin, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
178 GAIM_CALLBACK(received_im_msg), NULL); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
179 gaim_signal_connect(gaim_conversations_get_handle(), "received-chat-msg", plugin, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
180 GAIM_CALLBACK(received_chat_msg), NULL); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
181 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
182 gpsy = 0; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
183 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
184 return TRUE; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
185 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
186 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
187 static gboolean |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
188 plugin_unload(GaimPlugin *plugin) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
189 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
190 while (toasters) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
191 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
192 GntToast *toast = toasters->data; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
193 destroy_toaster(toast); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
194 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
195 return TRUE; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
196 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
197 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
198 static struct |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
199 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
200 char *pref; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
201 char *display; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
202 } prefs[] = |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
203 { |
14223
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14157
diff
changeset
|
204 {PREFS_EVENT_SIGNONF, N_("Buddy signs on/off")}, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14157
diff
changeset
|
205 {PREFS_EVENT_IM_MSG, N_("You receive an IM")}, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14157
diff
changeset
|
206 {PREFS_EVENT_CHAT_MSG, N_("Someone speaks in a chat")}, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14157
diff
changeset
|
207 {PREFS_EVENT_CHAT_NICK, N_("Someone says your name in a chat")}, |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
208 {NULL, NULL} |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
209 }; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
210 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
211 static void |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
212 pref_toggled(GntTree *tree, char *key, gpointer null) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
213 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
214 gaim_prefs_set_bool(key, gnt_tree_get_choice(tree, key)); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
215 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
216 |
14157
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
217 static void |
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
218 beep_toggled(GntCheckBox *check, gpointer null) |
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
219 { |
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
220 gaim_prefs_set_bool(PREFS_BEEP, gnt_check_box_get_checked(check)); |
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
221 } |
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
222 |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
223 static GntWidget * |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
224 config_frame() |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
225 { |
14157
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
226 GntWidget *window, *tree, *check; |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
227 int i; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
228 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
229 window = gnt_vbox_new(FALSE); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
230 gnt_box_set_pad(GNT_BOX(window), 0); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
231 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
232 gnt_box_set_fill(GNT_BOX(window), TRUE); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
233 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
234 gnt_box_add_widget(GNT_BOX(window), |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
235 gnt_label_new(_("Notify with a toaster when"))); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
236 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
237 tree = gnt_tree_new(); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
238 gnt_box_add_widget(GNT_BOX(window), tree); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
239 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
240 for (i = 0; prefs[i].pref; i++) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
241 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
242 gnt_tree_add_choice(GNT_TREE(tree), prefs[i].pref, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
243 gnt_tree_create_row(GNT_TREE(tree), prefs[i].display), NULL, NULL); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
244 gnt_tree_set_choice(GNT_TREE(tree), prefs[i].pref, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
245 gaim_prefs_get_bool(prefs[i].pref)); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
246 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
247 gnt_tree_set_col_width(GNT_TREE(tree), 0, 40); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
248 g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(pref_toggled), NULL); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
249 |
14157
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
250 check = gnt_check_box_new(_("Beep too!")); |
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
251 gnt_check_box_set_checked(GNT_CHECK_BOX(check), gaim_prefs_get_bool(PREFS_BEEP)); |
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
252 g_signal_connect(G_OBJECT(check), "toggled", G_CALLBACK(beep_toggled), NULL); |
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
253 gnt_box_add_widget(GNT_BOX(window), check); |
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
254 |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
255 return window; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
256 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
257 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
258 static GaimPluginInfo info = |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
259 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
260 GAIM_PLUGIN_MAGIC, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
261 GAIM_MAJOR_VERSION, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
262 GAIM_MINOR_VERSION, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
263 GAIM_PLUGIN_STANDARD, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
264 GAIM_GNT_PLUGIN_TYPE, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
265 0, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
266 NULL, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
267 GAIM_PRIORITY_DEFAULT, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
268 "gntgf", |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
269 N_("GntGf"), |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
270 VERSION, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
271 N_("Toaster plugin for GntGaim."), |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
272 N_("Toaster plugin for GntGaim."), |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
273 "Sadrul H Chowdhury <sadrul@users.sourceforge.net>", |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
274 "http://gaim.sourceforge.net", |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
275 plugin_load, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
276 plugin_unload, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
277 NULL, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
278 config_frame, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
279 NULL, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
280 NULL, |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
281 NULL |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
282 }; |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
283 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
284 static void |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
285 init_plugin(GaimPlugin *plugin) |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
286 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
287 gaim_prefs_add_none("/plugins"); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
288 gaim_prefs_add_none("/plugins/gnt"); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
289 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
290 gaim_prefs_add_none("/plugins/gnt/gntgf"); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
291 gaim_prefs_add_none(PREFS_EVENT); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
292 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
293 gaim_prefs_add_bool(PREFS_EVENT_SIGNONF, TRUE); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
294 gaim_prefs_add_bool(PREFS_EVENT_IM_MSG, TRUE); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
295 gaim_prefs_add_bool(PREFS_EVENT_CHAT_MSG, TRUE); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
296 gaim_prefs_add_bool(PREFS_EVENT_CHAT_NICK, TRUE); |
14157
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
297 |
d822e68acb3e
[gaim-migrate @ 16802]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14146
diff
changeset
|
298 gaim_prefs_add_bool(PREFS_BEEP, TRUE); |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
299 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
300 |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
301 GAIM_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info) |