[blam] Port a couple of dialogs to stetic
- From: Carlos MartÃn Nieto <cmartin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [blam] Port a couple of dialogs to stetic
- Date: Sat, 18 Aug 2012 12:40:18 +0000 (UTC)
commit 2cd2df18c10ed5a3a406761e65a7303867de47ad
Author: Carlos MartÃn Nieto <carlos cmartin tk>
Date: Sat Aug 18 14:39:46 2012 +0200
Port a couple of dialogs to stetic
blam.csproj | 15 +-
gtk-gui/Imendio.Blam.AddChannelDialog.cs | 171 +++++++++++
gtk-gui/generated.cs | 29 ++
gtk-gui/gui.stetic | 470 ++++++++++++++++++++++++++++++
src/AddChannelDialog.cs | 50 ++++
src/Application.cs | 23 ++-
src/Dialogs.cs | 93 ------
7 files changed, 748 insertions(+), 103 deletions(-)
---
diff --git a/blam.csproj b/blam.csproj
index 7850a01..eba27b2 100644
--- a/blam.csproj
+++ b/blam.csproj
@@ -7,7 +7,7 @@
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{4E407663-2362-4FCD-BC45-A772920BB32F}</ProjectGuid>
<OutputType>WinExe</OutputType>
- <RootNamespace>blam</RootNamespace>
+ <RootNamespace>Imendio.Blam</RootNamespace>
<AssemblyName>blam</AssemblyName>
<ReleaseVersion>1.9.10</ReleaseVersion>
<StartupObject>Imendio.Blam.Application</StartupObject>
@@ -68,14 +68,13 @@
<Package>notify-sharp</Package>
</Reference>
<Reference Include="System.Web" />
- <Reference Include="gconf-sharp, Version=2.24.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
- <Private>False</Private>
- <Package>gconf-sharp-2.0</Package>
- </Reference>
<Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<Private>False</Private>
<Package>gtk-sharp-2.0</Package>
</Reference>
+ <Reference Include="gconf-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
+ <Package>gconf-sharp-2.0</Package>
+ </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="src\Application.cs" />
@@ -106,6 +105,9 @@
<Compile Include="src\gtk-sharp-beans\Global.cs" />
<Compile Include="src\Defines.cs" />
<Compile Include="src\Channel.cs" />
+ <Compile Include="gtk-gui\generated.cs" />
+ <Compile Include="gtk-gui\Imendio.Blam.AddChannelDialog.cs" />
+ <Compile Include="src\AddChannelDialog.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
@@ -125,6 +127,9 @@
<EmbeddedResource Include="icons\blam-edit-news.png">
<LogicalName>blam-edit-news.png</LogicalName>
</EmbeddedResource>
+ <EmbeddedResource Include="gtk-gui\gui.stetic">
+ <LogicalName>gui.stetic</LogicalName>
+ </EmbeddedResource>
</ItemGroup>
<ProjectExtensions>
<MonoDevelop>
diff --git a/gtk-gui/Imendio.Blam.AddChannelDialog.cs b/gtk-gui/Imendio.Blam.AddChannelDialog.cs
new file mode 100644
index 0000000..a35053e
--- /dev/null
+++ b/gtk-gui/Imendio.Blam.AddChannelDialog.cs
@@ -0,0 +1,171 @@
+
+// This file has been generated by the GUI designer. Do not modify.
+namespace Imendio.Blam
+{
+ public partial class AddChannelDialog
+ {
+ private global::Gtk.HBox hbox1;
+ private global::Gtk.Image image1;
+ private global::Gtk.Label label1;
+ private global::Gtk.Table table1;
+ private global::Gtk.Label label2;
+ private global::Gtk.Label label3;
+ private global::Gtk.Label label4;
+ private global::Gtk.Entry PasswordEntry;
+ private global::Gtk.Entry UrlEntry;
+ private global::Gtk.Entry UsernameEntry;
+ private global::Gtk.Button buttonCancel;
+ private global::Gtk.Button buttonOk;
+
+ protected virtual void Build ()
+ {
+ global::Stetic.Gui.Initialize (this);
+ // Widget Imendio.Blam.AddChannelDialog
+ this.Name = "Imendio.Blam.AddChannelDialog";
+ this.WindowPosition = ((global::Gtk.WindowPosition)(4));
+ // Internal child Imendio.Blam.AddChannelDialog.VBox
+ global::Gtk.VBox w1 = this.VBox;
+ w1.Name = "dialog1_VBox";
+ w1.BorderWidth = ((uint)(2));
+ // Container child dialog1_VBox.Gtk.Box+BoxChild
+ this.hbox1 = new global::Gtk.HBox ();
+ this.hbox1.Name = "hbox1";
+ this.hbox1.Spacing = 6;
+ // Container child hbox1.Gtk.Box+BoxChild
+ this.image1 = new global::Gtk.Image ();
+ this.image1.Name = "image1";
+ this.image1.Pixbuf = global::Gdk.Pixbuf.LoadFromResource ("blam-add-news.png");
+ this.hbox1.Add (this.image1);
+ global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.image1]));
+ w2.Position = 0;
+ w2.Expand = false;
+ w2.Fill = false;
+ // Container child hbox1.Gtk.Box+BoxChild
+ this.label1 = new global::Gtk.Label ();
+ this.label1.Name = "label1";
+ this.label1.LabelProp = global::Mono.Unix.Catalog.GetString ("Enter the URL of the new channel");
+ this.hbox1.Add (this.label1);
+ global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.label1]));
+ w3.Position = 1;
+ w3.Expand = false;
+ w3.Fill = false;
+ w1.Add (this.hbox1);
+ global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(w1 [this.hbox1]));
+ w4.Position = 0;
+ w4.Expand = false;
+ w4.Fill = false;
+ // Container child dialog1_VBox.Gtk.Box+BoxChild
+ this.table1 = new global::Gtk.Table (((uint)(3)), ((uint)(2)), false);
+ this.table1.Name = "table1";
+ this.table1.RowSpacing = ((uint)(6));
+ this.table1.ColumnSpacing = ((uint)(6));
+ // Container child table1.Gtk.Table+TableChild
+ this.label2 = new global::Gtk.Label ();
+ this.label2.Name = "label2";
+ this.label2.LabelProp = global::Mono.Unix.Catalog.GetString ("URL");
+ this.table1.Add (this.label2);
+ global::Gtk.Table.TableChild w5 = ((global::Gtk.Table.TableChild)(this.table1 [this.label2]));
+ w5.XOptions = ((global::Gtk.AttachOptions)(4));
+ w5.YOptions = ((global::Gtk.AttachOptions)(4));
+ // Container child table1.Gtk.Table+TableChild
+ this.label3 = new global::Gtk.Label ();
+ this.label3.Name = "label3";
+ this.label3.LabelProp = global::Mono.Unix.Catalog.GetString ("Username");
+ this.table1.Add (this.label3);
+ global::Gtk.Table.TableChild w6 = ((global::Gtk.Table.TableChild)(this.table1 [this.label3]));
+ w6.TopAttach = ((uint)(1));
+ w6.BottomAttach = ((uint)(2));
+ w6.XOptions = ((global::Gtk.AttachOptions)(4));
+ w6.YOptions = ((global::Gtk.AttachOptions)(4));
+ // Container child table1.Gtk.Table+TableChild
+ this.label4 = new global::Gtk.Label ();
+ this.label4.Name = "label4";
+ this.label4.LabelProp = global::Mono.Unix.Catalog.GetString ("Password");
+ this.table1.Add (this.label4);
+ global::Gtk.Table.TableChild w7 = ((global::Gtk.Table.TableChild)(this.table1 [this.label4]));
+ w7.TopAttach = ((uint)(2));
+ w7.BottomAttach = ((uint)(3));
+ w7.XOptions = ((global::Gtk.AttachOptions)(4));
+ w7.YOptions = ((global::Gtk.AttachOptions)(4));
+ // Container child table1.Gtk.Table+TableChild
+ this.PasswordEntry = new global::Gtk.Entry ();
+ this.PasswordEntry.CanFocus = true;
+ this.PasswordEntry.Name = "PasswordEntry";
+ this.PasswordEntry.IsEditable = true;
+ this.PasswordEntry.InvisibleChar = 'â';
+ this.table1.Add (this.PasswordEntry);
+ global::Gtk.Table.TableChild w8 = ((global::Gtk.Table.TableChild)(this.table1 [this.PasswordEntry]));
+ w8.TopAttach = ((uint)(2));
+ w8.BottomAttach = ((uint)(3));
+ w8.LeftAttach = ((uint)(1));
+ w8.RightAttach = ((uint)(2));
+ w8.YOptions = ((global::Gtk.AttachOptions)(4));
+ // Container child table1.Gtk.Table+TableChild
+ this.UrlEntry = new global::Gtk.Entry ();
+ this.UrlEntry.CanFocus = true;
+ this.UrlEntry.Name = "UrlEntry";
+ this.UrlEntry.IsEditable = true;
+ this.UrlEntry.InvisibleChar = 'â';
+ this.table1.Add (this.UrlEntry);
+ global::Gtk.Table.TableChild w9 = ((global::Gtk.Table.TableChild)(this.table1 [this.UrlEntry]));
+ w9.LeftAttach = ((uint)(1));
+ w9.RightAttach = ((uint)(2));
+ w9.YOptions = ((global::Gtk.AttachOptions)(4));
+ // Container child table1.Gtk.Table+TableChild
+ this.UsernameEntry = new global::Gtk.Entry ();
+ this.UsernameEntry.CanFocus = true;
+ this.UsernameEntry.Name = "UsernameEntry";
+ this.UsernameEntry.IsEditable = true;
+ this.UsernameEntry.InvisibleChar = 'â';
+ this.table1.Add (this.UsernameEntry);
+ global::Gtk.Table.TableChild w10 = ((global::Gtk.Table.TableChild)(this.table1 [this.UsernameEntry]));
+ w10.TopAttach = ((uint)(1));
+ w10.BottomAttach = ((uint)(2));
+ w10.LeftAttach = ((uint)(1));
+ w10.RightAttach = ((uint)(2));
+ w10.YOptions = ((global::Gtk.AttachOptions)(4));
+ w1.Add (this.table1);
+ global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(w1 [this.table1]));
+ w11.Position = 1;
+ w11.Expand = false;
+ w11.Fill = false;
+ // Internal child Imendio.Blam.AddChannelDialog.ActionArea
+ global::Gtk.HButtonBox w12 = this.ActionArea;
+ w12.Name = "dialog1_ActionArea";
+ w12.Spacing = 10;
+ w12.BorderWidth = ((uint)(5));
+ w12.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 w13 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w12 [this.buttonCancel]));
+ w13.Expand = false;
+ w13.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 w14 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w12 [this.buttonOk]));
+ w14.Position = 1;
+ w14.Expand = false;
+ w14.Fill = false;
+ if ((this.Child != null)) {
+ this.Child.ShowAll ();
+ }
+ this.DefaultWidth = 400;
+ this.DefaultHeight = 300;
+ this.Show ();
+ }
+ }
+}
diff --git a/gtk-gui/generated.cs b/gtk-gui/generated.cs
new file mode 100644
index 0000000..9636f6f
--- /dev/null
+++ b/gtk-gui/generated.cs
@@ -0,0 +1,29 @@
+
+// This file has been generated by the GUI designer. Do not modify.
+namespace Stetic
+{
+ internal class Gui
+ {
+ private static bool initialized;
+
+ internal static void Initialize (Gtk.Widget iconRenderer)
+ {
+ if ((Stetic.Gui.initialized == false)) {
+ Stetic.Gui.initialized = true;
+ }
+ }
+ }
+
+ internal class ActionGroups
+ {
+ public static Gtk.ActionGroup GetActionGroup (System.Type type)
+ {
+ return Stetic.ActionGroups.GetActionGroup (type.FullName);
+ }
+
+ public static Gtk.ActionGroup GetActionGroup (string name)
+ {
+ return null;
+ }
+ }
+}
diff --git a/gtk-gui/gui.stetic b/gtk-gui/gui.stetic
new file mode 100644
index 0000000..961f76c
--- /dev/null
+++ b/gtk-gui/gui.stetic
@@ -0,0 +1,470 @@
+ï<?xml version="1.0" encoding="utf-8"?>
+<stetic-interface>
+ <configuration>
+ <images-root-path>..</images-root-path>
+ <target-gtk-version>2.12</target-gtk-version>
+ </configuration>
+ <import>
+ <widget-library name="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ <widget-library name="webkit-sharp, Version=1.1.15.0, Culture=neutral, PublicKeyToken=eaa1d335d2e19745" />
+ <widget-library name="notify-sharp, Version=0.4.0.0, Culture=neutral, PublicKeyToken=2df29c54e245917a" />
+ <widget-library name="../bin/Debug/blam.exe" internal="true" />
+ </import>
+ <widget class="Gtk.Dialog" id="Imendio.Blam.AddChannelDialog" design-size="400 420">
+ <property name="MemberName" />
+ <property name="Visible">False</property>
+ <property name="Title" translatable="yes">Add a channel</property>
+ <property name="TypeHint">Dialog</property>
+ <property name="WindowPosition">CenterOnParent</property>
+ <property name="Modal">True</property>
+ <property name="AllowGrow">False</property>
+ <property name="AllowShrink">True</property>
+ <property name="DestroyWithParent">True</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">6</property>
+ <child>
+ <widget class="Gtk.HBox" id="hbox1">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.Image" id="image1">
+ <property name="MemberName" />
+ <property name="Pixbuf">resource:blam-add-news.png</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>
+ <child>
+ <widget class="Gtk.Label" id="label1">
+ <property name="MemberName" />
+ <property name="LabelProp" translatable="yes">Enter the URL of the new channel</property>
+ </widget>
+ <packing>
+ <property name="Position">1</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>
+ <child>
+ <widget class="Gtk.Table" id="table1">
+ <property name="MemberName" />
+ <property name="NRows">3</property>
+ <property name="NColumns">2</property>
+ <property name="RowSpacing">6</property>
+ <property name="ColumnSpacing">6</property>
+ <child>
+ <widget class="Gtk.Label" id="label2">
+ <property name="MemberName" />
+ <property name="LabelProp" translatable="yes">URL</property>
+ </widget>
+ <packing>
+ <property name="AutoSize">True</property>
+ <property name="XOptions">Fill</property>
+ <property name="YOptions">Fill</property>
+ <property name="XExpand">False</property>
+ <property name="XFill">True</property>
+ <property name="XShrink">False</property>
+ <property name="YExpand">False</property>
+ <property name="YFill">True</property>
+ <property name="YShrink">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Label" id="label3">
+ <property name="MemberName" />
+ <property name="LabelProp" translatable="yes">Username</property>
+ </widget>
+ <packing>
+ <property name="TopAttach">1</property>
+ <property name="BottomAttach">2</property>
+ <property name="AutoSize">True</property>
+ <property name="XOptions">Fill</property>
+ <property name="YOptions">Fill</property>
+ <property name="XExpand">False</property>
+ <property name="XFill">True</property>
+ <property name="XShrink">False</property>
+ <property name="YExpand">False</property>
+ <property name="YFill">True</property>
+ <property name="YShrink">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Label" id="label4">
+ <property name="MemberName" />
+ <property name="LabelProp" translatable="yes">Password</property>
+ </widget>
+ <packing>
+ <property name="TopAttach">2</property>
+ <property name="BottomAttach">3</property>
+ <property name="AutoSize">True</property>
+ <property name="XOptions">Fill</property>
+ <property name="YOptions">Fill</property>
+ <property name="XExpand">False</property>
+ <property name="XFill">True</property>
+ <property name="XShrink">False</property>
+ <property name="YExpand">False</property>
+ <property name="YFill">True</property>
+ <property name="YShrink">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Entry" id="PasswordEntry">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="IsEditable">True</property>
+ <property name="InvisibleChar">â</property>
+ <signal name="Activated" handler="OnEntryActivated" />
+ </widget>
+ <packing>
+ <property name="TopAttach">2</property>
+ <property name="BottomAttach">3</property>
+ <property name="LeftAttach">1</property>
+ <property name="RightAttach">2</property>
+ <property name="AutoSize">True</property>
+ <property name="YOptions">Fill</property>
+ <property name="XExpand">True</property>
+ <property name="XFill">True</property>
+ <property name="XShrink">False</property>
+ <property name="YExpand">False</property>
+ <property name="YFill">True</property>
+ <property name="YShrink">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Entry" id="UrlEntry">
+ <property name="MemberName">UrlEntry</property>
+ <property name="CanFocus">True</property>
+ <property name="IsEditable">True</property>
+ <property name="InvisibleChar">â</property>
+ <signal name="Activated" handler="OnEntryActivated" />
+ </widget>
+ <packing>
+ <property name="LeftAttach">1</property>
+ <property name="RightAttach">2</property>
+ <property name="AutoSize">True</property>
+ <property name="YOptions">Fill</property>
+ <property name="XExpand">True</property>
+ <property name="XFill">True</property>
+ <property name="XShrink">False</property>
+ <property name="YExpand">False</property>
+ <property name="YFill">True</property>
+ <property name="YShrink">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Entry" id="UsernameEntry">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="IsEditable">True</property>
+ <property name="InvisibleChar">â</property>
+ <signal name="Activated" handler="OnEntryActivated" />
+ </widget>
+ <packing>
+ <property name="TopAttach">1</property>
+ <property name="BottomAttach">2</property>
+ <property name="LeftAttach">1</property>
+ <property name="RightAttach">2</property>
+ <property name="AutoSize">True</property>
+ <property name="YOptions">Fill</property>
+ <property name="XExpand">True</property>
+ <property name="XFill">True</property>
+ <property name="XShrink">False</property>
+ <property name="YExpand">False</property>
+ <property name="YFill">True</property>
+ <property name="YShrink">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">False</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="CanFocus">True</property>
+ <property name="UseStock">True</property>
+ <property name="Type">StockItem</property>
+ <property name="StockId">gtk-cancel</property>
+ <property name="ResponseId">-6</property>
+ <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>
+ <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>
+ <widget class="Gtk.Dialog" id="Imendio.Blam.AddChannelDialog" design-size="400 300">
+ <property name="MemberName" />
+ <property name="WindowPosition">CenterOnParent</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.HBox" id="hbox1">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.Image" id="image1">
+ <property name="MemberName" />
+ <property name="Pixbuf">resource:blam-add-news.png</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>
+ <child>
+ <widget class="Gtk.Label" id="label1">
+ <property name="MemberName" />
+ <property name="LabelProp" translatable="yes">Enter the URL of the new channel</property>
+ </widget>
+ <packing>
+ <property name="Position">1</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>
+ <child>
+ <widget class="Gtk.Table" id="table1">
+ <property name="MemberName" />
+ <property name="NRows">3</property>
+ <property name="NColumns">2</property>
+ <property name="RowSpacing">6</property>
+ <property name="ColumnSpacing">6</property>
+ <child>
+ <widget class="Gtk.Label" id="label2">
+ <property name="MemberName" />
+ <property name="LabelProp" translatable="yes">URL</property>
+ </widget>
+ <packing>
+ <property name="AutoSize">True</property>
+ <property name="XOptions">Fill</property>
+ <property name="YOptions">Fill</property>
+ <property name="XExpand">False</property>
+ <property name="XFill">True</property>
+ <property name="XShrink">False</property>
+ <property name="YExpand">False</property>
+ <property name="YFill">True</property>
+ <property name="YShrink">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Label" id="label3">
+ <property name="MemberName" />
+ <property name="LabelProp" translatable="yes">Username</property>
+ </widget>
+ <packing>
+ <property name="TopAttach">1</property>
+ <property name="BottomAttach">2</property>
+ <property name="AutoSize">True</property>
+ <property name="XOptions">Fill</property>
+ <property name="YOptions">Fill</property>
+ <property name="XExpand">False</property>
+ <property name="XFill">True</property>
+ <property name="XShrink">False</property>
+ <property name="YExpand">False</property>
+ <property name="YFill">True</property>
+ <property name="YShrink">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Label" id="label4">
+ <property name="MemberName" />
+ <property name="LabelProp" translatable="yes">Password</property>
+ </widget>
+ <packing>
+ <property name="TopAttach">2</property>
+ <property name="BottomAttach">3</property>
+ <property name="AutoSize">True</property>
+ <property name="XOptions">Fill</property>
+ <property name="YOptions">Fill</property>
+ <property name="XExpand">False</property>
+ <property name="XFill">True</property>
+ <property name="XShrink">False</property>
+ <property name="YExpand">False</property>
+ <property name="YFill">True</property>
+ <property name="YShrink">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Entry" id="PasswordEntry">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="IsEditable">True</property>
+ <property name="InvisibleChar">â</property>
+ </widget>
+ <packing>
+ <property name="TopAttach">2</property>
+ <property name="BottomAttach">3</property>
+ <property name="LeftAttach">1</property>
+ <property name="RightAttach">2</property>
+ <property name="AutoSize">True</property>
+ <property name="YOptions">Fill</property>
+ <property name="XExpand">True</property>
+ <property name="XFill">True</property>
+ <property name="XShrink">False</property>
+ <property name="YExpand">False</property>
+ <property name="YFill">True</property>
+ <property name="YShrink">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Entry" id="UrlEntry">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="IsEditable">True</property>
+ <property name="InvisibleChar">â</property>
+ </widget>
+ <packing>
+ <property name="LeftAttach">1</property>
+ <property name="RightAttach">2</property>
+ <property name="AutoSize">True</property>
+ <property name="YOptions">Fill</property>
+ <property name="XExpand">True</property>
+ <property name="XFill">True</property>
+ <property name="XShrink">False</property>
+ <property name="YExpand">False</property>
+ <property name="YFill">True</property>
+ <property name="YShrink">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Entry" id="UsernameEntry">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="IsEditable">True</property>
+ <property name="InvisibleChar">â</property>
+ </widget>
+ <packing>
+ <property name="TopAttach">1</property>
+ <property name="BottomAttach">2</property>
+ <property name="LeftAttach">1</property>
+ <property name="RightAttach">2</property>
+ <property name="AutoSize">True</property>
+ <property name="YOptions">Fill</property>
+ <property name="XExpand">True</property>
+ <property name="XFill">True</property>
+ <property name="XShrink">False</property>
+ <property name="YExpand">False</property>
+ <property name="YFill">True</property>
+ <property name="YShrink">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">1</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>
+ <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>
+ <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
diff --git a/src/AddChannelDialog.cs b/src/AddChannelDialog.cs
new file mode 100644
index 0000000..961ed4b
--- /dev/null
+++ b/src/AddChannelDialog.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Linq;
+using Gtk;
+
+namespace Imendio.Blam
+{
+ public partial class AddChannelDialog : Gtk.Dialog
+ {
+ public AddChannelDialog(Gtk.Window window)
+ {
+ this.Build();
+ this.TransientFor = window;
+ buttonOk.Sensitive = false;
+ var clipboard = Gtk.Clipboard.Get(Gdk.Atom.Intern("CLIPBOARD", true));
+ clipboard.RequestText((c, text) => {
+ if (!String.IsNullOrEmpty(text) && new[] {"http://", "https://"}.Any((p) => text.StartsWith(p))) {
+ Url = text;
+ } else {
+ Url = String.Empty;
+ }
+ });
+
+ UrlEntry.Activated += OnEntryActivated;
+ UsernameEntry.Activated += OnEntryActivated;
+ PasswordEntry.Activated += OnEntryActivated;
+
+ UrlEntry.Changed += (sender, e) => buttonOk.Sensitive = !String.IsNullOrEmpty(Url);
+ }
+
+ public string Username {
+ get { return UsernameEntry.Text; }
+ }
+
+ public string Password {
+ get { return PasswordEntry.Text; }
+ }
+
+ public string Url {
+ get { return UrlEntry.Text; }
+ set { UrlEntry.Text = value; }
+ }
+
+ protected void OnEntryActivated (object sender, EventArgs e)
+ {
+ if (buttonOk.Sensitive)
+ buttonOk.Click();
+ }
+ }
+}
+
diff --git a/src/Application.cs b/src/Application.cs
index 7181a2c..8124614 100644
--- a/src/Application.cs
+++ b/src/Application.cs
@@ -92,7 +92,6 @@ namespace Imendio.Blam {
public static string BaseDir;
- private AddChannelDialog addChannelDialog;
private ChannelDialog channelDialog;
private AddGroupDialog addGroupDialog;
private PreferencesDialog preferencesDialog;
@@ -239,7 +238,6 @@ namespace Imendio.Blam {
}
channelDialog = new ChannelDialog (this);
- addChannelDialog = new AddChannelDialog (this);
addGroupDialog = new AddGroupDialog (this);
preferencesDialog = new PreferencesDialog (this.Window);
opmlDialog = new OpmlDialog (this.Window);
@@ -566,9 +564,23 @@ namespace Imendio.Blam {
about.Destroy();
}
- public void AddChannelActivated (object obj, EventArgs args)
+ public void AddChannelActivated(object obj, EventArgs args)
{
- addChannelDialog.Show ();
+ using (var diag = new AddChannelDialog(TheApp.Window)) {
+ var response = diag.Run();
+
+ switch (response) {
+ case (int)ResponseType.Ok:
+ var chan = new Channel();
+ chan.Url = diag.Url;
+ chan.http_username = diag.Username;
+ chan.http_password = diag.Password;
+ TheApp.CCollection.Add(chan);
+ break;
+ }
+
+ diag.Hide();
+ }
}
public void AddGroupActivated (object obj, EventArgs args)
@@ -666,7 +678,8 @@ namespace Imendio.Blam {
UTF8Encoding encoding = new UTF8Encoding( );
string text = encoding.GetString(d.Data);
- addChannelDialog.Show (text);
+ var diag = new AddChannelDialog(TheApp.Window);
+ diag.Url = text;
}
private void OnUrl (string url)
diff --git a/src/Dialogs.cs b/src/Dialogs.cs
index 0c99ecb..1c2d679 100644
--- a/src/Dialogs.cs
+++ b/src/Dialogs.cs
@@ -54,99 +54,6 @@ namespace Imendio.Blam {
}
}
- class AddChannelDialog {
- [Widget] Gtk.Dialog addChannelDialog = null;
- [Widget] Gtk.Entry urlEntry = null;
- [Widget] Gtk.Entry usernameEntry = null;
- [Widget] Gtk.Entry passwordEntry = null;
- [Widget] Gtk.Image dialogImage = null;
- [Widget] Gtk.Button okButton = null;
-
- private static AddChannelDialog mThis;
-
- private Application mApp;
-
- public AddChannelDialog (Application app)
- {
- mApp = app;
-
- Glade.XML gladeXML = Glade.XML.FromAssembly ("blam.glade",
- "addChannelDialog",
- null);
- gladeXML.Autoconnect (this);
- addChannelDialog.TransientFor = mApp.Window;
- addChannelDialog.IconName = "blam";
-
- dialogImage.Pixbuf =
- Gdk.Pixbuf.LoadFromResource ("blam-add-news.png");
- }
-
- public static void ClipboardTextReceived(Clipboard clipboard, string text)
- {
- if((text == null) || ((!text.StartsWith("http://")) && (!text.StartsWith("https://")))
- || (text == string.Empty)){
- mThis.urlEntry.Text = "";
- } else {
- mThis.urlEntry.Text = text;
- }
- }
-
- public void Show ()
- {
- mThis = this;
- Clipboard clipboard = Clipboard.Get(Gdk.Atom.Intern("CLIPBOARD", true));
- clipboard.RequestText(ClipboardTextReceived);
-
- usernameEntry.Text = "";
- passwordEntry.Text = "";
-
- addChannelDialog.ShowAll ();
- }
-
- public void Show (string url)
- {
- urlEntry.Text = url;
- usernameEntry.Text = "";
- passwordEntry.Text = "";
-
- addChannelDialog.ShowAll ();
- }
-
- public void CancelButtonClicked (object obj, EventArgs args)
- {
- addChannelDialog.Hide();
- }
-
- public void OkButtonClicked (object obj, EventArgs args)
- {
- Channel channel = new Channel ();
-
- channel.Name = channel.Url = urlEntry.Text;
- channel.http_username = usernameEntry.Text;
- channel.http_password = passwordEntry.Text;
-
- mApp.CCollection.Add (channel);
-
- addChannelDialog.Hide ();
- }
-
- public void EntryChanged (object obj, EventArgs args)
- {
- if (!urlEntry.Text.Equals("")) {
- okButton.Sensitive = true;
- } else {
- okButton.Sensitive = false;
- }
- }
-
- public void EntryActivated (object obj, EventArgs args)
- {
- if (!urlEntry.Text.Equals("")) {
- okButton.Click();
- }
- }
- }
-
class RemoveChannelDialog {
[Widget] Gtk.Dialog removeChannelDialog = null;
[Widget] Gtk.Label dialogTextLabel = null;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]