// gtk_toolbar_insert_stock
771493
func (v *Toolbar) SetIconSize(icon_size IconSize) {
	C.gtk_toolbar_set_icon_size(TOOLBAR(v), C.GtkIconSize(icon_size))
}
388247
func (m *Manager) Insert(c *GlobalConfig) error {
	err := m.collection.Insert(c)

	return err
}
287474
func (p *Progress) AddBar(total int) *Bar {
	p.mtx.Lock()
	defer p.mtx.Unlock()

	bar := NewBar(total)
	bar.Width = p.Width
	p.Bars = append(p.Bars, bar)
	return bar
}
186817
func (b *Bulk) Insert(docs ...interface{}) {
	action := b.action(bulkInsert)
	action.docs = append(action.docs, docs...)
}
615088
func (ptree *ptree) Insert(keys ...common.Comparator) {
	ia := newInsertAction(keys)
	ptree.checkAndRun(ia)
	ia.completer.Wait()
}
884899
func (gb *GraphBuilder) insertNode(n *node) {
	gb.uidToNode.Write(n)
	gb.addDependentToOwners(n, n.owners)
}
497166
func (t list) InsertPos(v *Transition) int {
	return sort.Search(len(t), func(i int) bool {
		return t[i].hash >= v.hash
	})
}
624270
func (m *subMenu) Insert(pos int, i *MenuItem) (err error) {
	if err = m.isActionable(); err != nil {
		return
	}
	if pos > len(m.items) {
		err = fmt.Errorf("Submenu has %d items, position %d is invalid", len(m.items), pos)
		return
	}
	if _, err = synchronousEvent(m.c, m, m.w, Event{Name: EventNameSubMenuCmdInsert, TargetID: m.id, MenuItem: i.toEvent(), MenuItemPosition: PtrInt(pos)}, EventNameSubMenuEventInserted); err != nil {
		return
	}
	m.items = append(m.items[:pos], append([]*MenuItem{i}, m.items[pos:]...)...)
	return
}
1099137
func (v *Statusbar) SetHasResizeGrip(add_tearoffs bool) {
	C.gtk_statusbar_set_has_resize_grip(STATUSBAR(v), gbool(add_tearoffs))
}
605787
func (ds *MySQLDatastore) InsertApp(ctx context.Context, app *models.App) (*models.App, error) {
	var cbyte []byte
	var err error

	if app.Config != nil {
		cbyte, err = json.Marshal(app.Config)
		if err != nil {
			return nil, err
		}
	}
	stmt, err := ds.db.Prepare("INSERT apps SET name=?,config=?")

	if err != nil {
		return nil, err
	}

	_, err = stmt.Exec(app.Name, string(cbyte))

	if err != nil {
		mysqlErr := err.(*mysql.MySQLError)
		if mysqlErr.Number == 1062 {
			return nil, models.ErrAppsAlreadyExists
		}
		return nil, err
	}

	return app, nil
}
971312
func (t *redBlackTree) Insert(key keytype, value valuetype) (ret bool) {
	if t.root == nil {
		t.root = &redBlackNode{
			key:   key,
			value: value,
		}
		ret = true
	} else {
		var head = &redBlackNode{}

		var dir = true
		var last = true

		var parent *redBlackNode  // parent
		var gparent *redBlackNode // grandparent
		var ggparent = head       // great grandparent
		var node = t.root

		ggparent.right = t.root

		for {
			if node == nil {
				// insert new node at bottom
				node = &redBlackNode{
					key:   key,
					value: value,
					red:   true,
				}
				parent.setChild(dir, node)
				ret = true
			} else if isRed(node.left) && isRed(node.right) {
				// flip colors
				node.red = true
				node.left.red, node.right.red = false, false
			}
			// fix red violation
			if isRed(node) && isRed(parent) {
				dir2 := ggparent.right == gparent

				if node == parent.Child(last) {
					ggparent.setChild(dir2, singleRotate(gparent, !last))
				} else {
					ggparent.setChild(dir2, doubleRotate(gparent, !last))
				}
			}

			cmp := node.key.Compare(key)

			// stop if found
			if cmp == 0 {
				break
			}

			last = dir
			dir = cmp < 0

			// update helpers
			if gparent != nil {
				ggparent = gparent
			}
			gparent = parent
			parent = node

			node = node.Child(dir)
		}

		t.root = head.right
	}

	// make root black
	t.root.red = false

	if ret {
		t.size++
	}

	return ret
}
454939
func (mp *MultiProgressBar) AddProgressBar(p *ProgressBar) {
	mp.ProgressBars = append(mp.ProgressBars, p)

	if len(mp.ProgressBars) > 1 {
		fmt.Println()
	}
	mp.Print()
}
823152
func (d *Dataset) Insert(index int, row []interface{}) error {
	if index < 0 || index >= d.rows {
		return ErrInvalidRowIndex
	}

	if len(row) != d.cols {
		return ErrInvalidDimensions
	}

	ndata := make([][]interface{}, 0, d.rows+1)
	ndata = append(ndata, d.data[:index]...)
	ndata = append(ndata, row)
	ndata = append(ndata, d.data[index:]...)
	d.data = ndata
	d.rows++

	ntags := make([][]string, 0, d.rows+1)
	ntags = append(ntags, d.tags[:index]...)
	ntags = append(ntags, make([]string, 0))
	ntags = append(ntags, d.tags[index:]...)
	d.tags = ntags

	return nil
}
880705
func (r *RDBDriver) InsertNvdXML(cves []models.CveDetail) error {
	log.Infof("Inserting CVEs...")
	bar := pb.New(len(cves))
	if c.Conf.Quiet {
		bar.SetWriter(ioutil.Discard)
	} else {
		bar.SetWriter(os.Stderr)
	}
	bar.Start()

	var refreshedNvds []string
	for chunked := range chunkSlice(cves, 10) {
		tx := r.conn.Begin()
		if tx.Error != nil {
			return tx.Error
		}
		for _, c := range chunked {
			bar.Increment()

			// select old record.
			old := models.CveDetail{}
			result := tx.Where(&models.CveDetail{CveID: c.CveID}).First(&old)
			if result.Error != nil && result.Error != gorm.ErrRecordNotFound {
				return rollback(tx, result.Error)
			}
			if result.RecordNotFound() || old.ID == 0 {
				if err := tx.Create(&c).Error; err != nil {
					return rollback(tx, err)
				}
				refreshedNvds = append(refreshedNvds, c.CveID)
				continue
			}

			if !result.RecordNotFound() {
				// select Nvd from db
				nvd := models.NvdXML{}
				err := tx.Model(&old).Related(&nvd, "Nvd").Error
				if err != nil && err != gorm.ErrRecordNotFound {
					return rollback(tx, err)
				}

				if nvd.CveDetailID == 0 {
					c.NvdXML.CveDetailID = old.ID
					if err := tx.Create(&c.NvdXML).Error; err != nil {
						return rollback(tx, err)
					}
					refreshedNvds = append(refreshedNvds, c.CveID)
					continue
				}

				// Refresh to new NVD Record.

				// skip if the record has already been in DB and not modified.
				if nvd.LastModifiedDate.Equal(c.NvdXML.LastModifiedDate) ||
					nvd.LastModifiedDate.After(c.NvdXML.LastModifiedDate) {
					//  log.Debugf("Not modified. old: %s", old.CveID)
					continue
				} else {
					log.Debugf("newer Record found. CveID: %s, old: %s, new: %s",
						c.CveID, nvd.LastModifiedDate, c.NvdXML.LastModifiedDate)
				}

				// Delte old References
				refs := []models.Reference{}
				err = tx.Model(&nvd).Related(&refs, "References").Error
				if err != nil && err != gorm.ErrRecordNotFound {
					return rollback(tx, err)
				}
				for _, r := range refs {
					if err := tx.Unscoped().Delete(r).Error; err != nil {
						return rollback(tx, err)
					}
				}

				// Delte old CWE
				cwes := []models.Cwe{}
				err = tx.Model(&nvd).Related(&cwes, "Cwes").Error
				if err != nil && err != gorm.ErrRecordNotFound {
					return rollback(tx, err)
				}
				for _, cwe := range cwes {
					if err := tx.Unscoped().Delete(cwe).Error; err != nil {
						return rollback(tx, err)
					}
				}

				// uncomment if you needed
				// Delete old Cpes
				// cpes := []models.Cpe{}
				// err = tx.Model(&nvd).Related(&cpes, "Cpes").Error
				// if err != nil && err != gorm.ErrRecordNotFound {
				// return rollback(tx, err)
				// }
				// for _, cpe := range cpes {
				// if err := tx.Unscoped().Delete(cpe).Error; err != nil {
				// return rollback(tx, err)
				// }
				// }

				// Delete Cvss2
				cvss2 := []models.Cvss2{}
				err = tx.Model(&nvd).Related(&cvss2, "Cvss2").Error
				if err != nil && err != gorm.ErrRecordNotFound {
					return rollback(tx, err)
				}
				for _, cvss := range cvss2 {
					if err := tx.Unscoped().Delete(cvss).Error; err != nil {
						return rollback(tx, err)
					}
				}

				// Delete old Nvd
				if err := tx.Unscoped().Delete(&nvd).Error; err != nil {
					return rollback(tx, err)
				}

				// Insert Nvd
				c.NvdXML.CveDetailID = old.ID
				if err := tx.Create(&c.NvdXML).Error; err != nil {
					return rollback(tx, err)
				}
				refreshedNvds = append(refreshedNvds, c.CveID)
			}
		}
		if err := tx.Commit().Error; err != nil {
			return err
		}
	}
	bar.Finish()

	log.Infof("Refreshed %d Nvds.", len(refreshedNvds))
	//  log.Debugf("%v", refreshedNvds)
	return nil
}
977478
func (v *Window) SetPosition(position WindowPosition) {
	C.gtk_window_set_position(WINDOW(v), C.GtkWindowPosition(position))
}
153762
func (bl *blackList) insert(ip string, port int) {
	if bl.list.Len() >= bl.maxSize {
		return
	}

	bl.list.Set(bl.genKey(ip, port), &blockedItem{
		ip:         ip,
		port:       port,
		createTime: time.Now(),
	})
}
400951
func (tr *RTree) Insert(min, max []float64, item interface{}) {
	if len(min) != tr.dims || len(max) != tr.dims {
		panic("invalid dimensions")
	}
	if item == nil {
		panic("nil item")
	}
	bbox := treeNode{min: min, max: max}
	tr.insert(&bbox, item, tr.data.height-1, false)
}