changeset 12188:762bb28154bf

[gaim-migrate @ 14490] Correctly handle 'Show timestamps' as a global preference that is only settable from the 'Options' menu in conversations committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 22 Nov 2005 05:21:42 +0000
parents c4c612b8a648
children 2de8b6772d00
files src/gtkconv.c src/gtkconv.h src/gtkprefs.c
diffstat 3 files changed, 37 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkconv.c	Tue Nov 22 04:49:33 2005 +0000
+++ b/src/gtkconv.c	Tue Nov 22 05:21:42 2005 +0000
@@ -1297,9 +1297,7 @@
 
 	gtkconv = GAIM_GTK_CONVERSATION(conv);
 
-	gtkconv->show_timestamps =
-		gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
-	gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),
+	gaim_prefs_set_bool("/gaim/gtk/conversations/show_timestamps",
 		gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)));
 }
 
@@ -4022,8 +4020,8 @@
 	else
 		gtk_widget_hide(gtkconv->toolbar);
 
-	gtkconv->show_timestamps = TRUE;
-	gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), TRUE);
+	gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),
+		gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps"));
 	gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml),
 								 gaim_account_get_protocol_name(conv->account));
 
@@ -4037,7 +4035,7 @@
 			gaim_gtk_conv_window_add_gtkconv(hidden_convwin, gtkconv);
 			return;
 		}
- 
+
 		/* put conv in hidden_convwin if hide_new pref is away and account is away */
 		if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "away")==0
 				&& gaim_status_type_get_primitive(
@@ -5547,6 +5545,34 @@
 }
 
 static void
+show_timestamps_pref_cb(const char *name, GaimPrefType type,
+								gpointer value, gpointer data)
+{
+	GList *l;
+	GaimConversation *conv;
+	GaimGtkConversation *gtkconv;
+	GaimGtkWindow *win;
+
+	for (l = gaim_get_conversations(); l != NULL; l = l->next)
+	{
+		conv = (GaimConversation *)l->data;
+
+		if (!GAIM_IS_GTK_CONVERSATION(conv))
+			continue;
+
+		gtkconv = GAIM_GTK_CONVERSATION(conv);
+		win     = gtkconv->win;
+
+		gtk_check_menu_item_set_active(
+		        GTK_CHECK_MENU_ITEM(win->menu.show_timestamps),
+		        (gboolean)GPOINTER_TO_INT(value));
+
+		gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),
+			(gboolean)GPOINTER_TO_INT(value));
+	}
+}
+
+static void
 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type,
 								gpointer value, gpointer data)
 {
@@ -5747,6 +5773,7 @@
 	gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE);
 	gaim_prefs_add_bool("/gaim/gtk/conversations/show_incoming_formatting", TRUE);
 
+	gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", FALSE);
 	gaim_prefs_add_bool("/gaim/gtk/conversations/show_formatting_toolbar", TRUE);
 	gaim_prefs_add_bool("/gaim/gtk/conversations/passthrough_unknown_commands", FALSE);
 
@@ -5792,6 +5819,8 @@
 	/* Connect callbacks. */
 	gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/close_on_tabs",
 								close_on_tabs_pref_cb, NULL);
+	gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/show_timestamps",
+								show_timestamps_pref_cb, NULL);
 	gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/show_formatting_toolbar",
 								show_formatting_toolbar_pref_cb, NULL);
 	gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/spellcheck",
@@ -6523,7 +6552,7 @@
 		g_object_set_data(G_OBJECT(notebook->menu), "clicked_tab", gtkconv);
 		return FALSE;
 	}
-	
+
 	g_object_set_data(G_OBJECT(notebook->menu), "clicked_tab", gtkconv);
 
 	menu = notebook->menu;
@@ -6594,7 +6623,7 @@
 	                               gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar"));
 
 	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_timestamps),
-	                               gtkconv->show_timestamps);
+	                               gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps"));
 
 	if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
 		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_icon),
--- a/src/gtkconv.h	Tue Nov 22 04:49:33 2005 +0000
+++ b/src/gtkconv.h	Tue Nov 22 05:21:42 2005 +0000
@@ -118,8 +118,6 @@
 	GaimGtkWindow *win;
 
 	gboolean make_sound;
-	gboolean show_formatting_toolbar;
-	gboolean show_timestamps;
 
 	GtkTooltips *tooltips;
 
--- a/src/gtkprefs.c	Tue Nov 22 04:49:33 2005 +0000
+++ b/src/gtkprefs.c	Tue Nov 22 05:21:42 2005 +0000
@@ -1938,7 +1938,6 @@
 	gaim_prefs_remove("/gaim/gtk/conversations/icons_on_tabs");
 	gaim_prefs_remove("/gaim/gtk/conversations/send_formatting");
 	gaim_prefs_remove("/gaim/gtk/conversations/show_smileys");
-	gaim_prefs_remove("/gaim/gtk/conversations/show_timestamps");
 	gaim_prefs_remove("/gaim/gtk/conversations/show_urls_as_links");
 	gaim_prefs_remove("/gaim/gtk/conversations/smiley_shortcuts");
 	gaim_prefs_remove("/gaim/gtk/conversations/use_custom_bgcolor");