changeset 18345:2d4df5ef0090

If the action-windows are already there, then bring them to front when requested.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 28 Jun 2007 18:52:26 +0000
parents 310bad6dafe4
children 72a52cff76f3 3439e98112ea
files finch/gntaccount.c finch/gntblist.c finch/gntdebug.c finch/gntft.c finch/gntplugin.c finch/gntpounce.c finch/gntprefs.c finch/gntstatus.c
diffstat 8 files changed, 67 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntaccount.c	Thu Jun 28 18:41:43 2007 +0000
+++ b/finch/gntaccount.c	Thu Jun 28 18:52:26 2007 +0000
@@ -645,8 +645,10 @@
 	GList *iter;
 	GntWidget *box, *button;
 
-	if (accounts.window)
+	if (accounts.window) {
+		gnt_window_present(accounts.window);
 		return;
+	}
 
 	accounts.window = gnt_vbox_new(FALSE);
 	gnt_box_set_toplevel(GNT_BOX(accounts.window), TRUE);
--- a/finch/gntblist.c	Thu Jun 28 18:41:43 2007 +0000
+++ b/finch/gntblist.c	Thu Jun 28 18:52:26 2007 +0000
@@ -2250,8 +2250,10 @@
 {
 	if (ggblist == NULL)
 		new_list(list);
-	else if (ggblist->window)
+	else if (ggblist->window) {
+		gnt_window_present(ggblist->window);
 		return;
+	}
 
 	ggblist->window = gnt_vwindow_new(FALSE);
 	gnt_widget_set_name(ggblist->window, "buddylist");
--- a/finch/gntdebug.c	Thu Jun 28 18:41:43 2007 +0000
+++ b/finch/gntdebug.c	Thu Jun 28 18:52:26 2007 +0000
@@ -221,56 +221,59 @@
 
 void finch_debug_window_show()
 {
+	GntWidget *wid, *box;
+
 	debug.paused = FALSE;
-	if (debug.window == NULL)
-	{
-		GntWidget *wid, *box;
-		debug.window = gnt_vbox_new(FALSE);
-		gnt_box_set_toplevel(GNT_BOX(debug.window), TRUE);
-		gnt_box_set_title(GNT_BOX(debug.window), _("Debug Window"));
-		gnt_box_set_pad(GNT_BOX(debug.window), 0);
-		gnt_box_set_alignment(GNT_BOX(debug.window), GNT_ALIGN_MID);
+	if (debug.window) {
+		gnt_window_present(debug.window);
+		return;
+	}
 
-		debug.tview = gnt_text_view_new();
-		gnt_box_add_widget(GNT_BOX(debug.window), debug.tview);
-		gnt_widget_set_size(debug.tview,
-				purple_prefs_get_int(PREF_ROOT "/size/width"),
-				purple_prefs_get_int(PREF_ROOT "/size/height"));
-		g_signal_connect(G_OBJECT(debug.tview), "size_changed", G_CALLBACK(size_changed_cb), NULL);
+	debug.window = gnt_vbox_new(FALSE);
+	gnt_box_set_toplevel(GNT_BOX(debug.window), TRUE);
+	gnt_box_set_title(GNT_BOX(debug.window), _("Debug Window"));
+	gnt_box_set_pad(GNT_BOX(debug.window), 0);
+	gnt_box_set_alignment(GNT_BOX(debug.window), GNT_ALIGN_MID);
 
-		gnt_box_add_widget(GNT_BOX(debug.window), gnt_line_new(FALSE));
+	debug.tview = gnt_text_view_new();
+	gnt_box_add_widget(GNT_BOX(debug.window), debug.tview);
+	gnt_widget_set_size(debug.tview,
+			purple_prefs_get_int(PREF_ROOT "/size/width"),
+			purple_prefs_get_int(PREF_ROOT "/size/height"));
+	g_signal_connect(G_OBJECT(debug.tview), "size_changed", G_CALLBACK(size_changed_cb), NULL);
 
-		box = gnt_hbox_new(FALSE);
-		gnt_box_set_alignment(GNT_BOX(box), GNT_ALIGN_MID);
-		gnt_box_set_fill(GNT_BOX(box), FALSE);
+	gnt_box_add_widget(GNT_BOX(debug.window), gnt_line_new(FALSE));
+
+	box = gnt_hbox_new(FALSE);
+	gnt_box_set_alignment(GNT_BOX(box), GNT_ALIGN_MID);
+	gnt_box_set_fill(GNT_BOX(box), FALSE);
 
-		/* XXX: Setting the GROW_Y for the following widgets don't make sense. But right now
-		 * it's necessary to make the width of the debug window resizable ... like I said,
-		 * it doesn't make sense. The bug is likely in the packing in gntbox.c.
-		 */
-		wid = gnt_button_new(_("Clear"));
-		g_signal_connect(G_OBJECT(wid), "activate", G_CALLBACK(clear_debug_win), debug.tview);
-		GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y);
-		gnt_box_add_widget(GNT_BOX(box), wid);
-
-		debug.search = gnt_entry_new(purple_prefs_get_string(PREF_ROOT "/filter"));
-		gnt_box_add_widget(GNT_BOX(box), gnt_label_new(_("Filter: ")));
-		gnt_box_add_widget(GNT_BOX(box), debug.search);
-		g_signal_connect(G_OBJECT(debug.search), "text_changed", G_CALLBACK(update_filter_string), NULL);
+	/* XXX: Setting the GROW_Y for the following widgets don't make sense. But right now
+	 * it's necessary to make the width of the debug window resizable ... like I said,
+	 * it doesn't make sense. The bug is likely in the packing in gntbox.c.
+	 */
+	wid = gnt_button_new(_("Clear"));
+	g_signal_connect(G_OBJECT(wid), "activate", G_CALLBACK(clear_debug_win), debug.tview);
+	GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y);
+	gnt_box_add_widget(GNT_BOX(box), wid);
 
-		wid = gnt_check_box_new(_("Pause"));
-		g_signal_connect(G_OBJECT(wid), "toggled", G_CALLBACK(toggle_pause), NULL);
-		GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y);
-		gnt_box_add_widget(GNT_BOX(box), wid);
+	debug.search = gnt_entry_new(purple_prefs_get_string(PREF_ROOT "/filter"));
+	gnt_box_add_widget(GNT_BOX(box), gnt_label_new(_("Filter: ")));
+	gnt_box_add_widget(GNT_BOX(box), debug.search);
+	g_signal_connect(G_OBJECT(debug.search), "text_changed", G_CALLBACK(update_filter_string), NULL);
 
-		gnt_box_add_widget(GNT_BOX(debug.window), box);
-		GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_GROW_Y);
+	wid = gnt_check_box_new(_("Pause"));
+	g_signal_connect(G_OBJECT(wid), "toggled", G_CALLBACK(toggle_pause), NULL);
+	GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y);
+	gnt_box_add_widget(GNT_BOX(box), wid);
 
-		gnt_widget_set_name(debug.window, "debug-window");
+	gnt_box_add_widget(GNT_BOX(debug.window), box);
+	GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_GROW_Y);
 
-		g_signal_connect(G_OBJECT(debug.window), "destroy", G_CALLBACK(reset_debug_win), NULL);
-		gnt_text_view_attach_scroll_widget(GNT_TEXT_VIEW(debug.tview), debug.window);
-	}
+	gnt_widget_set_name(debug.window, "debug-window");
+
+	g_signal_connect(G_OBJECT(debug.window), "destroy", G_CALLBACK(reset_debug_win), NULL);
+	gnt_text_view_attach_scroll_widget(GNT_TEXT_VIEW(debug.tview), debug.window);
 
 	gnt_widget_show(debug.window);
 }
--- a/finch/gntft.c	Thu Jun 28 18:41:43 2007 +0000
+++ b/finch/gntft.c	Thu Jun 28 18:52:26 2007 +0000
@@ -262,6 +262,8 @@
 {
 	if (xfer_dialog == NULL)
 		finch_xfer_dialog_new();
+	else
+		gnt_window_present(xfer_dialog->window);
 }
 
 void
--- a/finch/gntplugin.c	Thu Jun 28 18:41:43 2007 +0000
+++ b/finch/gntplugin.c	Thu Jun 28 18:52:26 2007 +0000
@@ -242,8 +242,10 @@
 	GList *iter;
 	GList *seen;
 
-	if (plugins.window)
+	if (plugins.window) {
+		gnt_window_present(plugins.window);
 		return;
+	}
 
 	purple_plugins_probe(G_MODULE_SUFFIX);
 
--- a/finch/gntpounce.c	Thu Jun 28 18:41:43 2007 +0000
+++ b/finch/gntpounce.c	Thu Jun 28 18:52:26 2007 +0000
@@ -672,6 +672,7 @@
 	GntWidget *win;
 
 	if (pounces_manager != NULL) {
+		gnt_window_present(pounces_manager->window);
 		return;
 	}
 
--- a/finch/gntprefs.c	Thu Jun 28 18:41:43 2007 +0000
+++ b/finch/gntprefs.c	Thu Jun 28 18:52:26 2007 +0000
@@ -30,11 +30,15 @@
 #include "gntprefs.h"
 #include "gntrequest.h"
 
+#include "gnt.h"
+#include "gntwidget.h"
+
 #include <string.h>
 
 static struct {
 	GList *freestrings;  /* strings to be freed when the pref-window is closed */
 	gboolean showing;
+	GntWidget *window;
 } pref_request;
 
 void finch_prefs_init()
@@ -239,8 +243,10 @@
 {
 	PurpleRequestFields *fields;
 
-	if (pref_request.showing)
+	if (pref_request.showing) {
+		gnt_window_present(pref_request.window);
 		return;
+	}
 
 	fields = purple_request_fields_new();
 
@@ -250,7 +256,7 @@
 	add_pref_group(fields, _("Idle"), idle);
 
 	pref_request.showing = TRUE;
-	purple_request_fields(NULL, _("Preferences"), NULL, NULL, fields,
+	pref_request.window = purple_request_fields(NULL, _("Preferences"), NULL, NULL, fields,
 			_("Save"), G_CALLBACK(save_cb), _("Cancel"), free_strings,
 			NULL, NULL, NULL,
 			NULL);
--- a/finch/gntstatus.c	Thu Jun 28 18:41:43 2007 +0000
+++ b/finch/gntstatus.c	Thu Jun 28 18:52:26 2007 +0000
@@ -163,8 +163,10 @@
 void finch_savedstatus_show_all()
 {
 	GntWidget *window, *tree, *box, *button;
-	if (statuses.window)
+	if (statuses.window) {
+		gnt_window_present(statuses.window);
 		return;
+	}
 
 	statuses.window = window = gnt_vbox_new(FALSE);
 	gnt_box_set_toplevel(GNT_BOX(window), TRUE);