ext Matt Clark wrote:
I thought before I submit a bug I'd see if anyone can point out where I'm going wrong. My problem is that in an app I'm developing I'm not getting row-activated signals from a GtkTreeView under pygtk on an N800, but they work fine under pygtk elsewhere (e.g. Ubuntu Feisty (python 2.5.1), or OS X/Fink (python 2.4.2)). The N800 is latest firmware with no changes except the addition of the latest osso- xterm, python2.5-runtime and dropbear.


Hi Matt, I tried your code and a version in C (attached), which has the same problem.

Looking into the Maemo Gtk2.6 Contributions page at lgo[1], there's the following comments about the GtkTreeView:

gtktreeview.c - (!) - M58 - Tap on row activates, for multiple selection all selected rows all activated (can be done outside of tree view). gtktreeview.c - (!) - M58 - Double click handling code (in button_press) commented out, should be uncommented.

By the legend, the "(!)" symbol indicates change needed on maemo-gtk/glib.

The M58 is one of the changes from MaemoGtk to the api provided by Gtk+ 2.10 [2]. It's about changes on the GtkTreeView that could be implemented outside Gtk+, including row-activation.

So, according to those items, the double-click code (which triggers the row-activated on desktop) is commented out and to activate the row would be necessary just a tap, but it isn't working.

[1] http://live.gnome.org/Maemo/Gtk26Contributions
[2] http://live.gnome.org/Maemo/Gtk210Migration#M58

--
Lauro Moura
INdT - Recife
#include <hildon-widgets/hildon-program.h>
#include <gtk/gtk.h>

void activation_callback(GtkTreeView *treeview,
                         GtkTreePath *path,
                         GtkTreeViewColumn *col,
                         gpointer user_data)
{
    g_debug("row-activated callback");
    return;
}

enum {
        TEXT_COL
};

int main(int argc, char *argv[])
{
    int i;
    
    HildonWindow *window;
    HildonProgram *program;
    GtkWidget *treeview;
    GtkTreeStore *store;
    GtkTreeIter parentIter;
    GtkTreeIter childIter;
    GtkCellRenderer *cellrenderer;
    GtkTreeViewColumn *col;
    

    gtk_init(&argc, &argv);

    program = HILDON_PROGRAM(hildon_program_get_instance());
    g_set_application_name("row-activation test");

    window = HILDON_WINDOW(hildon_window_new());

    hildon_program_add_window(program, window);
    g_signal_connect(G_OBJECT(window), "delete-event",
                     G_CALLBACK(gtk_main_quit), NULL);
    
    /* TreeView creation */
    store = gtk_tree_store_new(1, G_TYPE_STRING);
    
    gtk_tree_store_append(store, &parentIter, NULL);
    gtk_tree_store_set(store, &parentIter, 0, "Parent item 0",-1);
    
    gtk_tree_store_append(store, &childIter, &parentIter);
    gtk_tree_store_set(store, &childIter, 0, "Child item 0",-1);

    treeview = gtk_tree_view_new();

    gtk_tree_view_set_model(GTK_TREE_VIEW(treeview),
                            GTK_TREE_MODEL(store));

    cellrenderer = gtk_cell_renderer_text_new();
    
    col = gtk_tree_view_column_new_with_attributes("Title",
                                                    cellrenderer,
                                                    "text", TEXT_COL,
                                                    NULL);
    
    gtk_tree_view_append_column(GTK_TREE_VIEW(treeview),
                                col);

    g_signal_connect(G_OBJECT(treeview), "row-activated", 
                     G_CALLBACK(activation_callback), NULL);
    /* Done with treeview */
    
    gtk_container_add(GTK_CONTAINER(window), treeview);
    gtk_widget_show_all(GTK_WIDGET(window));
    
    gtk_main();
    return 0;
}
_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers

Reply via email to