annotate src/gtkpounce.c @ 11439:617e67e1c985

[gaim-migrate @ 13676] Fixed a couple leaks and potential leaks. The retval of g_strsplit() needs to be g_strfreev()'d. Also some "declaration after code" fixes. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Sun, 04 Sep 2005 18:05:48 +0000
parents 17142948653e
children 58bc500cf226
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"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5866
diff changeset
42 #include "gtkutils.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5866
diff changeset
43
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
44 typedef struct
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 /* Pounce data */
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
47 GaimPounce *pounce;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
48 GaimAccount *account;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 /* The window */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 GtkWidget *window;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 /* Pounce Who */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 GtkWidget *account_menu;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 GtkWidget *buddy_entry;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 /* Pounce When */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 GtkWidget *signon;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 GtkWidget *signoff;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 GtkWidget *away;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 GtkWidget *away_return;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 GtkWidget *idle;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63 GtkWidget *idle_return;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 GtkWidget *typing;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 GtkWidget *stop_typing;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 /* Pounce Action */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 GtkWidget *open_win;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 GtkWidget *popup;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 GtkWidget *send_msg;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71 GtkWidget *send_msg_entry;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 GtkWidget *exec_cmd;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 GtkWidget *exec_cmd_entry;
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
74 GtkWidget *exec_cmd_browse;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 GtkWidget *play_sound;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76 GtkWidget *play_sound_entry;
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
77 GtkWidget *play_sound_browse;
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
78 GtkWidget *play_sound_test;
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
79
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 GtkWidget *save_pounce;
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
81
5876
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
82 /* Buttons */
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
83 GtkWidget *save_button;
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
84
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
85 } GaimGtkPounceDialog;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 /**************************************************************************
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 * Callbacks
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 **************************************************************************/
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90 static gint
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
91 delete_win_cb(GtkWidget *w, GdkEventAny *e, GaimGtkPounceDialog *dialog)
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93 gtk_widget_destroy(dialog->window);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94 g_free(dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96 return TRUE;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99 static void
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
100 delete_cb(GtkWidget *w, GaimGtkPounceDialog *dialog)
5052
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
101 {
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
102 gaim_pounce_destroy(dialog->pounce);
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
103
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
104 delete_win_cb(NULL, NULL, dialog);
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
105 }
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
106
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
107 static void
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
108 cancel_cb(GtkWidget *w, GaimGtkPounceDialog *dialog)
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110 delete_win_cb(NULL, NULL, dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
113 static void
9505
12ce3d23c662 [gaim-migrate @ 10332]
Mark Doliner <mark@kingant.net>
parents: 9206
diff changeset
114 pounce_update_entry_fields(void *user_data, const char *filename)
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
115 {
9505
12ce3d23c662 [gaim-migrate @ 10332]
Mark Doliner <mark@kingant.net>
parents: 9206
diff changeset
116 GtkWidget *entry = (GtkWidget *)user_data;
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
117
9505
12ce3d23c662 [gaim-migrate @ 10332]
Mark Doliner <mark@kingant.net>
parents: 9206
diff changeset
118 gtk_entry_set_text(GTK_ENTRY(entry), filename);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
119 }
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
120
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
121 static void
9505
12ce3d23c662 [gaim-migrate @ 10332]
Mark Doliner <mark@kingant.net>
parents: 9206
diff changeset
122 filesel(GtkWidget *widget, gpointer data)
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
123 {
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
124 GtkWidget *entry;
9505
12ce3d23c662 [gaim-migrate @ 10332]
Mark Doliner <mark@kingant.net>
parents: 9206
diff changeset
125 const gchar *name;
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
126
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
127 entry = (GtkWidget *)data;
9505
12ce3d23c662 [gaim-migrate @ 10332]
Mark Doliner <mark@kingant.net>
parents: 9206
diff changeset
128 name = gtk_entry_get_text(GTK_ENTRY(entry));
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
129
9505
12ce3d23c662 [gaim-migrate @ 10332]
Mark Doliner <mark@kingant.net>
parents: 9206
diff changeset
130 gaim_request_file(entry, _("Select a file"), name, FALSE,
12ce3d23c662 [gaim-migrate @ 10332]
Mark Doliner <mark@kingant.net>
parents: 9206
diff changeset
131 G_CALLBACK(pounce_update_entry_fields), NULL, entry);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
132 }
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
133
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
134 static void
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
135 pounce_test_sound(GtkWidget *w, GtkWidget *entry)
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
136 {
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
137 const char *filename;
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
138
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
139 filename = gtk_entry_get_text(GTK_ENTRY(entry));
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
140
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
141 if (filename != NULL && *filename != '\0')
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
142 gaim_sound_play_file((char *) filename);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
143 else
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
144 gaim_sound_play_event(GAIM_SOUND_POUNCE_DEFAULT);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
145 }
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
146
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
147 static void
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
148 save_pounce_cb(GtkWidget *w, GaimGtkPounceDialog *dialog)
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
149 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
150 const char *name;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
151 const char *message, *command, *sound;
7098
770233dad86c [gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
152 GaimBuddyList *blist;
770233dad86c [gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
153 GaimGtkBuddyList *gtkblist;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
154 GaimPounceEvent events = GAIM_POUNCE_NONE;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
155
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
156 name = gtk_entry_get_text(GTK_ENTRY(dialog->buddy_entry));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
157
9206
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
158 if (*name == '\0')
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
159 {
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5319
diff changeset
160 gaim_notify_error(NULL, NULL,
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5319
diff changeset
161 _("Please enter a buddy to pounce."), NULL);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
162 return;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
163 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
164
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
165 /* Events */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
166 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->signon)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
167 events |= GAIM_POUNCE_SIGNON;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
168
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
169 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->signoff)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
170 events |= GAIM_POUNCE_SIGNOFF;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
171
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
172 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->away)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
173 events |= GAIM_POUNCE_AWAY;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
174
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
175 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->away_return)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
176 events |= GAIM_POUNCE_AWAY_RETURN;
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 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->idle)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
179 events |= GAIM_POUNCE_IDLE;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
180
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
181 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->idle_return)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
182 events |= GAIM_POUNCE_IDLE_RETURN;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
183
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
184 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->typing)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
185 events |= GAIM_POUNCE_TYPING;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
186
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
187 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->stop_typing)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
188 events |= GAIM_POUNCE_TYPING_STOPPED;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
189
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
190 /* Data fields */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
191 message = gtk_entry_get_text(GTK_ENTRY(dialog->send_msg_entry));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
192 command = gtk_entry_get_text(GTK_ENTRY(dialog->exec_cmd_entry));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
193 sound = gtk_entry_get_text(GTK_ENTRY(dialog->play_sound_entry));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
194
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
195 if (*message == '\0') message = NULL;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
196 if (*command == '\0') command = NULL;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
197 if (*sound == '\0') sound = NULL;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
198
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
199 if (dialog->pounce == NULL)
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
200 {
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
201 dialog->pounce = gaim_pounce_new(GAIM_GTK_UI, dialog->account,
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
202 name, events);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
203 }
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
204 else {
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
205 gaim_pounce_set_events(dialog->pounce, events);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
206 gaim_pounce_set_pouncer(dialog->pounce, dialog->account);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
207 gaim_pounce_set_pouncee(dialog->pounce, name);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
208 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
209
9206
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
210 /* Actions */
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
211 gaim_pounce_action_set_enabled(dialog->pounce, "open-window",
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
212 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->open_win)));
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
213 gaim_pounce_action_set_enabled(dialog->pounce, "popup-notify",
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
214 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->popup)));
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
215 gaim_pounce_action_set_enabled(dialog->pounce, "send-message",
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
216 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->send_msg)));
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
217 gaim_pounce_action_set_enabled(dialog->pounce, "execute-command",
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
218 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd)));
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
219 gaim_pounce_action_set_enabled(dialog->pounce, "play-sound",
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
220 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->play_sound)));
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
221
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
222 gaim_pounce_action_set_attribute(dialog->pounce, "send-message",
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
223 "message", message);
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
224 gaim_pounce_action_set_attribute(dialog->pounce, "execute-command",
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
225 "command", command);
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
226 gaim_pounce_action_set_attribute(dialog->pounce, "play-sound",
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
227 "filename", sound);
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
228
9206
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
229 /* Set the defaults for next time. */
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
230 gaim_prefs_set_bool("/gaim/gtk/pounces/default_actions/open-window",
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
231 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->open_win)));
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
232 gaim_prefs_set_bool("/gaim/gtk/pounces/default_actions/popup-notify",
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
233 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->popup)));
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
234 gaim_prefs_set_bool("/gaim/gtk/pounces/default_actions/send-message",
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
235 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->send_msg)));
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
236 gaim_prefs_set_bool("/gaim/gtk/pounces/default_actions/execute-command",
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
237 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd)));
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
238 gaim_prefs_set_bool("/gaim/gtk/pounces/default_actions/play-sound",
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
239 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->play_sound)));
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
240
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
241 gaim_pounce_set_save(dialog->pounce,
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
242 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->save_pounce)));
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
243
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
244 delete_win_cb(NULL, NULL, dialog);
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
245
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
246 /* Rebuild the pounce menu */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
247 blist = gaim_get_blist();
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 if (GAIM_IS_GTK_BLIST(blist))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
250 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
251 gtkblist = GAIM_GTK_BLIST(blist);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
252
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
253 gaim_gtkpounce_menu_build(gtkblist->bpmenu);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
254 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
255 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
256
5054
abc8489b2e8f [gaim-migrate @ 5404]
Nathan Walp <nwalp@pidgin.im>
parents: 5052
diff changeset
257 static void
5877
f336fc0a7b8b [gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents: 5876
diff changeset
258 pounce_choose_cb(GtkWidget *item, GaimAccount *account,
f336fc0a7b8b [gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents: 5876
diff changeset
259 GaimGtkPounceDialog *dialog)
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
260 {
5877
f336fc0a7b8b [gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents: 5876
diff changeset
261 dialog->account = account;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
262 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
263
5876
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
264 static void
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
265 buddy_changed_cb(GtkEntry *entry, GaimGtkPounceDialog *dialog)
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
266 {
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
267 if (dialog->save_button == NULL)
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
268 return;
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
269
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
270 gtk_widget_set_sensitive(dialog->save_button,
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
271 *gtk_entry_get_text(entry) != '\0');
5876
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
272 }
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
273
8803
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
274 static void
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
275 pounce_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y,
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
276 GtkSelectionData *sd, guint info, guint t, gpointer data)
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
277 {
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
278 GaimGtkPounceDialog *dialog;
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
279
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
280 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE))
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
281 {
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
282 GaimBlistNode *node = NULL;
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
283 GaimBuddy *buddy;
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
284
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
285 memcpy(&node, sd->data, sizeof(node));
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
286
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
287 if (GAIM_BLIST_NODE_IS_CONTACT(node))
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
288 buddy = gaim_contact_get_priority_buddy((GaimContact *)node);
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
289 else if (GAIM_BLIST_NODE_IS_BUDDY(node))
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
290 buddy = (GaimBuddy *)node;
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
291 else
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
292 return;
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
293
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
294 dialog = (GaimGtkPounceDialog *)data;
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
295
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
296 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
297 dialog->account = buddy->account;
0cb20555b3ab [gaim-migrate @ 10802]
Luke Schierer <lschiere@pidgin.im>
parents: 9791
diff changeset
298 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
299
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
300 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
301 }
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
302 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
303 {
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
304 char *protocol = NULL;
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
305 char *username = NULL;
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
306 GaimAccount *account;
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
307
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 10921
diff changeset
308 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
309 &protocol, &username, NULL))
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
310 {
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
311 if (account == NULL)
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
312 {
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
313 gaim_notify_error(NULL, NULL,
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
314 _("You are not currently signed on with an account that "
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
315 "can add that buddy."), NULL);
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
316 }
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
317 else
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
318 {
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
319 dialog = (GaimGtkPounceDialog *)data;
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
320
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
321 gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), username);
9910
0cb20555b3ab [gaim-migrate @ 10802]
Luke Schierer <lschiere@pidgin.im>
parents: 9791
diff changeset
322 dialog->account = account;
0cb20555b3ab [gaim-migrate @ 10802]
Luke Schierer <lschiere@pidgin.im>
parents: 9791
diff changeset
323 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
324 }
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
325 }
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
326
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
327 if (username != NULL) g_free(username);
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
328 if (protocol != NULL) g_free(protocol);
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
329
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
330 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
331 }
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
332 }
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
333
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
334 static const GtkTargetEntry dnd_targets[] =
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
335 {
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
336 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 0},
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
337 {"application/x-im-contact", 0, 1}
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
338 };
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
339
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
340 void
5907
18486c860a46 [gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents: 5877
diff changeset
341 gaim_gtkpounce_dialog_show(GaimAccount *account, const char *name,
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
342 GaimPounce *cur_pounce)
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
343 {
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
344 GaimGtkPounceDialog *dialog;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
345 GtkWidget *window;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
346 GtkWidget *label;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
347 GtkWidget *bbox;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
348 GtkWidget *vbox1, *vbox2;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
349 GtkWidget *hbox;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
350 GtkWidget *button;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
351 GtkWidget *frame;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
352 GtkWidget *table;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
353 GtkSizeGroup *sg;
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
354 GPtrArray *sound_widgets;
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
355 GPtrArray *exec_widgets;
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
356
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10250
diff changeset
357 g_return_if_fail((cur_pounce != NULL) || (account != NULL) ||
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10250
diff changeset
358 (gaim_connections_get_all() != NULL));
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10250
diff changeset
359
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
360 dialog = g_new0(GaimGtkPounceDialog, 1);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
361
8803
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
362 if (cur_pounce != NULL)
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
363 {
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
364 dialog->pounce = cur_pounce;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
365 dialog->account = gaim_pounce_get_pouncer(cur_pounce);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
366 }
8803
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
367 else if (account != NULL)
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
368 {
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
369 dialog->pounce = NULL;
5907
18486c860a46 [gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents: 5877
diff changeset
370 dialog->account = account;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
371 }
8803
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
372 else
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
373 {
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
374 GaimConnection *gc;
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
375
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
376 gc = (GaimConnection *)gaim_connections_get_all()->data;
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
377
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
378 dialog->pounce = NULL;
8803
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
379 dialog->account = gaim_connection_get_account(gc);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
380 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
381
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
382 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
383
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
384 /* Create the window. */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
385 dialog->window = window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
386 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
387 gtk_window_set_role(GTK_WINDOW(window), "buddy_pounce");
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
388 gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
389 gtk_window_set_title(GTK_WINDOW(window),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
390 (cur_pounce == NULL
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
391 ? _("New Buddy Pounce") : _("Edit Buddy Pounce")));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
392
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
393 gtk_container_set_border_width(GTK_CONTAINER(window), GAIM_HIG_BORDER);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
394
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
395 g_signal_connect(G_OBJECT(window), "delete_event",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
396 G_CALLBACK(delete_win_cb), dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
397
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
398 /* Create the parent vbox for everything. */
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
399 vbox1 = gtk_vbox_new(FALSE, GAIM_HIG_BORDER);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
400 gtk_container_add(GTK_CONTAINER(window), vbox1);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
401 gtk_widget_show(vbox1);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
402
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
403 /* Create the vbox that will contain all the prefs stuff. */
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
404 vbox2 = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
405 gtk_box_pack_start(GTK_BOX(vbox1), vbox2, TRUE, TRUE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
406
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
407 /* Create the "Pounce Who" frame. */
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
408 frame = gaim_gtk_make_frame(vbox2, _("Pounce Who"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
409
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
410 /* Account: */
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
411 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
412 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
413 gtk_widget_show(hbox);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
414
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
415 label = gtk_label_new_with_mnemonic(_("_Account:"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
416 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
417 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
418 gtk_widget_show(label);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
419 gtk_size_group_add_widget(sg, label);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
420
5877
f336fc0a7b8b [gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents: 5876
diff changeset
421 dialog->account_menu =
6646
b89d98f0bf79 [gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents: 6640
diff changeset
422 gaim_gtk_account_option_menu_new(dialog->account, FALSE,
b89d98f0bf79 [gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents: 6640
diff changeset
423 G_CALLBACK(pounce_choose_cb),
b89d98f0bf79 [gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents: 6640
diff changeset
424 NULL, dialog);
5877
f336fc0a7b8b [gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents: 5876
diff changeset
425
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
426 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
427 gtk_widget_show(dialog->account_menu);
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
428 gaim_set_accessible_label (dialog->account_menu, label);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
429
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
430 /* Buddy: */
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
431 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
432 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
433 gtk_widget_show(hbox);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
434
8803
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
435 label = gtk_label_new_with_mnemonic(_("_Buddy name:"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
436 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
437 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
438 gtk_widget_show(label);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
439 gtk_size_group_add_widget(sg, label);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
440
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
441 dialog->buddy_entry = gtk_entry_new();
8803
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
442
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
443 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
444 gtk_widget_show(dialog->buddy_entry);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
445
5876
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
446 g_signal_connect(G_OBJECT(dialog->buddy_entry), "changed",
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
447 G_CALLBACK(buddy_changed_cb), dialog);
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
448 gaim_set_accessible_label (dialog->buddy_entry, label);
5876
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
449
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
450 if (cur_pounce != NULL) {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
451 gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
452 gaim_pounce_get_pouncee(cur_pounce));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
453 }
5907
18486c860a46 [gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents: 5877
diff changeset
454 else if (name != NULL) {
18486c860a46 [gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents: 5877
diff changeset
455 gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), name);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
456 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
457
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
458 /* Create the "Pounce When" frame. */
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
459 frame = gaim_gtk_make_frame(vbox2, _("Pounce When"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
460
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
461 table = gtk_table_new(2, 4, FALSE);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
462 gtk_container_add(GTK_CONTAINER(frame), table);
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
463 gtk_table_set_col_spacings(GTK_TABLE(table), GAIM_HIG_BORDER);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
464 gtk_widget_show(table);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
465
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
466 dialog->signon =
9591
bc910eb2679f [gaim-migrate @ 10434]
Luke Schierer <lschiere@pidgin.im>
parents: 9505
diff changeset
467 gtk_check_button_new_with_mnemonic(_("Si_gn on"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
468 dialog->signoff =
8157
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
469 gtk_check_button_new_with_mnemonic(_("Sign _off"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
470 dialog->away =
8157
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
471 gtk_check_button_new_with_mnemonic(_("A_way"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
472 dialog->away_return =
9591
bc910eb2679f [gaim-migrate @ 10434]
Luke Schierer <lschiere@pidgin.im>
parents: 9505
diff changeset
473 gtk_check_button_new_with_mnemonic(_("_Return from away"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
474 dialog->idle =
8157
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
475 gtk_check_button_new_with_mnemonic(_("_Idle"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
476 dialog->idle_return =
8157
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
477 gtk_check_button_new_with_mnemonic(_("Retur_n from idle"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
478 dialog->typing =
8157
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
479 gtk_check_button_new_with_mnemonic(_("Buddy starts _typing"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
480 dialog->stop_typing =
8157
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
481 gtk_check_button_new_with_mnemonic(_("Buddy stops t_yping"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
482
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
483 gtk_table_attach(GTK_TABLE(table), dialog->signon, 0, 1, 0, 1,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
484 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
485 gtk_table_attach(GTK_TABLE(table), dialog->signoff, 1, 2, 0, 1,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
486 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
487 gtk_table_attach(GTK_TABLE(table), dialog->away, 0, 1, 1, 2,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
488 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
489 gtk_table_attach(GTK_TABLE(table), dialog->away_return, 1, 2, 1, 2,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
490 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
491 gtk_table_attach(GTK_TABLE(table), dialog->idle, 0, 1, 2, 3,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
492 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
493 gtk_table_attach(GTK_TABLE(table), dialog->idle_return, 1, 2, 2, 3,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
494 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
495 gtk_table_attach(GTK_TABLE(table), dialog->typing, 0, 1, 3, 4,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
496 GTK_FILL, 0, 0, 0);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
497 gtk_table_attach(GTK_TABLE(table), dialog->stop_typing, 1, 2, 3, 5,
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
498 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
499
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
500 gtk_widget_show(dialog->signon);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
501 gtk_widget_show(dialog->signoff);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
502 gtk_widget_show(dialog->away);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
503 gtk_widget_show(dialog->away_return);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
504 gtk_widget_show(dialog->idle);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
505 gtk_widget_show(dialog->idle_return);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
506 gtk_widget_show(dialog->typing);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
507 gtk_widget_show(dialog->stop_typing);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
508
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
509 /* Create the "Pounce Action" frame. */
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
510 frame = gaim_gtk_make_frame(vbox2, _("Pounce Action"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
511
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
512 table = gtk_table_new(3, 5, FALSE);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
513 gtk_container_add(GTK_CONTAINER(frame), table);
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
514 gtk_table_set_col_spacings(GTK_TABLE(table), GAIM_HIG_BORDER);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
515 gtk_widget_show(table);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
516
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
517 dialog->open_win
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
518 = gtk_check_button_new_with_mnemonic(_("Op_en an IM window"));
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
519 dialog->popup
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
520 = gtk_check_button_new_with_mnemonic(_("_Popup notification"));
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
521 dialog->send_msg
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
522 = gtk_check_button_new_with_mnemonic(_("Send a _message"));
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
523 dialog->exec_cmd
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
524 = gtk_check_button_new_with_mnemonic(_("E_xecute a command"));
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
525 dialog->play_sound
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
526 = gtk_check_button_new_with_mnemonic(_("P_lay a sound"));
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
527
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
528 dialog->send_msg_entry = gtk_entry_new();
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
529 dialog->exec_cmd_entry = gtk_entry_new();
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
530 dialog->exec_cmd_browse = gtk_button_new_with_mnemonic(_("B_rowse..."));
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
531 dialog->play_sound_entry = gtk_entry_new();
8157
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
532 dialog->play_sound_browse = gtk_button_new_with_mnemonic(_("Bro_wse..."));
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
533 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
534
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
535 gtk_widget_set_sensitive(dialog->send_msg_entry, FALSE);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
536 gtk_widget_set_sensitive(dialog->exec_cmd_entry, FALSE);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
537 gtk_widget_set_sensitive(dialog->exec_cmd_browse, FALSE);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
538 gtk_widget_set_sensitive(dialog->play_sound_entry, FALSE);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
539 gtk_widget_set_sensitive(dialog->play_sound_browse, FALSE);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
540 gtk_widget_set_sensitive(dialog->play_sound_test, FALSE);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
541
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
542 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
543 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
544 gtk_table_attach(GTK_TABLE(table), dialog->popup, 0, 1, 1, 2,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
545 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
546 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
547 GTK_FILL, 0, 0, 0);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
548 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
549 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
550 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
551 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
552 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
553 GTK_FILL, 0, 0, 0);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
554 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
555 GTK_FILL | GTK_EXPAND, 0, 0, 0);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
556 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
557 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
558 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
559 GTK_FILL, 0, 0, 0);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
560 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
561 GTK_FILL | GTK_EXPAND, 0, 0, 0);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
562 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
563 GTK_FILL | GTK_EXPAND, 0, 0, 0);
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 gtk_widget_show(dialog->open_win);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
566 gtk_widget_show(dialog->popup);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
567 gtk_widget_show(dialog->send_msg);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
568 gtk_widget_show(dialog->send_msg_entry);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
569 gtk_widget_show(dialog->exec_cmd);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
570 gtk_widget_show(dialog->exec_cmd_entry);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
571 gtk_widget_show(dialog->exec_cmd_browse);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
572 gtk_widget_show(dialog->play_sound);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
573 gtk_widget_show(dialog->play_sound_entry);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
574 gtk_widget_show(dialog->play_sound_browse);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
575 gtk_widget_show(dialog->play_sound_test);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
576
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
577 g_signal_connect(G_OBJECT(dialog->send_msg), "clicked",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
578 G_CALLBACK(gaim_gtk_toggle_sensitive),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
579 dialog->send_msg_entry);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
580
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
581 exec_widgets = g_ptr_array_new();
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
582 g_ptr_array_add(exec_widgets,dialog->exec_cmd_entry);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
583 g_ptr_array_add(exec_widgets,dialog->exec_cmd_browse);
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
584
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
585 g_signal_connect(G_OBJECT(dialog->exec_cmd), "clicked",
10590
896efbdc74e2 [gaim-migrate @ 11995]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10535
diff changeset
586 G_CALLBACK(gaim_gtk_toggle_sensitive_array),
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
587 exec_widgets);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
588 g_signal_connect(G_OBJECT(dialog->exec_cmd_browse), "clicked",
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
589 G_CALLBACK(filesel),
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
590 dialog->exec_cmd_entry);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
591
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
592 sound_widgets = g_ptr_array_new();
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
593 g_ptr_array_add(sound_widgets,dialog->play_sound_entry);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
594 g_ptr_array_add(sound_widgets,dialog->play_sound_browse);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
595 g_ptr_array_add(sound_widgets,dialog->play_sound_test);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
596
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
597 g_signal_connect(G_OBJECT(dialog->play_sound), "clicked",
10590
896efbdc74e2 [gaim-migrate @ 11995]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10535
diff changeset
598 G_CALLBACK(gaim_gtk_toggle_sensitive_array),
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
599 sound_widgets);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
600 g_signal_connect(G_OBJECT(dialog->play_sound_browse), "clicked",
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
601 G_CALLBACK(filesel),
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
602 dialog->play_sound_entry);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
603 g_signal_connect(G_OBJECT(dialog->play_sound_test), "clicked",
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
604 G_CALLBACK(pounce_test_sound),
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
605 dialog->play_sound_entry);
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
606
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
607 g_signal_connect(G_OBJECT(dialog->send_msg_entry), "activate",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
608 G_CALLBACK(save_pounce_cb), dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
609 g_signal_connect(G_OBJECT(dialog->exec_cmd_entry), "activate",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
610 G_CALLBACK(save_pounce_cb), dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
611 g_signal_connect(G_OBJECT(dialog->play_sound_entry), "activate",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
612 G_CALLBACK(save_pounce_cb), dialog);
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
613
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
614 /* Now the last part, where we have the Save checkbox */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
615 dialog->save_pounce = gtk_check_button_new_with_mnemonic(
8157
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
616 _("Sav_e this pounce after activation"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
617
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
618 gtk_box_pack_start(GTK_BOX(vbox2), dialog->save_pounce, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
619
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
620 /* Now the button box! */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
621 bbox = gtk_hbutton_box_new();
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
622 gtk_box_set_spacing(GTK_BOX(bbox), GAIM_HIG_BOX_SPACE);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
623 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
624 gtk_box_pack_end(GTK_BOX(vbox1), bbox, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
625 gtk_widget_show(bbox);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
626
5052
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
627 /* Delete button */
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
628 button = gtk_button_new_from_stock(GTK_STOCK_DELETE);
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
629 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
630 if (cur_pounce == NULL)
fbb78553cae1 [gaim-migrate @ 11584]
Luke Schierer <lschiere@pidgin.im>
parents: 10352
diff changeset
631 gtk_widget_set_sensitive(button, FALSE);
5052
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
632 gtk_widget_show(button);
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
633
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
634 g_signal_connect(G_OBJECT(button), "clicked",
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
635 G_CALLBACK(delete_cb), dialog);
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
636
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
637 /* Cancel button */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
638 button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
639 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
640 gtk_widget_show(button);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
641
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
642 g_signal_connect(G_OBJECT(button), "clicked",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
643 G_CALLBACK(cancel_cb), dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
644
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
645 /* Save button */
5876
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
646 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
647 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
648 gtk_widget_show(button);
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
649
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
650 g_signal_connect(G_OBJECT(button), "clicked",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
651 G_CALLBACK(save_pounce_cb), dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
652
5876
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
653 if (*gtk_entry_get_text(GTK_ENTRY(dialog->buddy_entry)) == '\0')
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
654 gtk_widget_set_sensitive(button, FALSE);
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
655
8803
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
656 /* Setup drag-and-drop */
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
657 gtk_drag_dest_set(window,
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
658 GTK_DEST_DEFAULT_MOTION |
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
659 GTK_DEST_DEFAULT_DROP,
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
660 dnd_targets,
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
661 sizeof(dnd_targets) / sizeof(GtkTargetEntry),
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
662 GDK_ACTION_COPY);
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
663 gtk_drag_dest_set(dialog->buddy_entry,
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
664 GTK_DEST_DEFAULT_MOTION |
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
665 GTK_DEST_DEFAULT_DROP,
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
666 dnd_targets,
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
667 sizeof(dnd_targets) / sizeof(GtkTargetEntry),
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
668 GDK_ACTION_COPY);
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
669
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
670 g_signal_connect(G_OBJECT(window), "drag_data_received",
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
671 G_CALLBACK(pounce_dnd_recv), dialog);
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
672 g_signal_connect(G_OBJECT(dialog->buddy_entry), "drag_data_received",
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
673 G_CALLBACK(pounce_dnd_recv), dialog);
721899998983 [gaim-migrate @ 9565]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
674
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
675 /* Set the values of stuff. */
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
676 if (cur_pounce != NULL)
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
677 {
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
678 GaimPounceEvent events = gaim_pounce_get_events(cur_pounce);
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
679 const char *value;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
680
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
681 /* Events */
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
682 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signon),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
683 (events & GAIM_POUNCE_SIGNON));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
684 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signoff),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
685 (events & GAIM_POUNCE_SIGNOFF));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
686 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->away),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
687 (events & GAIM_POUNCE_AWAY));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
688 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->away_return),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
689 (events & GAIM_POUNCE_AWAY_RETURN));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
690 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->idle),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
691 (events & GAIM_POUNCE_IDLE));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
692 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->idle_return),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
693 (events & GAIM_POUNCE_IDLE_RETURN));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
694 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->typing),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
695 (events & GAIM_POUNCE_TYPING));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
696 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->stop_typing),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
697 (events & GAIM_POUNCE_TYPING_STOPPED));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
698
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
699 /* Actions */
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
700 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
701 gaim_pounce_action_is_enabled(cur_pounce, "open-window"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
702 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->popup),
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
703 gaim_pounce_action_is_enabled(cur_pounce, "popup-notify"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
704 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
705 gaim_pounce_action_is_enabled(cur_pounce, "send-message"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
706 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
707 gaim_pounce_action_is_enabled(cur_pounce, "execute-command"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
708 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
709 gaim_pounce_action_is_enabled(cur_pounce, "play-sound"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
710
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
711 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
712 gaim_pounce_get_save(cur_pounce));
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
713
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
714 if ((value = gaim_pounce_action_get_attribute(cur_pounce,
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
715 "send-message",
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
716 "message")) != NULL)
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
717 {
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
718 gtk_entry_set_text(GTK_ENTRY(dialog->send_msg_entry), value);
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
719 }
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
720
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
721 if ((value = gaim_pounce_action_get_attribute(cur_pounce,
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
722 "execute-command",
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
723 "command")) != NULL)
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
724 {
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
725 gtk_entry_set_text(GTK_ENTRY(dialog->exec_cmd_entry), value);
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
726 }
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
727
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
728 if ((value = gaim_pounce_action_get_attribute(cur_pounce,
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
729 "play-sound",
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
730 "filename")) != NULL)
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
731 {
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
732 gtk_entry_set_text(GTK_ENTRY(dialog->play_sound_entry), value);
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
733 }
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
734 }
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
735 else
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
736 {
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
737 GaimBuddy *buddy = NULL;
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
738
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
739 if (name != NULL)
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
740 buddy = gaim_find_buddy(account, name);
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
741
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
742 /* Set some defaults */
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
743 if (buddy == NULL)
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
744 {
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
745 gtk_toggle_button_set_active(
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
746 GTK_TOGGLE_BUTTON(dialog->signon), TRUE);
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
747 }
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
748 else
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
749 {
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
750 if (!GAIM_BUDDY_IS_ONLINE(buddy))
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
751 {
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
752 gtk_toggle_button_set_active(
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
753 GTK_TOGGLE_BUTTON(dialog->signon), TRUE);
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
754 }
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
755 else
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
756 {
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
757 gboolean default_set = FALSE;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9910
diff changeset
758 GaimPresence *presence = gaim_buddy_get_presence(buddy);
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
759
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9910
diff changeset
760 if (gaim_presence_is_idle(presence))
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
761 {
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
762 gtk_toggle_button_set_active(
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
763 GTK_TOGGLE_BUTTON(dialog->idle_return), TRUE);
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
764
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
765 default_set = TRUE;
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
766 }
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
767
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9910
diff changeset
768 if (!gaim_presence_is_available(presence))
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
769 {
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
770 gtk_toggle_button_set_active(
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
771 GTK_TOGGLE_BUTTON(dialog->away_return), TRUE);
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
772
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
773 default_set = TRUE;
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
774 }
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
775
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
776 if (!default_set)
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
777 {
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
778 gtk_toggle_button_set_active(
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
779 GTK_TOGGLE_BUTTON(dialog->signon), TRUE);
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
780 }
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
781 }
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
782 }
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
783
9206
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
784 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->open_win),
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
785 gaim_prefs_get_bool("/gaim/gtk/pounces/default_actions/open-window"));
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
786 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->popup),
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
787 gaim_prefs_get_bool("/gaim/gtk/pounces/default_actions/popup-notify"));
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
788 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->send_msg),
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
789 gaim_prefs_get_bool("/gaim/gtk/pounces/default_actions/send-message"));
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
790 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd),
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
791 gaim_prefs_get_bool("/gaim/gtk/pounces/default_actions/execute-command"));
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
792 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->play_sound),
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
793 gaim_prefs_get_bool("/gaim/gtk/pounces/default_actions/play-sound"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
794 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
795
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
796 gtk_widget_show_all(vbox2);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
797 gtk_widget_show(window);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
798 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
799
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
800 static void
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6660
diff changeset
801 new_pounce_cb(GtkWidget *w, GaimBuddy *b)
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
802 {
5937
3034a6ea2d89 [gaim-migrate @ 6377]
Christian Hammond <chipx86@chipx86.com>
parents: 5907
diff changeset
803 if (b == NULL)
3034a6ea2d89 [gaim-migrate @ 6377]
Christian Hammond <chipx86@chipx86.com>
parents: 5907
diff changeset
804 gaim_gtkpounce_dialog_show(NULL, NULL, NULL);
3034a6ea2d89 [gaim-migrate @ 6377]
Christian Hammond <chipx86@chipx86.com>
parents: 5907
diff changeset
805 else
3034a6ea2d89 [gaim-migrate @ 6377]
Christian Hammond <chipx86@chipx86.com>
parents: 5907
diff changeset
806 gaim_gtkpounce_dialog_show(b->account, b->name, NULL);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
807 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
808
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
809 static void
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
810 delete_pounce_cb(GtkWidget *w, GaimPounce *pounce)
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
811 {
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
812 gaim_pounce_destroy(pounce);
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
813 }
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
814
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
815 static void
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
816 edit_pounce_cb(GtkWidget *w, GaimPounce *pounce)
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
817 {
5907
18486c860a46 [gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents: 5877
diff changeset
818 gaim_gtkpounce_dialog_show(NULL, NULL, pounce);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
819 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
820
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8252
diff changeset
821 static gboolean
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
822 fill_menu(GtkWidget *menu, GCallback cb)
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
823 {
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
824 GtkWidget *image;
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
825 GtkWidget *item;
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
826 GdkPixbuf *pixbuf, *scale;
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
827 GaimPounce *pounce;
10250
89a25444401c [gaim-migrate @ 11390]
Mark Doliner <mark@kingant.net>
parents: 10246
diff changeset
828 GaimBuddy *buddy;
89a25444401c [gaim-migrate @ 11390]
Mark Doliner <mark@kingant.net>
parents: 10246
diff changeset
829 const char *buddyname;
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8252
diff changeset
830 gboolean has_items = FALSE;
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
831 GList *bp;
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
832
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
833 for (bp = gaim_pounces_get_all(); bp != NULL; bp = bp->next)
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
834 {
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
835 pounce = (GaimPounce *)bp->data;
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
836
8235
63c7a16a2c09 [gaim-migrate @ 8958]
Mark Doliner <mark@kingant.net>
parents: 8157
diff changeset
837 /* Check if account is online, if not skip it */
10250
89a25444401c [gaim-migrate @ 11390]
Mark Doliner <mark@kingant.net>
parents: 10246
diff changeset
838 if (!gaim_account_is_connected(gaim_pounce_get_pouncer(pounce)))
8235
63c7a16a2c09 [gaim-migrate @ 8958]
Mark Doliner <mark@kingant.net>
parents: 8157
diff changeset
839 continue;
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8252
diff changeset
840
10250
89a25444401c [gaim-migrate @ 11390]
Mark Doliner <mark@kingant.net>
parents: 10246
diff changeset
841 buddy = gaim_find_buddy(gaim_pounce_get_pouncer(pounce), gaim_pounce_get_pouncee(pounce));
89a25444401c [gaim-migrate @ 11390]
Mark Doliner <mark@kingant.net>
parents: 10246
diff changeset
842
89a25444401c [gaim-migrate @ 11390]
Mark Doliner <mark@kingant.net>
parents: 10246
diff changeset
843 if (buddy != NULL)
89a25444401c [gaim-migrate @ 11390]
Mark Doliner <mark@kingant.net>
parents: 10246
diff changeset
844 buddyname = gaim_buddy_get_contact_alias(buddy);
89a25444401c [gaim-migrate @ 11390]
Mark Doliner <mark@kingant.net>
parents: 10246
diff changeset
845 else
89a25444401c [gaim-migrate @ 11390]
Mark Doliner <mark@kingant.net>
parents: 10246
diff changeset
846 buddyname = gaim_pounce_get_pouncee(pounce);
89a25444401c [gaim-migrate @ 11390]
Mark Doliner <mark@kingant.net>
parents: 10246
diff changeset
847
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8252
diff changeset
848 has_items = TRUE;
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8252
diff changeset
849
5161
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
850 /* Build the menu item */
10250
89a25444401c [gaim-migrate @ 11390]
Mark Doliner <mark@kingant.net>
parents: 10246
diff changeset
851 item = gtk_image_menu_item_new_with_label(buddyname);
5161
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
852
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
853 /* Create a pixmap for the protocol icon. */
10884
5cda52915a1f [gaim-migrate @ 12582]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10774
diff changeset
854 pixbuf = gaim_gtk_create_prpl_icon(gaim_pounce_get_pouncer(pounce));
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
855 if (pixbuf != NULL)
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
856 {
5161
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
857 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16,
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
858 GDK_INTERP_BILINEAR);
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
859
5161
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
860 /* Now convert it to GtkImage */
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
861 image = gtk_image_new_from_pixbuf(scale);
5161
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
862 g_object_unref(G_OBJECT(scale));
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
863 g_object_unref(G_OBJECT(pixbuf));
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
864 gtk_widget_show(image);
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
865 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image);
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
866 }
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
867
5161
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
868 /* Put the item in the menu */
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
869 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
870 gtk_widget_show(item);
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
871
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
872 /* Set our callbacks. */
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
873 g_signal_connect(G_OBJECT(item), "activate", cb, pounce);
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
874 }
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8252
diff changeset
875
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8252
diff changeset
876 return has_items;
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
877 }
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
878
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
879 void
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
880 gaim_gtkpounce_menu_build(GtkWidget *menu)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
881 {
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
882 GtkWidget *remmenu;
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
883 GtkWidget *item;
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8252
diff changeset
884 GList *children, *l;
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8252
diff changeset
885 gboolean has_items;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
886
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8252
diff changeset
887 g_return_if_fail(menu != NULL);
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8236
diff changeset
888
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8252
diff changeset
889 if ((children = gtk_container_get_children(GTK_CONTAINER(menu))) != NULL)
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8252
diff changeset
890 {
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8252
diff changeset
891 for (l = children; l != NULL; l = l->next)
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8252
diff changeset
892 gtk_widget_destroy(GTK_WIDGET(l->data));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
893
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8252
diff changeset
894 g_list_free(children);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
895 }
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8236
diff changeset
896
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
897 /* "New Buddy Pounce" */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
898 item = gtk_menu_item_new_with_label(_("New Buddy Pounce"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
899 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10250
diff changeset
900 gtk_widget_set_sensitive(item, (gaim_connections_get_all() != NULL));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
901 gtk_widget_show(item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
902 g_signal_connect(G_OBJECT(item), "activate",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
903 G_CALLBACK(new_pounce_cb), NULL);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
904
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
905 /* "Remove Buddy Pounce" */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
906 item = gtk_menu_item_new_with_label(_("Remove Buddy Pounce"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
907 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
908
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
909 /* "Remove Buddy Pounce" menu */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
910 remmenu = gtk_menu_new();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
911
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8252
diff changeset
912 has_items = fill_menu(remmenu, G_CALLBACK(delete_pounce_cb));
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8252
diff changeset
913
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8252
diff changeset
914 if (!has_items)
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8252
diff changeset
915 gtk_widget_set_sensitive(item, FALSE);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
916
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
917 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), remmenu);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
918 gtk_widget_show(remmenu);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
919 gtk_widget_show(item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
920
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
921 /* Separator */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
922 item = gtk_separator_menu_item_new();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
923 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
924 gtk_widget_show(item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
925
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
926 fill_menu(menu, G_CALLBACK(edit_pounce_cb));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
927 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
928
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
929 static void
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
930 pounce_cb(GaimPounce *pounce, GaimPounceEvent events, void *data)
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
931 {
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
932 GaimConversation *conv;
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
933 GaimAccount *account;
7994
d5874c4f19c5 [gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents: 7276
diff changeset
934 GaimBuddy *buddy;
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
935 const char *pouncee;
7994
d5874c4f19c5 [gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents: 7276
diff changeset
936 const char *alias;
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
937
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
938 pouncee = gaim_pounce_get_pouncee(pounce);
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
939 account = gaim_pounce_get_pouncer(pounce);
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
940
7994
d5874c4f19c5 [gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents: 7276
diff changeset
941 buddy = gaim_find_buddy(account, pouncee);
d5874c4f19c5 [gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents: 7276
diff changeset
942
9620
c001be3c330e [gaim-migrate @ 10464]
Mark Doliner <mark@kingant.net>
parents: 9606
diff changeset
943 alias = gaim_buddy_get_alias(buddy);
7994
d5874c4f19c5 [gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents: 7276
diff changeset
944
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
945 if (gaim_pounce_action_is_enabled(pounce, "open-window"))
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
946 {
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11243
diff changeset
947 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
948
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
949 if (conv == NULL)
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11243
diff changeset
950 conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, pouncee);
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
951 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
952
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
953 if (gaim_pounce_action_is_enabled(pounce, "popup-notify"))
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
954 {
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
955 char tmp[1024];
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
956 const char *name_shown;
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
957
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
958 /*
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
959 * 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
960 * confusion about what protocol a pounce is for.
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
961 */
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
962 g_snprintf(tmp, sizeof(tmp),
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
963 (events & GAIM_POUNCE_TYPING) ?
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
964 _("%s has started typing to you (%s)") :
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
965 (events & GAIM_POUNCE_SIGNON) ?
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
966 _("%s has signed on (%s)") :
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
967 (events & GAIM_POUNCE_IDLE_RETURN) ?
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
968 _("%s has returned from being idle (%s)") :
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
969 (events & GAIM_POUNCE_AWAY_RETURN) ?
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
970 _("%s has returned from being away (%s)") :
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
971 (events & GAIM_POUNCE_TYPING_STOPPED) ?
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
972 _("%s has stopped typing to you (%s)") :
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
973 (events & GAIM_POUNCE_SIGNOFF) ?
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
974 _("%s has signed off (%s)") :
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
975 (events & GAIM_POUNCE_IDLE) ?
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
976 _("%s has become idle (%s)") :
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
977 (events & GAIM_POUNCE_AWAY) ?
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
978 _("%s has gone away. (%s)") :
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
979 _("Unknown pounce event. Please report this!"),
10774
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10590
diff changeset
980 alias, gaim_account_get_protocol_name(account));
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
981
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
982 /*
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
983 * Ok here is where I change the second argument, title, from
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
984 * 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
985 * alias if we have that
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
986 */
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
987 if ((name_shown = gaim_account_get_alias(account)) == NULL)
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
988 name_shown = gaim_account_get_username(account);
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
989
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
990 gaim_notify_info(NULL, name_shown, tmp, gaim_date_full());
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
991 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
992
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
993 if (gaim_pounce_action_is_enabled(pounce, "send-message"))
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
994 {
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
995 const char *message;
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
996
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
997 message = gaim_pounce_action_get_attribute(pounce, "send-message",
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
998 "message");
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
999
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
1000 if (message != NULL)
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
1001 {
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11243
diff changeset
1002 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
1003
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1004 if (conv == NULL)
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11243
diff changeset
1005 conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, pouncee);
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1006
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6695
diff changeset
1007 gaim_conversation_write(conv, NULL, message,
6621
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6444
diff changeset
1008 GAIM_MESSAGE_SEND, time(NULL));
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1009
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6695
diff changeset
1010 serv_send_im(account->gc, (char *)pouncee, (char *)message, 0);
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1011 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1012 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1013
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
1014 if (gaim_pounce_action_is_enabled(pounce, "execute-command"))
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
1015 {
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1016 const char *command;
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1017
10921
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1018 command = gaim_pounce_action_get_attribute(pounce,
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1019 "execute-command", "command");
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1020
10921
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1021 if (command != NULL)
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
1022 {
6660
48a31082bf5f [gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6646
diff changeset
1023 #ifndef _WIN32
10921
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1024 char *localecmd = g_locale_from_utf8(command, -1, NULL,
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1025 NULL, NULL);
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1026
10921
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1027 if (localecmd != NULL)
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1028 {
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1029 int pid = fork();
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1030
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1031 if (pid == 0) {
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1032 char *args[4];
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1033
10921
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1034 args[0] = "sh";
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1035 args[1] = "-c";
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1036 args[2] = (char *)localecmd;
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1037 args[3] = NULL;
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1038
10921
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1039 execvp(args[0], args);
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1040
10921
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1041 _exit(0);
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1042 }
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1043 g_free(localecmd);
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1044 }
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
1045 #else /* !_WIN32 */
10921
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1046 PROCESS_INFORMATION pi;
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1047 BOOL retval;
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1048 gchar *message = NULL;
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1049
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1050 memset(&pi, 0, sizeof(pi));
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1051
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1052 if (G_WIN32_HAVE_WIDECHAR_API ()) {
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1053 STARTUPINFOW si;
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1054 wchar_t *wc_cmd = g_utf8_to_utf16(command,
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1055 -1, NULL, NULL, NULL);
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1056
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1057 memset(&si, 0 , sizeof(si));
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1058 si.cb = sizeof(si);
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1059
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1060 retval = CreateProcessW(NULL, wc_cmd, NULL,
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1061 NULL, 0, 0, NULL, NULL,
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1062 &si, &pi);
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1063 g_free(wc_cmd);
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1064 } else {
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1065 STARTUPINFOA si;
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1066 char *l_cmd = g_locale_from_utf8(command,
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1067 -1, NULL, NULL, NULL);
6660
48a31082bf5f [gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6646
diff changeset
1068
10921
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1069 memset(&si, 0 , sizeof(si));
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1070 si.cb = sizeof(si);
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1071
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1072 retval = CreateProcessA(NULL, l_cmd, NULL,
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1073 NULL, 0, 0, NULL, NULL,
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1074 &si, &pi);
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1075 g_free(l_cmd);
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1076 }
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1077
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1078 if (retval) {
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1079 CloseHandle(pi.hProcess);
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1080 CloseHandle(pi.hThread);
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1081 } else {
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1082 message = g_win32_error_message(GetLastError());
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1083 }
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1084
7276
29c0fe160f90 [gaim-migrate @ 7855]
Christian Hammond <chipx86@chipx86.com>
parents: 7098
diff changeset
1085 gaim_debug_info("pounce",
10921
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1086 "Pounce execute command called for: "
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1087 "%s\n%s%s%s",
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1088 command,
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1089 retval ? "" : "Error: ",
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1090 retval ? "" : message,
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1091 retval ? "" : "\n");
9f75886e4f1f [gaim-migrate @ 12688]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10913
diff changeset
1092 g_free(message);
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
1093 #endif /* !_WIN32 */
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1094 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1095 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1096
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
1097 if (gaim_pounce_action_is_enabled(pounce, "play-sound"))
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
1098 {
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1099 const char *sound;
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1100
9205
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
1101 sound = gaim_pounce_action_get_attribute(pounce,
5b35a6b96726 [gaim-migrate @ 10000]
Christian Hammond <chipx86@chipx86.com>
parents: 9191
diff changeset
1102 "play-sound", "filename");
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1103
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1104 if (sound != NULL)
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1105 gaim_sound_play_file(sound);
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1106 else
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1107 gaim_sound_play_event(GAIM_SOUND_POUNCE_DEFAULT);
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1108 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1109 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1110
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1111 static void
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1112 free_pounce(GaimPounce *pounce)
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1113 {
7098
770233dad86c [gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
1114 GaimBuddyList *blist;
770233dad86c [gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
1115 GaimGtkBuddyList *gtkblist;
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1116
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1117 /* Rebuild the pounce menu */
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1118 blist = gaim_get_blist();
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1119
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1120 if (GAIM_IS_GTK_BLIST(blist))
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1121 {
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1122 gtkblist = GAIM_GTK_BLIST(blist);
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1123
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1124 gaim_gtkpounce_menu_build(gtkblist->bpmenu);
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1125 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1126 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1127
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1128 static void
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1129 new_pounce(GaimPounce *pounce)
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1130 {
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1131 gaim_pounce_action_register(pounce, "open-window");
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1132 gaim_pounce_action_register(pounce, "popup-notify");
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1133 gaim_pounce_action_register(pounce, "send-message");
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1134 gaim_pounce_action_register(pounce, "execute-command");
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1135 gaim_pounce_action_register(pounce, "play-sound");
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1136 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1137
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1138 void
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1139 gaim_gtk_pounces_init(void)
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1140 {
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1141 gaim_pounces_register_handler(GAIM_GTK_UI, pounce_cb, new_pounce,
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1142 free_pounce);
9206
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
1143
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
1144 gaim_prefs_add_none("/gaim/gtk/pounces");
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
1145 gaim_prefs_add_none("/gaim/gtk/pounces/default_actions");
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
1146 gaim_prefs_add_bool("/gaim/gtk/pounces/default_actions/open-window",
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
1147 FALSE);
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
1148 gaim_prefs_add_bool("/gaim/gtk/pounces/default_actions/popup-notify",
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
1149 FALSE);
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
1150 gaim_prefs_add_bool("/gaim/gtk/pounces/default_actions/send-message",
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
1151 TRUE);
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
1152 gaim_prefs_add_bool("/gaim/gtk/pounces/default_actions/execute-command",
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
1153 FALSE);
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
1154 gaim_prefs_add_bool("/gaim/gtk/pounces/default_actions/play-sound",
13bfd59e164f [gaim-migrate @ 10001]
Christian Hammond <chipx86@chipx86.com>
parents: 9205
diff changeset
1155 FALSE);
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1156 }