From 9e3b1112646950c591e5f7c031df26d3d1b7ab23 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Fri, 15 May 2015 10:47:23 +0800 Subject: [PATCH] src/Spawn.vala.c --- src/Main.vala | 2 +- src/Palete/RooDatabase.vala | 18 +++++++++++++----- src/Project/Gtk.vala | 18 +++++++++--------- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/Main.vala b/src/Main.vala index 6542d1bf1..41f65c64b 100644 --- a/src/Main.vala +++ b/src/Main.vala @@ -13,7 +13,7 @@ int main (string[] args) { var app = BuilderApplication.singleton( args); - if (BuilderApplication.opt_debug) || BuilderApplication.opt_compile_project == null) { + if (BuilderApplication.opt_debug || BuilderApplication.opt_compile_project == null) { GLib.Log.set_handler(null, GLib.LogLevelFlags.LEVEL_DEBUG | GLib.LogLevelFlags.LEVEL_WARNING, (dom, lvl, msg) => { diff --git a/src/Palete/RooDatabase.vala b/src/Palete/RooDatabase.vala index 2f367d235..f0d448c47 100644 --- a/src/Palete/RooDatabase.vala +++ b/src/Palete/RooDatabase.vala @@ -25,6 +25,11 @@ namespace Palete { this.project = project; this.DBTYPE = this.project.get_string_member("DBTYPE"); this.DBNAME = this.project.get_string_member("DBNAME"); + if (this.DBTYPE.length < 1) { + return; + } + + try { this.cnc = Gda.Connection.open_from_string ( @@ -35,11 +40,11 @@ namespace Palete { Gda.ConnectionOptions.NONE ); } catch(Gda.ConfigError e) { - print("%s\n", e.message); + GLib.warning("%s\n", e.message); this.cnc = null; this.DBTYPE = ""; } catch(Gda.ConnectionError e) { - print("%s\n", e.message); + GLib.warning("%s\n", e.message); this.cnc = null; this.DBTYPE = ""; } @@ -86,7 +91,7 @@ namespace Palete { if (this.DBTYPE == "MySQL") { return this.fetchAll(this.cnc.execute_select_command( "SHOW TABLES" )); } - print("Read tables failed DBTYPE = %s\n", this.DBTYPE); + GLib.warning("Read tables failed DBTYPE = %s\n", this.DBTYPE); return new Json.Array(); } @@ -189,7 +194,10 @@ namespace Palete { } var contents = jarr.get_string_element(0); - print(contents); + GLib.debug(contents); + if (contents == null) { + return ret; + } GLib.Regex exp = /FK\(([^\)]+)\)/; string str = ""; @@ -198,7 +206,7 @@ namespace Palete { if ( exp.match (contents, 0, out mi) ) { str = mi.fetch(1); - print("match = %s", str); + GLib.debug("match = %s", str); } } catch (GLib.Error e) { return ret; diff --git a/src/Project/Gtk.vala b/src/Project/Gtk.vala index abebe8bc1..95a4ee425 100644 --- a/src/Project/Gtk.vala +++ b/src/Project/Gtk.vala @@ -46,7 +46,7 @@ namespace Project { var fn = this.firstPath() + "/config1.builder"; - print("load: " + fn ); + GLib.debug("load: " + fn ); if (!FileUtils.test(fn, FileTest.EXISTS)) { this.compilegroups.set("_default_", new GtkValaSettings("_default_") ); @@ -71,7 +71,7 @@ namespace Project { } this.compilegroups.set(vs.name,vs); } - print("%s\n",this.configToString ()); + GLib.debug("%s\n",this.configToString ()); } public string configToString() @@ -95,7 +95,7 @@ namespace Project { public void writeConfig() { var fn = this.firstPath() + "/config1.builder"; - print("write: " + fn ); + GLib.debug("write: " + fn ); var f = GLib.File.new_for_path(fn); @@ -145,13 +145,13 @@ namespace Project { var dirname = this.resolve_path( this.resolve_path_combine_path(this.firstPath(),in_path)); - print("SCAN %s\n", dirname); + GLib.debug("SCAN %s\n", dirname); // scan the directory for files -- ending with vala || c var dir = File.new_for_path(dirname); if (!dir.query_exists()) { - print("SCAN %s - skip - does not exist\n", dirname); + GLib.debug("SCAN %s - skip - does not exist\n", dirname); return ret; } @@ -168,7 +168,7 @@ namespace Project { while ((next_file = file_enum.next_file(null)) != null) { var fn = next_file.get_display_name(); - print("SCAN %s - checking %s\n", dirname, fn); + GLib.debug("SCAN %s - checking %s\n", dirname, fn); if (Regex.match_simple("\\.vala$", fn)) { ret.add(in_path + "/" + fn); continue; @@ -202,9 +202,9 @@ namespace Project { } catch(Error e) { - print("oops - something went wrong scanning the projects\n"); + GLib.warning("oops - something went wrong scanning the projects\n"); } - print("SCAN %s = returning %d", dirname, ret.size); + GLib.debug("SCAN %s = returning %d", dirname, ret.size); return ret; @@ -286,7 +286,7 @@ namespace Project { var path = this.resolve_path( this.firstPath(), sources.get(i)); if (Path.get_basename (path) == "vapi") { - print("Adding VAPIDIR: %s\n", path); + GLib.debug("Adding VAPIDIR: %s\n", path); ret += path; } -- 2.39.2