Merge pull request #366 from zii-dmg/deprecate-constructors

GapiCodegen: added support for deprecated constructors
This commit is contained in:
lytico 2022-07-25 20:33:57 +02:00 committed by GitHub
commit 96df6b61c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 30 additions and 4 deletions

View file

@ -19,6 +19,7 @@ namespace Gtk {
public partial class HBox {
[Obsolete]
public HBox () : this (false, 0) {}
}

View file

@ -28,6 +28,7 @@ namespace Gtk {
delegate IntPtr d_gtk_hscale_new_with_range(double min, double max, double step);
static d_gtk_hscale_new_with_range gtk_hscale_new_with_range = FuncLoader.LoadFunction<d_gtk_hscale_new_with_range>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_hscale_new_with_range"));
[Obsolete]
public HScale (double min, double max, double step) : base (IntPtr.Zero)
{
if (GetType() != typeof (HScale)) {

View file

@ -25,6 +25,7 @@ namespace Gtk {
/// <summary> Sizes Property </summary>
/// <remarks> To be completed </remarks>
[Obsolete]
public Gtk.IconSize [] Sizes {
get {

View file

@ -28,6 +28,7 @@ namespace Gtk {
delegate IntPtr d_gtk_image_menu_item_new_with_mnemonic(IntPtr label);
static d_gtk_image_menu_item_new_with_mnemonic gtk_image_menu_item_new_with_mnemonic = FuncLoader.LoadFunction<d_gtk_image_menu_item_new_with_mnemonic>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_image_menu_item_new_with_mnemonic"));
[Obsolete]
public ImageMenuItem (string label) : base (IntPtr.Zero)
{
if (GetType() != typeof (ImageMenuItem)) {

View file

@ -32,6 +32,7 @@ namespace Gtk
delegate void d_gtk_radio_action_set_group(IntPtr raw, IntPtr list);
static d_gtk_radio_action_set_group gtk_radio_action_set_group = FuncLoader.LoadFunction<d_gtk_radio_action_set_group>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_radio_action_set_group"));
[Obsolete]
[GLib.Property ("group")]
public RadioAction[] Group {
get {

View file

@ -49,6 +49,7 @@ namespace Gtk {
delegate IntPtr d_gtk_radio_tool_button_new_from_stock(IntPtr group, IntPtr stock_id);
static d_gtk_radio_tool_button_new_from_stock gtk_radio_tool_button_new_from_stock = FuncLoader.LoadFunction<d_gtk_radio_tool_button_new_from_stock>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_radio_tool_button_new_from_stock"));
[Obsolete]
public RadioToolButton (RadioToolButton[] group, string stock_id) : base (IntPtr.Zero)
{
if (GetType () != typeof (RadioToolButton)) {

View file

@ -87,6 +87,7 @@ namespace Gtk {
delegate bool d_gtk_status_icon_get_geometry(IntPtr raw, out IntPtr screen, IntPtr area, out int orientation);
static d_gtk_status_icon_get_geometry gtk_status_icon_get_geometry = FuncLoader.LoadFunction<d_gtk_status_icon_get_geometry>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_status_icon_get_geometry"));
[Obsolete]
public bool GetGeometry(out Gdk.Screen screen, out Gdk.Rectangle area, out Gtk.Orientation orientation)
{
IntPtr native_screen;

View file

@ -26,6 +26,7 @@ namespace Gtk {
public partial class UIManager {
[Obsolete]
[MethodImpl(MethodImplOptions.NoInlining)]
public uint AddUiFromResource (string resource)
{
@ -42,6 +43,7 @@ namespace Gtk {
delegate uint d_gtk_ui_manager_new_merge_id(IntPtr raw);
static d_gtk_ui_manager_new_merge_id gtk_ui_manager_new_merge_id = FuncLoader.LoadFunction<d_gtk_ui_manager_new_merge_id>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_ui_manager_new_merge_id"));
[Obsolete]
public uint NewMergeId ()
{
return gtk_ui_manager_new_merge_id (Handle);
@ -50,6 +52,7 @@ namespace Gtk {
delegate IntPtr d_gtk_ui_manager_get_toplevels(IntPtr raw, int types);
static d_gtk_ui_manager_get_toplevels gtk_ui_manager_get_toplevels = FuncLoader.LoadFunction<d_gtk_ui_manager_get_toplevels>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_ui_manager_get_toplevels"));
[Obsolete]
public Widget[] GetToplevels (Gtk.UIManagerItemType types) {
IntPtr raw_ret = gtk_ui_manager_get_toplevels (Handle, (int) types);
GLib.SList list = new GLib.SList (raw_ret);
@ -63,6 +66,7 @@ namespace Gtk {
delegate IntPtr d_gtk_ui_manager_get_action_groups(IntPtr raw);
static d_gtk_ui_manager_get_action_groups gtk_ui_manager_get_action_groups = FuncLoader.LoadFunction<d_gtk_ui_manager_get_action_groups>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_ui_manager_get_action_groups"));
[Obsolete]
public ActionGroup[] ActionGroups {
get {
IntPtr raw_ret = gtk_ui_manager_get_action_groups (Handle);

View file

@ -19,6 +19,7 @@ namespace Gtk {
public partial class VBox {
[Obsolete]
public VBox () : this (false, 0) {}
}

View file

@ -28,6 +28,7 @@ namespace Gtk {
delegate IntPtr d_gtk_vscale_new_with_range(double min, double max, double step);
static d_gtk_vscale_new_with_range gtk_vscale_new_with_range = FuncLoader.LoadFunction<d_gtk_vscale_new_with_range>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_vscale_new_with_range"));
[Obsolete]
public VScale (double min, double max, double step) : base (IntPtr.Zero)
{
if (GetType() != typeof (VScale)) {

View file

@ -30,12 +30,15 @@ namespace GtkSharp.Generation {
public class Ctor : MethodBase {
private bool preferred;
private bool deprecated;
private string name;
private bool needs_chaining = false;
private bool needs_chaining;
public Ctor (XmlElement elem, ClassBase implementor) : base (elem, implementor)
{
preferred = elem.GetAttributeAsBoolean ("preferred");
deprecated = elem.GetAttributeAsBoolean("deprecated");
if (implementor is ObjectGen)
needs_chaining = true;
@ -47,6 +50,12 @@ namespace GtkSharp.Generation {
set { preferred = value; }
}
public bool IsDeprecated {
get {
return deprecated;
}
}
public string StaticName {
get {
if (!IsStatic)
@ -101,6 +110,10 @@ namespace GtkSharp.Generation {
if (IsStatic)
GenerateStatic (gen_info);
else {
if (IsDeprecated)
sw.WriteLine("\t\t[Obsolete]");
sw.WriteLine("\t\t{0} {1}{2} ({3}) {4}", Protection, Safety, name, Signature.ToString(), needs_chaining ? ": base (IntPtr.Zero)" : "");
sw.WriteLine("\t\t{");