changeset 10389:c432b927b0b1

[gaim-migrate @ 11616] Cleaned up "use_server_alias" some more and removed the timestamp option. Default: Yes. The timestamp plugin will override this, however; also the timestamp is now centered in the conversation. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Thu, 16 Dec 2004 05:34:34 +0000
parents 088633feb846
children de92a8da82c3
files ChangeLog plugins/timestamp.c src/blist.c src/gtkconv.c src/gtkprefs.c src/prefs.c
diffstat 6 files changed, 36 insertions(+), 89 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Dec 16 03:50:54 2004 +0000
+++ b/ChangeLog	Thu Dec 16 05:34:34 2004 +0000
@@ -45,6 +45,8 @@
 	* Removed "Show alias in tabs/titles," default to "Yes".
 	* Removed "Show formatting toolbars," made the option in the
 	  conversation menu affect the global preference.
+	* Removed "Show timestamps," defaulted to yes but made timestamp plugin
+	  override this.
 
 version 1.0.2 (10/19/2004):
 	Bug Fixes:
--- a/plugins/timestamp.c	Thu Dec 16 03:50:54 2004 +0000
+++ b/plugins/timestamp.c	Thu Dec 16 05:34:34 2004 +0000
@@ -44,7 +44,8 @@
 static gboolean do_timestamp (gpointer data)
 {
 	GaimConversation *c = (GaimConversation *)data;
-	char *buf;
+	GaimGtkConversation *conv = GAIM_GTK_CONVERSATION(c);
+	GtkTextIter iter;
 	char mdate[6];
 	int is_conversation_active;
 	time_t tim = time(NULL);
@@ -56,11 +57,11 @@
 	is_conversation_active = GPOINTER_TO_INT(gaim_conversation_get_data(c, "timestamp-conv-active"));
 	
 	if (is_conversation_active){
+		GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(conv->imhtml));
+		gtk_text_buffer_get_end_iter(buffer, &iter);
 		gaim_conversation_set_data(c, "timestamp-conv-active", GINT_TO_POINTER(FALSE));
 		strftime(mdate, sizeof(mdate), "%H:%M", localtime(&tim));
-		buf = g_strdup_printf("            %s", mdate);
-		gaim_conversation_write(c, NULL, buf, GAIM_MESSAGE_NO_LOG, tim);
-		g_free(buf);
+		gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, mdate, strlen(mdate), "TIMESTAMP", NULL);
 	}
 	else
 		gaim_conversation_set_data(c, "timestamp-enabled", GINT_TO_POINTER(FALSE));
@@ -103,18 +104,25 @@
 
 static void timestamp_new_convo(GaimConversation *conv)
 {
+	GaimGtkConversation *c = GAIM_GTK_CONVERSATION(conv);
+	
 	if (!g_list_find(gaim_get_conversations(), conv))
 		return;
 	
+	gtk_imhtml_show_comments(GTK_IMHTML(c->imhtml), FALSE);
+
 	/*
 	This if statement stops conversations that have already been initialized for timestamps
 	from being reinitialized.  This prevents every active conversation from immediately being spammed
 	with a new timestamp when the user modifies the timer interval.
 	*/
 	if (!gaim_conversation_get_data(conv, "timestamp-initialized")){
+		GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(c->imhtml));
 		gaim_conversation_set_data(conv, "timestamp-initialized", GINT_TO_POINTER(TRUE));
 		gaim_conversation_set_data(conv, "timestamp-enabled", GINT_TO_POINTER(TRUE));
 		gaim_conversation_set_data(conv, "timestamp-conv-active", GINT_TO_POINTER(TRUE));
+		gtk_text_buffer_create_tag (buffer, "TIMESTAMP", "foreground", "#888888", "justification", GTK_JUSTIFY_CENTER, 
+					    "weight", PANGO_WEIGHT_BOLD, NULL);
 		do_timestamp(conv);
 	}
 
@@ -235,6 +243,7 @@
 static gboolean
 plugin_unload(GaimPlugin *plugin)
 {
+	GList *cnvs;
 	void *conv_handle = gaim_conversations_get_handle();
 
 	gaim_signal_disconnect(conv_handle, "conversation-created",
@@ -245,6 +254,13 @@
 					plugin, GAIM_CALLBACK(timestamp_displaying_conv_msg));
 	
 	destroy_timer_list();
+
+	for (cnvs = gaim_get_conversations(); cnvs != NULL; cnvs = cnvs->next) {
+		GaimConversation *c = cnvs->data;
+		GaimGtkConversation *conv = GAIM_GTK_CONVERSATION(c);
+		gtk_imhtml_show_comments(GTK_IMHTML(conv->imhtml), TRUE);
+	}
+
 	return TRUE;
 }
 
--- a/src/blist.c	Thu Dec 16 03:50:54 2004 +0000
+++ b/src/blist.c	Thu Dec 16 05:34:34 2004 +0000
@@ -96,31 +96,6 @@
 	g_free(hb);
 }
 
-static void blist_pref_cb(const char *name, GaimPrefType type, gpointer value, gpointer data)
-{
-	GaimBlistUiOps *ops = gaimbuddylist->ui_ops;
-	GaimBlistNode *gnode, *cnode, *bnode;
-
-	if (!ops || !ops->update)
-		return;
-
-	for (gnode = gaimbuddylist->root; gnode; gnode = gnode->next) {
-		if (!GAIM_BLIST_NODE_IS_GROUP(gnode))
-			continue;
-		for (cnode = gnode->child; cnode; cnode = cnode->next) {
-			if (GAIM_BLIST_NODE_IS_CONTACT(cnode)) {
-				for (bnode = cnode->child; bnode; bnode = bnode->next) {
-					if (!GAIM_BLIST_NODE_IS_BUDDY(bnode))
-						continue;
-					ops->update(gaimbuddylist, bnode);
-				}
-			} else if (GAIM_BLIST_NODE_IS_CHAT(cnode)) {
-				ops->update(gaimbuddylist, cnode);
-			}
-		}
-	}
-}
-
 void gaim_contact_invalidate_priority_buddy(GaimContact *contact)
 {
 	g_return_if_fail(contact != NULL);
@@ -202,9 +177,6 @@
 	if (gbl->ui_ops != NULL && gbl->ui_ops->new_list != NULL)
 		gbl->ui_ops->new_list(gbl);
 
-	gaim_prefs_connect_callback(gaim_blist_get_handle(), "/core/buddies/use_server_alias",
-								blist_pref_cb, NULL);
-
 	return gbl;
 }
 
@@ -1413,8 +1385,7 @@
 	if ((buddy->alias != NULL) && (*buddy->alias != '\0')) {
 		return buddy->alias;
 	} else if ((buddy->server_alias != NULL) &&
-			   (*buddy->server_alias != '\0') &&
-			   (gaim_prefs_get_bool("/core/buddies/use_server_alias"))) {
+		   (*buddy->server_alias != '\0')) {
 
 		return buddy->server_alias;
 	}
@@ -1458,8 +1429,7 @@
 		return buddy->alias;
 
 	/* The server alias, if preferences say so */
-	if ((buddy->server_alias) && (*buddy->server_alias) &&
-			(gaim_prefs_get_bool("/core/buddies/use_server_alias")))
+	if ((buddy->server_alias) && (*buddy->server_alias))
 		return buddy->server_alias;
 
 	/* The buddy's user name (i.e. no alias) */
--- a/src/gtkconv.c	Thu Dec 16 03:50:54 2004 +0000
+++ b/src/gtkconv.c	Thu Dec 16 05:34:34 2004 +0000
@@ -3778,8 +3778,7 @@
 	/* Setup gtkihmtml. */
 	frame = gaim_gtk_create_imhtml(FALSE, &gtkconv->imhtml, NULL);
 	gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml");
-	gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),
-			gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps"));
+	gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), TRUE);
 	gtk_paned_pack1(GTK_PANED(hpaned), frame, TRUE, TRUE);
 	gtk_widget_show(frame);
 
@@ -3967,8 +3966,7 @@
 	/* Setup the gtkimhtml widget */
 	frame = gaim_gtk_create_imhtml(FALSE, &gtkconv->imhtml, NULL);
 	gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml");
-	gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),
-			gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps"));
+	gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),TRUE);
 	gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
 	gtk_widget_show(frame);
 
@@ -4355,11 +4353,8 @@
 		else
 			gtk_widget_hide(gtkconv->toolbar);
 
-		gtkconv->show_timestamps = gaim_prefs_get_bool(
-				"/gaim/gtk/conversations/show_timestamps");
-
-		gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),
-				gtkconv->show_timestamps);
+		gtkconv->show_timestamps = TRUE;
+		gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), TRUE);
 
 		g_signal_connect_swapped(G_OBJECT(pane), "focus",
 								 G_CALLBACK(gtk_widget_grab_focus),
@@ -4717,12 +4712,9 @@
 	}
 
 	if (flags & GAIM_MESSAGE_SYSTEM) {
-		if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps"))
-			g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>",
+		g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>",
 				   mdate, message);
-		else
-			g_snprintf(buf, BUF_LONG, "<B>%s</B>", message);
-
+	
 		g_snprintf(buf2, sizeof(buf2),
 			   "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>",
 			   sml_attrib, mdate, message);
@@ -4734,12 +4726,9 @@
 		conv->history = g_string_append(conv->history, "<BR>\n");
 
 	} else if (flags & GAIM_MESSAGE_ERROR) {
-		if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps"))
-			g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"#ff0000\"><FONT SIZE=\"2\">(%s)</FONT> <B>%s</B></FONT>",
+		g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"#ff0000\"><FONT SIZE=\"2\">(%s)</FONT> <B>%s</B></FONT>",
 				   mdate, message);
-		else
-			g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"#ff0000\"><B>%s</B></FONT>", message);
-
+		
 		g_snprintf(buf2, sizeof(buf2),
 			   "<FONT COLOR=\"#ff0000\"><FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT></FONT>",
 			   sml_attrib, mdate, message);
@@ -4820,17 +4809,11 @@
 			if(who_escaped)
 				g_free(who_escaped);
 		}
-
-		if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps"))
-			g_snprintf(buf, BUF_LONG,
+		g_snprintf(buf, BUF_LONG,
 				   "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\">(%s)</FONT> "
 				   "<B>%s</B></FONT> ", color,
 				   sml_attrib ? sml_attrib : "", mdate, str);
-		else
-			g_snprintf(buf, BUF_LONG,
-				   "<FONT COLOR=\"%s\" %s><B>%s</B></FONT> ", color,
-				   sml_attrib ? sml_attrib : "", str);
-
+		
 		g_snprintf(buf2, BUF_LONG,
 			   "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>"
 			   "<B>%s</B></FONT> ",
@@ -5659,26 +5642,6 @@
 }
 
 static void
-show_timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value,
-						gpointer data)
-{
-	GList *l;
-	GaimConversation *conv;
-	GaimGtkConversation *gtkconv;
-
-	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);
-
-		gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), (gboolean)GPOINTER_TO_INT(value));
-	}
-}
-
-static void
 spellcheck_pref_cb(const char *name, GaimPrefType type, gpointer value,
 				   gpointer data)
 {
@@ -5841,7 +5804,6 @@
 	gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE);
 	gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE);
 	gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE);
-	gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE);
 	gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE);
 #if 1
 	gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_colors", FALSE);
@@ -5883,8 +5845,6 @@
 								escape_closes_pref_cb, NULL);
 	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",
--- a/src/gtkprefs.c	Thu Dec 16 03:50:54 2004 +0000
+++ b/src/gtkprefs.c	Thu Dec 16 05:34:34 2004 +0000
@@ -755,8 +755,6 @@
 	gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
 
 	vbox = gaim_gtk_make_frame (ret, _("Display"));
-	gaim_gtk_prefs_checkbox(_("Show _timestamp on messages"),
-			"/gaim/gtk/conversations/show_timestamps", vbox);
 #ifdef USE_GTKSPELL
 	gaim_gtk_prefs_checkbox(_("_Highlight misspelled words"),
 			"/gaim/gtk/conversations/spellcheck", vbox);
@@ -2354,7 +2352,7 @@
 	gaim_prefs_remove("/gaim/gtk/conversations/chat/old_tab_complete");
 	gaim_prefs_remove("/gaim/gtk/conversations/im/raise_on_events");
 	gaim_prefs_remove("/gaim/gtk/conversations/chat/raise_on_events");
-	gaim_prefs_remove("/core/conversations/use_alias_for_title");
+	gaim_prefs_remove("/gaim/gtk/conversations/show_timestamps");
 	gaim_prefs_remove("/gaim/gtk/sound/signon");
 	gaim_prefs_remove("/gaim/gtk/sound/silent_signon");
 	gaim_prefs_remove("/gaim/gtk/logging/individual_logs");
--- a/src/prefs.c	Thu Dec 16 03:50:54 2004 +0000
+++ b/src/prefs.c	Thu Dec 16 05:34:34 2004 +0000
@@ -1031,4 +1031,5 @@
 	gaim_prefs_remove("/core/conversations/chat/show_join");
 	gaim_prefs_remove("/core/conversations/chat/show_leave");
 	gaim_prefs_remove("/core/conversations/combine_chat_im");
+	gaim_prefs_remove("/core/conversations/use_alias_for_title");
 }