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