[gnome-maps] properties: tweak the sidebar appearance a bit
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] properties: tweak the sidebar appearance a bit
- Date: Fri, 5 Apr 2013 16:39:41 +0000 (UTC)
commit 5d5b319b5cf84c226ff1c5caf71b654c7a8c46f4
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Apr 5 12:26:54 2013 -0400
properties: tweak the sidebar appearance a bit
- Use homogeneous margins
- Add a CSS file and a frame to the sidebar
- Set a larger minimum width
src/application.js | 2 ++
src/gnome-maps.gresource.xml | 1 +
src/properties.js | 10 ++++++----
src/utils.js | 13 +++++++++++++
4 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 1977455..5eda1ae 100644
--- a/src/application.js
+++ b/src/application.js
@@ -74,6 +74,8 @@ const Application = new Lang.Class({
let resource = Gio.Resource.load(Path.RESOURCE_DIR + '/gnome-maps.gresource');
resource._register();
+ Utils.loadStyleSheet(Gio.file_new_for_uri('resource:///org/gnome/maps/application.css'));
+
application = this;
settings = new Gio.Settings({ schema: 'org.gnome.maps' });
diff --git a/src/gnome-maps.gresource.xml b/src/gnome-maps.gresource.xml
index 1d61020..438576e 100644
--- a/src/gnome-maps.gresource.xml
+++ b/src/gnome-maps.gresource.xml
@@ -2,5 +2,6 @@
<gresources>
<gresource prefix="/org/gnome/maps">
<file preprocess="xml-stripblanks">app-menu.ui</file>
+ <file alias="application.css">../data/gnome-maps.css</file>
</gresource>
</gresources>
diff --git a/src/properties.js b/src/properties.js
index 3e08ba7..38b4012 100644
--- a/src/properties.js
+++ b/src/properties.js
@@ -52,9 +52,9 @@ const Properties = new Lang.Class({
// then the sidebar itself, packed into the revealer
let propsGrid = new Gtk.Grid({ vexpand: true,
hexpand: true,
- margin_top: 50,
- margin_left: 20,
- margin_right: 20,
+ margin_top: 32,
+ margin_left: 32,
+ margin_right: 32,
row_spacing: 15,
orientation: Gtk.Orientation.VERTICAL,
valign: Gtk.Align.FILL });
@@ -72,7 +72,9 @@ const Properties = new Lang.Class({
this.addMapTypeRadio(radio, radioGrid, _("Transit"), MapView.MapType.TRANSIT);
let propsContainer = new Gtk.Frame({ child: propsGrid,
- shadow_type: Gtk.ShadowType.NONE });
+ shadow_type: Gtk.ShadowType.IN,
+ width_request: 200 });
+ propsContainer.get_style_context().add_class('maps-sidebar');
let revealer = new Gd.Revealer({ child: propsContainer,
reveal_child: false,
diff --git a/src/utils.js b/src/utils.js
index 9bf2b15..a1ef094 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -20,8 +20,10 @@
*/
const Lang = imports.lang;
+const Gdk = imports.gi.Gdk;
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
+const Gtk = imports.gi.Gtk;
const Signals = imports.signals;
const Geocode = imports.gi.GeocodeGlib;
@@ -48,6 +50,17 @@ function addJSSignalMethods(proto) {
proto.disconnectAllJS = Signals._disconnectAll;
}
+function loadStyleSheet(file) {
+ file = file || Gio.file_new_for_path(GLib.build_filenamev([pkg.pkgdatadir,
+ 'application.css']));
+
+ let provider = new Gtk.CssProvider();
+ provider.load_from_file(file);
+ Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(),
+ provider,
+ Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
+}
+
function clearGtkClutterActorBg(actor) {
let widget = actor.get_widget();
widget.override_background_color(0, new Gdk.RGBA({ red: 0,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]