Commit Graph

15820 Commits

Author SHA1 Message Date
Benjamin Otte
1961be9ee9 iconview: Simplify adjustment monitoring for accessible 2011-12-19 16:17:13 +01:00
Benjamin Otte
4652d4c399 a11y: Remove widget_destroyed call
GtkAccessible does all of that for us now.
2011-12-19 16:17:13 +01:00
Benjamin Otte
80a0413d40 a11y: Use widget_unset vfunc in treeview 2011-12-19 16:17:13 +01:00
Benjamin Otte
dbc1581376 accessible: Ensure we unset the widget when finalizing 2011-12-19 16:17:13 +01:00
Benjamin Otte
03a63def24 widget: Unref accessible 2011-12-19 16:17:13 +01:00
Benjamin Otte
7b5b678e2e a11y: Fix crash in notebook
When the accessible was disposed before the notebook it referenced, the
weak ref could still trigger. This works around it.
2011-12-19 16:17:13 +01:00
Benjamin Otte
e042462674 widget: Unset self from accessible 2011-12-19 16:17:13 +01:00
Benjamin Otte
23b5f9c066 widget: Unset widget on accessibles 2011-12-19 16:17:13 +01:00
Benjamin Otte
075cc5dd36 accesible: Manage the DEFUNCT state
A GtkAccessible with a NULL widget is defunct, there's no way around it.
2011-12-19 16:17:12 +01:00
Benjamin Otte
1305815bde iconview: Split out iconview accessible 2011-12-19 16:17:12 +01:00
Benjamin Otte
eb27c61878 accessible: Use set_widget() in destroy notify
We don't want to bypass the unset_widget call.
2011-12-19 16:17:12 +01:00
Benjamin Otte
bac73e48db API: accessible: Add widget_set and widget_unset vfuncs
I expect them to be used a lot, so this approach seems better than
requiring signals that connect to "notify::widget". Also, we can't use
regular functions (like dispose or constructed), becaiuse those assume
that (un)setting of the widget only happens once and with the current
design (a puble set_widget() function) we can't really guarantee that.

Also, I split them into two separate functions as one function is part
of construction and the other part of destruction of the object. And it
doesn't sound like a good idea to have that both be part of one
function.
2011-12-19 16:17:12 +01:00
Benjamin Otte
50431be274 accessible: At an important note to the docs
I wanted to use weak refs to ensure this instead, but it's a performance
problem when used in the treeview and each and every cell adds a weak
ref to the treeview.
2011-12-19 16:17:12 +01:00
Benjamin Otte
5789fd983b accessible: Check the widgeyt actually changed when setting 2011-12-19 16:17:12 +01:00
Benjamin Otte
1998a63917 accessible: Make widget a property 2011-12-19 16:17:12 +01:00
Benjamin Otte
eed9cc94e1 treeview: Only set focus column in setter function
Single point of entry. It's actually going to become more complicated
with a11y now.
2011-12-19 16:17:12 +01:00
Benjamin Otte
e4f6a7124b a11y: Simplify code
Use peek_cell() instead of a custom find_cell() function that duplicates
loads of functionality.
2011-12-19 16:17:12 +01:00
Matthias Clasen
020c1846b7 Use the workarea when placing popups
This uses the new workarea API to avoid placing popups underneath
panels, docks, etc.
2011-12-18 14:29:16 -05:00
Ignacio Casal Quinteiro
69fba5d3ed textlayout: cleanup
Use g_clear_object, move unrefs to dispose and reorganize code
2011-12-18 18:46:36 +01:00
Paolo Borelli
397cbbef32 Use gtk_text_layout_get_iter_at_line
We already have a gtk_text_layout_get_iter_at_line wrapper that takes
care of getting the btree from the layout, we may as well use it.
2011-12-18 17:44:23 +01:00
Paolo Borelli
7f301cf822 Remove useless get_iter_at_line calls.
No need to call _gtk_text_btree_get_iter_at_line right before calling
totally_invisible_line, since it is the first thing it does itself.
2011-12-18 17:35:08 +01:00
Rui Matos
4a113394da tests: Add a test for latest commit
https://bugzilla.gnome.org/show_bug.cgi?id=666392
2011-12-17 11:59:08 +00:00
Rui Matos
9d6da33ff5 widget: Flip the sensitive flag even if the state doesn't change
Even if we can't change our sensitivity because the parent is insensitive we
should still flip the sensitive flag. Otherwise, with and insensitive parent,

child.set_sensitive(True)
...
parent.set_sensitive(True)

would result in child still being insensitive.

https://bugzilla.gnome.org/show_bug.cgi?id=666392
2011-12-17 11:48:01 +00:00
Benjamin Otte
b9fad15ee6 filechooserentry: Catch tab key earlier
Instead of in the key_press handler, use a signal handler. The signal
handler runs before the default handler, and before other signal
handlers. In particular it runs before the signal handler installed via
gtk_entry_set_completion() which pops down the entry completion, and we
don't want that to happen.

The code does not change the code of the handler in any significant way,
it just refacotrs it to not call the parent anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=663573
2011-12-16 20:09:14 +01:00
Benjamin Otte
640754e98b filechooserentry: Do inline completion only when opening files
When saving files, using <tab> is required. We don't want the UI
randomly changing filenames from below us.

https://bugzilla.gnome.org/show_bug.cgi?id=663573
2011-12-16 20:09:14 +01:00
Benjamin Otte
351dd206bc filechooserentry: Remove unused enum 2011-12-16 20:09:14 +01:00
Benjamin Otte
4fb6961c6a filechooserentry: Allow NULL as base folder again
This was removed previously, but is necessary to support the case where
no base folder is in use, which should cause an error. This can be
experienced in save mode in the recent files list.

https://bugzilla.gnome.org/show_bug.cgi?id=663573
2011-12-16 20:09:14 +01:00
Benjamin Otte
523a45d927 filechooserentry: Don't show files when selecting directory
We don't want to complete on files when they're not supposed to be
selectable.
2011-12-16 20:09:14 +01:00
Benjamin Otte
57766f1948 filechooserentry: Remove beep function
There's only 2 places left where we potentially beep. We can call
gtk_widget_error_bell() directly there.
2011-12-16 20:09:14 +01:00
Benjamin Otte
0d10583695 filechooserentry: Simplify load completion
Most importantly, consistently trigger a beep when we abort a pending
completion.
2011-12-16 20:09:14 +01:00
Benjamin Otte
c4a331f934 filechooserentry: Use a GtkFileFilter for filtering
That way, we can use the regular filtering features of the
filesystemmodel instead of having our own filtering function that
duplicates much of the matching code.

This also removes the broken-on-windows feature where files strting with
a dot were not autocompleted.
2011-12-16 20:09:14 +01:00
Benjamin Otte
98fb16e307 filesystemmodel: Add a toggle for whether directories are filtered 2011-12-16 20:09:14 +01:00
Benjamin Otte
b47b6d307e filechooserentry: Remove the file column
It is not needed anymore.
2011-12-16 20:09:14 +01:00
Benjamin Otte
5607cd9170 filechooserentry: Simplify code
Use all the clever functions we invented in recent refactorings to
compute the file and dir part and the current folder.

This also fixes the bug where "./" was not taken as the current
directory but interpreted as a file named "./".
2011-12-16 20:09:13 +01:00
Benjamin Otte
d27d73f885 filechooserentry: Refactor function
Name the function set_completion_folder() and make it accept NULL, so it
behaves like a regular setter function.
2011-12-16 20:09:13 +01:00
Benjamin Otte
ea8f5f15c1 filechooserentry: Set minimum key length to 0
We want the empty chooser to show possible completions, too.
2011-12-16 20:09:13 +01:00
Benjamin Otte
af9e385616 filechooserentry: Simplify refresh_current_folder_and_file_part()
The function can get the text it's refreshing from itself, as there is
only one possible value. And it doesn't need to return a value anymore.
2011-12-16 20:09:13 +01:00
Benjamin Otte
357ae09b54 filechooserentry: Get rid of unused member variable
in_change isn't set anymore.
2011-12-16 20:09:13 +01:00
Benjamin Otte
6ab681c094 filechooserentry: Remove _gtk_file_chooser_entry_set_file_part()
gtk_entry_set_text() is fine.
2011-12-16 20:09:13 +01:00
Benjamin Otte
c9b220275a filechooserentry: Use completion for completion
Reduce the amount of code even more by using the entry completion to
query the prefix.
2011-12-16 20:09:13 +01:00
Benjamin Otte
d3fd759f77 filechooserentry: Add gtk_file_chooser_entry_get_completion_text()
This returns the text that should be completed on. As this is somewhat
tricky to compute (and in fact one place did it wrong), let's make it a
function.
2011-12-16 20:09:13 +01:00
Benjamin Otte
f6f2a78d3e filechooserentry: Don't update the folder when completing
The folder is always up to date, there's no need to update it. (If the
folder is not up to date, that is a bug and needs to be fixed
elsewhere.)
2011-12-16 20:09:13 +01:00
Benjamin Otte
ad1672c194 filechooserentry: Don't override activate
The code is no longer necessary, because the relevant parts for inline
completion are now handled by GtkEntry.
2011-12-16 20:09:13 +01:00
Benjamin Otte
6e7b2de21e filechooserentry: Simplify append_common_prefix()
Now that we don't need to know anymore why insertion failed, we can
simplify the append function quite a lot.

A simple rule now: If we did not insert anything, beep.
2011-12-16 20:09:13 +01:00
Benjamin Otte
f7e5a773ff filechooserentry: Remove completion feedback
Too much special code for no gain.

I did a totally unscientific questionnaire on GNOME IRC (assuming
autocompletion is for advanced users) and nobody even knew what this is.
So I suspect it's useless. Also, it's positioned completely wrong anyway
and nobody noticed so far. Last but not least, I'm trying to imitate
bash here and bash doesn't show feedback.
2011-12-16 20:09:13 +01:00
Benjamin Otte
93263dcd33 filechooserentry: Redo completion popup trigger
Use dispatch_properties_changed() instead of GtkEditable to watch for
changes to the to-be-completed text. This is necessary because various
functions in GtkEntry don't use the interface vfuncs and one only
becomes aware of them via notifications. I'm not sure this is intended
behavior, but it's how it works today.
Also, use the same code for triggering in all situations.

What the code does is this: It looks at the part of the text in front of
the cursor (or selection) and completes for it. Once the directory has
been enumerated, inline completion is activated. Note that popping up of
the completion popup is completely handled by GtkEntry.
2011-12-16 20:09:13 +01:00
Benjamin Otte
132c42ccbd filechooserentry: Get rid of RefreshMode
Instead, pass the text to use to refresh_current_folder_and_file_part().
This also gets rid of the problem introduced earlier that the position
is not properly updated in do_insert_text() and therefor the completion
is wrong.
2011-12-16 20:09:13 +01:00
Benjamin Otte
45d54fcba6 filechooserentry: Use inline completion
... from GtkEntryCompletion instead of implementing a poor copy
ourselves. This also makes the file chooser entry behave a lot closer to
normal entries.
2011-12-16 20:09:13 +01:00
Benjamin Otte
cdd236ddd4 filechooserentry: Merge function 2011-12-16 20:09:13 +01:00
Benjamin Otte
c585471baf filechooserentry: Set the text column of the entry completion
I want to use it in the next commits, but am doing this in a separate
commit so we can find side effects causing bugs easier when bisecting.
2011-12-16 20:09:12 +01:00
Benjamin Otte
e3ef8a568e filechooserentry: Simplify match_selected function 2011-12-16 20:09:12 +01:00
Benjamin Otte
cde8ae7b1e filechooserentry: Keep an extra column for the full path
This is identical to the display name when not having a path that
changes the folder. Otherwise it will have the full path that was
entered in the entry. Say when from your home dir, you type
"../../usr/li", the full path for "lib" and "lib64" will be
"../../usr/lib" and "../../usr/lib64" respectively. This value isn't
used yet, but will be soon.
2011-12-16 20:09:12 +01:00
Benjamin Otte
fc775dfa5b entrycompletion: Export gtk_entry_completion_compute_prefix()
I want to use it in the file chooser entry autocomplete code.
2011-12-16 20:09:12 +01:00
Benjamin Otte
1ac6ace87d filechooserentry: Redo _gtk_file_chooser_entry_get_file_part()
The new version does not need to update any text, it just strips the
last part of the existing entry.
2011-12-16 20:09:12 +01:00
Benjamin Otte
e2105c2bef filechooserentry: Modify _gtk_file_chooser_entry_get_current_folder()
The new version does not need to muck with the entry, it just extracts
the required information. It returns a reference to the folder though,
as we extract the information now instead of returning something stored.
2011-12-16 20:09:12 +01:00
Benjamin Otte
5c42972735 filechooserentry: Split out function
I want to use that function elsewhere, so split it out.
2011-12-16 20:09:12 +01:00
Benjamin Otte
2186c28263 filechooserentry: Simplify code
Now that the base folder is always != NULL, we can remove the parts of
the code that check for NULL.
2011-12-16 20:09:12 +01:00
Benjamin Otte
35198e142d filechooserentry: Ensure the base folder is always valid
If the base folder is set to NULL, then we just assume the home dir.
FIXME: Should we disallow a NULL folder?
2011-12-16 20:09:12 +01:00
Benjamin Otte
e0859004f6 filechooserentry: Don't complain about incomplete hostnames
First of all, those hostnames may very well be complete, second of all,
smb:// is a valid uri to enter.
2011-12-16 20:09:12 +01:00
Benjamin Otte
242afcfeff filechooserentry: Start autocomplete immediately
Don't do idle handlers for this.
2011-12-16 20:09:12 +01:00
Benjamin Otte
9ee577d5ee filechooserentry: Remove file_system argument
It's not needed anymore.
2011-12-16 20:09:12 +01:00
Benjamin Otte
c3da748cb2 filechooserentry: Simplify code
Now that we've imported the function in the last commit, rename it and
omit useless arguments by instead passing in the entry directly.
2011-12-16 20:09:12 +01:00
Benjamin Otte
9d09028970 filechooserentry: Move _gtk_file_system_parse()
It's very specific to the file chooser entry, so it's better kept there.
It's also not used anywhere else in the code.
2011-12-16 20:09:12 +01:00
Benjamin Otte
036195e7a8 gtkfolder: Remove
It's not used anymore. And new code should of course use gio.
2011-12-16 20:09:12 +01:00
Benjamin Otte
a1e0c1e042 filechooserentry: Use a GtkFileSystemModel
Replace the usage of a list store and a GtkFolder with a
GtkFileSystemModel. This improves performance and reduces code size.
2011-12-16 20:09:11 +01:00
Benjamin Otte
06a64daefc filechooserentry: Store the liststore as a treemodel
Just changes the type of the member variable. This way we can avoid a
lot of casts.
2011-12-16 20:09:11 +01:00
Benjamin Otte
5ebc69066a filechooserentry: Make appending / to directories simpler 2011-12-16 20:09:11 +01:00
Benjamin Otte
2b9ecd9706 filechooserentry: Only append / to directory names once
Since 069d78ed31 the / is appended to
directories upon constructing the display name, so there is no need to
do it later.
2011-12-16 20:09:11 +01:00
Benjamin Otte
8389922de9 filechooserentry: Don't trim away the slash after directories
It's not necessary as the code appending the slashes checks for a slash
these days.
2011-12-16 20:09:11 +01:00
Benjamin Otte
2ead847f7d filechooserentry: Fold in start_loading_current_folder()
The function just did one thing, we can just fold it into the only
caller.
2011-12-16 20:09:11 +01:00
Benjamin Otte
a04b70e51f filechooserentry: The file system cannot be NULL
Remove code that checked this.
2011-12-16 20:09:11 +01:00
Benjamin Otte
05398b8f1a filechooserentry: Make the filesystem a construct-only argument
This allows simplifications in the code.
2011-12-16 20:09:11 +01:00
Benjamin Otte
5aeac0bccb filechooserentry: Keep finished_loading variable ourselves
This will be useful in the next commits when the GtkFolder code
previously keeping that variable gets repalced.
2011-12-16 20:09:11 +01:00
Benjamin Otte
b6f6e33801 filechooserentry: force_reload is never TRUE
.. so remove it.
2011-12-16 20:09:11 +01:00
Benjamin Otte
f0cf1117e1 filechooserentry: Fold function into other
There's no need to discard the current folder's file without also
discarding the folder object.
2011-12-16 20:09:11 +01:00
Benjamin Otte
d5e5ca3e2a filechooserentry: Reorganize function
Setter functions the way I code it look like this (in order):
1) Figure out if the value changed. If not, exit early.
2) Clear the old value (ie unref stuff, disconnect signals
3) Copy the new value
4) Set up things about the new value

This reorganization does that.

And by doing that, it even reduces the amount of code and the amount of
branches (and with it, nesting) needed.
2011-12-16 20:09:11 +01:00
Benjamin Otte
7b51ca9a47 filechooserentry: Use the actual discarding function to discard a folder 2011-12-16 20:09:11 +01:00
Benjamin Otte
edddb666a7 filechooserentry: Don't use a magic number
... when we have a proper enum value for a column.
2011-12-16 20:09:11 +01:00
Benjamin Otte
92a72ce3e5 entry: Move freeze/thaw into begin/end_change 2011-12-16 20:09:11 +01:00
Benjamin Otte
cf8f3c07f2 entry: Don't try to handle Tab in entry completions
Instead, fall through to the default handler after closing the
completion. This has the advantage of letting the file chooser entry
capture the tab key properly, so one can't accidentally move out of the
entry by pressing tab while the completion is popped up.

I also suspect it fixes bugs with weird tab keys and shift/ctrl
oddities. But who knows...
2011-12-16 20:09:11 +01:00
Benjamin Otte
e104219ab1 tests: Relax a refcount comparison check
We now test for real_refcount >= expected_refcount, because various
parts of the code (a11y, selection, cursor, ...) can and do add
references.
2011-12-16 13:39:43 +01:00
Benjamin Otte
113aff673f a11y: Don't emit children-changed when nothing changed
When we have 0 columns, no children ever get added or removed.
2011-12-16 13:39:43 +01:00
Benjamin Otte
d78971b31d treeview: Run unref helper for all rows
Don't do shortcuts. Because all rows need to be unreffed.
Introduced in 92929b968b.
2011-12-16 13:39:43 +01:00
Matthias Clasen
7f5a665b95 Fix more linking fallout
We are using xinput and gmodule API in a few places in libgtk.
https://bugzilla.gnome.org/show_bug.cgi?id=665326
2011-12-15 23:35:06 -05:00
Matthias Clasen
2f25ab2b22 Doc typo fix 2011-12-15 23:03:12 -05:00
Matthias Clasen
55f1799b96 Doc typo fix 2011-12-15 23:03:12 -05:00
Matthias Clasen
ba59b9c4f9 Cosmetic changes 2011-12-15 23:03:12 -05:00
Benjamin Otte
c0fdcbf513 a11y: Remove unused gtk_cell_accessible_set_cell_data() 2011-12-16 04:53:17 +01:00
Benjamin Otte
b8b8ba8ed9 a11y: Make boolean cell render report its states the new way 2011-12-16 04:53:17 +01:00
Benjamin Otte
64aa203773 a11y: Refactor treeview code even more
- Split out set_cell_data()
- Use it
- Get rid of update_cell_value() function, it's now just 2 calls
2011-12-16 04:53:16 +01:00
Benjamin Otte
eb6465167e a11y: Redo function signature
With the recent changes to gtk_cell_accessible_update_cache(), the
update_cell_value() function now needs less code, too.
2011-12-16 04:53:16 +01:00
Benjamin Otte
4ac501736e a11y: Implement GtkContainerCellAccessible.update_cache 2011-12-16 04:53:16 +01:00
Benjamin Otte
118bc610f6 a11y: Move update_cache to GtkCellAccesible
This way, we can call it for container renderers, too.
2011-12-16 04:53:16 +01:00
Benjamin Otte
2e7fcc24ac a11y: Redo cell update function
1) always emit signals
   Previously, newly constructed cells would be told to not emit events.
   However, we can ensure that nothing is connected to the signals, so
   they will not actually emit anything.
2) don't return anything
   The return value is unused anyway.
2011-12-16 04:53:16 +01:00
Benjamin Otte
5cca6b2dc2 a11y: Remove unused function 2011-12-16 04:53:16 +01:00
Benjamin Otte
d2a9220006 a11y: remove now unused property lists 2011-12-16 04:53:16 +01:00
Benjamin Otte
a3f60349ed a11y: Don't copy data between renderers
Now that we don't use custom renderers anymore, we don't need to copy
data between them anymore.
2011-12-16 04:53:16 +01:00
Benjamin Otte
8ac579602c a11y: Use cell renderer creation funcs unconditionally
Also delete the previous "new" functions and actually set the real cell
renderer here.
2011-12-16 04:53:16 +01:00
Benjamin Otte
c5433e852b gtk: Add accessible types for cell renderers 2011-12-16 04:53:16 +01:00
Benjamin Otte
e5d5863a3f a11y: Use the accessible type 2011-12-16 04:53:16 +01:00
Benjamin Otte
0470b91add cellrenderer: Add API to keep the accessible type
It's private for now, because we require a GType that isn't exported in
the API yet.
2011-12-16 04:53:16 +01:00
Benjamin Otte
acb73f99bb API: cellrenderer: Add a private struct 2011-12-16 04:53:15 +01:00
Benjamin Otte
c28f641921 a11y: Add GtkRendererCellAcessible::renderer 2011-12-16 04:53:15 +01:00
Benjamin Otte
dfb82333a3 a11y: Remove unused variable 2011-12-16 04:53:15 +01:00
Benjamin Otte
ccabccc42f treeview: Send changed signal directly to a11y code
No more signal handler is needed, therefore the code can also get rid of
tracking the treemodel. And we use a faster approach for iterating the
changed cellrenderers: We just iterate all columns instead of over all
cell accessibles, as that number is likely quite a bit smaller.
2011-12-16 04:53:15 +01:00
Benjamin Otte
f5621a3a8e treeview: Emit cursor-changed signal when new model is set 2011-12-16 04:53:15 +01:00
Benjamin Otte
c9c7e91db9 a11y: Improve treeview's add/remove_selection() 2011-12-16 04:53:15 +01:00
Benjamin Otte
dc8f5effd4 a11y: Improve get_selected_rows() 2011-12-16 04:53:15 +01:00
Benjamin Otte
20b56689c5 a11y: Improve table_is_row_selected() 2011-12-16 04:53:15 +01:00
Benjamin Otte
3112679a5e treeview: Signal selection changes to the accessible
And another signal gone.
2011-12-16 04:53:15 +01:00
Benjamin Otte
1a3226e2f7 a11y: Emit children-changed properly for treeviews
Fixes the patch reverted in b7e74ef95f1d9cd851fb81a124beca0ca11dad00
properly.

https://bugzilla.gnome.org/show_bug.cgi?id=548782
2011-12-16 04:53:15 +01:00
Benjamin Otte
0005d820c7 treeview: Remove unnecessary accessible_expanded()
Instead, just call remove_state().
2011-12-16 04:53:15 +01:00
Benjamin Otte
c7b82c2cea treeview: Add add() function to accessible
... and use that to emit the insertion signals.
2011-12-16 04:53:14 +01:00
Benjamin Otte
82a9f6faa0 treeview: Set expandable flag from treeview
... instead of trying to update it manually.
2011-12-16 04:53:14 +01:00
Benjamin Otte
9e9533fc88 a11y: Redo cell accessible action handling
Multiple changes:
- actions are now available unconditionally, but only work in the right
  state. This mirrors other actions.
- instead of adding actions manually, they invoke the action on the
  GtkCellAccessibleParent interface.

Tests have been updated to reflect the changes
2011-12-16 04:53:14 +01:00
Benjamin Otte
f840efae96 a11y: Remove "toggle" action from cell renderers
This is identical to "edit" (even though that name is kinda confusing).
2011-12-16 04:53:14 +01:00
Benjamin Otte
adf183b71f treeview: Set EXPANDED state directly on a11y elements 2011-12-16 04:53:14 +01:00
Benjamin Otte
6fa72300be treeview: Deprecate gtk_tree_view_set_destroy_count_func()
The accessibility code doesn't need it anymore.
2011-12-16 04:53:14 +01:00
Benjamin Otte
ab9c2c2de2 a11y: Remove destroy_count_func usage
It's not needed anymore.
2011-12-16 04:53:14 +01:00
Benjamin Otte
8ca5192d6d a11y: Emit row-deleted signal when rows get deleted
Instead of in the old callbacks.
2011-12-16 04:53:14 +01:00
Benjamin Otte
25445837ca a11y: Revert 22a47c3dbd
The fix is wrong on multiple levels. I'll add a proper fix soon.

https://bugzilla.gnome.org/show_bug.cgi?id=548782
2011-12-16 04:53:14 +01:00
Benjamin Otte
95dc248790 treeview: Don't use signals in a11y row expansion
Instead, add a function and call it directly.
2011-12-16 04:53:14 +01:00
Benjamin Otte
d9b71702dc a11y: Add _gtk_tree_view_accessible_add_state()
... and _gtk_tree_view_accessible_remove_state(). They should be called
by gtktreeview.c to notify about changes of state for a row.
2011-12-16 04:53:13 +01:00
Benjamin Otte
3badf48d2e a11y: Split out function
I want to use that function when sending notifications. See next
commits.
2011-12-16 04:53:13 +01:00
Benjamin Otte
ff80ae16d9 a11y: Readd FOCUSABLE state
The state was lost in commit 08d86fabc4.

Also order the states that are always set alphabetically.
2011-12-16 04:53:13 +01:00
Benjamin Otte
0ef6771bcc a11y: Remove old notify about showing/visible
As cells are always visible and showing, there is no need to do complex
notification mechanisms anymore.
2011-12-16 04:53:13 +01:00
Benjamin Otte
7f42a9465a a11y: Add _gtk_cell_accessible_state_changed()
It's supposed to replace the old state_set calls.
2011-12-16 04:53:13 +01:00
Benjamin Otte
90f04b56a7 a11y: Split out renderer<->atk state matching
We now keep a state map. This makes adding new states easier, and
doesn't introduce bugs with state change emissions.
2011-12-16 04:53:13 +01:00
Benjamin Otte
acfb3b3d88 a11y: Don't duplicate information anymore
We do provide the expandable and expanded information via
GtkCellRendererState now so there is no need to use extra flags.
2011-12-16 04:53:13 +01:00
Benjamin Otte
bb029420fd a11y: Set new treeview flags 2011-12-16 04:53:13 +01:00
Benjamin Otte
175043bd8d treeview: Set the new flags when rendering the cell 2011-12-16 04:53:13 +01:00
Benjamin Otte
b6aa011c43 cellrenderer: Add EXPANDED and EXPANDABLE states
These make more sense as flags than they do as properties of the cell
renderer.
2011-12-16 04:53:13 +01:00
Benjamin Otte
953b4aedf1 tests: Add a test for latest commit 2011-12-16 04:53:05 +01:00
Benjamin Otte
94f00eb04d widget: Don't change sensitive state with insensitve parent
This way child.set_sensitive(True) with an insensitive parent doesn't
cause child to become sensitive.
2011-12-16 04:50:11 +01:00
Benjamin Otte
1377ff08c0 fontchooserwidget: Handle dpi < 0
Just use 96.0
2011-12-16 04:50:11 +01:00
Matthias Clasen
14f1811158 Add new symbols 2011-12-15 22:40:01 -05:00
Cosimo Cecchi
f0714338b3 iconhelper: treat the empty string as a NULL icon name
Treat the empty string as if it was a NULL icon name instead of
rendering GTK_STOCK_MISSING_IMAGE.
This used to be the previous behavior of GtkCellRendererPixbuf and
applications might still rely on it.
2011-12-15 20:01:35 +01:00
Cosimo Cecchi
798413151f cellrendererpix: save the icon size locally instead of in the helper
We need to save the icon size locally for GtkCellRendererPixbuf, since
its properties are set again every time it's drawn (resetting the icon
size on the helper by means of _gtk_icon_helper_clear() each time).
2011-12-15 19:59:24 +01:00
Cosimo Cecchi
69a5b3af94 menuitem: cleanup arrow-spacing fetch code
Refactor get_arrow_size() to return the spacing as well, since basically
we always need both.
2011-12-15 18:52:30 +01:00
Cosimo Cecchi
05e62e0251 menuitem: share code between HFW and non-HFW height requests
The code is very similar; having two slightly different code paths is
bad and can lead to bugs. Refactor the code to use the same height
request function.
2011-12-15 18:52:30 +01:00
Cosimo Cecchi
4d76b10ce5 menuitem: properly respect padding when drawing the separators
Use the padding when calculating the draw coordinates of the separator.

https://bugzilla.gnome.org/show_bug.cgi?id=666242
2011-12-15 18:52:30 +01:00
Cosimo Cecchi
713df0c72b menuitem: force odd height if we're not using wide separators
So that the 1px line can receive the same amount of space above and
below.

https://bugzilla.gnome.org/show_bug.cgi?id=666242
2011-12-15 18:52:30 +01:00
Cosimo Cecchi
20e94c1275 menuitem: don't request twice the padding for separator menu items
Padding was requested twice for separator menu items.

https://bugzilla.gnome.org/show_bug.cgi?id=666242
2011-12-15 18:52:30 +01:00
Florian Müllner
4f8f8fe828 window: Add hide-titlebar-when-maximized property
For maximized windows, titlebars cannot be used to reposition or
scale the window, so if an application does not use it to convey
useful information (other than the application name), the screen
space occupied by titlebars could be put to better use.
Add a new window property which requests from the window manager
to hide titlebars when windows are maximized to account for this.

https://bugzilla.gnome.org/show_bug.cgi?id=665616
2011-12-15 16:31:56 +01:00
Cosimo Cecchi
cfa0339559 scale: remove unused variable 2011-12-15 12:16:09 +01:00
Rui Matos
1235dc320b widget: Synthesize crossing only if sensitivity changed while propagating state 2011-12-14 17:03:44 +00:00
Andrea Cimitan
40423df234 Add has-origin property for GtkScale
If the scale has an origin (it will have one by default), GtkRange will
render the two sides before/after the current value with different style
classes, making it possible for themes to use different colors and
properties for the two areas.
This was possible in GTK 2 with style details, but got lost during the
road to 3.0.

https://bugzilla.gnome.org/show_bug.cgi?id=665140
2011-12-14 17:16:09 +01:00
Alexander Larsson
10b5ec20f2 Fix set_focus_child handling during focus changes
In many cases we used to set focus_child to NULL all the way up
to the top and then to the right value, even if there was
a common ancestor, meaning these see a temporary NULL value for
focus_child. Only when the new focus widgets direct parent was
in the previous ancestor list did we stop early.

This fixes that by always stopping propagation when reaching
the common ancestor.
2011-12-14 00:26:40 +01:00
Claudio Saavedra
064204da9b GtkFrame: Fix a casting in the compute_child_allocation() method
The casting used to calculate the child allocation is confusing MAX().
As a result, width and height end up with negative values, which makes no sense.

https://bugzilla.gnome.org/show_bug.cgi?id=666109
2011-12-13 20:26:30 +02:00
Cosimo Cecchi
a7f3a9ff74 themingengine: split a GtkThemingBackground object
Allows easier modification and general sanity of the CSS background
rendering code.
2011-12-12 12:46:52 +01:00
Cosimo Cecchi
1e23a74a95 image: take misc padding into account when calculating x/y draw coords
This fixes the misc-alignment.ui reftest.
2011-12-12 12:30:27 +01:00
Cosimo Cecchi
b215aeacc8 image: add gtk_image_get_preferred_size()
Add a function to query the preferred size of the GtkImage, and use it
in the get_preferred_width/height implementations.
2011-12-12 12:29:21 +01:00
Benjamin Otte
92929b968b treeview: Ensure selection's changed signal
There was a corner case where the changed signal was not emitted.
If rows were built like this:
  1    (not selected)
  + 2  (selected)
  + 3  (not selected)
And row 1 was removed, no signal would be emitted.

I like it when writing tests actually finds bugs that have been around
since 2003 - introduced by 4a03ea2334
actually. :)
2011-12-10 08:00:26 +01:00
Benjamin Otte
d4d2cc14d2 treeview: Don't try to optimize away selection_changed signal
We get certain cases, in particular with SELECTION_MULTIPLE, where we
cannot figure out in advance of real_set_cursor() if the selection will
actually change.
2011-12-10 08:00:26 +01:00
Benjamin Otte
559c3c7da1 treeview: Add a CURSOR_INVALID flag to set_cursor_row()
This is necessary so the code doesn't attempt to do things with the
previous cursor, which currently cause crashes.
2011-12-10 08:00:26 +01:00
Benjamin Otte
d3bccfbb6d treeview: Replace lots of boolean args with flags
I want to add more and 3 boolean args is essentially unreadable code.
2011-12-10 08:00:26 +01:00
Benjamin Otte
4dbedb7481 docs: Update code demo for newer glib 2011-12-10 08:00:26 +01:00
Benjamin Otte
1a2932ba29 treeview: Handle the case where the cursor row gets deleted
Previously, the cursor would just become invalid, which used to
reselect the first row in the treeview later on (without a
cursor-changed signal). This leads to a crash now with the recent
refactorings.

The patch is longer than I'd like it to be, but the situation is kinda
complicated, because we want to make sure to move the cursor to a good
row. It works like this:
1) From the deleted row, search forward for the first row that is not
   going to be deleted and is not a separator.
2) If no such row exists, search backwards for a row that is not a
   separator.
3) If no such node exists, clear the cursor.
2011-12-10 08:00:26 +01:00
Benjamin Otte
e01af5c5c9 treeview: Replace cursor handling by keeping the node
Previously the code used a GtkTreeRowReference, which was (a) less
performant and more importantly (b) hiding errors.
The errors being hidden were the referenced row becoming invalid or
collapsed, because such rows would not be valid cursor rows and it would
be necesary to select a new row and emit a "cursor-changed" signal.

So if a crash bisects down to this commit, it is very likely that the
cursor has not correctly been updated and the cursor row is invalid.
2011-12-10 08:00:26 +01:00
Benjamin Otte
78aad2d35c treeview: Use _gtk_rbtree_contains() in a11y code 2011-12-10 08:00:25 +01:00
Benjamin Otte
710a8435cc rbtree: Add _gtk_rbtree_contains()
It's useful in a bunch of places, so split it out
2011-12-10 08:00:25 +01:00
Matthias Clasen
9bf17a95e5 Revert 3fd7dbc940
Calling gdk_keymap_add_virtual_modifiers causes _all_ virtual
modifiers to be added, which causes problem when they are co-located
on the same real modifier (as Super and Hyper often are). Effectively,
this made it impossible to enter key combinations involving Super,
since they all turn into Super+Hyper.
2011-12-08 12:44:19 -05:00
Timothy Arceri
36effbb307 print to file: fixed lost filename in gui
Stop widget creating an event before updating both directory and
filename values.

https://bugzilla.gnome.org/show_bug.cgi?id=603823
2011-12-07 20:04:38 -05:00
Benjamin Otte
6454c718dd overlay: Properly allocate the child upon addition
This ensures that after addition the child gets assigned the proper
allocation and the child window is properly shown/hidden.
2011-12-08 00:24:28 +01:00
Benjamin Otte
003d80dbea overlay: Move code
Move code for child allocation into the child allocation function. Don't
keep it in the overlay allocation code.

See the next commit for why this is useful.
2011-12-08 00:24:28 +01:00
Benjamin Otte
f34d0d6f7b overlay: Create child window before setting parent
Otherwise, the window will not be used when set_parent() maps the child.
2011-12-08 00:24:28 +01:00
Rui Matos
6ed5918718 progressbar: Set state flags on draw
We were missing setting state flags on the style context before drawing.
2011-12-07 22:42:56 +00:00
Rui Matos
7a6babfd02 widget: Unset window-unfocused in gtk_widget_unparent()
Widgets without a parent aren't inside a toplevel window so we must remove
window-unfocused as it doesn't make sense outside a toplevel.

https://bugzilla.gnome.org/show_bug.cgi?id=661428
2011-12-07 22:41:58 +00:00
Benjamin Otte
807a449f29 treeview: Fix crash when scrolling to end
This broke in a4630d0e7b

https://bugzilla.gnome.org/show_bug.cgi?id=665741
2011-12-07 20:12:12 +01:00
Benjamin Otte
c24742e789 modifierstyle: Fix compile errors
Introduced in 7bd2446801
2011-12-06 18:01:57 +01:00
Alexander Larsson
7bd2446801 Remove broken optimization in style modifier overrides
We used to only set the override color or font if it was different
than the existing value. However, that means you can't change it to
an override that is the same as the default value for the property.

With this fixed you can e.g. override with a color of 0,0,0,0 which
you couldn't before.
2011-12-06 14:12:23 +01:00
Matthias Clasen
d978ed85ae Remove an unused variable 2011-12-05 18:07:41 -05:00
Carlos Garnacho
029a884d9e gtk,notebook: Invalidate the gap side when reordering tabs
This narrow area is invalidated so the gap follows the tab
being reordered.
2011-12-05 21:23:23 +01:00
Alexander Larsson
fd06890354 notebook: Make the tab reordering dnd window transparent 2011-12-05 21:15:06 +01:00
Cosimo Cecchi
392cdff697 statusicon: fix the build on !X11
Uninevitable fallout from my last patch to GtkStatusIcon. Thanks to Rob
Bradford for testing this.
2011-12-05 13:22:20 -05:00
Benjamin Otte
4259a27cf5 widget: Update Pango context on state change
The layout depends on the state flags, so it must be updated when they
change.
2011-12-05 18:27:05 +01:00
Benjamin Otte
c3cccf586c label: Clear layout on state change
Selected or active text might be rendered differently.
2011-12-05 18:27:05 +01:00
Benjamin Otte
5ac6950dd6 label: Move callback to new stuff
We want to react to state flags changing, not to the (deprecated) state
type changing.
2011-12-05 18:27:05 +01:00
Cosimo Cecchi
d80ff7b5f1 stylecontext: always add the ARROW style class when rendering an arrow
When gtk_render_arrow() is called, always add an ARROW style class to
the GtkStyleContext before rendering, so themes can specify a different
color for it.

https://bugzilla.gnome.org/show_bug.cgi?id=665420
2011-12-05 09:37:21 -05:00
Cosimo Cecchi
c538fb8f64 stylecontext: add GTK_STYLE_CLASS_ARROW
For e.g. submenu items arrow in GtkMenuItems.

https://bugzilla.gnome.org/show_bug.cgi?id=665420
2011-12-05 09:30:57 -05:00
Cosimo Cecchi
2e01dc1b7a statusicon: port to GtkIconHelper
Just always render the pixbuf ourselves and set it on the GtkImage in
the X11 case.
Code for other backends was already rendering the pixbuf manually before
translating it into a native type, so this greatly simplifies the code.

https://bugzilla.gnome.org/show_bug.cgi?id=665409
2011-12-05 09:09:43 -05:00
Alexander Larsson
c47ef89aca Merge branch 'transparent-windows' 2011-12-05 14:24:28 +01:00
Alexander Larsson
93c086ec80 Make window handle transparent
Instead of painting the window background on the grip_window we now
only paint it on the GtkWindow->window, and we make the grip_window
have a transparent background.

We can't really make transparent window handle background optional
via css atm, because the handle color is actually based on the
background color, so if that is set to transparent we won't draw
anything.
2011-12-05 12:51:55 +01:00
Cosimo Cecchi
2bf765ab49 entry: avoid a mismatched cairo_save/restore
Leftover from GtkIconHelper migration.
2011-12-04 19:58:28 -05:00
Paolo Borelli
5a471fefdb Remove unused alignment from GtkTooltip. 2011-12-04 19:20:23 +01:00
Paolo Borelli
7c779a0bee Plug tiny leak in the css parser 2011-12-03 17:52:24 +01:00
Claudio Saavedra
f9c24e8f03 GtkIconView: fix a memory corruption in the drag-n-drop code
You shall free with g_slice_free() what you allocate with
g_slice_new().

https://bugzilla.gnome.org/show_bug.cgi?id=665338
2011-12-01 22:56:43 +01:00
Cosimo Cecchi
58b1f24d6d image: use the default icon size if no icon size is provided
If no icon size is provided (e.g. when setting icon-name or stock-id
using the GObject property directly), use the default icon size. This
matches the previous GtkImage behavior.
2011-11-30 19:47:52 -05:00
Cosimo Cecchi
0c68227270 image: minor cleanup 2011-11-30 19:47:52 -05:00
Paolo Borelli
2ef5844bac Introduce gtk_render_insertion_cursor
The new function provides an API that takes the PangoLayout and index
as input params, this way it handles strong and weak cursors internally
factoring out all code duplicated in the widgets that need to render
cursors.

https://bugzilla.gnome.org/show_bug.cgi?id=640317
2011-12-01 01:22:39 +01:00
Paolo Borelli
3c6842222a Use the split-cursor setting for textview cursors
Explicitely check the split-cursor setting when drawing the textview
insertion cursor instead of relying on the cursor_direction set in the
textlayout. This makes the cursor drawin code more uniform with other
widgets in preparation to refactoring the cursor drawing code in a
shared function.

https://bugzilla.gnome.org/show_bug.cgi?id=640317
2011-12-01 01:22:39 +01:00
Paolo Borelli
0bff1af7a2 Rework GtkTextView cursor code.
Move the handling of primary/secondary cursors to gtktextdisplay, which
makes code simpler and more consistent to how GtkLabel and GtkEntry
draw cursors, which is useful in preparation to further refactoring.

https://bugzilla.gnome.org/show_bug.cgi?id=640317
2011-12-01 01:22:39 +01:00
Paolo Borelli
b3f850e6b9 Tiny cleanup.
https://bugzilla.gnome.org/show_bug.cgi?id=640317
2011-12-01 01:22:38 +01:00
Paolo Borelli
f18bbdff53 Remove draw_insertion_cursor in label and entry
Remove the the draw_insertion_cursor wrapper which just converts from
GtkTextDir to PangoDirection

https://bugzilla.gnome.org/show_bug.cgi?id=640317
2011-12-01 01:22:38 +01:00
Cosimo Cecchi
772459979f image: simplify code
We can unconditionally call into the icon helper methods now that we
removed the g_return_val_if_fail() checks.
2011-11-30 19:06:38 -05:00
Cosimo Cecchi
d47e82ffdd entry: simplify code
We can unconditionally call into the icon helper methods now that we
removed the g_return_val_if_fail() checks.
2011-11-30 19:05:34 -05:00
Cosimo Cecchi
864c5610f8 icon-helper: remove useless checks
When we change storage type, we always clear the rest of the object, so
these checks do not add any safety.
2011-11-30 19:04:17 -05:00
Cosimo Cecchi
d300ddc5e4 icon-helper: don't warn out when the icon size is GTK_ICON_SIZE_INVALID
We can call ensure_icon_size() for an empty image; don't warn out in
that case, but just return a zero width.
2011-11-30 18:32:01 -05:00
Cosimo Cecchi
e37c55aa3e icon-helper: don't reset pixel_size when clearing the helper
Don't reset the pixel size when clearing the helper; pixel-size is e.g a
property of GtkImage, which is stable unless explicitly set.
2011-11-30 18:15:05 -05:00
Cosimo Cecchi
5224302a30 entry: always prepare the style context when using it for entry icons
Make sure to always prepare the entry's style context for the entry icon
style when passing it to GtkIconHelper.
2011-11-30 16:39:59 -05:00