[Frugalware-git] gfwsyscfg: gfwsyscfg.lua,gfwsyscfg.glade
Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=gfwsyscfg.git;a=commitdiff;h=e620c4f83d3237b507cd282395503ef06823 commit e620c4f83d3237b507cd282395503ef06823 Author: James Buren r...@frugalware.org Date: Fri Dec 12 13:32:01 2008 -0600 gfwsyscfg.lua,gfwsyscfg.glade * modify interface to use GLADE, import a glade file diff --git a/src/gfwsyscfg.glade b/src/gfwsyscfg.glade new file mode 100644 index 000..91e16ab --- /dev/null +++ b/src/gfwsyscfg.glade @@ -0,0 +1,38 @@ +?xml version=1.0 encoding=UTF-8 standalone=no? +!DOCTYPE glade-interface SYSTEM glade-2.0.dtd +!--Generated with glade3 3.4.5 on Fri Dec 12 13:27:39 2008 -- +glade-interface + widget class=GtkWindow id=mainwindow +child + widget class=GtkVBox id=vbox +property name=visibleTrue/property +child + widget class=GtkNotebook id=notebook +property name=visibleTrue/property +property name=can_focusTrue/property + /widget +/child +child + widget class=GtkHButtonBox id=hbuttonbox +property name=visibleTrue/property +property name=layout_styleGTK_BUTTONBOX_END/property +child + widget class=GtkButton id=closebutton +property name=visibleTrue/property +property name=can_focusTrue/property +property name=receives_defaultTrue/property +property name=label translatable=yesgtk-close/property +property name=use_stockTrue/property +property name=response_id0/property + /widget +/child + /widget + packing +property name=expandFalse/property +property name=position1/property + /packing +/child + /widget +/child + /widget +/glade-interface diff --git a/src/gfwsyscfg.lua b/src/gfwsyscfg.lua index 209fd24..9cb5379 100755 --- a/src/gfwsyscfg.lua +++ b/src/gfwsyscfg.lua @@ -10,10 +10,14 @@ function quit() end function init() - local win = lgui.Window.new() - win:set(title,gfwsyscfg) - win:connect(delete-event,quit) - win:showAll() + local app = {} + app.glade = lgui.Glade.new(gfwsyscfg.glade) + app.win = app.glade:getWidget(mainwindow) + app.closebutton = app.glade:getWidget(closebutton) + app.closebutton:connect(clicked,quit) + app.win:set(title,gfwsyscfg,width-request,300,height-request,300) + app.win:connect(delete-event,quit) + app.win:showAll() lgui.main() end ___ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git
[Frugalware-git] gfwsyscfg: gfwsyscfg.lua/gfwsyscfg.glade
Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=gfwsyscfg.git;a=commitdiff;h=1c39d451197066ba32be149aa397388c4a7c2277 commit 1c39d451197066ba32be149aa397388c4a7c2277 Author: James Buren r...@frugalware.org Date: Fri Dec 12 14:26:28 2008 -0600 gfwsyscfg.lua/gfwsyscfg.glade * move parts of code to glade, implement module loading prototype diff --git a/src/gfwsyscfg.glade b/src/gfwsyscfg.glade index 91e16ab..33c55be 100644 --- a/src/gfwsyscfg.glade +++ b/src/gfwsyscfg.glade @@ -1,8 +1,11 @@ ?xml version=1.0 encoding=UTF-8 standalone=no? !DOCTYPE glade-interface SYSTEM glade-2.0.dtd -!--Generated with glade3 3.4.5 on Fri Dec 12 13:27:39 2008 -- +!--Generated with glade3 3.4.5 on Fri Dec 12 14:01:31 2008 -- glade-interface widget class=GtkWindow id=mainwindow +property name=width_request300/property +property name=height_request300/property +property name=title translatable=yesgfwsyscfg/property child widget class=GtkVBox id=vbox property name=visibleTrue/property diff --git a/src/gfwsyscfg.lua b/src/gfwsyscfg.lua index 9cb5379..5e0fd6d 100755 --- a/src/gfwsyscfg.lua +++ b/src/gfwsyscfg.lua @@ -4,6 +4,7 @@ -- the pieces. require(lgui) +require(lfs) function quit() lgui.quit() @@ -11,11 +12,25 @@ end function init() local app = {} + local dir = ../modules/ app.glade = lgui.Glade.new(gfwsyscfg.glade) app.win = app.glade:getWidget(mainwindow) app.closebutton = app.glade:getWidget(closebutton) app.closebutton:connect(clicked,quit) - app.win:set(title,gfwsyscfg,width-request,300,height-request,300) + app.notebook = app.glade:getWidget(notebook) + for file in lfs.dir(dir) do + if file ~= . and file ~= .. then + local file = dir..file + if string.find(file,^.*.lua$) then + local success,widget,label = pcall(loadfile(file)) + if success then + if widget and label then + app.notebook:insertPage(widget,label) + end + end + end + end + end app.win:connect(delete-event,quit) app.win:showAll() lgui.main() ___ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git