Commit graph

129 commits

Author SHA1 Message Date
Christopher Davis
4e2706fc6f cc-window: Re-enable type-to-search
This was lost in the GTK4 port. This commit uses
GtkSearchBar's API to capture events.

See https://gnome.pages.gitlab.gnome.org/gtk/gtk4/method.SearchBar.set_key_capture_widget.html
2022-01-05 22:31:17 +00:00
Georges Basile Stavracas Neto
3f322e8553 shell: Allow panels set custom titlebars
This will be used by the Display panel to add a different
titlebar when confirming a new display configuration.
2021-12-14 22:34:21 -03:00
Georges Basile Stavracas Neto
30dcd1f973 window: Port to GTK4
- Inherit AdwApplicationWindow
 - GtkHeaderBar → AdwHeaderBar
 - Simplify the widget tree structure [1]
 - Drop custom key handler, use bindings instead

[1] It used to have a big messy chain of leaflets, headers,
and whatnot. Now it's simplified as:

 AdwLeaflet
 + ---------------- + --------------------------------- +
 |   AdwHeaderBar   |           AdwHeaderBar            |
 + ---------------- + --------------------------------- +
 |   GtkSearchBar   |                                   |
 + ---------------- +                                   |
 |                  |                                   |
 |                  |                                   |
 |                  |                                   |
 |                  |             GtkStack              |
 |   CcPanelList    |                                   |
 |                  |                                   |
 |                  |                                   |
 |                  |                                   |
 |                  |                                   |
 + ---------------- + --------------------------------- +
2021-12-14 22:34:21 -03:00
Guido Günther
a4ab41194b shell: Mirror the main leaflet's 'folded' property
This makes it simpler for panels to check whether g-c-c
is in folded state.
2021-09-25 19:05:28 +00:00
1pav
f89a48a980 window: Save application window state
Currently the window state (width, height, maximized) is not preserved
across application restarts.

These changes implement window state saving/restoring by leveraging the
GSettings API.

Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1293
2021-09-24 20:42:06 -03:00
Carlos Garnacho
7196e8aaea shell: Avoid handling map events from other windows
The CcWindow tries to unset the focus when first mapping the window.
However this pretty wide check intercepts mapping events from other
windows than the toplevel (e.g. subsurfaces, for popovers). This
causes the focus to move away from the popover, overriding its
modality.

Check that the event received is addressed to the CcWindow's
GDK window before unsetting the focus, so we don't mess with popover
focus.

Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1327
2021-04-21 20:54:06 +02:00
Adrien Plazas
fd60c313df Stop using HANDY_USE_UNSTABLE_API
It isn't needed anymore since libhandy 0.90.0.
2020-08-18 02:51:04 +00:00
Adrien Plazas
0c9b828d6f window: Use HdyLeaflet:folded
Replace the dropped fold enum property by the folded boolean one, and
directly bind booleans in UI files where possible.
2020-07-20 08:05:45 +02:00
Adrien Plazas
080e145e23 window: Use HdyHeaderGroup:decorate-all
Replace the dropped focus property by the decorate-all boolean one.
2020-07-20 08:04:28 +02:00
Adrien Plazas
611ffdbe7d window: Fix a typo in a comment 2020-07-03 10:07:58 +02:00
Georges Basile Stavracas Neto
a99ad542ae panel-list: Remove the Devices subsection
Same case of the Details subsection, it's now part of the
main list.
2020-01-06 15:15:30 +00:00
Georges Basile Stavracas Neto
f0d246a8b0 panel-list: Remove Details subsection
As per the latest mockups, the Details section is a toplevel
section, and not an actual subsection.

Remove all the code that implemented Details as a subsection,
and simply treat these panels as toplevel ones.
2020-01-06 15:15:30 +00:00
Robert Ancell
5dbbc20918 shell: Show the submenu icon hint for the applications panel
The panel swarms details/devices/privacy show this icon. Since the applications
panel is not made from sub-panels, this doesn't show. For consistency this shows
the icon so the transition isn't as jarring for the user.

Add a flat into the panel .desktop file to enable this - other panels might
require this in the future
2019-11-28 11:20:41 +13:00
Robert Ancell
19ccad96ae Whitespace fixes for g_autoptr coding style 2019-11-08 09:42:10 +13:00
Matthias Clasen
3860a2e2af shell: Add a new privacy section
This will be filled out in the next commits.

Probably doesn't build because it includes all the type funcs.
2019-11-07 14:19:23 +13:00
Felipe Borges
ad83235bf9 shell: Use a meson option to determine that we're in a sandbox 2019-10-14 20:25:39 +00:00
Robert Ancell
d99613a320 window: Use self variable name consistently 2019-09-23 14:00:42 +00:00
Robert Ancell
bb9fe942d1 window: Connect signals in swapped form 2019-09-23 14:00:42 +00:00
Robert Ancell
a80fc89f48 window: Use GTK+ widget types 2019-09-23 14:00:42 +00:00
Robert Ancell
d843802f98 window: Remove unused variables 2019-09-23 14:00:42 +00:00
Robert Ancell
c2567b9c3e window: Replace child names with widget references
Using child names can cause code to be broken if a name is changed - this wont
be picked up as an error in the compiler.
2019-09-23 14:00:42 +00:00
Mohammed Sadiq
62c7176304 window: Set sidebar as the default visible child
This doesn't make any difference when the UI isn't folded.
Otherwise (Eg., on small screens) the sidebar will be shown
first instead of some panel.
2019-09-21 03:43:34 +00:00
Mohammed Sadiq
661df1b683 window: Disable selection when panel list is folded
When the panel list is folded, either the panel items list or the
panel itself is shown, not both.  And when the list is shown it
doesn’t mean anything for an item to be marked as selected.
2019-08-27 13:26:21 +00:00
Georges Basile Stavracas Neto
75f150d5a2 shell: Add position to cc_shell_embed_widget_in_header()
So we can control where the widget should be added to. The
main window only supports left and right positions.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/528
2019-05-21 12:59:36 -03:00
Adrien Plazas
638dc94a8d window: Use a HdyLeaflet
This allows the window to be folded to show either the sidebar or the
panel when not enough space is available.

This reverts commit 2854669f5c8280a32d0b5fa6c5399cc391ef06f3.
2019-03-29 18:33:36 +00:00
Adrien Plazas
5cc5a85bf9 window: Stop using HdyLeaflet
It is safer to not make the shell adaptive until all panels are, so this
drops usage of HdyLeaflet to make the shell adaptive.

This mostly reverts commit 0ca61a5bde.

Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/issues/375.
2019-02-21 11:35:35 +00:00
Iain Lane
82191ca285
window: Update the headerbar when the panel list changes
Currently you can get stuck in the applications panel if you do this:

  1) Click "Applications" in the sidebar. The top left icon is a back
     icon.
  2) Click the back icon to return to the panel list. The top left icon
     changes to a search icon.
  3) Click "Applications" again. The top left icon remains a search icon
     and you're stuck in the panel.

The basic problem is that the headebar icon is update when the panel
changes, but not when the sidebar view changes. To fix this, we connect
to the signal that is emitted when the sidebar view changes, and update
the headerbar.
2019-02-18 13:19:51 +00:00
Christopher Davis
89245bbeda cc-window: Remove custom development CSS
GTK now includes it's own development style class, .devel.
We can use that instead of creating our own.
2019-01-21 20:44:44 -05:00
Adrien Plazas
0ca61a5bde window: Use a HdyLeaflet
This allows the window to be folded to show either the sidebar or the
panel when not enough space is available.
2019-01-21 21:53:21 +00:00
Adrien Plazas
9d9c547649 shell: Use a HdyHeaderGroup
Handle the header bars' decoration layouts with a HdyHeaderGroup to
simplify the code.
2019-01-21 21:53:21 +00:00
Georges Basile Stavracas Neto
8d2265c6b9
window: Properly update headebar buttons and title
With the new sidebar view in place, a new problem arose: we
need the current panel to be configured to update the title,
but cc_panel_list_add_sidebar_widget() changes the view while
activating the panel. That makes Settings crash.

Fix that by explicitly updating the headerbar widget, instead
of using notify::view of the panel list.
2018-11-16 19:25:13 -02:00
Georges Basile Stavracas Neto
8c144b6261
window: Instrument some functions 2018-11-16 19:24:49 -02:00
Georges Basile Stavracas Neto
2c18053ddd
window: Set the panel name as title for the widget
Instead of the wrong name of the previous panel list view.
2018-11-16 19:24:49 -02:00
Georges Basile Stavracas Neto
6295831fff
window: Add panel's sidebar widget to sidebar
When opening a panel, add its sidebar widget to the sidebar.
2018-11-16 19:24:49 -02:00
Georges Basile Stavracas Neto
b02bc2a935
panel-list: Replace set_view() by go_previous()
Instead of directly selecting the view that the panel
list will have, let it decide which is the previous
view instead.

This does not change anything functionality wise, but
in the future where we have sidebar widget (and thus
the main window does not control which view the sidebar
is display) this will be important.
2018-11-16 15:19:09 -02:00
Georges Basile Stavracas Neto
62743ab47e
window: Factor out function to find panel iter
It will be used by the next commits to look for the panel
name. That is because the panel name is what will be used
as the first headerbar title of panels with a sidebar widget.
2018-11-16 15:18:59 -02:00
Robert Ancell
c0f41daff0 shell: Remove the lock button from the shell
Only the date time panel used it, all other panels add their own shell using
cc_shell_embed_widget_in_header which was added after the date time panel was
written. Update the date time panel to use this method.
2018-10-18 00:25:40 +00:00
Corentin Noël
a6acc98371 common: fix some wrong autofree uses
g_autofree an array only g_free the first element, GStrv is the string array type.
2018-10-11 14:50:38 +13:00
Florian Müllner
d5de9d86c9 model: Convert panel icons to symbolic variants if possible
Panel icons should be consistent between the app and corresponding
search results in GNOME Shell, but currently the former uses the
symbolic variant while the latter uses the colored version.

Address this by converting icons to their symbolic variants when
building the model rather than later when consuming them.

https://gitlab.gnome.org/GNOME/gnome-control-center/merge_requests/151
2018-07-29 21:45:38 +00:00
Georges Basile Stavracas Neto
a8673b06c7 shell: Rename .ui files to match .c files
To keep it clean and well organized, rename the .ui files
(window.ui and panel-list.ui) to have the 'cc-' prefix and
match their .c counterparts.
2018-07-18 21:34:09 +00:00
Georges Basile Stavracas Neto
72924c6aba project: Remove unused files
The CcShellCategoryView and CcShellItemView were
residuals from the old shell there managed to stay
around unoticed.

Remove them from the project.
2018-07-15 10:59:27 -03:00
Georges Basile Stavracas Neto
c89a919536 window: Remove unused panel box
Whenever a panel is activated, there is a GtkBox that
is added between the window and the panel itself.

Investigating the history of this field, it originally
appeared at ec7f8c9b when the window started using
widgets rather than page numbers. Apparently, it was a
GtkBox to help dealing with the GtkNotebook (which was
later changed to the current GtkStack).

The field was renamed from 'current_panel' to 'current_panel_box'
at ab435aa9. But since the transition to GtkStack, there
is no real need to use the GtkBox anymore.

This patch removes this GtkBox, and as a consequence, the
code is slightly simplified.
2018-06-18 11:33:02 -03:00
Georges Basile Stavracas Neto
6d3ed43e74 window: Remove custom widgets at the correct time
The correct time to remove custom widgets is precisely
after we checked if the panel can be activated, and before
creating the panel. We were not following that, and it was
causing the panels with header widgets to never actually
show their custom widgets.

Fix that by calling remove_all_custom_widgets() at the
correct point in panel creation.
2018-05-29 20:46:03 -03:00
Georges Basile Stavracas Neto
1d8faa2a73 window: Instrument some functions
This will help in debugging.
2018-05-29 20:44:21 -03:00
Georges Basile Stavracas Neto
a461045f37 window: Don't remove header widgets before changing panels
When changing panels, CcWindow can only remove the previous
panel's header widgets after making sure the new panel was
successfully set.

However, this is not the case, and when the current panel
fails to be set, the previous panel's header widget is
removed.

Fix that by waiting to remove the header widgets until the
panel is successfully set.
2018-05-29 16:09:51 -03:00
Georges Basile Stavracas Neto
a78cbe3963 model: Add visibility field
This field can be used to communicate the visibility of the
panel from a static context (i.e. without any instances of
a CcPanel nor any access to CcShell).
2018-05-29 16:09:51 -03:00
Georges Basile Stavracas Neto
489a7ae5dd window: Delegate model creation to CcApplication
In order be able to modify panel information statically,
we need to have access to the CcShellModel from static
functions. CcApplication, thus, is a better place for the
model to live, since we can access it outside any scope
using g_application_get_default().

It also makes sense from the modeling point of view, since
the model is not tied to the shell anymore.
2018-05-29 16:09:49 -03:00
Georges Basile Stavracas Neto
6b334a8a00 window: Fix going back to previous panels
This never really worked on the new Setting layout
because it was historically implemented as "Back to
Overview", and we don't have an overview anymore.

This is fixed by morphing the implementation to be
"Back to previous panel", which forces us to actually
store the previous panel.
2018-05-28 22:23:35 -03:00
Georges Basile Stavracas Neto
52469cec7c window: Remove remaining overview mentions
There is no overview anymore -- Settings is always
visualizing a panel at any given time.

I just noticed that the Alt+Left shortcut was always
broken too. This will be fixed in a following commit.
2018-05-28 22:07:49 -03:00
Georges Basile Stavracas Neto
50094b45a6 window: Warn about development builds
With this commit, a message dialog pops up whenever a
development build runs. This is meant to actually annoy,
so that we're always reminded that things may not work
as expected.

Since the dialog can be dismissed with a single button
press, it is not the end of the world. But people still
should be aware that Settings is ~not~ meant to run with
Flatpak, and that this is a development tool only.
2018-05-14 18:24:03 -03:00