Commit Graph

783 Commits

Author SHA1 Message Date
Matthias Clasen
af6e0ee2b3 Use gtk_button_set_child throughout
Replace all uses of gtk_container_add on buttons
by gtk_button_set_child.
2020-05-04 22:53:07 -04:00
Matthias Clasen
6185cf95fb Fix label accessibility
Emit accessible change signals after setting the
new selection limits. This was broken in
commit f6bedd0d5e, and showed up as broken
accessibility tests.
2020-04-20 23:16:23 -04:00
Matthias Clasen
b4c79bad34 Assorted documentation fixes 2020-04-20 00:38:58 -04:00
Emmanuele Bassi
dd23a37ca1 Reconcile documentation with declaration and definition
The arguments name in the documentation must match declaration and
definition, or gtk-doc and g-ir-scanner will get very cross at us.
2020-04-17 22:34:10 +01:00
Timm Bäder
aad67743b9 label: Ignore setting attrs from NULL to NULL 2020-04-17 15:21:00 +02:00
Timm Bäder
5d61abd748 label: Redraw when text attrs are affected by css change
GtkWidget doesn't do it automatically and probably shouldn't
2020-04-17 15:21:00 +02:00
Timm Bäder
9f6ec5b7d4 label: Don't create an unnecessary attribute list 2020-04-17 15:21:00 +02:00
Timm Bäder
78e6475f9f label: Only parse mnemonic attributes if we need to 2020-04-17 15:21:00 +02:00
Timm Bäder
6289f7eecd label: Ignore AFFECTS_ATTRS css changes if we can
It's only interesting if we either already have attributes, or the new
style adds some.
2020-04-17 15:21:00 +02:00
Timm Bäder
9ad0dbb145 label: Inline function into only caller 2020-04-17 15:21:00 +02:00
Timm Bäder
db9fbb3918 label: Remove some unused quarks 2020-04-17 15:21:00 +02:00
Timm Bäder
afaa352142 label: Remove priv pointer 2020-04-17 15:21:00 +02:00
Timm Bäder
3b7cb31157 label: Stop connecting to notify::gtk-enable-accels
Leftover from when GtkAccelLabel was a GtkLabel subclass. GtkAccelLabel
connects to this itself these days though.
2020-04-17 15:21:00 +02:00
Timm Bäder
f0b33cdc53 label: Set underline text and markup in one step
Try to unify the way we parse the mnemonic character
2020-04-17 15:21:00 +02:00
Timm Bäder
203b0c9c9d label: Fold set_pattern_internal into only caller 2020-04-17 15:21:00 +02:00
Timm Bäder
36248c609d label: Remove GtkLabel:track-visited-links
Always track visited state of links. This way all visited links in all
labels look the same. Whether the theme wants to style :visited is the
theme's business.
2020-04-17 15:21:00 +02:00
Timm Bäder
f6bedd0d5e label: Remove a11y-only properties
Update them manually instead.
2020-04-17 15:21:00 +02:00
Timm Bäder
8f96b38539 label: Fold function into only caller
This makes it more obvious that gtk_label_setup_mnemonic() depends on
the root of the widget and it therefore makes sense to call it in
::root/::unroot.
2020-04-17 15:21:00 +02:00
Timm Bäder
813be8a921 label: Don't normalize booleans in internal setters
We almost always pass a literal TRUE/FALSE to them.
2020-04-17 15:21:00 +02:00
Timm Bäder
584a71ae96 cssstyle: Only create PangoAttrList if there are attribtues
Don't allocate a new GString if we never need it and therefore don't
create the PangoAttrList if we have no attributes anyway. Update callers
to handle the possible NULL return value.
2020-04-17 15:21:00 +02:00
Timm Bäder
2e14ea84f3 label: Pull all pango attributes from the theme
Dont' force an underline attribute here. Just ask the theme for the
text-decoration.
2020-04-17 15:21:00 +02:00
Timm Bäder
4737495e3c label: Fix an old TODO comment 2020-04-17 15:21:00 +02:00
Timm Bäder
4851081a77 label: Remove public pattern API 2020-04-17 15:21:00 +02:00
Timm Bäder
13fde6f4cd label: Shorten set_markup_internal a bit 2020-04-17 15:21:00 +02:00
Timm Bäder
1db53e6676 label: Avoid duplicating a string
We only use str_for_accel if with_uline is TRUE.
2020-04-17 15:21:00 +02:00
Timm Bäder
74b5eaa700 label: Pass <markup> length directly when parsing markup 2020-04-17 15:21:00 +02:00
Timm Bäder
b16157bc0d label: Remove a double if (needs_root) check
The code is clearer and shorter this way.
2020-04-17 15:21:00 +02:00
Timm Bäder
7a98e79d90 label: Use widget API to add style class 2020-04-17 15:21:00 +02:00
Timm Bäder
c588d8f858 label: Clear select info before creating a new one
E.g. set_markup_internal will create a new select_info, but then we were
destroying it again, just to recreate it later.
2020-04-17 15:21:00 +02:00
Timm Bäder
23cffdfe42 label: Save a few LOC 2020-04-17 15:21:00 +02:00
Timm Bäder
99998d25f8 label: Save links in an array
Stop using GList for this.
2020-04-17 15:21:00 +02:00
Matthias Clasen
432b741ab7 gtk: Port all users to the new gtk_show_uri()
We were only handling the error in one place anyway.
2020-04-11 22:10:08 -04:00
Matthias Clasen
3e7e862415 gtk: Just use current time for showing urls
We don't really have an event anywhere close in most
cases, and we already pass GDK_CURRENT_TIME in half
the cases anyway.

If we want to be serious about this, we need to pass
the event itself, since future focus-stealing protocols
may not rely on just a timestamp.
2020-04-11 17:29:27 -04:00
Matthias Clasen
6b9ac1043b Document actions 2020-04-11 10:07:31 -04:00
Matthias Clasen
e3b9dfef1c label: Improve link styling
Add a .link style class on labels that contain links,
so we can avoid the focus outline around the label
when individual links are focused, and use the link
node when rendering the focus on links.
2020-04-09 21:19:22 -04:00
Matthias Clasen
3371e3aa49 Move label attribute parser code
We want to reuse the parser for <attributes> in several
widgets, so move it to a shared place.
2020-04-06 22:59:45 -04:00
Matthias Clasen
b02db72e17 Rename GDK_MOD1_MASK to GDK_ALT_MASK
We've hardcoded Mod1 = Alt for a long time, there is
no need to keep the confusing naming around anymore.
2020-04-06 01:40:49 -04:00
Matthias Clasen
234a21905c gtk: Stop using keymap apis
Stop using most keymap apis in GTK. Only a few calls
related to virtual modifiers are left.
2020-04-06 01:40:49 -04:00
Timm Bäder
ecb8dda309 shortcutscontroller: Make add_shortcut transfer-full
Like all the other shortcut api
2020-03-27 08:36:32 +01:00
Matthias Clasen
fc0b0b14a8 label: Respect GtkPopover::mnemonics-visible
When inside a popover, look to the popover for
whether to show mnemonics or not.
2020-03-25 23:14:45 -04:00
Matthias Clasen
b2ac42e576 label: Disconnect visible mnemonics in popovers
The controller handling mnemonics is limited to same-native,
so showing mnemonics in other natives.
2020-03-25 23:14:45 -04:00
Emmanuele Bassi
6e8c78714d Turn GtkShortcutAction into a GObject
Just like we did for GtkShortcutTrigger.

This allows language bindings to properly deal with all the actions.
2020-03-25 23:14:45 -04:00
Matthias Clasen
778d884f70 Use an action for the context menu keybinding
The ::popup-menu signal is going away.
2020-03-25 23:14:44 -04:00
Benjamin Otte
92e20deca1 shortcut: Change the API for creating shortcuts
When creating shortcuts, there almost always are a trigger and an action
available for use. So make gtk_shortcut_new() take those as arguments.

Also add gtk_shortcut_new_with_arguments() so people can easily pass
those in, too.
2020-03-25 23:14:27 -04:00
Benjamin Otte
cd0332aad5 shortcut: Add GtkShortcutAction
Similar to GtkShortcutTrigger, GtkShortCutAction provides all the
different ways to activate a shortcut.

So far, these different ways are supported:

 - do nothing
 - Call a user-provided callback
 - Call gtk_widget_activate()
 - Call gtk_widget_mnemonic_activate()
 - Emit an action signal
 - Activate an action from the widget's action muxer
2020-03-25 23:14:27 -04:00
Benjamin Otte
9428807c57 label: Implement mnemonics using shortcuts 2020-03-25 23:14:27 -04:00
Benjamin Otte
cb09211ace label: Port bindings to use shortcuts 2020-03-25 22:36:03 -04:00
Matthias Clasen
31db615885 Revert "Merge branch 'disable-window-test' into 'master'"
This reverts commit 3ac4c76b18, reversing
changes made to 6ec96d2e98.
2020-03-19 18:03:16 -04:00
Matthias Clasen
908d996b4f Use an action for the context menu keybinding
The ::popup-menu signal is going away.
2020-03-18 23:00:51 -04:00
Benjamin Otte
4a4bfa0766 shortcut: Change the API for creating shortcuts
When creating shortcuts, there almost always are a trigger and an action
available for use. So make gtk_shortcut_new() take those as arguments.

Also add gtk_shortcut_new_with_arguments() so people can easily pass
those in, too.
2020-03-18 23:00:51 -04:00