Mercurial > pidgin
comparison finch/libgnt/gntstyle.c @ 17704:5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
This changes the ~/.gntrc config for workspaces to the following format:
[Workspace-1]
name = blist
window-names = buddylist;debug-window
[Workspace-2]
name = im
window-names = conversation-window
window-titles = Preferences
[Workspace-3]
name = chats
window-titles = IRC;conference
author | Richard Nelson <wabz@pidgin.im> |
---|---|
date | Sun, 29 Apr 2007 00:37:28 +0000 |
parents | 4ea517cb7ceb |
children | 08776fc5c06f |
comparison
equal
deleted
inserted
replaced
17703:4ea517cb7ceb | 17704:5acee0788697 |
---|---|
1 #include "gntstyle.h" | 1 #include "gntstyle.h" |
2 #include "gntcolors.h" | 2 #include "gntcolors.h" |
3 #include "gntws.h" | 3 #include "gntws.h" |
4 | 4 |
5 #include <ctype.h> | 5 #include <ctype.h> |
6 #include <glib/gprintf.h> | |
6 #include <string.h> | 7 #include <string.h> |
7 | 8 |
8 #define MAX_WORKSPACES 99 | 9 #define MAX_WORKSPACES 99 |
9 | 10 |
10 #if GLIB_CHECK_VERSION(2,6,0) | 11 #if GLIB_CHECK_VERSION(2,6,0) |
93 void gnt_style_read_workspaces(GntWM *wm) | 94 void gnt_style_read_workspaces(GntWM *wm) |
94 { | 95 { |
95 #if GLIB_CHECK_VERSION(2,6,0) | 96 #if GLIB_CHECK_VERSION(2,6,0) |
96 int i; | 97 int i; |
97 gchar *name; | 98 gchar *name; |
98 if (!g_key_file_has_group(gkfile, "Workspaces")) | 99 gsize c; |
99 return; | 100 |
100 | 101 for (i = 1; i < MAX_WORKSPACES; ++i) { |
101 for (i = 1; i <= MAX_WORKSPACES; i++) { | 102 int j; |
102 char *key = calloc(8, 1); | 103 GntWS *ws; |
103 sprintf(key, "name-%d", i); | 104 gchar **titles; |
104 name = g_key_file_get_string(gkfile, "Workspaces", key, NULL); | 105 char *group = calloc(12, 1); |
105 if (name) { | 106 g_sprintf(group, "Workspace-%d", i); |
106 GntWS *ws = g_object_new(GNT_TYPE_WS, NULL); | 107 name = g_key_file_get_value(gkfile, group, "name", NULL); |
107 gnt_ws_set_name(ws, name); | 108 if (!name) |
108 gnt_wm_add_workspace(wm, ws); | |
109 g_free(name); | |
110 } else { | |
111 return; | 109 return; |
112 } | 110 |
111 ws = g_object_new(GNT_TYPE_WS, NULL); | |
112 gnt_ws_set_name(ws, name); | |
113 gnt_wm_add_workspace(wm, ws); | |
114 g_free(name); | |
115 | |
116 titles = g_key_file_get_string_list(gkfile, group, "window-names", &c, NULL); | |
117 if (titles) { | |
118 for (j = 0; j < c; ++j) | |
119 g_hash_table_replace(wm->name_places, g_strdup(titles[j]), ws); | |
120 g_strfreev(titles); | |
121 } | |
122 | |
123 titles = g_key_file_get_string_list(gkfile, group, "window-titles", &c, NULL); | |
124 if (titles) { | |
125 for (j = 0; j < c; ++j) | |
126 g_hash_table_replace(wm->title_places, g_strdup(titles[j]), ws); | |
127 g_strfreev(titles); | |
128 } | |
129 g_free(group); | |
113 } | 130 } |
114 #endif | 131 #endif |
115 } | 132 } |
116 void gnt_style_read_actions(GType type, GntBindableClass *klass) | 133 void gnt_style_read_actions(GType type, GntBindableClass *klass) |
117 { | 134 { |