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