changeset 10118:ab8e8069b71e

[gaim-migrate @ 11155] Another pref bites the dust. Dim Idle Buddies removed, defaulted to "Yes." A bit of logic added to make the color adjust itself to GTK themes. I declared the color string outside of dim_grey(), so that it could be changed by other functions. If anyone wants to make it change for theme changes or even focus changes, I'll accept patches. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Tue, 19 Oct 2004 00:04:59 +0000
parents d520ab74fe8f
children 2a2cd2a6f7cf
files src/gtkblist.c src/gtkprefs.c
diffstat 2 files changed, 42 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkblist.c	Mon Oct 18 21:04:29 2004 +0000
+++ b/src/gtkblist.c	Tue Oct 19 00:04:59 2004 +0000
@@ -439,6 +439,21 @@
 /**************** END WEIRD DROP SHADOW STUFF ***********************************/
 #endif
 
+static char dim_grey_string[8] = "";
+static char *dim_grey() 
+{
+	if (!gtkblist)
+		return "dim grey";
+	if (!dim_grey_string[0]) {
+		GtkStyle *style = gtk_widget_get_style(gtkblist->treeview);
+		snprintf(dim_grey_string, sizeof(dim_grey_string), "#%02x%02x%02x",
+			 style->text_aa[GTK_STATE_NORMAL].red >> 8,
+			 style->text_aa[GTK_STATE_NORMAL].green >> 8,
+			 style->text_aa[GTK_STATE_NORMAL].blue >> 8);
+	}
+	return dim_grey_string;
+}
+		
 /***************************************************
  *              Callbacks                          *
  ***************************************************/
@@ -2690,8 +2705,7 @@
 
 		if (!GAIM_BUDDY_IS_ONLINE(buddy))
 			gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
-		else if (gaim_presence_is_idle(presence) &&
-				 gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies"))
+		else if (gaim_presence_is_idle(presence))
 		{
 			gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.25, FALSE);
 		}
@@ -2732,8 +2746,7 @@
 		if (!GAIM_BUDDY_IS_ONLINE(b))
 			gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.0, FALSE);
 
-		if (gaim_presence_is_idle(presence) &&
-			gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies"))
+		if (gaim_presence_is_idle(presence))
 		{
 			gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.25, FALSE);
 		}
@@ -2778,15 +2791,10 @@
 
 	if (!gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")) {
 
-		if ((gaim_presence_is_idle(presence) && !selected &&
-			 gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies")) ||
-			!GAIM_BUDDY_IS_ONLINE(b))
+		if ((gaim_presence_is_idle(presence) || !GAIM_BUDDY_IS_ONLINE(b)) && !selected)
 		{
-			if (selected)
-				text = g_strdup(esc);
-			else
-				text = g_strdup_printf("<span color='dim grey'>%s</span>",
-									   esc);
+			text = g_strdup_printf("<span color='%s'>%s</span>",
+					       dim_grey(), esc);
 			g_free(esc);
 			return text;
 		}
@@ -2869,12 +2877,10 @@
 	if(!GAIM_BUDDY_IS_ONLINE(b) && !statustext)
 		statustext = g_strdup(_("Offline "));
 
-	if (gaim_presence_is_idle(presence) && !selected &&
-		gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies")) {
-
-		text =  g_strdup_printf("<span color='dim grey'>%s</span>\n"
-					"<span color='dim grey' size='smaller'>%s%s%s</span>",
-					esc,
+	if (gaim_presence_is_idle(presence) && !selected) {
+		text =  g_strdup_printf("<span color='%s'>%s</span>\n"
+					"<span color='%s' size='smaller'>%s%s%s</span>",
+					dim_grey(), esc, dim_grey(),
 					statustext != NULL ? statustext : "",
 					idletime != NULL ? idletime : "",
 					warning != NULL ? warning : "");
@@ -2882,12 +2888,19 @@
 			GAIM_BUDDY_IS_ONLINE(b)) {
 		text = g_strdup(esc);
 	} else {
-		text = g_strdup_printf("%s\n"
-					"<span %s size='smaller'>%s%s%s</span>", esc,
-					selected ? "" : "color='dim grey'",
-					statustext != NULL ? statustext :  "",
-					idletime != NULL ? idletime : "",
-					warning != NULL ? warning : "");
+		if (selected)
+			text = g_strdup_printf("%s\n"
+					       "<span size='smaller'>%s%s%s</span>", esc,
+					       statustext != NULL ? statustext :  "",
+					       idletime != NULL ? idletime : "",
+					       warning != NULL ? warning : "");
+		else
+			text = g_strdup_printf("%s\n"
+					       "<span color='%s' size='smaller'>%s%s%s</span>", esc,
+					       dim_grey(), 
+					       statustext != NULL ? statustext :  "",
+					       idletime != NULL ? idletime : "",
+					       warning != NULL ? warning : "");
 	}
 	if (idletime)
 		g_free(idletime);
@@ -3268,8 +3281,6 @@
 	handle = gaim_gtk_blist_get_handle();
 
 	/* things that affect how buddies are displayed */
-	gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/grey_idle_buddies",
-			_prefs_change_redo_list, NULL);
 	gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_buddy_icons",
 			_prefs_change_redo_list, NULL);
 	gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_warning_level",
@@ -3578,19 +3589,18 @@
 	if (warning_level > 0)
 		warning = g_strdup_printf("%d%%", warning_level);
 
-	if (gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies") &&
-		gaim_presence_is_idle(presence))
+	if (gaim_presence_is_idle(presence))
 	{
 		if (warning && !selected) {
-			char *w2 = g_strdup_printf("<span color='dim grey'>%s</span>",
-					warning);
+			char *w2 = g_strdup_printf("<span color='%s'>%s</span>",
+						   dim_grey(), warning);
 			g_free(warning);
 			warning = w2;
 		}
 
 		if (idle && !selected) {
-			char *i2 = g_strdup_printf("<span color='dim grey'>%s</span>",
-									   idle);
+			char *i2 = g_strdup_printf("<span color='%s'>%s</span>",
+						   dim_grey(), idle);
 			g_free(idle);
 			idle = i2;
 		}
@@ -4527,7 +4537,6 @@
 	/* Initialize prefs */
 	gaim_prefs_add_none("/gaim/gtk/blist");
 	gaim_prefs_add_bool("/gaim/gtk/blist/auto_expand_contacts", TRUE);
-	gaim_prefs_add_bool("/gaim/gtk/blist/grey_idle_buddies", TRUE);
 	gaim_prefs_add_bool("/gaim/gtk/blist/raise_on_events", FALSE);
 	gaim_prefs_add_bool("/gaim/gtk/blist/show_buddy_icons", TRUE);
 	gaim_prefs_add_bool("/gaim/gtk/blist/show_empty_groups", FALSE);
--- a/src/gtkprefs.c	Mon Oct 18 21:04:29 2004 +0000
+++ b/src/gtkprefs.c	Tue Oct 19 00:04:59 2004 +0000
@@ -917,8 +917,6 @@
 			"/gaim/gtk/blist/show_warning_level", vbox);
 	gaim_gtk_prefs_checkbox(_("Show idle _times"),
 			"/gaim/gtk/blist/show_idle_time", vbox);
-	gaim_gtk_prefs_checkbox(_("Dim i_dle buddies"),
-			"/gaim/gtk/blist/grey_idle_buddies", vbox);
 	gaim_gtk_prefs_checkbox(_("_Automatically expand contacts"),
 			"/gaim/gtk/blist/auto_expand_contacts", vbox);