void dialog_graphical_options_channel (DialogGraphicalOptions * dlg) { int i; for (i = 0; i <= sys->channel[channel].cg->n; ++i) { gtk_combo_box_text_remove (dlg->combo_section, 0); gtk_combo_box_text_remove (dlg->combo_evolution_section, 0); } channel = gtk_combo_box_get_active (GTK_COMBO_BOX (dlg->combo_channel)); dialog_graphical_options_sections (dlg); gtk_combo_box_set_active (GTK_COMBO_BOX (dlg->combo_evolution_section), evolution_section); gtk_combo_box_set_active (GTK_COMBO_BOX (dlg->combo_section), section); }
static void tb80211_update_chan_type(void) { static unsigned int tb80211_type_cnt; unsigned int i; int oldtype = -1; for (i = 0; i < tb80211_type_cnt; i++) { gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(tb80211_chan_type_box), 0); } if (!tb80211_current_iface) { return; } oldtype = tb80211_current_type; tb80211_current_type = -1; i = 0; add_channel_type(CHAN_NO_HT, oldtype, i++); if (tb80211_current_iface->channel_types & (1 << WS80211_CHAN_HT20)) { add_channel_type(CHAN_HT20, oldtype, i++); } if (tb80211_current_iface->channel_types & (1 << WS80211_CHAN_HT40MINUS)) { add_channel_type(CHAN_HT40MINUS, oldtype, i++); } if (tb80211_current_iface->channel_types & (1 << WS80211_CHAN_HT40PLUS)) { add_channel_type(CHAN_HT40PLUS, oldtype, i++); } tb80211_type_cnt = i; }
static void tb80211_update_freq(void) { static unsigned int tb80211_freq_cnt; unsigned int i; gchar *str; gint32 oldfreq = 0; for (i = 0; i < tb80211_freq_cnt; i++) { gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(tb80211_freq_list_box), 0); } oldfreq = tb80211_current_freq; tb80211_current_freq = -1; if (!tb80211_current_iface) return; tb80211_freq_cnt = tb80211_current_iface->frequencies->len; for (i = 0; i < tb80211_freq_cnt; i++) { int freq; freq = g_array_index(tb80211_current_iface->frequencies, int, i); str = g_strdup_printf("%d MHz (%d)", freq, ws80211_frequency_to_channel(freq)); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(tb80211_freq_list_box), str); g_free(str); if (freq == oldfreq) { gtk_combo_box_set_active(GTK_COMBO_BOX(tb80211_freq_list_box), i); tb80211_current_freq = oldfreq; } } }
static VALUE rg_remove(VALUE self, VALUE position) { gtk_combo_box_text_remove(_SELF(self), NUM2INT(position)); return self; }
/* * Update channel combo box. If the airpcap interface is "Any", the combo box will be disabled. */ void airpcap_update_channel_combo(GtkWidget* channel_cb, airpcap_if_info_t* if_info) { if(!if_info || airpcap_if_is_any(if_info) || !airpcap_if_selected) { gtk_combo_box_set_active(GTK_COMBO_BOX(channel_cb), -1); change_airpcap_settings = FALSE; gtk_widget_set_sensitive(GTK_WIDGET(channel_cb),FALSE); } else { while (gtk_tree_model_iter_n_children(gtk_combo_box_get_model(GTK_COMBO_BOX(channel_cb)), NULL) > 0) { gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(channel_cb), 0); } if (if_info->pSupportedChannels != NULL && if_info->numSupportedChannels > 0){ guint i; for (i = 0; i<(if_info->numSupportedChannels); i++){ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(channel_cb), ieee80211_mhz_to_str(airpcap_if_selected->pSupportedChannels[i].Frequency)); } } airpcap_channel_combo_set_by_frequency(channel_cb, if_info->channelInfo.Frequency); change_airpcap_settings = TRUE; gtk_widget_set_sensitive(GTK_WIDGET(channel_cb), TRUE); } }
void combo_box_remove (gpointer p, int pos) { #if GTK_MAJOR_VERSION >= 3 gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(p), pos); #else gtk_combo_box_remove_text(GTK_COMBO_BOX(p), pos); #endif }
void checkTheWord(char* word,int checkDoc) { #if 1 int correct; AspellWordList* suggestions; AspellStringEnumeration* elements; const char* suggestedword; int wordcnt=0; char* wordlist[100]; char* labeltext[512]; correct=aspell_speller_check(spellChecker,word,-1); if(!correct) { badWord=word; cancelCheck=false; if(spellCheckWord==NULL) buildWordCheck(checkDoc); else { for(int j=0; j<numWords; j++) gtk_combo_box_text_remove((GtkComboBoxText*)wordListDropbox,0); sprintf((char*)&labeltext,"Change <i><b>%s</b></i> to: ",badWord); gtk_label_set_text((GtkLabel*)badWordLabel,(char*)&labeltext); gtk_label_set_use_markup((GtkLabel*)badWordLabel,true); } suggestions=(AspellWordList*)aspell_speller_suggest(spellChecker,word,-1); elements=aspell_word_list_elements(suggestions); while((suggestedword=aspell_string_enumeration_next(elements))!=NULL) { wordlist[wordcnt]=strdup(suggestedword); gtk_combo_box_text_append_text((GtkComboBoxText*)wordListDropbox,wordlist[wordcnt]); wordcnt++; } numWords=wordcnt; delete_aspell_string_enumeration(elements); gtk_combo_box_set_active((GtkComboBox*)wordListDropbox,0); gtk_widget_show_all(spellCheckWord); gtk_dialog_run((GtkDialog *)spellCheckWord); } #endif }
static void as_setup_format_combo(GawSndData *snd) { GtkWidget *combo = snd->w_format; snd_pcm_format_t format = snd->sparams->format; snd_pcm_t *pcm; snd_pcm_hw_params_t *hwparams; snd_pcm_format_mask_t *formatMask; AsFormatList *p; int i ; int err; for ( i = snd->n_format ; i > 0; i-- ){ gtk_combo_box_text_remove (GTK_COMBO_BOX_TEXT (combo), i - 1 ); } snd->n_format = 0; snd_pcm_hw_params_alloca(&hwparams); snd_pcm_format_mask_alloca(&formatMask); err = snd_pcm_open(&pcm, snd->sparams->device_name, SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK); if ( err < 0 ) { return; } err = snd_pcm_hw_params_any(pcm, hwparams); if ( err < 0 ) { snd_pcm_close(pcm); return; } snd_pcm_hw_params_get_format_mask(hwparams, formatMask); for( p = as_format_list, i = 0 ; p->name ; p++, i++ ){ if ( snd_pcm_format_mask_test ( formatMask, p->format ) < 0 ){ continue; } gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), p->name ); // msg_dbg("as_format %d '%s'", snd->n_format, p->name ); snd->n_format++; if ( p->format == format ) { gtk_combo_box_set_active (GTK_COMBO_BOX (combo), i); } } snd_pcm_close(pcm); }
static void as_setup_rate_combo (GawSndData *snd) { unsigned int rate = snd->sparams->rate; GtkWidget *combo = snd->w_rate; snd_pcm_t *pcm; snd_pcm_hw_params_t *hwparams; char **p; unsigned int val; int i ; int err; for ( i = snd->n_rate ; i > 0; i-- ){ gtk_combo_box_text_remove (GTK_COMBO_BOX_TEXT (combo), i - 1 ); } snd->n_rate = 0; snd_pcm_hw_params_alloca(&hwparams); err = snd_pcm_open(&pcm, snd->sparams->device_name, SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK); if ( err < 0 ) { return; } err = snd_pcm_hw_params_any(pcm, hwparams); if ( err < 0 ) { snd_pcm_close(pcm); return; } for ( p = as_rate_list, i = 0 ; *p ; p++, i++ ){ val = (unsigned int) g_ascii_strtoull ( *p, NULL, 10 ); if ( snd_pcm_hw_params_test_rate ( pcm, hwparams, val, 0 ) < 0 ){ continue; } gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), *p); // msg_dbg("as_rate %d '%s'", snd->n_rate, *p ); snd->n_rate++; if ( val == rate ) { gtk_combo_box_set_active (GTK_COMBO_BOX (combo), i); } } snd_pcm_close(pcm); }
static void fill_combo_box_entry(GtkComboBox **box, uint32_t count, GList **items, gboolean *multi) { GList *iter; // FIXME: use gtk_combo_box_text_remove_all() in future (gtk 3.0) // https://bugzilla.gnome.org/show_bug.cgi?id=324899 gtk_list_store_clear(GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(*box)))); // FIXME: how to make a nice empty combo box without the append/remove? if(count == 0) { gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(*box), ""); gtk_combo_box_set_active(GTK_COMBO_BOX(*box), 0); gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(*box), 0); *multi = FALSE; return; } if(count > 1) { gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(*box), _("<leave unchanged>")); // FIXME: should be italic! gtk_combo_box_set_button_sensitivity(GTK_COMBO_BOX(*box), GTK_SENSITIVITY_AUTO); *multi = TRUE; } else { gtk_combo_box_set_button_sensitivity(GTK_COMBO_BOX(*box), GTK_SENSITIVITY_OFF); *multi = FALSE; } if((iter = g_list_first(*items)) != NULL) { do { gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(*box), iter->data); // FIXME: dt segfaults when there // are illegal characters in the // string. } while((iter = g_list_next(iter)) != NULL); } gtk_combo_box_set_active(GTK_COMBO_BOX(*box), 0); }
/* Set the fiscal year end on a GncPeriodSelect widget. If set to a * value other than NULL then widget will include fiscal accounting * period like "this fiscal year". */ void gnc_period_select_set_fy_end (GncPeriodSelect *period, const GDate *fy_end) { GncPeriodSelectPrivate *priv; const gchar *label; gint i; g_return_if_fail(period != NULL); g_return_if_fail(GNC_IS_PERIOD_SELECT(period)); priv = GNC_PERIOD_SELECT_GET_PRIVATE(period); if (priv->fy_end) g_date_free(priv->fy_end); if (fy_end) { priv->fy_end = g_date_new_dmy(g_date_get_day(fy_end), g_date_get_month(fy_end), G_DATE_BAD_YEAR); } else { priv->fy_end = NULL; } if (fy_end) { for (i = GNC_ACCOUNTING_PERIOD_CYEAR_LAST; i < GNC_ACCOUNTING_PERIOD_FYEAR_LAST; i++) { label = priv->start ? _(start_strings[i]) : _(end_strings[i]); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(priv->selector), label); } } else { for (i = GNC_ACCOUNTING_PERIOD_FYEAR_LAST - 1; i >= GNC_ACCOUNTING_PERIOD_FYEAR_LAST; i--) { gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(priv->selector), i); } } }
/** * bastile_gpgme_generate_show: * @sksrc: the gpgme source * @parent: the parent window * @name: The user name, can be NULL if not available * @email: The user's email address, can be NULL if not available * @comment: The comment to add to the key. Can be NULL * * Shows the gpg key generation dialog, sets default entries. * */ void bastile_gpgme_generate_show (BastileGpgmeSource *sksrc, GtkWindow *parent, const gchar * name, const gchar *email, const gchar *comment) { BastileWidget *swidget; GtkWidget *widget, *datetime; time_t expires; guint i; swidget = bastile_widget_new ("pgp-generate", parent); /* Widget already present */ if (swidget == NULL) return; if (name) { widget = bastile_widget_get_widget (swidget, "name-entry"); g_return_if_fail (widget != NULL); gtk_entry_set_text(GTK_ENTRY(widget),name); } if (email) { widget = bastile_widget_get_widget (swidget, "email-entry"); g_return_if_fail (widget != NULL); gtk_entry_set_text(GTK_ENTRY(widget),email); } if (comment) { widget = bastile_widget_get_widget (swidget, "comment-entry"); g_return_if_fail (widget != NULL); gtk_entry_set_text(GTK_ENTRY(widget),comment); } widget = bastile_widget_get_widget (swidget, "pgp-image"); g_return_if_fail (widget != NULL); gtk_image_set_from_stock (GTK_IMAGE (widget), BASTILE_STOCK_SECRET, GTK_ICON_SIZE_DIALOG); /* The algoritms */ widget = bastile_widget_get_widget (swidget, "algorithm-choice"); g_return_if_fail (widget != NULL); #if GTK_CHECK_VERSION (2,91,2) gtk_combo_box_text_remove (GTK_COMBO_BOX_TEXT (widget), 0); for(i = 0; i < G_N_ELEMENTS(available_algorithms); i++) gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), _(available_algorithms[i].desc)); #else gtk_combo_box_remove_text (GTK_COMBO_BOX (widget), 0); for(i = 0; i < G_N_ELEMENTS(available_algorithms); i++) gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _(available_algorithms[i].desc)); #endif gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); on_gpgme_generate_algorithm_changed (GTK_COMBO_BOX (widget), swidget); expires = time (NULL); expires += (60 * 60 * 24 * 365); /* Seconds in a year */ /* Default expiry date */ widget = bastile_widget_get_widget (swidget, "expiry-date-container"); g_return_if_fail (widget != NULL); datetime = egg_datetime_new_from_time_t (expires); gtk_box_pack_start (GTK_BOX (widget), datetime, TRUE, TRUE, 0); gtk_widget_set_sensitive (datetime, FALSE); gtk_widget_show_all (widget); g_object_ref (sksrc); g_object_set_data_full (G_OBJECT (swidget), "source", sksrc, g_object_unref); on_gpgme_generate_entry_changed (NULL, swidget); }
/* * Update the channel offset of the given combobox according to the given frequency. */ void airpcap_update_channel_offset_combo(airpcap_if_info_t* if_info, guint chan_freq, GtkWidget *channel_offset_cb, gboolean set) { gint current_offset; gint new_offset; guint i; gint active_idx = 0; gint idx_count = -1; if (!if_info || airpcap_if_is_any(if_info) || if_info->pSupportedChannels == NULL || if_info->numSupportedChannels < 1) { gtk_widget_set_sensitive(GTK_WIDGET(channel_offset_cb),FALSE); gtk_combo_box_set_active(GTK_COMBO_BOX(channel_offset_cb), -1); return; } new_offset = current_offset = if_info->channelInfo.ExtChannel; /* Clear out the list */ while (gtk_tree_model_iter_n_children(gtk_combo_box_get_model(GTK_COMBO_BOX(channel_offset_cb)), NULL) > 0) { gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(channel_offset_cb), 0); } gtk_widget_set_sensitive(GTK_WIDGET(channel_offset_cb), TRUE); for (i = 0; i < if_info->numSupportedChannels; i++) { if (if_info->pSupportedChannels[i].Frequency == chan_freq) { /* If we can't be low or high, nudge the offset to 0 */ if (current_offset == -1 && !(if_info->pSupportedChannels[i].Flags & FLAG_CAN_BE_LOW)) { new_offset = 0; } else if (current_offset == 1 && !(if_info->pSupportedChannels[i].Flags & FLAG_CAN_BE_HIGH)) { new_offset = 0; } if ((if_info->pSupportedChannels[i].Flags & FLAG_CAN_BE_LOW)) { gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(channel_offset_cb), "-1"); idx_count++; if (new_offset == -1) { active_idx = idx_count; } } gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(channel_offset_cb), "0"); idx_count++; if (new_offset == 0) { active_idx = idx_count; } if ((if_info->pSupportedChannels[i].Flags & FLAG_CAN_BE_HIGH)){ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(channel_offset_cb), "+1"); idx_count++; if (new_offset == 1) { active_idx = idx_count; } } break; } } gtk_combo_box_set_active(GTK_COMBO_BOX(channel_offset_cb), active_idx); if (set) { change_airpcap_settings = TRUE; if_info->channelInfo.ExtChannel = new_offset; if (!airpcap_update_frequency_and_offset(if_info)){ simple_dialog(ESD_TYPE_ERROR,ESD_BTN_OK,"Adapter failed to be set with the following settings: Frequency - %d Extension Channel - %d", if_info->channelInfo.Frequency, if_info->channelInfo.ExtChannel); } } if (idx_count < 1) { gtk_widget_set_sensitive(channel_offset_cb, FALSE); } }