[Geany-devel] gtkbuilder branch and ui_lookup_widget functions

Matthew Brush mbrush at xxxxx
Fri Oct 21 00:22:40 UTC 2011


On 10/20/2011 07:53 AM, Nick Treleaven wrote:
> On 18/10/2011 22:57, Matthew Brush wrote:
>> On 11-10-18 01:33 PM, Matthew Brush wrote:
>>
>>> Not really (I'm kinda stupid remember :) I think I'm confused about how
>>> it used to work and you're confused about how it works now :)
>>>
>>
>> I think I see what you're talking about, ui_hookup_widget() is attaching
>> the widget to the owner Gobject's datalist. Ok, I think to avoid fixing
>> all of Geany's code that uses this, I will make the new
>> ui_hookup_object() to do this same thing as well, then we can worry more
>> about getting rid of what's left once we port the rest of the UI to
>> GtkBuilder.
>>
>> I'll report back once I've got it working and we can go from there.
>
> I'm currently fighting off flu so can't look at the new branch yet.
>

Bummer.  Hope you get better quickly!

> Just to make sure we understand each other; basically, the
> ui_[l]ookup_widget changes should be reverted. Then, if ui_lookup_widget
> fails, for compatibility it can try your hashtable lookup.
>

Yep, in my gtkbuilder2[1] branch I have replaced the old functionality 
(same with lookup_widget() in stash.c).  I didn't actually "revert" in 
the Git sense, but I did restore the old code for those functions.

> New code that wants to lookup a widget created from geany's glade xml
> can use your new function to lookup an object from the hashtable.
> Looking up some non-geany non-global widget still needs to use
> ui_[lh]ookup_widget.

Nope, I dropped the hash table, now all GtkBuilder widgets get 
"registered" like they used to with ui_hookup_widget() that I put back. 
  I also re-created the old Glade generated create_*() functions to 
provide access to the top level widgets.  The hash table was only there 
for compatibility so if it's not going to work, no point in keeping it.

>
> BTW name clashes are definitely possible if we only use your global
> hashtable, which is why we need the old functions to work like they used
> to. Even if it works with the global lookup now doesn't mean it's doing
> the right thing.
>

Right, though for the core, we *shouldn't* be using duplicate names for 
any widgets in the UI, since this isn't supported by GtkBuilder, but for 
now, until all the UI code gets ported into the Glade file, we do need 
to make sure it's supported to remain compatible.

> I don't think I misunderstood any of your explanations.
>

Ok, wasn't sure since you said you didn't read the code and my English 
isn't very good :)

Cheers,
Matthew Brush

[1] https://github.com/codebrainz/geany/tree/gtkbuilder2



More information about the Devel mailing list