Re: [Rhythmbox-devel] hiding entry-view columns from a plugin



On Mon, Mar 16, 2009 at 12:17:40AM +1100, Michael Gratton wrote:
> 
> Hi,
> 
> I'm writing a Python plugin that adds a new display column to the queue
> and library sources. Since I only have a 1024px screen, having 10+
> columns in the entry views for these tends to suck somewhat. The plugin
> will let me play around with merging some of those into a single "Track"
> column, to see how well it works.
> 
> Initially, it is looking pretty promising[0], but at the moment I need
> to patch the RB source to get rid of the official columns. I'm wondering
> what a potential way of doing this is that might have a chance of
> getting committed.

Some time ago, I added the rb_entry_view_get_column method (I can't
remember why, and it wasn't linked to a bug..) which allows you to get
the GtkTreeViewColumn object for a predefined column.

If you wanted to change the contents of one of the regular columns, you
can remove the regular cell renderer and add your own.  You can also
modify the resizing properties of the column.  As long as you don't want
to change the sorting behaviour too, this should be enough for what
you're trying to do.

So, during activation, your plugin would modify the columns for all 
existing sources, then it would watch for new sources being added via
the row-added signal on the sourcelist model, 

During deactivation, you could remove your custom cell renderers and try
to recreate the original ones, but it might not be worth the effort.

If you wanted to hide some of the columns, we could extend the current
mechanism used to make columns always visible regardless of the user
preferences.  See set_column_visibility() in rb-entry-view.c.  I guess
we could rename the current 'always_visible' data item to 'force_visibility',
and add another value that indicates the column should always be hidden.
 
> Ideally, the plugin would be able to use the existing visible column
> user prefs when deciding what to display, while surpressing the display
> of the offical columns. I've experimented with adding a method on
> rb-entry-view that lets the plugin hide the official columns, but that's
> kinda racy between view and plugin initialisation - it seems to work for
> the library but not the queue, for example.

I think the method I described above will work no matter when it gets
run.
 
> Would there be any objection to adding a runtime flag (accessible
> programatically by a plugin, not a pref) to prevent any default columns
> being added?

I think this makes it too much of an all-or-nothing situation, and it
would require that the plugin be loaded on startup.



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