annotate src/multi.c @ 5433:19224d2ab31e

[gaim-migrate @ 5815] add a _() in prefs committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sun, 18 May 2003 18:33:02 +0000
parents 573501c63fef
children ad445074d239
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /*
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 * gaim
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 *
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 *
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 * (at your option) any later version.
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 *
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 * GNU General Public License for more details.
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 *
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19 *
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 */
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21
4634
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
22 #include <stdlib.h>
2100
a93aeb6f813d [gaim-migrate @ 2110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
23 #include <string.h>
3067
b695cbbeee2d [gaim-migrate @ 3081]
Sean Egan <seanegan@gmail.com>
parents: 3066
diff changeset
24 #include <ctype.h>
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25 #include <gtk/gtk.h>
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
26 #include "prpl.h"
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27 #include "multi.h"
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28 #include "gaim.h"
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
29 #include "conversation.h"
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents: 5211
diff changeset
30 #include "gtkblist.h"
4962
b6fd57ba76e8 [gaim-migrate @ 5296]
Sean Egan <seanegan@gmail.com>
parents: 4890
diff changeset
31 #include "gaim-disclosure.h"
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32
4493
61ba567f9c64 [gaim-migrate @ 4768]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4491
diff changeset
33 #ifdef _WIN32
61ba567f9c64 [gaim-migrate @ 4768]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4491
diff changeset
34 #include "win32dep.h"
61ba567f9c64 [gaim-migrate @ 4768]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4491
diff changeset
35 #endif
61ba567f9c64 [gaim-migrate @ 4768]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4491
diff changeset
36
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1089
diff changeset
37 #define LOGIN_STEPS 5
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1089
diff changeset
38
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39 GSList *connections;
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3510
diff changeset
40 int connecting_count = 0;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42 static GtkWidget *acctedit = NULL;
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
43 static GtkWidget *treeview = NULL; /* the treeview of names in the accteditor */
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
44 static GtkListStore *model = NULL;
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
45
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
46 static GSList *mod_accounts = NULL;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
48 enum
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
49 {
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
50 COLUMN_SCREENNAME,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
51 COLUMN_ONLINE,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
52 COLUMN_AUTOLOGIN,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
53 COLUMN_PROTOCOL,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
54 COLUMN_DATA,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
55 NUM_COLUMNS
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
56 };
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
57
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
58 struct mod_account {
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
59 struct gaim_account *account;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
60
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
61 /* these are temporary */
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
62 char username[64];
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
63 char show[400];
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
64 char password[32];
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
65 int options;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
66 int protocol;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
67 char proto_opt[7][256];
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
68
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
69 /* stuff for modify window */
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
70 GtkWidget *mod;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
71 GtkWidget *main;
4998
13c4752e7138 [gaim-migrate @ 5333]
Nathan Walp <nwalp@pidgin.im>
parents: 4987
diff changeset
72 GtkWidget *disc_box;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
73 GtkWidget *name;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
74 GtkWidget *alias;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
75 GtkWidget *pwdbox;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
76 GtkWidget *pass;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
77 GtkWidget *rempass;
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
78 GtkWidget *login_frame;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
79 GtkWidget *user_frame;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
80 GtkWidget *proto_frame;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
81 GtkSizeGroup *sg;
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
82 GList *user_split_entries;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
83 GList *opt_entries;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
84
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
85 /* stuff for icon selection */
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
86 char iconfile[256];
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
87 GtkWidget *iconsel;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
88 GtkWidget *iconentry;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
89 GtkWidget *icondlg;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
90
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
91 /* stuff for mail check prompt */
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
92 GtkWidget *checkmail;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
93
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
94 /* stuff for register with server */
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
95 GtkWidget *register_user;
4634
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
96
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
97 /* stuff for proxy options */
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
98 GtkWidget *proxy_frame;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
99 GtkWidget *proxy_host_box;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
100 GtkWidget *proxytype_menu;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
101 GtkWidget *proxyhost_entry;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
102 GtkWidget *proxyport_entry;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
103 GtkWidget *proxyuser_entry;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
104 GtkWidget *proxypass_entry;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
105 };
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
106
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
107
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
108 struct mod_account_opt {
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
109 struct mod_account *ma;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
110 int opt;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
111 };
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
112
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
113 static void acct_signin(GtkCellRendererToggle *cell, gchar *path_str,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
114 gpointer d);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
115 static void acct_autologin(GtkCellRendererToggle *cell, gchar *path_str,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
116 gpointer d);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
117
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
118 static struct mod_account *mod_account_find(struct gaim_account *a)
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
119 {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
120 GSList *m = mod_accounts;
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
121 while (m) {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
122 struct mod_account *ma = m->data;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
123 if (ma->account == a)
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
124 return ma;
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
125 m = m->next;
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
126 }
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
127 return NULL;
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
128 }
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
129
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
130
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
131 struct gaim_connection *new_gaim_conn(struct gaim_account *account)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
132 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
133 struct gaim_connection *gc = g_new0(struct gaim_connection, 1);
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
134 gc->edittype = EDIT_GC;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
135 gc->protocol = account->protocol;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
136 gc->prpl = gaim_find_prpl(account->protocol);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
137 g_snprintf(gc->username, sizeof(gc->username), "%s", account->username);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
138 g_snprintf(gc->password, sizeof(gc->password), "%s", account->password);
1153
3063e6743913 [gaim-migrate @ 1163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1124
diff changeset
139 gc->keepalive = 0;
2382
569ae9f2bb89 [gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2380
diff changeset
140 gc->inpa = 0;
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 993
diff changeset
141 gc->buddy_chats = NULL;
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4082
diff changeset
142 gc->away = NULL;
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4082
diff changeset
143 gc->away_state = NULL;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
144
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
145 connections = g_slist_append(connections, gc);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
146
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
147 account->gc = gc;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
148 gc->account = account;
1089
f0f5c10cce63 [gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1086
diff changeset
149
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
150 return gc;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
151 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
152
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
153 struct meter_window {
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
154 GtkWidget *window;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
155 GtkTable *table;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
156 gint rows;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
157 gint active_count;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
158 } *meter_win = NULL;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
159
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
160 void destroy_gaim_conn(struct gaim_connection *gc)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
161 {
4785
1e28e7d802a1 [gaim-migrate @ 5105]
Nathan Walp <nwalp@pidgin.im>
parents: 4778
diff changeset
162 GaimBlistNode *gnode,*bnode;
1063
e1408fb04c36 [gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1058
diff changeset
163 struct group *m;
e1408fb04c36 [gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1058
diff changeset
164 struct buddy *n;
4785
1e28e7d802a1 [gaim-migrate @ 5105]
Nathan Walp <nwalp@pidgin.im>
parents: 4778
diff changeset
165 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) {
1e28e7d802a1 [gaim-migrate @ 5105]
Nathan Walp <nwalp@pidgin.im>
parents: 4778
diff changeset
166 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
1e28e7d802a1 [gaim-migrate @ 5105]
Nathan Walp <nwalp@pidgin.im>
parents: 4778
diff changeset
167 continue;
1e28e7d802a1 [gaim-migrate @ 5105]
Nathan Walp <nwalp@pidgin.im>
parents: 4778
diff changeset
168 m = (struct group *)gnode;
1e28e7d802a1 [gaim-migrate @ 5105]
Nathan Walp <nwalp@pidgin.im>
parents: 4778
diff changeset
169 for(bnode = gnode->child; bnode; bnode = bnode->next) {
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
170 if(GAIM_BLIST_NODE_IS_BUDDY(bnode)) {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
171 n = (struct buddy *)bnode;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
172 if(n->account == gc->account) {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
173 n->present = GAIM_BUDDY_OFFLINE;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
174 }
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
175 }
1063
e1408fb04c36 [gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1058
diff changeset
176 }
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2568
diff changeset
177 }
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4082
diff changeset
178 g_free(gc->away);
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4082
diff changeset
179 g_free(gc->away_state);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
180 g_free(gc);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
181
988
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 984
diff changeset
182 if (!connections && mainwindow)
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 984
diff changeset
183 gtk_widget_show(mainwindow);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
184 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
185
4275
5ce5b252cdb1 [gaim-migrate @ 4526]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
186 static void quit_acctedit(gpointer d)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
187 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
188 if (acctedit) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
189 save_prefs();
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
190 gtk_widget_destroy(acctedit);
4275
5ce5b252cdb1 [gaim-migrate @ 4526]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
191 acctedit = NULL;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
192 }
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4687
diff changeset
193
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
194 treeview = NULL;
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4687
diff changeset
195
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4687
diff changeset
196 if (!d && !GAIM_GTK_BLIST(gaim_get_blist())->window &&
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4687
diff changeset
197 !mainwindow && !connections) {
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4687
diff changeset
198
4082
4b04ecb3eb97 [gaim-migrate @ 4297]
Luke Schierer <lschiere@pidgin.im>
parents: 4074
diff changeset
199 do_quit();
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4687
diff changeset
200 }
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
201 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
202
4275
5ce5b252cdb1 [gaim-migrate @ 4526]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
203 static void on_delete_acctedit(GtkWidget *w, GdkEvent *ev, gpointer d)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
204 {
4275
5ce5b252cdb1 [gaim-migrate @ 4526]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
205 quit_acctedit(d);
5ce5b252cdb1 [gaim-migrate @ 4526]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
206 }
5ce5b252cdb1 [gaim-migrate @ 4526]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
207
5ce5b252cdb1 [gaim-migrate @ 4526]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
208 static void on_close_acctedit(GtkButton *button, gpointer d)
5ce5b252cdb1 [gaim-migrate @ 4526]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
209 {
5ce5b252cdb1 [gaim-migrate @ 4526]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
210 quit_acctedit(d);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
211 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
212
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
213 static char *proto_name(int proto)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
214 {
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
215 GaimPlugin *p = gaim_find_prpl(proto);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
216 if (p && p->info->name)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
217 return p->info->name;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
218 else
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
219 return "Unknown";
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
220 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
221
2204
5014b802eb41 [gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2203
diff changeset
222 void regenerate_user_list()
5014b802eb41 [gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2203
diff changeset
223 {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
224 GSList *accounts = gaim_accounts;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
225 struct gaim_account *a;
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
226 GtkTreeIter iter;
2204
5014b802eb41 [gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2203
diff changeset
227
5014b802eb41 [gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2203
diff changeset
228 if (!acctedit)
5014b802eb41 [gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2203
diff changeset
229 return;
5014b802eb41 [gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2203
diff changeset
230
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
231 gtk_list_store_clear(model);
2204
5014b802eb41 [gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2203
diff changeset
232
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
233 while (accounts) {
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
234 a = (struct gaim_account *)accounts->data;
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
235
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
236 gtk_list_store_append(model, &iter);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
237 gtk_list_store_set(model, &iter,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
238 COLUMN_SCREENNAME, a->username,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
239 COLUMN_ONLINE, (a->gc ? TRUE : FALSE),
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
240 COLUMN_AUTOLOGIN, (a->options & OPT_ACCT_AUTO),
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
241 COLUMN_PROTOCOL, proto_name(a->protocol),
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
242 COLUMN_DATA, a,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
243 -1);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
244 accounts = accounts->next;
2204
5014b802eb41 [gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2203
diff changeset
245 }
5014b802eb41 [gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2203
diff changeset
246 }
5014b802eb41 [gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2203
diff changeset
247
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
248 static gboolean get_iter_from_data(GtkTreeView *treeview,
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
249 struct gaim_account *a, GtkTreeIter *iter)
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
250 {
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
251 return gtk_tree_model_iter_nth_child(gtk_tree_view_get_model(treeview),
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
252 iter, NULL,
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
253 g_slist_index(gaim_accounts, a));
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
254 }
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
255
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
256 static void add_columns(GtkWidget *treeview)
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
257 {
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
258 GtkCellRenderer *renderer;
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
259 /* GtkTreeViewColumn *column; */
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
260
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
261 /* Screennames */
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
262 renderer = gtk_cell_renderer_text_new();
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
263 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview),
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
264 -1, _("Screenname"),
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
265 renderer,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
266 "text", COLUMN_SCREENNAME,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
267 NULL);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
268
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
269 /* Online? */
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
270 renderer = gtk_cell_renderer_toggle_new();
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
271 g_signal_connect(G_OBJECT(renderer), "toggled",
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
272 G_CALLBACK(acct_signin), model);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
273 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview),
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
274 -1, _("Online"),
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
275 renderer,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
276 "active", COLUMN_ONLINE,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
277 NULL);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
278
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
279 /* Auto-login? */
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
280 renderer = gtk_cell_renderer_toggle_new();
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
281 g_signal_connect(G_OBJECT(renderer), "toggled",
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
282 G_CALLBACK(acct_autologin), model);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
283 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview),
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
284 -1, _("Auto-login"),
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
285 renderer,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
286 "active", COLUMN_AUTOLOGIN,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
287 NULL);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
288
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
289 /* Protocol */
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
290 renderer = gtk_cell_renderer_text_new();
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
291 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview),
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
292 -1, _("Protocol"),
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
293 renderer,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
294 "text", COLUMN_PROTOCOL,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
295 NULL);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
296
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
297 /* Data */
4630
5cdfd20daa07 [gaim-migrate @ 4921]
Sean Egan <seanegan@gmail.com>
parents: 4617
diff changeset
298 /*
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
299 column = gtk_tree_view_column_new();
4630
5cdfd20daa07 [gaim-migrate @ 4921]
Sean Egan <seanegan@gmail.com>
parents: 4617
diff changeset
300 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
301 gtk_tree_view_column_set_visible(column, FALSE);
4630
5cdfd20daa07 [gaim-migrate @ 4921]
Sean Egan <seanegan@gmail.com>
parents: 4617
diff changeset
302 */
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
303 }
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
304
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
305 static GtkWidget *generate_list()
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
306 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
307 GtkWidget *win;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
308
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
309 win = gtk_scrolled_window_new(0, 0);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
310 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(win),
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
311 GTK_POLICY_AUTOMATIC,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
312 GTK_POLICY_ALWAYS);
4550
972af41f277c [gaim-migrate @ 4830]
Christian Hammond <chipx86@chipx86.com>
parents: 4493
diff changeset
313 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(win),
972af41f277c [gaim-migrate @ 4830]
Christian Hammond <chipx86@chipx86.com>
parents: 4493
diff changeset
314 GTK_SHADOW_IN);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
315
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
316 /* Create the list model. */
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
317 model = gtk_list_store_new(NUM_COLUMNS, G_TYPE_STRING, G_TYPE_BOOLEAN,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
318 G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
319
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
320 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
321 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
322 gtk_tree_selection_set_mode(
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
323 gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)),
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
324 GTK_SELECTION_MULTIPLE);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
325
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
326 add_columns(treeview);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
327
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
328 gtk_container_add(GTK_CONTAINER(win), treeview);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
329 gtk_widget_show(treeview);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
330
2204
5014b802eb41 [gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2203
diff changeset
331 regenerate_user_list();
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
332 gtk_tree_view_set_reorderable (GTK_TREE_VIEW(treeview), TRUE);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
333 gtk_widget_show(win);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
334 return win;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
335 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
336
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
337 static void delmod(GtkWidget *w, struct mod_account *ma)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
338 {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
339 mod_accounts = g_slist_remove(mod_accounts, ma);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
340 g_free(ma);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
341 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
342
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
343 static void mod_opt(GtkWidget *b, struct mod_account_opt *mao)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
344 {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
345 mao->ma->options = mao->ma->options ^ mao->opt;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
346 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
347
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
348 static void free_mao(GtkWidget *b, struct mod_account_opt *mao)
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
349 {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
350 g_free(mao);
1051
713b0e14e0a9 [gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
351 }
713b0e14e0a9 [gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
352
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
353 static GtkWidget *acct_button(const char *text, struct mod_account *ma, int option, GtkWidget *box)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
354 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
355 GtkWidget *button;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
356 struct mod_account_opt *mao = g_new0(struct mod_account_opt, 1);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
357 button = gtk_check_button_new_with_label(text);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
358 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), (ma->options & option));
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
359 gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
360 mao->ma = ma;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
361 mao->opt = option;
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
362 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(mod_opt), mao);
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
363 g_signal_connect(G_OBJECT(button), "destroy", G_CALLBACK(free_mao), mao);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
364 gtk_widget_show(button);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
365 return button;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
366 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
367
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
368 static void process_login_opts(struct mod_account *ma) {
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
369 GaimPlugin *p = gaim_find_prpl(ma->protocol);
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
370 const char *entry_text;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
371 char *username = g_strdup(gtk_entry_get_text(GTK_ENTRY(ma->name)));
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
372 char *tmp;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
373 GList *entries = ma->user_split_entries;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
374 GList *user_splits = NULL;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
375
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
376 if(p)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
377 user_splits = GAIM_PLUGIN_PROTOCOL_INFO(p)->user_splits;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
378
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
379 while(user_splits) {
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
380 GtkWidget *entry = entries->data;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
381 struct proto_user_split *pus = user_splits->data;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
382 char tmp_sep[2] = " ";
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
383 entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
384
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
385 tmp_sep[0] = pus->sep;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
386 tmp = g_strconcat(username, tmp_sep, *entry_text ? entry_text : pus->def, NULL);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
387 g_free(username);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
388 username = tmp;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
389
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
390 entries = entries->next;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
391 user_splits = user_splits->next;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
392 }
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
393
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
394 g_snprintf(ma->username, sizeof(ma->username), "%s", username);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
395 g_free(username);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
396
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
397 entry_text = gtk_entry_get_text(GTK_ENTRY(ma->pass));
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
398 g_snprintf(ma->password, sizeof(ma->password), "%s", entry_text);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
399
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
400 entry_text = gtk_entry_get_text(GTK_ENTRY(ma->alias));
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
401 g_snprintf(ma->show, sizeof(ma->show), "%s", entry_text);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
402 }
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
403
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
404 static void ok_mod(GtkWidget *w, struct mod_account *ma)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
405 {
2154
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2153
diff changeset
406 GList *tmp;
1954
c15c3a3f6cd4 [gaim-migrate @ 1964]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1942
diff changeset
407 const char *txt;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
408 struct gaim_account *a;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
409 GaimPlugin *p = gaim_find_prpl(ma->protocol);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
410 GaimPluginProtocolInfo *prpl_info = NULL;
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
411 GtkTreeIter iter;
4634
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
412 int proxytype;
1355
04874e92af24 [gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
413
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
414 if (!ma->account) {
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
415 txt = gtk_entry_get_text(GTK_ENTRY(ma->name));
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
416 ma->account = gaim_account_new(txt, ma->protocol, ma->options);
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
417 }
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
418 a = ma->account;
2154
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2153
diff changeset
419
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
420 a->options = ma->options;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
421 a->protocol = ma->protocol;
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
422
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
423 process_login_opts(ma);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
424 g_snprintf(a->username, sizeof(a->username), "%s", ma->username);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
425 g_snprintf(a->alias, sizeof(a->alias), "%s", ma->show);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
426
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
427 if (a->options & OPT_ACCT_REM_PASS)
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
428 g_snprintf(a->password, sizeof(a->password), "%s", ma->password);
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
429 else
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
430 a->password[0] = '\0';
2190
24d947eff811 [gaim-migrate @ 2200]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2165
diff changeset
431
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
432 if (get_iter_from_data(GTK_TREE_VIEW(treeview), a, &iter)) {
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
433 gtk_list_store_set(model, &iter,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
434 COLUMN_SCREENNAME, a->username,
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
435 COLUMN_AUTOLOGIN, (a->options & OPT_ACCT_AUTO),
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
436 COLUMN_PROTOCOL, proto_name(a->protocol),
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
437 -1);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
438 }
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
439
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
440 #if 0
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
441 i = gtk_clist_find_row_from_data(GTK_CLIST(list), a);
2628
4054a0849461 [gaim-migrate @ 2641]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2627
diff changeset
442 gtk_clist_set_text(GTK_CLIST(list), i, 0, a->username);
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
443 gtk_clist_set_text(GTK_CLIST(list), i, 2,
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
444 (a->options & OPT_ACCT_AUTO) ? "True" : "False");
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
445 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(a->protocol));
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
446 #endif
1355
04874e92af24 [gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
447
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
448 tmp = ma->opt_entries;
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
449 while (tmp) {
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
450 GtkEntry *entry = tmp->data;
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
451 int pos = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(entry), "position"));
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
452 g_snprintf(a->proto_opt[pos], sizeof(a->proto_opt[pos]), "%s",
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2364
diff changeset
453 gtk_entry_get_text(entry));
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
454 tmp = tmp->next;
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
455 }
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
456 if (ma->opt_entries)
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
457 g_list_free(ma->opt_entries);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
458 ma->opt_entries = NULL;
1355
04874e92af24 [gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
459
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
460 g_snprintf(a->iconfile, sizeof(a->iconfile), "%s", ma->iconfile);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
461 if (ma->icondlg)
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
462 gtk_widget_destroy(ma->icondlg);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
463 ma->icondlg = NULL;
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
464
4634
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
465 if(ma->account->gpi)
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
466 g_free(ma->account->gpi);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
467 ma->account->gpi = NULL;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
468
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
469 proxytype = GPOINTER_TO_INT(g_object_get_data(
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
470 G_OBJECT(gtk_menu_get_active(GTK_MENU(ma->proxytype_menu))),
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
471 "proxytype"));
4634
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
472
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
473 if(proxytype != PROXY_USE_GLOBAL) {
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
474 struct gaim_proxy_info *gpi = g_new0(struct gaim_proxy_info, 1);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
475 gpi->proxytype = proxytype;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
476 g_snprintf(gpi->proxyhost, sizeof(gpi->proxyhost), "%s", gtk_entry_get_text(GTK_ENTRY(ma->proxyhost_entry)));
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
477 gpi->proxyport = atoi(gtk_entry_get_text(GTK_ENTRY(ma->proxyport_entry)));
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
478 g_snprintf(gpi->proxyuser, sizeof(gpi->proxyuser), "%s", gtk_entry_get_text(GTK_ENTRY(ma->proxyuser_entry)));
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
479 g_snprintf(gpi->proxypass, sizeof(gpi->proxypass), "%s", gtk_entry_get_text(GTK_ENTRY(ma->proxypass_entry)));
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
480
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
481 ma->account->gpi = gpi;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
482 }
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
483
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
484 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(p);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
485
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
486 /*
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
487 * See if user registration is supported/required
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
488 */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
489 if (!p) {
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
490 /* TBD: error dialog here! (This should never happen, you know...) */
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
491 fprintf(stderr, "dbg: couldn't find protocol for protocol number %d!\n", ma->protocol);
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
492 fflush(stderr);
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
493 } else {
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
494 if (prpl_info->register_user != NULL &&
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
495 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ma->register_user)) == TRUE) {
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
496 prpl_info->register_user(a);
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
497 }
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
498 }
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
499
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
500 save_prefs();
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
501
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
502 gtk_widget_destroy(ma->mod);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
503 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
504
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
505 static void cancel_mod(GtkWidget *w, struct mod_account *ma)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
506 {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
507 if (ma->opt_entries)
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
508 g_list_free(ma->opt_entries);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
509 ma->opt_entries = NULL;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
510 if (ma->icondlg)
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
511 gtk_widget_destroy(ma->icondlg);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
512 ma->icondlg = NULL;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
513 gtk_widget_destroy(ma->mod);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
514 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
515
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
516 static void generate_login_options(struct mod_account *ma, GtkWidget *box);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
517 static void generate_user_options(struct mod_account *ma, GtkWidget *box);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
518 static void generate_protocol_options(struct mod_account *ma, GtkWidget *box);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
519
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
520 static void set_prot(GtkWidget *opt, int proto)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
521 {
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
522 struct mod_account *ma = g_object_get_data(G_OBJECT(opt), "mod_account");
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
523 GaimPlugin *p;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
524 if (ma->protocol != proto) {
1086
ce201056e7a6 [gaim-migrate @ 1096]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1075
diff changeset
525 int i;
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
526
1878
75643b9f4261 [gaim-migrate @ 1888]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1817
diff changeset
527 for (i = 0; i < 7; i++)
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
528 ma->proto_opt[i][0] = '\0';
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
529 p = gaim_find_prpl(ma->protocol);
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
530
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
531 process_login_opts(ma);
2522
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
532
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
533 ma->protocol = proto;
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
534
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
535 if(!ma->account)
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
536 g_snprintf(ma->username, sizeof(ma->username), "%s",
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
537 gtk_entry_get_text(GTK_ENTRY(ma->name)));
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
538
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
539 generate_login_options(ma, ma->main);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
540 generate_user_options(ma, ma->main);
4998
13c4752e7138 [gaim-migrate @ 5333]
Nathan Walp <nwalp@pidgin.im>
parents: 4987
diff changeset
541 generate_protocol_options(ma, ma->disc_box);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
542 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
543 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
544
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
545 static GtkWidget *make_protocol_menu(GtkWidget *box, struct mod_account *ma)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
546 {
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
547 GaimPluginProtocolInfo *prpl_info = NULL;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
548 GtkWidget *optmenu;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
549 GtkWidget *menu;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
550 GtkWidget *opt;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
551 GSList *p;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
552 GaimPlugin *e;
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1074
diff changeset
553 int count = 0;
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1074
diff changeset
554 gboolean found = FALSE;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
555
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
556 optmenu = gtk_option_menu_new();
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
557 gtk_box_pack_start(GTK_BOX(box), optmenu, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
558 gtk_widget_show(optmenu);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
559
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
560 menu = gtk_menu_new();
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
561
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
562 for (p = protocols; p != NULL; p = p->next) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
563 e = (GaimPlugin *)p->data;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
564 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(e);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
565
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
566 if (prpl_info->protocol == ma->protocol)
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
567 found = TRUE;
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
568 if (!found)
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
569 count++;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
570 if (e->info->name)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
571 opt = gtk_menu_item_new_with_label(e->info->name);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
572 else
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
573 opt = gtk_menu_item_new_with_label("Unknown");
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
574 g_object_set_data(G_OBJECT(opt), "mod_account", ma);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
575 g_signal_connect(G_OBJECT(opt), "activate",
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
576 G_CALLBACK(set_prot), (void *)prpl_info->protocol);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
577 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
578 gtk_widget_show(opt);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
579 }
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
580
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
581 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu);
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1074
diff changeset
582 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), count);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
583
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
584 return optmenu;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
585 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
586
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
587 static void des_icon_sel(GtkWidget *w, struct mod_account *ma)
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
588 {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
589 w = ma->icondlg;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
590 if (ma->icondlg)
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
591 ma->icondlg = NULL;
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
592 if (w)
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
593 gtk_widget_destroy(w);
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
594 }
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
595
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
596 static void set_icon(GtkWidget *w, struct mod_account *ma)
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
597 {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
598 GtkWidget *sel = ma->icondlg;
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3458
diff changeset
599 const char *file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(sel));
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
600
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
601 if (file_is_dir(file, sel))
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
602 return;
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
603
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
604 gtk_entry_set_text(GTK_ENTRY(ma->iconentry), file);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
605 g_snprintf(ma->iconfile, sizeof(ma->iconfile), "%s", file);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
606 ma->icondlg = NULL;
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
607
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
608 gtk_widget_destroy(sel);
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
609 }
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
610
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
611 static void sel_icon_dlg(GtkWidget *w, struct mod_account *ma)
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
612 {
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
613 GtkWidget *dlg;
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
614 char buf[256];
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
615
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
616 if (ma->icondlg) {
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
617 gtk_widget_show(ma->icondlg);
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
618 return;
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
619 }
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
620
4703
e4dda06a3143 [gaim-migrate @ 5014]
Sean Egan <seanegan@gmail.com>
parents: 4695
diff changeset
621 dlg = gtk_file_selection_new(_("Load Buddy Icon"));
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
622 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(dlg));
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
623 if (ma->iconfile) {
4738
34fdf9e313d5 [gaim-migrate @ 5053]
Mark Doliner <mark@kingant.net>
parents: 4703
diff changeset
624 char *tmp = g_path_get_dirname(ma->iconfile);
34fdf9e313d5 [gaim-migrate @ 5053]
Mark Doliner <mark@kingant.net>
parents: 4703
diff changeset
625 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, tmp);
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
626 g_free(tmp);
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
627 } else {
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
628 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, gaim_home_dir());
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
629 }
4738
34fdf9e313d5 [gaim-migrate @ 5053]
Mark Doliner <mark@kingant.net>
parents: 4703
diff changeset
630 gtk_file_selection_set_filename(GTK_FILE_SELECTION(dlg), buf);
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
631
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
632 g_signal_connect(G_OBJECT(dlg), "destroy",
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
633 G_CALLBACK(des_icon_sel), ma);
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
634 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dlg)->cancel_button), "clicked",
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
635 G_CALLBACK(des_icon_sel), ma);
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
636 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dlg)->ok_button), "clicked",
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
637 G_CALLBACK(set_icon), ma);
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
638
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
639 ma->icondlg = dlg;
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
640
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
641 gtk_widget_show(dlg);
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
642 }
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
643
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
644 static void reset_icon(GtkWidget *w, struct mod_account *ma)
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
645 {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
646 ma->iconfile[0] = 0;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
647 gtk_entry_set_text(GTK_ENTRY(ma->iconentry), "");
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
648 }
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
649
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
650 static GtkWidget *build_icon_selection(struct mod_account *ma, GtkWidget *box)
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
651 {
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
652 GtkWidget *hbox;
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
653 GtkWidget *label;
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
654 GtkWidget *name;
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
655 GtkWidget *browse;
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
656 GtkWidget *reset;
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
657
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
658 if (ma->account)
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
659 g_snprintf(ma->iconfile, sizeof(ma->iconfile), "%s", ma->account->iconfile);
2431
5948060f486c [gaim-migrate @ 2444]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2411
diff changeset
660
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
661 hbox = gtk_hbox_new(FALSE, 0);
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
662 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5);
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
663 gtk_widget_show(hbox);
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
664
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
665 label = gtk_label_new(_("Buddy Icon File:"));
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
666 gtk_size_group_add_widget(ma->sg, label);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
667 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
668 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
669 gtk_widget_show(label);
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
670
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
671 name = gtk_entry_new();
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
672 gtk_entry_set_text(GTK_ENTRY(name), ma->iconfile);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
673 gtk_editable_set_editable(GTK_EDITABLE(name), FALSE);
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
674 gtk_box_pack_start(GTK_BOX(hbox), name, TRUE, TRUE, 5);
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
675 gtk_widget_show(name);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
676 ma->iconentry = name;
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
677
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
678 browse = gtk_button_new_with_label(_("Browse"));
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
679 g_signal_connect(G_OBJECT(browse), "clicked",
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
680 G_CALLBACK(sel_icon_dlg), ma);
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
681 gtk_box_pack_start(GTK_BOX(hbox), browse, FALSE, FALSE, 0);
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
682 gtk_widget_show(browse);
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
683
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
684 reset = gtk_button_new_with_label(_("Reset"));
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
685 g_signal_connect(G_OBJECT(reset), "clicked",
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
686 G_CALLBACK(reset_icon), ma);
2411
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
687 gtk_box_pack_start(GTK_BOX(hbox), reset, FALSE, FALSE, 0);
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
688 gtk_widget_show(reset);
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
689
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
690 return hbox;
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
691 }
123aaa84109a [gaim-migrate @ 2424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2403
diff changeset
692
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
693 static void generate_login_options(struct mod_account *ma, GtkWidget *box)
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
694 {
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
695 GtkWidget *frame;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
696 GtkWidget *vbox;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
697 GtkWidget *hbox;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
698 GtkWidget *label;
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
699 GList *user_splits = NULL;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
700 GList *split_entries;
2522
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
701
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
702 GaimPlugin *p;
2522
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
703
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
704 char *username = NULL;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
705 char *start;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
706
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
707 if(ma->login_frame)
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
708 gtk_widget_destroy(ma->login_frame);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
709 ma->login_frame = NULL;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
710
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
711 frame = make_frame(box, _("Login Options"));
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
712 ma->login_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame));
4998
13c4752e7138 [gaim-migrate @ 5333]
Nathan Walp <nwalp@pidgin.im>
parents: 4987
diff changeset
713 gtk_box_reorder_child(GTK_BOX(box), ma->login_frame, 0);
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1074
diff changeset
714
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
715 vbox = gtk_vbox_new(FALSE, 5);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
716 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2522
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
717 gtk_container_add(GTK_CONTAINER(frame), vbox);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
718
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
719 hbox = gtk_hbox_new(FALSE, 5);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
720 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
721 gtk_widget_show(hbox);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
722
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
723 label = gtk_label_new(_("Protocol:"));
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
724 gtk_size_group_add_widget(ma->sg, label);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
725 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
726 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
727
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
728 make_protocol_menu(hbox, ma);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
729
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
730 hbox = gtk_hbox_new(FALSE, 5);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
731 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
732
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
733 p = gaim_find_prpl(ma->protocol);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
734
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
735 if(p)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
736 user_splits = GAIM_PLUGIN_PROTOCOL_INFO(p)->user_splits;
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1074
diff changeset
737
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
738 label = gtk_label_new(_("Screenname:"));
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
739 gtk_size_group_add_widget(ma->sg, label);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
740 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
741 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
742
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
743 ma->name = gtk_entry_new();
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
744 gtk_box_pack_start(GTK_BOX(hbox), ma->name, TRUE, TRUE, 0);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
745
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
746 if(ma->user_split_entries) {
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
747 g_list_free(ma->user_split_entries);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
748 ma->user_split_entries = NULL;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
749 }
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
750
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
751 while(user_splits) {
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
752 struct proto_user_split *pus = user_splits->data;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
753 GtkWidget *entry;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
754
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
755 hbox = gtk_hbox_new(FALSE, 5);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
756 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
757
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
758 label = gtk_label_new(pus->label);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
759 gtk_size_group_add_widget(ma->sg, label);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
760 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
761 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
762 user_splits = user_splits->next;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
763
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
764 entry = gtk_entry_new();
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
765 gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 0);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
766
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
767 ma->user_split_entries = g_list_append(ma->user_split_entries, entry);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
768 }
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
769
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
770 ma->pwdbox = gtk_hbox_new(FALSE, 5);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
771 gtk_box_pack_start(GTK_BOX(vbox), ma->pwdbox, FALSE, FALSE, 0);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
772
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
773 label = gtk_label_new(_("Password:"));
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
774 gtk_size_group_add_widget(ma->sg, label);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
775 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
776 gtk_box_pack_start(GTK_BOX(ma->pwdbox), label, FALSE, FALSE, 0);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
777
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
778 ma->pass = gtk_entry_new();
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
779 gtk_box_pack_start(GTK_BOX(ma->pwdbox), ma->pass, TRUE, TRUE, 0);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
780 gtk_entry_set_visibility(GTK_ENTRY(ma->pass), FALSE);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
781
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
782 hbox = gtk_hbox_new(FALSE, 5);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
783 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
3205
332df87cf3d6 [gaim-migrate @ 3222]
Sean Egan <seanegan@gmail.com>
parents: 3111
diff changeset
784
332df87cf3d6 [gaim-migrate @ 3222]
Sean Egan <seanegan@gmail.com>
parents: 3111
diff changeset
785 label = gtk_label_new(_("Alias:"));
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
786 gtk_size_group_add_widget(ma->sg, label);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
787 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
3205
332df87cf3d6 [gaim-migrate @ 3222]
Sean Egan <seanegan@gmail.com>
parents: 3111
diff changeset
788 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
332df87cf3d6 [gaim-migrate @ 3222]
Sean Egan <seanegan@gmail.com>
parents: 3111
diff changeset
789
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
790 ma->alias = gtk_entry_new();
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
791 gtk_box_pack_start(GTK_BOX(hbox), ma->alias, TRUE, TRUE, 0);
3205
332df87cf3d6 [gaim-migrate @ 3222]
Sean Egan <seanegan@gmail.com>
parents: 3111
diff changeset
792
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
793 ma->rempass = acct_button(_("Remember Password"), ma, OPT_ACCT_REM_PASS, vbox);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
794 acct_button(_("Auto-Login"), ma, OPT_ACCT_AUTO, vbox);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
795
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
796 gtk_widget_show_all(ma->login_frame);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
797
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
798 if (p)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
799 user_splits = g_list_last(GAIM_PLUGIN_PROTOCOL_INFO(p)->user_splits);
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
800
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
801 username = g_strdup(ma->username);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
802 split_entries = g_list_last(ma->user_split_entries);
2100
a93aeb6f813d [gaim-migrate @ 2110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
803
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
804 while(user_splits) {
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
805 struct proto_user_split *pus = user_splits->data;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
806 GtkWidget *entry = split_entries->data;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
807 start = strrchr(username, pus->sep);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
808 if(start) {
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
809 *start = '\0';
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
810 start++;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
811 gtk_entry_set_text(GTK_ENTRY(entry), start);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
812 } else {
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
813 gtk_entry_set_text(GTK_ENTRY(entry), pus->def);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
814 }
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
815 user_splits = user_splits->prev;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
816 split_entries = split_entries->prev;
2522
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
817 }
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
818
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
819 gtk_entry_set_text(GTK_ENTRY(ma->name), username);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
820 gtk_entry_set_text(GTK_ENTRY(ma->alias), ma->show);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
821 gtk_entry_set_text(GTK_ENTRY(ma->pass), ma->password);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
822 g_free(username);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
823
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
824 if (p && (GAIM_PLUGIN_PROTOCOL_INFO(p)->options & OPT_PROTO_NO_PASSWORD)) {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
825 gtk_widget_hide(ma->pwdbox);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
826 gtk_widget_hide(ma->rempass);
2444
13ce96daf30f [gaim-migrate @ 2457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2442
diff changeset
827 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
828 }
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
829
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
830 static void generate_user_options(struct mod_account *ma, GtkWidget *box)
2522
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
831 {
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
832 /* This function will add the appropriate (depending on the current
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
833 * protocol) widgets to frame and return TRUE if there anything
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
834 * was added (meaning the frame should be shown)
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
835 * Eric will most likely change this (as he does all other submitted code)
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
836 * so that it will accept the vbox as an argument and create, add, and show
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
837 * the frame itself (like generate_protocol_options). I'd do it myself, but I'm
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
838 * tired and I don't care. */
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
839 /* Sean was right. I did do that. I told him I would. */
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
840
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
841 GtkWidget *vbox;
3756
08742bf8a7be [gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents: 3755
diff changeset
842 GtkWidget *frame;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
843 GaimPluginProtocolInfo *prpl_info = NULL;
2522
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
844
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
845 GaimPlugin *p = gaim_find_prpl(ma->protocol);
2522
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
846
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
847 if(ma->user_frame)
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
848 gtk_widget_destroy(ma->user_frame);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
849 ma->user_frame = NULL;
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
850
3756
08742bf8a7be [gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents: 3755
diff changeset
851 frame = make_frame(box, _("User Options"));
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
852 ma->user_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame));
4998
13c4752e7138 [gaim-migrate @ 5333]
Nathan Walp <nwalp@pidgin.im>
parents: 4987
diff changeset
853 gtk_box_reorder_child(GTK_BOX(box), ma->user_frame, 1);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
854 gtk_widget_show_all(ma->user_frame);
2522
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
855
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
856 vbox = gtk_vbox_new(FALSE, 5);
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
857 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
3756
08742bf8a7be [gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents: 3755
diff changeset
858 gtk_container_add(GTK_CONTAINER(frame), vbox);
2522
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
859 gtk_widget_show(vbox);
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
860
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
861 ma->checkmail = acct_button(_("New Mail Notifications"), ma, OPT_ACCT_MAIL_CHECK, vbox);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
862 ma->iconsel = build_icon_selection(ma, vbox);
2522
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
863
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
864 if (!p) {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
865 gtk_widget_hide(ma->user_frame);
2522
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
866 return;
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
867 }
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
868
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
869 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(p);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
870
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
871 if (!(prpl_info->options & OPT_PROTO_MAIL_CHECK))
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
872 gtk_widget_hide(ma->checkmail);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
873 if (!(prpl_info->options & OPT_PROTO_BUDDY_ICON))
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
874 gtk_widget_hide(ma->iconsel);
2525
4fc6aac9da94 [gaim-migrate @ 2538]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2522
diff changeset
875
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
876 if ((prpl_info->options & OPT_PROTO_BUDDY_ICON) ||
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
877 (prpl_info->options & OPT_PROTO_MAIL_CHECK)) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
878
2525
4fc6aac9da94 [gaim-migrate @ 2538]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2522
diff changeset
879 return;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
880 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
881
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
882 gtk_widget_hide(ma->user_frame);
2522
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
883 }
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
884
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
885 static void generate_protocol_options(struct mod_account *ma, GtkWidget *box)
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
886 {
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
887 GaimPlugin *p = gaim_find_prpl(ma->protocol);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
888 GaimPluginProtocolInfo *prpl_info = NULL;
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
889
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
890 GList *op, *tmp;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
891
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
892 GtkWidget *vbox;
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
893 GtkWidget *hbox;
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
894 GtkWidget *label;
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
895 GtkWidget *entry;
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
896 GtkWidget *frame;
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
897
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
898 char buf[256];
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
899
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
900 if (ma->proto_frame)
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
901 gtk_widget_destroy(ma->proto_frame);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
902 ma->proto_frame = NULL;
2203
14100685c95f [gaim-migrate @ 2213]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2200
diff changeset
903
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
904 if (ma->opt_entries) {
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
905 g_list_free(ma->opt_entries);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
906 ma->opt_entries = NULL;
2190
24d947eff811 [gaim-migrate @ 2200]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2165
diff changeset
907 }
24d947eff811 [gaim-migrate @ 2200]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2165
diff changeset
908
2522
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
909 if (!p)
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
910 return;
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
911
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
912 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(p);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
913
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
914 if (!prpl_info->user_opts)
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
915 return;
2154
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2153
diff changeset
916
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
917 tmp = op = prpl_info->user_opts;
2154
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2153
diff changeset
918
2522
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
919 if (!op)
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
920 return;
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
921
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
922 g_snprintf(buf, sizeof(buf), _("%s Options"), p->info->name);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
923 frame = make_frame(box, buf);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
924
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
925 /* BLEH */
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
926 ma->proto_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame));
4998
13c4752e7138 [gaim-migrate @ 5333]
Nathan Walp <nwalp@pidgin.im>
parents: 4987
diff changeset
927 gtk_box_reorder_child(GTK_BOX(box), ma->proto_frame, 0);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
928 gtk_widget_show_all(ma->proto_frame);
2522
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
929
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
930 vbox = gtk_vbox_new(FALSE, 5);
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
931 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
932 gtk_container_add(GTK_CONTAINER(frame), vbox);
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
933 gtk_widget_show(vbox);
2154
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2153
diff changeset
934
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
935 while (op) {
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
936 struct proto_user_opt *puo = op->data;
2154
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2153
diff changeset
937
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
938 hbox = gtk_hbox_new(FALSE, 5);
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
939 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
940 gtk_widget_show(hbox);
2154
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2153
diff changeset
941
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
942 label = gtk_label_new(puo->label);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
943 gtk_size_group_add_widget(ma->sg, label);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
944 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
945 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
946 gtk_widget_show(label);
2154
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2153
diff changeset
947
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
948 entry = gtk_entry_new();
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
949 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
950 g_object_set_data(G_OBJECT(entry), "position", GINT_TO_POINTER(puo->pos));
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
951 if (ma->proto_opt[puo->pos][0]) {
5211
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
952 gaim_debug(GAIM_DEBUG_MISC, "protocol options",
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
953 "Setting text %s\n", ma->proto_opt[puo->pos]);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
954 gtk_entry_set_text(GTK_ENTRY(entry), ma->proto_opt[puo->pos]);
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
955 } else {
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
956 gtk_entry_set_text(GTK_ENTRY(entry), puo->def);
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
957 }
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
958 gtk_widget_show(entry);
2154
cff133e0ec0c [gaim-migrate @ 2164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2153
diff changeset
959
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
960 ma->opt_entries = g_list_append(ma->opt_entries, entry);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
961
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
962 op = op->next;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
963 }
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
964
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
965 if(prpl_info->register_user != NULL) {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
966 ma->register_user = gtk_check_button_new_with_label(_("Register with server"));
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
967 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ma->register_user), FALSE);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
968 gtk_box_pack_start(GTK_BOX(vbox), ma->register_user, FALSE, FALSE, 0);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
969 gtk_widget_show(ma->register_user);
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
970 }
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
971
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1074
diff changeset
972 }
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1074
diff changeset
973
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
974 static void proxy_dropdown_set(GObject *w, struct mod_account *ma) {
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
975 int opt = GPOINTER_TO_INT(g_object_get_data(w, "proxytype"));
4856
ac9ed6c5594f [gaim-migrate @ 5183]
Nathan Walp <nwalp@pidgin.im>
parents: 4834
diff changeset
976 if(opt == PROXY_NONE || opt == PROXY_USE_GLOBAL)
ac9ed6c5594f [gaim-migrate @ 5183]
Nathan Walp <nwalp@pidgin.im>
parents: 4834
diff changeset
977 gtk_widget_hide_all(ma->proxy_host_box);
ac9ed6c5594f [gaim-migrate @ 5183]
Nathan Walp <nwalp@pidgin.im>
parents: 4834
diff changeset
978 else {
ac9ed6c5594f [gaim-migrate @ 5183]
Nathan Walp <nwalp@pidgin.im>
parents: 4834
diff changeset
979 gtk_widget_show_all(ma->proxy_host_box);
ac9ed6c5594f [gaim-migrate @ 5183]
Nathan Walp <nwalp@pidgin.im>
parents: 4834
diff changeset
980 }
4634
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
981 }
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
982
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
983 static void generate_proxy_options(struct mod_account *ma, GtkWidget *box) {
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
984 GtkWidget *frame;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
985 GtkWidget *hbox;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
986 GtkWidget *vbox;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
987 GtkWidget *label;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
988 GtkWidget *menu;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
989 GtkWidget *dropdown;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
990 GtkWidget *opt;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
991 GtkWidget *entry;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
992 GtkWidget *vbox2;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
993
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
994 struct gaim_proxy_info *gpi = NULL;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
995
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
996 if(ma->account)
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
997 gpi = ma->account->gpi;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
998
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
999 frame = make_frame(box, _("Proxy Options"));
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1000 ma->proxy_frame = gtk_widget_get_parent(gtk_widget_get_parent(frame));
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1001 gtk_widget_show_all(ma->proxy_frame);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1002
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1003 vbox = gtk_vbox_new(FALSE, 5);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1004 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1005 gtk_container_add(GTK_CONTAINER(frame), vbox);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1006 gtk_widget_show(vbox);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1007
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1008 /* make the dropdown w/o the benefit of the easy helper funcs in prefs.c */
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1009 hbox = gtk_hbox_new(FALSE, 5);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1010 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1011 gtk_widget_show(hbox);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1012
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1013 label = gtk_label_new_with_mnemonic(_("Proxy _Type"));
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1014 gtk_size_group_add_widget(ma->sg, label);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1015 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1016 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1017 gtk_widget_show(label);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1018
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1019 dropdown = gtk_option_menu_new();
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1020 menu = gtk_menu_new();
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1021
4834
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4785
diff changeset
1022 opt = gtk_menu_item_new_with_label(_("Use Global Proxy Settings"));
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
1023 g_object_set_data(G_OBJECT(opt), "proxytype", GINT_TO_POINTER(PROXY_USE_GLOBAL));
4634
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1024 g_signal_connect(G_OBJECT(opt), "activate",
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1025 G_CALLBACK(proxy_dropdown_set), ma);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1026 gtk_widget_show(opt);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1027 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1028 if(!gpi)
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1029 gtk_menu_set_active(GTK_MENU(menu), 0);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1030
4834
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4785
diff changeset
1031 opt = gtk_menu_item_new_with_label(_("No Proxy"));
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
1032 g_object_set_data(G_OBJECT(opt), "proxytype", GINT_TO_POINTER(PROXY_NONE));
4634
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1033 g_signal_connect(G_OBJECT(opt), "activate",
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1034 G_CALLBACK(proxy_dropdown_set), ma);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1035 gtk_widget_show(opt);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1036 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1037 if(gpi && gpi->proxytype == PROXY_NONE)
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1038 gtk_menu_set_active(GTK_MENU(menu), 1);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1039
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1040 opt = gtk_menu_item_new_with_label("SOCKS 4");
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
1041 g_object_set_data(G_OBJECT(opt), "proxytype", GINT_TO_POINTER(PROXY_SOCKS4));
4634
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1042 g_signal_connect(G_OBJECT(opt), "activate",
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1043 G_CALLBACK(proxy_dropdown_set), ma);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1044 gtk_widget_show(opt);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1045 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1046 if(gpi && gpi->proxytype == PROXY_SOCKS4)
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1047 gtk_menu_set_active(GTK_MENU(menu), 2);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1048
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1049 opt = gtk_menu_item_new_with_label("SOCKS 5");
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
1050 g_object_set_data(G_OBJECT(opt), "proxytype", GINT_TO_POINTER(PROXY_SOCKS5));
4634
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1051 g_signal_connect(G_OBJECT(opt), "activate",
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1052 G_CALLBACK(proxy_dropdown_set), ma);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1053 gtk_widget_show(opt);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1054 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1055 if(gpi && gpi->proxytype == PROXY_SOCKS5)
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1056 gtk_menu_set_active(GTK_MENU(menu), 3);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1057
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1058 opt = gtk_menu_item_new_with_label("HTTP");
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
1059 g_object_set_data(G_OBJECT(opt), "proxytype", GINT_TO_POINTER(PROXY_HTTP));
4634
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1060 g_signal_connect(G_OBJECT(opt), "activate",
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1061 G_CALLBACK(proxy_dropdown_set), ma);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1062 gtk_widget_show(opt);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1063 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1064 if(gpi && gpi->proxytype == PROXY_HTTP)
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1065 gtk_menu_set_active(GTK_MENU(menu), 4);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1066
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1067 gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown), menu);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1068 gtk_box_pack_start(GTK_BOX(hbox), dropdown, FALSE, FALSE, 0);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1069 gtk_widget_show(dropdown);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1070
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1071 ma->proxytype_menu = menu;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1072
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1073
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1074 vbox2 = gtk_vbox_new(FALSE, 5);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1075 gtk_container_add(GTK_CONTAINER(vbox), vbox2);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1076 gtk_widget_show(vbox2);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1077 ma->proxy_host_box = vbox2;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1078
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1079 hbox = gtk_hbox_new(FALSE, 5);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1080 gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1081 gtk_widget_show(hbox);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1082
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1083 label = gtk_label_new_with_mnemonic(_("_Host:"));
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1084 gtk_size_group_add_widget(ma->sg, label);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1085 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1086 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1087 gtk_widget_show(label);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1088 entry = gtk_entry_new();
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1089 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1090 gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1091 gtk_entry_set_text(GTK_ENTRY(entry), gpi ? gpi->proxyhost : "");
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1092 gtk_widget_show(entry);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1093 ma->proxyhost_entry = entry;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1094
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1095 hbox = gtk_hbox_new(FALSE, 5);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1096 gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1097 gtk_widget_show(hbox);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1098
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1099 label = gtk_label_new_with_mnemonic(_("Port:"));
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1100 gtk_size_group_add_widget(ma->sg, label);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1101 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1102 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1103 gtk_widget_show(label);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1104 entry = gtk_entry_new();
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1105 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1106 gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1107 if(gpi && gpi->proxyport) {
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1108 char buf[128];
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1109 g_snprintf(buf, sizeof(buf), "%d", gpi->proxyport);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1110 gtk_entry_set_text(GTK_ENTRY(entry), buf);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1111 }
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1112 gtk_widget_show(entry);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1113 ma->proxyport_entry = entry;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1114
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1115 hbox = gtk_hbox_new(FALSE, 5);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1116 gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1117 gtk_widget_show(hbox);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1118
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1119 label = gtk_label_new_with_mnemonic(_("_User:"));
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1120 gtk_size_group_add_widget(ma->sg, label);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1121 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1122 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1123 gtk_widget_show(label);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1124 entry = gtk_entry_new();
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1125 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1126 gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1127 gtk_entry_set_text(GTK_ENTRY(entry), gpi ? gpi->proxyuser : "");
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1128 gtk_widget_show(entry);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1129 ma->proxyuser_entry = entry;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1130
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1131 hbox = gtk_hbox_new(FALSE, 5);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1132 gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1133 gtk_widget_show(hbox);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1134
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1135 label = gtk_label_new_with_mnemonic(_("Pa_ssword:"));
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1136 gtk_size_group_add_widget(ma->sg, label);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1137 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1138 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1139 gtk_widget_show(label);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1140 entry = gtk_entry_new();
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1141 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1142 gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1143 gtk_entry_set_text(GTK_ENTRY(entry), gpi ? gpi->proxypass : "");
5401
e03f07e1f7f4 [gaim-migrate @ 5777]
Luke Schierer <lschiere@pidgin.im>
parents: 5314
diff changeset
1144 gtk_entry_set_visibility(GTK_ENTRY(entry),FALSE); /*show *'s for passwd*/
4634
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1145 gtk_widget_show(entry);
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1146 ma->proxypass_entry = entry;
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1147
4856
ac9ed6c5594f [gaim-migrate @ 5183]
Nathan Walp <nwalp@pidgin.im>
parents: 4834
diff changeset
1148 if(gpi == NULL || gpi->proxytype == PROXY_NONE)
ac9ed6c5594f [gaim-migrate @ 5183]
Nathan Walp <nwalp@pidgin.im>
parents: 4834
diff changeset
1149 gtk_widget_hide_all(vbox2);
4634
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1150 }
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4630
diff changeset
1151
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1152 static void show_acct_mod(struct gaim_account *a)
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1074
diff changeset
1153 {
2522
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
1154 /* This is the fucking modify account dialog. I've fucking seperated it into
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
1155 * three fucking frames:
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
1156 * a fucking Login Options frame, a fucking User Options frame and a fucking
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1157 * Protcol Options frame. This fucking removes the two fucking tabs, which
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1158 * were quite fucking uneccessary. Fuck. */
2522
108b3eab22aa [gaim-migrate @ 2535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2458
diff changeset
1159 /* -- SeanEgan */
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1160 /* YEAH!! -- ChipX86 */
4962
b6fd57ba76e8 [gaim-migrate @ 5296]
Sean Egan <seanegan@gmail.com>
parents: 4890
diff changeset
1161 GtkWidget *hbox, *vbox, *disc, *dbox;
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1074
diff changeset
1162 GtkWidget *button;
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1163 GtkWidget *sep;
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1164 GtkSizeGroup *button_sg;
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1074
diff changeset
1165
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1166 struct mod_account *ma = mod_account_find(a);
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1167
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1168 if (!ma) {
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1169 ma = g_new0(struct mod_account, 1);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1170 ma->account = a;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1171 mod_accounts = g_slist_append(mod_accounts, ma);
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1172
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1173 if (a) {
2458
8208e2016d9b [gaim-migrate @ 2471]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2445
diff changeset
1174 int i;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1175 ma->options = a->options;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1176 if (gaim_find_prpl(a->protocol))
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1177 ma->protocol = a->protocol;
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1178 else if (protocols)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1179 ma->protocol = GAIM_PLUGIN_PROTOCOL_INFO(
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1180 ((GaimPlugin *)protocols->data))->protocol;
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1181 else
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1182 ma->protocol = -1;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1183 g_snprintf(ma->iconfile, sizeof(ma->iconfile), "%s", a->iconfile);
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
1184 g_snprintf(ma->username, sizeof(ma->username), "%s", a->username);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
1185 g_snprintf(ma->show, sizeof(ma->show), "%s", a->alias);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
1186 g_snprintf(ma->password, sizeof(ma->password), "%s", a->password);
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4962
diff changeset
1187
2458
8208e2016d9b [gaim-migrate @ 2471]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2445
diff changeset
1188 for (i = 0; i < 7; i++)
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1189 g_snprintf(ma->proto_opt[i], sizeof(ma->proto_opt[i]), "%s",
2458
8208e2016d9b [gaim-migrate @ 2471]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2445
diff changeset
1190 a->proto_opt[i]);
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1191 } else {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1192 ma->options = OPT_ACCT_REM_PASS;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1193 if (gaim_find_prpl(GAIM_PROTO_DEFAULT))
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1194 ma->protocol = GAIM_PROTO_DEFAULT;
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1195 else if (protocols)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1196 ma->protocol = GAIM_PLUGIN_PROTOCOL_INFO(
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1197 ((GaimPlugin *)protocols->data))->protocol;
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1198 else
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1199 ma->protocol = -1;
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1200 }
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1201 } else {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1202 gtk_widget_show(ma->mod);
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1074
diff changeset
1203 return;
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1074
diff changeset
1204 }
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1074
diff changeset
1205
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1206 ma->mod = gtk_window_new(GTK_WINDOW_TOPLEVEL);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1207 gtk_window_set_role(GTK_WINDOW(ma->mod), "account");
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1208 gtk_widget_realize(ma->mod);
4703
e4dda06a3143 [gaim-migrate @ 5014]
Sean Egan <seanegan@gmail.com>
parents: 4695
diff changeset
1209 gtk_window_set_title(GTK_WINDOW(ma->mod), _("Modify Account"));
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
1210 gtk_window_set_resizable(GTK_WINDOW(ma->mod), FALSE); /* nothing odd here :) */
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1211 g_signal_connect(G_OBJECT(ma->mod), "destroy",
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1212 G_CALLBACK(delmod), ma);
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1074
diff changeset
1213
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1214 vbox = gtk_vbox_new(FALSE, 6);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
1215 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1216 gtk_container_add(GTK_CONTAINER(ma->mod), vbox);
3756
08742bf8a7be [gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents: 3755
diff changeset
1217 gtk_widget_show(vbox);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1218
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1219 ma->main = gtk_vbox_new(FALSE, 12);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
1220 gtk_container_set_border_width(GTK_CONTAINER(ma->main), 6);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1221 gtk_box_pack_start(GTK_BOX(vbox), ma->main, FALSE, FALSE, 0);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1222 gtk_widget_show(ma->main);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1223
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1224 ma->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1225
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1226 generate_login_options(ma, ma->main);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1227 generate_user_options(ma, ma->main);
4962
b6fd57ba76e8 [gaim-migrate @ 5296]
Sean Egan <seanegan@gmail.com>
parents: 4890
diff changeset
1228 disc = gaim_disclosure_new(_("Show more options"), _("Show fewer options"));
b6fd57ba76e8 [gaim-migrate @ 5296]
Sean Egan <seanegan@gmail.com>
parents: 4890
diff changeset
1229 gtk_box_pack_start(GTK_BOX(ma->main), disc, FALSE, FALSE, 0);
b6fd57ba76e8 [gaim-migrate @ 5296]
Sean Egan <seanegan@gmail.com>
parents: 4890
diff changeset
1230 gtk_widget_show(disc);
4998
13c4752e7138 [gaim-migrate @ 5333]
Nathan Walp <nwalp@pidgin.im>
parents: 4987
diff changeset
1231 ma->disc_box = dbox = gtk_vbox_new(FALSE, 12);
4962
b6fd57ba76e8 [gaim-migrate @ 5296]
Sean Egan <seanegan@gmail.com>
parents: 4890
diff changeset
1232 gtk_container_set_border_width(GTK_CONTAINER(dbox), 6);
b6fd57ba76e8 [gaim-migrate @ 5296]
Sean Egan <seanegan@gmail.com>
parents: 4890
diff changeset
1233 gtk_box_pack_start(GTK_BOX(ma->main), dbox, FALSE, FALSE, 0);
b6fd57ba76e8 [gaim-migrate @ 5296]
Sean Egan <seanegan@gmail.com>
parents: 4890
diff changeset
1234 gaim_disclosure_set_container(GAIM_DISCLOSURE(disc), dbox);
b6fd57ba76e8 [gaim-migrate @ 5296]
Sean Egan <seanegan@gmail.com>
parents: 4890
diff changeset
1235 generate_protocol_options(ma, dbox);
b6fd57ba76e8 [gaim-migrate @ 5296]
Sean Egan <seanegan@gmail.com>
parents: 4890
diff changeset
1236 generate_proxy_options(ma, dbox);
1075
2fe18b2d6105 [gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1074
diff changeset
1237
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1238 hbox = gtk_hbox_new(FALSE, 6);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1239 gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1240 gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1241
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1242 button_sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1243
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1244 button = gtk_button_new_from_stock(GTK_STOCK_OK);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1245 gtk_size_group_add_widget(button_sg, button);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1246 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1247 g_signal_connect(G_OBJECT(button), "clicked",
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1248 G_CALLBACK(ok_mod), ma);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1249
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1250 button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1251 gtk_size_group_add_widget(button_sg, button);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1252 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1253 g_signal_connect(G_OBJECT(button), "clicked",
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1254 G_CALLBACK(cancel_mod), ma);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1255
3756
08742bf8a7be [gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents: 3755
diff changeset
1256 sep = gtk_hseparator_new();
08742bf8a7be [gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents: 3755
diff changeset
1257 gtk_box_pack_end (GTK_BOX (vbox), sep, FALSE, FALSE, 0);
08742bf8a7be [gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents: 3755
diff changeset
1258 gtk_widget_show(sep);
08742bf8a7be [gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents: 3755
diff changeset
1259
08742bf8a7be [gaim-migrate @ 3895]
Christian Hammond <chipx86@chipx86.com>
parents: 3755
diff changeset
1260 gtk_widget_show_all(hbox);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1261 gtk_widget_show(ma->mod);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1262 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1263
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1264 static void add_acct(GtkWidget *w, gpointer d)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1265 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1266 show_acct_mod(NULL);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1267 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1268
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1269 static void mod_acct_func(GtkTreeModel *model, GtkTreePath *path,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1270 GtkTreeIter *iter, gpointer data)
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1271 {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1272 struct gaim_account *a;
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1273
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1274 gtk_tree_model_get(model, iter, COLUMN_DATA, &a, -1);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1275
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1276 if (a != NULL)
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1277 show_acct_mod(a);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1278 }
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1279
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1280 static void mod_acct(GtkWidget *w, gpointer d)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1281 {
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1282 GtkTreeSelection *selection;
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1283
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1284 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1285
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1286 gtk_tree_selection_selected_foreach(selection, mod_acct_func, NULL);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1287 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1288
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1289 struct pass_prompt {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1290 struct gaim_account *account;
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1291 GtkWidget *win;
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1292 GtkWidget *entry;
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1293 };
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1294 static GSList *passes = NULL;
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1295
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1296 static struct pass_prompt *find_pass_prompt(struct gaim_account *account)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1297 {
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1298 GSList *p = passes;
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1299 while (p) {
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1300 struct pass_prompt *r = p->data;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1301 if (r->account == account)
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1302 return r;
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1303 p = p->next;
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1304 }
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1305 return NULL;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1306 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1307
4483
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1308 static void pass_callback(GtkDialog *d, gint resp, struct pass_prompt *p)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1309 {
4483
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1310 if (resp == GTK_RESPONSE_YES) {
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1311 const char *txt = gtk_entry_get_text(GTK_ENTRY(p->entry));
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1312 g_snprintf(p->account->password, sizeof(p->account->password), "%s", txt);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1313 serv_login(p->account);
4483
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1314 }
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1315 passes = g_slist_remove(passes, p);
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1316 gtk_widget_destroy(p->win);
4483
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1317 g_free(p);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1318 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1319
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1320 static void do_pass_dlg(struct gaim_account *account)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1321 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1322 /* we can safely assume that u is not NULL */
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1323 struct pass_prompt *p = find_pass_prompt(account);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1324 GtkWidget *label;
4483
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1325 GtkWidget *hbox, *vbox;
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1326 char *labeltext=NULL;
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4998
diff changeset
1327 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_AUTH, GTK_ICON_SIZE_DIALOG);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1328
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1329 if (p) {
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1330 gtk_widget_show(p->win);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1331 return;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1332 }
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1333
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1334 p = g_new0(struct pass_prompt, 1);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1335 p->account = account;
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1336 passes = g_slist_append(passes, p);
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1337
4778
85c6c3a60503 [gaim-migrate @ 5098]
Mark Doliner <mark@kingant.net>
parents: 4772
diff changeset
1338 p->win = gtk_dialog_new_with_buttons("", NULL, 0, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
4483
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1339 _("_Login"), GTK_RESPONSE_YES, NULL);
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1340
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1341 gtk_dialog_set_default_response (GTK_DIALOG(p->win), GTK_RESPONSE_YES);
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1342 g_signal_connect(G_OBJECT(p->win), "response", G_CALLBACK(pass_callback), p);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1343
4483
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1344 gtk_container_set_border_width (GTK_CONTAINER(p->win), 6);
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1345 gtk_window_set_resizable(GTK_WINDOW(p->win), FALSE);
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1346 gtk_dialog_set_has_separator(GTK_DIALOG(p->win), FALSE);
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1347 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(p->win)->vbox), 12);
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1348 gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(p->win)->vbox), 6);
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1349
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1350 hbox = gtk_hbox_new(FALSE, 12);
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1351 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(p->win)->vbox), hbox);
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1352 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1353
4483
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1354 vbox = gtk_vbox_new(FALSE, 0);
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1355 gtk_container_add(GTK_CONTAINER(hbox), vbox);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1356
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1357 labeltext = g_strdup_printf(_("Please enter your password for %s.\n\n"),
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1358 account->username);
4483
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1359 label = gtk_label_new(labeltext);
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1360 g_free(labeltext);
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1361
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1362 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1363 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1364 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1365
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1366 hbox = gtk_hbox_new(FALSE, 5);
4483
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1367 gtk_container_add(GTK_CONTAINER(vbox), hbox);
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1368 label = gtk_label_new_with_mnemonic(_("_Password"));
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1369 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1370 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1371
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1372 p->entry = gtk_entry_new();
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1373 gtk_entry_set_visibility(GTK_ENTRY(p->entry), FALSE);
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1374 gtk_box_pack_start(GTK_BOX(hbox), p->entry, FALSE, FALSE, 5);
4483
109948475ecc [gaim-migrate @ 4758]
Sean Egan <seanegan@gmail.com>
parents: 4448
diff changeset
1375 gtk_label_set_mnemonic_widget(GTK_LABEL(label), p->entry);
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1376 gtk_widget_grab_focus(p->entry);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1377
4413
a00bfe984e7e [gaim-migrate @ 4686]
Sean Egan <seanegan@gmail.com>
parents: 4388
diff changeset
1378 gtk_widget_show_all(p->win);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1379 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1380
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1381 static void acct_signin(GtkCellRendererToggle *cell, gchar *path_str,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1382 gpointer d)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1383 {
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1384 GtkTreeModel *model = (GtkTreeModel *)d;
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1385 GtkTreeIter iter;
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1386
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1387 struct gaim_account *account = NULL;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1388 GaimPlugin *p = NULL;
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1389 GaimPluginProtocolInfo *prpl_info = NULL;
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1390
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1391 gtk_tree_model_get_iter_from_string(model, &iter, path_str);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1392 gtk_tree_model_get(model, &iter, COLUMN_DATA, &account, -1);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1393
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1394 p = gaim_find_prpl(account->protocol);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1395
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1396 if (p != NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1397 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(p);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1398
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1399 if (!account->gc && p && prpl_info->login) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1400 GaimPlugin *p = gaim_find_prpl(account->protocol);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1401
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1402 if (p != NULL)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1403 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(p);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1404
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1405 if (p && !(prpl_info->options & OPT_PROTO_NO_PASSWORD) &&
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1406 !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL) &&
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1407 !account->password[0]) {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1408
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1409 do_pass_dlg(account);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1410 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1411 else {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1412 serv_login(account);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1413 }
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1414 } else if (account->gc) {
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1415 account->gc->wants_to_die = TRUE;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1416 signoff(account->gc);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1417 } else {
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1418 if (account->protocol == GAIM_PROTO_TOC)
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1419 do_error_dialog(_("TOC not found."),
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1420 _("You have attempted to login an IM account using the "
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1421 "TOC protocol. Because this protocol is inferior to "
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1422 "OSCAR, it is now compiled as a plugin by default. "
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1423 "To login, edit this account to use OSCAR or load the "
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1424 "TOC plugin."), GAIM_ERROR);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1425 else
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1426 do_error_dialog(_("Protocol not found."),
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1427 _("You cannot log this account in; you do not have "
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1428 "the protocol it uses loaded, or the protocol does "
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1429 "not have a login function."), GAIM_ERROR);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1430 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1431 }
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1432
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1433 static void acct_autologin(GtkCellRendererToggle *cell, gchar *path_str,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1434 gpointer d)
2007
948a67a691a6 [gaim-migrate @ 2017]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1956
diff changeset
1435 {
3867
43e396e94095 [gaim-migrate @ 4019]
Rob Flynn <gaim@robflynn.com>
parents: 3789
diff changeset
1436 GtkTreeModel *model = (GtkTreeModel *)d;
43e396e94095 [gaim-migrate @ 4019]
Rob Flynn <gaim@robflynn.com>
parents: 3789
diff changeset
1437 GtkTreeIter iter;
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1438
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1439 struct gaim_account *account = NULL;
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1440
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1441 gtk_tree_model_get_iter_from_string(model, &iter, path_str);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1442 gtk_tree_model_get(model, &iter, COLUMN_DATA, &account, -1);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1443
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1444 account->options ^= OPT_ACCT_AUTO;
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1445
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1446 gtk_list_store_set(GTK_LIST_STORE(model), &iter,
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1447 COLUMN_AUTOLOGIN, (account->options & OPT_ACCT_AUTO), -1);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1448
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1449 save_prefs();
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1450 }
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1451
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1452 static void do_del_acct(struct gaim_account *account)
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1453 {
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1454 GtkTreeIter iter;
4785
1e28e7d802a1 [gaim-migrate @ 5105]
Nathan Walp <nwalp@pidgin.im>
parents: 4778
diff changeset
1455 GaimBlistNode *gnode,*bnode;
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1456
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1457 if (account->gc) {
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1458 account->gc->wants_to_die = TRUE;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1459 signoff(account->gc);
2007
948a67a691a6 [gaim-migrate @ 2017]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1956
diff changeset
1460 }
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1461
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1462 if (get_iter_from_data(GTK_TREE_VIEW(treeview), account, &iter)) {
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1463 gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1464 }
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1465
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1466
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1467 /* remove the buddies for the account we just destroyed */
4785
1e28e7d802a1 [gaim-migrate @ 5105]
Nathan Walp <nwalp@pidgin.im>
parents: 4778
diff changeset
1468 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) {
1e28e7d802a1 [gaim-migrate @ 5105]
Nathan Walp <nwalp@pidgin.im>
parents: 4778
diff changeset
1469 struct group *g = (struct group *)gnode;
1e28e7d802a1 [gaim-migrate @ 5105]
Nathan Walp <nwalp@pidgin.im>
parents: 4778
diff changeset
1470 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
1e28e7d802a1 [gaim-migrate @ 5105]
Nathan Walp <nwalp@pidgin.im>
parents: 4778
diff changeset
1471 continue;
1e28e7d802a1 [gaim-migrate @ 5105]
Nathan Walp <nwalp@pidgin.im>
parents: 4778
diff changeset
1472 for(bnode = gnode->child; bnode; bnode = bnode->next) {
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1473 if(GAIM_BLIST_NODE_IS_BUDDY(bnode)) {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1474 struct buddy *b = (struct buddy *)bnode;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1475 if(b->account == account)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1476 gaim_blist_remove_buddy(b);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1477 } else if(GAIM_BLIST_NODE_IS_CHAT(bnode)) {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1478 struct chat *chat = (struct chat *)bnode;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1479 if(chat->account == account)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1480 gaim_blist_remove_chat(chat);
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1481 }
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1482 }
4785
1e28e7d802a1 [gaim-migrate @ 5105]
Nathan Walp <nwalp@pidgin.im>
parents: 4778
diff changeset
1483 if(!gnode->child) {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4639
diff changeset
1484 gaim_blist_remove_group(g);
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1485 }
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1486 }
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1487
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1488 gaim_accounts = g_slist_remove(gaim_accounts, account);
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1489
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1490 gaim_blist_save();
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1491
2007
948a67a691a6 [gaim-migrate @ 2017]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1956
diff changeset
1492 save_prefs();
948a67a691a6 [gaim-migrate @ 2017]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1956
diff changeset
1493 }
948a67a691a6 [gaim-migrate @ 2017]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1956
diff changeset
1494
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1495 static void del_acct_func(GtkTreeModel *model, GtkTreePath *path,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1496 GtkTreeIter *iter, gpointer data)
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1497 {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1498 struct gaim_account *account;
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1499
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1500 gtk_tree_model_get(model, iter, COLUMN_DATA, &account, -1);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1501
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1502 if (account != NULL) {
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1503 char buf[8192];
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1504
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1505 g_snprintf(buf, sizeof(buf),
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1506 _("Are you sure you want to delete %s?"), account->username);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1507 do_ask_dialog(buf, NULL, account, _("Delete"), do_del_acct, _("Cancel"), NULL, NULL, FALSE);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1508 }
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1509 }
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1510
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1511 static void del_acct(GtkWidget *w, gpointer d)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1512 {
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1513 GtkTreeSelection *selection;
2008
6f049002d963 [gaim-migrate @ 2018]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2007
diff changeset
1514
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1515 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1516
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1517 gtk_tree_selection_selected_foreach(selection, del_acct_func, NULL);
2008
6f049002d963 [gaim-migrate @ 2018]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2007
diff changeset
1518 }
2007
948a67a691a6 [gaim-migrate @ 2017]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1956
diff changeset
1519
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1520 void account_editor(GtkWidget *w, GtkWidget *W)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1521 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1522 /* please kill me */
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1523 GtkWidget *vbox;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1524 GtkWidget *hbox;
2008
6f049002d963 [gaim-migrate @ 2018]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2007
diff changeset
1525 GtkWidget *sw;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1526 GtkWidget *button; /* used for many things */
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1527 GtkWidget *sep;
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1528 GtkSizeGroup *sg;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1529
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1530 if (acctedit) {
3472
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
1531 gtk_window_present(GTK_WINDOW(acctedit));
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1532 return;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1533 }
3764
6400b37e0c35 [gaim-migrate @ 3903]
Rob Flynn <gaim@robflynn.com>
parents: 3760
diff changeset
1534
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1535 acctedit = gtk_window_new(GTK_WINDOW_TOPLEVEL);
4703
e4dda06a3143 [gaim-migrate @ 5014]
Sean Egan <seanegan@gmail.com>
parents: 4695
diff changeset
1536 gtk_window_set_title(GTK_WINDOW(acctedit), _("Account Editor"));
4074
3ccbdf8e7f8d [gaim-migrate @ 4289]
Sean Egan <seanegan@gmail.com>
parents: 4040
diff changeset
1537 gtk_window_set_role(GTK_WINDOW(acctedit), "accounteditor");
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1538 gtk_widget_realize(acctedit);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
1539 gtk_widget_set_size_request(acctedit, -1, 250);
3755
a868e1181321 [gaim-migrate @ 3894]
Sean Egan <seanegan@gmail.com>
parents: 3754
diff changeset
1540 gtk_window_set_default_size(GTK_WINDOW(acctedit), 550, 250);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1541 g_signal_connect(G_OBJECT(acctedit), "delete_event",
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1542 G_CALLBACK(on_delete_acctedit), W);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1543
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1544 vbox = gtk_vbox_new(FALSE, 6);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1545 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1546 gtk_container_add(GTK_CONTAINER(acctedit), vbox);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1547
2008
6f049002d963 [gaim-migrate @ 2018]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2007
diff changeset
1548 sw = generate_list();
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1549 hbox = gtk_hbox_new(FALSE, 6);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1550 gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 6);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1551
4550
972af41f277c [gaim-migrate @ 4830]
Christian Hammond <chipx86@chipx86.com>
parents: 4493
diff changeset
1552 gtk_box_pack_start(GTK_BOX(hbox), sw, TRUE, TRUE, 0);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1553
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1554 sep = gtk_hseparator_new();
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1555 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1556
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1557 hbox = gtk_hbox_new(FALSE, 6);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1558 gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1559 gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1560
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1561 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1562
3885
94852b7cc81f [gaim-migrate @ 4037]
Rob Flynn <gaim@robflynn.com>
parents: 3867
diff changeset
1563 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1564 gtk_size_group_add_widget(sg, button);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1565 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1566 g_signal_connect(G_OBJECT(button), "clicked",
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1567 G_CALLBACK(on_close_acctedit), W);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1568
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1569 button = gtk_button_new_from_stock(GTK_STOCK_DELETE);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1570 gtk_size_group_add_widget(sg, button);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1571 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1572 g_signal_connect(G_OBJECT(button), "clicked",
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1573 G_CALLBACK(del_acct), NULL);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1574
4114
fa5075168c23 [gaim-migrate @ 4330]
Luke Schierer <lschiere@pidgin.im>
parents: 4111
diff changeset
1575 button = gaim_pixbuf_button_from_stock(_("_Modify"), GTK_STOCK_PREFERENCES,
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1576 GAIM_BUTTON_HORIZONTAL);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1577 gtk_size_group_add_widget(sg, button);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1578 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1579 g_signal_connect(G_OBJECT(button), "clicked",
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1580 G_CALLBACK(mod_acct), NULL);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1581
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1582 button = gtk_button_new_from_stock(GTK_STOCK_ADD);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1583 gtk_size_group_add_widget(sg, button);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1584 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1585 g_signal_connect(G_OBJECT(button), "clicked",
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1586 G_CALLBACK(add_acct), NULL);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1587
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1588 gtk_widget_show_all(acctedit);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1589 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1590
2402
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1591 struct signon_meter {
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1592 struct gaim_connection *gc;
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1593 GtkWidget *button;
2402
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1594 GtkWidget *progress;
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1595 GtkWidget *status;
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1596 };
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1597 static GSList *meters = NULL;
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1598
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4639
diff changeset
1599 GtkWidget* create_meter_pixmap (struct gaim_connection *gc)
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1600 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4639
diff changeset
1601 GdkPixbuf *pb = create_prpl_icon(gc->account);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4639
diff changeset
1602 GdkPixbuf *scale = gdk_pixbuf_scale_simple(pb, 30,30,GDK_INTERP_BILINEAR);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4639
diff changeset
1603 GtkWidget *image =
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4639
diff changeset
1604 gtk_image_new_from_pixbuf(scale);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4639
diff changeset
1605 g_object_unref(G_OBJECT(pb));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4639
diff changeset
1606 g_object_unref(G_OBJECT(scale));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4639
diff changeset
1607 return image;
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1608 }
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1609
2402
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1610 static struct signon_meter *find_signon_meter(struct gaim_connection *gc)
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1611 {
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1612 GSList *m = meters;
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1613 while (m) {
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1614 if (((struct signon_meter *)m->data)->gc == gc)
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1615 return m->data;
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1616 m = m->next;
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1617 }
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1618 return NULL;
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1619 }
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1620
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1621 void kill_meter(struct signon_meter *meter) {
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1622 gtk_widget_set_sensitive (meter->button, FALSE);
4275
5ce5b252cdb1 [gaim-migrate @ 4526]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1623 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(meter->progress), 1);
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1624 gtk_statusbar_pop(GTK_STATUSBAR(meter->status), 1);
4169
40d35a98f481 [gaim-migrate @ 4398]
Luke Schierer <lschiere@pidgin.im>
parents: 4162
diff changeset
1625 gtk_statusbar_push(GTK_STATUSBAR(meter->status), 1, _("Done."));
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1626 meter_win->active_count--;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1627 if (meter_win->active_count == 0) {
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1628 gtk_widget_destroy(meter_win->window);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1629 g_free (meter_win);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1630 meter_win = NULL;
3554
cf00549c53d7 [gaim-migrate @ 3644]
Sean Egan <seanegan@gmail.com>
parents: 3517
diff changeset
1631 }
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1632 }
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1633
4890
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1634 void away_on_login(char *mesg)
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1635 {
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1636 GSList *awy = away_messages;
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1637 struct away_message *a, *message = NULL;
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1638 struct gaim_gtk_buddy_list *gtkblist;
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1639
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1640 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1641
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1642 if (!gtkblist->window) {
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1643 return;
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1644 }
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1645
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1646 if (mesg == NULL) {
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1647 /* Use default message */
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1648 do_away_message(NULL, default_away);
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1649 } else {
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1650 /* Use argument */
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1651 while (awy) {
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1652 a = (struct away_message *)awy->data;
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1653 if (strcmp(a->name, mesg) == 0) {
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1654 message = a;
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1655 break;
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1656 }
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1657 awy = awy->next;
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1658 }
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1659 if (message == NULL)
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1660 message = default_away;
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1661 do_away_message(NULL, message);
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1662 }
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1663 return;
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1664 }
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents: 4856
diff changeset
1665
1089
f0f5c10cce63 [gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1086
diff changeset
1666 void account_online(struct gaim_connection *gc)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1667 {
2402
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1668 struct signon_meter *meter = find_signon_meter(gc);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1669 GList *wins;
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1670 GtkTreeIter iter;
4785
1e28e7d802a1 [gaim-migrate @ 5105]
Nathan Walp <nwalp@pidgin.im>
parents: 4778
diff changeset
1671 GaimBlistNode *gnode,*bnode;
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1672 GList *add_buds=NULL;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1673 GList *l;
1002
1d8f05ea6bdf [gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 998
diff changeset
1674
4333
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4275
diff changeset
1675 /* Set the time the account came online */
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4275
diff changeset
1676 time(&gc->login_time);
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4275
diff changeset
1677
1002
1d8f05ea6bdf [gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 998
diff changeset
1678 /* first we hide the login progress meter */
2402
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1679 if (meter) {
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1680 kill_meter(meter);
2402
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1681 meters = g_slist_remove(meters, meter);
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1682 g_free(meter);
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1683 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1684
1002
1d8f05ea6bdf [gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 998
diff changeset
1685 /* then we do the buddy list stuff */
1d8f05ea6bdf [gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 998
diff changeset
1686 if (mainwindow)
1d8f05ea6bdf [gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 998
diff changeset
1687 gtk_widget_hide(mainwindow);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1688
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4639
diff changeset
1689 gaim_blist_show();
1002
1d8f05ea6bdf [gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 998
diff changeset
1690
3367
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3285
diff changeset
1691 update_privacy_connections();
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1391
diff changeset
1692 do_away_menu();
1499
de0b946e86a4 [gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1474
diff changeset
1693 do_proto_menu();
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1694
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1695 gaim_blist_add_account(gc->account);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1696
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1697 /*
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1698 * XXX This is a hack! Remove this and replace it with a better event
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1699 * notification system.
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1700 */
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1701 for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1702 struct gaim_window *win = (struct gaim_window *)wins->data;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1703 gaim_conversation_update(gaim_window_get_conversation_at(win, 0),
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1704 GAIM_CONV_ACCOUNT_ONLINE);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1705 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1706
1002
1d8f05ea6bdf [gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 998
diff changeset
1707 gaim_setup(gc);
1d8f05ea6bdf [gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 998
diff changeset
1708
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1709 gc->account->connecting = FALSE;
3726
d85208a99af2 [gaim-migrate @ 3862]
Luke Schierer <lschiere@pidgin.im>
parents: 3717
diff changeset
1710 connecting_count--;
5211
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
1711 gaim_debug(GAIM_DEBUG_MISC, "accounts",
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
1712 "Connecting count: %d\n", connecting_count);
3570
b791019b2492 [gaim-migrate @ 3666]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
1713
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1714 gaim_event_broadcast(event_signon, gc);
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1499
diff changeset
1715 system_log(log_signon, gc, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON);
1002
1d8f05ea6bdf [gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 998
diff changeset
1716
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1717 /* away option given? */
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1718 if (opt_away) {
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1719 away_on_login(opt_away_arg);
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1720 /* don't do it again */
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1721 opt_away = 0;
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1391
diff changeset
1722 } else if (awaymessage) {
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1391
diff changeset
1723 serv_set_away(gc, GAIM_AWAY_CUSTOM, awaymessage->message);
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1724 }
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1725 if (opt_away_arg != NULL) {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2364
diff changeset
1726 g_free(opt_away_arg);
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1727 opt_away_arg = NULL;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1728 }
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1729
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1730 /* let the prpl know what buddies we pulled out of the local list */
4785
1e28e7d802a1 [gaim-migrate @ 5105]
Nathan Walp <nwalp@pidgin.im>
parents: 4778
diff changeset
1731 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) {
1e28e7d802a1 [gaim-migrate @ 5105]
Nathan Walp <nwalp@pidgin.im>
parents: 4778
diff changeset
1732 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
1e28e7d802a1 [gaim-migrate @ 5105]
Nathan Walp <nwalp@pidgin.im>
parents: 4778
diff changeset
1733 continue;
1e28e7d802a1 [gaim-migrate @ 5105]
Nathan Walp <nwalp@pidgin.im>
parents: 4778
diff changeset
1734 for(bnode = gnode->child; bnode; bnode = bnode->next) {
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1735 if(GAIM_BLIST_NODE_IS_BUDDY(bnode)) {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1736 struct buddy *b = (struct buddy *)bnode;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1737 if(b->account == gc->account) {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1738 add_buds = g_list_append(add_buds, b->name);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1739 }
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1740 }
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1741 }
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1742 }
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1743
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1744 if(add_buds) {
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1745 serv_add_buddies(gc, add_buds);
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1746 g_list_free(add_buds);
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1747 }
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1748
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1749 serv_set_permit_deny(gc);
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1750
1002
1d8f05ea6bdf [gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 998
diff changeset
1751 /* everything for the account editor */
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1752 if (!acctedit)
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1753 return;
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1754
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1755 if (get_iter_from_data(GTK_TREE_VIEW(treeview), gc->account, &iter)) {
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1756 gtk_list_store_set(model, &iter,
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1757 COLUMN_ONLINE, TRUE,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
1758 COLUMN_PROTOCOL, gc->prpl->info->name,
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1759 -1);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1760 }
1002
1d8f05ea6bdf [gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 998
diff changeset
1761
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1762 /* Update the conversation windows that use this account. */
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1763 for (l = gaim_get_conversations(); l != NULL; l = l->next) {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1764 struct gaim_conversation *conv = (struct gaim_conversation *)l->data;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1765
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1766 if (gaim_conversation_get_account(conv) == gc->account) {
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1767 gaim_conversation_update(conv, GAIM_CONV_UPDATE_ACCOUNT);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1768 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1769 }
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1770 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1771
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1772 void account_offline(struct gaim_connection *gc)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1773 {
2402
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1774 struct signon_meter *meter = find_signon_meter(gc);
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1775 GtkTreeIter iter;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1776 GList *l;
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1777
2402
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1778 if (meter) {
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1779 kill_meter(meter);
2402
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1780 meters = g_slist_remove(meters, meter);
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1781 g_free(meter);
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1782 }
5211
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
1783
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
1784 gaim_debug(GAIM_DEBUG_MISC, "accounts",
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
1785 "Disconnecting. user = %p, gc = %p (%p)\n",
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
1786 gc->account, gc->account->gc, gc);
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
1787
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1788 gc->account->gc = NULL; /* wasn't that awkward? */
4388
bf6ac19d0d63 [gaim-migrate @ 4654]
Nathan Walp <nwalp@pidgin.im>
parents: 4359
diff changeset
1789
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1790 if (!acctedit)
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1791 return;
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1792
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1793 if (get_iter_from_data(GTK_TREE_VIEW(treeview), gc->account, &iter)) {
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1794 gtk_list_store_set(model, &iter, COLUMN_ONLINE, FALSE, -1);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
1795 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1796
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1797 /* Update the conversation windows that use this account. */
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1798 for (l = gaim_get_conversations(); l != NULL; l = l->next) {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1799 struct gaim_conversation *conv = (struct gaim_conversation *)l->data;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1800
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1801 if (gaim_conversation_get_account(conv) == gc->account) {
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1802 gaim_conversation_update(conv, GAIM_CONV_UPDATE_ACCOUNT);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1803 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1804 }
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1805 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1806
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1807 void auto_login()
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1808 {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1809 GSList *accts = gaim_accounts;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1810 struct gaim_account *a = NULL;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1811
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1812 while (accts) {
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1813 a = (struct gaim_account *)accts->data;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1814 if ((a->options & OPT_ACCT_AUTO) && (a->options & OPT_ACCT_REM_PASS)) {
980
82c5865f7cfe [gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 977
diff changeset
1815 serv_login(a);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1816 }
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1817 accts = accts->next;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1818 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1819 }
988
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 984
diff changeset
1820
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1821 /*
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1822 * d:)->-<
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1823 *
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1824 * d:O-\-<
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1825 *
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1826 * d:D-/-<
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1827 *
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1828 * d8D->-< DANCE!
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1829 */
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1830
2402
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1831 static void cancel_signon(GtkWidget *button, struct signon_meter *meter)
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1832 {
2402
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1833 meter->gc->wants_to_die = TRUE;
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1834 signoff(meter->gc);
1089
f0f5c10cce63 [gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1086
diff changeset
1835 }
f0f5c10cce63 [gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1086
diff changeset
1836
2402
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1837 static gint meter_destroy(GtkWidget *window, GdkEvent *evt, struct signon_meter *meter)
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1838 {
1089
f0f5c10cce63 [gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1086
diff changeset
1839 return TRUE;
988
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 984
diff changeset
1840 }
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 984
diff changeset
1841
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1842 static struct signon_meter *register_meter(struct gaim_connection *gc, GtkWidget *widget, GtkTable *table, gint *rows)
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1843 {
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1844 GtkWidget *graphic;
3378
8c394e9f0dfb [gaim-migrate @ 3397]
Sean Egan <seanegan@gmail.com>
parents: 3375
diff changeset
1845 GtkWidget *label;
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1846 GtkWidget *nest_vbox;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1847 GString *name_to_print;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1848 struct signon_meter *meter;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1849
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1850 name_to_print = g_string_new(gc->username);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1851
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1852 meter = g_new0(struct signon_meter, 1);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1853
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1854 (*rows)++;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1855 gtk_table_resize (table, *rows, 4);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1856
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4639
diff changeset
1857 graphic = create_meter_pixmap(gc);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1858
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1859 nest_vbox = gtk_vbox_new (FALSE, 0);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1860
4225
76ea459c8b5b [gaim-migrate @ 4469]
Luke Schierer <lschiere@pidgin.im>
parents: 4169
diff changeset
1861 g_string_prepend(name_to_print, _("Signon: "));
3378
8c394e9f0dfb [gaim-migrate @ 3397]
Sean Egan <seanegan@gmail.com>
parents: 3375
diff changeset
1862 label = gtk_label_new (name_to_print->str);
4225
76ea459c8b5b [gaim-migrate @ 4469]
Luke Schierer <lschiere@pidgin.im>
parents: 4169
diff changeset
1863 g_string_free(name_to_print, TRUE);
3378
8c394e9f0dfb [gaim-migrate @ 3397]
Sean Egan <seanegan@gmail.com>
parents: 3375
diff changeset
1864 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1865
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1866 meter->status = gtk_statusbar_new();
4639
2c9f1ac20b36 [gaim-migrate @ 4947]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
1867 gtk_widget_set_size_request(meter->status, 250, -1);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1868
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1869 meter->progress = gtk_progress_bar_new ();
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1870
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4998
diff changeset
1871 meter->button = gaim_pixbuf_button_from_stock (_("Cancel"), GTK_STOCK_CANCEL, GAIM_BUTTON_HORIZONTAL);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1872 g_signal_connect(G_OBJECT (meter->button), "clicked",
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1873 G_CALLBACK (cancel_signon), meter);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1874
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1875 gtk_table_attach (GTK_TABLE (table), graphic, 0, 1, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1876 gtk_table_attach (GTK_TABLE (table), nest_vbox, 1, 2, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
3378
8c394e9f0dfb [gaim-migrate @ 3397]
Sean Egan <seanegan@gmail.com>
parents: 3375
diff changeset
1877 gtk_box_pack_start (GTK_BOX (nest_vbox), GTK_WIDGET (label), FALSE, FALSE, 0);
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1878 gtk_box_pack_start (GTK_BOX (nest_vbox), GTK_WIDGET (meter->status), FALSE, FALSE, 0);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1879 gtk_table_attach (GTK_TABLE (table), meter->progress, 2, 3, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1880 gtk_table_attach (GTK_TABLE (table), meter->button, 3, 4, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1881
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1882 gtk_widget_show_all (GTK_WIDGET (meter_win->window));
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1883
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1884 meter_win->active_count++;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1885
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1886 return meter;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1887 }
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1888
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1889 static void loop_cancel () {
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1890 GSList *m = meters;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1891 struct signon_meter *meter = NULL;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1892
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1893 while (m) {
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1894 meter = (struct signon_meter *) (m->data);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1895 meter->gc->wants_to_die = TRUE;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1896 signoff((struct gaim_connection *) meter->gc);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1897 m = meters;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1898 }
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1899 }
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1900
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1901 void set_login_progress(struct gaim_connection *gc, float howfar, char *message)
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1172
diff changeset
1902 {
2402
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1903 struct signon_meter *meter = find_signon_meter(gc);
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1904
988
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 984
diff changeset
1905 if (mainwindow)
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 984
diff changeset
1906 gtk_widget_hide(mainwindow);
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 984
diff changeset
1907
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1908 if (!meter_win) {
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1909 GtkWidget *cancel_button;
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1910 GtkWidget *vbox;
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
1911
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1912 meter_win = g_new0(struct meter_window, 1);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1913 meter_win->rows=0;
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
1914
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1915 meter_win->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1916 GAIM_DIALOG(meter_win->window);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
1917 gtk_window_set_resizable(GTK_WINDOW(meter_win->window), FALSE);
4074
3ccbdf8e7f8d [gaim-migrate @ 4289]
Sean Egan <seanegan@gmail.com>
parents: 4040
diff changeset
1918 gtk_window_set_role(GTK_WINDOW(meter_win->window), "signon");
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1919 gtk_container_set_border_width(GTK_CONTAINER(meter_win->window), 5);
4703
e4dda06a3143 [gaim-migrate @ 5014]
Sean Egan <seanegan@gmail.com>
parents: 4695
diff changeset
1920 gtk_window_set_title (GTK_WINDOW (meter_win->window), _("Signon"));
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1921 gtk_widget_realize(meter_win->window);
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4634
diff changeset
1922
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1923 vbox = gtk_vbox_new (FALSE, 0);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1924 gtk_container_add (GTK_CONTAINER (meter_win->window), GTK_WIDGET (vbox));
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1925
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1926 meter_win->table = (GtkTable *) gtk_table_new (1 , 4, FALSE);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1927 gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (meter_win->table), FALSE, FALSE, 0);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1928 gtk_container_set_border_width (GTK_CONTAINER (meter_win->table), 5);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1929 gtk_table_set_row_spacings (GTK_TABLE (meter_win->table), 5);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1930 gtk_table_set_col_spacings (GTK_TABLE (meter_win->table), 10);
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1931
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 4998
diff changeset
1932 cancel_button = gaim_pixbuf_button_from_stock (_("Cancel All"), GTK_STOCK_QUIT, GAIM_BUTTON_HORIZONTAL);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1933 g_signal_connect_swapped(G_OBJECT(cancel_button), "clicked",
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1934 G_CALLBACK (loop_cancel), NULL);
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1935 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(cancel_button), FALSE, FALSE, 0);
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1936
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1937 g_signal_connect(G_OBJECT(meter_win->window), "delete_event",
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1938 G_CALLBACK(meter_destroy), NULL);
4987
1f92610b0772 [gaim-migrate @ 5322]
Mark Doliner <mark@kingant.net>
parents: 4966
diff changeset
1939 }
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1940
2402
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1941 if (!meter) {
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1942 meter = register_meter(gc, GTK_WIDGET (meter_win->window), GTK_TABLE (meter_win->table), (gint *) &meter_win->rows);
2402
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1943 meter->gc = gc;
2403
8555e48c02df [gaim-migrate @ 2416]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2402
diff changeset
1944 meters = g_slist_append(meters, meter);
988
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 984
diff changeset
1945 }
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 984
diff changeset
1946
4275
5ce5b252cdb1 [gaim-migrate @ 4526]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1947 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(meter->progress), howfar / LOGIN_STEPS);
2402
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1948 gtk_statusbar_pop(GTK_STATUSBAR(meter->status), 1);
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1949 gtk_statusbar_push(GTK_STATUSBAR(meter->status), 1, message);
988
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 984
diff changeset
1950 }
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 984
diff changeset
1951
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1952 struct kick_dlg {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1953 struct gaim_account *account;
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1954 GtkWidget *dlg;
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1955 };
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1956 static GSList *kicks = NULL;
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1957
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1958 static struct kick_dlg *find_kick_dlg(struct gaim_account *account)
1817
b367beee6448 [gaim-migrate @ 1827]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1772
diff changeset
1959 {
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1960 GSList *k = kicks;
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1961 while (k) {
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1962 struct kick_dlg *d = k->data;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1963 if (d->account == account)
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1964 return d;
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1965 k = k->next;
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1966 }
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1967 return NULL;
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1968 }
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1969
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1970 static void set_kick_null(GtkObject *obj, struct kick_dlg *k)
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1971 {
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1972 kicks = g_slist_remove(kicks, k);
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1973 g_free(k);
1817
b367beee6448 [gaim-migrate @ 1827]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1772
diff changeset
1974 }
b367beee6448 [gaim-migrate @ 1827]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1772
diff changeset
1975
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
1976 /*
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
1977 * Common code for hide_login_progress(), and hide_login_progress_info()
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
1978 */
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
1979 static void hide_login_progress_common(struct gaim_connection *gc,
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
1980 char *details,
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
1981 char *title,
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
1982 char *prologue)
988
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 984
diff changeset
1983 {
4617
858979ab3867 [gaim-migrate @ 4908]
Mark Doliner <mark@kingant.net>
parents: 4550
diff changeset
1984 gchar *buf;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1985 struct kick_dlg *k = find_kick_dlg(gc->account);
2402
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1986 struct signon_meter *meter = find_signon_meter(gc);
4617
858979ab3867 [gaim-migrate @ 4908]
Mark Doliner <mark@kingant.net>
parents: 4550
diff changeset
1987 buf = g_strdup_printf(_("%s\n%s: %s"), full_date(), prologue, details);
2442
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1988 if (k)
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1989 gtk_widget_destroy(k->dlg);
895e2469cb3a [gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2438
diff changeset
1990 k = g_new0(struct kick_dlg, 1);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
1991 k->account = gc->account;
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3391
diff changeset
1992 k->dlg = do_error_dialog(title, buf, GAIM_ERROR);
2709
df0832a9ccec [gaim-migrate @ 2722]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2707
diff changeset
1993 kicks = g_slist_append(kicks, k);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1994 g_signal_connect(G_OBJECT(k->dlg), "destroy",
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5234
diff changeset
1995 G_CALLBACK(set_kick_null), k);
2402
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1996 if (meter) {
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2975
diff changeset
1997 kill_meter(meter);
2402
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1998 meters = g_slist_remove(meters, meter);
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
1999 g_free(meter);
6e3dc0b3b9b1 [gaim-migrate @ 2415]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
2000 }
4617
858979ab3867 [gaim-migrate @ 4908]
Mark Doliner <mark@kingant.net>
parents: 4550
diff changeset
2001 g_free(buf);
988
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 984
diff changeset
2002 }
1355
04874e92af24 [gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2003
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
2004 void hide_login_progress(struct gaim_connection *gc, char *why)
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
2005 {
4617
858979ab3867 [gaim-migrate @ 4908]
Mark Doliner <mark@kingant.net>
parents: 4550
diff changeset
2006 gchar *buf;
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
2007
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
2008 gaim_event_broadcast(event_error, gc, why);
4617
858979ab3867 [gaim-migrate @ 4908]
Mark Doliner <mark@kingant.net>
parents: 4550
diff changeset
2009 buf = g_strdup_printf(_("%s was unable to sign on"), gc->username);
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
2010 hide_login_progress_common(gc, why, _("Signon Error"), buf);
4617
858979ab3867 [gaim-migrate @ 4908]
Mark Doliner <mark@kingant.net>
parents: 4550
diff changeset
2011 g_free(buf);
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
2012 }
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
2013
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
2014 /*
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
2015 * Like hide_login_progress(), but for informational, not error/warning,
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
2016 * messages.
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
2017 *
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
2018 */
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
2019 void hide_login_progress_notice(struct gaim_connection *gc, char *why)
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
2020 {
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
2021 hide_login_progress_common(gc, why, _("Notice"), gc->username);
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
2022 }
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2725
diff changeset
2023
3074
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3069
diff changeset
2024 /*
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3069
diff changeset
2025 * Like hide_login_progress(), but for non-signon error messages.
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3069
diff changeset
2026 *
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3069
diff changeset
2027 */
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3069
diff changeset
2028 void hide_login_progress_error(struct gaim_connection *gc, char *why)
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3069
diff changeset
2029 {
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3069
diff changeset
2030 char buf[2048];
4617
858979ab3867 [gaim-migrate @ 4908]
Mark Doliner <mark@kingant.net>
parents: 4550
diff changeset
2031
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
2032 gaim_event_broadcast(event_error, gc, why);
3074
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3069
diff changeset
2033 g_snprintf(buf, sizeof(buf), _("%s has been signed off"), gc->username);
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3069
diff changeset
2034 hide_login_progress_common(gc, why, _("Connection Error"), buf);
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3069
diff changeset
2035 }
793fb2e9d53b [gaim-migrate @ 3088]
Sean Egan <seanegan@gmail.com>
parents: 3069
diff changeset
2036
2559
e49ab50736bf [gaim-migrate @ 2572]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2525
diff changeset
2037 void signoff_all()
2380
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2038 {
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2039 GSList *c = connections;
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2040 struct gaim_connection *g = NULL;
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2041
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2042 while (c) {
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2043 g = (struct gaim_connection *)c->data;
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2044 g->wants_to_die = TRUE;
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2045 signoff(g);
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2046 c = connections;
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2047 }
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2048 }
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2049
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2050 void signoff(struct gaim_connection *gc)
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2051 {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2052 GList *wins;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2053
5413
573501c63fef [gaim-migrate @ 5789]
Nathan Walp <nwalp@pidgin.im>
parents: 5401
diff changeset
2054 /* we only remove the account if we ever added it */
573501c63fef [gaim-migrate @ 5789]
Nathan Walp <nwalp@pidgin.im>
parents: 5401
diff changeset
2055 if(!gc->account->connecting)
573501c63fef [gaim-migrate @ 5789]
Nathan Walp <nwalp@pidgin.im>
parents: 5401
diff changeset
2056 gaim_blist_remove_account(gc->account);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
2057
2380
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2058 /* core stuff */
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
2059 /* remove this here so plugins get a sensible count of connections */
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
2060 connections = g_slist_remove(connections, gc);
5211
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
2061 gaim_debug(GAIM_DEBUG_MISC, "accounts", "date: %s\n", full_date());
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5068
diff changeset
2062 gaim_event_broadcast(event_signoff, gc);
2380
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2063 system_log(log_signoff, gc, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
2064 /* set this in case the plugin died before really connecting.
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
2065 do it after calling the plugins so they can determine if
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
2066 this user was ever on-line or not */
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
2067 if (gc->account->connecting) {
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
2068 gc->account->connecting = FALSE;
3726
d85208a99af2 [gaim-migrate @ 3862]
Luke Schierer <lschiere@pidgin.im>
parents: 3717
diff changeset
2069 connecting_count--;
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3510
diff changeset
2070 }
5211
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
2071 gaim_debug(GAIM_DEBUG_MISC, "accounts", "connecting_count: %d\n",
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
2072 connecting_count);
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
2073 serv_close(gc);
2380
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2074
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
2075 /* more UI stuff */
2380
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2076 do_away_menu();
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2077 do_proto_menu();
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2078
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2079 /*
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2080 * XXX This is a hack! Remove this and replace it with a better event
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2081 * notification system.
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2082 */
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2083 for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2084 struct gaim_window *win = (struct gaim_window *)wins->data;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2085 gaim_conversation_update(gaim_window_get_conversation_at(win, 0),
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2086 GAIM_CONV_ACCOUNT_OFFLINE);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2087 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2088
3367
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3285
diff changeset
2089 update_privacy_connections();
2380
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2090
3510
e23909729192 [gaim-migrate @ 3576]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
2091 /* in, out, shake it all about */
2380
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2092 if (connections)
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2093 return;
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2094
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2095 destroy_all_dialogs();
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4639
diff changeset
2096 gaim_blist_destroy();
3472
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
2097
2380
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2098 show_login();
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2099 }
6f83c22d9e70 [gaim-migrate @ 2393]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
2100
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
2101 struct gaim_account *gaim_account_new(const char *name, int proto, int opts)
1355
04874e92af24 [gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2102 {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
2103 struct gaim_account *account = g_new0(struct gaim_account, 1);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
2104 g_snprintf(account->username, sizeof(account->username), "%s", name);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
2105 g_snprintf(account->user_info, sizeof(account->user_info), "%s", DEFAULT_INFO);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
2106 account->protocol = proto;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
2107 account->options = opts;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
2108 account->permit = NULL;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
2109 account->deny = NULL;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
2110 gaim_accounts = g_slist_append(gaim_accounts, account);
1355
04874e92af24 [gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2111
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
2112 if (treeview) {
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
2113 GtkTreeIter iter;
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
2114
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
2115 gtk_list_store_append(model, &iter);
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
2116 gtk_list_store_set(model, &iter,
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
2117 COLUMN_SCREENNAME, account->username,
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
2118 COLUMN_ONLINE, (account->gc ? TRUE : FALSE),
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
2119 COLUMN_AUTOLOGIN, (account->options & OPT_ACCT_AUTO),
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
2120 COLUMN_PROTOCOL, proto_name(account->protocol),
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
2121 COLUMN_DATA, account,
3754
599194293ee5 [gaim-migrate @ 3893]
Sean Egan <seanegan@gmail.com>
parents: 3730
diff changeset
2122 -1);
1355
04874e92af24 [gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2123 }
04874e92af24 [gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2124
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4484
diff changeset
2125 return account;
1355
04874e92af24 [gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1261
diff changeset
2126 }