Commit Graph

174 Commits

Author SHA1 Message Date
Matthias Clasen
58253d567f radiobutton: Fix selection on focus-in
We need to unselect the previously selected button
to preserve radioness.

Fixes: #2326
2020-04-09 22:38:30 -04:00
Benjamin Otte
a278edab22 window: Remove type argument from gtk_window_new() 2020-02-14 21:18:49 +01:00
Benjamin Otte
146b921246 cssnode: Convert name + id from interned string to GQuark
The reason for this is simply that I want to get hash functions that
have their values close together, so they can fit in a smaller range
(the goal here is 12 bits). By using GQuark, we get consecutive numbers
starting with 1 (and applications have <1000 quarks usually), whereas
interned strings can be all over the place.

As a side effect we also save 64 bytes per declaration.
2020-01-28 02:17:03 +01:00
Benjamin Otte
b9c81b1b94 widget: Initialize cssnode name asap
That way, it's correct in subclass's init functions.
2020-01-21 12:47:16 +01:00
Benjamin Otte
553a9c292d togglebutton: Don't emit clicked during set_active()
set_active() is meant to set the state of the property, which happens
during setup.
The clicked signal is emitting events from user actions.

It is impossible to use Togglebuttons for MVC applications as long as it
does that.
2019-10-29 04:56:19 +01:00
Timm Bäder
dbabdf8341 radiobutton: Fix a warning in a code sample 2019-10-09 16:57:21 +02:00
Matthias Clasen
5d3c85c7e9 radio button: Make final 2019-05-27 00:10:48 -04:00
Matthias Clasen
cf47bb9355 gtk: Stop using gtk_button_clicked
This function is going away.
2019-05-18 14:27:09 -04:00
Timm Bäder
bd71e744d2 Stop using gtk_box_pack_end
It might soon go away!
2019-01-23 19:30:46 -05:00
Timm Bäder
016de68ceb radiobutton: Save signal IDs like everything else 2018-08-25 08:05:48 +02:00
Timm Bäder
beb4cb0e37 radiobutton: remove priv pointer 2018-06-18 17:35:03 +02:00
Timm Bäder
1eb22e7927 radibutton: Use focusing facilities from GtkWidget
Instead of the ones from GtkContainer which will hopefully soon go away.
2018-03-17 12:09:30 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Timm Bäder
3f68475b6f Make a few more code samples compile 2018-01-03 17:11:32 +01:00
Matthias Clasen
ffd6baec42 gtk: Intern css names
This avoids a bunch of strdups at startup.
2017-11-17 22:49:57 -05:00
Timm Bäder
66d584ce6e togglebutton: Move :draw-indicator property to GtkCheckButton
It's not used in GtkToggleButton at all, only in GtkCheckButton and
GtkRadioButton.
2017-01-30 18:11:00 +01:00
Timm Bäder
ea897c6df4 Remove gtk_widget_show_all 2017-01-20 21:37:04 +01:00
Benjamin Otte
e1a03ead7a Use NULL for generic marshallers in g_signal_new()
glib will use the correct marshaller automatically. And as a side
effect, we also get all glib optimizations, like a va marshaller.
2016-08-29 16:20:54 +02:00
Matthias Clasen
2f544655f9 Revise CSS node documentation
Clarify the use of brackets in the CSS node diagrams:
[] means optional nodes or classes, <> means child widgets.
2015-12-16 10:58:47 -05:00
Matthias Clasen
a52c3a3db9 radiobutton: Port radio buttons to gadgets
This was already mostly done by inheritance from GtkCheckButton.
To complete it, stop using the draw_indicator vfunc for radio
buttons, and instead make the indicator gadget draw either a
check or radio.
2015-12-15 08:41:16 -05:00
Matthias Clasen
67b739b58a button: Add diagrams to CSS node docs for buttons 2015-11-03 10:17:41 -05:00
Matthias Clasen
c631656f0c toggle button: Convert to css nodes
Convert GtkToggleButton and its subclasses to CSS nodes.
Keep the button element name for when we want to render
these button-like (but with .toggle, .check and .radio
style classes for differentiation).

When we want to render them with an indicator, use distinct
element names checkbutton and radiobutton, and add a subnode
for the indicator with name check or radio.
2015-10-30 00:40:50 -04:00
Matthias Clasen
143d3c1204 radio button: Convert to g_object_notify_by_pspec
This avoids pspec lookup overhead in g_object_notify.
2015-09-06 17:11:36 -04:00
Matthias Clasen
0648453339 radio button: Fix directional navigation
GtkRadioButton had a deficient copy of the focus sort code
in GtkContainer, causing focus to jump over the next button
in the list. Just use _gtk_container_focus_sort() here,
which fixes the bug _and_ saves 80 lines of code.

https://bugzilla.gnome.org/show_bug.cgi?id=746817
2015-03-29 00:24:35 -04:00
Cosimo Cecchi
276a510b4b radiobutton: don't consider hidden buttons in the group for focus
When a GtkRadioButton has no focus, it will accept it when there is no
other active button in its group.
If the active button in the group is hidden, for example because the UI
desires not to have a default option pre-selected, currently the focus
will not be accepted, which is not desired behavior.

This commit changes the code to only consider visible buttons in the
group when checking whether another button is active.

https://bugzilla.gnome.org/show_bug.cgi?id=739474
2014-11-01 10:08:42 -07:00
Matthias Clasen
3f5d462305 GtkToggleButton: Move nonexported API to a private header
This is our standard practice nowadays.
2014-10-19 22:42:49 -04:00
Matthias Clasen
cc529c2423 GtkRadioButton: Allow setting group more than once
It turns out that GtkBuilder will sometimes set a property
twice. Normally, this is harmless, but for GtkRadioButton:group,
it triggered a critical. Remove that.
2014-10-02 23:37:38 -04:00
Benjamin Otte
d36bba293d checkbutton: Don't redundantly update states
States are set properly by GtkButton, there is no need to set them
manually.
2014-08-17 03:19:59 +02:00
Benjamin Otte
c1a063e1a4 checkbutton: Draw background unconditionally
We want to draw backgrounds always, not just on prelight. Themes can
decide to only set a background during prelight themselves.
2014-08-17 00:58:04 +02:00
Benjamin Otte
0f7c90ac62 radiobutton: :hover on hover
No special cases, those go in the theme.
2014-08-16 16:34:15 +02:00
Benjamin Otte
db1ab7ddf8 button: Handle :inconsistent in GtkToggleButton 2014-08-16 16:34:15 +02:00
Benjamin Otte
cd349dcd48 button: Handle :checked in gtktogglebutton.c
Don't try to handle it elsewhere.
2014-08-16 16:34:15 +02:00
Benjamin Otte
b675a13233 button: Remove depressed_on_activate
All buttons should always be marked as :active when they are pressed.
That includes checkboxes (which are never activated in real code anyway,
so this change pretty much doesn't matter).
2014-08-16 16:34:14 +02:00
Benjamin Otte
1abe923740 css: Do inconsistent checked states right
In HTML5, both pseudoclasses apply. So we do the same thing in our
widgets.

https://bugzilla.gnome.org/show_bug.cgi?id=733967
2014-08-16 16:34:14 +02:00
Benjamin Otte
bb069b781b button: Remove depressed variable
It is not used anymore.
2014-08-16 16:34:14 +02:00
Benjamin Otte
4e077d4638 gtk: Use new :checked state
on:
- GtkToggleButton
- GtkCheckButton
- GtkRadioButton
- GtkModelButton
- GtkCellRendererToggle
- GtkCheckMenuItem

also update themes:
- Adwaita
- Raleigh
but not the win32 theme.

The new :checked state replaces :active for the actual checkedness of
the widgets and :active is now used exclusively while the button is being
pressed.

https://bugzilla.gnome.org/show_bug.cgi?id=733967
2014-08-16 16:34:14 +02:00
Cosimo Cecchi
8fff30090b radiobutton: don't use focus-line-width 2014-05-09 11:02:45 -07:00
Cosimo Cecchi
99f0776f19 checkbutton: don't use focus padding 2014-05-09 11:02:42 -07:00
Cosimo Cecchi
0c6cc487d6 radiobutton: always use interior focus 2014-05-09 11:02:41 -07:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
Matthias Clasen
c779b42476 Docs: use // for comments in examples
Without sgml mode, we can't escape /* as /&ast; anymore,
so just switch to // for comments in examples.
2014-02-14 23:34:22 -05:00
Matthias Clasen
7f6a964c47 Docs: Remove all entities and turn off sgml mode
With all element markup gone, it is time to turn off
sgml mode, and get rid of entities as well.
2014-02-09 17:58:07 -05:00
William Jon McCann
4dee965116 docs: use apostrophe in *'m 2014-02-07 13:42:09 -05:00
William Jon McCann
7a208fbbf3 docs: use proper apostrophe
https://wiki.gnome.org/Design/OS/Typography
2014-02-07 13:06:10 -05:00
William Jon McCann
63e887e165 docs: replace all <examples> with markdown headings 2014-02-04 16:58:54 -05:00
William Jon McCann
4c8bd8e7cf docs: Identify examples that are C code
https://bugzilla.gnome.org/show_bug.cgi?id=723119
2014-01-29 12:45:49 -05:00
William Jon McCann
768bc44081 docs: use |[ ]| instead of <programlisting></programlisting>
https://bugzilla.gnome.org/show_bug.cgi?id=723119
2014-01-29 12:45:49 -05:00
Torsten Schönfeld
904bc27250 gtkradio*: add (allow-none) annotations were appropriate
https://bugzilla.gnome.org/show_bug.cgi?id=679563
2013-12-06 23:57:16 +01:00
Emmanuele Bassi
0899ef7cc9 gtk: Use new macros for defining private data
https://bugzilla.gnome.org/show_bug.cgi?id=702996
2013-07-09 09:30:02 +01:00
William Jon McCann
b101d465be Deprecate and ignore gtk-keynav-cursor-only and gtk-keynav-wrap-around 2013-06-26 15:33:10 -04:00