void combo_set_vals (GtkWidget *combo, GList *strlist, const char *str) { g_return_if_fail(GTK_IS_COMBO(combo)); if (!strlist) { gtk_list_clear_items (GTK_LIST (GTK_COMBO (combo)->list), 0, -1); } else { /* * gtk_combo_set_popdown_strings (actually gtk_list_insert_items) * automatically selects the first one and puts it into entry. * That should not happen. Drop selection mode for a moment * to prevent that. */ gtk_list_set_selection_mode (GTK_LIST (GTK_COMBO (combo)->list), GTK_SELECTION_SINGLE); gtk_combo_set_popdown_strings (GTK_COMBO (combo), strlist); gtk_list_set_selection_mode (GTK_LIST (GTK_COMBO (combo)->list), GTK_SELECTION_BROWSE); } if (str) { gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (combo)->entry), str); gtk_entry_set_position (GTK_ENTRY (GTK_COMBO (combo)->entry), 0); } else { gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (combo)->entry), ""); } }
PRIVATE void refresh_combo(Control *control) { Data *data = control->g->data; if( ((Data *)control->g->data)->list != NULL ) gtk_combo_set_popdown_strings( GTK_COMBO(control->widget), data->list ); }
static GtkWidget * create_combo (void) { GList *cbitems; GtkCombo *combo; cbitems = NULL; cbitems = g_list_append (cbitems, "item0"); cbitems = g_list_append (cbitems, "item1 item1"); cbitems = g_list_append (cbitems, "item2 item2 item2"); cbitems = g_list_append (cbitems, "item3 item3 item3 item3"); cbitems = g_list_append (cbitems, "item4 item4 item4 item4 item4"); cbitems = g_list_append (cbitems, "item5 item5 item5 item5 item5 item5"); cbitems = g_list_append (cbitems, "item6 item6 item6 item6 item6"); cbitems = g_list_append (cbitems, "item7 item7 item7 item7"); cbitems = g_list_append (cbitems, "item8 item8 item8"); cbitems = g_list_append (cbitems, "item9 item9"); combo = GTK_COMBO (gtk_combo_new ()); gtk_combo_set_popdown_strings (combo, cbitems); gtk_entry_set_text (GTK_ENTRY (combo->entry), "hello world"); gtk_editable_select_region (GTK_EDITABLE (combo->entry), 0, -1); return GTK_WIDGET (combo); }
int GetPrinterToGList(const char* combo_name) { PrintersInfo* printers = NULL; GList* list = NULL; GtkWidget *combo = NULL, *entry = NULL; PrinterInfo* info = NULL; int i = 0; printers = g_printers; if(NULL == printers){ if(GetAllPrinters() < 0){ return -1; } printers = g_printers; } for(i = 0; i < g_list_length(printers->printer_list); i++){ info = (PrinterInfo*)g_list_nth_data(printers->printer_list, i); if(info != NULL){ list = g_list_append(list, info->name); } } combo = glade_xml_get_widget(g_main_xml, combo_name); if(combo != NULL){ entry = GTK_COMBO(combo)->entry; } if(list != NULL){ gtk_combo_set_popdown_strings(GTK_COMBO(combo), list); gtk_entry_set_text(GTK_ENTRY(entry), printers->curr_printer->name); g_list_free(list); } return 0; }
static void search_text(viewer_t *viewer, int from_start) { char *text = (char *) gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(viewer->search_combo)->entry)); int info_only = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(viewer->search_info)); int case_sensitive = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(viewer->search_case)); GList *item; if ( *text == '\0' ) return; item = g_list_find_custom(viewer->search_list, text, (GCompareFunc) strcmp); if ( item == NULL ) { text = strdup(text); } else { text = g_list_nth_data(item, 0); viewer->search_list = g_list_remove(viewer->search_list, text); } viewer->search_list = g_list_prepend(viewer->search_list, text); gtk_combo_set_popdown_strings(GTK_COMBO(viewer->search_combo), viewer->search_list) ; gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(viewer->search_combo)->entry), text); gdk_window_set_cursor(viewer->window->window, viewer->cursor_watch); gdk_flush(); list_search_text(viewer->list, text, from_start, info_only, case_sensitive); gdk_window_set_cursor(viewer->window->window, NULL); }
GtkWidget * TPCCTableProps_new (test_t * lpBench) { TPCCTableProps *newdlg = TPCC_TABLE_PROPS (gtk_type_new (TPCCTableProps_get_type ())); ServerDSN *dsn; int inx; newdlg->lpBench = lpBench; dsn = SERVER_DSN (newdlg->dsn = ServerDSN_new (lpBench)); gtk_signal_connect (GTK_OBJECT (newdlg->dsn), "dsns_changed", GTK_SIGNAL_FUNC (set_dsn_combos), newdlg->combos); for (inx = 0; inx < 9; inx++) { if (dsn->dsn_info.dsns) gtk_combo_set_popdown_strings (GTK_COMBO (newdlg->combos[inx]), dsn->dsn_info.dsns); gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (newdlg->combos[inx])->entry), lpBench->tpc.c.tableDSNS[inx]); } gtk_spin_button_set_value (GTK_SPIN_BUTTON (newdlg->n_ware), newdlg->lpBench->tpc.c.count_ware); return (GTK_WIDGET (newdlg)); }
void gmdb_schema_new_cb(GtkWidget *w, gpointer data) { GList *glist = NULL; GtkWidget *combo; MdbCatalogEntry *entry; int i; /* load the interface */ schemawin_xml = glade_xml_new(GMDB_GLADEDIR "gmdb-schema.glade", NULL, NULL); /* connect the signals in the interface */ glade_xml_signal_autoconnect(schemawin_xml); /* set up capabilities call back. TODO: autoconnect should do that */ combo = glade_xml_get_widget(schemawin_xml, "combo-list2"); g_signal_connect( G_OBJECT (combo), "selection_changed", G_CALLBACK(gmdb_schema_capabilities_cb), schemawin_xml); /* set signals with user data, anyone know how to do this in glade? */ combo = glade_xml_get_widget (schemawin_xml, "table_combo"); glist = g_list_append(glist, ALL_TABLES); /* add all user tables in catalog to list */ for (i=0; i < mdb->num_catalog; i++) { entry = g_ptr_array_index (mdb->catalog, i); if (mdb_is_user_table(entry)) { glist = g_list_append(glist, entry->object_name); } } /* for */ gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist); g_list_free(glist); check_default_options(); refresh_available_options(); }
void ShowURLDialog(void) { urlItem *item; if (URLDialog) gtkRaise(URLDialog); else URLDialog = CreateURLDialog(); item = listMgr(URLLIST_GET, 0); if (item) { g_list_free(urlEntries); urlEntries = NULL; while (item) { urlEntries = g_list_append(urlEntries, (gchar *)item->url); item = item->next; } } if (urlEntries) { gtk_entry_set_text(GTK_ENTRY(urlEntry), urlEntries->data); gtk_combo_set_popdown_strings(GTK_COMBO(urlCombo), urlEntries); } gtk_widget_show(URLDialog); }
GtkWidget * make_families_menu () { GtkWidget *combo; int n_families; PangoFontFamily **families; GList *family_list = NULL; int i; pango_context_list_families (context, &families, &n_families); qsort (families, n_families, sizeof(char *), cmp_families); for (i=0; i<n_families; i++) family_list = g_list_prepend (family_list, pango_font_family_get_name (families[i])); family_list = g_list_reverse (family_list); combo = gtk_combo_new (); gtk_combo_set_popdown_strings (GTK_COMBO (combo), family_list); gtk_combo_set_value_in_list (GTK_COMBO (combo), TRUE, FALSE); gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (combo)->entry), FALSE); gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (combo)->entry), pango_font_description_get_family(font_description)); gtk_signal_connect (GTK_OBJECT (GTK_COMBO (combo)->entry), "changed", GTK_SIGNAL_FUNC (set_family), NULL); g_list_free (family_list); return combo; }
static void gtkam_chooser_set_port_list (GtkamChooser *chooser, GList *list) { gchar *port; guint i; g_return_if_fail (GTKAM_IS_CHOOSER (chooser)); if (list) { /* Remember the old entry */ port = g_strdup (gtk_entry_get_text ( chooser->priv->entry_port)); gtk_combo_set_popdown_strings (chooser->priv->combo_port, list); for (i = 0; i < g_list_length (list); i++) if (!strcmp (g_list_nth_data (list, i), port)) gtk_entry_set_text (chooser->priv->entry_port, port); g_free (port); gtk_widget_set_sensitive ( GTK_WIDGET (chooser->priv->combo_port), TRUE); gtk_widget_set_sensitive ( GTK_WIDGET (chooser->priv->button_add), TRUE); } else { gtk_widget_set_sensitive ( GTK_WIDGET (chooser->priv->combo_port), FALSE); gtk_widget_set_sensitive ( GTK_WIDGET (chooser->priv->button_add), FALSE); } }
static void populate_user_list(login_dlg *ldlg) { GSList *l; GList *strings = NULL; JamHost *host = ldlg->curhost; JamAccount *acc; gtk_widget_set_sensitive(ldlg->bupdate, JAM_HOST_IS_LJ(ldlg->curhost)); for (l = host->accounts; l != NULL; l = l->next) { strings = g_list_append(strings, (char*)jam_account_get_username(l->data)); } if (strings) gtk_combo_set_popdown_strings(GTK_COMBO(ldlg->cusername), strings); else gtk_list_clear_items(GTK_LIST(GTK_COMBO(ldlg->cusername)->list), 0, -1); if (host->lastaccount) { acc = host->lastaccount; } else if (host->accounts) { acc = host->accounts->data; } else { acc = NULL; } gtk_entry_set_text(GTK_ENTRY(ldlg->eusername), acc ? jam_account_get_username(acc) : ""); load_account(ldlg, acc); }
void ShowURLDialogBox( void ) { if ( URL ) gtkActive( URL ); else URL=create_URL(); if ( urlList ) { urlItem * item = urlList; g_list_free( URLComboEntrys ); URLComboEntrys=NULL; while( item ) { URLComboEntrys=g_list_append( URLComboEntrys,(gchar *)item->url ); item=item->next; } } if ( URLComboEntrys ) { gtk_entry_set_text( GTK_ENTRY( URLEntry ),URLComboEntrys->data ); gtk_combo_set_popdown_strings( GTK_COMBO( URLCombo ),URLComboEntrys ); } gtk_widget_show( URL ); }
static void gtkam_chooser_update_for_model (GtkamChooser *chooser) { const gchar *model; int m, result, i; CameraAbilities a; GtkWidget *dialog; GList *list; /* Get abilities of selected model */ model = gtk_entry_get_text (chooser->priv->entry_model); if (!model || !*model) return; m = gp_abilities_list_lookup_model (chooser->priv->al, model); result = gp_abilities_list_get_abilities (chooser->priv->al, m, &a); if (result < 0) { dialog = gtkam_error_new (result, NULL, GTK_WIDGET (chooser), _("Could not get abilities of model '%s'."), model); gtk_widget_show (dialog); return; } /* Update port combo */ gtkam_chooser_set_port_mask (chooser, a.port); /* Update speed combo */ list = g_list_append (NULL, _("Best")); for (i = 0; a.speed[i]; i++) list = g_list_append (list, g_strdup_printf ("%i", a.speed[i])); gtk_combo_set_popdown_strings (chooser->priv->combo_speed, list); gtk_widget_set_sensitive (GTK_WIDGET (chooser->priv->combo_speed), !(a.port == GP_PORT_USB)); }
int doProperties() { GtkWidget *optionsWindow; optionsWindow = gtk_dialog_new_with_buttons("Properties",GTK_WINDOW(window),GTK_DIALOG_DESTROY_WITH_PARENT,GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL ); GtkWidget *vbox; vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(optionsWindow)->vbox), vbox); gtk_window_set_modal(GTK_WINDOW(optionsWindow), TRUE); gtk_window_set_keep_above(GTK_WINDOW(optionsWindow), TRUE); GtkWidget* deviceLabel; deviceLabel = gtk_label_new("Device"); gtk_box_pack_start(GTK_BOX(vbox),deviceLabel, FALSE, FALSE, 5); GtkWidget *combo; GList *items = NULL; items = g_list_append (items, "/dev/ttyUSB0"); //items = g_list_append (items, "First Item"); combo = gtk_combo_new (); gtk_combo_set_popdown_strings (GTK_COMBO (combo), items); gtk_box_pack_start(GTK_BOX(vbox),combo, FALSE, FALSE, 5); GtkWidget *timeSwitch; timeSwitch = gtk_check_button_new_with_label("Display time"); gtk_box_pack_start(GTK_BOX(vbox),timeSwitch, FALSE, FALSE, 5); gtk_widget_show_all(optionsWindow); return 0; }
static GtkWidget *get_video_channels_widget() { GtkWidget *vbox; GList *channellist = NULL; vbox = gtk_vbox_new(FALSE, 20); if (channels) { int i; for (i=0;channels[i];i++) channellist = g_list_append(channellist, channels[i]->name); } channelcombo = gtk_combo_new(); if (channellist) gtk_combo_set_popdown_strings (GTK_COMBO (channelcombo), channellist); if (current_channel >= 0) gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(channelcombo)->entry), channels[current_channel]->name); gtk_signal_connect(GTK_OBJECT(GTK_COMBO(channelcombo)->entry), "changed", GTK_SIGNAL_FUNC (channel_changed), NULL); gtk_box_pack_start(GTK_BOX(vbox), channelcombo, TRUE, FALSE, 0); gtk_widget_show(channelcombo); return vbox; }
static void callback_audioCodecChanged( GtkWidget *widget, gpointer data ) { int codec = selectedAudioCodecIndex(); int i; if (g_VcrCompDialog.audioAttribGList != 0) { g_list_free( g_VcrCompDialog.audioAttribGList ); g_VcrCompDialog.audioAttribGList = 0; } for (i = 0; i < VCRComp_numAudioCodecAttribs( codec ); i++) g_VcrCompDialog.audioAttribGList = g_list_append( g_VcrCompDialog.audioAttribGList, (gchar*)VCRComp_audioCodecAttribName( codec, i ) ); if (g_VcrCompDialog.audioAttribGList == 0) { gtk_widget_set_sensitive( g_VcrCompDialog.audioAttribCombo, FALSE ); gtk_widget_set_sensitive( g_VcrCompDialog.audioAttribEntry, FALSE ); gtk_widget_set_sensitive( g_VcrCompDialog.audioAttribChangeButton, FALSE ); gtk_entry_set_text( GTK_ENTRY(g_VcrCompDialog.audioAttribEntry), "" ); } else { gtk_widget_set_sensitive( g_VcrCompDialog.audioAttribCombo, TRUE ); gtk_widget_set_sensitive( g_VcrCompDialog.audioAttribEntry, TRUE ); gtk_widget_set_sensitive( g_VcrCompDialog.audioAttribChangeButton, TRUE ); gtk_combo_set_popdown_strings( GTK_COMBO(g_VcrCompDialog.audioAttribCombo), g_VcrCompDialog.audioAttribGList ); callback_audioAttribChanged( NULL, NULL ); } }
void ifselect(GtkWidget *widget,gpointer data) { gint i = 0; GtkWidget *dialog; GtkWidget *_hbox; GtkWidget *label; GList *glist=NULL; GtkWidget *ifCombo; dialog = gnome_dialog_new(_("Choose a interface to capture"),_("OK"),NULL,NULL); _hbox = gtk_hbox_new(FALSE,0); label = gtk_label_new("Choose an interface: "); ifCombo = gtk_combo_new(); for (i = 0; i < ifnum; i++) { glist = g_list_append(glist, ifitem[i].ifname); } gtk_combo_set_popdown_strings( GTK_COMBO(ifCombo), glist); gtk_box_pack_start(GTK_BOX(_hbox),label,FALSE,FALSE,5); gtk_box_pack_start(GTK_BOX(_hbox),ifCombo,FALSE,FALSE,5); gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),_hbox,TRUE,TRUE,0); gtk_signal_connect(GTK_OBJECT(GTK_COMBO(ifCombo)->entry), "activate", GTK_SIGNAL_FUNC (get_ifcard_str),NULL); gtk_widget_show(ifCombo); gtk_widget_show(label); gtk_widget_show(_hbox); gtk_signal_connect(GTK_OBJECT(dialog),"clicked",GTK_SIGNAL_FUNC(dialog_ok),&dialog); gtk_window_set_modal(GTK_WINDOW(dialog),TRUE); gtk_widget_show(dialog); gnome_dialog_set_parent(GNOME_DIALOG(dialog),GTK_WINDOW(app)); }
static GtkWidget *toolbar_add_zoom(GtkWidget *box) // Add zoom combo box { int i; static char *txt[] = { "10%", "20%", "25%", "33%", "50%", "100%", "200%", "300%", "400%", "800%", "1200%", "1600%", "2000%", NULL }; GtkWidget *combo, *combo_entry; GList *combo_list = NULL; combo = gtk_combo_new(); gtk_combo_set_value_in_list (GTK_COMBO (combo), FALSE, FALSE); gtk_widget_show (combo); combo_entry = GTK_COMBO (combo)->entry; GTK_WIDGET_UNSET_FLAGS (combo_entry, GTK_CAN_FOCUS); gtk_widget_set_usize(GTK_COMBO(combo)->button, 18, -1); #if GTK_MAJOR_VERSION == 1 gtk_widget_set_usize(combo, 75, -1); #else /* #if GTK_MAJOR_VERSION == 2 */ gtk_entry_set_width_chars(GTK_ENTRY(combo_entry), 6); #endif gtk_entry_set_editable( GTK_ENTRY(combo_entry), FALSE ); for ( i=0; txt[i]; i++ ) combo_list = g_list_append( combo_list, txt[i] ); gtk_combo_set_popdown_strings( GTK_COMBO(combo), combo_list ); g_list_free( combo_list ); gtk_entry_set_text( GTK_ENTRY(combo_entry), "100%" ); pack(box, combo); return (combo); }
static void set_dsn_combos (GtkWidget * check, gpointer widget) { TPCATableProps *tbl = TPCA_TABLE_PROPS (widget); ServerDSN *dsn = SERVER_DSN (check); if (dsn->dsn_info.dsns) { gtk_combo_set_popdown_strings (GTK_COMBO (tbl->branch_dsn), dsn->dsn_info.dsns); gtk_combo_set_popdown_strings (GTK_COMBO (tbl->teller_dsn), dsn->dsn_info.dsns); gtk_combo_set_popdown_strings (GTK_COMBO (tbl->account_dsn), dsn->dsn_info.dsns); gtk_combo_set_popdown_strings (GTK_COMBO (tbl->history_dsn), dsn->dsn_info.dsns); } }
/* * Sets the properties of the widget. This is used for both applying the * properties changed in the property editor, and also for loading. */ static void gb_combo_set_properties (GtkWidget * widget, GbWidgetSetArgData * data) { gboolean value_in_list, ok_if_empty, case_sensitive, arrows, arrows_always; gchar *items; GList *item_list = NULL; value_in_list = gb_widget_input_bool (data, ValueInList); if (data->apply) { gtk_object_set_data (GTK_OBJECT (widget), ValueInList, value_in_list ? "TRUE" : NULL); } ok_if_empty = gb_widget_input_bool (data, OKIfEmpty); if (data->apply) { gtk_object_set_data (GTK_OBJECT (widget), OKIfEmpty, ok_if_empty ? "TRUE" : NULL); } case_sensitive = gb_widget_input_bool (data, Case); if (data->apply) gtk_combo_set_case_sensitive (GTK_COMBO (widget), case_sensitive); arrows = gb_widget_input_bool (data, Arrows); if (data->apply) gtk_combo_set_use_arrows (GTK_COMBO (widget), arrows); arrows_always = gb_widget_input_bool (data, Always); if (data->apply) gtk_combo_set_use_arrows_always (GTK_COMBO (widget), arrows_always); items = gb_widget_input_text (data, Items); if (data->apply) { gchar *pos = items; gchar *items_end = &items[strlen (items)]; while (pos < items_end) { gchar *item_end = strchr (pos, '\n'); if (item_end == NULL) item_end = items_end; *item_end = '\0'; item_list = g_list_append (item_list, pos); pos = item_end + 1; } if (item_list) gtk_combo_set_popdown_strings (GTK_COMBO (widget), item_list); else gtk_list_clear_items (GTK_LIST (GTK_COMBO (widget)->list), 0, -1); g_list_free (item_list); } if (data->action == GB_APPLYING) g_free (items); }
void gmdb_table_export_populate_dialog(GladeXML *xml) { GList *glist = NULL; GtkWidget *combo; /* Create the widgets */ combo = glade_xml_get_widget (xml, "term_combo"); glist = g_list_append(glist, LF); glist = g_list_append(glist, CR); glist = g_list_append(glist, CRLF); gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist); g_list_free(glist); combo = glade_xml_get_widget (xml, "sep_combo"); glist = NULL; glist = g_list_append(glist, COMMA); glist = g_list_append(glist, TAB); glist = g_list_append(glist, SPACE); glist = g_list_append(glist, COLON); glist = g_list_append(glist, SEMICOLON); glist = g_list_append(glist, PIPE); gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist); g_list_free(glist); combo = glade_xml_get_widget (xml, "quote_combo"); glist = NULL; glist = g_list_append(glist, ALWAYS); glist = g_list_append(glist, NEVER); glist = g_list_append(glist, AUTOMAT); gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist); g_list_free(glist); combo = glade_xml_get_widget (xml, "qchar_combo"); glist = NULL; glist = g_list_append(glist, "\""); glist = g_list_append(glist, "'"); glist = g_list_append(glist, "`"); gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist); g_list_free(glist); }
void ShowEquConfig( void ) { GList * Items = NULL; if ( EquConfig ) gtkActive( EquConfig ); else EquConfig=create_EquConfig(); Items=g_list_append( Items,(gpointer)MSGTR_EQU_Front_Right ); Items=g_list_append( Items,(gpointer)MSGTR_EQU_Front_Left ); Items=g_list_append( Items,(gpointer)MSGTR_EQU_Back_Right ); Items=g_list_append( Items,(gpointer)MSGTR_EQU_Back_Left ); Items=g_list_append( Items,(gpointer)MSGTR_EQU_Center ); Items=g_list_append( Items,(gpointer)MSGTR_EQU_Bass ); gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel1 ),Items ); gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel2 ),Items ); gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel3 ),Items ); gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel4 ),Items ); gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel5 ),Items ); gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel6 ),Items ); g_list_free( Items ); gtk_entry_set_text( GTK_ENTRY( CEChannel1 ),gtkEquChannel1 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel1 ),FALSE ); gtk_entry_set_text( GTK_ENTRY( CEChannel2 ),gtkEquChannel2 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel2 ),FALSE ); gtk_entry_set_text( GTK_ENTRY( CEChannel3 ),gtkEquChannel3 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel3 ),FALSE ); gtk_entry_set_text( GTK_ENTRY( CEChannel4 ),gtkEquChannel4 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel4 ),FALSE ); gtk_entry_set_text( GTK_ENTRY( CEChannel5 ),gtkEquChannel5 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel5 ),FALSE ); gtk_entry_set_text( GTK_ENTRY( CEChannel6 ),gtkEquChannel6 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel6 ),FALSE ); gtk_widget_show( EquConfig ); gtkSetLayer( EquConfig ); }
static void set_dsn_combos (GtkWidget * check, gpointer widget) { GtkWidget **combos = (GtkWidget **) widget; ServerDSN *dsn = SERVER_DSN (check); if (dsn->dsn_info.dsns) { int inx; for (inx = 0; inx < 9; inx++) gtk_combo_set_popdown_strings (GTK_COMBO (combos[inx]), dsn->dsn_info.dsns); } }
int clip_GTK_COMBOSETPOPDOWNSTRINGS(ClipMachine * ClipMachineMemory) { C_widget *ccmb = _fetch_cw_arg(ClipMachineMemory); ClipArrVar *astr = (ClipArrVar *) _clip_vptr(_clip_spar(ClipMachineMemory, 2)); GList *str_list = NULL; gchar *text_utf; ClipStrVar *s; int i; CHECKCWID(ccmb, GTK_IS_COMBO); CHECKOPT(2, ARRAY_type_of_ClipVarType); for (i = 0; i < astr->count; i++) { if (astr->items[i].t.ClipVartype_type_of_ClipType != CHARACTER_type_of_ClipVarType) continue; s = (ClipStrVar *) _clip_vptr(&astr->items[i]); text_utf = _clip_locale_to_utf8(s->str.buf); if (ccmb->objtype == GTK_WIDGET_COMBO_SIMPLE) { str_list = g_list_append(str_list, gtk_list_item_new_with_label(text_utf)); g_free(text_utf); } else str_list = g_list_append(str_list, text_utf); } if (ccmb->objtype == GTK_WIDGET_COMBO_SIMPLE) { gtk_list_clear_items(GTK_LIST(GTK_COMBO(ccmb->widget)->list), 0, -1); gtk_list_append_items(GTK_LIST(GTK_COMBO(ccmb->widget)->list), str_list); } else gtk_combo_set_popdown_strings(GTK_COMBO(ccmb->widget), str_list); /* while (str_list) { g_free(str_list->data); str_list = g_list_next(str_list); } */ return 0; err: return 1; }
/*--------------------------------------------------------------------------*/ static void add_select_download_page( GnomeDruid *wdruid, GdkPixbuf *logo ) { GtkWidget *wvbox; GdkColor druid_bg_color = DRUID_BG_COLOR; GdkColor druid_title_color = DRUID_TITLE_COLOR; GtkWidget *whbox, *wcombo; GList *name_list = NULL; GList *p; Site *site; gb_debug (DEBUG_UPDATE, "START"); download_page = gnome_druid_page_standard_new_with_vals (_("Select download site"), logo, NULL); gnome_druid_page_standard_set_background(GNOME_DRUID_PAGE_STANDARD(download_page), &druid_bg_color); gnome_druid_page_standard_set_logo_background(GNOME_DRUID_PAGE_STANDARD(download_page), &druid_bg_color); gnome_druid_page_standard_set_title_foreground( GNOME_DRUID_PAGE_STANDARD(download_page), &druid_title_color); gnome_druid_append_page( wdruid, GNOME_DRUID_PAGE(download_page) ); wvbox = GNOME_DRUID_PAGE_STANDARD(download_page)->vbox; whbox = gtk_hbox_new( FALSE, 10 ); gtk_container_set_border_width( GTK_CONTAINER(whbox), 20 ); gtk_box_pack_start( GTK_BOX(wvbox), whbox, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX(whbox), gtk_label_new( _("Download site:") ), FALSE, TRUE, 0 ); if ( site_list == NULL ) { site_list = read_site_list(); } for ( p=site_list; p!= NULL; p=p->next ) { site = (Site *)p->data; name_list = g_list_append( name_list, site->name ); } wcombo = gtk_combo_new(); gtk_combo_set_popdown_strings( GTK_COMBO(wcombo), name_list ); g_list_free( name_list ); name_list = NULL; site_entry = GTK_COMBO(wcombo)->entry; gtk_entry_set_editable( GTK_ENTRY(site_entry), FALSE ); gtk_box_pack_start( GTK_BOX(whbox), wcombo, TRUE, TRUE, 0 ); gb_debug (DEBUG_UPDATE, "END"); }
gchar *input_dialog_combo(const gchar *title, const gchar *message, const gchar *default_string, GList *list, gboolean case_sensitive) { if (dialog) return NULL; input_dialog_create(INPUT_DIALOG_COMBO); if (!list) { GList empty_list; empty_list.data = (gpointer)""; empty_list.next = NULL; empty_list.prev = NULL; gtk_combo_set_popdown_strings(GTK_COMBO(combo), &empty_list); } else gtk_combo_set_popdown_strings(GTK_COMBO(combo), list); gtk_combo_set_case_sensitive(GTK_COMBO(combo), case_sensitive); return input_dialog_open(title, message, default_string); }
void SetGListToCombo(const char *combo_widget, GList *glist, const gchar *curr_name) { GtkWidget *entry = NULL, *combo = NULL; combo = glade_xml_get_widget(g_cngplp_xml,combo_widget); if(combo != NULL){ entry = GTK_COMBO(combo)->entry; } if((glist != NULL) || (curr_name != NULL)){ gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist); gtk_entry_set_text(GTK_ENTRY(entry), curr_name); } }
void combo_set_items(Combo *combo, GList *item_strings, int default_index) { updating_flag = TRUE; gtk_combo_set_popdown_strings(GTK_COMBO(combo),item_strings); if (default_index < g_list_length(item_strings) && default_index >= 0) { gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), (gchar *)g_list_nth_data(item_strings, default_index)); combo->chosen_index = default_index; } else combo->chosen_index = 0; updating_flag = FALSE; gtk_signal_emit(GTK_OBJECT(combo),combo_signals[CHANGED_SIGNAL]); }
PRIVATE void init_combo( Control *control ) { GtkCombo *cb; cb = GTK_COMBO( gtk_combo_new() ); g_assert( cb != NULL ); gtk_combo_disable_activate( cb ); if( ((Data *)control->g->data)->list != NULL ) gtk_combo_set_popdown_strings( cb, ((Data *)control->g->data)->list ); gtk_signal_connect( GTK_OBJECT( cb->entry ), "activate", GTK_SIGNAL_FUNC(entry_activated), control ); control->widget = GTK_WIDGET(cb); }
void on_menu_options_preferences_activate (GtkMenuItem *menuitem, gpointer user_data) { GtkToggleButton *button; GtkCombo *combo; GtkRange *range; GtkSpinButton *spinner; GList *items; int i; vo_driver_t const *drivers; items = NULL; if( !preferences_window ) { preferences_window = create_preferences_window(); } /* set the combo box up with the correct values. */ combo = GTK_COMBO(lookup_widget(GTK_WIDGET(preferences_window), "video_output_driver_combo" )); gchar * vidpref = NULL; drivers = vo_drivers(); for( i = 0; drivers[i].name; i++ ) { items = g_list_append(items, drivers[i].name); // while looking through the list of available video drivers, // the prefered driver is xv2, followed by xv, and finally x11. // If the user hasn't selected one, this one will be used. if ( !strcmp(drivers[i].name,"xv2") || (!vidpref && !strcmp(drivers[i].name,"xv"))) { if (vidpref) free(vidpref); vidpref=g_strdup(drivers[i].name); } } if (!vidpref) vidpref=g_strdup("x11"); gtk_combo_set_popdown_strings(combo, items); if( !options.video_driver_ptr ) options.video_driver_ptr = vidpref; else if (vidpref) free(vidpref); gtk_entry_set_text(GTK_ENTRY(combo->entry), (const gchar*)options.video_driver_ptr); handle_simple_preferences(true); gtk_widget_show(preferences_window); }