changeset 5297:d4c9c5491812

[gaim-migrate @ 5669] Deryni turned off the 30 sec timer when idle times aren't being displayed committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 05 May 2003 20:38:49 +0000
parents 72f102ca9982
children 857106f8f971
files src/gtkblist.c src/prefs.c
diffstat 2 files changed, 32 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkblist.c	Sun May 04 23:06:08 2003 +0000
+++ b/src/gtkblist.c	Mon May 05 20:38:49 2003 +0000
@@ -1242,6 +1242,8 @@
 {
 	GaimBlistNode *group, *buddy;
 
+	gaim_debug(GAIM_DEBUG_INFO, "refresh_timer", "called\n");
+
 	for(group = list->root; group; group = group->next) {
 		if(!GAIM_BLIST_NODE_IS_GROUP(group))
 			continue;
@@ -1506,7 +1508,8 @@
 	gaim_gtk_blist_update_toolbar();
 
 	/* start the refresh timer */
-	gtkblist->refresh_timer = g_timeout_add(30000, (GSourceFunc)gaim_gtk_blist_refresh_timer, list);
+	if (blist_options & (OPT_BLIST_SHOW_IDLETIME | OPT_BLIST_SHOW_ICONS))
+		gtkblist->refresh_timer = g_timeout_add(30000, (GSourceFunc)gaim_gtk_blist_refresh_timer, list);
 }
 
 void gaim_gtk_blist_refresh(struct gaim_buddy_list *list)
@@ -1523,6 +1526,25 @@
 	}
 }
 
+void
+gaim_gtk_blist_update_refresh_timeout()
+{
+	struct gaim_buddy_list *blist;
+	struct gaim_gtk_buddy_list *gtkblist;
+
+	gaim_debug(GAIM_DEBUG_INFO, "update_refresh_timeout", "called\n");
+
+	blist = gaim_get_blist();
+	gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
+
+	if (blist_options & (OPT_BLIST_SHOW_IDLETIME | OPT_BLIST_SHOW_ICONS)) {
+		gtkblist->refresh_timer = g_timeout_add(30000, (GSourceFunc)gaim_gtk_blist_refresh_timer, blist);
+	} else {
+		g_source_remove(gtkblist->refresh_timer);
+		gtkblist->refresh_timer = 0;
+	}
+}
+
 static gboolean get_iter_from_node(GaimBlistNode *node, GtkTreeIter *iter) {
 	struct _gaim_gtk_blist_node *gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
 	GtkTreePath *path;
--- a/src/prefs.c	Sun May 04 23:06:08 2003 +0000
+++ b/src/prefs.c	Mon May 05 20:38:49 2003 +0000
@@ -1974,18 +1974,23 @@
 	gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
 
 	blist_options ^= option;
-	
+
 	if (!gtkblist)
 		return;
-	
-	if (option == OPT_BLIST_SHOW_WARN ||
-		 option == OPT_BLIST_SHOW_IDLETIME)
+
+	if (option == OPT_BLIST_SHOW_WARN)
 		gaim_gtk_blist_update_columns();
+	else if (option == OPT_BLIST_SHOW_IDLETIME) {
+		gaim_gtk_blist_update_refresh_timeout();
+		gaim_gtk_blist_update_columns();
+	}
 	else if (option == OPT_BLIST_SHOW_ICONS) {
+		gaim_gtk_blist_update_refresh_timeout();
 		gaim_gtk_blist_refresh(gaim_get_blist());
 		gaim_gtk_blist_update_columns();
 	} else
 		gaim_gtk_blist_refresh(gaim_get_blist());
+
 }
 
 static void set_convo_option(GtkWidget *w, int option)