Switch from GtkBuilder to using GtkTemplate.
Rename widget IDs to be more readable.
Drop widget IDs that are not used.
Move code into the .ui file that can be.
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.
- Move more code into the .ui file
- Don't save the dialog between runs - it's cheap to generate on demand
- Hold references on data passed to dialog
- Connect signals in "swapped" form
- Use standard naming format for signal callbacks
Previously, low resolutions were hidden from the control center
because when such display modes are activated, GNOME is unusable;
many important UI elements do not fit on the screen at all.
https://bugzilla.gnome.org/show_bug.cgi?id=626822
This was removed in c0f686bb0f
without explanation; reinstate it here.
Also prevent the scaling from being selected or activated if the
effective scaled resolution would result in an equivalently low
resolution being used.
We need to re-sync the scale button scale when updating the state
dynamically. Otherwise changing the resolution will always show a scale
of 100% (first item) rather than the actual active one.
The visibility is explicitly controlled in the functions that create the
rows in question. This regression was introduced in commit 3d177b67
(display: Don't use gtk_widget_show_all).
Switch from GtkBuilder to using GtkTemplate.
Rename widget IDs to be more readable.
Drop widget IDs that are not used.
Move code into the .ui file that can be.
Connect signals in swapped form.
The night light dialog is both marked as "destroy_with_parent" and explicitly
destroyed in the panel. Drop one of these.
Causes the warning after opening the dialog then closing the app:
(gnome-control-center:19887): Gtk-CRITICAL **: 11:00:01.370: gtk_widget_destroy: assertion 'GTK_IS_WIDGET (widget)' failed
This bug was introduced in ed36688c58
The previous code had a number of issues:
- It used a shared 'op' enum value for the operation - a second operation would
overwrite this.
- It acted on the row selected at the time the operation was requested - this
could have changed by the time the operation occurred.
Solved by passing all the required data though the async methods.
The Wi-Fi and mobile broadband row's visibility depends on related
device status. But calling gtk_widget_show_all on the whole list box
makes them visible even related device is not avialbe. Fix that by
setting no-show-all of these two widgets as TRUE.
https://gitlab.gnome.org/GNOME/gnome-control-center/issues/189
This was due to the callback occurring before all the widgets had been added to
the dialog.
Also remove the workaround for the handler occuring during/after dispose by
using g_signal_connect_object.
The warnings were:
(gnome-control-center:13048): Gtk-CRITICAL **: 09:42:17.841: gtk_bin_get_child: assertion 'GTK_IS_BIN (bin)' failed
(gnome-control-center:13048): Gtk-CRITICAL **: 09:42:17.841: gtk_icon_view_unselect_all: assertion 'GTK_IS_ICON_VIEW (icon_view)' failed
Objects created using the object storage API are not disposed when the panel
that created them is disposed. In order to prevent segfaults we need to manually
disconnect signal handler connected to these objects or we can do it
automatically using g_signal_connect_object.
Fixes: https://launchpad.net/bugs/1797205
The following warning occurs when the datetime panel is created:
(gnome-control-center:3173): GLib-GIO-CRITICAL **: 09:18:38.531: g_settings_get_value: assertion 'G_IS_SETTINGS (settings)' failed
This is due to the callback being called before the settings object is created
Due to an API bug in GNOME Online Accounts, the asynchronous
goa_provider_get_all method doesn't accept a GCancellable argument.
This makes it difficult to cancel an ongoing call when the CcGoaPanel
gets destroyed.
Prior to commit c26f8ae018, this was hacked around by taking a
reference on the panel for the duration of the call. Instead of
cancelling a pending call on destruction, it would keep the panel alive
until the call was over. However, that was lost during commit
c26f8ae018.
One thing to bear in mind is that GtkWidgets, CcGoaPanel is one, can
be destroyed by a gtk_widget_destroy call, which is subtly different
than a simple sequence of g_object_unref calls. When gtk_widget_destroy
is used, it invokes the GObject::dispose virtual method of the widget.
It is expected this will cause anything holding a reference to this
widget to drop their references, leading to GObject::finalize being
called. However, there is no guarantee that this will happen in the
same iteration of the GMainLoop. Therefore, it is possible that when
the goa_provider_get_all call finishes, the CcGoaPanel might be in a
disposed, but not yet finalized state.
When a GObject is in a disposed-but-not-finalized state, only a very
limited number of operations can be performed on it. Its reference
count can be altered, the memory used by the instance struct can be
accessed, but none of the member GObjects can be assumed to be valid.
eg., it's definitely illegal to add new rows to the member GtkListBox.
Hence a boolean flag is used to mark the destroyed state of the panel.
This second part is a small improvement over the earlier hack.
https://gitlab.gnome.org/GNOME/gnome-control-center/issues/208
There was an issue where the "minor" axis snapping would not be done if
the "major" axis snapping had a zero distance. This could be seen when e.g.
moving a monitor on the right up/down slightly. In that case, no
snapping to align the bottom/top edges were done unless you also moved
the mouse sideways a bit.
Fixes#211