Re: GtkTreeView behaviour

2010-01-13 Thread Piñeiro
From: George Kibardin george-kibar...@yandex.ru

 Thank you Alberto for your code samble. I've found the problem. 
 gtk_container_add() shoud be used instead of 
 hildon_pannable_area_add_with_viewportl().

This is because the treeview has native scrolling support, so it is
wrong. There are additional information on :
http://library.gnome.org/devel/gtk/stable/GtkScrolledWindow.html#gtk-scrolled-window-add-with-viewport

I have just check the documentation on
hildon_pannable_area_add_with_viewport, and this is not mentioned,
just assumed. Probably it would be a good idea to mention it, and also
add a hint to the gtk_scrolled_window_add_with_viewport for extra
information.

BR

===
API (apinhe...@igalia.com)
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkTreeView behaviour

2010-01-13 Thread Piñeiro
From: Piñeiro apinhe...@igalia.com

 From: George Kibardin george-kibar...@yandex.ru
 
  Thank you Alberto for your code samble. I've found the problem. 
  gtk_container_add() shoud be used instead of 
  hildon_pannable_area_add_with_viewportl().
 
 This is because the treeview has native scrolling support, so it is
 wrong. There are additional information on :
 http://library.gnome.org/devel/gtk/stable/GtkScrolledWindow.html#gtk-scrolled-window-add-with-viewport
 
 I have just check the documentation on
 hildon_pannable_area_add_with_viewport, and this is not mentioned,
 just assumed. Probably it would be a good idea to mention it, and also
 add a hint to the gtk_scrolled_window_add_with_viewport for extra
 information.

Done, thanks!

===
API (apinhe...@igalia.com)
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkTreeView behaviour

2010-01-13 Thread Claudio Saavedra
El mié, 13-01-2010 a las 15:16 +0100, Piñeiro escribió:
  
  I have just check the documentation on
  hildon_pannable_area_add_with_viewport, and this is not mentioned,
  just assumed. Probably it would be a good idea to mention it, and
 also
  add a hint to the gtk_scrolled_window_add_with_viewport for extra
  information.
 
 Done, thanks! 

Please cherry pick into hildon-2-2.

Claudio


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


Re: GtkTreeView behaviour

2010-01-13 Thread Piñeiro
From: Claudio Saavedra csaave...@igalia.com

 El mié, 13-01-2010 a las 15:16 +0100, Piñeiro escribió:
   
   I have just check the documentation on
   hildon_pannable_area_add_with_viewport, and this is not mentioned,
   just assumed. Probably it would be a good idea to mention it, and
  also
   add a hint to the gtk_scrolled_window_add_with_viewport for extra
   information.
  
  Done, thanks! 
 
 Please cherry pick into hildon-2-2.

Done.

===
API (apinhe...@igalia.com)
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkTreeView behaviour

2010-01-12 Thread Alberto Garcia
On Mon, Jan 11, 2010 at 11:47:48PM +0300, George Kibardin wrote:

 In my case for some reason in normal mode I need two taps to get
 row-activated signal: one tap to select appropriate item and another
 one to activate it. In edit mode with multiple selection enabled
 I need to use Ctrl to select multiple items which also seems
 wrong. What I'm doing wrong?

There must be something wrong in your code... I'm attaching a simple
example of a treeview in normal mode, tell me if it works fine for
you.

Berto

#includehildon/hildon.h

static const char *countries[] = {
Austria, Belgium, Bulgaria, Cyprus, Czech Republic,
Denmark, Estonia, Finland, France, Germany, Greece,
Hungary, Ireland, Italy, Latvia, Lithuania, Luxembourg,
Malta, Netherlands, Poland, Portugal, Romania, Slovakia,
Slovenia, Spain, Sweden, United Kingdom
};

static void
row_activated_cb(GtkTreeView   *tree_view,
 GtkTreePath   *path,
 GtkTreeViewColumn *column,
 gpointer   user_data)
{
gchar *str;
GtkTreeIter iter;
GtkTreeModel *model = gtk_tree_view_get_model (tree_view);
gtk_tree_model_get_iter (model, iter, path);
gtk_tree_model_get (model, iter, 0, str, -1);
g_debug (Row activated: %s, str);
g_free (str);
}

static GtkTreeModel *
create_model(void)
{
int i;
GtkListStore *store;

store = gtk_list_store_new (1, G_TYPE_STRING);

for (i = 0; i  G_N_ELEMENTS (countries); i++) {
gtk_list_store_insert_with_values (store, NULL, i, 0, countries[i], -1);
}

return GTK_TREE_MODEL (store);
}

static GtkWidget *
create_tree_view(void)
{
GtkWidget *tree_view;
GtkCellRenderer *renderer;
GtkTreeModel *model;

tree_view = hildon_gtk_tree_view_new (HILDON_UI_MODE_NORMAL);
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (tree_view), TRUE);

model = create_model ();
gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), model);
g_object_unref (model);

renderer = gtk_cell_renderer_text_new ();
g_object_set (renderer, xalign, 0.5, weight, PANGO_WEIGHT_BOLD, NULL);

gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view), 0,
 Column 0, renderer, text, 0, NULL);

return tree_view;
}


int
main(intargc,
 char **argv)
{
GtkWidget *window;
GtkWidget *panarea;
GtkWidget *treeview;

hildon_gtk_init (argc, argv);

window = hildon_window_new ();
panarea = hildon_pannable_area_new ();
treeview = create_tree_view ();

gtk_container_add (GTK_CONTAINER (panarea), treeview);
gtk_container_add (GTK_CONTAINER (window), panarea);

g_signal_connect (window, destroy, G_CALLBACK (gtk_main_quit), NULL);
g_signal_connect (treeview, row-activated, G_CALLBACK (row_activated_cb), NULL);

gtk_widget_show_all (window);

gtk_main ();

return 0;
}
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkTreeView behaviour

2010-01-12 Thread Piñeiro
From: George Kibardin george-kibar...@yandex.ru

 Hi everybody!
 
 I'm porting my application (FeedCircuit) to N900 and faced strange problem. I 
 have no real device so I'm using scratchbox. According to guidelines (like 
 this 
 http://sw.nokia.com/id/a3187f95-ad88-4233-b0ef-a182da3ec1c7/Hildon_2_2_Widget_UI_Specification_v1_0_en.pdf)
  when GtkTreeView is put into PannableArea it becomes finger friendly. When 
 it is created with hildon_gtk_tree_view_new(HILDON_UI_MODE_NORMAL) it should 
 emit row-activated signal after a single tap on it. In edit mode 
 hildon_gtk_tree_view_new(HILDON_UI_MODE_EDIT) tap must select/deselect one or 
 multiple records. In my case for some reason in normal mode I need two taps 
 to get row-activated signal: one tap to select appropriate item and another 
 one to activate it. In edit mode with multiple selection enabled I need to 
 use Ctrl to select multiple items which also seems wrong. What I'm doing 
 wrong?

In HILDON_UI_MODE_NORMAL you shouldn't require two taps to select an
item. In fact, in this mode there is no selection at all.

This is the reason the row-activated signal is emitted, in order to
get the element selected by the user.

Take into account that due legacy reasons gtktreeview required to
support the old behaviour (desktop and so on) and the fremantle new
behaviour (HILDON_UI_MODE_NORMAL and HILDON_UI_MODE_EDIT were added in
hildon fremantle). In order to do that, a new style property were
added in GtkWidget, called hildon-mode.

You need to set hildon-mode to one, this is normally done on a rc
file.

Anyway this is strange, as in the touch selector we set the
hildon-mode to 1 in this way:

 gtk_rc_parse_string (style \fremantle-htst\ {\n
 GtkWidget::hildon-mode = 1\n
   } widget \*.fremantle-htst\ style \fremantle-htst\
   widget_class \*HildonPannableArea.GtkTreeView\ 
style :highest \fremantle-htst\);

I hope this helps.

BR

===
API (apinhe...@igalia.com)
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: GtkTreeView behaviour

2010-01-12 Thread Alberto Garcia
On Tue, Jan 12, 2010 at 12:39:33PM +0100, Piñeiro wrote:

 You need to set hildon-mode to one, this is normally done on a rc
 file.

This is not necessary anymore :)

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


Re: Re: GtkTreeView behaviour

2010-01-12 Thread George Kibardin
Thank you Alberto for your code samble. I've found the problem. 
gtk_container_add() shoud be used instead of 
hildon_pannable_area_add_with_viewportl().

12.01.10, 12:23, Alberto Garcia agar...@igalia.com:

 On Mon, Jan 11, 2010 at 11:47:48PM +0300, George Kibardin wrote:
  
   In my case for some reason in normal mode I need two taps to get
   row-activated signal: one tap to select appropriate item and another
   one to activate it. In edit mode with multiple selection enabled
   I need to use Ctrl to select multiple items which also seems
   wrong. What I'm doing wrong?
  
  There must be something wrong in your code... I'm attaching a simple
  example of a treeview in normal mode, tell me if it works fine for
  you.
  
  Berto
  
  
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


GtkTreeView behaviour

2010-01-11 Thread George Kibardin
Hi everybody!

I'm porting my application (FeedCircuit) to N900 and faced strange problem. I 
have no real device so I'm using scratchbox. According to guidelines (like this 
http://sw.nokia.com/id/a3187f95-ad88-4233-b0ef-a182da3ec1c7/Hildon_2_2_Widget_UI_Specification_v1_0_en.pdf)
 when GtkTreeView is put into PannableArea it becomes finger friendly. When it 
is created with hildon_gtk_tree_view_new(HILDON_UI_MODE_NORMAL) it should emit 
row-activated signal after a single tap on it. In edit mode 
hildon_gtk_tree_view_new(HILDON_UI_MODE_EDIT) tap must select/deselect one or 
multiple records. In my case for some reason in normal mode I need two taps to 
get row-activated signal: one tap to select appropriate item and another one to 
activate it. In edit mode with multiple selection enabled I need to use Ctrl to 
select multiple items which also seems wrong. What I'm doing wrong?


Best,
George
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers