changeset 13957:421259b9e06d

[gaim-migrate @ 16508] Use alt+, and alt+. to change the order of the window. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 17 Jul 2006 13:37:08 +0000
parents f61428cc4019
children 6741419af7f7
files console/libgnt/gntmain.c
diffstat 1 files changed, 37 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/console/libgnt/gntmain.c	Mon Jul 17 06:21:53 2006 +0000
+++ b/console/libgnt/gntmain.c	Mon Jul 17 13:37:08 2006 +0000
@@ -275,6 +275,34 @@
 	g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(window_list_activate), NULL);
 }
 
+static void
+shift_window(GntWidget *widget, int dir)
+{
+	GList *all = g_list_first(focus_list);
+	GList *list = g_list_find(all, widget);
+	int length, pos;
+	if (!list)
+		return;
+
+	length = g_list_length(all);
+	pos = g_list_position(all, list);
+
+	pos += dir;
+	if (dir > 0)
+		pos++;
+
+	if (pos < 0)
+		pos = length;
+	else if (pos > length)
+		pos = 0;
+
+	all = g_list_insert(all, widget, pos);
+	all = g_list_delete_link(all, list);
+	if (focus_list == list)
+		focus_list = g_list_find(all, widget);
+	draw_taskbar();
+}
+
 static gboolean
 io_invoke(GIOChannel *source, GIOCondition cond, gpointer null)
 {
@@ -351,6 +379,15 @@
 					/* Resize window */
 					mode = GNT_KP_MODE_RESIZE;
 				}
+				else if (strcmp(buffer + 1, ",") == 0 && focus_list)
+				{
+					/* Re-order the list of windows */
+					shift_window(focus_list->data, -1);
+				}
+				else if (strcmp(buffer + 1, ".") == 0 && focus_list)
+				{
+					shift_window(focus_list->data, 1);
+				}
 			}
 		}
 	}