void ToolPageLayer::setLayerCount(int layer, int selected)
{
	XOJ_CHECK_TYPE(ToolPageLayer);

	this->inCbUpdate = true;

	int count = gtk_tree_model_iter_n_children(gtk_combo_box_get_model(GTK_COMBO_BOX(this->layerComboBox)), NULL);

	for (int i = count - 1; i >= 0; i--)
	{
		gtk_combo_box_remove_text(GTK_COMBO_BOX(this->layerComboBox), i);
	}

	gtk_combo_box_append_text(GTK_COMBO_BOX(this->layerComboBox), _C("Background"));
	for (int i = 1; i <= layer; i++)
	{
		string text = FS(_F("Layer {1}") % i);
		gtk_combo_box_prepend_text(GTK_COMBO_BOX(this->layerComboBox), text.c_str());
	}

	setSelectedLayer(selected);

	this->layerCount = layer;
	this->inCbUpdate = false;
}
예제 #2
0
/* Set items in the key_array and value_array to GtkComboBox */
void SetTextArrayToComboBox(GtkWidget* window, gchar *combo_name,
		const gchar* key_array[], const short value_array[], short value)
{
	int index = 0;
	int i;

	GtkWidget* combo = LookupWidget(window, combo_name);

	/* Remove all items in current list */
	if(gtk_combo_box_get_active_text( GTK_COMBO_BOX( combo )) ){
		while( 1 ){
			gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), 0 );
			if( ! gtk_combo_box_get_active_text( GTK_COMBO_BOX( combo )) ) break;
			gtk_combo_box_remove_text( GTK_COMBO_BOX( combo ), 0 );
		}
	}

	/* Add items in "key_array" */
	for( i = 0 ; key_array[i] != NULL ; i++ )
	{
		gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), LookupText(g_keytext_list, key_array[i]) );
		if( value_array[i] == value ) index = i;
	}

	/* Set active item */
	gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), index );
}
예제 #3
0
static void
signed_off_cb(PurpleConnection *gc)
{
	int i = 0;
	GList *l;

	if (!console)
		return;

	l = console->accounts;
	while (l) {
		PurpleConnection *g = l->data;
		if (gc == g)
			break;
		i++;
		l = l->next;
	}

	if (l == NULL)
		return;

	gtk_combo_box_remove_text(GTK_COMBO_BOX(console->dropdown), i);
	console->accounts = g_list_remove(console->accounts, gc);
	console->count--;

	if (gc == console->gc) {
		console->gc = NULL;
		gtk_imhtml_append_text(GTK_IMHTML(console->imhtml),
				       _("<font color='#c8c8c8'>Logged out.</font>"), 0);
	}
}
예제 #4
0
파일: window.c 프로젝트: risujin/cellwriter
void unicode_block_toggle(int block, int on)
{
        int pos, active, training_block_saved;

        if (block < 0 || unicode_blocks[block].enabled == on)
                return;
        unicode_blocks[block].enabled = on;
        active = gtk_combo_box_get_active(GTK_COMBO_BOX(blocks_combo));
        pos = block_unicode_to_combo(block);
        training_block_saved = training_block;
        if (!on)
                gtk_combo_box_remove_text(GTK_COMBO_BOX(blocks_combo), pos);
        else
                gtk_combo_box_insert_text(GTK_COMBO_BOX(blocks_combo), pos,
                                          unicode_blocks[block].name);
        update_enabled_samples();
        if ((!on && block <= training_block_saved) || active < 0)
                gtk_combo_box_set_active(GTK_COMBO_BOX(blocks_combo),
                                         active > 0 ? active - 1 : 0);

        /* Are we out of blocks? */
        if (gtk_combo_box_get_active(GTK_COMBO_BOX(blocks_combo)) < 0) {
                training_block = -1;
                cell_widget_train();
        }
}
예제 #5
0
void ComboOptionView::reset() {
	if (myComboBox == 0) {
		return;
	}

	for (; myListSize > 0; --myListSize) {
		gtk_combo_box_remove_text(myComboBox, 0);
	}
	const ZLComboOptionEntry &comboOptionEntry = (ZLComboOptionEntry&)*myOption;
	const std::vector<std::string> &values = comboOptionEntry.values();
	const std::string &initial = comboOptionEntry.initialValue();
	myListSize = values.size();
	mySelectedIndex = -1;
	int index = 0;

	for (std::vector<std::string>::const_iterator it = values.begin(); it != values.end(); ++it, ++index) {
		if (*it == initial) {
			mySelectedIndex = index;
		}
		gtk_combo_box_append_text(myComboBox, it->c_str());
	}

	if (mySelectedIndex >= 0) {
		gtk_combo_box_set_active(myComboBox, mySelectedIndex);
	}
}
예제 #6
0
void GTKComboBox::DeleteItem(const char *Text)
{
	int a = getPossitionOf(Text);
	if (a == -1)
		return;
	gtk_combo_box_remove_text(ComboBox, Items[a].ComboPos);
}
예제 #7
0
/*
 * 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_remove_text(GTK_COMBO_BOX(channel_cb), 0);
        }
        
        if (if_info != NULL && if_info->pSupportedChannels != NULL && if_info->numSupportedChannels > 0){
            guint i;
            for (i = 0; i<(if_info->numSupportedChannels); i++){
                gtk_combo_box_append_text(GTK_COMBO_BOX(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);
    }
}
예제 #8
0
파일: utils_gui.c 프로젝트: rosedu/osmo
void
utl_gui_create_category_combobox (GtkComboBox *combo_box, GtkListStore *store, gboolean none) {

GtkTreeIter iter;
gchar *category;
gint i, n;

    n = utl_gui_get_combobox_items(combo_box);

    gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), -1);

    for (i = n-1; i >= 0; i--) {
        gtk_combo_box_remove_text (GTK_COMBO_BOX (combo_box), i);
    }

    if (none == TRUE) {
        gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), _("None"));
    } else {
        gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), _("All items"));
    }

    i = 0;

    while (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, i++)) {

        gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &category, -1);
        gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), category);
        g_free(category);
    }

}
void populate_config_combo(GtkWidget *combo)
{
	int index = 0;

	// clear the combo box
	GtkTreeIter iter;
	GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(combo));

	while (gtk_tree_model_get_iter_first(model, &iter))
	{
		gtk_combo_box_remove_text(GTK_COMBO_BOX(combo), index);
		model = gtk_combo_box_get_model(GTK_COMBO_BOX(combo));
	}

	index = 0;
	for (int a = 0; a < colour_configs.size(); a++)
	{
		gtk_combo_box_append_text(GTK_COMBO_BOX(combo), colour_configs[a].name.c_str());
		string ccfg = col_config;

		if (ccfg == colour_configs[a].name)
		{
			index = a;
			current = &colour_configs[a];
		}
	}

	gtk_combo_box_set_active(GTK_COMBO_BOX(combo), index);
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkChoicePeer_nativeRemoveAll
  (JNIEnv *env, jobject obj)
{
  void *ptr;
  GtkTreeModel *model;
  GtkWidget *bin;
  gint count, i;

  gdk_threads_enter ();

  ptr = NSA_GET_PTR (env, obj);
  bin = choice_get_widget (GTK_WIDGET (ptr));
  
  model = gtk_combo_box_get_model (GTK_COMBO_BOX (bin));
  count = gtk_tree_model_iter_n_children (model, NULL);

  /* First, unselect everything, to avoid problems when removing items. */
  gtk_combo_box_set_active (GTK_COMBO_BOX (bin), -1);

  for (i = count - 1; i >= 0; i--) {
    gtk_combo_box_remove_text (GTK_COMBO_BOX (bin), i);
  }

  gdk_threads_leave ();
}
예제 #11
0
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			   
}
예제 #12
0
  /* Put an allocated string on the history list and combo text list
     |  if it is not a duplicate.  The history_list is just a shadow of the
     |  combo list, but I think is needed because I don't see an api for reading
     |  the combo strings.  The combo box strings take "const gchar *", so the
     |  same allocated string can go in both the history list and the combo list.
     |  If removed from both lists, a string can be freed.
   */
static void
command_history_add (gchar * cmd)
{
  GList *list;
  gchar *s;
  gint i;

  if (!cmd || !*cmd)
    return;

  /* Check for a duplicate command.  If found, move it to the
     |  top of the list and similarly modify the combo box strings.
   */
  for (i = 0, list = history_list; list; list = list->next, ++i)
    {
      s = (gchar *) list->data;
      if (!strcmp (cmd, s))
	{
	  history_list = g_list_remove (history_list, s);
	  history_list = g_list_prepend (history_list, s);
	  gtk_combo_box_remove_text (GTK_COMBO_BOX
				     (ghidgui->command_combo_box), i);
	  gtk_combo_box_prepend_text (GTK_COMBO_BOX
				      (ghidgui->command_combo_box), s);
	  return;
	}
    }

  /* Not a duplicate, so put first in history list and combo box text list.
   */
  s = g_strdup (cmd);
  history_list = g_list_prepend (history_list, s);
  gtk_combo_box_prepend_text (GTK_COMBO_BOX (ghidgui->command_combo_box), s);

  /* And keep the lists trimmed!
   */
  if (g_list_length (history_list) > ghidgui->history_size)
    {
      s = (gchar *) g_list_nth_data (history_list, ghidgui->history_size);
      history_list = g_list_remove (history_list, s);
      gtk_combo_box_remove_text (GTK_COMBO_BOX (ghidgui->command_combo_box),
				 ghidgui->history_size);
      g_free (s);
    }
}
예제 #13
0
void clear_combobox(const char *widget_name)
{
    GtkWidget *w = get_widget_checked(widget_name);
    int x=0;
    while (1 /* gtk_combo_box_get_active(GTK_COMBO_BOX(w)) != -1*/) {
        gtk_combo_box_remove_text(GTK_COMBO_BOX(w), 0);
        if (++x>MAX_BANDS) break;
    }
}
예제 #14
0
static void
fill_type_combo (JanaGtkRecurrence *self)
{
	gchar *recur_string;
	
	JanaGtkRecurrencePrivate *priv = RECURRENCE_PRIVATE (self);
	JanaRecurrence *recur = jana_recurrence_new ();
	
	if (priv->recur) recur->interval = priv->recur->interval;
	
	/* Daily */
	recur_string = jana_utils_recurrence_to_string (recur, NULL);
	gtk_combo_box_insert_text (GTK_COMBO_BOX (priv->type_combo), 1,
		recur_string);
	gtk_combo_box_remove_text (GTK_COMBO_BOX (priv->type_combo), 2);
	g_free (recur_string);

	/* Weekly */
	recur->type = JANA_RECURRENCE_WEEKLY;
	recur_string = jana_utils_recurrence_to_string (recur, NULL);
	gtk_combo_box_insert_text (GTK_COMBO_BOX (priv->type_combo), 2,
		recur_string);
	gtk_combo_box_remove_text (GTK_COMBO_BOX (priv->type_combo), 3);
	g_free (recur_string);

	/* Monthly */
	recur->type = JANA_RECURRENCE_MONTHLY;
	recur_string = jana_utils_recurrence_to_string (recur, NULL);
	gtk_combo_box_insert_text (GTK_COMBO_BOX (priv->type_combo), 3,
		recur_string);
	gtk_combo_box_remove_text (GTK_COMBO_BOX (priv->type_combo), 4);
	g_free (recur_string);

	/* Yearly */
	recur->type = JANA_RECURRENCE_YEARLY;
	recur_string = jana_utils_recurrence_to_string (recur, NULL);
	gtk_combo_box_insert_text (GTK_COMBO_BOX (priv->type_combo), 4,
		recur_string);
	gtk_combo_box_remove_text (GTK_COMBO_BOX (priv->type_combo), 5);
	g_free (recur_string);
	
	jana_recurrence_free (recur);
}
예제 #15
0
void on_btn_notification_date_remove(GtkWidget *widget, gpointer data)
{
    gint n_active;

    n_active = gtk_combo_box_get_active(GTK_COMBO_BOX(notification_date_combo));

    if(n_active != -1) {
       gtk_combo_box_remove_text(GTK_COMBO_BOX(notification_date_combo), n_active);
       value_del_time_when_notify(n_active);
    }
}
예제 #16
0
파일: combo.c 프로젝트: magnush/mhwaveedit
void combo_remove_item(Combo *combo, int item_index)
{
     int i;
     gchar *c;
     i = combo_selected_index(combo);
     g_assert(i != item_index);
     gtk_combo_box_remove_text(GTK_COMBO_BOX(combo),item_index);
     c = (gchar *)g_list_nth_data(combo->strings,item_index);
     /* printf("Removing:  selected_index %d, string %s\n",i,c); */
     combo->strings = g_list_remove(combo->strings,c);
     g_free(c);
}
예제 #17
0
static void custom_configurations_received_callback(bool_t res)
{
	int i,j;

	if (res==TRUE)
	{
		PRINT("%s %s %i - Request success !\n",__FILE__,__FUNCTION__,__LINE__);

		gdk_threads_enter();

		for (i=1;i<NB_CONFIG_CATEGORIES;i++)
		{
			PRINT("Got %i ids for category %i\n",available_configurations[i].nb_configurations,i);

			if (available_configurations[i].nb_configurations==0)
			{
				gtk_combo_box_remove_text (GTK_COMBO_BOX(ihm_config.custom_config_values[i].combo),0);
				gtk_combo_box_insert_text(GTK_COMBO_BOX(ihm_config.custom_config_values[i].combo),0,"no custom config. detected");
			}
			else
			{
				for (j=0;j<available_configurations[i].nb_configurations;j++)
				{
					gtk_combo_box_remove_text (GTK_COMBO_BOX(ihm_config.custom_config_values[i].combo),j);
					gtk_combo_box_insert_text(GTK_COMBO_BOX(ihm_config.custom_config_values[i].combo),j,available_configurations[i].list[j].id);
				}
			}
		}
		//gtk_widget_show_all(ihm_config.window);
		gdk_threads_leave();
	}
	else
	{
		PRINT("%s %s %i - Request failure !\n",__FILE__,__FUNCTION__,__LINE__);
	}
}
예제 #18
0
void horniakBete()
{
	MYSQL_ROW row;

	mysql_query(dbElkartea, "select HIzena from Hornitzaileak order by HGakoa");
	rstHornitzaileak = mysql_use_result(dbElkartea);
	int i=0;
	while ((row=mysql_fetch_row(rstHornitzaileak))!=NULL)
	{
		gtk_combo_box_remove_text (GTK_COMBO_BOX(cmbHornitzaileak), i);
		gtk_combo_box_insert_text (GTK_COMBO_BOX(cmbHornitzaileak), i, row[0]);
		i++;
	}
	mysql_free_result(rstHornitzaileak);
}
예제 #19
0
void wxComboBox::Delete(unsigned int n)
{
    wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );

#ifdef __WXGTK24__
    if (!gtk_check_version(2,4,0))
    {
        wxCHECK_RET( IsValid(n), wxT("invalid index") );

        GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
        gtk_combo_box_remove_text( combobox, n );
    }
    else
#endif
    {
        GtkList *listbox = GTK_LIST( GTK_COMBO(m_widget)->list );

        GList *child = g_list_nth( listbox->children, n );

        if (!child)
        {
            wxFAIL_MSG(wxT("wrong index"));
            return;
        }

        DisableEvents();

        GList *list = g_list_append( (GList*) NULL, child->data );
        gtk_list_remove_items( listbox, list );
        g_list_free( list );

        EnableEvents();
    }

    wxList::compatibility_iterator node = m_clientObjectList.Item( n );
    if (node)
    {
        wxClientData *cd = (wxClientData*)node->GetData();
        if (cd) delete cd;
        m_clientObjectList.Erase( node );
    }

    node = m_clientDataList.Item( n );
    if (node)
        m_clientDataList.Erase( node );

    InvalidateBestSize();
}
예제 #20
0
파일: combobox.c 프로젝트: amery/clip-itk
int
clip_GTK_COMBOBOXREMOVETEXT(ClipMachine * cm)
{
	C_widget   *ccmb = _fetch_cw_arg(cm);
        gint         pos = _clip_parni(cm, 2);

	CHECKCWID(ccmb,GTK_IS_COMBO_BOX);
        CHECKARG(2, NUMERIC_t);

	pos --;
	gtk_combo_box_remove_text(GTK_COMBO_BOX(ccmb->widget), pos);

	return 0;
err:
	return 1;
}
예제 #21
0
void ZLGtkApplicationWindow::GtkEntryParameter::setValueList(const std::vector<std::string> &values) {
	if (myItem.type() == ZLToolbar::Item::TEXT_FIELD) {
		return;
	}

	GtkComboBox *comboBox = GTK_COMBO_BOX(myWidget);

	int size = gtk_tree_model_iter_n_children(gtk_combo_box_get_model(comboBox), 0);
	for (; size > 0; --size) {
		gtk_combo_box_remove_text(comboBox, 0);
	}

	for (std::vector<std::string>::const_iterator it = values.begin(); it != values.end(); ++it) {
		gtk_combo_box_append_text(comboBox, it->c_str());
	}
}
예제 #22
0
/* Make a list of available items of specified object , and Set the list to GtkComboBox */
short SetItemsToComboBox(GtkWidget* window, gchar *combo_name, short objectid , short currentid)
{
	GtkWidget* combo = LookupWidget(window, combo_name);

	LPCNCLDB lpdb = g_uidb.lpdbTop;
	char *str;
	short i,active_item,item_count;


	/* Remove all items in current list */
	if(gtk_combo_box_get_active_text( GTK_COMBO_BOX( combo )) ){
	
	
		while( 1 ){
			gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), 0 );
			if( ! gtk_combo_box_get_active_text( GTK_COMBO_BOX( combo )) ) break;
			gtk_combo_box_remove_text( GTK_COMBO_BOX( combo ), 0 );
		}
	}


	/* Add available list (not disable items from UIDB ) */
	item_count = 0;
	active_item = 0;
	for( i = 0 ; i < g_uidb.dbsize ; i++, lpdb++ )
	{
		if( lpdb->nObjectID == objectid )
		{
			str = ValueToName(lpdb->nObjectID, lpdb->nValue);

			if( str != NULL )
			{
				if( *str != '\0' && lpdb->disable == 0 ){
					/* append one item */
					gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), str );
					if( lpdb->nValue == currentid ) active_item = item_count;
					item_count++;
				}
			}
		}
	}

	/* Set active item */
	gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), active_item );

	return item_count;
}
예제 #23
0
static void datuakKargatu()
{
	MYSQL_ROW row;

	mysql_query(dbElkartea, "SELECT Aizenaeus FROM Aukerak ORDER BY AOrdena");
	rstAukerak = mysql_use_result(dbElkartea);
	int i=0;
	while ((row=mysql_fetch_row(rstAukerak))!=NULL)
	{
		gtk_combo_box_remove_text (GTK_COMBO_BOX(cmbAukerak), i);
		gtk_combo_box_insert_text (GTK_COMBO_BOX(cmbAukerak), i, row[0]);
		i++;
	}
	mysql_free_result(rstAukerak);

	horniakBete();
}
예제 #24
0
/* Set items in "GList" to GtkComboBox */
short SetGListToComboBox(GtkWidget* window, gchar *combo_name,
									GList* glist, gchar* current , short objectid )
{
	GtkWidget* combo = LookupWidget(window, combo_name);
	GList* glist_tmp = glist;

	short	current_id;
	char *str;
	short active_item,item_count;

	
	/* Remove all items in current list */
	if(gtk_combo_box_get_active_text( GTK_COMBO_BOX( combo )) ){
	
		while( 1 ){
			gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), 0 );
			if( ! gtk_combo_box_get_active_text( GTK_COMBO_BOX( combo )) ) break;
			gtk_combo_box_remove_text( GTK_COMBO_BOX( combo ), 0 );
		}
	}


	/* Add items in "glist" */
	item_count = 0;
	active_item = 0;
	current_id = NameToValue( objectid , (char *)current);

	while( glist_tmp )
	{
		str = (char *)glist_tmp->data;

		if( str != NULL )
		{
			/* append one item */
			gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), str );
			if( current_id == NameToValue( objectid , str ) )  active_item = item_count;
			item_count++;
		}
		glist_tmp = glist_tmp->next;
	}

	/* Set active item */
	gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), active_item );

	return item_count;
}
JNIEXPORT void JNICALL 
Java_gnu_java_awt_peer_gtk_GtkChoicePeer_nativeRemove 
  (JNIEnv *env, jobject obj, jint index)
{
  void *ptr;
  GtkWidget *bin;
  
  gdk_threads_enter ();

  ptr = NSA_GET_PTR (env, obj);
  bin = choice_get_widget (GTK_WIDGET (ptr));

  /* First, unselect everything, to avoid problems when removing items. */
  gtk_combo_box_set_active (GTK_COMBO_BOX (bin), -1);
  gtk_combo_box_remove_text (GTK_COMBO_BOX (bin), index);

  gdk_threads_leave ();
}
예제 #26
0
void changeType(GtkComboBox *widget, gpointer user_data){
	WidgetData *data = (WidgetData *)user_data;
	if(gtk_combo_box_get_active(GTK_COMBO_BOX(data->mainCombo)) == 0){
		gtk_combo_box_remove_text (GTK_COMBO_BOX(data->combo),0);
		gtk_combo_box_remove_text (GTK_COMBO_BOX(data->combo),0);
		gtk_combo_box_remove_text (GTK_COMBO_BOX(data->combo2),0);
		gtk_combo_box_remove_text (GTK_COMBO_BOX(data->combo2),0);
		
		gtk_combo_box_append_text(GTK_COMBO_BOX(data->combo), "Pounds (lbs)");
		gtk_combo_box_append_text(GTK_COMBO_BOX(data->combo), "Kilograms (kgs)");
	
		gtk_combo_box_append_text(GTK_COMBO_BOX(data->combo2), "Pounds (lbs)");
		gtk_combo_box_append_text(GTK_COMBO_BOX(data->combo2), "Kilograms (kgs)");
	
		gtk_combo_box_set_active(GTK_COMBO_BOX(data->combo),0);
		gtk_combo_box_set_active(GTK_COMBO_BOX(data->combo2),1);
		gtk_entry_set_text(GTK_ENTRY(data->entry1), "2.25");
		gtk_entry_set_text(GTK_ENTRY(data->entry2), "1.00");
		
	}
	else if (gtk_combo_box_get_active(GTK_COMBO_BOX(data->mainCombo)) == 1){
		gtk_combo_box_remove_text (GTK_COMBO_BOX(data->combo),0);
		gtk_combo_box_remove_text (GTK_COMBO_BOX(data->combo),0);
		gtk_combo_box_remove_text (GTK_COMBO_BOX(data->combo2),0);
		gtk_combo_box_remove_text (GTK_COMBO_BOX(data->combo2),0);
		
		gtk_combo_box_append_text(GTK_COMBO_BOX(data->combo), "Fahrenheit (F)");
		gtk_combo_box_append_text(GTK_COMBO_BOX(data->combo), "Celcius (C)");
	
		gtk_combo_box_append_text(GTK_COMBO_BOX(data->combo2), "Fahrenheit (F)");
		gtk_combo_box_append_text(GTK_COMBO_BOX(data->combo2), "Celcius (C)");
		
		gtk_combo_box_set_active(GTK_COMBO_BOX(data->combo),0);
		gtk_combo_box_set_active(GTK_COMBO_BOX(data->combo2),1);
		gtk_entry_set_text(GTK_ENTRY(data->entry1), "32");
		gtk_entry_set_text(GTK_ENTRY(data->entry2), "0");
	}
}
예제 #27
0
파일: metadata.c 프로젝트: sk1p/darktable
static void fill_combo_box_entry(GtkComboBoxEntry **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_append_text(GTK_COMBO_BOX(*box), "");
    gtk_combo_box_set_active(GTK_COMBO_BOX(*box), 0);
    gtk_combo_box_remove_text(GTK_COMBO_BOX(*box), 0);

    *multi = FALSE;
    return;
  }

  if(count>1)
  {
    gtk_combo_box_append_text(GTK_COMBO_BOX(*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_append_text(GTK_COMBO_BOX(*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);
}
예제 #28
0
파일: combo.c 프로젝트: magnush/mhwaveedit
void combo_set_items(Combo *combo, GList *item_strings, int default_index)
{
     GList *l;
     gchar *c;
     int len;
     updating_flag = TRUE;
     for (l=combo->strings; l!=NULL; l=l->next) {
	  g_free(l->data);
	  gtk_combo_box_remove_text(GTK_COMBO_BOX(combo),0);
     }
     g_list_free(combo->strings);
     combo->strings = NULL;
     for (l=item_strings,len=0; l!=NULL; l=l->next,len++) {
	  c = (gchar *)l->data;
	  gtk_combo_box_append_text(GTK_COMBO_BOX(combo),c);
	  combo->strings = g_list_append(combo->strings,g_strdup(c));
     }
     if (default_index >= len || default_index < 0) default_index = 0;
     gtk_combo_box_set_active(GTK_COMBO_BOX(combo),default_index);
     updating_flag = FALSE;
     gtk_signal_emit(GTK_OBJECT(combo),combo_signals[CHANGED_SIGNAL]);
}
예제 #29
0
void
on_remove_selection_clicked              (GtkButton       *button,
                                        gpointer         user_data)
{
    GtkComboBox* list_selections=GTK_COMBO_BOX(lookup_widget(GTK_WIDGET(button),"list_selections"));
    gchar* active_text = gtk_combo_box_get_active_text(list_selections);
    if(active_text != 0)
    {
        gtk_combo_box_remove_text(list_selections, gtk_combo_box_get_active(list_selections));
        for(vector< DoubleSet<Point>* >::iterator itSelections = lSelections.begin();
            itSelections != lSelections.end();)
        {
            if(strcmp((*itSelections)->name.c_str(), active_text)==0)
            {
                printf("Erase %s\n", active_text);
                itSelections = lSelections.erase(itSelections);
                break;
            }
            else
                itSelections++;
        }
    }
}
/* Sets data to the variants combo box */
void
fill_cbox_variants(GtkWidget *combo, gchar *layout) {

    rules = xkb_xorg_get_rules();


    int nelemnts = gtk_tree_model_iter_n_children(
            gtk_combo_box_get_model(GTK_COMBO_BOX(combo)),
            NULL);
    int i = 0;
    for (i = 0; i < nelemnts; i++) {
        gtk_combo_box_remove_text(GTK_COMBO_BOX(combo), 0);
    }


    GSList *it = rules->layouts;
    Layout *l;

    while (it != NULL) {
        l = it->data;
        if (strcmp(l->description, layout) == 0)
            break;
        it = it ->next;
    }
    if (it == NULL) {
        fprintf(stderr, "ERROR: %s is not a valid layout.\n", layout);
        return;
    }
    it = l->variant;
    Variant *v;
    while (it != NULL) {
        v = it->data;
        gtk_combo_box_append_text(GTK_COMBO_BOX(combo), v->description);

        it = it->next;
    }
}