Commit graph

17728 commits

Author SHA1 Message Date
Robert Ancell
d2959e4fe7 power: Simplify GPtrArray memory management 2018-05-30 23:17:08 +00:00
Robert Ancell
ed6ac15b5c power: Simplify cancellable destruction 2018-05-30 23:17:07 +00:00
Robert Ancell
27a64cd04b power: Replace ifdefs with #pragma once 2018-05-30 23:17:07 +00:00
Robert Ancell
f51932978f power: Replace GObject boilerplace with G_DECLARE_TYPE 2018-05-30 23:17:07 +00:00
Robert Ancell
3dc77a68e6 mouse: Connect signal handlers swapped 2018-05-31 09:16:00 +12:00
Robert Ancell
41d98fdf3f mouse: Move callbacks into .ui file 2018-05-31 09:13:47 +12:00
Georges Basile Stavracas Neto
4627e847af notifications: Remove unused variable 2018-05-30 17:45:28 -03:00
Georges Basile Stavracas Neto
d357f1de9e region: Remove unused variable 2018-05-30 17:42:07 -03:00
Robert Ancell
5ea7632b83 color: Use GtkTemplate 2018-05-30 16:27:46 +12:00
Robert Ancell
490bee5a23 color: Use g_auto for variables 2018-05-30 15:46:01 +12:00
Robert Ancell
04e36953ff color: Replace ifdefs with #pragma once 2018-05-30 15:09:55 +12:00
Robert Ancell
770a3b1df6 color: Replace GObject boilerplace with G_DECLARE_TYPE 2018-05-30 15:08:44 +12: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
Robert Ancell
961b41a291 display: Use g_auto for variables 2018-05-29 22:35:32 +00:00
Georges Basile Stavracas Neto
f4b630030c panel-list: Properly select panels when changing views
When moving from and to different views, the first row
might be activated due to focus going to the listbox. This
wasn't a problem before because we couldn't hit that code
path, but now we can.

Fix that by always selecting the first visible row.
2018-05-29 19:20:44 -03:00
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