Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugal-tweak.git;a=commitdiff;h=d7ffb3e29378da460e75ffc2906992adc01b8e40

commit d7ffb3e29378da460e75ffc2906992adc01b8e40
Author: bouleetbil <bouleet...@frogdev.info>
Date:   Sat Nov 13 17:44:52 2010 +0100

*added MessageBox for confirm some operations

diff --git a/frugal-mono-tools/MessageBox.cs b/frugal-mono-tools/MessageBox.cs
new file mode 100644
index 0000000..7fa4af1
--- /dev/null
+++ b/frugal-mono-tools/MessageBox.cs
@@ -0,0 +1,45 @@
+// /*
+//  *  Copyright (C) 2010 by Gaetan Gourdin <bouleet...@frogdev.info>
+//  *
+//  *  This program is free software; you can redistribute it and/or modify
+//  *  it under the terms of the GNU General Public License as published by
+//  *  the Free Software Foundation; either version 2 of the License, or
+//  *  (at your option) any later version.
+//  *
+//  *  This program is distributed in the hope that it will be useful,
+//  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  *  GNU General Public License for more details.
+//  *
+//  *  You should have received a copy of the GNU General Public License
+//  *  along with this program; if not, write to the Free Software
+//  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 
USA.
+//  */
+using System;
+namespace frugalmonotools
+{
+       public partial class MessageBox : Gtk.Dialog
+       {
+
+               protected virtual void OnButtonOkClicked (object sender, 
System.EventArgs e)
+               {
+                       Outils.ResultAsk=true;
+                       this.Destroy();
+               }
+
+
+               public MessageBox (string message)
+               {
+                       this.Build ();
+                       LIB_Message.Text=message;
+               }
+               protected virtual void OnButtonCancelClicked (object sender, 
System.EventArgs e)
+               {
+                       Outils.ResultAsk=false;
+                       this.Destroy();
+               }
+
+
+       }
+}
+
diff --git a/frugal-mono-tools/OUTILS/Outils.cs 
b/frugal-mono-tools/OUTILS/Outils.cs
index c4b2e87..4b1e1db 100644
--- a/frugal-mono-tools/OUTILS/Outils.cs
+++ b/frugal-mono-tools/OUTILS/Outils.cs
@@ -23,6 +23,13 @@ namespace frugalmonotools
{
public static class Outils
{
+               public static bool ResultAsk ;
+               public static bool Ask(string message)
+               {
+                       MessageBox dialog = new MessageBox(message);
+                       dialog.Run();
+                       return ResultAsk;
+               }
public static List<string>  WalkDirectoryTree(System.IO.DirectoryInfo 
root,string pattern)
{
List<string>  strFiles = new List<string>();
diff --git a/frugal-mono-tools/Pictures/WID_Users.cs 
b/frugal-mono-tools/Pictures/WID_Users.cs
index 837efd0..b9f22dc 100644
--- a/frugal-mono-tools/Pictures/WID_Users.cs
+++ b/frugal-mono-tools/Pictures/WID_Users.cs
@@ -187,6 +187,7 @@ namespace frugalmonotools
{
//remove group
if(GroupSelect=="") return;
+                       if(!Outils.Ask("Remove "+GroupSelect+" ?") )return;
Outils.ExcecuteAsRoot("/usr/sbin/groupdel "+GroupSelect,true);
_InitGroup();
}
diff --git a/frugal-mono-tools/frugal-mono-tools.csproj 
b/frugal-mono-tools/frugal-mono-tools.csproj
index 05dc5c2..a79a0d6 100644
--- a/frugal-mono-tools/frugal-mono-tools.csproj
+++ b/frugal-mono-tools/frugal-mono-tools.csproj
@@ -149,6 +149,8 @@
<Compile Include="Groups.cs" />
<Compile Include="Pictures\WID_Users.cs" />
<Compile Include="gtk-gui\frugalmonotools.WID_Users.cs" />
+    <Compile Include="MessageBox.cs" />
+    <Compile Include="gtk-gui\frugalmonotools.MessageBox.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
diff --git a/frugal-mono-tools/gtk-gui/frugalmonotools.MessageBox.cs 
b/frugal-mono-tools/gtk-gui/frugalmonotools.MessageBox.cs
new file mode 100644
index 0000000..d044677
--- /dev/null
+++ b/frugal-mono-tools/gtk-gui/frugalmonotools.MessageBox.cs
@@ -0,0 +1,86 @@
+
+// This file has been generated by the GUI designer. Do not modify.
+namespace frugalmonotools
+{
+       public partial class MessageBox
+       {
+               private global::Gtk.VBox vbox2;
+
+               private global::Gtk.Label LIB_Message;
+
+               private global::Gtk.Button buttonCancel;
+
+               private global::Gtk.Button buttonOk;
+
+               protected virtual void Build ()
+               {
+                       global::Stetic.Gui.Initialize (this);
+                       // Widget frugalmonotools.MessageBox
+                       this.Name = "frugalmonotools.MessageBox";
+                       this.Title = global::Mono.Unix.Catalog.GetString 
("Information");
+                       this.WindowPosition = ((global::Gtk.WindowPosition)(4));
+                       this.AllowShrink = true;
+                       this.DefaultHeight = 100;
+                       // Internal child frugalmonotools.MessageBox.VBox
+                       global::Gtk.VBox w1 = this.VBox;
+                       w1.Name = "dialog1_VBox";
+                       w1.BorderWidth = ((uint)(2));
+                       // Container child dialog1_VBox.Gtk.Box+BoxChild
+                       this.vbox2 = new global::Gtk.VBox ();
+                       this.vbox2.Name = "vbox2";
+                       this.vbox2.Spacing = 6;
+                       // Container child vbox2.Gtk.Box+BoxChild
+                       this.LIB_Message = new global::Gtk.Label ();
+                       this.LIB_Message.Name = "LIB_Message";
+                       this.LIB_Message.LabelProp = 
global::Mono.Unix.Catalog.GetString ("label1");
+                       this.vbox2.Add (this.LIB_Message);
+                       global::Gtk.Box.BoxChild w2 = 
((global::Gtk.Box.BoxChild)(this.vbox2[this.LIB_Message]));
+                       w2.Position = 0;
+                       w2.Expand = false;
+                       w2.Fill = false;
+                       w1.Add (this.vbox2);
+                       global::Gtk.Box.BoxChild w3 = 
((global::Gtk.Box.BoxChild)(w1[this.vbox2]));
+                       w3.Position = 0;
+                       w3.Expand = false;
+                       w3.Fill = false;
+                       // Internal child frugalmonotools.MessageBox.ActionArea
+                       global::Gtk.HButtonBox w4 = this.ActionArea;
+                       w4.Name = "dialog1_ActionArea";
+                       w4.Spacing = 10;
+                       w4.BorderWidth = ((uint)(5));
+                       w4.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4));
+                       // Container child 
dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
+                       this.buttonCancel = new global::Gtk.Button ();
+                       this.buttonCancel.CanDefault = true;
+                       this.buttonCancel.CanFocus = true;
+                       this.buttonCancel.Name = "buttonCancel";
+                       this.buttonCancel.UseStock = true;
+                       this.buttonCancel.UseUnderline = true;
+                       this.buttonCancel.Label = "gtk-cancel";
+                       this.AddActionWidget (this.buttonCancel, -6);
+                       global::Gtk.ButtonBox.ButtonBoxChild w5 = 
((global::Gtk.ButtonBox.ButtonBoxChild)(w4[this.buttonCancel]));
+                       w5.Expand = false;
+                       w5.Fill = false;
+                       // Container child 
dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
+                       this.buttonOk = new global::Gtk.Button ();
+                       this.buttonOk.CanDefault = true;
+                       this.buttonOk.CanFocus = true;
+                       this.buttonOk.Name = "buttonOk";
+                       this.buttonOk.UseStock = true;
+                       this.buttonOk.UseUnderline = true;
+                       this.buttonOk.Label = "gtk-ok";
+                       this.AddActionWidget (this.buttonOk, -5);
+                       global::Gtk.ButtonBox.ButtonBoxChild w6 = 
((global::Gtk.ButtonBox.ButtonBoxChild)(w4[this.buttonOk]));
+                       w6.Position = 1;
+                       w6.Expand = false;
+                       w6.Fill = false;
+                       if ((this.Child != null)) {
+                               this.Child.ShowAll ();
+                       }
+                       this.DefaultWidth = 400;
+                       this.Show ();
+                       this.buttonCancel.Clicked += new 
global::System.EventHandler (this.OnButtonCancelClicked);
+                       this.buttonOk.Clicked += new 
global::System.EventHandler (this.OnButtonOkClicked);
+               }
+       }
+}
diff --git a/frugal-mono-tools/gtk-gui/gui.stetic 
b/frugal-mono-tools/gtk-gui/gui.stetic
index c4ef7b4..7586758 100644
--- a/frugal-mono-tools/gtk-gui/gui.stetic
+++ b/frugal-mono-tools/gtk-gui/gui.stetic
@@ -3848,4 +3848,87 @@ Public License instead of this License.
</widget>
</child>
</widget>
+  <widget class="Gtk.Dialog" id="frugalmonotools.MessageBox" design-size="400 
300">
+    <property name="MemberName" />
+    <property name="Title" translatable="yes">Information</property>
+    <property name="WindowPosition">CenterOnParent</property>
+    <property name="AllowShrink">True</property>
+    <property name="DefaultHeight">100</property>
+    <property name="Buttons">2</property>
+    <property name="HelpButton">False</property>
+    <child internal-child="VBox">
+      <widget class="Gtk.VBox" id="dialog1_VBox">
+        <property name="MemberName" />
+        <property name="BorderWidth">2</property>
+        <child>
+          <widget class="Gtk.VBox" id="vbox2">
+            <property name="MemberName" />
+            <property name="Spacing">6</property>
+            <child>
+              <widget class="Gtk.Label" id="LIB_Message">
+                <property name="MemberName" />
+                <property name="LabelProp" translatable="yes">label1</property>
+              </widget>
+              <packing>
+                <property name="Position">0</property>
+                <property name="AutoSize">True</property>
+                <property name="Expand">False</property>
+                <property name="Fill">False</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="Position">0</property>
+            <property name="AutoSize">True</property>
+            <property name="Expand">False</property>
+            <property name="Fill">False</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+    <child internal-child="ActionArea">
+      <widget class="Gtk.HButtonBox" id="dialog1_ActionArea">
+        <property name="MemberName" />
+        <property name="Spacing">10</property>
+        <property name="BorderWidth">5</property>
+        <property name="Size">2</property>
+        <property name="LayoutStyle">End</property>
+        <child>
+          <widget class="Gtk.Button" id="buttonCancel">
+            <property name="MemberName" />
+            <property name="CanDefault">True</property>
+            <property name="CanFocus">True</property>
+            <property name="UseStock">True</property>
+            <property name="Type">StockItem</property>
+            <property name="StockId">gtk-cancel</property>
+            <property name="ResponseId">-6</property>
+            <signal name="Clicked" handler="OnButtonCancelClicked" />
+            <property name="label">gtk-cancel</property>
+          </widget>
+          <packing>
+            <property name="Expand">False</property>
+            <property name="Fill">False</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="Gtk.Button" id="buttonOk">
+            <property name="MemberName" />
+            <property name="CanDefault">True</property>
+            <property name="CanFocus">True</property>
+            <property name="UseStock">True</property>
+            <property name="Type">StockItem</property>
+            <property name="StockId">gtk-ok</property>
+            <property name="ResponseId">-5</property>
+            <signal name="Clicked" handler="OnButtonOkClicked" />
+            <property name="label">gtk-ok</property>
+          </widget>
+          <packing>
+            <property name="Position">1</property>
+            <property name="Expand">False</property>
+            <property name="Fill">False</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
</stetic-interface>
\ No newline at end of file
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to