gtk: Use the same behavior in Builder constructor overloads

Each overload needs to call Assembly.GetCallingAssembly () explicitly,
otherwise the calling assembly would end up being gtk-sharp.
This commit is contained in:
Antonius Riha 2014-09-07 19:51:13 +02:00 committed by Bertrand Lorentz
parent 2034648ec2
commit a281a85f9d

View File

@ -26,6 +26,7 @@
namespace Gtk {
using System;
using System.Reflection;
using System.Runtime.InteropServices;
public partial class Builder {
@ -168,21 +169,22 @@ namespace Gtk {
TranslationDomain = translation_domain;
}
public Builder (string resource_name) : this (resource_name, null)
public Builder (string resource_name) : this (Assembly.GetCallingAssembly (), resource_name, null)
{
}
public Builder (string resource_name, string translation_domain) : this (System.Reflection.Assembly.GetEntryAssembly (), resource_name, translation_domain)
public Builder (string resource_name, string translation_domain)
: this (Assembly.GetCallingAssembly (), resource_name, translation_domain)
{
}
public Builder (System.Reflection.Assembly assembly, string resource_name, string translation_domain) : this ()
public Builder (Assembly assembly, string resource_name, string translation_domain) : this ()
{
if (GetType() != typeof (Builder))
throw new InvalidOperationException ("Cannot chain to this constructor from subclasses.");
if (assembly == null)
assembly = System.Reflection.Assembly.GetCallingAssembly ();
assembly = Assembly.GetCallingAssembly ();
System.IO.Stream s = assembly.GetManifestResourceStream (resource_name);
if (s == null)