Re: GtkNotebook with action on click of special tab
In the end it was as easy as replacing g_signal_connect with g_signal_connect_after Regards Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: multiple tree views
V Nedeľa, 1. máj 2011 o 15:59 +0200, Colomban Wendling napísal(a): Hi, Le 01/05/2011 15:03, Pavol Klačanský a écrit : Hi, I need in my about 5 and more treeviews. I created one using glade, but I don't know how can I use it multiple times, gtk says something like this (client:25913): Gtk-WARNING **: Attempting to add a widget with type GtkTreeView to a container of type GtkHBox, but the widget is already inside a container of type GtkHBox, the GTK+ FAQ at http://library.gnome.org/devel/gtk-faq/stable/ explains how to reparent a widget. You cannot pack a widget at more that one place at a time, you'll need to create 5 tree views. Though, if you want to display the same content in more than one tree view, you can share the TreeModel IIRC. Regards, Colomban ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list Hi, and can I create tree in Glade and use it as template? or Do I have to generate them in code? I wanna separated trees with separated storage ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: multiple tree views
2011/5/3 Pavol Klačanský pa...@klacansky.com: V Nedeľa, 1. máj 2011 o 15:59 +0200, Colomban Wendling napísal(a): Hi, Le 01/05/2011 15:03, Pavol Klačanský a écrit : Hi, I need in my about 5 and more treeviews. I created one using glade, but I don't know how can I use it multiple times, gtk says something like this (client:25913): Gtk-WARNING **: Attempting to add a widget with type GtkTreeView to a container of type GtkHBox, but the widget is already inside a container of type GtkHBox, the GTK+ FAQ at http://library.gnome.org/devel/gtk-faq/stable/ explains how to reparent a widget. You cannot pack a widget at more that one place at a time, you'll need to create 5 tree views. Though, if you want to display the same content in more than one tree view, you can share the TreeModel IIRC. Regards, Colomban ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list Hi, and can I create tree in Glade and use it as template? or Do I have to generate them in code? I wanna separated trees with separated storage ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list just keep spawning treeviews from your gladefile. Think of it as a building plan, not as an identifyable object. The result of building according the glade file plan will be aunique object. Hope that helps. Regards Bernhard ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
gtk+ 2 handling of X primary selection not optimal?
Hi, with gtk+ 2.20 (as in Debian 6) if you use the left mouse button to select text, over standard gtk+ text widgets, such as the about box of a gtk+ program, it seems the X primary selection is updated every time you select one more character (as you drag). This is not the behavior when dragging (selecting text) over web pages in Firefox, text in X term, or text in gnome-term, where the X primary selection is updated only after the user has released the button after finishing dragging. One would assume the gtk+ behavior increases CPU load and decreases the GUI performance... Andy -- Andy Tai, a...@atai.org, Skype: licheng.tai Year 2011 民國100年 自動的精神力是信仰與覺悟 自動的行為力是勞動與技能 ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GSource object lifetime
trying to stop a memory leak (2.24.1 x86_64)... I'm repetitively calling g_idle_source_new(), g_source_set_callback(), g_source_attach() to get an idle callback to run in a separate thread. The callback in question always exits with FALSE. The docs for GSourceFunc() state: ... Returns : it should return FALSE if the source should be removed. ... Does removed mean frees up the idle source, or just undoes the g_source_attach()? Should I be trying to reuse the idle source? I was destroying and recreating a time out source, but finally gave that up and just let it tick all the time. That stopped a leak in another program so that's why I was wondering... -- www.thomasstover.com FLYNN LIVES! ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GSource object lifetime
Le 03/05/2011 20:49, Thomas Stover a écrit : trying to stop a memory leak (2.24.1 x86_64)... I'm repetitively calling g_idle_source_new(), g_source_set_callback(), g_source_attach() to get an idle callback to run in a separate thread. The callback in question always exits with FALSE. Don't forget to unref your source after you attached to the context, because g_source_attach() increases the reference count of the source. Basically you need to: s = g_idle_source_new(); g_source_set_callback(s, func, data, notify); g_source_attach(s, ctx); g_source_unref(s); Unless you need to keep a reference to the source for some other reason of course. The docs are a bit lacking info on the matter, but the code can tell you (e.g. the source of g_idle_add(), which actually almost does this with NULL as the context). The docs for GSourceFunc() state: ... Returns : it should return FALSE if the source should be removed. ... Does removed mean frees up the idle source, or just undoes the g_source_attach()? AFAIK it means remove from the context and unref it, so if it was the last reference to that source it'd be freed, yes. Should I be trying to reuse the idle source? I was destroying and recreating a time out source, but finally gave that up and just let it tick all the time. That stopped a leak in another program so that's why I was wondering... I don't think you need to take care of re-using the same source again, it'd probably be only painful for you and I doubt it has any real benefit. Cheers, Colomban ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GSource object lifetime
Hi. I'm repetitively calling g_idle_source_new(), g_source_set_callback(), g_source_attach() to get an idle callback to run in a separate thread. The callback in question always exits with FALSE. Do you call g_source_unref() after attaching it? Cheers, Tadej. -- Tadej Borovšak tadeboro.blogspot.com tadeb...@gmail.com tadej.borov...@gmail.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GSource object lifetime
On Tue, 3 May 2011 22:06:02 +0200, Tadej Borovšak tadeb...@gmail.com wrote: Hi. I'm repetitively calling g_idle_source_new(), g_source_set_callback(), g_source_attach() to get an idle callback to run in a separate thread. The callback in question always exits with FALSE. Do you call g_source_unref() after attaching it? Cheers, Tadej. That did help (I think I still have an unrelated leak). I think a few things could be made more clear in the docs (I'm not 100% sure I'm correct either): -A newly created source (from g_idle_source_new() ) has a reference count of 1 not 0. -g_source_attach() increases the reference count by 1 -returning FALSE in a source callback function detaches the source from the source's attached main context, and decreases the reference count by 1 -Once a source has been detached by source callback function returning FALSE, it can not be reattached g_source_attach(). An assertion error is thrown. You can however, decrease the source's reference count down to 0 so it will free itself, then create a fresh source. -- www.thomasstover.com FLYNN LIVES! ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GSource object lifetime
Hi. That did help (I think I still have an unrelated leak). I think a few things could be made more clear in the docs (I'm not 100% sure I'm correct either): I must agree with you here. Docs are a bit scarce on this topic. But ... -A newly created source (from g_idle_source_new() ) has a reference count of 1 not 0. -g_source_attach() increases the reference count by 1 -returning FALSE in a source callback function detaches the source from the source's attached main context, and decreases the reference count by 1 -Once a source has been detached by source callback function returning FALSE, it can not be reattached g_source_attach(). An assertion error is thrown. You can however, decrease the source's reference count down to 0 so it will free itself, then create a fresh source. You got it exactly right. I would only add that you decrease reference count right after attaching it to context (like Colomban already suggested). This way memory used by source will be freed when detached from context. All that being said, maybe you could cook up a patch for API docs with this info? I'm sure people would find it useful. Tadej -- Tadej Borovšak tadeboro.blogspot.com tadeb...@gmail.com tadej.borov...@gmail.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GSource object lifetime
On Tue, 3 May 2011 22:50:38 +0200, Tadej Borovšak tadeb...@gmail.com wrote: All that being said, maybe you could cook up a patch for API docs with this info? I'm sure people would find it useful. Is there a starting place to read how to go about doing that? -- www.thomasstover.com FLYNN LIVES! ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list