Sat, 08 Nov 2008 19:26:28 +0000
Add an ellipsis to the "Add" and "Modify" buttons in the accounts, pounces, and
saved statuses windows.
Fixes #6662
committer: Richard Laager <rlaager@pidgin.im>
| 5032 | 1 | /** |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
2 | * @file gtkpounce.c GTK+ Buddy Pounce API |
|
16254
eeb2bba4dc94
Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@pidgin.im>
parents:
16123
diff
changeset
|
3 | * @ingroup pidgin |
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
4 | */ |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
5 | |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
6 | /* pidgin |
| 5032 | 7 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
8 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 8046 | 9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 10 | * source distribution. | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
11 | * |
| 5032 | 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by | |
| 14 | * the Free Software Foundation; either version 2 of the License, or | |
| 15 | * (at your option) any later version. | |
| 16 | * | |
| 17 | * This program is distributed in the hope that it will be useful, | |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 20 | * GNU General Public License for more details. | |
| 21 | * | |
| 22 | * You should have received a copy of the GNU General Public License | |
| 23 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19786
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 5032 | 25 | * |
| 26 | */ | |
| 9791 | 27 | #include "internal.h" |
| 15577 | 28 | #include "pidgin.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
29 | |
| 8235 | 30 | #include "account.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
31 | #include "conversation.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
32 | #include "debug.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
33 | #include "notify.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
34 | #include "prpl.h" |
|
9505
6120a3cb8af7
[gaim-migrate @ 10332]
Mark Doliner <markdoliner@pidgin.im>
parents:
9206
diff
changeset
|
35 | #include "request.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
36 | #include "server.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
37 | #include "sound.h" |
|
9709
2e73f176cc80
[gaim-migrate @ 10570]
Mark Doliner <markdoliner@pidgin.im>
parents:
9699
diff
changeset
|
38 | #include "util.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
39 | |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
40 | #include "gtkblist.h" |
|
9709
2e73f176cc80
[gaim-migrate @ 10570]
Mark Doliner <markdoliner@pidgin.im>
parents:
9699
diff
changeset
|
41 | #include "gtkdialogs.h" |
|
17388
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
42 | #include "gtkimhtml.h" |
| 5032 | 43 | #include "gtkpounce.h" |
|
15883
969b74a3e27a
According to etags, pidgin/ should be completely clean of references to 'gaim' as a client
Sean Egan <seanegan@pidgin.im>
parents:
15882
diff
changeset
|
44 | #include "pidginstock.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
45 | #include "gtkutils.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
46 | |
| 12136 | 47 | /** |
| 48 | * These are used for the GtkTreeView when you're scrolling through | |
| 49 | * all your saved pounces. | |
| 50 | */ | |
| 51 | enum | |
| 52 | { | |
| 15884 | 53 | /* Hidden column containing the PurplePounce */ |
| 12136 | 54 | POUNCES_MANAGER_COLUMN_POUNCE, |
| 55 | POUNCES_MANAGER_COLUMN_ICON, | |
| 56 | POUNCES_MANAGER_COLUMN_TARGET, | |
| 57 | POUNCES_MANAGER_COLUMN_ACCOUNT, | |
|
12193
243b18a880ba
[gaim-migrate @ 14495]
Richard Laager <rlaager@pidgin.im>
parents:
12192
diff
changeset
|
58 | POUNCES_MANAGER_COLUMN_RECURRING, |
| 12136 | 59 | POUNCES_MANAGER_NUM_COLUMNS |
| 60 | }; | |
| 61 | ||
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
62 | typedef struct |
| 5032 | 63 | { |
| 64 | /* Pounce data */ | |
| 15884 | 65 | PurplePounce *pounce; |
| 66 | PurpleAccount *account; | |
| 5032 | 67 | |
| 68 | /* The window */ | |
| 69 | GtkWidget *window; | |
| 70 | ||
| 12694 | 71 | /* Pounce on Whom */ |
| 5032 | 72 | GtkWidget *account_menu; |
| 73 | GtkWidget *buddy_entry; | |
| 74 | ||
| 12694 | 75 | /* Pounce options */ |
| 76 | GtkWidget *on_away; | |
| 77 | ||
| 78 | /* Pounce When Buddy... */ | |
| 5032 | 79 | GtkWidget *signon; |
| 80 | GtkWidget *signoff; | |
| 81 | GtkWidget *away; | |
| 82 | GtkWidget *away_return; | |
| 83 | GtkWidget *idle; | |
| 84 | GtkWidget *idle_return; | |
| 85 | GtkWidget *typing; | |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
86 | GtkWidget *typed; |
| 5032 | 87 | GtkWidget *stop_typing; |
| 12694 | 88 | GtkWidget *message_recv; |
| 5032 | 89 | |
| 12694 | 90 | /* Action */ |
| 5032 | 91 | GtkWidget *open_win; |
| 92 | GtkWidget *popup; | |
| 12934 | 93 | GtkWidget *popup_entry; |
| 5032 | 94 | GtkWidget *send_msg; |
| 95 | GtkWidget *send_msg_entry; | |
| 96 | GtkWidget *exec_cmd; | |
| 97 | GtkWidget *exec_cmd_entry; | |
| 5319 | 98 | GtkWidget *exec_cmd_browse; |
| 5032 | 99 | GtkWidget *play_sound; |
| 100 | GtkWidget *play_sound_entry; | |
| 5319 | 101 | GtkWidget *play_sound_browse; |
| 102 | GtkWidget *play_sound_test; | |
|
23260
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
103 | GtkWidget *play_sound_reset; |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
104 | |
| 5032 | 105 | GtkWidget *save_pounce; |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
106 | |
|
5876
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
107 | /* Buttons */ |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
108 | GtkWidget *save_button; |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
109 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
110 | } PidginPounceDialog; |
| 5032 | 111 | |
| 12136 | 112 | typedef struct |
| 113 | { | |
| 114 | GtkWidget *window; | |
| 115 | GtkListStore *model; | |
| 116 | GtkWidget *treeview; | |
| 117 | GtkWidget *modify_button; | |
| 118 | GtkWidget *delete_button; | |
| 119 | } PouncesManager; | |
| 120 | ||
| 121 | static PouncesManager *pounces_manager = NULL; | |
| 122 | ||
| 5032 | 123 | /************************************************************************** |
| 124 | * Callbacks | |
| 125 | **************************************************************************/ | |
| 126 | static gint | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
127 | delete_win_cb(GtkWidget *w, GdkEventAny *e, PidginPounceDialog *dialog) |
| 5032 | 128 | { |
| 129 | gtk_widget_destroy(dialog->window); | |
| 130 | g_free(dialog); | |
| 131 | ||
| 132 | return TRUE; | |
| 133 | } | |
| 134 | ||
| 135 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
136 | cancel_cb(GtkWidget *w, PidginPounceDialog *dialog) |
| 5032 | 137 | { |
| 138 | delete_win_cb(NULL, NULL, dialog); | |
| 139 | } | |
| 140 | ||
| 5319 | 141 | static void |
|
9505
6120a3cb8af7
[gaim-migrate @ 10332]
Mark Doliner <markdoliner@pidgin.im>
parents:
9206
diff
changeset
|
142 | pounce_update_entry_fields(void *user_data, const char *filename) |
| 5319 | 143 | { |
|
9505
6120a3cb8af7
[gaim-migrate @ 10332]
Mark Doliner <markdoliner@pidgin.im>
parents:
9206
diff
changeset
|
144 | GtkWidget *entry = (GtkWidget *)user_data; |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
145 | |
|
9505
6120a3cb8af7
[gaim-migrate @ 10332]
Mark Doliner <markdoliner@pidgin.im>
parents:
9206
diff
changeset
|
146 | gtk_entry_set_text(GTK_ENTRY(entry), filename); |
| 5319 | 147 | } |
| 148 | ||
| 149 | static void | |
|
9505
6120a3cb8af7
[gaim-migrate @ 10332]
Mark Doliner <markdoliner@pidgin.im>
parents:
9206
diff
changeset
|
150 | filesel(GtkWidget *widget, gpointer data) |
| 5319 | 151 | { |
| 152 | GtkWidget *entry; | |
|
9505
6120a3cb8af7
[gaim-migrate @ 10332]
Mark Doliner <markdoliner@pidgin.im>
parents:
9206
diff
changeset
|
153 | const gchar *name; |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
154 | |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
155 | entry = (GtkWidget *)data; |
|
9505
6120a3cb8af7
[gaim-migrate @ 10332]
Mark Doliner <markdoliner@pidgin.im>
parents:
9206
diff
changeset
|
156 | name = gtk_entry_get_text(GTK_ENTRY(entry)); |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
157 | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
158 | purple_request_file(entry, _("Select a file"), name, FALSE, |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16254
diff
changeset
|
159 | G_CALLBACK(pounce_update_entry_fields), NULL, |
|
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16254
diff
changeset
|
160 | NULL, NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
161 | entry); |
|
15319
f8f83efdc3a6
[gaim-migrate @ 18047]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15315
diff
changeset
|
162 | g_signal_connect_swapped(G_OBJECT(entry), "destroy", |
| 15884 | 163 | G_CALLBACK(purple_request_close_with_handle), 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; | |
|
23260
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
170 | gboolean temp_mute; |
|
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
171 | |
|
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
172 | temp_mute = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/mute"); |
|
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
173 | |
|
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
174 | if (temp_mute) purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", FALSE); |
| 5319 | 175 | |
| 176 | filename = gtk_entry_get_text(GTK_ENTRY(entry)); | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
177 | |
|
23260
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
178 | if (filename != NULL && *filename != '\0' && strcmp(filename, _("(default)"))) |
| 15884 | 179 | purple_sound_play_file(filename, NULL); |
| 5319 | 180 | else |
| 15884 | 181 | purple_sound_play_event(PURPLE_SOUND_POUNCE_DEFAULT, NULL); |
|
23260
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
182 | |
|
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
183 | if (temp_mute) purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", TRUE); |
|
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
184 | } |
|
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
185 | |
|
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
186 | static void |
|
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
187 | pounce_reset_sound(GtkWidget *w, GtkWidget *entry) |
|
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
188 | { |
|
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
189 | gtk_entry_set_text(GTK_ENTRY(entry), _("(default)")); |
| 5319 | 190 | } |
| 5032 | 191 | |
| 192 | static void | |
| 15884 | 193 | add_pounce_to_treeview(GtkListStore *model, PurplePounce *pounce) |
| 12136 | 194 | { |
| 195 | GtkTreeIter iter; | |
| 15884 | 196 | PurpleAccount *account; |
| 197 | PurplePounceEvent events; | |
|
12193
243b18a880ba
[gaim-migrate @ 14495]
Richard Laager <rlaager@pidgin.im>
parents:
12192
diff
changeset
|
198 | gboolean recurring; |
| 12136 | 199 | const char *pouncer; |
| 200 | const char *pouncee; | |
|
13091
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
13033
diff
changeset
|
201 | GdkPixbuf *pixbuf; |
| 12136 | 202 | |
| 15884 | 203 | account = purple_pounce_get_pouncer(pounce); |
| 12136 | 204 | |
| 15884 | 205 | events = purple_pounce_get_events(pounce); |
| 12136 | 206 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
207 | pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_MEDIUM); |
| 12136 | 208 | |
| 15884 | 209 | pouncer = purple_account_get_username(account); |
| 210 | pouncee = purple_pounce_get_pouncee(pounce); | |
| 211 | recurring = purple_pounce_get_save(pounce); | |
| 12136 | 212 | |
| 213 | gtk_list_store_append(model, &iter); | |
| 214 | gtk_list_store_set(model, &iter, | |
| 215 | POUNCES_MANAGER_COLUMN_POUNCE, pounce, | |
|
13091
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
13033
diff
changeset
|
216 | POUNCES_MANAGER_COLUMN_ICON, pixbuf, |
| 12136 | 217 | POUNCES_MANAGER_COLUMN_TARGET, pouncee, |
| 218 | POUNCES_MANAGER_COLUMN_ACCOUNT, pouncer, | |
|
12193
243b18a880ba
[gaim-migrate @ 14495]
Richard Laager <rlaager@pidgin.im>
parents:
12192
diff
changeset
|
219 | POUNCES_MANAGER_COLUMN_RECURRING, recurring, |
| 12136 | 220 | -1); |
|
13091
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
13033
diff
changeset
|
221 | |
|
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
13033
diff
changeset
|
222 | if (pixbuf != NULL) |
|
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
13033
diff
changeset
|
223 | g_object_unref(pixbuf); |
| 12136 | 224 | } |
| 225 | ||
| 226 | static void | |
| 227 | populate_pounces_list(PouncesManager *dialog) | |
| 228 | { | |
|
18190
bcf28ef7e8ff
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents:
18186
diff
changeset
|
229 | GList *pounces; |
| 12136 | 230 | |
| 231 | gtk_list_store_clear(dialog->model); | |
| 232 | ||
|
18209
5f63822878eb
Fix #1574. (Pidgin and Finch show each other's pounces, interact in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18193
diff
changeset
|
233 | for (pounces = purple_pounces_get_all_for_ui(PIDGIN_UI); pounces != NULL; |
|
5f63822878eb
Fix #1574. (Pidgin and Finch show each other's pounces, interact in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18193
diff
changeset
|
234 | pounces = g_list_delete_link(pounces, pounces)) |
| 12136 | 235 | { |
| 236 | add_pounce_to_treeview(dialog->model, pounces->data); | |
| 237 | } | |
| 238 | } | |
| 239 | ||
| 240 | static void | |
| 241 | update_pounces(void) | |
| 242 | { | |
| 243 | /* Rebuild the pounces list if the pounces manager is open */ | |
| 244 | if (pounces_manager != NULL) | |
| 245 | { | |
| 246 | populate_pounces_list(pounces_manager); | |
| 247 | } | |
| 248 | } | |
| 249 | ||
| 250 | static void | |
| 15884 | 251 | signed_on_off_cb(PurpleConnection *gc, gpointer user_data) |
| 12136 | 252 | { |
| 253 | update_pounces(); | |
| 254 | } | |
| 255 | ||
| 256 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
257 | save_pounce_cb(GtkWidget *w, PidginPounceDialog *dialog) |
| 5032 | 258 | { |
| 259 | const char *name; | |
|
17388
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
260 | const char *command, *sound, *reason; |
|
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
261 | char *message; |
| 15884 | 262 | PurplePounceEvent events = PURPLE_POUNCE_NONE; |
| 263 | PurplePounceOption options = PURPLE_POUNCE_OPTION_NONE; | |
| 5032 | 264 | |
| 265 | name = gtk_entry_get_text(GTK_ENTRY(dialog->buddy_entry)); | |
| 266 | ||
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
267 | if (*name == '\0') |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
268 | { |
| 15884 | 269 | purple_notify_error(NULL, NULL, |
|
5436
a0e0bacaa196
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5319
diff
changeset
|
270 | _("Please enter a buddy to pounce."), NULL); |
| 5032 | 271 | return; |
| 272 | } | |
| 273 | ||
| 12694 | 274 | /* Options */ |
| 275 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->on_away))) | |
| 15884 | 276 | options |= PURPLE_POUNCE_OPTION_AWAY; |
| 12694 | 277 | |
| 5032 | 278 | /* Events */ |
| 279 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->signon))) | |
| 15884 | 280 | events |= PURPLE_POUNCE_SIGNON; |
| 5032 | 281 | |
| 282 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->signoff))) | |
| 15884 | 283 | events |= PURPLE_POUNCE_SIGNOFF; |
| 5032 | 284 | |
| 285 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->away))) | |
| 15884 | 286 | events |= PURPLE_POUNCE_AWAY; |
| 5032 | 287 | |
| 288 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->away_return))) | |
| 15884 | 289 | events |= PURPLE_POUNCE_AWAY_RETURN; |
| 5032 | 290 | |
| 291 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->idle))) | |
| 15884 | 292 | events |= PURPLE_POUNCE_IDLE; |
| 5032 | 293 | |
| 294 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->idle_return))) | |
| 15884 | 295 | events |= PURPLE_POUNCE_IDLE_RETURN; |
| 5032 | 296 | |
| 297 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->typing))) | |
| 15884 | 298 | events |= PURPLE_POUNCE_TYPING; |
| 5032 | 299 | |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
300 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->typed))) |
| 15884 | 301 | events |= PURPLE_POUNCE_TYPED; |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
302 | |
| 5032 | 303 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->stop_typing))) |
| 15884 | 304 | events |= PURPLE_POUNCE_TYPING_STOPPED; |
| 5032 | 305 | |
| 12694 | 306 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->message_recv))) |
| 15884 | 307 | events |= PURPLE_POUNCE_MESSAGE_RECEIVED; |
| 12694 | 308 | |
| 5032 | 309 | /* Data fields */ |
|
17388
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
310 | message = gtk_imhtml_get_markup(GTK_IMHTML(dialog->send_msg_entry)); |
| 5032 | 311 | command = gtk_entry_get_text(GTK_ENTRY(dialog->exec_cmd_entry)); |
| 312 | sound = gtk_entry_get_text(GTK_ENTRY(dialog->play_sound_entry)); | |
| 12934 | 313 | reason = gtk_entry_get_text(GTK_ENTRY(dialog->popup_entry)); |
| 5032 | 314 | |
| 12934 | 315 | if (*reason == '\0') reason = NULL; |
|
17388
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
316 | if (*message == '\0') { |
|
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
317 | g_free(message); |
|
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
318 | message = NULL; |
|
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
319 | } |
| 5032 | 320 | if (*command == '\0') command = NULL; |
|
23260
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
321 | if (*sound == '\0' || !strcmp(sound, _("(default)"))) sound = NULL; |
| 5032 | 322 | |
|
20168
5d2fb40e4cdf
If a pounce has been deleted or triggered while we're editing it, make a new one when saving instead of crashing. Fixes #3326
Daniel Atallah <datallah@pidgin.im>
parents:
20147
diff
changeset
|
323 | /* If the pounce has already been triggered, let's pretend it is a new one */ |
|
5d2fb40e4cdf
If a pounce has been deleted or triggered while we're editing it, make a new one when saving instead of crashing. Fixes #3326
Daniel Atallah <datallah@pidgin.im>
parents:
20147
diff
changeset
|
324 | if (dialog->pounce != NULL |
|
5d2fb40e4cdf
If a pounce has been deleted or triggered while we're editing it, make a new one when saving instead of crashing. Fixes #3326
Daniel Atallah <datallah@pidgin.im>
parents:
20147
diff
changeset
|
325 | && g_list_find(purple_pounces_get_all(), dialog->pounce) == NULL) { |
|
5d2fb40e4cdf
If a pounce has been deleted or triggered while we're editing it, make a new one when saving instead of crashing. Fixes #3326
Daniel Atallah <datallah@pidgin.im>
parents:
20147
diff
changeset
|
326 | purple_debug_info("gtkpounce", "Saving pounce that no longer exists; creating new pounce.\n"); |
|
5d2fb40e4cdf
If a pounce has been deleted or triggered while we're editing it, make a new one when saving instead of crashing. Fixes #3326
Daniel Atallah <datallah@pidgin.im>
parents:
20147
diff
changeset
|
327 | dialog->pounce = NULL; |
|
5d2fb40e4cdf
If a pounce has been deleted or triggered while we're editing it, make a new one when saving instead of crashing. Fixes #3326
Daniel Atallah <datallah@pidgin.im>
parents:
20147
diff
changeset
|
328 | } |
|
5d2fb40e4cdf
If a pounce has been deleted or triggered while we're editing it, make a new one when saving instead of crashing. Fixes #3326
Daniel Atallah <datallah@pidgin.im>
parents:
20147
diff
changeset
|
329 | |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
330 | if (dialog->pounce == NULL) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
331 | { |
| 15884 | 332 | dialog->pounce = purple_pounce_new(PIDGIN_UI, dialog->account, |
| 12694 | 333 | name, events, options); |
| 5032 | 334 | } |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
335 | else { |
| 15884 | 336 | purple_pounce_set_events(dialog->pounce, events); |
| 337 | purple_pounce_set_options(dialog->pounce, options); | |
| 338 | purple_pounce_set_pouncer(dialog->pounce, dialog->account); | |
| 339 | purple_pounce_set_pouncee(dialog->pounce, name); | |
| 5032 | 340 | } |
| 341 | ||
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
342 | /* Actions */ |
| 15884 | 343 | purple_pounce_action_set_enabled(dialog->pounce, "open-window", |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
344 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->open_win))); |
| 15884 | 345 | purple_pounce_action_set_enabled(dialog->pounce, "popup-notify", |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
346 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->popup))); |
| 15884 | 347 | purple_pounce_action_set_enabled(dialog->pounce, "send-message", |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
348 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->send_msg))); |
| 15884 | 349 | purple_pounce_action_set_enabled(dialog->pounce, "execute-command", |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
350 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd))); |
| 15884 | 351 | purple_pounce_action_set_enabled(dialog->pounce, "play-sound", |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
352 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->play_sound))); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
353 | |
| 15884 | 354 | purple_pounce_action_set_attribute(dialog->pounce, "send-message", |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
355 | "message", message); |
| 15884 | 356 | purple_pounce_action_set_attribute(dialog->pounce, "execute-command", |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
357 | "command", command); |
| 15884 | 358 | purple_pounce_action_set_attribute(dialog->pounce, "play-sound", |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
359 | "filename", sound); |
| 15884 | 360 | purple_pounce_action_set_attribute(dialog->pounce, "popup-notify", |
| 12934 | 361 | "reason", reason); |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
362 | |
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
363 | /* Set the defaults for next time. */ |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
364 | purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/open-window", |
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
365 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->open_win))); |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
366 | purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/popup-notify", |
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
367 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->popup))); |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
368 | purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/send-message", |
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
369 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->send_msg))); |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
370 | purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/execute-command", |
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
371 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd))); |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
372 | purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/play-sound", |
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
373 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->play_sound))); |
|
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
374 | |
| 15884 | 375 | purple_pounce_set_save(dialog->pounce, |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
376 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->save_pounce))); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
377 | |
| 12136 | 378 | update_pounces(); |
|
17388
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
379 | g_free(message); |
| 5032 | 380 | |
| 12136 | 381 | delete_win_cb(NULL, NULL, dialog); |
| 5032 | 382 | } |
| 383 | ||
| 5054 | 384 | static void |
| 15884 | 385 | pounce_choose_cb(GtkWidget *item, PurpleAccount *account, |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
386 | PidginPounceDialog *dialog) |
| 5032 | 387 | { |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5876
diff
changeset
|
388 | dialog->account = account; |
| 5032 | 389 | } |
| 390 | ||
|
5876
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
391 | static void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
392 | buddy_changed_cb(GtkEntry *entry, PidginPounceDialog *dialog) |
|
5876
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
393 | { |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
394 | if (dialog->save_button == NULL) |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
395 | return; |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
396 | |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
397 | gtk_widget_set_sensitive(dialog->save_button, |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
398 | *gtk_entry_get_text(entry) != '\0'); |
|
5876
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
399 | } |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
400 | |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
401 | static void |
| 12694 | 402 | message_recv_toggle(GtkButton *message_recv, GtkWidget *send_msg) |
| 403 | { | |
| 404 | gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(message_recv)); | |
| 405 | ||
| 406 | gtk_widget_set_sensitive(send_msg, !active); | |
| 407 | if (active) | |
| 408 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(send_msg), FALSE); | |
| 409 | } | |
| 410 | ||
| 411 | static void | |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
412 | pounce_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
413 | GtkSelectionData *sd, guint info, guint t, gpointer data) |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
414 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
415 | PidginPounceDialog *dialog; |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
416 | |
| 15884 | 417 | if (sd->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
418 | { |
| 15884 | 419 | PurpleBlistNode *node = NULL; |
| 420 | PurpleBuddy *buddy; | |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
421 | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
422 | memcpy(&node, sd->data, sizeof(node)); |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
423 | |
| 15884 | 424 | if (PURPLE_BLIST_NODE_IS_CONTACT(node)) |
| 425 | buddy = purple_contact_get_priority_buddy((PurpleContact *)node); | |
| 426 | else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) | |
| 427 | buddy = (PurpleBuddy *)node; | |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
428 | else |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
429 | return; |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
430 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
431 | dialog = (PidginPounceDialog *)data; |
|
8803
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), buddy->name); |
|
9910
7b4465b92411
[gaim-migrate @ 10802]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
434 | dialog->account = buddy->account; |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
435 | pidgin_account_option_menu_set_selected(dialog->account_menu, buddy->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 | gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
|
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 | 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
|
440 | { |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
441 | char *protocol = NULL; |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
442 | char *username = NULL; |
| 15884 | 443 | PurpleAccount *account; |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
444 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
445 | if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account, |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
446 | &protocol, &username, NULL)) |
|
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 | if (account == NULL) |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
449 | { |
| 15884 | 450 | purple_notify_error(NULL, NULL, |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
451 | _("You are not currently signed on with an account that " |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
452 | "can add that buddy."), NULL); |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
453 | } |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
454 | else |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
455 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
456 | dialog = (PidginPounceDialog *)data; |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
457 | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
458 | gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), username); |
|
9910
7b4465b92411
[gaim-migrate @ 10802]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
459 | dialog->account = account; |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
460 | pidgin_account_option_menu_set_selected(dialog->account_menu, account); |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
461 | } |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
462 | } |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
463 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
464 | g_free(username); |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
465 | g_free(protocol); |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
466 | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
467 | gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
468 | } |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
469 | } |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
470 | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
471 | static const GtkTargetEntry dnd_targets[] = |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
472 | { |
| 15884 | 473 | {"PURPLE_BLIST_NODE", GTK_TARGET_SAME_APP, 0}, |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
474 | {"application/x-im-contact", 0, 1} |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
475 | }; |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
476 | |
|
17388
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
477 | static void |
|
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
478 | reset_send_msg_entry(PidginPounceDialog *dialog, GtkWidget *dontcare) |
|
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
479 | { |
|
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
480 | PurpleAccount *account = pidgin_account_option_menu_get_selected(dialog->account_menu); |
|
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
481 | gtk_imhtml_setup_entry(GTK_IMHTML(dialog->send_msg_entry), |
|
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
482 | (account && account->gc) ? account->gc->flags : PURPLE_CONNECTION_HTML); |
|
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
483 | } |
|
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
484 | |
| 5032 | 485 | void |
| 20706 | 486 | pidgin_pounce_editor_show(PurpleAccount *account, const char *name, |
| 487 | PurplePounce *cur_pounce) | |
| 488 | { | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
489 | PidginPounceDialog *dialog; |
| 5032 | 490 | GtkWidget *window; |
| 491 | GtkWidget *label; | |
| 492 | GtkWidget *vbox1, *vbox2; | |
| 493 | GtkWidget *hbox; | |
| 494 | GtkWidget *button; | |
| 495 | GtkWidget *frame; | |
| 496 | GtkWidget *table; | |
| 497 | GtkSizeGroup *sg; | |
| 5319 | 498 | GPtrArray *sound_widgets; |
| 499 | GPtrArray *exec_widgets; | |
|
17388
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
500 | GtkWidget *send_msg_imhtml; |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
501 | |
|
15058
212b71a4faf6
[gaim-migrate @ 17775]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
502 | g_return_if_fail((cur_pounce != NULL) || |
|
212b71a4faf6
[gaim-migrate @ 17775]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
503 | (account != NULL) || |
| 15884 | 504 | (purple_accounts_get_all() != NULL)); |
|
10352
802e7ab5b838
[gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents:
10250
diff
changeset
|
505 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
506 | dialog = g_new0(PidginPounceDialog, 1); |
| 5032 | 507 | |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
508 | if (cur_pounce != NULL) |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
509 | { |
| 5032 | 510 | dialog->pounce = cur_pounce; |
| 15884 | 511 | dialog->account = purple_pounce_get_pouncer(cur_pounce); |
| 5032 | 512 | } |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
513 | else if (account != NULL) |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
514 | { |
| 5032 | 515 | dialog->pounce = NULL; |
|
5907
b2812113a4a6
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
516 | dialog->account = account; |
| 5032 | 517 | } |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
518 | else |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
519 | { |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
520 | GList *connections = purple_connections_get_all(); |
| 15884 | 521 | PurpleConnection *gc; |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
522 | |
|
15058
212b71a4faf6
[gaim-migrate @ 17775]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
523 | if (connections != NULL) |
|
212b71a4faf6
[gaim-migrate @ 17775]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
524 | { |
| 15884 | 525 | gc = (PurpleConnection *)connections->data; |
| 526 | dialog->account = purple_connection_get_account(gc); | |
|
15058
212b71a4faf6
[gaim-migrate @ 17775]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
527 | } |
|
212b71a4faf6
[gaim-migrate @ 17775]
Richard Laager <rlaager@pidgin.im>
parents:
14253
diff
changeset
|
528 | else |
| 15884 | 529 | dialog->account = purple_accounts_get_all()->data; |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
530 | |
| 5032 | 531 | dialog->pounce = NULL; |
| 532 | } | |
| 533 | ||
| 534 | sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
| 535 | ||
| 536 | /* Create the window. */ | |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
18966
diff
changeset
|
537 | dialog->window = window = gtk_dialog_new(); |
|
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
18966
diff
changeset
|
538 | gtk_window_set_title(GTK_WINDOW(window), (cur_pounce == NULL ? _("New Buddy Pounce") : _("Edit Buddy Pounce"))); |
|
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
18966
diff
changeset
|
539 | gtk_window_set_role(GTK_WINDOW(window), "buddy_pounce"); |
|
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
18966
diff
changeset
|
540 | gtk_container_set_border_width(GTK_CONTAINER(dialog->window), PIDGIN_HIG_BORDER); |
| 5032 | 541 | |
| 542 | g_signal_connect(G_OBJECT(window), "delete_event", | |
| 543 | G_CALLBACK(delete_win_cb), dialog); | |
| 544 | ||
| 545 | /* Create the parent vbox for everything. */ | |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
18966
diff
changeset
|
546 | vbox1 = GTK_DIALOG(window)->vbox; |
| 5032 | 547 | |
| 548 | /* Create the vbox that will contain all the prefs stuff. */ | |
| 15882 | 549 | vbox2 = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
| 5032 | 550 | gtk_box_pack_start(GTK_BOX(vbox1), vbox2, TRUE, TRUE, 0); |
| 551 | ||
| 12694 | 552 | /* Create the "Pounce on Whom" frame. */ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
553 | frame = pidgin_make_frame(vbox2, _("Pounce on Whom")); |
| 5032 | 554 | |
| 555 | /* Account: */ | |
| 15882 | 556 | hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
| 5032 | 557 | gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); |
| 558 | gtk_widget_show(hbox); | |
| 559 | ||
| 560 | label = gtk_label_new_with_mnemonic(_("_Account:")); | |
| 561 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 562 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 563 | gtk_widget_show(label); | |
| 564 | gtk_size_group_add_widget(sg, label); | |
| 565 | ||
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5876
diff
changeset
|
566 | dialog->account_menu = |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
567 | pidgin_account_option_menu_new(dialog->account, TRUE, |
|
6646
b9a0b5eb74e6
[gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents:
6640
diff
changeset
|
568 | G_CALLBACK(pounce_choose_cb), |
|
b9a0b5eb74e6
[gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents:
6640
diff
changeset
|
569 | NULL, dialog); |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5876
diff
changeset
|
570 | |
| 5032 | 571 | gtk_box_pack_start(GTK_BOX(hbox), dialog->account_menu, FALSE, FALSE, 0); |
| 572 | gtk_widget_show(dialog->account_menu); | |
| 15568 | 573 | pidgin_set_accessible_label (dialog->account_menu, label); |
| 5032 | 574 | |
| 575 | /* Buddy: */ | |
| 15882 | 576 | hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
| 5032 | 577 | gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); |
| 578 | gtk_widget_show(hbox); | |
| 579 | ||
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
580 | label = gtk_label_new_with_mnemonic(_("_Buddy name:")); |
| 5032 | 581 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
| 582 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 583 | gtk_widget_show(label); | |
| 584 | gtk_size_group_add_widget(sg, label); | |
| 585 | ||
| 586 | dialog->buddy_entry = gtk_entry_new(); | |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
587 | |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18209
diff
changeset
|
588 | pidgin_setup_screenname_autocomplete_with_filter(dialog->buddy_entry, dialog->account_menu, pidgin_screenname_autocomplete_default_filter, GINT_TO_POINTER(FALSE)); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13228
diff
changeset
|
589 | |
| 5032 | 590 | gtk_box_pack_start(GTK_BOX(hbox), dialog->buddy_entry, TRUE, TRUE, 0); |
| 591 | gtk_widget_show(dialog->buddy_entry); | |
| 592 | ||
|
5876
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
593 | g_signal_connect(G_OBJECT(dialog->buddy_entry), "changed", |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
594 | G_CALLBACK(buddy_changed_cb), dialog); |
| 15568 | 595 | pidgin_set_accessible_label (dialog->buddy_entry, label); |
|
5876
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
596 | |
| 5032 | 597 | if (cur_pounce != NULL) { |
| 598 | gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), | |
| 15884 | 599 | purple_pounce_get_pouncee(cur_pounce)); |
| 5032 | 600 | } |
|
5907
b2812113a4a6
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
601 | else if (name != NULL) { |
|
b2812113a4a6
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
602 | gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), name); |
| 5032 | 603 | } |
| 604 | ||
| 12694 | 605 | /* Create the "Pounce When Buddy..." frame. */ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
606 | frame = pidgin_make_frame(vbox2, _("Pounce When Buddy...")); |
| 5032 | 607 | |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
608 | table = gtk_table_new(5, 2, FALSE); |
| 5032 | 609 | gtk_container_add(GTK_CONTAINER(frame), table); |
| 15882 | 610 | gtk_table_set_col_spacings(GTK_TABLE(table), PIDGIN_HIG_BORDER); |
| 5032 | 611 | gtk_widget_show(table); |
| 612 | ||
| 613 | dialog->signon = | |
|
12141
9cd436b9b7f6
[gaim-migrate @ 14442]
Richard Laager <rlaager@pidgin.im>
parents:
12137
diff
changeset
|
614 | gtk_check_button_new_with_mnemonic(_("Si_gns on")); |
| 5032 | 615 | dialog->signoff = |
|
12142
45aba96df80d
[gaim-migrate @ 14443]
Richard Laager <rlaager@pidgin.im>
parents:
12141
diff
changeset
|
616 | gtk_check_button_new_with_mnemonic(_("Signs o_ff")); |
| 5032 | 617 | dialog->away = |
|
12141
9cd436b9b7f6
[gaim-migrate @ 14442]
Richard Laager <rlaager@pidgin.im>
parents:
12137
diff
changeset
|
618 | gtk_check_button_new_with_mnemonic(_("Goes a_way")); |
| 5032 | 619 | dialog->away_return = |
|
12144
a24ccdee060b
[gaim-migrate @ 14445]
Richard Laager <rlaager@pidgin.im>
parents:
12142
diff
changeset
|
620 | gtk_check_button_new_with_mnemonic(_("Ret_urns from away")); |
| 5032 | 621 | dialog->idle = |
|
12192
36b7b33aa956
[gaim-migrate @ 14494]
Richard Laager <rlaager@pidgin.im>
parents:
12186
diff
changeset
|
622 | gtk_check_button_new_with_mnemonic(_("Becomes _idle")); |
| 5032 | 623 | dialog->idle_return = |
|
12192
36b7b33aa956
[gaim-migrate @ 14494]
Richard Laager <rlaager@pidgin.im>
parents:
12186
diff
changeset
|
624 | gtk_check_button_new_with_mnemonic(_("Is no longer i_dle")); |
| 5032 | 625 | dialog->typing = |
|
12141
9cd436b9b7f6
[gaim-migrate @ 14442]
Richard Laager <rlaager@pidgin.im>
parents:
12137
diff
changeset
|
626 | gtk_check_button_new_with_mnemonic(_("Starts _typing")); |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
627 | dialog->typed = |
|
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
628 | gtk_check_button_new_with_mnemonic(_("P_auses while typing")); |
| 5032 | 629 | dialog->stop_typing = |
|
12141
9cd436b9b7f6
[gaim-migrate @ 14442]
Richard Laager <rlaager@pidgin.im>
parents:
12137
diff
changeset
|
630 | gtk_check_button_new_with_mnemonic(_("Stops t_yping")); |
| 12694 | 631 | dialog->message_recv = |
| 632 | gtk_check_button_new_with_mnemonic(_("Sends a _message")); | |
| 5032 | 633 | |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
634 | gtk_table_attach(GTK_TABLE(table), dialog->message_recv, 0, 1, 0, 1, |
| 5032 | 635 | GTK_FILL, 0, 0, 0); |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
636 | gtk_table_attach(GTK_TABLE(table), dialog->signon, 0, 1, 1, 2, |
| 5032 | 637 | GTK_FILL, 0, 0, 0); |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
638 | gtk_table_attach(GTK_TABLE(table), dialog->signoff, 0, 1, 2, 3, |
| 5032 | 639 | GTK_FILL, 0, 0, 0); |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
640 | gtk_table_attach(GTK_TABLE(table), dialog->away, 0, 1, 3, 4, |
|
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
641 | GTK_FILL, 0, 0, 0); |
|
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
642 | gtk_table_attach(GTK_TABLE(table), dialog->away_return, 0, 1, 4, 5, |
| 5032 | 643 | GTK_FILL, 0, 0, 0); |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
644 | gtk_table_attach(GTK_TABLE(table), dialog->idle, 1, 2, 0, 1, |
| 12694 | 645 | GTK_FILL, 0, 0, 0); |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
646 | gtk_table_attach(GTK_TABLE(table), dialog->idle_return, 1, 2, 1, 2, |
| 5032 | 647 | GTK_FILL, 0, 0, 0); |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
648 | gtk_table_attach(GTK_TABLE(table), dialog->typing, 1, 2, 2, 3, |
| 5032 | 649 | GTK_FILL, 0, 0, 0); |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
650 | gtk_table_attach(GTK_TABLE(table), dialog->typed, 1, 2, 3, 4, |
| 5032 | 651 | GTK_FILL, 0, 0, 0); |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
652 | gtk_table_attach(GTK_TABLE(table), dialog->stop_typing, 1, 2, 4, 5, |
| 5032 | 653 | GTK_FILL, 0, 0, 0); |
| 654 | ||
| 655 | gtk_widget_show(dialog->signon); | |
| 656 | gtk_widget_show(dialog->signoff); | |
| 657 | gtk_widget_show(dialog->away); | |
| 658 | gtk_widget_show(dialog->away_return); | |
| 659 | gtk_widget_show(dialog->idle); | |
| 660 | gtk_widget_show(dialog->idle_return); | |
| 661 | gtk_widget_show(dialog->typing); | |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
662 | gtk_widget_show(dialog->typed); |
| 5032 | 663 | gtk_widget_show(dialog->stop_typing); |
| 12694 | 664 | gtk_widget_show(dialog->message_recv); |
| 5032 | 665 | |
| 12694 | 666 | /* Create the "Action" frame. */ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
667 | frame = pidgin_make_frame(vbox2, _("Action")); |
| 5032 | 668 | |
|
23260
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
669 | table = gtk_table_new(3, 6, FALSE); |
| 5032 | 670 | gtk_container_add(GTK_CONTAINER(frame), table); |
| 15882 | 671 | gtk_table_set_col_spacings(GTK_TABLE(table), PIDGIN_HIG_BORDER); |
| 5032 | 672 | gtk_widget_show(table); |
| 673 | ||
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
674 | dialog->open_win |
|
12192
36b7b33aa956
[gaim-migrate @ 14494]
Richard Laager <rlaager@pidgin.im>
parents:
12186
diff
changeset
|
675 | = 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
|
676 | dialog->popup |
|
12141
9cd436b9b7f6
[gaim-migrate @ 14442]
Richard Laager <rlaager@pidgin.im>
parents:
12137
diff
changeset
|
677 | = gtk_check_button_new_with_mnemonic(_("_Pop up a notification")); |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
678 | dialog->send_msg |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
679 | = gtk_check_button_new_with_mnemonic(_("Send a _message")); |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
680 | dialog->exec_cmd |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
681 | = gtk_check_button_new_with_mnemonic(_("E_xecute a command")); |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
682 | dialog->play_sound |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
683 | = gtk_check_button_new_with_mnemonic(_("P_lay a sound")); |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
684 | |
|
17388
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
685 | send_msg_imhtml = pidgin_create_imhtml(TRUE, &dialog->send_msg_entry, NULL, NULL); |
|
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
686 | reset_send_msg_entry(dialog, NULL); |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
687 | dialog->exec_cmd_entry = gtk_entry_new(); |
| 12934 | 688 | dialog->popup_entry = gtk_entry_new(); |
|
12192
36b7b33aa956
[gaim-migrate @ 14494]
Richard Laager <rlaager@pidgin.im>
parents:
12186
diff
changeset
|
689 | 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
|
690 | dialog->play_sound_entry = gtk_entry_new(); |
|
23260
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
691 | gtk_entry_set_text(GTK_ENTRY(dialog->play_sound_entry), _("(default)")); |
|
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
692 | gtk_editable_set_editable(GTK_EDITABLE(dialog->play_sound_entry), FALSE); |
|
12144
a24ccdee060b
[gaim-migrate @ 14445]
Richard Laager <rlaager@pidgin.im>
parents:
12142
diff
changeset
|
693 | 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
|
694 | dialog->play_sound_test = gtk_button_new_with_mnemonic(_("Pre_view")); |
|
23260
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
695 | dialog->play_sound_reset = gtk_button_new_with_mnemonic(_("Reset")); |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
696 | |
|
17388
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
697 | gtk_widget_set_sensitive(send_msg_imhtml, FALSE); |
| 12694 | 698 | gtk_widget_set_sensitive(dialog->exec_cmd_entry, FALSE); |
| 12934 | 699 | gtk_widget_set_sensitive(dialog->popup_entry, FALSE); |
| 12694 | 700 | gtk_widget_set_sensitive(dialog->exec_cmd_browse, FALSE); |
| 701 | gtk_widget_set_sensitive(dialog->play_sound_entry, FALSE); | |
| 702 | gtk_widget_set_sensitive(dialog->play_sound_browse, FALSE); | |
| 703 | gtk_widget_set_sensitive(dialog->play_sound_test, FALSE); | |
|
23260
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
704 | gtk_widget_set_sensitive(dialog->play_sound_reset, FALSE); |
| 12694 | 705 | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20168
diff
changeset
|
706 | g_object_unref(sg); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20168
diff
changeset
|
707 | |
| 12694 | 708 | sg = gtk_size_group_new(GTK_SIZE_GROUP_VERTICAL); |
| 709 | gtk_size_group_add_widget(sg, dialog->open_win); | |
| 710 | gtk_size_group_add_widget(sg, dialog->popup); | |
| 12934 | 711 | gtk_size_group_add_widget(sg, dialog->popup_entry); |
| 12694 | 712 | gtk_size_group_add_widget(sg, dialog->exec_cmd); |
| 713 | gtk_size_group_add_widget(sg, dialog->exec_cmd_entry); | |
| 714 | gtk_size_group_add_widget(sg, dialog->exec_cmd_browse); | |
| 715 | gtk_size_group_add_widget(sg, dialog->play_sound); | |
| 716 | gtk_size_group_add_widget(sg, dialog->play_sound_entry); | |
| 717 | gtk_size_group_add_widget(sg, dialog->play_sound_browse); | |
| 718 | gtk_size_group_add_widget(sg, dialog->play_sound_test); | |
|
23260
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
719 | gtk_size_group_add_widget(sg, dialog->play_sound_reset); |
| 5032 | 720 | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20168
diff
changeset
|
721 | g_object_unref(sg); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20168
diff
changeset
|
722 | sg = NULL; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20168
diff
changeset
|
723 | |
| 5032 | 724 | gtk_table_attach(GTK_TABLE(table), dialog->open_win, 0, 1, 0, 1, |
| 725 | GTK_FILL, 0, 0, 0); | |
| 726 | gtk_table_attach(GTK_TABLE(table), dialog->popup, 0, 1, 1, 2, | |
| 727 | GTK_FILL, 0, 0, 0); | |
|
23260
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
728 | gtk_table_attach(GTK_TABLE(table), dialog->popup_entry, 1, 5, 1, 2, |
| 12934 | 729 | GTK_FILL, 0, 0, 0); |
|
23260
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
730 | gtk_table_attach(GTK_TABLE(table), dialog->send_msg, 0, 5, 2, 3, |
| 5032 | 731 | GTK_FILL, 0, 0, 0); |
|
23260
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
732 | gtk_table_attach(GTK_TABLE(table), send_msg_imhtml, 0, 5, 3, 4, |
| 5032 | 733 | GTK_FILL, 0, 0, 0); |
|
17388
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
734 | gtk_table_attach(GTK_TABLE(table), dialog->exec_cmd, 0, 1, 4, 5, |
| 5032 | 735 | GTK_FILL, 0, 0, 0); |
|
17388
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
736 | gtk_table_attach(GTK_TABLE(table), dialog->exec_cmd_entry, 1, 2, 4, 5, |
| 5032 | 737 | GTK_FILL, 0, 0, 0); |
|
17388
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
738 | gtk_table_attach(GTK_TABLE(table), dialog->exec_cmd_browse, 2, 3, 4, 5, |
| 5319 | 739 | GTK_FILL | GTK_EXPAND, 0, 0, 0); |
|
17388
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
740 | gtk_table_attach(GTK_TABLE(table), dialog->play_sound, 0, 1, 5, 6, |
| 5032 | 741 | GTK_FILL, 0, 0, 0); |
|
17388
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
742 | gtk_table_attach(GTK_TABLE(table), dialog->play_sound_entry, 1, 2, 5, 6, |
| 5032 | 743 | GTK_FILL, 0, 0, 0); |
|
17388
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
744 | gtk_table_attach(GTK_TABLE(table), dialog->play_sound_browse,2, 3, 5, 6, |
| 5319 | 745 | GTK_FILL | GTK_EXPAND, 0, 0, 0); |
|
17388
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
746 | gtk_table_attach(GTK_TABLE(table), dialog->play_sound_test, 3, 4, 5, 6, |
| 5319 | 747 | GTK_FILL | GTK_EXPAND, 0, 0, 0); |
|
23260
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
748 | gtk_table_attach(GTK_TABLE(table), dialog->play_sound_reset, 4, 5, 5, 6, |
|
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
749 | GTK_FILL | GTK_EXPAND, 0, 0, 0); |
| 5032 | 750 | |
| 15882 | 751 | gtk_table_set_row_spacings(GTK_TABLE(table), PIDGIN_HIG_BOX_SPACE / 2); |
| 12694 | 752 | |
| 5032 | 753 | gtk_widget_show(dialog->open_win); |
| 754 | gtk_widget_show(dialog->popup); | |
| 12934 | 755 | gtk_widget_show(dialog->popup_entry); |
| 5032 | 756 | gtk_widget_show(dialog->send_msg); |
|
17388
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
757 | gtk_widget_show(send_msg_imhtml); |
| 5032 | 758 | gtk_widget_show(dialog->exec_cmd); |
| 759 | gtk_widget_show(dialog->exec_cmd_entry); | |
| 5319 | 760 | gtk_widget_show(dialog->exec_cmd_browse); |
| 5032 | 761 | gtk_widget_show(dialog->play_sound); |
| 762 | gtk_widget_show(dialog->play_sound_entry); | |
| 5319 | 763 | gtk_widget_show(dialog->play_sound_browse); |
| 764 | gtk_widget_show(dialog->play_sound_test); | |
|
23260
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
765 | gtk_widget_show(dialog->play_sound_reset); |
| 5032 | 766 | |
| 12694 | 767 | g_signal_connect(G_OBJECT(dialog->message_recv), "clicked", |
| 768 | G_CALLBACK(message_recv_toggle), | |
| 769 | dialog->send_msg); | |
| 770 | ||
| 5032 | 771 | g_signal_connect(G_OBJECT(dialog->send_msg), "clicked", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
772 | G_CALLBACK(pidgin_toggle_sensitive), |
|
17388
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
773 | send_msg_imhtml); |
| 5319 | 774 | |
| 12934 | 775 | g_signal_connect(G_OBJECT(dialog->popup), "clicked", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
776 | G_CALLBACK(pidgin_toggle_sensitive), |
| 12934 | 777 | dialog->popup_entry); |
| 778 | ||
| 5319 | 779 | exec_widgets = g_ptr_array_new(); |
| 780 | g_ptr_array_add(exec_widgets,dialog->exec_cmd_entry); | |
| 781 | g_ptr_array_add(exec_widgets,dialog->exec_cmd_browse); | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
782 | |
| 5032 | 783 | g_signal_connect(G_OBJECT(dialog->exec_cmd), "clicked", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
784 | G_CALLBACK(pidgin_toggle_sensitive_array), |
| 5319 | 785 | exec_widgets); |
| 786 | g_signal_connect(G_OBJECT(dialog->exec_cmd_browse), "clicked", | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
787 | G_CALLBACK(filesel), |
| 5032 | 788 | dialog->exec_cmd_entry); |
|
15315
048e3e051d67
[gaim-migrate @ 18043]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15058
diff
changeset
|
789 | g_object_set_data_full(G_OBJECT(dialog->window), "exec-widgets", |
|
048e3e051d67
[gaim-migrate @ 18043]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15058
diff
changeset
|
790 | exec_widgets, (GDestroyNotify)g_ptr_array_free); |
| 5319 | 791 | |
| 792 | sound_widgets = g_ptr_array_new(); | |
| 793 | g_ptr_array_add(sound_widgets,dialog->play_sound_entry); | |
| 794 | g_ptr_array_add(sound_widgets,dialog->play_sound_browse); | |
| 795 | g_ptr_array_add(sound_widgets,dialog->play_sound_test); | |
|
23260
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
796 | g_ptr_array_add(sound_widgets,dialog->play_sound_reset); |
| 5319 | 797 | |
| 5032 | 798 | g_signal_connect(G_OBJECT(dialog->play_sound), "clicked", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
799 | G_CALLBACK(pidgin_toggle_sensitive_array), |
| 5319 | 800 | sound_widgets); |
| 801 | g_signal_connect(G_OBJECT(dialog->play_sound_browse), "clicked", | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
802 | G_CALLBACK(filesel), |
| 5032 | 803 | dialog->play_sound_entry); |
| 5319 | 804 | g_signal_connect(G_OBJECT(dialog->play_sound_test), "clicked", |
| 805 | G_CALLBACK(pounce_test_sound), | |
| 806 | dialog->play_sound_entry); | |
|
23260
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
807 | g_signal_connect(G_OBJECT(dialog->play_sound_reset), "clicked", |
|
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
808 | G_CALLBACK(pounce_reset_sound), |
|
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
809 | dialog->play_sound_entry); |
|
15315
048e3e051d67
[gaim-migrate @ 18043]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15058
diff
changeset
|
810 | g_object_set_data_full(G_OBJECT(dialog->window), "sound-widgets", |
|
048e3e051d67
[gaim-migrate @ 18043]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15058
diff
changeset
|
811 | sound_widgets, (GDestroyNotify)g_ptr_array_free); |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
812 | |
|
17388
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
813 | g_signal_connect_swapped(G_OBJECT(dialog->send_msg_entry), "format_function_clear", |
|
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
814 | G_CALLBACK(reset_send_msg_entry), dialog); |
|
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
815 | g_signal_connect_swapped(G_OBJECT(dialog->account_menu), "changed", |
|
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
816 | G_CALLBACK(reset_send_msg_entry), dialog); |
|
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
817 | |
|
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
818 | g_signal_connect(G_OBJECT(dialog->send_msg_entry), "message_send", |
| 5032 | 819 | G_CALLBACK(save_pounce_cb), dialog); |
| 12934 | 820 | g_signal_connect(G_OBJECT(dialog->popup_entry), "activate", |
| 821 | G_CALLBACK(save_pounce_cb), dialog); | |
| 5032 | 822 | g_signal_connect(G_OBJECT(dialog->exec_cmd_entry), "activate", |
| 823 | G_CALLBACK(save_pounce_cb), dialog); | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
824 | |
| 12694 | 825 | /* Create the "Options" frame. */ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
826 | frame = pidgin_make_frame(vbox2, _("Options")); |
| 12694 | 827 | |
| 828 | table = gtk_table_new(2, 1, FALSE); | |
| 829 | gtk_container_add(GTK_CONTAINER(frame), table); | |
| 15882 | 830 | gtk_table_set_col_spacings(GTK_TABLE(table), PIDGIN_HIG_BORDER); |
| 12694 | 831 | gtk_widget_show(table); |
| 832 | ||
| 833 | dialog->on_away = | |
|
17655
64f25df341e4
Hopefully make what this checkbox does a little more clear by changing
Etan Reisner <deryni@pidgin.im>
parents:
16490
diff
changeset
|
834 | gtk_check_button_new_with_mnemonic(_("P_ounce only when my status is not Available")); |
| 12694 | 835 | gtk_table_attach(GTK_TABLE(table), dialog->on_away, 0, 1, 0, 1, |
| 836 | GTK_FILL, 0, 0, 0); | |
| 837 | ||
| 5032 | 838 | dialog->save_pounce = gtk_check_button_new_with_mnemonic( |
|
12186
fddd08d58f3b
[gaim-migrate @ 14488]
Mark Doliner <markdoliner@pidgin.im>
parents:
12144
diff
changeset
|
839 | _("_Recurring")); |
| 12694 | 840 | gtk_table_attach(GTK_TABLE(table), dialog->save_pounce, 0, 1, 1, 2, |
| 841 | GTK_FILL, 0, 0, 0); | |
| 5032 | 842 | |
| 12694 | 843 | gtk_widget_show(dialog->on_away); |
| 844 | gtk_widget_show(dialog->save_pounce); | |
| 5032 | 845 | |
| 846 | /* Cancel button */ | |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
18966
diff
changeset
|
847 | button = gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); |
| 5032 | 848 | g_signal_connect(G_OBJECT(button), "clicked", |
| 849 | G_CALLBACK(cancel_cb), dialog); | |
| 850 | ||
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
851 | /* Save button */ |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
18966
diff
changeset
|
852 | dialog->save_button = button = gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_SAVE, GTK_RESPONSE_OK); |
| 5032 | 853 | g_signal_connect(G_OBJECT(button), "clicked", |
| 854 | G_CALLBACK(save_pounce_cb), dialog); | |
| 855 | ||
|
5876
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
856 | if (*gtk_entry_get_text(GTK_ENTRY(dialog->buddy_entry)) == '\0') |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
857 | gtk_widget_set_sensitive(button, FALSE); |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
858 | |
|
8803
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
859 | /* Setup drag-and-drop */ |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
860 | gtk_drag_dest_set(window, |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
861 | GTK_DEST_DEFAULT_MOTION | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
862 | GTK_DEST_DEFAULT_DROP, |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
863 | dnd_targets, |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
864 | sizeof(dnd_targets) / sizeof(GtkTargetEntry), |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
865 | GDK_ACTION_COPY); |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
866 | gtk_drag_dest_set(dialog->buddy_entry, |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
867 | GTK_DEST_DEFAULT_MOTION | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
868 | GTK_DEST_DEFAULT_DROP, |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
869 | dnd_targets, |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
870 | sizeof(dnd_targets) / sizeof(GtkTargetEntry), |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
871 | GDK_ACTION_COPY); |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
872 | |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
873 | g_signal_connect(G_OBJECT(window), "drag_data_received", |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
874 | G_CALLBACK(pounce_dnd_recv), dialog); |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
875 | g_signal_connect(G_OBJECT(dialog->buddy_entry), "drag_data_received", |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
876 | G_CALLBACK(pounce_dnd_recv), dialog); |
|
79bc4ecbcac7
[gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents:
8259
diff
changeset
|
877 | |
| 5032 | 878 | /* Set the values of stuff. */ |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
879 | if (cur_pounce != NULL) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
880 | { |
| 15884 | 881 | PurplePounceEvent events = purple_pounce_get_events(cur_pounce); |
| 882 | PurplePounceOption options = purple_pounce_get_options(cur_pounce); | |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
883 | const char *value; |
| 5032 | 884 | |
| 12694 | 885 | /* Options */ |
| 886 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->on_away), | |
| 15884 | 887 | (options & PURPLE_POUNCE_OPTION_AWAY)); |
| 12694 | 888 | |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
889 | /* Events */ |
| 5032 | 890 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signon), |
| 15884 | 891 | (events & PURPLE_POUNCE_SIGNON)); |
| 5032 | 892 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signoff), |
| 15884 | 893 | (events & PURPLE_POUNCE_SIGNOFF)); |
| 5032 | 894 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->away), |
| 15884 | 895 | (events & PURPLE_POUNCE_AWAY)); |
| 5032 | 896 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->away_return), |
| 15884 | 897 | (events & PURPLE_POUNCE_AWAY_RETURN)); |
| 5032 | 898 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->idle), |
| 15884 | 899 | (events & PURPLE_POUNCE_IDLE)); |
| 5032 | 900 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->idle_return), |
| 15884 | 901 | (events & PURPLE_POUNCE_IDLE_RETURN)); |
| 5032 | 902 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->typing), |
| 15884 | 903 | (events & PURPLE_POUNCE_TYPING)); |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
904 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->typed), |
| 15884 | 905 | (events & PURPLE_POUNCE_TYPED)); |
| 5032 | 906 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->stop_typing), |
| 15884 | 907 | (events & PURPLE_POUNCE_TYPING_STOPPED)); |
| 12694 | 908 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->message_recv), |
| 15884 | 909 | (events & PURPLE_POUNCE_MESSAGE_RECEIVED)); |
| 5032 | 910 | |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
911 | /* Actions */ |
| 5032 | 912 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->open_win), |
| 15884 | 913 | purple_pounce_action_is_enabled(cur_pounce, "open-window")); |
| 5032 | 914 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->popup), |
| 15884 | 915 | purple_pounce_action_is_enabled(cur_pounce, "popup-notify")); |
| 5032 | 916 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->send_msg), |
| 15884 | 917 | purple_pounce_action_is_enabled(cur_pounce, "send-message")); |
| 5032 | 918 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd), |
| 15884 | 919 | purple_pounce_action_is_enabled(cur_pounce, "execute-command")); |
| 5032 | 920 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->play_sound), |
| 15884 | 921 | purple_pounce_action_is_enabled(cur_pounce, "play-sound")); |
| 5032 | 922 | |
| 923 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->save_pounce), | |
| 15884 | 924 | purple_pounce_get_save(cur_pounce)); |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
925 | |
| 15884 | 926 | if ((value = purple_pounce_action_get_attribute(cur_pounce, |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
927 | "send-message", |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
928 | "message")) != NULL) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
929 | { |
|
17388
8be39f0de528
Allow formatted text in the pounce dialog. Also, use the same code to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
930 | gtk_imhtml_append_text(GTK_IMHTML(dialog->send_msg_entry), value, 0); |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
931 | } |
| 5032 | 932 | |
| 15884 | 933 | if ((value = purple_pounce_action_get_attribute(cur_pounce, |
| 12934 | 934 | "popup-notify", |
| 935 | "reason")) != NULL) | |
| 936 | { | |
| 937 | gtk_entry_set_text(GTK_ENTRY(dialog->popup_entry), value); | |
| 938 | } | |
| 939 | ||
| 15884 | 940 | if ((value = purple_pounce_action_get_attribute(cur_pounce, |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
941 | "execute-command", |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
942 | "command")) != NULL) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
943 | { |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
944 | gtk_entry_set_text(GTK_ENTRY(dialog->exec_cmd_entry), value); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
945 | } |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
946 | |
| 15884 | 947 | if ((value = purple_pounce_action_get_attribute(cur_pounce, |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
948 | "play-sound", |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
949 | "filename")) != NULL) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
950 | { |
|
23260
56fda1590379
Make it more obvious that there is a default buddy pounce sound, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
951 | gtk_entry_set_text(GTK_ENTRY(dialog->play_sound_entry), (value && *value != '\0') ? value : _("(default)")); |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
952 | } |
| 5032 | 953 | } |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
954 | else |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
955 | { |
| 15884 | 956 | PurpleBuddy *buddy = NULL; |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
957 | |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
958 | if (name != NULL) |
| 15884 | 959 | buddy = purple_find_buddy(account, name); |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
960 | |
| 5032 | 961 | /* Set some defaults */ |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
962 | if (buddy == NULL) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
963 | { |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
964 | gtk_toggle_button_set_active( |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
965 | GTK_TOGGLE_BUTTON(dialog->signon), TRUE); |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
966 | } |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
967 | else |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
968 | { |
| 15884 | 969 | if (!PURPLE_BUDDY_IS_ONLINE(buddy)) |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
970 | { |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
971 | gtk_toggle_button_set_active( |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
972 | GTK_TOGGLE_BUTTON(dialog->signon), TRUE); |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
973 | } |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
974 | else |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
975 | { |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
976 | gboolean default_set = FALSE; |
| 15884 | 977 | PurplePresence *presence = purple_buddy_get_presence(buddy); |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
978 | |
| 15884 | 979 | if (purple_presence_is_idle(presence)) |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
980 | { |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
981 | gtk_toggle_button_set_active( |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
982 | GTK_TOGGLE_BUTTON(dialog->idle_return), TRUE); |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
983 | |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
984 | default_set = TRUE; |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
985 | } |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
986 | |
| 15884 | 987 | if (!purple_presence_is_available(presence)) |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
988 | { |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
989 | gtk_toggle_button_set_active( |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
990 | GTK_TOGGLE_BUTTON(dialog->away_return), TRUE); |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
991 | |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
992 | default_set = TRUE; |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
993 | } |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
994 | |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
995 | if (!default_set) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
996 | { |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
997 | gtk_toggle_button_set_active( |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
998 | GTK_TOGGLE_BUTTON(dialog->signon), TRUE); |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
999 | } |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1000 | } |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1001 | } |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1002 | |
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
1003 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->open_win), |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1004 | purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/open-window")); |
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
1005 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->popup), |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1006 | purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/popup-notify")); |
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
1007 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->send_msg), |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1008 | purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/send-message")); |
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
1009 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd), |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1010 | purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/execute-command")); |
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
1011 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->play_sound), |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1012 | purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/play-sound")); |
| 5032 | 1013 | } |
| 1014 | ||
|
19786
33ab83cd846b
Don't show *all*\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19546
diff
changeset
|
1015 | gtk_widget_show(vbox2); |
| 5032 | 1016 | gtk_widget_show(window); |
| 1017 | } | |
| 1018 | ||
| 12136 | 1019 | static gboolean |
| 1020 | pounces_manager_configure_cb(GtkWidget *widget, GdkEventConfigure *event, PouncesManager *dialog) | |
| 1021 | { | |
| 1022 | if (GTK_WIDGET_VISIBLE(widget)) { | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1023 | purple_prefs_set_int(PIDGIN_PREFS_ROOT "/pounces/dialog/width", event->width); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1024 | purple_prefs_set_int(PIDGIN_PREFS_ROOT "/pounces/dialog/height", event->height); |
| 12136 | 1025 | } |
| 1026 | ||
| 1027 | return FALSE; | |
| 1028 | } | |
| 1029 | ||
| 1030 | static gboolean | |
| 15884 | 1031 | pounces_manager_find_pounce(GtkTreeIter *iter, PurplePounce *pounce) |
| 5032 | 1032 | { |
| 12136 | 1033 | GtkTreeModel *model = GTK_TREE_MODEL(pounces_manager->model); |
| 15884 | 1034 | PurplePounce *p; |
| 12136 | 1035 | |
| 1036 | if (!gtk_tree_model_get_iter_first(model, iter)) | |
| 1037 | return FALSE; | |
| 1038 | ||
| 1039 | gtk_tree_model_get(model, iter, POUNCES_MANAGER_COLUMN_POUNCE, &p, -1); | |
| 1040 | if (pounce == p) | |
| 1041 | return TRUE; | |
| 1042 | ||
| 1043 | while (gtk_tree_model_iter_next(model, iter)) | |
| 1044 | { | |
| 1045 | gtk_tree_model_get(model, iter, POUNCES_MANAGER_COLUMN_POUNCE, &p, -1); | |
| 1046 | if (pounce == p) | |
| 1047 | return TRUE; | |
| 1048 | } | |
| 1049 | ||
| 1050 | return FALSE; | |
| 1051 | } | |
| 1052 | ||
| 1053 | static gboolean | |
| 1054 | pounces_manager_destroy_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data) | |
| 1055 | { | |
| 1056 | PouncesManager *dialog = user_data; | |
| 1057 | ||
| 1058 | dialog->window = NULL; | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
1059 | pidgin_pounces_manager_hide(); |
| 12136 | 1060 | |
| 1061 | return FALSE; | |
| 1062 | } | |
| 1063 | ||
| 1064 | #if !GTK_CHECK_VERSION(2,2,0) | |
| 1065 | static void | |
| 1066 | count_selected_helper(GtkTreeModel *model, GtkTreePath *path, | |
| 1067 | GtkTreeIter *iter, gpointer user_data) | |
| 1068 | { | |
| 1069 | (*(gint *)user_data)++; | |
| 1070 | } | |
| 1071 | #endif | |
| 1072 | ||
| 1073 | static void | |
| 15884 | 1074 | pounces_manager_connection_cb(PurpleConnection *gc, GtkWidget *add_button) |
| 12136 | 1075 | { |
| 15884 | 1076 | gtk_widget_set_sensitive(add_button, (purple_connections_get_all() != NULL)); |
| 5032 | 1077 | } |
| 1078 | ||
| 1079 | static void | |
| 12136 | 1080 | pounces_manager_add_cb(GtkButton *button, gpointer user_data) |
| 1081 | { | |
|
21214
db28e29a4990
Reverted changes from ef7ac46f90a801547f7dfc4295927a956f90e869 to
Richard Laager <rlaager@pidgin.im>
parents:
21171
diff
changeset
|
1082 | pidgin_pounce_editor_show(NULL, NULL, NULL); |
| 12136 | 1083 | } |
| 1084 | ||
| 1085 | static void | |
| 1086 | pounces_manager_modify_foreach(GtkTreeModel *model, GtkTreePath *path, | |
| 1087 | GtkTreeIter *iter, gpointer user_data) | |
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1088 | { |
| 15884 | 1089 | PurplePounce *pounce; |
| 12136 | 1090 | |
| 1091 | gtk_tree_model_get(model, iter, POUNCES_MANAGER_COLUMN_POUNCE, &pounce, -1); | |
|
21214
db28e29a4990
Reverted changes from ef7ac46f90a801547f7dfc4295927a956f90e869 to
Richard Laager <rlaager@pidgin.im>
parents:
21171
diff
changeset
|
1092 | pidgin_pounce_editor_show(NULL, NULL, pounce); |
| 12136 | 1093 | } |
| 1094 | ||
| 1095 | static void | |
| 1096 | pounces_manager_modify_cb(GtkButton *button, gpointer user_data) | |
| 1097 | { | |
| 1098 | PouncesManager *dialog = user_data; | |
| 1099 | GtkTreeSelection *selection; | |
| 1100 | ||
| 1101 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); | |
| 1102 | ||
| 1103 | gtk_tree_selection_selected_foreach(selection, pounces_manager_modify_foreach, user_data); | |
| 1104 | } | |
| 1105 | ||
| 1106 | static void | |
| 15884 | 1107 | pounces_manager_delete_confirm_cb(PurplePounce *pounce) |
| 12136 | 1108 | { |
| 1109 | GtkTreeIter iter; | |
| 1110 | ||
|
13172
4e7621289194
[gaim-migrate @ 15534]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1111 | if (pounces_manager && pounces_manager_find_pounce(&iter, pounce)) |
| 12136 | 1112 | gtk_list_store_remove(pounces_manager->model, &iter); |
| 1113 | ||
| 15884 | 1114 | purple_request_close_with_handle(pounce); |
| 1115 | purple_pounce_destroy(pounce); | |
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1116 | } |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1117 | |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1118 | static void |
| 12136 | 1119 | pounces_manager_delete_foreach(GtkTreeModel *model, GtkTreePath *path, |
| 1120 | GtkTreeIter *iter, gpointer user_data) | |
| 1121 | { | |
| 15884 | 1122 | PurplePounce *pounce; |
| 1123 | PurpleAccount *account; | |
| 12136 | 1124 | const char *pouncer, *pouncee; |
| 1125 | char *buf; | |
| 1126 | ||
| 1127 | gtk_tree_model_get(model, iter, POUNCES_MANAGER_COLUMN_POUNCE, &pounce, -1); | |
| 15884 | 1128 | account = purple_pounce_get_pouncer(pounce); |
| 1129 | pouncer = purple_account_get_username(account); | |
| 1130 | pouncee = purple_pounce_get_pouncee(pounce); | |
| 12136 | 1131 | |
| 1132 | buf = g_strdup_printf(_("Are you sure you want to delete the pounce on %s for %s?"), pouncee, pouncer); | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1133 | purple_request_action(pounce, NULL, buf, NULL, 0, |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16254
diff
changeset
|
1134 | account, pouncee, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1135 | pounce, 2, |
| 12136 | 1136 | _("Delete"), pounces_manager_delete_confirm_cb, |
|
13228
d1ef216aba5c
[gaim-migrate @ 15592]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13172
diff
changeset
|
1137 | _("Cancel"), NULL); |
| 12136 | 1138 | g_free(buf); |
| 1139 | } | |
| 1140 | ||
| 1141 | static void | |
| 1142 | pounces_manager_delete_cb(GtkButton *button, gpointer user_data) | |
| 1143 | { | |
| 1144 | PouncesManager *dialog = user_data; | |
| 1145 | GtkTreeSelection *selection; | |
| 1146 | ||
| 1147 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); | |
| 1148 | ||
| 1149 | gtk_tree_selection_selected_foreach(selection, pounces_manager_delete_foreach, user_data); | |
| 1150 | } | |
| 1151 | ||
| 1152 | static void | |
| 1153 | pounces_manager_close_cb(GtkButton *button, gpointer user_data) | |
| 5032 | 1154 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
1155 | pidgin_pounces_manager_hide(); |
| 12136 | 1156 | } |
| 1157 | ||
| 1158 | static void | |
| 1159 | pounce_selected_cb(GtkTreeSelection *sel, gpointer user_data) | |
| 1160 | { | |
| 1161 | PouncesManager *dialog = user_data; | |
| 1162 | int num_selected = 0; | |
| 1163 | ||
| 1164 | #if GTK_CHECK_VERSION(2,2,0) | |
| 1165 | num_selected = gtk_tree_selection_count_selected_rows(sel); | |
| 1166 | #else | |
| 1167 | gtk_tree_selection_selected_foreach(sel, count_selected_helper, &num_selected); | |
| 1168 | #endif | |
| 1169 | ||
| 1170 | gtk_widget_set_sensitive(dialog->modify_button, (num_selected > 0)); | |
| 1171 | gtk_widget_set_sensitive(dialog->delete_button, (num_selected > 0)); | |
| 1172 | } | |
| 1173 | ||
|
12137
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1174 | static gboolean |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1175 | pounce_double_click_cb(GtkTreeView *treeview, GdkEventButton *event, gpointer user_data) |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1176 | { |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1177 | PouncesManager *dialog = user_data; |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1178 | GtkTreePath *path; |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1179 | GtkTreeIter iter; |
| 15884 | 1180 | PurplePounce *pounce; |
|
12137
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1181 | |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1182 | /* Figure out which node was clicked */ |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1183 | 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
|
1184 | return FALSE; |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1185 | 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
|
1186 | gtk_tree_path_free(path); |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1187 | 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
|
1188 | |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1189 | if ((pounce != NULL) && (event->button == 1) && |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1190 | (event->type == GDK_2BUTTON_PRESS)) |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1191 | { |
|
21214
db28e29a4990
Reverted changes from ef7ac46f90a801547f7dfc4295927a956f90e869 to
Richard Laager <rlaager@pidgin.im>
parents:
21171
diff
changeset
|
1192 | pidgin_pounce_editor_show(NULL, NULL, pounce); |
|
12137
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1193 | return TRUE; |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1194 | } |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1195 | |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1196 | return FALSE; |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1197 | } |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1198 | |
| 12136 | 1199 | static void |
|
12193
243b18a880ba
[gaim-migrate @ 14495]
Richard Laager <rlaager@pidgin.im>
parents:
12192
diff
changeset
|
1200 | pounces_manager_recurring_cb(GtkCellRendererToggle *renderer, gchar *path_str, |
| 12136 | 1201 | gpointer user_data) |
| 1202 | { | |
| 1203 | PouncesManager *dialog = user_data; | |
| 15884 | 1204 | PurplePounce *pounce; |
|
12193
243b18a880ba
[gaim-migrate @ 14495]
Richard Laager <rlaager@pidgin.im>
parents:
12192
diff
changeset
|
1205 | gboolean recurring; |
| 12136 | 1206 | GtkTreeModel *model = GTK_TREE_MODEL(dialog->model); |
| 1207 | GtkTreeIter iter; | |
| 1208 | ||
| 1209 | gtk_tree_model_get_iter_from_string(model, &iter, path_str); | |
| 1210 | gtk_tree_model_get(model, &iter, | |
| 1211 | POUNCES_MANAGER_COLUMN_POUNCE, &pounce, | |
|
12193
243b18a880ba
[gaim-migrate @ 14495]
Richard Laager <rlaager@pidgin.im>
parents:
12192
diff
changeset
|
1212 | POUNCES_MANAGER_COLUMN_RECURRING, &recurring, |
| 12136 | 1213 | -1); |
| 1214 | ||
| 15884 | 1215 | purple_pounce_set_save(pounce, !recurring); |
| 12136 | 1216 | |
| 1217 | update_pounces(); | |
| 5032 | 1218 | } |
| 1219 | ||
|
8259
7ed91862683d
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
1220 | static gboolean |
| 12136 | 1221 | 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
|
1222 | { |
| 12136 | 1223 | gboolean result; |
| 1224 | char *haystack; | |
| 1225 | ||
| 1226 | gtk_tree_model_get(model, iter, column, &haystack, -1); | |
| 1227 | ||
| 15884 | 1228 | result = (purple_strcasestr(haystack, key) == NULL); |
| 12136 | 1229 | |
| 1230 | g_free(haystack); | |
| 1231 | ||
| 1232 | return result; | |
| 1233 | } | |
| 1234 | ||
| 1235 | static GtkWidget * | |
| 1236 | create_pounces_list(PouncesManager *dialog) | |
| 1237 | { | |
| 1238 | GtkWidget *sw; | |
| 1239 | GtkWidget *treeview; | |
| 1240 | GtkTreeSelection *sel; | |
| 1241 | GtkTreeViewColumn *column; | |
| 1242 | GtkCellRenderer *renderer; | |
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1243 | |
| 12136 | 1244 | /* Create the scrolled window */ |
| 1245 | sw = gtk_scrolled_window_new(0, 0); | |
| 1246 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
1247 | GTK_POLICY_AUTOMATIC, |
| 13775 | 1248 | GTK_POLICY_AUTOMATIC); |
| 12136 | 1249 | gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
| 13775 | 1250 | GTK_SHADOW_IN); |
| 12136 | 1251 | gtk_widget_show(sw); |
|
8259
7ed91862683d
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
1252 | |
| 12136 | 1253 | /* Create the list model */ |
| 1254 | dialog->model = gtk_list_store_new(POUNCES_MANAGER_NUM_COLUMNS, | |
| 1255 | G_TYPE_POINTER, | |
| 1256 | GDK_TYPE_PIXBUF, | |
| 1257 | G_TYPE_STRING, | |
| 1258 | G_TYPE_STRING, | |
| 1259 | G_TYPE_BOOLEAN | |
| 1260 | ); | |
|
10250
9a0f00083ec1
[gaim-migrate @ 11390]
Mark Doliner <markdoliner@pidgin.im>
parents:
10246
diff
changeset
|
1261 | |
| 12136 | 1262 | /* Create the treeview */ |
| 1263 | treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(dialog->model)); | |
|
22214
e8a9916cb99e
It turns out the tree-models need to be unref'ed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
1264 | g_object_unref(G_OBJECT(dialog->model)); |
| 12136 | 1265 | dialog->treeview = treeview; |
| 1266 | 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
|
1267 | |
| 12136 | 1268 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); |
| 1269 | gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE); | |
| 1270 | g_signal_connect(G_OBJECT(sel), "changed", | |
| 1271 | G_CALLBACK(pounce_selected_cb), dialog); | |
| 1272 | ||
|
12137
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1273 | /* Handle double-clicking */ |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1274 | g_signal_connect(G_OBJECT(treeview), "button_press_event", |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1275 | G_CALLBACK(pounce_double_click_cb), dialog); |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1276 | |
|
6a9dafcaaed1
[gaim-migrate @ 14437]
Richard Laager <rlaager@pidgin.im>
parents:
12136
diff
changeset
|
1277 | |
| 12136 | 1278 | gtk_container_add(GTK_CONTAINER(sw), treeview); |
| 1279 | gtk_widget_show(treeview); | |
|
8259
7ed91862683d
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
1280 | |
| 12136 | 1281 | /* Pouncee Column */ |
| 1282 | column = gtk_tree_view_column_new(); | |
| 1283 | gtk_tree_view_column_set_title(column, _("Pounce Target")); | |
| 1284 | gtk_tree_view_column_set_resizable(column, TRUE); | |
| 1285 | gtk_tree_view_column_set_min_width(column, 200); | |
| 1286 | gtk_tree_view_column_set_sort_column_id(column, | |
| 1287 | POUNCES_MANAGER_COLUMN_TARGET); | |
| 1288 | gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); | |
| 5161 | 1289 | |
| 12136 | 1290 | /* Icon */ |
| 1291 | renderer = gtk_cell_renderer_pixbuf_new(); | |
| 1292 | gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
| 1293 | gtk_tree_view_column_add_attribute(column, renderer, "pixbuf", | |
| 1294 | POUNCES_MANAGER_COLUMN_ICON); | |
| 1295 | ||
| 1296 | /* Pouncee */ | |
| 1297 | renderer = gtk_cell_renderer_text_new(); | |
| 1298 | gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
| 1299 | gtk_tree_view_column_add_attribute(column, renderer, "text", | |
| 1300 | POUNCES_MANAGER_COLUMN_TARGET); | |
| 1301 | ||
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1302 | |
| 12136 | 1303 | /* Account Column */ |
| 1304 | column = gtk_tree_view_column_new(); | |
| 1305 | gtk_tree_view_column_set_title(column, _("Account")); | |
| 1306 | gtk_tree_view_column_set_resizable(column, TRUE); | |
| 1307 | gtk_tree_view_column_set_min_width(column, 200); | |
| 1308 | gtk_tree_view_column_set_sort_column_id(column, | |
| 1309 | POUNCES_MANAGER_COLUMN_ACCOUNT); | |
| 1310 | gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); | |
| 1311 | renderer = gtk_cell_renderer_text_new(); | |
| 1312 | gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
| 1313 | gtk_tree_view_column_add_attribute(column, renderer, "text", | |
| 1314 | POUNCES_MANAGER_COLUMN_ACCOUNT); | |
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1315 | |
|
12193
243b18a880ba
[gaim-migrate @ 14495]
Richard Laager <rlaager@pidgin.im>
parents:
12192
diff
changeset
|
1316 | /* Recurring Column */ |
| 12136 | 1317 | renderer = gtk_cell_renderer_toggle_new(); |
|
12193
243b18a880ba
[gaim-migrate @ 14495]
Richard Laager <rlaager@pidgin.im>
parents:
12192
diff
changeset
|
1318 | column = gtk_tree_view_column_new_with_attributes(_("Recurring"), renderer, |
|
243b18a880ba
[gaim-migrate @ 14495]
Richard Laager <rlaager@pidgin.im>
parents:
12192
diff
changeset
|
1319 | "active", POUNCES_MANAGER_COLUMN_RECURRING, NULL); |
| 12136 | 1320 | gtk_tree_view_column_set_sort_column_id(column, |
|
12193
243b18a880ba
[gaim-migrate @ 14495]
Richard Laager <rlaager@pidgin.im>
parents:
12192
diff
changeset
|
1321 | POUNCES_MANAGER_COLUMN_RECURRING); |
| 12136 | 1322 | gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); |
| 1323 | g_signal_connect(G_OBJECT(renderer), "toggled", | |
|
12193
243b18a880ba
[gaim-migrate @ 14495]
Richard Laager <rlaager@pidgin.im>
parents:
12192
diff
changeset
|
1324 | G_CALLBACK(pounces_manager_recurring_cb), dialog); |
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1325 | |
| 12136 | 1326 | /* Enable CTRL+F searching */ |
| 1327 | gtk_tree_view_set_search_column(GTK_TREE_VIEW(treeview), POUNCES_MANAGER_COLUMN_TARGET); | |
| 1328 | 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
|
1329 | |
| 12136 | 1330 | /* Sort the pouncee column by default */ |
| 1331 | gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(dialog->model), | |
| 1332 | POUNCES_MANAGER_COLUMN_TARGET, | |
| 1333 | GTK_SORT_ASCENDING); | |
| 1334 | ||
| 1335 | /* Populate list */ | |
| 1336 | populate_pounces_list(dialog); | |
| 1337 | ||
| 1338 | return sw; | |
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1339 | } |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1340 | |
| 5032 | 1341 | void |
|
21182
23cc39e90bf7
Only the request API changes
Gabriel Schulhof <nix@go-nix.ca>
parents:
21162
diff
changeset
|
1342 | pidgin_pounces_manager_show(void) |
| 5032 | 1343 | { |
| 12136 | 1344 | PouncesManager *dialog; |
| 1345 | GtkWidget *button; | |
| 1346 | GtkWidget *list; | |
| 1347 | GtkWidget *vbox; | |
| 1348 | GtkWidget *win; | |
| 1349 | int width, height; | |
| 5032 | 1350 | |
| 12136 | 1351 | if (pounces_manager != NULL) { |
| 1352 | gtk_window_present(GTK_WINDOW(pounces_manager->window)); | |
| 1353 | return; | |
| 5032 | 1354 | } |
| 8252 | 1355 | |
| 12136 | 1356 | pounces_manager = dialog = g_new0(PouncesManager, 1); |
| 1357 | ||
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1358 | width = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/pounces/dialog/width"); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1359 | height = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/pounces/dialog/height"); |
| 12136 | 1360 | |
|
22000
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
1361 | dialog->window = win = pidgin_create_dialog(_("Buddy Pounces"), PIDGIN_HIG_BORDER, "pounces", TRUE); |
| 12136 | 1362 | gtk_window_set_default_size(GTK_WINDOW(win), width, height); |
| 1363 | ||
| 1364 | g_signal_connect(G_OBJECT(win), "delete_event", | |
| 1365 | G_CALLBACK(pounces_manager_destroy_cb), dialog); | |
| 1366 | g_signal_connect(G_OBJECT(win), "configure_event", | |
| 1367 | G_CALLBACK(pounces_manager_configure_cb), dialog); | |
| 1368 | ||
| 1369 | /* Setup the vbox */ | |
|
22000
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
1370 | vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(win), FALSE, PIDGIN_HIG_BORDER); |
| 5032 | 1371 | |
| 12136 | 1372 | /* List of saved buddy pounces */ |
| 1373 | list = create_pounces_list(dialog); | |
| 1374 | gtk_box_pack_start(GTK_BOX(vbox), list, TRUE, TRUE, 0); | |
| 1375 | ||
|
22005
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
1376 | /* Add button */ |
|
24594
b2da1decae23
Add an ellipsis to the "Add" and "Modify" buttons in the accounts, pounces, and
Alex Willmer <alex@moreati.org.uk>
parents:
23260
diff
changeset
|
1377 | button = pidgin_dialog_add_button(GTK_DIALOG(win), PIDGIN_STOCK_ADD, G_CALLBACK(pounces_manager_add_cb), dialog); |
|
22005
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
1378 | gtk_widget_set_sensitive(button, (purple_accounts_get_all() != NULL)); |
| 5032 | 1379 | |
| 15884 | 1380 | purple_signal_connect(purple_connections_get_handle(), "signed-on", |
| 1381 | pounces_manager, PURPLE_CALLBACK(pounces_manager_connection_cb), button); | |
| 1382 | purple_signal_connect(purple_connections_get_handle(), "signed-off", | |
| 1383 | pounces_manager, PURPLE_CALLBACK(pounces_manager_connection_cb), button); | |
| 5032 | 1384 | |
| 12136 | 1385 | /* Modify button */ |
|
22005
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
1386 | button = pidgin_dialog_add_button(GTK_DIALOG(win), PIDGIN_STOCK_MODIFY, G_CALLBACK(pounces_manager_modify_cb), dialog); |
| 12136 | 1387 | gtk_widget_set_sensitive(button, FALSE); |
|
22005
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
1388 | dialog->modify_button = button; |
|
8259
7ed91862683d
[gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
1389 | |
| 12136 | 1390 | /* Delete button */ |
|
22005
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
1391 | button = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_DELETE, G_CALLBACK(pounces_manager_delete_cb), dialog); |
| 12136 | 1392 | gtk_widget_set_sensitive(button, FALSE); |
|
22005
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
1393 | dialog->delete_button = button; |
| 5032 | 1394 | |
| 12136 | 1395 | /* Close button */ |
|
22005
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
1396 | pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CLOSE, G_CALLBACK(pounces_manager_close_cb), dialog); |
| 12136 | 1397 | |
| 1398 | gtk_widget_show(win); | |
| 1399 | } | |
| 1400 | ||
| 1401 | void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
1402 | pidgin_pounces_manager_hide(void) |
| 12136 | 1403 | { |
| 1404 | if (pounces_manager == NULL) | |
| 1405 | return; | |
| 1406 | ||
| 1407 | if (pounces_manager->window != NULL) | |
| 1408 | gtk_widget_destroy(pounces_manager->window); | |
| 1409 | ||
| 15884 | 1410 | purple_signals_disconnect_by_handle(pounces_manager); |
| 12136 | 1411 | |
| 1412 | g_free(pounces_manager); | |
| 1413 | pounces_manager = NULL; | |
| 5032 | 1414 | } |
| 1415 | ||
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1416 | static void |
| 15884 | 1417 | pounce_cb(PurplePounce *pounce, PurplePounceEvent events, void *data) |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1418 | { |
| 15884 | 1419 | PurpleConversation *conv; |
| 1420 | PurpleAccount *account; | |
| 1421 | PurpleBuddy *buddy; | |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1422 | const char *pouncee; |
|
7994
13b0203d6d52
[gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents:
7276
diff
changeset
|
1423 | const char *alias; |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1424 | |
| 15884 | 1425 | pouncee = purple_pounce_get_pouncee(pounce); |
| 1426 | account = purple_pounce_get_pouncer(pounce); | |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1427 | |
| 15884 | 1428 | buddy = purple_find_buddy(account, pouncee); |
| 12934 | 1429 | if (buddy != NULL) |
| 1430 | { | |
| 15884 | 1431 | alias = purple_buddy_get_alias(buddy); |
| 12934 | 1432 | if (alias == NULL) |
| 1433 | alias = pouncee; | |
| 1434 | } | |
| 1435 | else | |
| 1436 | alias = pouncee; | |
|
7994
13b0203d6d52
[gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents:
7276
diff
changeset
|
1437 | |
| 15884 | 1438 | if (purple_pounce_action_is_enabled(pounce, "open-window")) |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1439 | { |
| 15884 | 1440 | conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, pouncee, account); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1441 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1442 | if (conv == NULL) |
| 15884 | 1443 | conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, pouncee); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1444 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1445 | |
| 15884 | 1446 | if (purple_pounce_action_is_enabled(pounce, "popup-notify")) |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1447 | { |
| 12934 | 1448 | char *tmp; |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1449 | const char *name_shown; |
| 12934 | 1450 | const char *reason; |
| 15884 | 1451 | reason = purple_pounce_action_get_attribute(pounce, "popup-notify", |
| 12934 | 1452 | "reason"); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1453 | |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1454 | /* |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1455 | * 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
|
1456 | * confusion about what protocol a pounce is for. |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1457 | */ |
| 12934 | 1458 | tmp = g_strdup_printf( |
| 15884 | 1459 | (events & PURPLE_POUNCE_TYPING) ? |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1460 | _("%s has started typing to you (%s)") : |
| 15884 | 1461 | (events & PURPLE_POUNCE_TYPED) ? |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13775
diff
changeset
|
1462 | _("%s has paused while typing to you (%s)") : |
| 15884 | 1463 | (events & PURPLE_POUNCE_SIGNON) ? |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1464 | _("%s has signed on (%s)") : |
| 15884 | 1465 | (events & PURPLE_POUNCE_IDLE_RETURN) ? |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1466 | _("%s has returned from being idle (%s)") : |
| 15884 | 1467 | (events & PURPLE_POUNCE_AWAY_RETURN) ? |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1468 | _("%s has returned from being away (%s)") : |
| 15884 | 1469 | (events & PURPLE_POUNCE_TYPING_STOPPED) ? |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1470 | _("%s has stopped typing to you (%s)") : |
| 15884 | 1471 | (events & PURPLE_POUNCE_SIGNOFF) ? |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1472 | _("%s has signed off (%s)") : |
| 15884 | 1473 | (events & PURPLE_POUNCE_IDLE) ? |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1474 | _("%s has become idle (%s)") : |
| 15884 | 1475 | (events & PURPLE_POUNCE_AWAY) ? |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1476 | _("%s has gone away. (%s)") : |
| 15884 | 1477 | (events & PURPLE_POUNCE_MESSAGE_RECEIVED) ? |
| 12694 | 1478 | _("%s has sent you a message. (%s)") : |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1479 | _("Unknown pounce event. Please report this!"), |
| 15884 | 1480 | alias, purple_account_get_protocol_name(account)); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1481 | |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1482 | /* |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1483 | * Ok here is where I change the second argument, title, from |
| 12934 | 1484 | * NULL to the account alias if we have it or the account |
| 1485 | * name if that's all we have | |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1486 | */ |
| 15884 | 1487 | if ((name_shown = purple_account_get_alias(account)) == NULL) |
| 1488 | name_shown = purple_account_get_username(account); | |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1489 | |
| 12934 | 1490 | if (reason == NULL) |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
1491 | { |
| 15884 | 1492 | purple_notify_info(NULL, name_shown, tmp, purple_date_format_full(NULL)); |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
1493 | } |
| 12934 | 1494 | else |
| 1495 | { | |
| 15884 | 1496 | char *tmp2 = g_strdup_printf("%s\n\n%s", reason, purple_date_format_full(NULL)); |
| 1497 | purple_notify_info(NULL, name_shown, tmp, tmp2); | |
| 12934 | 1498 | g_free(tmp2); |
| 1499 | } | |
| 1500 | g_free(tmp); | |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1501 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1502 | |
| 15884 | 1503 | if (purple_pounce_action_is_enabled(pounce, "send-message")) |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1504 | { |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1505 | const char *message; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1506 | |
| 15884 | 1507 | message = purple_pounce_action_get_attribute(pounce, "send-message", |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1508 | "message"); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1509 | |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1510 | if (message != NULL) |
|
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1511 | { |
| 15884 | 1512 | conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, pouncee, account); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1513 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1514 | if (conv == NULL) |
| 15884 | 1515 | conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, pouncee); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1516 | |
| 15884 | 1517 | purple_conversation_write(conv, NULL, message, |
| 1518 | PURPLE_MESSAGE_SEND, time(NULL)); | |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1519 | |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6695
diff
changeset
|
1520 | serv_send_im(account->gc, (char *)pouncee, (char *)message, 0); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1521 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1522 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1523 | |
| 15884 | 1524 | if (purple_pounce_action_is_enabled(pounce, "execute-command")) |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1525 | { |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1526 | const char *command; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1527 | |
| 15884 | 1528 | command = purple_pounce_action_get_attribute(pounce, |
|
10921
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1529 | "execute-command", "command"); |
|
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 | if (command != NULL) |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1532 | { |
| 6660 | 1533 | #ifndef _WIN32 |
|
10921
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1534 | char *localecmd = g_locale_from_utf8(command, -1, NULL, |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1535 | NULL, NULL); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1536 | |
|
10921
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1537 | if (localecmd != NULL) |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1538 | { |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1539 | int pid = fork(); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1540 | |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1541 | if (pid == 0) { |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1542 | char *args[4]; |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1543 | |
|
10921
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1544 | args[0] = "sh"; |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1545 | args[1] = "-c"; |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1546 | args[2] = (char *)localecmd; |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1547 | args[3] = NULL; |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1548 | |
|
10921
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1549 | execvp(args[0], args); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1550 | |
|
10921
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1551 | _exit(0); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1552 | } |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1553 | g_free(localecmd); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1554 | } |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1555 | #else /* !_WIN32 */ |
|
10921
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1556 | PROCESS_INFORMATION pi; |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1557 | BOOL retval; |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1558 | gchar *message = NULL; |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1559 | |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1560 | memset(&pi, 0, sizeof(pi)); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1561 | |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1562 | if (G_WIN32_HAVE_WIDECHAR_API ()) { |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1563 | STARTUPINFOW si; |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1564 | wchar_t *wc_cmd = g_utf8_to_utf16(command, |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1565 | -1, NULL, NULL, NULL); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1566 | |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1567 | memset(&si, 0 , sizeof(si)); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1568 | si.cb = sizeof(si); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1569 | |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1570 | retval = CreateProcessW(NULL, wc_cmd, NULL, |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1571 | NULL, 0, 0, NULL, NULL, |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1572 | &si, &pi); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1573 | g_free(wc_cmd); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1574 | } else { |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1575 | STARTUPINFOA si; |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1576 | char *l_cmd = g_locale_from_utf8(command, |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1577 | -1, NULL, NULL, NULL); |
| 6660 | 1578 | |
|
10921
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1579 | memset(&si, 0 , sizeof(si)); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1580 | si.cb = sizeof(si); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1581 | |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1582 | retval = CreateProcessA(NULL, l_cmd, NULL, |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1583 | NULL, 0, 0, NULL, NULL, |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1584 | &si, &pi); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1585 | g_free(l_cmd); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1586 | } |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1587 | |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1588 | if (retval) { |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1589 | CloseHandle(pi.hProcess); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1590 | CloseHandle(pi.hThread); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1591 | } else { |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1592 | message = g_win32_error_message(GetLastError()); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1593 | } |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1594 | |
| 15884 | 1595 | purple_debug_info("pounce", |
|
10921
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1596 | "Pounce execute command called for: " |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1597 | "%s\n%s%s%s", |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1598 | command, |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1599 | retval ? "" : "Error: ", |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1600 | retval ? "" : message, |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1601 | retval ? "" : "\n"); |
|
44adf364b1e7
[gaim-migrate @ 12688]
Daniel Atallah <datallah@pidgin.im>
parents:
10913
diff
changeset
|
1602 | g_free(message); |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1603 | #endif /* !_WIN32 */ |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1604 | } |
|
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 | |
| 15884 | 1607 | if (purple_pounce_action_is_enabled(pounce, "play-sound")) |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1608 | { |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1609 | const char *sound; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1610 | |
| 15884 | 1611 | sound = purple_pounce_action_get_attribute(pounce, |
|
9205
8c4dbbe6386f
[gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents:
9191
diff
changeset
|
1612 | "play-sound", "filename"); |
|
5875
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 | if (sound != NULL) |
| 15884 | 1615 | purple_sound_play_file(sound, account); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1616 | else |
| 15884 | 1617 | purple_sound_play_event(PURPLE_SOUND_POUNCE_DEFAULT, account); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1618 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1619 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1620 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1621 | static void |
| 15884 | 1622 | free_pounce(PurplePounce *pounce) |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1623 | { |
| 12136 | 1624 | update_pounces(); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1625 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1626 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1627 | static void |
| 15884 | 1628 | new_pounce(PurplePounce *pounce) |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1629 | { |
| 15884 | 1630 | purple_pounce_action_register(pounce, "open-window"); |
| 1631 | purple_pounce_action_register(pounce, "popup-notify"); | |
| 1632 | purple_pounce_action_register(pounce, "send-message"); | |
| 1633 | purple_pounce_action_register(pounce, "execute-command"); | |
| 1634 | purple_pounce_action_register(pounce, "play-sound"); | |
| 12136 | 1635 | |
| 1636 | update_pounces(); | |
| 1637 | } | |
| 1638 | ||
| 1639 | void * | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
1640 | pidgin_pounces_get_handle() { |
| 12136 | 1641 | static int handle; |
| 1642 | ||
| 1643 | return &handle; | |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1644 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1645 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1646 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
1647 | pidgin_pounces_init(void) |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1648 | { |
| 15884 | 1649 | purple_pounces_register_handler(PIDGIN_UI, pounce_cb, new_pounce, |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1650 | free_pounce); |
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
1651 | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1652 | purple_prefs_add_none(PIDGIN_PREFS_ROOT "/pounces"); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1653 | purple_prefs_add_none(PIDGIN_PREFS_ROOT "/pounces/default_actions"); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1654 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/open-window", |
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
1655 | FALSE); |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1656 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/popup-notify", |
|
12141
9cd436b9b7f6
[gaim-migrate @ 14442]
Richard Laager <rlaager@pidgin.im>
parents:
12137
diff
changeset
|
1657 | TRUE); |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1658 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/send-message", |
|
12141
9cd436b9b7f6
[gaim-migrate @ 14442]
Richard Laager <rlaager@pidgin.im>
parents:
12137
diff
changeset
|
1659 | FALSE); |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1660 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/execute-command", |
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
1661 | FALSE); |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1662 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/pounces/default_actions/play-sound", |
|
9206
57a4db675f8d
[gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents:
9205
diff
changeset
|
1663 | FALSE); |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1664 | purple_prefs_add_none(PIDGIN_PREFS_ROOT "/pounces/dialog"); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1665 | purple_prefs_add_int(PIDGIN_PREFS_ROOT "/pounces/dialog/width", 520); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1666 | purple_prefs_add_int(PIDGIN_PREFS_ROOT "/pounces/dialog/height", 321); |
| 12136 | 1667 | |
| 15884 | 1668 | purple_signal_connect(purple_connections_get_handle(), "signed-on", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
1669 | pidgin_pounces_get_handle(), |
| 15884 | 1670 | PURPLE_CALLBACK(signed_on_off_cb), NULL); |
| 1671 | purple_signal_connect(purple_connections_get_handle(), "signed-off", | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15496
diff
changeset
|
1672 | pidgin_pounces_get_handle(), |
| 15884 | 1673 | PURPLE_CALLBACK(signed_on_off_cb), NULL); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1674 | } |