annotate finch/gntpounce.c @ 31106:a063e2a804ff

ChangeLog the previous patch. Refs #12758.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Sat, 08 Jan 2011 02:16:41 +0000
parents 259bbfb423d4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * @file gntpounce.c GNT Buddy Pounce API
16194
0f0832c13fcb Rename the Doxygen group from gntui to finch and define the finch group
Richard Laager <rlaager@wiktel.com>
parents: 15870
diff changeset
3 * @ingroup finch
20074
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19681
diff changeset
4 */
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19681
diff changeset
5
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19681
diff changeset
6 /* finch
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
15870
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
8 * Finch is the legal property of its developers, whose names are too numerous
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * source distribution.
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 *
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * (at your option) any later version.
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 *
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * GNU General Public License for more details.
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 *
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
19681
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19374
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 *
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 */
28770
259bbfb423d4 Fix all the remaining files for which internal.h doesn't end up being the first include.
Paul Aurich <paul@darkrain42.org>
parents: 27587
diff changeset
27 #include <internal.h>
259bbfb423d4 Fix all the remaining files for which internal.h doesn't end up being the first include.
Paul Aurich <paul@darkrain42.org>
parents: 27587
diff changeset
28
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include <gnt.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include <gntbox.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include <gntbutton.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include <gntcheckbox.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include <gntcombobox.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #include <gntentry.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 #include <gntlabel.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 #include <gntline.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 #include <gnttree.h>
18511
7ee0e0597a26 Add utility function to trigger some button when some key is pressed with
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18345
diff changeset
38 #include <gntutils.h>
7ee0e0597a26 Add utility function to trigger some button when some key is pressed with
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18345
diff changeset
39
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
40 #include "finch.h"
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41
26347
1c73d2ef9ddc Remove some extra edits that snuck into Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24943
diff changeset
42 #include "account.h"
1c73d2ef9ddc Remove some extra edits that snuck into Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24943
diff changeset
43 #include "conversation.h"
1c73d2ef9ddc Remove some extra edits that snuck into Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24943
diff changeset
44 #include "debug.h"
1c73d2ef9ddc Remove some extra edits that snuck into Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24943
diff changeset
45 #include "notify.h"
1c73d2ef9ddc Remove some extra edits that snuck into Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24943
diff changeset
46 #include "prpl.h"
1c73d2ef9ddc Remove some extra edits that snuck into Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24943
diff changeset
47 #include "request.h"
1c73d2ef9ddc Remove some extra edits that snuck into Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24943
diff changeset
48 #include "server.h"
1c73d2ef9ddc Remove some extra edits that snuck into Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24943
diff changeset
49 #include "util.h"
1c73d2ef9ddc Remove some extra edits that snuck into Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24943
diff changeset
50
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 #include "gntpounce.h"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 typedef struct
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 /* Pounce data */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
57 PurplePounce *pounce;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
58 PurpleAccount *account;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 /* The window */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 GntWidget *window;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63 /* Pounce on Whom */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 GntWidget *account_menu;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 GntWidget *buddy_entry;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67 /* Pounce options */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68 GntWidget *on_away;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70 /* Pounce When Buddy... */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 GntWidget *signon;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 GntWidget *signoff;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 GntWidget *away;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 GntWidget *away_return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 GntWidget *idle;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 GntWidget *idle_return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 GntWidget *typing;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 GntWidget *typed;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 GntWidget *stop_typing;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 GntWidget *message_recv;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 /* Action */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 GntWidget *open_win;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 GntWidget *popup;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 GntWidget *popup_entry;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 GntWidget *send_msg;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 GntWidget *send_msg_entry;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 GntWidget *exec_cmd;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 GntWidget *exec_cmd_entry;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 GntWidget *play_sound;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 GntWidget *save_pounce;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 /* Buttons */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 GntWidget *save_button;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
97 } PurpleGntPounceDialog;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 typedef struct
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 GntWidget *window;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 GntWidget *tree;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 GntWidget *modify_button;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 GntWidget *delete_button;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 } PouncesManager;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 static PouncesManager *pounces_manager = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 /**************************************************************************
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 * Callbacks
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 **************************************************************************/
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 static gint
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
113 delete_win_cb(GntWidget *w, PurpleGntPounceDialog *dialog)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 gnt_widget_destroy(dialog->window);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 g_free(dialog);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
122 cancel_cb(GntWidget *w, PurpleGntPounceDialog *dialog)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 gnt_widget_destroy(dialog->window);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
128 add_pounce_to_treeview(GntTree *tree, PurplePounce *pounce)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
130 PurpleAccount *account;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 const char *pouncer;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 const char *pouncee;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
134 account = purple_pounce_get_pouncer(pounce);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
135 pouncer = purple_account_get_username(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
136 pouncee = purple_pounce_get_pouncee(pounce);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 gnt_tree_add_row_last(tree, pounce,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 gnt_tree_create_row(tree, pouncer, pouncee), NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 populate_pounces_list(PouncesManager *dialog)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 {
18118
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18063
diff changeset
144 GList *pounces;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 gnt_tree_remove_all(GNT_TREE(dialog->tree));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147
18137
323272a9bb65 Fix #1574. (Pidgin and Finch show each other's pounces, interact in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18118
diff changeset
148 for (pounces = purple_pounces_get_all_for_ui(FINCH_UI); pounces != NULL;
323272a9bb65 Fix #1574. (Pidgin and Finch show each other's pounces, interact in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18118
diff changeset
149 pounces = g_list_delete_link(pounces, pounces))
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 add_pounce_to_treeview(GNT_TREE(dialog->tree), pounces->data);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156 update_pounces(void)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158 /* Rebuild the pounces list if the pounces manager is open */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159 if (pounces_manager != NULL)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
161 populate_pounces_list(pounces_manager);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
166 signed_on_off_cb(PurpleConnection *gc, gpointer user_data)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 update_pounces();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 static void
21279
47118f6062e9 Enable auto-complete in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
172 setup_buddy_list_suggestion(GntEntry *entry, gboolean offline)
47118f6062e9 Enable auto-complete in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
173 {
47118f6062e9 Enable auto-complete in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
174 PurpleBlistNode *node = purple_blist_get_root();
47118f6062e9 Enable auto-complete in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
175 for (; node; node = purple_blist_node_next(node, offline)) {
47118f6062e9 Enable auto-complete in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
176 if (!PURPLE_BLIST_NODE_IS_BUDDY(node))
47118f6062e9 Enable auto-complete in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
177 continue;
47118f6062e9 Enable auto-complete in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
178 gnt_entry_add_suggest(entry, purple_buddy_get_name((PurpleBuddy*)node));
47118f6062e9 Enable auto-complete in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
179 }
47118f6062e9 Enable auto-complete in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
180 }
47118f6062e9 Enable auto-complete in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
181
47118f6062e9 Enable auto-complete in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
182 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
183 save_pounce_cb(GntWidget *w, PurpleGntPounceDialog *dialog)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 const char *name;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 const char *message, *command, *reason;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
187 PurplePounceEvent events = PURPLE_POUNCE_NONE;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
188 PurplePounceOption options = PURPLE_POUNCE_OPTION_NONE;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 name = gnt_entry_get_text(GNT_ENTRY(dialog->buddy_entry));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 if (*name == '\0')
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
194 purple_notify_error(NULL, NULL,
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 _("Please enter a buddy to pounce."), NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 /* Options */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->on_away)))
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
201 options |= PURPLE_POUNCE_OPTION_AWAY;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 /* Events */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204 if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->signon)))
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
205 events |= PURPLE_POUNCE_SIGNON;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207 if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->signoff)))
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
208 events |= PURPLE_POUNCE_SIGNOFF;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->away)))
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
211 events |= PURPLE_POUNCE_AWAY;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->away_return)))
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
214 events |= PURPLE_POUNCE_AWAY_RETURN;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->idle)))
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
217 events |= PURPLE_POUNCE_IDLE;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->idle_return)))
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
220 events |= PURPLE_POUNCE_IDLE_RETURN;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->typing)))
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
223 events |= PURPLE_POUNCE_TYPING;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->typed)))
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
226 events |= PURPLE_POUNCE_TYPED;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->stop_typing)))
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
229 events |= PURPLE_POUNCE_TYPING_STOPPED;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
231 if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->message_recv)))
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
232 events |= PURPLE_POUNCE_MESSAGE_RECEIVED;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 /* Data fields */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 message = gnt_entry_get_text(GNT_ENTRY(dialog->send_msg_entry));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 command = gnt_entry_get_text(GNT_ENTRY(dialog->exec_cmd_entry));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 reason = gnt_entry_get_text(GNT_ENTRY(dialog->popup_entry));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 if (*reason == '\0') reason = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 if (*message == '\0') message = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241 if (*command == '\0') command = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 if (dialog->pounce == NULL) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
244 dialog->pounce = purple_pounce_new(FINCH_UI, dialog->account,
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245 name, events, options);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246 } else {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
247 purple_pounce_set_events(dialog->pounce, events);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
248 purple_pounce_set_options(dialog->pounce, options);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
249 purple_pounce_set_pouncer(dialog->pounce, dialog->account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
250 purple_pounce_set_pouncee(dialog->pounce, name);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253 /* Actions */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
254 purple_pounce_action_set_enabled(dialog->pounce, "open-window",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->open_win)));
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
256 purple_pounce_action_set_enabled(dialog->pounce, "popup-notify",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->popup)));
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
258 purple_pounce_action_set_enabled(dialog->pounce, "send-message",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->send_msg)));
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
260 purple_pounce_action_set_enabled(dialog->pounce, "execute-command",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->exec_cmd)));
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
262 purple_pounce_action_set_enabled(dialog->pounce, "play-beep",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->play_sound)));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
265 purple_pounce_action_set_attribute(dialog->pounce, "send-message",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 "message", message);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
267 purple_pounce_action_set_attribute(dialog->pounce, "execute-command",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 "command", command);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
269 purple_pounce_action_set_attribute(dialog->pounce, "popup-notify",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 "reason", reason);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 /* Set the defaults for next time. */
16424
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16287
diff changeset
273 purple_prefs_set_bool("/finch/pounces/default_actions/open-window",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->open_win)));
16424
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16287
diff changeset
275 purple_prefs_set_bool("/finch/pounces/default_actions/popup-notify",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->popup)));
16424
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16287
diff changeset
277 purple_prefs_set_bool("/finch/pounces/default_actions/send-message",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->send_msg)));
16424
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16287
diff changeset
279 purple_prefs_set_bool("/finch/pounces/default_actions/execute-command",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->exec_cmd)));
16424
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16287
diff changeset
281 purple_prefs_set_bool("/finch/pounces/default_actions/play-beep",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->play_sound)));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
284 purple_pounce_set_save(dialog->pounce,
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285 gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->save_pounce)));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
287 purple_pounce_set_pouncer(dialog->pounce,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
288 (PurpleAccount *)gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->account_menu)));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290 update_pounces();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292 gnt_widget_destroy(dialog->window);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
297 finch_pounce_editor_show(PurpleAccount *account, const char *name,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
298 PurplePounce *cur_pounce)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
300 PurpleGntPounceDialog *dialog;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 GntWidget *window;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 GntWidget *bbox;
16287
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
303 GntWidget *hbox, *vbox;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304 GntWidget *button;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305 GntWidget *combo;
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
306 GList *list;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 g_return_if_fail((cur_pounce != NULL) ||
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 (account != NULL) ||
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
310 (purple_accounts_get_all() != NULL));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
312 dialog = g_new0(PurpleGntPounceDialog, 1);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314 if (cur_pounce != NULL) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315 dialog->pounce = cur_pounce;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
316 dialog->account = purple_pounce_get_pouncer(cur_pounce);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 } else if (account != NULL) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318 dialog->pounce = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319 dialog->account = account;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
320 } else {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
321 GList *connections = purple_connections_get_all();
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
322 PurpleConnection *gc;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324 if (connections != NULL) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
325 gc = (PurpleConnection *)connections->data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
326 dialog->account = purple_connection_get_account(gc);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327 } else
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
328 dialog->account = purple_accounts_get_all()->data;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
330 dialog->pounce = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
333 /* Create the window. */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334 dialog->window = window = gnt_vbox_new(FALSE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335 gnt_box_set_pad(GNT_BOX(window), 0);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
336 gnt_box_set_toplevel(GNT_BOX(window), TRUE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_LEFT);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
338 gnt_box_set_title(GNT_BOX(window),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339 (cur_pounce == NULL
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
340 ? _("New Buddy Pounce") : _("Edit Buddy Pounce")));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342 g_signal_connect(G_OBJECT(window), "destroy",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 G_CALLBACK(delete_win_cb), dialog);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345 gnt_box_add_widget(GNT_BOX(window), gnt_label_new_with_format(_("Pounce Who"), GNT_TEXT_FLAG_BOLD));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347 /* Account: */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348 gnt_box_add_widget(GNT_BOX(window), gnt_label_new(_("Account:")));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
349 dialog->account_menu = combo = gnt_combo_box_new();
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
350 list = purple_accounts_get_all();
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
351 for (; list; list = list->next)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
353 PurpleAccount *account;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354 char *text;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
355
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
356 account = list->data;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
357 text = g_strdup_printf("%s (%s)",
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
358 purple_account_get_username(account),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
359 purple_account_get_protocol_name(account));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
360 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), account, text);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
361 g_free(text);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
362 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363 if (dialog->account)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
364 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), dialog->account);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366 gnt_box_add_widget(GNT_BOX(window), combo);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 /* Buddy: */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 hbox = gnt_hbox_new(FALSE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Buddy name:")));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372 dialog->buddy_entry = gnt_entry_new(NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373 gnt_box_add_widget(GNT_BOX(hbox), dialog->buddy_entry);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374
21279
47118f6062e9 Enable auto-complete in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
375 setup_buddy_list_suggestion(GNT_ENTRY(dialog->buddy_entry), TRUE);
47118f6062e9 Enable auto-complete in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21244
diff changeset
376
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377 gnt_box_add_widget(GNT_BOX(window), hbox);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
378
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 if (cur_pounce != NULL) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380 gnt_entry_set_text(GNT_ENTRY(dialog->buddy_entry),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
381 purple_pounce_get_pouncee(cur_pounce));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382 } else if (name != NULL) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383 gnt_entry_set_text(GNT_ENTRY(dialog->buddy_entry), name);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385
16287
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
386 /* Create the event frame */
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
387 gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388 gnt_box_add_widget(GNT_BOX(window), gnt_label_new_with_format(_("Pounce When Buddy..."), GNT_TEXT_FLAG_BOLD));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
389
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390 dialog->signon = gnt_check_box_new(_("Signs on"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391 dialog->signoff = gnt_check_box_new(_("Signs off"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392 dialog->away = gnt_check_box_new(_("Goes away"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 dialog->away_return = gnt_check_box_new(_("Returns from away"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394 dialog->idle = gnt_check_box_new(_("Becomes idle"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
395 dialog->idle_return = gnt_check_box_new(_("Is no longer idle"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396 dialog->typing = gnt_check_box_new(_("Starts typing"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
397 dialog->typed = gnt_check_box_new(_("Pauses while typing"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
398 dialog->stop_typing = gnt_check_box_new(_("Stops typing"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399 dialog->message_recv = gnt_check_box_new(_("Sends a message"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
400
16287
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
401 hbox = gnt_hbox_new(TRUE);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402 gnt_box_set_pad(GNT_BOX(hbox), 2);
16287
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
403
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
404 vbox = gnt_vbox_new(FALSE);
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
405 gnt_box_set_pad(GNT_BOX(vbox), 0);
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
406 gnt_box_add_widget(GNT_BOX(hbox), vbox);
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
407
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
408 gnt_box_add_widget(GNT_BOX(vbox), dialog->signon);
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
409 gnt_box_add_widget(GNT_BOX(vbox), dialog->away);
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
410 gnt_box_add_widget(GNT_BOX(vbox), dialog->idle);
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
411 gnt_box_add_widget(GNT_BOX(vbox), dialog->typing);
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
412 gnt_box_add_widget(GNT_BOX(vbox), dialog->stop_typing);
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
413
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
414 vbox = gnt_vbox_new(FALSE);
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
415 gnt_box_set_pad(GNT_BOX(vbox), 0);
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
416 gnt_box_add_widget(GNT_BOX(hbox), vbox);
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
417
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
418 gnt_box_add_widget(GNT_BOX(vbox), dialog->signoff);
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
419 gnt_box_add_widget(GNT_BOX(vbox), dialog->away_return);
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
420 gnt_box_add_widget(GNT_BOX(vbox), dialog->idle_return);
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
421 gnt_box_add_widget(GNT_BOX(vbox), dialog->typed);
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
422 gnt_box_add_widget(GNT_BOX(vbox), dialog->message_recv);
776bf7979b4f Line up the event-checkboxes in the pounce dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16194
diff changeset
423
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 gnt_box_add_widget(GNT_BOX(window), hbox);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 /* Create the "Action" frame. */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 gnt_box_add_widget(GNT_BOX(window), gnt_label_new_with_format(_("Action"), GNT_TEXT_FLAG_BOLD));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430 dialog->open_win = gnt_check_box_new(_("Open an IM window"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431 dialog->popup = gnt_check_box_new(_("Pop up a notification"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432 dialog->send_msg = gnt_check_box_new(_("Send a message"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433 dialog->exec_cmd = gnt_check_box_new(_("Execute a command"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434 dialog->play_sound = gnt_check_box_new(_("Play a sound"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436 dialog->send_msg_entry = gnt_entry_new(NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437 dialog->exec_cmd_entry = gnt_entry_new(NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438 dialog->popup_entry = gnt_entry_new(NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
439 dialog->exec_cmd_entry = gnt_entry_new(NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441 hbox = gnt_hbox_new(FALSE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442 gnt_box_add_widget(GNT_BOX(hbox), dialog->open_win);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
443 gnt_box_add_widget(GNT_BOX(window), hbox);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444 hbox = gnt_hbox_new(FALSE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445 gnt_box_add_widget(GNT_BOX(hbox), dialog->popup);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 gnt_box_add_widget(GNT_BOX(hbox), dialog->popup_entry);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
447 gnt_box_add_widget(GNT_BOX(window), hbox);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448 hbox = gnt_hbox_new(FALSE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 gnt_box_add_widget(GNT_BOX(hbox), dialog->send_msg);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 gnt_box_add_widget(GNT_BOX(hbox), dialog->send_msg_entry);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 gnt_box_add_widget(GNT_BOX(window), hbox);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452 hbox = gnt_hbox_new(FALSE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 gnt_box_add_widget(GNT_BOX(hbox), dialog->exec_cmd);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454 gnt_box_add_widget(GNT_BOX(hbox), dialog->exec_cmd_entry);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455 gnt_box_add_widget(GNT_BOX(window), hbox);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456 hbox = gnt_hbox_new(FALSE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457 gnt_box_add_widget(GNT_BOX(hbox), dialog->play_sound);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
458 gnt_box_add_widget(GNT_BOX(window), hbox);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460 gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461 gnt_box_add_widget(GNT_BOX(window), gnt_label_new_with_format(_("Options"), GNT_TEXT_FLAG_BOLD));
22249
876ae8ce12d6 Make this clearer
Richard Nelson <wabz@pidgin.im>
parents: 22218
diff changeset
462 dialog->on_away = gnt_check_box_new(_("Pounce only when my status is not Available"));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463 gnt_box_add_widget(GNT_BOX(window), dialog->on_away);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 dialog->save_pounce = gnt_check_box_new(_("Recurring"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 gnt_box_add_widget(GNT_BOX(window), dialog->save_pounce);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468 gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 /* Now the button box! */
19374
d65ce3df5be2 Make some of the dialogs look and behave more like each other.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18511
diff changeset
470 bbox = gnt_hbox_new(FALSE);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472 /* Cancel button */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473 button = gnt_button_new(_("Cancel"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474 gnt_box_add_widget(GNT_BOX(bbox), button);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
475 g_signal_connect(G_OBJECT(button), "activate",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
476 G_CALLBACK(cancel_cb), dialog);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
478 /* Save button */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 dialog->save_button = button = gnt_button_new(_("Save"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480 gnt_box_add_widget(GNT_BOX(bbox), button);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481 g_signal_connect(G_OBJECT(button), "activate",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 G_CALLBACK(save_pounce_cb), dialog);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
483
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484 gnt_box_add_widget(GNT_BOX(window), bbox);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
487 /* Set the values of stuff. */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
488 if (cur_pounce != NULL)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
490 PurplePounceEvent events = purple_pounce_get_events(cur_pounce);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
491 PurplePounceOption options = purple_pounce_get_options(cur_pounce);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
492 const char *value;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
494 /* Options */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
495 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->on_away),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
496 (options & PURPLE_POUNCE_OPTION_AWAY));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 /* Events */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
499 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->signon),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
500 (events & PURPLE_POUNCE_SIGNON));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->signoff),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
502 (events & PURPLE_POUNCE_SIGNOFF));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
503 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->away),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
504 (events & PURPLE_POUNCE_AWAY));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
505 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->away_return),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
506 (events & PURPLE_POUNCE_AWAY_RETURN));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
507 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->idle),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
508 (events & PURPLE_POUNCE_IDLE));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->idle_return),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
510 (events & PURPLE_POUNCE_IDLE_RETURN));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->typing),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
512 (events & PURPLE_POUNCE_TYPING));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->typed),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
514 (events & PURPLE_POUNCE_TYPED));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->stop_typing),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
516 (events & PURPLE_POUNCE_TYPING_STOPPED));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->message_recv),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
518 (events & PURPLE_POUNCE_MESSAGE_RECEIVED));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520 /* Actions */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->open_win),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
522 purple_pounce_action_is_enabled(cur_pounce, "open-window"));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
523 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->popup),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
524 purple_pounce_action_is_enabled(cur_pounce, "popup-notify"));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->send_msg),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
526 purple_pounce_action_is_enabled(cur_pounce, "send-message"));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->exec_cmd),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
528 purple_pounce_action_is_enabled(cur_pounce, "execute-command"));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
529 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->play_sound),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
530 purple_pounce_action_is_enabled(cur_pounce, "play-beep"));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
531
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
532 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->save_pounce),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
533 purple_pounce_get_save(cur_pounce));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
535 if ((value = purple_pounce_action_get_attribute(cur_pounce,
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536 "send-message",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537 "message")) != NULL)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539 gnt_entry_set_text(GNT_ENTRY(dialog->send_msg_entry), value);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
542 if ((value = purple_pounce_action_get_attribute(cur_pounce,
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543 "popup-notify",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 "reason")) != NULL)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546 gnt_entry_set_text(GNT_ENTRY(dialog->popup_entry), value);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
549 if ((value = purple_pounce_action_get_attribute(cur_pounce,
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
550 "execute-command",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551 "command")) != NULL)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553 gnt_entry_set_text(GNT_ENTRY(dialog->exec_cmd_entry), value);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
554 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556 else
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
558 PurpleBuddy *buddy = NULL;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560 if (name != NULL)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
561 buddy = purple_find_buddy(account, name);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
563 /* Set some defaults */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564 if (buddy == NULL) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565 gnt_check_box_set_checked(
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
566 GNT_CHECK_BOX(dialog->signon), TRUE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567 } else {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
568 if (!PURPLE_BUDDY_IS_ONLINE(buddy)) {
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
569 gnt_check_box_set_checked(
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570 GNT_CHECK_BOX(dialog->signon), TRUE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
571 } else {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572 gboolean default_set = FALSE;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
573 PurplePresence *presence = purple_buddy_get_presence(buddy);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
574
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
575 if (purple_presence_is_idle(presence))
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577 gnt_check_box_set_checked(
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578 GNT_CHECK_BOX(dialog->idle_return), TRUE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
579
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580 default_set = TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
582
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
583 if (!purple_presence_is_available(presence))
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
584 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
585 gnt_check_box_set_checked(
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
586 GNT_CHECK_BOX(dialog->away_return), TRUE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
587
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
588 default_set = TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
590
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
591 if (!default_set)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
592 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
593 gnt_check_box_set_checked(
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594 GNT_CHECK_BOX(dialog->signon), TRUE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
595 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
596 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
598
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
599 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->open_win),
16424
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16287
diff changeset
600 purple_prefs_get_bool("/finch/pounces/default_actions/open-window"));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
601 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->popup),
16424
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16287
diff changeset
602 purple_prefs_get_bool("/finch/pounces/default_actions/popup-notify"));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
603 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->send_msg),
16424
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16287
diff changeset
604 purple_prefs_get_bool("/finch/pounces/default_actions/send-message"));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
605 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->exec_cmd),
16424
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16287
diff changeset
606 purple_prefs_get_bool("/finch/pounces/default_actions/execute-command"));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607 gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->play_sound),
16424
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16287
diff changeset
608 purple_prefs_get_bool("/finch/pounces/default_actions/play-beep"));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
609 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
610
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611 gnt_widget_show(window);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
612 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
613
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
614
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
615
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
616 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
617 pounces_manager_destroy_cb(GntWidget *widget, gpointer user_data)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
618 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
619 PouncesManager *dialog = user_data;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
620
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
621 dialog->window = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
622 finch_pounces_manager_hide();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
623
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
624 return FALSE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
625 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
626
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
627
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
628 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
629 pounces_manager_add_cb(GntButton *button, gpointer user_data)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
630 {
19374
d65ce3df5be2 Make some of the dialogs look and behave more like each other.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18511
diff changeset
631 if (purple_accounts_get_all() == NULL) {
d65ce3df5be2 Make some of the dialogs look and behave more like each other.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18511
diff changeset
632 purple_notify_error(NULL, _("Cannot create pounce"),
d65ce3df5be2 Make some of the dialogs look and behave more like each other.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18511
diff changeset
633 _("You do not have any accounts."),
d65ce3df5be2 Make some of the dialogs look and behave more like each other.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18511
diff changeset
634 _("You must create an account first before you can create a pounce."));
d65ce3df5be2 Make some of the dialogs look and behave more like each other.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18511
diff changeset
635 return;
d65ce3df5be2 Make some of the dialogs look and behave more like each other.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18511
diff changeset
636 }
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
637 finch_pounce_editor_show(NULL, NULL, NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
638 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
639
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
640
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
641 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
642 pounces_manager_modify_cb(GntButton *button, gpointer user_data)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
643 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
644 PouncesManager *dialog = user_data;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
645 PurplePounce *pounce = gnt_tree_get_selection_data(GNT_TREE(dialog->tree));
19374
d65ce3df5be2 Make some of the dialogs look and behave more like each other.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18511
diff changeset
646 if (pounce)
d65ce3df5be2 Make some of the dialogs look and behave more like each other.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18511
diff changeset
647 finch_pounce_editor_show(NULL, NULL, pounce);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
648 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
649
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
650 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
651 pounces_manager_delete_confirm_cb(PurplePounce *pounce)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
653 gnt_tree_remove(GNT_TREE(pounces_manager->tree), pounce);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
654
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
655 purple_request_close_with_handle(pounce);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
656 purple_pounce_destroy(pounce);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
657 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
658
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
659
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
660 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
661 pounces_manager_delete_cb(GntButton *button, gpointer user_data)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
662 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
663 PouncesManager *dialog = user_data;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
664 PurplePounce *pounce;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
665 PurpleAccount *account;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
666 const char *pouncer, *pouncee;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
667 char *buf;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
668
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
669 pounce = (PurplePounce *)gnt_tree_get_selection_data(GNT_TREE(dialog->tree));
19374
d65ce3df5be2 Make some of the dialogs look and behave more like each other.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18511
diff changeset
670 if (pounce == NULL)
d65ce3df5be2 Make some of the dialogs look and behave more like each other.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18511
diff changeset
671 return;
d65ce3df5be2 Make some of the dialogs look and behave more like each other.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18511
diff changeset
672
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
673 account = purple_pounce_get_pouncer(pounce);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
674 pouncer = purple_account_get_username(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
675 pouncee = purple_pounce_get_pouncee(pounce);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
676 buf = g_strdup_printf(_("Are you sure you want to delete the pounce on %s for %s?"), pouncee, pouncer);
16439
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 16424
diff changeset
677 purple_request_action(pounce, NULL, buf, NULL, 0,
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 16424
diff changeset
678 account, pouncee, NULL,
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 16424
diff changeset
679 pounce, 2,
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
680 _("Delete"), pounces_manager_delete_confirm_cb,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
681 _("Cancel"), NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
682 g_free(buf);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
683 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
684
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
685 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
686 pounces_manager_close_cb(GntButton *button, gpointer user_data)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
687 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
688 finch_pounces_manager_hide();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
689 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
690
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
691
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
692 void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
693 finch_pounces_manager_show(void)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
694 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
695 PouncesManager *dialog;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
696 GntWidget *bbox;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
697 GntWidget *button;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
698 GntWidget *tree;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
699 GntWidget *win;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
700
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
701 if (pounces_manager != NULL) {
18345
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18137
diff changeset
702 gnt_window_present(pounces_manager->window);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
703 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
704 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
705
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
706 pounces_manager = dialog = g_new0(PouncesManager, 1);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
707
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
708 dialog->window = win = gnt_vbox_new(FALSE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
709 gnt_box_set_toplevel(GNT_BOX(win), TRUE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
710 gnt_box_set_title(GNT_BOX(win), _("Buddy Pounces"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
711 gnt_box_set_pad(GNT_BOX(win), 0);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
712
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
713 g_signal_connect(G_OBJECT(win), "destroy",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
714 G_CALLBACK(pounces_manager_destroy_cb), dialog);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
715
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
716 /* List of saved buddy pounces */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
717 dialog->tree = tree = GNT_WIDGET(gnt_tree_new_with_columns(2));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718 gnt_tree_set_column_titles(GNT_TREE(tree), "Account", "Pouncee", NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
719 gnt_tree_set_show_title(GNT_TREE(tree), TRUE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
720
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
721 gnt_box_add_widget(GNT_BOX(win), tree);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
722
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
723 /* Button box. */
19374
d65ce3df5be2 Make some of the dialogs look and behave more like each other.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18511
diff changeset
724 bbox = gnt_hbox_new(FALSE);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
725
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
726 /* Add button */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
727 button = gnt_button_new(_("Add"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
728 gnt_box_add_widget(GNT_BOX(bbox), button);
18511
7ee0e0597a26 Add utility function to trigger some button when some key is pressed with
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18345
diff changeset
729 gnt_util_set_trigger_widget(tree, GNT_KEY_INS, button);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
730
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
731 g_signal_connect(G_OBJECT(button), "activate",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
732 G_CALLBACK(pounces_manager_add_cb), dialog);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
733
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
734 /* Modify button */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
735 button = gnt_button_new(_("Modify"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
736 dialog->modify_button = button;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
737 gnt_box_add_widget(GNT_BOX(bbox), button);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
738
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
739 g_signal_connect(G_OBJECT(button), "activate",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
740 G_CALLBACK(pounces_manager_modify_cb), dialog);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
741
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
742 /* Delete button */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
743 button = gnt_button_new(_("Delete"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
744 dialog->delete_button = button;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
745 gnt_box_add_widget(GNT_BOX(bbox), button);
18511
7ee0e0597a26 Add utility function to trigger some button when some key is pressed with
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18345
diff changeset
746 gnt_util_set_trigger_widget(tree, GNT_KEY_DEL, button);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
747
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
748 g_signal_connect(G_OBJECT(button), "activate",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
749 G_CALLBACK(pounces_manager_delete_cb), dialog);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
750
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
751 /* Close button */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
752 button = gnt_button_new(_("Close"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
753 gnt_box_add_widget(GNT_BOX(bbox), button);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
754 gnt_widget_show(button);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
755
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
756 g_signal_connect(G_OBJECT(button), "activate",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
757 G_CALLBACK(pounces_manager_close_cb), dialog);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
758
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
759 gnt_box_add_widget(GNT_BOX(win), bbox);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
760
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
761 gnt_widget_show(win);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
762 populate_pounces_list(pounces_manager);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
763 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
764
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
765 void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
766 finch_pounces_manager_hide(void)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
767 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
768 if (pounces_manager == NULL)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
769 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
770
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
771 if (pounces_manager->window != NULL)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
772 gnt_widget_destroy(pounces_manager->window);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
773
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
774 purple_signals_disconnect_by_handle(pounces_manager);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
775
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
776 g_free(pounces_manager);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
777 pounces_manager = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
778 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
779
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
780 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
781 pounce_cb(PurplePounce *pounce, PurplePounceEvent events, void *data)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
782 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
783 PurpleConversation *conv;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
784 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
785 PurpleBuddy *buddy;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
786 const char *pouncee;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
787 const char *alias;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
788
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
789 pouncee = purple_pounce_get_pouncee(pounce);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
790 account = purple_pounce_get_pouncer(pounce);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
791
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
792 buddy = purple_find_buddy(account, pouncee);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
793 if (buddy != NULL)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
794 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
795 alias = purple_buddy_get_alias(buddy);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
796 if (alias == NULL)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
797 alias = pouncee;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
798 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
799 else
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
800 alias = pouncee;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
801
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
802 if (purple_pounce_action_is_enabled(pounce, "open-window"))
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
803 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
804 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, pouncee, account);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
805
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
806 if (conv == NULL)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
807 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, pouncee);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
808 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
809
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
810 if (purple_pounce_action_is_enabled(pounce, "popup-notify"))
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
811 {
22213
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
812 char *tmp = NULL;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
813 const char *name_shown;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
814 const char *reason;
22213
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
815 struct {
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
816 PurplePounceEvent event;
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
817 const char *format;
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
818 } messages[] = {
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
819 {PURPLE_POUNCE_TYPING, _("%s has started typing to you (%s)")},
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
820 {PURPLE_POUNCE_TYPED, _("%s has paused while typing to you (%s)")},
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
821 {PURPLE_POUNCE_SIGNON, _("%s has signed on (%s)")},
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
822 {PURPLE_POUNCE_IDLE_RETURN, _("%s has returned from being idle (%s)")},
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
823 {PURPLE_POUNCE_AWAY_RETURN, _("%s has returned from being away (%s)")},
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
824 {PURPLE_POUNCE_TYPING_STOPPED, _("%s has stopped typing to you (%s)")},
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
825 {PURPLE_POUNCE_SIGNOFF, _("%s has signed off (%s)")},
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
826 {PURPLE_POUNCE_IDLE, _("%s has become idle (%s)")},
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
827 {PURPLE_POUNCE_AWAY, _("%s has gone away. (%s)")},
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
828 {PURPLE_POUNCE_MESSAGE_RECEIVED, _("%s has sent you a message. (%s)")},
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
829 {0, NULL}
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
830 };
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
831 int i;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
832 reason = purple_pounce_action_get_attribute(pounce, "popup-notify",
22213
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
833 "reason");
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
834
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
835 /*
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
836 * Here we place the protocol name in the pounce dialog to lessen
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
837 * confusion about what protocol a pounce is for.
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
838 */
22213
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
839 for (i = 0; messages[i].format != NULL; i++) {
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
840 if (messages[i].event & events) {
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
841 tmp = g_strdup_printf(messages[i].format, alias,
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
842 purple_account_get_protocol_name(account));
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
843 break;
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
844 }
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
845 }
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
846 if (tmp == NULL)
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
847 tmp = g_strdup(_("Unknown pounce event. Please report this!"));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
848
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
849 /*
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
850 * Ok here is where I change the second argument, title, from
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
851 * NULL to the account alias if we have it or the account
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
852 * name if that's all we have
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
853 */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
854 if ((name_shown = purple_account_get_alias(account)) == NULL)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
855 name_shown = purple_account_get_username(account);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
856
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
857 if (reason == NULL)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
858 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
859 purple_notify_info(NULL, name_shown, tmp, purple_date_format_full(NULL));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
860 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
861 else
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
862 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
863 char *tmp2 = g_strdup_printf("%s\n\n%s", reason, purple_date_format_full(NULL));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
864 purple_notify_info(NULL, name_shown, tmp, tmp2);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
865 g_free(tmp2);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
866 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
867 g_free(tmp);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
868 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
869
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
870 if (purple_pounce_action_is_enabled(pounce, "send-message"))
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
871 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
872 const char *message;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
873
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
874 message = purple_pounce_action_get_attribute(pounce, "send-message",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
875 "message");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
876
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
877 if (message != NULL)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
878 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
879 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, pouncee, account);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
880
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
881 if (conv == NULL)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
882 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, pouncee);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
883
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
884 purple_conversation_write(conv, NULL, message,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
885 PURPLE_MESSAGE_SEND, time(NULL));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
886
22213
16ff37f64e29 Update finch to not touch the internals of PurpleAccount. This also includes a change I made to reduce the Cyclomatic Complexity of one of the functions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
887 serv_send_im(purple_account_get_connection(account), (char *)pouncee, (char *)message, 0);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
888 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
889 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
890
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
891 if (purple_pounce_action_is_enabled(pounce, "execute-command"))
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
892 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
893 const char *command;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
894
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
895 command = purple_pounce_action_get_attribute(pounce,
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
896 "execute-command", "command");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
897
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
898 if (command != NULL)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
899 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
900 char *localecmd = g_locale_from_utf8(command, -1, NULL,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
901 NULL, NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
902
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
903 if (localecmd != NULL)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
904 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
905 int pid = fork();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
906
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
907 if (pid == 0) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
908 char *args[4];
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
909
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
910 args[0] = "sh";
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
911 args[1] = "-c";
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
912 args[2] = (char *)localecmd;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
913 args[3] = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
914
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
915 execvp(args[0], args);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
916
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
917 _exit(0);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
918 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
919 g_free(localecmd);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
920 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
921 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
922 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
923
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
924 if (purple_pounce_action_is_enabled(pounce, "play-beep"))
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
925 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
926 beep();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
927 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
928 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
929
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
930 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
931 free_pounce(PurplePounce *pounce)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
932 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
933 update_pounces();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
934 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
935
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
936 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
937 new_pounce(PurplePounce *pounce)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
938 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
939 purple_pounce_action_register(pounce, "open-window");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
940 purple_pounce_action_register(pounce, "popup-notify");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
941 purple_pounce_action_register(pounce, "send-message");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
942 purple_pounce_action_register(pounce, "execute-command");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
943 purple_pounce_action_register(pounce, "play-beep");
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
944
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
945 update_pounces();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
946 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
947
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
948 void *
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
949 finch_pounces_get_handle()
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
950 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
951 static int handle;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
952
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
953 return &handle;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
954 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
955
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
956 void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
957 finch_pounces_init(void)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
958 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
959 purple_pounces_register_handler(FINCH_UI, pounce_cb, new_pounce,
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
960 free_pounce);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
961
16424
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16287
diff changeset
962 purple_prefs_add_none("/finch/pounces");
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16287
diff changeset
963 purple_prefs_add_none("/finch/pounces/default_actions");
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16287
diff changeset
964 purple_prefs_add_bool("/finch/pounces/default_actions/open-window",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
965 FALSE);
16424
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16287
diff changeset
966 purple_prefs_add_bool("/finch/pounces/default_actions/popup-notify",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
967 TRUE);
16424
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16287
diff changeset
968 purple_prefs_add_bool("/finch/pounces/default_actions/send-message",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
969 FALSE);
16424
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16287
diff changeset
970 purple_prefs_add_bool("/finch/pounces/default_actions/execute-command",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
971 FALSE);
16424
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16287
diff changeset
972 purple_prefs_add_bool("/finch/pounces/default_actions/play-beep",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
973 FALSE);
16424
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16287
diff changeset
974 purple_prefs_add_none("/finch/pounces/dialog");
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
975
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
976 purple_signal_connect(purple_connections_get_handle(), "signed-on",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
977 finch_pounces_get_handle(),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
978 PURPLE_CALLBACK(signed_on_off_cb), NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
979 purple_signal_connect(purple_connections_get_handle(), "signed-off",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
980 finch_pounces_get_handle(),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
981 PURPLE_CALLBACK(signed_on_off_cb), NULL);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
982 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
983
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
984 /* XXX: There's no such thing in pidgin. Perhaps there should be? */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
985 void finch_pounces_uninit()
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
986 {
24078
4ada5e2189d6 Use the more appropriate _unregister_handler function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22249
diff changeset
987 purple_pounces_unregister_handler(FINCH_UI);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
988
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
989 purple_signals_disconnect_by_handle(finch_pounces_get_handle());
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
990 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
991