Pastey utils.e

namespace utils
 
include file_menu.e 
 
constant tips = { -- utils menu calls functions: 
 "Compress database", 
 "Dump database" 
 } 
  
include GtkEngine.e 
include std/eds.e 
 
include db_err_handler.e -- checking for dbase open, table selected, etc; 
include prefs.e -- get name of dump_file, dump_view app; 
 
constant menu = create(GtkMenuItem,"_Utilities"),  
 submenu = create(GtkMenu), 
    items = 
    create(GtkMenuItem,"folder-download-symbolic#Compress",_("CompressDB")) 
    & create(GtkMenuItem,"go-bottom#Dump",_("DumpDB")) 
  
for i = 1 to length(tips) do 
    set(items[i],"tooltip text",tips[i]) 
end for 
     
set(menu,"submenu",submenu) 
add(submenu,items) 
add("MainWin:MenuBar",menu) 
 
--------------------------- 
global function DumpDB() -- these are so simple, there's no need for a separate file; 
--------------------------- 
if dbase() then 
    db_dump(dump_file) 
    system(format("[] []",{dump_viewer,dump_file})) 
    return 1 
end if 
return 0 
end function 
 
--------------------- 
function CompressDB() 
--------------------- 
if db_compress() != DB_OK then 
    Warn("MainWin","CompressDB","compress failed!",db_current()) 
    return 0 
end if  
return 1 
end function 

Search



Quick Links

User menu

Not signed in.

Help Fund OpenEuphoria

Misc Menu