comparison 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
comparison
equal deleted inserted replaced
18068:0b3d6ea61760 18069:08776fc5c06f
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22 22
23 #include "gntstyle.h" 23 #include "gntstyle.h"
24 #include "gntcolors.h" 24 #include "gntcolors.h"
25 #include "gntws.h"
25 26
26 #include <glib.h> 27 #include <glib.h>
27 #include <ctype.h> 28 #include <ctype.h>
29 #include <glib/gprintf.h>
28 #include <string.h> 30 #include <string.h>
31
32 #define MAX_WORKSPACES 99
29 33
30 #if GLIB_CHECK_VERSION(2,6,0) 34 #if GLIB_CHECK_VERSION(2,6,0)
31 static GKeyFile *gkfile; 35 static GKeyFile *gkfile;
32 #endif 36 #endif
33 37
114 parse_key(const char *key) 118 parse_key(const char *key)
115 { 119 {
116 return (char *)gnt_key_translate(key); 120 return (char *)gnt_key_translate(key);
117 } 121 }
118 122
123 void gnt_style_read_workspaces(GntWM *wm)
124 {
125 #if GLIB_CHECK_VERSION(2,6,0)
126 int i;
127 gchar *name;
128 gsize c;
129
130 for (i = 1; i < MAX_WORKSPACES; ++i) {
131 int j;
132 GntWS *ws;
133 gchar **titles;
134 char *group = calloc(12, 1);
135 g_sprintf(group, "Workspace-%d", i);
136 name = g_key_file_get_value(gkfile, group, "name", NULL);
137 if (!name)
138 return;
139
140 ws = g_object_new(GNT_TYPE_WS, NULL);
141 gnt_ws_set_name(ws, name);
142 gnt_wm_add_workspace(wm, ws);
143 g_free(name);
144
145 titles = g_key_file_get_string_list(gkfile, group, "window-names", &c, NULL);
146 if (titles) {
147 for (j = 0; j < c; ++j)
148 g_hash_table_replace(wm->name_places, g_strdup(titles[j]), ws);
149 g_strfreev(titles);
150 }
151
152 titles = g_key_file_get_string_list(gkfile, group, "window-titles", &c, NULL);
153 if (titles) {
154 for (j = 0; j < c; ++j)
155 g_hash_table_replace(wm->title_places, g_strdup(titles[j]), ws);
156 g_strfreev(titles);
157 }
158 g_free(group);
159 }
160 #endif
161 }
119 void gnt_style_read_actions(GType type, GntBindableClass *klass) 162 void gnt_style_read_actions(GType type, GntBindableClass *klass)
120 { 163 {
121 #if GLIB_CHECK_VERSION(2,6,0) 164 #if GLIB_CHECK_VERSION(2,6,0)
122 char *name; 165 char *name;
123 GError *error = NULL; 166 GError *error = NULL;