changeset 25277:bc632f651319

propagate from branch 'im.pidgin.pidgin' (head d09a92cd7ce9896f92599d245e9964da4ac5b2e1) to branch 'im.pidgin.pidgin.next.minor' (head 26d9225c6ebd05488d396cbc713c3567e9280714)
author Richard Laager <rlaager@wiktel.com>
date Thu, 30 Oct 2008 20:03:40 +0000
parents e679c14e83b3 (current diff) fe7504f465a2 (diff)
children 12b8ccc3e9ec
files pidgin/gtkblist.c
diffstat 8 files changed, 61 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Oct 30 19:59:54 2008 +0000
+++ b/ChangeLog	Thu Oct 30 20:03:40 2008 +0000
@@ -8,6 +8,16 @@
 	  --with-system-ssl-certs and GnuTLS need to include these in the
 	  system certs directory.
 
+	Pidgin:
+	* On GTK+ 2.14 and higher, we're using the gtk-tooltip-delay setting
+	  instead of our own (hidden) tooltip_delay pref.  If you had
+	  previously changed that pref, add a line like this to
+	  ~/.purple/gtkrc-2.0 (where 500 is the timeout (in ms) you want):
+	      gtk-tooltip-timeout = 500
+	  To completely disable tooltips (e.g. if you had an old tooltip_delay
+	  of zero), add this to ~/.purple/gtkrc-2.0:
+	      gtk-enable-tooltips = 0
+
 version 2.5.2 (10/19/2008):
 	libpurple:
 	* Fixed a crash on removing a custom buddy icon on a buddy.
--- a/autogen.sh	Thu Oct 30 19:59:54 2008 +0000
+++ b/autogen.sh	Thu Oct 30 20:03:40 2008 +0000
@@ -37,7 +37,7 @@
 #   INTLTOOLIZE_FLAGS - command line arguments to pass to intltoolize
 #   LIBTOOLIZE_FLAGS - command line arguments to pass to libtoolize
 #
-# Other helpfull notes:
+# Other helpful notes:
 #   If you're using a different c compiler, you can override the environment
 #   variable in 'autogen.args'.  For example, say you're using distcc, just add
 #   the following to 'autogen.args':
@@ -48,6 +48,8 @@
 ###############################################################################
 PACKAGE="Pidgin"
 ARGS_FILE="autogen.args"
+export CFLAGS
+export LDFLAGS
 
 libtoolize="libtoolize"
 case $(uname -s) in
@@ -115,7 +117,7 @@
 if [ -f ${ARGS_FILE} ] ; then
 	echo "found."
 	printf "%s" "sourcing ${ARGS_FILE}: "
-	. ${ARGS_FILE}
+	. "`dirname "$0"`"/${ARGS_FILE}
 	echo "done."
 else
 	echo "not found."
@@ -125,8 +127,8 @@
 # Check for our required helpers
 ###############################################################################
 check "$libtoolize";		LIBTOOLIZE=${BIN};
-check "glib-gettextize"; GLIB_GETTEXTIZE=${BIN};
-check "intltoolize";	INTLTOOLIZE=${BIN};
+check "glib-gettextize";	GLIB_GETTEXTIZE=${BIN};
+check "intltoolize";		INTLTOOLIZE=${BIN};
 check "aclocal";		ACLOCAL=${BIN};
 check "autoheader";		AUTOHEADER=${BIN};
 check "automake";		AUTOMAKE=${BIN};
--- a/libpurple/blist.h	Thu Oct 30 19:59:54 2008 +0000
+++ b/libpurple/blist.h	Thu Oct 30 20:03:40 2008 +0000
@@ -75,11 +75,11 @@
 
 } PurpleBlistNodeFlags;
 
-#define PURPLE_BLIST_NODE_HAS_FLAG(b, f) (((PurpleBlistNode*)(b))->flags & (f))
+#define PURPLE_BLIST_NODE_HAS_FLAG(b, f) (purple_blist_node_get_flags((PurpleBlistNode*)(b)) & (f))
 #define PURPLE_BLIST_NODE_SHOULD_SAVE(b) (! PURPLE_BLIST_NODE_HAS_FLAG(b, PURPLE_BLIST_NODE_FLAG_NO_SAVE))
 
-#define PURPLE_BLIST_NODE_NAME(n) ((n)->type == PURPLE_BLIST_CHAT_NODE  ? purple_chat_get_name((PurpleChat*)n) :        \
-				     (n)->type == PURPLE_BLIST_BUDDY_NODE ? purple_buddy_get_name((PurpleBuddy*)n) : NULL)
+#define PURPLE_BLIST_NODE_NAME(n) (purple_blist_node_get_type(n) == PURPLE_BLIST_CHAT_NODE  ? purple_chat_get_name((PurpleChat*)n) :        \
+				     purple_blist_node_get_type(n) == PURPLE_BLIST_BUDDY_NODE ? purple_buddy_get_name((PurpleBuddy*)n) : NULL)
 
 #include "account.h"
 #include "buddyicon.h"
--- a/libpurple/plugins/tcl/tcl_cmds.c	Thu Oct 30 19:59:54 2008 +0000
+++ b/libpurple/plugins/tcl/tcl_cmds.c	Thu Oct 30 20:03:40 2008 +0000
@@ -428,7 +428,6 @@
 	if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK)
 		return error;
 
-	type = purple_blist_node_get_type(node);
 	switch (cmd) {
 	case CMD_BUDDY_ALIAS:
 		if (objc != 3) {
@@ -439,6 +438,7 @@
 			return error;
 		if ((node = tcl_list_to_buddy(interp, count, elems)) == NULL)
 			return TCL_ERROR;
+		type = purple_blist_node_get_type(node);
 		if (type == PURPLE_BLIST_CHAT_NODE)
 			Tcl_SetObjResult(interp,
 					 Tcl_NewStringObj(purple_chat_get_name((PurpleChat *)node), -1));
--- a/libpurple/protocols/bonjour/buddy.c	Thu Oct 30 19:59:54 2008 +0000
+++ b/libpurple/protocols/bonjour/buddy.c	Thu Oct 30 20:03:40 2008 +0000
@@ -127,7 +127,7 @@
 {
 	PurpleGroup *group;
 	PurpleAccount *account = bonjour_buddy->account;
-	const char *status_id, *old_hash, *new_hash;
+	const char *status_id, *old_hash, *new_hash, *name;
 
 	/* Translate between the Bonjour status and the Purple status */
 	if (bonjour_buddy->status != NULL && g_ascii_strcasecmp("dnd", bonjour_buddy->status) == 0)
@@ -158,10 +158,11 @@
 	}
 
 	buddy->proto_data = bonjour_buddy;
+	name = purple_buddy_get_name(buddy);
 
 	/* Create the alias for the buddy using the first and the last name */
 	if (bonjour_buddy->nick)
-		serv_got_alias(purple_account_get_connection(account), buddy->name, bonjour_buddy->nick);
+		serv_got_alias(purple_account_get_connection(account), name, bonjour_buddy->nick);
 	else {
 		gchar *alias = NULL;
 		const char *first, *last;
@@ -172,18 +173,18 @@
 						(first && *first ? first : ""),
 						(first && *first && last && *last ? " " : ""),
 						(last && *last ? last : ""));
-		serv_got_alias(purple_account_get_connection(account), buddy->name, alias);
+		serv_got_alias(purple_account_get_connection(account), name, alias);
 		g_free(alias);
 	}
 
 	/* Set the user's status */
 	if (bonjour_buddy->msg != NULL)
-		purple_prpl_got_user_status(account, buddy->name, status_id,
+		purple_prpl_got_user_status(account, name, status_id,
 					    "message", bonjour_buddy->msg, NULL);
 	else
-		purple_prpl_got_user_status(account, buddy->name, status_id, NULL);
+		purple_prpl_got_user_status(account, name, status_id, NULL);
 
-	purple_prpl_got_user_idle(account, buddy->name, FALSE, 0);
+	purple_prpl_got_user_idle(account, name, FALSE, 0);
 
 	/* TODO: Because we don't save Bonjour buddies in blist.xml,
 	 * we will always have to look up the buddy icon at login time.
@@ -198,7 +199,7 @@
 		 * as what we looked up. */
 		bonjour_dns_sd_retrieve_buddy_icon(bonjour_buddy);
 	} else if (!new_hash)
-		purple_buddy_icons_set_for_user(account, buddy->name, NULL, 0, NULL);
+		purple_buddy_icons_set_for_user(account, name, NULL, 0, NULL);
 }
 
 /**
--- a/libpurple/protocols/bonjour/jabber.c	Thu Oct 30 19:59:54 2008 +0000
+++ b/libpurple/protocols/bonjour/jabber.c	Thu Oct 30 20:03:40 2008 +0000
@@ -142,7 +142,7 @@
 _jabber_parse_and_write_message_to_ui(xmlnode *message_node, PurpleBuddy *pb)
 {
 	xmlnode *body_node, *html_node, *events_node;
-	PurpleConnection *gc = pb->account->gc;
+	PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(pb));
 	gchar *body = NULL;
 	gboolean composing_event = FALSE;
 
@@ -225,7 +225,7 @@
 	}
 
 	/* Send the message to the UI */
-	serv_got_im(gc, pb->name, body, 0, time(NULL));
+	serv_got_im(gc, purple_buddy_get_name(pb), body, 0, time(NULL));
 
 	g_free(body);
 }
--- a/pidgin/gtkblist.c	Thu Oct 30 19:59:54 2008 +0000
+++ b/pidgin/gtkblist.c	Thu Oct 30 20:03:40 2008 +0000
@@ -7303,7 +7303,10 @@
 	purple_prefs_add_int(PIDGIN_PREFS_ROOT "/blist/y", 0);
 	purple_prefs_add_int(PIDGIN_PREFS_ROOT "/blist/width", 250); /* Golden ratio, baby */
 	purple_prefs_add_int(PIDGIN_PREFS_ROOT "/blist/height", 405); /* Golden ratio, baby */
+#if !GTK_CHECK_VERSION(2,14,0)
+	/* This pref is used in pidgintooltip.c. */
 	purple_prefs_add_int(PIDGIN_PREFS_ROOT "/blist/tooltip_delay", 500);
+#endif
 	purple_prefs_add_string(PIDGIN_PREFS_ROOT "/blist/theme", "");
 
 	purple_theme_manager_register_type(g_object_new(PIDGIN_TYPE_BLIST_THEME_LOADER, "type", "blist", NULL));
--- a/pidgin/pidgintooltip.c	Thu Oct 30 19:59:54 2008 +0000
+++ b/pidgin/pidgintooltip.c	Thu Oct 30 20:03:40 2008 +0000
@@ -30,6 +30,9 @@
 #include "pidgintooltip.h"
 #include "debug.h"
 
+static gboolean enable_tooltips;
+static int tooltip_delay = -1;
+
 struct
 {
 	GtkWidget *widget;
@@ -56,6 +59,25 @@
 } PidginTooltipData;
 
 static void
+initialize_tooltip_delay()
+{
+	GtkSettings *settings;
+
+	if (tooltip_delay != -1)
+		return;
+
+#if GTK_CHECK_VERSION(2,14,0)
+	settings = gtk_settings_get_default();
+
+	g_object_get(settings, "gtk-enable-tooltips", &enable_tooltips, NULL);
+	g_object_get(settings, "gtk-tooltip-timeout", &tooltip_delay, NULL);
+#else
+	tooltip_delay = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/tooltip_delay");
+	enable_tooltips = (tooltip_delay != 0);
+#endif
+}
+
+static void
 destroy_tooltip_data(PidginTooltipData *data)
 {
 	gtk_tree_path_free(data->common.treeview.path);
@@ -280,14 +302,12 @@
 row_motion_cb(GtkWidget *tv, GdkEventMotion *event, gpointer userdata)
 {
 	GtkTreePath *path;
-	int delay;
 
 	if (event->window != gtk_tree_view_get_bin_window(GTK_TREE_VIEW(tv)))
 		return FALSE;    /* The cursor is probably on the TreeView's header. */
 
-	/* XXX: probably use something more generic? */
-	delay = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/tooltip_delay");
-	if (delay == 0)
+	initialize_tooltip_delay();
+	if (!enable_tooltips)
 		return FALSE;
 
 	if (pidgin_tooltip.timeout) {
@@ -307,7 +327,7 @@
 	gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &pidgin_tooltip.tip_rect);
 	gtk_tree_path_free(path);
 
-	pidgin_tooltip.timeout = g_timeout_add(delay, (GSourceFunc)pidgin_tooltip_timeout, userdata);
+	pidgin_tooltip.timeout = g_timeout_add(tooltip_delay, (GSourceFunc)pidgin_tooltip_timeout, userdata);
 
 	return FALSE;
 }
@@ -337,13 +357,13 @@
 static gboolean
 widget_motion_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
 {
-	int delay = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/tooltip_delay");
+	initialize_tooltip_delay();
 
 	pidgin_tooltip_destroy();
-	if (delay == 0)
+	if (!enable_tooltips)
 		return FALSE;
 
-	pidgin_tooltip.timeout = g_timeout_add(delay, (GSourceFunc)pidgin_tooltip_timeout, data);
+	pidgin_tooltip.timeout = g_timeout_add(tooltip_delay, (GSourceFunc)pidgin_tooltip_timeout, data);
 	return FALSE;
 }