void wxBitmapComboBox::GTKCreateComboBoxWidget() { GtkListStore *store; store = gtk_list_store_new( 2, G_TYPE_OBJECT, G_TYPE_STRING ); if ( HasFlag(wxCB_READONLY) ) { m_widget = gtk_combo_box_new_with_model( GTK_TREE_MODEL(store) ); } else { m_widget = gtk_combo_box_entry_new_with_model( GTK_TREE_MODEL(store), m_stringCellIndex ); m_entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(m_widget))); gtk_editable_set_editable(GTK_EDITABLE(m_entry), true); } g_object_ref(m_widget); // This must be called as gtk_combo_box_entry_new_with_model adds // automatically adds one text column. gtk_cell_layout_clear( GTK_CELL_LAYOUT(m_widget) ); GtkCellRenderer* imageRenderer = gtk_cell_renderer_pixbuf_new(); gtk_cell_layout_pack_start( GTK_CELL_LAYOUT(m_widget), imageRenderer, FALSE); gtk_cell_layout_add_attribute( GTK_CELL_LAYOUT(m_widget), imageRenderer, "pixbuf", 0); GtkCellRenderer* textRenderer = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_end( GTK_CELL_LAYOUT(m_widget), textRenderer, TRUE ); gtk_cell_layout_add_attribute( GTK_CELL_LAYOUT(m_widget), textRenderer, "text", 1); }
GtkWidget* remmina_public_create_combo(gboolean use_icon) { GtkWidget *combo; GtkListStore *store; GtkCellRenderer *renderer; if (use_icon) { store = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); } else { store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); } combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store)); if (use_icon) { renderer = gtk_cell_renderer_pixbuf_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, FALSE); gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(combo), renderer, "icon-name", 2); } renderer = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, TRUE); gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(combo), renderer, "text", 1); if (use_icon) g_object_set(G_OBJECT(renderer), "xpad", 5, NULL); return combo; }
void init_object_combo_box(GtkWidget *cbox) { GtkCellRenderer *rend; GtkTreeViewRowSeparatorFunc func; func = gtk_combo_box_get_row_separator_func(GTK_COMBO_BOX(cbox)); if (func == NULL) { gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(cbox), combo_box_separator_func, NULL, NULL); } gtk_cell_layout_clear(GTK_CELL_LAYOUT(cbox)); rend = gtk_cell_renderer_toggle_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(cbox), rend, FALSE); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(cbox), rend, "active", OBJECT_COLUMN_TYPE_TOGGLE, "visible", OBJECT_COLUMN_TYPE_TOGGLE_VISIBLE, "radio", OBJECT_COLUMN_TYPE_TOGGLE_IS_RADIO, NULL); rend = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(cbox), rend, FALSE); gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(cbox), rend, "text", OBJECT_COLUMN_TYPE_STRING); rend = gtk_cell_renderer_pixbuf_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(cbox), rend, FALSE); gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(cbox), rend, "pixbuf", OBJECT_COLUMN_TYPE_PIXBUF); }
/*! \brief Create a ComboBox with the gschem fill styles. * * \return GtkWidget */ GtkWidget* x_fstylecb_new () { GtkComboBox *combo; GtkCellLayout *layout; GtkCellRenderer *swatch_cell; GtkCellRenderer *text_cell; if (fstyle_list_store == NULL) { fstyle_list_store = create_fstyle_list_store (); } combo = GTK_COMBO_BOX (gtk_combo_box_new_with_model (GTK_TREE_MODEL (fstyle_list_store))); layout = GTK_CELL_LAYOUT (combo); /* For convenience */ /* Renders the fill swatch. Since this won't contain text, set a * minimum width. */ swatch_cell = GTK_CELL_RENDERER (gschem_fill_swatch_cell_renderer_new ()); g_object_set (swatch_cell, "width", 25, NULL); gtk_cell_layout_pack_start (layout, swatch_cell, FALSE); gtk_cell_layout_add_attribute (layout, swatch_cell, "fill-type", COLUMN_INDEX); /* Renders the name of the fill style */ text_cell = GTK_CELL_RENDERER (gtk_cell_renderer_text_new()); g_object_set (text_cell, "xpad", 5, NULL); gtk_cell_layout_pack_start (layout, text_cell, TRUE); gtk_cell_layout_add_attribute (layout, text_cell, "text", COLUMN_NAME); return GTK_WIDGET (combo); }
static void connection_essids_combo_init (GtkComboBoxEntry *combo) { GtkTreeModel *model; GtkCellRenderer *renderer; model = GTK_TREE_MODEL (gtk_list_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT)); gtk_combo_box_set_model (GTK_COMBO_BOX (combo), model); g_object_unref (model); /* add "crypted" renderer */ renderer = gtk_cell_renderer_pixbuf_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), renderer, "pixbuf", 0); gtk_cell_layout_reorder (GTK_CELL_LAYOUT (combo), renderer, 0); /* add "quality" renderer */ renderer = gtk_cell_renderer_progress_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), renderer, "value", 2); /* reuse text cell renderer for the essid */ gtk_combo_box_entry_set_text_column (combo, 1); g_signal_connect (gtk_bin_get_child (GTK_BIN (combo)), "changed", G_CALLBACK (on_dialog_changed), tool); }
static void math_converter_init(MathConverter *converter) { GtkWidget *hbox, *label, *swap_button; GtkCellRenderer *renderer; converter->priv = G_TYPE_INSTANCE_GET_PRIVATE(converter, math_converter_get_type(), MathConverterPrivate); gtk_box_set_spacing(GTK_BOX(converter), 6); hbox = gtk_hbox_new(FALSE, 0); gtk_widget_show(hbox); gtk_box_pack_start(GTK_BOX(converter), hbox, FALSE, TRUE, 0); converter->priv->from_combo = gtk_combo_box_new (); renderer = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(converter->priv->from_combo), renderer, TRUE); gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(converter->priv->from_combo), renderer, "text", 0); gtk_cell_layout_set_cell_data_func(GTK_CELL_LAYOUT(converter->priv->from_combo), renderer, from_cell_data_func, NULL, NULL); g_signal_connect(converter->priv->from_combo, "changed", G_CALLBACK(from_combobox_changed_cb), converter); gtk_widget_show(converter->priv->from_combo); gtk_box_pack_start(GTK_BOX(hbox), converter->priv->from_combo, FALSE, TRUE, 0); label = gtk_label_new(/* Label that is displayed between the two conversion combo boxes, e.g. "[degrees] in [radians]" */ _(" in ")); gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); converter->priv->to_combo = gtk_combo_box_new(); renderer = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(converter->priv->to_combo), renderer, TRUE); gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(converter->priv->to_combo), renderer, "text", 0); g_signal_connect(converter->priv->to_combo, "changed", G_CALLBACK(to_combobox_changed_cb), converter); gtk_widget_show(converter->priv->to_combo); gtk_box_pack_start(GTK_BOX(hbox), converter->priv->to_combo, FALSE, TRUE, 0); swap_button = gtk_button_new_with_label ("⇆"); gtk_widget_set_tooltip_text (swap_button, /* Tooltip for swap conversion button */ _("Switch conversion units")); gtk_button_set_relief (GTK_BUTTON (swap_button), GTK_RELIEF_NONE); g_signal_connect (swap_button, "clicked", G_CALLBACK (swap_button_clicked_cb), converter); gtk_widget_show(swap_button); gtk_box_pack_start(GTK_BOX(hbox), swap_button, FALSE, TRUE, 0); converter->priv->result_label = gtk_label_new(""); gtk_misc_set_alignment(GTK_MISC(converter->priv->result_label), 1.0, 0.5); gtk_widget_set_sensitive(converter->priv->result_label, FALSE); gtk_widget_show(converter->priv->result_label); gtk_box_pack_start(GTK_BOX(converter), converter->priv->result_label, TRUE, TRUE, 0); g_signal_connect(currency_manager_get_default(), "updated", G_CALLBACK(currency_updated_cb), converter); }
static void gwy_app_file_chooser_add_preview(GwyAppFileChooser *chooser) { GtkListStore *store; GtkIconView *preview; GtkCellLayout *layout; GtkCellRenderer *renderer; GtkWidget *scwin; gint w; if (gtk_check_version(2, 8, 0)) { g_warning("File previews require Gtk+ 2.8"); return; } scwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scwin), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); store = gtk_list_store_new(2, G_TYPE_STRING, GDK_TYPE_PIXBUF); chooser->preview = gtk_icon_view_new_with_model(GTK_TREE_MODEL(store)); g_object_unref(store); preview = GTK_ICON_VIEW(chooser->preview); layout = GTK_CELL_LAYOUT(preview); gtk_icon_view_set_columns(preview, 1); renderer = gtk_cell_renderer_pixbuf_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(preview), renderer, FALSE); gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(preview), renderer, "pixbuf", COLUMN_PIXBUF); renderer = gtk_cell_renderer_text_new(); g_object_set(renderer, "wrap-mode", PANGO_WRAP_WORD_CHAR, "ellipsize", PANGO_ELLIPSIZE_END, "ellipsize-set", TRUE, NULL); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(preview), renderer, FALSE); gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(preview), renderer, "markup", COLUMN_FILEINFO); chooser->renderer_fileinfo = G_OBJECT(renderer); gtk_icon_view_set_selection_mode(preview, GTK_SELECTION_NONE); gtk_icon_view_set_item_width(preview, TMS_NORMAL_THUMB_SIZE); w = TMS_NORMAL_THUMB_SIZE + 2*gtk_icon_view_get_margin(preview); gtk_widget_set_size_request(chooser->preview, w, -1); gtk_container_add(GTK_CONTAINER(scwin), chooser->preview); gtk_widget_show(chooser->preview); gtk_file_chooser_set_preview_widget(GTK_FILE_CHOOSER(chooser), scwin); g_signal_connect(chooser, "update-preview", G_CALLBACK(gwy_app_file_chooser_update_preview), NULL); }
static void ipreferences_merge(IAnjutaPreferences* ipref, AnjutaPreferences* prefs, GError** e) { /* Add preferences */ SourceviewPlugin* plugin = ANJUTA_PLUGIN_SOURCEVIEW (ipref); GtkCellRenderer* renderer_name = gtk_cell_renderer_text_new (); GtkCellRenderer* renderer_desc = gtk_cell_renderer_text_new (); GtkTreeIter* iter = NULL; GError* error = NULL; builder = gtk_builder_new (); if (!gtk_builder_add_from_file(builder, PREFS_GLADE, &error)) { DEBUG_PRINT ("Could load sourceview preferences: %s", error->message); g_error_free (error); return; } anjuta_preferences_add_from_builder (prefs, builder, plugin->settings, "Editor", _("GtkSourceView Editor"), ICON_FILE); plugin->check_font = GTK_WIDGET (gtk_builder_get_object (builder, FONT_USE_THEME_BUTTON)); g_signal_connect(G_OBJECT(plugin->check_font), "toggled", G_CALLBACK(on_font_check_toggled), builder); on_font_check_toggled (GTK_TOGGLE_BUTTON (plugin->check_font), builder); /* Init styles combo */ plugin->combo_styles = GTK_WIDGET (gtk_builder_get_object (builder, COMBO_STYLES)); gtk_combo_box_set_model (GTK_COMBO_BOX (plugin->combo_styles), create_style_model(plugin->settings, &iter)); g_signal_connect (plugin->combo_styles, "changed", G_CALLBACK (on_style_changed), plugin); gtk_cell_layout_clear (GTK_CELL_LAYOUT(plugin->combo_styles)); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT(plugin->combo_styles), renderer_name, TRUE); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT(plugin->combo_styles), renderer_desc, FALSE); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT(plugin->combo_styles), renderer_name, "text", COLUMN_NAME); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT(plugin->combo_styles), renderer_desc, "text", COLUMN_DESC); g_object_set (renderer_desc, "style", PANGO_STYLE_ITALIC, NULL); if (iter) { gtk_combo_box_set_active_iter (GTK_COMBO_BOX (plugin->combo_styles), iter); gtk_tree_iter_free (iter); } }
static gboolean on_focus_in( GtkWidget *entry, GdkEventFocus* evt, gpointer user_data ) { GtkEntryCompletion* completion = gtk_entry_completion_new(); GtkListStore* list = gtk_list_store_new( COUNT_COLS, G_TYPE_STRING, G_TYPE_STRING ); GtkCellRenderer* render; gtk_entry_completion_set_minimum_key_length( completion, 1 ); gtk_entry_completion_set_model( completion, GTK_TREE_MODEL(list) ); g_object_unref( list ); // gtk_entry_completion_set_text_column( completion, COL_PATH ); // g_object_set( completion, "text-column", COL_PATH, NULL );VV g_object_set( completion, "text-column", COL_NAME, NULL ); render = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start( (GtkCellLayout*)completion, render, TRUE ); gtk_cell_layout_add_attribute( (GtkCellLayout*)completion, render, "text", COL_NAME ); gtk_entry_completion_set_inline_completion( completion, TRUE ); #if GTK_CHECK_VERSION( 2, 8, 0) // gtk+ prior to 2.8.0 doesn't have this API gtk_entry_completion_set_popup_set_width( completion, TRUE ); #endif gtk_entry_set_completion( GTK_ENTRY(entry), completion ); g_signal_connect( G_OBJECT(entry), "changed", G_CALLBACK(on_changed), NULL ); g_object_unref( completion ); return FALSE; }
static void xfce_mixer_card_combo_init (XfceMixerCardCombo *combo) { GtkCellRenderer *renderer; GtkTreeIter tree_iter; GList *iter; combo->list_store = gtk_list_store_new (2, G_TYPE_STRING, GST_TYPE_ELEMENT); gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (combo->list_store)); renderer = gtk_cell_renderer_text_new (); g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), renderer, "text", NAME_COLUMN); for (iter = xfce_mixer_get_cards (); iter != NULL; iter = g_list_next (iter)) { gtk_list_store_append (combo->list_store, &tree_iter); gtk_list_store_set (combo->list_store, &tree_iter, NAME_COLUMN, xfce_mixer_get_card_display_name (iter->data), CARD_COLUMN, iter->data, -1); } g_signal_connect_swapped (combo, "changed", G_CALLBACK (xfce_mixer_card_combo_changed), combo); }
static void cg_combo_flags_cell_layout_add_attribute (GtkCellLayout *layout, GtkCellRenderer *cell, const gchar *attribute, gint column) { CgComboFlags *combo; CgComboFlagsPrivate *priv; CgComboFlagsCellInfo *info; combo = CG_COMBO_FLAGS (layout); priv = CG_COMBO_FLAGS_PRIVATE(combo); info = cg_combo_flags_get_cell_info (combo, cell); info->attributes = g_slist_prepend (info->attributes, GINT_TO_POINTER (column)); info->attributes = g_slist_prepend (info->attributes, g_strdup (attribute)); if (priv->column != NULL) { gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (priv->column), cell, attribute, column); } gtk_widget_queue_resize (GTK_WIDGET (combo)); }
static gboolean on_focus_in( GtkWidget *entry, GdkEventFocus* evt, gpointer user_data ) { GtkEntryCompletion* completion = gtk_entry_completion_new(); GtkListStore* list = gtk_list_store_new( N_COLS, G_TYPE_STRING, G_TYPE_STRING ); GtkCellRenderer* render; gtk_entry_completion_set_minimum_key_length( completion, 1 ); gtk_entry_completion_set_model( completion, GTK_TREE_MODEL(list) ); g_object_unref( list ); /* gtk_entry_completion_set_text_column( completion, COL_PATH ); */ // Following line causes GTK3 to show both columns, so skip this and use // custom match-selected handler to insert COL_PATH //g_object_set( completion, "text-column", COL_PATH, NULL ); render = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start( (GtkCellLayout*)completion, render, TRUE ); gtk_cell_layout_add_attribute( (GtkCellLayout*)completion, render, "text", COL_NAME ); //gtk_entry_completion_set_inline_completion( completion, TRUE ); gtk_entry_completion_set_popup_set_width( completion, TRUE ); gtk_entry_set_completion( GTK_ENTRY(entry), completion ); g_signal_connect( G_OBJECT(entry), "changed", G_CALLBACK(on_changed), NULL ); g_signal_connect( G_OBJECT( completion ), "match-selected", G_CALLBACK( on_match_selected ), entry ); g_signal_connect( G_OBJECT( completion ), "insert-prefix", G_CALLBACK( on_insert_prefix ), entry ); g_object_unref( completion ); return FALSE; }
static void attributes_end_element (GMarkupParseContext *context, const gchar *element_name, gpointer user_data, GError **error) { AttributesSubParserData *data = (AttributesSubParserData*)user_data; GValue val = G_VALUE_INIT; if (!data->attr_name) return; if (!gtk_builder_value_from_string_type (data->builder, G_TYPE_INT, data->string->str, &val, error)) { _gtk_builder_prefix_error (data->builder, context, error); return; } gtk_cell_layout_add_attribute (data->cell_layout, data->renderer, data->attr_name, g_value_get_int (&val)); g_free (data->attr_name); data->attr_name = NULL; g_string_set_size (data->string, 0); }
static void setup_device_chooser (const gchar *profile, int type, GtkWidget *combobox, GtkWidget *test_button, const gchar *test_pipeline) { DeviceChooser *device_chooser; GtkCellRenderer *cell; gchar *gconf_key; g_return_if_fail (GTK_IS_COMBO_BOX (combobox)); g_return_if_fail (GTK_IS_BUTTON (test_button)); device_chooser = g_malloc0 (sizeof (DeviceChooser)); device_chooser->profile = profile; device_chooser->type = type; device_chooser->combobox = combobox; device_chooser->model = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING); device_chooser->test_pipeline = test_pipeline; gtk_combo_box_set_model (GTK_COMBO_BOX (combobox), GTK_TREE_MODEL (device_chooser->model)); cell = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), cell, TRUE); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combobox), cell, "text", 1); device_choosers = g_list_prepend (device_choosers, device_chooser); gconf_key = get_gconf_key_for_profile (profile, type); gconf_client_notify_add (gconf_client, gconf_key, gconf_key_changed, device_chooser, NULL, NULL); g_free (gconf_key); g_signal_connect (combobox, "changed", G_CALLBACK (device_changed), device_chooser); g_signal_connect (test_button, "clicked", G_CALLBACK (device_test_button_clicked), device_chooser); }
static void cg_combo_flags_sync_cells (CgComboFlags *combo, GtkCellLayout *cell_layout) { CgComboFlagsPrivate *priv; CgComboFlagsCellInfo *info; GSList *j; GSList *k; priv = CG_COMBO_FLAGS_PRIVATE (combo); for (k = priv->cells; k != NULL; k = k->next) { info = (CgComboFlagsCellInfo *) k->data; if (info->pack == GTK_PACK_START) gtk_cell_layout_pack_start (cell_layout, info->cell, info->expand); else if (info->pack == GTK_PACK_END) gtk_cell_layout_pack_end (cell_layout, info->cell, info->expand); gtk_cell_layout_set_cell_data_func (cell_layout, info->cell, cg_combo_flags_cell_data_func, info, NULL); for (j = info->attributes; j != NULL; j = j->next->next) { gtk_cell_layout_add_attribute (cell_layout, info->cell, j->data, GPOINTER_TO_INT (j->next->data)); } } }
void ui_common_setup_combo_text (GtkComboBox *combo, gint col) { GtkCellRenderer *rend = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), rend, TRUE); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), rend, "text", col); }
GtkWidget * e_table_proxy_gtk_combo_text_new (void) { GtkCellRenderer *renderer; GtkListStore *store; GtkWidget *combo_box; GHashTable *index; store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING); combo_box = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start ( GTK_CELL_LAYOUT (combo_box), renderer, FALSE); gtk_cell_layout_add_attribute ( GTK_CELL_LAYOUT (combo_box), renderer, "text", COLUMN_ITEM); /* Embed a reverse-lookup index into the widget. */ index = g_hash_table_new_full ( g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) gtk_tree_row_reference_free); g_object_set_data_full ( G_OBJECT (combo_box), "index", index, (GDestroyNotify) g_hash_table_destroy); return combo_box; }
static GtkWidget * geanypg_combobox(GtkListStore * list) { GtkWidget * combobox = gtk_combo_box_new_with_model(GTK_TREE_MODEL(list)); GtkCellRenderer * cell1 = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox), cell1, FALSE); gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(combobox), cell1, "text", RECIPIENT_COLUMN); return combobox; }
gboolean moab_setup_ui(gchar ** char_account, GebrServer * server, gboolean parallel_program) { gboolean ret; GtkWidget * box; GtkWidget * hbox; GtkWidget * dialog; GtkWidget * label; GtkWidget * cb_account; GtkCellRenderer * cell; GtkTreeIter iter; ret = TRUE; dialog = gtk_dialog_new_with_buttons(_("Moab execution parameters"), GTK_WINDOW(gebr.window), (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT), GTK_STOCK_EXECUTE, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL); box = GTK_DIALOG(dialog)->vbox; cb_account = gtk_combo_box_new(); cell = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(cb_account), cell, TRUE); gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(cb_account), cell, "text", 0); hbox = gtk_hbox_new(FALSE, 5); label = gtk_label_new(_("Account")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), cb_account, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, TRUE, 0); if (parallel_program) { /* We should be able to ask for the number of processes (np) to run the parallel program(s). */ GtkWidget *hbox_np = gtk_hbox_new(FALSE, 5); GtkWidget *label_np = gtk_label_new(_("Number of processes")); GtkWidget *entry_np = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(hbox_np), label_np, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox_np), entry_np, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), hbox_np, TRUE, TRUE, 0); } gtk_combo_box_set_model(GTK_COMBO_BOX(cb_account), GTK_TREE_MODEL(server->accounts_model)); gtk_combo_box_set_active(GTK_COMBO_BOX(cb_account), 0); gtk_widget_show_all(dialog); if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_ACCEPT) { ret = FALSE; goto out; } gtk_combo_box_get_active_iter(GTK_COMBO_BOX(cb_account), &iter); gtk_tree_model_get(GTK_TREE_MODEL(server->accounts_model), &iter, 0, char_account, -1); out: gtk_widget_destroy(dialog); return ret; }
static void cc_wacom_mapping_panel_init (CcWacomMappingPanel *self) { CcWacomMappingPanelPrivate *priv; GtkWidget *vbox, *grid; GtkCellRenderer *renderer; priv = self->priv = WACOM_MAPPING_PANEL_PRIVATE (self); vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8); gtk_container_add (GTK_CONTAINER (self), vbox); gtk_container_set_border_width (GTK_CONTAINER (self), 12); gtk_widget_set_vexpand (GTK_WIDGET (vbox), TRUE); gtk_widget_set_hexpand (GTK_WIDGET (vbox), TRUE); /* Output Combobox */ grid = gtk_grid_new(); gtk_grid_set_row_spacing (GTK_GRID (grid), 10); gtk_grid_set_column_spacing (GTK_GRID (grid), 10); priv->label = gtk_label_new (_("Output:")); gtk_widget_set_halign (priv->label, GTK_ALIGN_END); priv->combobox = gtk_combo_box_new (); g_signal_connect (G_OBJECT (priv->combobox), "changed", G_CALLBACK (combobox_changed_cb), self); renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT(priv->combobox), renderer, TRUE); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT(priv->combobox), renderer, "text", 0); gtk_grid_attach (GTK_GRID(grid), GTK_WIDGET(priv->label), 0, 0, 1, 1); gtk_grid_attach (GTK_GRID(grid), GTK_WIDGET(priv->combobox), 1, 0, 1, 1); /* Keep ratio switch */ priv->aspectlabel = gtk_label_new (_("Keep aspect ratio (letterbox):")); gtk_widget_set_halign (priv->aspectlabel, GTK_ALIGN_END); priv->aspectswitch = gtk_switch_new (); gtk_widget_set_halign (priv->aspectswitch, GTK_ALIGN_START); gtk_switch_set_active (GTK_SWITCH (priv->aspectswitch), FALSE); g_signal_connect (GTK_SWITCH (priv->aspectswitch), "notify::active", G_CALLBACK (aspectswitch_toggled_cb), self); gtk_grid_attach (GTK_GRID(grid), GTK_WIDGET(priv->aspectlabel), 0, 1, 1, 1); gtk_grid_attach (GTK_GRID(grid), GTK_WIDGET(priv->aspectswitch), 1, 1, 1, 1); /* Whole-desktop checkbox */ priv->checkbutton = gtk_check_button_new_with_label (_("Map to single monitor")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->checkbutton), FALSE); g_signal_connect (G_OBJECT (priv->checkbutton), "toggled", G_CALLBACK (checkbutton_toggled_cb), self); gtk_box_pack_start (GTK_BOX(vbox), GTK_WIDGET(priv->checkbutton), FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX(vbox), GTK_WIDGET(grid), FALSE, FALSE, 8); /* Update display */ cc_wacom_mapping_panel_set_device (self, NULL); gtk_widget_show_all(GTK_WIDGET(self)); }
static void setup_filesystem_menu(FormatDialog* dialog) { GtkTreeStore* model; model = gtk_tree_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN); GtkComboBox* combo = dialog->fs_combo; GtkCellRenderer* text_renderer; gtk_combo_box_set_model(combo, GTK_TREE_MODEL(model)); dialog->fs_model = model; /* Set up the column */ gtk_cell_layout_pack_start( GTK_CELL_LAYOUT(combo), (text_renderer = gtk_cell_renderer_text_new()), TRUE ); gtk_cell_layout_add_attribute( GTK_CELL_LAYOUT(combo), text_renderer, "markup", FS_COLUMN_MARKUP ); gtk_cell_layout_add_attribute( GTK_CELL_LAYOUT(combo), text_renderer, "sensitive", FS_COLUMN_SENSITIVE ); /* Add the default items */ gtk_tree_store_insert_with_values(model, NULL, NULL, 100 /*Always at end*/, FS_COLUMN_REALNAME, "friendly_vfat", FS_COLUMN_MARKUP, _("For all computers"), FS_COLUMN_SENSITIVE, TRUE, -1); gtk_tree_store_insert_with_values(model, NULL, NULL, 100 /*Always at end*/, FS_COLUMN_REALNAME, "friendly_ext2", FS_COLUMN_MARKUP, _("For Linux computers"), FS_COLUMN_SENSITIVE, TRUE, -1); gtk_tree_store_insert_with_values(model, NULL, NULL, 100 /*Always at end*/, FS_COLUMN_REALNAME, "friendly_hfsplus", FS_COLUMN_MARKUP, _("For Apple computers"), FS_COLUMN_SENSITIVE, TRUE, -1); GtkTreeIter parent = {0, NULL}; gtk_tree_store_insert_with_values(model, &parent, NULL, 100 /*Always at end*/, FS_COLUMN_REALNAME, "specific_fs", FS_COLUMN_MARKUP, _("Specific Filesystem"), FS_COLUMN_SENSITIVE, TRUE, -1); /* Populate the specific fs list */ struct _setup_fs_duple s; s.model = model; s.parent = &parent; dialog->fs_map = build_supported_fs_list(); g_hash_table_foreach(dialog->fs_map, setup_fs_cb, &s); }
GtkWidget * gnc_main_window_summary_new (void) { GNCMainSummary * retval = g_new0(GNCMainSummary, 1); GtkCellRenderer *textRenderer; int i; // These options lead to a better looking layout for the combo-box, where // the "Assets: $####.##" and "Profit: $####.##" values are visually next // to each other. gboolean expandOptions[] = { TRUE, FALSE, TRUE, FALSE, TRUE }; retval->datamodel = gtk_list_store_new( N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); retval->hbox = gtk_hbox_new (FALSE, 5); retval->totals_combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (retval->datamodel)); g_object_unref (retval->datamodel); retval->component_id = gnc_register_gui_component (WINDOW_SUMMARYBAR_CM_CLASS, summarybar_refresh_handler, NULL, retval); gnc_gui_component_watch_entity_type (retval->component_id, GNC_ID_ACCOUNT, QOF_EVENT_DESTROY | GNC_EVENT_ITEM_CHANGED); for ( i = 0; i < N_COLUMNS; i++ ) { textRenderer = GTK_CELL_RENDERER(gtk_cell_renderer_text_new()); gtk_cell_layout_pack_start( GTK_CELL_LAYOUT(retval->totals_combo), textRenderer, expandOptions[i] ); gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(retval->totals_combo), textRenderer, "text", i ); } gtk_container_set_border_width (GTK_CONTAINER (retval->hbox), 2); gtk_box_pack_start (GTK_BOX(retval->hbox), retval->totals_combo, TRUE, TRUE, 5); gtk_widget_show (retval->totals_combo); gtk_widget_show (retval->hbox); g_signal_connect_swapped (G_OBJECT (retval->hbox), "destroy", G_CALLBACK (gnc_main_window_summary_destroy_cb), retval); gnc_main_window_summary_refresh(retval); retval->cnxn_id = gnc_gconf_add_anon_notification(GCONF_SECTION, gconf_client_notify_cb, retval); return retval->hbox; }
static void combo_add_columns (GtkComboBox *combo) { GtkCellRenderer *renderer; gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo)); renderer = gtk_cell_renderer_pixbuf_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), renderer, "pixbuf", NFS_HOST_COL_PIXBUF); g_object_unref (renderer); renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), renderer, "text", NFS_HOST_COL_NAME); g_object_unref (renderer); }
static void rejilla_mime_filter_init (RejillaMimeFilter * obj) { GtkListStore *store; GtkCellRenderer *renderer; gtk_box_set_spacing (GTK_BOX (obj), 6); obj->priv = g_new0 (RejillaMimeFilterPrivate, 1); store = gtk_list_store_new (REJILLA_MIME_FILTER_NB_COL, G_TYPE_ICON, G_TYPE_STRING, G_TYPE_INT, G_TYPE_POINTER); obj->combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); g_object_unref (G_OBJECT (store)); renderer = gtk_cell_renderer_pixbuf_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (obj->combo), renderer, FALSE); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (obj->combo), renderer, "gicon", REJILLA_MIME_FILTER_ICON_COL); renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (obj->combo), renderer, FALSE); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (obj->combo), renderer, "text", REJILLA_MIME_FILTER_DISPLAY_COL); gtk_box_pack_end (GTK_BOX (obj), obj->combo, FALSE, FALSE, 0); obj->priv->table = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL); }
void seahorse_combo_keys_attach (GtkComboBox *combo, GcrCollection *collection, const gchar *none_option) { GtkTreeModel *model; GtkTreeIter iter; GtkCellRenderer *renderer; GList *l, *objects; g_object_set_data_full (G_OBJECT (combo), "combo-keys-closure", combo_closure_new (), combo_closure_free); /* Setup the None Option */ model = gtk_combo_box_get_model (combo); if (!model) { model = GTK_TREE_MODEL (gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER)); gtk_combo_box_set_model (combo, model); gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo)); renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), renderer, "markup", COMBO_MARKUP); } /* Setup the object list */ objects = gcr_collection_get_objects (collection); for (l = objects; l != NULL; l = g_list_next (l)) on_collection_added (collection, l->data, combo); g_list_free (objects); g_signal_connect_after (collection, "added", G_CALLBACK (on_collection_added), combo); g_signal_connect_after (collection, "removed", G_CALLBACK (on_collection_removed), combo); if (none_option) { gtk_list_store_prepend (GTK_LIST_STORE (model), &iter); gtk_list_store_set (GTK_LIST_STORE (model), &iter, COMBO_LABEL, NULL, COMBO_MARKUP, none_option, COMBO_POINTER, NULL, -1); } gtk_tree_model_get_iter_first (model, &iter); gtk_combo_box_set_active_iter (combo, &iter); g_signal_connect_data (combo, "destroy", G_CALLBACK (on_combo_destroy), g_object_ref (collection), (GClosureNotify)g_object_unref, 0); }
void init_engine_list() { //presumes the container & combo are created //presumes the combo is NOT registered GtkCellRenderer * r; EngineModel = gtk_list_store_new(ENGINE_COL_COUNT,G_TYPE_STRING, G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,GDK_TYPE_PIXBUF); gchar * local_engine_dir = g_strjoin("/",g_get_home_dir(),".emerald/engines",NULL); gtk_combo_box_set_model(GTK_COMBO_BOX(EngineCombo),GTK_TREE_MODEL(EngineModel)); r = gtk_cell_renderer_pixbuf_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(EngineCombo),r,FALSE); gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(EngineCombo),r,"pixbuf",ENGINE_COL_ICON); r = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(EngineCombo),r,TRUE); gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(EngineCombo),r,"markup",ENGINE_COL_MARKUP); engine_scan_dir(local_engine_dir); g_free(local_engine_dir); engine_scan_dir(ENGINE_DIR); register_setting(EngineCombo,ST_ENGINE_COMBO,"engine","engine"); }
static void setup_volume_treeview (FormatDialog* dialog) { GtkTreeStore* model; GtkCellRenderer* icon_renderer; GtkCellRenderer* text_renderer; GtkComboBox* combo = dialog->volume_combo; /* udi, icon, name, sensitive */ model = gtk_tree_store_new(4, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_BOOLEAN); gtk_combo_box_set_model(combo, GTK_TREE_MODEL(model)); /* Set up the column */ gtk_cell_layout_pack_start( GTK_CELL_LAYOUT(combo), (icon_renderer = gtk_cell_renderer_pixbuf_new()), FALSE /* expand? */); gtk_cell_layout_pack_start( GTK_CELL_LAYOUT(combo), (text_renderer = gtk_cell_renderer_text_new()), TRUE ); gtk_cell_layout_add_attribute( GTK_CELL_LAYOUT(combo), icon_renderer, "pixbuf", DEV_COLUMN_ICON ); gtk_cell_layout_add_attribute( GTK_CELL_LAYOUT(combo), icon_renderer, "sensitive", DEV_COLUMN_SENSITIVE ); gtk_cell_layout_add_attribute( GTK_CELL_LAYOUT(combo), text_renderer, "markup", DEV_COLUMN_NAME_MARKUP ); gtk_cell_layout_add_attribute( GTK_CELL_LAYOUT(combo), text_renderer, "sensitive", DEV_COLUMN_SENSITIVE ); /* Do some miscellaneous things */ dialog->icon_cache = create_icon_cache(); dialog->volume_model = model; }
static void attachment_icon_view_constructed (GObject *object) { GtkCellLayout *cell_layout; GtkCellRenderer *renderer; cell_layout = GTK_CELL_LAYOUT (object); /* This needs to happen after constructor properties are set * so that GtkCellLayout.get_area() returns something valid. */ renderer = gtk_cell_renderer_pixbuf_new (); g_object_set (renderer, "stock-size", icon_size, NULL); gtk_cell_layout_pack_start (cell_layout, renderer, FALSE); gtk_cell_layout_add_attribute ( cell_layout, renderer, "gicon", E_ATTACHMENT_STORE_COLUMN_ICON); renderer = gtk_cell_renderer_text_new (); g_object_set ( renderer, "alignment", PANGO_ALIGN_CENTER, "wrap-mode", PANGO_WRAP_WORD, "wrap-width", 150, "yalign", 0.0, NULL); gtk_cell_layout_pack_start (cell_layout, renderer, FALSE); gtk_cell_layout_add_attribute ( cell_layout, renderer, "text", E_ATTACHMENT_STORE_COLUMN_CAPTION); renderer = gtk_cell_renderer_progress_new (); g_object_set (renderer, "text", _("Loading"), NULL); gtk_cell_layout_pack_start (cell_layout, renderer, TRUE); gtk_cell_layout_add_attribute ( cell_layout, renderer, "value", E_ATTACHMENT_STORE_COLUMN_PERCENT); gtk_cell_layout_add_attribute ( cell_layout, renderer, "visible", E_ATTACHMENT_STORE_COLUMN_LOADING); renderer = gtk_cell_renderer_progress_new (); g_object_set (renderer, "text", _("Saving"), NULL); gtk_cell_layout_pack_start (cell_layout, renderer, TRUE); gtk_cell_layout_add_attribute ( cell_layout, renderer, "value", E_ATTACHMENT_STORE_COLUMN_PERCENT); gtk_cell_layout_add_attribute ( cell_layout, renderer, "visible", E_ATTACHMENT_STORE_COLUMN_SAVING); e_extensible_load_extensions (E_EXTENSIBLE (object)); }
static VALUE rg_add_attribute(VALUE self, VALUE cell, VALUE attribute, VALUE column) { const gchar *name; if (SYMBOL_P(attribute)) { name = rb_id2name(SYM2ID(attribute)); } else { name = RVAL2CSTR(attribute); } gtk_cell_layout_add_attribute(_SELF(self), RVAL2RENDERER(cell), name, NUM2INT(column)); return self; }
static void hd_bookmark_widgets_setup_column_renderes (HDWidgets *widgets, GtkCellLayout *column) { GtkCellRenderer *renderer; renderer = gtk_cell_renderer_pixbuf_new (); gtk_cell_layout_pack_start (column, renderer, FALSE); gtk_cell_layout_add_attribute (column, renderer, "pixbuf", 3); /* Add the label renderer */ renderer = gtk_cell_renderer_text_new (); g_object_set (renderer, "xpad", HILDON_MARGIN_DOUBLE, NULL); gtk_cell_layout_pack_start (column, renderer, FALSE); gtk_cell_layout_add_attribute (column, renderer, "text", 0); }