comparison src/themes.c @ 4816:94e75b03c598

[gaim-migrate @ 5140] the themes patch made gaim not compile. this removes that patch committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 18 Mar 2003 02:05:48 +0000
parents 043f7c059034
children dc6de8ad81ae
comparison
equal deleted inserted replaced
4815:3efe860c40c7 4816:94e75b03c598
68 struct smiley_theme *theme=NULL; 68 struct smiley_theme *theme=NULL;
69 struct smiley_list *list = NULL; 69 struct smiley_list *list = NULL;
70 GSList *lst = smiley_themes; 70 GSList *lst = smiley_themes;
71 char *dirname; 71 char *dirname;
72 gboolean old=FALSE; 72 gboolean old=FALSE;
73 const char *locale;
74 char language[3];
75 73
76 while (lst) { 74 while (lst) {
77 struct smiley_theme *thm = lst->data; 75 struct smiley_theme *thm = lst->data;
78 if (!strcmp(thm->path, file)) { 76 if (!strcmp(thm->path, file)) {
79 theme = thm; 77 theme = thm;
114 current_smiley_theme->list = NULL; 112 current_smiley_theme->list = NULL;
115 g_slist_free(already_freed); 113 g_slist_free(already_freed);
116 } 114 }
117 current_smiley_theme = theme; 115 current_smiley_theme = theme;
118 } 116 }
119 117
120 locale = setlocale(LC_MESSAGES, NULL); 118
121 if(locale[0] && locale[1]) {
122 language[0] = locale[0];
123 language[1] = locale[1];
124 language[2] = '\0';
125 } else
126 language[0] = '\0';
127
128 while (!feof(f)) { 119 while (!feof(f)) {
129 char *p;
130 if (!fgets(buf, sizeof(buf), f)) { 120 if (!fgets(buf, sizeof(buf), f)) {
131 break; 121 break;
132 } 122 }
133 123
134 if (buf[0] == '#' || buf[0] == '\0') 124 if (buf[0] == '#' || buf[0] == '\0')
136 126
137 i = buf; 127 i = buf;
138 while (isspace(*i)) 128 while (isspace(*i))
139 i++; 129 i++;
140 130
141 if (*i == '[' && (p=strchr(i, ']')) && load) { 131 if (*i == '[' && strchr(i, ']') && load) {
142 struct smiley_list *child = g_new0(struct smiley_list, 1); 132 struct smiley_list *child = g_new0(struct smiley_list, 1);
143 child->sml = g_strndup(i+1, (p - i) - 1); 133 child->sml = g_strndup(i+1, (int)strchr(i, ']') - (int)i - 1);
144 if (theme->list) 134 if (theme->list)
145 list->next = child; 135 list->next = child;
146 else 136 else
147 theme->list = child; 137 theme->list = child;
148 list = child; 138 list = child;
149 continue; 139 } else if (!g_ascii_strncasecmp(i, "Name=", strlen("Name="))) {
150 } 140 theme->name = g_strdup(i+ strlen("Name="));
151 if(!list) { 141 theme->name[strlen(theme->name)-1] = 0;
152 char key[256], *open_bracket; 142 } else if (!g_ascii_strncasecmp(i, "Description=", strlen("Description="))) {
153 p = strchr(i, '='); 143 theme->desc = g_strdup(i + strlen("Description="));
154 if(!p) 144 theme->desc[strlen(theme->desc)-1] = 0;
155 continue; 145 } else if (!g_ascii_strncasecmp(i, "Icon=", strlen("Icon="))) {
156 strncpy(key, i, (p-i)); 146 theme->icon = g_build_filename(dirname, i + strlen("Icon="), NULL);
157 key[p-i] = '\0'; 147 theme->icon[strlen(theme->icon)-1] = 0;
158 148 } else if (!g_ascii_strncasecmp(i, "Author=", strlen("Author="))) {
159 open_bracket = strchr(key, '['); 149 theme->author = g_strdup(i + strlen("Author="));
160 if(open_bracket) { 150 theme->author[strlen(theme->author)-1] = 0;
161 if(strncmp(open_bracket+1,locale,strlen(locale)) && 151 } else if (load && list) {
162 strncmp(open_bracket+1,language,2))
163 continue;
164 *open_bracket = '\0';
165 }
166
167 do p++; while(isspace(*p));
168
169 if (!g_ascii_strncasecmp(key, "Name", 4)) {
170 if(theme->name)
171 g_free(theme->name);
172 theme->name = g_strdup(p);
173 theme->name[strlen(theme->name)-1] = '\0';
174 } else if (!g_ascii_strcasecmp(key, "Description")) {
175 if(theme->desc)
176 g_free(theme->desc);
177 theme->desc = g_strdup(p);
178 theme->desc[strlen(theme->desc)-1] = '\0';
179 } else if (!g_ascii_strcasecmp(key, "Icon")) {
180 if(theme->icon)
181 g_free(theme->icon);
182 theme->icon = g_build_filename(dirname, p, NULL);
183 theme->icon[strlen(theme->icon)-1] = '\0';
184 } else if (!g_ascii_strcasecmp(key, "Author")) {
185 if(theme->author)
186 g_free(theme->author);
187 theme->author = g_strdup(p);
188 theme->author[strlen(theme->author)-1] = '\0';
189 }
190 continue;
191 }
192 if (load) {
193 gboolean hidden = FALSE; 152 gboolean hidden = FALSE;
194 char *sfile = NULL; 153 char *sfile = NULL;
195 154
196 if (*i == '!' && *(i + 1) == ' ') { 155 if (*i == '!' && *(i + 1) == ' ') {
197 hidden = TRUE; 156 hidden = TRUE;