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