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