Commit Graph

213 Commits

Author SHA1 Message Date
Evan Nemerson
54ec42f035 gtk: port many nullability annotation fixes from Vala bindings
https://bugzilla.gnome.org/show_bug.cgi?id=730745
2014-05-30 13:24:20 -07:00
Cosimo Cecchi
9eb1e1b15e listbox: don't use focus-line-width 2014-05-09 11:02:46 -07:00
Cosimo Cecchi
241b4c0c75 listbox: don't use focus padding 2014-05-09 11:02:43 -07:00
Matthias Clasen
c813765430 GtkListBox: improve the docs
The documentation was not really clear about ::row-selected
not working for multi-selection.
2014-05-08 07:33:01 -04:00
Paolo Borelli
abf10a74b7 listbox: check gsequence end iter in get_row_at_index 2014-05-04 19:45:28 +02:00
Cosimo Cecchi
24fd96d837 listbox: fix a segfault
Don't dereference a NULL pointer.
2014-05-01 19:48:41 +02:00
Benjamin Otte
d7a3e67025 listbox: Remove unneeded checks
Size vfuncs always get non-null out variables passed, so no need to
check for NULL.
2014-05-01 14:51:28 +02:00
Matthias Clasen
0d55346fbb list-box: Fix copy-paste error
The new function gtk_list_box_get_selected_rows was implemented
as gtk_list_box_get_selected_children.
2014-04-13 14:04:08 -07:00
Matthias Clasen
dbf3a0681a listbox: Emit ::row-selected as we used to
The listbox selection test was failing because we were not
emitting these signals anymore.
2014-04-13 14:04:08 -07:00
Matthias Clasen
69ef54bcd9 listbox: keep emitting ::row-selected
This was accidentally lost when multi-selection was added, causing
sidebars like the one in gnome-contacts or polari to not work any
more.
2014-04-07 23:17:56 -04:00
Matthias Clasen
125c9f207f list box: Avoid excessive signals
We were emitting the a11y ::selection-changed signal much more
often than ::selected-rows-changed. Thats not necessary.
2014-04-06 01:44:38 -04:00
Matthias Clasen
3fe243d346 list box: Cosmetic changes
Shorten variable names from list_box to box, throughout,
and use the BOX_PRIV macro everywhere.
2014-04-06 01:44:37 -04:00
Matthias Clasen
f652120347 list box: Implement multiple selection
This largely copies the flox box implementation, including the
same key bindings.
2014-04-06 01:44:36 -04:00
Matthias Clasen
463c89e540 listbox: Add multi-selection API
This commit adds API for dealing with multi-selection. It is identical
to the flow box API for this purpose. The implementation is still limited
to single-selection, and will be updated in subsequent commits.
2014-04-06 01:44:35 -04:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
William Jon McCann
e34bd4137d docs: use apostrophes in *n't 2014-02-07 13:32:47 -05:00
Carlos Garnacho
628b1f5e1c listbox: return GDK_EVENT_STOP if button events were handled
The button press/release handlers did invariably return FALSE, even
though it shouldn't if a row was found on the event coordinates. Also,
use GDK_EVENT_* defines for the return values.
2014-01-28 16:44:01 +01:00
Timm Bäder
dd6f4fb785 GtkListBox: Expand the placeholder
https://bugzilla.gnome.org/show_bug.cgi?id=711255
2013-11-09 10:50:02 -05:00
Florian Müllner
dd85acbaf1 listbox: Fix keynav_failed() parameter in move_cursor()
The 'direction' parameter to gtk_widget_keynav_failed() is based on
gtk_list_box_move_cursor()'s 'count' parameter. However if the passed
in movement is GTK_MOVEMENT_DISPLAY_LINES, 'count' is modified by
the keynav handling and will always be 0. To avoid messing up the
'direction' parameter, use a local variable for keynav handling and
leave 'count' untouched.

https://bugzilla.gnome.org/show_bug.cgi?id=709687
2013-10-11 13:11:59 +02:00
Timm Bäder
01d278a74f gtk_list_box_set_focus: Handle ist_box == NULL
Rows without a parent GtkListBox can happen in Glade and its previewer.
2013-10-03 14:05:12 +02:00
Matthias Clasen
3f6a1dc9a9 More formatting style adjustments
Lose a whole bunch of unnecessary 'real', shortening
excessively long function names.
2013-09-27 22:00:38 -04:00
Matthias Clasen
c31a34d5ee Some coding style improvements
Use g_return_if_fail in GTK+ style in all public APIs,
avoid dereferencing variables early, shorten some
function names.
2013-09-27 21:39:10 -04:00
Matthias Clasen
f0aba21fd2 Small cleanup for the previous commit
When setting an accessible type, we don't need to
set an accessible row anymore.
2013-09-21 20:56:46 -04:00
Matthias Clasen
c22e27f986 Add a GtkListBoxRow accessible
This lets us do two things:
1. Set the list-item role
2. Set selectable and selected states as appropriate

https://bugzilla.gnome.org/show_bug.cgi?id=692258
2013-09-21 20:51:22 -04:00
Alexander Larsson
7b7b8eaaff listbox: Don't crash if cursor_row is NULL in real_focus
https://bugzilla.gnome.org/show_bug.cgi?id=708320
2013-09-19 22:38:41 +02:00
Kalev Lember
5f62785d41 listbox: Jump over insensitive rows with keynav
https://bugzilla.gnome.org/show_bug.cgi?id=708128
2013-09-16 11:43:26 +02:00
Alejandro Piñeiro
c6943fcbcf a11y: set ATK_ROLE_LIST_ITEM to GtkListBoxRow
https://bugzilla.gnome.org/show_bug.cgi?id=707915
2013-09-13 11:01:44 +02:00
Alexander Larsson
90383300d2 listbox: Set activate_signal on listboxrow class
keyboard navigation didn't support activation since we moved
the keynav to the child row widgets. We fix this by adding a
activate signal handler for the row and setting
widget_class->activate_signal to it.

https://bugzilla.gnome.org/show_bug.cgi?id=707778
2013-09-10 16:20:56 +02:00
Alexander Larsson
5ed8db986f GtkListBox: ref_sink new object in set_header and set_adjustment
These are taking ownership of the object in the hierarchy, so should
sink any floating refs to make it easy to use in C code.
2013-09-04 21:01:50 +02:00
Kalev Lember
653fc4fd4b listbox: Reorder code
This just moves the gtk_list_box_insert function to where the rest of the
public API is defined.

https://bugzilla.gnome.org/show_bug.cgi?id=705558
2013-08-08 11:00:32 +02:00
Kalev Lember
43c68e118f listbox: Implement gtk_list_box_insert()
... to make it possible to insert rows in the middle of the list without having
to fiddle with the sort functions. One of the first users is going to be Glade.

https://bugzilla.gnome.org/show_bug.cgi?id=705558
2013-08-08 11:00:26 +02:00
Paolo Borelli
0b200aaa32 Add gtk_list_box_prepend
Add a convenience method for prepending rows to a list box without
having to fiddle with a sort function.

https://bugzilla.gnome.org/show_bug.cgi?id=705558
2013-08-07 10:52:11 +02:00
Kalev Lember
ceda38ee4e listbox: handle row sensitivity
When a row is insensitive, don't emit button press events and avoid
prelighting it.
2013-07-29 12:50:16 +02:00
Kalev Lember
5d121a8aaa GtkListBox: Add g_return_if_fail checks to public row functions 2013-07-04 16:00:30 +02:00
Kalev Lember
b46d583f87 GtkListBox: Add a function for getting the index of a row
https://bugzilla.gnome.org/show_bug.cgi?id=703618
2013-07-04 15:19:47 +02:00
Kalev Lember
a5d2565b7e GtkListBox: Remove a double semicolon 2013-07-04 14:03:06 +02:00
Alexander Larsson
2a81d6f396 listbox: Use new private model, remove priv pointer 2013-07-02 13:44:17 +02:00
Emanuele Aina
4eddc00911 docs: Add GtkListBox functions to their section and fix links
https://bugzilla.gnome.org/show_bug.cgi?id=702981
2013-06-27 16:28:40 +02:00
Alexander Larsson
207703155b listbox: handle moving mouse out of widget with button down
Unset active row, etc when mousing out of the widget totally.
2013-06-17 15:15:07 +02:00
Alexander Larsson
3513981e1e listbox: Properly handle double click
We never want to handle GDK_2BUTTON_PRESS like a normal first click.
2013-06-17 15:15:07 +02:00
Alexander Larsson
e4a981eef2 listbox: Rewrite coords from child windows
If button events are from child windows we need to rewrite
the coordinates to our window.
2013-06-17 15:15:07 +02:00
Matthias Clasen
87190233ef GtkListBox: cosmetics
Clean up formatting trivia, adjust includes to gtk conventions,
use P_() for properties, etc.
2013-06-15 12:32:59 -04:00
Alexander Larsson
61f44628d6 GtkListBox: Consider width of filtered rows
Without this lists keep shrinking in width as they are filtered, whic
looks really bad.
2013-06-13 12:17:08 +02:00
Alexander Larsson
220eb45ef0 GtkListBox: Protect against reentrancy.
Activating a row may destroy the widget, so keep a ref since
we're doing thing to the listbox after emission.
2013-06-13 12:17:08 +02:00
Alexander Larsson
0f93b7f6c4 GtkListBox: minor fix
Move the check inside the existing chech which also checks
for active_row != NULL for extra safety.
2013-06-13 12:17:08 +02:00
Alexander Larsson
1dd0b468a7 GtkListBox: Add style classes for lists and rows 2013-06-13 12:17:07 +02:00
Alexander Larsson
3bb2d15195 GtkListBox: Add getter for activate_on_single_click 2013-06-13 12:17:07 +02:00
Alexander Larsson
90ff262df6 GtkListBox: Rename reXXX to invalidate_XXX
This is lets us later move to a setup where the rows are not
immediately resorted but queued until next layout.
2013-06-13 12:17:07 +02:00
Alexander Larsson
caacce6d44 GtkListBox: Add placeholder widget support 2013-06-13 12:17:07 +02:00
Alexander Larsson
b0b746b2ea GtkListBox: Track the number of visible children 2013-06-13 12:17:07 +02:00
Alexander Larsson
9510b79d78 GtkListBox: Track visible in the row
This is a minor performance improvement, but its mainly to
allow us to track when n_visible_children changes.
2013-06-13 12:17:07 +02:00
Alexander Larsson
217c2bb087 GtkListBox: Open code the update_header calls in add()
Rather than reusing row_visibility_changed. This means
row_visibility_changed really means that the row visibility changed.
2013-06-13 12:17:07 +02:00
Alexander Larsson
1eb729dcd9 GtkListBox: Make reseparate a no-op for hidden lists
We already take care to not track headers when the listbox is hidden,
because that can be very expensive during creation, so we might as
well skip reseparate() too. The only time we don't want to skip it
is when we're about to show the list.
2013-06-13 12:17:07 +02:00
Alexander Larsson
cbf294b27e GtkListBox: Remove some unnecessary code
the unhighlight call already NULLs out drag_highlighted_row
2013-06-13 12:17:07 +02:00
Alexander Larsson
2ba67a0b8b GtkListBox: Fix docs
Removed some cut/paste leftovers
2013-06-13 12:17:07 +02:00
Alexander Larsson
b119b022a7 GtkListBox: Allow unselecting of rows in SINGLE mode 2013-06-13 12:17:07 +02:00
Alexander Larsson
cc4ac1ee70 GtkListBox: Rename separators to headers 2013-06-13 12:17:07 +02:00
Alexander Larsson
4a0b6e5479 GtkListBox: Remove refilter signal
This was added from https://bugzilla.gnome.org/show_bug.cgi?id=691979
where it was wanted in order to get a "all children filtered" kind
of row. However, the solution is not really generic enough, because
filtering can happen for other reasons than a full refilter (i.e. due
to a row change), and the partial fix you can get by counting children
after refilter can be achieved by manually doing it whenever you manually
called refilter anyway.

Its possible we should have some better solution for the "empty state"
though.
2013-06-13 12:17:07 +02:00
Alexander Larsson
c6ac711508 GtkListBox: Add docs 2013-06-13 12:17:07 +02:00
Alexander Larsson
ecff28bb68 GtkListBox: Remove add_to_scrolled()
Now that we automatically set up the focus_vadjustment we only
need the adjustment to handle the page-up/down scroll length correctly.

We use parent_set to automatically pick up the adjustment from a
scrollable (i.e. viewport) parent which makes add_to_scrolled useless, so
it can be removed.
2013-06-13 12:17:07 +02:00
Alexander Larsson
157102aa73 GtkListBox: No need to manually clamp adjustment to focus
Now that we use real widgets for rows the focus_vadjustment is
enough.
2013-06-13 12:17:06 +02:00
Alexander Larsson
932535d444 GtkListBox: Clean up DnD code
Unhighlight rows if they are removed.

Drop the automatic drag motion based auto-scrolling. This is not really
right, as it e.g. hardcodes auto-scroll regions and assumes we're the only
widget inside the scrolled container. Its also imho in the wrong place,
autoscrolling if any should be done on the scrolled-window or viewport.
All the removed code is implementable outside Gtk+ though.
2013-06-13 12:17:06 +02:00
Alexander Larsson
e319867f80 Add GtkListBox
This is basically an import/rename of EggListBox from the row-widget
branch of egg-list-box.
2013-06-13 12:17:06 +02:00