Bug Summary

File:geyes/themes.c
Warning:line 81, column 25
Value stored to 'token' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name themes.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/geyes -resource-dir /usr/lib/llvm-16/lib/clang/16 -D HAVE_CONFIG_H -I . -I .. -I . -I . -I /usr/include/cafe-panel-4.0/libcafe-panel-applet -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/ctk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/x86_64-linux-gnu -I /usr/include/webp -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -I /usr/include -D GEYES_THEMES_DIR="/usr/share/cafe-applets/geyes/" -D GEYES_MENU_UI_DIR="/usr/share/cafe/ui" -internal-isystem /usr/lib/llvm-16/lib/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/rootdir/geyes -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-04-16-122014-85828-1 -x c themes.c
1/*
2 * Copyright (C) 1999 Dave Camp <dave@davec.dhs.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
17 *
18 */
19
20#include <config.h>
21#include <string.h>
22#include <dirent.h>
23#include <limits.h>
24#include <ctype.h>
25#include <ctk/ctk.h>
26#include <gio/gio.h>
27#include "geyes.h"
28
29#define NUM_THEME_DIRECTORIES2 2
30#define HIG_IDENTATION" " " "
31
32static char *theme_directories[NUM_THEME_DIRECTORIES2];
33
34enum {
35 COL_THEME_DIR = 0,
36 COL_THEME_NAME,
37 TOTAL_COLS
38};
39
40void theme_dirs_create (void)
41{
42 static gboolean themes_created = FALSE(0);
43
44 if (themes_created == TRUE(!(0)))
45 return;
46
47 theme_directories[0] = g_build_filename(GEYES_THEMES_DIR"/usr/share/cafe-applets/geyes/", NULL((void*)0));
48
49 theme_directories[1] = g_build_filename(g_get_user_config_dir(), "cafe", "geyes-themes", NULL((void*)0));
50
51 themes_created = TRUE(!(0));
52}
53
54static void
55parse_theme_file (EyesApplet *eyes_applet, FILE *theme_file)
56{
57 gchar line_buf [512]; /* prolly overkill */
58 gchar *token;
59
60 if (fgets (line_buf, 512, theme_file) == NULL((void*)0))
61 printf("fgets error\n");
62
63 while (!feof (theme_file)) {
64 token = strtok (line_buf, "=");
65 if (strncmp (token, "wall-thickness",
66 strlen ("wall-thickness")) == 0) {
67 token += strlen ("wall-thickness");
68 while (!isdigit (*token)((*__ctype_b_loc ())[(int) ((*token))] & (unsigned short int
) _ISdigit)
) {
69 token++;
70 }
71 sscanf (token, "%d", &eyes_applet->wall_thickness);
72 } else if (strncmp (token, "num-eyes", strlen ("num-eyes")) == 0) {
73 token += strlen ("num-eyes");
74 while (!isdigit (*token)((*__ctype_b_loc ())[(int) ((*token))] & (unsigned short int
) _ISdigit)
) {
75 token++;
76 }
77 sscanf (token, "%d", &eyes_applet->num_eyes);
78 if (eyes_applet->num_eyes > MAX_EYES1000)
79 eyes_applet->num_eyes = MAX_EYES1000;
80 } else if (strncmp (token, "eye-pixmap", strlen ("eye-pixmap")) == 0) {
81 token = strtok (NULL((void*)0), "\"");
Value stored to 'token' is never read
82 token = strtok (NULL((void*)0), "\"");
83 if (eyes_applet->eye_filename != NULL((void*)0))
84 g_free (eyes_applet->eye_filename);
85 eyes_applet->eye_filename = g_strdup_printf ("%s%s",
86 eyes_applet->theme_dir,
87 token);
88 } else if (strncmp (token, "pupil-pixmap", strlen ("pupil-pixmap")) == 0) {
89 token = strtok (NULL((void*)0), "\"");
90 token = strtok (NULL((void*)0), "\"");
91 if (eyes_applet->pupil_filename != NULL((void*)0))
92 g_free (eyes_applet->pupil_filename);
93 eyes_applet->pupil_filename
94 = g_strdup_printf ("%s%s",
95 eyes_applet->theme_dir,
96 token);
97 }
98 if (fgets (line_buf, 512, theme_file) == NULL((void*)0))
99 printf("fgets error\n");
100 }
101}
102
103int
104load_theme (EyesApplet *eyes_applet, const gchar *theme_dir)
105{
106 CtkWidget *dialog;
107
108 FILE* theme_file;
109 gchar *file_name;
110
111 eyes_applet->theme_dir = g_strdup_printf ("%s/", theme_dir);
112
113 file_name = g_strdup_printf("%s%s",theme_dir,"/config");
114 theme_file = fopen (file_name, "r");
115 g_free (file_name);
116 if (theme_file == NULL((void*)0)) {
117 g_free (eyes_applet->theme_dir);
118 eyes_applet->theme_dir = g_strdup_printf (GEYES_THEMES_DIR"/usr/share/cafe-applets/geyes/" "Default-tiny/");
119 theme_file = fopen (GEYES_THEMES_DIR"/usr/share/cafe-applets/geyes/" "Default-tiny/config", "r");
120 }
121
122 /* if it's still NULL we've got a major problem */
123 if (theme_file == NULL((void*)0)) {
124 dialog = ctk_message_dialog_new_with_markup (NULL((void*)0),
125 CTK_DIALOG_DESTROY_WITH_PARENT,
126 CTK_MESSAGE_ERROR,
127 CTK_BUTTONS_OK,
128 "<b>%s</b>\n\n%s",
129 _("Can not launch the eyes applet.")gettext ("Can not launch the eyes applet."),
130 _("There was a fatal error while trying to load the theme.")gettext ("There was a fatal error while trying to load the theme."
)
);
131
132 ctk_dialog_run (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_dialog_get_type ()))))))
);
133 ctk_widget_destroy (dialog);
134
135 ctk_widget_destroy (CTK_WIDGET (eyes_applet->applet)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((eyes_applet->applet)), ((ctk_widget_get_type ()))))))
);
136
137 return FALSE(0);
138 }
139
140 parse_theme_file (eyes_applet, theme_file);
141 fclose (theme_file);
142
143 eyes_applet->theme_name = g_strdup (theme_dir)g_strdup_inline (theme_dir);
144
145 if (eyes_applet->eye_image)
146 g_object_unref (eyes_applet->eye_image);
147 eyes_applet->eye_image = gdk_pixbuf_new_from_file (eyes_applet->eye_filename, NULL((void*)0));
148 if (eyes_applet->pupil_image)
149 g_object_unref (eyes_applet->pupil_image);
150 eyes_applet->pupil_image = gdk_pixbuf_new_from_file (eyes_applet->pupil_filename, NULL((void*)0));
151
152 eyes_applet->eye_height = gdk_pixbuf_get_height (eyes_applet->eye_image);
153 eyes_applet->eye_width = gdk_pixbuf_get_width (eyes_applet->eye_image);
154 eyes_applet->pupil_height = gdk_pixbuf_get_height (eyes_applet->pupil_image);
155 eyes_applet->pupil_width = gdk_pixbuf_get_width (eyes_applet->pupil_image);
156
157 return TRUE(!(0));
158}
159
160static void
161destroy_theme (EyesApplet *eyes_applet)
162{
163 /* Dunno about this - to unref or not to unref? */
164 if (eyes_applet->eye_image != NULL((void*)0)) {
165 g_object_unref (eyes_applet->eye_image);
166 eyes_applet->eye_image = NULL((void*)0);
167 }
168 if (eyes_applet->pupil_image != NULL((void*)0)) {
169 g_object_unref (eyes_applet->pupil_image);
170 eyes_applet->pupil_image = NULL((void*)0);
171 }
172
173 g_free (eyes_applet->theme_dir);
174 g_free (eyes_applet->theme_name);
175}
176
177static void
178theme_selected_cb (CtkTreeSelection *selection, gpointer data)
179{
180 EyesApplet *eyes_applet = data;
181 CtkTreeModel *model;
182 CtkTreeIter iter;
183 gchar *theme;
184 gchar *theme_dir;
185
186 if (!ctk_tree_selection_get_selected (selection, &model, &iter))
187 return;
188
189 ctk_tree_model_get (model, &iter, COL_THEME_DIR, &theme, -1);
190
191 g_return_if_fail (theme)do { if ((theme)) { } else { g_return_if_fail_warning (((gchar
*) 0), ((const char*) (__func__)), "theme"); return; } } while
(0)
;
192
193 theme_dir = g_strdup_printf ("%s/", theme);
194 if (!g_ascii_strncasecmp (theme_dir, eyes_applet->theme_dir, strlen (theme_dir))) {
195 g_free (theme_dir);
196 return;
197 }
198 g_free (theme_dir);
199
200 destroy_eyes (eyes_applet);
201 destroy_theme (eyes_applet);
202 load_theme (eyes_applet, theme);
203 setup_eyes (eyes_applet);
204
205 g_settings_set_string (
206 eyes_applet->settings, "theme-path", theme);
207
208 g_free (theme);
209}
210
211static void
212phelp_cb (CtkDialog *dialog)
213{
214 GError *error = NULL((void*)0);
215
216 ctk_show_uri_on_window (CTK_WINDOW (dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_window_get_type ()))))))
,
217 "help:cafe-geyes/geyes-settings",
218 ctk_get_current_event_time (),
219 &error);
220
221 if (error) {
222 CtkWidget *error_dialog = ctk_message_dialog_new (NULL((void*)0), CTK_DIALOG_MODAL, CTK_MESSAGE_ERROR, CTK_BUTTONS_CLOSE,
223 _("There was an error displaying help: %s")gettext ("There was an error displaying help: %s"), error->message);
224 g_signal_connect (G_OBJECT (error_dialog), "response", G_CALLBACK (ctk_widget_destroy) , NULL)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((error_dialog)), (((GType) ((20) <<
(2))))))))), ("response"), (((GCallback) (ctk_widget_destroy
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
225 ctk_window_set_resizable (CTK_WINDOW (error_dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((error_dialog)), ((ctk_window_get_type ()))))))
, FALSE(0));
226 ctk_window_set_screen (CTK_WINDOW (error_dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((error_dialog)), ((ctk_window_get_type ()))))))
, ctk_widget_get_screen (CTK_WIDGET (dialog)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_widget_get_type ()))))))
));
227 ctk_widget_show (error_dialog);
228 g_error_free (error);
229 error = NULL((void*)0);
230 }
231}
232
233static void
234presponse_cb (CtkDialog *dialog, gint id, gpointer data)
235{
236 EyesApplet *eyes_applet = data;
237 if(id == CTK_RESPONSE_HELP){
238 phelp_cb (dialog);
239 return;
240 }
241
242
243 ctk_widget_destroy (CTK_WIDGET (dialog)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_widget_get_type ()))))))
);
244
245 eyes_applet->prop_box.pbox = NULL((void*)0);
246}
247
248void
249properties_cb (CtkAction *action,
250 EyesApplet *eyes_applet)
251{
252 CtkWidget *pbox, *hbox;
253 CtkWidget *vbox, *indent;
254 CtkWidget *categories_vbox;
255 CtkWidget *category_vbox, *control_vbox;
256 CtkWidget *tree;
257 CtkWidget *scrolled;
258 CtkWidget *label;
259 CtkListStore *model;
260 CtkTreeViewColumn *column;
261 CtkCellRenderer *cell;
262 CtkTreeSelection *selection;
263 CtkTreeIter iter;
264 DIR *dfd;
265 struct dirent *dp;
266 int i;
267#ifdef PATH_MAX4096
268 gchar filename [PATH_MAX4096];
269#else
270 gchar *filename;
271#endif
272 gchar *title;
273
274 if (eyes_applet->prop_box.pbox) {
275 ctk_window_set_screen (
276 CTK_WINDOW (eyes_applet->prop_box.pbox)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((eyes_applet->prop_box.pbox)), ((ctk_window_get_type (
)))))))
,
277 ctk_widget_get_screen (CTK_WIDGET (eyes_applet->applet)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((eyes_applet->applet)), ((ctk_widget_get_type ()))))))
));
278 ctk_window_present (CTK_WINDOW (eyes_applet->prop_box.pbox)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((eyes_applet->prop_box.pbox)), ((ctk_window_get_type (
)))))))
);
279 return;
280 }
281
282 pbox = ctk_dialog_new_with_buttons (_("Eyes Preferences")gettext ("Eyes Preferences"), NULL((void*)0),
283 CTK_DIALOG_DESTROY_WITH_PARENT,
284 "ctk-close", CTK_RESPONSE_CLOSE,
285 "ctk-help", CTK_RESPONSE_HELP,
286 NULL((void*)0));
287
288 ctk_window_set_screen (CTK_WINDOW (pbox)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pbox)), ((ctk_window_get_type ()))))))
,
289 ctk_widget_get_screen (CTK_WIDGET (eyes_applet->applet)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((eyes_applet->applet)), ((ctk_widget_get_type ()))))))
));
290
291 ctk_widget_set_size_request (CTK_WIDGET (pbox)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pbox)), ((ctk_widget_get_type ()))))))
, 300, 200);
292 ctk_dialog_set_default_response(CTK_DIALOG (pbox)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pbox)), ((ctk_dialog_get_type ()))))))
, CTK_RESPONSE_CLOSE);
293 ctk_container_set_border_width (CTK_CONTAINER (pbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pbox)), ((ctk_container_get_type ()))))))
, 5);
294 ctk_box_set_spacing (CTK_BOX (ctk_dialog_get_content_area (CTK_DIALOG (pbox)))((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_dialog_get_content_area (((((CtkDialog*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pbox)), ((ctk_dialog_get_type ()))))))))
), ((ctk_box_get_type ()))))))
, 2);
295
296 g_signal_connect (pbox, "response",g_signal_connect_data ((pbox), ("response"), (((GCallback) (presponse_cb
))), (eyes_applet), ((void*)0), (GConnectFlags) 0)
297 G_CALLBACK (presponse_cb),g_signal_connect_data ((pbox), ("response"), (((GCallback) (presponse_cb
))), (eyes_applet), ((void*)0), (GConnectFlags) 0)
298 eyes_applet)g_signal_connect_data ((pbox), ("response"), (((GCallback) (presponse_cb
))), (eyes_applet), ((void*)0), (GConnectFlags) 0)
;
299
300 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
301 ctk_container_set_border_width (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_container_get_type ()))))))
, 5);
302 ctk_widget_show (vbox);
303
304 ctk_box_pack_start (CTK_BOX (ctk_dialog_get_content_area (CTK_DIALOG (pbox)))((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_dialog_get_content_area (((((CtkDialog*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pbox)), ((ctk_dialog_get_type ()))))))))
), ((ctk_box_get_type ()))))))
, vbox,
305 TRUE(!(0)), TRUE(!(0)), 0);
306
307 categories_vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 18);
308 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, categories_vbox, TRUE(!(0)), TRUE(!(0)), 0);
309 ctk_widget_show (categories_vbox);
310
311 category_vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 6);
312 ctk_box_pack_start (CTK_BOX (categories_vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((categories_vbox)), ((ctk_box_get_type ()))))))
, category_vbox, TRUE(!(0)), TRUE(!(0)), 0);
313 ctk_widget_show (category_vbox);
314
315 title = g_strconcat ("<span weight=\"bold\">", _("Themes")gettext ("Themes"), "</span>", NULL((void*)0));
316 label = ctk_label_new (_(title)gettext (title));
317 ctk_label_set_use_markup (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, TRUE(!(0)));
318 ctk_label_set_justify (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, CTK_JUSTIFY_LEFT);
319 ctk_label_set_xalign (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, 0.0);
320 ctk_box_pack_start (CTK_BOX (category_vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((category_vbox)), ((ctk_box_get_type ()))))))
, label, FALSE(0), FALSE(0), 0);
321 g_free (title);
322
323 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
324 ctk_box_pack_start (CTK_BOX (category_vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((category_vbox)), ((ctk_box_get_type ()))))))
, hbox, TRUE(!(0)), TRUE(!(0)), 0);
325 ctk_widget_show (hbox);
326
327 indent = ctk_label_new (HIG_IDENTATION" ");
328 ctk_label_set_justify (CTK_LABEL (indent)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((indent)), ((ctk_label_get_type ()))))))
, CTK_JUSTIFY_LEFT);
329 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, indent, FALSE(0), FALSE(0), 0);
330 ctk_widget_show (indent);
331
332 control_vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 6);
333 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, control_vbox, TRUE(!(0)), TRUE(!(0)), 0);
334 ctk_widget_show (control_vbox);
335
336 label = ctk_label_new_with_mnemonic (_("_Select a theme:")gettext ("_Select a theme:"));
337 ctk_label_set_xalign (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, 0.0);
338 ctk_box_pack_start (CTK_BOX (control_vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((control_vbox)), ((ctk_box_get_type ()))))))
, label, FALSE(0), FALSE(0), 0);
339
340 scrolled = ctk_scrolled_window_new (NULL((void*)0), NULL((void*)0));
341 ctk_scrolled_window_set_shadow_type (CTK_SCROLLED_WINDOW (scrolled)((((CtkScrolledWindow*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((scrolled)), ((ctk_scrolled_window_get_type
()))))))
, CTK_SHADOW_IN);
342 ctk_scrolled_window_set_policy (CTK_SCROLLED_WINDOW (scrolled)((((CtkScrolledWindow*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((scrolled)), ((ctk_scrolled_window_get_type
()))))))
,
343 CTK_POLICY_AUTOMATIC,
344 CTK_POLICY_AUTOMATIC);
345
346 model = ctk_list_store_new (TOTAL_COLS, G_TYPE_STRING((GType) ((16) << (2))), G_TYPE_STRING((GType) ((16) << (2))));
347 tree = ctk_tree_view_new_with_model (CTK_TREE_MODEL (model)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((model)), ((ctk_tree_model_get_type ()))))))
);
348 ctk_tree_view_set_headers_visible (CTK_TREE_VIEW (tree)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree)), ((ctk_tree_view_get_type ()))))))
, FALSE(0));
349 ctk_label_set_mnemonic_widget (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, tree);
350 g_object_unref (model);
351
352 ctk_container_add (CTK_CONTAINER (scrolled)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scrolled)), ((ctk_container_get_type ()))))))
, tree);
353
354 cell = ctk_cell_renderer_text_new ();
355 column = ctk_tree_view_column_new_with_attributes ("not used", cell,
356 "text", COL_THEME_NAME, NULL((void*)0));
357 ctk_tree_view_append_column (CTK_TREE_VIEW (tree)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree)), ((ctk_tree_view_get_type ()))))))
, column);
358
359 selection = ctk_tree_view_get_selection (CTK_TREE_VIEW (tree)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree)), ((ctk_tree_view_get_type ()))))))
);
360 g_signal_connect (selection, "changed",g_signal_connect_data ((selection), ("changed"), (((GCallback
) (theme_selected_cb))), (eyes_applet), ((void*)0), (GConnectFlags
) 0)
361 G_CALLBACK (theme_selected_cb),g_signal_connect_data ((selection), ("changed"), (((GCallback
) (theme_selected_cb))), (eyes_applet), ((void*)0), (GConnectFlags
) 0)
362 eyes_applet)g_signal_connect_data ((selection), ("changed"), (((GCallback
) (theme_selected_cb))), (eyes_applet), ((void*)0), (GConnectFlags
) 0)
;
363
364 if ( ! g_settings_is_writable (eyes_applet->settings, "theme-path")) {
365 ctk_widget_set_sensitive (tree, FALSE(0));
366 ctk_widget_set_sensitive (label, FALSE(0));
367 }
368
369 for (i = 0; i < NUM_THEME_DIRECTORIES2; i++) {
370 if ((dfd = opendir (theme_directories[i])) != NULL((void*)0)) {
371 while ((dp = readdir (dfd)) != NULL((void*)0)) {
372 if (dp->d_name[0] != '.') {
373 gchar *theme_dir;
374 gchar *theme_name;
375#ifdef PATH_MAX4096
376 strcpy (filename,
377 theme_directories[i]);
378 strcat (filename, dp->d_name);
379#else
380 asprintf (&filename, theme_directories[i], dp->d_name);
381#endif
382 theme_dir = g_strdup_printf ("%s/", filename);
383 theme_name = g_path_get_basename (filename);
384
385 ctk_list_store_append (model, &iter);
386 ctk_list_store_set (model, &iter,
387 COL_THEME_DIR, &filename,
388 COL_THEME_NAME, theme_name,
389 -1);
390
391 if (!g_ascii_strncasecmp (eyes_applet->theme_dir, theme_dir, strlen (theme_dir))) {
392 CtkTreePath *path;
393 path = ctk_tree_model_get_path (CTK_TREE_MODEL (model)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((model)), ((ctk_tree_model_get_type ()))))))
,
394 &iter);
395 ctk_tree_view_set_cursor (CTK_TREE_VIEW (tree)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree)), ((ctk_tree_view_get_type ()))))))
,
396 path,
397 NULL((void*)0),
398 FALSE(0));
399 ctk_tree_path_free (path);
400 }
401 g_free (theme_name);
402 g_free (theme_dir);
403 }
404 }
405 closedir (dfd);
406 }
407 }
408#ifndef PATH_MAX4096
409 g_free (filename);
410#endif
411
412 ctk_box_pack_start (CTK_BOX (control_vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((control_vbox)), ((ctk_box_get_type ()))))))
, scrolled, TRUE(!(0)), TRUE(!(0)), 0);
413
414 ctk_widget_show_all (pbox);
415
416 eyes_applet->prop_box.pbox = pbox;
417
418 return;
419}
420
421