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