Re: Working with GVariant in Python



On Mon, Jun 25, 2012 at 7:15 PM, Micah Carrick <micah quixotix com> wrote:
> I just added a patch
> to https://bugzilla.gnome.org/show_bug.cgi?id=678655 which overrides
> g_action_map_add_action_entries() that would make my bloatpad a bit closer
> to the original C version.

Your patch, looks ok, but just one minor issue I noticed on the first
read-through. You have a couple places where you say:

if user_data is None:
    foo(a, b)
else:
    foo(a, b, user_data)

I don't know for sure, but my experience with other parts of PyGObject
is that it's actually harmless to pass in a None value for user_data,
so you can just replace the above idiom with simply this:

foo(a, b, user_data)

And the right thing should happen regardless of if user_data is
defined or not. It's worth testing since you do it twice and it would
be cleaner without it.

>> I'd like to know more, because I want that application menu for my app
>> but I haven't yet been able to figure out how to get the menu to show
>> up (when I add the gtkbuilder xml to my own, and then add the menu,
>> Gnome Shell loses the 'Quit' entry menu and just shows me a blank
>> menu. I can't seem to make the Bloatpad menu work for me at all).
>
> If you set the app menu then the GNOME version of the app menu goes
> away--whether you added the actions to the app or not. If for any reason the
> actions don't get added to the application or they don't correspond to a
> matching name in the XML then the menu shows up empty.
>
> The app menu is actually working fine in that bloatpad link I posted (take a
> look at BloatPad.startup()).

Yeah, I got it working following the example you posted on github. Thanks again.

https://github.com/robru/gottengeography/commit/2df9296a4ad8452ea84e5f0b2ca2ff4cd79122e5

-- 
http://exolucere.ca


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]