Mercurial > pidgin
annotate src/aim.c @ 253:5b28ef2b550e
[gaim-migrate @ 263]
A few things happened in this update:
- Commented out the libfaim deny/permit list stuff because it's seriously buggy
- Added Socks v4 support
- improved proxy support for things like getting users' info
- i think that's it
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Tue, 23 May 2000 05:26:30 +0000 |
| parents | f3b61c04f44e |
| children | 59f1748b09a6 |
| rev | line source |
|---|---|
| 1 | 1 /* |
| 2 * gaim | |
| 3 * | |
| 4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
| 5 * | |
| 6 * This program is free software; you can redistribute it and/or modify | |
| 7 * it under the terms of the GNU General Public License as published by | |
| 8 * the Free Software Foundation; either version 2 of the License, or | |
| 9 * (at your option) any later version. | |
| 10 * | |
| 11 * This program is distributed in the hope that it will be useful, | |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 * GNU General Public License for more details. | |
| 15 * | |
| 16 * You should have received a copy of the GNU General Public License | |
| 17 * along with this program; if not, write to the Free Software | |
| 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 19 * | |
| 20 */ | |
| 21 | |
| 22 #ifdef USE_THEMES | |
| 23 #include <gnome.h> | |
| 24 #else | |
| 25 #ifdef USE_APPLET | |
| 26 #include "gnome_applet_mgr.h" | |
| 27 #include <gnome.h> | |
| 28 #endif /* USE_APPLET */ | |
| 29 #endif /* USE_THEMES */ | |
| 30 #include <gtk/gtk.h> | |
| 31 #include <gdk/gdkx.h> | |
|
216
f7e17fb767eb
[gaim-migrate @ 226]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
200
diff
changeset
|
32 #include <gdk/gdk.h> |
| 1 | 33 #include <unistd.h> |
| 34 #include <netinet/in.h> | |
| 35 #include <arpa/inet.h> | |
| 36 #include <sys/wait.h> | |
| 37 #include <stdio.h> | |
| 38 #include <string.h> | |
| 39 #include <stdarg.h> | |
| 40 #include <stdlib.h> | |
| 228 | 41 #include <ctype.h> |
| 1 | 42 #include "gaim.h" |
| 43 #ifndef USE_APPLET | |
| 44 #include "pixmaps/logo.xpm" | |
| 45 #endif /* USE_APPLET */ | |
| 46 | |
| 47 static GtkWidget *name; | |
| 48 static GtkWidget *pass; | |
| 49 static GtkWidget *signon; | |
| 50 static GtkWidget *cancel; | |
| 51 static GtkWidget *progress; | |
| 52 static GtkWidget *notice; | |
| 53 | |
| 54 GList *permit = NULL; | |
| 55 GList *deny = NULL; | |
| 56 GList *log_conversations = NULL; | |
| 57 GList *buddy_pounces = NULL; | |
| 58 GList *away_messages = NULL; | |
| 59 GList *groups = NULL; | |
| 60 GList *buddy_chats = NULL; | |
| 61 GList *conversations = NULL; | |
| 62 GList *chat_rooms = NULL; | |
| 63 | |
| 64 GtkWidget *mainwindow = NULL; | |
| 65 | |
| 66 char toc_addy[16]; | |
| 26 | 67 char *quad_addr = NULL; |
| 1 | 68 |
| 69 | |
| 70 void cancel_logon(void) | |
| 71 { | |
| 72 #ifdef USE_APPLET | |
| 73 set_applet_draw_closed(); | |
| 74 AppletCancelLogon(); | |
| 75 gtk_widget_hide(mainwindow); | |
| 76 #else | |
| 77 exit(0); | |
| 78 #endif /* USE_APPLET */ | |
| 79 } | |
| 80 | |
| 81 void set_login_progress(int howfar, char *whattosay) | |
| 82 { | |
| 83 gtk_progress_bar_update(GTK_PROGRESS_BAR(progress), | |
| 84 ((float)howfar / (float)LOGIN_STEPS)); | |
| 85 gtk_statusbar_pop(GTK_STATUSBAR(notice), 1); | |
| 86 gtk_statusbar_push(GTK_STATUSBAR(notice), 1, whattosay); | |
| 87 | |
| 88 while (gtk_events_pending()) | |
| 89 gtk_main_iteration(); | |
| 90 | |
| 91 /* Why do I need these? */ | |
| 92 usleep(10); | |
| 93 while (gtk_events_pending()) | |
| 94 gtk_main_iteration(); | |
| 95 | |
| 96 } | |
| 97 | |
| 98 void hide_login_progress(char *why) | |
| 99 { | |
| 100 gtk_progress_bar_update(GTK_PROGRESS_BAR(progress), | |
| 101 0); | |
| 102 gtk_statusbar_pop(GTK_STATUSBAR(notice), 1); | |
| 103 gtk_statusbar_push(GTK_STATUSBAR(notice), 1, why); | |
| 104 | |
| 105 while (gtk_events_pending()) | |
| 106 gtk_main_iteration(); | |
| 107 | |
| 108 /* Why do I need these? */ | |
| 109 usleep(10); | |
| 110 while (gtk_events_pending()) | |
| 111 gtk_main_iteration(); | |
| 112 } | |
| 113 | |
|
109
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
114 static int snd_tmout; |
|
133
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
109
diff
changeset
|
115 int logins_not_muted = 1; |
|
109
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
116 static void sound_timeout() { |
|
133
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
109
diff
changeset
|
117 logins_not_muted = 1; |
|
109
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
118 gtk_timeout_remove(snd_tmout); |
|
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
119 } |
|
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
120 |
| 228 | 121 char g_screenname[ 64 ]; /* gotta be enough */ |
| 122 | |
| 1 | 123 void dologin(GtkWidget *widget, GtkWidget *w) |
| 124 { | |
| 84 | 125 static gboolean running = FALSE; |
| 1 | 126 char *username = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(name)->entry)); |
| 127 char *password = gtk_entry_get_text(GTK_ENTRY(pass)); | |
| 228 | 128 int i; |
| 1 | 129 |
| 130 if (query_state() != STATE_OFFLINE) | |
| 131 return; | |
| 132 | |
| 133 if (!strlen(username)) { | |
| 134 hide_login_progress("Please enter your logon"); | |
| 135 return; | |
| 136 } | |
| 137 if (!strlen(password)) { | |
| 138 hide_login_progress("You must give your password"); | |
| 139 return; | |
| 140 } | |
| 141 | |
| 228 | 142 /* save screenname away for cache file use */ |
| 143 | |
| 144 strcpy( g_screenname, username ); | |
| 145 | |
| 146 /* fold cache screen name file to upper case to avoid problems | |
| 147 finding file later if user uses different case at login time */ | |
| 148 | |
| 149 for ( i = 0; i < strlen( g_screenname ); i++ ) | |
| 150 g_screenname[i] = toupper( g_screenname[i] ); | |
| 151 | |
| 1 | 152 #ifdef USE_APPLET |
| 153 set_applet_draw_closed(); | |
| 154 setUserState(signing_on); | |
| 155 #endif /* USE_APPLET */ | |
| 156 | |
| 84 | 157 if (running) return; |
| 158 running = TRUE; | |
| 1 | 159 |
|
253
5b28ef2b550e
[gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
160 /* libfaim FIXME : serv_login only starts the process. it's not over |
|
5b28ef2b550e
[gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
161 * after serv_login gets called */ |
| 84 | 162 if (serv_login(username, password) < 0) { |
| 163 running = FALSE; | |
| 1 | 164 return; |
| 84 | 165 } |
| 1 | 166 |
|
109
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
167 if (sound_options & OPT_SOUND_LOGIN && |
|
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
168 sound_options & OPT_SOUND_SILENT_SIGNON) { |
|
133
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
109
diff
changeset
|
169 logins_not_muted = 0; |
|
109
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
170 snd_tmout = gtk_timeout_add(10000, (GtkFunction)sound_timeout, |
|
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
171 NULL); |
|
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
172 } |
|
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
173 |
| 84 | 174 #ifdef USE_APPLET |
| 175 applet_widget_unregister_callback(APPLET_WIDGET(applet),"signon"); | |
| 176 applet_widget_register_callback(APPLET_WIDGET(applet), | |
| 177 "buddy", | |
| 178 _("Buddy List"), | |
|
107
55faf2e3a134
[gaim-migrate @ 117]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
97
diff
changeset
|
179 (AppletCallbackFunc)createOnlinePopup, |
| 84 | 180 NULL); |
| 181 applet_widget_register_callback(APPLET_WIDGET(applet), | |
| 182 "signoff", | |
| 183 _("Signoff"), | |
| 184 signoff, | |
| 185 NULL); | |
| 186 #endif | |
|
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
187 |
|
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
188 #ifdef GAIM_PLUGINS |
|
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
189 { |
|
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
190 GList *c = callbacks; |
|
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
191 struct gaim_callback *g; |
|
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
192 void (*function)(void *); |
|
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
193 while (c) { |
|
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
194 g = (struct gaim_callback *)c->data; |
|
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
195 if (g->event == event_signon && g->function != NULL) { |
|
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
196 function = g->function; |
|
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
197 (*function)(g->data); |
|
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
198 } |
|
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
199 c = c->next; |
|
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
200 } |
|
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
201 } |
|
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
202 #endif |
|
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
85
diff
changeset
|
203 |
| 84 | 204 running = FALSE; |
| 205 return; | |
| 1 | 206 } |
| 207 | |
| 208 | |
| 209 | |
| 210 | |
| 211 void doenter(GtkWidget *widget, GtkWidget *w) | |
| 212 { | |
| 213 if (widget == name) { | |
| 214 gtk_entry_set_text(GTK_ENTRY(pass),""); | |
| 215 gtk_entry_select_region(GTK_ENTRY(GTK_COMBO(name)->entry), 0, 0); | |
|
158
e9414f13d8b7
[gaim-migrate @ 168]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
157
diff
changeset
|
216 gtk_widget_grab_focus(pass); |
| 1 | 217 } else if (widget == pass) { |
|
158
e9414f13d8b7
[gaim-migrate @ 168]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
157
diff
changeset
|
218 gtk_widget_grab_focus(signon); |
| 1 | 219 } |
| 220 | |
| 221 } | |
| 222 | |
| 223 | |
| 224 static void combo_changed(GtkWidget *w, GtkWidget *combo) | |
| 225 { | |
|
158
e9414f13d8b7
[gaim-migrate @ 168]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
157
diff
changeset
|
226 char *txt = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry)); |
| 1 | 227 struct aim_user *u; |
| 228 | |
| 25 | 229 if (!(general_options & OPT_GEN_REMEMBER_PASS)) { |
| 1 | 230 return; |
| 25 | 231 } |
| 232 | |
| 1 | 233 u = find_user(txt); |
| 234 | |
| 235 if (u != NULL) { | |
| 236 gtk_entry_set_text(GTK_ENTRY(pass), u->password); | |
| 237 } else { | |
| 238 gtk_entry_set_text(GTK_ENTRY(pass), ""); | |
| 239 } | |
| 25 | 240 |
| 1 | 241 return; |
| 242 } | |
| 243 | |
| 244 static GList *combo_user_names() | |
| 245 { | |
| 246 GList *usr = aim_users; | |
| 247 GList *tmp = NULL; | |
| 248 struct aim_user *u; | |
| 249 | |
| 250 | |
| 251 if (!usr) | |
| 252 return g_list_append(NULL, "<unknown>"); | |
| 253 | |
| 254 while(usr) { | |
| 255 u = (struct aim_user *)usr->data; | |
| 256 tmp = g_list_append(tmp, g_strdup(u->username)); | |
| 257 usr = usr->next; | |
| 258 | |
| 259 } | |
| 260 | |
| 261 return tmp; | |
| 262 } | |
| 263 | |
| 264 | |
| 265 | |
| 266 void show_login() | |
| 267 { | |
| 268 GtkWidget *options; | |
|
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
269 #ifdef GAIM_PLUGINS |
|
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
270 GtkWidget *plugs; |
|
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
271 #endif |
| 1 | 272 GtkWidget *reg; |
| 273 GtkWidget *bbox; | |
|
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
274 GtkWidget *hbox; |
| 1 | 275 GtkWidget *sbox; |
| 276 GtkWidget *label; | |
| 277 GtkWidget *table; | |
| 278 GtkWidget *remember; | |
| 279 | |
| 280 #ifndef USE_APPLET | |
| 281 GtkWidget *pmw; | |
| 282 GdkPixmap *pm; | |
| 283 GtkStyle *style; | |
| 284 GdkBitmap *mask; | |
| 285 #endif /* USE_APPLET */ | |
| 286 | |
| 287 if (mainwindow) { | |
| 288 gtk_widget_show(mainwindow); | |
| 289 return; | |
| 290 } | |
| 291 | |
| 292 mainwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
| 293 signon = gtk_button_new_with_label("Signon"); | |
| 294 cancel = gtk_button_new_with_label("Cancel"); | |
| 295 reg = gtk_button_new_with_label("Register"); | |
| 296 options = gtk_button_new_with_label("Options"); | |
|
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
297 #ifdef GAIM_PLUGINS |
|
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
298 plugs = gtk_button_new_with_label("Plugins"); |
|
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
299 #endif |
| 1 | 300 table = gtk_table_new(8, 2, FALSE); |
| 301 name = gtk_combo_new(); | |
| 302 pass = gtk_entry_new(); | |
| 303 notice = gtk_statusbar_new(); | |
| 304 progress = gtk_progress_bar_new(); | |
| 305 | |
| 306 gtk_combo_set_popdown_strings(GTK_COMBO(name), combo_user_names()); | |
| 307 | |
| 308 /* Make the buttons do stuff */ | |
| 309 /* Clicking the button initiates a login */ | |
| 310 gtk_signal_connect(GTK_OBJECT(signon), "clicked", | |
| 311 GTK_SIGNAL_FUNC(dologin), mainwindow); | |
| 312 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
| 313 GTK_SIGNAL_FUNC(cancel_logon), mainwindow); | |
| 314 /* Allow user to change prefs before logging in */ | |
| 315 gtk_signal_connect(GTK_OBJECT(options), "clicked", | |
| 316 GTK_SIGNAL_FUNC(show_prefs), NULL); | |
|
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
317 #ifdef GAIM_PLUGINS |
|
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
318 /* Allow user to control plugins before logging in */ |
|
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
319 gtk_signal_connect(GTK_OBJECT(plugs), "clicked", |
|
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
320 GTK_SIGNAL_FUNC(show_plugins), NULL); |
|
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
321 #endif |
| 1 | 322 |
| 323 /* Register opens the right URL */ | |
| 324 gtk_signal_connect(GTK_OBJECT(reg), "clicked", | |
| 325 GTK_SIGNAL_FUNC(open_url), "http://www.aol.com/aim"); | |
| 326 /* Enter in the username clears the password and sets | |
| 327 the pointer in the password field */ | |
| 328 gtk_signal_connect(GTK_OBJECT(GTK_COMBO(name)->entry), "activate", | |
| 329 GTK_SIGNAL_FUNC(doenter), mainwindow); | |
| 330 | |
| 331 gtk_signal_connect(GTK_OBJECT(GTK_COMBO(name)->entry), "changed", | |
| 332 GTK_SIGNAL_FUNC(combo_changed), name); | |
| 333 | |
| 334 gtk_signal_connect(GTK_OBJECT(pass), "activate", | |
| 335 GTK_SIGNAL_FUNC(doenter), mainwindow); | |
| 336 gtk_signal_connect(GTK_OBJECT(mainwindow), "delete_event", | |
| 337 GTK_SIGNAL_FUNC(cancel_logon), mainwindow); | |
| 338 /* Homogenous spacing, 10 padding */ | |
| 339 bbox = gtk_hbox_new(TRUE, 10); | |
|
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
340 hbox = gtk_hbox_new(TRUE, 10); |
| 1 | 341 sbox = gtk_vbox_new(TRUE, 10); |
| 342 | |
| 343 gtk_box_pack_start(GTK_BOX(bbox), reg, TRUE, TRUE, 0); | |
| 344 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); | |
| 345 gtk_box_pack_start(GTK_BOX(bbox), signon, TRUE, TRUE, 0); | |
|
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
346 |
|
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
347 gtk_box_pack_start(GTK_BOX(hbox), options, TRUE, TRUE, 0); |
|
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
348 #ifdef GAIM_PLUGINS |
|
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
349 gtk_box_pack_start(GTK_BOX(hbox), plugs, TRUE, TRUE, 0); |
|
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
350 #endif |
|
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
351 |
| 1 | 352 gtk_box_pack_start(GTK_BOX(sbox), bbox, TRUE, TRUE, 0); |
|
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
353 gtk_box_pack_start(GTK_BOX(sbox), hbox, TRUE, TRUE, 0); |
| 1 | 354 |
| 355 /* Labels for selectors and text boxes */ | |
| 356 #if 0 | |
| 357 label = gtk_label_new("TOC: "); | |
| 358 gtk_table_attach(GTK_TABLE(table), label, 0,1,1,2,0,0, 5, 5); | |
| 359 gtk_widget_show(label); | |
| 360 #endif | |
| 361 label = gtk_label_new("Screen Name: "); | |
| 362 gtk_table_attach(GTK_TABLE(table), label, 0,1,2,3,0,0, 5, 5); | |
| 363 gtk_widget_show(label); | |
| 364 label = gtk_label_new("Password: "); | |
| 365 gtk_table_attach(GTK_TABLE(table), label, 0,1,3,4,0,0, 5, 5); | |
| 366 gtk_widget_show(label); | |
| 367 remember = gtk_check_button_new_with_label("Remember Password"); | |
| 368 gtk_table_attach(GTK_TABLE(table), remember, 0,2,4,5,0,0, 5, 5); | |
| 369 gtk_widget_show(remember); | |
| 370 | |
| 371 gtk_widget_show(options); | |
|
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
372 #ifdef GAIM_PLUGINS |
|
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
373 gtk_widget_show(plugs); |
|
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
374 #endif |
| 1 | 375 |
| 376 /* Adjust sizes of inputs */ | |
| 377 gtk_widget_set_usize(name,95,0); | |
| 378 gtk_widget_set_usize(pass,95,0); | |
| 379 | |
| 380 | |
| 381 /* Status and label */ | |
| 382 gtk_widget_show(notice); | |
| 383 | |
| 384 gtk_widget_set_usize(progress,150,0); | |
| 385 | |
| 386 gtk_widget_show(progress); | |
| 387 | |
| 388 gtk_table_attach(GTK_TABLE(table), progress, 0, 2, 6, 7, 0, 0, 5, 5); | |
| 389 gtk_widget_set_usize(GTK_STATUSBAR(notice)->label, 150, 0); | |
| 390 gtk_table_attach(GTK_TABLE(table), notice, 0, 2, 8, 9, 0, 0, 5, 5); | |
| 391 | |
| 392 /* Attach the buttons at the bottom */ | |
| 393 gtk_widget_show(signon); | |
| 394 gtk_widget_show(cancel); | |
| 395 gtk_widget_show(reg); | |
| 396 gtk_widget_show(bbox); | |
|
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
397 gtk_widget_show(hbox); |
| 1 | 398 gtk_widget_show(sbox); |
| 399 gtk_table_attach(GTK_TABLE(table), sbox, 0,2,7,8,0,0, 5, 5); | |
| 400 | |
| 401 /* Text fields */ | |
| 402 | |
| 403 gtk_table_attach(GTK_TABLE(table),name,1,2,2,3,0,0,5,5); | |
| 404 gtk_widget_show(name); | |
| 405 gtk_table_attach(GTK_TABLE(table),pass,1,2,3,4,0,0,5,5); | |
| 406 gtk_entry_set_visibility(GTK_ENTRY(pass), FALSE); | |
| 407 gtk_widget_show(pass); | |
| 408 | |
| 409 gtk_container_border_width(GTK_CONTAINER(sbox), 10); | |
| 410 | |
| 411 gtk_container_add(GTK_CONTAINER(mainwindow),table ); | |
| 412 | |
| 413 gtk_widget_show(table); | |
| 414 gtk_window_set_title(GTK_WINDOW(mainwindow),"Gaim - Login"); | |
| 415 | |
| 416 | |
| 417 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(remember), (general_options & OPT_GEN_REMEMBER_PASS)); | |
| 418 | |
| 419 if (current_user) { | |
|
138
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
133
diff
changeset
|
420 GList *all = aim_users; |
|
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
133
diff
changeset
|
421 GList *srch = g_list_find(all, (void *)current_user); |
| 85 | 422 int length = g_list_length(all) - g_list_length(srch); |
| 423 | |
| 424 gtk_combo_set_value_in_list(GTK_COMBO(name), length, 0); | |
|
158
e9414f13d8b7
[gaim-migrate @ 168]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
157
diff
changeset
|
425 if ((general_options & OPT_GEN_REMEMBER_PASS)) { |
|
e9414f13d8b7
[gaim-migrate @ 168]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
157
diff
changeset
|
426 combo_changed(NULL, name); |
|
157
aad89d9bce85
[gaim-migrate @ 167]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
155
diff
changeset
|
427 gtk_widget_grab_focus(signon); |
|
158
e9414f13d8b7
[gaim-migrate @ 168]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
157
diff
changeset
|
428 } else { |
|
157
aad89d9bce85
[gaim-migrate @ 167]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
155
diff
changeset
|
429 gtk_widget_grab_focus(pass); |
|
158
e9414f13d8b7
[gaim-migrate @ 168]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
157
diff
changeset
|
430 } |
|
e9414f13d8b7
[gaim-migrate @ 168]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
157
diff
changeset
|
431 } else { |
|
157
aad89d9bce85
[gaim-migrate @ 167]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
155
diff
changeset
|
432 gtk_widget_grab_focus(name); |
|
158
e9414f13d8b7
[gaim-migrate @ 168]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
157
diff
changeset
|
433 } |
| 1 | 434 |
| 435 | |
| 436 gtk_signal_connect(GTK_OBJECT(remember), "clicked", GTK_SIGNAL_FUNC(set_general_option), (int *)OPT_GEN_REMEMBER_PASS); | |
| 437 | |
| 438 | |
| 439 gtk_widget_realize(mainwindow); | |
| 440 | |
| 441 #ifndef USE_APPLET | |
| 442 /* Logo at the top */ | |
| 443 style = gtk_widget_get_style(mainwindow); | |
| 444 pm = gdk_pixmap_create_from_xpm_d(mainwindow->window, &mask, | |
| 445 &style->bg[GTK_STATE_NORMAL], (gchar **)aol_logo); | |
| 446 pmw = gtk_pixmap_new( pm, mask); | |
| 447 gtk_table_attach(GTK_TABLE(table), pmw, 0,2,0,1,0,0,5,5); | |
| 448 gtk_widget_show(pmw); | |
| 449 #endif /* USE_APPLET */ | |
| 450 | |
| 451 | |
| 452 aol_icon(mainwindow->window); | |
| 453 #ifndef _WIN32 | |
| 454 gdk_window_set_group(mainwindow->window, mainwindow->window); | |
| 455 #endif | |
| 456 | |
| 457 | |
| 458 gtk_widget_show(mainwindow); | |
| 459 | |
| 460 if((general_options & OPT_GEN_AUTO_LOGIN) && | |
| 461 (general_options & OPT_GEN_REMEMBER_PASS)) { | |
| 462 dologin(signon, NULL); | |
| 463 } | |
| 464 } | |
| 465 | |
|
200
bc117fbcf527
[gaim-migrate @ 210]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
184
diff
changeset
|
466 extern void show_debug(GtkObject *); |
| 180 | 467 |
| 1 | 468 int main(int argc, char *argv[]) |
| 469 { | |
| 470 #ifdef USE_APPLET | |
| 471 InitAppletMgr( argc, argv ); | |
| 472 #elif defined USE_THEMES | |
| 473 gnome_init("GAIM",NULL,argc,argv); | |
| 474 #else | |
| 475 gtk_init(&argc, &argv); | |
| 476 #endif /* USE_THEMES */ | |
| 477 | |
| 478 | |
| 479 set_defaults(); | |
| 480 load_prefs(); | |
| 180 | 481 |
| 482 if (general_options & OPT_GEN_CHECK_VERSIONS) | |
| 483 { | |
| 184 | 484 /* FIXME: |
| 485 Thread this code later | |
| 180 | 486 check_gaim_versions(); |
| 184 | 487 */ |
| 180 | 488 } |
| 489 | |
|
176
c99d0b82c8a8
[gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
158
diff
changeset
|
490 if (general_options & OPT_GEN_DEBUG) |
|
c99d0b82c8a8
[gaim-migrate @ 186]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
158
diff
changeset
|
491 show_debug(NULL); |
| 1 | 492 |
|
216
f7e17fb767eb
[gaim-migrate @ 226]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
200
diff
changeset
|
493 gdk_threads_enter(); |
|
f7e17fb767eb
[gaim-migrate @ 226]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
200
diff
changeset
|
494 |
| 1 | 495 #ifdef USE_APPLET |
| 496 applet_widget_register_callback(APPLET_WIDGET(applet), | |
| 497 "prefs", | |
| 498 _("Preferences"), | |
| 499 show_prefs, | |
| 500 NULL); | |
| 501 applet_widget_register_callback(APPLET_WIDGET(applet), | |
| 502 "signon", | |
| 503 _("Signon"), | |
| 504 applet_show_login, | |
| 505 NULL); | |
|
97
5b4b7aa8dd9a
[gaim-migrate @ 107]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
506 #ifdef GAIM_PLUGINS |
|
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
507 applet_widget_register_callback(APPLET_WIDGET(applet), |
|
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
508 "plugins", |
|
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
509 _("Plugins"), |
|
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
510 GTK_SIGNAL_FUNC(show_plugins), |
|
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
511 NULL); |
|
97
5b4b7aa8dd9a
[gaim-migrate @ 107]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
512 #endif /* GAIM_PLUGINS */ |
| 1 | 513 |
| 514 if((general_options & OPT_GEN_AUTO_LOGIN) && | |
| 515 (general_options & OPT_GEN_REMEMBER_PASS)) { | |
| 516 | |
| 517 applet_show_login(APPLET_WIDGET(applet), NULL); | |
| 518 } | |
| 82 | 519 |
| 520 update_pixmaps(); | |
| 1 | 521 |
| 522 applet_widget_gtk_main(); | |
| 523 #else | |
| 524 | |
| 525 | |
| 526 show_login(); | |
| 527 gtk_main(); | |
| 528 | |
| 529 #endif /* USE_APPLET */ | |
|
216
f7e17fb767eb
[gaim-migrate @ 226]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
200
diff
changeset
|
530 gdk_threads_leave(); |
| 1 | 531 |
| 532 return 0; | |
| 533 | |
| 534 } |
