changeset 29837:7cc66981f029

propagate from branch 'im.pidgin.pidgin' (head d33b4d42bee23e1d64289f3e7c83b182ef0e5a91) to branch 'im.pidgin.cpw.rekkanoryo.icqxstatus' (head 5fa1ee0a365568098be2e91550533c59ca3e20f6)
author Richard Laager <rlaager@wiktel.com>
date Mon, 17 Nov 2008 19:09:53 +0000
parents 33945b987e15 (current diff) 558523cebd10 (diff)
children 30014b0ad09c
files libpurple/protocols/jabber/jabber.c pidgin/gtkblist.c pidgin/pixmaps/emblems/16/mobile.png pidgin/pixmaps/emotes/default/24/eat.png pidgin/pixmaps/emotes/default/24/in-love.png pidgin/pixmaps/emotes/default/24/love.png pidgin/pixmaps/emotes/default/24/nailbiting.png pidgin/pixmaps/emotes/default/24/shock.png pidgin/pixmaps/emotes/default/24/smile-big.png pidgin/pixmaps/emotes/default/24/smile.png pidgin/pixmaps/emotes/default/24/sweat.png pidgin/pixmaps/emotes/default/24/tremble.png pidgin/pixmaps/emotes/default/24/yawn.png pidgin/pixmaps/emotes/small/16/love.png pidgin/pixmaps/emotes/small/16/smile-big.png pidgin/pixmaps/emotes/small/16/yawn.png
diffstat 6 files changed, 121 insertions(+), 86 deletions(-) [+]
line wrap: on
line diff
--- a/doc/funniest_home_convos.txt	Mon Nov 17 08:04:36 2008 +0000
+++ b/doc/funniest_home_convos.txt	Mon Nov 17 19:09:53 2008 +0000
@@ -556,3 +556,12 @@
 (16:58:10) elb: I just spent literally a couple of HOURS trying to
            debug a problem where I was using g_list_delete_link with a
            list item which wasn't in the list
+
+--
+
+22:35 <user> hi I know this might sound like a stupid question and I am NOT
+             trolling..
+22:36 <user> but when I go to some channels like anime ones people lol at me
+             for using pidgen
+22:36 <user> why do they think this is a bad client? does it have history?
+
--- a/libpurple/protocols/jabber/jabber.c	Mon Nov 17 08:04:36 2008 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Mon Nov 17 19:09:53 2008 +0000
@@ -1729,7 +1729,7 @@
 	types = g_list_prepend(types, type);
 
 	type = purple_status_type_new_with_attrs(PURPLE_STATUS_TUNE,
-			"tune", NULL, TRUE, TRUE, TRUE,
+			"tune", NULL, FALSE, TRUE, TRUE,
 			PURPLE_TUNE_ARTIST, _("Tune Artist"), purple_value_new(PURPLE_TYPE_STRING),
 			PURPLE_TUNE_TITLE, _("Tune Title"), purple_value_new(PURPLE_TYPE_STRING),
 			PURPLE_TUNE_ALBUM, _("Tune Album"), purple_value_new(PURPLE_TYPE_STRING),
--- a/libpurple/protocols/msn/msn.c	Mon Nov 17 08:04:36 2008 +0000
+++ b/libpurple/protocols/msn/msn.c	Mon Nov 17 19:09:53 2008 +0000
@@ -836,7 +836,7 @@
 	types = g_list_append(types, status);
 
 	status = purple_status_type_new_with_attrs(PURPLE_STATUS_TUNE,
-			"tune", NULL, TRUE, TRUE, TRUE,
+			"tune", NULL, FALSE, TRUE, TRUE,
 			PURPLE_TUNE_ARTIST, _("Artist"), purple_value_new(PURPLE_TYPE_STRING),
 			PURPLE_TUNE_ALBUM, _("Album"), purple_value_new(PURPLE_TYPE_STRING),
 			PURPLE_TUNE_TITLE, _("Title"), purple_value_new(PURPLE_TYPE_STRING),
--- a/libpurple/protocols/myspace/myspace.c	Mon Nov 17 08:04:36 2008 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Mon Nov 17 19:09:53 2008 +0000
@@ -139,7 +139,7 @@
 	prim,   /* PurpleStatusPrimitive */                         \
 	NULL,   /* id - use default */                              \
 	NULL,   /* name - use default */                            \
-	TRUE,   /* savable */                                       \
+	TRUE,   /* saveable */                                      \
 	TRUE,   /* user_settable */                                 \
 	FALSE,  /* not independent */                               \
 	                                                            \
@@ -163,7 +163,7 @@
 			PURPLE_STATUS_TUNE,	/* primitive */
 			"tune",                 /* ID */
 			NULL,                   /* name - use default */
-			TRUE,                   /* savable */
+			FALSE,                  /* saveable */
 			TRUE,                   /* should be user_settable some day */
 			TRUE,                   /* independent */
 
--- a/pidgin/gtkblist.c	Mon Nov 17 08:04:36 2008 +0000
+++ b/pidgin/gtkblist.c	Mon Nov 17 19:09:53 2008 +0000
@@ -2979,6 +2979,22 @@
 	pidgin_tooltip_destroy();
 }
 
+static void
+pidgin_blist_align_tooltip(struct tooltip_data *td, GtkWidget *widget) 
+{ 
+	GtkTextDirection dir = gtk_widget_get_direction(widget); 
+
+	if (dir == GTK_TEXT_DIR_RTL) 
+	{
+		char* layout_name = purple_markup_strip_html(pango_layout_get_text(td->name_layout));
+		PangoDirection dir = pango_find_base_dir(layout_name, -1);
+		if (dir == PANGO_DIRECTION_RTL || dir == PANGO_DIRECTION_NEUTRAL)
+			pango_layout_set_alignment(td->name_layout, PANGO_ALIGN_RIGHT); 
+		g_free(layout_name);
+		pango_layout_set_alignment(td->layout, PANGO_ALIGN_RIGHT); 
+	}
+}
+
 static gboolean
 pidgin_blist_create_tooltip_for_node(GtkWidget *widget, gpointer data, int *w, int *h)
 {
@@ -2998,11 +3014,13 @@
 	if (PURPLE_BLIST_NODE_IS_CHAT(node) ||
 	   PURPLE_BLIST_NODE_IS_BUDDY(node)) {
 		struct tooltip_data *td = create_tip_for_node(node, TRUE);
+		pidgin_blist_align_tooltip(td, gtkblist->tipwindow);
 		gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td);
 	} else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
 		PurpleGroup *group = (PurpleGroup*)node;
 		GSList *accounts;
 		struct tooltip_data *td = create_tip_for_node(node, TRUE);
+		pidgin_blist_align_tooltip(td, gtkblist->tipwindow);
 		gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td);
 
 		/* Accounts with buddies in group */
@@ -3022,6 +3040,7 @@
 		{
 			if(PURPLE_BLIST_NODE_IS_BUDDY(child) && buddy_is_displayable((PurpleBuddy*)child)) {
 				struct tooltip_data *td = create_tip_for_node(child, (b == (PurpleBuddy*)child));
+				pidgin_blist_align_tooltip(td, gtkblist->tipwindow);
 				if (b == (PurpleBuddy *)child) {
 					gtkblist->tooltipdata = g_list_prepend(gtkblist->tooltipdata, td);
 				} else {
--- a/pidgin/pidginstock.c	Mon Nov 17 08:04:36 2008 +0000
+++ b/pidgin/pidginstock.c	Mon Nov 17 19:09:53 2008 +0000
@@ -206,69 +206,64 @@
 	{ PIDGIN_STOCK_TRAY_EMAIL, "tray", "tray-message.png", FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, NULL  }
 };
 
+static void
+add_sized_icon_common(GtkIconSet *iconset, GtkIconSize sizeid, const char *dir,
+	       gboolean rtl, const char *size, const char *file,
+		   gboolean translucent);
+
+static gchar *
+find_file_common(const char *name)
+{
+	gchar *filename;
+#if GLIB_CHECK_VERSION(2,6,0)
+	const gchar *userdir;
+	const gchar * const *sysdirs;
+
+	userdir = g_get_user_data_dir();
+	filename = g_build_filename(userdir, name, NULL);
+	if (g_file_test(filename, G_FILE_TEST_EXISTS))
+		return filename;
+	g_free(filename);
+
+	sysdirs = g_get_system_data_dirs();
+	for (; *sysdirs; sysdirs++) {
+		filename = g_build_filename(*sysdirs, name, NULL);
+		if (g_file_test(filename, G_FILE_TEST_EXISTS))
+			return filename;
+		g_free(filename);
+	}
+#endif
+	filename = g_build_filename(DATADIR, name, NULL);
+	if (g_file_test(filename, G_FILE_TEST_EXISTS))
+		return filename;
+	g_free(filename);
+	return NULL;
+}
+
 static gchar *
 find_file(const char *dir, const char *base)
 {
 	char *filename;
+	char *ret;
 
 	if (base == NULL)
 		return NULL;
 
 	if (!strcmp(dir, "pidgin"))
-		filename = g_build_filename(DATADIR, "pixmaps", "pidgin", base, NULL);
+		filename = g_build_filename("pixmaps", "pidgin", base, NULL);
 	else
-	{
-		filename = g_build_filename(DATADIR, "pixmaps", "pidgin", dir,
-									base, NULL);
-	}
+		filename = g_build_filename("pixmaps", "pidgin", dir, base, NULL);
 
-	return filename;
+	ret = find_file_common(filename);
+	g_free(filename);
+	return ret;
 }
 
 static void
-add_sized_icon(GtkIconSet *iconset, GtkIconSize sizeid, const char *dir, 
+add_sized_icon(GtkIconSet *iconset, GtkIconSize sizeid, const char *dir,
 	       gboolean rtl, const char *size, const char *file)
 {
-	char *filename;
-	GtkIconSource *source;	
-
-	filename = g_build_filename(DATADIR, "pixmaps", "pidgin", dir, size, file, NULL);
-	source = gtk_icon_source_new();
-        gtk_icon_source_set_filename(source, filename);
-	gtk_icon_source_set_direction(source, GTK_TEXT_DIR_LTR);
-        gtk_icon_source_set_direction_wildcarded(source, !rtl);
-	gtk_icon_source_set_size(source, sizeid);
-        gtk_icon_source_set_size_wildcarded(source, FALSE);
-        gtk_icon_source_set_state_wildcarded(source, TRUE);
-        gtk_icon_set_add_source(iconset, source);
-	gtk_icon_source_free(source);
-
-	if (sizeid == gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)) {
-		source = gtk_icon_source_new();
-	        gtk_icon_source_set_filename(source, filename);
-        	gtk_icon_source_set_direction_wildcarded(source, TRUE);
-	        gtk_icon_source_set_size(source, GTK_ICON_SIZE_MENU);
-	        gtk_icon_source_set_size_wildcarded(source, FALSE);
-        	gtk_icon_source_set_state_wildcarded(source, TRUE);
-	        gtk_icon_set_add_source(iconset, source);
-	        gtk_icon_source_free(source);
-	}
-        g_free(filename);
-
-       if (rtl) {
-		filename = g_build_filename(DATADIR, "pixmaps", "pidgin", dir, size, "rtl", file, NULL);
-                source = gtk_icon_source_new();
-                gtk_icon_source_set_filename(source, filename);
-                gtk_icon_source_set_direction(source, GTK_TEXT_DIR_RTL);
-                gtk_icon_source_set_size(source, sizeid);
-                gtk_icon_source_set_size_wildcarded(source, FALSE);
-                gtk_icon_source_set_state_wildcarded(source, TRUE);
-                gtk_icon_set_add_source(iconset, source);
-		g_free(filename);
-		gtk_icon_source_free(source);
-        }
-
-
+	add_sized_icon_common(iconset, sizeid, dir, rtl, size, file, FALSE);
 }
 
 /* Altered from do_colorshift in gnome-panel */
@@ -307,64 +302,77 @@
         }
 }
 
-/* TODO: This is almost certainly not the best way to do this, but it's late, I'm tired,
- * we're a few hours from getting this thing out, and copy/paste is EASY.
- */
 static void
 add_translucent_sized_icon(GtkIconSet *iconset, GtkIconSize sizeid, const char *dir,
 	       gboolean rtl, const char *size, const char *file)
 {
-	char *filename;
-	GtkIconSource *source;	
+	add_sized_icon_common(iconset, sizeid, dir, rtl, size, file, TRUE);
+}
+
+static void
+add_sized_icon_common(GtkIconSet *iconset, GtkIconSize sizeid, const char *dir,
+	       gboolean rtl, const char *size, const char *file,
+		   gboolean translucent)
+{
+	char *filename, *subpath;
+	GtkIconSource *source;
 	GdkPixbuf *pixbuf;
 
-	filename = g_build_filename(DATADIR, "pixmaps", "pidgin", dir, size, file, NULL);
+	subpath = g_build_filename("pixmaps", "pidgin", dir, size, file, NULL);
+	filename = find_file_common(subpath);
+	g_free(subpath);
+	if (!filename)
+		return;
+
 	pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
-	do_alphashift(pixbuf, pixbuf);
+	if (translucent)
+		do_alphashift(pixbuf, pixbuf);
 
 	source = gtk_icon_source_new();
-        gtk_icon_source_set_pixbuf(source, pixbuf);
+	gtk_icon_source_set_pixbuf(source, pixbuf);
 	gtk_icon_source_set_direction(source, GTK_TEXT_DIR_LTR);
-        gtk_icon_source_set_direction_wildcarded(source, !rtl);
+	gtk_icon_source_set_direction_wildcarded(source, !rtl);
 	gtk_icon_source_set_size(source, sizeid);
-        gtk_icon_source_set_size_wildcarded(source, FALSE);
-        gtk_icon_source_set_state_wildcarded(source, TRUE);
-        gtk_icon_set_add_source(iconset, source);
+	gtk_icon_source_set_size_wildcarded(source, FALSE);
+	gtk_icon_source_set_state_wildcarded(source, TRUE);
+	gtk_icon_set_add_source(iconset, source);
 	gtk_icon_source_free(source);
 
 	if (sizeid == gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)) {
 		source = gtk_icon_source_new();
-	        gtk_icon_source_set_pixbuf(source, pixbuf);
-        	gtk_icon_source_set_direction_wildcarded(source, TRUE);
-	        gtk_icon_source_set_size(source, GTK_ICON_SIZE_MENU);
-	        gtk_icon_source_set_size_wildcarded(source, FALSE);
-        	gtk_icon_source_set_state_wildcarded(source, TRUE);
-	        gtk_icon_set_add_source(iconset, source);
-	        gtk_icon_source_free(source);
+		gtk_icon_source_set_pixbuf(source, pixbuf);
+		gtk_icon_source_set_direction_wildcarded(source, TRUE);
+		gtk_icon_source_set_size(source, GTK_ICON_SIZE_MENU);
+		gtk_icon_source_set_size_wildcarded(source, FALSE);
+		gtk_icon_source_set_state_wildcarded(source, TRUE);
+		gtk_icon_set_add_source(iconset, source);
+		gtk_icon_source_free(source);
 	}
-        g_free(filename);
+	g_free(filename);
 	g_object_unref(pixbuf);
 
-       if (rtl) {
-		filename = g_build_filename(DATADIR, "pixmaps", "pidgin", dir, size, "rtl", file, NULL);
- 		pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
-		do_alphashift(pixbuf, pixbuf);
+	if (rtl) {
+		subpath = g_build_filename("pixmaps", "pidgin", dir, size, "rtl", file, NULL);
+		filename = find_file_common(subpath);
+		g_free(subpath);
+		if (!filename)
+			return;
+		pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
+		if (translucent)
+			do_alphashift(pixbuf, pixbuf);
 		source = gtk_icon_source_new();
-                gtk_icon_source_set_pixbuf(source, pixbuf);
-                gtk_icon_source_set_direction(source, GTK_TEXT_DIR_RTL);
-                gtk_icon_source_set_size(source, sizeid);
-                gtk_icon_source_set_size_wildcarded(source, FALSE);
-                gtk_icon_source_set_state_wildcarded(source, TRUE);
-                gtk_icon_set_add_source(iconset, source);
+		gtk_icon_source_set_pixbuf(source, pixbuf);
+		gtk_icon_source_set_direction(source, GTK_TEXT_DIR_RTL);
+		gtk_icon_source_set_size(source, sizeid);
+		gtk_icon_source_set_size_wildcarded(source, FALSE);
+		gtk_icon_source_set_state_wildcarded(source, TRUE);
+		gtk_icon_set_add_source(iconset, source);
 		g_free(filename);
 		g_object_unref(pixbuf);
 		gtk_icon_source_free(source);
-        }
-
-
+	}
 }
 
-
 void
 pidgin_stock_init(void)
 {
@@ -413,7 +421,6 @@
 			gtk_icon_source_set_size_wildcarded(source, TRUE);
 			gtk_icon_source_set_state_wildcarded(source, TRUE);
 
-
 			iconset = gtk_icon_set_new();
 			gtk_icon_set_add_source(iconset, source);