changeset 18070:2b757aadddc9

add gnt_window_present
author Richard Nelson <wabz@pidgin.im>
date Fri, 08 Jun 2007 12:41:30 +0000
parents 08776fc5c06f
children bb9cd8dfc61c
files finch/libgnt/gnt.h finch/libgnt/gntmain.c finch/libgnt/gntwm.c
diffstat 3 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/gnt.h	Fri Jun 08 10:21:50 2007 +0000
+++ b/finch/libgnt/gnt.h	Fri Jun 08 12:41:30 2007 +0000
@@ -43,6 +43,7 @@
  */
 gboolean gnt_ascii_only(void);
 
+void gnt_window_present(GntWidget *window);
 /**
  * 
  * @param widget
--- a/finch/libgnt/gntmain.c	Fri Jun 08 10:21:50 2007 +0000
+++ b/finch/libgnt/gntmain.c	Fri Jun 08 12:41:30 2007 +0000
@@ -484,6 +484,10 @@
  * Stuff for 'window management' *
  *********************************/
 
+void gnt_window_present(GntWidget *window) {
+	gnt_wm_raise_window(wm, window);
+}
+
 void gnt_screen_occupy(GntWidget *widget)
 {
 	gnt_wm_new_window(wm, widget);
--- a/finch/libgnt/gntwm.c	Fri Jun 08 10:21:50 2007 +0000
+++ b/finch/libgnt/gntwm.c	Fri Jun 08 12:41:30 2007 +0000
@@ -186,7 +186,7 @@
 		return;
 	for (iter = act; iter; iter = iter->next) {
 		GntWS *ws = iter->data;
-		g_string_sprintfa(text, "%s, ", gnt_ws_get_name(ws));
+		g_string_append_printf(text, "%s, ", gnt_ws_get_name(ws));
 	}
 	g_string_erase(text, text->len - 2, 2);
 	message = gnt_vbox_new(FALSE);
@@ -562,9 +562,6 @@
 	if (GNT_IS_WS(sel)) {
 		gnt_wm_switch_workspace(wm, g_list_index(wm->workspaces, sel));
 	} else {
-		GntNode *node = g_hash_table_lookup(wm->nodes, sel);
-		if (node && node->ws != wm->cws)
-			gnt_wm_switch_workspace(wm, g_list_index(wm->workspaces, node->ws));
 		gnt_wm_raise_window(wm, GNT_WIDGET(sel));
 	}
 }
@@ -1550,8 +1547,6 @@
 		}
 
 		if (wm->event_stack || node->me == wm->_list.window) {
-			if (wm->cws != ws)
-				gnt_wm_switch_workspace(wm, g_list_index(wm->workspaces, ws));
 			gnt_wm_raise_window(wm, node->me);
 		} else {
 			bottom_panel(node->panel);     /* New windows should not grab focus */
@@ -1928,6 +1923,9 @@
 
 void gnt_wm_raise_window(GntWM *wm, GntWidget *widget)
 {
+	GntWS *ws = gnt_wm_widget_find_workspace(wm, widget);
+	if (wm->cws != ws)
+		gnt_wm_switch_workspace(wm, g_list_index(wm->workspaces, ws));
 	g_signal_emit(wm, signals[SIG_GIVE_FOCUS], 0, widget);
 }