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
This commit is contained in:
Benjamin Berg 2017-11-24 13:13:09 +01:00 committed by Georges Basile Stavracas Neto
parent 199a7117f2
commit e17e9daa19
4 changed files with 1 additions and 2479 deletions

View file

@ -21,9 +21,6 @@
#include "cc-display-panel.h"
#include <gtk/gtk.h>
#include "scrollarea.h"
#define GNOME_DESKTOP_USE_UNSTABLE_API
#include <libgnome-desktop/gnome-bg.h>
#include <glib/gi18n.h>
#include <stdlib.h>
#include <gdesktop-enums.h>
@ -44,8 +41,6 @@ CC_PANEL_REGISTER (CcDisplayPanel, cc_display_panel)
#define DISPLAY_PANEL_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_DISPLAY_PANEL, CcDisplayPanelPrivate))
#define TOP_BAR_HEIGHT 5
#define PANEL_PADDING 32
#define SECTION_PADDING 32
#define HEADING_PADDING 12
@ -65,8 +60,7 @@ struct _CcDisplayPanelPrivate
CcDisplayConfig *current_config;
CcDisplayMonitor *current_output;
GnomeBG *background;
GnomeDesktopThumbnailFactory *thumbnail_factory;
CcDisplayArrangement *arrangement;
guint focus_id;
@ -121,10 +115,6 @@ static void
update_apply_button (CcDisplayPanel *panel);
static void
apply_current_configuration (CcDisplayPanel *self);
static void
on_area_paint (FooScrollArea *area,
cairo_t *cr,
gpointer data);
static char *
make_display_size_string (int width_mm,
int height_mm);
@ -336,8 +326,6 @@ cc_display_panel_dispose (GObject *object)
g_clear_object (&priv->manager);
g_clear_object (&priv->current_config);
g_clear_object (&priv->up_client);
g_clear_object (&priv->background);
g_clear_object (&priv->thumbnail_factory);
g_clear_object (&priv->settings_color);
g_clear_object (&priv->night_light_dialog);
g_clear_object (&priv->main_size_group);
@ -393,150 +381,6 @@ set_current_output (CcDisplayPanel *panel,
g_signal_emit (panel, panel_signals[CURRENT_OUTPUT], 0);
}
static void
apply_rotation_to_geometry (CcDisplayMonitor *output, int *w, int *h)
{
CcDisplayRotation rotation;
rotation = cc_display_monitor_get_rotation (output);
if ((rotation == CC_DISPLAY_ROTATION_90) || (rotation == CC_DISPLAY_ROTATION_270))
{
int tmp;
tmp = *h;
*h = *w;
*w = tmp;
}
}
static void
get_geometry (CcDisplayMonitor *output, int *x, int *y, int *w, int *h)
{
if (cc_display_monitor_is_active (output))
{
cc_display_monitor_get_geometry (output, x, y, w, h);
}
else
{
cc_display_monitor_get_geometry (output, x, y, NULL, NULL);
cc_display_mode_get_resolution (cc_display_monitor_get_preferred_mode (output),
w, h);
}
apply_rotation_to_geometry (output, w, h);
}
static void
on_viewport_changed (FooScrollArea *scroll_area,
GdkRectangle *old_viewport,
GdkRectangle *new_viewport)
{
foo_scroll_area_set_size (scroll_area,
new_viewport->width,
new_viewport->height);
foo_scroll_area_invalidate (scroll_area);
}
static void
paint_output (CcDisplayPanel *panel,
cairo_t *cr,
CcDisplayConfig *configuration,
CcDisplayMonitor *output,
gint num,
gint allocated_width,
gint allocated_height)
{
CcDisplayPanelPrivate *priv = panel->priv;
GdkPixbuf *pixbuf;
gint x, y, width, height;
get_geometry (output, NULL, NULL, &width, &height);
x = y = 0;
/* scale to fit allocation */
if (width / (double) height < allocated_width / (double) allocated_height)
{
width = allocated_height * (width / (double) height);
height = allocated_height;
}
else
{
height = allocated_width * (height / (double) width);
width = allocated_width;
}
x = (allocated_width / 2.0) - (width / 2.0);
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_rectangle (cr, x, y, width, height);
cairo_fill (cr);
pixbuf = gnome_bg_create_thumbnail (priv->background,
priv->thumbnail_factory,
gdk_screen_get_default (), width, height);
if (cc_display_monitor_is_primary (output)
|| cc_display_config_is_cloning (configuration))
{
y += TOP_BAR_HEIGHT;
height -= TOP_BAR_HEIGHT;
}
if (pixbuf)
gdk_cairo_set_source_pixbuf (cr, pixbuf, x + 1, y + 1);
else
cairo_set_source_rgb (cr, 0.3, 0.3, 0.3);
cairo_rectangle (cr, x + 1, y + 1, width - 2, height - 2);
cairo_fill (cr);
g_clear_object (&pixbuf);
if (num > 0)
{
PangoLayout *layout;
gchar *number_str;
gdouble r = 3, r2 = r / 2.0, x1, y1, x2, y2;
PangoRectangle extents;
gdouble max_extent;
number_str = g_strdup_printf ("<small>%d</small>", num);
layout = gtk_widget_create_pango_layout (GTK_WIDGET (panel), "");
pango_layout_set_markup (layout, number_str, -1);
pango_layout_get_extents (layout, NULL, &extents);
g_free (number_str);
cairo_set_source_rgba (cr, 0, 0, 0, 0.75);
max_extent = MAX ((extents.width - extents.x)/ PANGO_SCALE,
(extents.height - extents.y) / PANGO_SCALE);
x += 5;
y += 5;
x1 = x;
x2 = x1 + max_extent + 1;
y1 = y;
y2 = y1 + max_extent + 1;
cairo_move_to (cr, x1 + r, y1);
cairo_line_to (cr, x2 - r, y1);
cairo_curve_to (cr, x2 - r2, y1, x2, y1 + r2, x2, y1 + r);
cairo_line_to (cr, x2, y2 - r);
cairo_curve_to (cr, x2, y2 - r2, x2 - r2, y2, x2 - r, y2);
cairo_line_to (cr, x1 + r, y2);
cairo_curve_to (cr, x1 + r2, y2, x1, y2 - r2, x1, y2 - r);
cairo_line_to (cr, x1, y1 + r);
cairo_curve_to (cr, x1, y1 + r2, x1 + r2, y1, x1 + r, y1);
cairo_fill (cr);
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_move_to (cr,
x + (max_extent / 2.0) - ((extents.width / PANGO_SCALE) / 2.0),
y + (max_extent / 2.0) - ((extents.height / PANGO_SCALE) / 2.0));
pango_cairo_show_layout (cr, layout);
cairo_fill (cr);
g_object_unref (layout);
}
}
static GtkWidget *
make_bin (void)
{
@ -1281,26 +1125,6 @@ make_single_output_ui (CcDisplayPanel *panel)
}
static void
monitor_output_changes (GtkWidget *area,
CcDisplayPanel *panel)
{
CcDisplayPanelPrivate *priv = panel->priv;
const gchar *signals[] = { "rotation", "mode", "primary", "active", "scale" };
GList *outputs, *l;
guint i;
outputs = cc_display_config_get_monitors (priv->current_config);
for (l = outputs; l; l = l->next)
{
CcDisplayMonitor *output = l->data;
for (i = 0; i < G_N_ELEMENTS (signals); ++i)
{
g_signal_connect_object (output, signals[i], G_CALLBACK (gtk_widget_queue_draw),
area, G_CONNECT_SWAPPED);
}
}
}
arrangement_notify_selected_ouptut_cb (CcDisplayPanel *panel,
GParamSpec *pspec,
CcDisplayArrangement *arr)
@ -2169,444 +1993,6 @@ on_screen_changed (CcDisplayPanel *panel)
gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), "error");
}
#define SPACE 15
#define MARGIN 15
static void
get_total_size (CcDisplayPanel *self, int *total_w, int *total_h)
{
GList *outputs, *l;
*total_w = 0;
*total_h = 0;
outputs = cc_display_config_get_monitors (self->priv->current_config);
for (l = outputs; l != NULL; l = l->next)
{
CcDisplayMonitor *output = l->data;
int w, h;
if (!is_output_useful (output))
continue;
get_geometry (output, NULL, NULL, &w, &h);
if (cc_display_config_is_layout_logical (self->priv->current_config))
{
double scale = cc_display_monitor_get_scale (output);
w /= scale;
h /= scale;
}
*total_w += w;
*total_h += h;
}
}
static double
compute_scale (CcDisplayPanel *self, FooScrollArea *area)
{
int available_w, available_h;
int total_w, total_h;
int n_monitors;
GdkRectangle viewport;
foo_scroll_area_get_viewport (area, &viewport);
get_total_size (self, &total_w, &total_h);
n_monitors = count_useful_outputs (self);
available_w = viewport.width - 2 * MARGIN - (n_monitors - 1) * SPACE;
available_h = viewport.height - 2 * MARGIN - (n_monitors - 1) * SPACE;
return MIN ((double)available_w / total_w, (double)available_h / total_h);
}
typedef struct Edge
{
CcDisplayMonitor *output;
int x1, y1;
int x2, y2;
} Edge;
typedef struct Snap
{
Edge *snapper; /* Edge that should be snapped */
Edge *snappee;
int dy, dx;
} Snap;
static void
add_edge (CcDisplayMonitor *output, int x1, int y1, int x2, int y2, GArray *edges)
{
Edge e;
e.x1 = x1;
e.x2 = x2;
e.y1 = y1;
e.y2 = y2;
e.output = output;
g_array_append_val (edges, e);
}
static void
list_edges_for_output (CcDisplayMonitor *output, GArray *edges, gboolean should_scale)
{
int x, y, w, h;
get_geometry (output, &x, &y, &w, &h);
if (should_scale)
{
double scale = cc_display_monitor_get_scale (output);
w /= scale;
h /= scale;
}
/* Top, Bottom, Left, Right */
add_edge (output, x, y, x + w, y, edges);
add_edge (output, x, y + h, x + w, y + h, edges);
add_edge (output, x, y, x, y + h, edges);
add_edge (output, x + w, y, x + w, y + h, edges);
}
static void
list_edges (CcDisplayPanel *panel, GArray *edges)
{
GList *outputs, *l;
gboolean should_scale;
should_scale = cc_display_config_is_layout_logical (panel->priv->current_config);
outputs = cc_display_config_get_monitors (panel->priv->current_config);
for (l = outputs; l != NULL; l = l->next)
{
CcDisplayMonitor *output = l->data;
if (!is_output_useful (output))
continue;
list_edges_for_output (output, edges, should_scale);
}
}
static gboolean
overlap (int s1, int e1, int s2, int e2)
{
return (!(e1 < s2 || s1 >= e2));
}
static gboolean
horizontal_overlap (Edge *snapper, Edge *snappee)
{
if (snapper->y1 != snapper->y2 || snappee->y1 != snappee->y2)
return FALSE;
return overlap (snapper->x1, snapper->x2, snappee->x1, snappee->x2);
}
static gboolean
vertical_overlap (Edge *snapper, Edge *snappee)
{
if (snapper->x1 != snapper->x2 || snappee->x1 != snappee->x2)
return FALSE;
return overlap (snapper->y1, snapper->y2, snappee->y1, snappee->y2);
}
static void
add_snap (GArray *snaps, Snap snap)
{
if (ABS (snap.dx) <= 200 || ABS (snap.dy) <= 200)
g_array_append_val (snaps, snap);
}
static void
add_edge_snaps (Edge *snapper, Edge *snappee, GArray *snaps)
{
Snap snap;
snap.snapper = snapper;
snap.snappee = snappee;
if (horizontal_overlap (snapper, snappee))
{
snap.dx = 0;
snap.dy = snappee->y1 - snapper->y1;
add_snap (snaps, snap);
}
else if (vertical_overlap (snapper, snappee))
{
snap.dy = 0;
snap.dx = snappee->x1 - snapper->x1;
add_snap (snaps, snap);
}
/* Corner snaps */
/* 1->1 */
snap.dx = snappee->x1 - snapper->x1;
snap.dy = snappee->y1 - snapper->y1;
add_snap (snaps, snap);
/* 1->2 */
snap.dx = snappee->x2 - snapper->x1;
snap.dy = snappee->y2 - snapper->y1;
add_snap (snaps, snap);
/* 2->2 */
snap.dx = snappee->x2 - snapper->x2;
snap.dy = snappee->y2 - snapper->y2;
add_snap (snaps, snap);
/* 2->1 */
snap.dx = snappee->x1 - snapper->x2;
snap.dy = snappee->y1 - snapper->y2;
add_snap (snaps, snap);
}
static void
list_snaps (CcDisplayMonitor *output, GArray *edges, GArray *snaps)
{
int i;
for (i = 0; i < edges->len; ++i)
{
Edge *output_edge = &(g_array_index (edges, Edge, i));
if (output_edge->output == output)
{
int j;
for (j = 0; j < edges->len; ++j)
{
Edge *edge = &(g_array_index (edges, Edge, j));
if (edge->output != output)
add_edge_snaps (output_edge, edge, snaps);
}
}
}
}
#if 0
static void
print_edge (Edge *edge)
{
g_debug ("(%d %d %d %d)", edge->x1, edge->y1, edge->x2, edge->y2);
}
#endif
static gboolean
corner_on_edge (int x, int y, Edge *e)
{
if (x == e->x1 && x == e->x2 && y >= e->y1 && y <= e->y2)
return TRUE;
if (y == e->y1 && y == e->y2 && x >= e->x1 && x <= e->x2)
return TRUE;
return FALSE;
}
static gboolean
edges_align (Edge *e1, Edge *e2)
{
if (corner_on_edge (e1->x1, e1->y1, e2))
return TRUE;
if (corner_on_edge (e2->x1, e2->y1, e1))
return TRUE;
return FALSE;
}
static gboolean
output_is_aligned (CcDisplayMonitor *output, GArray *edges)
{
gboolean result = FALSE;
int i;
for (i = 0; i < edges->len; ++i)
{
Edge *output_edge = &(g_array_index (edges, Edge, i));
if (output_edge->output == output)
{
int j;
for (j = 0; j < edges->len; ++j)
{
Edge *edge = &(g_array_index (edges, Edge, j));
/* We are aligned if an output edge matches
* an edge of another output
*/
if (edge->output != output_edge->output)
{
if (edges_align (output_edge, edge))
{
result = TRUE;
goto done;
}
}
}
}
}
done:
return result;
}
static void
get_output_rect (CcDisplayMonitor *output, GdkRectangle *rect, gboolean should_scale)
{
get_geometry (output, &rect->x, &rect->y, &rect->width, &rect->height);
if (should_scale)
{
double scale = cc_display_monitor_get_scale (output);
rect->height /= scale;
rect->width /= scale;
}
}
static gboolean
output_overlaps (CcDisplayMonitor *output, CcDisplayPanel *panel)
{
GdkRectangle output_rect;
GList *outputs, *l;
gboolean should_scale;
g_assert (output != NULL);
should_scale = cc_display_config_is_layout_logical (panel->priv->current_config);
get_output_rect (output, &output_rect, should_scale);
outputs = cc_display_config_get_monitors (panel->priv->current_config);
for (l = outputs; l != NULL; l = l->next)
{
CcDisplayMonitor *o = l->data;
if (!is_output_useful (o))
continue;
if (o != output)
{
GdkRectangle other_rect;
get_output_rect (o, &other_rect, should_scale);
if (gdk_rectangle_intersect (&output_rect, &other_rect, NULL))
return TRUE;
}
}
return FALSE;
}
static gboolean
config_is_aligned (CcDisplayPanel *panel, GArray *edges)
{
gboolean result = TRUE;
GList *outputs, *l;
outputs = cc_display_config_get_monitors (panel->priv->current_config);
for (l = outputs; l != NULL; l = l->next)
{
CcDisplayMonitor *output = l->data;
if (!is_output_useful (output))
continue;
if (!output_is_aligned (output, edges))
return FALSE;
if (output_overlaps (output, panel))
return FALSE;
}
return result;
}
static gboolean
is_corner_snap (const Snap *s)
{
return s->dx != 0 && s->dy != 0;
}
static int
compare_snaps (gconstpointer v1, gconstpointer v2)
{
const Snap *s1 = v1;
const Snap *s2 = v2;
int sv1 = MAX (ABS (s1->dx), ABS (s1->dy));
int sv2 = MAX (ABS (s2->dx), ABS (s2->dy));
int d;
d = sv1 - sv2;
/* This snapping algorithm is good enough for rock'n'roll, but
* this is probably a better:
*
* First do a horizontal/vertical snap, then
* with the new coordinates from that snap,
* do a corner snap.
*
* Right now, it's confusing that corner snapping
* depends on the distance in an axis that you can't actually see.
*
*/
if (d == 0)
{
if (is_corner_snap (s1) && !is_corner_snap (s2))
return -1;
else if (is_corner_snap (s2) && !is_corner_snap (s1))
return 1;
else
return 0;
}
else
{
return d;
}
}
/* Sets a mouse cursor for a widget's window. As a hack, you can pass
* GDK_BLANK_CURSOR to mean "set the cursor to NULL" (i.e. reset the widget's
* window's cursor to its default).
*/
static void
set_cursor (GtkWidget *widget, GdkCursorType type)
{
GdkCursor *cursor;
GdkWindow *window;
if (type == GDK_BLANK_CURSOR)
cursor = NULL;
else
cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), type);
window = gtk_widget_get_window (widget);
if (window)
gdk_window_set_cursor (window, cursor);
if (cursor)
g_object_unref (cursor);
}
static void
grab_weak_ref_notify (gpointer area,
GObject *object)
{
foo_scroll_area_end_grab (area, NULL);
}
static gboolean
on_toplevel_key_press (GtkWidget *button,
GdkEventKey *event)
@ -2693,225 +2079,6 @@ update_apply_button (CcDisplayPanel *panel)
show_apply_titlebar (panel, cc_display_config_is_applicable (priv->current_config));
}
static void
on_output_event (FooScrollArea *area,
FooScrollAreaEvent *event,
gpointer data)
{
CcDisplayMonitor *output = data;
CcDisplayPanel *self = g_object_get_data (G_OBJECT (area), "panel");
int n_monitors;
if (event->type == FOO_DRAG_HOVER)
{
return;
}
if (event->type == FOO_DROP)
{
/* Activate new primary? */
return;
}
n_monitors = count_useful_outputs (self);
/* If the mouse is inside the outputs, set the cursor to "you can move me". See
* on_canvas_event() for where we reset the cursor to the default if it
* exits the outputs' area.
*/
if (!cc_display_config_is_cloning (self->priv->current_config) &&
n_monitors > 1)
set_cursor (GTK_WIDGET (area), GDK_FLEUR);
if (event->type == FOO_BUTTON_PRESS)
{
GrabInfo *info;
set_current_output (self, output);
if (!cc_display_config_is_cloning (self->priv->current_config) &&
n_monitors > 1)
{
int output_x, output_y;
cc_display_monitor_get_geometry (output, &output_x, &output_y, NULL, NULL);
foo_scroll_area_begin_grab (area, on_output_event, data);
g_object_weak_ref (data, grab_weak_ref_notify, area);
info = g_new0 (GrabInfo, 1);
info->grab_x = event->x;
info->grab_y = event->y;
info->output_x = output_x;
info->output_y = output_y;
g_object_set_data (G_OBJECT (output), "grab-info", info);
}
foo_scroll_area_invalidate (area);
}
else
{
if (foo_scroll_area_is_grabbed (area))
{
GrabInfo *info = g_object_get_data (G_OBJECT (output), "grab-info");
double scale = compute_scale (self, area);
int old_x, old_y;
int new_x, new_y;
int i;
GArray *edges, *snaps, *new_edges;
cc_display_monitor_get_geometry (output, &old_x, &old_y, NULL, NULL);
new_x = info->output_x + (event->x - info->grab_x) / scale;
new_y = info->output_y + (event->y - info->grab_y) / scale;
cc_display_monitor_set_position (output, new_x, new_y);
edges = g_array_new (TRUE, TRUE, sizeof (Edge));
snaps = g_array_new (TRUE, TRUE, sizeof (Snap));
new_edges = g_array_new (TRUE, TRUE, sizeof (Edge));
list_edges (self, edges);
list_snaps (output, edges, snaps);
g_array_sort (snaps, compare_snaps);
cc_display_monitor_set_position (output, old_x, old_y);
for (i = 0; i < snaps->len; ++i)
{
Snap *snap = &(g_array_index (snaps, Snap, i));
GArray *new_edges = g_array_new (TRUE, TRUE, sizeof (Edge));
cc_display_monitor_set_position (output, new_x + snap->dx, new_y + snap->dy);
g_array_set_size (new_edges, 0);
list_edges (self, new_edges);
if (config_is_aligned (self, new_edges))
{
g_array_free (new_edges, TRUE);
break;
}
else
{
cc_display_monitor_set_position (output, info->output_x, info->output_y);
}
}
g_array_free (new_edges, TRUE);
g_array_free (snaps, TRUE);
g_array_free (edges, TRUE);
if (event->type == FOO_BUTTON_RELEASE)
{
foo_scroll_area_end_grab (area, event);
g_free (g_object_get_data (G_OBJECT (output), "grab-info"));
g_object_set_data (G_OBJECT (output), "grab-info", NULL);
g_object_weak_unref (data, grab_weak_ref_notify, area);
update_apply_button (self);
#if 0
g_debug ("new position: %d %d %d %d", output->x, output->y, output->width, output->height);
#endif
}
foo_scroll_area_invalidate (area);
}
}
}
static void
on_canvas_event (FooScrollArea *area,
FooScrollAreaEvent *event,
gpointer data)
{
/* If the mouse exits the outputs, reset the cursor to the default. See
* on_output_event() for where we set the cursor to the movement cursor if
* it is over one of the outputs.
*/
set_cursor (GTK_WIDGET (area), GDK_BLANK_CURSOR);
}
static void
paint_background (FooScrollArea *area,
cairo_t *cr)
{
GdkRectangle viewport;
foo_scroll_area_get_viewport (area, &viewport);
cairo_set_source_rgba (cr, 0, 0, 0, 0.0);
cairo_rectangle (cr,
viewport.x, viewport.y,
viewport.width, viewport.height);
foo_scroll_area_add_input_from_fill (area, cr, on_canvas_event, NULL);
cairo_fill (cr);
}
static void
on_area_paint (FooScrollArea *area,
cairo_t *cr,
gpointer data)
{
CcDisplayPanel *self = data;
GList *connected_outputs = NULL;
GList *list;
int total_w, total_h;
paint_background (area, cr);
if (!self->priv->current_config)
return;
get_total_size (self, &total_w, &total_h);
connected_outputs = cc_display_config_get_monitors (self->priv->current_config);
for (list = connected_outputs; list != NULL; list = list->next)
{
int w, h;
double scale = compute_scale (self, area);
gint x, y;
int output_x, output_y;
CcDisplayMonitor *output = list->data;
GdkRectangle viewport;
if (!is_output_useful (output))
continue;
cairo_save (cr);
foo_scroll_area_get_viewport (area, &viewport);
get_geometry (output, &output_x, &output_y, &w, &h);
if (cc_display_config_is_layout_logical (self->priv->current_config))
{
double scale = cc_display_monitor_get_scale (output);
w /= scale;
h /= scale;
}
viewport.height -= 2 * MARGIN;
viewport.width -= 2 * MARGIN;
x = output_x * scale + MARGIN + (viewport.width - total_w * scale) / 2.0;
y = output_y * scale + MARGIN + (viewport.height - total_h * scale) / 2.0;
cairo_set_source_rgba (cr, 0, 0, 0, 0);
cairo_rectangle (cr, x, y, w * scale + 0.5, h * scale + 0.5);
foo_scroll_area_add_input_from_fill (area, cr, on_output_event, output);
cairo_fill (cr);
cairo_translate (cr, x, y);
paint_output (self, cr, self->priv->current_config, output,
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (output), "ui-number")),
w * scale, h * scale);
cairo_restore (cr);
if (cc_display_config_is_cloning (self->priv->current_config))
break;
}
}
static void
apply_current_configuration (CcDisplayPanel *self)
{
@ -3310,7 +2477,6 @@ static void
cc_display_panel_init (CcDisplayPanel *self)
{
CcDisplayPanelPrivate *priv;
GSettings *settings;
g_autoptr (GtkCssProvider) provider = NULL;
GtkWidget *bin;
@ -3333,13 +2499,6 @@ cc_display_panel_init (CcDisplayPanel *self)
gtk_container_add (GTK_CONTAINER (self), priv->stack);
gtk_widget_show_all (priv->stack);
settings = g_settings_new ("org.gnome.desktop.background");
priv->background = gnome_bg_new ();
gnome_bg_load_from_preferences (priv->background, settings);
g_object_unref (settings);
priv->thumbnail_factory = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL);
priv->night_light_dialog = cc_night_light_dialog_new ();
priv->settings_color = g_settings_new ("org.gnome.settings-daemon.plugins.color");