gtk: move ComboBoxText custom code to a partial class

Also rename the constructor parameter to has_entry and pass its value to
CreateNativeObject.
This commit is contained in:
Bertrand Lorentz 2011-07-16 17:53:21 +02:00
parent bef589e836
commit 9463e98ca2
2 changed files with 10 additions and 6 deletions

View file

@ -1,4 +1,4 @@
// ComboBoxText.custom - Gtk ComboBoxText customizations // ComboBoxText.cs - Gtk ComboBoxText customizations
// //
// Authors: Bertrand Lorentz <bertrand.lorentz@gmail.com> // Authors: Bertrand Lorentz <bertrand.lorentz@gmail.com>
// //
@ -18,14 +18,18 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA. // Boston, MA 02111-1307, USA.
protected ComboBoxText (bool with_entry) : base (IntPtr.Zero) namespace Gtk {
public partial class ComboBoxText {
protected ComboBoxText (bool has_entry) : base (IntPtr.Zero)
{ {
if (GetType () != typeof (ComboBoxText)) { if (GetType () != typeof (ComboBoxText)) {
CreateNativeObject (new string [0], new GLib.Value[0]); CreateNativeObject (new string[] { "has-entry" }, new GLib.Value[] { new GLib.Value (has_entry) });
return; return;
} }
if (with_entry) { if (has_entry) {
Raw = gtk_combo_box_text_new_with_entry (); Raw = gtk_combo_box_text_new_with_entry ();
} else { } else {
Raw = gtk_combo_box_text_new (); Raw = gtk_combo_box_text_new ();
@ -37,4 +41,5 @@
return (Gtk.Entry)Child; return (Gtk.Entry)Child;
} }
} }
}
}

View file

@ -54,7 +54,6 @@ customs = \
ColorSelection.custom \ ColorSelection.custom \
ColorSelectionDialog.custom \ ColorSelectionDialog.custom \
ComboBox.custom \ ComboBox.custom \
ComboBoxText.custom \
Container.custom \ Container.custom \
Dialog.custom \ Dialog.custom \
Drag.custom \ Drag.custom \