[gnome-maps/wip/templates: 14/16] zoomControl: Convert to template
- From: Mattias Bengtsson <mattiasb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/templates: 14/16] zoomControl: Convert to template
- Date: Thu, 20 Nov 2014 15:30:52 +0000 (UTC)
commit 1fa7b07953fcfd15b79155e70bb582e2ebc31043
Author: Jonas Danielsson <jonas danielsson threetimestwo org>
Date: Mon Nov 10 09:20:06 2014 -0500
zoomControl: Convert to template
src/zoom-control.ui | 61 +++++++++++++++++++++++++++++---------------------
src/zoomControl.js | 16 +++----------
2 files changed, 39 insertions(+), 38 deletions(-)
---
diff --git a/src/zoom-control.ui b/src/zoom-control.ui
index edaa34e..ea096a3 100644
--- a/src/zoom-control.ui
+++ b/src/zoom-control.ui
@@ -1,46 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.10 -->
- <object class= "GtkBox" id="zoom-control">
+ <template class="Gjs_ZoomControl" parent="GtkBin">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <style>
- <class name="linked" />
- </style>
+ <property name="halign">start</property>
+ <property name="valign">start</property>
+ <property name="margin_top">6</property>
+ <property name="margin_start">6</property>
<child>
- <object class="GtkButton" id="zoom-in-button">
- <property name="name">zoom-in-button</property>
+ <object class="GtkBox" id="zoomControl">
<property name="visible">True</property>
- <property name="width-request">34</property>
- <property name="height-request">34</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <style>
+ <class name="linked" />
+ </style>
<child>
- <object class="GtkLabel" id="zoom-in-label">
+ <object class="GtkButton" id="zoomInButton">
+ <property name="name">zoom-in-button</property>
<property name="visible">True</property>
+ <property name="width-request">34</property>
+ <property name="height-request">34</property>
<property name="can_focus">False</property>
- <property name="margin">0</property>
- <property name="label">+</property>
+ <child>
+ <object class="GtkLabel" id="zoomInLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin">0</property>
+ <property name="label">+</property>
+ </object>
+ </child>
</object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="zoom-out-button">
- <property name="name">zoom-out-button</property>
- <property name="visible">True</property>
- <property name="width-request">34</property>
- <property name="height-request">34</property>
- <property name="can_focus">False</property>
<child>
- <object class="GtkLabel" id="zoom-out-label">
+ <object class="GtkButton" id="zoomOutButton">
+ <property name="name">zoom-out-button</property>
<property name="visible">True</property>
+ <property name="width-request">34</property>
+ <property name="height-request">34</property>
<property name="can_focus">False</property>
- <property name="margin">0</property>
- <property name="label">-</property>
+ <child>
+ <object class="GtkLabel" id="zoomOutLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin">0</property>
+ <property name="label">-</property>
+ </object>
+ </child>
</object>
</child>
</object>
</child>
- </object>
+ </template>
</interface>
diff --git a/src/zoomControl.js b/src/zoomControl.js
index 0f98121..ba688d5 100644
--- a/src/zoomControl.js
+++ b/src/zoomControl.js
@@ -27,19 +27,12 @@ const Utils = imports.utils;
const ZoomControl = new Lang.Class({
Name: 'ZoomControl',
Extends: Gtk.Bin,
+ Template: 'resource:///org/gnome/maps/zoom-control.ui',
+ InternalChildren: [ 'zoomInButton',
+ 'zoomOutButton' ],
_init: function (mapView) {
- this.parent({ halign: Gtk.Align.START,
- valign: Gtk.Align.START,
- margin_top: 6,
- margin_start: 6,
- visible: true });
-
- let ui = Utils.getUIObject('zoom-control', ['zoom-control',
- 'zoom-in-button',
- 'zoom-out-button']);
- this._zoomInButton = ui.zoomInButton;
- this._zoomOutButton = ui.zoomOutButton;
+ this.parent();
this._view = mapView.view;
this._zoomInButton.connect('clicked',
@@ -53,7 +46,6 @@ const ZoomControl = new Lang.Class({
this._updateSensitive.bind(this));
this._view.connect('notify::min-zoom-level',
this._updateSensitive.bind(this));
- this.add(ui.zoomControl);
},
_updateSensitive: function () {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]