示例#1
0
文件: maindock.go 项目: sqp/godock
func dialogAskBackend() {
	// Need to keep the string as it is for translation.
	str := "OpenGL allows you to use the hardware acceleration, reducing the CPU load to the minimum.\nIt also allows some pretty visual effects similar to Compiz.\nHowever, some cards and/or their drivers don't fully support it, which may prevent the dock from running correctly.\nDo you want to activate OpenGL ?\n (To not show this dialog, launch the dock from the Application menu,\n  or with the -o option to force OpenGL and -c to force cairo.)"

	dialog := newgtk.Dialog()
	dialog.SetTitle(tran.Slate("Use OpenGL in Cairo-Dock"))
	dialog.AddButton(tran.Slate("Yes"), gtk.RESPONSE_YES)
	dialog.AddButton(tran.Slate("No"), gtk.RESPONSE_NO)

	labelTxt := newgtk.Label(tran.Slate(str))

	content, _ := dialog.GetContentArea()
	content.PackStart(labelTxt, false, false, 0)

	askBox := newgtk.Box(gtk.ORIENTATION_HORIZONTAL, 3)
	content.PackStart(askBox, false, false, 0)

	labelSave := newgtk.Label(tran.Slate("Remember this choice"))
	check := newgtk.CheckButton()
	askBox.PackEnd(check, false, false, 0)
	askBox.PackEnd(labelSave, false, false, 0)

	dialog.ShowAll()

	answer := dialog.Run() // has its own main loop, so we can call it before gtk_main.
	remember := check.GetActive()
	dialog.Destroy()

	if answer == int(gtk.RESPONSE_NO) {
		gldi.GLBackendDeactivate()
	}

	if remember { // save user choice to file.
		value := ternary.String(gtk.ResponseType(answer) == gtk.RESPONSE_YES, "opengl", "cairo")
		updateHiddenFile("default backend", value)
	}
}
示例#2
0
文件: about.go 项目: sqp/godock
// New creates a GuiIcons widget to edit cairo-dock icons config.
//
func New() *About {
	// GtkWidget *pDialog = gtk_dialog_new_with_buttons (_(""),
	// 	GTK_WINDOW (pContainer->pWidget),
	// 	GTK_DIALOG_DESTROY_WITH_PARENT,
	// 	GLDI_ICON_NAME_CLOSE,
	// 	GTK_RESPONSE_CLOSE,
	// 	NULL);

	dialog := newgtk.Dialog()
	dialog.SetTitle(tran.Slate("About Cairo-Dock"))
	// dialog.SetParentWindow(parentWindow)
	dialog.AddButton(tran.Slate("_Close"), gtk.RESPONSE_CLOSE)
	dialog.Connect("response", dialog.Destroy)

	// Widgets.
	image := newgtk.ImageFromFile(Img)
	notebook := addNotebook()
	links := addLinks()

	// Packing.
	header := newgtk.Box(gtk.ORIENTATION_HORIZONTAL, 0)
	header.PackStart(image, false, false, 0)
	header.PackStart(links, false, false, 0)

	content, _ := dialog.GetContentArea()
	content.PackStart(header, false, false, 0)
	content.PackStart(notebook, true, true, 0)

	dialog.Resize(AboutWidth, AboutHeight) // had check min size compared to desktop size...
	dialog.ShowAll()

	//don't use gtk_dialog_run(), as we don't want to block the dock
	dialog.SetKeepAbove(true)

	return (*About)(dialog)
}