[moserial] remove #if support for old vala versions



commit 3a197ece085f823ca126957d49d22057db008f2c
Author: Michael J. Chudobiak <mjc avtechpulse com>
Date:   Fri Dec 22 14:17:25 2017 -0500

    remove #if support for old vala versions

 configure.ac              |    2 ++
 src/HexTextBuffer.vala    |   36 ------------------------------------
 src/MainWindow.vala       |    4 ----
 src/MoUtils.vala          |    4 ----
 src/SerialConnection.vala |   11 -----------
 5 files changed, 2 insertions(+), 55 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 38d012f..f466b3d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,6 +29,8 @@ AC_SUBST(LDFLAGS)
 GLIB_REQUIRED=2.12.0
 GTK_REQUIRED=3.0.0
 
+AM_PROG_VALAC([0.16.0])
+
 PKG_CHECK_MODULES(MOSERIAL, glib-2.0 >= $GLIB_REQUIRED
                            gobject-2.0 >= $GLIB_REQUIRED
                            gtk+-3.0 >= $GTK_REQUIRED
diff --git a/src/HexTextBuffer.vala b/src/HexTextBuffer.vala
index 57a6792..393a5a9 100644
--- a/src/HexTextBuffer.vala
+++ b/src/HexTextBuffer.vala
@@ -69,11 +69,7 @@ public class moserial.HexTextBuffer : TextBuffer
                                this.add_mark(startMark, nextCharIter);
 
                                // Insert offset info (hexBytes)
-#if VALA_0_16
                                this.insert(ref nextCharIter, "\n%08x".printf(hexBytes), 9);
-#else
-                               this.insert(nextCharIter, "\n%08x".printf(hexBytes), 9);
-#endif
                                this.get_end_iter (out nextCharIter);   
 
                                // Format offset info
@@ -82,11 +78,7 @@ public class moserial.HexTextBuffer : TextBuffer
                                this.delete_mark(startMark);
 
                                // Blank space
-#if VALA_0_16
                                this.insert(ref nextCharIter, " ", 1);
-#else
-                               this.insert(nextCharIter, " ", 1);
-#endif
                                this.get_end_iter (out nextCharIter);
 
                                // Save current position in nextHexMark
@@ -96,11 +88,7 @@ public class moserial.HexTextBuffer : TextBuffer
                                this.add_mark(nextHexMark, nextHexIter);
 
                                // Put 51 blank spaces
-#if VALA_0_16
                                this.insert(ref nextCharIter, "                                               
    ", 51);
-#else
-                               this.insert(nextCharIter, "                                                   
", 51);
-#endif
                                this.get_end_iter (out nextCharIter);
                                // Save current nextCharMark
                                this.delete_mark(nextCharMark);
@@ -110,11 +98,7 @@ public class moserial.HexTextBuffer : TextBuffer
                         else if((hexBytes % 8)==0) {
                                // Every 8 characters put a separation of 2 spaces
                                this.get_iter_at_mark(out nextHexIter, nextHexMark);
-#if VALA_0_16
                                this.insert(ref nextHexIter, "  ", 2);
-#else
-                               this.insert(nextHexIter, "  ", 2);
-#endif
                                this.get_iter_at_mark(out nextHexIter, nextHexMark);
                                nextHexIter.forward_chars(2);
                                // Save current nextHexMark
@@ -125,20 +109,12 @@ public class moserial.HexTextBuffer : TextBuffer
                                TextIter tempIter;
                                tempIter = nextHexIter;
                                tempIter.forward_chars(2);
-#if VALA_0_16
                                this.delete(ref nextHexIter, ref tempIter);
-#else
-                               this.delete(nextHexIter, tempIter);
-#endif
                        }
                        // Put hex data at nextHexMark
                        this.get_iter_at_mark(out nextHexIter, nextHexMark);
                         incomingHexBuffer += "%02X ".printf(data);
-#if VALA_0_16
                        this.insert(ref nextHexIter, incomingHexBuffer, (int)incomingHexBuffer.length);
-#else
-                       this.insert(nextHexIter, incomingHexBuffer, (int)incomingHexBuffer.length);
-#endif
 
                         this.get_iter_at_mark(out nextHexIter, nextHexMark);
                         nextHexIter.forward_chars(incomingHexBuffer.length);
@@ -150,11 +126,7 @@ public class moserial.HexTextBuffer : TextBuffer
                         TextIter tempIter;
                         tempIter = nextHexIter;
                         tempIter.forward_chars(3);
-#if VALA_0_16
                        this.delete(ref nextHexIter, ref tempIter);
-#else
-                       this.delete(nextHexIter, tempIter);
-#endif                
                         incomingHexBuffer = "";
                         hexBytes++;
                         
@@ -163,20 +135,12 @@ public class moserial.HexTextBuffer : TextBuffer
                         unichar c = "%c".printf(data).get_char();
                         string s = "%c".printf(data);
                         if (s.validate() && c.isprint()) {
-#if VALA_0_16
                                this.insert(ref nextCharIter, s, (int)s.length);
-#else
-                               this.insert(nextCharIter, s, (int)s.length);
-#endif
                                this.get_iter_at_mark(out nextCharIter, nextCharMark);
                                nextCharIter.forward_chars(s.length);
                        }
                         else {
-#if VALA_0_16
                                this.insert(ref nextCharIter, ".", 1);
-#else
-                               this.insert(nextCharIter, ".", 1);
-#endif
                                this.get_iter_at_mark(out nextCharIter, nextCharMark);
                                nextCharIter.forward_chars(1);
                        }
diff --git a/src/MainWindow.vala b/src/MainWindow.vala
index 64e77e0..47bec6a 100644
--- a/src/MainWindow.vala
+++ b/src/MainWindow.vala
@@ -372,11 +372,7 @@ public class moserial.MainWindow : Gtk.Window //Have to extend Gtk.Winow to get
                }
 
                 buf.get_end_iter(out iter);
-#if VALA_0_16
                 buf.insert(ref iter, builder.str, (int)builder.str.length);
-#else
-               buf.insert(iter, builder.str, (int)builder.str.length);
-#endif
         }
 
         public void sendString(Widget w) {
diff --git a/src/MoUtils.vala b/src/MoUtils.vala
index 2277c82..3c66ac3 100644
--- a/src/MoUtils.vala
+++ b/src/MoUtils.vala
@@ -39,11 +39,7 @@ public class MoUtils : GLib.Object
        public static int64 fileSize (string path) {
                GLib.File file=newFile(path);
                try {
-#if VALA_0_16
                        GLib.FileInfo info=file.query_info(FileAttribute.STANDARD_SIZE,0,null);
-#else
-                       GLib.FileInfo info=file.query_info(GLib.FILE_ATTRIBUTE_STANDARD_SIZE,0,null);
-#endif
                        return info.get_size();
                 } catch (GLib.Error e) {
                         warning("%s", e.message);
diff --git a/src/SerialConnection.vala b/src/SerialConnection.vala
index 5a85036..f5025c0 100644
--- a/src/SerialConnection.vala
+++ b/src/SerialConnection.vala
@@ -68,14 +68,8 @@ public class moserial.SerialConnection : GLib.Object
                         return false;
                 }
                 Posix.tcflush(m_fd, Posix.TCIOFLUSH);
-//                int n = Posix.File.fcntl(m_fd, Posix.File.FDFlag.GETFL);
-//                Posix.File.fcntl_with_arg(m_fd, Posix.File.FDFlag.SETFL, n & 
~Posix.File.FileStatus.NDELAY);
 
-#if VALA_0_14
                 tcgetattr(m_fd, out restoretio);
-#else
-               tcgetattr(m_fd, restoretio);
-#endif
                 applySettings(settings);
                 tcsetattr(m_fd, Posix.TCSANOW, newtio);
 
@@ -208,13 +202,8 @@ public class moserial.SerialConnection : GLib.Object
                         break;
                 }
 
-#if VALA_0_14
                 Posix.cfsetospeed(ref newtio, baudRate);
                 Posix.cfsetispeed(ref newtio, baudRate);
-#else
-                Posix.cfsetospeed(newtio, baudRate);
-                Posix.cfsetispeed(newtio, baudRate);
-#endif
 
                 //DataBits
                 int dataBits;


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