annotate src/gtkpounce.c @ 8157:657b5acaec48

[gaim-migrate @ 8869] Gary Kramlich has mnemonicated the buddy pounce dialog for you all committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Wed, 21 Jan 2004 04:51:29 +0000
parents 4971193f761d
children 63c7a16a2c09
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 */
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 5966
diff changeset
26 #include "gtkinternal.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5866
diff changeset
27
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5866
diff changeset
28 #include "conversation.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5866
diff changeset
29 #include "debug.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5866
diff changeset
30 #include "notify.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5866
diff changeset
31 #include "prpl.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5866
diff changeset
32 #include "server.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5866
diff changeset
33 #include "sound.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5866
diff changeset
34
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5866
diff changeset
35 #include "gtkblist.h"
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 #include "gtkpounce.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5866
diff changeset
37 #include "gtkutils.h"
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 "ui.h"
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
41 typedef struct
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 /* Pounce data */
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
44 GaimPounce *pounce;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5530
diff changeset
45 GaimAccount *account;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 /* The window */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 GtkWidget *window;
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 /* Pounce Who */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 GtkWidget *account_menu;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 GtkWidget *buddy_entry;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 /* Pounce When */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 GtkWidget *signon;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56 GtkWidget *signoff;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 GtkWidget *away;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 GtkWidget *away_return;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 GtkWidget *idle;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 GtkWidget *idle_return;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 GtkWidget *typing;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 GtkWidget *stop_typing;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 /* Pounce Action */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 GtkWidget *open_win;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 GtkWidget *popup;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 GtkWidget *send_msg;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 GtkWidget *send_msg_entry;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 GtkWidget *exec_cmd;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 GtkWidget *exec_cmd_entry;
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
71 GtkWidget *exec_cmd_browse;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 GtkWidget *play_sound;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 GtkWidget *play_sound_entry;
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
74 GtkWidget *play_sound_browse;
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
75 GtkWidget *play_sound_test;
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
76
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77 GtkWidget *save_pounce;
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
78
5876
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
79 /* Buttons */
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
80 GtkWidget *save_button;
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
81
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
82 } GaimGtkPounceDialog;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 /**************************************************************************
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85 * Callbacks
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 static gint
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
88 delete_win_cb(GtkWidget *w, GdkEventAny *e, GaimGtkPounceDialog *dialog)
5032
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 gtk_widget_destroy(dialog->window);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91 g_free(dialog);
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 return TRUE;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94 }
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 static void
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
97 delete_cb(GtkWidget *w, GaimGtkPounceDialog *dialog)
5052
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
98 {
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
99 gaim_pounce_destroy(dialog->pounce);
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
100
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
101 delete_win_cb(NULL, NULL, dialog);
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
102 }
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 static void
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
105 cancel_cb(GtkWidget *w, GaimGtkPounceDialog *dialog)
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
107 delete_win_cb(NULL, NULL, dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
110 static void
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
111 pounce_update_entryfields(GtkWidget *w, gpointer data)
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
112 {
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
113 const char *filename;
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
114 GHashTable *args;
5959
0a2a32b1917c [gaim-migrate @ 6405]
Mark Doliner <mark@kingant.net>
parents: 5937
diff changeset
115 GtkFileSelection *filesel;
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
116
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
117 args = (GHashTable *)data;
5959
0a2a32b1917c [gaim-migrate @ 6405]
Mark Doliner <mark@kingant.net>
parents: 5937
diff changeset
118 filesel = GTK_FILE_SELECTION(g_hash_table_lookup(args, "filesel"));
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
119
5959
0a2a32b1917c [gaim-migrate @ 6405]
Mark Doliner <mark@kingant.net>
parents: 5937
diff changeset
120 filename = gtk_file_selection_get_filename(filesel);
0a2a32b1917c [gaim-migrate @ 6405]
Mark Doliner <mark@kingant.net>
parents: 5937
diff changeset
121
5966
5fb6bd688a5b [gaim-migrate @ 6413]
Mark Doliner <mark@kingant.net>
parents: 5959
diff changeset
122 if (gaim_gtk_check_if_dir(filename, filesel))
5959
0a2a32b1917c [gaim-migrate @ 6405]
Mark Doliner <mark@kingant.net>
parents: 5937
diff changeset
123 return;
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
124
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
125 if (filename != NULL)
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
126 gtk_entry_set_text(GTK_ENTRY(g_hash_table_lookup(args, "entry")),
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
127 filename);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
128
5959
0a2a32b1917c [gaim-migrate @ 6405]
Mark Doliner <mark@kingant.net>
parents: 5937
diff changeset
129 gtk_widget_destroy(GTK_WIDGET(filesel));
0a2a32b1917c [gaim-migrate @ 6405]
Mark Doliner <mark@kingant.net>
parents: 5937
diff changeset
130 g_hash_table_destroy(args);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
131 }
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 static void
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
134 filesel(GtkWidget *w, gpointer data)
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
135 {
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
136 GtkWidget *filesel;
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
137 GtkWidget *entry;
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
138 GHashTable *args;
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
139
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
140 entry = (GtkWidget *)data;
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
141
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
142 filesel = gtk_file_selection_new(_("Select a file"));
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
143 gtk_file_selection_set_filename(GTK_FILE_SELECTION(filesel),
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
144 gtk_entry_get_text(GTK_ENTRY(entry)));
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
145 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(filesel));
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
146 gtk_file_selection_set_select_multiple(GTK_FILE_SELECTION(filesel), FALSE);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
147
5959
0a2a32b1917c [gaim-migrate @ 6405]
Mark Doliner <mark@kingant.net>
parents: 5937
diff changeset
148 args = g_hash_table_new(g_str_hash, g_str_equal);
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
149 g_hash_table_insert(args, "filesel", filesel);
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
150 g_hash_table_insert(args, "entry", entry);
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
151
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
152 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button),
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
153 "clicked",
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
154 G_CALLBACK(pounce_update_entryfields), args);
5959
0a2a32b1917c [gaim-migrate @ 6405]
Mark Doliner <mark@kingant.net>
parents: 5937
diff changeset
155 g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button),
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
156 "clicked",
5959
0a2a32b1917c [gaim-migrate @ 6405]
Mark Doliner <mark@kingant.net>
parents: 5937
diff changeset
157 G_CALLBACK(g_hash_table_destroy), args);
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
158 g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button),
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
159 "clicked",
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
160 G_CALLBACK(gtk_widget_destroy), filesel);
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
161
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
162 gtk_widget_show(filesel);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
163 }
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
164
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
165 static void
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
166 pounce_test_sound(GtkWidget *w, GtkWidget *entry)
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
167 {
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
168 const char *filename;
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
169
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
170 filename = gtk_entry_get_text(GTK_ENTRY(entry));
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
171
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
172 if (filename != NULL && *filename != '\0')
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
173 gaim_sound_play_file((char *) filename);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
174 else
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
175 gaim_sound_play_event(GAIM_SOUND_POUNCE_DEFAULT);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
176 }
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
177
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
178 static void
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
179 save_pounce_cb(GtkWidget *w, GaimGtkPounceDialog *dialog)
5032
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 const char *name;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
182 const char *message, *command, *sound;
7098
770233dad86c [gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
183 GaimBuddyList *blist;
770233dad86c [gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
184 GaimGtkBuddyList *gtkblist;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
185 GaimPounceEvent events = GAIM_POUNCE_NONE;
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 name = gtk_entry_get_text(GTK_ENTRY(dialog->buddy_entry));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
188
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
189 if (*name == '\0') {
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5319
diff changeset
190 gaim_notify_error(NULL, NULL,
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5319
diff changeset
191 _("Please enter a buddy to pounce."), NULL);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
192 return;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
193 }
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 /* Events */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
196 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->signon)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
197 events |= GAIM_POUNCE_SIGNON;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
198
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
199 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->signoff)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
200 events |= GAIM_POUNCE_SIGNOFF;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
201
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
202 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->away)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
203 events |= GAIM_POUNCE_AWAY;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
204
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
205 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->away_return)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
206 events |= GAIM_POUNCE_AWAY_RETURN;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
207
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
208 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->idle)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
209 events |= GAIM_POUNCE_IDLE;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
210
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
211 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->idle_return)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
212 events |= GAIM_POUNCE_IDLE_RETURN;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
213
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
214 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->typing)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
215 events |= GAIM_POUNCE_TYPING;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
216
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
217 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->stop_typing)))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
218 events |= GAIM_POUNCE_TYPING_STOPPED;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
219
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
220 /* Data fields */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
221 message = gtk_entry_get_text(GTK_ENTRY(dialog->send_msg_entry));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
222 command = gtk_entry_get_text(GTK_ENTRY(dialog->exec_cmd_entry));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
223 sound = gtk_entry_get_text(GTK_ENTRY(dialog->play_sound_entry));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
224
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
225 if (*message == '\0') message = NULL;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
226 if (*command == '\0') command = NULL;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
227 if (*sound == '\0') sound = NULL;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
228
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
229 if (dialog->pounce == NULL) {
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
230 dialog->pounce = gaim_pounce_new(GAIM_GTK_UI, dialog->account,
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
231 name, events);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
232 }
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
233 else {
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
234 gaim_pounce_set_events(dialog->pounce, events);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
235 gaim_pounce_set_pouncer(dialog->pounce, dialog->account);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
236 gaim_pounce_set_pouncee(dialog->pounce, name);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
237 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
238
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
239 /* Actions*/
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
240 gaim_pounce_action_set_enabled(dialog->pounce, "open-window",
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
241 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->open_win)));
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
242 gaim_pounce_action_set_enabled(dialog->pounce, "popup-notify",
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
243 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->popup)));
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
244 gaim_pounce_action_set_enabled(dialog->pounce, "send-message",
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
245 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->send_msg)));
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
246 gaim_pounce_action_set_enabled(dialog->pounce, "execute-command",
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
247 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd)));
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
248 gaim_pounce_action_set_enabled(dialog->pounce, "play-sound",
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
249 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->play_sound)));
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
250
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
251 gaim_pounce_action_set_attribute(dialog->pounce, "send-message",
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
252 "message", message);
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
253 gaim_pounce_action_set_attribute(dialog->pounce, "execute-command",
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
254 "command", command);
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
255 gaim_pounce_action_set_attribute(dialog->pounce, "play-sound",
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
256 "filename", sound);
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
257
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
258 gaim_pounce_set_save(dialog->pounce,
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
259 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->save_pounce)));
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
260
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
261 delete_win_cb(NULL, NULL, dialog);
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
262
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
263 gaim_pounces_sync();
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
264
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
265 /* Rebuild the pounce menu */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
266 blist = gaim_get_blist();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
267
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
268 if (GAIM_IS_GTK_BLIST(blist))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
269 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
270 gtkblist = GAIM_GTK_BLIST(blist);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
271
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
272 gaim_gtkpounce_menu_build(gtkblist->bpmenu);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
273 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
274 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
275
5054
abc8489b2e8f [gaim-migrate @ 5404]
Nathan Walp <nwalp@pidgin.im>
parents: 5052
diff changeset
276 static void
5877
f336fc0a7b8b [gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents: 5876
diff changeset
277 pounce_choose_cb(GtkWidget *item, GaimAccount *account,
f336fc0a7b8b [gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents: 5876
diff changeset
278 GaimGtkPounceDialog *dialog)
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
279 {
5877
f336fc0a7b8b [gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents: 5876
diff changeset
280 dialog->account = account;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
281 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
282
5876
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
283 static void
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
284 buddy_changed_cb(GtkEntry *entry, GaimGtkPounceDialog *dialog)
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
285 {
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
286 if (dialog->save_button == NULL)
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
287 return;
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
288
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
289 gtk_widget_set_sensitive(dialog->save_button,
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
290 *gtk_entry_get_text(entry) != '\0');
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
291 }
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
292
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
293 void
5907
18486c860a46 [gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents: 5877
diff changeset
294 gaim_gtkpounce_dialog_show(GaimAccount *account, const char *name,
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
295 GaimPounce *cur_pounce)
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
296 {
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
297 GaimGtkPounceDialog *dialog;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
298 GtkWidget *window;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
299 GtkWidget *label;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
300 GtkWidget *bbox;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
301 GtkWidget *vbox1, *vbox2;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
302 GtkWidget *hbox;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
303 GtkWidget *button;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
304 GtkWidget *frame;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
305 GtkWidget *table;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
306 GtkWidget *sep;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
307 GtkSizeGroup *sg;
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
308 GPtrArray *sound_widgets;
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
309 GPtrArray *exec_widgets;
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
310
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
311 dialog = g_new0(GaimGtkPounceDialog, 1);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
312
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
313 if (cur_pounce != NULL) {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
314 dialog->pounce = cur_pounce;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
315 dialog->account = gaim_pounce_get_pouncer(cur_pounce);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
316 }
5907
18486c860a46 [gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents: 5877
diff changeset
317 else if (account != NULL) {
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
318 dialog->pounce = NULL;
5907
18486c860a46 [gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents: 5877
diff changeset
319 dialog->account = account;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
320 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
321 else {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
322 dialog->pounce = NULL;
5580
86456ec3ca25 [gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
323 dialog->account = gaim_accounts_get_all()->data;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
324 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
325
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
326 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
327
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
328 /* Create the window. */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
329 dialog->window = window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
330 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
331 gtk_window_set_role(GTK_WINDOW(window), "buddy_pounce");
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
332 gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
333 gtk_window_set_title(GTK_WINDOW(window),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
334 (cur_pounce == NULL
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
335 ? _("New Buddy Pounce") : _("Edit Buddy Pounce")));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
336
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
337 gtk_container_set_border_width(GTK_CONTAINER(window), 12);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
338 gtk_widget_realize(window);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
339
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
340 g_signal_connect(G_OBJECT(window), "delete_event",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
341 G_CALLBACK(delete_win_cb), dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
342
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
343 /* Create the parent vbox for everything. */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
344 vbox1 = gtk_vbox_new(FALSE, 12);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
345 gtk_container_add(GTK_CONTAINER(window), vbox1);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
346 gtk_widget_show(vbox1);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
347
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
348 /* Create the vbox that will contain all the prefs stuff. */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
349 vbox2 = gtk_vbox_new(FALSE, 18);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
350 gtk_box_pack_start(GTK_BOX(vbox1), vbox2, TRUE, TRUE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
351
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
352 /* Create the "Pounce Who" frame. */
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
353 frame = gaim_gtk_make_frame(vbox2, _("Pounce Who"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
354
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
355 /* Account: */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
356 hbox = gtk_hbox_new(FALSE, 6);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
357 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
358 gtk_widget_show(hbox);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
359
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
360 label = gtk_label_new_with_mnemonic(_("_Account:"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
361 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
362 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
363 gtk_widget_show(label);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
364 gtk_size_group_add_widget(sg, label);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
365
5877
f336fc0a7b8b [gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents: 5876
diff changeset
366 dialog->account_menu =
6646
b89d98f0bf79 [gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents: 6640
diff changeset
367 gaim_gtk_account_option_menu_new(dialog->account, FALSE,
b89d98f0bf79 [gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents: 6640
diff changeset
368 G_CALLBACK(pounce_choose_cb),
b89d98f0bf79 [gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents: 6640
diff changeset
369 NULL, dialog);
5877
f336fc0a7b8b [gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents: 5876
diff changeset
370
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
371 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
372 gtk_widget_show(dialog->account_menu);
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
373 gaim_set_accessible_label (dialog->account_menu, label);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
374
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
375 /* Buddy: */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
376 hbox = gtk_hbox_new(FALSE, 6);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
377 gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
378 gtk_widget_show(hbox);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
379
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
380 label = gtk_label_new_with_mnemonic(_("_Buddy Name:"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
381 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
382 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
383 gtk_widget_show(label);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
384 gtk_size_group_add_widget(sg, label);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
385
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
386 dialog->buddy_entry = gtk_entry_new();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
387 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
388 gtk_widget_show(dialog->buddy_entry);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
389
5876
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
390 g_signal_connect(G_OBJECT(dialog->buddy_entry), "changed",
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
391 G_CALLBACK(buddy_changed_cb), dialog);
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
392 gaim_set_accessible_label (dialog->buddy_entry, label);
5876
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
393
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
394 if (cur_pounce != NULL) {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
395 gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
396 gaim_pounce_get_pouncee(cur_pounce));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
397 }
5907
18486c860a46 [gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents: 5877
diff changeset
398 else if (name != NULL) {
18486c860a46 [gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents: 5877
diff changeset
399 gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), name);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
400 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
401
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
402 /* Create the "Pounce When" frame. */
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
403 frame = gaim_gtk_make_frame(vbox2, _("Pounce When"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
404
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
405 table = gtk_table_new(2, 4, FALSE);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
406 gtk_container_add(GTK_CONTAINER(frame), table);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
407 gtk_table_set_col_spacings(GTK_TABLE(table), 12);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
408 gtk_widget_show(table);
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 dialog->signon =
8157
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
411 gtk_check_button_new_with_mnemonic(_("_Sign on"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
412 dialog->signoff =
8157
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
413 gtk_check_button_new_with_mnemonic(_("Sign _off"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
414 dialog->away =
8157
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
415 gtk_check_button_new_with_mnemonic(_("A_way"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
416 dialog->away_return =
8157
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
417 gtk_check_button_new_with_mnemonic(_("Re_turn from away"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
418 dialog->idle =
8157
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
419 gtk_check_button_new_with_mnemonic(_("_Idle"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
420 dialog->idle_return =
8157
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
421 gtk_check_button_new_with_mnemonic(_("Retur_n from idle"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
422 dialog->typing =
8157
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
423 gtk_check_button_new_with_mnemonic(_("Buddy starts _typing"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
424 dialog->stop_typing =
8157
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
425 gtk_check_button_new_with_mnemonic(_("Buddy stops t_yping"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
426
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
427 gtk_table_attach(GTK_TABLE(table), dialog->signon, 0, 1, 0, 1,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
428 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
429 gtk_table_attach(GTK_TABLE(table), dialog->signoff, 1, 2, 0, 1,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
430 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
431 gtk_table_attach(GTK_TABLE(table), dialog->away, 0, 1, 1, 2,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
432 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
433 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
434 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
435 gtk_table_attach(GTK_TABLE(table), dialog->idle, 0, 1, 2, 3,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
436 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
437 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
438 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
439 gtk_table_attach(GTK_TABLE(table), dialog->typing, 0, 1, 3, 4,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
440 GTK_FILL, 0, 0, 0);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
441 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
442 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
443
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
444 gtk_widget_show(dialog->signon);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
445 gtk_widget_show(dialog->signoff);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
446 gtk_widget_show(dialog->away);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
447 gtk_widget_show(dialog->away_return);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
448 gtk_widget_show(dialog->idle);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
449 gtk_widget_show(dialog->idle_return);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
450 gtk_widget_show(dialog->typing);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
451 gtk_widget_show(dialog->stop_typing);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
452
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
453 /* Create the "Pounce Action" frame. */
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
454 frame = gaim_gtk_make_frame(vbox2, _("Pounce Action"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
455
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
456 table = gtk_table_new(3, 5, FALSE);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
457 gtk_container_add(GTK_CONTAINER(frame), table);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
458 gtk_table_set_col_spacings(GTK_TABLE(table), 12);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
459 gtk_widget_show(table);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
460
8157
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
461 dialog->open_win = gtk_check_button_new_with_mnemonic(_("Op_en an IM window"));
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
462 dialog->popup = gtk_check_button_new_with_mnemonic(_("_Popup notification"));
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
463 dialog->send_msg = gtk_check_button_new_with_mnemonic(_("Send a _message"));
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
464 dialog->exec_cmd = gtk_check_button_new_with_mnemonic(_("E_xecute a command"));
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
465 dialog->play_sound = gtk_check_button_new_with_mnemonic(_("P_lay a sound"));
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
466
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
467 dialog->send_msg_entry = gtk_entry_new();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
468 dialog->exec_cmd_entry = gtk_entry_new();
8157
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
469 dialog->exec_cmd_browse = gtk_button_new_with_mnemonic(_("B_rowse..."));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
470 dialog->play_sound_entry = gtk_entry_new();
8157
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
471 dialog->play_sound_browse = gtk_button_new_with_mnemonic(_("Bro_wse..."));
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
472 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
473
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
474 gtk_widget_set_sensitive(dialog->send_msg_entry, FALSE);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
475 gtk_widget_set_sensitive(dialog->exec_cmd_entry, FALSE);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
476 gtk_widget_set_sensitive(dialog->exec_cmd_browse, FALSE);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
477 gtk_widget_set_sensitive(dialog->play_sound_entry, FALSE);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
478 gtk_widget_set_sensitive(dialog->play_sound_browse, FALSE);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
479 gtk_widget_set_sensitive(dialog->play_sound_test, FALSE);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
480
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
481 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
482 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
483 gtk_table_attach(GTK_TABLE(table), dialog->popup, 0, 1, 1, 2,
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->send_msg, 0, 1, 2, 3,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
486 GTK_FILL, 0, 0, 0);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
487 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
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->exec_cmd, 0, 1, 3, 4,
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->exec_cmd_entry, 1, 2, 3, 4,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
492 GTK_FILL, 0, 0, 0);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
493 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
494 GTK_FILL | GTK_EXPAND, 0, 0, 0);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
495 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
496 GTK_FILL, 0, 0, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
497 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
498 GTK_FILL, 0, 0, 0);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
499 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
500 GTK_FILL | GTK_EXPAND, 0, 0, 0);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
501 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
502 GTK_FILL | GTK_EXPAND, 0, 0, 0);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
503
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
504 gtk_widget_show(dialog->open_win);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
505 gtk_widget_show(dialog->popup);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
506 gtk_widget_show(dialog->send_msg);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
507 gtk_widget_show(dialog->send_msg_entry);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
508 gtk_widget_show(dialog->exec_cmd);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
509 gtk_widget_show(dialog->exec_cmd_entry);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
510 gtk_widget_show(dialog->exec_cmd_browse);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
511 gtk_widget_show(dialog->play_sound);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
512 gtk_widget_show(dialog->play_sound_entry);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
513 gtk_widget_show(dialog->play_sound_browse);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
514 gtk_widget_show(dialog->play_sound_test);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
515
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
516 g_signal_connect(G_OBJECT(dialog->send_msg), "clicked",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
517 G_CALLBACK(gaim_gtk_toggle_sensitive),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
518 dialog->send_msg_entry);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
519
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
520 exec_widgets = g_ptr_array_new();
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
521 g_ptr_array_add(exec_widgets,dialog->exec_cmd_entry);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
522 g_ptr_array_add(exec_widgets,dialog->exec_cmd_browse);
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
523
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
524 g_signal_connect(G_OBJECT(dialog->exec_cmd), "clicked",
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
525 G_CALLBACK(gtk_toggle_sensitive_array),
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
526 exec_widgets);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
527 g_signal_connect(G_OBJECT(dialog->exec_cmd_browse), "clicked",
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
528 G_CALLBACK(filesel),
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
529 dialog->exec_cmd_entry);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
530
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
531 sound_widgets = g_ptr_array_new();
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
532 g_ptr_array_add(sound_widgets,dialog->play_sound_entry);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
533 g_ptr_array_add(sound_widgets,dialog->play_sound_browse);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
534 g_ptr_array_add(sound_widgets,dialog->play_sound_test);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
535
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
536 g_signal_connect(G_OBJECT(dialog->play_sound), "clicked",
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
537 G_CALLBACK(gtk_toggle_sensitive_array),
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
538 sound_widgets);
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
539 g_signal_connect(G_OBJECT(dialog->play_sound_browse), "clicked",
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
540 G_CALLBACK(filesel),
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
541 dialog->play_sound_entry);
5319
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
542 g_signal_connect(G_OBJECT(dialog->play_sound_test), "clicked",
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
543 G_CALLBACK(pounce_test_sound),
3adb20b869b4 [gaim-migrate @ 5691]
Christian Hammond <chipx86@chipx86.com>
parents: 5228
diff changeset
544 dialog->play_sound_entry);
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
545
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
546 g_signal_connect(G_OBJECT(dialog->send_msg_entry), "activate",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
547 G_CALLBACK(save_pounce_cb), dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
548 g_signal_connect(G_OBJECT(dialog->exec_cmd_entry), "activate",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
549 G_CALLBACK(save_pounce_cb), dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
550 g_signal_connect(G_OBJECT(dialog->play_sound_entry), "activate",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
551 G_CALLBACK(save_pounce_cb), dialog);
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
552
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
553 /* Now the last part, where we have the Save checkbox */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
554 dialog->save_pounce = gtk_check_button_new_with_mnemonic(
8157
657b5acaec48 [gaim-migrate @ 8869]
Ethan Blanton <elb@pidgin.im>
parents: 8137
diff changeset
555 _("Sav_e this pounce after activation"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
556
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
557 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
558
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
559 /* Separator... */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
560 sep = gtk_hseparator_new();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
561 gtk_box_pack_start(GTK_BOX(vbox1), sep, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
562 gtk_widget_show(sep);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
563
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
564 /* Now the button box! */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
565 bbox = gtk_hbutton_box_new();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
566 gtk_box_set_spacing(GTK_BOX(bbox), 6);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
567 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
568 gtk_box_pack_end(GTK_BOX(vbox1), bbox, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
569 gtk_widget_show(bbox);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
570
5052
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
571 /* Delete button */
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
572 button = gtk_button_new_from_stock(GTK_STOCK_DELETE);
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
573 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
574 gtk_widget_show(button);
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
575
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
576 g_signal_connect(G_OBJECT(button), "clicked",
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
577 G_CALLBACK(delete_cb), dialog);
6a7759f63766 [gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents: 5051
diff changeset
578
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
579 /* Cancel button */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
580 button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
581 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
582 gtk_widget_show(button);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
583
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
584 g_signal_connect(G_OBJECT(button), "clicked",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
585 G_CALLBACK(cancel_cb), dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
586
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
587 /* Save button */
5876
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
588 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
589 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
590 gtk_widget_show(button);
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
591
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
592 g_signal_connect(G_OBJECT(button), "clicked",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
593 G_CALLBACK(save_pounce_cb), dialog);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
594
5876
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
595 if (*gtk_entry_get_text(GTK_ENTRY(dialog->buddy_entry)) == '\0')
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
596 gtk_widget_set_sensitive(button, FALSE);
8d6e5f804325 [gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents: 5875
diff changeset
597
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
598 /* Set the values of stuff. */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
599 if (cur_pounce != NULL) {
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
600 GaimPounceEvent events = gaim_pounce_get_events(cur_pounce);
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
601 const char *value;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
602
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
603 /* Events */
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
604 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signon),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
605 (events & GAIM_POUNCE_SIGNON));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
606 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signoff),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
607 (events & GAIM_POUNCE_SIGNOFF));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
608 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->away),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
609 (events & GAIM_POUNCE_AWAY));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
610 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->away_return),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
611 (events & GAIM_POUNCE_AWAY_RETURN));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
612 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->idle),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
613 (events & GAIM_POUNCE_IDLE));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
614 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->idle_return),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
615 (events & GAIM_POUNCE_IDLE_RETURN));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
616 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->typing),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
617 (events & GAIM_POUNCE_TYPING));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
618 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->stop_typing),
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
619 (events & GAIM_POUNCE_TYPING_STOPPED));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
620
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
621 /* Actions */
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
622 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
623 gaim_pounce_action_is_enabled(cur_pounce, "open-window"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
624 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->popup),
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
625 gaim_pounce_action_is_enabled(cur_pounce, "popup-notify"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
626 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
627 gaim_pounce_action_is_enabled(cur_pounce, "send-message"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
628 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
629 gaim_pounce_action_is_enabled(cur_pounce, "execute-command"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
630 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
631 gaim_pounce_action_is_enabled(cur_pounce, "play-sound"));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
632
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
633 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
634 gaim_pounce_get_save(cur_pounce));
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
635
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
636 if ((value = gaim_pounce_action_get_attribute(cur_pounce,
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
637 "send-message",
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
638 "message")) != NULL) {
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
639
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
640 gtk_entry_set_text(GTK_ENTRY(dialog->send_msg_entry), value);
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
641 }
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
642
5864
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
643 if ((value = gaim_pounce_action_get_attribute(cur_pounce,
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
644 "execute-command",
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
645 "command")) != NULL) {
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
646
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
647 gtk_entry_set_text(GTK_ENTRY(dialog->exec_cmd_entry), value);
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
648 }
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
649
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
650 if ((value = gaim_pounce_action_get_attribute(cur_pounce,
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
651 "play-sound",
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
652 "filename")) != NULL) {
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
653 gtk_entry_set_text(GTK_ENTRY(dialog->play_sound_entry), value);
417b1001d2b1 [gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents: 5857
diff changeset
654 }
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
655 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
656 else {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
657 /* Set some defaults */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
658 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->send_msg), TRUE);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
659 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signon), TRUE);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
660 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
661
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
662 gtk_widget_show_all(vbox2);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
663 gtk_widget_show(window);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
664 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
665
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
666 static void
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6660
diff changeset
667 new_pounce_cb(GtkWidget *w, GaimBuddy *b)
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
668 {
5937
3034a6ea2d89 [gaim-migrate @ 6377]
Christian Hammond <chipx86@chipx86.com>
parents: 5907
diff changeset
669 if (b == NULL)
3034a6ea2d89 [gaim-migrate @ 6377]
Christian Hammond <chipx86@chipx86.com>
parents: 5907
diff changeset
670 gaim_gtkpounce_dialog_show(NULL, NULL, NULL);
3034a6ea2d89 [gaim-migrate @ 6377]
Christian Hammond <chipx86@chipx86.com>
parents: 5907
diff changeset
671 else
3034a6ea2d89 [gaim-migrate @ 6377]
Christian Hammond <chipx86@chipx86.com>
parents: 5907
diff changeset
672 gaim_gtkpounce_dialog_show(b->account, b->name, NULL);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
673 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
674
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
675 static void
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
676 delete_pounce_cb(GtkWidget *w, GaimPounce *pounce)
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
677 {
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
678 gaim_pounce_destroy(pounce);
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
679 }
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
680
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
681 static void
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
682 edit_pounce_cb(GtkWidget *w, GaimPounce *pounce)
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
683 {
5907
18486c860a46 [gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents: 5877
diff changeset
684 gaim_gtkpounce_dialog_show(NULL, NULL, pounce);
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
685 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
686
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
687 static void
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
688 fill_menu(GtkWidget *menu, GCallback cb)
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
689 {
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
690 GtkWidget *image;
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
691 GtkWidget *item;
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
692 GdkPixbuf *pixbuf, *scale;
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
693 GaimPounce *pounce;
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
694 const char *buddy;
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
695 GList *bp;
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
696
5866
d6b5cab288bb [gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents: 5864
diff changeset
697 for (bp = gaim_pounces_get_all(); bp != NULL; bp = bp->next) {
5857
2fa4aa9c1885 [gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
698 pounce = (GaimPounce *)bp->data;
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
699 buddy = gaim_pounce_get_pouncee(pounce);
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
700
5161
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
701 /* Build the menu item */
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
702 item = gtk_image_menu_item_new_with_label(buddy);
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
703
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
704 /* Create a pixmap for the protocol icon. */
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
705 pixbuf = create_prpl_icon(gaim_pounce_get_pouncer(pounce));
5161
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
706 if(pixbuf) {
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
707 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16,
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
708 GDK_INTERP_BILINEAR);
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
709
5161
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
710 /* Now convert it to GtkImage */
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
711 image = gtk_image_new_from_pixbuf(scale);
5161
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
712 g_object_unref(G_OBJECT(scale));
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
713 g_object_unref(G_OBJECT(pixbuf));
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
714 gtk_widget_show(image);
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
715 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
716 }
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
717
5161
777f56b95a92 [gaim-migrate @ 5525]
Nathan Walp <nwalp@pidgin.im>
parents: 5158
diff changeset
718 /* Put the item in the menu */
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
719 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
720 gtk_widget_show(item);
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
721
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
722 /* Set our callbacks. */
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
723 g_signal_connect(G_OBJECT(item), "activate", cb, pounce);
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
724 }
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
725 }
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
726
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
727 void
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
728 gaim_gtkpounce_menu_build(GtkWidget *menu)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
729 {
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
730 GtkWidget *remmenu;
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
731 GtkWidget *item;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
732 GList *l;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
733
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
734 for (l = gtk_container_get_children(GTK_CONTAINER(menu));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
735 l != NULL;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
736 l = l->next) {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
737
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
738 gtk_widget_destroy(GTK_WIDGET(l->data));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
739 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
740
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
741 /* "New Buddy Pounce" */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
742 item = gtk_menu_item_new_with_label(_("New Buddy Pounce"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
743 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
744 gtk_widget_show(item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
745 g_signal_connect(G_OBJECT(item), "activate",
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
746 G_CALLBACK(new_pounce_cb), NULL);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
747
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
748 /* "Remove Buddy Pounce" */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
749 item = gtk_menu_item_new_with_label(_("Remove Buddy Pounce"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
750 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
751
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
752 /* "Remove Buddy Pounce" menu */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
753 remmenu = gtk_menu_new();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
754
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
755 fill_menu(remmenu, G_CALLBACK(delete_pounce_cb));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
756
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
757 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), remmenu);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
758 gtk_widget_show(remmenu);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
759 gtk_widget_show(item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
760
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
761 /* Separator */
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
762 item = gtk_separator_menu_item_new();
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
763 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
764 gtk_widget_show(item);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
765
5153
ab0f12de3718 [gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents: 5054
diff changeset
766 fill_menu(menu, G_CALLBACK(edit_pounce_cb));
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
767 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
768
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
769 static void
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
770 pounce_cb(GaimPounce *pounce, GaimPounceEvent events, void *data)
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
771 {
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
772 GaimConversation *conv;
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
773 GaimAccount *account;
7994
d5874c4f19c5 [gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents: 7276
diff changeset
774 GaimBuddy *buddy;
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
775 const char *pouncee;
7994
d5874c4f19c5 [gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents: 7276
diff changeset
776 const char *alias;
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
777
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
778 pouncee = gaim_pounce_get_pouncee(pounce);
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
779 account = gaim_pounce_get_pouncer(pounce);
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
780
7994
d5874c4f19c5 [gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents: 7276
diff changeset
781 buddy = gaim_find_buddy(account, pouncee);
d5874c4f19c5 [gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents: 7276
diff changeset
782
d5874c4f19c5 [gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents: 7276
diff changeset
783 alias = gaim_get_buddy_alias(buddy);
d5874c4f19c5 [gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents: 7276
diff changeset
784
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
785 if (gaim_pounce_action_is_enabled(pounce, "open-window")) {
6640
314111e7b601 [gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents: 6621
diff changeset
786 conv = gaim_find_conversation_with_account(pouncee, account);
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
787
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
788 if (conv == NULL)
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
789 conv = gaim_conversation_new(GAIM_CONV_IM, account, pouncee);
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
790 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
791
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
792 if (gaim_pounce_action_is_enabled(pounce, "popup-notify")) {
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
793 char tmp[1024];
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
794
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
795 g_snprintf(tmp, sizeof(tmp),
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
796 (events & GAIM_POUNCE_TYPING) ? _("%s has started typing to you") :
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
797 (events & GAIM_POUNCE_SIGNON) ? _("%s has signed on") :
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
798 (events & GAIM_POUNCE_IDLE_RETURN) ? _("%s has returned from being idle") :
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
799 (events & GAIM_POUNCE_AWAY_RETURN) ? _("%s has returned from being away") :
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
800 (events & GAIM_POUNCE_TYPING_STOPPED) ? _("%s has stopped typing to you") :
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
801 (events & GAIM_POUNCE_SIGNOFF) ? _("%s has signed off") :
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
802 (events & GAIM_POUNCE_IDLE) ? _("%s has become idle") :
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
803 (events & GAIM_POUNCE_AWAY) ? _("%s has gone away.") :
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
804 _("Unknown pounce event. Please report this!"),
7994
d5874c4f19c5 [gaim-migrate @ 8671]
Christian Hammond <chipx86@chipx86.com>
parents: 7276
diff changeset
805 alias);
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
806
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
807 gaim_notify_info(NULL, NULL, tmp, NULL);
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
808 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
809
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
810 if (gaim_pounce_action_is_enabled(pounce, "send-message")) {
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
811 const char *message;
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
812
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
813 message = gaim_pounce_action_get_attribute(pounce, "send-message",
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
814 "message");
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
815
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
816 if (message != NULL) {
6640
314111e7b601 [gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents: 6621
diff changeset
817 conv = gaim_find_conversation_with_account(pouncee, account);
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
818
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
819 if (conv == NULL)
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
820 conv = gaim_conversation_new(GAIM_CONV_IM, account, pouncee);
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
821
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6695
diff changeset
822 gaim_conversation_write(conv, NULL, message,
6621
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6444
diff changeset
823 GAIM_MESSAGE_SEND, time(NULL));
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
824
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6695
diff changeset
825 serv_send_im(account->gc, (char *)pouncee, (char *)message, 0);
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
826 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
827 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
828
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
829 if (gaim_pounce_action_is_enabled(pounce, "execute-command")) {
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
830 const char *command;
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
831
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
832 command = gaim_pounce_action_get_attribute(pounce, "execute-command",
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
833 "command");
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
834
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
835 if (command != NULL) {
6660
48a31082bf5f [gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6646
diff changeset
836 #ifndef _WIN32
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
837 int pid = fork();
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
838
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
839 if (pid == 0) {
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
840 char *args[4];
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
841
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
842 args[0] = "sh";
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
843 args[1] = "-c";
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
844 args[2] = (char *)command;
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
845 args[3] = NULL;
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
846
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
847 execvp(args[0], args);
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
848
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
849 _exit(0);
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
850 }
6660
48a31082bf5f [gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6646
diff changeset
851 #else
48a31082bf5f [gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6646
diff changeset
852 STARTUPINFO StartInfo;
48a31082bf5f [gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6646
diff changeset
853 PROCESS_INFORMATION ProcInfo;
48a31082bf5f [gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6646
diff changeset
854
48a31082bf5f [gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6646
diff changeset
855 memset(&ProcInfo, 0, sizeof(ProcInfo));
48a31082bf5f [gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6646
diff changeset
856 memset(&StartInfo, 0 , sizeof(StartInfo));
48a31082bf5f [gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6646
diff changeset
857 StartInfo.cb = sizeof(StartInfo);
48a31082bf5f [gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6646
diff changeset
858 CreateProcess(NULL, (char *)command, NULL, NULL, 0, 0, NULL, NULL, &StartInfo, &ProcInfo);
7276
29c0fe160f90 [gaim-migrate @ 7855]
Christian Hammond <chipx86@chipx86.com>
parents: 7098
diff changeset
859 gaim_debug_info("pounce",
29c0fe160f90 [gaim-migrate @ 7855]
Christian Hammond <chipx86@chipx86.com>
parents: 7098
diff changeset
860 "Pounce execute command called for: %s\n",
29c0fe160f90 [gaim-migrate @ 7855]
Christian Hammond <chipx86@chipx86.com>
parents: 7098
diff changeset
861 command);
6660
48a31082bf5f [gaim-migrate @ 7185]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6646
diff changeset
862 #endif
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
863 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
864 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
865
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
866 if (gaim_pounce_action_is_enabled(pounce, "play-sound")) {
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
867 const char *sound;
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
868
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
869 sound = gaim_pounce_action_get_attribute(pounce, "play-sound",
6444
601c2a52d74a [gaim-migrate @ 6953]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
870 "filename");
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
871
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
872 if (sound != NULL)
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
873 gaim_sound_play_file(sound);
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
874 else
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
875 gaim_sound_play_event(GAIM_SOUND_POUNCE_DEFAULT);
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
876 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
877 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
878
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
879 static void
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
880 free_pounce(GaimPounce *pounce)
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
881 {
7098
770233dad86c [gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
882 GaimBuddyList *blist;
770233dad86c [gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
883 GaimGtkBuddyList *gtkblist;
5875
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
884
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
885 /* Rebuild the pounce menu */
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
886 blist = gaim_get_blist();
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
887
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
888 if (GAIM_IS_GTK_BLIST(blist))
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
889 {
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
890 gtkblist = GAIM_GTK_BLIST(blist);
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
891
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
892 gaim_gtkpounce_menu_build(gtkblist->bpmenu);
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
893 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
894 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
895
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
896 static void
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
897 new_pounce(GaimPounce *pounce)
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
898 {
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
899 gaim_pounce_action_register(pounce, "open-window");
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
900 gaim_pounce_action_register(pounce, "popup-notify");
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
901 gaim_pounce_action_register(pounce, "send-message");
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
902 gaim_pounce_action_register(pounce, "execute-command");
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
903 gaim_pounce_action_register(pounce, "play-sound");
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
904 }
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
905
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
906 void
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
907 gaim_gtk_pounces_init(void)
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
908 {
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
909 gaim_pounces_register_handler(GAIM_GTK_UI, pounce_cb, new_pounce,
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
910 free_pounce);
448f2f4ca3ec [gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
911 }