Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=frugal-tweak.git;a=commitdiff;h=bf002a1d7ef018e8512e0b59b39689a629fc247e
commit bf002a1d7ef018e8512e0b59b39689a629fc247e Author: bouleetbil <bouleet...@frogdev.info> Date: Thu Sep 9 21:28:44 2010 +0200 *some fix *added connection auto diff --git a/frugal-irc/Main.cs b/frugal-irc/Main.cs index 4421649..01ee4e8 100644 --- a/frugal-irc/Main.cs +++ b/frugal-irc/Main.cs @@ -20,13 +20,22 @@ using Gtk; namespace frugalirc { - class MainClass - { + public class MainClass + { + public static string ChanParameter=""; public static void Main (string[] args) { - Application.Init (); - MainWindow win = new MainWindow (); - win.Show (); + Application.Init (); + if (args.Length>0) + { + ChanParameter="#"+args[0]; + Console.WriteLine("Connection to "+ChanParameter); + } + MainWindow win = new MainWindow (); + win.Show (); + //GUI readu + if (ChanParameter!="") + Gtk.Application.Invoke (delegate {win.Connection();}); Application.Run (); } } diff --git a/frugal-irc/MainWindow.cs b/frugal-irc/MainWindow.cs index 83e6c00..dde847e 100644 --- a/frugal-irc/MainWindow.cs +++ b/frugal-irc/MainWindow.cs @@ -20,7 +20,7 @@ using Gtk; using System.Threading; using System.Collections; using System.Collections.Generic; - +using frugalirc; using Meebey.SmartIrc4net; public partial class MainWindow : Gtk.Window @@ -28,8 +28,8 @@ public partial class MainWindow : Gtk.Window // make an instance of the high-level API public static IrcClient irc = new IrcClient(); private Thread T; - ListStore UpdateListUsers = new Gtk.ListStore (typeof (string)); - + ListStore UpdateListUsers = new Gtk.ListStore (typeof (string)); + private int MyRandom() { Random rndNumbers = new Random(); @@ -38,9 +38,11 @@ public partial class MainWindow : Gtk.Window return rndNumber; } + public MainWindow () : base(Gtk.WindowType.Toplevel) { Build (); + SAI_User.Text+=MyRandom().ToString(); //update package list // Create a column for the package name @@ -51,14 +53,22 @@ public partial class MainWindow : Gtk.Window Column.PackStart (NameCell, true); TREE_Users.AppendColumn (Column); Column.AddAttribute (NameCell, "text", 0); - TREE_Users.Model=UpdateListUsers; + TREE_Users.Model=UpdateListUsers; + if (MainClass.ChanParameter!="") + { + SAI_Chan.Text=MainClass.ChanParameter; + } } - + protected void OnDeleteEvent (object sender, DeleteEventArgs a) - { - Application.Quit (); - T.Abort(); - a.RetVal = true; + { + try + { + Application.Quit (); + T.Abort(); + a.RetVal = true; + } + catch{} } // this method we will use to analyse queries (also known as private messages) public void OnQueryMessage(object sender, IrcEventArgs e) @@ -267,15 +277,13 @@ public partial class MainWindow : Gtk.Window // join the channel irc.RfcJoin(channel); - for (int i = 0; i < 3; i++) { - // here we send just 3 different types of messages, 3 times for - // testing the delay and flood protection (messagebuffer work) - irc.SendMessage(SendType.Notice, channel, "Hello"); - irc.SendMessage(SendType.Message, channel, "Hello"); - //ask list users - irc.RfcList(channel); - } + // testing the delay and flood protection (messagebuffer work) + irc.SendMessage(SendType.Notice, channel, "Hello"); + irc.SendMessage(SendType.Message, channel, "Hello"); + //ask list users + irc.RfcList(channel); + BTN_Send.Visible=true; // spawn a new thread to read the stdin of the console, this we use // for reading IRC commands from the keyboard while the IRC connection // stays in its own thread @@ -325,6 +333,12 @@ public partial class MainWindow : Gtk.Window SAI_Envoi.Text=""; } + protected virtual void OnSAIEnvoiKeyPressEvent (object o, Gtk.KeyPressEventArgs args) + { + Console.WriteLine("Passe"); + } + + } diff --git a/frugal-irc/gtk-gui/MainWindow.cs b/frugal-irc/gtk-gui/MainWindow.cs index 79ef6e2..60031d0 100644 --- a/frugal-irc/gtk-gui/MainWindow.cs +++ b/frugal-irc/gtk-gui/MainWindow.cs @@ -187,6 +187,7 @@ public partial class MainWindow if ((this.Child != null)) { this.Child.ShowAll (); } + this.BTN_Send.Hide (); this.Show (); this.DeleteEvent += new global::Gtk.DeleteEventHandler (this.OnDeleteEvent); this.BTN_Connect.Clicked += new global::System.EventHandler (this.OnBTNConnectClicked); diff --git a/frugal-irc/gtk-gui/gui.stetic b/frugal-irc/gtk-gui/gui.stetic index 64e4ae2..2fe39fd 100644 --- a/frugal-irc/gtk-gui/gui.stetic +++ b/frugal-irc/gtk-gui/gui.stetic @@ -158,6 +158,7 @@ <child> <widget class="Gtk.Button" id="BTN_Send"> <property name="MemberName" /> + <property name="Visible">False</property> <property name="CanFocus">True</property> <property name="Type">TextOnly</property> <property name="Label" translatable="yes">Send</property> _______________________________________________ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git