Re: Drag Drop on GTK + Maemo 5 (was: Re: [pymaemo] DnD on N900)

2010-01-13 Thread Kimmo Hämäläinen
On Wed, 2010-01-13 at 00:03 +0100, ext Jeffrey Barish wrote:
 Claudio Saavedra wrote:
 
  El mié, 06-01-2010 a las 19:44 -0400, Anderson Lizardo escribió:
  There is no drag 'n drop in Maemo GTK+. This has been deliberately
  disabled.
  
  Claudio
 
 Is there a way to enable drag  drop, ideally on a per-application basis?

Unfortunately not yet. There is a (internal) bug for enabling that.
Maybe maemo.org bug would help to get it fixed.


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


Re: Drag Drop on GTK + Maemo 5 (was: Re: [pymaemo] DnD on N900)

2010-01-12 Thread Jeffrey Barish
Claudio Saavedra wrote:

 El mié, 06-01-2010 a las 19:44 -0400, Anderson Lizardo escribió:
 There is no drag 'n drop in Maemo GTK+. This has been deliberately
 disabled.
 
 Claudio

Is there a way to enable drag  drop, ideally on a per-application basis?
-- 
Jeffrey Barish

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


Re: Drag Drop on GTK + Maemo 5 (was: Re: [pymaemo] DnD on N900)

2010-01-08 Thread Jeffrey Barish
Claudio Saavedra wrote:

 El jue, 07-01-2010 a las 10:08 -0400, Anderson Lizardo escribió:
 On Thu, Jan 7, 2010 at 5:37 AM, Claudio Saavedra csaave...@igalia.com
 wrote:
  There is no drag 'n drop in Maemo GTK+. This has been deliberately
  disabled.

 I believe that pretty much answers Jeff's issue... Was this done for
 Maemo 5 ? Because according to Jeff it used to work on the N810
 (Diablo). I haven't tested it myself on N810 , though.
 
 Yes, only since Maemo 5.

Out of curiousity, do you have any idea why it was disabled in Maemo 5?  Is 
there DnD in Maemo Qt?
-- 
Jeffrey Barish

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


Re: Drag Drop on GTK + Maemo 5 (was: Re: [pymaemo] DnD on N900)

2010-01-07 Thread Claudio Saavedra
El mié, 06-01-2010 a las 19:44 -0400, Anderson Lizardo escribió:
 [I'm CC'ing maemo-developers as it is clearly not a Python specific
 issue; see below for details]
 
 On Wed, Jan 6, 2010 at 2:11 PM, Jeffrey Barish
 jeff_bar...@earthlink.net wrote:
  Well, it took a little more than a few days, but here is a test program.  It
  works on Ubuntu and N810, but not N900.
 
 Well, I tested your example on Maemo and Ubuntu, and indeed the drag 
 drop only worked on Ubuntu. Additionally, this error is shown on
 console:
 
 /tmp/dndtest.py:77: Warning: g_object_set_data_full: assertion
 `G_IS_OBJECT (object)' failed
   gtk.main()
 
 So I went further and translated your example to C (please note I'm no
 GTK expert, I'm only trying to help debugging the problem). And the
 same behavior is presented: the drag does not work and this message is
 shown on console:
 
 dndtest[9349]: GLIB CRITICAL ** GLib-GObject - g_object_set_data_full:
 assertion `G_IS_OBJECT (object)' failed
 
 That means the problem is not related to Python or PyGTK at all, but
 some GTK limitation/bug on Maemo 5.

There is no drag 'n drop in Maemo GTK+. This has been deliberately
disabled.

A stacktrace on the critical warning would be useful to find out the
cause.

Claudio


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


Re: Drag Drop on GTK + Maemo 5 (was: Re: [pymaemo] DnD on N900)

2010-01-07 Thread Anderson Lizardo
On Thu, Jan 7, 2010 at 5:37 AM, Claudio Saavedra csaave...@igalia.com wrote:
 There is no drag 'n drop in Maemo GTK+. This has been deliberately
 disabled.

I believe that pretty much answers Jeff's issue... Was this done for
Maemo 5 ? Because according to Jeff it used to work on the N810
(Diablo). I haven't tested it myself on N810 , though.

 A stacktrace on the critical warning would be useful to find out the
 cause.

How to get that stack trace (some glib/gtk function?) ? it does not
crash the application , so I think gdb cannot be used in this case.

Thanks,
-- 
Anderson Lizardo
OpenBossa Labs - INdT
Manaus - Brazil
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Drag Drop on GTK + Maemo 5 (was: Re: [pymaemo] DnD on N900)

2010-01-07 Thread Claudio Saavedra
El jue, 07-01-2010 a las 10:08 -0400, Anderson Lizardo escribió:
 On Thu, Jan 7, 2010 at 5:37 AM, Claudio Saavedra csaave...@igalia.com wrote:
  There is no drag 'n drop in Maemo GTK+. This has been deliberately
  disabled.
 
 I believe that pretty much answers Jeff's issue... Was this done for
 Maemo 5 ? Because according to Jeff it used to work on the N810
 (Diablo). I haven't tested it myself on N810 , though.

Yes, only since Maemo 5.

 
  A stacktrace on the critical warning would be useful to find out the
  cause.
 
 How to get that stack trace (some glib/gtk function?) ? it does not
 crash the application , so I think gdb cannot be used in this case.

Set G_DEBUG=fatal-criticals. That will cause glib to abort on a critical
warning.

Claudio


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


Drag Drop on GTK + Maemo 5 (was: Re: [pymaemo] DnD on N900)

2010-01-06 Thread Anderson Lizardo
[I'm CC'ing maemo-developers as it is clearly not a Python specific
issue; see below for details]

On Wed, Jan 6, 2010 at 2:11 PM, Jeffrey Barish
jeff_bar...@earthlink.net wrote:
 Well, it took a little more than a few days, but here is a test program.  It
 works on Ubuntu and N810, but not N900.

Well, I tested your example on Maemo and Ubuntu, and indeed the drag 
drop only worked on Ubuntu. Additionally, this error is shown on
console:

/tmp/dndtest.py:77: Warning: g_object_set_data_full: assertion
`G_IS_OBJECT (object)' failed
  gtk.main()

So I went further and translated your example to C (please note I'm no
GTK expert, I'm only trying to help debugging the problem). And the
same behavior is presented: the drag does not work and this message is
shown on console:

dndtest[9349]: GLIB CRITICAL ** GLib-GObject - g_object_set_data_full:
assertion `G_IS_OBJECT (object)' failed

That means the problem is not related to Python or PyGTK at all, but
some GTK limitation/bug on Maemo 5.

The translated C example is attached.

Any ideas anyone? Regards,
-- 
Anderson Lizardo
OpenBossa Labs - INdT
Manaus - Brazil
#include gtk/gtk.h

gboolean on_delete_event(GtkWidget *widget, GdkEvent *event, gpointer data)
{
gtk_main_quit();
return FALSE;
}

void on_drag_data_received(GtkWidget *treeview,
   GdkDragContext   *drag_context,
   gint  x,
   gint  y,
   GtkSelectionData *data,
   guint info,
   guint time,
   gpointer  user_data)
{
gboolean ret;
GtkWidget *source_widget = gtk_drag_get_source_widget(drag_context);

GtkTreeModel *model;
gchar *source_row[2];
if (source_widget == treeview) {
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
GtkTreeIter iter;
ret = gtk_tree_selection_get_selected(selection, model, iter);
g_assert(ret == TRUE);
gtk_tree_model_get(model, iter, 0, source_row[0], 1, source_row[1], -1);
} else {
model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
source_row[0] = 9;
source_row[1] = newrow;
}
GtkTreePath *path;
GtkTreeViewDropPosition position;
ret = gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(treeview), x, y, path, position);
if (ret) {
GtkTreeIter iter;
ret = gtk_tree_model_get_iter(model, iter, path);
if (position == GTK_TREE_VIEW_DROP_BEFORE || position == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE) {
GtkTreeIter new_iter;
gtk_list_store_insert_before(GTK_LIST_STORE(model), new_iter, iter);
gtk_list_store_set(GTK_LIST_STORE(model), new_iter, 0, source_row[0], 1, source_row[1], -1);
} else {
GtkTreeIter new_iter;
gtk_list_store_insert_after(GTK_LIST_STORE(model), new_iter, iter);
gtk_list_store_set(GTK_LIST_STORE(model), new_iter, 0, source_row[0], 1, source_row[1], -1);
}
} else {
GtkTreeIter iter;
gtk_list_store_append(GTK_LIST_STORE(model), iter);
gtk_list_store_set(GTK_LIST_STORE(model), iter, 0, source_row[0], 1, source_row[1], -1);
}
if (drag_context-action == GDK_ACTION_MOVE) {
gtk_drag_finish(drag_context, TRUE, TRUE, (guint32)data);
}
}

int main(int argc, char **argv)
{
gtk_init(argc, argv);

GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), DND Test);
gtk_widget_set_size_request(window, 200, 300);
g_signal_connect(G_OBJECT(window), delete_event, G_CALLBACK(on_delete_event), NULL);

GtkWidget *button = gtk_button_new_with_label(Text on the button);

GtkListStore *liststore = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
GtkTreeIter iter;
gtk_list_store_append(liststore, iter);
gtk_list_store_set(liststore, iter, 0, 0, 1, zero, -1);
gtk_list_store_append(liststore, iter);
gtk_list_store_set(liststore, iter, 0, 1, 1, one, -1);
gtk_list_store_append(liststore, iter);
gtk_list_store_set(liststore, iter, 0, 2, 1, two, -1);
gtk_list_store_append(liststore, iter);
gtk_list_store_set(liststore, iter, 0, 3, 1, three, -1);
gtk_list_store_append(liststore, iter);
gtk_list_store_set(liststore, iter, 0, 4, 1, four, -1);
gtk_list_store_append(liststore, iter);
gtk_list_store_set(liststore, iter, 0, 5, 1, five, -1);
gtk_list_store_append(liststore, iter);
gtk_list_store_set(liststore, iter, 0, 6, 1, six, -1);

GtkWidget *treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(liststore));
g_signal_connect(G_OBJECT(treeview), drag-data-received, G_CALLBACK(on_drag_data_received), NULL);

GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes(Int,