Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono-addins.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez Gual <lluis@novell.com>2011-02-14 21:49:11 +0300
committerLluis Sanchez Gual <lluis@novell.com>2011-02-14 21:49:11 +0300
commitc71863491b69bd83fd3a1ef654ed726e4bc0010e (patch)
tree537298c1a76a01e5d541b3aa86ef7d2f536e2853 /Mono.Addins.Gui
parent287a43dc96d08a4df0aeedb83089ca464f8e3d07 (diff)
Allow installing add-ins from a file.
Diffstat (limited to 'Mono.Addins.Gui')
-rw-r--r--Mono.Addins.Gui/Mono.Addins.Gui/AddinManagerDialog.cs43
-rw-r--r--Mono.Addins.Gui/Mono.Addins.Gui/AddinTreeWidget.cs5
-rw-r--r--Mono.Addins.Gui/Mono.Addins.Gui/InstallDialog.cs24
-rw-r--r--Mono.Addins.Gui/gtk-gui/Mono.Addins.Gui.AddinManagerDialog.cs51
-rw-r--r--Mono.Addins.Gui/gtk-gui/gui.stetic26
5 files changed, 118 insertions, 31 deletions
diff --git a/Mono.Addins.Gui/Mono.Addins.Gui/AddinManagerDialog.cs b/Mono.Addins.Gui/Mono.Addins.Gui/AddinManagerDialog.cs
index f2086a8..e30745b 100644
--- a/Mono.Addins.Gui/Mono.Addins.Gui/AddinManagerDialog.cs
+++ b/Mono.Addins.Gui/Mono.Addins.Gui/AddinManagerDialog.cs
@@ -502,5 +502,48 @@ namespace Mono.Addins.Gui
dlg.Destroy ();
}
}
+
+ static string lastFolder;
+
+ protected virtual void OnButtonInstallFromFileClicked (object sender, System.EventArgs e)
+ {
+ string[] files;
+ Gtk.FileChooserDialog dlg = new Gtk.FileChooserDialog (Catalog.GetString ("Install Add-in Package"), this, FileChooserAction.Open);
+ try {
+ if (lastFolder != null)
+ dlg.SetCurrentFolder (lastFolder);
+ else
+ dlg.SetCurrentFolder (Environment.GetFolderPath (Environment.SpecialFolder.Personal));
+ dlg.SelectMultiple = true;
+
+ Gtk.FileFilter f = new Gtk.FileFilter ();
+ f.AddPattern ("*.mpack");
+ f.Name = Catalog.GetString ("Add-in packages");
+ dlg.AddFilter (f);
+
+ f = new Gtk.FileFilter ();
+ f.AddPattern ("*");
+ f.Name = Catalog.GetString ("All files");
+ dlg.AddFilter (f);
+
+ dlg.AddButton (Gtk.Stock.Cancel, ResponseType.Cancel);
+ dlg.AddButton (Gtk.Stock.Open, ResponseType.Ok);
+ if (dlg.Run () != (int) Gtk.ResponseType.Ok)
+ return;
+ files = dlg.Filenames;
+ lastFolder = dlg.CurrentFolder;
+ } finally {
+ dlg.Destroy ();
+ }
+
+ InstallDialog idlg = new InstallDialog (this, service);
+ try {
+ idlg.InitForInstall (files);
+ if (idlg.Run () == (int) Gtk.ResponseType.Ok)
+ LoadAll ();
+ } finally {
+ idlg.Destroy ();
+ }
+ }
}
}
diff --git a/Mono.Addins.Gui/Mono.Addins.Gui/AddinTreeWidget.cs b/Mono.Addins.Gui/Mono.Addins.Gui/AddinTreeWidget.cs
index 85a8d34..cc36a36 100644
--- a/Mono.Addins.Gui/Mono.Addins.Gui/AddinTreeWidget.cs
+++ b/Mono.Addins.Gui/Mono.Addins.Gui/AddinTreeWidget.cs
@@ -54,8 +54,6 @@ namespace Mono.Addins.Gui
Gdk.Pixbuf iconInstalled;
Gdk.Pixbuf iconNotInstalled;
- Gdk.Pixbuf iconHasUpdate;
- Gdk.Pixbuf iconDisabled;
Gdk.Pixbuf updateOverlay;
public event EventHandler SelectionChanged;
@@ -73,8 +71,6 @@ namespace Mono.Addins.Gui
{
iconInstalled = Gdk.Pixbuf.LoadFromResource ("plugin-32.png");
iconNotInstalled = Gdk.Pixbuf.LoadFromResource ("plugin-avail-32.png");
- iconHasUpdate = Gdk.Pixbuf.LoadFromResource ("plugin-update-32.png");
- iconDisabled = Gdk.Pixbuf.LoadFromResource ("plugin-disabled-32.png");
updateOverlay = Gdk.Pixbuf.LoadFromResource ("software-update-available-overlay.png");
this.treeView = treeView;
@@ -134,6 +130,7 @@ namespace Mono.Addins.Gui
col.AddAttribute (pr, "visible", ColShowImage);
CellRendererText crt = new CellRendererText ();
+ crt.Ellipsize = Pango.EllipsizeMode.End;
col.PackStart (crt, true);
col.AddAttribute (crt, "markup", ColName);
diff --git a/Mono.Addins.Gui/Mono.Addins.Gui/InstallDialog.cs b/Mono.Addins.Gui/Mono.Addins.Gui/InstallDialog.cs
index ac507fc..3db1287 100644
--- a/Mono.Addins.Gui/Mono.Addins.Gui/InstallDialog.cs
+++ b/Mono.Addins.Gui/Mono.Addins.Gui/InstallDialog.cs
@@ -34,6 +34,7 @@ namespace Mono.Addins.Gui
{
internal partial class InstallDialog : Gtk.Dialog
{
+ string[] filesToInstall;
AddinRepositoryEntry[] addinsToInstall;
PackageCollection packagesToInstall;
SetupService service;
@@ -57,6 +58,12 @@ namespace Mono.Addins.Gui
FillSummaryPage ();
}
+ public void InitForInstall (string[] filesToInstall)
+ {
+ this.filesToInstall = filesToInstall;
+ FillSummaryPage ();
+ }
+
public void InitForUninstall (Addin[] info)
{
this.uninstallId = info[0].Id;
@@ -78,8 +85,16 @@ namespace Mono.Addins.Gui
void FillSummaryPage ()
{
PackageCollection packs = new PackageCollection ();
- foreach (AddinRepositoryEntry arep in addinsToInstall) {
- packs.Add (Package.FromRepository (arep));
+
+ if (filesToInstall != null) {
+ foreach (string file in filesToInstall) {
+ packs.Add (Package.FromFile (file));
+ }
+ }
+ else {
+ foreach (AddinRepositoryEntry arep in addinsToInstall) {
+ packs.Add (Package.FromRepository (arep));
+ }
}
packagesToInstall = new PackageCollection (packs);
@@ -219,7 +234,10 @@ namespace Mono.Addins.Gui
void RunInstall ()
{
try {
- service.Install (installMonitor, packagesToInstall);
+ if (filesToInstall != null)
+ service.Install (installMonitor, filesToInstall);
+ else
+ service.Install (installMonitor, packagesToInstall);
} catch (Exception ex) {
installMonitor.Errors.Add (ex.Message);
} finally {
diff --git a/Mono.Addins.Gui/gtk-gui/Mono.Addins.Gui.AddinManagerDialog.cs b/Mono.Addins.Gui/gtk-gui/Mono.Addins.Gui.AddinManagerDialog.cs
index 0c402e2..ee3fdbb 100644
--- a/Mono.Addins.Gui/gtk-gui/Mono.Addins.Gui.AddinManagerDialog.cs
+++ b/Mono.Addins.Gui/gtk-gui/Mono.Addins.Gui.AddinManagerDialog.cs
@@ -27,7 +27,7 @@ namespace Mono.Addins.Gui
private global::Gtk.EventBox eventbox3;
private global::Mono.Addins.Gui.AddinInfoView addininfoUpdates;
private global::Gtk.Label label4;
- private global::Gtk.HBox hbox4;
+ private global::Gtk.HBox hbox6;
private global::Gtk.VBox vboxGallery;
private global::Gtk.EventBox eboxRepo;
private global::Gtk.HBox hbox66;
@@ -39,6 +39,7 @@ namespace Mono.Addins.Gui
private global::Gtk.EventBox eventbox1;
private global::Mono.Addins.Gui.AddinInfoView addininfoGallery;
private global::Gtk.Label label8;
+ private global::Gtk.Button buttonInstallFromFile;
private global::Gtk.Button btnClose;
protected virtual void Build ()
@@ -73,7 +74,7 @@ namespace Mono.Addins.Gui
this.notebook = new global::Gtk.Notebook ();
this.notebook.CanFocus = true;
this.notebook.Name = "notebook";
- this.notebook.CurrentPage = 1;
+ this.notebook.CurrentPage = 0;
this.notebook.ShowBorder = false;
// Container child notebook.Gtk.Notebook+NotebookChild
this.hbox2 = new global::Gtk.HBox ();
@@ -247,11 +248,11 @@ namespace Mono.Addins.Gui
this.notebook.SetTabLabel (this.boxUpdates, this.label4);
this.label4.ShowAll ();
// Container child notebook.Gtk.Notebook+NotebookChild
- this.hbox4 = new global::Gtk.HBox ();
- this.hbox4.Name = "hbox4";
- this.hbox4.Spacing = 9;
- this.hbox4.BorderWidth = ((uint)(9));
- // Container child hbox4.Gtk.Box+BoxChild
+ this.hbox6 = new global::Gtk.HBox ();
+ this.hbox6.Name = "hbox6";
+ this.hbox6.Spacing = 9;
+ this.hbox6.BorderWidth = ((uint)(9));
+ // Container child hbox6.Gtk.Box+BoxChild
this.vboxGallery = new global::Gtk.VBox ();
this.vboxGallery.Name = "vboxGallery";
// Container child vboxGallery.Gtk.Box+BoxChild
@@ -320,10 +321,10 @@ namespace Mono.Addins.Gui
this.vboxGallery.Add (this.scrolledGallery);
global::Gtk.Box.BoxChild w49 = ((global::Gtk.Box.BoxChild)(this.vboxGallery [this.scrolledGallery]));
w49.Position = 1;
- this.hbox4.Add (this.vboxGallery);
- global::Gtk.Box.BoxChild w50 = ((global::Gtk.Box.BoxChild)(this.hbox4 [this.vboxGallery]));
+ this.hbox6.Add (this.vboxGallery);
+ global::Gtk.Box.BoxChild w50 = ((global::Gtk.Box.BoxChild)(this.hbox6 [this.vboxGallery]));
w50.Position = 0;
- // Container child hbox4.Gtk.Box+BoxChild
+ // Container child hbox6.Gtk.Box+BoxChild
this.eventbox1 = new global::Gtk.EventBox ();
this.eventbox1.Name = "eventbox1";
// Container child eventbox1.Gtk.Container+ContainerChild
@@ -332,19 +333,19 @@ namespace Mono.Addins.Gui
this.addininfoGallery.Name = "addininfoGallery";
this.addininfoGallery.AllowInstall = false;
this.eventbox1.Add (this.addininfoGallery);
- this.hbox4.Add (this.eventbox1);
- global::Gtk.Box.BoxChild w52 = ((global::Gtk.Box.BoxChild)(this.hbox4 [this.eventbox1]));
+ this.hbox6.Add (this.eventbox1);
+ global::Gtk.Box.BoxChild w52 = ((global::Gtk.Box.BoxChild)(this.hbox6 [this.eventbox1]));
w52.Position = 1;
w52.Expand = false;
w52.Fill = false;
- this.notebook.Add (this.hbox4);
- global::Gtk.Notebook.NotebookChild w53 = ((global::Gtk.Notebook.NotebookChild)(this.notebook [this.hbox4]));
+ this.notebook.Add (this.hbox6);
+ global::Gtk.Notebook.NotebookChild w53 = ((global::Gtk.Notebook.NotebookChild)(this.notebook [this.hbox6]));
w53.Position = 2;
// Notebook tab
this.label8 = new global::Gtk.Label ();
this.label8.Name = "label8";
this.label8.LabelProp = global::Mono.Unix.Catalog.GetString ("Gallery");
- this.notebook.SetTabLabel (this.hbox4, this.label8);
+ this.notebook.SetTabLabel (this.hbox6, this.label8);
this.label8.ShowAll ();
this.hbox72.Add (this.notebook);
global::Gtk.Box.BoxChild w54 = ((global::Gtk.Box.BoxChild)(this.hbox72 [this.notebook]));
@@ -363,7 +364,17 @@ namespace Mono.Addins.Gui
w58.Name = "dialog-action_area8";
w58.Spacing = 6;
w58.BorderWidth = ((uint)(5));
- w58.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4));
+ w58.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(2));
+ // Container child dialog-action_area8.Gtk.ButtonBox+ButtonBoxChild
+ this.buttonInstallFromFile = new global::Gtk.Button ();
+ this.buttonInstallFromFile.CanFocus = true;
+ this.buttonInstallFromFile.Name = "buttonInstallFromFile";
+ this.buttonInstallFromFile.UseUnderline = true;
+ this.buttonInstallFromFile.Label = global::Mono.Unix.Catalog.GetString ("Install from file...");
+ w58.Add (this.buttonInstallFromFile);
+ global::Gtk.ButtonBox.ButtonBoxChild w59 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w58 [this.buttonInstallFromFile]));
+ w59.Expand = false;
+ w59.Fill = false;
// Container child dialog-action_area8.Gtk.ButtonBox+ButtonBoxChild
this.btnClose = new global::Gtk.Button ();
this.btnClose.CanDefault = true;
@@ -373,9 +384,10 @@ namespace Mono.Addins.Gui
this.btnClose.UseUnderline = true;
this.btnClose.Label = "gtk-close";
this.AddActionWidget (this.btnClose, -7);
- global::Gtk.ButtonBox.ButtonBoxChild w59 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w58 [this.btnClose]));
- w59.Expand = false;
- w59.Fill = false;
+ global::Gtk.ButtonBox.ButtonBoxChild w60 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w58 [this.btnClose]));
+ w60.Position = 1;
+ w60.Expand = false;
+ w60.Fill = false;
if ((this.Child != null)) {
this.Child.ShowAll ();
}
@@ -396,6 +408,7 @@ namespace Mono.Addins.Gui
this.addininfoGallery.UninstallClicked += new global::System.EventHandler (this.OnUninstallClicked);
this.addininfoGallery.UpdateClicked += new global::System.EventHandler (this.OnUpdateClicked);
this.addininfoGallery.EnableDisableClicked += new global::System.EventHandler (this.OnEnableDisableClicked);
+ this.buttonInstallFromFile.Clicked += new global::System.EventHandler (this.OnButtonInstallFromFileClicked);
}
}
}
diff --git a/Mono.Addins.Gui/gtk-gui/gui.stetic b/Mono.Addins.Gui/gtk-gui/gui.stetic
index 460b459..3872204 100644
--- a/Mono.Addins.Gui/gtk-gui/gui.stetic
+++ b/Mono.Addins.Gui/gtk-gui/gui.stetic
@@ -154,7 +154,7 @@
<property name="BorderWidth">6</property>
<property name="DefaultWidth">700</property>
<property name="DefaultHeight">550</property>
- <property name="Buttons">1</property>
+ <property name="Buttons">2</property>
<property name="HelpButton">False</property>
<child internal-child="VBox">
<widget class="Gtk.VBox" id="dialog-vbox8">
@@ -178,7 +178,7 @@
<widget class="Gtk.Notebook" id="notebook">
<property name="MemberName" />
<property name="CanFocus">True</property>
- <property name="CurrentPage">1</property>
+ <property name="CurrentPage">0</property>
<property name="ShowBorder">False</property>
<child>
<widget class="Gtk.HBox" id="hbox2">
@@ -380,7 +380,7 @@
</packing>
</child>
<child>
- <widget class="Gtk.HBox" id="hbox4">
+ <widget class="Gtk.HBox" id="hbox6">
<property name="MemberName" />
<property name="Spacing">9</property>
<property name="BorderWidth">9</property>
@@ -536,8 +536,23 @@
<property name="MemberName" />
<property name="Spacing">6</property>
<property name="BorderWidth">5</property>
- <property name="Size">1</property>
- <property name="LayoutStyle">End</property>
+ <property name="Size">2</property>
+ <property name="LayoutStyle">Edge</property>
+ <child>
+ <widget class="Gtk.Button" id="buttonInstallFromFile">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Type">TextOnly</property>
+ <property name="Label" translatable="yes">Install from file...</property>
+ <property name="UseUnderline">True</property>
+ <property name="ResponseId">-1</property>
+ <signal name="Clicked" handler="OnButtonInstallFromFileClicked" />
+ </widget>
+ <packing>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
<child>
<widget class="Gtk.Button" id="btnClose">
<property name="MemberName" />
@@ -550,6 +565,7 @@
<property name="label">gtk-close</property>
</widget>
<packing>
+ <property name="Position">1</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>