| File: | ctk/inspector/action-editor.c |
| Warning: | line 174, column 35 Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | /* |
| 2 | * Copyright (c) 2014 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 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 | |
| 18 | #include "config.h" |
| 19 | #include <glib/gi18n-lib.h> |
| 20 | |
| 21 | #include "action-editor.h" |
| 22 | |
| 23 | #include "ctksizegroup.h" |
| 24 | #include "ctktogglebutton.h" |
| 25 | #include "ctkentry.h" |
| 26 | #include "ctkbin.h" |
| 27 | #include "ctklabel.h" |
| 28 | |
| 29 | struct _CtkInspectorActionEditorPrivate |
| 30 | { |
| 31 | GActionGroup *group; |
| 32 | gchar *prefix; |
| 33 | gchar *name; |
| 34 | gboolean enabled; |
| 35 | const GVariantType *parameter_type; |
| 36 | GVariantType *state_type; |
| 37 | CtkWidget *activate_button; |
| 38 | CtkWidget *parameter_entry; |
| 39 | CtkWidget *state_entry; |
| 40 | CtkSizeGroup *sg; |
| 41 | }; |
| 42 | |
| 43 | enum |
| 44 | { |
| 45 | PROP_0, |
| 46 | PROP_GROUP, |
| 47 | PROP_PREFIX, |
| 48 | PROP_NAME |
| 49 | }; |
| 50 | |
| 51 | G_DEFINE_TYPE_WITH_PRIVATE (CtkInspectorActionEditor, ctk_inspector_action_editor, CTK_TYPE_BOX)static void ctk_inspector_action_editor_init (CtkInspectorActionEditor *self); static void ctk_inspector_action_editor_class_init ( CtkInspectorActionEditorClass *klass); static GType ctk_inspector_action_editor_get_type_once (void); static gpointer ctk_inspector_action_editor_parent_class = ((void*)0); static gint CtkInspectorActionEditor_private_offset ; static void ctk_inspector_action_editor_class_intern_init ( gpointer klass) { ctk_inspector_action_editor_parent_class = g_type_class_peek_parent (klass); if (CtkInspectorActionEditor_private_offset != 0) g_type_class_adjust_private_offset (klass, &CtkInspectorActionEditor_private_offset); ctk_inspector_action_editor_class_init ((CtkInspectorActionEditorClass*) klass); } __attribute__ (( __unused__)) static inline gpointer ctk_inspector_action_editor_get_instance_private (CtkInspectorActionEditor *self) { return (((gpointer) ((guint8 *) (self) + (glong) (CtkInspectorActionEditor_private_offset) ))); } GType ctk_inspector_action_editor_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_inspector_action_editor_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_inspector_action_editor_get_type_once (void) { GType g_define_type_id = g_type_register_static_simple ((ctk_box_get_type ()), g_intern_static_string ("CtkInspectorActionEditor" ), sizeof (CtkInspectorActionEditorClass), (GClassInitFunc)(void (*)(void)) ctk_inspector_action_editor_class_intern_init, sizeof (CtkInspectorActionEditor), (GInstanceInitFunc)(void (*)(void )) ctk_inspector_action_editor_init, (GTypeFlags) 0); { {{ CtkInspectorActionEditor_private_offset = g_type_add_instance_private (g_define_type_id, sizeof (CtkInspectorActionEditorPrivate )); };} } return g_define_type_id; } |
| 52 | |
| 53 | static void |
| 54 | ctk_inspector_action_editor_init (CtkInspectorActionEditor *editor) |
| 55 | { |
| 56 | editor->priv = ctk_inspector_action_editor_get_instance_private (editor); |
| 57 | g_object_set (editor, |
| 58 | "orientation", CTK_ORIENTATION_VERTICAL, |
| 59 | "spacing", 10, |
| 60 | "margin", 10, |
| 61 | NULL((void*)0)); |
| 62 | } |
| 63 | |
| 64 | typedef void (*VariantEditorChanged) (CtkWidget *editor, gpointer data); |
| 65 | |
| 66 | typedef struct { |
| 67 | CtkWidget *editor; |
| 68 | VariantEditorChanged callback; |
| 69 | gpointer data; |
| 70 | } VariantEditorData; |
| 71 | |
| 72 | static void |
| 73 | variant_editor_changed_cb (GObject *obj G_GNUC_UNUSED__attribute__ ((__unused__)), |
| 74 | GParamSpec *pspec G_GNUC_UNUSED__attribute__ ((__unused__)), |
| 75 | VariantEditorData *data) |
| 76 | { |
| 77 | data->callback (data->editor, data->data); |
| 78 | } |
| 79 | |
| 80 | static CtkWidget * |
| 81 | variant_editor_new (const GVariantType *type, |
| 82 | VariantEditorChanged callback, |
| 83 | gpointer data) |
| 84 | { |
| 85 | CtkWidget *editor; |
| 86 | CtkWidget *label; |
| 87 | CtkWidget *entry; |
| 88 | VariantEditorData *d; |
| 89 | |
| 90 | d = g_new (VariantEditorData, 1)((VariantEditorData *) g_malloc_n ((1), sizeof (VariantEditorData ))); |
| 91 | d->callback = callback; |
| 92 | d->data = data; |
| 93 | |
| 94 | if (g_variant_type_equal (type, G_VARIANT_TYPE_BOOLEAN((const GVariantType *) "b"))) |
| 95 | { |
| 96 | editor = ctk_toggle_button_new_with_label ("FALSE"); |
| 97 | g_signal_connect (editor, "notify::active", G_CALLBACK (variant_editor_changed_cb), d)g_signal_connect_data ((editor), ("notify::active"), (((GCallback ) (variant_editor_changed_cb))), (d), ((void*)0), (GConnectFlags ) 0); |
| 98 | } |
| 99 | else if (g_variant_type_equal (type, G_VARIANT_TYPE_STRING((const GVariantType *) "s"))) |
| 100 | { |
| 101 | editor = ctk_entry_new (); |
| 102 | g_signal_connect (editor, "notify::text", G_CALLBACK (variant_editor_changed_cb), d)g_signal_connect_data ((editor), ("notify::text"), (((GCallback ) (variant_editor_changed_cb))), (d), ((void*)0), (GConnectFlags ) 0); |
| 103 | } |
| 104 | else |
| 105 | { |
| 106 | editor = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 10); |
| 107 | entry = ctk_entry_new (); |
| 108 | ctk_container_add (CTK_CONTAINER (editor)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((editor)), ((ctk_container_get_type ())))))), entry); |
| 109 | label = ctk_label_new (g_variant_type_peek_string (type)); |
| 110 | ctk_container_add (CTK_CONTAINER (editor)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((editor)), ((ctk_container_get_type ())))))), label); |
| 111 | g_signal_connect (entry, "notify::text", G_CALLBACK (variant_editor_changed_cb), d)g_signal_connect_data ((entry), ("notify::text"), (((GCallback ) (variant_editor_changed_cb))), (d), ((void*)0), (GConnectFlags ) 0); |
| 112 | } |
| 113 | |
| 114 | g_object_set_data (G_OBJECT (editor)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((editor)), (((GType) ((20) << (2)))))))), "type", (gpointer)type); |
| 115 | d->editor = editor; |
| 116 | g_object_set_data_full (G_OBJECT (editor)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((editor)), (((GType) ((20) << (2)))))))), "callback", d, g_free); |
| 117 | |
| 118 | ctk_widget_show_all (editor); |
| 119 | |
| 120 | return editor; |
| 121 | } |
| 122 | |
| 123 | static void |
| 124 | variant_editor_set_value (CtkWidget *editor, |
| 125 | GVariant *value) |
| 126 | { |
| 127 | const GVariantType *type; |
| 128 | gpointer data; |
| 129 | |
| 130 | data = g_object_get_data (G_OBJECT (editor)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((editor)), (((GType) ((20) << (2)))))))), "callback"); |
| 131 | g_signal_handlers_block_by_func (editor, variant_editor_changed_cb, data)g_signal_handlers_block_matched ((editor), (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)0 ), (variant_editor_changed_cb), (data)); |
| 132 | |
| 133 | type = g_variant_get_type (value); |
| 134 | if (g_variant_type_equal (type, G_VARIANT_TYPE_BOOLEAN((const GVariantType *) "b"))) |
| 135 | { |
| 136 | CtkToggleButton *tb = CTK_TOGGLE_BUTTON (editor)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((editor)), ((ctk_toggle_button_get_type ())))))); |
| 137 | CtkWidget *child; |
| 138 | |
| 139 | ctk_toggle_button_set_active (tb, g_variant_get_boolean (value)); |
| 140 | child = ctk_bin_get_child (CTK_BIN (tb)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tb)), ((ctk_bin_get_type ()))))))); |
| 141 | ctk_label_set_text (CTK_LABEL (child)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((child)), ((ctk_label_get_type ())))))), |
| 142 | g_variant_get_boolean (value) ? "TRUE" : "FALSE"); |
| 143 | } |
| 144 | else if (g_variant_type_equal (type, G_VARIANT_TYPE_STRING((const GVariantType *) "s"))) |
| 145 | { |
| 146 | CtkEntry *entry = CTK_ENTRY (editor)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((editor)), ((ctk_entry_get_type ())))))); |
| 147 | ctk_entry_set_text (entry, g_variant_get_string (value, NULL((void*)0))); |
| 148 | } |
| 149 | else |
| 150 | { |
| 151 | GList *children; |
| 152 | CtkEntry *entry; |
| 153 | gchar *text; |
| 154 | |
| 155 | children = ctk_container_get_children (CTK_CONTAINER (editor)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((editor)), ((ctk_container_get_type ()))))))); |
| 156 | entry = children->data; |
| 157 | g_list_free (children); |
| 158 | |
| 159 | text = g_variant_print (value, FALSE(0)); |
| 160 | ctk_entry_set_text (entry, text); |
| 161 | g_free (text); |
| 162 | } |
| 163 | |
| 164 | g_signal_handlers_unblock_by_func (editor, variant_editor_changed_cb, data)g_signal_handlers_unblock_matched ((editor), (GSignalMatchType ) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*) 0), (variant_editor_changed_cb), (data)); |
| 165 | } |
| 166 | |
| 167 | static GVariant * |
| 168 | variant_editor_get_value (CtkWidget *editor) |
| 169 | { |
| 170 | const GVariantType *type; |
| 171 | GVariant *value; |
| 172 | |
| 173 | type = (const GVariantType *) g_object_get_data (G_OBJECT (editor)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((editor)), (((GType) ((20) << (2)))))))), "type"); |
| 174 | if (g_variant_type_equal (type, G_VARIANT_TYPE_BOOLEAN((const GVariantType *) "b"))) |
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption | |
| 175 | { |
| 176 | CtkToggleButton *tb = CTK_TOGGLE_BUTTON (editor)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((editor)), ((ctk_toggle_button_get_type ())))))); |
| 177 | value = g_variant_new_boolean (ctk_toggle_button_get_active (tb)); |
| 178 | } |
| 179 | else if (g_variant_type_equal (type, G_VARIANT_TYPE_STRING((const GVariantType *) "s"))) |
| 180 | { |
| 181 | CtkEntry *entry = CTK_ENTRY (editor)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((editor)), ((ctk_entry_get_type ())))))); |
| 182 | value = g_variant_new_string (ctk_entry_get_text (entry)); |
| 183 | } |
| 184 | else |
| 185 | { |
| 186 | GList *children; |
| 187 | CtkEntry *entry; |
| 188 | const gchar *text; |
| 189 | |
| 190 | children = ctk_container_get_children (CTK_CONTAINER (editor)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((editor)), ((ctk_container_get_type ()))))))); |
| 191 | entry = children->data; |
| 192 | text = ctk_entry_get_text (entry); |
| 193 | g_list_free (children); |
| 194 | |
| 195 | value = g_variant_parse (type, text, NULL((void*)0), NULL((void*)0), NULL((void*)0)); |
| 196 | } |
| 197 | |
| 198 | return value; |
| 199 | } |
| 200 | |
| 201 | static void |
| 202 | activate_action (CtkWidget *button G_GNUC_UNUSED__attribute__ ((__unused__)), |
| 203 | CtkInspectorActionEditor *r) |
| 204 | { |
| 205 | GVariant *parameter = NULL((void*)0); |
| 206 | |
| 207 | if (r->priv->parameter_entry) |
| 208 | parameter = variant_editor_get_value (r->priv->parameter_entry); |
| 209 | g_action_group_activate_action (r->priv->group, r->priv->name, parameter); |
| 210 | } |
| 211 | |
| 212 | static void |
| 213 | parameter_changed (CtkWidget *editor, |
| 214 | gpointer data) |
| 215 | { |
| 216 | CtkInspectorActionEditor *r = data; |
| 217 | GVariant *value; |
| 218 | |
| 219 | value = variant_editor_get_value (editor); |
| 220 | ctk_widget_set_sensitive (r->priv->activate_button, r->priv->enabled && value != NULL((void*)0)); |
| 221 | if (value) |
| 222 | g_variant_unref (value); |
| 223 | } |
| 224 | |
| 225 | static void |
| 226 | state_changed (CtkWidget *editor, |
| 227 | gpointer data) |
| 228 | { |
| 229 | CtkInspectorActionEditor *r = data; |
| 230 | GVariant *value; |
| 231 | |
| 232 | value = variant_editor_get_value (editor); |
| 233 | if (value) |
| 234 | g_action_group_change_action_state (r->priv->group, r->priv->name, value); |
| 235 | } |
| 236 | |
| 237 | static void |
| 238 | action_enabled_changed_cb (GActionGroup *group G_GNUC_UNUSED__attribute__ ((__unused__)), |
| 239 | const gchar *action_name G_GNUC_UNUSED__attribute__ ((__unused__)), |
| 240 | gboolean enabled, |
| 241 | CtkInspectorActionEditor *r) |
| 242 | { |
| 243 | r->priv->enabled = enabled; |
| 244 | if (r->priv->parameter_entry) |
| 245 | { |
| 246 | ctk_widget_set_sensitive (r->priv->parameter_entry, enabled); |
| 247 | parameter_changed (r->priv->parameter_entry, r); |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | static void |
| 252 | action_state_changed_cb (GActionGroup *group G_GNUC_UNUSED__attribute__ ((__unused__)), |
| 253 | const gchar *action_name G_GNUC_UNUSED__attribute__ ((__unused__)), |
| 254 | GVariant *state, |
| 255 | CtkInspectorActionEditor *r) |
| 256 | { |
| 257 | if (r->priv->state_entry) |
| 258 | variant_editor_set_value (r->priv->state_entry, state); |
| 259 | } |
| 260 | |
| 261 | static void |
| 262 | constructed (GObject *object) |
| 263 | { |
| 264 | CtkInspectorActionEditor *r = CTK_INSPECTOR_ACTION_EDITOR (object)((((CtkInspectorActionEditor*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((object)), ((ctk_inspector_action_editor_get_type ())))))); |
| 265 | GVariant *state; |
| 266 | gchar *fullname; |
| 267 | CtkWidget *row; |
| 268 | |
| 269 | r->priv->enabled = g_action_group_get_action_enabled (r->priv->group, r->priv->name); |
| 270 | state = g_action_group_get_action_state (r->priv->group, r->priv->name); |
| 271 | |
| 272 | fullname = g_strdup_printf ("%s.%s", r->priv->prefix, r->priv->name); |
| 273 | ctk_container_add (CTK_CONTAINER (r)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((r)), ((ctk_container_get_type ())))))), ctk_label_new (fullname)); |
| 274 | g_free (fullname); |
| 275 | |
| 276 | r->priv->sg = ctk_size_group_new (CTK_SIZE_GROUP_HORIZONTAL); |
| 277 | |
| 278 | row = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 10); |
| 279 | |
| 280 | r->priv->activate_button = ctk_button_new_with_label (_("Activate")((char *) g_dgettext ("ctk30", "Activate"))); |
| 281 | g_signal_connect (r->priv->activate_button, "clicked", G_CALLBACK (activate_action), r)g_signal_connect_data ((r->priv->activate_button), ("clicked" ), (((GCallback) (activate_action))), (r), ((void*)0), (GConnectFlags ) 0); |
| 282 | |
| 283 | ctk_size_group_add_widget (r->priv->sg, r->priv->activate_button); |
| 284 | ctk_widget_set_sensitive (r->priv->activate_button, r->priv->enabled); |
| 285 | ctk_container_add (CTK_CONTAINER (row)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((row)), ((ctk_container_get_type ())))))), r->priv->activate_button); |
| 286 | |
| 287 | r->priv->parameter_type = g_action_group_get_action_parameter_type (r->priv->group, r->priv->name); |
| 288 | if (r->priv->parameter_type) |
| 289 | { |
| 290 | r->priv->parameter_entry = variant_editor_new (r->priv->parameter_type, parameter_changed, r); |
| 291 | ctk_widget_set_sensitive (r->priv->parameter_entry, r->priv->enabled); |
| 292 | ctk_container_add (CTK_CONTAINER (row)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((row)), ((ctk_container_get_type ())))))), r->priv->parameter_entry); |
| 293 | } |
| 294 | |
| 295 | ctk_container_add (CTK_CONTAINER (r)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((r)), ((ctk_container_get_type ())))))), row); |
| 296 | |
| 297 | if (state) |
| 298 | { |
| 299 | CtkWidget *label; |
| 300 | |
| 301 | r->priv->state_type = g_variant_type_copy (g_variant_get_type (state)); |
| 302 | row = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 10); |
| 303 | label = ctk_label_new (_("State")((char *) g_dgettext ("ctk30", "State"))); |
| 304 | ctk_size_group_add_widget (r->priv->sg, label); |
| 305 | ctk_container_add (CTK_CONTAINER (row)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((row)), ((ctk_container_get_type ())))))), label); |
| 306 | r->priv->state_entry = variant_editor_new (r->priv->state_type, state_changed, r); |
| 307 | variant_editor_set_value (r->priv->state_entry, state); |
| 308 | ctk_container_add (CTK_CONTAINER (row)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((row)), ((ctk_container_get_type ())))))), r->priv->state_entry); |
| 309 | ctk_container_add (CTK_CONTAINER (r)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((r)), ((ctk_container_get_type ())))))), row); |
| 310 | } |
| 311 | |
| 312 | g_signal_connect (r->priv->group, "action-enabled-changed",g_signal_connect_data ((r->priv->group), ("action-enabled-changed" ), (((GCallback) (action_enabled_changed_cb))), (r), ((void*) 0), (GConnectFlags) 0) |
| 313 | G_CALLBACK (action_enabled_changed_cb), r)g_signal_connect_data ((r->priv->group), ("action-enabled-changed" ), (((GCallback) (action_enabled_changed_cb))), (r), ((void*) 0), (GConnectFlags) 0); |
| 314 | g_signal_connect (r->priv->group, "action-state-changed",g_signal_connect_data ((r->priv->group), ("action-state-changed" ), (((GCallback) (action_state_changed_cb))), (r), ((void*)0) , (GConnectFlags) 0) |
| 315 | G_CALLBACK (action_state_changed_cb), r)g_signal_connect_data ((r->priv->group), ("action-state-changed" ), (((GCallback) (action_state_changed_cb))), (r), ((void*)0) , (GConnectFlags) 0); |
| 316 | |
| 317 | ctk_widget_show_all (CTK_WIDGET (r)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((r)), ((ctk_widget_get_type ()))))))); |
| 318 | } |
| 319 | |
| 320 | static void |
| 321 | finalize (GObject *object) |
| 322 | { |
| 323 | CtkInspectorActionEditor *r = CTK_INSPECTOR_ACTION_EDITOR (object)((((CtkInspectorActionEditor*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((object)), ((ctk_inspector_action_editor_get_type ())))))); |
| 324 | |
| 325 | g_free (r->priv->prefix); |
| 326 | g_free (r->priv->name); |
| 327 | g_object_unref (r->priv->sg); |
| 328 | if (r->priv->state_type) |
| 329 | g_variant_type_free (r->priv->state_type); |
| 330 | g_signal_handlers_disconnect_by_func (r->priv->group, action_enabled_changed_cb, r)g_signal_handlers_disconnect_matched ((r->priv->group), (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA ), 0, 0, ((void*)0), (action_enabled_changed_cb), (r)); |
| 331 | g_signal_handlers_disconnect_by_func (r->priv->group, action_state_changed_cb, r)g_signal_handlers_disconnect_matched ((r->priv->group), (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA ), 0, 0, ((void*)0), (action_state_changed_cb), (r)); |
| 332 | |
| 333 | G_OBJECT_CLASS (ctk_inspector_action_editor_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((ctk_inspector_action_editor_parent_class)), (((GType) (( 20) << (2))))))))->finalize (object); |
| 334 | } |
| 335 | |
| 336 | static void |
| 337 | get_property (GObject *object, |
| 338 | guint param_id, |
| 339 | GValue *value, |
| 340 | GParamSpec *pspec) |
| 341 | { |
| 342 | CtkInspectorActionEditor *r = CTK_INSPECTOR_ACTION_EDITOR (object)((((CtkInspectorActionEditor*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((object)), ((ctk_inspector_action_editor_get_type ())))))); |
| 343 | |
| 344 | switch (param_id) |
| 345 | { |
| 346 | case PROP_GROUP: |
| 347 | g_value_set_object (value, r->priv->group); |
| 348 | break; |
| 349 | |
| 350 | case PROP_PREFIX: |
| 351 | g_value_set_string (value, r->priv->prefix); |
| 352 | break; |
| 353 | |
| 354 | case PROP_NAME: |
| 355 | g_value_set_string (value, r->priv->name); |
| 356 | break; |
| 357 | |
| 358 | default: |
| 359 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec *_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id = ((param_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'" , "inspector/action-editor.c", 359, ("property"), _glib__property_id , _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance *) (_glib__pspec))->g_class))->g_type)))), (g_type_name ((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class ))->g_type)))))); } while (0); |
| 360 | break; |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | static void |
| 365 | set_property (GObject *object, |
| 366 | guint param_id, |
| 367 | const GValue *value, |
| 368 | GParamSpec *pspec) |
| 369 | { |
| 370 | CtkInspectorActionEditor *r = CTK_INSPECTOR_ACTION_EDITOR (object)((((CtkInspectorActionEditor*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((object)), ((ctk_inspector_action_editor_get_type ())))))); |
| 371 | |
| 372 | switch (param_id) |
| 373 | { |
| 374 | case PROP_GROUP: |
| 375 | r->priv->group = g_value_get_object (value); |
| 376 | break; |
| 377 | |
| 378 | case PROP_PREFIX: |
| 379 | g_free (r->priv->prefix); |
| 380 | r->priv->prefix = g_value_dup_string (value); |
| 381 | break; |
| 382 | |
| 383 | case PROP_NAME: |
| 384 | g_free (r->priv->name); |
| 385 | r->priv->name = g_value_dup_string (value); |
| 386 | break; |
| 387 | |
| 388 | default: |
| 389 | G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec *_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id = ((param_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'" , "inspector/action-editor.c", 389, ("property"), _glib__property_id , _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance *) (_glib__pspec))->g_class))->g_type)))), (g_type_name ((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class ))->g_type)))))); } while (0); |
| 390 | break; |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | static void |
| 395 | ctk_inspector_action_editor_class_init (CtkInspectorActionEditorClass *klass) |
| 396 | { |
| 397 | GObjectClass *object_class = G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((klass)), (((GType) ((20) << (2)))))))); |
| 398 | |
| 399 | object_class->constructed = constructed; |
| 400 | object_class->finalize = finalize; |
| 401 | object_class->get_property = get_property; |
| 402 | object_class->set_property = set_property; |
| 403 | |
| 404 | g_object_class_install_property (object_class, PROP_GROUP, |
| 405 | g_param_spec_object ("group", "Action Group", "The Action Group containing the action", |
| 406 | G_TYPE_ACTION_GROUP(g_action_group_get_type ()), G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); |
| 407 | |
| 408 | g_object_class_install_property (object_class, PROP_PREFIX, |
| 409 | g_param_spec_string ("prefix", "Prefix", "The action name prefix", |
| 410 | NULL((void*)0), G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); |
| 411 | |
| 412 | g_object_class_install_property (object_class, PROP_NAME, |
| 413 | g_param_spec_string ("name", "Name", "The action name", |
| 414 | NULL((void*)0), G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); |
| 415 | } |
| 416 | |
| 417 | CtkWidget * |
| 418 | ctk_inspector_action_editor_new (GActionGroup *group, |
| 419 | const gchar *prefix, |
| 420 | const gchar *name) |
| 421 | { |
| 422 | return g_object_new (CTK_TYPE_INSPECTOR_ACTION_EDITOR(ctk_inspector_action_editor_get_type()), |
| 423 | "group", group, |
| 424 | "prefix", prefix, |
| 425 | "name", name, |
| 426 | NULL((void*)0)); |
| 427 | } |