static void mail_browser_set_message (EMailReader *reader, const gchar *uid) { EMailReaderInterface *iface; EMailBrowser *browser; CamelMessageInfo *info; CamelFolder *folder; browser = E_MAIL_BROWSER (reader); /* Chain up to parent's set_message() method. */ iface = g_type_default_interface_peek (E_TYPE_MAIL_READER); iface->set_message (reader, uid); if (uid == NULL) { e_mail_browser_close (browser); return; } folder = e_mail_reader_ref_folder (reader); info = camel_folder_get_message_info (folder, uid); if (info != NULL) { gtk_window_set_title ( GTK_WINDOW (reader), camel_message_info_subject (info)); camel_message_info_unref (info); } g_clear_object (&folder); }
static void glade_tool_item_group_editor_editable_init (GladeEditableIface *iface) { parent_editable_iface = g_type_default_interface_peek (GLADE_TYPE_EDITABLE); iface->load = glade_tool_item_group_editor_load; iface->set_show_name = glade_tool_item_group_editor_set_show_name; }
static void test_dynamic_iface (void) { TestDynamicIfaceClass *dynamic_iface; test_module_new (module_register); /* Not loaded until we call ref for the first time */ dynamic_iface = g_type_default_interface_peek (TEST_TYPE_DYNAMIC_IFACE); g_assert (dynamic_iface == NULL); /* Ref loads */ dynamic_iface = g_type_default_interface_ref (TEST_TYPE_DYNAMIC_IFACE); g_assert (dynamic_iface_init); g_assert (dynamic_iface && dynamic_iface->val == 42); /* Peek then works */ dynamic_iface = g_type_default_interface_peek (TEST_TYPE_DYNAMIC_IFACE); g_assert (dynamic_iface && dynamic_iface->val == 42); /* Unref causes finalize */ g_type_default_interface_unref (dynamic_iface); #if 0 g_assert (!dynamic_iface_init); #endif /* Peek returns NULL */ dynamic_iface = g_type_default_interface_peek (TEST_TYPE_DYNAMIC_IFACE); #if 0 g_assert (dynamic_iface == NULL); #endif /* Ref reloads */ dynamic_iface = g_type_default_interface_ref (TEST_TYPE_DYNAMIC_IFACE); g_assert (dynamic_iface_init); g_assert (dynamic_iface && dynamic_iface->val == 42); /* And Unref causes finalize once more*/ g_type_default_interface_unref (dynamic_iface); #if 0 g_assert (!dynamic_iface_init); #endif }
static void gimp_component_editor_docked_iface_init (GimpDockedInterface *iface) { parent_docked_iface = g_type_interface_peek_parent (iface); if (! parent_docked_iface) parent_docked_iface = g_type_default_interface_peek (GIMP_TYPE_DOCKED); iface->set_context = gimp_component_editor_set_context; }
static void clutter_scriptable_iface_init (ClutterScriptableIface *iface) { parent_scriptable_iface = g_type_interface_peek_parent (iface); if (!parent_scriptable_iface) parent_scriptable_iface = g_type_default_interface_peek (CLUTTER_TYPE_SCRIPTABLE); iface->parse_custom_node = clutter_behaviour_path_parse_custom_node; }
static void gimp_paint_options_config_iface_init (GimpConfigInterface *config_iface) { parent_config_iface = g_type_interface_peek_parent (config_iface); if (! parent_config_iface) parent_config_iface = g_type_default_interface_peek (GIMP_TYPE_CONFIG); config_iface->duplicate = gimp_paint_options_duplicate; config_iface->copy = gimp_paint_options_copy; }
static void gimp_cursor_view_docked_iface_init (GimpDockedInterface *iface) { parent_docked_iface = g_type_interface_peek_parent (iface); if (! parent_docked_iface) parent_docked_iface = g_type_default_interface_peek (GIMP_TYPE_DOCKED); iface->set_aux_info = gimp_cursor_view_set_aux_info; iface->get_aux_info = gimp_cursor_view_get_aux_info; }
static void gimp_histogram_editor_docked_iface_init (GimpDockedInterface *docked_iface) { parent_docked_iface = g_type_interface_peek_parent (docked_iface); if (! parent_docked_iface) parent_docked_iface = g_type_default_interface_peek (GIMP_TYPE_DOCKED); docked_iface->set_aux_info = gimp_histogram_editor_set_aux_info; docked_iface->get_aux_info = gimp_histogram_editor_get_aux_info; }
static void gimp_palette_editor_docked_iface_init (GimpDockedInterface *iface) { parent_docked_iface = g_type_interface_peek_parent (iface); if (! parent_docked_iface) parent_docked_iface = g_type_default_interface_peek (GIMP_TYPE_DOCKED); iface->set_context = gimp_palette_editor_set_context; iface->set_aux_info = gimp_palette_editor_set_aux_info; iface->get_aux_info = gimp_palette_editor_get_aux_info; }
static void test_static_iface (void) { TestStaticIfaceClass *static_iface; /* Not loaded until we call ref for the first time */ static_iface = g_type_default_interface_peek (TEST_TYPE_STATIC_IFACE); g_assert (static_iface == NULL); /* Ref loads */ static_iface = g_type_default_interface_ref (TEST_TYPE_STATIC_IFACE); g_assert (static_iface && static_iface->val == 42); /* Peek then works */ static_iface = g_type_default_interface_peek (TEST_TYPE_STATIC_IFACE); g_assert (static_iface && static_iface->val == 42); /* Unref does nothing */ g_type_default_interface_unref (static_iface); /* And peek still works */ static_iface = g_type_default_interface_peek (TEST_TYPE_STATIC_IFACE); g_assert (static_iface && static_iface->val == 42); }
static void soup_auth_manager_session_feature_init (SoupSessionFeatureInterface *feature_interface, gpointer interface_data) { soup_session_feature_default_interface = g_type_default_interface_peek (SOUP_TYPE_SESSION_FEATURE); feature_interface->attach = soup_auth_manager_attach; feature_interface->request_queued = soup_auth_manager_request_queued; feature_interface->request_started = soup_auth_manager_request_started; feature_interface->request_unqueued = soup_auth_manager_request_unqueued; feature_interface->add_feature = soup_auth_manager_add_feature; feature_interface->remove_feature = soup_auth_manager_remove_feature; feature_interface->has_feature = soup_auth_manager_has_feature; }
static void set_default_done_callback (Gchd *gchd, gboolean success, gchar * error, gpointer data) { GrubChooseDefaultButtonBox *bbox = GRUB_CHOOSE_DEFAULT_BUTTON_BOX (data); GrubChooseDefaultButtonBoxPrivate *priv = GET_PRIVATE (bbox); GrubChooseDefaultWidgetInterface * widget_class = g_type_default_interface_peek (GRUB_CHOOSE_DEFAULT_TYPE_WIDGET); if (!success) { grub_choose_default_error_message (gtk_widget_get_toplevel (GTK_WIDGET (bbox)), error); g_free (error); } g_signal_emit (bbox, widget_class->signals[GRUB_CHOOSE_DEFAULT_WIDGET_SIGNAL_SELECTED], 0, priv->def_entry); }
static void gimp_container_entry_view_iface_init (GimpContainerViewInterface *iface) { parent_view_iface = g_type_interface_peek_parent (iface); if (! parent_view_iface) parent_view_iface = g_type_default_interface_peek (GIMP_TYPE_CONTAINER_VIEW); iface->set_context = gimp_container_entry_set_context; iface->insert_item = gimp_container_entry_insert_item; iface->remove_item = gimp_container_entry_remove_item; iface->reorder_item = gimp_container_entry_reorder_item; iface->rename_item = gimp_container_entry_rename_item; iface->select_item = gimp_container_entry_select_item; iface->clear_items = gimp_container_entry_clear_items; iface->set_view_size = gimp_container_entry_set_view_size; iface->insert_data_free = (GDestroyNotify) gtk_tree_iter_free; }
static void button_clicked (GtkButton *button, gpointer user_data) { GrubChooseDefaultButtonBox *bbox = GRUB_CHOOSE_DEFAULT_BUTTON_BOX (user_data); GrubChooseDefaultButtonBoxPrivate *priv = GET_PRIVATE (bbox); GrubChooseDefaultWidgetInterface * widget_class = g_type_default_interface_peek (GRUB_CHOOSE_DEFAULT_TYPE_WIDGET); const GchdEntry *entry; entry = g_object_get_data (G_OBJECT (button), "entry"); g_assert (entry != NULL); priv->def_entry = g_strdup (entry->name); DBG ("Pressed %s", entry->name); if (entry->submenu) { buttonize (bbox, entry->submenu); return; } else if (entry->parentmenu) { buttonize (bbox, entry->parentmenu); return; } if (priv->autocommit) { commit (GRUB_CHOOSE_DEFAULT_WIDGET (bbox), NULL); /* the signal is emitted in the callback added by commit */ } else { g_signal_emit (bbox, widget_class->signals[GRUB_CHOOSE_DEFAULT_WIDGET_SIGNAL_SELECTED], 0, entry); } }
static void extension_subclass_init (GObjectClass *klass, GType *exten_types) { guint i; guint property_id = 1; g_debug ("Initializing class '%s'", G_OBJECT_CLASS_NAME (klass)); klass->set_property = extension_subclass_set_property; klass->get_property = extension_subclass_get_property; for (i = 0; exten_types[i] != 0; ++i) { guint n_props, j; gpointer iface_vtable; GParamSpec **properties; iface_vtable = g_type_default_interface_peek (exten_types[i]); properties = g_object_interface_list_properties (iface_vtable, &n_props); for (j = 0; j < n_props; ++j, ++property_id) { const gchar *property_name; property_name = g_param_spec_get_name (properties[j]); g_object_class_override_property (klass, property_id, property_name); g_debug ("Overrided '%s:%s' for '%s' proxy", g_type_name (exten_types[i]), property_name, G_OBJECT_CLASS_NAME (klass)); } g_free (properties); } g_debug ("Initialized class '%s'", G_OBJECT_CLASS_NAME (klass)); }
static void gtk_switch_class_init (GtkSwitchClass *klass) { GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass); gpointer activatable_iface; g_type_class_add_private (klass, sizeof (GtkSwitchPrivate)); activatable_iface = g_type_default_interface_peek (GTK_TYPE_ACTIVATABLE); switch_props[PROP_RELATED_ACTION] = g_param_spec_override ("related-action", g_object_interface_find_property (activatable_iface, "related-action")); switch_props[PROP_USE_ACTION_APPEARANCE] = g_param_spec_override ("use-action-appearance", g_object_interface_find_property (activatable_iface, "use-action-appearance")); /** * GtkSwitch:active: * * Whether the #GtkSwitch widget is in its on or off state. */ switch_props[PROP_ACTIVE] = g_param_spec_boolean ("active", P_("Active"), P_("Whether the switch is on or off"), FALSE, GTK_PARAM_READWRITE); gobject_class->set_property = gtk_switch_set_property; gobject_class->get_property = gtk_switch_get_property; gobject_class->dispose = gtk_switch_dispose; g_object_class_install_properties (gobject_class, LAST_PROP, switch_props); widget_class->get_preferred_width = gtk_switch_get_preferred_width; widget_class->get_preferred_height = gtk_switch_get_preferred_height; widget_class->size_allocate = gtk_switch_size_allocate; widget_class->realize = gtk_switch_realize; widget_class->unrealize = gtk_switch_unrealize; widget_class->map = gtk_switch_map; widget_class->unmap = gtk_switch_unmap; widget_class->draw = gtk_switch_draw; widget_class->button_press_event = gtk_switch_button_press; widget_class->button_release_event = gtk_switch_button_release; widget_class->motion_notify_event = gtk_switch_motion; widget_class->enter_notify_event = gtk_switch_enter; widget_class->leave_notify_event = gtk_switch_leave; widget_class->key_release_event = gtk_switch_key_release; widget_class->get_accessible = gtk_switch_get_accessible; /** * GtkSwitch:slider-width: * * The minimum width of the #GtkSwitch handle, in pixels. */ gtk_widget_class_install_style_property (widget_class, g_param_spec_int ("slider-width", P_("Slider Width"), P_("The minimum width of the handle"), DEFAULT_SLIDER_WIDTH, G_MAXINT, DEFAULT_SLIDER_WIDTH, GTK_PARAM_READABLE)); }
static void gtk_switch_class_init (GtkSwitchClass *klass) { GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass); gpointer activatable_iface; G_GNUC_BEGIN_IGNORE_DEPRECATIONS; activatable_iface = g_type_default_interface_peek (GTK_TYPE_ACTIVATABLE); G_GNUC_END_IGNORE_DEPRECATIONS; switch_props[PROP_RELATED_ACTION] = g_param_spec_override ("related-action", g_object_interface_find_property (activatable_iface, "related-action")); switch_props[PROP_USE_ACTION_APPEARANCE] = g_param_spec_override ("use-action-appearance", g_object_interface_find_property (activatable_iface, "use-action-appearance")); /** * GtkSwitch:active: * * Whether the #GtkSwitch widget is in its on or off state. */ switch_props[PROP_ACTIVE] = g_param_spec_boolean ("active", P_("Active"), P_("Whether the switch is on or off"), FALSE, GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkSwitch:state: * * The backend state that is controlled by the switch. * See #GtkSwitch::state-set for details. * * Since: 3.14 */ switch_props[PROP_STATE] = g_param_spec_boolean ("state", P_("State"), P_("The backend state"), FALSE, GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); gobject_class->set_property = gtk_switch_set_property; gobject_class->get_property = gtk_switch_get_property; gobject_class->dispose = gtk_switch_dispose; gobject_class->finalize = gtk_switch_finalize; g_object_class_install_properties (gobject_class, LAST_PROP, switch_props); widget_class->get_preferred_width = gtk_switch_get_preferred_width; widget_class->get_preferred_height = gtk_switch_get_preferred_height; widget_class->size_allocate = gtk_switch_size_allocate; widget_class->realize = gtk_switch_realize; widget_class->unrealize = gtk_switch_unrealize; widget_class->map = gtk_switch_map; widget_class->unmap = gtk_switch_unmap; widget_class->draw = gtk_switch_draw; widget_class->enter_notify_event = gtk_switch_enter; widget_class->leave_notify_event = gtk_switch_leave; klass->activate = gtk_switch_activate; klass->state_set = state_set; /** * GtkSwitch:slider-width: * * The minimum width of the #GtkSwitch handle, in pixels. */ gtk_widget_class_install_style_property (widget_class, g_param_spec_int ("slider-width", P_("Slider Width"), P_("The minimum width of the handle"), DEFAULT_SLIDER_WIDTH, G_MAXINT, DEFAULT_SLIDER_WIDTH, GTK_PARAM_READABLE)); /** * GtkSwitch::activate: * @widget: the object which received the signal. * * The ::activate signal on GtkSwitch is an action signal and * emitting it causes the switch to animate. * Applications should never connect to this signal, but use the * notify::active signal. */ signals[ACTIVATE] = g_signal_new (I_("activate"), G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GtkSwitchClass, activate), NULL, NULL, _gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); widget_class->activate_signal = signals[ACTIVATE]; /** * GtkSwitch::state-set: * @widget: the object on which the signal was emitted * @state: the new state of the switch * * The ::state-set signal on GtkSwitch is emitted to change the underlying * state. It is emitted when the user changes the switch position. The * default handler keeps the state in sync with the #GtkState:active * property. * * To implement delayed state change, applications can connect to this signal, * initiate the change of the underlying state, and call gtk_switch_set_state() * when the underlying state change is complete. The signal handler should * return %TRUE to prevent the default handler from running. * * Visually, the underlying state is represented by the trough color of * the switch, while the #GtkSwitch:active property is represented by the * position of the switch. * * Returns: %TRUE to stop the signal emission * * Since: 3.14 */ signals[STATE_SET] = g_signal_new (I_("state-set"), G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkSwitchClass, state_set), _gtk_boolean_handled_accumulator, NULL, _gtk_marshal_BOOLEAN__BOOLEAN, G_TYPE_BOOLEAN, 1, G_TYPE_BOOLEAN); g_object_class_override_property (gobject_class, PROP_ACTION_NAME, "action-name"); g_object_class_override_property (gobject_class, PROP_ACTION_TARGET, "action-target"); gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SWITCH_ACCESSIBLE); gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_TOGGLE_BUTTON); }
static void gtk_switch_class_init (GtkSwitchClass *klass) { GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass); gpointer activatable_iface; G_GNUC_BEGIN_IGNORE_DEPRECATIONS; activatable_iface = g_type_default_interface_peek (GTK_TYPE_ACTIVATABLE); G_GNUC_END_IGNORE_DEPRECATIONS; switch_props[PROP_RELATED_ACTION] = g_param_spec_override ("related-action", g_object_interface_find_property (activatable_iface, "related-action")); switch_props[PROP_USE_ACTION_APPEARANCE] = g_param_spec_override ("use-action-appearance", g_object_interface_find_property (activatable_iface, "use-action-appearance")); /** * GtkSwitch:active: * * Whether the #GtkSwitch widget is in its on or off state. */ switch_props[PROP_ACTIVE] = g_param_spec_boolean ("active", P_("Active"), P_("Whether the switch is on or off"), FALSE, GTK_PARAM_READWRITE); gobject_class->set_property = gtk_switch_set_property; gobject_class->get_property = gtk_switch_get_property; gobject_class->dispose = gtk_switch_dispose; g_object_class_install_properties (gobject_class, LAST_PROP, switch_props); widget_class->get_preferred_width = gtk_switch_get_preferred_width; widget_class->get_preferred_height = gtk_switch_get_preferred_height; widget_class->size_allocate = gtk_switch_size_allocate; widget_class->realize = gtk_switch_realize; widget_class->unrealize = gtk_switch_unrealize; widget_class->map = gtk_switch_map; widget_class->unmap = gtk_switch_unmap; widget_class->draw = gtk_switch_draw; widget_class->button_press_event = gtk_switch_button_press; widget_class->button_release_event = gtk_switch_button_release; widget_class->motion_notify_event = gtk_switch_motion; widget_class->enter_notify_event = gtk_switch_enter; widget_class->leave_notify_event = gtk_switch_leave; klass->activate = gtk_switch_activate; /** * GtkSwitch:slider-width: * * The minimum width of the #GtkSwitch handle, in pixels. */ gtk_widget_class_install_style_property (widget_class, g_param_spec_int ("slider-width", P_("Slider Width"), P_("The minimum width of the handle"), DEFAULT_SLIDER_WIDTH, G_MAXINT, DEFAULT_SLIDER_WIDTH, GTK_PARAM_READABLE)); /** * GtkSwitch::activate: * @widget: the object which received the signal. * * The ::activate signal on GtkSwitch is an action signal and * emitting it causes the switch to animate. * Applications should never connect to this signal, but use the * notify::active signal. */ signals[ACTIVATE] = g_signal_new (I_("activate"), G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GtkSwitchClass, activate), NULL, NULL, _gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); widget_class->activate_signal = signals[ACTIVATE]; g_object_class_override_property (gobject_class, PROP_ACTION_NAME, "action-name"); g_object_class_override_property (gobject_class, PROP_ACTION_TARGET, "action-target"); gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SWITCH_ACCESSIBLE); gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_TOGGLE_BUTTON); }