annotate src/gtkpounce.c @ 5717:1d140b31d4b3

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