[gnome-clocks] Fold the standalone ui in the main panel ui
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks] Fold the standalone ui in the main panel ui
- Date: Fri, 15 Aug 2014 19:32:07 +0000 (UTC)
commit 29574b87354fe53a15bcbc9ffaaa0e0c7195afbd
Author: Paolo Borelli <pborelli gnome org>
Date: Fri Aug 15 17:27:44 2014 +0200
Fold the standalone ui in the main panel ui
There is no reason to have a separate template class
data/gnome-clocks.gresource.xml | 1 -
data/ui/world.ui | 140 +++++++++++++++++++++++++++++++++++++-
data/ui/worldstandalone.ui | 145 ---------------------------------------
po/POTFILES.in | 1 -
src/world.vala | 60 ++++++++--------
5 files changed, 168 insertions(+), 179 deletions(-)
---
diff --git a/data/gnome-clocks.gresource.xml b/data/gnome-clocks.gresource.xml
index e10c714..6305a4d 100644
--- a/data/gnome-clocks.gresource.xml
+++ b/data/gnome-clocks.gresource.xml
@@ -5,7 +5,6 @@
<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/alarmringing.ui</file>
<file preprocess="xml-stripblanks">ui/alarmsetupdialog.ui</file>
diff --git a/data/ui/world.ui b/data/ui/world.ui
index 6abde2e..cd94b5f 100644
--- a/data/ui/world.ui
+++ b/data/ui/world.ui
@@ -44,8 +44,146 @@
<property name="visible">True</property>
<signal name="notify::visible-child" handler="visible_child_changed" swapped="no"/>
<child>
- <object class="ClocksWorldStandalonePanel" id="standalone">
+ <object class="GtkGrid" id="standalone">
<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="standalone_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="standalone_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="standalone_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="standalone_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>
</child>
</template>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 41ff176..11da86b 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -20,5 +20,4 @@ src/world.vala
[type: gettext/glade]data/ui/timer.ui
[type: gettext/glade]data/ui/window.ui
[type: gettext/glade]data/ui/worldlocationdialog.ui
-[type: gettext/glade]data/ui/worldstandalone.ui
[type: gettext/glade]data/ui/world.ui
diff --git a/src/world.vala b/src/world.vala
index 50e7833..b09321c 100644
--- a/src/world.vala
+++ b/src/world.vala
@@ -215,29 +215,6 @@ private class LocationDialog : Gtk.Dialog {
}
}
-[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 void update () {
- if (location != null) {
- time_label.label = location.time_label;
- day_label.label = location.day_label;
- sunrise_label.label = location.sunrise_label;
- sunset_label.label = location.sunset_label;
- }
- }
-}
-
[GtkTemplate (ui = "/org/gnome/clocks/ui/world.ui")]
public class MainPanel : Gtk.Stack, Clocks.Clock {
public string label { get; construct set; }
@@ -251,10 +228,19 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
private Gdk.Pixbuf? day_pixbuf;
private Gdk.Pixbuf? night_pixbuf;
private ContentView content_view;
+ private Item standalone_location;
[GtkChild]
private Gtk.Widget empty_view;
[GtkChild]
- private StandalonePanel standalone;
+ private Gtk.Widget standalone;
+ [GtkChild]
+ private Gtk.Label standalone_time_label;
+ [GtkChild]
+ private Gtk.Label standalone_day_label;
+ [GtkChild]
+ private Gtk.Label standalone_sunrise_label;
+ [GtkChild]
+ private Gtk.Label standalone_sunset_label;
public MainPanel (HeaderBar header_bar) {
Object (label: _("World"), header_bar: header_bar, transition_type:
Gtk.StackTransitionType.CROSSFADE, panel_id: PanelId.WORLD);
@@ -295,10 +281,7 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
add (content_view);
content_view.item_activated.connect ((item) => {
- Item location = (Item) item;
- standalone.location = location;
- standalone.update ();
- visible_child = standalone;
+ show_standalone ((Item) item);
});
content_view.delete_selected.connect (() => {
@@ -325,7 +308,7 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
l.tick();
}
content_view.queue_draw ();
- standalone.update ();
+ update_standalone ();
});
}
@@ -338,6 +321,21 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
}
}
+ private void update_standalone () {
+ if (standalone_location != null) {
+ standalone_time_label.label = standalone_location.time_label;
+ standalone_day_label.label = standalone_location.day_label;
+ standalone_sunrise_label.label = standalone_location.sunrise_label;
+ standalone_sunset_label.label = standalone_location.sunset_label;
+ }
+ }
+
+ private void show_standalone (Item location) {
+ standalone_location = location;
+ update_standalone ();
+ visible_child = standalone;
+ }
+
private void load () {
foreach (var l in settings.get_value ("world-clocks")) {
Item? location = Item.deserialize (l);
@@ -422,8 +420,8 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
content_view.update_header_bar ();
break;
case HeaderBar.Mode.STANDALONE:
- header_bar.title = GLib.Markup.escape_text (standalone.location.city_name);
- header_bar.subtitle = GLib.Markup.escape_text (standalone.location.contry_name);
+ header_bar.title = GLib.Markup.escape_text (standalone_location.city_name);
+ header_bar.subtitle = GLib.Markup.escape_text (standalone_location.contry_name);
back_button.show ();
break;
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]