2002-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>

* sample/DbClient/client.cs: updated to make it compile.

svn path=/trunk/gtk-sharp/; revision=7256
This commit is contained in:
Gonzalo Paniagua Javier 2002-09-05 01:43:04 +00:00
parent ab081f8358
commit e233ca8d49
2 changed files with 25 additions and 19 deletions

View File

@ -1,3 +1,7 @@
2002-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* sample/DbClient/client.cs: updated to make it compile.
2002-09-04 Mike Kestner <mkestner@speakeasy.net> 2002-09-04 Mike Kestner <mkestner@speakeasy.net>
* generator/ObjectGen.cs : generate dtors. * generator/ObjectGen.cs : generate dtors.

View File

@ -44,7 +44,7 @@ class Client {
PackToolbar (); PackToolbar ();
box.PackStart (toolbar, false, false, 0); box.PackStart (toolbar, false, false, 0);
UpdateView (); UpdateView (null);
status = new Statusbar (); status = new Statusbar ();
box.PackEnd (status, false, false, 0); box.PackEnd (status, false, false, 0);
@ -72,24 +72,24 @@ class Client {
{ {
toolbar.AppendItem ("Insert", "Insert a row", String.Empty, toolbar.AppendItem ("Insert", "Insert a row", String.Empty,
new Gtk.Image (Stock.Add, IconSize.LargeToolbar), new Gtk.Image (Stock.Add, IconSize.LargeToolbar),
new SignalFunc (Db_Insert), IntPtr.Zero); new SignalFunc (Db_Insert));
toolbar.AppendItem ("Remove", "Remove a row", String.Empty, toolbar.AppendItem ("Remove", "Remove a row", String.Empty,
new Gtk.Image (Stock.Remove, IconSize.LargeToolbar), new Gtk.Image (Stock.Remove, IconSize.LargeToolbar),
new SignalFunc (Db_Remove), IntPtr.Zero); new SignalFunc (Db_Remove));
toolbar.AppendItem ("Update", "Update a row", String.Empty, toolbar.AppendItem ("Update", "Update a row", String.Empty,
new Gtk.Image (Stock.Italic, IconSize.LargeToolbar), new Gtk.Image (Stock.Italic, IconSize.LargeToolbar),
new SignalFunc (Db_Update), IntPtr.Zero); new SignalFunc (Db_Update));
toolbar.AppendItem ("Refresh", "Refresh the view", String.Empty, toolbar.AppendItem ("Refresh", "Refresh the view", String.Empty,
new Gtk.Image (Stock.Refresh, IconSize.LargeToolbar), new Gtk.Image (Stock.Refresh, IconSize.LargeToolbar),
new SignalFunc (UpdateView), IntPtr.Zero); new SignalFunc (UpdateView));
toolbar.AppendSpace (); toolbar.AppendSpace ();
toolbar.InsertStock (Stock.Quit, "Quit", String.Empty, toolbar.InsertStock (Stock.Quit, "Quit", String.Empty,
new SignalFunc (Quit), IntPtr.Zero, -1); new SignalFunc (Quit), -1);
toolbar.ToolbarStyle = ToolbarStyle.BothHoriz; toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
} }
@ -100,7 +100,7 @@ class Client {
args.RetVal = true; args.RetVal = true;
} }
static void UpdateView () static void UpdateView (Gtk.Object o)
{ {
if (tableau != null) if (tableau != null)
tableau.Destroy (); tableau.Destroy ();
@ -165,7 +165,7 @@ class Client {
t.Attach (label, 2, 3, 0, 1); t.Attach (label, 2, 3, 0, 1);
} }
static void Db_Insert () static void Db_Insert (Gtk.Object o)
{ {
if (dialog != null) { if (dialog != null) {
return; return;
@ -195,7 +195,7 @@ class Client {
dialog.ShowAll (); dialog.ShowAll ();
} }
static void Db_Remove () static void Db_Remove (Gtk.Object o)
{ {
if (dialog != null) { if (dialog != null) {
return; return;
@ -259,7 +259,7 @@ class Client {
return hbox ; return hbox ;
} }
static void Db_Update () static void Db_Update (Gtk.Object o)
{ {
if (dialog != null) { if (dialog != null) {
return; return;
@ -288,7 +288,7 @@ class Client {
dialog.ShowAll (); dialog.ShowAll ();
} }
static void Quit () static void Quit (Gtk.Object o)
{ {
Application.Quit (); Application.Quit ();
} }
@ -297,7 +297,7 @@ class Client {
{ {
try { try {
Conn.Insert (UInt32.Parse (id_entry.Text), name_entry.Text, address_entry.Text); Conn.Insert (UInt32.Parse (id_entry.Text), name_entry.Text, address_entry.Text);
UpdateView (); UpdateView (o as Gtk.Object);
} catch (Exception e) { } catch (Exception e) {
PushMessage (e.Message); PushMessage (e.Message);
} }
@ -309,7 +309,7 @@ class Client {
{ {
try { try {
Conn.Delete (UInt32.Parse (id_entry.Text)); Conn.Delete (UInt32.Parse (id_entry.Text));
UpdateView (); UpdateView (o as Gtk.Object);
} catch (Exception e) { } catch (Exception e) {
PushMessage (e.Message); PushMessage (e.Message);
} }
@ -321,7 +321,7 @@ class Client {
{ {
try { try {
Conn.Update (UInt32.Parse (id_entry.Text), name_entry.Text, address_entry.Text); Conn.Update (UInt32.Parse (id_entry.Text), name_entry.Text, address_entry.Text);
UpdateView (); UpdateView (o as Gtk.Object);
} catch (Exception e) { } catch (Exception e) {
PushMessage (e.Message); PushMessage (e.Message);
} }
@ -384,17 +384,17 @@ class Client {
static void Insert_Activated (object o, EventArgs args) static void Insert_Activated (object o, EventArgs args)
{ {
Db_Insert (); Db_Insert (o as Gtk.Object);
} }
static void Remove_Activated (object o, EventArgs args) static void Remove_Activated (object o, EventArgs args)
{ {
Db_Remove (); Db_Remove (o as Gtk.Object);
} }
static void Update_Activated (object o, EventArgs args) static void Update_Activated (object o, EventArgs args)
{ {
Db_Update (); Db_Update (o as Gtk.Object);
} }
static void Quit_Activated (object o, EventArgs args) static void Quit_Activated (object o, EventArgs args)
@ -410,11 +410,13 @@ class Client {
}; };
string [] documenters = new string [] {}; string [] documenters = new string [] {};
Gdk.Pixbuf pixbuf = new Gdk.Pixbuf ("../pixmaps/gtk-sharp-logo.png");
Gnome.About about = new Gnome.About ("Database Client", "0.1", Gnome.About about = new Gnome.About ("Database Client", "0.1",
"Copyright (C) 2002, Ximian Inc.", "Copyright (C) 2002, Ximian Inc.",
"A Sample Database client", "A Sample Database client",
authors, documenters, "", new Gdk.Pixbuf ()); authors, documenters, "", pixbuf);
about.Show (); about.Show ();
} }
@ -452,7 +454,7 @@ class IdConnection : IDisposable
cnc = new SqlConnection (); cnc = new SqlConnection ();
string connectionString = "" + string connectionString = "" +
"" + "" +
"" + "user=monotest;" +
"dbname=monotest"; "dbname=monotest";
cnc.ConnectionString = connectionString; cnc.ConnectionString = connectionString;