[8/15] Compiling C object 'panels/background/panels@background@@background-chooser@sta/cc-background-xml.c.o'.
In file included from /usr/include/glib-2.0/gobject/gbinding.h:29:0,
from /usr/include/glib-2.0/glib-object.h:23,
from /usr/include/glib-2.0/gio/gioenums.h:28,
from /usr/include/glib-2.0/gio/giotypes.h:28,
from /usr/include/glib-2.0/gio/gio.h:26,
from ../panels/background/cc-background-xml.c:22:
../panels/background/cc-background-xml.c: In function ‘cc_background_xml_load_xml_internal’:
/usr/include/glib-2.0/gobject/gobject.h:512:32: warning: passing argument 2 of ‘emit_added_in_idle’ from incompatible pointer type [-Wincompatible-pointer-types]
#define g_object_ref(Obj) ((__typeof__(Obj)) (g_object_ref) (Obj))
^
../panels/background/cc-background-xml.c:310:34: note: in expansion of macro ‘g_object_ref’
emit_added_in_idle (xml, g_object_ref (item));
^~~~~~~~~~~~
../panels/background/cc-background-xml.c:138:1: note: expected ‘GObject * {aka struct _GObject *}’ but argument is of type ‘CcBackgroundItem * {aka struct _CcBackgroundItem *}’
emit_added_in_idle (CcBackgroundXml *xml,
^~~~~~~~~~~~~~~~~~
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 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.
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.
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.
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.
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 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.
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.