BwackNinja / spacefm

SpaceFM File Manager
http://ignorantguru.github.com/spacefm/
GNU General Public License v3.0
3 stars 0 forks source link

[gtk3] Devices list empty #21

Closed IgnorantGuru closed 11 years ago

IgnorantGuru commented 12 years ago

To reproduce, set Devices|Settings|Show so only Empty Drives (and Mounted Files + Mounted Networks) are checked (no Internal Drives). Then hide the Devices pane and close spacefm. When restarted, show the Devices pane and it will be empty rather than showing /dev/sr0. Close spacefm and restart, and /dev/sr0 is shown.

This affects the gtk3 build only.

BwackNinja commented 12 years ago

Sorry, I can't reproduce this issue. Everything displays fine for me.

IgnorantGuru commented 12 years ago

I should add that my /dev/sr0 is in fact empty, not sure if that matters. And I have no other 'removable' drives plugged in so its the only one listed (its actually internal but for udev purposes optical is 'removable'). If spacefm is started with the devices pane unshown, and then its shown, it doesn't list it until restart. Only seems to happen if the devices list is very short - a cm or so.

I'm also able to make this happen other ways:

So in the first case it's probably listed, just above the visible part of the list. This is confirmed by that fact that it only seems to happen if the devices list is very short - a cm or so.

IgnorantGuru commented 12 years ago

I tried these in ptk-file-browser.c ptk_file_browser_init() right after gtk_scrolled_window_new:

    gtk_widget_set_size_request( file_browser->side_dir_scroll, 1, 1 );
    gtk_widget_set_size_request( file_browser->side_book_scroll, 1, 1 );
    gtk_widget_set_size_request( file_browser->side_dev_scroll, 1, 1 );
    gtk_widget_set_size_request( file_browser->side_vpane_top, 1, 1 );
    gtk_widget_set_size_request( file_browser->side_vpane_bottom, 1, 1 );

and in ptk-location_view.c ptk_location_view_new():

    gtk_widget_set_size_request( view, 1, 1 );

No affect on the problem. Any suggestions?

BwackNinja commented 12 years ago

The issue occurs when you shrink a widget below it's requisition. Changing the side vpane gtk_paned_pack{1,2}(pane, widget, TRUE, TRUE) to gtk_paned_pack{1,2}(pane, widget, TRUE, FALSE) avoids this.

I'll toss up a simple commit to fix this.

IgnorantGuru commented 12 years ago

With the above change, if devices (or other lists) are hidden then shown, it's no longer possible to reduce the height of it smaller than about three lines. The intention is for the user to be able to set the side panes to any size for best use of space. For example, devices may need to be only one or two lines. Any way to reduce that minimum height? I tried some set_size_requests but no effect.

BwackNinja commented 12 years ago

I'm pretty sure you can't reduce the minimum height beyond that. That seems to be as much height as it needs to work properly, show a somewhat useful scrollbar, etc. I'd say that beyond that point is almost equivalent to hiding the side pane.

I think you can either have this bug or not be able to resize the side panes that small. The two situations seem to be in conflict.

IgnorantGuru commented 12 years ago

Doesn't sound right - normally gtk allows widgets to shrink more than this, rather than imposing an arbitrary limit > 1.

This is evidenced by the fact that when the window first opens with devices visible, I can shrink it to one line or less (including a very tiny scrollbar). However when devices are hidden, then shown, then this limit appears.

I'd like to see this working similar to gtk2 where there is no arbitrary limit, without the user having to close and reopen the browser (which eliminates the limit).

I've always had a similar problem in gtk(2) expanding then shrinking columns - sometimes they stick with a minimum size.

BwackNinja commented 11 years ago

I double-checked in gtk2, this issue is there as well. To reproduce:

  1. show all 3 side panes.
  2. shrink the sidebar width so that a horizontal scrollbar appears on the devices side pane
  3. shrink the devices pane height so that it is almost zero

The horizontal scrollbar will be cut off (and unless the devices side pane height is zero, it draws over the pane separator.)

The size that gtk imposes on the side panes might seem big, but it is broken without enabling that restriction.

IgnorantGuru commented 11 years ago

In gtk2 with my theme, I see the drawing issue you mean, but it only occurs when the pane is made so short that no lines are visible, which isn't a functional state.

With your suggested fix, in gtk2 this causes the minimum height to be fixed at a few lines, even on initial window startup with devices visible. (In gtk3, the minimum height is only enforced if devices is manually shrunk to zero height or so, then is hidden, then shown, then shrunk.)

In https://github.com/IgnorantGuru/spacefm/commit/61049c39f647498249799d4b2580573994c9f0e9 I included your fix for gtk3 only, since gtk2 is more functional without it. I still don't like the arbitrary limit, but it can be avoided by closing and reopening the window, so this isn't a critical issue.

Whatever state the pane and list are in when the window first opens is the state I would like - I can resize devices to any height. For some reason hiding it (which destroys the gtktreeview) and showing it makes this bug appear (even though the pane and scrollbox are not destroyed), but I interpret this as a bug in gtk3.

Only other idea I have would be to somehow pack this differently in ptk-file-browser.c around L1745:

        gtk_container_add( GTK_CONTAINER( file_browser->side_dev_scroll ),
                                            file_browser->side_dev );

At any rate, closing this as 'good enough for now/minor issue'.