[gnome-games/glchess-vala] Remove non-required GLib namespaces
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/glchess-vala] Remove non-required GLib namespaces
- Date: Sun, 2 Jan 2011 02:33:31 +0000 (UTC)
commit 0336b8408b574ebc904c2d42e0dfb691942cd283
Author: Robert Ancell <robert ancell canonical com>
Date: Sat Jan 1 12:42:50 2011 +1100
Remove non-required GLib namespaces
glchess/src/3ds.vala | 18 ++++++++--------
glchess/src/ai-profile.vala | 20 +++++++++---------
glchess/src/chess-engine-cecp.vala | 4 +-
glchess/src/chess-engine-uci.vala | 12 +++++-----
glchess/src/chess-engine.vala | 38 +++++++++++++++++-----------------
glchess/src/chess-game.vala | 12 +++++-----
glchess/src/chess-pgn.vala | 16 +++++++-------
glchess/src/chess-view-2d.vala | 2 +-
glchess/src/chess-view-3d.vala | 6 ++--
glchess/src/chess-view-options.vala | 2 +-
glchess/src/glchess.vala | 28 ++++++++++++------------
11 files changed, 79 insertions(+), 79 deletions(-)
---
diff --git a/glchess/src/3ds.vala b/glchess/src/3ds.vala
index c62dee6..0d44ce1 100644
--- a/glchess/src/3ds.vala
+++ b/glchess/src/3ds.vala
@@ -6,10 +6,10 @@ public class TDSModel
private GLushort[] triangles;
private GLfloat[] normals;
- public TDSModel (GLib.File file) throws GLib.Error
+ public TDSModel (File file) throws Error
{
var stream = file.read ();
- parse_block (stream, stream.query_info (GLib.FILE_ATTRIBUTE_STANDARD_SIZE).get_size ());
+ parse_block (stream, stream.query_info (FILE_ATTRIBUTE_STANDARD_SIZE).get_size ());
/* Calculate normals */
normals = new GLfloat[vertices.length];
@@ -55,7 +55,7 @@ public class TDSModel
}
}
- private void parse_block (GLib.FileInputStream stream, int64 length) throws GLib.Error
+ private void parse_block (FileInputStream stream, int64 length) throws Error
{
while (length > 6)
{
@@ -174,7 +174,7 @@ public class TDSModel
}
length -= block_length;
- //stream.seek (block_length - 6, GLib.SeekType.CUR);
+ //stream.seek (block_length - 6, SeekType.CUR);
}
if (length != 0)
@@ -195,28 +195,28 @@ public class TDSModel
glDisableClientState (GL_VERTEX_ARRAY);
}
- private uint8 read_uint8 (GLib.InputStream stream) throws GLib.Error
+ private uint8 read_uint8 (InputStream stream) throws Error
{
uchar buffer[1];
stream.read_all (buffer, null, null);
return buffer[0];
}
- private uint16 read_uint16 (GLib.InputStream stream) throws GLib.Error
+ private uint16 read_uint16 (InputStream stream) throws Error
{
uchar buffer[2];
stream.read_all (buffer, null, null);
return buffer[1] << 8 | buffer[0];
}
- private uint32 read_uint32 (GLib.InputStream stream) throws GLib.Error
+ private uint32 read_uint32 (InputStream stream) throws Error
{
uchar buffer[4];
stream.read_all (buffer, null, null);
return buffer[3] << 24 | buffer[2] << 16 | buffer[1] << 8 | buffer[0];
}
- private float read_float (GLib.InputStream stream) throws GLib.Error
+ private float read_float (InputStream stream) throws Error
{
uint8 buffer[4];
stream.read_all (buffer, null, null);
@@ -224,7 +224,7 @@ public class TDSModel
return fbuffer[0];
}
- private string read_string (GLib.InputStream stream) throws GLib.Error
+ private string read_string (InputStream stream) throws Error
{
var value = new StringBuilder();
while (true)
diff --git a/glchess/src/ai-profile.vala b/glchess/src/ai-profile.vala
index ab29ab9..f9ed93b 100644
--- a/glchess/src/ai-profile.vala
+++ b/glchess/src/ai-profile.vala
@@ -1,26 +1,26 @@
-public GLib.List<AIProfile> load_ai_profiles (string filename)
+public List<AIProfile> load_ai_profiles (string filename)
{
- var profiles = new GLib.List<AIProfile> ();
+ var profiles = new List<AIProfile> ();
- var file = new GLib.KeyFile ();
+ var file = new KeyFile ();
try
{
- file.load_from_file (filename, GLib.KeyFileFlags.NONE);
+ file.load_from_file (filename, KeyFileFlags.NONE);
}
- catch (GLib.KeyFileError e)
+ catch (KeyFileError e)
{
- GLib.warning ("Failed to load AI profiles: %s", e.message);
+ warning ("Failed to load AI profiles: %s", e.message);
return profiles;
}
- catch (GLib.FileError e)
+ catch (FileError e)
{
- GLib.warning ("Failed to load AI profiles: %s", e.message);
+ warning ("Failed to load AI profiles: %s", e.message);
return profiles;
}
foreach (string name in file.get_groups ())
{
- GLib.debug ("Loading AI profile %s", name);
+ debug ("Loading AI profile %s", name);
var profile = new AIProfile ();
try
{
@@ -30,7 +30,7 @@ public GLib.List<AIProfile> load_ai_profiles (string filename)
if (file.has_key (name, "args"))
profile.args = file.get_value (name, "args");
}
- catch (GLib.KeyFileError e)
+ catch (KeyFileError e)
{
continue;
}
diff --git a/glchess/src/chess-engine-cecp.vala b/glchess/src/chess-engine-cecp.vala
index fdeb9bc..340ae03 100644
--- a/glchess/src/chess-engine-cecp.vala
+++ b/glchess/src/chess-engine-cecp.vala
@@ -34,7 +34,7 @@ public class ChessEngineCECP : ChessEngine
buffer[offset] = '\0';
string line = (string) buffer;
- GLib.debug ("Read from engine: '%s'", line);
+ debug ("Read from engine: '%s'", line);
string[] move_prefixes = { "My move is: ", "my move is ", "move " };
foreach (string prefix in move_prefixes)
@@ -42,7 +42,7 @@ public class ChessEngineCECP : ChessEngine
if (line.has_prefix (prefix))
{
string move = line[prefix.length:line.length];
- GLib.debug ("Engine moves %s", move);
+ debug ("Engine moves %s", move);
moving = true;
moved (move);
}
diff --git a/glchess/src/chess-engine-uci.vala b/glchess/src/chess-engine-uci.vala
index 78fd3d3..58bc836 100644
--- a/glchess/src/chess-engine-uci.vala
+++ b/glchess/src/chess-engine-uci.vala
@@ -53,7 +53,7 @@ public class ChessEngineUCI : ChessEngine
buffer[offset] = '\0';
string line = (string) buffer;
- GLib.debug ("Read from engine: '%s'", line);
+ debug ("Read from engine: '%s'", line);
string[] tokens = line.split (" ");
if (tokens.length > 0)
@@ -65,22 +65,22 @@ public class ChessEngineUCI : ChessEngine
case "uciok":
if (tokens.length != 1)
- GLib.warning ("Unexpected arguments on uciok: %s", line);
+ warning ("Unexpected arguments on uciok: %s", line);
configure ();
break;
case "readyok":
if (tokens.length != 1)
- GLib.warning ("Unexpected arguments on readyok: %s", line);
+ warning ("Unexpected arguments on readyok: %s", line);
ready = true;
break;
case "bestmove":
if (tokens.length < 2)
- GLib.warning ("No move with bestmove: %s", line);
- GLib.debug ("Engine moves %s", tokens[1]);
+ warning ("No move with bestmove: %s", line);
+ debug ("Engine moves %s", tokens[1]);
moved (tokens[1]);
break;
@@ -91,7 +91,7 @@ public class ChessEngineUCI : ChessEngine
break;
default:
- GLib.warning ("Unknown command: '%s'", line);
+ warning ("Unknown command: '%s'", line);
break;
}
}
diff --git a/glchess/src/chess-engine.vala b/glchess/src/chess-engine.vala
index df1a4cb..ece5e4a 100644
--- a/glchess/src/chess-engine.vala
+++ b/glchess/src/chess-engine.vala
@@ -1,10 +1,10 @@
-public class ChessEngine : GLib.Object
+public class ChessEngine : Object
{
public string binary;
- private GLib.Pid pid;
+ private Pid pid;
private int stdin_fd;
private int stderr_fd;
- private GLib.IOChannel stdout_channel;
+ private IOChannel stdout_channel;
protected virtual void process_input (char[] data) {}
@@ -34,27 +34,27 @@ public class ChessEngine : GLib.Object
int stdout_fd;
try
{
- GLib.Process.spawn_async_with_pipes (null, argv, null,
- GLib.SpawnFlags.SEARCH_PATH,
+ Process.spawn_async_with_pipes (null, argv, null,
+ SpawnFlags.SEARCH_PATH,
null,
out pid, out stdin_fd, out stdout_fd, out stderr_fd);
}
- catch (GLib.SpawnError e)
+ catch (SpawnError e)
{
stderr.printf ("Failed to execute chess engine: %s\n", e.message);
return false;
}
- stdout_channel = new GLib.IOChannel.unix_new (stdout_fd);
+ stdout_channel = new IOChannel.unix_new (stdout_fd);
try
{
- stdout_channel.set_flags (GLib.IOFlags.NONBLOCK);
+ stdout_channel.set_flags (IOFlags.NONBLOCK);
}
- catch (GLib.IOChannelError e)
+ catch (IOChannelError e)
{
stderr.printf ("Failed to set input from chess engine to non-blocking: %s", e.message);
}
- stdout_channel.add_watch (GLib.IOCondition.IN, read_cb);
+ stdout_channel.add_watch (IOCondition.IN, read_cb);
starting ();
@@ -79,34 +79,34 @@ public class ChessEngine : GLib.Object
stopped ();
}
- private bool read_cb (GLib.IOChannel source, GLib.IOCondition condition)
+ private bool read_cb (IOChannel source, IOCondition condition)
{
char[] buf;
size_t n_read;
- GLib.IOStatus status;
+ IOStatus status;
buf = new char[1024];
try
{
status = source.read_chars (buf, out n_read);
}
- catch (GLib.ConvertError e)
+ catch (ConvertError e)
{
return false;
}
- catch (GLib.IOChannelError e)
+ catch (IOChannelError e)
{
return false;
}
- if (status == GLib.IOStatus.EOF)
+ if (status == IOStatus.EOF)
{
stdout.printf ("EOF\n");
return false;
}
- if (status == GLib.IOStatus.NORMAL)
+ if (status == IOStatus.NORMAL)
{
- //GLib.debug ("Read %zu octets from engine", n_read);
+ //debug ("Read %zu octets from engine", n_read);
buf.resize ((int) n_read);
process_input (buf);
}
@@ -130,7 +130,7 @@ public class ChessEngine : GLib.Object
if (n_written < 0)
return;
- //GLib.debug ("Wrote %zu octets to engine", n_written);
+ //debug ("Wrote %zu octets to engine", n_written);
offset += n_written;
}
@@ -139,7 +139,7 @@ public class ChessEngine : GLib.Object
protected void write_line (string line)
{
string l = line + "\n";
- GLib.debug ("Writing line to engine: '%s'", line);
+ debug ("Writing line to engine: '%s'", line);
char[] d = l.to_utf8 ();
if (d != null)
write (d);
diff --git a/glchess/src/chess-game.vala b/glchess/src/chess-game.vala
index d7408c6..ef5e418 100644
--- a/glchess/src/chess-game.vala
+++ b/glchess/src/chess-game.vala
@@ -4,7 +4,7 @@ public enum Color
BLACK
}
-public class ChessPlayer : GLib.Object
+public class ChessPlayer : Object
{
public Color color;
public signal void start_turn ();
@@ -697,7 +697,7 @@ public class ChessState
/* Don't have a destination to move to */
if (r1 < 0 || f1 < 0)
{
- GLib.debug ("Move %s missing destination", move);
+ debug ("Move %s missing destination", move);
return false;
}
@@ -728,7 +728,7 @@ public class ChessState
/* Duplicate match */
if (match_rank >= 0)
{
- GLib.debug ("Move %s is ambiguous", move);
+ debug ("Move %s is ambiguous", move);
return false;
}
@@ -739,7 +739,7 @@ public class ChessState
if (match_rank < 0)
{
- GLib.debug ("Move %s has no matches", move);
+ debug ("Move %s has no matches", move);
return false;
}
@@ -755,7 +755,7 @@ public class ChessState
if (move[i] != '\0')
{
- GLib.debug ("Move %s has unexpected characters", move);
+ debug ("Move %s has unexpected characters", move);
return false;
}
@@ -789,7 +789,7 @@ public class ChessGame
public bool is_started;
public ChessResult result;
public ChessRule rule;
- public GLib.List<ChessState> move_stack;
+ public List<ChessState> move_stack;
public signal void started ();
public signal void turn_started (ChessPlayer player);
diff --git a/glchess/src/chess-pgn.vala b/glchess/src/chess-pgn.vala
index f8dc29c..ab6229d 100644
--- a/glchess/src/chess-pgn.vala
+++ b/glchess/src/chess-pgn.vala
@@ -32,8 +32,8 @@ private int compare_tag (string name0, string name1)
public class PGNGame
{
- public GLib.HashTable<string, string> tags;
- public GLib.List<string> moves;
+ public HashTable<string, string> tags;
+ public List<string> moves;
public string event
{
@@ -93,7 +93,7 @@ public class PGNGame
public PGNGame ()
{
- tags = new GLib.HashTable<string, string> (str_hash, str_equal);
+ tags = new HashTable<string, string> (str_hash, str_equal);
tags.insert ("Event", "?");
tags.insert ("Site", "?");
tags.insert ("Date", "????.??.??");
@@ -103,11 +103,11 @@ public class PGNGame
tags.insert ("Result", "*");
}
- public void write (OutputStream stream) throws GLib.Error
+ public void write (OutputStream stream) throws Error
{
// FIXME: Escape \ and " in tag values
var keys = tags.get_keys ();
- keys.sort ((GLib.CompareFunc) compare_tag);
+ keys.sort ((CompareFunc) compare_tag);
foreach (var key in keys)
write_string (stream, "[%s \"%s\"]\n".printf (key, tags.lookup (key)));
write_string (stream, "\n");
@@ -125,7 +125,7 @@ public class PGNGame
write_string (stream, "\n");
}
- private void write_string (OutputStream stream, string value) throws GLib.Error
+ private void write_string (OutputStream stream, string value) throws Error
{
stream.write_all ((uint8[]) value, null);
}
@@ -148,13 +148,13 @@ enum State
public class PGN
{
- public GLib.List<PGNGame> games;
+ public List<PGNGame> games;
public PGN ()
{
}
- public PGN.from_file (GLib.File file) throws GLib.Error
+ public PGN.from_file (File file) throws Error
{
string contents;
size_t n_read;
diff --git a/glchess/src/chess-view-2d.vala b/glchess/src/chess-view-2d.vala
index e81205f..dc43a62 100644
--- a/glchess/src/chess-view-2d.vala
+++ b/glchess/src/chess-view-2d.vala
@@ -177,7 +177,7 @@ private class ChessView2D : ChessView
{
handle = new Rsvg.Handle.from_file (Path.build_filename (Config.PKGDATADIR, "pieces", options.theme_name, file_name + ".svg", null));
}
- catch (GLib.Error e)
+ catch (Error e)
{
stderr.printf ("Failed to load piece svg: %s", e.message);
handle = null;
diff --git a/glchess/src/chess-view-3d.vala b/glchess/src/chess-view-3d.vala
index e3355ef..35e0509 100644
--- a/glchess/src/chess-view-3d.vala
+++ b/glchess/src/chess-view-3d.vala
@@ -51,7 +51,7 @@ private class ChessView3D : ChessView
queen_model = new TDSModel (File.new_for_path (Path.build_filename (Config.PKGDATADIR, "pieces", "3d", "queen.3ds", null)));
king_model = new TDSModel (File.new_for_path (Path.build_filename (Config.PKGDATADIR, "pieces", "3d", "king.3ds", null)));
}
- catch (GLib.Error e)
+ catch (Error e)
{
}
create_board ();
@@ -128,13 +128,13 @@ private class ChessView3D : ChessView
var screen = Gdk.x11_screen_get_screen_number (get_screen ());
var visual = glXChooseVisual (display, screen, attributes);
if (visual == null)
- GLib.warning ("Failed to get GLX visual");
+ warning ("Failed to get GLX visual");
else
{
context = glXCreateContext (display, visual, null, true);
GLX.Context null_context = (GLX.Context) null;
if (context == null_context)
- GLib.warning ("Failed to create GLX context");
+ warning ("Failed to create GLX context");
}
}
diff --git a/glchess/src/chess-view-options.vala b/glchess/src/chess-view-options.vala
index 7128b9b..9df917c 100644
--- a/glchess/src/chess-view-options.vala
+++ b/glchess/src/chess-view-options.vala
@@ -1,4 +1,4 @@
-public class ChessViewOptions : GLib.Object
+public class ChessViewOptions : Object
{
public signal void changed ();
diff --git a/glchess/src/glchess.vala b/glchess/src/glchess.vala
index ba0971a..27afe6d 100644
--- a/glchess/src/glchess.vala
+++ b/glchess/src/glchess.vala
@@ -1,6 +1,6 @@
public class Application
{
- private GLib.Settings settings;
+ private Settings settings;
private History history;
private Gtk.Builder builder;
private Gtk.Builder preferences_builder;
@@ -34,13 +34,13 @@ public class Application
private Gtk.AboutDialog? about_dialog = null;
private ChessGame game;
- private GLib.List<AIProfile> ai_profiles;
+ private List<AIProfile> ai_profiles;
private ChessPlayer? opponent = null;
private ChessEngine? opponent_engine = null;
public Application ()
{
- settings = new GLib.Settings ("org.gnome.glchess.Settings");
+ settings = new Settings ("org.gnome.glchess.Settings");
var data_dir = File.new_for_path (Path.build_filename (Environment.get_user_data_dir (), "glchess", null));
DirUtils.create_with_parents (data_dir.get_path (), 0755);
@@ -54,7 +54,7 @@ public class Application
}
catch (Error e)
{
- GLib.warning ("Could not load UI: %s", e.message);
+ warning ("Could not load UI: %s", e.message);
}
window = (Gtk.Window) builder.get_object ("glchess_app");
save_menu = (Gtk.Widget) builder.get_object ("menu_save_item");
@@ -212,7 +212,7 @@ public class Application
}
if (profile == null)
{
- GLib.warning ("Unknown AI profile %s", name);
+ warning ("Unknown AI profile %s", name);
if (ai_profiles == null)
return null;
profile = ai_profiles.data;
@@ -224,7 +224,7 @@ public class Application
engine = new ChessEngineUCI ();
else
{
- GLib.warning ("Unknown AI protocol %s", profile.protocol);
+ warning ("Unknown AI protocol %s", profile.protocol);
return null;
}
engine.binary = profile.binary;
@@ -236,7 +236,7 @@ public class Application
{
ai_profiles = load_ai_profiles (Path.build_filename (Config.PKGDATADIR, "engines.conf", null));
foreach (var profile in ai_profiles)
- GLib.message ("Detected AI profile %s", profile.name);
+ message ("Detected AI profile %s", profile.name);
if (game == null)
{
@@ -545,7 +545,7 @@ public class Application
[CCode (cname = "G_MODULE_EXPORT undo_move_cb", instance_pos = -1)]
public void undo_move_cb (Gtk.Widget widget)
{
- GLib.warning ("FIXME: Undo last move");
+ warning ("FIXME: Undo last move");
}
[CCode (cname = "G_MODULE_EXPORT quit_cb", instance_pos = -1)]
@@ -635,7 +635,7 @@ public class Application
}
catch (Error e)
{
- GLib.warning ("Could not load preferences UI: %s", e.message);
+ warning ("Could not load preferences UI: %s", e.message);
}
preferences_dialog = (Gtk.Dialog) preferences_builder.get_object ("preferences");
@@ -900,7 +900,7 @@ public class Application
}
catch (Error e)
{
- GLib.warning ("Unable to open help: %s", e.message);
+ warning ("Unable to open help: %s", e.message);
}
}
@@ -1035,7 +1035,7 @@ public class Application
try
{
- var stream = save_dialog.get_file ().replace (null, false, GLib.FileCreateFlags.NONE);
+ var stream = save_dialog.get_file ().replace (null, false, FileCreateFlags.NONE);
pgn.write (stream);
}
catch (Error e)
@@ -1125,7 +1125,7 @@ public class Application
game = new ChessGame (pgn_game.fen);
else
{
- GLib.warning ("Chess game has SetUp tag but no FEN tag");
+ warning ("Chess game has SetUp tag but no FEN tag");
game = new ChessGame ();
}
}
@@ -1135,10 +1135,10 @@ public class Application
start_game (game);
foreach (var move in pgn_game.moves)
{
- GLib.debug ("Move: %s", move);
+ debug ("Move: %s", move);
if (!game.current_player.move (move))
{
- GLib.warning ("Invalid move: %s", move);
+ warning ("Invalid move: %s", move);
break;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]