----------------------------------------------------------------------------------------------------------------------- --# GtkPlacesSidebar ----------------------------------------------------------------------------------------------------------------------- include GtkEngine.e include GtkFileSelector.e include resources/places_sidebar.txt requires("3.10","GtkPlacesSidebar") constant win = create(GtkWindow,{ {"default size",400,600}, {"position",GTK_WIN_POS_CENTER}, {"signal","destroy","Quit"}}) constant panel = create(GtkBox,HORIZONTAL) add(win,panel) constant sidebar = create(GtkPlacesSidebar,{ {"add shortcut",create(GFile,"~/demos")}, {"show connect to server",TRUE}}) connect(sidebar,"open-location","ShowSelected") add(panel,sidebar) constant rightside = create(GtkBox,{ {"orientation",VERTICAL}, {"margin top",10}}) pack(panel,rightside) constant lbl = create(GtkLabel,{ {"markup",places_sidebar:txt}, {"padding",10,0}, {"line wrap",FALSE}}) pack(rightside,lbl) constant box = create(GtkButtonBox,{ {"orientation",HORIZONTAL}, {"layout",GTK_BUTTONBOX_SPREAD}, {"margin bottom",10}}) pack_end(rightside,box) constant btn1 = create(GtkButton,"gtk-quit","Quit"), btn2 = create(GtkButton,"gtk-add","AddShortcut") add(box,{btn1,btn2}) show_all(win) main() ------------------------------ global function ShowSelected() ------------------------------ object loc = get(sidebar,"location") object name = gtk_str_func("g_file_get_parse_name",{P},{loc}) fileselector:filters = {"euphoria","all"} fileselector:Open(name & "/*") -- without the added /*, selected dir will be highlighted, but not opened -- with the addition, dir will be opened and files displayed. return 1 end function ------------------------------ global function AddShortcut() ------------------------------ fileselector:filters = {"dir"} object folder = fileselector:SelectFolder(0) if string(folder) then set(sidebar,"add shortcut",create(GFile,folder)) end if return 1 end function