[gnome-boxes] Get rid of DisplayProperties
- From: Marc-Andre Lureau <malureau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Get rid of DisplayProperties
- Date: Fri, 26 Oct 2012 10:08:18 +0000 (UTC)
commit f4568fb22a1a4639570ad7ea17830c20e0c499a1
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date: Wed Oct 24 22:42:40 2012 +0200
Get rid of DisplayProperties
https://bugzilla.gnome.org/show_bug.cgi?id=680826
src/Makefile.am | 1 -
src/display-properties.vala | 34 ----------------------------------
src/display.vala | 31 ++++++++++++++++++++++++++++++-
3 files changed, 30 insertions(+), 36 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 16523cb..7d81b61 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -44,7 +44,6 @@ noinst_LIBRARIES = libcommon.a
libcommon_a_VALASOURCES = \
box-config.vala \
collection-source.vala \
- display-properties.vala \
util.vala \
$(NULL)
diff --git a/src/display-properties.vala b/src/display-properties.vala
index 092a9f0..e69de29 100644
--- a/src/display-properties.vala
+++ b/src/display-properties.vala
@@ -1,34 +0,0 @@
-// This file is part of GNOME Boxes. License: LGPLv2+
-
-// too bad we can't make it just a mixin
-public class Boxes.DisplayProperties: GLib.Object {
- private int64 started_time;
- protected void access_start () {
- if (started_time != 0)
- return;
-
- started_time = get_monotonic_time ();
- config.access_last_time = get_real_time ();
- config.access_ntimes += 1;
-
- if (config.access_first_time == 0)
- config.access_first_time = config.access_last_time;
- }
-
- protected void access_finish () {
- if (started_time == 0)
- return;
-
- var duration = get_monotonic_time () - started_time;
- duration /= 1000000; // convert to seconds
- config.access_total_time += duration;
-
- started_time = 0;
- }
-
- ~DisplayProperties () {
- access_finish ();
- }
-
- public BoxConfig? config { get; set; }
-}
diff --git a/src/display.vala b/src/display.vala
index a49f485..8409eb3 100644
--- a/src/display.vala
+++ b/src/display.vala
@@ -1,10 +1,11 @@
// This file is part of GNOME Boxes. License: LGPLv2+
using Gtk;
-private abstract class Boxes.Display: Boxes.DisplayProperties, Boxes.IPropertiesProvider {
+private abstract class Boxes.Display: GLib.Object, Boxes.IPropertiesProvider {
public abstract string protocol { get; }
public abstract string uri { owned get; }
+ public BoxConfig? config { get; set; }
public bool can_grab_mouse { get; protected set; }
public bool mouse_grabbed { get; protected set; }
public bool need_password { get; protected set; }
@@ -27,6 +28,34 @@ private abstract class Boxes.Display: Boxes.DisplayProperties, Boxes.IProperties
protected HashTable<int, Gtk.Widget?> displays;
+ private int64 started_time;
+ protected void access_start () {
+ if (started_time != 0)
+ return;
+
+ started_time = get_monotonic_time ();
+ config.access_last_time = get_real_time ();
+ config.access_ntimes += 1;
+
+ if (config.access_first_time == 0)
+ config.access_first_time = config.access_last_time;
+ }
+
+ protected void access_finish () {
+ if (started_time == 0)
+ return;
+
+ var duration = get_monotonic_time () - started_time;
+ duration /= 1000000; // convert to seconds
+ config.access_total_time += duration;
+
+ started_time = 0;
+ }
+
+ ~Display () {
+ access_finish ();
+ }
+
construct {
displays = new HashTable<int, Gtk.Widget> (direct_hash, direct_equal);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]