Skip to content

Commit

Permalink
Move to g_message instead of g_debug
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveDavenport committed Jan 7, 2012
1 parent bf60a69 commit cd92c49
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 38 deletions.
12 changes: 6 additions & 6 deletions Actions/ExternalTool.vala
Expand Up @@ -45,12 +45,12 @@ namespace IfThenElse
private void child_watch_called(GLib.Pid p, int status)
{
GLib.Process.close_pid(p);
GLib.debug("Child watch called.\n");
GLib.message("Child watch called.\n");
pid = 0;
}
private void start_application()
{
GLib.debug("%s: %s", this.name, "start application");
GLib.message("%s: %s", this.name, "start application");
if(kill_child)
{
stop_application();
Expand All @@ -59,13 +59,13 @@ namespace IfThenElse
if(pid == 0)
{
string[] argv;
GLib.debug("Start application\n");
GLib.message("Start application\n");
try {
GLib.Shell.parse_argv(cmd, out argv);

foreach (var s in argv)
{
GLib.debug("argv: %s\n", s);
GLib.message("argv: %s\n", s);
}
GLib.Process.spawn_async(null, argv, null, SpawnFlags.SEARCH_PATH|SpawnFlags.DO_NOT_REAP_CHILD, null, out pid);

Expand All @@ -79,7 +79,7 @@ namespace IfThenElse
{
if(pid > 0)
{
GLib.debug("%s: Killing pid: %i\n",this.name, (int)pid);
GLib.message("%s: Killing pid: %i\n",this.name, (int)pid);
Posix.kill((pid_t)pid, 1);
}
}
Expand All @@ -90,7 +90,7 @@ namespace IfThenElse
}
public void Deactivate()
{
GLib.debug("%s: Deactivate\n", this.name);
GLib.message("%s: Deactivate\n", this.name);
stop_application();
}
/**
Expand Down
2 changes: 1 addition & 1 deletion Actions/MultiAction.vala
Expand Up @@ -61,7 +61,7 @@ namespace IfThenElse
*/
public void Deactivate()
{
GLib.debug("%s: Deactivate\n", this.name);
GLib.message("%s: Deactivate\n", this.name);
foreach(BaseAction action in actions)
{
action.Deactivate();
Expand Down
2 changes: 1 addition & 1 deletion Base/BaseClass.vala
Expand Up @@ -55,7 +55,7 @@ namespace IfThenElse

~Base()
{
GLib.debug("Destroying: %s\n", this.name);
GLib.message("Destroying: %s\n", this.name);
}
/**
* Check if it is a toplevel object.
Expand Down
8 changes: 4 additions & 4 deletions Base/Parser.vala
Expand Up @@ -43,7 +43,7 @@ namespace IfThenElse
*/
~Parser()
{
GLib.debug("Destroying parser\n");
GLib.message("Destroying parser\n");
}

/**
Expand All @@ -56,7 +56,7 @@ namespace IfThenElse
foreach(string group in kf.get_groups())
{
var str_tp = kf.get_string(group, "type");
GLib.debug("Creating object: %s\n", group);
GLib.message("Creating object: %s\n", group);
GLib.Type tp = GLib.Type.from_name("IfThenElse"+str_tp);
if(tp == 0) {
GLib.error("Failed to lookup type: %s for %s\n",str_tp, group);
Expand All @@ -82,13 +82,13 @@ namespace IfThenElse
}catch(GLib.KeyFileError e) {
GLib.error("Failed to parse keyfile: %s", e.message);
}
GLib.debug("=== %s ===\n", group);
GLib.message("=== %s ===\n", group);
foreach(var prop in keys)
{
// Skip the "Type" field.
if(prop == "type") continue;

GLib.debug("Setting property: %s\n", prop);
GLib.message("Setting property: %s\n", prop);

// Load property
unowned ParamSpec? ps = object.get_class().find_property(prop);
Expand Down
4 changes: 2 additions & 2 deletions Checks/BaseCheck.vala
Expand Up @@ -62,7 +62,7 @@ namespace IfThenElse
public void Activate()
{
BaseCheck.StateType state = this.check();
GLib.debug("%s Activate: %i\n", this.name, (int)state);
GLib.message("%s Activate: %i\n", this.name, (int)state);
// If no change, do nothing.
if(state == BaseCheck.StateType.NO_CHANGE)
return;
Expand All @@ -87,7 +87,7 @@ namespace IfThenElse
*/
public void Deactivate()
{
GLib.debug("%s Deactivate\n", this.name);
GLib.message("%s Deactivate\n", this.name);
// Deactivate both.
if(_then_action != null)
_then_action.Deactivate();
Expand Down
2 changes: 1 addition & 1 deletion Checks/ExternalToolCheck.vala
Expand Up @@ -93,7 +93,7 @@ namespace IfThenElse
GLib.Process.spawn_command_line_sync(cmd,
out output, null, out exit_value);
exit_value = GLib.Process.exit_status(exit_value);
GLib.debug("output: %i:%s vs %s\n", exit_value, output, output_compare);
GLib.message("output: %i:%s vs %s\n", exit_value, output, output_compare);
if(output_compare == null)
{
if(compare_old_state)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -10,7 +10,7 @@ PACKAGE_CHECK=.pkgcheck
# VALAC magic.
VALAC=valac
VALAC_PACKAGES=$(foreach PKG, $(PACKAGES), --pkg=$(PKG))
VALAC_FLAGS=-g $(VALAC_PACKAGES) --vapidir=./Vapi/ --pkg=posix
VALAC_FLAGS=-g $(VALAC_PACKAGES) --vapidir=./Vapi/ --pkg=posix
VALADOC_DRIVER?=$(shell valac --version | awk -F' ' '{c= split($$2,B,"\."); printf "%s.%s.x", B[1], B[2]}')


Expand Down
4 changes: 2 additions & 2 deletions Triggers/BaseTrigger.vala
Expand Up @@ -48,7 +48,7 @@ namespace IfThenElse

public void Deactivate()
{
GLib.debug("%s: Deactivate\n", this.name);
GLib.message("%s: Deactivate\n", this.name);
if(_action != null) {
_action.Deactivate();
}
Expand All @@ -59,7 +59,7 @@ namespace IfThenElse
*/
public void fire()
{
GLib.debug("Fire trigger: %p\n", _action);
GLib.message("Fire trigger: %p\n", _action);
if(_action != null) {
_action.Activate();
}
Expand Down
8 changes: 4 additions & 4 deletions Triggers/ExternalToolTrigger.vala
Expand Up @@ -55,7 +55,7 @@ namespace IfThenElse
private void child_watch_called(GLib.Pid p, int status)
{
GLib.Process.close_pid(pid);
GLib.debug("Child watch called.\n");
GLib.message("Child watch called.\n");
pid = 0;
if(status == 0)
{
Expand All @@ -68,13 +68,13 @@ namespace IfThenElse
if(pid == 0)
{
string[] argv;
GLib.debug("Start application\n");
GLib.message("Start application\n");
try {
GLib.Shell.parse_argv(cmd, out argv);

foreach (var s in argv)
{
GLib.debug("argv: %s\n", s);
GLib.message("argv: %s\n", s);
}
GLib.Process.spawn_async(null, argv, null, SpawnFlags.SEARCH_PATH|SpawnFlags.DO_NOT_REAP_CHILD, null, out pid);

Expand All @@ -88,7 +88,7 @@ namespace IfThenElse
{
if(pid > 0)
{
GLib.debug("%s: Killing pid: %i\n",this.name, (int)pid);
GLib.message("%s: Killing pid: %i\n",this.name, (int)pid);
Posix.kill((pid_t)pid, 1);
}
}
Expand Down
12 changes: 6 additions & 6 deletions Triggers/OutputWatch.vala
Expand Up @@ -73,11 +73,11 @@ namespace IfThenElse
size_t length, term_pos;
try{
source.read_line(out retv, out length, out term_pos);
GLib.debug("Read: %s\n", retv);
GLib.message("Read: %s\n", retv);
// continue to watch.
var regex = new GLib.Regex (fire_regex);
if(regex.match(retv)) {
GLib.debug("Fire: %s\n", retv);
GLib.message("Fire: %s\n", retv);
this.fire();
}
}catch(GLib.Error e) {
Expand All @@ -94,7 +94,7 @@ namespace IfThenElse
private void child_watch_called(GLib.Pid p, int status)
{
GLib.Process.close_pid(p);
GLib.debug("Child watch called: %i.\n", (int)p);
GLib.message("Child watch called: %i.\n", (int)p);
pid = 0;
if(output_watch > 0){
GLib.Source.remove(output_watch);
Expand All @@ -116,14 +116,14 @@ namespace IfThenElse
if(pid == 0)
{
string[] argv;
GLib.debug("Start application\n");
GLib.message("Start application\n");
try {
int standard_output = -1;
GLib.Shell.parse_argv(cmd, out argv);

foreach (var s in argv)
{
GLib.debug("argv: %s\n", s);
GLib.message("argv: %s\n", s);
}
GLib.Process.spawn_async_with_pipes(
null, argv, null,
Expand All @@ -143,7 +143,7 @@ namespace IfThenElse
{
if(pid > 0)
{
GLib.debug("%s: Killing pid: %i\n",this.name, (int)pid);
GLib.message("%s: Killing pid: %i\n",this.name, (int)pid);
Posix.kill((pid_t)pid, 1);
// Disconnect all signals.
child_watch_called(pid, 1);
Expand Down
2 changes: 1 addition & 1 deletion Triggers/TimeTrigger.vala
Expand Up @@ -143,7 +143,7 @@ namespace IfThenElse
// time has past, so next day.
remaining_time+=24*60*60;
}
GLib.debug("Remaining seconds: %i\n", remaining_time);
GLib.message("Remaining seconds: %i\n", remaining_time);

handler = GLib.Timeout.add_seconds(remaining_time, timer_callback);

Expand Down
2 changes: 1 addition & 1 deletion Triggers/Timer.vala
Expand Up @@ -72,7 +72,7 @@ namespace IfThenElse
*/
private bool timer_callback()
{
GLib.debug("Timer fire\n");
GLib.message("Timer fire\n");
this.fire();
return true;
}
Expand Down
17 changes: 9 additions & 8 deletions main.vala
Expand Up @@ -259,7 +259,7 @@ namespace IfThenElse
*/
private void reload_files()
{
GLib.debug("Reload....");
GLib.message("Reload....");
stop();
load_argument();
start();
Expand All @@ -284,12 +284,12 @@ namespace IfThenElse
quit_program();

if (strsignal (signo) != null) {
GLib.debug ("Received signal:%d->'%s'", signo, strsignal (signo));
GLib.message ("Received signal:%d->'%s'", signo, strsignal (signo));
}
break;
default:
if (strsignal (signo) != null) {
GLib.debug ("Received signal:%d->'%s'", signo, strsignal (signo));
GLib.message ("Received signal:%d->'%s'", signo, strsignal (signo));
}
break;
}
Expand All @@ -303,7 +303,7 @@ namespace IfThenElse
{
if(force || GLib.Regex.match_simple(".*\\.ife$", file))
{
GLib.debug("Load file: %s", file);
GLib.message("Load file: %s", file);
try{
parser.add_from_file(file);
}catch(GLib.Error e) {
Expand All @@ -313,7 +313,7 @@ namespace IfThenElse
}
else
{
GLib.debug("Ignoring: %s\n", file);
GLib.message("Ignoring: %s\n", file);
}
}
/**
Expand Down Expand Up @@ -467,7 +467,8 @@ namespace IfThenElse

// Log handler
GLib.Log.set_handler(null,
GLib.LogLevelFlags.LEVEL_INFO|GLib.LogLevelFlags.LEVEL_DEBUG,
GLib.LogLevelFlags.LEVEL_INFO|GLib.LogLevelFlags.LEVEL_DEBUG|
GLib.LogLevelFlags.LEVEL_MESSAGE,
my_log_handler);

// Load the setup file.
Expand Down Expand Up @@ -510,10 +511,10 @@ namespace IfThenElse
start();
loop.run();

GLib.debug("Quit....");
GLib.message("Quit....");

stop();
GLib.debug("Cleanup....");
GLib.message("Cleanup....");
// Destroy
parser = null;
return 0;
Expand Down

0 comments on commit cd92c49

Please sign in to comment.