Mercurial > pidgin
annotate src/gtkpounce.c @ 5580:86456ec3ca25
[gaim-migrate @ 5984]
More nifty stuff! Accounts now get converted, and other niceties.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sat, 31 May 2003 02:27:03 +0000 |
parents | 9eb5b13fd412 |
children | b07aa997ddd8 |
rev | line source |
---|---|
5032 | 1 /** |
2 * @file gtkpounce.h GTK+ buddy pounce API | |
3 * | |
4 * gaim | |
5 * | |
6 * Copyright (C) 2003, Christian Hammond <chipx86@gnupdate.org> | |
7 * | |
8 * This program is free software; you can redistribute it and/or modify | |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 * | |
22 */ | |
5054 | 23 #include <unistd.h> |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
24 #include <string.h> |
5032 | 25 #include "gaim.h" |
26 #include "gtkpounce.h" | |
5228
1a53330dfd34
[gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
27 #include "gtkblist.h" |
5032 | 28 #include "prpl.h" |
29 #include "sound.h" | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5319
diff
changeset
|
30 #include "notify.h" |
5032 | 31 |
32 struct gaim_gtkpounce_dialog | |
33 { | |
34 /* Pounce data */ | |
35 struct gaim_pounce *pounce; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
36 GaimAccount *account; |
5032 | 37 |
38 /* The window */ | |
39 GtkWidget *window; | |
40 | |
41 /* Pounce Who */ | |
42 GtkWidget *account_menu; | |
43 GtkWidget *buddy_entry; | |
44 | |
45 /* Pounce When */ | |
46 GtkWidget *signon; | |
47 GtkWidget *signoff; | |
48 GtkWidget *away; | |
49 GtkWidget *away_return; | |
50 GtkWidget *idle; | |
51 GtkWidget *idle_return; | |
52 GtkWidget *typing; | |
53 GtkWidget *stop_typing; | |
54 | |
55 /* Pounce Action */ | |
56 GtkWidget *open_win; | |
57 GtkWidget *popup; | |
58 GtkWidget *send_msg; | |
59 GtkWidget *send_msg_entry; | |
60 GtkWidget *exec_cmd; | |
61 GtkWidget *exec_cmd_entry; | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
62 GtkWidget *exec_cmd_browse; |
5032 | 63 GtkWidget *play_sound; |
64 GtkWidget *play_sound_entry; | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
65 GtkWidget *play_sound_browse; |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
66 GtkWidget *play_sound_test; |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
67 |
5032 | 68 GtkWidget *save_pounce; |
69 }; | |
70 | |
71 /************************************************************************** | |
72 * Callbacks | |
73 **************************************************************************/ | |
74 static gint | |
75 delete_win_cb(GtkWidget *w, GdkEventAny *e, | |
76 struct gaim_gtkpounce_dialog *dialog) | |
77 { | |
78 gtk_widget_destroy(dialog->window); | |
79 g_free(dialog); | |
80 | |
81 return TRUE; | |
82 } | |
83 | |
84 static void | |
5052
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
85 delete_cb(GtkWidget *w, struct gaim_gtkpounce_dialog *dialog) |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
86 { |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
87 gaim_pounce_destroy(dialog->pounce); |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
88 |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
89 delete_win_cb(NULL, NULL, dialog); |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
90 } |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
91 |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
92 static void |
5032 | 93 cancel_cb(GtkWidget *w, struct gaim_gtkpounce_dialog *dialog) |
94 { | |
95 delete_win_cb(NULL, NULL, dialog); | |
96 } | |
97 | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
98 static void |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
99 pounce_update_entryfields(GtkWidget *w, gpointer data) |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
100 { |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
101 const char *selected_filename; |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
102 GHashTable *args; |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
103 |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
104 args = (GHashTable *) data; |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
105 |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
106 selected_filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(g_hash_table_lookup(args, "pounce_file_selector"))); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
107 if (selected_filename != NULL) |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
108 gtk_entry_set_text(GTK_ENTRY(g_hash_table_lookup(args, "entry")),selected_filename); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
109 |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
110 g_free(args); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
111 } |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
112 |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
113 static void |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
114 pounce_file_selector(GtkWidget *w, gpointer data) |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
115 { |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
116 GtkWidget *pounce_file_selector; |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
117 GtkWidget *entry; |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
118 GHashTable *args; |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
119 |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
120 entry = (GtkWidget *) data; |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
121 |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
122 pounce_file_selector = gtk_file_selection_new(_("Select a file")); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
123 gtk_file_selection_set_filename(GTK_FILE_SELECTION(pounce_file_selector), gtk_entry_get_text(GTK_ENTRY(entry))); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
124 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(pounce_file_selector)); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
125 gtk_file_selection_set_select_multiple(GTK_FILE_SELECTION(pounce_file_selector), FALSE); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
126 |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
127 args = g_hash_table_new(g_str_hash,g_str_equal); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
128 g_hash_table_insert(args, "pounce_file_selector", (gpointer) pounce_file_selector); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
129 g_hash_table_insert(args, "entry", (gpointer) entry); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
130 |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
131 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(pounce_file_selector)->ok_button), |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
132 "clicked", G_CALLBACK(pounce_update_entryfields), (gpointer) args); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
133 |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
134 g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(pounce_file_selector)->ok_button), |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
135 "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer) pounce_file_selector); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
136 g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(pounce_file_selector)->cancel_button), |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
137 "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer) pounce_file_selector); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
138 |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
139 gtk_widget_show(pounce_file_selector); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
140 } |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
141 |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
142 static void |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
143 pounce_test_sound(GtkWidget *w, gpointer data) |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
144 { |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
145 const char *filename; |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
146 GtkWidget *entry; |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
147 |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
148 entry = (GtkWidget *) data; |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
149 |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
150 filename = gtk_entry_get_text(GTK_ENTRY(entry)); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
151 if ((filename != NULL) && (strlen(filename) > 0)) |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
152 gaim_sound_play_file((char *) filename); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
153 else |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
154 gaim_sound_play_event(GAIM_SOUND_POUNCE_DEFAULT); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
155 } |
5032 | 156 |
157 static void | |
158 save_pounce_cb(GtkWidget *w, struct gaim_gtkpounce_dialog *dialog) | |
159 { | |
160 const char *name; | |
161 const char *message, *command, *sound; | |
162 struct gaim_buddy_list *blist; | |
163 struct gaim_gtk_buddy_list *gtkblist; | |
164 GaimPounceEvent events = GAIM_POUNCE_NONE; | |
165 GaimGtkPounceAction actions = GAIM_GTKPOUNCE_NONE; | |
166 gboolean save; | |
167 | |
168 name = gtk_entry_get_text(GTK_ENTRY(dialog->buddy_entry)); | |
169 | |
170 if (*name == '\0') { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5319
diff
changeset
|
171 gaim_notify_error(NULL, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5319
diff
changeset
|
172 _("Please enter a buddy to pounce."), NULL); |
5032 | 173 return; |
174 } | |
175 | |
176 /* Events */ | |
177 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->signon))) | |
178 events |= GAIM_POUNCE_SIGNON; | |
179 | |
180 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->signoff))) | |
181 events |= GAIM_POUNCE_SIGNOFF; | |
182 | |
183 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->away))) | |
184 events |= GAIM_POUNCE_AWAY; | |
185 | |
186 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->away_return))) | |
187 events |= GAIM_POUNCE_AWAY_RETURN; | |
188 | |
189 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->idle))) | |
190 events |= GAIM_POUNCE_IDLE; | |
191 | |
192 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->idle_return))) | |
193 events |= GAIM_POUNCE_IDLE_RETURN; | |
194 | |
195 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->typing))) | |
196 events |= GAIM_POUNCE_TYPING; | |
197 | |
198 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->stop_typing))) | |
199 events |= GAIM_POUNCE_TYPING_STOPPED; | |
200 | |
201 | |
202 /* Actions */ | |
203 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->open_win))) | |
204 actions |= GAIM_GTKPOUNCE_OPEN_WIN; | |
205 | |
206 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->popup))) | |
207 actions |= GAIM_GTKPOUNCE_POPUP; | |
208 | |
209 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->send_msg))) | |
210 actions |= GAIM_GTKPOUNCE_SEND_MSG; | |
211 | |
212 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd))) | |
213 actions |= GAIM_GTKPOUNCE_EXEC_CMD; | |
214 | |
215 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->play_sound))) | |
216 actions |= GAIM_GTKPOUNCE_PLAY_SOUND; | |
217 | |
218 save = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->save_pounce)); | |
219 | |
220 /* Data fields */ | |
221 message = gtk_entry_get_text(GTK_ENTRY(dialog->send_msg_entry)); | |
222 command = gtk_entry_get_text(GTK_ENTRY(dialog->exec_cmd_entry)); | |
223 sound = gtk_entry_get_text(GTK_ENTRY(dialog->play_sound_entry)); | |
224 | |
225 if (*message == '\0') message = NULL; | |
226 if (*command == '\0') command = NULL; | |
227 if (*sound == '\0') sound = NULL; | |
228 | |
229 if (dialog->pounce == NULL) | |
230 { | |
231 gaim_gtkpounce_new(dialog->account, name, events, actions, | |
232 message, command, sound, save); | |
233 } | |
234 else | |
235 { | |
236 struct gaim_gtkpounce_data *pounce_data; | |
237 | |
238 gaim_pounce_set_events(dialog->pounce, events); | |
239 gaim_pounce_set_pouncer(dialog->pounce, dialog->account); | |
240 gaim_pounce_set_pouncee(dialog->pounce, name); | |
241 | |
242 pounce_data = GAIM_GTKPOUNCE(dialog->pounce); | |
243 | |
244 if (pounce_data->message != NULL) g_free(pounce_data->message); | |
245 if (pounce_data->command != NULL) g_free(pounce_data->command); | |
246 if (pounce_data->sound != NULL) g_free(pounce_data->sound); | |
247 | |
248 pounce_data->message = (message == NULL ? NULL : g_strdup(message)); | |
249 pounce_data->command = (command == NULL ? NULL : g_strdup(command)); | |
250 pounce_data->sound = (sound == NULL ? NULL : g_strdup(sound)); | |
251 | |
252 pounce_data->actions = actions; | |
253 pounce_data->save = save; | |
254 } | |
255 | |
256 delete_win_cb(NULL, NULL, dialog); | |
257 /* Rebuild the pounce menu */ | |
258 blist = gaim_get_blist(); | |
259 | |
260 if (GAIM_IS_GTK_BLIST(blist)) | |
261 { | |
262 gtkblist = GAIM_GTK_BLIST(blist); | |
263 | |
264 gaim_gtkpounce_menu_build(gtkblist->bpmenu); | |
265 } | |
266 | |
267 save_prefs(); | |
268 } | |
269 | |
5054 | 270 static void |
5032 | 271 pounce_choose_cb(GtkWidget *item, struct gaim_gtkpounce_dialog *dialog) |
272 { | |
273 dialog->account = g_object_get_data(G_OBJECT(item), "user_data"); | |
274 } | |
275 | |
276 static GtkWidget * | |
277 pounce_user_menu(struct gaim_gtkpounce_dialog *dialog) | |
278 { | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
279 GaimAccount *account; |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
280 GaimPlugin *prpl; |
5032 | 281 GtkWidget *opt_menu; |
282 GtkWidget *menu; | |
283 GtkWidget *item; | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
284 GList *l; |
5032 | 285 char buf[2048]; |
5054 | 286 int count, place = 0; |
5032 | 287 |
288 opt_menu = gtk_option_menu_new(); | |
289 menu = gtk_menu_new(); | |
290 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
291 for (l = gaim_accounts_get_all(), count = 0; |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
292 l != NULL; |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
293 l = l->next, count++) { |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
294 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
295 account = (GaimAccount *)l->data; |
5032 | 296 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
297 prpl = gaim_find_prpl(account->protocol); |
5032 | 298 |
299 g_snprintf(buf, sizeof(buf), "%s (%s)", account->username, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
300 (prpl && prpl->info->name) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
301 ? prpl->info->name : _("Unknown")); |
5032 | 302 |
303 item = gtk_menu_item_new_with_label(buf); | |
304 g_object_set_data(G_OBJECT(item), "user_data", account); | |
305 | |
306 g_signal_connect(G_OBJECT(item), "activate", | |
307 G_CALLBACK(pounce_choose_cb), dialog); | |
308 | |
309 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); | |
310 gtk_widget_show(item); | |
311 | |
312 if (dialog->account == account) { | |
313 gtk_menu_item_activate(GTK_MENU_ITEM(item)); | |
314 place = count; | |
315 } | |
316 } | |
317 | |
318 gtk_option_menu_set_menu(GTK_OPTION_MENU(opt_menu), menu); | |
319 gtk_option_menu_set_history(GTK_OPTION_MENU(opt_menu), place); | |
320 | |
321 return opt_menu; | |
322 } | |
323 | |
324 static void | |
325 pounce_cb(struct gaim_pounce *pounce, GaimPounceEvent events, void *data) | |
326 { | |
327 struct gaim_conversation *conv; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
328 GaimAccount *account; |
5032 | 329 struct gaim_gtkpounce_data *pounce_data; |
330 const char *pouncee; | |
331 | |
332 pounce_data = (struct gaim_gtkpounce_data *)data; | |
333 pouncee = gaim_pounce_get_pouncee(pounce); | |
334 account = gaim_pounce_get_pouncer(pounce); | |
335 | |
336 if (pounce_data->actions & GAIM_GTKPOUNCE_OPEN_WIN) { | |
337 conv = gaim_find_conversation(pouncee); | |
338 | |
339 if (conv == NULL) | |
340 conv = gaim_conversation_new(GAIM_CONV_IM, account, pouncee); | |
341 } | |
342 | |
343 if (pounce_data->actions & GAIM_GTKPOUNCE_POPUP) { | |
344 char tmp[1024]; | |
345 | |
346 g_snprintf(tmp, sizeof(tmp), | |
347 (events & GAIM_POUNCE_TYPING) ? _("%s has started typing to you") : | |
348 (events & GAIM_POUNCE_SIGNON) ? _("%s has signed on") : | |
349 (events & GAIM_POUNCE_IDLE_RETURN) ? _("%s has returned from being idle") : | |
350 (events & GAIM_POUNCE_AWAY_RETURN) ? _("%s has returned from being away") : | |
351 (events & GAIM_POUNCE_TYPING_STOPPED) ? _("%s has stopped typing to you") : | |
352 (events & GAIM_POUNCE_SIGNOFF) ? _("%s has signed off") : | |
353 (events & GAIM_POUNCE_IDLE) ? _("%s has become idle") : | |
354 (events & GAIM_POUNCE_AWAY) ? _("%s has gone away.") : | |
355 _("Unknown pounce event. Please report this!"), | |
356 pouncee); | |
357 | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5319
diff
changeset
|
358 gaim_notify_info(NULL, NULL, tmp, NULL); |
5032 | 359 } |
360 | |
361 if (pounce_data->actions & GAIM_GTKPOUNCE_SEND_MSG && | |
5051
b3d9195777bb
[gaim-migrate @ 5400]
Christian Hammond <chipx86@chipx86.com>
parents:
5032
diff
changeset
|
362 pounce_data->message != NULL) { |
5032 | 363 |
364 conv = gaim_find_conversation(pouncee); | |
365 | |
366 if (conv == NULL) | |
367 conv = gaim_conversation_new(GAIM_CONV_IM, account, pouncee); | |
368 | |
369 gaim_conversation_write(conv, NULL, pounce_data->message, -1, | |
370 WFLAG_SEND, time(NULL)); | |
371 | |
372 serv_send_im(account->gc, (char *)pouncee, pounce_data->message, -1, 0); | |
373 } | |
374 | |
375 if (pounce_data->actions & GAIM_GTKPOUNCE_EXEC_CMD && | |
5051
b3d9195777bb
[gaim-migrate @ 5400]
Christian Hammond <chipx86@chipx86.com>
parents:
5032
diff
changeset
|
376 pounce_data->command != NULL) { |
5032 | 377 #ifndef _WIN32 |
378 int pid = fork(); | |
379 | |
380 if (pid == 0) { | |
381 char *args[4]; | |
382 | |
383 args[0] = "sh"; | |
384 args[1] = "-c"; | |
385 args[2] = pounce_data->command; | |
386 args[3] = NULL; | |
387 | |
388 execvp(args[0], args); | |
389 | |
390 _exit(0); | |
391 } | |
392 #endif /* _WIN32 */ | |
393 } | |
394 | |
395 if (pounce_data->actions & GAIM_GTKPOUNCE_PLAY_SOUND) { | |
5051
b3d9195777bb
[gaim-migrate @ 5400]
Christian Hammond <chipx86@chipx86.com>
parents:
5032
diff
changeset
|
396 if (pounce_data->sound != NULL) |
5032 | 397 gaim_sound_play_file(pounce_data->sound); |
398 else | |
399 gaim_sound_play_event(GAIM_SOUND_POUNCE_DEFAULT); | |
400 } | |
401 | |
402 if (!pounce_data->save) | |
403 gaim_pounce_destroy(pounce); | |
404 } | |
405 | |
406 static void | |
407 free_pounce(void *data) | |
408 { | |
409 struct gaim_gtkpounce_data *pounce_data; | |
410 struct gaim_buddy_list *blist; | |
411 struct gaim_gtk_buddy_list *gtkblist; | |
412 | |
413 pounce_data = (struct gaim_gtkpounce_data *)data; | |
414 | |
415 if (pounce_data->message != NULL) g_free(pounce_data->message); | |
416 if (pounce_data->command != NULL) g_free(pounce_data->command); | |
417 if (pounce_data->sound != NULL) g_free(pounce_data->sound); | |
418 | |
419 g_free(data); | |
420 | |
421 /* Rebuild the pounce menu */ | |
422 blist = gaim_get_blist(); | |
423 | |
424 if (GAIM_IS_GTK_BLIST(blist)) | |
425 { | |
426 gtkblist = GAIM_GTK_BLIST(blist); | |
427 | |
428 gaim_gtkpounce_menu_build(gtkblist->bpmenu); | |
429 } | |
430 | |
431 save_prefs(); | |
432 } | |
433 | |
434 struct gaim_pounce * | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
435 gaim_gtkpounce_new(GaimAccount *pouncer, const char *pouncee, |
5032 | 436 GaimPounceEvent events, GaimGtkPounceAction actions, |
437 const char *message, const char *command, | |
438 const char *sound, gboolean save) | |
439 { | |
440 struct gaim_gtkpounce_data *data; | |
441 | |
442 data = g_new0(struct gaim_gtkpounce_data, 1); | |
443 | |
444 data->actions = actions; | |
445 | |
446 if (message != NULL) data->message = g_strdup(message); | |
447 if (command != NULL) data->command = g_strdup(command); | |
448 if (sound != NULL) data->sound = g_strdup(sound); | |
449 | |
450 data->save = save; | |
451 | |
452 return gaim_pounce_new(pouncer, pouncee, events, pounce_cb, data, | |
453 free_pounce); | |
454 } | |
455 | |
456 void | |
457 gaim_gtkpounce_dialog_show(struct buddy *buddy, | |
458 struct gaim_pounce *cur_pounce) | |
459 { | |
460 struct gaim_gtkpounce_dialog *dialog; | |
461 GtkWidget *window; | |
462 GtkWidget *label; | |
463 GtkWidget *bbox; | |
464 GtkWidget *vbox1, *vbox2; | |
465 GtkWidget *hbox; | |
466 GtkWidget *button; | |
467 GtkWidget *frame; | |
468 GtkWidget *table; | |
469 GtkWidget *sep; | |
470 GtkSizeGroup *sg; | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
471 GPtrArray *sound_widgets; |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
472 GPtrArray *exec_widgets; |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
473 |
5032 | 474 dialog = g_new0(struct gaim_gtkpounce_dialog, 1); |
475 | |
476 if (cur_pounce != NULL) { | |
477 dialog->pounce = cur_pounce; | |
478 dialog->account = gaim_pounce_get_pouncer(cur_pounce); | |
479 } | |
480 else if (buddy != NULL) { | |
481 dialog->pounce = NULL; | |
482 dialog->account = buddy->account; | |
483 } | |
484 else { | |
485 dialog->pounce = NULL; | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
486 dialog->account = gaim_accounts_get_all()->data; |
5032 | 487 } |
488 | |
489 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
490 | |
491 /* Create the window. */ | |
492 dialog->window = window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
493 gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG); | |
494 gtk_window_set_role(GTK_WINDOW(window), "buddy_pounce"); | |
495 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
496 gtk_window_set_title(GTK_WINDOW(window), | |
497 (cur_pounce == NULL | |
498 ? _("New Buddy Pounce") : _("Edit Buddy Pounce"))); | |
499 | |
500 gtk_container_set_border_width(GTK_CONTAINER(window), 12); | |
501 gtk_widget_realize(window); | |
502 | |
503 g_signal_connect(G_OBJECT(window), "delete_event", | |
504 G_CALLBACK(delete_win_cb), dialog); | |
505 | |
506 /* Create the parent vbox for everything. */ | |
507 vbox1 = gtk_vbox_new(FALSE, 12); | |
508 gtk_container_add(GTK_CONTAINER(window), vbox1); | |
509 gtk_widget_show(vbox1); | |
510 | |
511 /* Create the vbox that will contain all the prefs stuff. */ | |
512 vbox2 = gtk_vbox_new(FALSE, 18); | |
513 gtk_box_pack_start(GTK_BOX(vbox1), vbox2, TRUE, TRUE, 0); | |
514 | |
515 /* Create the "Pounce Who" frame. */ | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
516 frame = gaim_gtk_make_frame(vbox2, _("Pounce Who")); |
5032 | 517 |
518 /* Account: */ | |
519 hbox = gtk_hbox_new(FALSE, 6); | |
520 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); | |
521 gtk_widget_show(hbox); | |
522 | |
523 label = gtk_label_new_with_mnemonic(_("_Account:")); | |
524 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
525 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
526 gtk_widget_show(label); | |
527 gtk_size_group_add_widget(sg, label); | |
528 | |
529 dialog->account_menu = pounce_user_menu(dialog); | |
530 gtk_box_pack_start(GTK_BOX(hbox), dialog->account_menu, FALSE, FALSE, 0); | |
531 gtk_widget_show(dialog->account_menu); | |
532 | |
533 /* Buddy: */ | |
534 hbox = gtk_hbox_new(FALSE, 6); | |
535 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); | |
536 gtk_widget_show(hbox); | |
537 | |
538 label = gtk_label_new_with_mnemonic(_("_Buddy Name:")); | |
539 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
540 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
541 gtk_widget_show(label); | |
542 gtk_size_group_add_widget(sg, label); | |
543 | |
544 dialog->buddy_entry = gtk_entry_new(); | |
545 gtk_box_pack_start(GTK_BOX(hbox), dialog->buddy_entry, TRUE, TRUE, 0); | |
546 gtk_widget_show(dialog->buddy_entry); | |
547 | |
548 if (cur_pounce != NULL) { | |
549 gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), | |
550 gaim_pounce_get_pouncee(cur_pounce)); | |
551 } | |
552 else if (buddy != NULL) { | |
553 gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), buddy->name); | |
554 } | |
555 | |
556 /* Create the "Pounce When" frame. */ | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
557 frame = gaim_gtk_make_frame(vbox2, _("Pounce When")); |
5032 | 558 |
559 table = gtk_table_new(2, 4, FALSE); | |
560 gtk_container_add(GTK_CONTAINER(frame), table); | |
561 gtk_table_set_col_spacings(GTK_TABLE(table), 12); | |
562 gtk_widget_show(table); | |
563 | |
564 dialog->signon = | |
565 gtk_check_button_new_with_label(_("Sign on")); | |
566 dialog->signoff = | |
567 gtk_check_button_new_with_label(_("Sign off")); | |
568 dialog->away = | |
569 gtk_check_button_new_with_label(_("Away")); | |
570 dialog->away_return = | |
571 gtk_check_button_new_with_label(_("Return from away")); | |
572 dialog->idle = | |
573 gtk_check_button_new_with_label(_("Idle")); | |
574 dialog->idle_return = | |
575 gtk_check_button_new_with_label(_("Return from idle")); | |
576 dialog->typing = | |
577 gtk_check_button_new_with_label(_("Buddy starts typing")); | |
578 dialog->stop_typing = | |
579 gtk_check_button_new_with_label(_("Buddy stops typing")); | |
580 | |
581 gtk_table_attach(GTK_TABLE(table), dialog->signon, 0, 1, 0, 1, | |
582 GTK_FILL, 0, 0, 0); | |
583 gtk_table_attach(GTK_TABLE(table), dialog->signoff, 1, 2, 0, 1, | |
584 GTK_FILL, 0, 0, 0); | |
585 gtk_table_attach(GTK_TABLE(table), dialog->away, 0, 1, 1, 2, | |
586 GTK_FILL, 0, 0, 0); | |
587 gtk_table_attach(GTK_TABLE(table), dialog->away_return, 1, 2, 1, 2, | |
588 GTK_FILL, 0, 0, 0); | |
589 gtk_table_attach(GTK_TABLE(table), dialog->idle, 0, 1, 2, 3, | |
590 GTK_FILL, 0, 0, 0); | |
591 gtk_table_attach(GTK_TABLE(table), dialog->idle_return, 1, 2, 2, 3, | |
592 GTK_FILL, 0, 0, 0); | |
593 gtk_table_attach(GTK_TABLE(table), dialog->typing, 0, 1, 3, 4, | |
594 GTK_FILL, 0, 0, 0); | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
595 gtk_table_attach(GTK_TABLE(table), dialog->stop_typing, 1, 2, 3, 5, |
5032 | 596 GTK_FILL, 0, 0, 0); |
597 | |
598 gtk_widget_show(dialog->signon); | |
599 gtk_widget_show(dialog->signoff); | |
600 gtk_widget_show(dialog->away); | |
601 gtk_widget_show(dialog->away_return); | |
602 gtk_widget_show(dialog->idle); | |
603 gtk_widget_show(dialog->idle_return); | |
604 gtk_widget_show(dialog->typing); | |
605 gtk_widget_show(dialog->stop_typing); | |
606 | |
607 /* Create the "Pounce Action" frame. */ | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
608 frame = gaim_gtk_make_frame(vbox2, _("Pounce Action")); |
5032 | 609 |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
610 table = gtk_table_new(3, 5, FALSE); |
5032 | 611 gtk_container_add(GTK_CONTAINER(frame), table); |
612 gtk_table_set_col_spacings(GTK_TABLE(table), 12); | |
613 gtk_widget_show(table); | |
614 | |
615 dialog->open_win = gtk_check_button_new_with_label(_("Open an IM window")); | |
616 dialog->popup = gtk_check_button_new_with_label(_("Popup notification")); | |
617 dialog->send_msg = gtk_check_button_new_with_label(_("Send a message")); | |
618 dialog->exec_cmd = gtk_check_button_new_with_label(_("Execute a command")); | |
5051
b3d9195777bb
[gaim-migrate @ 5400]
Christian Hammond <chipx86@chipx86.com>
parents:
5032
diff
changeset
|
619 dialog->play_sound = gtk_check_button_new_with_label(_("Play a sound")); |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
620 |
5032 | 621 dialog->send_msg_entry = gtk_entry_new(); |
622 dialog->exec_cmd_entry = gtk_entry_new(); | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
623 dialog->exec_cmd_browse = gtk_button_new_with_label(_("Browse")); |
5032 | 624 dialog->play_sound_entry = gtk_entry_new(); |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
625 dialog->play_sound_browse = gtk_button_new_with_label(_("Browse")); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
626 dialog->play_sound_test = gtk_button_new_with_label(_("Test")); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
627 |
5032 | 628 gtk_widget_set_sensitive(dialog->send_msg_entry, FALSE); |
629 gtk_widget_set_sensitive(dialog->exec_cmd_entry, FALSE); | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
630 gtk_widget_set_sensitive(dialog->exec_cmd_browse, FALSE); |
5032 | 631 gtk_widget_set_sensitive(dialog->play_sound_entry, FALSE); |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
632 gtk_widget_set_sensitive(dialog->play_sound_browse, FALSE); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
633 gtk_widget_set_sensitive(dialog->play_sound_test, FALSE); |
5032 | 634 |
635 gtk_table_attach(GTK_TABLE(table), dialog->open_win, 0, 1, 0, 1, | |
636 GTK_FILL, 0, 0, 0); | |
637 gtk_table_attach(GTK_TABLE(table), dialog->popup, 0, 1, 1, 2, | |
638 GTK_FILL, 0, 0, 0); | |
639 gtk_table_attach(GTK_TABLE(table), dialog->send_msg, 0, 1, 2, 3, | |
640 GTK_FILL, 0, 0, 0); | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
641 gtk_table_attach(GTK_TABLE(table), dialog->send_msg_entry, 1, 4, 2, 3, |
5032 | 642 GTK_FILL, 0, 0, 0); |
643 gtk_table_attach(GTK_TABLE(table), dialog->exec_cmd, 0, 1, 3, 4, | |
644 GTK_FILL, 0, 0, 0); | |
645 gtk_table_attach(GTK_TABLE(table), dialog->exec_cmd_entry, 1, 2, 3, 4, | |
646 GTK_FILL, 0, 0, 0); | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
647 gtk_table_attach(GTK_TABLE(table), dialog->exec_cmd_browse, 2, 3, 3, 4, |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
648 GTK_FILL | GTK_EXPAND, 0, 0, 0); |
5032 | 649 gtk_table_attach(GTK_TABLE(table), dialog->play_sound, 0, 1, 4, 5, |
650 GTK_FILL, 0, 0, 0); | |
651 gtk_table_attach(GTK_TABLE(table), dialog->play_sound_entry, 1, 2, 4, 5, | |
652 GTK_FILL, 0, 0, 0); | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
653 gtk_table_attach(GTK_TABLE(table), dialog->play_sound_browse, 2, 3, 4, 5, |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
654 GTK_FILL | GTK_EXPAND, 0, 0, 0); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
655 gtk_table_attach(GTK_TABLE(table), dialog->play_sound_test, 3, 4, 4, 5, |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
656 GTK_FILL | GTK_EXPAND, 0, 0, 0); |
5032 | 657 |
658 gtk_widget_show(dialog->open_win); | |
659 gtk_widget_show(dialog->popup); | |
660 gtk_widget_show(dialog->send_msg); | |
661 gtk_widget_show(dialog->send_msg_entry); | |
662 gtk_widget_show(dialog->exec_cmd); | |
663 gtk_widget_show(dialog->exec_cmd_entry); | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
664 gtk_widget_show(dialog->exec_cmd_browse); |
5032 | 665 gtk_widget_show(dialog->play_sound); |
666 gtk_widget_show(dialog->play_sound_entry); | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
667 gtk_widget_show(dialog->play_sound_browse); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
668 gtk_widget_show(dialog->play_sound_test); |
5032 | 669 |
670 g_signal_connect(G_OBJECT(dialog->send_msg), "clicked", | |
671 G_CALLBACK(gaim_gtk_toggle_sensitive), | |
672 dialog->send_msg_entry); | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
673 |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
674 exec_widgets = g_ptr_array_new(); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
675 g_ptr_array_add(exec_widgets,dialog->exec_cmd_entry); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
676 g_ptr_array_add(exec_widgets,dialog->exec_cmd_browse); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
677 |
5032 | 678 g_signal_connect(G_OBJECT(dialog->exec_cmd), "clicked", |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
679 G_CALLBACK(gtk_toggle_sensitive_array), |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
680 exec_widgets); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
681 g_signal_connect(G_OBJECT(dialog->exec_cmd_browse), "clicked", |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
682 G_CALLBACK(pounce_file_selector), |
5032 | 683 dialog->exec_cmd_entry); |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
684 |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
685 sound_widgets = g_ptr_array_new(); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
686 g_ptr_array_add(sound_widgets,dialog->play_sound_entry); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
687 g_ptr_array_add(sound_widgets,dialog->play_sound_browse); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
688 g_ptr_array_add(sound_widgets,dialog->play_sound_test); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
689 |
5032 | 690 g_signal_connect(G_OBJECT(dialog->play_sound), "clicked", |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
691 G_CALLBACK(gtk_toggle_sensitive_array), |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
692 sound_widgets); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
693 g_signal_connect(G_OBJECT(dialog->play_sound_browse), "clicked", |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
694 G_CALLBACK(pounce_file_selector), |
5032 | 695 dialog->play_sound_entry); |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
696 g_signal_connect(G_OBJECT(dialog->play_sound_test), "clicked", |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
697 G_CALLBACK(pounce_test_sound), |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
698 dialog->play_sound_entry); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
699 |
5032 | 700 g_signal_connect(G_OBJECT(dialog->send_msg_entry), "activate", |
701 G_CALLBACK(save_pounce_cb), dialog); | |
702 g_signal_connect(G_OBJECT(dialog->exec_cmd_entry), "activate", | |
703 G_CALLBACK(save_pounce_cb), dialog); | |
704 g_signal_connect(G_OBJECT(dialog->play_sound_entry), "activate", | |
705 G_CALLBACK(save_pounce_cb), dialog); | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
706 |
5032 | 707 /* Now the last part, where we have the Save checkbox */ |
708 dialog->save_pounce = gtk_check_button_new_with_mnemonic( | |
709 _("_Save this pounce after activation")); | |
710 | |
711 gtk_box_pack_start(GTK_BOX(vbox2), dialog->save_pounce, FALSE, FALSE, 0); | |
712 | |
713 /* Separator... */ | |
714 sep = gtk_hseparator_new(); | |
715 gtk_box_pack_start(GTK_BOX(vbox1), sep, FALSE, FALSE, 0); | |
716 gtk_widget_show(sep); | |
717 | |
718 /* Now the button box! */ | |
719 bbox = gtk_hbutton_box_new(); | |
720 gtk_box_set_spacing(GTK_BOX(bbox), 6); | |
721 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
722 gtk_box_pack_end(GTK_BOX(vbox1), bbox, FALSE, FALSE, 0); | |
723 gtk_widget_show(bbox); | |
724 | |
5052
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
725 /* Delete button */ |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
726 button = gtk_button_new_from_stock(GTK_STOCK_DELETE); |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
727 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
728 gtk_widget_show(button); |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
729 |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
730 g_signal_connect(G_OBJECT(button), "clicked", |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
731 G_CALLBACK(delete_cb), dialog); |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
732 |
5032 | 733 /* Cancel button */ |
734 button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); | |
735 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
736 gtk_widget_show(button); | |
737 | |
738 g_signal_connect(G_OBJECT(button), "clicked", | |
739 G_CALLBACK(cancel_cb), dialog); | |
740 | |
741 /* OK button */ | |
742 button = gtk_button_new_from_stock(GTK_STOCK_OK); | |
743 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
744 gtk_widget_show(button); | |
745 | |
746 g_signal_connect(G_OBJECT(button), "clicked", | |
747 G_CALLBACK(save_pounce_cb), dialog); | |
748 | |
749 /* Set the values of stuff. */ | |
750 if (cur_pounce != NULL) { | |
751 GaimPounceEvent events; | |
752 GaimGtkPounceAction actions; | |
753 struct gaim_gtkpounce_data *pounce_data; | |
754 | |
755 pounce_data = GAIM_GTKPOUNCE(cur_pounce); | |
756 events = gaim_pounce_get_events(cur_pounce); | |
757 actions = pounce_data->actions; | |
758 | |
759 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signon), | |
760 (events & GAIM_POUNCE_SIGNON)); | |
761 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signoff), | |
762 (events & GAIM_POUNCE_SIGNOFF)); | |
763 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->away), | |
764 (events & GAIM_POUNCE_AWAY)); | |
765 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->away_return), | |
766 (events & GAIM_POUNCE_AWAY_RETURN)); | |
767 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->idle), | |
768 (events & GAIM_POUNCE_IDLE)); | |
769 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->idle_return), | |
770 (events & GAIM_POUNCE_IDLE_RETURN)); | |
771 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->typing), | |
772 (events & GAIM_POUNCE_TYPING)); | |
773 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->stop_typing), | |
774 (events & GAIM_POUNCE_TYPING_STOPPED)); | |
775 | |
776 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->open_win), | |
777 (actions & GAIM_GTKPOUNCE_OPEN_WIN)); | |
778 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->popup), | |
779 (actions & GAIM_GTKPOUNCE_POPUP)); | |
780 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->send_msg), | |
781 (actions & GAIM_GTKPOUNCE_SEND_MSG)); | |
782 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd), | |
783 (actions & GAIM_GTKPOUNCE_EXEC_CMD)); | |
784 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->play_sound), | |
785 (actions & GAIM_GTKPOUNCE_PLAY_SOUND)); | |
786 | |
787 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->save_pounce), | |
788 pounce_data->save); | |
789 | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
790 if (pounce_data->message != NULL) |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
791 gtk_entry_set_text(GTK_ENTRY(dialog->send_msg_entry), |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
792 pounce_data->message); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
793 if (pounce_data->command != NULL) |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
794 gtk_entry_set_text(GTK_ENTRY(dialog->exec_cmd_entry), |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
795 pounce_data->command); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
796 if (pounce_data->sound != NULL) |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
797 gtk_entry_set_text(GTK_ENTRY(dialog->play_sound_entry), |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
798 pounce_data->sound); |
5032 | 799 } |
800 else { | |
801 /* Set some defaults */ | |
802 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->send_msg), TRUE); | |
803 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signon), TRUE); | |
804 } | |
805 | |
806 gtk_widget_show_all(vbox2); | |
807 gtk_widget_show(window); | |
808 } | |
809 | |
810 static void | |
811 new_pounce_cb(GtkWidget *w, struct buddy *b) | |
812 { | |
813 gaim_gtkpounce_dialog_show(b, NULL); | |
814 } | |
815 | |
816 static void | |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
817 delete_pounce_cb(GtkWidget *w, struct gaim_pounce *pounce) |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
818 { |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
819 gaim_pounce_destroy(pounce); |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
820 } |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
821 |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
822 static void |
5032 | 823 edit_pounce_cb(GtkWidget *w, struct gaim_pounce *pounce) |
824 { | |
825 struct buddy *buddy; | |
826 | |
827 buddy = gaim_find_buddy(gaim_pounce_get_pouncer(pounce), | |
828 gaim_pounce_get_pouncee(pounce)); | |
829 | |
830 gaim_gtkpounce_dialog_show(buddy, pounce); | |
831 } | |
832 | |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
833 static void |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
834 fill_menu(GtkWidget *menu, GCallback cb) |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
835 { |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
836 GtkWidget *image; |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
837 GtkWidget *item; |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
838 GdkPixbuf *pixbuf, *scale; |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
839 struct gaim_pounce *pounce; |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
840 const char *buddy; |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
841 GList *bp; |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
842 |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
843 for (bp = gaim_get_pounces(); bp != NULL; bp = bp->next) { |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
844 pounce = (struct gaim_pounce *)bp->data; |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
845 buddy = gaim_pounce_get_pouncee(pounce); |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
846 |
5161 | 847 /* Build the menu item */ |
848 item = gtk_image_menu_item_new_with_label(buddy); | |
849 | |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
850 /* Create a pixmap for the protocol icon. */ |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
851 pixbuf = create_prpl_icon(gaim_pounce_get_pouncer(pounce)); |
5161 | 852 if(pixbuf) { |
853 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, | |
854 GDK_INTERP_BILINEAR); | |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
855 |
5161 | 856 /* Now convert it to GtkImage */ |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
857 image = gtk_image_new_from_pixbuf(scale); |
5161 | 858 g_object_unref(G_OBJECT(scale)); |
859 g_object_unref(G_OBJECT(pixbuf)); | |
860 gtk_widget_show(image); | |
861 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image); | |
862 } | |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
863 |
5161 | 864 /* Put the item in the menu */ |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
865 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
866 gtk_widget_show(item); |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
867 |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
868 /* Set our callbacks. */ |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
869 g_signal_connect(G_OBJECT(item), "activate", cb, pounce); |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
870 } |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
871 } |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
872 |
5032 | 873 void |
874 gaim_gtkpounce_menu_build(GtkWidget *menu) | |
875 { | |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
876 GtkWidget *remmenu; |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
877 GtkWidget *item; |
5032 | 878 GList *l; |
879 | |
880 for (l = gtk_container_get_children(GTK_CONTAINER(menu)); | |
881 l != NULL; | |
882 l = l->next) { | |
883 | |
884 gtk_widget_destroy(GTK_WIDGET(l->data)); | |
885 } | |
886 | |
887 /* "New Buddy Pounce" */ | |
888 item = gtk_menu_item_new_with_label(_("New Buddy Pounce")); | |
889 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); | |
890 gtk_widget_show(item); | |
891 g_signal_connect(G_OBJECT(item), "activate", | |
892 G_CALLBACK(new_pounce_cb), NULL); | |
893 | |
894 /* "Remove Buddy Pounce" */ | |
895 item = gtk_menu_item_new_with_label(_("Remove Buddy Pounce")); | |
896 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); | |
897 | |
898 /* "Remove Buddy Pounce" menu */ | |
899 remmenu = gtk_menu_new(); | |
900 | |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
901 fill_menu(remmenu, G_CALLBACK(delete_pounce_cb)); |
5032 | 902 |
903 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), remmenu); | |
904 gtk_widget_show(remmenu); | |
905 gtk_widget_show(item); | |
906 | |
907 /* Separator */ | |
908 item = gtk_separator_menu_item_new(); | |
909 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); | |
910 gtk_widget_show(item); | |
911 | |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
912 fill_menu(menu, G_CALLBACK(edit_pounce_cb)); |
5032 | 913 } |
914 |