Author: mkrueger
Date: 2007-07-20 03:34:51 -0400 (Fri, 20 Jul 2007)
New Revision: 82338
Modified:
trunk/monodevelop/Extras/MonoDevelop.Gettext/ChangeLog
trunk/monodevelop/Extras/MonoDevelop.Gettext/MonoDevelop.Gettext.mdp
trunk/monodevelop/Extras/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationProject.cs
trunk/monodevelop/Extras/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationService.cs
trunk/monodevelop/Extras/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.TranslationProjectOptionsDialog.cs
trunk/monodevelop/Extras/MonoDevelop.Gettext/gtk-gui/gui.stetic
trunk/monodevelop/Extras/MonoDevelop.Gettext/gtk-gui/objects.xml
Log:
* MonoDevelop.Gettext/TranslationService.cs,
MonoDevelop.Gettext/TranslationProject.cs: Improved update code.
Modified: trunk/monodevelop/Extras/MonoDevelop.Gettext/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/MonoDevelop.Gettext/ChangeLog 2007-07-20
02:48:48 UTC (rev 82337)
+++ trunk/monodevelop/Extras/MonoDevelop.Gettext/ChangeLog 2007-07-20
07:34:51 UTC (rev 82338)
@@ -1,3 +1,8 @@
+2007-07-20 Mike Krüger <[EMAIL PROTECTED]>
+
+ * MonoDevelop.Gettext/TranslationService.cs,
+ MonoDevelop.Gettext/TranslationProject.cs: Improved update code.
+
2007-07-19 Mike Krüger <[EMAIL PROTECTED]>
* MonoDevelop.Gettext.NodeBuilders/TranslationProjectNodeBuilder.cs,
Modified:
trunk/monodevelop/Extras/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationProject.cs
===================================================================
---
trunk/monodevelop/Extras/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationProject.cs
2007-07-20 02:48:48 UTC (rev 82337)
+++
trunk/monodevelop/Extras/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationProject.cs
2007-07-20 07:34:51 UTC (rev 82338)
@@ -113,12 +113,33 @@
}
}
+ int updateLevel = 0;
+ Dictionary<string, Catalog> catalogs = new Dictionary<string,
Catalog> ();
+ public void BeginUpdate ()
+ {
+ updateLevel++;
+ if (updateLevel == 1) {
+ catalogs.Clear ();
+ }
+ }
+ public void EndUpdate ()
+ {
+ updateLevel--;
+ if (updateLevel == 0) {
+ foreach (KeyValuePair<string, Catalog> catalog
in catalogs) {
+ catalog.Value.Save (catalog.Key);
+ }
+ }
+ }
+
public void AddTranslationStrings (Translation translation,
string fileName, List<TranslationProject.MatchLocation> matches)
{
string relativeFileName =
MonoDevelop.Core.Runtime.FileService.AbsoluteToRelativePath
(this.BaseDirectory, fileName);
string poFileName = GetFileName (translation);
- Catalog catalog = new Catalog (poFileName);
+ if (!catalogs.ContainsKey (poFileName))
+ catalogs[poFileName] = new Catalog (poFileName);
+ Catalog catalog = catalogs[poFileName];
foreach (CatalogEntry entry in catalog) {
foreach (string reference in entry.References) {
@@ -137,8 +158,6 @@
}
entry.AddReference (relativeFileName + ":" +
match.Line);
}
-
- catalog.Save (poFileName);
}
public void AddTranslationStrings (string fileName,
List<TranslationProject.MatchLocation> matches)
Modified:
trunk/monodevelop/Extras/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationService.cs
===================================================================
---
trunk/monodevelop/Extras/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationService.cs
2007-07-20 02:48:48 UTC (rev 82337)
+++
trunk/monodevelop/Extras/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationService.cs
2007-07-20 07:34:51 UTC (rev 82338)
@@ -127,13 +127,18 @@
public static void UpdateTranslation (TranslationProject
translationProject, string fileName, string isoCode)
{
- switch (Path.GetExtension (fileName)) {
- case ".xml":
- UpdateXmlTranslations (translationProject,
fileName);
- break;
- default:
- UpdateTranslations (translationProject,
fileName);
- break;
+ translationProject.BeginUpdate ();
+ try {
+ switch (Path.GetExtension (fileName)) {
+ case ".xml":
+ UpdateXmlTranslations
(translationProject, fileName);
+ break;
+ default:
+ UpdateTranslations (translationProject,
fileName);
+ break;
+ }
+ } finally {
+ translationProject.EndUpdate ();
}
}
@@ -142,12 +147,16 @@
TranslationProject translationProject =
GetTranslationProject (e.Project);
if (translationProject == null)
return;
-
- UpdateTranslation (translationProject,
e.ProjectFile.FilePath, null);
-
- ProjectFile steticFile = e.Project.GetProjectFile
(Path.Combine (e.Project.BaseDirectory, "gtk-gui/gui.stetic"));
- if (steticFile != null)
- UpdateSteticTranslations (translationProject,
steticFile.FilePath);
+ translationProject.BeginUpdate ();
+ try {
+ UpdateTranslation (translationProject,
e.ProjectFile.FilePath, null);
+
+ ProjectFile steticFile =
e.Project.GetProjectFile (Path.Combine (e.Project.BaseDirectory,
"gtk-gui/gui.stetic"));
+ if (steticFile != null)
+ UpdateSteticTranslations
(translationProject, steticFile.FilePath);
+ } finally {
+ translationProject.EndUpdate ();
+ }
}
static void CombineOpened (object sender, CombineEventArgs e)
Modified: trunk/monodevelop/Extras/MonoDevelop.Gettext/MonoDevelop.Gettext.mdp
===================================================================
--- trunk/monodevelop/Extras/MonoDevelop.Gettext/MonoDevelop.Gettext.mdp
2007-07-20 02:48:48 UTC (rev 82337)
+++ trunk/monodevelop/Extras/MonoDevelop.Gettext/MonoDevelop.Gettext.mdp
2007-07-20 07:34:51 UTC (rev 82338)
@@ -52,6 +52,7 @@
<File name="./MonoDevelop.Gettext/CatalogDeletedEntry.cs" subtype="Code"
buildaction="Compile" />
<File name="./MonoDevelop.Gettext/PluralForms.cs" subtype="Code"
buildaction="Compile" />
<File name="./MonoDevelop.Gettext/IsoCodes.cs" subtype="Code"
buildaction="Compile" />
+ <File name="./gtk-gui/MonoDevelop.Gettext.EntrySelectionTree.cs"
subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
@@ -84,6 +85,7 @@
<GtkDesignInfo partialTypes="True">
<ExportedWidgets>
<Widget>MonoDevelop.Gettext.POEditorWidget</Widget>
+ <Widget>MonoDevelop.Gettext.EntrySelectionTree</Widget>
</ExportedWidgets>
</GtkDesignInfo>
<MonoDevelop.Gettext.TranslationInfo />
Modified:
trunk/monodevelop/Extras/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.TranslationProjectOptionsDialog.cs
===================================================================
---
trunk/monodevelop/Extras/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.TranslationProjectOptionsDialog.cs
2007-07-20 02:48:48 UTC (rev 82337)
+++
trunk/monodevelop/Extras/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.TranslationProjectOptionsDialog.cs
2007-07-20 07:34:51 UTC (rev 82338)
@@ -67,8 +67,10 @@
private Gtk.Label label4;
- private Gtk.TreeView treeview1;
+ private Gtk.ScrolledWindow scrolledwindow1;
+ private Gtk.TreeView treeviewProjectList;
+
private Gtk.Label label2;
private Gtk.Button buttonCancel;
@@ -90,7 +92,7 @@
this.notebook1 = new Gtk.Notebook();
this.notebook1.CanFocus = true;
this.notebook1.Name = "notebook1";
- this.notebook1.CurrentPage = 0;
+ this.notebook1.CurrentPage = 1;
// Container child notebook1.Gtk.Notebook+NotebookChild
this.vbox2 = new Gtk.VBox();
this.vbox2.Name = "vbox2";
@@ -299,30 +301,38 @@
w23.Expand = false;
w23.Fill = false;
// Container child pageSelectProject.Gtk.Box+BoxChild
- this.treeview1 = new Gtk.TreeView();
- this.treeview1.CanFocus = true;
- this.treeview1.Name = "treeview1";
- this.pageSelectProject.Add(this.treeview1);
- Gtk.Box.BoxChild w24 =
((Gtk.Box.BoxChild)(this.pageSelectProject[this.treeview1]));
- w24.Position = 3;
+ this.scrolledwindow1 = new Gtk.ScrolledWindow();
+ this.scrolledwindow1.CanFocus = true;
+ this.scrolledwindow1.Name = "scrolledwindow1";
+ this.scrolledwindow1.VscrollbarPolicy = ((Gtk.PolicyType)(1));
+ this.scrolledwindow1.HscrollbarPolicy = ((Gtk.PolicyType)(1));
+ this.scrolledwindow1.ShadowType = ((Gtk.ShadowType)(1));
+ // Container child scrolledwindow1.Gtk.Container+ContainerChild
+ this.treeviewProjectList = new Gtk.TreeView();
+ this.treeviewProjectList.CanFocus = true;
+ this.treeviewProjectList.Name = "treeviewProjectList";
+ this.scrolledwindow1.Add(this.treeviewProjectList);
+ this.pageSelectProject.Add(this.scrolledwindow1);
+ Gtk.Box.BoxChild w25 =
((Gtk.Box.BoxChild)(this.pageSelectProject[this.scrolledwindow1]));
+ w25.Position = 3;
this.notebook1.Add(this.pageSelectProject);
- Gtk.Notebook.NotebookChild w25 =
((Gtk.Notebook.NotebookChild)(this.notebook1[this.pageSelectProject]));
- w25.Position = 1;
- w25.TabExpand = false;
+ Gtk.Notebook.NotebookChild w26 =
((Gtk.Notebook.NotebookChild)(this.notebook1[this.pageSelectProject]));
+ w26.Position = 1;
+ w26.TabExpand = false;
// Notebook tab
this.label2 = new Gtk.Label();
this.label2.Name = "label2";
this.label2.LabelProp = Mono.Unix.Catalog.GetString("Include in
Projects");
this.notebook1.SetTabLabel(this.pageSelectProject, this.label2);
w1.Add(this.notebook1);
- Gtk.Box.BoxChild w26 = ((Gtk.Box.BoxChild)(w1[this.notebook1]));
- w26.Position = 0;
+ Gtk.Box.BoxChild w27 = ((Gtk.Box.BoxChild)(w1[this.notebook1]));
+ w27.Position = 0;
// Internal child
MonoDevelop.Gettext.TranslationProjectOptionsDialog.ActionArea
- Gtk.HButtonBox w27 = this.ActionArea;
- w27.Name = "dialog1_ActionArea";
- w27.Spacing = 6;
- w27.BorderWidth = ((uint)(5));
- w27.LayoutStyle = ((Gtk.ButtonBoxStyle)(4));
+ Gtk.HButtonBox w28 = this.ActionArea;
+ w28.Name = "dialog1_ActionArea";
+ w28.Spacing = 6;
+ w28.BorderWidth = ((uint)(5));
+ w28.LayoutStyle = ((Gtk.ButtonBoxStyle)(4));
// Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
this.buttonCancel = new Gtk.Button();
this.buttonCancel.CanDefault = true;
@@ -332,9 +342,9 @@
this.buttonCancel.UseUnderline = true;
this.buttonCancel.Label = "gtk-cancel";
this.AddActionWidget(this.buttonCancel, -6);
- Gtk.ButtonBox.ButtonBoxChild w28 =
((Gtk.ButtonBox.ButtonBoxChild)(w27[this.buttonCancel]));
- w28.Expand = false;
- w28.Fill = false;
+ Gtk.ButtonBox.ButtonBoxChild w29 =
((Gtk.ButtonBox.ButtonBoxChild)(w28[this.buttonCancel]));
+ w29.Expand = false;
+ w29.Fill = false;
// Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
this.buttonOk = new Gtk.Button();
this.buttonOk.CanDefault = true;
@@ -344,15 +354,15 @@
this.buttonOk.UseUnderline = true;
this.buttonOk.Label = "gtk-ok";
this.AddActionWidget(this.buttonOk, -5);
- Gtk.ButtonBox.ButtonBoxChild w29 =
((Gtk.ButtonBox.ButtonBoxChild)(w27[this.buttonOk]));
- w29.Position = 1;
- w29.Expand = false;
- w29.Fill = false;
+ Gtk.ButtonBox.ButtonBoxChild w30 =
((Gtk.ButtonBox.ButtonBoxChild)(w28[this.buttonOk]));
+ w30.Position = 1;
+ w30.Expand = false;
+ w30.Fill = false;
if ((this.Child != null)) {
this.Child.ShowAll();
}
this.DefaultWidth = 519;
- this.DefaultHeight = 347;
+ this.DefaultHeight = 346;
this.Show();
}
}
Modified: trunk/monodevelop/Extras/MonoDevelop.Gettext/gtk-gui/gui.stetic
===================================================================
--- trunk/monodevelop/Extras/MonoDevelop.Gettext/gtk-gui/gui.stetic
2007-07-20 02:48:48 UTC (rev 82337)
+++ trunk/monodevelop/Extras/MonoDevelop.Gettext/gtk-gui/gui.stetic
2007-07-20 07:34:51 UTC (rev 82338)
@@ -960,7 +960,7 @@
</widget>
</child>
</widget>
- <widget class="Gtk.Dialog"
id="MonoDevelop.Gettext.TranslationProjectOptionsDialog" design-size="519 347">
+ <widget class="Gtk.Dialog"
id="MonoDevelop.Gettext.TranslationProjectOptionsDialog" design-size="519 346">
<property name="MemberName" />
<property name="Title" translatable="yes">Translation Options</property>
<property name="WindowPosition">CenterOnParent</property>
@@ -975,7 +975,7 @@
<widget class="Gtk.Notebook" id="notebook1">
<property name="MemberName" />
<property name="CanFocus">True</property>
- <property name="CurrentPage">0</property>
+ <property name="CurrentPage">1</property>
<child>
<widget class="Gtk.VBox" id="vbox2">
<property name="MemberName" />
@@ -1287,10 +1287,19 @@
</packing>
</child>
<child>
- <widget class="Gtk.TreeView" id="treeview1">
+ <widget class="Gtk.ScrolledWindow" id="scrolledwindow1">
<property name="MemberName" />
<property name="CanFocus">True</property>
- <property name="HeadersClickable">True</property>
+ <property name="VscrollbarPolicy">Automatic</property>
+ <property name="HscrollbarPolicy">Automatic</property>
+ <property name="ShadowType">In</property>
+ <child>
+ <widget class="Gtk.TreeView" id="treeviewProjectList">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="HeadersClickable">True</property>
+ </widget>
+ </child>
</widget>
<packing>
<property name="Position">3</property>
Modified: trunk/monodevelop/Extras/MonoDevelop.Gettext/gtk-gui/objects.xml
===================================================================
--- trunk/monodevelop/Extras/MonoDevelop.Gettext/gtk-gui/objects.xml
2007-07-20 02:48:48 UTC (rev 82337)
+++ trunk/monodevelop/Extras/MonoDevelop.Gettext/gtk-gui/objects.xml
2007-07-20 07:34:51 UTC (rev 82338)
@@ -7,4 +7,8 @@
</itemgroups>
<signals />
</object>
+ <object type="MonoDevelop.Gettext.EntrySelectionTree"
palette-category="widget" allow-children="false" base-type="Gtk.Bin">
+ <itemgroups />
+ <signals />
+ </object>
</objects>
\ No newline at end of file
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches