# Preserving functions after changing a glade project

**URL:** <https://www.ruby-forum.com/t/preserving-functions-after-changing-a-glade-project/131808>\
**Category:** Ruby-Gnome 2\
**Created:** [March 13, 2008, 1:48pm UTC](https://www.ruby-forum.com/t/preserving-functions-after-changing-a-glade-project/131808 "2008-03-13T13:48:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wolfgang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/54ee81/32.png) [@wolfgang](https://www.ruby-forum.com/u/wolfgang)\
**Post date:** [March 13, 2008, 1:48pm UTC](https://www.ruby-forum.com/t/preserving-functions-after-changing-a-glade-project/131808/1 "2008-03-13T13:48:28Z")

</div>

Hello!

After saving my Glade file I use

“ruby-glade-create-template \> myfile.rb”

to create a ruby file from it. Then I implement the functions,  
so that buttons etc. have an effect. So far, so good.

But:

Whenever I change my Glade project, I’d also have to call  
ruby-glade-create-template again, and all changes I made  
to the ruby file are lost. ☹

What’s the best way to avoid that?

Thanks!  
Wolfgang  
(Sorry to all, I already know that this is a newbie question.  
I’m new to Ruby and Gtk+/Gnome. :-}

---

<div class="post-metadata">

**Author:** ![wolfgang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/54ee81/32.png) [@wolfgang](https://www.ruby-forum.com/u/wolfgang)\
**Post date:** [March 13, 2008, 6:08pm UTC](https://www.ruby-forum.com/t/preserving-functions-after-changing-a-glade-project/131808/2 "2008-03-13T18:08:27Z")

</div>

Am Donnerstag, den 13.03.2008, 13:48 +0100 schrieb Wolfgang Kaiser:

> Hello!
> 
> After saving my Glade file I use
> 
> “ruby-glade-create-template \> myfile.rb”
> 
> to create a ruby file from it.

Hi,

don’t do this. It’s a maintenance night mare. With GladeXML.new you can  
load your glade file and your window or dialogs will directly got build  
from this. If you then cange your glade file it will get much easier to  
update your code for this.

Cheers, detlef

---

<div class="post-metadata">

**Author:** ![wolfgang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/54ee81/32.png) [@wolfgang](https://www.ruby-forum.com/u/wolfgang)\
**Post date:** [March 13, 2008, 5:31pm UTC](https://www.ruby-forum.com/t/preserving-functions-after-changing-a-glade-project/131808/3 "2008-03-13T17:31:35Z")

</div>

Wolfgang Kaiser wrote:

> “ruby-glade-create-template \> myfile.rb”

> Whenever I change my Glade project, I’d also have to call  
> ruby-glade-create-template again, and all changes I made  
> to the ruby file are lost. ☹

“It’s not a bug, it’s a feature.”

ruby-glade-create-template is just useful to create a fast application  
based on that template to work on. You shouldn’t call it twice. The “\>”  
operator of your shell just overwrites the file if exists.

If you make changes in your glade file you can should adapt them  
manually. Or you can call  
ruby-glade-create-template myfile.glade

(without the “\> myfile.rb”!) and look at the changes.
