Re: [Vala] Gtk.TextBuffer text/set_text
- From: "Thijs Vermeir" <thijsvermeir gmail com>
- To: gj_alsem yahoo com
- Cc: vala-list gnome org
- Subject: Re: [Vala] Gtk.TextBuffer text/set_text
- Date: Wed, 5 Nov 2008 13:45:35 +0100
Hi,
On Wed, Nov 5, 2008 at 1:36 PM, Geert Jan <gj_alsem yahoo com> wrote:
Hi everybody,
Sorry for replying to my own mail, but I feel that in my previous message I was a bit unclear and
impersonal, resulting in no replies. So I'd like to summarize my question here:
The fact that Vala for Gtk.TextBuffer accepts:
my_text_buffer.text = "foo";
...is probably a bug, since gcc doesn't compile the resulting C code. But what kind of bug is this? Should
the text property of Gtk.TextBuffer just be private?
Yes, it should be private just like in a recent question on the
mailing list about the Gtk.Label.text
Gr,
Thijs
And as a follow up question I wondered why there was chosen to give the user the choice between using the =
operator and the set_something() method, because at first it confused me a little as it made me wonder if
there was a difference.
Hopefully someone can shed some light on the matter. I'm getting to know Vala pretty well, so I think soon
I'll be able to help out by fixing bugs myself, instead of just pestering others. :)
Sincerely,
Geert Jan Alsem
--- On Thu, 10/30/08, Geert Jan <gj_alsem yahoo com> wrote:
From: Geert Jan <gj_alsem yahoo com>
Subject: [Vala] Gtk.TextBuffer text/set_text
To: vala-list gnome org
Date: Thursday, October 30, 2008, 9:33 AM
Gtk.TextBuffer has a property:
public weak string text { set; get; }
This should mean you can either use:
my_text_buffer.text = "foo";
Or:
my_text_buffer.set_text ("foo");
Right? However, the set_text() method in this case is
different:
public void set_text (string text, int len)
So, this works:
my_text_buffer.set_text ("foo", 3);
But this doesn't:
my_text_buffer.text = "foo";
The problem is, valac compiles that last line, but gcc
gives an error saying gtk_text_buffer_set_text() isn't
getting enough arguments. So I'm guessing this
constitutes as a bug in Vala.
BTW, I would have just submitted a bug report on bugzilla,
but the whole philosophy behind the { set; get; } way of
working is still a bit unclear to me. Is it meant to be
double, as in: you can always use both "object.x =
something" and "object.set_x(something)"? Why
wasn't there chosen for one way? Maybe I'm just
fussing too hard over this, but I keep wondering which is
the preferred way of the two.
_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list
_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]