pidgin: d33b4d42: A patch from db42 to fix right-to-left t...
rlaager at pidgin.im
rlaager at pidgin.im
Mon Nov 17 14:15:36 EST 2008
-----------------------------------------------------------------
Revision: d33b4d42bee23e1d64289f3e7c83b182ef0e5a91
Ancestor: a9579fef71ff6820f390a986132d30b079f590a0
Author: rlaager at pidgin.im
Date: 2008-11-17T19:09:37
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/d33b4d42bee23e1d64289f3e7c83b182ef0e5a91
Modified files:
pidgin/gtkblist.c
ChangeLog:
A patch from db42 to fix right-to-left text in tooltips.
Fixes #1977
-------------- next part --------------
============================================================
--- pidgin/gtkblist.c cede637a952d43e945aa9ce507c9972fcbfe69f9
+++ pidgin/gtkblist.c 031e200e2e9534d8053c775c13843e2f5c3ae591
@@ -2979,6 +2979,22 @@ void pidgin_blist_tooltip_destroy()
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 @@ pidgin_blist_create_tooltip_for_node(Gtk
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 @@ pidgin_blist_create_tooltip_for_node(Gtk
{
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 {
More information about the Commits
mailing list