Mercurial > pidgin
annotate src/gtkpounce.c @ 8935:efbee137f245
[gaim-migrate @ 9705]
since mike of novell included joe's patch, i should have done this earlier
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Sat, 15 May 2004 20:54:39 +0000 |
parents | f17670a9e4ef |
children | 06b28fb24300 |
rev | line source |
---|---|
5032 | 1 /** |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
2 * @file gtkpounce.c GTK+ Buddy Pounce API |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
3 * @ingroup gtkui |
5032 | 4 * |
5 * gaim | |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
10 * |
5032 | 11 * This program is free software; you can redistribute it and/or modify |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 * | |
25 */ | |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
26 #include "gtkinternal.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
27 |
8235 | 28 #include "account.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
29 #include "conversation.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
30 #include "debug.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
31 #include "notify.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
32 #include "prpl.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
33 #include "server.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
34 #include "sound.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
35 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
36 #include "gtkblist.h" |
5032 | 37 #include "gtkpounce.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
38 #include "gtkutils.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
39 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
40 #include "ui.h" |
8862 | 41 #include "util.h" |
5032 | 42 |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
43 typedef struct |
5032 | 44 { |
45 /* Pounce data */ | |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
46 GaimPounce *pounce; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
47 GaimAccount *account; |
5032 | 48 |
49 /* The window */ | |
50 GtkWidget *window; | |
51 | |
52 /* Pounce Who */ | |
53 GtkWidget *account_menu; | |
54 GtkWidget *buddy_entry; | |
55 | |
56 /* Pounce When */ | |
57 GtkWidget *signon; | |
58 GtkWidget *signoff; | |
59 GtkWidget *away; | |
60 GtkWidget *away_return; | |
61 GtkWidget *idle; | |
62 GtkWidget *idle_return; | |
63 GtkWidget *typing; | |
64 GtkWidget *stop_typing; | |
65 | |
66 /* Pounce Action */ | |
67 GtkWidget *open_win; | |
68 GtkWidget *popup; | |
69 GtkWidget *send_msg; | |
70 GtkWidget *send_msg_entry; | |
71 GtkWidget *exec_cmd; | |
72 GtkWidget *exec_cmd_entry; | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
73 GtkWidget *exec_cmd_browse; |
5032 | 74 GtkWidget *play_sound; |
75 GtkWidget *play_sound_entry; | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
76 GtkWidget *play_sound_browse; |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
77 GtkWidget *play_sound_test; |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
78 |
5032 | 79 GtkWidget *save_pounce; |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
80 |
5876
8d6e5f804325
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
81 /* Buttons */ |
8d6e5f804325
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
82 GtkWidget *save_button; |
8d6e5f804325
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
83 |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
84 } GaimGtkPounceDialog; |
5032 | 85 |
86 /************************************************************************** | |
87 * Callbacks | |
88 **************************************************************************/ | |
89 static gint | |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
90 delete_win_cb(GtkWidget *w, GdkEventAny *e, GaimGtkPounceDialog *dialog) |
5032 | 91 { |
92 gtk_widget_destroy(dialog->window); | |
93 g_free(dialog); | |
94 | |
95 return TRUE; | |
96 } | |
97 | |
98 static void | |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
99 delete_cb(GtkWidget *w, GaimGtkPounceDialog *dialog) |
5052
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
100 { |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
101 gaim_pounce_destroy(dialog->pounce); |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
102 |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
103 delete_win_cb(NULL, NULL, dialog); |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
104 } |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
105 |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
106 static void |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
107 cancel_cb(GtkWidget *w, GaimGtkPounceDialog *dialog) |
5032 | 108 { |
109 delete_win_cb(NULL, NULL, dialog); | |
110 } | |
111 | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
112 static void |
8259
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
113 pounce_update_entry_fields(GtkWidget *w, gpointer data) |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
114 { |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
115 const char *filename; |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
116 GHashTable *args; |
5959 | 117 GtkFileSelection *filesel; |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
118 |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
119 args = (GHashTable *)data; |
5959 | 120 filesel = GTK_FILE_SELECTION(g_hash_table_lookup(args, "filesel")); |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
121 |
5959 | 122 filename = gtk_file_selection_get_filename(filesel); |
123 | |
5966 | 124 if (gaim_gtk_check_if_dir(filename, filesel)) |
5959 | 125 return; |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
126 |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
127 if (filename != NULL) |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
128 gtk_entry_set_text(GTK_ENTRY(g_hash_table_lookup(args, "entry")), |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
129 filename); |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
130 |
5959 | 131 gtk_widget_destroy(GTK_WIDGET(filesel)); |
132 g_hash_table_destroy(args); | |
5319
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 |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
135 static void |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
136 filesel(GtkWidget *w, gpointer data) |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
137 { |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
138 GtkWidget *filesel; |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
139 GtkWidget *entry; |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
140 GHashTable *args; |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
141 |
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
142 entry = (GtkWidget *)data; |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
143 |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
144 filesel = gtk_file_selection_new(_("Select a file")); |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
145 gtk_file_selection_set_filename(GTK_FILE_SELECTION(filesel), |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
146 gtk_entry_get_text(GTK_ENTRY(entry))); |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
147 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(filesel)); |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
148 gtk_file_selection_set_select_multiple(GTK_FILE_SELECTION(filesel), FALSE); |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
149 |
5959 | 150 args = g_hash_table_new(g_str_hash, g_str_equal); |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
151 g_hash_table_insert(args, "filesel", filesel); |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
152 g_hash_table_insert(args, "entry", entry); |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
153 |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
154 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
155 "clicked", |
8259
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
156 G_CALLBACK(pounce_update_entry_fields), args); |
5959 | 157 g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button), |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
158 "clicked", |
5959 | 159 G_CALLBACK(g_hash_table_destroy), args); |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
160 g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button), |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
161 "clicked", |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
162 G_CALLBACK(gtk_widget_destroy), filesel); |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
163 |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
164 gtk_widget_show(filesel); |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
165 } |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
166 |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
167 static void |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
168 pounce_test_sound(GtkWidget *w, GtkWidget *entry) |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
169 { |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
170 const char *filename; |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
171 |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
172 filename = gtk_entry_get_text(GTK_ENTRY(entry)); |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
173 |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
174 if (filename != NULL && *filename != '\0') |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
175 gaim_sound_play_file((char *) filename); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
176 else |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
177 gaim_sound_play_event(GAIM_SOUND_POUNCE_DEFAULT); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
178 } |
5032 | 179 |
180 static void | |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
181 save_pounce_cb(GtkWidget *w, GaimGtkPounceDialog *dialog) |
5032 | 182 { |
183 const char *name; | |
184 const char *message, *command, *sound; | |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
185 GaimBuddyList *blist; |
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
186 GaimGtkBuddyList *gtkblist; |
5032 | 187 GaimPounceEvent events = GAIM_POUNCE_NONE; |
188 | |
189 name = gtk_entry_get_text(GTK_ENTRY(dialog->buddy_entry)); | |
190 | |
191 if (*name == '\0') { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5319
diff
changeset
|
192 gaim_notify_error(NULL, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5319
diff
changeset
|
193 _("Please enter a buddy to pounce."), NULL); |
5032 | 194 return; |
195 } | |
196 | |
197 /* Events */ | |
198 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->signon))) | |
199 events |= GAIM_POUNCE_SIGNON; | |
200 | |
201 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->signoff))) | |
202 events |= GAIM_POUNCE_SIGNOFF; | |
203 | |
204 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->away))) | |
205 events |= GAIM_POUNCE_AWAY; | |
206 | |
207 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->away_return))) | |
208 events |= GAIM_POUNCE_AWAY_RETURN; | |
209 | |
210 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->idle))) | |
211 events |= GAIM_POUNCE_IDLE; | |
212 | |
213 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->idle_return))) | |
214 events |= GAIM_POUNCE_IDLE_RETURN; | |
215 | |
216 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->typing))) | |
217 events |= GAIM_POUNCE_TYPING; | |
218 | |
219 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->stop_typing))) | |
220 events |= GAIM_POUNCE_TYPING_STOPPED; | |
221 | |
222 /* Data fields */ | |
223 message = gtk_entry_get_text(GTK_ENTRY(dialog->send_msg_entry)); | |
224 command = gtk_entry_get_text(GTK_ENTRY(dialog->exec_cmd_entry)); | |
225 sound = gtk_entry_get_text(GTK_ENTRY(dialog->play_sound_entry)); | |
226 | |
227 if (*message == '\0') message = NULL; | |
228 if (*command == '\0') command = NULL; | |
229 if (*sound == '\0') sound = NULL; | |
230 | |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
231 if (dialog->pounce == NULL) { |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
232 dialog->pounce = gaim_pounce_new(GAIM_GTK_UI, dialog->account, |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
233 name, events); |
5032 | 234 } |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
235 else { |
5032 | 236 gaim_pounce_set_events(dialog->pounce, events); |
237 gaim_pounce_set_pouncer(dialog->pounce, dialog->account); | |
238 gaim_pounce_set_pouncee(dialog->pounce, name); | |
239 } | |
240 | |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
241 /* Actions*/ |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
242 gaim_pounce_action_set_enabled(dialog->pounce, "open-window", |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
243 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->open_win))); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
244 gaim_pounce_action_set_enabled(dialog->pounce, "popup-notify", |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
245 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->popup))); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
246 gaim_pounce_action_set_enabled(dialog->pounce, "send-message", |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
247 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->send_msg))); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
248 gaim_pounce_action_set_enabled(dialog->pounce, "execute-command", |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
249 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd))); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
250 gaim_pounce_action_set_enabled(dialog->pounce, "play-sound", |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
251 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->play_sound))); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
252 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
253 gaim_pounce_action_set_attribute(dialog->pounce, "send-message", |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
254 "message", message); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
255 gaim_pounce_action_set_attribute(dialog->pounce, "execute-command", |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
256 "command", command); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
257 gaim_pounce_action_set_attribute(dialog->pounce, "play-sound", |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
258 "filename", sound); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
259 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
260 gaim_pounce_set_save(dialog->pounce, |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
261 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->save_pounce))); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
262 |
5032 | 263 delete_win_cb(NULL, NULL, dialog); |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
264 |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
265 gaim_pounces_sync(); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
266 |
5032 | 267 /* Rebuild the pounce menu */ |
268 blist = gaim_get_blist(); | |
269 | |
270 if (GAIM_IS_GTK_BLIST(blist)) | |
271 { | |
272 gtkblist = GAIM_GTK_BLIST(blist); | |
273 | |
274 gaim_gtkpounce_menu_build(gtkblist->bpmenu); | |
275 } | |
276 } | |
277 | |
5054 | 278 static void |
5877
f336fc0a7b8b
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5876
diff
changeset
|
279 pounce_choose_cb(GtkWidget *item, GaimAccount *account, |
f336fc0a7b8b
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5876
diff
changeset
|
280 GaimGtkPounceDialog *dialog) |
5032 | 281 { |
5877
f336fc0a7b8b
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5876
diff
changeset
|
282 dialog->account = account; |
5032 | 283 } |
284 | |
5876
8d6e5f804325
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
285 static void |
8d6e5f804325
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
286 buddy_changed_cb(GtkEntry *entry, GaimGtkPounceDialog *dialog) |
8d6e5f804325
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
287 { |
8d6e5f804325
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
288 if (dialog->save_button == NULL) |
8d6e5f804325
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
289 return; |
8d6e5f804325
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
290 |
8d6e5f804325
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
291 gtk_widget_set_sensitive(dialog->save_button, |
8d6e5f804325
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
292 *gtk_entry_get_text(entry) != '\0'); |
8d6e5f804325
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
293 } |
8d6e5f804325
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
294 |
8803
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
295 static void |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
296 pounce_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
297 GtkSelectionData *sd, guint info, guint t, gpointer data) |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
298 { |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
299 GaimGtkPounceDialog *dialog; |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
300 |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
301 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
302 { |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
303 GaimBlistNode *node = NULL; |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
304 GaimBuddy *buddy; |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
305 |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
306 memcpy(&node, sd->data, sizeof(node)); |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
307 |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
308 if (GAIM_BLIST_NODE_IS_CONTACT(node)) |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
309 buddy = gaim_contact_get_priority_buddy((GaimContact *)node); |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
310 else if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
311 buddy = (GaimBuddy *)node; |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
312 else |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
313 return; |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
314 |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
315 dialog = (GaimGtkPounceDialog *)data; |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
316 |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
317 gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), buddy->name); |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
318 |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
319 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
320 } |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
321 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
322 { |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
323 char *protocol = NULL; |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
324 char *username = NULL; |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
325 GaimAccount *account; |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
326 |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
327 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account, |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
328 &protocol, &username, NULL)) |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
329 { |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
330 if (account == NULL) |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
331 { |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
332 gaim_notify_error(NULL, NULL, |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
333 _("You are not currently signed on with an account that " |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
334 "can add that buddy."), NULL); |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
335 } |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
336 else |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
337 { |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
338 dialog = (GaimGtkPounceDialog *)data; |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
339 |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
340 gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), username); |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
341 } |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
342 } |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
343 |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
344 if (username != NULL) g_free(username); |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
345 if (protocol != NULL) g_free(protocol); |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
346 |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
347 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
348 } |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
349 } |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
350 |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
351 static const GtkTargetEntry dnd_targets[] = |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
352 { |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
353 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 0}, |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
354 {"application/x-im-contact", 0, 1} |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
355 }; |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
356 |
5032 | 357 void |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
358 gaim_gtkpounce_dialog_show(GaimAccount *account, const char *name, |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
359 GaimPounce *cur_pounce) |
5032 | 360 { |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
361 GaimGtkPounceDialog *dialog; |
5032 | 362 GtkWidget *window; |
363 GtkWidget *label; | |
364 GtkWidget *bbox; | |
365 GtkWidget *vbox1, *vbox2; | |
366 GtkWidget *hbox; | |
367 GtkWidget *button; | |
368 GtkWidget *frame; | |
369 GtkWidget *table; | |
370 GtkWidget *sep; | |
371 GtkSizeGroup *sg; | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
372 GPtrArray *sound_widgets; |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
373 GPtrArray *exec_widgets; |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
374 |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
375 dialog = g_new0(GaimGtkPounceDialog, 1); |
5032 | 376 |
8803
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
377 if (cur_pounce != NULL) |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
378 { |
5032 | 379 dialog->pounce = cur_pounce; |
380 dialog->account = gaim_pounce_get_pouncer(cur_pounce); | |
381 } | |
8803
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
382 else if (account != NULL) |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
383 { |
5032 | 384 dialog->pounce = NULL; |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
385 dialog->account = account; |
5032 | 386 } |
8803
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
387 else |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
388 { |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
389 GaimConnection *gc; |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
390 |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
391 gc = (GaimConnection *)gaim_connections_get_all()->data; |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
392 |
5032 | 393 dialog->pounce = NULL; |
8803
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
394 dialog->account = gaim_connection_get_account(gc); |
5032 | 395 } |
396 | |
397 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
398 | |
399 /* Create the window. */ | |
400 dialog->window = window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
401 gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG); | |
402 gtk_window_set_role(GTK_WINDOW(window), "buddy_pounce"); | |
403 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
404 gtk_window_set_title(GTK_WINDOW(window), | |
405 (cur_pounce == NULL | |
406 ? _("New Buddy Pounce") : _("Edit Buddy Pounce"))); | |
407 | |
408 gtk_container_set_border_width(GTK_CONTAINER(window), 12); | |
409 gtk_widget_realize(window); | |
410 | |
411 g_signal_connect(G_OBJECT(window), "delete_event", | |
412 G_CALLBACK(delete_win_cb), dialog); | |
413 | |
414 /* Create the parent vbox for everything. */ | |
415 vbox1 = gtk_vbox_new(FALSE, 12); | |
416 gtk_container_add(GTK_CONTAINER(window), vbox1); | |
417 gtk_widget_show(vbox1); | |
418 | |
419 /* Create the vbox that will contain all the prefs stuff. */ | |
420 vbox2 = gtk_vbox_new(FALSE, 18); | |
421 gtk_box_pack_start(GTK_BOX(vbox1), vbox2, TRUE, TRUE, 0); | |
422 | |
423 /* Create the "Pounce Who" frame. */ | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
424 frame = gaim_gtk_make_frame(vbox2, _("Pounce Who")); |
5032 | 425 |
426 /* Account: */ | |
427 hbox = gtk_hbox_new(FALSE, 6); | |
428 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); | |
429 gtk_widget_show(hbox); | |
430 | |
431 label = gtk_label_new_with_mnemonic(_("_Account:")); | |
432 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
433 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
434 gtk_widget_show(label); | |
435 gtk_size_group_add_widget(sg, label); | |
436 | |
5877
f336fc0a7b8b
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5876
diff
changeset
|
437 dialog->account_menu = |
6646
b89d98f0bf79
[gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents:
6640
diff
changeset
|
438 gaim_gtk_account_option_menu_new(dialog->account, FALSE, |
b89d98f0bf79
[gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents:
6640
diff
changeset
|
439 G_CALLBACK(pounce_choose_cb), |
b89d98f0bf79
[gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents:
6640
diff
changeset
|
440 NULL, dialog); |
5877
f336fc0a7b8b
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5876
diff
changeset
|
441 |
5032 | 442 gtk_box_pack_start(GTK_BOX(hbox), dialog->account_menu, FALSE, FALSE, 0); |
443 gtk_widget_show(dialog->account_menu); | |
8137 | 444 gaim_set_accessible_label (dialog->account_menu, label); |
5032 | 445 |
446 /* Buddy: */ | |
447 hbox = gtk_hbox_new(FALSE, 6); | |
448 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); | |
449 gtk_widget_show(hbox); | |
450 | |
8803
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
451 label = gtk_label_new_with_mnemonic(_("_Buddy name:")); |
5032 | 452 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
453 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
454 gtk_widget_show(label); | |
455 gtk_size_group_add_widget(sg, label); | |
456 | |
457 dialog->buddy_entry = gtk_entry_new(); | |
8803
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
458 |
5032 | 459 gtk_box_pack_start(GTK_BOX(hbox), dialog->buddy_entry, TRUE, TRUE, 0); |
460 gtk_widget_show(dialog->buddy_entry); | |
461 | |
5876
8d6e5f804325
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
462 g_signal_connect(G_OBJECT(dialog->buddy_entry), "changed", |
8d6e5f804325
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
463 G_CALLBACK(buddy_changed_cb), dialog); |
8137 | 464 gaim_set_accessible_label (dialog->buddy_entry, label); |
5876
8d6e5f804325
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
465 |
5032 | 466 if (cur_pounce != NULL) { |
467 gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), | |
468 gaim_pounce_get_pouncee(cur_pounce)); | |
469 } | |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
470 else if (name != NULL) { |
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
471 gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), name); |
5032 | 472 } |
473 | |
474 /* Create the "Pounce When" frame. */ | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
475 frame = gaim_gtk_make_frame(vbox2, _("Pounce When")); |
5032 | 476 |
477 table = gtk_table_new(2, 4, FALSE); | |
478 gtk_container_add(GTK_CONTAINER(frame), table); | |
479 gtk_table_set_col_spacings(GTK_TABLE(table), 12); | |
480 gtk_widget_show(table); | |
481 | |
482 dialog->signon = | |
8157 | 483 gtk_check_button_new_with_mnemonic(_("_Sign on")); |
5032 | 484 dialog->signoff = |
8157 | 485 gtk_check_button_new_with_mnemonic(_("Sign _off")); |
5032 | 486 dialog->away = |
8157 | 487 gtk_check_button_new_with_mnemonic(_("A_way")); |
5032 | 488 dialog->away_return = |
8157 | 489 gtk_check_button_new_with_mnemonic(_("Re_turn from away")); |
5032 | 490 dialog->idle = |
8157 | 491 gtk_check_button_new_with_mnemonic(_("_Idle")); |
5032 | 492 dialog->idle_return = |
8157 | 493 gtk_check_button_new_with_mnemonic(_("Retur_n from idle")); |
5032 | 494 dialog->typing = |
8157 | 495 gtk_check_button_new_with_mnemonic(_("Buddy starts _typing")); |
5032 | 496 dialog->stop_typing = |
8157 | 497 gtk_check_button_new_with_mnemonic(_("Buddy stops t_yping")); |
5032 | 498 |
499 gtk_table_attach(GTK_TABLE(table), dialog->signon, 0, 1, 0, 1, | |
500 GTK_FILL, 0, 0, 0); | |
501 gtk_table_attach(GTK_TABLE(table), dialog->signoff, 1, 2, 0, 1, | |
502 GTK_FILL, 0, 0, 0); | |
503 gtk_table_attach(GTK_TABLE(table), dialog->away, 0, 1, 1, 2, | |
504 GTK_FILL, 0, 0, 0); | |
505 gtk_table_attach(GTK_TABLE(table), dialog->away_return, 1, 2, 1, 2, | |
506 GTK_FILL, 0, 0, 0); | |
507 gtk_table_attach(GTK_TABLE(table), dialog->idle, 0, 1, 2, 3, | |
508 GTK_FILL, 0, 0, 0); | |
509 gtk_table_attach(GTK_TABLE(table), dialog->idle_return, 1, 2, 2, 3, | |
510 GTK_FILL, 0, 0, 0); | |
511 gtk_table_attach(GTK_TABLE(table), dialog->typing, 0, 1, 3, 4, | |
512 GTK_FILL, 0, 0, 0); | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
513 gtk_table_attach(GTK_TABLE(table), dialog->stop_typing, 1, 2, 3, 5, |
5032 | 514 GTK_FILL, 0, 0, 0); |
515 | |
516 gtk_widget_show(dialog->signon); | |
517 gtk_widget_show(dialog->signoff); | |
518 gtk_widget_show(dialog->away); | |
519 gtk_widget_show(dialog->away_return); | |
520 gtk_widget_show(dialog->idle); | |
521 gtk_widget_show(dialog->idle_return); | |
522 gtk_widget_show(dialog->typing); | |
523 gtk_widget_show(dialog->stop_typing); | |
524 | |
525 /* Create the "Pounce Action" frame. */ | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
526 frame = gaim_gtk_make_frame(vbox2, _("Pounce Action")); |
5032 | 527 |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
528 table = gtk_table_new(3, 5, FALSE); |
5032 | 529 gtk_container_add(GTK_CONTAINER(frame), table); |
530 gtk_table_set_col_spacings(GTK_TABLE(table), 12); | |
531 gtk_widget_show(table); | |
532 | |
8157 | 533 dialog->open_win = gtk_check_button_new_with_mnemonic(_("Op_en an IM window")); |
534 dialog->popup = gtk_check_button_new_with_mnemonic(_("_Popup notification")); | |
535 dialog->send_msg = gtk_check_button_new_with_mnemonic(_("Send a _message")); | |
536 dialog->exec_cmd = gtk_check_button_new_with_mnemonic(_("E_xecute a command")); | |
537 dialog->play_sound = gtk_check_button_new_with_mnemonic(_("P_lay a sound")); | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
538 |
5032 | 539 dialog->send_msg_entry = gtk_entry_new(); |
540 dialog->exec_cmd_entry = gtk_entry_new(); | |
8157 | 541 dialog->exec_cmd_browse = gtk_button_new_with_mnemonic(_("B_rowse...")); |
5032 | 542 dialog->play_sound_entry = gtk_entry_new(); |
8157 | 543 dialog->play_sound_browse = gtk_button_new_with_mnemonic(_("Bro_wse...")); |
544 dialog->play_sound_test = gtk_button_new_with_mnemonic(_("Pre_view")); | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
545 |
5032 | 546 gtk_widget_set_sensitive(dialog->send_msg_entry, FALSE); |
547 gtk_widget_set_sensitive(dialog->exec_cmd_entry, FALSE); | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
548 gtk_widget_set_sensitive(dialog->exec_cmd_browse, FALSE); |
5032 | 549 gtk_widget_set_sensitive(dialog->play_sound_entry, FALSE); |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
550 gtk_widget_set_sensitive(dialog->play_sound_browse, FALSE); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
551 gtk_widget_set_sensitive(dialog->play_sound_test, FALSE); |
5032 | 552 |
553 gtk_table_attach(GTK_TABLE(table), dialog->open_win, 0, 1, 0, 1, | |
554 GTK_FILL, 0, 0, 0); | |
555 gtk_table_attach(GTK_TABLE(table), dialog->popup, 0, 1, 1, 2, | |
556 GTK_FILL, 0, 0, 0); | |
557 gtk_table_attach(GTK_TABLE(table), dialog->send_msg, 0, 1, 2, 3, | |
558 GTK_FILL, 0, 0, 0); | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
559 gtk_table_attach(GTK_TABLE(table), dialog->send_msg_entry, 1, 4, 2, 3, |
5032 | 560 GTK_FILL, 0, 0, 0); |
561 gtk_table_attach(GTK_TABLE(table), dialog->exec_cmd, 0, 1, 3, 4, | |
562 GTK_FILL, 0, 0, 0); | |
563 gtk_table_attach(GTK_TABLE(table), dialog->exec_cmd_entry, 1, 2, 3, 4, | |
564 GTK_FILL, 0, 0, 0); | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
565 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
|
566 GTK_FILL | GTK_EXPAND, 0, 0, 0); |
5032 | 567 gtk_table_attach(GTK_TABLE(table), dialog->play_sound, 0, 1, 4, 5, |
568 GTK_FILL, 0, 0, 0); | |
569 gtk_table_attach(GTK_TABLE(table), dialog->play_sound_entry, 1, 2, 4, 5, | |
570 GTK_FILL, 0, 0, 0); | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
571 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
|
572 GTK_FILL | GTK_EXPAND, 0, 0, 0); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
573 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
|
574 GTK_FILL | GTK_EXPAND, 0, 0, 0); |
5032 | 575 |
576 gtk_widget_show(dialog->open_win); | |
577 gtk_widget_show(dialog->popup); | |
578 gtk_widget_show(dialog->send_msg); | |
579 gtk_widget_show(dialog->send_msg_entry); | |
580 gtk_widget_show(dialog->exec_cmd); | |
581 gtk_widget_show(dialog->exec_cmd_entry); | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
582 gtk_widget_show(dialog->exec_cmd_browse); |
5032 | 583 gtk_widget_show(dialog->play_sound); |
584 gtk_widget_show(dialog->play_sound_entry); | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
585 gtk_widget_show(dialog->play_sound_browse); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
586 gtk_widget_show(dialog->play_sound_test); |
5032 | 587 |
588 g_signal_connect(G_OBJECT(dialog->send_msg), "clicked", | |
589 G_CALLBACK(gaim_gtk_toggle_sensitive), | |
590 dialog->send_msg_entry); | |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
591 |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
592 exec_widgets = g_ptr_array_new(); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
593 g_ptr_array_add(exec_widgets,dialog->exec_cmd_entry); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
594 g_ptr_array_add(exec_widgets,dialog->exec_cmd_browse); |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
595 |
5032 | 596 g_signal_connect(G_OBJECT(dialog->exec_cmd), "clicked", |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
597 G_CALLBACK(gtk_toggle_sensitive_array), |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
598 exec_widgets); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
599 g_signal_connect(G_OBJECT(dialog->exec_cmd_browse), "clicked", |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
600 G_CALLBACK(filesel), |
5032 | 601 dialog->exec_cmd_entry); |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
602 |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
603 sound_widgets = g_ptr_array_new(); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
604 g_ptr_array_add(sound_widgets,dialog->play_sound_entry); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
605 g_ptr_array_add(sound_widgets,dialog->play_sound_browse); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
606 g_ptr_array_add(sound_widgets,dialog->play_sound_test); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
607 |
5032 | 608 g_signal_connect(G_OBJECT(dialog->play_sound), "clicked", |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
609 G_CALLBACK(gtk_toggle_sensitive_array), |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
610 sound_widgets); |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
611 g_signal_connect(G_OBJECT(dialog->play_sound_browse), "clicked", |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
612 G_CALLBACK(filesel), |
5032 | 613 dialog->play_sound_entry); |
5319
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
614 g_signal_connect(G_OBJECT(dialog->play_sound_test), "clicked", |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
615 G_CALLBACK(pounce_test_sound), |
3adb20b869b4
[gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
616 dialog->play_sound_entry); |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
617 |
5032 | 618 g_signal_connect(G_OBJECT(dialog->send_msg_entry), "activate", |
619 G_CALLBACK(save_pounce_cb), dialog); | |
620 g_signal_connect(G_OBJECT(dialog->exec_cmd_entry), "activate", | |
621 G_CALLBACK(save_pounce_cb), dialog); | |
622 g_signal_connect(G_OBJECT(dialog->play_sound_entry), "activate", | |
623 G_CALLBACK(save_pounce_cb), dialog); | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
624 |
5032 | 625 /* Now the last part, where we have the Save checkbox */ |
626 dialog->save_pounce = gtk_check_button_new_with_mnemonic( | |
8157 | 627 _("Sav_e this pounce after activation")); |
5032 | 628 |
629 gtk_box_pack_start(GTK_BOX(vbox2), dialog->save_pounce, FALSE, FALSE, 0); | |
630 | |
631 /* Separator... */ | |
632 sep = gtk_hseparator_new(); | |
633 gtk_box_pack_start(GTK_BOX(vbox1), sep, FALSE, FALSE, 0); | |
634 gtk_widget_show(sep); | |
635 | |
636 /* Now the button box! */ | |
637 bbox = gtk_hbutton_box_new(); | |
638 gtk_box_set_spacing(GTK_BOX(bbox), 6); | |
639 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
640 gtk_box_pack_end(GTK_BOX(vbox1), bbox, FALSE, FALSE, 0); | |
641 gtk_widget_show(bbox); | |
642 | |
5052
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
643 /* Delete button */ |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
644 button = gtk_button_new_from_stock(GTK_STOCK_DELETE); |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
645 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
646 gtk_widget_show(button); |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
647 |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
648 g_signal_connect(G_OBJECT(button), "clicked", |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
649 G_CALLBACK(delete_cb), dialog); |
6a7759f63766
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
650 |
5032 | 651 /* Cancel button */ |
652 button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); | |
653 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
654 gtk_widget_show(button); | |
655 | |
656 g_signal_connect(G_OBJECT(button), "clicked", | |
657 G_CALLBACK(cancel_cb), dialog); | |
658 | |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
659 /* Save button */ |
5876
8d6e5f804325
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
660 dialog->save_button = button = gtk_button_new_from_stock(GTK_STOCK_SAVE); |
5032 | 661 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
662 gtk_widget_show(button); | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
663 |
5032 | 664 g_signal_connect(G_OBJECT(button), "clicked", |
665 G_CALLBACK(save_pounce_cb), dialog); | |
666 | |
5876
8d6e5f804325
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
667 if (*gtk_entry_get_text(GTK_ENTRY(dialog->buddy_entry)) == '\0') |
8d6e5f804325
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
668 gtk_widget_set_sensitive(button, FALSE); |
8d6e5f804325
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
669 |
8803
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
670 /* Setup drag-and-drop */ |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
671 gtk_drag_dest_set(window, |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
672 GTK_DEST_DEFAULT_MOTION | |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
673 GTK_DEST_DEFAULT_DROP, |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
674 dnd_targets, |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
675 sizeof(dnd_targets) / sizeof(GtkTargetEntry), |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
676 GDK_ACTION_COPY); |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
677 gtk_drag_dest_set(dialog->buddy_entry, |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
678 GTK_DEST_DEFAULT_MOTION | |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
679 GTK_DEST_DEFAULT_DROP, |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
680 dnd_targets, |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
681 sizeof(dnd_targets) / sizeof(GtkTargetEntry), |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
682 GDK_ACTION_COPY); |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
683 |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
684 g_signal_connect(G_OBJECT(window), "drag_data_received", |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
685 G_CALLBACK(pounce_dnd_recv), dialog); |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
686 g_signal_connect(G_OBJECT(dialog->buddy_entry), "drag_data_received", |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
687 G_CALLBACK(pounce_dnd_recv), dialog); |
721899998983
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
688 |
5032 | 689 /* Set the values of stuff. */ |
690 if (cur_pounce != NULL) { | |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
691 GaimPounceEvent events = gaim_pounce_get_events(cur_pounce); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
692 const char *value; |
5032 | 693 |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
694 /* Events */ |
5032 | 695 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signon), |
696 (events & GAIM_POUNCE_SIGNON)); | |
697 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signoff), | |
698 (events & GAIM_POUNCE_SIGNOFF)); | |
699 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->away), | |
700 (events & GAIM_POUNCE_AWAY)); | |
701 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->away_return), | |
702 (events & GAIM_POUNCE_AWAY_RETURN)); | |
703 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->idle), | |
704 (events & GAIM_POUNCE_IDLE)); | |
705 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->idle_return), | |
706 (events & GAIM_POUNCE_IDLE_RETURN)); | |
707 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->typing), | |
708 (events & GAIM_POUNCE_TYPING)); | |
709 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->stop_typing), | |
710 (events & GAIM_POUNCE_TYPING_STOPPED)); | |
711 | |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
712 /* Actions */ |
5032 | 713 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->open_win), |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
714 gaim_pounce_action_is_enabled(cur_pounce, "open-window")); |
5032 | 715 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->popup), |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
716 gaim_pounce_action_is_enabled(cur_pounce, "popup-notify")); |
5032 | 717 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->send_msg), |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
718 gaim_pounce_action_is_enabled(cur_pounce, "send-message")); |
5032 | 719 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd), |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
720 gaim_pounce_action_is_enabled(cur_pounce, "execute-command")); |
5032 | 721 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->play_sound), |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
722 gaim_pounce_action_is_enabled(cur_pounce, "play-sound")); |
5032 | 723 |
724 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->save_pounce), | |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
725 gaim_pounce_get_save(cur_pounce)); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
726 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
727 if ((value = gaim_pounce_action_get_attribute(cur_pounce, |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
728 "send-message", |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
729 "message")) != NULL) { |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
730 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
731 gtk_entry_set_text(GTK_ENTRY(dialog->send_msg_entry), value); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
732 } |
5032 | 733 |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
734 if ((value = gaim_pounce_action_get_attribute(cur_pounce, |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
735 "execute-command", |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
736 "command")) != NULL) { |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
737 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
738 gtk_entry_set_text(GTK_ENTRY(dialog->exec_cmd_entry), value); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
739 } |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
740 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
741 if ((value = gaim_pounce_action_get_attribute(cur_pounce, |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
742 "play-sound", |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
743 "filename")) != NULL) { |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
744 gtk_entry_set_text(GTK_ENTRY(dialog->play_sound_entry), value); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
745 } |
5032 | 746 } |
747 else { | |
748 /* Set some defaults */ | |
749 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->send_msg), TRUE); | |
750 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signon), TRUE); | |
751 } | |
752 | |
753 gtk_widget_show_all(vbox2); | |
754 gtk_widget_show(window); | |
755 } | |
756 | |
757 static void | |
6695 | 758 new_pounce_cb(GtkWidget *w, GaimBuddy *b) |
5032 | 759 { |
5937
3034a6ea2d89
[gaim-migrate @ 6377]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
760 if (b == NULL) |
3034a6ea2d89
[gaim-migrate @ 6377]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
761 gaim_gtkpounce_dialog_show(NULL, NULL, NULL); |
3034a6ea2d89
[gaim-migrate @ 6377]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
762 else |
3034a6ea2d89
[gaim-migrate @ 6377]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
763 gaim_gtkpounce_dialog_show(b->account, b->name, NULL); |
5032 | 764 } |
765 | |
766 static void | |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
767 delete_pounce_cb(GtkWidget *w, GaimPounce *pounce) |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
768 { |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
769 gaim_pounce_destroy(pounce); |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
770 } |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
771 |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
772 static void |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
773 edit_pounce_cb(GtkWidget *w, GaimPounce *pounce) |
5032 | 774 { |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
775 gaim_gtkpounce_dialog_show(NULL, NULL, pounce); |
5032 | 776 } |
777 | |
8259
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
778 static gboolean |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
779 fill_menu(GtkWidget *menu, GCallback cb) |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
780 { |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
781 GtkWidget *image; |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
782 GtkWidget *item; |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
783 GdkPixbuf *pixbuf, *scale; |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
784 GaimPounce *pounce; |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
785 const char *buddy; |
8259
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
786 gboolean has_items = FALSE; |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
787 GList *bp; |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
788 |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
789 for (bp = gaim_pounces_get_all(); bp != NULL; bp = bp->next) { |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
790 pounce = (GaimPounce *)bp->data; |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
791 buddy = gaim_pounce_get_pouncee(pounce); |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
792 |
8235 | 793 /* Check if account is online, if not skip it */ |
8259
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
794 if (!gaim_account_is_connected(pounce->pouncer)) |
8235 | 795 continue; |
8259
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
796 |
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
797 has_items = TRUE; |
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
798 |
5161 | 799 /* Build the menu item */ |
800 item = gtk_image_menu_item_new_with_label(buddy); | |
801 | |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
802 /* Create a pixmap for the protocol icon. */ |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
803 pixbuf = create_prpl_icon(gaim_pounce_get_pouncer(pounce)); |
5161 | 804 if(pixbuf) { |
805 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, | |
806 GDK_INTERP_BILINEAR); | |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
807 |
5161 | 808 /* Now convert it to GtkImage */ |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
809 image = gtk_image_new_from_pixbuf(scale); |
5161 | 810 g_object_unref(G_OBJECT(scale)); |
811 g_object_unref(G_OBJECT(pixbuf)); | |
812 gtk_widget_show(image); | |
813 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image); | |
814 } | |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
815 |
5161 | 816 /* Put the item in the menu */ |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
817 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
818 gtk_widget_show(item); |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
819 |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
820 /* Set our callbacks. */ |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
821 g_signal_connect(G_OBJECT(item), "activate", cb, pounce); |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
822 } |
8259
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
823 |
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
824 return has_items; |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
825 } |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
826 |
5032 | 827 void |
828 gaim_gtkpounce_menu_build(GtkWidget *menu) | |
829 { | |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
830 GtkWidget *remmenu; |
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
831 GtkWidget *item; |
8259
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
832 GList *children, *l; |
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
833 gboolean has_items; |
5032 | 834 |
8259
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
835 g_return_if_fail(menu != NULL); |
8252 | 836 |
8259
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
837 if ((children = gtk_container_get_children(GTK_CONTAINER(menu))) != NULL) |
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
838 { |
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
839 for (l = children; l != NULL; l = l->next) |
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
840 gtk_widget_destroy(GTK_WIDGET(l->data)); |
5032 | 841 |
8259
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
842 g_list_free(children); |
5032 | 843 } |
8252 | 844 |
5032 | 845 /* "New Buddy Pounce" */ |
846 item = gtk_menu_item_new_with_label(_("New Buddy Pounce")); | |
847 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); | |
848 gtk_widget_show(item); | |
849 g_signal_connect(G_OBJECT(item), "activate", | |
850 G_CALLBACK(new_pounce_cb), NULL); | |
851 | |
852 /* "Remove Buddy Pounce" */ | |
853 item = gtk_menu_item_new_with_label(_("Remove Buddy Pounce")); | |
854 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); | |
855 | |
856 /* "Remove Buddy Pounce" menu */ | |
857 remmenu = gtk_menu_new(); | |
858 | |
8259
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
859 has_items = fill_menu(remmenu, G_CALLBACK(delete_pounce_cb)); |
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
860 |
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
861 if (!has_items) |
4f9f68ab8770
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
862 gtk_widget_set_sensitive(item, FALSE); |
5032 | 863 |
864 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), remmenu); | |
865 gtk_widget_show(remmenu); | |
866 gtk_widget_show(item); | |
867 | |
868 /* Separator */ | |
869 item = gtk_separator_menu_item_new(); | |
870 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); | |
871 gtk_widget_show(item); | |
872 | |
5153
ab0f12de3718
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
873 fill_menu(menu, G_CALLBACK(edit_pounce_cb)); |
5032 | 874 } |
875 | |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
876 static void |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
877 pounce_cb(GaimPounce *pounce, GaimPounceEvent events, void *data) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
878 { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
879 GaimConversation *conv; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
880 GaimAccount *account; |
7994
d5874c4f19c5
[gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents:
7276
diff
changeset
|
881 GaimBuddy *buddy; |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
882 const char *pouncee; |
7994
d5874c4f19c5
[gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents:
7276
diff
changeset
|
883 const char *alias; |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
884 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
885 pouncee = gaim_pounce_get_pouncee(pounce); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
886 account = gaim_pounce_get_pouncer(pounce); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
887 |
7994
d5874c4f19c5
[gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents:
7276
diff
changeset
|
888 buddy = gaim_find_buddy(account, pouncee); |
d5874c4f19c5
[gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents:
7276
diff
changeset
|
889 |
d5874c4f19c5
[gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents:
7276
diff
changeset
|
890 alias = gaim_get_buddy_alias(buddy); |
d5874c4f19c5
[gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents:
7276
diff
changeset
|
891 |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
892 if (gaim_pounce_action_is_enabled(pounce, "open-window")) { |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6621
diff
changeset
|
893 conv = gaim_find_conversation_with_account(pouncee, account); |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
894 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
895 if (conv == NULL) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
896 conv = gaim_conversation_new(GAIM_CONV_IM, account, pouncee); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
897 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
898 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
899 if (gaim_pounce_action_is_enabled(pounce, "popup-notify")) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
900 char tmp[1024]; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
901 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
902 g_snprintf(tmp, sizeof(tmp), |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
903 (events & GAIM_POUNCE_TYPING) ? _("%s has started typing to you") : |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
904 (events & GAIM_POUNCE_SIGNON) ? _("%s has signed on") : |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
905 (events & GAIM_POUNCE_IDLE_RETURN) ? _("%s has returned from being idle") : |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
906 (events & GAIM_POUNCE_AWAY_RETURN) ? _("%s has returned from being away") : |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
907 (events & GAIM_POUNCE_TYPING_STOPPED) ? _("%s has stopped typing to you") : |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
908 (events & GAIM_POUNCE_SIGNOFF) ? _("%s has signed off") : |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
909 (events & GAIM_POUNCE_IDLE) ? _("%s has become idle") : |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
910 (events & GAIM_POUNCE_AWAY) ? _("%s has gone away.") : |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
911 _("Unknown pounce event. Please report this!"), |
7994
d5874c4f19c5
[gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents:
7276
diff
changeset
|
912 alias); |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
913 |
8862 | 914 gaim_notify_info(NULL, NULL, tmp, (char*)gaim_date_full()); |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
915 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
916 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
917 if (gaim_pounce_action_is_enabled(pounce, "send-message")) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
918 const char *message; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
919 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
920 message = gaim_pounce_action_get_attribute(pounce, "send-message", |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
921 "message"); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
922 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
923 if (message != NULL) { |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6621
diff
changeset
|
924 conv = gaim_find_conversation_with_account(pouncee, account); |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
925 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
926 if (conv == NULL) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
927 conv = gaim_conversation_new(GAIM_CONV_IM, account, pouncee); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
928 |
6982 | 929 gaim_conversation_write(conv, NULL, message, |
6621 | 930 GAIM_MESSAGE_SEND, time(NULL)); |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
931 |
6982 | 932 serv_send_im(account->gc, (char *)pouncee, (char *)message, 0); |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
933 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
934 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
935 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
936 if (gaim_pounce_action_is_enabled(pounce, "execute-command")) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
937 const char *command; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
938 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
939 command = gaim_pounce_action_get_attribute(pounce, "execute-command", |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
940 "command"); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
941 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
942 if (command != NULL) { |
6660
48a31082bf5f
[gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6646
diff
changeset
|
943 #ifndef _WIN32 |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
944 int pid = fork(); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
945 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
946 if (pid == 0) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
947 char *args[4]; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
948 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
949 args[0] = "sh"; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
950 args[1] = "-c"; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
951 args[2] = (char *)command; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
952 args[3] = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
953 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
954 execvp(args[0], args); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
955 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
956 _exit(0); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
957 } |
6660
48a31082bf5f
[gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6646
diff
changeset
|
958 #else |
48a31082bf5f
[gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6646
diff
changeset
|
959 STARTUPINFO StartInfo; |
48a31082bf5f
[gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6646
diff
changeset
|
960 PROCESS_INFORMATION ProcInfo; |
48a31082bf5f
[gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6646
diff
changeset
|
961 |
48a31082bf5f
[gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6646
diff
changeset
|
962 memset(&ProcInfo, 0, sizeof(ProcInfo)); |
48a31082bf5f
[gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6646
diff
changeset
|
963 memset(&StartInfo, 0 , sizeof(StartInfo)); |
48a31082bf5f
[gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6646
diff
changeset
|
964 StartInfo.cb = sizeof(StartInfo); |
48a31082bf5f
[gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6646
diff
changeset
|
965 CreateProcess(NULL, (char *)command, NULL, NULL, 0, 0, NULL, NULL, &StartInfo, &ProcInfo); |
7276
29c0fe160f90
[gaim-migrate @ 7855]
Christian Hammond <chipx86@chipx86.com>
parents:
7098
diff
changeset
|
966 gaim_debug_info("pounce", |
29c0fe160f90
[gaim-migrate @ 7855]
Christian Hammond <chipx86@chipx86.com>
parents:
7098
diff
changeset
|
967 "Pounce execute command called for: %s\n", |
29c0fe160f90
[gaim-migrate @ 7855]
Christian Hammond <chipx86@chipx86.com>
parents:
7098
diff
changeset
|
968 command); |
6660
48a31082bf5f
[gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6646
diff
changeset
|
969 #endif |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
970 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
971 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
972 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
973 if (gaim_pounce_action_is_enabled(pounce, "play-sound")) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
974 const char *sound; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
975 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
976 sound = gaim_pounce_action_get_attribute(pounce, "play-sound", |
6444
601c2a52d74a
[gaim-migrate @ 6953]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
977 "filename"); |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
978 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
979 if (sound != NULL) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
980 gaim_sound_play_file(sound); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
981 else |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
982 gaim_sound_play_event(GAIM_SOUND_POUNCE_DEFAULT); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
983 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
984 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
985 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
986 static void |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
987 free_pounce(GaimPounce *pounce) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
988 { |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
989 GaimBuddyList *blist; |
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
990 GaimGtkBuddyList *gtkblist; |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
991 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
992 /* Rebuild the pounce menu */ |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
993 blist = gaim_get_blist(); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
994 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
995 if (GAIM_IS_GTK_BLIST(blist)) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
996 { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
997 gtkblist = GAIM_GTK_BLIST(blist); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
998 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
999 gaim_gtkpounce_menu_build(gtkblist->bpmenu); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1000 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1001 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1002 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1003 static void |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1004 new_pounce(GaimPounce *pounce) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1005 { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1006 gaim_pounce_action_register(pounce, "open-window"); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1007 gaim_pounce_action_register(pounce, "popup-notify"); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1008 gaim_pounce_action_register(pounce, "send-message"); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1009 gaim_pounce_action_register(pounce, "execute-command"); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1010 gaim_pounce_action_register(pounce, "play-sound"); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1011 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1012 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1013 void |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1014 gaim_gtk_pounces_init(void) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1015 { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1016 gaim_pounces_register_handler(GAIM_GTK_UI, pounce_cb, new_pounce, |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1017 free_pounce); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1018 } |