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