annotate src/gtkpounce.c @ 12888:03f690fcb78e

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