Bug Summary

File:src/eoc-preferences-dialog.c
Warning:line 78, column 2
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption

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 eoc-preferences-dialog.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 -fhalf-no-semantic-interposition -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 -fdebug-compilation-dir=/rootdir/src -fcoverage-compilation-dir=/rootdir/src -resource-dir /usr/lib/llvm-19/lib/clang/19 -D HAVE_CONFIG_H -I . -I .. -I . -I .. -I ../jpegutils -I ../cut-n-paste/toolbar-editor -D G_LOG_DOMAIN="EOC" -D EOC_DATA_DIR="/usr/share/eoc" -D EOC_LOCALE_DIR="/usr/share/locale" -D EOC_PLUGIN_DIR="/usr/lib/eoc/plugins" -D LIBDIR="/usr/lib" -I /usr/include/ctk-3.0 -I /usr/include/pango-1.0 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -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/cafe-desktop-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -I /usr/include/ctk-3.0/unix-print -I /usr/local/include/libbean-2.0 -I /usr/include/gobject-introspection-1.0 -I /usr/include/exempi-2.0 -I /usr/include/librsvg-2.0 -I /usr/include/libxml2 -D PIC -internal-isystem /usr/lib/llvm-19/lib/clang/19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -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.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/2025-07-18-064417-31381-1 -x c eoc-preferences-dialog.c
1/* Eye Of Cafe - EOC Preferences Dialog
2 *
3 * Copyright (C) 2006 The Free Software Foundation
4 *
5 * Author: Lucas Rocha <lucasr@gnome.org>
6 *
7 * Based on code by:
8 * - Jens Finke <jens@gnome.org>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
23 */
24
25#ifdef HAVE_CONFIG_H1
26#include "config.h"
27#endif
28
29#include "eoc-preferences-dialog.h"
30#include "eoc-scroll-view.h"
31#include "eoc-util.h"
32#include "eoc-config-keys.h"
33
34#include <glib.h>
35#include <glib/gi18n.h>
36#include <glib-object.h>
37#include <ctk/ctk.h>
38#include <gio/gio.h>
39#include <libbean-ctk/bean-ctk-plugin-manager.h>
40
41#define GSETTINGS_OBJECT_KEY"GSETTINGS_KEY" "GSETTINGS_KEY"
42#define GSETTINGS_OBJECT_VALUE"GSETTINGS_VALUE" "GSETTINGS_VALUE"
43
44struct _EocPreferencesDialogPrivate {
45 GSettings *view_settings;
46 GSettings *ui_settings;
47 GSettings *fullscreen_settings;
48
49 CtkWidget *interpolate_check;
50 CtkWidget *extrapolate_check;
51 CtkWidget *autorotate_check;
52 CtkWidget *bg_color_check;
53 CtkWidget *bg_color_button;
54 CtkWidget *color_radio;
55 CtkWidget *checkpattern_radio;
56 CtkWidget *background_radio;
57 CtkWidget *transp_color_button;
58
59 CtkWidget *upscale_check;
60 CtkWidget *random_check;
61 CtkWidget *loop_check;
62 CtkWidget *seconds_spin;
63
64 CtkWidget *plugin_manager;
65};
66
67static GObject *instance = NULL((void*)0);
68
69G_DEFINE_TYPE_WITH_PRIVATE (EocPreferencesDialog, eoc_preferences_dialog, CTK_TYPE_DIALOG)static void eoc_preferences_dialog_init (EocPreferencesDialog
*self); static void eoc_preferences_dialog_class_init (EocPreferencesDialogClass
*klass); static GType eoc_preferences_dialog_get_type_once (
void); static gpointer eoc_preferences_dialog_parent_class = (
(void*)0); static gint EocPreferencesDialog_private_offset; static
void eoc_preferences_dialog_class_intern_init (gpointer klass
) { eoc_preferences_dialog_parent_class = g_type_class_peek_parent
(klass); if (EocPreferencesDialog_private_offset != 0) g_type_class_adjust_private_offset
(klass, &EocPreferencesDialog_private_offset); eoc_preferences_dialog_class_init
((EocPreferencesDialogClass*) klass); } __attribute__ ((__unused__
)) static inline gpointer eoc_preferences_dialog_get_instance_private
(EocPreferencesDialog *self) { return (((gpointer) ((guint8*
) (self) + (glong) (EocPreferencesDialog_private_offset)))); }
GType eoc_preferences_dialog_get_type (void) { static GType static_g_define_type_id
= 0; if ((__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); (void
) (0 ? (gpointer) * (&static_g_define_type_id) : ((void*)
0)); (!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); __typeof__
(*(&static_g_define_type_id)) gapg_temp_newval; __typeof__
((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter_pointer (
&static_g_define_type_id)); })) ) { GType g_define_type_id
= eoc_preferences_dialog_get_type_once (); (__extension__ ({
_Static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); 0 ? (void) (*(
&static_g_define_type_id) = (g_define_type_id)) : (void) 0
; g_once_init_leave_pointer ((&static_g_define_type_id), (
gpointer) (guintptr) (g_define_type_id)); })) ; } return static_g_define_type_id
; } __attribute__ ((__noinline__)) static GType eoc_preferences_dialog_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((ctk_dialog_get_type ()), g_intern_static_string ("EocPreferencesDialog"
), sizeof (EocPreferencesDialogClass), (GClassInitFunc)(void (
*)(void)) eoc_preferences_dialog_class_intern_init, sizeof (EocPreferencesDialog
), (GInstanceInitFunc)(void (*)(void)) eoc_preferences_dialog_init
, (GTypeFlags) 0); { {{ EocPreferencesDialog_private_offset =
g_type_add_instance_private (g_define_type_id, sizeof (EocPreferencesDialogPrivate
)); };} } return g_define_type_id; }
;
70
71static gboolean
72pd_string_to_rgba_mapping (GValue *value,
73 GVariant *variant,
74 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
75{
76 CdkRGBA color;
77
78 g_return_val_if_fail (g_variant_is_of_type (variant, G_VARIANT_TYPE_STRING), FALSE)do { if ((g_variant_is_of_type (variant, ((const GVariantType
*) "s")))) { } else { g_return_if_fail_warning ("EOC", ((const
char*) (__func__)), "g_variant_is_of_type (variant, G_VARIANT_TYPE_STRING)"
); return ((0)); } } while (0)
;
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
79
80 if (cdk_rgba_parse (&color, g_variant_get_string (variant, NULL((void*)0)))) {
81 g_value_set_boxed (value, &color);
82 return TRUE(!(0));
83 }
84
85 return FALSE(0);
86}
87
88static GVariant*
89pd_rgba_to_string_mapping (const GValue *value,
90 const GVariantType *expected_type,
91 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
92{
93
94 GVariant *variant = NULL((void*)0);
95 CdkRGBA *color;
96 gchar *hex_val;
97
98 g_return_val_if_fail (G_VALUE_TYPE (value) == CDK_TYPE_RGBA, NULL)do { if (((((GValue*) (value))->g_type) == (cdk_rgba_get_type
()))) { } else { g_return_if_fail_warning ("EOC", ((const char
*) (__func__)), "G_VALUE_TYPE (value) == CDK_TYPE_RGBA"); return
(((void*)0)); } } while (0)
;
99 g_return_val_if_fail (g_variant_type_equal (expected_type, G_VARIANT_TYPE_STRING), NULL)do { if ((g_variant_type_equal (expected_type, ((const GVariantType
*) "s")))) { } else { g_return_if_fail_warning ("EOC", ((const
char*) (__func__)), "g_variant_type_equal (expected_type, G_VARIANT_TYPE_STRING)"
); return (((void*)0)); } } while (0)
;
100
101 color = g_value_get_boxed (value);
102 hex_val = cdk_rgba_to_string(color);
103
104 variant = g_variant_new_string (hex_val);
105 g_free (hex_val);
106
107 return variant;
108}
109
110static void
111pd_transp_radio_toggle_cb (CtkWidget *widget, gpointer data)
112{
113 gpointer value = NULL((void*)0);
114
115 if (!ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (widget)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_toggle_button_get_type ()))))))
))
116 return;
117
118 value = g_object_get_data (G_OBJECT (widget)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), (((GType) ((20) << (2))))))))
, GSETTINGS_OBJECT_VALUE"GSETTINGS_VALUE");
119
120 g_settings_set_enum (G_SETTINGS (data)((((GSettings*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((g_settings_get_type ()))))))
, EOC_CONF_VIEW_TRANSPARENCY"transparency",
121 GPOINTER_TO_INT (value)((gint) (glong) (value)));
122}
123
124static void
125random_change_cb (GSettings *settings, gchar *key, CtkWidget *widget)
126{
127 ctk_widget_set_sensitive (widget, !g_settings_get_boolean (settings, key));
128}
129
130static void
131eoc_preferences_response_cb (CtkDialog *dlg,
132 gint res_id,
133 gpointer data G_GNUC_UNUSED__attribute__ ((__unused__)))
134{
135 switch (res_id) {
136 case CTK_RESPONSE_HELP:
137 eoc_util_show_help ("eoc-prefs", NULL((void*)0));
138 break;
139 default:
140 ctk_widget_destroy (CTK_WIDGET (dlg)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dlg)), ((ctk_widget_get_type ()))))))
);
141 instance = NULL((void*)0);
142 }
143}
144
145static void
146eoc_preferences_dialog_class_init (EocPreferencesDialogClass *klass)
147{
148 CtkWidgetClass *widget_class = (CtkWidgetClass*) klass;
149
150 /* This should make sure the libbean-ctk dependency isn't
151 * dropped by aggressive linkers (#739618) */
152 g_type_ensure (BEAN_CTK_TYPE_PLUGIN_MANAGER(bean_ctk_plugin_manager_get_type()));
153
154 ctk_widget_class_set_template_from_resource (widget_class,
155 "/org/cafe/eoc/ui/eoc-preferences-dialog.ui");
156 ctk_widget_class_bind_template_child_private (widget_class,ctk_widget_class_bind_template_child_full (widget_class, "interpolate_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, interpolate_check)))))
157 EocPreferencesDialog,ctk_widget_class_bind_template_child_full (widget_class, "interpolate_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, interpolate_check)))))
158 interpolate_check)ctk_widget_class_bind_template_child_full (widget_class, "interpolate_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, interpolate_check)))))
;
159 ctk_widget_class_bind_template_child_private (widget_class,ctk_widget_class_bind_template_child_full (widget_class, "extrapolate_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, extrapolate_check)))))
160 EocPreferencesDialog,ctk_widget_class_bind_template_child_full (widget_class, "extrapolate_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, extrapolate_check)))))
161 extrapolate_check)ctk_widget_class_bind_template_child_full (widget_class, "extrapolate_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, extrapolate_check)))))
;
162 ctk_widget_class_bind_template_child_private (widget_class,ctk_widget_class_bind_template_child_full (widget_class, "autorotate_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, autorotate_check)))))
163 EocPreferencesDialog,ctk_widget_class_bind_template_child_full (widget_class, "autorotate_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, autorotate_check)))))
164 autorotate_check)ctk_widget_class_bind_template_child_full (widget_class, "autorotate_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, autorotate_check)))))
;
165 ctk_widget_class_bind_template_child_private (widget_class,ctk_widget_class_bind_template_child_full (widget_class, "bg_color_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, bg_color_check)))))
166 EocPreferencesDialog,ctk_widget_class_bind_template_child_full (widget_class, "bg_color_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, bg_color_check)))))
167 bg_color_check)ctk_widget_class_bind_template_child_full (widget_class, "bg_color_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, bg_color_check)))))
;
168 ctk_widget_class_bind_template_child_private (widget_class,ctk_widget_class_bind_template_child_full (widget_class, "bg_color_button"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, bg_color_button)))))
169 EocPreferencesDialog,ctk_widget_class_bind_template_child_full (widget_class, "bg_color_button"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, bg_color_button)))))
170 bg_color_button)ctk_widget_class_bind_template_child_full (widget_class, "bg_color_button"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, bg_color_button)))))
;
171 ctk_widget_class_bind_template_child_private (widget_class,ctk_widget_class_bind_template_child_full (widget_class, "color_radio"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, color_radio)))))
172 EocPreferencesDialog,ctk_widget_class_bind_template_child_full (widget_class, "color_radio"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, color_radio)))))
173 color_radio)ctk_widget_class_bind_template_child_full (widget_class, "color_radio"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, color_radio)))))
;
174 ctk_widget_class_bind_template_child_private (widget_class,ctk_widget_class_bind_template_child_full (widget_class, "checkpattern_radio"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, checkpattern_radio)))))
175 EocPreferencesDialog,ctk_widget_class_bind_template_child_full (widget_class, "checkpattern_radio"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, checkpattern_radio)))))
176 checkpattern_radio)ctk_widget_class_bind_template_child_full (widget_class, "checkpattern_radio"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, checkpattern_radio)))))
;
177 ctk_widget_class_bind_template_child_private (widget_class,ctk_widget_class_bind_template_child_full (widget_class, "background_radio"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, background_radio)))))
178 EocPreferencesDialog,ctk_widget_class_bind_template_child_full (widget_class, "background_radio"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, background_radio)))))
179 background_radio)ctk_widget_class_bind_template_child_full (widget_class, "background_radio"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, background_radio)))))
;
180 ctk_widget_class_bind_template_child_private (widget_class,ctk_widget_class_bind_template_child_full (widget_class, "transp_color_button"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, transp_color_button)))))
181 EocPreferencesDialog,ctk_widget_class_bind_template_child_full (widget_class, "transp_color_button"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, transp_color_button)))))
182 transp_color_button)ctk_widget_class_bind_template_child_full (widget_class, "transp_color_button"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, transp_color_button)))))
;
183
184 ctk_widget_class_bind_template_child_private (widget_class,ctk_widget_class_bind_template_child_full (widget_class, "upscale_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, upscale_check)))))
185 EocPreferencesDialog,ctk_widget_class_bind_template_child_full (widget_class, "upscale_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, upscale_check)))))
186 upscale_check)ctk_widget_class_bind_template_child_full (widget_class, "upscale_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, upscale_check)))))
;
187 ctk_widget_class_bind_template_child_private (widget_class,ctk_widget_class_bind_template_child_full (widget_class, "random_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, random_check)))))
188 EocPreferencesDialog,ctk_widget_class_bind_template_child_full (widget_class, "random_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, random_check)))))
189 random_check)ctk_widget_class_bind_template_child_full (widget_class, "random_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, random_check)))))
;
190 ctk_widget_class_bind_template_child_private (widget_class,ctk_widget_class_bind_template_child_full (widget_class, "loop_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, loop_check)))))
191 EocPreferencesDialog,ctk_widget_class_bind_template_child_full (widget_class, "loop_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, loop_check)))))
192 loop_check)ctk_widget_class_bind_template_child_full (widget_class, "loop_check"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, loop_check)))))
;
193 ctk_widget_class_bind_template_child_private (widget_class,ctk_widget_class_bind_template_child_full (widget_class, "seconds_spin"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, seconds_spin)))))
194 EocPreferencesDialog,ctk_widget_class_bind_template_child_full (widget_class, "seconds_spin"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, seconds_spin)))))
195 seconds_spin)ctk_widget_class_bind_template_child_full (widget_class, "seconds_spin"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, seconds_spin)))))
;
196
197 ctk_widget_class_bind_template_child_private (widget_class,ctk_widget_class_bind_template_child_full (widget_class, "plugin_manager"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, plugin_manager)))))
198 EocPreferencesDialog,ctk_widget_class_bind_template_child_full (widget_class, "plugin_manager"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, plugin_manager)))))
199 plugin_manager)ctk_widget_class_bind_template_child_full (widget_class, "plugin_manager"
, (0), (EocPreferencesDialog_private_offset + (((glong) __builtin_offsetof
(EocPreferencesDialogPrivate, plugin_manager)))))
;
200}
201
202static void
203eoc_preferences_dialog_init (EocPreferencesDialog *pref_dlg)
204{
205 EocPreferencesDialogPrivate *priv;
206
207 pref_dlg->priv = eoc_preferences_dialog_get_instance_private (pref_dlg);
208 priv = pref_dlg->priv;
209
210 ctk_widget_init_template (CTK_WIDGET (pref_dlg)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pref_dlg)), ((ctk_widget_get_type ()))))))
);
211
212 priv->view_settings = g_settings_new (EOC_CONF_VIEW"org.cafe.eoc"".view");
213 priv->fullscreen_settings = g_settings_new (EOC_CONF_FULLSCREEN"org.cafe.eoc"".full-screen");
214
215 g_signal_connect (G_OBJECT (pref_dlg),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pref_dlg)), (((GType) ((20) << (2)
)))))))), ("response"), (((GCallback) (eoc_preferences_response_cb
))), (pref_dlg), ((void*)0), (GConnectFlags) 0)
216 "response",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pref_dlg)), (((GType) ((20) << (2)
)))))))), ("response"), (((GCallback) (eoc_preferences_response_cb
))), (pref_dlg), ((void*)0), (GConnectFlags) 0)
217 G_CALLBACK (eoc_preferences_response_cb),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pref_dlg)), (((GType) ((20) << (2)
)))))))), ("response"), (((GCallback) (eoc_preferences_response_cb
))), (pref_dlg), ((void*)0), (GConnectFlags) 0)
218 pref_dlg)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((pref_dlg)), (((GType) ((20) << (2)
)))))))), ("response"), (((GCallback) (eoc_preferences_response_cb
))), (pref_dlg), ((void*)0), (GConnectFlags) 0)
;
219
220 g_settings_bind (priv->view_settings,
221 EOC_CONF_VIEW_INTERPOLATE"interpolate",
222 priv->interpolate_check, "active",
223 G_SETTINGS_BIND_DEFAULT);
224 g_settings_bind (priv->view_settings,
225 EOC_CONF_VIEW_EXTRAPOLATE"extrapolate",
226 priv->extrapolate_check, "active",
227 G_SETTINGS_BIND_DEFAULT);
228 g_settings_bind (priv->view_settings,
229 EOC_CONF_VIEW_AUTOROTATE"autorotate",
230 priv->autorotate_check, "active",
231 G_SETTINGS_BIND_DEFAULT);
232 g_settings_bind (priv->view_settings,
233 EOC_CONF_VIEW_USE_BG_COLOR"use-background-color",
234 priv->bg_color_check, "active",
235 G_SETTINGS_BIND_DEFAULT);
236
237 g_settings_bind_with_mapping (priv->view_settings,
238 EOC_CONF_VIEW_BACKGROUND_COLOR"background-color",
239 priv->bg_color_button, "rgba",
240 G_SETTINGS_BIND_DEFAULT,
241 pd_string_to_rgba_mapping,
242 pd_rgba_to_string_mapping,
243 NULL((void*)0), NULL((void*)0));
244 g_object_set_data (G_OBJECT (priv->color_radio)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->color_radio)), (((GType) ((20) << (2)))))
)))
,
245 GSETTINGS_OBJECT_VALUE"GSETTINGS_VALUE",
246 GINT_TO_POINTER (EOC_TRANSP_COLOR)((gpointer) (glong) (EOC_TRANSP_COLOR)));
247
248 g_signal_connect (G_OBJECT (priv->color_radio),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->color_radio)), (((GType) ((20) <<
(2))))))))), ("toggled"), (((GCallback) (pd_transp_radio_toggle_cb
))), (priv->view_settings), ((void*)0), (GConnectFlags) 0)
249 "toggled",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->color_radio)), (((GType) ((20) <<
(2))))))))), ("toggled"), (((GCallback) (pd_transp_radio_toggle_cb
))), (priv->view_settings), ((void*)0), (GConnectFlags) 0)
250 G_CALLBACK (pd_transp_radio_toggle_cb),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->color_radio)), (((GType) ((20) <<
(2))))))))), ("toggled"), (((GCallback) (pd_transp_radio_toggle_cb
))), (priv->view_settings), ((void*)0), (GConnectFlags) 0)
251 priv->view_settings)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->color_radio)), (((GType) ((20) <<
(2))))))))), ("toggled"), (((GCallback) (pd_transp_radio_toggle_cb
))), (priv->view_settings), ((void*)0), (GConnectFlags) 0)
;
252
253 g_object_set_data (G_OBJECT (priv->checkpattern_radio)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->checkpattern_radio)), (((GType) ((20) << (
2))))))))
,
254 GSETTINGS_OBJECT_VALUE"GSETTINGS_VALUE",
255 GINT_TO_POINTER (EOC_TRANSP_CHECKED)((gpointer) (glong) (EOC_TRANSP_CHECKED)));
256
257 g_signal_connect (G_OBJECT (priv->checkpattern_radio),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->checkpattern_radio)), (((GType)
((20) << (2))))))))), ("toggled"), (((GCallback) (pd_transp_radio_toggle_cb
))), (priv->view_settings), ((void*)0), (GConnectFlags) 0)
258 "toggled",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->checkpattern_radio)), (((GType)
((20) << (2))))))))), ("toggled"), (((GCallback) (pd_transp_radio_toggle_cb
))), (priv->view_settings), ((void*)0), (GConnectFlags) 0)
259 G_CALLBACK (pd_transp_radio_toggle_cb),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->checkpattern_radio)), (((GType)
((20) << (2))))))))), ("toggled"), (((GCallback) (pd_transp_radio_toggle_cb
))), (priv->view_settings), ((void*)0), (GConnectFlags) 0)
260 priv->view_settings)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->checkpattern_radio)), (((GType)
((20) << (2))))))))), ("toggled"), (((GCallback) (pd_transp_radio_toggle_cb
))), (priv->view_settings), ((void*)0), (GConnectFlags) 0)
;
261
262 g_object_set_data (G_OBJECT (priv->background_radio)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->background_radio)), (((GType) ((20) << (2
))))))))
,
263 GSETTINGS_OBJECT_VALUE"GSETTINGS_VALUE",
264 GINT_TO_POINTER (EOC_TRANSP_BACKGROUND)((gpointer) (glong) (EOC_TRANSP_BACKGROUND)));
265
266 g_signal_connect (G_OBJECT (priv->background_radio),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->background_radio)), (((GType) (
(20) << (2))))))))), ("toggled"), (((GCallback) (pd_transp_radio_toggle_cb
))), (priv->view_settings), ((void*)0), (GConnectFlags) 0)
267 "toggled",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->background_radio)), (((GType) (
(20) << (2))))))))), ("toggled"), (((GCallback) (pd_transp_radio_toggle_cb
))), (priv->view_settings), ((void*)0), (GConnectFlags) 0)
268 G_CALLBACK (pd_transp_radio_toggle_cb),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->background_radio)), (((GType) (
(20) << (2))))))))), ("toggled"), (((GCallback) (pd_transp_radio_toggle_cb
))), (priv->view_settings), ((void*)0), (GConnectFlags) 0)
269 priv->view_settings)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((priv->background_radio)), (((GType) (
(20) << (2))))))))), ("toggled"), (((GCallback) (pd_transp_radio_toggle_cb
))), (priv->view_settings), ((void*)0), (GConnectFlags) 0)
;
270
271 switch (g_settings_get_enum (priv->view_settings,
272 EOC_CONF_VIEW_TRANSPARENCY"transparency"))
273 {
274 case EOC_TRANSP_COLOR:
275 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (priv->color_radio)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->color_radio)), ((ctk_toggle_button_get_type ())
)))))
, TRUE(!(0)));
276 break;
277 case EOC_TRANSP_CHECKED:
278 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (priv->checkpattern_radio)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->checkpattern_radio)), ((ctk_toggle_button_get_type
()))))))
, TRUE(!(0)));
279 break;
280 default:
281 // Log a warning and use EOC_TRANSP_BACKGROUND as fallback
282 g_warn_if_reached ()do { g_warn_message ("EOC", "eoc-preferences-dialog.c", 282, (
(const char*) (__func__)), ((void*)0)); } while (0)
;
283 case EOC_TRANSP_BACKGROUND:
284 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (priv->background_radio)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((priv->background_radio)), ((ctk_toggle_button_get_type
()))))))
, TRUE(!(0)));
285 break;
286 }
287
288 g_settings_bind_with_mapping (priv->view_settings,
289 EOC_CONF_VIEW_TRANS_COLOR"trans-color",
290 priv->transp_color_button, "rgba",
291 G_SETTINGS_BIND_DEFAULT,
292 pd_string_to_rgba_mapping,
293 pd_rgba_to_string_mapping,
294 NULL((void*)0), NULL((void*)0));
295
296 g_settings_bind (priv->fullscreen_settings, EOC_CONF_FULLSCREEN_UPSCALE"upscale",
297 priv->upscale_check, "active",
298 G_SETTINGS_BIND_DEFAULT);
299
300 g_settings_bind (priv->fullscreen_settings,
301 EOC_CONF_FULLSCREEN_LOOP"loop",
302 priv->loop_check, "active",
303 G_SETTINGS_BIND_DEFAULT);
304
305 g_settings_bind (priv->fullscreen_settings,
306 EOC_CONF_FULLSCREEN_RANDOM"random",
307 priv->random_check, "active",
308 G_SETTINGS_BIND_DEFAULT);
309 g_signal_connect (priv->fullscreen_settings,g_signal_connect_data ((priv->fullscreen_settings), ("changed::"
"random"), (((GCallback) (random_change_cb))), (priv->loop_check
), ((void*)0), (GConnectFlags) 0)
310 "changed::" EOC_CONF_FULLSCREEN_RANDOM,g_signal_connect_data ((priv->fullscreen_settings), ("changed::"
"random"), (((GCallback) (random_change_cb))), (priv->loop_check
), ((void*)0), (GConnectFlags) 0)
311 G_CALLBACK (random_change_cb),g_signal_connect_data ((priv->fullscreen_settings), ("changed::"
"random"), (((GCallback) (random_change_cb))), (priv->loop_check
), ((void*)0), (GConnectFlags) 0)
312 priv->loop_check)g_signal_connect_data ((priv->fullscreen_settings), ("changed::"
"random"), (((GCallback) (random_change_cb))), (priv->loop_check
), ((void*)0), (GConnectFlags) 0)
;
313 random_change_cb (priv->fullscreen_settings,
314 EOC_CONF_FULLSCREEN_RANDOM"random",
315 priv->loop_check);
316
317 g_settings_bind (priv->fullscreen_settings,
318 EOC_CONF_FULLSCREEN_SECONDS"seconds",
319 priv->seconds_spin, "value",
320 G_SETTINGS_BIND_DEFAULT);
321
322 ctk_widget_show_all (priv->plugin_manager);
323}
324
325CtkWidget *eoc_preferences_dialog_get_instance (CtkWindow *parent)
326{
327 if (instance == NULL((void*)0)) {
328 instance = g_object_new (EOC_TYPE_PREFERENCES_DIALOG(eoc_preferences_dialog_get_type ()),
329 NULL((void*)0));
330 }
331
332 if (parent)
333 ctk_window_set_transient_for (CTK_WINDOW (instance)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((instance)), ((ctk_window_get_type ()))))))
, parent);
334
335 return CTK_WIDGET(instance)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((instance)), ((ctk_widget_get_type ()))))))
;
336}