annotate src/gtkpounce.c @ 6587:ed11e3f8ba21

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