After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 432318 - [Python bindings] RBEntryView column_custom methods
[Python bindings] RBEntryView column_custom methods
Status: RESOLVED FIXED
Product: rhythmbox
Classification: Other
Component: Programmatic interfaces
HEAD
Other Linux
: Normal normal
: ---
Assigned To: RhythmBox Maintainers
RhythmBox Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-04-22 16:55 UTC by Tim Retout
Modified: 2009-03-06 09:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add a GDestroyNotify argument to each C function. (6.49 KB, patch)
2007-04-22 17:00 UTC, Tim Retout
committed Details | Review
Actually bind the append/insert methods. (9.71 KB, patch)
2007-06-19 00:01 UTC, Tim Retout
none Details | Review
Clean up previous patch. (9.93 KB, patch)
2007-06-19 11:40 UTC, Tim Retout
none Details | Review
Update; try using existing method names to make the patch simpler. (8.47 KB, patch)
2007-07-02 21:26 UTC, Tim Retout
needs-work Details | Review
patch updated to svn trunk, make sort parameters optional (9.11 KB, patch)
2009-03-03 12:45 UTC, Michael Gratton
committed Details | Review

Description Tim Retout 2007-04-22 16:55:55 UTC
The {append,insert}_column_custom methods of RBEntryView are not bound to Python. Build errors are:

Could not write method RBEntryView.append_column_custom: No ArgType for GCompareDataFunc
Could not write method RBEntryView.insert_column_custom: No ArgType for GCompareDataFunc
Comment 1 Tim Retout 2007-04-22 17:00:14 UTC
Created attachment 86791 [details] [review]
Add a GDestroyNotify argument to each C function.

It is possible to bind these to Python, but it is nice to avoid a memory leak by offering a way to clean up the callback afterwards.

The downside is that this breaks the API of RBEntryView.
Comment 2 James "Doc" Livingston 2007-04-28 02:36:52 UTC
Thanks for catching this, stopping leaks in the bindings is alawys good. I've committed it to svn trunk.

> The downside is that this breaks the API of RBEntryView.

It only breaks the C API, and you can't build C plugins outside the source tree, so all it could break is a few patches (which are easily updatable).
Comment 3 Tim Retout 2007-06-19 00:01:03 UTC
Created attachment 90247 [details] [review]
Actually bind the append/insert methods.

Reverts one line of the previous patch, which was incorrect.

Moves the python method calling stuff used by rhythmdb as well into override_common, which seemed the logical place for it.
Comment 4 Tim Retout 2007-06-19 11:40:16 UTC
Created attachment 90265 [details] [review]
Clean up previous patch.

Check the call to PyEval_CallObject, to help plugin developers.

Tidy up use of XINCREF vs. INCREF. Fix a small memory leak.
Comment 5 Tim Retout 2007-07-02 21:26:03 UTC
Created attachment 91059 [details] [review]
Update; try using existing method names to make the patch simpler.

Also fix calling ``Py_DECREF (args)'' too early, which led to crashes.
Comment 6 Mitchell Ferschweiler 2008-05-02 00:40:30 UTC
What is the current status of this patch? Is there anything I can do to help expedite its inclusion into svn?
Comment 7 Tim Retout 2008-05-02 09:14:00 UTC
The patch was fairly well-tested, but I don't know whether it will still apply to SVN trunk. It should be easy to clean up, but iirc I wanted some feedback on whether it was simpler to use the existing _rhythmdb_query_model_sort_func in _wrap_rb_entry_view_append_column_custom and so on, and whether it was okay to add new functions to override_common.c.
Comment 8 Jonathan Matthew 2008-06-21 11:44:51 UTC
This mostly looks OK (and still applies cleanly); columns don't actually need to have sort functions, though, so both the sort function and data args should be optional.

It seems a bit silly to have append_column_custom and insert_column_custom in the python API, since append_column_custom is just insert_column_custom(..., -1).
Comment 9 Michael Gratton 2009-03-02 04:41:45 UTC
This seems to apply successfully to both 0.11.6 and the trunk, and seems to work okay using 0.11.6.

Any chance of getting it applied? I'm writing a plugin that needs a working rb.EntryView.insert_column_custom().
Comment 10 Jonathan Matthew 2009-03-02 14:31:42 UTC
I'd be OK with applying an updated patch that made the sort function and data arguments optional.  I'm less concerned about having both append_column_custom() and insert_column_custom().
Comment 11 Michael Gratton 2009-03-03 12:45:21 UTC
Created attachment 129937 [details] [review]
patch updated to svn trunk, make sort parameters optional

Updated the previous version of the patch to apply cleanly to the trunk. Make sort params (sort_func, data) optional for the python bindings.

However, if the caller does specify NULL sort params, the sort_data assert in rb_entry_view_resort_model() is triggered later on. This function assumes there is sort data present for the current sorting column.

Should rb_entry_view_resort_model() be fixed to not care if sort_data is null or should the lack of sort func/data make the column somehow not sortable?

Is being able to specify NULL sort func/data really that useful?
Comment 12 Jonathan Matthew 2009-03-05 02:08:09 UTC
When a column with no sort function is added, the column header is not made clickable, so the user can't try to sort on that column.  

There are a couple of non-sortable columns already: the playing status column, the podcast feed status column, and the title/artist/album column in the play queue sidebar, so python code should have the ability to add more.
Comment 13 Jonathan Matthew 2009-03-06 09:15:01 UTC
2009-03-06  Jonathan Matthew  <jonathan@d14n.org>

        patch by: Tim Retout <tim@retout.co.uk>, Mike Gratton <mike@vee.net>

        * bindings/python/override_common.c:
        (_rhythmdb_query_model_sort_data_free),
        (_rhythmdb_query_model_sort_func):
        * bindings/python/override_common.h:
        * bindings/python/rb.defs:
        * bindings/python/rb.override:
        * bindings/python/rhythmdb.override:
        * widgets/rb-entry-view.c: (rb_entry_view_resort_model):
        Add bindings for the methods used to add custom columns to entry
        views.  Fixes #432318.