diff finch/libgnt/gntstyle.c @ 18069:08776fc5c06f

propagate from branch 'im.pidgin.finch.workspaces' (head 76cfc9565a5cdde8d2e1f2efc3282b309a55a110) to branch 'im.pidgin.pidgin.2.1.0' (head 7369e1bc964aa300a73670872d34129642b3ec49)
author Richard Nelson <wabz@pidgin.im>
date Fri, 08 Jun 2007 10:21:50 +0000
parents 1cedd520cd18 5acee0788697
children da183b86a3ef afd96f97c50a
line wrap: on
line diff
--- a/finch/libgnt/gntstyle.c	Thu Jun 07 14:48:33 2007 +0000
+++ b/finch/libgnt/gntstyle.c	Fri Jun 08 10:21:50 2007 +0000
@@ -22,11 +22,15 @@
 
 #include "gntstyle.h"
 #include "gntcolors.h"
+#include "gntws.h"
 
 #include <glib.h>
 #include <ctype.h>
+#include <glib/gprintf.h>
 #include <string.h>
 
+#define MAX_WORKSPACES 99
+
 #if GLIB_CHECK_VERSION(2,6,0)
 static GKeyFile *gkfile;
 #endif
@@ -116,6 +120,45 @@
 	return (char *)gnt_key_translate(key);
 }
 
+void gnt_style_read_workspaces(GntWM *wm)
+{
+#if GLIB_CHECK_VERSION(2,6,0)
+	int i;
+	gchar *name;
+	gsize c;
+
+	for (i = 1; i < MAX_WORKSPACES; ++i) {
+		int j;
+		GntWS *ws;
+		gchar **titles;
+		char *group = calloc(12, 1);
+		g_sprintf(group, "Workspace-%d", i);
+		name = g_key_file_get_value(gkfile, group, "name", NULL);
+		if (!name)
+			return;
+
+		ws = g_object_new(GNT_TYPE_WS, NULL);
+		gnt_ws_set_name(ws, name);
+		gnt_wm_add_workspace(wm, ws);
+		g_free(name);
+
+		titles = g_key_file_get_string_list(gkfile, group, "window-names", &c, NULL);
+		if (titles) {
+			for (j = 0; j < c; ++j)
+				g_hash_table_replace(wm->name_places, g_strdup(titles[j]), ws);
+			g_strfreev(titles);
+		}
+
+		titles = g_key_file_get_string_list(gkfile, group, "window-titles", &c, NULL);
+		if (titles) {
+			for (j = 0; j < c; ++j)
+				g_hash_table_replace(wm->title_places, g_strdup(titles[j]), ws);
+			g_strfreev(titles);
+		}
+		g_free(group);
+	}
+#endif
+}
 void gnt_style_read_actions(GType type, GntBindableClass *klass)
 {
 #if GLIB_CHECK_VERSION(2,6,0)