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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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).
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.
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.
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.
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.
When selecting the panel on startup based on the "last-panel" settings,
we need to make sure that the panel exists.
Note that this is a special case which does not use the internal
set_active_panel_from_id API. Using it is currently not possible because
the API does not report back the error and we would end up not selecting
any panel.
The helper function to get the icon name from a GIcon directly
returns the symbolic icon now. This makes it in turn possible
to also directly check if the theme has the icon with the symbolic
name instead of checking of for the full colored one and then
deriving the symbolic name from that. The latter (old) practice
will fail if there is a symbolic icon in the theme that has no
full color icon (like e.g. thunderbolt).
These were only used by CcApplication, and at this level
of the program we don't need to use any wrapper functions,
since we're certain that the CcWindow is a GtkWindow subclass.
There were leftover UI declarations in the source code, breaking
the nice split that it having the UI declared in the GtkBuilder
file while the logic is programmed.
This commit moves the remaining widgets declared in the source
code, the connected signals using and the binded properties to
the GtkBuilder file. This led to a nice cleanup in the source
code.
In an attempt to make the CcWindow code more organized and
structured, this commit reorganizes the source code to match
a recent pattern:
* Structure declarations, G_DEFINE_TYPE
* Function prototypes
* Auxiliary methods
* Callbacks
* Vfunc overrides
* class_init() + init()
* Public API
In practice, this is never uninitialized, but the
compiler is complaining anyway, so let's play the
conservative and make sure it's always initialized
to NULL.