[gnome-break-timer] Fixed valac warnings.



commit 8b06b5631abdae0e23bbc29781ea121eaeb9f3bb
Author: Dylan McCall <dylanmccall ubuntu com>
Date:   Wed Sep 18 22:46:11 2013 -0700

    Fixed valac warnings.
    
    Warnings included unhandled exceptions and private classes with unused methods. (Changed to public 
classes).

 data/settings-panels.ui           |    1 +
 helper/BreakManager.vala          |    2 +-
 helper/HelperApplication.vala     |   11 ++++++++---
 helper/SessionStatus.vala         |   14 +++++++++++---
 helper/break/BreakController.vala |    2 +-
 5 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/data/settings-panels.ui b/data/settings-panels.ui
index 87667d8..ee21ab2 100644
--- a/data/settings-panels.ui
+++ b/data/settings-panels.ui
@@ -207,6 +207,7 @@
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="hexpand">True</property>
+                <property name="ypad">4</property>
                 <property name="label" translatable="yes">Full breaks are time to get away from the computer 
and move around.</property>
                 <style>
                   <class name="_break-status-body"/>
diff --git a/helper/BreakManager.vala b/helper/BreakManager.vala
index 8c12a6d..ccc15bb 100644
--- a/helper/BreakManager.vala
+++ b/helper/BreakManager.vala
@@ -99,7 +99,7 @@ public class BreakManager : Object {
 }
 
 [DBus (name = "org.gnome.BreakTimer")]
-private class BreakHelperServer : Object, IBreakHelper {
+public class BreakHelperServer : Object, IBreakHelper {
        private weak BreakManager break_manager;
        
        public BreakHelperServer (BreakManager break_manager) {
diff --git a/helper/HelperApplication.vala b/helper/HelperApplication.vala
index 6f4b538..79e4486 100644
--- a/helper/HelperApplication.vala
+++ b/helper/HelperApplication.vala
@@ -152,16 +152,21 @@ public class HelperApplication : Gtk.Application {
                        OutputStream state_stream = state_file.replace (null, false, FileCreateFlags.NONE);
                        generator.to_stream (state_stream);
                } catch (Error e) {
-                       GLib.warning ("Error writing to breaks state file: %s", e.message);
+                       GLib.warning ("Error writing to state file: %s", e.message);
                }
        }
 
        private void restore_state () {
                File state_file = this.get_state_file ();
                if (state_file.query_exists ()) {
-                       InputStream state_stream = state_file.read ();
                        Json.Parser parser = new Json.Parser ();
-                       parser.load_from_stream (state_stream);
+
+                       try {
+                               InputStream state_stream = state_file.read ();
+                               parser.load_from_stream (state_stream);
+                       } catch (Error e) {
+                               GLib.warning ("Error reading state file: %s", e.message);
+                       }
 
                        Json.Node? root = parser.get_root ();
                        if (root != null) {
diff --git a/helper/SessionStatus.vala b/helper/SessionStatus.vala
index 4f05071..153ebfa 100644
--- a/helper/SessionStatus.vala
+++ b/helper/SessionStatus.vala
@@ -16,7 +16,7 @@
  */
 
 [DBus (name = "org.gnome.ScreenSaver")]
-interface IScreenSaver : Object {
+public interface IScreenSaver : Object {
     public signal void active_changed (bool active);
 
     public abstract bool get_active () throws IOError;
@@ -90,13 +90,21 @@ public class SessionStatus : ISessionStatus, Object {
 
        public void blank_screen () {
                if (this.screensaver != null) {
-                       this.screensaver.set_active (true);
+                       try {
+                               this.screensaver.set_active (true);
+                       } catch (IOError error) {
+                               GLib.warning ("Error blanking screeen: %s", error.message);
+                       }
                }
        }
 
        public void unblank_screen () {
                if (this.screensaver != null) {
-                       this.screensaver.set_active (false);
+                       try {
+                               this.screensaver.set_active (false);
+                       } catch (IOError error) {
+                               GLib.warning ("Error unblanking screeen: %s", error.message);
+                       }
                }
        }
 }
\ No newline at end of file
diff --git a/helper/break/BreakController.vala b/helper/break/BreakController.vala
index a8fe27e..38136f1 100644
--- a/helper/break/BreakController.vala
+++ b/helper/break/BreakController.vala
@@ -88,7 +88,7 @@ public abstract class BreakController : Object {
        }
 
        public virtual void deserialize (ref Json.Object json_root) {
-               State serialized_state = (State)json_root.get_int_member ("state");
+               // State serialized_state = (State)json_root.get_int_member ("state");
                // We won't restore the original state directly. A BreakController
                // implementation should decide whether to activate at this stage.
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]