empathy r1264 - trunk/src



Author: xclaesse
Date: Sat Jul 19 10:50:08 2008
New Revision: 1264
URL: http://svn.gnome.org/viewvc/empathy?rev=1264&view=rev

Log:
Add support to set register param. Fixes bug #462880.


Modified:
   trunk/src/empathy-accounts-dialog.c
   trunk/src/empathy-accounts-dialog.glade

Modified: trunk/src/empathy-accounts-dialog.c
==============================================================================
--- trunk/src/empathy-accounts-dialog.c	(original)
+++ trunk/src/empathy-accounts-dialog.c	Sat Jul 19 10:50:08 2008
@@ -73,6 +73,7 @@
 	GtkWidget        *hbox_type;
 	GtkWidget        *button_create;
 	GtkWidget        *button_back;
+	GtkWidget        *checkbutton_register;
 
 	GtkWidget        *image_type;
 	GtkWidget        *label_name;
@@ -862,6 +863,7 @@
 	McProfile   *profile;
 	McAccount   *account;
 	const gchar *str;
+	McProfileCapabilityFlags cap;
 
 	/* Update widgets */
 	gtk_widget_show (dialog->vbox_details);
@@ -872,10 +874,19 @@
 
 	/* Create account */
 	account = mc_account_create (profile);
-
 	str = mc_account_get_unique_name (account);
 	mc_account_set_display_name (account, str);
 
+	cap = mc_profile_get_capabilities (profile);
+	if (cap & MC_PROFILE_CAPABILITY_REGISTRATION_UI) {
+		gboolean active;
+
+		active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->checkbutton_register));
+		if (!active) {
+			mc_account_set_param_boolean (account, "register", TRUE);
+		}
+	}
+
 	accounts_dialog_add_account (dialog, account);
 	accounts_dialog_model_set_selected (dialog, account);
 
@@ -900,6 +911,24 @@
 }
 
 static void
+accounts_dialog_profile_changed_cb (GtkWidget             *widget,
+				    EmpathyAccountsDialog *dialog)
+{
+	McProfile *profile;
+	McProfileCapabilityFlags cap;
+
+	profile = empathy_profile_chooser_get_selected (dialog->combobox_profile);
+	cap = mc_profile_get_capabilities (profile);
+
+	if (cap & MC_PROFILE_CAPABILITY_REGISTRATION_UI) {
+		gtk_widget_show (dialog->checkbutton_register);
+	} else {
+		gtk_widget_hide (dialog->checkbutton_register);
+	}
+	g_object_unref (profile);
+}
+
+static void
 accounts_dialog_button_add_clicked_cb (GtkWidget             *button,
 				       EmpathyAccountsDialog *dialog)
 {
@@ -915,6 +944,9 @@
 	gtk_widget_hide (dialog->frame_no_account);
 	gtk_widget_show (dialog->frame_new_account);
 
+	accounts_dialog_profile_changed_cb (dialog->checkbutton_register, dialog);
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->checkbutton_register),
+				      TRUE);
 	gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->combobox_profile), 0);
 	gtk_widget_grab_focus (dialog->combobox_profile);
 }
@@ -1067,6 +1099,7 @@
 				       "hbox_type", &dialog->hbox_type,
 				       "button_create", &dialog->button_create,
 				       "button_back", &dialog->button_back,
+				       "checkbutton_register", &dialog->checkbutton_register,
 				       "image_type", &dialog->image_type,
 				       "label_name", &dialog->label_name,
 				       "button_add", &dialog->button_add,
@@ -1098,6 +1131,9 @@
 	if (empathy_profile_chooser_n_profiles (dialog->combobox_profile) <= 0) {
 		gtk_widget_set_sensitive (dialog->button_add, FALSE);
 	}
+	g_signal_connect (dialog->combobox_profile, "changed",
+			  G_CALLBACK (accounts_dialog_profile_changed_cb),
+			  dialog);
 
 	/* Set up signalling */
 	dialog->mc = empathy_mission_control_new ();

Modified: trunk/src/empathy-accounts-dialog.glade
==============================================================================
--- trunk/src/empathy-accounts-dialog.glade	(original)
+++ trunk/src/empathy-accounts-dialog.glade	Sat Jul 19 10:50:08 2008
@@ -183,6 +183,20 @@
                               </widget>
                             </child>
                             <child>
+                              <widget class="GtkCheckButton" id="checkbutton_register">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="label" translatable="yes">I already have an account I want to use</property>
+                                <property name="use_underline">True</property>
+                                <property name="response_id">0</property>
+                                <property name="active">True</property>
+                                <property name="draw_indicator">True</property>
+                              </widget>
+                              <packing>
+                                <property name="position">2</property>
+                              </packing>
+                            </child>
+                            <child>
                               <widget class="GtkHBox" id="hbox181">
                                 <property name="visible">True</property>
                                 <property name="spacing">6</property>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]