Commit graph

17712 commits

Author SHA1 Message Date
Robert Ancell
72a3516389 display: Replace ifdefs with #pragma once 2018-05-29 21:53:28 +00:00
Robert Ancell
40520d7b7f display: Replace GObject boilerplace with G_DECLARE_TYPE 2018-05-29 21:53:28 +00:00
Robert Ancell
17945caef6 search: Replace ifdefs with #pragma once 2018-05-29 21:42:33 +00:00
Robert Ancell
880ac4a89d search: Replace GObject boilerplace with G_DECLARE_TYPE 2018-05-29 21:42:32 +00:00
Georges Basile Stavracas Neto
62cfe91689 panel-list: Improve search behavior
There are a couple of small problems with the search
behavior here. First, if we select a panel from search
and leave it, it will continue to stay there forever.
Second, if panels change their visibility status during
runtime, the panel list wouldn't respond accordingly.
2018-05-29 18:03:05 -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
90e7f05057 wi-fi: Remove unused header 2018-05-29 16:09:51 -03:00
Georges Basile Stavracas Neto
4151af5ea2 wifi: Hide when no Wi-Fi adapter is available
It's WIP.
2018-05-29 16:09:51 -03:00
Georges Basile Stavracas Neto
10cf920fef panel-loader: Add support for static init functions
Static init functions are functions that initialize resources
or monitor daemons without needing any contextual information,
such as a CcPanel instance or access to a CcShell implementation.

These functions are meant to be used for monitoring a panel's
visibility, when it makes sense. Usually, panels that represent
hardware that potentially is not available or is not supported
should hide itself.

Following this commit, the Wi-Fi panel panel will be adapted as
the first user of this new API. Other panels that require this
functionality will be adapted later.
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
b261bcaf99 panel: Update code style
This is just an almost-trivial commit that ports
CcPanel to use the latest code practices around.
2018-05-29 16:07:04 -03:00
Robert Ancell
7e4c1e3eae nofications: Use g_auto for variables 2018-05-29 18:29:45 +00:00
Robert Ancell
fceac14a2c notifications: Replace ifdefs with #pragma once 2018-05-29 18:29:45 +00:00
Robert Ancell
67a94dfee9 notifications: Replace GObject boilerplace with G_DECLARE_TYPE 2018-05-29 18:29:45 +00:00
Georges Basile Stavracas Neto
1b68bf1cb4 keyboard: Update code style
No functional changes were introduced. This is purely
aesthetical.
2018-05-29 13:50:17 -03:00
Georges Basile Stavracas Neto
9cc248a1af docs: Improve code style guideline 2018-05-29 13:50:17 -03:00
Robert Ancell
6a72e73d0c datetime: Use GtkTemplate 2018-05-29 16:34:28 +00:00
Robert Ancell
5174ae136d keyboard: Replace ifdefs with #pragma once 2018-05-29 15:44:19 +00:00
Robert Ancell
57975633e6 keyboard: Replace GObject boilerplace with G_DECLARE_TYPE 2018-05-29 15:44:19 +00:00
Georges Basile Stavracas Neto
ed36688c58 night-light: Rework implementation
This commit improves the Night Light code in various
ways:

 * Turn it into a template class, subclass of GtkDialog,
   and adapts all the code to reflect that.

 * Update the code style in various places, to make it
   more conformant with the documented code style.

 * Reorganize the code a bit, moving functions around,
   to make it more conformant with the documented order.
2018-05-29 12:30:16 -03:00
Georges Basile Stavracas Neto
f0bba59699 night-light: Use "#pragma once" in header
Let's use modern code practices around.
2018-05-29 12:29:42 -03:00
Benjamin Berg
e1e82ccda4 tests: Add VPN related tests
This adds tests for the VPN section. Note that the tests to check
sorting are disabled currently as sorting is not implemented.
2018-05-29 15:22:17 +02:00
Benjamin Berg
870b64b848 tests: Also wait for ConnectionAdded signal from NetworkManager
Also wait for the connection-added signal instead of only waiting for the
property notification for the connections. While not neccessary, this is
more correct.
2018-05-29 15:21:59 +02:00
Benjamin Berg
12555d62eb tests: Add helper to find a parent widget to network test
In preparation for testing VPN sorting. Looks for a parent of a specific
type.
2018-05-29 15:20:30 +02:00
Benjamin Berg
d45512d680 tests: Check that Bluetooth section is not shown
This simply ensure the section does not randomly show up after making
unrelated changes.
2018-05-29 15:20:15 +02:00
Benjamin Berg
ab59a8f658 tests: Use g_assert_nonnull rather than testing for != NULL
Just a small code cleanup in the network panel test code.
2018-05-29 15:20:04 +02:00
Benjamin Berg
4f3aec794e tests: Add delete_cb for network panel testing
Having a delete_cb to handle connection removal is useful for other
tests. Add the function in preparation for VPN testing.
2018-05-29 15:19:50 +02:00
Benjamin Berg
edc85abf91 tests: Return NMRemoteConnection from add_cb
The add_cb can be useful in other tests. Return the remote connection in
the info struct to allow its use in other situations.
2018-05-29 15:19:30 +02:00
Benjamin Berg
bfdd2e0a8f tests: Use the same NMClient as the panel
Doing so means we handle the same events as the panel. This probably
makes no difference, but this way it is guaranteed we are not getting
weird inconsistencies during testing.

Also fixes a NMClient memory leak in the process.
2018-05-29 15:19:22 +02:00
Benjamin Berg
b14e5145f0 tests: Improve helpers to wait for NM events
This adds support for waiting on an NMConnection object and also allows
waiting for both signals and properties.
2018-05-29 15:19:15 +02:00
Benjamin Berg
77edec52ed tests: Allow creating VPNs in the NM test service
This is in preparation for adding VPN related tests.
2018-05-29 15:19:00 +02:00
Benjamin Berg
7c43f95ef9 tests: Add trivial test to check empty network panel
If there are no connections or devices then we should not be showing
e.g. the Bluetooth list. Add a simple check that this is handled
correctly.
2018-05-29 15:17:50 +02:00
Benjamin Berg
f3322b495c tests: Do not show_all the network panel
This has the side effect of showing UI elements that should not be
visible at startup. Just add the correct gtk_widget_show calls to show
all relevant widgets.
2018-05-29 15:17:24 +02:00
Benjamin Berg
3950e66bd2 tests: Unset wayland display environment variable correctly
Otherwise the test might run on a develpers wayland session rather than
using the created X11 server.
2018-05-29 15:17:09 +02:00
Benjamin Berg
77a1225917 network: Fix disconnecting the VPN connection_removed_cb handler
The disconnect was for the wrong object (connection rather than client).
Fix this by simply moving to use g_signal_connect_object which obsoletes
the explicit disconnect calls.
2018-05-29 15:16:50 +02:00
Benjamin Berg
52034ba0be network: Update VPN title when the connection is changed
When the connection is modified then the title might be changed. Call
the UI update function to ensure that widgets are updated.
2018-05-29 15:16:43 +02:00
Benjamin Berg
a51dbcd8ca network: Fix Bluetooth panel showing up after connection removal
The test to check whether the Bluetooth (simple section) contains
elements was testing for NetObjectSimple. However, ethernet connections
are a subclass and check would count these. This causes issue when the
code is run after net object removal.

The fix is to check for the exact object type rather than also allowing
subclasses.
2018-05-29 15:16:43 +02:00
Robert Ancell
4aee26cc77 display: Fix double free of GError 2018-05-29 15:01:03 +12: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
Jeremy Bicha
f109289538 Revert "shell: make the .desktop file pass "--overview""
This reverts commit 94aeba51e3.

We actually do want to see the last panel opened
2018-05-29 00:46:01 +00:00
Robert Ancell
a7e84dcf2e mouse: Use GtkTemplate 2018-05-29 00:36:30 +00:00
Georges Basile Stavracas Neto
02f0353fc4 display: Various style fixes
It makes @feaneron happier, and fixes a couple of
memory leaks.
2018-05-28 21:24:41 -03:00
Benjamin Berg
9a4449dfa9 display: Implement major/minor axis snapping and infinit for edges
This improves the snapping behaviour in a number of ways. It allows
increasing the snapping distance while still helping the user to align
monitors by snapping a different distance for the minor axis. The patch
also allows setting this distance to infinity so that we get the correct
behaviour in the case of two monitors for the corners.
2018-05-28 20:57:20 -03:00
Benjamin Berg
d54c356aa5 display: Enable infinit snapping when arranging two monitors
Two monitors are a special case where it is easy to ensure that the
monitors are always adjacent to each other by special casing the
snapping code. Do so by increasing the snapping distance to infinity and
adding extra snapping points so that corner cases are covered.
2018-05-28 20:57:20 -03:00
Benjamin Berg
08a7f7cb53 display: Move output utility functions into CcDisplayMonitor
This adds the following API:
 * cc_display_config_get_ui_sorted_monitors
   Returns the monitors in UI order
 * cc_display_config_count_useful_monitors
   Counts the useful monitors (active and usable)
 * cc_display_monitor_is_useful
   Checks if a monitor is active and usable
 * cc_display_monitor_is_useable
   Check if a monitor is marked as useable
 * cc_display_monitor_set_usable
   Used to mark builtin monitors as unusable if the lid is closed
 * cc_display_monitor_get_ui_*
   Get the UI number and strings for display

https://bugzilla.gnome.org/show_bug.cgi?id=786971
2018-05-28 20:57:20 -03:00
Benjamin Berg
6fa9368f38 display: Remove incorrect comment
The comment was not updated when the workaround in the code was removed.

https://bugzilla.gnome.org/show_bug.cgi?id=786971
2018-05-28 20:57:20 -03:00
Benjamin Berg
e17e9daa19 display: Remove unused old display arrangement code
Remove the code that has become unused with the new arrangement widget.

There are more possible cleanups as there is some code duplication
between cc-display-panel.c and cc-display-arrangment.c at this point.

https://bugzilla.gnome.org/show_bug.cgi?id=786971
2018-05-28 20:57:20 -03:00
Benjamin Berg
199a7117f2 display: Add new arrangement widget and hook it up
This commits adds a new arrangement widget, refactoring the existing
code and addressing a number of issues:
 * Forced snapping made laying out more than 2 monitors hard
 * Random gaps would be shown between monitors
 * The scaling was fixed and usually tiny

https://bugzilla.gnome.org/show_bug.cgi?id=786971
2018-05-28 20:57:20 -03:00