changeset 5581:3a9b54f260e3

[gaim-migrate @ 5985] Commit'em if you got'em. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sat, 31 May 2003 04:35:54 +0000
parents 86456ec3ca25
children e2f2d8857f9f
files src/account.c src/connection.c src/gtkaccount.c src/main.c src/prefs.c src/server.c
diffstat 6 files changed, 74 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/src/account.c	Sat May 31 02:27:03 2003 +0000
+++ b/src/account.c	Sat May 31 04:35:54 2003 +0000
@@ -552,7 +552,7 @@
 			plugin = (GaimPlugin *)l->data;
 
 			if (GAIM_IS_PROTOCOL_PLUGIN(plugin)) {
-				if (!strcmp(plugin->info->name, buffer)) {
+				if (!strcmp(plugin->info->id, buffer)) {
 					data->protocol =
 						GAIM_PLUGIN_PROTOCOL_INFO(plugin)->protocol;
 
@@ -563,8 +563,10 @@
 	}
 	else if (data->tag == TAG_NAME)
 		data->account = gaim_account_new(buffer, data->protocol);
-	else if (data->tag == TAG_PASSWORD)
+	else if (data->tag == TAG_PASSWORD) {
 		gaim_account_set_password(data->account, buffer);
+		gaim_account_set_remember_password(data->account, TRUE);
+	}
 	else if (data->tag == TAG_ALIAS)
 		gaim_account_set_alias(data->account, buffer);
 	else if (data->tag == TAG_USERINFO)
--- a/src/connection.c	Sat May 31 02:27:03 2003 +0000
+++ b/src/connection.c	Sat May 31 04:35:54 2003 +0000
@@ -89,6 +89,8 @@
 		!(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL) &&
 		gaim_account_get_password(account) == NULL) {
 
+		gaim_debug(GAIM_DEBUG_INFO, "connection", "Requestin password\n");
+
 		if (ops != NULL && ops->request_pass != NULL)
 			ops->request_pass(gc);
 
@@ -97,6 +99,8 @@
 
 	gaim_connection_set_state(gc, GAIM_CONNECTING);
 
+	gaim_debug(GAIM_DEBUG_INFO, "connection", "Calling serv_login\n");
+
 	serv_login(account);
 }
 
--- a/src/gtkaccount.c	Sat May 31 02:27:03 2003 +0000
+++ b/src/gtkaccount.c	Sat May 31 04:35:54 2003 +0000
@@ -29,10 +29,11 @@
 enum
 {
 	COLUMN_ICON,
+	COLUMN_PROTOCOL,
 	COLUMN_SCREENNAME,
 	COLUMN_ONLINE,
 	COLUMN_AUTOLOGIN,
-	COLUMN_PROTOCOL,
+	COLUMN_FILLER,
 	COLUMN_DATA,
 	NUM_COLUMNS
 };
@@ -43,6 +44,8 @@
 
 	GtkListStore *model;
 
+	GtkTreeViewColumn *screenname_col;
+
 } AccountsDialog;
 
 static AccountsDialog *accounts_dialog = NULL;
@@ -68,8 +71,30 @@
 __configure_cb(GtkWidget *w, GdkEventConfigure *event, AccountsDialog *dialog)
 {
 	if (GTK_WIDGET_VISIBLE(w)) {
+		int old_width = gaim_prefs_get_int("/gaim/gtk/accounts/dialog/width");
+		int col_width;
+		int difference;
+
 		gaim_prefs_set_int("/gaim/gtk/accounts/dialog/width",  event->width);
 		gaim_prefs_set_int("/gaim/gtk/accounts/dialog/height", event->height);
+
+		col_width = gtk_tree_view_column_get_width(dialog->screenname_col);
+
+		if (col_width == 0)
+			return FALSE;
+
+		difference = (MAX(old_width, event->width) -
+					  MIN(old_width, event->width));
+
+		if (difference == 0)
+			return FALSE;
+
+		if (old_width < event->width)
+			gtk_tree_view_column_set_min_width(dialog->screenname_col,
+					col_width + difference);
+		else
+			gtk_tree_view_column_set_max_width(dialog->screenname_col,
+					col_width - difference);
 	}
 
 	return FALSE;
@@ -116,22 +141,33 @@
 __add_columns(GtkWidget *treeview, AccountsDialog *dialog)
 {
 	GtkCellRenderer *renderer;
+	GtkTreeViewColumn *column;
 
-	/* Protocol Icon */
+	/* Protocol */
+	column = gtk_tree_view_column_new();
+	gtk_tree_view_column_set_title(column, _("Protocol"));
+	gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
+
+	/* Icon text */
 	renderer = gtk_cell_renderer_pixbuf_new();
-	gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview),
-												-1, "",
-												renderer,
-												"pixbuf", COLUMN_ICON,
-												NULL);
+	gtk_tree_view_column_pack_start(column, renderer, FALSE);
+	gtk_tree_view_column_add_attribute(column, renderer,
+									   "pixbuf", COLUMN_ICON);
+
+	/* Protocol name */
+	renderer = gtk_cell_renderer_text_new();
+	gtk_tree_view_column_pack_start(column, renderer, TRUE);
+	gtk_tree_view_column_add_attribute(column, renderer,
+									   "text", COLUMN_PROTOCOL);
 
 	/* Screennames */
 	renderer = gtk_cell_renderer_text_new();
-	gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview),
-												-1, _("Screenname"),
-												renderer,
-												"text", COLUMN_SCREENNAME,
-												NULL);
+	column = gtk_tree_view_column_new_with_attributes(_("Screenname"),
+				renderer, "text", COLUMN_SCREENNAME, NULL);
+	dialog->screenname_col = column;
+
+	gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+	gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
 
 	/* Online? */
 	renderer = gtk_cell_renderer_toggle_new();
@@ -145,26 +181,22 @@
 												"active", COLUMN_ONLINE,
 												NULL);
 
-
 	/* Auto-login? */
 	renderer = gtk_cell_renderer_toggle_new();
 
 	g_signal_connect(G_OBJECT(renderer), "toggled",
 					 G_CALLBACK(__autologin_cb), dialog);
 
-	gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview),
-												-1, _("Auto-login"),
-												renderer,
-												"active", COLUMN_AUTOLOGIN,
-												NULL);
+	column = gtk_tree_view_column_new_with_attributes(_("Auto-login"),
+			renderer, "active", COLUMN_AUTOLOGIN, NULL);
 
+	gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
 
-	/* Protocol description */
+	/* Filler */
 	renderer = gtk_cell_renderer_text_new();
 	gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview),
-												-1, _("Protocol"),
-												renderer,
-												"text", COLUMN_PROTOCOL,
+												-1, "", renderer,
+												"visible", COLUMN_FILLER,
 												NULL);
 }
 
@@ -198,6 +230,7 @@
 				COLUMN_AUTOLOGIN, FALSE,
 				COLUMN_PROTOCOL, proto_name(gaim_account_get_protocol(account)),
 				COLUMN_DATA, account,
+				COLUMN_FILLER, FALSE,
 				-1);
 
 		if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf));
@@ -222,9 +255,9 @@
 
 	/* Create the list model. */
 	dialog->model = gtk_list_store_new(NUM_COLUMNS, GDK_TYPE_PIXBUF,
-									   G_TYPE_STRING, G_TYPE_BOOLEAN,
-									   G_TYPE_BOOLEAN, G_TYPE_STRING,
-									   G_TYPE_POINTER);
+									   G_TYPE_STRING, G_TYPE_STRING,
+									   G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
+									   G_TYPE_BOOLEAN, G_TYPE_POINTER);
 
 	/* And now the actual treeview */
 	treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(dialog->model));
@@ -234,11 +267,11 @@
 			gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)),
 			GTK_SELECTION_MULTIPLE);
 
-	__add_columns(treeview, dialog);
-
 	gtk_container_add(GTK_CONTAINER(sw), treeview);
 	gtk_widget_show(treeview);
 
+	__add_columns(treeview, dialog);
+
 	__populate_accounts_list(dialog);
 
 	return sw;
--- a/src/main.c	Sat May 31 02:27:03 2003 +0000
+++ b/src/main.c	Sat May 31 04:35:54 2003 +0000
@@ -886,12 +886,10 @@
 
 	gaim_prefs_init();
 	gaim_gtk_prefs_init();
-	gaim_accounts_load();
 
 	if (!gaim_prefs_load()) {
 		load_prefs();
 		gaim_prefs_sync();
-		gaim_accounts_sync();
 	}
 
 	plugin_search_paths[0] = LIBDIR;
@@ -906,6 +904,8 @@
 
 	gaim_plugins_probe(NULL);
 
+	gaim_accounts_load();
+
 #ifdef _WIN32
 	/* Various win32 initializations */
 	wgaim_init();
--- a/src/prefs.c	Sat May 31 02:27:03 2003 +0000
+++ b/src/prefs.c	Sat May 31 04:35:54 2003 +0000
@@ -440,6 +440,8 @@
 gboolean gaim_prefs_get_bool(const char *name) {
 	struct gaim_pref *pref = find_pref(name);
 
+	gaim_debug(GAIM_DEBUG_MISC, "prefs", "key = %s\n", name);
+
 	g_return_val_if_fail(pref != NULL, FALSE);
 	g_return_val_if_fail(pref->type == GAIM_PREF_BOOLEAN, FALSE);
 
--- a/src/server.c	Sat May 31 02:27:03 2003 +0000
+++ b/src/server.c	Sat May 31 04:35:54 2003 +0000
@@ -42,10 +42,10 @@
 
 void serv_login(GaimAccount *account)
 {
-	GaimPlugin *p = gaim_find_prpl(account->protocol);
+	GaimPlugin *p = gaim_find_prpl(gaim_account_get_protocol(account));
 	GaimPluginProtocolInfo *prpl_info = NULL;
 
-	if (account->gc != NULL || p == NULL)
+	if (account->gc == NULL || p == NULL)
 		return;
 
 	prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(p);