Commit Graph

15907 Commits

Author SHA1 Message Date
Ryan Lortie
363c2d684c GtkApplication: lock gdk on incoming messages
When we have incoming activations or action invocations we should
acquire the GDK lock, just in case the program in question is using gdk
threads.

https://bugzilla.gnome.org/show_bug.cgi?id=665737
2011-12-19 12:51:12 -05:00
Ryan Lortie
76d671d6a2 Move X property handling to GtkApplicationWindow
Don't try to deal with this using a qdata and signal connections in
GtkApplication.
2011-12-19 12:51:12 -05:00
Matthias Clasen
cff5ba1bc2 Document that gtk_init is called without argv
This answers a question in bug 661823.
2011-12-19 12:51:12 -05:00
Matthias Clasen
316e0ea542 Fix a typo 2011-12-19 12:51:12 -05:00
Matthias Clasen
5562d0a57a Forgotten file 2011-12-19 12:51:12 -05:00
Matthias Clasen
080007d7cb Show off some menus 2011-12-19 12:51:12 -05:00
Matthias Clasen
06a75b7e1f Some more menu-related docs 2011-12-19 12:51:12 -05:00
Matthias Clasen
a991bb9927 GtkBuilder: pick up named submenus
When parsing GMenu xml, use the facility for pick up named submenus.
Note that <section id='foo'>...</section> is _not_ a named submenu.
It is a named item with an unnamed submenu :-(
2011-12-19 12:51:12 -05:00
William Hua
c1f9ccce5b Handle menu changes. 2011-12-19 12:51:12 -05:00
William Hua
1a02fc036d Refactor GMenuModel rendering for Mac OS. 2011-12-19 12:51:12 -05:00
William Hua
ec72f8fd81 gtkquartz-menu: fix some leaks 2011-12-19 12:51:12 -05:00
William Hua
460ac291b2 begin adding menu accelerators
Show accelerators in menus.
2011-12-19 12:51:12 -05:00
Matthias Clasen
3103ae2685 Two small fixes
Don't leak a session bus reference, and don't assume a display
is X11 just because we've built the X11 backend.
2011-12-19 12:51:12 -05:00
Matthias Clasen
d91c9f9859 Fix up includes 2011-12-19 12:51:12 -05:00
William Hua
8bc7513a7b begin GtkApplication menu support for Mac OS 2011-12-19 12:51:11 -05:00
Ryan Lortie
21f4562d10 GtkApplicationWindow: share one GActionMuxer
Use the same GActionMuxer for menubars and accels instead of recreating
a new one each time.
2011-12-19 12:51:11 -05:00
Matthias Clasen
f485dd3f08 Documentation additions 2011-12-19 12:51:11 -05:00
Matthias Clasen
0baa663182 GtkApplicationWindow: Always install accelerators
We want accelerators to work, even if the menus are not shown
locally, so we can't rely on the GtkMenu code to set them up
for us. Currently, this code only installs accelerators when the
window is realized.
2011-12-19 12:51:11 -05:00
Matthias Clasen
f7244431a9 GtkApplication: Extract accelerators from menus
This allows to specify accelerators in a convenient way, by
adding accel="..." attributes to the menu items in the
XML for the menu.

Currently, the accelerators are extracted only once, when the
menu property is changed on the application.
2011-12-19 12:51:11 -05:00
Matthias Clasen
2398d7e900 Introduce gtkaccelmapprivate.h
Move internal accel map API there and update all users.
Also, add an internal function to create an accel path for
an action and parameter, and use it in gtkapplication.c and
gtkmodelmenuitem.c instead of duplicating that code.
2011-12-19 12:51:11 -05:00
Matthias Clasen
153cc818db GtkApplication: Add API to install accelerators for actions 2011-12-19 12:51:11 -05:00
Matthias Clasen
1c6d0c3e27 GtkApplicationWindow: Set the accel group on constructed windows
This will make the menuitems pick up matching accel map entries
automatically. Currently, nothing creates such accel map entries,
though.
2011-12-19 12:51:11 -05:00
Matthias Clasen
9d62d24d65 GtkApplicationWindow: Add a GtkAccelGroup
This will be used in the following patches.
2011-12-19 12:51:11 -05:00
Matthias Clasen
d5d896f812 Fix a gtk-doc warning 2011-12-19 12:51:11 -05:00
Ryan Lortie
90fcf994d5 GtkApplication: export windows on the bus
And advertise their location on the bus using X11 properties.
2011-12-19 12:51:11 -05:00
Ryan Lortie
03db3e1ca1 (trivially) implement 'shutdown' in GtkApplication 2011-12-19 12:51:11 -05:00
Matthias Clasen
aa1faa7c70 Add an example 2011-12-19 12:51:10 -05:00
Matthias Clasen
898bc98d3b Update GtkApplicationWindow docs 2011-12-19 12:51:10 -05:00
Matthias Clasen
3205a40b84 Whitespace fix 2011-12-19 12:51:10 -05:00
Matthias Clasen
f119c834c1 Make accelmap initialization more forgiving 2011-12-19 12:51:10 -05:00
Matthias Clasen
7ef340fb87 Clean up includes 2011-12-19 12:51:10 -05:00
Ryan Lortie
cd7ce867a7 Split off GMenuModel -> GtkMenuBar code
Put this in a separate file and substantially refactor it.

Move handling of submenu creation into gtkmodelmenuitem where it
belongs.

Improve our handling of when to show separators or not.
2011-12-19 12:51:10 -05:00
Ryan Lortie
afb0c098cb Watch "shell shows menu" settings for changes
Correctly monitor the GtkSettings for changes to the
"gtk-shell-shows-app-menu" and "gtk-shell-shows-menubar" properties.
2011-12-19 12:51:10 -05:00
Ryan Lortie
88f16b13f3 GtkSettings: quartz: shell always shows menus 2011-12-19 12:51:10 -05:00
Matthias Clasen
b7de477611 Never add separators to menubars 2011-12-19 12:51:10 -05:00
Ryan Lortie
2e64177e3f GtkModelMenuItem: don't leak a GVariant 2011-12-19 12:51:10 -05:00
Ryan Lortie
f83530ae3a GtkModelMenuItem: omit indicator if not required
GtkModelMenuItem, being based on GtkCheckMenuItem, was always reserving
space for a check/radio indicator.  This ends up looking pretty strange
in a GtkMenuBar.

Don't reserve space for the indicator unless it's appropriate.
2011-12-19 12:51:10 -05:00
Ryan Lortie
de53b5226d GtkApplicationWindow: nuke some g_print spew 2011-12-19 12:51:10 -05:00
Ryan Lortie
f0c2ff39fc GtkApplcationWindow: plug two obvious leaks 2011-12-19 12:51:10 -05:00
Colin Walters
c7e7237559 GtkApplicationWindow: Consistently unparent menubar
We create it floating, and don't hold an extra ref, so we should
just unparent it.
2011-12-19 12:51:10 -05:00
Ryan Lortie
c299963428 GtkApplicationWindow: clean up menubar logic 2011-12-19 12:51:10 -05:00
Ryan Lortie
612e24dfc6 introduce GtkModelMenuItem
This GtkMenuItem subclass (and GActionObserver implementation) contains
all the knowledge necessary for converting a GMenuModel item description
into a GtkMenuItem.

Remove much of the code that used to do this from
gtkapplicationwindow.c.
2011-12-19 12:51:09 -05:00
Ryan Lortie
ecfdb834c9 GtkSettings: add shell-shows-menubar property
Unity will set this to tell us that it is going to handle displaying the
menubar.
2011-12-19 12:51:09 -05:00
Matthias Clasen
45e9d09eab Only add separators when a section actually ends 2011-12-19 12:51:09 -05:00
Colin Walters
2c6b7eff17 GtkApplicationWindow: Further sanitize handling of merging app menu and menubar
The _set_show_app_menu should really be _set_show_menubar().

Also, correctly display just the window menu in the window when run
under GNOME 3.
2011-12-19 12:51:09 -05:00
Colin Walters
65a2962733 GtkApplication: Merge app menu and menubar
Change bloatpad to have both an app menu and a menubar.
2011-12-19 12:51:09 -05:00
Matthias Clasen
aae52d4580 GtkApplicationWindow: Make mnemonics work for stateful actions 2011-12-19 12:51:09 -05:00
Colin Walters
3a088d9ac2 GtkApplicationWindow: Don't unref a NULL object 2011-12-19 12:51:09 -05:00
Ryan Lortie
b42308f8e3 Adapt to changes in GLib API
g_application_get_menu() -> get_app_menu().
2011-12-19 12:51:09 -05:00
Matthias Clasen
33aaf26dd5 Drop GtkApplicationMenuButton for now
This feels premature; we do have the fallback situation covered
adaequately with the menubar, and people can do their own creative
solutions with gtk_application_window_get_menu(), so we don't have
to offer a widget for this right now.
2011-12-19 12:51:09 -05:00
Matthias Clasen
acbda82199 Remove a redundant test 2011-12-19 12:51:09 -05:00
Matthias Clasen
b893247eeb GtkApplicationMenuButton: add docs 2011-12-19 12:51:09 -05:00
Matthias Clasen
bd30a1c556 Undoccommentify action muxer files 2011-12-19 12:51:09 -05:00
Matthias Clasen
0683f086bb Whitespace fixes 2011-12-19 12:51:09 -05:00
Matthias Clasen
6d0475df4f Remove no-longer existing function 2011-12-19 12:51:09 -05:00
Matthias Clasen
f10f3bc7e4 GtkApplicationWindow: more docs 2011-12-19 12:51:09 -05:00
Matthias Clasen
762616dd75 Include gtkapplicationmenubutton.h in gtk.h 2011-12-19 12:51:08 -05:00
Matthias Clasen
65f5a65336 GtkApplicationWindow: mark a string for translation 2011-12-19 12:51:08 -05:00
Matthias Clasen
792c719478 Some coding style fixes 2011-12-19 12:51:08 -05:00
Matthias Clasen
d9c3714fcb GtkApplication: doc improvement 2011-12-19 12:51:08 -05:00
Matthias Clasen
a6794133aa Some initial docs 2011-12-19 12:51:08 -05:00
Colin Walters
1eee7fb103 GtkApplicationWindow: Use dispose for GObjects
This ensures we break cyclic references.
2011-12-19 12:51:08 -05:00
Colin Walters
9e9e1a9fbf gtkapplicationwindow: Pick up gtk-shell-shows-app-menu XSetting
Calling gtk_application_window_set_show_app_menu() is now an override
for that setting.  If you don't call it, we pick up the default.
2011-12-19 12:51:08 -05:00
Ryan Lortie
ddfbe19b23 add GtkApplicationMenuButton 2011-12-19 12:51:08 -05:00
Ryan Lortie
1a97f4b9ef GtkApplicationWindow: wire up action activations
Wire the 'activate_action' and 'change_action_state' vfuncs through to
the GSimpleActionGroup.
2011-12-19 12:51:08 -05:00
Ryan Lortie
af0c1e66ab gtk.symbols fixes 2011-12-19 12:51:08 -05:00
Ryan Lortie
7e34342899 GtkApplicationWindow: implement GActionMap 2011-12-19 12:51:08 -05:00
Ryan Lortie
a93b9dd1cb add GtkApplicationWindow
This is a GtkWindow subclass that "application windows" will use.  Each
is associated with a GtkApplication, has the ability to show menus and
will have its own associated set of actions.
2011-12-19 12:51:08 -05:00
Ryan Lortie
e7ad2f97c8 add GActionMuxer and observer interfaces
These were destined for GLib, but they don't really make sense as a
public API.  Instead, we'll copy/paste them around between the various
codebases that need to render menus.
2011-12-19 12:51:08 -05:00
Ryan Lortie
f826dd5481 GtkSettings: add shell-shows-app-menu property
This is a boolean property that will be set to TRUE if the current
desktop environment is capable of displaying the application menu as
part of the desktop shell.

If it is FALSE then the application will need to display the menu for
itself.
2011-12-19 12:51:08 -05:00
Matthias Clasen
6b7be4a3a2 Add a very bad fallback check
...maybe committing this inspires some better solution.
2011-12-19 12:51:07 -05:00
Colin Walters
9c52a73c21 window: Set a _DBUS_APPLICATION_ID X11 window property
This will allow gnome-shell to reference it.
2011-12-19 12:51:07 -05:00
Matthias Clasen
5705a330c2 GtkApplication: Insert separators after sections
The previous code was only inserting a separator when a new
section was starting right away, which may not always be the
case.
2011-12-19 12:45:51 -05:00
Matthias Clasen
5aee67793f GtkApplication: Initial attempt at section headings
This should be redone to show the label together with the
separator line, somehow. For now, just put the label below
the separator, as a separate item.
2011-12-19 12:45:51 -05:00
Matthias Clasen
92af3d04b8 GtkApplication: use activate for actions here, too 2011-12-19 12:45:51 -05:00
Matthias Clasen
95d9a5e368 Adapt to api changes in GMenuModel 2011-12-19 12:45:51 -05:00
Matthias Clasen
cc24dbe9c7 GtkApplication: add a way to get the appmenu
This function either returns a GtkMenu or NULL.
Still to do: detect if the app menu is externally handled.
2011-12-19 12:45:51 -05:00
Matthias Clasen
601b3fca60 Drop an unused variable 2011-12-19 12:45:51 -05:00
Matthias Clasen
3b2f77e2c6 Remove an unneeded include 2011-12-19 12:45:51 -05:00
Matthias Clasen
f13083bf0d Pass domain to the menu parser
This is necessary to make translations in markup work.
2011-12-19 12:45:51 -05:00
Matthias Clasen
1ddaf01aed Quick-and-dirty GtkBuilder integration
This makes GtkBuilder accept a GMenuMarkup tree at the toplevel
(ie with <menu id='foo'> being a child of <interface>) and the resulting
GMenu object can be obtained via gtk_builder_get_object (builder, "foo").
2011-12-19 12:45:50 -05:00
Benjamin Otte
902c5c6979 a11y: emit entry signals immediately
We want to emit signals when stuff happens, not sometime later. That way
we can also catch the correct text that was deleted.

https://bugzilla.gnome.org/show_bug.cgi?id=659445
2011-12-19 16:17:14 +01:00
Benjamin Otte
3d4a8dabb2 a11y: implement widget_(un)set in ContainerCell 2011-12-19 16:17:13 +01:00
Benjamin Otte
d2a58446ea a11y: Make GtkCellAccessible a GtkAccessible 2011-12-19 16:17:13 +01:00
Benjamin Otte
073b4d8bea accessible: Deprecate gtk_accessible_connect_widget_destroyed()
That was an abomination. Also, if people called it twice, you got even
mor signal handlers!
2011-12-19 16:17:13 +01:00
Benjamin Otte
0c1f2f2fc1 widget: Set widget in accessible's constructor
No need to add t manually later.
2011-12-19 16:17:13 +01:00
Benjamin Otte
d801b28365 a11y: Don't connect_destroyed anymore
It's not used now that set_widget() does the right thing.
2011-12-19 16:17:13 +01:00
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