[gnome-clocks] Port world and alarms to ui templates
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks] Port world and alarms to ui templates
- Date: Sat, 9 Aug 2014 09:23:23 +0000 (UTC)
commit c7592d06f457e6b65fe01df0f0270ad9131c1962
Author: Paolo Borelli <pborelli gnome org>
Date: Sat Aug 9 10:56:29 2014 +0200
Port world and alarms to ui templates
data/gnome-clocks.gresource.xml | 4 +-
data/ui/alarm.ui | 79 ++-------------------
data/ui/alarmringing.ui | 85 ++++++++++++++++++++++
data/ui/world.ui | 149 ++-------------------------------------
data/ui/worldstandalone.ui | 145 +++++++++++++++++++++++++++++++++++++
src/alarm.vala | 63 +++++++---------
src/utils.vala | 10 ---
src/world.vala | 45 +++++-------
8 files changed, 291 insertions(+), 289 deletions(-)
---
diff --git a/data/gnome-clocks.gresource.xml b/data/gnome-clocks.gresource.xml
index 7a76fc1..e10c714 100644
--- a/data/gnome-clocks.gresource.xml
+++ b/data/gnome-clocks.gresource.xml
@@ -5,9 +5,11 @@
<file preprocess="xml-stripblanks">gtk/menus.ui</file>
<file preprocess="xml-stripblanks">ui/window.ui</file>
<file preprocess="xml-stripblanks">ui/worldlocationdialog.ui</file>
+ <file preprocess="xml-stripblanks">ui/worldstandalone.ui</file>
<file preprocess="xml-stripblanks">ui/world.ui</file>
- <file preprocess="xml-stripblanks">ui/alarm.ui</file>
+ <file preprocess="xml-stripblanks">ui/alarmringing.ui</file>
<file preprocess="xml-stripblanks">ui/alarmsetupdialog.ui</file>
+ <file preprocess="xml-stripblanks">ui/alarm.ui</file>
<file preprocess="xml-stripblanks">ui/stopwatch.ui</file>
<file preprocess="xml-stripblanks">ui/stopwatchlapsrow.ui</file>
<file preprocess="xml-stripblanks">ui/timer.ui</file>
diff --git a/data/ui/alarm.ui b/data/ui/alarm.ui
index 213374e..191e504 100644
--- a/data/ui/alarm.ui
+++ b/data/ui/alarm.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.6 -->
- <object class="GtkGrid" id="empty_panel">
+ <object class="GtkGrid" id="empty_view">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
@@ -40,81 +40,14 @@
</packing>
</child>
</object>
- <object class="GtkGrid" id="ringing_panel">
+ <template class="ClocksAlarmMainPanel" parent="GtkStack">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">center</property>
- <property name="valign">center</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="row_spacing">48</property>
- <property name="column_spacing">24</property>
- <child>
- <object class="GtkLabel" id="time_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">center</property>
- <property name="valign">center</property>
- <style>
- <class name="clocks-ringing-label"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
+ <signal name="notify::visible-child" handler="visible_child_changed" swapped="no"/>
<child>
- <object class="GtkGrid" id="button_grid">
+ <object class="ClocksAlarmRingingPanel" id="ringing_panel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="column_spacing">24</property>
- <child>
- <object class="GtkButton" id="stop_button">
- <property name="label" translatable="yes">Stop</property>
- <property name="width_request">200</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <style>
- <class name="clocks-button"/>
- <class name="clocks-stop"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="snooze_button">
- <property name="label" translatable="yes">Snooze</property>
- <property name="width_request">200</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <style>
- <class name="clocks-button"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
+ <signal name="dismiss" handler="dismiss_ringing_panel" swapped="no"/>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
- </object>
+ </template>
</interface>
diff --git a/data/ui/alarmringing.ui b/data/ui/alarmringing.ui
new file mode 100644
index 0000000..147d770
--- /dev/null
+++ b/data/ui/alarmringing.ui
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <template class="ClocksAlarmRingingPanel" parent="GtkGrid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="row_spacing">48</property>
+ <property name="column_spacing">24</property>
+ <child>
+ <object class="GtkLabel" id="time_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <style>
+ <class name="clocks-ringing-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="button_grid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="column_spacing">24</property>
+ <child>
+ <object class="GtkButton" id="stop_button">
+ <property name="label" translatable="yes">Stop</property>
+ <property name="width_request">200</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="stop_clicked" swapped="no"/>
+ <style>
+ <class name="clocks-button"/>
+ <class name="clocks-stop"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="snooze_button">
+ <property name="label" translatable="yes">Snooze</property>
+ <property name="width_request">200</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="snooze_clicked" swapped="no"/>
+ <style>
+ <class name="clocks-button"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </template>
+</interface>
diff --git a/data/ui/world.ui b/data/ui/world.ui
index 7c754b9..6abde2e 100644
--- a/data/ui/world.ui
+++ b/data/ui/world.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
- <object class="GtkGrid" id="empty_panel">
+ <object class="GtkGrid" id="empty_view">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
@@ -40,152 +40,13 @@
</packing>
</child>
</object>
- <object class="GtkGrid" id="standalone_content">
+ <template class="ClocksWorldMainPanel" parent="GtkStack">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <signal name="notify::visible-child" handler="visible_child_changed" swapped="no"/>
<child>
- <object class="GtkGrid" id="grid2">
+ <object class="ClocksWorldStandalonePanel" id="standalone">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">center</property>
- <property name="valign">center</property>
- <property name="margin_start">34</property>
- <property name="margin_end">34</property>
- <property name="margin_bottom">12</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <child>
- <object class="GtkLabel" id="dummy_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label"> </property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="time_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <style>
- <class name="clocks-standalone-label"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="day_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <style>
- <class name="clocks-secondary-standalone-label"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
- <child>
- <object class="GtkGrid" id="grid3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">center</property>
- <property name="margin_bottom">24</property>
- <property name="column_spacing">12</property>
- <style>
- <class name="clocks-secondary-standalone-label"/>
- </style>
- <child>
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Sunrise</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Sunset</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="sunrise_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label">label</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="sunset_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- </object>
- <object class="GtkSizeGroup" id="sizegroup1">
- <property name="mode">vertical</property>
- <widgets>
- <widget name="dummy_label"/>
- <widget name="day_label"/>
- </widgets>
- </object>
+ </template>
</interface>
diff --git a/data/ui/worldstandalone.ui b/data/ui/worldstandalone.ui
new file mode 100644
index 0000000..5fab849
--- /dev/null
+++ b/data/ui/worldstandalone.ui
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <template class="ClocksWorldStandalonePanel" parent="GtkGrid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkGrid" id="grid2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="margin_start">34</property>
+ <property name="margin_end">34</property>
+ <property name="margin_bottom">12</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <child>
+ <object class="GtkLabel" id="dummy_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"> </property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="time_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <style>
+ <class name="clocks-standalone-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="day_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <style>
+ <class name="clocks-secondary-standalone-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="margin_bottom">24</property>
+ <property name="column_spacing">12</property>
+ <style>
+ <class name="clocks-secondary-standalone-label"/>
+ </style>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Sunrise</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Sunset</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="sunrise_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">label</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="sunset_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </template>
+</interface>
diff --git a/src/alarm.vala b/src/alarm.vala
index 6d6c88f..07e2677 100644
--- a/src/alarm.vala
+++ b/src/alarm.vala
@@ -463,7 +463,8 @@ private class SetupDialog : Gtk.Dialog {
}
}
-private class RingingPanel : Gtk.EventBox {
+[GtkTemplate (ui = "/org/gnome/clocks/ui/alarmringing.ui")]
+private class RingingPanel : Gtk.Grid {
public Item alarm {
get {
return _alarm;
@@ -487,26 +488,17 @@ private class RingingPanel : Gtk.EventBox {
private Item? _alarm;
private ulong alarm_state_handler;
+ [GtkChild]
private Gtk.Label time_label;
- private Gtk.Button stop_button;
- private Gtk.Button snooze_button;
-
- public RingingPanel () {
- var builder = Utils.load_ui ("alarm.ui");
- var grid = builder.get_object ("ringing_panel") as Gtk.Grid;
- time_label = builder.get_object ("time_label") as Gtk.Label;
- stop_button = builder.get_object ("stop_button") as Gtk.Button;
- snooze_button = builder.get_object ("snooze_button") as Gtk.Button;
-
- stop_button.clicked.connect (() => {
- alarm.stop ();
- });
- snooze_button.clicked.connect (() => {
- alarm.snooze ();
- });
+ [GtkCallback]
+ private void stop_clicked () {
+ alarm.stop ();
+ }
- add (grid);
+ [GtkCallback]
+ private void snooze_clicked () {
+ alarm.snooze ();
}
public virtual signal void dismiss () {
@@ -524,6 +516,7 @@ private class RingingPanel : Gtk.EventBox {
}
}
+[GtkTemplate (ui = "/org/gnome/clocks/ui/alarm.ui")]
public class MainPanel : Gtk.Stack, Clocks.Clock {
public string label { get; construct set; }
public HeaderBar header_bar { get; construct set; }
@@ -533,6 +526,9 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
private GLib.Settings settings;
private Gtk.Button new_button;
private ContentView content_view;
+ [GtkChild]
+ private Gtk.Widget empty_view;
+ [GtkChild]
private RingingPanel ringing_panel;
public MainPanel (HeaderBar header_bar) {
@@ -565,8 +561,6 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
new_button.action_name = "win.new";
header_bar.pack_start (new_button);
- var builder = Utils.load_ui ("alarm.ui");
- var empty_view = builder.get_object ("empty_panel") as Gtk.Widget;
content_view = new ContentView (empty_view, header_bar);
add (content_view);
@@ -586,23 +580,8 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
save ();
});
- ringing_panel = new RingingPanel ();
- add (ringing_panel);
-
- ringing_panel.dismiss.connect (() => {
- visible_child = content_view;
- });
-
load ();
- notify["visible-child"].connect (() => {
- if (visible_child == content_view) {
- header_bar.mode = HeaderBar.Mode.NORMAL;
- } else if (visible_child == ringing_panel) {
- header_bar.mode = HeaderBar.Mode.STANDALONE;
- }
- });
-
visible_child = content_view;
show_all ();
@@ -624,6 +603,20 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
public signal void ring ();
+ [GtkCallback]
+ private void dismiss_ringing_panel () {
+ visible_child = content_view;
+ }
+
+ [GtkCallback]
+ private void visible_child_changed () {
+ if (visible_child == content_view) {
+ header_bar.mode = HeaderBar.Mode.NORMAL;
+ } else if (visible_child == ringing_panel) {
+ header_bar.mode = HeaderBar.Mode.STANDALONE;
+ }
+ }
+
private Item? find_item (string id) {
foreach (var i in alarms) {
if (i.id == id) {
diff --git a/src/utils.vala b/src/utils.vala
index f344e91..e14700a 100644
--- a/src/utils.vala
+++ b/src/utils.vala
@@ -32,16 +32,6 @@ public Gtk.CssProvider load_css (string css) {
return provider;
}
-public Gtk.Builder load_ui (string ui) {
- var builder = new Gtk.Builder ();
- try {
- builder.add_from_resource ("/org/gnome/clocks/ui/".concat (ui, null));
- } catch (Error e) {
- error ("loading main builder file: %s", e.message);
- }
- return builder;
-}
-
public Gdk.Pixbuf? load_image (string image) {
try {
var path = Path.build_filename (Config.DATADIR, "gnome-clocks", "images", image);
diff --git a/src/world.vala b/src/world.vala
index 0fb9ce0..16c373d 100644
--- a/src/world.vala
+++ b/src/world.vala
@@ -221,26 +221,19 @@ private class LocationDialog : Gtk.Dialog {
}
}
-private class StandalonePanel : Gtk.EventBox {
+[GtkTemplate (ui = "/org/gnome/clocks/ui/worldstandalone.ui")]
+private class StandalonePanel : Gtk.Grid {
public Item location { get; set; }
+ [GtkChild]
private Gtk.Label time_label;
+ [GtkChild]
private Gtk.Label day_label;
+ [GtkChild]
private Gtk.Label sunrise_label;
+ [GtkChild]
private Gtk.Label sunset_label;
- public StandalonePanel () {
- var builder = Utils.load_ui ("world.ui");
-
- var grid = builder.get_object ("standalone_content") as Gtk.Grid;
- time_label = builder.get_object ("time_label") as Gtk.Label;
- day_label = builder.get_object ("day_label") as Gtk.Label;
- sunrise_label = builder.get_object ("sunrise_label") as Gtk.Label;
- sunset_label = builder.get_object ("sunset_label") as Gtk.Label;
-
- add (grid);
- }
-
public void update () {
if (location != null) {
time_label.label = location.time_label;
@@ -251,6 +244,7 @@ private class StandalonePanel : Gtk.EventBox {
}
}
+[GtkTemplate (ui = "/org/gnome/clocks/ui/world.ui")]
public class MainPanel : Gtk.Stack, Clocks.Clock {
public string label { get; construct set; }
public HeaderBar header_bar { get; construct set; }
@@ -263,6 +257,9 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
private Gdk.Pixbuf? day_pixbuf;
private Gdk.Pixbuf? night_pixbuf;
private ContentView content_view;
+ [GtkChild]
+ private Gtk.Widget empty_view;
+ [GtkChild]
private StandalonePanel standalone;
public MainPanel (HeaderBar header_bar) {
@@ -291,8 +288,6 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
});
header_bar.pack_start (back_button);
- var builder = Utils.load_ui ("world.ui");
- var empty_view = builder.get_object ("empty_panel") as Gtk.Widget;
content_view = new ContentView (empty_view, header_bar);
content_view.set_sorting(Gtk.SortType.ASCENDING, (item1, item2) => {
var offset1 = ((Item) item1).location.get_timezone().get_offset();
@@ -319,9 +314,6 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
save ();
});
- standalone = new StandalonePanel ();
- add (standalone);
-
load ();
if (settings.get_boolean ("geolocation")) {
@@ -330,14 +322,6 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
});
}
- notify["visible-child"].connect (() => {
- if (visible_child == content_view) {
- header_bar.mode = HeaderBar.Mode.NORMAL;
- } else if (visible_child == standalone) {
- header_bar.mode = HeaderBar.Mode.STANDALONE;
- }
- });
-
visible_child = content_view;
show_all ();
@@ -351,6 +335,15 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
});
}
+ [GtkCallback]
+ private void visible_child_changed () {
+ if (visible_child == content_view) {
+ header_bar.mode = HeaderBar.Mode.NORMAL;
+ } else if (visible_child == standalone) {
+ header_bar.mode = HeaderBar.Mode.STANDALONE;
+ }
+ }
+
private void load () {
foreach (var l in settings.get_value ("world-clocks")) {
Item? location = Item.deserialize (l);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]