pidgin: 8a25fec9: UI hack ala Google Talk for Facebook.

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Tue Dec 7 10:11:13 EST 2010


----------------------------------------------------------------------
Revision: 8a25fec953967ace4591727a8399082c0df41101
Parent:   f6eda9b9e5e58492dd7afd0aed0d12cc2d95ae2c
Author:   nosnilmot at pidgin.im
Date:     12/07/10 10:05:46
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/8a25fec953967ace4591727a8399082c0df41101

Changelog: 

UI hack ala Google Talk for Facebook.

Changes against parent f6eda9b9e5e58492dd7afd0aed0d12cc2d95ae2c

  patched  pidgin/gtkaccount.c
  patched  pidgin/gtkutils.c

-------------- next part --------------
============================================================
--- pidgin/gtkutils.c	ac3fe57287f1edfe7c47fd07af973a84f2f5e9ca
+++ pidgin/gtkutils.c	5537edee3cffeb641b749752fefd6c80a4ef183a
@@ -684,7 +684,7 @@ create_protocols_menu(const char *defaul
 	GdkPixbuf *pixbuf = NULL;
 	GtkSizeGroup *sg;
 	GList *p;
-	const char *gtalk_name = NULL;
+	const char *gtalk_name = NULL, *facebook_name = NULL;
 	int i;
 
 	aop_menu = g_malloc0(sizeof(AopMenu));
@@ -693,8 +693,10 @@ create_protocols_menu(const char *defaul
 	gtk_widget_show(aop_menu->menu);
 	sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
 
-	if (purple_find_prpl("prpl-jabber"))
+	if (purple_find_prpl("prpl-jabber")) {
 		gtalk_name = _("Google Talk");
+		facebook_name = _("Facebook (XMPP)");
+	}
 
 	for (p = purple_plugins_get_protocols(), i = 0;
 		 p != NULL;
@@ -712,7 +714,7 @@ create_protocols_menu(const char *defaul
 
 			gtk_menu_shell_append(GTK_MENU_SHELL(aop_menu->menu),
 				item = aop_menu_item_new(sg, pixbuf, gtalk_name, "prpl-jabber", "protocol"));
-			g_object_set_data(G_OBJECT(item), "fake", GINT_TO_POINTER(1));
+			g_object_set_data(G_OBJECT(item), "fakegoogle", GINT_TO_POINTER(1));
 
 			if (pixbuf)
 				g_object_unref(pixbuf);
@@ -721,6 +723,25 @@ create_protocols_menu(const char *defaul
 			i++;
 		}
 
+		if (facebook_name && strcmp(facebook_name, plugin->info->name) < 0) {
+			char *filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols",
+			                                  "16", "facebook.png", NULL);
+			GtkWidget *item;
+
+			pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
+			g_free(filename);
+
+			gtk_menu_shell_append(GTK_MENU_SHELL(aop_menu->menu),
+				item = aop_menu_item_new(sg, pixbuf, facebook_name, "prpl-jabber", "protocol"));
+			g_object_set_data(G_OBJECT(item), "fakefacebook", GINT_TO_POINTER(1));
+
+			if (pixbuf)
+				g_object_unref(pixbuf);
+
+			facebook_name = NULL;
+			i++;
+		}
+
 		pixbuf = pidgin_create_prpl_icon_from_prpl(plugin, PIDGIN_PRPL_ICON_SMALL, NULL);
 
 		gtk_menu_shell_append(GTK_MENU_SHELL(aop_menu->menu),
============================================================
--- pidgin/gtkaccount.c	c6c6f42af0d54071a143aeab36b4165866907064
+++ pidgin/gtkaccount.c	60bda1f3229092fe59a44e13213502f693e01077
@@ -559,10 +559,14 @@ add_login_options(AccountPrefsDialog *di
 		/* Google Talk default domain hackery! */
 		menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(dialog->protocol_menu));
 		item = gtk_menu_get_active(GTK_MENU(menu));
-		if (value == NULL && g_object_get_data(G_OBJECT(item), "fake") &&
+		if (value == NULL && g_object_get_data(G_OBJECT(item), "fakegoogle") &&
 			!strcmp(purple_account_user_split_get_text(split), _("Domain")))
 			value = "gmail.com";
 
+		if (value == NULL && g_object_get_data(G_OBJECT(item), "fakefacebook") &&
+			!strcmp(purple_account_user_split_get_text(split), _("Domain")))
+			value = "chat.facebook.com";
+
 		if (value != NULL)
 			gtk_entry_set_text(GTK_ENTRY(entry), value);
 	}
@@ -758,7 +762,7 @@ add_protocol_options(AccountPrefsDialog 
 {
 	PurpleAccountOption *option;
 	PurpleAccount *account;
-	GtkWidget *vbox, *check, *entry, *combo;
+	GtkWidget *vbox, *check, *entry, *combo, *menu, *item;
 	GList *list, *node;
 	gint i, idx, int_value;
 	GtkListStore *model;
@@ -797,6 +801,9 @@ add_protocol_options(AccountPrefsDialog 
 			gtk_label_new_with_mnemonic(_("Ad_vanced")), 1);
 	gtk_widget_show(vbox);
 
+	menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(dialog->protocol_menu));
+	item = gtk_menu_get_active(GTK_MENU(menu));
+
 	for (l = dialog->prpl_info->protocol_options; l != NULL; l = l->next)
 	{
 		option = (PurpleAccountOption *)l->data;
@@ -911,6 +918,10 @@ add_protocol_options(AccountPrefsDialog 
 				model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_POINTER);
 				opt_entry->widget = combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(model));
 
+				if (g_object_get_data(G_OBJECT(item), "fakefacebook") &&
+					!strcmp(opt_entry->setting, "connection_security"))
+					str_value = "opportunistic_tls";
+
 				/* Loop through list of PurpleKeyValuePair items */
 				for (node = list; node != NULL; node = node->next) {
 					if (node->data != NULL) {


More information about the Commits mailing list