diff console/libgnt/gntmain.c @ 13885:582aaa4e287e

[gaim-migrate @ 16365] Add ui for conversation. It 'works', but it's broken. So don't use it just yet. I probably will not be able to touch it in the next couple of days. So feel free to fix the brokenness :) committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 28 Jun 2006 05:52:23 +0000
parents 0d0ab1e39d0a
children 9d66969a2e32
line wrap: on
line diff
--- a/console/libgnt/gntmain.c	Wed Jun 28 01:46:41 2006 +0000
+++ b/console/libgnt/gntmain.c	Wed Jun 28 05:52:23 2006 +0000
@@ -49,7 +49,6 @@
 	if (focus_list)
 	{
 		gboolean ret = FALSE;
-		/*g_signal_emit_by_name(focus_list->data, "key_pressed", buffer, &ret);*/
 		ret = gnt_widget_key_pressed(focus_list->data, buffer);
 	}
 
@@ -57,22 +56,35 @@
 	{
 		/* Some special key has been pressed */
 		if (strcmp(buffer+1, GNT_KEY_POPUP) == 0)
-		{
-			/*printf("popup\n");*/
-		}
-		else
+		{}
+		else if (strcmp(buffer + 1, "c") == 0)
 		{
-			/*printf("Unknown: %s\n", buffer+1);*/
+			/* Alt + c was pressed. I am going to use it to close a window. */
+			if (focus_list)
+			{
+				gnt_widget_destroy(focus_list->data);
+				gnt_screen_remove_widget(focus_list->data);
+			}
 		}
-	}
-	else
-	{
-		if (buffer[0] == 'q')
+		else if (strcmp(buffer + 1, "q") == 0)
 		{
+			/* I am going to use Alt + q to quit. */
 			endwin();
 			exit(1);
 		}
-		/*printf("%s\n", buffer);*/
+		else if (strcmp(buffer + 1, "n") == 0)
+		{
+			/* Alt + n to go to the next window */
+			if (focus_list && focus_list->next)
+				focus_list = focus_list->next;
+			else
+				focus_list = g_list_first(focus_list);
+			if (focus_list)
+			{
+				/* XXX: Need a way to bring it on top */
+				gnt_widget_draw(focus_list->data);
+			}
+		}
 	}
 	refresh();
 
@@ -184,7 +196,7 @@
 	WINDOW *win;
 	GList *iter;
 	GntNode *node = g_hash_table_lookup(nodes, widget);
-	if (node == NULL || node->below == NULL)	/* Yay! Nothing to do. */
+	if (node == NULL)	/* Yay! Nothing to do. */
 		return;
 
 	win = dupwin(widget->window);
@@ -212,6 +224,12 @@
 		n->above = g_list_remove(n->above, node);
 	}
 
+	for (iter = node->above; iter; iter = iter->next)
+	{
+		GntNode *n = iter->data;
+		n->below = g_list_remove(n->below, node);
+	}
+
 	wrefresh(win);
 	delwin(win);