soc.2008.themes: 169a66da: fixed some small font bugs, the coloring...

ffdragon at soc.pidgin.im ffdragon at soc.pidgin.im
Fri Aug 1 13:10:46 EDT 2008


-----------------------------------------------------------------
Revision: 169a66daed0dfbd361f1a1b973233f38f7140096
Ancestor: 665142d25c7f89e22d45ba0980793e5fed08f0dd
Author: ffdragon at soc.pidgin.im
Date: 2008-08-01T17:04:49
Branch: im.pidgin.soc.2008.themes
URL: http://d.pidgin.im/viewmtn/revision/info/169a66daed0dfbd361f1a1b973233f38f7140096

Modified files:
        pidgin/gtkblist-loader.c pidgin/gtkblist.c

ChangeLog: 

fixed some small font bugs, the coloring when selected, and a segfault

-------------- next part --------------
============================================================
--- pidgin/gtkblist-loader.c	27979e25d13452d958fa3913bcb7f7128163826a
+++ pidgin/gtkblist-loader.c	6bf39097d7841d6e26fdd32374c74cbfdaec9f9f
@@ -162,7 +162,7 @@ pidgin_blist_loader_build(const gchar *d
 	}
 	
 	if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "contact_text")) != NULL)) {
-		online->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
+		contact->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
 		if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color))
 			contact->color = g_strdup(temp);
 		else contact->color = g_strdup(DEFAULT_TEXT_COLOR);
============================================================
--- pidgin/gtkblist.c	9b1534eff995fd537e7d856a0b9f6e6c7791720d
+++ pidgin/gtkblist.c	6f33ea8eb2b38c32b7148f5291a5ae76d276afb2
@@ -1797,7 +1797,8 @@ pidgin_blist_show_context_menu(PurpleBli
 	return handled;
 }
 
-static gboolean gtk_blist_button_press_cb(GtkWidget *tv, GdkEventButton *event, gpointer user_data)
+static gboolean 
+gtk_blist_button_press_cb(GtkWidget *tv, GdkEventButton *event, gpointer user_data)
 {
 	GtkTreePath *path;
 	PurpleBlistNode *node;
@@ -3817,7 +3818,7 @@ pidgin_blist_get_name_markup(PurpleBuddy
 		gtkcontactnode = ((PurpleBlistNode*)contact)->ui_data;
 
 	/* Name */
-	if(gtkcontactnode && !gtkcontactnode->contact_expanded && contact->alias)
+	if (gtkcontactnode && !gtkcontactnode->contact_expanded && contact->alias)
 		name = contact->alias;
 	else
 		name = purple_buddy_get_alias(b);
@@ -3959,13 +3960,15 @@ pidgin_blist_get_name_markup(PurpleBuddy
 
 	/* Put it all together */
 	if (biglist && (statustext || idletime)) {
-		text = g_strdup_printf("<span color='%s'>%s</span>\n<span size='smaller' color='%s'>%s%s%s</span>",
-					name_color, nametext, status_color, 
+		/* using <span size='smaller'> breaks the status, so it must be seperated into <small><span>*/
+		text = g_strdup_printf("<span font_desc='%s' foreground='%s'>%s</span>\n"
+				 	"<small><span font_desc='%s' foreground='%s'>%s%s%s</span></small>", 
+					name_font, name_color, nametext, status_font, status_color, 
 					idletime != NULL ? idletime : "",
 				        (idletime != NULL && statustext != NULL) ? " - " : "",
 				        statustext != NULL ? statustext : ""); 
 
-	} else text = g_strdup_printf("<span color='%s'>%s</span>", name_color, nametext); 
+	} else text = g_strdup_printf("<span font_desc='%s' color='%s'>%s</span>", name_font, name_color, nametext); 
 
 	if (hidden_conv) {
 		char *tmp = text;
@@ -6082,7 +6085,7 @@ static char *pidgin_get_group_title(Purp
 	else pair = pidgin_blist_theme_get_collapsed_text_info(theme);
 
 	
-	text_color = (pair == NULL || pair->color == NULL) ? "black" : pair->color;
+	text_color = (selected || pair == NULL || pair->color == NULL) ? "black" : pair->color;
 	text_font = (pair == NULL || pair->font == NULL) ? "" : pair->font;
 
 	esc = g_markup_escape_text(group->name, -1);
@@ -6145,13 +6148,12 @@ static void buddy_node(PurpleBuddy *budd
 			ihrs = (t - idle_secs) / 3600;
 			imin = ((t - idle_secs) / 60) % 60;
 
-			if (selected) textcolor = "dim grey";
-			else if (theme != NULL && (pair = pidgin_blist_theme_get_idle_text_info(theme)) != NULL && pair->color != NULL)
+			if (!selected && theme != NULL && (pair = pidgin_blist_theme_get_idle_text_info(theme)) != NULL && pair->color != NULL)
 				textcolor = pair->color;
 			else textcolor = "black";
 
-			idle = g_strdup_printf("<span color='%s' font_desc='%s'>%d:%02d</span>",
-					   textcolor, (pair == NULL || pair->font == NULL) ? "" : pair->color, ihrs, imin);
+			idle = g_strdup_printf("<span color='%s' font_desc='%s'>%d:%02d</span>", textcolor, 
+					      (pair == NULL || pair->font == NULL) ? "" : pair->color, ihrs, imin);
 		}
 	}
 
@@ -6233,17 +6235,18 @@ static void pidgin_blist_update_contact(
 			gchar *mark;
 			GdkColor *color = NULL;
 			PidginBlistTheme *theme = pidgin_blist_get_theme();
+			gboolean selected = (gtkblist->selected_node == cnode);
 			
 			mark = g_markup_escape_text(purple_contact_get_alias(contact), -1);
 
 			if (theme != NULL) {
 				FontColorPair *pair = pidgin_blist_theme_get_contact_text_info(theme);
 				color = pidgin_blist_theme_get_contact_color(theme);
-				
+
 				if (pair != NULL) {
-					gchar *temp = g_strdup_printf("<span font_desc='%s' foreground='%s'>%s</span>",
-								     (pair->font == NULL) ? "" : pair->font, 
-								     (pair->color == NULL) ? "black" : pair->color, mark);
+					gchar *temp = g_strdup_printf("<span foreground='%s' font_desc='%s'>%s</span>",
+								     (selected || pair->color == NULL || contact) ? "black" : pair->color,
+								     (pair->font == NULL) ? "" : pair->font, mark);
 				
 					g_free(mark);
 					mark = temp;
@@ -6336,6 +6339,7 @@ static void pidgin_blist_update_chat(Pur
 		GdkColor *bgcolor = NULL;
 		FontColorPair *pair;
 		PidginBlistTheme *theme;
+		gboolean selected = (gtkblist->selected_node == node);
 
 		if (!insert_node(list, node, &iter))
 			return;
@@ -6364,15 +6368,13 @@ static void pidgin_blist_update_chat(Pur
 		else if (hidden) 
 			pair = pidgin_blist_theme_get_unread_message_text_info(theme);
 		else pair = pidgin_blist_theme_get_online_text_info(theme); 
-		
+			
 		font = (pair == NULL || pair->font == NULL) ? "" : g_strdup(pair->font);
-		color = (pair == NULL || pair->color == NULL) ? "black" : g_strdup(pair->color);
+		color = (selected || pair == NULL || pair->color == NULL) ? "black" : g_strdup(pair->color);
 
 		tmp = g_strdup_printf("<span font_desc='%s' color='%s' weight='%s'>%s</span>", 
 				      font, color, hidden ? "bold" : "normal", mark);
 
-		g_free(font);
-		g_free(color);
 		g_free(mark);
 		mark = tmp;
 
@@ -6404,6 +6406,7 @@ static void pidgin_blist_update_chat(Pur
 			g_object_unref(avatar);
 		if(prpl_icon)
 			g_object_unref(prpl_icon);
+
 	} else {
 		pidgin_blist_hide_node(list, node, TRUE);
 	}


More information about the Commits mailing list