diff console/libgnt/gntmain.c @ 14335:b1b76fb9c739

[gaim-migrate @ 17031] Add a sample window-manager. This one removes the border and shadows from the buddylist, shows the conversation windows at the right-end of the screen, and puts all the rest of the dialogs in the middle of the screen. I was not planning on committing this just yet, but I accidentally included the change in configure.ac, and I don't want to get yelled at ;) committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 25 Aug 2006 18:21:22 +0000
parents 985e5e3f6f2c
children 0387a167f342
line wrap: on
line diff
--- a/console/libgnt/gntmain.c	Fri Aug 25 18:17:22 2006 +0000
+++ b/console/libgnt/gntmain.c	Fri Aug 25 18:21:22 2006 +0000
@@ -4,12 +4,15 @@
 #include <panel.h>
 #endif
 
+#include <gmodule.h>
+
 #include "gnt.h"
 #include "gntbox.h"
 #include "gntcolors.h"
 #include "gntkeys.h"
 #include "gntstyle.h"
 #include "gnttree.h"
+#include "gntwm.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -38,6 +41,8 @@
 static gboolean ascii_only;
 static gboolean mouse_enabled;
 
+static GntWM wm;
+
 static GMainLoop *loop;
 static struct
 {
@@ -846,6 +851,24 @@
 }
 #endif
 
+static void
+init_wm()
+{
+	const char *name = gnt_style_get(GNT_STYLE_WM);
+	gpointer handle;
+	
+	if (!name || !*name)
+		return;
+	
+	handle = g_module_open(name, G_MODULE_BIND_LAZY);
+	if (handle) {
+		gboolean (*init)(GntWM *);
+		if (g_module_symbol(handle, "gntwm_init", &init)) {
+			init(&wm);
+		}
+	}
+}
+
 void gnt_init()
 {
 	static GIOChannel *channel = NULL;
@@ -915,6 +938,8 @@
 #endif
 
 	g_type_init();
+
+	init_wm();
 }
 
 void gnt_main()
@@ -999,7 +1024,10 @@
 	node = g_hash_table_lookup(nodes, widget);
 	if (node && !node->panel)
 	{
-		node->panel = new_panel(node->me->window);
+		if (wm.new_window)
+			node->panel = wm.new_window(node->me);
+		else
+			node->panel = new_panel(node->me->window);
 		if (!GNT_WIDGET_IS_FLAG_SET(node->me, GNT_WIDGET_TRANSIENT))
 		{
 			bottom_panel(node->panel);     /* New windows should not grab focus */