Commit graph

250 commits

Author SHA1 Message Date
Felipe Borges
ef359060ee common: Fix "selectable" state of the ListRow InfoButton
Originally the screen reader wasn't reading the text of the label
within the popover. It read when we set label.selectable = True.
That had the side-effect of making the label have the visual look
of a selectable label (as expected).

This hack unsets the selectable state of the popover when it is
visible, but that still allows the screen reader to read the label.

Fixes #2508
2023-08-22 11:53:44 +02:00
Cyber Phantom
9b6993607f info-overview: Show each graphics device in it's own row
Part 1:

Currently all graphics devices have to share a single row for their names, this method doesn't pretty well for devices with long names or computers that may have multiple GPUs.
The new mockup fixes this by having a separate entry for each graphics device.

This commit turns graphics_row into a GtkBox, graphics_row is going to act like a space where gpu entries will be placed.
graphics_row will be populated in the code using create_graphics_row() to have separate entries for each graphics device

Part 2:

Currently all graphics devices have to share a single row for their names, this method doesn't pretty well for devices with l>
The new	mockup fixes this by having a separate entry for each graphics device.

This commit adds a method to popuplate graphics_row with GPU information entries.
It uses the existing logic from get_renderer_from_switcheroo to iterate over a list of graphics devices and build a CcInfoEntry for each device.
It finally appends the widget to graphics_row

Part 3:

Currently all graphics devices have to share a single row for their names, this method doesn't pretty well for devices with l>
The new mockup fixes this by having a separate entry for each graphics device.

The list of graphics devices is now processed in create_graphics_rows function, so remove that logic from get_renderer_from_switcheroo () and return a GSList instead of a string.
graphics_hardware_string has been renamed to graphics_hardware_list to imply the change.
Since create_graphics_rows expects a list, get_graphics_hardware method has been modified to create a renderer list from the outputs of get_renderer_from_session or get_renderer_from_helper in case that get_renderer_from_switcheroo fails.
2023-07-17 09:25:26 +00:00
Felipe Borges
5bc8ffe8e0 common: Handle when CcPermissionInfobar doesn't have a GPermission
The widget should default to showing the error message when its
missing its respective GPermission object, instead of throwing
a critical error message.

We also hide the "Unlock" button when there's no GPermission set.

See https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1708
2023-07-12 15:57:06 +00:00
Felipe Borges
9ff812f6e8 common: Add default title to Permission Infobar
Whenever there isn't a GPermission set, the infobar should show
"Error: some settings cannot be unlocked".

See https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1708#note_1742075
2023-07-12 15:57:06 +00:00
Marco Melorio
2a33247f52 common: Remove switch feature to CcListRow
AdwSwitchRow should be used now instead.
2023-06-30 09:06:56 +00:00
Robert Ancell
88d0cba1e6 common: Connect signal handlers in swapped form 2023-06-07 09:12:54 +12:00
Felipe Borges
f444852449 common: Fix name of internal InfoButton get/set functions
This was a copy-pasta mistake when creating the CcListRowInfoButton
class from the CcListRow class.

The mistake was harmless but fixing it is good for the sake of
consistency and to avoid confusion in backtraces.
2023-05-31 21:34:03 +00:00
Robert Ancell
426f9a9302 common: Do signal handlers in swapped form 2023-05-30 08:36:22 +00:00
Felipe Borges
bb351a1b51 common: Fix time entry for RTL languages
While GTK will flip most things for RTL languages, that shouldn't be
the case for displaying time.

These changes make sure that the time-entry/editor behave as expected
in RTL languages.

Fixes #2504
2023-05-26 01:03:45 +00:00
Lukáš Tyrychtr
3f47fd0dea common: Make the info button labels selectable
That allows a screen reader to read the information, which was previously
unreachable in any meaningful way.
2023-05-24 12:55:12 +02:00
Lukáš Tyrychtr
41cb03db76 a11y: Present the checked state on the list row itself
That allows the visually impaired user to get the information quicker,
and, as a result of that, we can simplify the focus chain as well.
2023-05-24 09:04:02 +00:00
Pablo Correa Gómez
7f7b65545c all: meson: do not specify resources from gresource files as dependencies
Meson extracts them by itself and add them as dependencies for the target.
It means one less location to keep track of files, and a lot less boilerplate
around the meson files
2023-05-24 08:34:14 +00:00
Felipe Borges
00a71d46da common: Introduce CcListRowInfoButton widget
This simplifies the display of additional text information for our
rows.

See #1571
2023-05-16 13:32:21 +00:00
sunflowerskater
c95dcf2a9a general: Add placeholder text to various search entries
Acc. HIG, "text fields should have placeholder text or a label".

https://developer.gnome.org/hig/patterns/controls/text-fields.html

Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2190
2023-04-21 12:40:42 +00:00
Felipe Borges
7e12d653ba common: Don't set the CcHostnameEntry widget sensitivity twice 2023-04-20 14:08:29 +00:00
Christopher Davis
d25c0e345d general: Use AdwBanner in CcPermissionInfobar
AdwBanner is a new adaptive widget that replaces GtkInfoBar.
AdwBanner adapts better to mobile sizes and has an API
that fits with how we use infobars.

This commit changes CcPermissionInfobar to use an AdwBanner
internally instead of a GtkInfoBar. It also re-implements
part of GtkLockButton, as AdwBanner does not support adding
arbitrary widgets.
2023-04-11 12:23:16 +00:00
Sayan Bhattacharjee
0524a6eee6 info-overview: Show each GPU in it's own line
When having multiple GPUs, each GPUs are now seperated by a newline
instead of the previously used seperator: " / ".
This particular fix works ONLY for systems that use switcheroo-control.

Also, this commit allows the 'secondary_label' of 'CcListRow' to have
'lines' set to '4' and 'wrap' to 'True', along with 'hexpand'
and 'halign' set to 'True' to accommodate long strings on all labels
which previously suffered from a issue of getting truncated if
the strings are too long.

Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2125
2023-04-11 11:20:28 +00:00
Maksym Hazevych
e00f773b2f Remove unnecessary visibility change 2023-03-29 14:26:55 +13:00
Maksym Hazevych
d831e5cb48 Replace all occurrences of 'gtk_widget_show'
Replace all occurrences of 'gtk_widget_show(smth)' with
'gtk_widget_set_visible(smth, TRUE)'.
2023-03-29 14:26:55 +13:00
Marco Trevisan (Treviño)
da0f0ec021 illustrated-row, split-row: Add widget name and css class
It's not possible to theme them right now, while it could be useful so
make them more recognizable in the widget tree.
2023-03-28 13:52:12 +00:00
Marco Trevisan (Treviño)
81c1bf437c split-row / illustrated-row: Keep track of the resources path
We pass to the setter a const char* but we don't control the ownership
of that and it may be returned later from the property getter.

While this is not causing any crash right now, going in the inspector
and try to check the property leads to some scrambled chars which seems
an indication of a memory error.

In general the string passed to these APIs could come from anywhere and
it's not guaranteed that it's always a constant string (and in fact is
not in some cases).
2023-03-23 22:58:56 +00:00
Mohammed Sadiq
f0f1ee168f common: hostname-entry: Update hostname only after apply is clicked
Since the entry already shows an apply button, update hostname only
after the apply button is clicked.  It's not required to update
hostname after every character change.
2023-03-15 13:37:15 +00:00
Felipe Borges
75e92da6d2 common: Use GtkPicture for CcSplitRow and CcIllustrationRow videos
So we can preserve the aspect-ratio.

Fixes #2345
2023-02-17 02:09:50 +00:00
Felipe Borges
6b4e8ca316 common: Pause CcSplitRow/CcIllustrated videos when pointer leaves
Fixes #2346
2023-02-17 00:48:51 +00:00
Felipe Borges
42cfa6dcb5 common: Introduce CcSplitRow 2023-02-14 13:31:23 -03:00
Felipe Borges
c4e569610d common, multitasking: Introduce CcIllustratedRow
The CcIllustratedRow is a generalization of CcMultitaskingRow to
be used later in the Mouse settings.
2023-02-14 13:31:23 -03:00
Felipe Borges
9871a09143 common, info-overview, sharing: Use AdwEntryRow for Hostname entries
See mockups in https://gitlab.gnome.org/Teams/Design/settings-mockups/-/issues/48
2022-12-13 16:16:08 +00:00
Mohammed Sadiq
c917fa73c3 common: Don't Handle list-row switch state manually
This was a hack added for libhandy-0, which is no longer required.
Also, this hack results in the switch not working when gtk animations
are turned off.
2022-11-18 04:08:22 +00:00
Kate Hsuan
fbafcc77a0 firmware-security: improve datetime format parsing
Showing the datetime string using cc_util_get_smart_date_time().
2022-10-25 23:49:16 +00:00
Kate Hsuan
df2bd37837 panels: cc-util: a smart date time
Convert the DateTime to string with time.
The format will be:
smart_date, \%X
2022-10-25 23:49:16 +00:00
Mohammed Sadiq
ff39de678b common: time-editor: Fix initial AM/PM label value
We set AM/PM label on format change in init(),
but we shall not have set the time in the editor
in init() which results in wrong label if the time
is PM.

Fix it by updating clock label after time changes
2022-08-14 21:34:07 +05:30
Mohammed Sadiq
57c919b7d9 common: time-entry: Emit time-changed on time change 2022-08-14 21:33:52 +05:30
Jan Tojnar
7c4428eb59 region: Fix creating rows for locales without country
When creating a language row for Esperanto (eo.UTF-8), gnome-desktop throws a critical:

    gnome_get_country_from_code: assertion 'code != NULL' failed
2022-05-26 19:05:16 +00:00
Pablo Correa Gómez
42cb548115 common: Wrap CcPermissionInfobar labels to fit in narrower screens 2022-05-10 04:37:42 +00:00
Dor Askayo
9401881a38 common: Add a missing dependency on cc-common-resources.h
cc-common-resources.h is used by both libwidgets and liblanguage, and
so must be generated before they build. However, Meson wasn't aware
of this dependency which resulted in a race condition during build.

Conveniently, "generates_sources_dep" already contains other generated
sources used by these two libraries, so adding cc-common-resources.h
to this list is enough to declare the dependency.
2022-02-25 16:10:58 +00:00
Georges Basile Stavracas Neto
c591ab3f77 common: Slightly increase default width of CcLanguageChooser
So it doesn't cut the title label in Portuguese.
2022-02-07 07:03:42 -03:00
Mohammed Sadiq
9dfaca3725 common: time-entry: Fix changing time clicking the buttons
The change-value signal was not handled when emitted.  Add a handler
to handle the signal and update time as needed.
2022-01-27 03:32:58 +00:00
Christopher Davis
e637f47e78 cc-list-row: Subclass AdwActionRow
AdwActionRow handles many of the properties we use
CcListRow for. We can re-use it instead of re-creating it.

CcListRow is now an AdwActionRow with three suffixes.
The `activatable-widget` is set when the switch is visible.

Since our `icon-name` property was only used for the arrow
icon, it has been replaced with a `show-arrow` property.

The `bold` property has been removed - it was only used in
one place, and it's not a pattern used in other apps.

I decided to go this route because replacing all the
instances of CcListRow with AdwActionRow directly would
end up being more code.
2022-01-06 08:56:12 -08:00
Victor Toso
dac8fd64cd common: Fix leak of GUdevDevice
The add_device() check for g_udev_device_get_parent() was leaking (see
below). As this is actually used in create_device(), I'm passing it as
argument to avoid a second call to that function.

 > 34,175 (1,080 direct, 33,095 indirect) bytes in 27 blocks are definitely lost in loss record 19,729 of 19,758
 >    at 0x4A7A337: g_type_create_instance (gtype.c:1907)
 >    by 0x4A61CAC: g_object_new_internal (gobject.c:1945)
 >    by 0x4A62C7C: g_object_new_with_properties (gobject.c:2114)
 >    by 0x4A63780: g_object_new (gobject.c:1785)
 >    by 0x5EA5A6A: _g_udev_device_new (gudevdevice.c:132)
 >    by 0x4B6D24: add_device (gsd-device-manager.c:447)
 >    by 0x4B6FBF: gsd_device_manager_init (gsd-device-manager.c:517)
 >    by 0x4A7A288: g_type_create_instance (gtype.c:1929)
 >    by 0x4A61CAC: g_object_new_internal (gobject.c:1945)
 >    by 0x4A62C7C: g_object_new_with_properties (gobject.c:2114)
 >    by 0x4A63780: g_object_new (gobject.c:1785)
 >    by 0x4B7075: gsd_device_manager_get (gsd-device-manager.c:533)
2021-12-17 09:50:57 +01:00
Georges Basile Stavracas Neto
234d1aadb7 common: Depend on generated sources
Generated sources need to be generated before files that
use them can be built.

Add a separate dependency on them, and make the various
libraries under panels/common/ depend on these sources.
2021-12-15 11:17:57 -03:00
Georges Basile Stavracas Neto
59bdf81028 common: Port to GTK4
This is only the bare minimum to make everything under panels/common
build. Since these widgets are used by the main window, port them
first.

CcTimeEntry was particularly hard to port. That's because GtkEntry
is a final class now. Overall, though, I'm happy with how it turned
out to be - much cleaner, less code, more obvious.
2021-12-14 22:34:21 -03:00
Mohammed Sadiq
f3f4f13fe4 common: Add polkit rules for modem management 2021-08-13 19:25:41 +00:00
Eric
4383f020e7 Switch to g_get_os_info to read os_release
As described in #1346, GLib 2.64 includes a g_get_os_info() function,
providing access to keys from /etc/os-release. This commit replaces calls to
gnome-control-center's custom parser (in panels/common/cc-os-release.c)
with calls to this new function, and deletes the custom parser code.

Closes #1346
2021-06-15 21:54:35 +00:00
Georges Basile Stavracas Neto
9fc0a4c2b1 common/language-chooser: Center More row icon
Otherwise it gets pushed to the start of the row.
2021-03-04 09:33:44 -03:00
Georges Basile Stavracas Neto
c223ba2554 common/language-chooser: Make "More" rows visible by default
The inner box of the More row is visible, but the row itself isn't.
Make the row visible too.

Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1273
2021-03-04 09:33:40 -03:00
Georges Basile Stavracas Neto
af5d13e7b5 common: Rename 'check' to 'check_image'
The C code tries to fetch and use 'check_image', but the UI definition
calls it 'check', which throws a few warnings. Renaming it in the UI file
is easier than in the C file, so I went with the former.
2021-02-23 10:28:22 -03:00
Georges Basile Stavracas Neto
7167019522 common: Add missing <child> tag to CcLanguageChooser
The UI file is not wrapping the <object> tag with <child>, which
fails to parse and blanks the dialog.

Add the missing <child>  tag around the "More" row object.

Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1270
2021-02-23 10:28:15 -03:00
Robert Ancell
e50de0def6 common: Use self variable name for CcLanguageChooser 2021-02-01 04:02:22 +00:00
Robert Ancell
d7c8ecee60 common: Move CcLanguageChooser signal handlers into GtkBuilder 2021-02-01 04:02:22 +00:00
Robert Ancell
c7d2b0945d common: Consolidate CcLanguageChooser functions 2021-02-01 04:02:22 +00:00