changeset 16982:87e6707b512f

merge of '4c166ec2780777ec3a8a3f5ad6774ec0a47c35e2' and 'a7fe56508258038ba8b2ff7bb614d603136301ba'
author Richard Laager <rlaager@wiktel.com>
date Wed, 09 May 2007 22:04:39 +0000
parents e7d59fa4faaf (current diff) 9c4c7f28b005 (diff)
children b4720d213f31
files pidgin/gtkutils.c
diffstat 6 files changed, 84 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntconv.c	Wed May 09 21:50:29 2007 +0000
+++ b/finch/gntconv.c	Wed May 09 22:04:39 2007 +0000
@@ -303,6 +303,11 @@
 get_info_cb(GntMenuItem *item, gpointer ggconv)
 {
 	FinchConv *ggc = ggconv;
+	PurpleNotifyUserInfo *info = purple_notify_user_info_new();
+	purple_notify_user_info_add_pair(info, _("Information"), _("Retrieving..."));
+	purple_notify_userinfo(ggc->active_conv->account->gc, purple_conversation_get_name(ggc->active_conv), info, NULL, NULL);
+	purple_notify_user_info_destroy(info);
+
 	serv_get_info(purple_conversation_get_gc(ggc->active_conv),
 			purple_conversation_get_name(ggc->active_conv));
 }
--- a/pidgin/gtkblist.c	Wed May 09 21:50:29 2007 +0000
+++ b/pidgin/gtkblist.c	Wed May 09 22:04:39 2007 +0000
@@ -274,6 +274,11 @@
 
 static void gtk_blist_menu_info_cb(GtkWidget *w, PurpleBuddy *b)
 {
+	PurpleNotifyUserInfo *info = purple_notify_user_info_new();
+	purple_notify_user_info_add_pair(info, _("Information"), _("Retrieving..."));
+	purple_notify_userinfo(b->account->gc, purple_buddy_get_name(b), info, NULL, NULL);
+	purple_notify_user_info_destroy(info);
+
 	serv_get_info(b->account->gc, b->name);
 }
 
--- a/pidgin/gtkconv.c	Wed May 09 21:50:29 2007 +0000
+++ b/pidgin/gtkconv.c	Wed May 09 22:04:39 2007 +0000
@@ -672,6 +672,11 @@
 	PurpleConversation *conv = gtkconv->active_conv;
 
 	if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
+		PurpleNotifyUserInfo *info = purple_notify_user_info_new();
+		purple_notify_user_info_add_pair(info, _("Information"), _("Retrieving..."));
+		purple_notify_userinfo(conv->account->gc, purple_conversation_get_name(conv), info, NULL, NULL);
+		purple_notify_user_info_destroy(info);
+
 		serv_get_info(purple_conversation_get_gc(conv),
 					  purple_conversation_get_name(conv));
 
--- a/pidgin/gtknotify.c	Wed May 09 21:50:29 2007 +0000
+++ b/pidgin/gtknotify.c	Wed May 09 22:04:39 2007 +0000
@@ -549,6 +549,21 @@
 	return FALSE;
 }
 
+static GtkIMHtmlOptions
+notify_imhtml_options()
+{
+	GtkIMHtmlOptions options = 0;
+
+	if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting"))
+		options |= GTK_IMHTML_NO_COLOURS | GTK_IMHTML_NO_FONTS | GTK_IMHTML_NO_SIZES;
+
+	options |= GTK_IMHTML_NO_COMMENTS;
+	options |= GTK_IMHTML_NO_TITLE;
+	options |= GTK_IMHTML_NO_NEWLINE;
+	options |= GTK_IMHTML_NO_SCROLL;
+	return options;
+}
+
 static void *
 pidgin_notify_formatted(const char *title, const char *primary,
 						  const char *secondary, const char *text)
@@ -559,7 +574,6 @@
 	GtkWidget *button;
 	GtkWidget *imhtml;
 	GtkWidget *frame;
-	int options = 0;
 	char label_text[2048];
 	char *linked_text, *primary_esc, *secondary_esc;
 
@@ -614,20 +628,13 @@
 	g_signal_connect(G_OBJECT(window), "key_press_event",
 					 G_CALLBACK(formatted_input_cb), NULL);
 
-	/* Add the text to the gtkimhtml */
-	if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting"))
-		options |= GTK_IMHTML_NO_COLOURS | GTK_IMHTML_NO_FONTS | GTK_IMHTML_NO_SIZES;
-
-	options |= GTK_IMHTML_NO_COMMENTS;
-	options |= GTK_IMHTML_NO_TITLE;
-	options |= GTK_IMHTML_NO_NEWLINE;
-	options |= GTK_IMHTML_NO_SCROLL;
-
 	/* Make sure URLs are clickable */
 	linked_text = purple_markup_linkify(text);
-	gtk_imhtml_append_text(GTK_IMHTML(imhtml), linked_text, options);
+	gtk_imhtml_append_text(GTK_IMHTML(imhtml), linked_text, notify_imhtml_options());
 	g_free(linked_text);
 
+	g_object_set_data(G_OBJECT(window), "info-widget", imhtml);
+
 	/* Show the window */
 	gtk_widget_show(window);
 
@@ -856,18 +863,53 @@
 	return data;
 }
 
+/** Xerox'ed from Finch! How the tables have turned!! ;) **/
+/** User information. **/
+static GHashTable *userinfo;
+
+static char *
+userinfo_hash(PurpleAccount *account, const char *who)
+{
+	char key[256];
+	snprintf(key, sizeof(key), "%s - %s", purple_account_get_username(account), purple_normalize(account, who));
+	return g_utf8_strup(key, -1);
+}
+
+static void
+remove_userinfo(GtkWidget *widget, gpointer key)
+{
+	g_hash_table_remove(userinfo, key);
+}
+
 static void *
 pidgin_notify_userinfo(PurpleConnection *gc, const char *who,
 						 PurpleNotifyUserInfo *user_info)
 {
-	char *primary, *info;
+	char *info;
 	void *ui_handle;
+	char *key = userinfo_hash(purple_connection_get_account(gc), who);
+
+	if (!userinfo) {
+		userinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
+	}
 
-	primary = g_strdup_printf(_("Info for %s"), who);
 	info = purple_notify_user_info_get_text_with_newline(user_info, "<br />");
-	ui_handle = pidgin_notify_formatted(_("Buddy Information"), primary, NULL, info);
+	ui_handle = g_hash_table_lookup(userinfo, key);
+	if (ui_handle != NULL) {
+		GtkIMHtml *imhtml = g_object_get_data(G_OBJECT(ui_handle), "info-widget");
+		char *linked_text = purple_markup_linkify(info);
+		gtk_imhtml_clear(imhtml);
+		gtk_imhtml_append_text(imhtml, linked_text, notify_imhtml_options());
+		g_free(linked_text);
+		g_free(key);
+	} else {
+		char *primary = g_strdup_printf(_("Info for %s"), who);
+		ui_handle = pidgin_notify_formatted(_("Buddy Information"), primary, NULL, info);
+		g_hash_table_insert(userinfo, key, ui_handle);
+		g_signal_connect(G_OBJECT(ui_handle), "destroy", G_CALLBACK(remove_userinfo), key);
+		g_free(primary);
+	}
 	g_free(info);
-	g_free(primary);
 	return ui_handle;
 }
 
--- a/pidgin/gtkutils.c	Wed May 09 21:50:29 2007 +0000
+++ b/pidgin/gtkutils.c	Wed May 09 22:04:39 2007 +0000
@@ -103,17 +103,17 @@
 	if (purple_running_gnome()) {
 		char *path, *font;
 		PangoFontDescription *desc = NULL;
-				
+
 		if ((path = g_find_program_in_path("gconftool-2"))) {
 			g_free(path);
 			if (!g_spawn_command_line_sync(
-					"gconftool-2 -g /desktop/gnome/interface/document_font_name", 
+					"gconftool-2 -g /desktop/gnome/interface/document_font_name",
 					&font, NULL, NULL, NULL))
 				return;
 		}
 		desc = pango_font_description_from_string(font);
 		g_free(font);
-		
+
 		if (desc) {
 			gtk_widget_modify_font(imhtml, desc);
 			pango_font_description_free(desc);
@@ -2325,6 +2325,10 @@
 
 	if (!filename || g_stat(filename, &st))
 	{
+#if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */
+		gtk_file_chooser_set_preview_widget_active(
+					GTK_FILE_CHOOSER(dialog->icon_filesel), FALSE);
+#endif /* FILECHOOSER */
 		g_free(filename);
 		return;
 	}
--- a/pidgin/plugins/extplacement.c	Wed May 09 21:50:29 2007 +0000
+++ b/pidgin/plugins/extplacement.c	Wed May 09 22:04:39 2007 +0000
@@ -101,6 +101,11 @@
 	ppref = purple_plugin_pref_new_with_label(_("Conversation Placement"));
 	purple_plugin_pref_frame_add(frame, ppref);
 
+	/* Translators: "New conversations" should match the text in the preferences dialog and "By conversation count" should be the same text used above */
+	ppref = purple_plugin_pref_new_with_label(_("Note: The preference for \"New conversations\" must be set to \"By conversation count\"."));
+	purple_plugin_pref_set_type(ppref, PURPLE_PLUGIN_PREF_INFO);
+	purple_plugin_pref_frame_add(frame, ppref);
+
 	ppref = purple_plugin_pref_new_with_name_and_label(
 							"/plugins/gtk/extplacement/placement_number",
 							_("Number of conversations per window"));