File: | ctk/ctkbuiltinicon.c |
Warning: | line 125, column 25 Dereference of null pointer (loaded from variable 'minimum_baseline') |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* | |||
2 | * Copyright © 2015 Red Hat Inc. | |||
3 | * | |||
4 | * This library is free software; you can redistribute it and/or | |||
5 | * modify it under the terms of the GNU Lesser General Public | |||
6 | * License as published by the Free Software Foundation; either | |||
7 | * version 2.1 of the License, or (at your option) any later version. | |||
8 | * | |||
9 | * This library 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 GNU | |||
12 | * Lesser General Public License for more details. | |||
13 | * | |||
14 | * You should have received a copy of the GNU Lesser General Public | |||
15 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | |||
16 | * | |||
17 | * Authors: Benjamin Otte <otte@gnome.org> | |||
18 | */ | |||
19 | ||||
20 | #include "config.h" | |||
21 | ||||
22 | #include "ctkbuiltiniconprivate.h" | |||
23 | ||||
24 | #include "ctkcssnodeprivate.h" | |||
25 | #include "ctkcssnumbervalueprivate.h" | |||
26 | #include "ctkrendericonprivate.h" | |||
27 | ||||
28 | /* CtkBuiltinIcon is a gadget implementation that is meant to replace | |||
29 | * all calls to ctk_render_ functions to render arrows, expanders, checks | |||
30 | * radios, handles, separators, etc. See the CtkCssImageBuiltinType | |||
31 | * enumeration for the full set of builtin icons that this gadget can | |||
32 | * render. | |||
33 | * | |||
34 | * Use ctk_builtin_icon_set_image to set which of the builtin icons | |||
35 | * is rendered. | |||
36 | * | |||
37 | * Use ctk_builtin_icon_set_default_size to set a non-zero default | |||
38 | * size for the icon. If you need to support a legacy size style property, | |||
39 | * use ctk_builtin_icon_set_default_size_property. | |||
40 | * | |||
41 | * Themes can override the acutal image that is used with the | |||
42 | * -ctk-icon-source property. If it is not specified, a builtin | |||
43 | * fallback is used. | |||
44 | */ | |||
45 | ||||
46 | typedef struct _CtkBuiltinIconPrivate CtkBuiltinIconPrivate; | |||
47 | struct _CtkBuiltinIconPrivate { | |||
48 | CtkCssImageBuiltinType image_type; | |||
49 | int default_size; | |||
50 | int strikethrough; | |||
51 | gboolean strikethrough_valid; | |||
52 | char * default_size_property; | |||
53 | }; | |||
54 | ||||
55 | G_DEFINE_TYPE_WITH_CODE (CtkBuiltinIcon, ctk_builtin_icon, CTK_TYPE_CSS_GADGET,static void ctk_builtin_icon_init (CtkBuiltinIcon *self); static void ctk_builtin_icon_class_init (CtkBuiltinIconClass *klass ); static GType ctk_builtin_icon_get_type_once (void); static gpointer ctk_builtin_icon_parent_class = ((void*)0); static gint CtkBuiltinIcon_private_offset; static void ctk_builtin_icon_class_intern_init (gpointer klass) { ctk_builtin_icon_parent_class = g_type_class_peek_parent (klass); if (CtkBuiltinIcon_private_offset != 0) g_type_class_adjust_private_offset (klass, &CtkBuiltinIcon_private_offset); ctk_builtin_icon_class_init ((CtkBuiltinIconClass*) klass); } __attribute__ ((__unused__ )) static inline gpointer ctk_builtin_icon_get_instance_private (CtkBuiltinIcon *self) { return (((gpointer) ((guint8*) (self ) + (glong) (CtkBuiltinIcon_private_offset)))); } GType ctk_builtin_icon_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 = ctk_builtin_icon_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 ctk_builtin_icon_get_type_once ( void) { GType g_define_type_id = g_type_register_static_simple ((ctk_css_gadget_get_type ()), g_intern_static_string ("CtkBuiltinIcon" ), sizeof (CtkBuiltinIconClass), (GClassInitFunc)(void (*)(void )) ctk_builtin_icon_class_intern_init, sizeof (CtkBuiltinIcon ), (GInstanceInitFunc)(void (*)(void)) ctk_builtin_icon_init, (GTypeFlags) 0); { {{ CtkBuiltinIcon_private_offset = g_type_add_instance_private (g_define_type_id, sizeof (CtkBuiltinIconPrivate)); };} } return g_define_type_id; } | |||
56 | G_ADD_PRIVATE (CtkBuiltinIcon))static void ctk_builtin_icon_init (CtkBuiltinIcon *self); static void ctk_builtin_icon_class_init (CtkBuiltinIconClass *klass ); static GType ctk_builtin_icon_get_type_once (void); static gpointer ctk_builtin_icon_parent_class = ((void*)0); static gint CtkBuiltinIcon_private_offset; static void ctk_builtin_icon_class_intern_init (gpointer klass) { ctk_builtin_icon_parent_class = g_type_class_peek_parent (klass); if (CtkBuiltinIcon_private_offset != 0) g_type_class_adjust_private_offset (klass, &CtkBuiltinIcon_private_offset); ctk_builtin_icon_class_init ((CtkBuiltinIconClass*) klass); } __attribute__ ((__unused__ )) static inline gpointer ctk_builtin_icon_get_instance_private (CtkBuiltinIcon *self) { return (((gpointer) ((guint8*) (self ) + (glong) (CtkBuiltinIcon_private_offset)))); } GType ctk_builtin_icon_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 = ctk_builtin_icon_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 ctk_builtin_icon_get_type_once ( void) { GType g_define_type_id = g_type_register_static_simple ((ctk_css_gadget_get_type ()), g_intern_static_string ("CtkBuiltinIcon" ), sizeof (CtkBuiltinIconClass), (GClassInitFunc)(void (*)(void )) ctk_builtin_icon_class_intern_init, sizeof (CtkBuiltinIcon ), (GInstanceInitFunc)(void (*)(void)) ctk_builtin_icon_init, (GTypeFlags) 0); { {{ CtkBuiltinIcon_private_offset = g_type_add_instance_private (g_define_type_id, sizeof (CtkBuiltinIconPrivate)); };} } return g_define_type_id; } | |||
57 | ||||
58 | static void | |||
59 | ctk_builtin_icon_get_preferred_size (CtkCssGadget *gadget, | |||
60 | CtkOrientation orientation, | |||
61 | gint for_size G_GNUC_UNUSED__attribute__ ((__unused__)), | |||
62 | gint *minimum, | |||
63 | gint *natural, | |||
64 | gint *minimum_baseline, | |||
65 | gint *natural_baseline) | |||
66 | { | |||
67 | CtkBuiltinIconPrivate *priv = ctk_builtin_icon_get_instance_private (CTK_BUILTIN_ICON (gadget)((((CtkBuiltinIcon*) (void *) g_type_check_instance_cast ((GTypeInstance *) (gadget), ((ctk_builtin_icon_get_type ()))))))); | |||
68 | double min_size; | |||
69 | guint property; | |||
70 | ||||
71 | if (orientation == CTK_ORIENTATION_HORIZONTAL) | |||
| ||||
72 | property = CTK_CSS_PROPERTY_MIN_WIDTH; | |||
73 | else | |||
74 | property = CTK_CSS_PROPERTY_MIN_HEIGHT; | |||
75 | min_size = _ctk_css_number_value_get (ctk_css_style_get_value (ctk_css_gadget_get_style (gadget), property), 100); | |||
76 | if (min_size > 0.0) | |||
77 | { | |||
78 | *minimum = *natural = min_size; | |||
79 | } | |||
80 | else if (priv->default_size_property) | |||
81 | { | |||
82 | GValue value = G_VALUE_INIT{ 0, { { 0 } } }; | |||
83 | ||||
84 | /* Do it a bit more complicated here so we get warnings when | |||
85 | * somebody sets a non-int proerty. | |||
86 | */ | |||
87 | g_value_init (&value, G_TYPE_INT((GType) ((6) << (2)))); | |||
88 | ctk_widget_style_get_property (ctk_css_gadget_get_owner (gadget), | |||
89 | priv->default_size_property, | |||
90 | &value); | |||
91 | *minimum = *natural = g_value_get_int (&value); | |||
92 | g_value_unset (&value); | |||
93 | } | |||
94 | else | |||
95 | { | |||
96 | *minimum = *natural = priv->default_size; | |||
97 | } | |||
98 | ||||
99 | if (minimum_baseline) | |||
100 | { | |||
101 | if (!priv->strikethrough_valid) | |||
102 | { | |||
103 | CtkWidget *widget; | |||
104 | PangoContext *pango_context; | |||
105 | const PangoFontDescription *font_desc; | |||
106 | PangoFontMetrics *metrics; | |||
107 | ||||
108 | widget = ctk_css_gadget_get_owner (gadget); | |||
109 | pango_context = ctk_widget_get_pango_context (widget); | |||
110 | font_desc = pango_context_get_font_description (pango_context); | |||
111 | ||||
112 | metrics = pango_context_get_metrics (pango_context, | |||
113 | font_desc, | |||
114 | pango_context_get_language (pango_context)); | |||
115 | priv->strikethrough = pango_font_metrics_get_strikethrough_position (metrics); | |||
116 | priv->strikethrough_valid = TRUE(!(0)); | |||
117 | ||||
118 | pango_font_metrics_unref (metrics); | |||
119 | } | |||
120 | ||||
121 | *minimum_baseline = *minimum * 0.5 + PANGO_PIXELS (priv->strikethrough)(((int)(priv->strikethrough) + 512) >> 10); | |||
122 | } | |||
123 | ||||
124 | if (natural_baseline) | |||
125 | *natural_baseline = *minimum_baseline; | |||
| ||||
126 | } | |||
127 | ||||
128 | static void | |||
129 | ctk_builtin_icon_allocate (CtkCssGadget *gadget, | |||
130 | const CtkAllocation *allocation, | |||
131 | int baseline, | |||
132 | CtkAllocation *out_clip) | |||
133 | { | |||
134 | CdkRectangle icon_clip; | |||
135 | ||||
136 | CTK_CSS_GADGET_CLASS (ctk_builtin_icon_parent_class)((((CtkCssGadgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) (ctk_builtin_icon_parent_class), ((ctk_css_gadget_get_type ()))))))->allocate (gadget, allocation, baseline, out_clip); | |||
137 | ||||
138 | ctk_css_style_render_icon_get_extents (ctk_css_gadget_get_style (gadget), | |||
139 | &icon_clip, | |||
140 | allocation->x, allocation->y, | |||
141 | allocation->width, allocation->height); | |||
142 | cdk_rectangle_union (out_clip, &icon_clip, out_clip); | |||
143 | } | |||
144 | ||||
145 | static gboolean | |||
146 | ctk_builtin_icon_draw (CtkCssGadget *gadget, | |||
147 | cairo_t *cr, | |||
148 | int x, | |||
149 | int y, | |||
150 | int width, | |||
151 | int height) | |||
152 | { | |||
153 | CtkBuiltinIconPrivate *priv = ctk_builtin_icon_get_instance_private (CTK_BUILTIN_ICON (gadget)((((CtkBuiltinIcon*) (void *) g_type_check_instance_cast ((GTypeInstance *) (gadget), ((ctk_builtin_icon_get_type ()))))))); | |||
154 | ||||
155 | ctk_css_style_render_icon (ctk_css_gadget_get_style (gadget), | |||
156 | cr, | |||
157 | x, y, | |||
158 | width, height, | |||
159 | priv->image_type); | |||
160 | ||||
161 | return FALSE(0); | |||
162 | } | |||
163 | ||||
164 | static void | |||
165 | ctk_builtin_icon_style_changed (CtkCssGadget *gadget, | |||
166 | CtkCssStyleChange *change) | |||
167 | { | |||
168 | CtkBuiltinIconPrivate *priv = ctk_builtin_icon_get_instance_private (CTK_BUILTIN_ICON (gadget)((((CtkBuiltinIcon*) (void *) g_type_check_instance_cast ((GTypeInstance *) (gadget), ((ctk_builtin_icon_get_type ()))))))); | |||
169 | ||||
170 | if (ctk_css_style_change_affects (change, CTK_CSS_AFFECTS_FONT)) | |||
171 | priv->strikethrough_valid = FALSE(0); | |||
172 | ||||
173 | CTK_CSS_GADGET_CLASS (ctk_builtin_icon_parent_class)((((CtkCssGadgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) (ctk_builtin_icon_parent_class), ((ctk_css_gadget_get_type ()))))))->style_changed (gadget, change); | |||
174 | } | |||
175 | ||||
176 | static void | |||
177 | ctk_builtin_icon_finalize (GObject *object) | |||
178 | { | |||
179 | CtkBuiltinIconPrivate *priv = ctk_builtin_icon_get_instance_private (CTK_BUILTIN_ICON (object)((((CtkBuiltinIcon*) (void *) g_type_check_instance_cast ((GTypeInstance *) (object), ((ctk_builtin_icon_get_type ()))))))); | |||
180 | ||||
181 | g_free (priv->default_size_property); | |||
182 | ||||
183 | G_OBJECT_CLASS (ctk_builtin_icon_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((ctk_builtin_icon_parent_class)), (((GType) ((20) << (2))))))))->finalize (object); | |||
184 | } | |||
185 | ||||
186 | static void | |||
187 | ctk_builtin_icon_class_init (CtkBuiltinIconClass *klass) | |||
188 | { | |||
189 | CtkCssGadgetClass *gadget_class = CTK_CSS_GADGET_CLASS (klass)((((CtkCssGadgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) (klass), ((ctk_css_gadget_get_type ())))))); | |||
190 | GObjectClass *object_class = G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((klass)), (((GType) ((20) << (2)))))))); | |||
191 | ||||
192 | object_class->finalize = ctk_builtin_icon_finalize; | |||
193 | ||||
194 | gadget_class->get_preferred_size = ctk_builtin_icon_get_preferred_size; | |||
195 | gadget_class->allocate = ctk_builtin_icon_allocate; | |||
196 | gadget_class->draw = ctk_builtin_icon_draw; | |||
197 | gadget_class->style_changed = ctk_builtin_icon_style_changed; | |||
198 | } | |||
199 | ||||
200 | static void | |||
201 | ctk_builtin_icon_init (CtkBuiltinIcon *custom_gadget G_GNUC_UNUSED__attribute__ ((__unused__))) | |||
202 | { | |||
203 | } | |||
204 | ||||
205 | CtkCssGadget * | |||
206 | ctk_builtin_icon_new_for_node (CtkCssNode *node, | |||
207 | CtkWidget *owner) | |||
208 | { | |||
209 | return g_object_new (CTK_TYPE_BUILTIN_ICON(ctk_builtin_icon_get_type ()), | |||
210 | "node", node, | |||
211 | "owner", owner, | |||
212 | NULL((void*)0)); | |||
213 | } | |||
214 | ||||
215 | CtkCssGadget * | |||
216 | ctk_builtin_icon_new (const char *name, | |||
217 | CtkWidget *owner, | |||
218 | CtkCssGadget *parent, | |||
219 | CtkCssGadget *next_sibling) | |||
220 | { | |||
221 | CtkCssNode *node; | |||
222 | CtkCssGadget *result; | |||
223 | ||||
224 | node = ctk_css_node_new (); | |||
225 | ctk_css_node_set_name (node, g_intern_string (name)); | |||
226 | if (parent) | |||
227 | ctk_css_node_insert_before (ctk_css_gadget_get_node (parent), | |||
228 | node, | |||
229 | next_sibling ? ctk_css_gadget_get_node (next_sibling) : NULL((void*)0)); | |||
230 | ||||
231 | result = ctk_builtin_icon_new_for_node (node, owner); | |||
232 | ||||
233 | g_object_unref (node); | |||
234 | ||||
235 | return result; | |||
236 | } | |||
237 | ||||
238 | void | |||
239 | ctk_builtin_icon_set_image (CtkBuiltinIcon *icon, | |||
240 | CtkCssImageBuiltinType image) | |||
241 | { | |||
242 | CtkBuiltinIconPrivate *priv; | |||
243 | ||||
244 | g_return_if_fail (CTK_IS_BUILTIN_ICON (icon))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) (icon); GType __t = ((ctk_builtin_icon_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__ )), "CTK_IS_BUILTIN_ICON (icon)"); return; } } while (0); | |||
245 | ||||
246 | priv = ctk_builtin_icon_get_instance_private (icon); | |||
247 | ||||
248 | if (priv->image_type != image) | |||
249 | { | |||
250 | priv->image_type = image; | |||
251 | ctk_widget_queue_draw (ctk_css_gadget_get_owner (CTK_CSS_GADGET (icon)((((CtkCssGadget*) (void *) g_type_check_instance_cast ((GTypeInstance *) (icon), ((ctk_css_gadget_get_type ())))))))); | |||
252 | } | |||
253 | } | |||
254 | ||||
255 | CtkCssImageBuiltinType | |||
256 | ctk_builtin_icon_get_image (CtkBuiltinIcon *icon) | |||
257 | { | |||
258 | CtkBuiltinIconPrivate *priv; | |||
259 | ||||
260 | g_return_val_if_fail (CTK_IS_BUILTIN_ICON (icon), CTK_CSS_IMAGE_BUILTIN_NONE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) (icon); GType __t = ((ctk_builtin_icon_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__ )), "CTK_IS_BUILTIN_ICON (icon)"); return (CTK_CSS_IMAGE_BUILTIN_NONE ); } } while (0); | |||
261 | ||||
262 | priv = ctk_builtin_icon_get_instance_private (icon); | |||
263 | ||||
264 | return priv->image_type; | |||
265 | } | |||
266 | ||||
267 | void | |||
268 | ctk_builtin_icon_set_default_size (CtkBuiltinIcon *icon, | |||
269 | int default_size) | |||
270 | { | |||
271 | CtkBuiltinIconPrivate *priv; | |||
272 | ||||
273 | g_return_if_fail (CTK_IS_BUILTIN_ICON (icon))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) (icon); GType __t = ((ctk_builtin_icon_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__ )), "CTK_IS_BUILTIN_ICON (icon)"); return; } } while (0); | |||
274 | ||||
275 | priv = ctk_builtin_icon_get_instance_private (icon); | |||
276 | ||||
277 | if (priv->default_size != default_size) | |||
278 | { | |||
279 | priv->default_size = default_size; | |||
280 | ctk_widget_queue_resize (ctk_css_gadget_get_owner (CTK_CSS_GADGET (icon)((((CtkCssGadget*) (void *) g_type_check_instance_cast ((GTypeInstance *) (icon), ((ctk_css_gadget_get_type ())))))))); | |||
281 | } | |||
282 | } | |||
283 | ||||
284 | int | |||
285 | ctk_builtin_icon_get_default_size (CtkBuiltinIcon *icon) | |||
286 | { | |||
287 | CtkBuiltinIconPrivate *priv; | |||
288 | ||||
289 | g_return_val_if_fail (CTK_IS_BUILTIN_ICON (icon), CTK_CSS_IMAGE_BUILTIN_NONE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) (icon); GType __t = ((ctk_builtin_icon_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__ )), "CTK_IS_BUILTIN_ICON (icon)"); return (CTK_CSS_IMAGE_BUILTIN_NONE ); } } while (0); | |||
290 | ||||
291 | priv = ctk_builtin_icon_get_instance_private (icon); | |||
292 | ||||
293 | return priv->default_size; | |||
294 | } | |||
295 | ||||
296 | /** | |||
297 | * ctk_builtin_icon_set_default_size_property: | |||
298 | * @icon: icon to set the property for | |||
299 | * @property_name: Name of the style property | |||
300 | * | |||
301 | * Sets the name of a widget style property to use to compute the default size | |||
302 | * of the icon. If it is set to no %NULL, it will be used instead of the value | |||
303 | * set via ctk_builtin_icon_set_default_size() to set the default size of the | |||
304 | * icon. | |||
305 | * | |||
306 | * @property_name must refer to a style property that is of integer type. | |||
307 | * | |||
308 | * This function is intended strictly for backwards compatibility reasons. | |||
309 | */ | |||
310 | void | |||
311 | ctk_builtin_icon_set_default_size_property (CtkBuiltinIcon *icon, | |||
312 | const char *property_name) | |||
313 | { | |||
314 | CtkBuiltinIconPrivate *priv; | |||
315 | ||||
316 | g_return_if_fail (CTK_IS_BUILTIN_ICON (icon))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) (icon); GType __t = ((ctk_builtin_icon_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__ )), "CTK_IS_BUILTIN_ICON (icon)"); return; } } while (0); | |||
317 | ||||
318 | priv = ctk_builtin_icon_get_instance_private (icon); | |||
319 | ||||
320 | if (g_strcmp0 (priv->default_size_property, property_name)) | |||
321 | { | |||
322 | priv->default_size_property = g_strdup (property_name)g_strdup_inline (property_name); | |||
323 | ctk_widget_queue_resize (ctk_css_gadget_get_owner (CTK_CSS_GADGET (icon)((((CtkCssGadget*) (void *) g_type_check_instance_cast ((GTypeInstance *) (icon), ((ctk_css_gadget_get_type ())))))))); | |||
324 | } | |||
325 | } | |||
326 | ||||
327 | const char * | |||
328 | ctk_builtin_icon_get_default_size_property (CtkBuiltinIcon *icon) | |||
329 | { | |||
330 | CtkBuiltinIconPrivate *priv; | |||
331 | ||||
332 | g_return_val_if_fail (CTK_IS_BUILTIN_ICON (icon), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) (icon); GType __t = ((ctk_builtin_icon_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__ )), "CTK_IS_BUILTIN_ICON (icon)"); return (((void*)0)); } } while (0); | |||
333 | ||||
334 | priv = ctk_builtin_icon_get_instance_private (icon); | |||
335 | ||||
336 | return priv->default_size_property; | |||
337 | } |