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