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