changeset 1587:69a004b5820a

[gaim-migrate @ 1597] requested keybindings, and also handle nick format changes better committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 16 Mar 2001 07:30:14 +0000
parents bb97d3e8a54d
children 2a3cac07e69d
files src/conversation.c src/gaim.h src/server.c
diffstat 3 files changed, 49 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Fri Mar 16 02:59:54 2001 +0000
+++ b/src/conversation.c	Fri Mar 16 07:30:14 2001 +0000
@@ -644,10 +644,33 @@
 				gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
 			}
 		}
+		if (display_options & OPT_DISP_ONE_WINDOW) {
+			if (event->keyval == GDK_Left) {
+				gtk_notebook_prev_page(GTK_NOTEBOOK(convo_notebook));
+				gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
+			} else if (event->keyval == GDK_Right) {
+				gtk_notebook_next_page(GTK_NOTEBOOK(convo_notebook));
+				gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
+			} else if (event->keyval == GDK_Tab) {
+				GList *cnv = conversations;
+				struct conversation *c;
+				while (cnv) {
+					c = cnv->data;
+					if (c->unseen)
+						break;
+					cnv = cnv->next;
+					c = NULL;
+				}
+				if (c) {
+					gtk_notebook_set_page(GTK_NOTEBOOK(convo_notebook),
+							g_list_index(conversations, c));
+				}
+				gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
+			}
+		}
 	}
 
 	return TRUE;
-
 }
 
 
@@ -1403,13 +1426,13 @@
 		if (!GTK_WIDGET_REALIZED(label))
 			gtk_widget_realize(label);
 		gdk_font_unref(style->font);
-		style->font = label->style->font;
-		gdk_font_ref(style->font);
+		style->font = gdk_font_ref(label->style->font);
 		style->fg[0].red = 0xcccc;
 		style->fg[0].green = 0x0000;
 		style->fg[0].blue = 0x0000;
 		gtk_widget_set_style(label, style);
 		gtk_style_unref(style);
+		c->unseen = TRUE;
 	}
 
 	g_free(smiley);
@@ -1815,10 +1838,10 @@
 		return;
 	style = gtk_style_new();
 	gdk_font_unref(style->font);
-	style->font = label->style->font;
-	gdk_font_ref(style->font);
+	style->font = gdk_font_ref(label->style->font);
 	gtk_widget_set_style(label, style);
 	gtk_style_unref(style);
+	c->unseen = FALSE;
 }
 
 
@@ -2169,3 +2192,10 @@
 		conversations = m;
 	}
 }
+
+void set_convo_tab_label(struct conversation *c, char *text)
+{
+	gtk_label_set_text(GTK_LABEL(gtk_notebook_get_tab_label(GTK_NOTEBOOK(convo_notebook),
+					gtk_notebook_get_nth_page(GTK_NOTEBOOK(convo_notebook),
+						g_list_index(conversations, c)))), text);
+}
--- a/src/gaim.h	Fri Mar 16 02:59:54 2001 +0000
+++ b/src/gaim.h	Fri Mar 16 07:30:14 2001 +0000
@@ -352,6 +352,7 @@
 	GtkWidget *sep2;
  	time_t sent_away;
 	GtkWidget *menu;
+	gboolean unseen;
 
 	/* stuff used just for chat */
         GList *in_room;
--- a/src/server.c	Fri Mar 16 02:59:54 2001 +0000
+++ b/src/server.c	Fri Mar 16 07:30:14 2001 +0000
@@ -445,15 +445,19 @@
 		while (cnv) {
 			cv = (struct conversation *)cnv->data;
 			if (!strcasecmp(who, normalize(cv->name))) {
-				g_snprintf(cv->name, sizeof(cv->name), "%s", name);
-				if (find_log_info(name) || (logging_options & OPT_LOG_ALL))
-					 g_snprintf(who, 63, LOG_CONVERSATION_TITLE, name);
-				else
-					g_snprintf(who, 63, CONVERSATION_TITLE, name);
-				gtk_window_set_title(GTK_WINDOW(cv->window), who);
-				/* was g_free(buf), but break gives us that
-				 * and freeing twice is not good --Sumner */
-				break;
+				if (display_options & OPT_DISP_ONE_WINDOW) {
+					set_convo_tab_label(cv, b->name);
+				} else {
+					g_snprintf(cv->name, sizeof(cv->name), "%s", name);
+					if (find_log_info(name) || (logging_options & OPT_LOG_ALL))
+						 g_snprintf(who, 63, LOG_CONVERSATION_TITLE, name);
+					else
+						g_snprintf(who, 63, CONVERSATION_TITLE, name);
+						gtk_window_set_title(GTK_WINDOW(cv->window), who);
+					/* was g_free(buf), but break gives us that
+					 * and freeing twice is not good --Sumner */
+					break;
+				}
 			}
 			cnv = cnv->next;
 		}