[gnome-control-center/wip/jsparber/background: 3/58] [feat] add stylesheet and layout fix
- From: Julian Sparber <jsparber src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/jsparber/background: 3/58] [feat] add stylesheet and layout fix
- Date: Fri, 24 Nov 2017 21:46:06 +0000 (UTC)
commit 293de2ebe5bcba435df11c2e013a1f63baf89b96
Author: Julian Sparber <julian sparber net>
Date: Sun Oct 22 11:39:58 2017 +0200
[feat] add stylesheet and layout fix
panels/background/background.gresource.xml | 1 +
panels/background/background.ui | 16 +++++++++++++---
panels/background/cc-background-panel.c | 16 +++++++---------
panels/background/data/background.css | 7 +++++++
4 files changed, 28 insertions(+), 12 deletions(-)
---
diff --git a/panels/background/background.gresource.xml b/panels/background/background.gresource.xml
index e8e4ff3..4a76129 100644
--- a/panels/background/background.gresource.xml
+++ b/panels/background/background.gresource.xml
@@ -2,5 +2,6 @@
<gresources>
<gresource prefix="/org/gnome/control-center/background">
<file preprocess="xml-stripblanks">background.ui</file>
+ <file alias="background.css">data/background.css</file>
</gresource>
</gresources>
diff --git a/panels/background/background.ui b/panels/background/background.ui
index 447c4b6..d47b863 100644
--- a/panels/background/background.ui
+++ b/panels/background/background.ui
@@ -21,6 +21,9 @@
<property name="margin">6</property>
<property name="spacing">6</property>
<property name="orientation">vertical</property>
+ <style>
+ <class name="black-border"/>
+ </style>
<child>
<object class="GtkDrawingArea" id="background-desktop-drawingarea">
<property name="width_request">310</property>
@@ -32,9 +35,6 @@
<property name="vexpand">True</property>
</object>
</child>
- <style>
- <class name="black-border"/>
- </style>
</object>
</child>
<child>
@@ -120,16 +120,26 @@
<object class="GtkBox" id="box4">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <style>
+ <class name="background-gallery"/>
+ </style>
<child>
<object class="GtkFlowBox" id="background-gallery">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<property name="orientation">horizontal</property>
+ <property name="min-children-per-line">2</property>
+ <property name="row_spacing">5</property>
+ <property name="column_spacing">5</property>
<property name="halign">center</property>
<property name="valign">center</property>
+ <property name="margin">25</property>
+ <property name="margin_top">50</property>
</object>
</child>
+
</object>
</child>
</object>
diff --git a/panels/background/cc-background-panel.c b/panels/background/cc-background-panel.c
index f8e2677..f850630 100644
--- a/panels/background/cc-background-panel.c
+++ b/panels/background/cc-background-panel.c
@@ -786,7 +786,7 @@ cc_background_panel_init (CcBackgroundPanel *panel)
{
gchar *objects[] = {"background-panel", NULL };
GError *err = NULL;
- GtkCssProvider *provider;
+ GtkStyleProvider *provider;
GtkStyleContext *context;
GtkWidget *widget;
@@ -821,15 +821,13 @@ cc_background_panel_init (CcBackgroundPanel *panel)
/* add border to background preview */
widget = WID ("background-preview-top");
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (provider),
- ".black-border {\n"
- " border: 1px solid black;\n"
- "}", -1, NULL);
+ provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
+ gtk_css_provider_load_from_resource (provider,
+ "org/gnome/control-center/background/background.css");
context = gtk_widget_get_style_context (widget);
- gtk_style_context_add_provider (context,
- GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ gtk_style_context_add_provider_for_screen (gdk_screen_get_default(),
+ provider,
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref (provider);
/* setup preview area */
diff --git a/panels/background/data/background.css b/panels/background/data/background.css
new file mode 100644
index 0000000..c2874a6
--- /dev/null
+++ b/panels/background/data/background.css
@@ -0,0 +1,7 @@
+.background-gallery {
+ background: #fff;
+}
+
+.black-border {
+ border: 1px solid black;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]