changeset 7062:86ed8b2aa665

[gaim-migrate @ 7626] g_show_info_text() is gone! Mwahahaha. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 30 Sep 2003 06:43:17 +0000
parents 80fd120e180b
children 7fdac700deb1
files src/dialogs.c src/gaim.h src/protocols/gg/gg.c src/protocols/irc/msgs.c src/protocols/msn/msn.c src/protocols/napster/napster.c src/protocols/toc/toc.c src/protocols/yahoo/yahoo.c src/protocols/zephyr/zephyr.c
diffstat 9 files changed, 42 insertions(+), 153 deletions(-) [+]
line wrap: on
line diff
--- a/src/dialogs.c	Tue Sep 30 05:58:48 2003 +0000
+++ b/src/dialogs.c	Tue Sep 30 06:43:17 2003 +0000
@@ -121,26 +121,6 @@
 
 } GaimGtkBlockData;
 
-static GSList *info_dlgs = NULL;
-
-static struct info_dlg *find_info_dlg(GaimConnection *gc, const char *who)
-{
-	GSList *i = info_dlgs;
-	while (i) {
-		struct info_dlg *d = i->data;
-		i = i->next;
-		if (d->gc != gc)
-			continue;
-		if (d->who == NULL)
-			continue;
-		if (!who)
-			continue;
-		if (!gaim_utf8_strcasecmp(normalize(who), d->who))
-			return d;
-	}
-	return NULL;
-}
-
 struct set_info_dlg {
 	GtkWidget *window;
 	GtkWidget *menu;
@@ -1217,115 +1197,6 @@
 	gtk_widget_show_all(b->window);
 }
 
-/*------------------------------------------------------------------------*/
-/*  The dialog for the info requests                                      */
-/*------------------------------------------------------------------------*/
-
-static void info_dlg_free(GtkWidget *b, struct info_dlg *d)
-{
-	if (g_slist_find(info_dlgs, d))
-		info_dlgs = g_slist_remove(info_dlgs, d);
-	g_free(d->who);
-	g_free(d);
-}
-
-/* if away is 0, show regardless and try to get away message
- *            1, don't show if regular info isn't shown
- *            2, show regardless but don't try to get away message
- *
- * i wish this were my client. if i were i wouldn't have to deal with this shit.
- */
-void g_show_info_text(GaimConnection *gc, const char *who, int away, const char *info, ...)
-{
-	GtkWidget *ok;
-	GtkWidget *label;
-	GtkWidget *text;
-	GtkWidget *bbox;
-	GtkWidget *sw;
-	gint options = 0;
-	gchar *linkifyinated;
-	va_list ap;
-	char *more_info;
-
-	struct info_dlg *b = find_info_dlg(gc, who);
-	if (!b && (away == 1))
-		return;
-	if (!b) {
-		b = g_new0(struct info_dlg, 1);
-		b->gc = gc;
-		b->who = who ? g_strdup(normalize(who)) : NULL;
-		info_dlgs = g_slist_append(info_dlgs, b);
-
-		GAIM_DIALOG(b->window);
-		gtk_window_set_title(GTK_WINDOW(b->window), "Gaim");
-		gtk_window_set_role(GTK_WINDOW(b->window), "get_info");
-		gtk_container_set_border_width(GTK_CONTAINER(b->window), 5);
-		gtk_widget_realize(GTK_WIDGET(b->window));
-		g_signal_connect(G_OBJECT(b->window), "destroy", G_CALLBACK(info_dlg_free), b);
-
-		bbox = gtk_vbox_new(FALSE, 5);
-		gtk_container_add(GTK_CONTAINER(b->window), bbox);
-
-		label = gtk_label_new(_("Below are the results of your search: "));
-		gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0);
-
-		sw = gtk_scrolled_window_new(NULL, NULL);
-		gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
-		gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
-		gtk_box_pack_start(GTK_BOX(bbox), sw, TRUE, TRUE, 0);
-
-		text = gtk_imhtml_new(NULL, NULL);
-		b->text = text;
-		gtk_container_add(GTK_CONTAINER(sw), text);
-		gtk_widget_set_size_request(sw, 300, 250);
-		gaim_setup_imhtml(text);
-
-		ok = gaim_pixbuf_button_from_stock(_("OK"), GTK_STOCK_OK, GAIM_BUTTON_HORIZONTAL);
-		g_signal_connect_swapped(G_OBJECT(ok), "clicked", G_CALLBACK(gtk_widget_destroy),
-					  G_OBJECT(b->window));
-		gtk_box_pack_start(GTK_BOX(bbox), ok, FALSE, FALSE, 0);
-
-		gtk_widget_show_all(b->window);
-	}
-
-	if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors"))
-		options ^= GTK_IMHTML_NO_COLOURS;
-
-	if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts"))
-		options ^= GTK_IMHTML_NO_FONTS;
-
-	if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes"))
-		options ^= GTK_IMHTML_NO_SIZES;
-
-	options ^= GTK_IMHTML_NO_COMMENTS;
-	options ^= GTK_IMHTML_NO_TITLE;
-	options ^= GTK_IMHTML_NO_NEWLINE;
-	options ^= GTK_IMHTML_NO_SCROLL;
-
-	if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_urls_as_links")) {
-		linkifyinated = linkify_text(info);
-		gtk_imhtml_append_text(GTK_IMHTML(b->text), linkifyinated, options);
-		g_free(linkifyinated);
-	} else
-		gtk_imhtml_append_text(GTK_IMHTML(b->text), info, options);
-
-	va_start(ap, info);
-	while ((more_info = va_arg(ap, char *)) != NULL) {
-		if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_urls_as_links")) {
-			linkifyinated = linkify_text(more_info);
-			gtk_imhtml_append_text(GTK_IMHTML(b->text), linkifyinated, options);
-			g_free(linkifyinated);
-		} else
-			gtk_imhtml_append_text(GTK_IMHTML(b->text), more_info, options);
-	}
-	va_end(ap);
-
-	if (away)
-		info_dlgs = g_slist_remove(info_dlgs, b);
-	else
-		serv_get_away(gc, who);
-}
-
 
 /*------------------------------------------------------------------------*/
 /*  Functions Called To Add A Log                                          */
--- a/src/gaim.h	Tue Sep 30 05:58:48 2003 +0000
+++ b/src/gaim.h	Tue Sep 30 06:43:17 2003 +0000
@@ -2,7 +2,7 @@
  * gaim
  *
  * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -37,7 +37,6 @@
 extern GSList *away_time_queue;
 
 /* Functions in dialogs.c */
-extern void g_show_info_text(GaimConnection *, const char *, int, const char *, ...);
 extern void show_change_passwd(GaimConnection *);
 extern void show_set_dir(GaimConnection *);
 extern void show_find_email(GaimConnection *);
--- a/src/protocols/gg/gg.c	Tue Sep 30 05:58:48 2003 +0000
+++ b/src/protocols/gg/gg.c	Tue Sep 30 06:43:17 2003 +0000
@@ -1,6 +1,6 @@
 /*
  * gaim - Gadu-Gadu Protocol Plugin
- * $Id: gg.c 7538 2003-09-27 19:17:21Z thekingant $
+ * $Id: gg.c 7626 2003-09-30 06:43:17Z chipx86 $
  *
  * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
  *
@@ -34,7 +34,7 @@
 #include "server.h"
 #include "util.h"
 
-/* XXX for g_show_info_text(), WEBSITE, and stuff */
+#warning Replace show_change_passwd and remove #include <gaim.h>
 #include "gaim.h"
 
 #define GG_CONNECT_STEPS 5
@@ -722,7 +722,8 @@
 
 	g_strfreev(webdata_tbl);
 
-	g_show_info_text(gc, NULL, 2, buf, NULL);
+	gaim_notify_formatted(gc, NULL, _("Buddy Information"), NULL,
+						  buf, NULL, NULL);
 
 	g_free(buf);
 }
@@ -1186,6 +1187,7 @@
 	GList *m = NULL;
 	struct proto_actions_menu *pam;
 
+#if 0
 	pam = g_new0(struct proto_actions_menu, 1);
 	pam->label = _("Directory Search");
 	pam->callback = show_find_info;
@@ -1193,6 +1195,7 @@
 	m = g_list_append(m, pam);
 
 	m = g_list_append(m, NULL);
+#endif
 
 	pam = g_new0(struct proto_actions_menu, 1);
 	pam->label = _("Change Password");
--- a/src/protocols/irc/msgs.c	Tue Sep 30 05:58:48 2003 +0000
+++ b/src/protocols/irc/msgs.c	Tue Sep 30 06:43:17 2003 +0000
@@ -22,9 +22,6 @@
 
 #include "internal.h"
 
-/* XXX g_show_info_text */
-#include "gaim.h"
-
 #include "conversation.h"
 #include "blist.h"
 #include "notify.h"
@@ -170,6 +167,7 @@
 {
 	GaimConnection *gc;
 	GString *info;
+	char buffer[256];
 	char *str;
 
 	if (!irc->whois.nick) {
@@ -216,7 +214,11 @@
 
 	gc = gaim_account_get_connection(irc->account);
 	str = g_string_free(info, FALSE);
-	g_show_info_text(gc, irc->whois.nick, 2, str, NULL);
+
+	g_snprintf(buffer, sizeof(buffer),
+			   _("Buddy Information for %s"), irc->whois.nick);
+	gaim_notify_formatted(gc, NULL, buffer, NULL, str, NULL, NULL);
+
 	g_free(str);
 	memset(&irc->whois, 0, sizeof(irc->whois));
 }
--- a/src/protocols/msn/msn.c	Tue Sep 30 05:58:48 2003 +0000
+++ b/src/protocols/msn/msn.c	Tue Sep 30 06:43:17 2003 +0000
@@ -1217,6 +1217,7 @@
 static void
 msn_got_info(gpointer data, char *url_text, unsigned long len)
 {
+	GaimConnection *gc = (GaimConnection *)data;
 	char *stripped, *p, *q;
 	char buf[1024];
 	char *user_url = NULL;
@@ -1224,9 +1225,9 @@
 
 	if (url_text == NULL || strcmp(url_text,"") == 0)
 	{
-		g_show_info_text(NULL, NULL, 2,
-				_("<html><body><b>Error retrieving profile</b></body></html>"),
-				NULL);
+		gaim_notify_formatted(gc, NULL, _("Buddy Information"), NULL,
+			_("<html><body><b>Error retrieving profile</b></body></html>"),
+			  NULL, NULL);
 
 		return;
 	}
@@ -1421,7 +1422,10 @@
 
 	/* Finish it off, and show it to them */
 	strcat(url_text, "</body></html>\n");
-	g_show_info_text(NULL, NULL, 2, url_text, NULL);
+
+	gaim_notify_formatted(gc, NULL, _("Buddy Information"), NULL,
+						  url_text, NULL, NULL);
+
 	g_free(stripped);
 }
 
@@ -1430,7 +1434,8 @@
 {
 	char url[256];
 	g_snprintf(url, sizeof url, "%s%s", PROFILE_URL, name);
-	grab_url(url, FALSE, msn_got_info, NULL,"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)",1);
+	grab_url(url, FALSE, msn_got_info, gc,
+			 "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)",1);
 }
 
 static GaimPluginProtocolInfo prpl_info =
--- a/src/protocols/napster/napster.c	Tue Sep 30 05:58:48 2003 +0000
+++ b/src/protocols/napster/napster.c	Tue Sep 30 06:43:17 2003 +0000
@@ -387,7 +387,9 @@
 	case 604: /* MSG_SERVER_WHOIS_RESPONSE */
 		/* XXX - Format is:   "Elite" 37 " " "Active" 0 0 0 0 "gaim 0.63cvs" 0 0 192.168.1.41 32798 0 unknown flounder */
 		res = g_strsplit(buf, " ", 2);
-		g_show_info_text(gc, res[0], 2, res[1], NULL);
+		/* res[0] == username */
+		gaim_notify_formatted(gc, NULL, _("Buddy Information"), NULL,
+							  res[1], NULL, NULL);
 		g_strfreev(res);
 		break;
 
--- a/src/protocols/toc/toc.c	Tue Sep 30 05:58:48 2003 +0000
+++ b/src/protocols/toc/toc.c	Tue Sep 30 06:43:17 2003 +0000
@@ -499,7 +499,8 @@
 	if (!url_text)
 		return;
 
-	g_show_info_text(NULL, NULL, 2, url_text, NULL);
+	gaim_notify_formatted(data, NULL, _("Buddy Information"), NULL,
+						  url_text, NULL, NULL);
 }
 
 static char *show_error_message()
@@ -899,7 +900,7 @@
 		g_snprintf(tmp, sizeof(tmp), "http://%s:%d/%s", tdt->toc_ip,
 				gaim_account_get_int(gc->account, "port", TOC_PORT),
 				url);
-		grab_url(tmp, FALSE, toc_got_info, NULL, NULL, 0);
+		grab_url(tmp, FALSE, toc_got_info, gc, NULL, 0);
 	} else if (!g_ascii_strcasecmp(c, "DIR_STATUS")) {
 	} else if (!g_ascii_strcasecmp(c, "ADMIN_NICK_STATUS")) {
 	} else if (!g_ascii_strcasecmp(c, "ADMIN_PASSWD_STATUS")) {
--- a/src/protocols/yahoo/yahoo.c	Tue Sep 30 05:58:48 2003 +0000
+++ b/src/protocols/yahoo/yahoo.c	Tue Sep 30 06:43:17 2003 +0000
@@ -2399,8 +2399,10 @@
 
 	/* we failed to grab the profile URL */
 	if (!url_text) {
-		g_show_info_text(NULL, NULL, 2,
-				_("<html><body><b>Error retrieving profile</b></body></html>"), NULL);
+		gaim_notify_formatted(data, NULL, _("Buddy Information"), NULL,
+			_("<html><body><b>Error retrieving profile</b></body></html>"),
+			  NULL, NULL);
+
 		return;
 	}
 
@@ -2417,7 +2419,8 @@
 				_("If you wish to view this profile, you will need to visit this link in your web browser"),
 				1, YAHOO_PROFILE_URL);
 		strcat(buf, "</body></html>\n");
-		g_show_info_text(NULL, NULL, 2, buf, NULL);
+		gaim_notify_formatted(data, NULL, _("Buddy Information"), NULL,
+							  buf, NULL, NULL);
 		return;
 	}
 
@@ -2433,7 +2436,8 @@
 				_("If you wish to view this profile, you will need to visit this link in your web browser"),
 				1, YAHOO_PROFILE_URL);
 		strcat(buf, "</body></html>\n");
-		g_show_info_text(NULL, NULL, 2, buf, NULL);
+		gaim_notify_formatted(data, NULL, _("Buddy Information"), NULL,
+							  buf, NULL, NULL);
 		return;
 	}
 
@@ -2550,7 +2554,8 @@
 	g_free(stripped);
 
 	/* show it to the user */
-	g_show_info_text(NULL, NULL, 2, url_text, NULL);
+	gaim_notify_formatted(data, NULL, _("Buddy Information"), NULL,
+						  url_text, NULL, NULL);
 }
 
 static void yahoo_get_info(GaimConnection *gc, const char *name)
@@ -2558,7 +2563,7 @@
 	/* struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; */
 	char url[256];
 	g_snprintf(url, sizeof url, "%s%s", YAHOO_PROFILE_URL, name);
-	grab_url(url, FALSE, yahoo_got_info, NULL, NULL, 0);
+	grab_url(url, FALSE, yahoo_got_info, gc, NULL, 0);
 }
 
 static void yahoo_change_buddys_group(GaimConnection *gc, const char *who,
--- a/src/protocols/zephyr/zephyr.c	Tue Sep 30 05:58:48 2003 +0000
+++ b/src/protocols/zephyr/zephyr.c	Tue Sep 30 06:43:17 2003 +0000
@@ -344,7 +344,8 @@
 					g_string_append_printf(str, _("<br>At %s since %s"), locs.host,
 									locs.time);
 				}
-				g_show_info_text(NULL, NULL, 2, str->str, NULL);
+				gaim_notify_formatted(zgc, NULL, _("Buddy Information"),
+									  NULL, str->str, NULL, NULL);
 				g_string_free(str, TRUE);
 			} else
 				serv_got_update(zgc, b->name, nlocs, 0, 0, 0, 0);