Re: Going crazy with HildonPickerButton with multiple selection

2010-02-22 Thread Alberto Garcia
On Fri, Feb 19, 2010 at 09:31:47AM +0200, Alberto Mardegan wrote:

 BTW, I find the APIs for handling selections rather cumbersome, I
 have to write about 20 lines of code just to know the selection
 state of an item (if multiple selection is enabled).
 
 If I write a patch that adds
 
 gboolean hildon_touch_selector_is_selected(HildonTouchSelector *selector,
gint column,
gint index);
 void hildon_touch_selector_set_selected(HildonTouchSelector *selector,
 gint column,
 gint index,
 gboolean selected);
 
 would that have any chance of making its way in a future release?

Sure, can you please file a bug ?

Berto
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Going crazy with HildonPickerButton with multiple selection

2010-02-18 Thread Alberto Mardegan

Hi all,
  I've been getting exasperated with HildonPickerButton: I have a 
simple list of strings, and I want the user to select zero or more of them.


HildonPickerButton with multiple selection seems to be perfect for my 
need, but unfortunately HildonPickerDialog doesn't allow closing the 
dialog if no item is selected (why???).


The only workaround I could come up with, is connecting to the changed 
signal of the HildonTouchSelector and in the handler run this code. I'm 
pasting this here in case it turns out to be useful for someone else:


=
static void
hack_sel(GtkWidget *selector, gint column, gboolean *hacked)
{
GtkWidget *dialog;
guint id, ret;

if (*hacked) return;

/* HILDON HACK: HildonPickerDialog blocks the emission of the
 * response signal if no item is selected. Since this blocking
 * happens on a signal handler for the response signal itself,
 * we disconnect it :-) */
dialog = gtk_widget_get_toplevel(selector);
id = g_signal_lookup(response, GTK_TYPE_DIALOG);
ret = g_signal_handlers_disconnect_matched(dialog,
G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DATA, id, 0,
NULL, NULL, NULL);
if (ret != 1)
g_warning(%s: disconnected %u signals!, G_STRFUNC, ret);

*hacked = TRUE;
}



If someone has some better suggestion, you are most welcome to post it. :-)

Ciao,
  Alberto


--
http://www.mardy.it - geek in un lingua international!
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Going crazy with HildonPickerButton with multiple selection

2010-02-18 Thread Alberto Garcia
On Thu, Feb 18, 2010 at 10:33:46PM +0200, Alberto Mardegan wrote:

 HildonPickerButton with multiple selection seems to be perfect for
 my need, but unfortunately HildonPickerDialog doesn't allow closing
 the dialog if no item is selected (why???).

I know it's controversial, but that was a design decision for Maemo 5.
The solution is to have an option labelled None.

For an example, open the clock app, try adding a new alarm and see the
Repeat button (which allows multiple selection). The first option is
Never

Berto
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Going crazy with HildonPickerButton with multiple selection

2010-02-18 Thread Alberto Mardegan

Alberto Garcia wrote:

On Thu, Feb 18, 2010 at 10:33:46PM +0200, Alberto Mardegan wrote:


HildonPickerButton with multiple selection seems to be perfect for
my need, but unfortunately HildonPickerDialog doesn't allow closing
the dialog if no item is selected (why???).


I know it's controversial, but that was a design decision for Maemo 5.
The solution is to have an option labelled None.

For an example, open the clock app, try adding a new alarm and see the
Repeat button (which allows multiple selection). The first option is
Never


I see. I could actually implement it in the same way as the clock app is doing.
BTW, I find the APIs for handling selections rather cumbersome, I have to write 
about 20 lines of code just to know the selection state of an item (if multiple 
selection is enabled).


If I write a patch that adds

gboolean hildon_touch_selector_is_selected(HildonTouchSelector *selector,
   gint column,
   gint index);
void hildon_touch_selector_set_selected(HildonTouchSelector *selector,
gint column,
gint index,
gboolean selected);

would that have any chance of making its way in a future release?


Ciao,
  Alberto

--
http://www.mardy.it -- geek in un lingua international!
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers