static void on_listbox_row_changed(GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, PrivateListBoxData* data) { GtkListBoxRow* row = gtk_list_box_get_row_at_index(data->widget, gtk_tree_path_get_indices(path)[0]); if(row) { GtkWidget* content = gtk_bin_get_child(GTK_BIN(row)); for(GSList* item = data->model_bindings; item != NULL; item = item->next) { const ModelPropertyBinding* bind = item->data; GValue value = G_VALUE_INIT; gtk_tree_model_get_value(GTK_TREE_MODEL(model), iter, bind->column, &value); if(bind->widget) { GObject* child = gtk_widget_get_template_child(content, G_TYPE_FROM_INSTANCE(content), bind->widget); if(child) g_object_set_property(child, bind->prop, &value); } else g_object_set_property(G_OBJECT(content), bind->prop, &value); g_value_unset(&value); } } }
static void cursor_example_init (CursorExample *example) { CursorExamplePrivate *priv; gint i; example->priv = priv = cursor_example_get_instance_private (example); g_type_ensure (CURSOR_TYPE_NAVIGATOR); g_type_ensure (CURSOR_TYPE_SEARCH); gtk_widget_init_template (GTK_WIDGET (example)); for (i = 0; i < N_SLOTS; i++) { gchar *name = g_strdup_printf ("contact_slot_%d", i + 1); priv->slots[i] = (GtkWidget *) gtk_widget_get_template_child (GTK_WIDGET (example), CURSOR_TYPE_EXAMPLE, name); g_free (name); } }
bool wxInfoBar::Create(wxWindow *parent, wxWindowID winid) { if ( !UseNative() ) return wxInfoBarGeneric::Create(parent, winid); m_impl = new wxInfoBarGTKImpl; // this control is created initially hidden Hide(); if ( !CreateBase(parent, winid) ) return false; // create the info bar widget itself m_widget = gtk_info_bar_new(); wxCHECK_MSG( m_widget, false, "failed to create GtkInfoBar" ); g_object_ref(m_widget); // also create a label which will be used to show our message m_impl->m_label = gtk_label_new(""); gtk_widget_show(m_impl->m_label); GtkWidget * const contentArea = gtk_info_bar_get_content_area(GTK_INFO_BAR(m_widget)); wxCHECK_MSG( contentArea, false, "failed to get GtkInfoBar content area" ); gtk_container_add(GTK_CONTAINER(contentArea), m_impl->m_label); // finish creation and connect to all the signals we're interested in m_parent->DoAddChild(this); PostCreation(wxDefaultSize); GTKConnectWidget("response", G_CALLBACK(wxgtk_infobar_response)); GTKConnectWidget("close", G_CALLBACK(wxgtk_infobar_close)); // Work around GTK+ bug https://bugzilla.gnome.org/show_bug.cgi?id=710888 // by disabling the transition when showing it: without this, it's not // shown at all. // // Compile-time check is needed because GtkRevealer is new in 3.10. #if GTK_CHECK_VERSION(3, 10, 0) // Run-time check is needed because the bug was introduced in 3.10 and // fixed in 3.22.29 (see 6b4d95e86dabfcdaa805fbf068a99e19736a39a4 and a // couple of previous commits in GTK+ repository). if ( gtk_check_version(3, 10, 0) == NULL && gtk_check_version(3, 22, 29) != NULL ) { GObject* const revealer = gtk_widget_get_template_child(GTK_WIDGET(m_widget), GTK_TYPE_INFO_BAR, "revealer"); if ( revealer ) { gtk_revealer_set_transition_type(GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_NONE); gtk_revealer_set_transition_duration(GTK_REVEALER (revealer), 0); } } #endif // GTK+ >= 3.10 return true; }