diff src/gtkaccount.c @ 5688:e43e1b8dca8b

[gaim-migrate @ 6109] Updating the protocol type now updates the fields in the modify account dialog. Also, fixed a bug that caused an infinite loop. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 03 Jun 2003 05:33:46 +0000
parents ae626f0b68ef
children 7a619706e048
line wrap: on
line diff
--- a/src/gtkaccount.c	Tue Jun 03 05:09:54 2003 +0000
+++ b/src/gtkaccount.c	Tue Jun 03 05:33:46 2003 +0000
@@ -80,8 +80,12 @@
 
 	GaimProxyType new_proxy_type;
 
+	GtkSizeGroup *sg;
 	GtkWidget *window;
 
+	GtkWidget *top_vbox;
+	GtkWidget *bottom_vbox;
+
 	/* Login Options */
 	GtkWidget *login_frame;
 	GtkWidget *protocol_menu;
@@ -111,8 +115,6 @@
 	GtkWidget *proxy_user_entry;
 	GtkWidget *proxy_pass_entry;
 
-	GtkSizeGroup *sg;
-
 } AccountPrefsDialog;
 
 
@@ -130,11 +132,11 @@
 /**************************************************************************
  * Add/Modify Account dialog
  **************************************************************************/
-static void
-__set_account_protocol(GtkWidget *item, GaimProtocol protocol,
-					   AccountPrefsDialog *dialog)
-{
-}
+static void __add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent);
+static void __add_user_options(AccountPrefsDialog *dialog, GtkWidget *parent);
+static void __add_protocol_options(AccountPrefsDialog *dialog,
+								   GtkWidget *parent);
+static void __add_proxy_options(AccountPrefsDialog *dialog, GtkWidget *parent);
 
 static GtkWidget *
 __add_pref_box(AccountPrefsDialog *dialog, GtkWidget *parent,
@@ -160,6 +162,20 @@
 }
 
 static void
+__set_account_protocol_cb(GtkWidget *item, GaimProtocol protocol,
+						  AccountPrefsDialog *dialog)
+{
+	dialog->protocol = protocol;
+
+	if ((dialog->plugin = gaim_find_prpl(dialog->protocol)) != NULL)
+		dialog->prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(dialog->plugin);
+
+	__add_login_options(dialog,    dialog->top_vbox);
+	__add_user_options(dialog,     dialog->top_vbox);
+	__add_protocol_options(dialog, dialog->bottom_vbox);
+}
+
+static void
 __add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent)
 {
 	GtkWidget *frame;
@@ -189,7 +205,7 @@
 
 	/* Protocol */
 	dialog->protocol_menu = gaim_gtk_protocol_option_menu_new(
-			dialog->protocol, G_CALLBACK(__set_account_protocol), dialog);
+			dialog->protocol, G_CALLBACK(__set_account_protocol_cb), dialog);
 
 	__add_pref_box(dialog, vbox, _("Protocol:"), dialog->protocol_menu);
 
@@ -383,7 +399,7 @@
 }
 
 static void
-__add_protocol_options_frame(AccountPrefsDialog *dialog, GtkWidget *parent)
+__add_protocol_options(AccountPrefsDialog *dialog, GtkWidget *parent)
 {
 	GaimAccountOption *option;
 	GtkWidget *frame;
@@ -567,7 +583,7 @@
 }
 
 static void
-__add_proxy_options_frame(AccountPrefsDialog *dialog, GtkWidget *parent)
+__add_proxy_options(AccountPrefsDialog *dialog, GtkWidget *parent)
 {
 	GaimProxyInfo *proxy_info;
 	GtkWidget *frame;
@@ -709,7 +725,7 @@
 	gtk_widget_show(main_vbox);
 
 	/* Setup the inner vbox */
-	vbox = gtk_vbox_new(FALSE, 18);
+	dialog->top_vbox = vbox = gtk_vbox_new(FALSE, 18);
 	gtk_box_pack_start(GTK_BOX(main_vbox), vbox, FALSE, FALSE, 0);
 	gtk_widget_show(vbox);
 
@@ -724,14 +740,14 @@
 	gtk_widget_show(disclosure);
 
 	/* Setup the box that the disclosure will cover. */
-	dbox = gtk_vbox_new(FALSE, 18);
+	dialog->bottom_vbox = dbox = gtk_vbox_new(FALSE, 18);
 	gtk_box_pack_start(GTK_BOX(vbox), dbox, FALSE, FALSE, 0);
 
 	gaim_disclosure_set_container(GAIM_DISCLOSURE(disclosure), dbox);
 
 	/** Setup the bottom frames. */
-	__add_protocol_options_frame(dialog, dbox);
-	__add_proxy_options_frame(dialog, dbox);
+	__add_protocol_options(dialog, dbox);
+	__add_proxy_options(dialog, dbox);
 
 	/* Separator... */
 	sep = gtk_hseparator_new();