Sat, 19 Nov 2005 00:34:04 +0000
[gaim-migrate @ 14445]
Fix a conflict in mnemonics I added. I'm going to force SimGuy to write a patch if I've done this wrong again.
| 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 | */ | |
| 9791 | 26 | #include "internal.h" |
| 27 | #include "gtkgaim.h" | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
28 | |
| 8235 | 29 | #include "account.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
30 | #include "conversation.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
31 | #include "debug.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
32 | #include "notify.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
33 | #include "prpl.h" |
|
9505
6120a3cb8af7
[gaim-migrate @ 10332]
Mark Doliner <markdoliner@pidgin.im>
parents:
9206
diff
changeset
|
34 | #include "request.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
35 | #include "server.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
36 | #include "sound.h" |
|
9709
2e73f176cc80
[gaim-migrate @ 10570]
Mark Doliner <markdoliner@pidgin.im>
parents:
9699
diff
changeset
|
37 | #include "util.h" |
|
5872
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 "gtkblist.h" |
|
9709
2e73f176cc80
[gaim-migrate @ 10570]
Mark Doliner <markdoliner@pidgin.im>
parents:
9699
diff
changeset
|
40 | #include "gtkdialogs.h" |
| 5032 | 41 | #include "gtkpounce.h" |
| 12136 | 42 | #include "gtkstock.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
43 | #include "gtkutils.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
44 | |
| 12136 | 45 | /** |
| 46 | * These are used for the GtkTreeView when you're scrolling through | |
| 47 | * all your saved pounces. | |
| 48 | */ | |
| 49 | enum | |
| 50 | { | |
| 51 | /* Hidden column containing the GaimPounce */ | |
| 52 | POUNCES_MANAGER_COLUMN_POUNCE, | |
| 53 | POUNCES_MANAGER_COLUMN_ICON, | |
| 54 | POUNCES_MANAGER_COLUMN_TARGET, | |
| 55 | POUNCES_MANAGER_COLUMN_ACCOUNT, | |
| 56 | POUNCES_MANAGER_COLUMN_PERSISTENCE, | |
| 57 | POUNCES_MANAGER_NUM_COLUMNS | |
| 58 | }; | |
| 59 | ||
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
60 | typedef struct |
| 5032 | 61 | { |
| 62 | /* Pounce data */ | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
63 | GaimPounce *pounce; |
|
5563
d5a7852aa0cb
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
64 | GaimAccount *account; |
| 5032 | 65 | |
| 66 | /* The window */ | |
| 67 | GtkWidget *window; | |
| 68 | ||
| 69 | /* Pounce Who */ | |
| 70 | GtkWidget *account_menu; | |
| 71 | GtkWidget *buddy_entry; | |
| 72 | ||
| 73 | /* Pounce When */ | |
| 74 | GtkWidget *signon; | |
| 75 | GtkWidget *signoff; | |
| 76 | GtkWidget *away; | |
| 77 | GtkWidget *away_return; | |
| 78 | GtkWidget *idle; | |
| 79 | GtkWidget *idle_return; | |
| 80 | GtkWidget *typing; | |
| 81 | GtkWidget *stop_typing; | |
| 82 | ||
| 83 | /* Pounce Action */ | |
| 84 | GtkWidget *open_win; | |
| 85 | GtkWidget *popup; | |
| 86 | GtkWidget *send_msg; | |
| 87 | GtkWidget *send_msg_entry; | |
| 88 | GtkWidget *exec_cmd; | |
| 89 | GtkWidget *exec_cmd_entry; | |
| 5319 | 90 | GtkWidget *exec_cmd_browse; |
| 5032 | 91 | GtkWidget *play_sound; |
| 92 | GtkWidget *play_sound_entry; | |
| 5319 | 93 | GtkWidget *play_sound_browse; |
| 94 | GtkWidget *play_sound_test; | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
95 | |
| 5032 | 96 | GtkWidget *save_pounce; |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
97 | |
|
5876
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
98 | /* Buttons */ |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
99 | GtkWidget *save_button; |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
100 | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
101 | } GaimGtkPounceDialog; |
| 5032 | 102 | |
| 12136 | 103 | typedef struct |
| 104 | { | |
| 105 | GtkWidget *window; | |
| 106 | GtkListStore *model; | |
| 107 | GtkWidget *treeview; | |
| 108 | GtkWidget *modify_button; | |
| 109 | GtkWidget *delete_button; | |
| 110 | } PouncesManager; | |
| 111 | ||
| 112 | static PouncesManager *pounces_manager = NULL; | |
| 113 | ||
| 5032 | 114 | /************************************************************************** |
| 115 | * Callbacks | |
| 116 | **************************************************************************/ | |
| 117 | static gint | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
118 | delete_win_cb(GtkWidget *w, GdkEventAny *e, GaimGtkPounceDialog *dialog) |
| 5032 | 119 | { |
| 120 | gtk_widget_destroy(dialog->window); | |
| 121 | g_free(dialog); | |
| 122 | ||
| 123 | return TRUE; | |
| 124 | } | |
| 125 | ||
| 126 | static void | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
127 | delete_cb(GtkWidget *w, GaimGtkPounceDialog *dialog) |
|
5052
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
128 | { |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
129 | gaim_pounce_destroy(dialog->pounce); |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
130 | |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
131 | delete_win_cb(NULL, NULL, dialog); |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
132 | } |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
133 | |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
134 | static void |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
135 | cancel_cb(GtkWidget *w, GaimGtkPounceDialog *dialog) |
| 5032 | 136 | { |
| 137 | delete_win_cb(NULL, NULL, dialog); | |
| 138 | } | |
| 139 | ||
| 5319 | 140 | static void |
|
9505
6120a3cb8af7
[gaim-migrate @ 10332]
Mark Doliner <markdoliner@pidgin.im>
parents:
9206
diff
changeset
|
141 | pounce_update_entry_fields(void *user_data, const char *filename) |
| 5319 | 142 | { |
|
9505
6120a3cb8af7
[gaim-migrate @ 10332]
Mark Doliner <markdoliner@pidgin.im>
parents:
9206
diff
changeset
|
143 | GtkWidget *entry = (GtkWidget *)user_data; |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
144 | |
|
9505
6120a3cb8af7
[gaim-migrate @ 10332]
Mark Doliner <markdoliner@pidgin.im>
parents:
9206
diff
changeset
|
145 | gtk_entry_set_text(GTK_ENTRY(entry), filename); |
| 5319 | 146 | } |
| 147 | ||
| 148 | static void | |
|
9505
6120a3cb8af7
[gaim-migrate @ 10332]
Mark Doliner <markdoliner@pidgin.im>
parents:
9206
diff
changeset
|
149 | filesel(GtkWidget *widget, gpointer data) |
| 5319 | 150 | { |
| 151 | GtkWidget *entry; | |
|
9505
6120a3cb8af7
[gaim-migrate @ 10332]
Mark Doliner <markdoliner@pidgin.im>
parents:
9206
diff
changeset
|
152 | const gchar *name; |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
153 | |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
154 | entry = (GtkWidget *)data; |
|
9505
6120a3cb8af7
[gaim-migrate @ 10332]
Mark Doliner <markdoliner@pidgin.im>
parents:
9206
diff
changeset
|
155 | name = gtk_entry_get_text(GTK_ENTRY(entry)); |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
156 | |
|
9505
6120a3cb8af7
[gaim-migrate @ 10332]
Mark Doliner <markdoliner@pidgin.im>
parents:
9206
diff
changeset
|
157 | gaim_request_file(entry, _("Select a file"), name, FALSE, |
|
6120a3cb8af7
[gaim-migrate @ 10332]
Mark Doliner <markdoliner@pidgin.im>
parents:
9206
diff
changeset
|
158 | G_CALLBACK(pounce_update_entry_fields), NULL, entry); |
| 5319 | 159 | } |
| 160 | ||
| 161 | static void | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
162 | pounce_test_sound(GtkWidget *w, GtkWidget *entry) |
| 5319 | 163 | { |
| 164 | const char *filename; | |
| 165 | ||
| 166 | filename = gtk_entry_get_text(GTK_ENTRY(entry)); | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
167 | |
|
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
168 | if (filename != NULL && *filename != '\0') |
|
11642
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11338
diff
changeset
|
169 | gaim_sound_play_file(filename, NULL); |
| 5319 | 170 | else |
|
11642
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11338
diff
changeset
|
171 | gaim_sound_play_event(GAIM_SOUND_POUNCE_DEFAULT, NULL); |
| 5319 | 172 | } |
| 5032 | 173 | |
| 174 | static void | |
| 12136 | 175 | add_pounce_to_treeview(GtkListStore *model, GaimPounce *pounce) |
| 176 | { | |
| 177 | GtkTreeIter iter; | |
| 178 | GaimAccount *account; | |
| 179 | GaimPounceEvent events; | |
| 180 | gboolean persists; | |
| 181 | const char *pouncer; | |
| 182 | const char *pouncee; | |
| 183 | GdkPixbuf *pixbuf, *scale = NULL; | |
| 184 | ||
| 185 | account = gaim_pounce_get_pouncer(pounce); | |
| 186 | ||
| 187 | if (gaim_account_is_disconnected(account)) | |
| 188 | return; | |
| 189 | ||
| 190 | events = gaim_pounce_get_events(pounce); | |
| 191 | ||
| 192 | pixbuf = gaim_gtk_create_prpl_icon(account); | |
| 193 | ||
| 194 | if (pixbuf != NULL) | |
| 195 | scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, | |
| 196 | GDK_INTERP_BILINEAR); | |
| 197 | ||
| 198 | pouncer = gaim_account_get_username(account); | |
| 199 | pouncee = gaim_pounce_get_pouncee(pounce); | |
| 200 | persists = gaim_pounce_get_save(pounce); | |
| 201 | ||
| 202 | gtk_list_store_append(model, &iter); | |
| 203 | gtk_list_store_set(model, &iter, | |
| 204 | POUNCES_MANAGER_COLUMN_POUNCE, pounce, | |
| 205 | POUNCES_MANAGER_COLUMN_ICON, scale, | |
| 206 | POUNCES_MANAGER_COLUMN_TARGET, pouncee, | |
| 207 | POUNCES_MANAGER_COLUMN_ACCOUNT, pouncer, | |
| 208 | POUNCES_MANAGER_COLUMN_PERSISTENCE, persists, | |
| 209 | -1); | |
| 210 | } | |
| 211 | ||
| 212 | static void | |
| 213 | populate_pounces_list(PouncesManager *dialog) | |
| 214 | { | |
| 215 | const GList *pounces; | |
| 216 | ||
| 217 | gtk_list_store_clear(dialog->model); | |
| 218 | ||
| 219 | for (pounces = gaim_pounces_get_all(); pounces != NULL; | |
| 220 | pounces = g_list_next(pounces)) | |
| 221 | { | |
| 222 | add_pounce_to_treeview(dialog->model, pounces->data); | |
| 223 | } | |
| 224 | } | |
| 225 | ||
| 226 | static void | |
| 227 | update_pounces(void) | |
| 228 | { | |
| 229 | /* Rebuild the pounces list if the pounces manager is open */ | |
| 230 | if (pounces_manager != NULL) | |
| 231 | { | |
| 232 | populate_pounces_list(pounces_manager); | |
| 233 | } | |
| 234 | } | |
| 235 | ||
| 236 | static void | |
| 237 | signed_on_off_cb(GaimConnection *gc, gpointer user_data) | |
| 238 | { | |
| 239 | update_pounces(); | |
| 240 | } | |
| 241 | ||
| 242 | static void | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
243 | save_pounce_cb(GtkWidget *w, GaimGtkPounceDialog *dialog) |
| 5032 | 244 | { |
| 245 | const char *name; | |
| 246 | const char *message, *command, *sound; | |
| 247 | GaimPounceEvent events = GAIM_POUNCE_NONE; | |
| 248 | ||
| 249 | name = gtk_entry_get_text(GTK_ENTRY(dialog->buddy_entry)); | |
| 250 | ||
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
251 | if (*name == '\0') |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
252 | { |
|
5436
a0e0bacaa196
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5319
diff
changeset
|
253 | gaim_notify_error(NULL, NULL, |
|
a0e0bacaa196
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5319
diff
changeset
|
254 | _("Please enter a buddy to pounce."), NULL); |
| 5032 | 255 | return; |
| 256 | } | |
| 257 | ||
| 258 | /* Events */ | |
| 259 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->signon))) | |
| 260 | events |= GAIM_POUNCE_SIGNON; | |
| 261 | ||
| 262 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->signoff))) | |
| 263 | events |= GAIM_POUNCE_SIGNOFF; | |
| 264 | ||
| 265 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->away))) | |
| 266 | events |= GAIM_POUNCE_AWAY; | |
| 267 | ||
| 268 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->away_return))) | |
| 269 | events |= GAIM_POUNCE_AWAY_RETURN; | |
| 270 | ||
| 271 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->idle))) | |
| 272 | events |= GAIM_POUNCE_IDLE; | |
| 273 | ||
| 274 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->idle_return))) | |
| 275 | events |= GAIM_POUNCE_IDLE_RETURN; | |
| 276 | ||
| 277 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->typing))) | |
| 278 | events |= GAIM_POUNCE_TYPING; | |
| 279 | ||
| 280 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->stop_typing))) | |
| 281 | events |= GAIM_POUNCE_TYPING_STOPPED; | |
| 282 | ||
| 283 | /* Data fields */ | |
| 284 | message = gtk_entry_get_text(GTK_ENTRY(dialog->send_msg_entry)); | |
| 285 | command = gtk_entry_get_text(GTK_ENTRY(dialog->exec_cmd_entry)); | |
| 286 | sound = gtk_entry_get_text(GTK_ENTRY(dialog->play_sound_entry)); | |
| 287 | ||
| 288 | if (*message == '\0') message = NULL; | |
| 289 | if (*command == '\0') command = NULL; | |
| 290 | if (*sound == '\0') sound = NULL; | |
| 291 | ||
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
292 | if (dialog->pounce == NULL) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
293 | { |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
294 | dialog->pounce = gaim_pounce_new(GAIM_GTK_UI, dialog->account, |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
295 | name, events); |
| 5032 | 296 | } |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
297 | else { |
| 5032 | 298 | gaim_pounce_set_events(dialog->pounce, events); |
| 299 | gaim_pounce_set_pouncer(dialog->pounce, dialog->account); | |
| 300 | gaim_pounce_set_pouncee(dialog->pounce, name); | |
| 301 | } | |
| 302 | ||
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
303 | /* Actions */ |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
304 | gaim_pounce_action_set_enabled(dialog->pounce, "open-window", |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
305 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->open_win))); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
306 | gaim_pounce_action_set_enabled(dialog->pounce, "popup-notify", |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
307 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->popup))); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
308 | gaim_pounce_action_set_enabled(dialog->pounce, "send-message", |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
309 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->send_msg))); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
310 | gaim_pounce_action_set_enabled(dialog->pounce, "execute-command", |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
311 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd))); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
312 | gaim_pounce_action_set_enabled(dialog->pounce, "play-sound", |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
313 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->play_sound))); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
314 | |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
315 | gaim_pounce_action_set_attribute(dialog->pounce, "send-message", |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
316 | "message", message); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
317 | gaim_pounce_action_set_attribute(dialog->pounce, "execute-command", |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
318 | "command", command); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
319 | gaim_pounce_action_set_attribute(dialog->pounce, "play-sound", |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
320 | "filename", sound); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
321 | |
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
322 | /* Set the defaults for next time. */ |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
323 | gaim_prefs_set_bool("/gaim/gtk/pounces/default_actions/open-window", |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
324 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->open_win))); |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
325 | gaim_prefs_set_bool("/gaim/gtk/pounces/default_actions/popup-notify", |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
326 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->popup))); |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
327 | gaim_prefs_set_bool("/gaim/gtk/pounces/default_actions/send-message", |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
328 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->send_msg))); |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
329 | gaim_prefs_set_bool("/gaim/gtk/pounces/default_actions/execute-command", |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
330 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd))); |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
331 | gaim_prefs_set_bool("/gaim/gtk/pounces/default_actions/play-sound", |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
332 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->play_sound))); |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
333 | |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
334 | gaim_pounce_set_save(dialog->pounce, |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
335 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->save_pounce))); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
336 | |
| 12136 | 337 | update_pounces(); |
| 5032 | 338 | |
| 12136 | 339 | delete_win_cb(NULL, NULL, dialog); |
| 5032 | 340 | } |
| 341 | ||
| 5054 | 342 | static void |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5876
diff
changeset
|
343 | pounce_choose_cb(GtkWidget *item, GaimAccount *account, |
|
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5876
diff
changeset
|
344 | GaimGtkPounceDialog *dialog) |
| 5032 | 345 | { |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5876
diff
changeset
|
346 | dialog->account = account; |
| 5032 | 347 | } |
| 348 | ||
|
5876
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
349 | static void |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
350 | buddy_changed_cb(GtkEntry *entry, GaimGtkPounceDialog *dialog) |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
351 | { |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
352 | if (dialog->save_button == NULL) |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
353 | return; |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
354 | |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
355 | gtk_widget_set_sensitive(dialog->save_button, |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
356 | *gtk_entry_get_text(entry) != '\0'); |
|
5876
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
357 | } |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
358 | |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
359 | static void |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
360 | pounce_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
361 | GtkSelectionData *sd, guint info, guint t, gpointer data) |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
362 | { |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
363 | GaimGtkPounceDialog *dialog; |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
364 | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
365 | if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
366 | { |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
367 | GaimBlistNode *node = NULL; |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
368 | GaimBuddy *buddy; |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
369 | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
370 | memcpy(&node, sd->data, sizeof(node)); |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
371 | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
372 | if (GAIM_BLIST_NODE_IS_CONTACT(node)) |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
373 | buddy = gaim_contact_get_priority_buddy((GaimContact *)node); |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
374 | else if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
375 | buddy = (GaimBuddy *)node; |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
376 | else |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
377 | return; |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
378 | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
379 | dialog = (GaimGtkPounceDialog *)data; |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
380 | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
381 | gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), buddy->name); |
|
9910
7b4465b92411
[gaim-migrate @ 10802]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
382 | dialog->account = buddy->account; |
|
7b4465b92411
[gaim-migrate @ 10802]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
383 | gaim_gtk_account_option_menu_set_selected(dialog->account_menu, buddy->account); |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
384 | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
385 | gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
386 | } |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
387 | else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
388 | { |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
389 | char *protocol = NULL; |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
390 | char *username = NULL; |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
391 | GaimAccount *account; |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
392 | |
|
11137
cf40226ddff7
[gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents:
10921
diff
changeset
|
393 | if (gaim_gtk_parse_x_im_contact((const char *)sd->data, FALSE, &account, |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
394 | &protocol, &username, NULL)) |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
395 | { |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
396 | if (account == NULL) |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
397 | { |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
398 | gaim_notify_error(NULL, NULL, |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
399 | _("You are not currently signed on with an account that " |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
400 | "can add that buddy."), NULL); |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
401 | } |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
402 | else |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
403 | { |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
404 | dialog = (GaimGtkPounceDialog *)data; |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
405 | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
406 | gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), username); |
|
9910
7b4465b92411
[gaim-migrate @ 10802]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
407 | dialog->account = account; |
|
7b4465b92411
[gaim-migrate @ 10802]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
408 | gaim_gtk_account_option_menu_set_selected(dialog->account_menu, account); |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
409 | } |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
410 | } |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
411 | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
412 | if (username != NULL) g_free(username); |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
413 | if (protocol != NULL) g_free(protocol); |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
414 | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
415 | gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
416 | } |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
417 | } |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
418 | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
419 | static const GtkTargetEntry dnd_targets[] = |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
420 | { |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
421 | {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 0}, |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
422 | {"application/x-im-contact", 0, 1} |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
423 | }; |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
424 | |
| 5032 | 425 | void |
| 12136 | 426 | gaim_gtk_pounce_editor_show(GaimAccount *account, const char *name, |
| 427 | GaimPounce *cur_pounce) | |
| 5032 | 428 | { |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
429 | GaimGtkPounceDialog *dialog; |
| 5032 | 430 | GtkWidget *window; |
| 431 | GtkWidget *label; | |
| 432 | GtkWidget *bbox; | |
| 433 | GtkWidget *vbox1, *vbox2; | |
| 434 | GtkWidget *hbox; | |
| 435 | GtkWidget *button; | |
| 436 | GtkWidget *frame; | |
| 437 | GtkWidget *table; | |
| 438 | GtkSizeGroup *sg; | |
| 5319 | 439 | GPtrArray *sound_widgets; |
| 440 | GPtrArray *exec_widgets; | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
441 | |
|
10352
802e7ab5b838
[gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents:
10250
diff
changeset
|
442 | g_return_if_fail((cur_pounce != NULL) || (account != NULL) || |
|
802e7ab5b838
[gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents:
10250
diff
changeset
|
443 | (gaim_connections_get_all() != NULL)); |
|
802e7ab5b838
[gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents:
10250
diff
changeset
|
444 | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
445 | dialog = g_new0(GaimGtkPounceDialog, 1); |
| 5032 | 446 | |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
447 | if (cur_pounce != NULL) |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
448 | { |
| 5032 | 449 | dialog->pounce = cur_pounce; |
| 450 | dialog->account = gaim_pounce_get_pouncer(cur_pounce); | |
| 451 | } | |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
452 | else if (account != NULL) |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
453 | { |
| 5032 | 454 | dialog->pounce = NULL; |
|
5907
b2812113a4a6
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
455 | dialog->account = account; |
| 5032 | 456 | } |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
457 | else |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
458 | { |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
459 | GaimConnection *gc; |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
460 | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
461 | gc = (GaimConnection *)gaim_connections_get_all()->data; |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
462 | |
| 5032 | 463 | dialog->pounce = NULL; |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
464 | dialog->account = gaim_connection_get_account(gc); |
| 5032 | 465 | } |
| 466 | ||
| 467 | sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
| 468 | ||
| 469 | /* Create the window. */ | |
| 470 | dialog->window = window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
| 471 | gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG); | |
| 472 | gtk_window_set_role(GTK_WINDOW(window), "buddy_pounce"); | |
| 473 | gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
| 474 | gtk_window_set_title(GTK_WINDOW(window), | |
| 475 | (cur_pounce == NULL | |
| 476 | ? _("New Buddy Pounce") : _("Edit Buddy Pounce"))); | |
| 477 | ||
| 11243 | 478 | gtk_container_set_border_width(GTK_CONTAINER(window), GAIM_HIG_BORDER); |
| 5032 | 479 | |
| 480 | g_signal_connect(G_OBJECT(window), "delete_event", | |
| 481 | G_CALLBACK(delete_win_cb), dialog); | |
| 482 | ||
| 483 | /* Create the parent vbox for everything. */ | |
| 11243 | 484 | vbox1 = gtk_vbox_new(FALSE, GAIM_HIG_BORDER); |
| 5032 | 485 | gtk_container_add(GTK_CONTAINER(window), vbox1); |
| 486 | gtk_widget_show(vbox1); | |
| 487 | ||
| 488 | /* Create the vbox that will contain all the prefs stuff. */ | |
| 11243 | 489 | vbox2 = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
| 5032 | 490 | gtk_box_pack_start(GTK_BOX(vbox1), vbox2, TRUE, TRUE, 0); |
| 491 | ||
| 492 | /* Create the "Pounce Who" frame. */ | |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
493 | frame = gaim_gtk_make_frame(vbox2, _("Pounce Who")); |
| 5032 | 494 | |
| 495 | /* Account: */ | |
| 11243 | 496 | hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
| 5032 | 497 | gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); |
| 498 | gtk_widget_show(hbox); | |
| 499 | ||
| 500 | label = gtk_label_new_with_mnemonic(_("_Account:")); | |
| 501 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 502 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 503 | gtk_widget_show(label); | |
| 504 | gtk_size_group_add_widget(sg, label); | |
| 505 | ||
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5876
diff
changeset
|
506 | dialog->account_menu = |
|
6646
b9a0b5eb74e6
[gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents:
6640
diff
changeset
|
507 | gaim_gtk_account_option_menu_new(dialog->account, FALSE, |
|
b9a0b5eb74e6
[gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents:
6640
diff
changeset
|
508 | G_CALLBACK(pounce_choose_cb), |
|
b9a0b5eb74e6
[gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents:
6640
diff
changeset
|
509 | NULL, dialog); |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5876
diff
changeset
|
510 | |
| 5032 | 511 | gtk_box_pack_start(GTK_BOX(hbox), dialog->account_menu, FALSE, FALSE, 0); |
| 512 | gtk_widget_show(dialog->account_menu); | |
| 8137 | 513 | gaim_set_accessible_label (dialog->account_menu, label); |
| 5032 | 514 | |
| 515 | /* Buddy: */ | |
| 11243 | 516 | hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
| 5032 | 517 | gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); |
| 518 | gtk_widget_show(hbox); | |
| 519 | ||
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
520 | label = gtk_label_new_with_mnemonic(_("_Buddy name:")); |
| 5032 | 521 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
| 522 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 523 | gtk_widget_show(label); | |
| 524 | gtk_size_group_add_widget(sg, label); | |
| 525 | ||
| 526 | dialog->buddy_entry = gtk_entry_new(); | |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
527 | |
| 5032 | 528 | gtk_box_pack_start(GTK_BOX(hbox), dialog->buddy_entry, TRUE, TRUE, 0); |
| 529 | gtk_widget_show(dialog->buddy_entry); | |
| 530 | ||
|
5876
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
531 | g_signal_connect(G_OBJECT(dialog->buddy_entry), "changed", |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
532 | G_CALLBACK(buddy_changed_cb), dialog); |
| 8137 | 533 | gaim_set_accessible_label (dialog->buddy_entry, label); |
|
5876
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
534 | |
| 5032 | 535 | if (cur_pounce != NULL) { |
| 536 | gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), | |
| 537 | gaim_pounce_get_pouncee(cur_pounce)); | |
| 538 | } | |
|
5907
b2812113a4a6
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
539 | else if (name != NULL) { |
|
b2812113a4a6
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
540 | gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), name); |
| 5032 | 541 | } |
| 542 | ||
| 543 | /* Create the "Pounce When" frame. */ | |
|
12141
9cd436b9b7f6
[gaim-migrate @ 14442]
Richard Laager <rlaager@pidgin.im>
parents:
12137
diff
changeset
|
544 | frame = gaim_gtk_make_frame(vbox2, _("Pounce When Buddy...")); |
| 5032 | 545 | |
| 546 | table = gtk_table_new(2, 4, FALSE); | |
| 547 | gtk_container_add(GTK_CONTAINER(frame), table); | |
| 11243 | 548 | gtk_table_set_col_spacings(GTK_TABLE(table), GAIM_HIG_BORDER); |
| 5032 | 549 | gtk_widget_show(table); |
| 550 | ||
| 551 | dialog->signon = | |
|
12141
9cd436b9b7f6
[gaim-migrate @ 14442]
Richard Laager <rlaager@pidgin.im>
parents:
12137
diff
changeset
|
552 | gtk_check_button_new_with_mnemonic(_("Si_gns on")); |
| 5032 | 553 | dialog->signoff = |
|
12142
45aba96df80d
[gaim-migrate @ 14443]
Richard Laager <rlaager@pidgin.im>
parents:
12141
diff
changeset
|
554 | gtk_check_button_new_with_mnemonic(_("Signs o_ff")); |
| 5032 | 555 | dialog->away = |
|
12141
9cd436b9b7f6
[gaim-migrate @ 14442]
Richard Laager <rlaager@pidgin.im>
parents:
12137
diff
changeset
|
556 | gtk_check_button_new_with_mnemonic(_("Goes a_way")); |
| 5032 | 557 | dialog->away_return = |
|
12144
a24ccdee060b
[gaim-migrate @ 14445]
Richard Laager <rlaager@pidgin.im>
parents:
12142
diff
changeset
|
558 | gtk_check_button_new_with_mnemonic(_("Ret_urns from away")); |
| 5032 | 559 | dialog->idle = |
|
12141
9cd436b9b7f6
[gaim-migrate @ 14442]
Richard Laager <rlaager@pidgin.im>
parents:
12137
diff
changeset
|
560 | gtk_check_button_new_with_mnemonic(_("Becomes _Idle")); |
| 5032 | 561 | dialog->idle_return = |
|
12141
9cd436b9b7f6
[gaim-migrate @ 14442]
Richard Laager <rlaager@pidgin.im>
parents:
12137
diff
changeset
|
562 | gtk_check_button_new_with_mnemonic(_("Is _no longer idle")); |
| 5032 | 563 | dialog->typing = |
|
12141
9cd436b9b7f6
[gaim-migrate @ 14442]
Richard Laager <rlaager@pidgin.im>
parents:
12137
diff
changeset
|
564 | gtk_check_button_new_with_mnemonic(_("Starts _typing")); |
| 5032 | 565 | dialog->stop_typing = |
|
12141
9cd436b9b7f6
[gaim-migrate @ 14442]
Richard Laager <rlaager@pidgin.im>
parents:
12137
diff
changeset
|
566 | gtk_check_button_new_with_mnemonic(_("Stops t_yping")); |
| 5032 | 567 | |
| 568 | gtk_table_attach(GTK_TABLE(table), dialog->signon, 0, 1, 0, 1, | |
| 569 | GTK_FILL, 0, 0, 0); | |
| 570 | gtk_table_attach(GTK_TABLE(table), dialog->signoff, 1, 2, 0, 1, | |
| 571 | GTK_FILL, 0, 0, 0); | |
| 572 | gtk_table_attach(GTK_TABLE(table), dialog->away, 0, 1, 1, 2, | |
| 573 | GTK_FILL, 0, 0, 0); | |
| 574 | gtk_table_attach(GTK_TABLE(table), dialog->away_return, 1, 2, 1, 2, | |
| 575 | GTK_FILL, 0, 0, 0); | |
| 576 | gtk_table_attach(GTK_TABLE(table), dialog->idle, 0, 1, 2, 3, | |
| 577 | GTK_FILL, 0, 0, 0); | |
| 578 | gtk_table_attach(GTK_TABLE(table), dialog->idle_return, 1, 2, 2, 3, | |
| 579 | GTK_FILL, 0, 0, 0); | |
| 580 | gtk_table_attach(GTK_TABLE(table), dialog->typing, 0, 1, 3, 4, | |
| 581 | GTK_FILL, 0, 0, 0); | |
| 5319 | 582 | gtk_table_attach(GTK_TABLE(table), dialog->stop_typing, 1, 2, 3, 5, |
| 5032 | 583 | GTK_FILL, 0, 0, 0); |
| 584 | ||
| 585 | gtk_widget_show(dialog->signon); | |
| 586 | gtk_widget_show(dialog->signoff); | |
| 587 | gtk_widget_show(dialog->away); | |
| 588 | gtk_widget_show(dialog->away_return); | |
| 589 | gtk_widget_show(dialog->idle); | |
| 590 | gtk_widget_show(dialog->idle_return); | |
| 591 | gtk_widget_show(dialog->typing); | |
| 592 | gtk_widget_show(dialog->stop_typing); | |
| 593 | ||
| 594 | /* Create the "Pounce Action" frame. */ | |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
595 | frame = gaim_gtk_make_frame(vbox2, _("Pounce Action")); |
| 5032 | 596 | |
| 5319 | 597 | table = gtk_table_new(3, 5, FALSE); |
| 5032 | 598 | gtk_container_add(GTK_CONTAINER(frame), table); |
| 11243 | 599 | gtk_table_set_col_spacings(GTK_TABLE(table), GAIM_HIG_BORDER); |
| 5032 | 600 | gtk_widget_show(table); |
| 601 | ||
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
602 | dialog->open_win |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
603 | = gtk_check_button_new_with_mnemonic(_("Op_en an IM window")); |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
604 | dialog->popup |
|
12141
9cd436b9b7f6
[gaim-migrate @ 14442]
Richard Laager <rlaager@pidgin.im>
parents:
12137
diff
changeset
|
605 | = gtk_check_button_new_with_mnemonic(_("_Pop up a notification")); |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
606 | dialog->send_msg |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
607 | = gtk_check_button_new_with_mnemonic(_("Send a _message")); |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
608 | dialog->exec_cmd |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
609 | = gtk_check_button_new_with_mnemonic(_("E_xecute a command")); |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
610 | dialog->play_sound |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
611 | = gtk_check_button_new_with_mnemonic(_("P_lay a sound")); |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
612 | |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
613 | dialog->send_msg_entry = gtk_entry_new(); |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
614 | dialog->exec_cmd_entry = gtk_entry_new(); |
|
12144
a24ccdee060b
[gaim-migrate @ 14445]
Richard Laager <rlaager@pidgin.im>
parents:
12142
diff
changeset
|
615 | dialog->exec_cmd_browse = gtk_button_new_with_mnemonic(_("B_rowse...")); |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
616 | dialog->play_sound_entry = gtk_entry_new(); |
|
12144
a24ccdee060b
[gaim-migrate @ 14445]
Richard Laager <rlaager@pidgin.im>
parents:
12142
diff
changeset
|
617 | dialog->play_sound_browse = gtk_button_new_with_mnemonic(_("Br_owse...")); |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
618 | dialog->play_sound_test = gtk_button_new_with_mnemonic(_("Pre_view")); |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
619 | |
| 5032 | 620 | gtk_widget_set_sensitive(dialog->send_msg_entry, FALSE); |
| 621 | gtk_widget_set_sensitive(dialog->exec_cmd_entry, FALSE); | |
| 5319 | 622 | gtk_widget_set_sensitive(dialog->exec_cmd_browse, FALSE); |
| 5032 | 623 | gtk_widget_set_sensitive(dialog->play_sound_entry, FALSE); |
| 5319 | 624 | gtk_widget_set_sensitive(dialog->play_sound_browse, FALSE); |
| 625 | gtk_widget_set_sensitive(dialog->play_sound_test, FALSE); | |
| 5032 | 626 | |
| 627 | gtk_table_attach(GTK_TABLE(table), dialog->open_win, 0, 1, 0, 1, | |
| 628 | GTK_FILL, 0, 0, 0); | |
| 629 | gtk_table_attach(GTK_TABLE(table), dialog->popup, 0, 1, 1, 2, | |
| 630 | GTK_FILL, 0, 0, 0); | |
| 631 | gtk_table_attach(GTK_TABLE(table), dialog->send_msg, 0, 1, 2, 3, | |
| 632 | GTK_FILL, 0, 0, 0); | |
| 5319 | 633 | gtk_table_attach(GTK_TABLE(table), dialog->send_msg_entry, 1, 4, 2, 3, |
| 5032 | 634 | GTK_FILL, 0, 0, 0); |
| 635 | gtk_table_attach(GTK_TABLE(table), dialog->exec_cmd, 0, 1, 3, 4, | |
| 636 | GTK_FILL, 0, 0, 0); | |
| 637 | gtk_table_attach(GTK_TABLE(table), dialog->exec_cmd_entry, 1, 2, 3, 4, | |
| 638 | GTK_FILL, 0, 0, 0); | |
| 5319 | 639 | gtk_table_attach(GTK_TABLE(table), dialog->exec_cmd_browse, 2, 3, 3, 4, |
| 640 | GTK_FILL | GTK_EXPAND, 0, 0, 0); | |
| 5032 | 641 | gtk_table_attach(GTK_TABLE(table), dialog->play_sound, 0, 1, 4, 5, |
| 642 | GTK_FILL, 0, 0, 0); | |
| 643 | gtk_table_attach(GTK_TABLE(table), dialog->play_sound_entry, 1, 2, 4, 5, | |
| 644 | GTK_FILL, 0, 0, 0); | |
| 5319 | 645 | gtk_table_attach(GTK_TABLE(table), dialog->play_sound_browse, 2, 3, 4, 5, |
| 646 | GTK_FILL | GTK_EXPAND, 0, 0, 0); | |
| 647 | gtk_table_attach(GTK_TABLE(table), dialog->play_sound_test, 3, 4, 4, 5, | |
| 648 | GTK_FILL | GTK_EXPAND, 0, 0, 0); | |
| 5032 | 649 | |
| 650 | gtk_widget_show(dialog->open_win); | |
| 651 | gtk_widget_show(dialog->popup); | |
| 652 | gtk_widget_show(dialog->send_msg); | |
| 653 | gtk_widget_show(dialog->send_msg_entry); | |
| 654 | gtk_widget_show(dialog->exec_cmd); | |
| 655 | gtk_widget_show(dialog->exec_cmd_entry); | |
| 5319 | 656 | gtk_widget_show(dialog->exec_cmd_browse); |
| 5032 | 657 | gtk_widget_show(dialog->play_sound); |
| 658 | gtk_widget_show(dialog->play_sound_entry); | |
| 5319 | 659 | gtk_widget_show(dialog->play_sound_browse); |
| 660 | gtk_widget_show(dialog->play_sound_test); | |
| 5032 | 661 | |
| 662 | g_signal_connect(G_OBJECT(dialog->send_msg), "clicked", | |
| 663 | G_CALLBACK(gaim_gtk_toggle_sensitive), | |
| 664 | dialog->send_msg_entry); | |
| 5319 | 665 | |
| 666 | exec_widgets = g_ptr_array_new(); | |
| 667 | g_ptr_array_add(exec_widgets,dialog->exec_cmd_entry); | |
| 668 | g_ptr_array_add(exec_widgets,dialog->exec_cmd_browse); | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
669 | |
| 5032 | 670 | g_signal_connect(G_OBJECT(dialog->exec_cmd), "clicked", |
| 10590 | 671 | G_CALLBACK(gaim_gtk_toggle_sensitive_array), |
| 5319 | 672 | exec_widgets); |
| 673 | g_signal_connect(G_OBJECT(dialog->exec_cmd_browse), "clicked", | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
674 | G_CALLBACK(filesel), |
| 5032 | 675 | dialog->exec_cmd_entry); |
| 5319 | 676 | |
| 677 | sound_widgets = g_ptr_array_new(); | |
| 678 | g_ptr_array_add(sound_widgets,dialog->play_sound_entry); | |
| 679 | g_ptr_array_add(sound_widgets,dialog->play_sound_browse); | |
| 680 | g_ptr_array_add(sound_widgets,dialog->play_sound_test); | |
| 681 | ||
| 5032 | 682 | g_signal_connect(G_OBJECT(dialog->play_sound), "clicked", |
| 10590 | 683 | G_CALLBACK(gaim_gtk_toggle_sensitive_array), |
| 5319 | 684 | sound_widgets); |
| 685 | g_signal_connect(G_OBJECT(dialog->play_sound_browse), "clicked", | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
686 | G_CALLBACK(filesel), |
| 5032 | 687 | dialog->play_sound_entry); |
| 5319 | 688 | g_signal_connect(G_OBJECT(dialog->play_sound_test), "clicked", |
| 689 | G_CALLBACK(pounce_test_sound), | |
| 690 | dialog->play_sound_entry); | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
691 | |
| 5032 | 692 | g_signal_connect(G_OBJECT(dialog->send_msg_entry), "activate", |
| 693 | G_CALLBACK(save_pounce_cb), dialog); | |
| 694 | g_signal_connect(G_OBJECT(dialog->exec_cmd_entry), "activate", | |
| 695 | G_CALLBACK(save_pounce_cb), dialog); | |
| 696 | g_signal_connect(G_OBJECT(dialog->play_sound_entry), "activate", | |
| 697 | G_CALLBACK(save_pounce_cb), dialog); | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
698 | |
| 5032 | 699 | /* Now the last part, where we have the Save checkbox */ |
| 700 | dialog->save_pounce = gtk_check_button_new_with_mnemonic( | |
|
12142
45aba96df80d
[gaim-migrate @ 14443]
Richard Laager <rlaager@pidgin.im>
parents:
12141
diff
changeset
|
701 | _("_Keep this pounce after the first time it runs")); |
| 5032 | 702 | |
| 703 | gtk_box_pack_start(GTK_BOX(vbox2), dialog->save_pounce, FALSE, FALSE, 0); | |
| 704 | ||
| 705 | /* Now the button box! */ | |
| 706 | bbox = gtk_hbutton_box_new(); | |
| 11243 | 707 | gtk_box_set_spacing(GTK_BOX(bbox), GAIM_HIG_BOX_SPACE); |
| 5032 | 708 | gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); |
| 709 | gtk_box_pack_end(GTK_BOX(vbox1), bbox, FALSE, FALSE, 0); | |
| 710 | gtk_widget_show(bbox); | |
| 711 | ||
|
5052
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
712 | /* Delete button */ |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
713 | button = gtk_button_new_from_stock(GTK_STOCK_DELETE); |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
714 | gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
| 10366 | 715 | if (cur_pounce == NULL) |
| 716 | gtk_widget_set_sensitive(button, FALSE); | |
|
5052
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
717 | gtk_widget_show(button); |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
718 | |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
719 | g_signal_connect(G_OBJECT(button), "clicked", |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
720 | G_CALLBACK(delete_cb), dialog); |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
721 | |
| 5032 | 722 | /* Cancel button */ |
| 723 | button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); | |
| 724 | gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
| 725 | gtk_widget_show(button); | |
| 726 | ||
| 727 | g_signal_connect(G_OBJECT(button), "clicked", | |
| 728 | G_CALLBACK(cancel_cb), dialog); | |
| 729 | ||
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
730 | /* Save button */ |
|
5876
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
731 | dialog->save_button = button = gtk_button_new_from_stock(GTK_STOCK_SAVE); |
| 5032 | 732 | gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
| 733 | gtk_widget_show(button); | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
734 | |
| 5032 | 735 | g_signal_connect(G_OBJECT(button), "clicked", |
| 736 | G_CALLBACK(save_pounce_cb), dialog); | |
| 737 | ||
|
5876
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
738 | if (*gtk_entry_get_text(GTK_ENTRY(dialog->buddy_entry)) == '\0') |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
739 | gtk_widget_set_sensitive(button, FALSE); |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
740 | |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
741 | /* Setup drag-and-drop */ |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
742 | gtk_drag_dest_set(window, |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
743 | GTK_DEST_DEFAULT_MOTION | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
744 | GTK_DEST_DEFAULT_DROP, |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
745 | dnd_targets, |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
746 | sizeof(dnd_targets) / sizeof(GtkTargetEntry), |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
747 | GDK_ACTION_COPY); |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
748 | gtk_drag_dest_set(dialog->buddy_entry, |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
749 | GTK_DEST_DEFAULT_MOTION | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
750 | GTK_DEST_DEFAULT_DROP, |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
751 | dnd_targets, |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
752 | sizeof(dnd_targets) / sizeof(GtkTargetEntry), |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
753 | GDK_ACTION_COPY); |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
754 | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
755 | g_signal_connect(G_OBJECT(window), "drag_data_received", |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
756 | G_CALLBACK(pounce_dnd_recv), dialog); |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
757 | g_signal_connect(G_OBJECT(dialog->buddy_entry), "drag_data_received", |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
758 | G_CALLBACK(pounce_dnd_recv), dialog); |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
759 | |
| 5032 | 760 | /* Set the values of stuff. */ |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
761 | if (cur_pounce != NULL) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
762 | { |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
763 | GaimPounceEvent events = gaim_pounce_get_events(cur_pounce); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
764 | const char *value; |
| 5032 | 765 | |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
766 | /* Events */ |
| 5032 | 767 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signon), |
| 768 | (events & GAIM_POUNCE_SIGNON)); | |
| 769 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signoff), | |
| 770 | (events & GAIM_POUNCE_SIGNOFF)); | |
| 771 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->away), | |
| 772 | (events & GAIM_POUNCE_AWAY)); | |
| 773 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->away_return), | |
| 774 | (events & GAIM_POUNCE_AWAY_RETURN)); | |
| 775 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->idle), | |
| 776 | (events & GAIM_POUNCE_IDLE)); | |
| 777 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->idle_return), | |
| 778 | (events & GAIM_POUNCE_IDLE_RETURN)); | |
| 779 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->typing), | |
| 780 | (events & GAIM_POUNCE_TYPING)); | |
| 781 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->stop_typing), | |
| 782 | (events & GAIM_POUNCE_TYPING_STOPPED)); | |
| 783 | ||
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
784 | /* Actions */ |
| 5032 | 785 | 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
|
786 | gaim_pounce_action_is_enabled(cur_pounce, "open-window")); |
| 5032 | 787 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->popup), |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
788 | gaim_pounce_action_is_enabled(cur_pounce, "popup-notify")); |
| 5032 | 789 | 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
|
790 | gaim_pounce_action_is_enabled(cur_pounce, "send-message")); |
| 5032 | 791 | 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
|
792 | gaim_pounce_action_is_enabled(cur_pounce, "execute-command")); |
| 5032 | 793 | 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
|
794 | gaim_pounce_action_is_enabled(cur_pounce, "play-sound")); |
| 5032 | 795 | |
| 796 | 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
|
797 | gaim_pounce_get_save(cur_pounce)); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
798 | |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
799 | if ((value = gaim_pounce_action_get_attribute(cur_pounce, |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
800 | "send-message", |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
801 | "message")) != NULL) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
802 | { |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
803 | gtk_entry_set_text(GTK_ENTRY(dialog->send_msg_entry), value); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
804 | } |
| 5032 | 805 | |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
806 | if ((value = gaim_pounce_action_get_attribute(cur_pounce, |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
807 | "execute-command", |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
808 | "command")) != NULL) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
809 | { |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
810 | gtk_entry_set_text(GTK_ENTRY(dialog->exec_cmd_entry), value); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
811 | } |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
812 | |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
813 | if ((value = gaim_pounce_action_get_attribute(cur_pounce, |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
814 | "play-sound", |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
815 | "filename")) != NULL) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
816 | { |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
817 | gtk_entry_set_text(GTK_ENTRY(dialog->play_sound_entry), value); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
818 | } |
| 5032 | 819 | } |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
820 | else |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
821 | { |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
822 | GaimBuddy *buddy = NULL; |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
823 | |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
824 | if (name != NULL) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
825 | buddy = gaim_find_buddy(account, name); |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
826 | |
| 5032 | 827 | /* Set some defaults */ |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
828 | if (buddy == NULL) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
829 | { |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
830 | gtk_toggle_button_set_active( |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
831 | GTK_TOGGLE_BUTTON(dialog->signon), TRUE); |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
832 | } |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
833 | else |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
834 | { |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
835 | if (!GAIM_BUDDY_IS_ONLINE(buddy)) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
836 | { |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
837 | gtk_toggle_button_set_active( |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
838 | GTK_TOGGLE_BUTTON(dialog->signon), TRUE); |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
839 | } |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
840 | else |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
841 | { |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
842 | gboolean default_set = FALSE; |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9910
diff
changeset
|
843 | GaimPresence *presence = gaim_buddy_get_presence(buddy); |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
844 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9910
diff
changeset
|
845 | if (gaim_presence_is_idle(presence)) |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
846 | { |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
847 | gtk_toggle_button_set_active( |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
848 | GTK_TOGGLE_BUTTON(dialog->idle_return), TRUE); |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
849 | |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
850 | default_set = TRUE; |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
851 | } |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
852 | |
|
9949
377cd65fab3d
[gaim-migrate @ 10845]
Daniel Atallah <datallah@pidgin.im>
parents:
9910
diff
changeset
|
853 | if (!gaim_presence_is_available(presence)) |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
854 | { |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
855 | gtk_toggle_button_set_active( |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
856 | GTK_TOGGLE_BUTTON(dialog->away_return), TRUE); |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
857 | |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
858 | default_set = TRUE; |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
859 | } |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
860 | |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
861 | if (!default_set) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
862 | { |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
863 | gtk_toggle_button_set_active( |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
864 | GTK_TOGGLE_BUTTON(dialog->signon), TRUE); |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
865 | } |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
866 | } |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
867 | } |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
868 | |
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
869 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->open_win), |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
870 | gaim_prefs_get_bool("/gaim/gtk/pounces/default_actions/open-window")); |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
871 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->popup), |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
872 | gaim_prefs_get_bool("/gaim/gtk/pounces/default_actions/popup-notify")); |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
873 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->send_msg), |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
874 | gaim_prefs_get_bool("/gaim/gtk/pounces/default_actions/send-message")); |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
875 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd), |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
876 | gaim_prefs_get_bool("/gaim/gtk/pounces/default_actions/execute-command")); |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
877 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->play_sound), |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
878 | gaim_prefs_get_bool("/gaim/gtk/pounces/default_actions/play-sound")); |
| 5032 | 879 | } |
| 880 | ||
| 881 | gtk_widget_show_all(vbox2); | |
| 882 | gtk_widget_show(window); | |
| 883 | } | |
| 884 | ||
| 12136 | 885 | static gboolean |
| 886 | pounces_manager_configure_cb(GtkWidget *widget, GdkEventConfigure *event, PouncesManager *dialog) | |
| 887 | { | |
| 888 | if (GTK_WIDGET_VISIBLE(widget)) { | |
| 889 | gaim_prefs_set_int("/gaim/gtk/pounces/dialog/width", event->width); | |
| 890 | gaim_prefs_set_int("/gaim/gtk/pounces/dialog/height", event->height); | |
| 891 | } | |
| 892 | ||
| 893 | return FALSE; | |
| 894 | } | |
| 895 | ||
| 896 | static gboolean | |
| 897 | pounces_manager_find_pounce(GtkTreeIter *iter, GaimPounce *pounce) | |
| 5032 | 898 | { |
| 12136 | 899 | GtkTreeModel *model = GTK_TREE_MODEL(pounces_manager->model); |
| 900 | GaimPounce *p; | |
| 901 | ||
| 902 | if (!gtk_tree_model_get_iter_first(model, iter)) | |
| 903 | return FALSE; | |
| 904 | ||
| 905 | gtk_tree_model_get(model, iter, POUNCES_MANAGER_COLUMN_POUNCE, &p, -1); | |
| 906 | if (pounce == p) | |
| 907 | return TRUE; | |
| 908 | ||
| 909 | while (gtk_tree_model_iter_next(model, iter)) | |
| 910 | { | |
| 911 | gtk_tree_model_get(model, iter, POUNCES_MANAGER_COLUMN_POUNCE, &p, -1); | |
| 912 | if (pounce == p) | |
| 913 | return TRUE; | |
| 914 | } | |
| 915 | ||
| 916 | return FALSE; | |
| 917 | } | |
| 918 | ||
| 919 | static gboolean | |
| 920 | pounces_manager_destroy_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data) | |
| 921 | { | |
| 922 | PouncesManager *dialog = user_data; | |
| 923 | ||
| 924 | dialog->window = NULL; | |
| 925 | gaim_gtk_pounces_manager_hide(); | |
| 926 | ||
| 927 | return FALSE; | |
| 928 | } | |
| 929 | ||
| 930 | #if !GTK_CHECK_VERSION(2,2,0) | |
| 931 | static void | |
| 932 | count_selected_helper(GtkTreeModel *model, GtkTreePath *path, | |
| 933 | GtkTreeIter *iter, gpointer user_data) | |
| 934 | { | |
| 935 | (*(gint *)user_data)++; | |
| 936 | } | |
| 937 | #endif | |
| 938 | ||
| 939 | static void | |
| 940 | pounces_manager_connection_cb(GaimConnection *gc, GtkWidget *add_button) | |
| 941 | { | |
| 942 | gtk_widget_set_sensitive(add_button, (gaim_connections_get_all() != NULL)); | |
| 5032 | 943 | } |
| 944 | ||
| 945 | static void | |
| 12136 | 946 | pounces_manager_add_cb(GtkButton *button, gpointer user_data) |
| 947 | { | |
| 948 | gaim_gtk_pounce_editor_show(NULL, NULL, NULL); | |
| 949 | } | |
| 950 | ||
| 951 | static void | |
| 952 | pounces_manager_modify_foreach(GtkTreeModel *model, GtkTreePath *path, | |
| 953 | GtkTreeIter *iter, gpointer user_data) | |
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
954 | { |
| 12136 | 955 | GaimPounce *pounce; |
| 956 | ||
| 957 | gtk_tree_model_get(model, iter, POUNCES_MANAGER_COLUMN_POUNCE, &pounce, -1); | |
| 958 | gaim_gtk_pounce_editor_show(NULL, NULL, pounce); | |
| 959 | } | |
| 960 | ||
| 961 | static void | |
| 962 | pounces_manager_modify_cb(GtkButton *button, gpointer user_data) | |
| 963 | { | |
| 964 | PouncesManager *dialog = user_data; | |
| 965 | GtkTreeSelection *selection; | |
| 966 | ||
| 967 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); | |
| 968 | ||
| 969 | gtk_tree_selection_selected_foreach(selection, pounces_manager_modify_foreach, user_data); | |
| 970 | } | |
| 971 | ||
| 972 | static void | |
| 973 | pounces_manager_delete_confirm_cb(GaimPounce *pounce) | |
| 974 | { | |
| 975 | GtkTreeIter iter; | |
| 976 | ||
| 977 | if (pounces_manager_find_pounce(&iter, pounce)) | |
| 978 | gtk_list_store_remove(pounces_manager->model, &iter); | |
| 979 | ||
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
980 | gaim_pounce_destroy(pounce); |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
981 | } |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
982 | |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
983 | static void |
| 12136 | 984 | pounces_manager_delete_foreach(GtkTreeModel *model, GtkTreePath *path, |
| 985 | GtkTreeIter *iter, gpointer user_data) | |
| 986 | { | |
| 987 | GaimPounce *pounce; | |
| 988 | GaimAccount *account; | |
| 989 | const char *pouncer, *pouncee; | |
| 990 | char *buf; | |
| 991 | ||
| 992 | gtk_tree_model_get(model, iter, POUNCES_MANAGER_COLUMN_POUNCE, &pounce, -1); | |
| 993 | account = gaim_pounce_get_pouncer(pounce); | |
| 994 | pouncer = gaim_account_get_username(account); | |
| 995 | pouncee = gaim_pounce_get_pouncee(pounce); | |
| 996 | ||
| 997 | buf = g_strdup_printf(_("Are you sure you want to delete the pounce on %s for %s?"), pouncee, pouncer); | |
| 998 | gaim_request_action(NULL, NULL, buf, NULL, 0, pounce, 2, | |
| 999 | _("Delete"), pounces_manager_delete_confirm_cb, | |
| 1000 | _("Cancel"), g_free); | |
| 1001 | g_free(buf); | |
| 1002 | } | |
| 1003 | ||
| 1004 | static void | |
| 1005 | pounces_manager_delete_cb(GtkButton *button, gpointer user_data) | |
| 1006 | { | |
| 1007 | PouncesManager *dialog = user_data; | |
| 1008 | GtkTreeSelection *selection; | |
| 1009 | ||
| 1010 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); | |
| 1011 | ||
| 1012 | gtk_tree_selection_selected_foreach(selection, pounces_manager_delete_foreach, user_data); | |
| 1013 | } | |
| 1014 | ||
| 1015 | static void | |
| 1016 | pounces_manager_close_cb(GtkButton *button, gpointer user_data) | |
| 5032 | 1017 | { |
| 12136 | 1018 | gaim_gtk_pounces_manager_hide(); |
| 1019 | } | |
| 1020 | ||
| 1021 | static void | |
| 1022 | pounce_selected_cb(GtkTreeSelection *sel, gpointer user_data) | |
| 1023 | { | |
| 1024 | PouncesManager *dialog = user_data; | |
| 1025 | int num_selected = 0; | |
| 1026 | ||
| 1027 | #if GTK_CHECK_VERSION(2,2,0) | |
| 1028 | num_selected = gtk_tree_selection_count_selected_rows(sel); | |
| 1029 | #else | |
| 1030 | gtk_tree_selection_selected_foreach(sel, count_selected_helper, &num_selected); | |
| 1031 | #endif | |
| 1032 | ||
| 1033 | gtk_widget_set_sensitive(dialog->modify_button, (num_selected > 0)); | |
| 1034 | gtk_widget_set_sensitive(dialog->delete_button, (num_selected > 0)); | |
| 1035 | } | |
| 1036 | ||
|
12137
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1037 | static gboolean |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1038 | pounce_double_click_cb(GtkTreeView *treeview, GdkEventButton *event, gpointer user_data) |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1039 | { |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1040 | PouncesManager *dialog = user_data; |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1041 | GtkTreePath *path; |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1042 | GtkTreeIter iter; |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1043 | GaimPounce *pounce; |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1044 | |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1045 | /* Figure out which node was clicked */ |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1046 | if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(dialog->treeview), event->x, event->y, &path, NULL, NULL, NULL)) |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1047 | return FALSE; |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1048 | gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, path); |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1049 | gtk_tree_path_free(path); |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1050 | gtk_tree_model_get(GTK_TREE_MODEL(dialog->model), &iter, POUNCES_MANAGER_COLUMN_POUNCE, &pounce, -1); |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1051 | |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1052 | if ((pounce != NULL) && (event->button == 1) && |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1053 | (event->type == GDK_2BUTTON_PRESS)) |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1054 | { |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1055 | gaim_gtk_pounce_editor_show(NULL, NULL, pounce); |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1056 | return TRUE; |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1057 | } |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1058 | |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1059 | return FALSE; |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1060 | } |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1061 | |
| 12136 | 1062 | static void |
| 1063 | pounces_manager_persists_cb(GtkCellRendererToggle *renderer, gchar *path_str, | |
| 1064 | gpointer user_data) | |
| 1065 | { | |
| 1066 | PouncesManager *dialog = user_data; | |
| 1067 | GaimPounce *pounce; | |
| 1068 | gboolean persists; | |
| 1069 | GtkTreeModel *model = GTK_TREE_MODEL(dialog->model); | |
| 1070 | GtkTreeIter iter; | |
| 1071 | ||
| 1072 | gtk_tree_model_get_iter_from_string(model, &iter, path_str); | |
| 1073 | gtk_tree_model_get(model, &iter, | |
| 1074 | POUNCES_MANAGER_COLUMN_POUNCE, &pounce, | |
| 1075 | POUNCES_MANAGER_COLUMN_PERSISTENCE, &persists, | |
| 1076 | -1); | |
| 1077 | ||
| 1078 | gaim_pounce_set_save(pounce, !persists); | |
| 1079 | ||
| 1080 | update_pounces(); | |
| 5032 | 1081 | } |
| 1082 | ||
|
8259
7ed91862683d
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
1083 | static gboolean |
| 12136 | 1084 | search_func(GtkTreeModel *model, gint column, const gchar *key, GtkTreeIter *iter, gpointer search_data) |
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1085 | { |
| 12136 | 1086 | gboolean result; |
| 1087 | char *haystack; | |
| 1088 | ||
| 1089 | gtk_tree_model_get(model, iter, column, &haystack, -1); | |
| 1090 | ||
| 1091 | result = (gaim_strcasestr(haystack, key) == NULL); | |
| 1092 | ||
| 1093 | g_free(haystack); | |
| 1094 | ||
| 1095 | return result; | |
| 1096 | } | |
| 1097 | ||
| 1098 | static GtkWidget * | |
| 1099 | create_pounces_list(PouncesManager *dialog) | |
| 1100 | { | |
| 1101 | GtkWidget *sw; | |
| 1102 | GtkWidget *treeview; | |
| 1103 | GtkTreeSelection *sel; | |
| 1104 | GtkTreeViewColumn *column; | |
| 1105 | GtkCellRenderer *renderer; | |
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1106 | |
| 12136 | 1107 | /* Create the scrolled window */ |
| 1108 | sw = gtk_scrolled_window_new(0, 0); | |
| 1109 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
| 1110 | GTK_POLICY_AUTOMATIC, | |
| 1111 | GTK_POLICY_ALWAYS); | |
| 1112 | gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), | |
| 1113 | GTK_SHADOW_IN); | |
| 1114 | gtk_widget_show(sw); | |
|
8259
7ed91862683d
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
1115 | |
| 12136 | 1116 | /* Create the list model */ |
| 1117 | dialog->model = gtk_list_store_new(POUNCES_MANAGER_NUM_COLUMNS, | |
| 1118 | G_TYPE_POINTER, | |
| 1119 | GDK_TYPE_PIXBUF, | |
| 1120 | G_TYPE_STRING, | |
| 1121 | G_TYPE_STRING, | |
| 1122 | G_TYPE_BOOLEAN | |
| 1123 | ); | |
|
10250
9a0f00083ec1
[gaim-migrate @ 11390]
Mark Doliner <markdoliner@pidgin.im>
parents:
10246
diff
changeset
|
1124 | |
| 12136 | 1125 | /* Create the treeview */ |
| 1126 | treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(dialog->model)); | |
| 1127 | dialog->treeview = treeview; | |
| 1128 | gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); | |
|
10250
9a0f00083ec1
[gaim-migrate @ 11390]
Mark Doliner <markdoliner@pidgin.im>
parents:
10246
diff
changeset
|
1129 | |
| 12136 | 1130 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); |
| 1131 | gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE); | |
| 1132 | g_signal_connect(G_OBJECT(sel), "changed", | |
| 1133 | G_CALLBACK(pounce_selected_cb), dialog); | |
| 1134 | ||
|
12137
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1135 | /* Handle double-clicking */ |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1136 | g_signal_connect(G_OBJECT(treeview), "button_press_event", |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1137 | G_CALLBACK(pounce_double_click_cb), dialog); |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1138 | |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1139 | |
| 12136 | 1140 | gtk_container_add(GTK_CONTAINER(sw), treeview); |
| 1141 | gtk_widget_show(treeview); | |
|
8259
7ed91862683d
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
1142 | |
| 12136 | 1143 | /* Pouncee Column */ |
| 1144 | column = gtk_tree_view_column_new(); | |
| 1145 | gtk_tree_view_column_set_title(column, _("Pounce Target")); | |
| 1146 | gtk_tree_view_column_set_resizable(column, TRUE); | |
| 1147 | gtk_tree_view_column_set_min_width(column, 200); | |
| 1148 | gtk_tree_view_column_set_sort_column_id(column, | |
| 1149 | POUNCES_MANAGER_COLUMN_TARGET); | |
| 1150 | gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); | |
| 5161 | 1151 | |
| 12136 | 1152 | /* Icon */ |
| 1153 | renderer = gtk_cell_renderer_pixbuf_new(); | |
| 1154 | gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
| 1155 | gtk_tree_view_column_add_attribute(column, renderer, "pixbuf", | |
| 1156 | POUNCES_MANAGER_COLUMN_ICON); | |
| 1157 | ||
| 1158 | /* Pouncee */ | |
| 1159 | renderer = gtk_cell_renderer_text_new(); | |
| 1160 | gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
| 1161 | gtk_tree_view_column_add_attribute(column, renderer, "text", | |
| 1162 | POUNCES_MANAGER_COLUMN_TARGET); | |
| 1163 | ||
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1164 | |
| 12136 | 1165 | /* Account Column */ |
| 1166 | column = gtk_tree_view_column_new(); | |
| 1167 | gtk_tree_view_column_set_title(column, _("Account")); | |
| 1168 | gtk_tree_view_column_set_resizable(column, TRUE); | |
| 1169 | gtk_tree_view_column_set_min_width(column, 200); | |
| 1170 | gtk_tree_view_column_set_sort_column_id(column, | |
| 1171 | POUNCES_MANAGER_COLUMN_ACCOUNT); | |
| 1172 | gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); | |
| 1173 | renderer = gtk_cell_renderer_text_new(); | |
| 1174 | gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
| 1175 | gtk_tree_view_column_add_attribute(column, renderer, "text", | |
| 1176 | POUNCES_MANAGER_COLUMN_ACCOUNT); | |
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1177 | |
| 12136 | 1178 | /* Persistence Column */ |
| 1179 | renderer = gtk_cell_renderer_toggle_new(); | |
| 1180 | column = gtk_tree_view_column_new_with_attributes(_("Persists"), renderer, | |
| 1181 | "active", POUNCES_MANAGER_COLUMN_PERSISTENCE, NULL); | |
| 1182 | gtk_tree_view_column_set_sort_column_id(column, | |
| 1183 | POUNCES_MANAGER_COLUMN_PERSISTENCE); | |
| 1184 | gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); | |
| 1185 | g_signal_connect(G_OBJECT(renderer), "toggled", | |
| 1186 | G_CALLBACK(pounces_manager_persists_cb), dialog); | |
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1187 | |
| 12136 | 1188 | /* Enable CTRL+F searching */ |
| 1189 | gtk_tree_view_set_search_column(GTK_TREE_VIEW(treeview), POUNCES_MANAGER_COLUMN_TARGET); | |
| 1190 | gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(treeview), search_func, NULL, NULL); | |
|
8259
7ed91862683d
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
1191 | |
| 12136 | 1192 | /* Sort the pouncee column by default */ |
| 1193 | gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(dialog->model), | |
| 1194 | POUNCES_MANAGER_COLUMN_TARGET, | |
| 1195 | GTK_SORT_ASCENDING); | |
| 1196 | ||
| 1197 | /* Populate list */ | |
| 1198 | populate_pounces_list(dialog); | |
| 1199 | ||
| 1200 | return sw; | |
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1201 | } |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1202 | |
| 5032 | 1203 | void |
| 12136 | 1204 | gaim_gtk_pounces_manager_show(void) |
| 5032 | 1205 | { |
| 12136 | 1206 | PouncesManager *dialog; |
| 1207 | GtkWidget *bbox; | |
| 1208 | GtkWidget *button; | |
| 1209 | GtkWidget *list; | |
| 1210 | GtkWidget *vbox; | |
| 1211 | GtkWidget *win; | |
| 1212 | int width, height; | |
| 5032 | 1213 | |
| 12136 | 1214 | if (pounces_manager != NULL) { |
| 1215 | gtk_window_present(GTK_WINDOW(pounces_manager->window)); | |
| 1216 | return; | |
| 5032 | 1217 | } |
| 8252 | 1218 | |
| 12136 | 1219 | pounces_manager = dialog = g_new0(PouncesManager, 1); |
| 1220 | ||
| 1221 | width = gaim_prefs_get_int("/gaim/gtk/pounces/dialog/width"); | |
| 1222 | height = gaim_prefs_get_int("/gaim/gtk/pounces/dialog/height"); | |
| 1223 | ||
| 1224 | dialog->window = win = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
| 1225 | gtk_window_set_default_size(GTK_WINDOW(win), width, height); | |
| 1226 | gtk_window_set_role(GTK_WINDOW(win), "pounces"); | |
| 1227 | gtk_window_set_title(GTK_WINDOW(win), _("Buddy Pounces")); | |
| 1228 | gtk_container_set_border_width(GTK_CONTAINER(win), GAIM_HIG_BORDER); | |
| 1229 | ||
| 1230 | g_signal_connect(G_OBJECT(win), "delete_event", | |
| 1231 | G_CALLBACK(pounces_manager_destroy_cb), dialog); | |
| 1232 | g_signal_connect(G_OBJECT(win), "configure_event", | |
| 1233 | G_CALLBACK(pounces_manager_configure_cb), dialog); | |
| 1234 | ||
| 1235 | /* Setup the vbox */ | |
| 1236 | vbox = gtk_vbox_new(FALSE, GAIM_HIG_BORDER); | |
| 1237 | gtk_container_add(GTK_CONTAINER(win), vbox); | |
| 1238 | gtk_widget_show(vbox); | |
| 5032 | 1239 | |
| 12136 | 1240 | /* List of saved buddy pounces */ |
| 1241 | list = create_pounces_list(dialog); | |
| 1242 | gtk_box_pack_start(GTK_BOX(vbox), list, TRUE, TRUE, 0); | |
| 1243 | ||
| 1244 | /* Button box. */ | |
| 1245 | bbox = gtk_hbutton_box_new(); | |
| 1246 | gtk_box_set_spacing(GTK_BOX(bbox), GAIM_HIG_BOX_SPACE); | |
| 1247 | gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
| 1248 | gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, TRUE, 0); | |
| 1249 | gtk_widget_show(bbox); | |
| 5032 | 1250 | |
| 12136 | 1251 | /* Add button */ |
| 1252 | button = gtk_button_new_from_stock(GTK_STOCK_ADD); | |
| 1253 | gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
| 1254 | gtk_widget_set_sensitive(button, (gaim_connections_get_all() != NULL)); | |
| 1255 | gaim_signal_connect(gaim_connections_get_handle(), "signed-on", | |
| 1256 | pounces_manager, GAIM_CALLBACK(pounces_manager_connection_cb), button); | |
| 1257 | gaim_signal_connect(gaim_connections_get_handle(), "signed-off", | |
| 1258 | pounces_manager, GAIM_CALLBACK(pounces_manager_connection_cb), button); | |
| 1259 | gtk_widget_show(button); | |
| 1260 | ||
| 1261 | g_signal_connect(G_OBJECT(button), "clicked", | |
| 1262 | G_CALLBACK(pounces_manager_add_cb), dialog); | |
| 5032 | 1263 | |
| 12136 | 1264 | /* Modify button */ |
| 1265 | button = gtk_button_new_from_stock(GAIM_STOCK_MODIFY); | |
| 1266 | dialog->modify_button = button; | |
| 1267 | gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
| 1268 | gtk_widget_set_sensitive(button, FALSE); | |
| 1269 | gtk_widget_show(button); | |
| 1270 | ||
| 1271 | g_signal_connect(G_OBJECT(button), "clicked", | |
| 1272 | G_CALLBACK(pounces_manager_modify_cb), dialog); | |
|
8259
7ed91862683d
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
1273 | |
| 12136 | 1274 | /* Delete button */ |
| 1275 | button = gtk_button_new_from_stock(GTK_STOCK_DELETE); | |
| 1276 | dialog->delete_button = button; | |
| 1277 | gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
| 1278 | gtk_widget_set_sensitive(button, FALSE); | |
| 1279 | gtk_widget_show(button); | |
| 5032 | 1280 | |
| 12136 | 1281 | g_signal_connect(G_OBJECT(button), "clicked", |
| 1282 | G_CALLBACK(pounces_manager_delete_cb), dialog); | |
| 5032 | 1283 | |
| 12136 | 1284 | /* Close button */ |
| 1285 | button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
| 1286 | gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
| 1287 | gtk_widget_show(button); | |
| 1288 | ||
| 1289 | g_signal_connect(G_OBJECT(button), "clicked", | |
| 1290 | G_CALLBACK(pounces_manager_close_cb), dialog); | |
| 1291 | ||
| 1292 | gtk_widget_show(win); | |
| 1293 | } | |
| 1294 | ||
| 1295 | void | |
| 1296 | gaim_gtk_pounces_manager_hide(void) | |
| 1297 | { | |
| 1298 | if (pounces_manager == NULL) | |
| 1299 | return; | |
| 1300 | ||
| 1301 | if (pounces_manager->window != NULL) | |
| 1302 | gtk_widget_destroy(pounces_manager->window); | |
| 1303 | ||
| 1304 | gaim_signals_disconnect_by_handle(pounces_manager); | |
| 1305 | ||
| 1306 | g_free(pounces_manager); | |
| 1307 | pounces_manager = NULL; | |
| 5032 | 1308 | } |
| 1309 | ||
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1310 | static void |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1311 | pounce_cb(GaimPounce *pounce, GaimPounceEvent events, void *data) |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1312 | { |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1313 | GaimConversation *conv; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1314 | GaimAccount *account; |
|
7994
13b0203d6d52
[gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents:
7276
diff
changeset
|
1315 | GaimBuddy *buddy; |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1316 | const char *pouncee; |
|
7994
13b0203d6d52
[gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents:
7276
diff
changeset
|
1317 | const char *alias; |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1318 | |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1319 | pouncee = gaim_pounce_get_pouncee(pounce); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1320 | account = gaim_pounce_get_pouncer(pounce); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1321 | |
|
7994
13b0203d6d52
[gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents:
7276
diff
changeset
|
1322 | buddy = gaim_find_buddy(account, pouncee); |
|
13b0203d6d52
[gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents:
7276
diff
changeset
|
1323 | |
|
9620
fe99fcea5c1c
[gaim-migrate @ 10464]
Christopher O'Brien <siege@pidgin.im>
parents:
9606
diff
changeset
|
1324 | alias = gaim_buddy_get_alias(buddy); |
|
7994
13b0203d6d52
[gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents:
7276
diff
changeset
|
1325 | |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1326 | if (gaim_pounce_action_is_enabled(pounce, "open-window")) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1327 | { |
|
11338
1a3663ac9b05
[gaim-migrate @ 13551]
Mark Doliner <markdoliner@pidgin.im>
parents:
11243
diff
changeset
|
1328 | conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, pouncee, account); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1329 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1330 | if (conv == NULL) |
|
11338
1a3663ac9b05
[gaim-migrate @ 13551]
Mark Doliner <markdoliner@pidgin.im>
parents:
11243
diff
changeset
|
1331 | conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, pouncee); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1332 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1333 | |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1334 | if (gaim_pounce_action_is_enabled(pounce, "popup-notify")) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1335 | { |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1336 | char tmp[1024]; |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1337 | const char *name_shown; |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1338 | |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1339 | /* |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1340 | * Here we place the protocol name in the pounce dialog to lessen |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1341 | * confusion about what protocol a pounce is for. |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1342 | */ |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1343 | g_snprintf(tmp, sizeof(tmp), |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1344 | (events & GAIM_POUNCE_TYPING) ? |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1345 | _("%s has started typing to you (%s)") : |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1346 | (events & GAIM_POUNCE_SIGNON) ? |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1347 | _("%s has signed on (%s)") : |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1348 | (events & GAIM_POUNCE_IDLE_RETURN) ? |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1349 | _("%s has returned from being idle (%s)") : |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1350 | (events & GAIM_POUNCE_AWAY_RETURN) ? |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1351 | _("%s has returned from being away (%s)") : |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1352 | (events & GAIM_POUNCE_TYPING_STOPPED) ? |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1353 | _("%s has stopped typing to you (%s)") : |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1354 | (events & GAIM_POUNCE_SIGNOFF) ? |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1355 | _("%s has signed off (%s)") : |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1356 | (events & GAIM_POUNCE_IDLE) ? |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1357 | _("%s has become idle (%s)") : |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1358 | (events & GAIM_POUNCE_AWAY) ? |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1359 | _("%s has gone away. (%s)") : |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1360 | _("Unknown pounce event. Please report this!"), |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10590
diff
changeset
|
1361 | alias, gaim_account_get_protocol_name(account)); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1362 | |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1363 | /* |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1364 | * Ok here is where I change the second argument, title, from |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1365 | * NULL to the account name if that's all we have or the account |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1366 | * alias if we have that |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1367 | */ |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1368 | if ((name_shown = gaim_account_get_alias(account)) == NULL) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1369 | name_shown = gaim_account_get_username(account); |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1370 | |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1371 | gaim_notify_info(NULL, name_shown, tmp, gaim_date_full()); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1372 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1373 | |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1374 | if (gaim_pounce_action_is_enabled(pounce, "send-message")) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1375 | { |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1376 | const char *message; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1377 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1378 | message = gaim_pounce_action_get_attribute(pounce, "send-message", |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1379 | "message"); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1380 | |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1381 | if (message != NULL) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1382 | { |
|
11338
1a3663ac9b05
[gaim-migrate @ 13551]
Mark Doliner <markdoliner@pidgin.im>
parents:
11243
diff
changeset
|
1383 | conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, pouncee, account); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1384 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1385 | if (conv == NULL) |
|
11338
1a3663ac9b05
[gaim-migrate @ 13551]
Mark Doliner <markdoliner@pidgin.im>
parents:
11243
diff
changeset
|
1386 | conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, pouncee); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1387 | |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6695
diff
changeset
|
1388 | gaim_conversation_write(conv, NULL, message, |
|
6621
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6444
diff
changeset
|
1389 | GAIM_MESSAGE_SEND, time(NULL)); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1390 | |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6695
diff
changeset
|
1391 | serv_send_im(account->gc, (char *)pouncee, (char *)message, 0); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1392 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1393 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1394 | |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1395 | if (gaim_pounce_action_is_enabled(pounce, "execute-command")) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1396 | { |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1397 | const char *command; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1398 | |
|
10921
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1399 | command = gaim_pounce_action_get_attribute(pounce, |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1400 | "execute-command", "command"); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1401 | |
|
10921
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1402 | if (command != NULL) |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1403 | { |
| 6660 | 1404 | #ifndef _WIN32 |
|
10921
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1405 | char *localecmd = g_locale_from_utf8(command, -1, NULL, |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1406 | NULL, NULL); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1407 | |
|
10921
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1408 | if (localecmd != NULL) |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1409 | { |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1410 | int pid = fork(); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1411 | |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1412 | if (pid == 0) { |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1413 | char *args[4]; |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1414 | |
|
10921
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1415 | args[0] = "sh"; |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1416 | args[1] = "-c"; |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1417 | args[2] = (char *)localecmd; |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1418 | args[3] = NULL; |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1419 | |
|
10921
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1420 | execvp(args[0], args); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1421 | |
|
10921
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1422 | _exit(0); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1423 | } |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1424 | g_free(localecmd); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1425 | } |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1426 | #else /* !_WIN32 */ |
|
10921
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1427 | PROCESS_INFORMATION pi; |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1428 | BOOL retval; |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1429 | gchar *message = NULL; |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1430 | |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1431 | memset(&pi, 0, sizeof(pi)); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1432 | |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1433 | if (G_WIN32_HAVE_WIDECHAR_API ()) { |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1434 | STARTUPINFOW si; |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1435 | wchar_t *wc_cmd = g_utf8_to_utf16(command, |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1436 | -1, NULL, NULL, NULL); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1437 | |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1438 | memset(&si, 0 , sizeof(si)); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1439 | si.cb = sizeof(si); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1440 | |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1441 | retval = CreateProcessW(NULL, wc_cmd, NULL, |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1442 | NULL, 0, 0, NULL, NULL, |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1443 | &si, &pi); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1444 | g_free(wc_cmd); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1445 | } else { |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1446 | STARTUPINFOA si; |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1447 | char *l_cmd = g_locale_from_utf8(command, |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1448 | -1, NULL, NULL, NULL); |
| 6660 | 1449 | |
|
10921
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1450 | memset(&si, 0 , sizeof(si)); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1451 | si.cb = sizeof(si); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1452 | |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1453 | retval = CreateProcessA(NULL, l_cmd, NULL, |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1454 | NULL, 0, 0, NULL, NULL, |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1455 | &si, &pi); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1456 | g_free(l_cmd); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1457 | } |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1458 | |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1459 | if (retval) { |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1460 | CloseHandle(pi.hProcess); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1461 | CloseHandle(pi.hThread); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1462 | } else { |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1463 | message = g_win32_error_message(GetLastError()); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1464 | } |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1465 | |
|
7276
08382c6de2eb
[gaim-migrate @ 7855]
Christian Hammond <chipx86@chipx86.com>
parents:
7098
diff
changeset
|
1466 | gaim_debug_info("pounce", |
|
10921
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1467 | "Pounce execute command called for: " |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1468 | "%s\n%s%s%s", |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1469 | command, |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1470 | retval ? "" : "Error: ", |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1471 | retval ? "" : message, |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1472 | retval ? "" : "\n"); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1473 | g_free(message); |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1474 | #endif /* !_WIN32 */ |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1475 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1476 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1477 | |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1478 | if (gaim_pounce_action_is_enabled(pounce, "play-sound")) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1479 | { |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1480 | const char *sound; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1481 | |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1482 | sound = gaim_pounce_action_get_attribute(pounce, |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1483 | "play-sound", "filename"); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1484 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1485 | if (sound != NULL) |
|
11642
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11338
diff
changeset
|
1486 | gaim_sound_play_file(sound, account); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1487 | else |
|
11642
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11338
diff
changeset
|
1488 | gaim_sound_play_event(GAIM_SOUND_POUNCE_DEFAULT, account); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1489 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1490 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1491 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1492 | static void |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1493 | free_pounce(GaimPounce *pounce) |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1494 | { |
| 12136 | 1495 | update_pounces(); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1496 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1497 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1498 | static void |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1499 | new_pounce(GaimPounce *pounce) |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1500 | { |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1501 | gaim_pounce_action_register(pounce, "open-window"); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1502 | gaim_pounce_action_register(pounce, "popup-notify"); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1503 | gaim_pounce_action_register(pounce, "send-message"); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1504 | gaim_pounce_action_register(pounce, "execute-command"); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1505 | gaim_pounce_action_register(pounce, "play-sound"); |
| 12136 | 1506 | |
| 1507 | update_pounces(); | |
| 1508 | } | |
| 1509 | ||
| 1510 | void * | |
| 1511 | gaim_gtk_pounces_get_handle() { | |
| 1512 | static int handle; | |
| 1513 | ||
| 1514 | return &handle; | |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1515 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1516 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1517 | void |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1518 | gaim_gtk_pounces_init(void) |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1519 | { |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1520 | gaim_pounces_register_handler(GAIM_GTK_UI, pounce_cb, new_pounce, |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1521 | free_pounce); |
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
1522 | |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
1523 | gaim_prefs_add_none("/gaim/gtk/pounces"); |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
1524 | gaim_prefs_add_none("/gaim/gtk/pounces/default_actions"); |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
1525 | gaim_prefs_add_bool("/gaim/gtk/pounces/default_actions/open-window", |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
1526 | FALSE); |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
1527 | gaim_prefs_add_bool("/gaim/gtk/pounces/default_actions/popup-notify", |
|
12141
9cd436b9b7f6
[gaim-migrate @ 14442]
Richard Laager <rlaager@pidgin.im>
parents:
12137
diff
changeset
|
1528 | TRUE); |
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
1529 | gaim_prefs_add_bool("/gaim/gtk/pounces/default_actions/send-message", |
|
12141
9cd436b9b7f6
[gaim-migrate @ 14442]
Richard Laager <rlaager@pidgin.im>
parents:
12137
diff
changeset
|
1530 | FALSE); |
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
1531 | gaim_prefs_add_bool("/gaim/gtk/pounces/default_actions/execute-command", |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
1532 | FALSE); |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
1533 | gaim_prefs_add_bool("/gaim/gtk/pounces/default_actions/play-sound", |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
1534 | FALSE); |
| 12136 | 1535 | gaim_prefs_add_none("/gaim/gtk/pounces/dialog"); |
| 1536 | gaim_prefs_add_int("/gaim/gtk/pounces/dialog/width", 550); | |
| 1537 | gaim_prefs_add_int("/gaim/gtk/pounces/dialog/height", 250); | |
| 1538 | ||
| 1539 | gaim_signal_connect(gaim_connections_get_handle(), "signed-on", | |
| 1540 | gaim_gtk_pounces_get_handle(), | |
| 1541 | GAIM_CALLBACK(signed_on_off_cb), NULL); | |
| 1542 | gaim_signal_connect(gaim_connections_get_handle(), "signed-off", | |
| 1543 | gaim_gtk_pounces_get_handle(), | |
| 1544 | GAIM_CALLBACK(signed_on_off_cb), NULL); | |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1545 | } |