Re: GtkComboBox question



Mike,

-----Original Message-----
>From: Mike Massonnet <mmassonnet gmail com>
>Sent: Mar 11, 2009 5:41 PM
>To: gtk-list gnome org
>Cc: Igor Korot <ikorot earthlink net>
>Subject: Re: GtkComboBox question
>
>Le Wed, 11 Mar 2009 14:24:21 -0700 (GMT-07:00),
>Igor Korot <ikorot earthlink net> a écrit :
>
>> Mike,
>> 
>> -----Original Message-----
>> >From: Mike Massonnet <mmassonnet gmail com>
>> >Sent: Mar 11, 2009 1:47 PM
>> >To: gtk-list gnome org
>> >Cc: Igor Korot <ikorot earthlink net>
>> >Subject: Re: GtkComboBox question
>> >
>> >Le Wed, 11 Mar 2009 12:54:09 -0700 (GMT-07:00),
>> >Igor Korot <ikorot earthlink net> a écrit :
>SNIP
>
>> >> Basically I'm looking for a way to override the mouse click on the
>> >> arrow for the combo box when the list either pops-up or closes
>> >> down. If this is not the right event/signal, please let me know.
>> >
>> >I didn't try. The last time I had to hack with this case I used the
>> >popdown/up signals, which was plain wrong as they work strictly with
>> >the keyboard shortcuts. So you might be right with
>> >notify::popup-shown.
>> 
>> Also, do you know how do I make the function that connects to
>> this signal? I was hoping to write something like this:
>
>http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject-notify

That's very helpful. Thank you.
So basically what I'm looking for is this code:

g_signal_connect( combo->popup-shown, "notify::popup-shown", G_CALLBACK(...),combo);

right?

>
>> void my_func( GtkComboBox *widget, GtkScrollType scroll_type,
>> gpointer user_data) {
>>      if( widget->popup-shown )
>>      {
>> // code for list shown
>>      }
>>      else
>>      {
>> // code for list not shown
>>      }
>> }
>
>You can read the popup-shown value by using g_object_get(). I don't
>know how to read the value out of the GParamSpec passed in the callback.

Ok. Problem is, this is what the doc says:

"
Gets properties of an object. 

In general, a copy is made of the property contents and the caller is responsible
for freeing the memory in the appropriate manner for the type, for instance by calling
g_free() or g_object_unref(). 
"

What scares me is the words "In general". So if this property is boolean, then according
to the example that follows, I don't have to free the memory. But then will I have a memory
leak?

>
>Mike 

Thank you. You've been a great helper so far. ;-)

>
>> But I don't know if this is a right prototype or not.
>> And the code itself, I'm not sure if it's right as well, as I can't
>> check...
>> 
>> >
>> >> Thank you.
>> 
>> Thank you for the fast responce.
>> 
>> >
>> >Mike
>> 
>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]