changeset 21416:0f469b9a4302

propagate from branch 'im.pidgin.pidgin.next.minor' (head 58a7a68ec9891c7989ec16c0a3d52f9756de75db) to branch 'im.pidgin.cpw.resiak.disconnectreason' (head 5db9a4fc4ce0375558d343ab39f2b6f39453031b)
author Will Thompson <will.thompson@collabora.co.uk>
date Mon, 05 Nov 2007 16:48:02 +0000
parents ebb46dea479a (diff) 5203f3836da5 (current diff)
children 21bea7c72a80
files COPYRIGHT ChangeLog.API
diffstat 14 files changed, 37 insertions(+), 283 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Mon Nov 05 10:29:13 2007 +0000
+++ b/COPYRIGHT	Mon Nov 05 16:48:02 2007 +0000
@@ -93,6 +93,7 @@
 Michael Culbertson
 Steven Danna
 Chris Davies
+Josh Davis
 Martijn Dekker
 Vinicius Depizzol
 Philip Derrin
--- a/ChangeLog.API	Mon Nov 05 10:29:13 2007 +0000
+++ b/ChangeLog.API	Mon Nov 05 16:48:02 2007 +0000
@@ -54,8 +54,6 @@
 		* pidgin_pounce_editor_show_with_parent()
 		* pidgin_pounces_manager_show_with_parent()
 		* pidgin_syslog_show_with_parent()
-		* pidgin_docklet_get_geometry()
-		* pidgin_docklet_get_gdk_screen()
 
 		* purple_request_accept_cancel_with_hint()
 		* purple_request_action_varg_with_hint()
--- a/finch/gntplugin.c	Mon Nov 05 10:29:13 2007 +0000
+++ b/finch/gntplugin.c	Mon Nov 05 16:48:02 2007 +0000
@@ -29,6 +29,7 @@
 #include <gntlabel.h>
 #include <gntline.h>
 #include <gnttree.h>
+#include <gntutils.h>
 
 #include "finch.h"
 
@@ -399,6 +400,7 @@
 
 	button = gnt_button_new(_("Install Plugin..."));
 	gnt_box_add_widget(GNT_BOX(box), button);
+	gnt_util_set_trigger_widget(GNT_WIDGET(tree), GNT_KEY_INS, button);
 	g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(install_plugin_cb), NULL);
 
 	button = gnt_button_new(_("Close"));
--- a/finch/libgnt/gntbutton.c	Mon Nov 05 10:29:13 2007 +0000
+++ b/finch/libgnt/gntbutton.c	Mon Nov 05 16:48:02 2007 +0000
@@ -98,6 +98,14 @@
 }
 
 static void
+gnt_button_destroy(GntWidget *widget)
+{
+	GntButton *button = GNT_BUTTON(widget);
+	g_free(button->priv->text);
+	g_free(button->priv);
+}
+
+static void
 gnt_button_class_init(GntWidgetClass *klass)
 {
 	char *style;
@@ -108,6 +116,7 @@
 	parent_class->size_request = gnt_button_size_request;
 	parent_class->key_pressed = gnt_button_key_pressed;
 	parent_class->clicked = gnt_button_clicked;
+	parent_class->destroy = gnt_button_destroy;
 
 	style = gnt_style_get_from_name(NULL, "small-button");
 	small_button = gnt_style_parse_bool(style);
--- a/finch/libgnt/gntfilesel.c	Mon Nov 05 10:29:13 2007 +0000
+++ b/finch/libgnt/gntfilesel.c	Mon Nov 05 16:48:02 2007 +0000
@@ -634,6 +634,7 @@
 	sel->cancel = gnt_button_new("Cancel");
 	sel->select = gnt_button_new("Select");
 
+	g_signal_connect_swapped(G_OBJECT(sel->files), "activate", G_CALLBACK(gnt_widget_activate), sel->select);
 	g_signal_connect(G_OBJECT(sel->select), "activate", G_CALLBACK(select_activated_cb), sel);
 }
 
--- a/finch/libgnt/gnttree.c	Mon Nov 05 10:29:13 2007 +0000
+++ b/finch/libgnt/gnttree.c	Mon Nov 05 16:48:02 2007 +0000
@@ -363,17 +363,17 @@
 		notfirst = TRUE;
 
 		if (len > width) {
-			len = width - 1;
+			len = MAX(1, width - 1);
 			cut = TRUE;
 		}
 
 		if (RIGHT_ALIGNED(tree, i) && len < tree->columns[i].width) {
-			g_string_append_printf(string, "%*s", width - len, "");
+			g_string_append_printf(string, "%*s", width - len - cut, "");
 		}
 
 		text = gnt_util_onscreen_width_to_pointer(display, len - fl, NULL);
 		string = g_string_append_len(string, display, text - display);
-		if (cut) { /* ellipsis */
+		if (cut && width > 1) { /* ellipsis */
 			if (gnt_ascii_only())
 				g_string_append_c(string, '~');
 			else
@@ -1492,7 +1492,8 @@
 			col->text = g_strdup(text ? text : "");
 		}
 
-		if (get_distance(tree->top, row) >= 0 && get_distance(row, tree->bottom) >= 0)
+		if (GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(tree), GNT_WIDGET_MAPPED) &&
+			get_distance(tree->top, row) >= 0 && get_distance(row, tree->bottom) >= 0)
 			redraw_tree(tree);
 	}
 }
--- a/libpurple/protocols/myspace/markup.c	Mon Nov 05 10:29:13 2007 +0000
+++ b/libpurple/protocols/myspace/markup.c	Mon Nov 05 16:48:02 2007 +0000
@@ -580,7 +580,6 @@
 		default:
 			purple_debug_info("msim",
 					"msim_convert_xmlnode: strange node\n");
-			inner = g_strdup("");
 		}
 
 		if (inner) {
--- a/libpurple/protocols/silc10/silc.c	Mon Nov 05 10:29:13 2007 +0000
+++ b/libpurple/protocols/silc10/silc.c	Mon Nov 05 16:48:02 2007 +0000
@@ -936,11 +936,14 @@
 	purple_request_field_group_add_field(g, f);
 	purple_request_fields_add_group(fields, g);
 
-	purple_request_fields(gc, _("Create New SILC Key Pair"),
-			    _("Create New SILC Key Pair"), NULL, fields,
-			    _("Generate Key Pair"), G_CALLBACK(silcpurple_create_keypair_cb),
-			    _("Cancel"), G_CALLBACK(silcpurple_create_keypair_cancel),
-				gc->account, NULL, NULL, "blist", gc);
+	purple_request_fields_with_hint(gc, _("Create New SILC Key Pair"),
+	                                _("Create New SILC Key Pair"), NULL,
+	                                fields, _("Generate Key Pair"),
+	                                G_CALLBACK(silcpurple_create_keypair_cb),
+	                                _("Cancel"),
+                                        G_CALLBACK(silcpurple_create_keypair_cancel),
+	                                gc->account, NULL, NULL,
+                                        PURPLE_REQUEST_UI_HINT_BLIST, gc);
 
 	g_strfreev(u);
 	silc_free(hostname);
--- a/libpurple/util.c	Mon Nov 05 10:29:13 2007 +0000
+++ b/libpurple/util.c	Mon Nov 05 16:48:02 2007 +0000
@@ -1372,7 +1372,9 @@
 							g_string_append_printf(xhtml, "</%s>", pt->dest_tag);
 						if(plain && !strcmp(pt->src_tag, "a")) {
 							/* if this is a link, we have to add the url to the plaintext, too */
-							if (cdata && url && !g_string_equal(cdata, url))
+							if (cdata && url &&
+									(!g_string_equal(cdata, url) && (g_ascii_strncasecmp(url->str, "mailto:", 7) != 0 ||
+									                                 g_utf8_collate(url->str + 7, cdata->str) != 0)))
 								g_string_append_printf(plain, " <%s>", g_strstrip(url->str));
 							if (cdata) {
 								g_string_free(cdata, TRUE);
@@ -1732,6 +1734,8 @@
 				xhtml = g_string_append_len(xhtml, c, len);
 			if(plain)
 				plain = g_string_append(plain, pln);
+			if(cdata)
+				cdata = g_string_append_len(cdata, c, len);
 			c += len;
 		} else {
 			if(xhtml)
@@ -1757,6 +1761,8 @@
 		*plain_out = g_string_free(plain, FALSE);
 	if(url)
 		g_string_free(url, TRUE);
+	if (cdata)
+		g_string_free(cdata, TRUE);
 }
 
 /* The following are probably reasonable changes:
--- a/pidgin/gtkdocklet-x11.c	Mon Nov 05 10:29:13 2007 +0000
+++ b/pidgin/gtkdocklet-x11.c	Mon Nov 05 16:48:02 2007 +0000
@@ -229,35 +229,6 @@
 }
 
 static gboolean
-docklet_x11_get_geometry(gint *x, gint *y, gint *w, gint *h)
-{
-	int lx,ly;
-	GtkWidget *widget = GTK_WIDGET(docklet);
-
-	if(docklet==NULL) return FALSE;
-
-	gdk_window_get_origin(GDK_WINDOW(widget->window), &lx, &ly);
-
-	if(x!=NULL) *x = lx + widget->allocation.x;
-	if(y!=NULL) *y = ly + widget->allocation.y;
-
-	if(w!=NULL) *w = widget->allocation.width;
-	if(h!=NULL) *h = widget->allocation.height;
-
-	return TRUE;
-}
-
-static GObject *
-docklet_x11_get_gdk_screen()
-{
-#if GTK_CHECK_VERSION(2,2,0)
-	return (GObject *)gtk_widget_get_screen(GTK_WIDGET(docklet));
-#else
-	return NULL;
-#endif
-}
-
-static gboolean
 docklet_x11_embed_timeout_cb()
 {
 	/* The docklet was not embedded within the timeout.
@@ -342,12 +313,10 @@
 	docklet_x11_blank_icon,
 	docklet_x11_set_tooltip,
 #if GTK_CHECK_VERSION(2,2,0)
-	docklet_x11_position_menu,
+	docklet_x11_position_menu
 #else
-	NULL,
+	NULL
 #endif
-	docklet_x11_get_geometry,
-	docklet_x11_get_gdk_screen
 };
 
 void
--- a/pidgin/gtkdocklet.c	Mon Nov 05 10:29:13 2007 +0000
+++ b/pidgin/gtkdocklet.c	Mon Nov 05 16:48:02 2007 +0000
@@ -709,22 +709,6 @@
 	return &i;
 }
 
-gboolean
-pidgin_docklet_get_geometry(gint *x, gint *y, gint *w, gint *h)
-{
-	if(visible && ui_ops && ui_ops->get_geometry)
-		return ui_ops->get_geometry(x, y, w, h);
-	return FALSE;
-}
-
-GObject *
-pidgin_docklet_get_gdk_screen()
-{
-	if(visible && ui_ops && ui_ops->get_gdk_screen)
-		return ui_ops->get_gdk_screen();
-	return NULL;
-}
-
 void
 pidgin_docklet_init()
 {
--- a/pidgin/gtkdocklet.h	Mon Nov 05 10:29:13 2007 +0000
+++ b/pidgin/gtkdocklet.h	Mon Nov 05 16:48:02 2007 +0000
@@ -35,8 +35,6 @@
 	void (*blank_icon)(void);
 	void (*set_tooltip)(gchar *);
 	GtkMenuPositionFunc position_menu;
-	gboolean (*get_geometry)(gint *x, gint *y, gint *w, gint *h);
-	GObject *(*get_gdk_screen)(void);
 };
 
 
@@ -51,28 +49,6 @@
 void pidgin_docklet_uninit(void);
 void*pidgin_docklet_get_handle(void);
 
-/**
- * Get the geometry of the docklet. Any of the parameters may be
- * NULL if that value is not desired.
- *
- * @param x x coordinate of the top left corner of the docklet in screen coordinates
- * @param y y coordinate of the top left corner of the docklet in screen coordinates
- * @param w width of the docklet
- * @param h height of the docklet
- *
- * @return TRUE if the geometry was found, otherwise FALSE
- */
-gboolean pidgin_docklet_get_geometry(gint *x, gint *y, gint *w, gint *h);
-
-/**
- * Get the GdkScreen of the docklet. If the GdkScreen is not available, including
- * running on versions of Gtk/Gdk where GdkScreen does not exist (<2.2), NULL is
- * returned.
- *
- * @return GdkScreen if available, otherwise NULL
- */
-GObject *pidgin_docklet_get_gdk_screen(void);
-
 /* function in gtkdocklet-{x11,win32}.c */
 void docklet_ui_init(void);
 
--- a/pidgin/gtkstatusbox.c	Mon Nov 05 10:29:13 2007 +0000
+++ b/pidgin/gtkstatusbox.c	Mon Nov 05 16:48:02 2007 +0000
@@ -276,7 +276,7 @@
 			return FALSE;
 		}
 
-		box->buddy_icon_sel = pidgin_buddy_icon_chooser_new(NULL, icon_choose_cb, box);
+		box->buddy_icon_sel = pidgin_buddy_icon_chooser_new(GTK_WINDOW(gtk_widget_get_toplevel(widget)), icon_choose_cb, box);
 		gtk_widget_show_all(box->buddy_icon_sel);
 	}
 	return FALSE;
--- a/pidgin/win32/gtkdocklet-win32.c	Mon Nov 05 10:29:13 2007 +0000
+++ b/pidgin/win32/gtkdocklet-win32.c	Mon Nov 05 16:48:02 2007 +0000
@@ -570,199 +570,6 @@
 	RestoreWndFromTray(GDK_WINDOW_HWND(gtkblist->window->window));
 }
 
-/* Checks to see if a window matches a specified name. If it matches,
- * the matched_hwnd pointer is set to the checked window.
- *
- * hwnd is the window to check
- * matched_hwnd points to hwnd on a match
- * name is the expected class name
- * 
- * returns TRUE if there was a match, otherwise FALSE
- */
-static BOOL
-check_hwnd_class_name(HWND hwnd, HWND *matched_hwnd, char *name)
-{
-	TCHAR class_name[256];
-
-	/* get class name of window */
-	GetClassName(hwnd, class_name, 255);
-
-	/* compare class name with specified name */
-	if(strncmp(class_name, name, 255)!=0) return FALSE;
-
-	/* set matched_hwnd to hwnd */
-	*matched_hwnd = hwnd;
-	return TRUE;
-}
-
-/* callback for EnumChildWindows looking for TrayNotifyWnd */
-static BOOL CALLBACK
-find_tray_notify_hwnd_cb(HWND hwnd, LPARAM lparam)
-{
-	return !check_hwnd_class_name(hwnd, (HWND*)lparam, "TrayNotifyWnd");
-}
-
-/* callback for EnumChildWindows looking for ToolbarWindow32 */
-static BOOL CALLBACK
-find_tray_toolbar_hwnd_cb(HWND hwnd, LPARAM lparam)
-{
-	return !check_hwnd_class_name(hwnd, (HWND*)lparam, "ToolbarWindow32");
-}
-
-static HWND
-get_tray_toolbar_hwnd()
-{
-	HWND shell_tray_hwnd = NULL;
-	HWND tray_notify_hwnd = NULL;
-	HWND tray_toolbar_hwnd = NULL;
-
-	/* find the top-level window of the system tray area */
-	shell_tray_hwnd = FindWindow("Shell_TrayWnd", NULL);
-	if(!shell_tray_hwnd) return NULL;
-
-	/* enumerate over the shell_tray_hwnd children windows looking for the tray_notify_hwnd */
-	EnumChildWindows(shell_tray_hwnd, find_tray_notify_hwnd_cb, (LPARAM)&tray_notify_hwnd);
-	if(!tray_notify_hwnd || !IsWindow(tray_notify_hwnd)) return NULL;
-
-	/* enumerate over the tray_notify_hwnd children windows looking for tray_toolbar_hwnd */
-	EnumChildWindows(tray_notify_hwnd, find_tray_toolbar_hwnd_cb, (LPARAM)&tray_toolbar_hwnd);
-	if(!tray_toolbar_hwnd || !IsWindow(tray_toolbar_hwnd)) return NULL;
-
-	return tray_toolbar_hwnd;
-}
-
-
-/* Get the geometry of the tray icon. This might break if the user is running a
- * non-standard shell, in which case this function will return FALSE. If the
- * tray icon is hidden (possible >= winxp), then the geometry of the tray itself
- * is returned. If FALSE is returned, x, y, w and h are left unchanged.
- * Any of the parameters (x, y, w, h) may be NULL if that value is not
- * desired.
- *
- * This code is based on the method and code described here by Irek Zielinski:
- *     http://www.codeproject.com/shell/ctrayiconposition.asp?msg=999295
- */
-static gboolean
-winpidgin_tray_get_geometry(gint *x, gint *y, gint *w, gint *h)
-{
-	/* systray_hwnd is the parent window of our systray icon */
-	HWND tray_toolbar_hwnd = NULL;
-	DWORD tray_toolbar_pid = -1;
-	HANDLE tray_toolbar_proc = NULL;
-	int tray_toolbar_bcount = 0;
-	LPVOID tray_toolbar_mem = NULL;
-
-	TBBUTTON button;
-	DWORD nbytes = -1;
-	DWORD hwnd_id_pair[2] = { -1, -1};
-	RECT rect;
-	POINT top_left;
-	POINT bot_right;
-	gboolean found_docklet = FALSE;
-	int i;
-
-	/* get the tray_toolbar_hwnd */
-	tray_toolbar_hwnd = get_tray_toolbar_hwnd();
-	if(!tray_toolbar_hwnd) {
-		return FALSE;
-	}
-
-	/* count buttons in the tray_toolbar_hwnd */
-	tray_toolbar_bcount = SendMessage(tray_toolbar_hwnd, TB_BUTTONCOUNT, 0, 0);
-	if(tray_toolbar_bcount < 1) {
-		return FALSE;
-	}
-
-	/* get pid of the tray_toolbar_hwnd parent process */
-	GetWindowThreadProcessId(tray_toolbar_hwnd, &tray_toolbar_pid);
-	if(tray_toolbar_pid <= 0) {
-		return FALSE;
-	}
-
-	/* open the tray_toolbar_hwnd parent process */
-	tray_toolbar_proc = OpenProcess(PROCESS_ALL_ACCESS, 0, tray_toolbar_pid);
-	if(!tray_toolbar_proc) {
-		return FALSE;
-	}
-
-	/* allocate some memory in the tray_toolbar_hwnd process space */
-	tray_toolbar_mem = VirtualAllocEx(tray_toolbar_proc, NULL, sizeof(TBBUTTON), MEM_COMMIT, PAGE_READWRITE);
-	if(!tray_toolbar_mem) {
-		CloseHandle(tray_toolbar_proc);
-		return FALSE;
-	}
-
-	/* loop through buttons, looking for the docklet */
-	for(i=0; i<tray_toolbar_bcount; i++) {
-
-		/* get the button */
-		SendMessage(tray_toolbar_hwnd, TB_GETBUTTON, i, (LPARAM)tray_toolbar_mem);
-		ReadProcessMemory(tray_toolbar_proc, tray_toolbar_mem, &button, sizeof(TBBUTTON), &nbytes);
-		if(nbytes < sizeof(TBBUTTON)) {
-			continue;
-		}
-
-		/* get the dwData from the button */
-		ReadProcessMemory(tray_toolbar_proc, (LPVOID)button.dwData, &hwnd_id_pair, sizeof(hwnd_id_pair), &nbytes);
-		if(nbytes < sizeof(hwnd_id_pair)) {
-			continue;
-		}
-
-		/* compare hwnd of button against systray_hwnd */
-		if((HWND)hwnd_id_pair[0] != systray_hwnd) {
-			continue;
-		}
-
-		/* check if button is hidden */
-		if(button.fsState & TBSTATE_HIDDEN) {
-			break;
-		}
-
-		/* get RECT of docklet icon */
-		SendMessage(tray_toolbar_hwnd, TB_GETITEMRECT, i, (LPARAM)tray_toolbar_mem);
-		ReadProcessMemory(tray_toolbar_proc, tray_toolbar_mem, &rect, sizeof(RECT), &nbytes);
-		if(nbytes < sizeof(RECT)) {
-			break;
-		}
-
-		/* translate to screen coordinates */
-		top_left.x = rect.left;
-		top_left.y = rect.top;
-		bot_right.x = rect.right;
-		bot_right.y = rect.bottom;
-
-		MapWindowPoints(tray_toolbar_hwnd, NULL, (LPPOINT)&top_left, 1);
-		MapWindowPoints(tray_toolbar_hwnd, NULL, (LPPOINT)&bot_right, 1);
-
-		found_docklet = TRUE;
-		break;
-	}
-
-	if(!found_docklet) {
-		/* fallback on geometry of tray itself */
-		GetWindowRect(tray_toolbar_hwnd, &rect);
-		if(x!=NULL) *x = rect.left;
-		if(y!=NULL) *y = rect.top;
-		if(w!=NULL) *w = rect.right - rect.left;
-		if(h!=NULL) *h = rect.bottom - rect.top;
-	} else {
-		if(x!=NULL) *x = top_left.x;
-		if(y!=NULL) *y = top_left.y;
-		if(w!=NULL) *w = bot_right.x - top_left.x;
-		if(h!=NULL) *h = bot_right.y - top_left.y;
-	}
-
-	/* clean up */
-	VirtualFreeEx(tray_toolbar_proc, tray_toolbar_mem, 0, MEM_RELEASE);
-	CloseHandle(tray_toolbar_proc);
-	return TRUE;
-}
-
-static GObject *
-winpidgin_tray_get_gdk_screen()
-{
-	return (GObject *)gdk_screen_get_default();
-}
 
 static void winpidgin_tray_create() {
 	OSVERSIONINFO osinfo;
@@ -851,9 +658,7 @@
 	winpidgin_tray_update_icon,
 	winpidgin_tray_blank_icon,
 	winpidgin_tray_set_tooltip,
-	NULL,
-	winpidgin_tray_get_geometry,
-	winpidgin_tray_get_gdk_screen
+	NULL
 };
 
 /* Used by docklet's plugin load func */