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