how to hint gtk about a useful start of the focus chain

2011-08-02 Thread Stefan Kost
hi,

having the focus on the right widget can make apps more productive. I feed that 
right now either I am missing something or gtk does not a good job at it.

For odd reasons gtk prefers to focus toolbar button on new windows (which is
strange and not useful imho). When trying to hint gtk+ about what a useful focus
behavior I came across gtk_button_get_focus_on_click(). The documentations
says "Making mouse clicks not grab focus is useful in places like toolbars
where you don't want the keyboard focus removed from the main area of the
application.". Although this function cannot be used with toolbar buttons as 
those are
toolitems. Then I discovered that gtktoolitem.c seems to actually call this 
internaly.
http://git.gnome.org/browse/gtk+/tree/gtk/gtktoolbutton.c?h=gtk-2-24#n308

Should the docs be changed to mention that for toolbars its helpful for
toolitem implementations?

Should gtk take that flag into account when determining the widget that gets
focus in a new window. Right now it stubbornly focuses on the toolitem. No
matter how hard I try (e.g. gtk_widget_grab_focus(other_widget) in window::show
signal handler).

Any tips? What are you guy using to set a proper focus on new windows/dialogs.

Stefan


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gobject construction with parameter

2011-06-30 Thread Stefan Kost
On 01/31/11 16:39, James Morris wrote:
> On 31 January 2011 13:32, Jannis Pohlmann  wrote:
>
>>> Can anyone point me in the direction of code examples where the
>>> construction of the g object requires a parameter so I can see how to
>>> do it please? - I can't make sense of the documentation.
>> I usually do this by adding a construct or construct-only property to
>> the object class and creating a my_object_new() function that takes a
>> parameter for this property that I can then pass to g_object_new().
>>
>> Here's a simple example from Xfce's XDG menu library garcon: GarconMenu
>> is the object and it needs a menu file (a GFile object) to be
>> constructed properly. So what we did is to to install a construct-only
>> property like this:
>>
>>  http://git.xfce.org/libs/garcon/tree/garcon/garcon-menu.c#n246
> It looks straight forward at first glance but soon becomes apparent
> it's not at all :/
>
> I want to pass a const char** null terminated list of C strings -
> which is obviously not a G_TYPE_FILE!
> I thought maybe I could use G_TYPE_ARRAY but that results in:
>
> GLib-GObject-CRITICAL **: g_param_spec_object: assertion `g_type_is_a
> (object_type, G_TYPE_OBJECT)' failed
>
> So I've no idea what to do there. It's as clear as mud; I'm a GObject newb.
>
>
>> and write a _new() function that takes a GFile for this property and
>> passes it to g_object_new():
>>
>>  http://git.xfce.org/libs/garcon/tree/garcon/garcon-menu.c#n459
>>
>> This property will not be available in the init function (e.g.
>> garcon_menu_init) but if you want to do something with it before the
>> object can be used by the outside world, you can do that by overriding
>> the GObject constructed function like you do with finalize or
>> get_property. In constructed, the construct and construct-only
>> properties will be set and you can do something with them.
>>
> Anyway, thanks for making an effort to help.  I think the only way
> anyone could provide any further help here would be to show me an
> example that works using a const char ** null terminated list of c
> strings as a parameter to the constructor.

Use gpointer or a gboxed.

Stefan
> I will most likely avoid GObject all together and do it the old
> fashioned C way as this only seems to be making it more complex than
> necessary.
>
> Thanks,
> James.
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gobject construction with parameter

2011-06-30 Thread Stefan Kost
On 01/31/11 16:39, James Morris wrote:
> On 31 January 2011 13:32, Jannis Pohlmann  wrote:
>
>>> Can anyone point me in the direction of code examples where the
>>> construction of the g object requires a parameter so I can see how to
>>> do it please? - I can't make sense of the documentation.
>> I usually do this by adding a construct or construct-only property to
>> the object class and creating a my_object_new() function that takes a
>> parameter for this property that I can then pass to g_object_new().
>>
>> Here's a simple example from Xfce's XDG menu library garcon: GarconMenu
>> is the object and it needs a menu file (a GFile object) to be
>> constructed properly. So what we did is to to install a construct-only
>> property like this:
>>
>>  http://git.xfce.org/libs/garcon/tree/garcon/garcon-menu.c#n246
> It looks straight forward at first glance but soon becomes apparent
> it's not at all :/
>
> I want to pass a const char** null terminated list of C strings -
> which is obviously not a G_TYPE_FILE!
> I thought maybe I could use G_TYPE_ARRAY but that results in:
>
> GLib-GObject-CRITICAL **: g_param_spec_object: assertion `g_type_is_a
> (object_type, G_TYPE_OBJECT)' failed
>
> So I've no idea what to do there. It's as clear as mud; I'm a GObject newb.
>
>
>> and write a _new() function that takes a GFile for this property and
>> passes it to g_object_new():
>>
>>  http://git.xfce.org/libs/garcon/tree/garcon/garcon-menu.c#n459
>>
>> This property will not be available in the init function (e.g.
>> garcon_menu_init) but if you want to do something with it before the
>> object can be used by the outside world, you can do that by overriding
>> the GObject constructed function like you do with finalize or
>> get_property. In constructed, the construct and construct-only
>> properties will be set and you can do something with them.
>>
> Anyway, thanks for making an effort to help.  I think the only way
> anyone could provide any further help here would be to show me an
> example that works using a const char ** null terminated list of c
> strings as a parameter to the constructor.

Use gpointer or a gboxed.

Stefan
> I will most likely avoid GObject all together and do it the old
> fashioned C way as this only seems to be making it more complex than
> necessary.
>
> Thanks,
> James.
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gobject construction with parameter

2011-06-30 Thread Stefan Kost
On 01/31/11 16:39, James Morris wrote:
> On 31 January 2011 13:32, Jannis Pohlmann  wrote:
>
>>> Can anyone point me in the direction of code examples where the
>>> construction of the g object requires a parameter so I can see how to
>>> do it please? - I can't make sense of the documentation.
>> I usually do this by adding a construct or construct-only property to
>> the object class and creating a my_object_new() function that takes a
>> parameter for this property that I can then pass to g_object_new().
>>
>> Here's a simple example from Xfce's XDG menu library garcon: GarconMenu
>> is the object and it needs a menu file (a GFile object) to be
>> constructed properly. So what we did is to to install a construct-only
>> property like this:
>>
>>  http://git.xfce.org/libs/garcon/tree/garcon/garcon-menu.c#n246
> It looks straight forward at first glance but soon becomes apparent
> it's not at all :/
>
> I want to pass a const char** null terminated list of C strings -
> which is obviously not a G_TYPE_FILE!
> I thought maybe I could use G_TYPE_ARRAY but that results in:
>
> GLib-GObject-CRITICAL **: g_param_spec_object: assertion `g_type_is_a
> (object_type, G_TYPE_OBJECT)' failed
>
> So I've no idea what to do there. It's as clear as mud; I'm a GObject newb.
>
>
>> and write a _new() function that takes a GFile for this property and
>> passes it to g_object_new():
>>
>>  http://git.xfce.org/libs/garcon/tree/garcon/garcon-menu.c#n459
>>
>> This property will not be available in the init function (e.g.
>> garcon_menu_init) but if you want to do something with it before the
>> object can be used by the outside world, you can do that by overriding
>> the GObject constructed function like you do with finalize or
>> get_property. In constructed, the construct and construct-only
>> properties will be set and you can do something with them.
>>
> Anyway, thanks for making an effort to help.  I think the only way
> anyone could provide any further help here would be to show me an
> example that works using a const char ** null terminated list of c
> strings as a parameter to the constructor.

Use gpointer or a gboxed.

Stefan
> I will most likely avoid GObject all together and do it the old
> fashioned C way as this only seems to be making it more complex than
> necessary.
>
> Thanks,
> James.
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
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

2011-05-28 Thread Stefan Kost
Am 04.05.2011 00:03, schrieb Thomas Stover:
> On Tue, 3 May 2011 22:50:38 +0200, Tadej Borovšak 
> 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?
> 
> 
A brief howto:
* clone the repository (check the address from git.gnome.org)
* do e.g. find . -type f -exec grep -l "* g_source_attach:" {} \;  to find the
file containing the api-docs
* make changes
* git add 
* git commit and describe the changes
* git format-patch origin
* open a bug in bugzilla and attach the patch file (e.g.
0001-docs-improve-api-docs.diff)
* let us know in this thread about the bugzilla ticket number (at least this 
time).

more info about git + gnome: http://live.gnome.org/Git
more info about bugzilla + gnome: http://live.gnome.org/Bugzilla


Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: scan code for required gtk version

2011-02-05 Thread Stefan Kost
Am 01.01.2011 17:30, schrieb Dan McMahill:
> Is there a way to scan ones source code automatically to determine the
> minimum required version of gtk and also glib?  The reason I ask is I've
> been involved in a project that doesn't really use lots of the most
> cutting edge features and in general, we only want to bump the required
> version in cases where there is some really motivating reason to do so.
>  That said, I also don't want to maintain a whole bunch of different gtk
> installs only for purposes of trying to see how far back I can go and
> still build this other program.
> 
> Thanks
> -Dan
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

gtk-doc has a "gtkdoc-depscan" script for it.

Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Performance issues of GDK deprecation in favour of Cairo

2010-08-18 Thread Stefan Kost
hi,

On 17.08.2010 12:01, James Morris wrote:
> Hi,
>
> I see that some GDK drawing functions and graphics contexts have been
> deprecated in favour of using Cairo.
>
> Yesterday I spent a few hours *removing* Cairo code from my fledgling
> GTK application and replacing it with gdk_draw_rectangle,
> gdk_gc_set_rgb_fg_color, and gdk_gc_set_function. I did this for
> performance reasons[1]
>
> I am wondering if my approach to drawing is wrong however and if a
> better approach might yield less CPU usage?
>
> It begins with a 33ms timeout. The timeout callback calls
> gtk_widget_queue_draw on the window and the drawing area.
>   

Would it be possible to isolate this into a standalone demo. Or could
you point us to the actual code?

Stefan

> (Imagine rectangles appearing each time a note is played in a piece of
> music and disappearing when that note ends.)
>
> In the expose event callback a linked-list of rectangles is
> maintained. Rectangles are added to the list and removed from the list
> as notes start and end (The application is an experimental MIDI
> sequencer/arpeggiator operating in real time).
>
> Each and every time the expose event callback is called (every 33ms)
> the background and the entire list of rectangles is drawn as well as
> various maintenance functions performed on the list.
>
> The documentation of gdk_cairo_create seems to suggest this is the
> only way of doing it when it says:
>
> "Note that due to double-buffering, Cairo contexts created in a GTK+
> expose event handler cannot be cached and reused between different
> expose events."
>
> Is it possible to do this any other way?
> Cheers,
> James.
>
> [1]My machine is a 64bit 3.0ghz dual core desktop. Using GDK for
> drawing, the CPU usage is at worst 5% on both cores. Using Cairo on
> the other hand, the CPU usage can reach as much as 20% on both cores.
>
> The project is here:http://github.com/jwm-art-net/BoxySeq
> Cairo routines is here:
> http://github.com/jwm-art-net/BoxySeq/tree/97f6d674a2a182a143ef82b03bde11689fedcf18
> GDK routines is here:
> http://github.com/jwm-art-net/BoxySeq/tree/29f412b41b2371ec136aa86da50d858f5892bfa0
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>   

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Dynamic change of language(local languages like german, chinese, french....) in Gtk

2010-01-26 Thread Stefan Kost
Am 25.01.2010 16:46, schrieb harshavardhanreddy mandeepala:
> Hi,
> 
> I think this question might have discussed but i couldn't find any
> satisfying answers.
> 
> While searching in net i found useful info how to provide
> internationalization/localization(supporting
> english,french,german,chinese...) support using Gtk.
> 
> But All is well and all works fine if i reboot my app or system.
> 
> But in a real world situation like mobile phones,user want to see the
> language change dynamically(without rebooting/restart).
> 
> Is there any way to do that? In Qt I think they will connect the widget to
> Changeevent and will see if the event is Languagechangeevent then settext
> the label of widget.
> 
> If any elegant way is there in Gtk to do this kindly suggest me.

There isn't really. Basically gtk does not know wheter the ui is translated or
not. E:g. one calls
gtk_label_set_text(label,_("translated text"));
or
gtk_label_set_text(label,"untranslated text");
for gtk it is just text. To change that we would need a lot of new api, like
gtk_label_set_i18n_text(domain,N_("translated text"));
so that gtk+ could catch changes to the locale and update the UI.

No idea if we could do some black magic for UIs that use gtkbuilder. Something
that allows apps to catch the locale change and systematically set all texts 
again.

Stefan
> 
> 
> Thanks,
> 
> Regards,
> Harsha
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: simple internalisation

2010-01-16 Thread Stefan Kost
Am 12.01.2010 14:31, schrieb Pavel A. da Mek:
>> For example, having "File" stock item doesn't make much
> sense, since files usually carry their own name and this is what
> should be displayed.
> 
> Most programs have the "File" menu item in the tool bar.
> To create menu items from stock items is a simple way to present
> translated labels for all languages supported by gtk at least for the
> frquently used items,  without need to manage translations to all those
> languages for the application.
> 
> What I am doing is this:
> 
> GtkWidget* menu_item_new_from_stock (const gchar *stock_id) {
> GtkStockItem item;
> 
> if (gtk_stock_lookup (stock_id, &item)) {
>  return gtk_menu_item_new_with_mnemonic (item.label);
> }
> return gtk_menu_item_new_with_mnemonic (stock_id);
> }
> 
> ...
> // *** menu items in menu bar
> editMBMenuItem = menu_item_new_from_stock (GTK_STOCK_EDIT);
> preferencesMBMenuItem = menu_item_new_from_stock (GTK_STOCK_PREFERENCES);
> helpMBMenuItem = menu_item_new_from_stock (GTK_STOCK_HELP);
> ...

People usualy don'T use stockitems for the menubar, just for the menu items. I
never saw a app with icons in the menu bar. The whole stock business is kind of
obsolete anyway, as the the images are not shown anymore by default in latest
gnome :/

Stefan

> 
> But because this does not work for GTK_STOCK_FILE,
> I am using this:
> 
> #include 
> #define T_(String) dgettext ("gtk20", String)
> ...
> fileMBMenuItem = gtk_menu_item_new_with_mnemonic (T_("_Files"));
> ...
> 
> Other frequently used words are available too, for example
> 
> searchMBMenuItem = gtk_menu_item_new_with_mnemonic (T_("Search"));
> 
> Some other words are translated for gtk properties and for glib,
> so I am using also this:
> 
> #define L_(String) dgettext ("glib20", String)
> #define P_(String) dgettext ("gtk20-properties", String)
> 
> for example:
> 
> settingsMBMenuItem = gtk_menu_item_new_with_mnemonic (P_("Settings"));
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkTreeView in VBox

2010-01-16 Thread Stefan Kost
Am 07.01.2010 14:24, schrieb Amol Kulkarni:
> Hi All,
> Is it possible to add GtkTreeView inside VBox and then add that VBox to
> ScrolledWindow using gtk_scrolled_window_add_with_viewport(sw,vbox).
> GtkTreeView has inbuilt scrolling support hence it is expected to add it
> directely to scrolledwindow using gtk_container_add but in some weird
> case i want to pack treeview in vbox which will eventually be placed in
> scrolledwindow.
> It works fine for most of the cases but if i am having long list of
> elements packed inside it then it behaves very randomly when my
> scrolledwindow adjustment value is between some range [17000 - 27000] it
> again works fine once adjustment moves beyond that. 
> Since i am not adding treeview directely to scrolledwindow treeview
> adjustments and scrolledwindow adjustments may not be in sync but if i
> manually set treeview adjustments then i get double scrolling [scrolled
> window + treeview] which i don't want.
> Is this expected/supported use case or am i doing something wrong here?
> Thanks for your time.


What are the other things you put into the vbox? Maybe there is a better
solution. e.g. if you want two widgets side by side you an use:
vbox
  scrolled window 1
treeview
  scrolled window 2
your other widget

- then share the gtkadjustment of scrolled window 1 with scrolled window 2
- set scrollbar policies so that you see them just once

I have a short standalone example if thsi is what you want.

Stefan

> 
> --
> Thanks and Regards,
> Amol
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to set a window filled the whole screen when we start the window?

2009-06-26 Thread Stefan Kost
Michael Torrie schrieb:
> donglongchao wrote:
>> Thank you very much.That is just what I need.
>> I am not very familiar with the API manual.
> 
> I always program with a web browser open showing the API docs.  Although
> they often lack documentation and examples (they are generated from the
> source code), they at least document the API calls and parameters, the
> various enumerations, structures, etc.  Invaluable, although a bit hard
> to search. Fortunately google helps out there.

Hej,
just install devhelp and the -dev packages. Then you even have search.

Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Accelerator

2009-06-06 Thread Stefan Kost
dhk schrieb:
> Are accelerators only for menu items?  I've seen a lot of examples with
> accelerators and the all seem to connect to a menu item.  I've been
> having a difficult time getting accelerators to work even with the
> examples.  I think I'm missing something.
> 
> One thing I would like is to just have an accelerator execute a function
> or a callback.  Maybe if I could just print "Hello World" to the
> terminal when pressing Alt-F4 would help prove the concept.

I am struggling with the same issue and resorted to a terrible hack. I've
defined a popupmenu which I never show. It contains menu items with the
accelerators. Voila, global accelerators for the app :)

Stefan

> 
> Can someone help?
> 
> Thanks,
> 
> dhk
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: [Fwd: gstreamer mingw cross development libraries?]

2009-03-30 Thread Stefan Kost
John Stebbins schrieb:
> Oops, sent private message instead of to the list again. Redirecting
> to list.
>
> Tor, I wanted to thank you again for your help.  I've successfully
> ported my app (handbrake video transcoder).  There's only one missing
> feature, live preview, and for that I need working gstreamer cross
> development libs.  I've looked around, but have only found stuff that
> is broken in some way.
>
Unless you have already write to gstreamer-devel mailing list or check
on #gstreamer on freenode irc.

Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Scrolling multiple treeviews

2009-03-23 Thread Stefan Kost
dhk schrieb:
> Is it possible to have a single vertical scrollbar scroll multiple
> treeviews?
>
> To avoid using a horizontal scroll on a large set of data I broke the
> data up into multiple treeviews.  However, I would like to have one
> scroll control all the views at the same time instead of each treeview
> having it's own scrollbar.
>
> All ideas and examples are welcome.
>   
yes, you can share the adjustment.

Stefan
> Thanks in advance.
>
> dave
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>   

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: treeview with fixed in place first row

2009-02-26 Thread Stefan Kost
Stefan Kost schrieb:
> DEXTER schrieb:
>> Hi there,
>>
>> I have a treeview and what I'd like to achieve is that the first row
>> of the treeview (under the column headers) be fixed at its place so
>> the scrolling won't affect it. I would use this very first row to
>> filter the treeview. Attached an image showing the what I would like
>> to make. (As you can see there's a row under the column headers
>> including comboboxes)
>>
>> I was able to access the column headers' buttons. (TreeViewColumn) The
>> TreeViewColumn has a function called set_widget, and I can set any
>> widget _inside_ that button, but it is not good for me, because if I
>> set a combobox with this, than - since it is inside the button - it
>> acts like a button too.
>>
>> I also tried to replace that button with a vbox (and put the button
>> and a combobox in the vbox) but as soon as I removed the button from
>> the treeview, it complaind about propagating expose cannot be done (
>> g_assert (child->parent == GTK_WIDGET (container));) I think this is
>> because this button is a private child of the treeview, so it won't
>> let me replace it with any other widget.
>>
>> Is there any other way to achieve this? Any suggestions are welcome.
>>
> I have a simmilar need in buzztard for the first column and what I actually do
> is to use two treeview and share the scrollbar. See the attched sample.
> 
> Stefan

Mr. mailing list is smart and drops sample code :/
http://buzztard.svn.sourceforge.net/viewvc/buzztard/trunk/buzztard/design/gui/syncviews.c?revision=1742

Stefan

> 
>> Thx.
>> Balazs
>>
>>
>> 
>>
>> ___
>> gtk-app-devel-list mailing list
>> gtk-app-devel-list@gnome.org
>> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 
> 
> 
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: treeview with fixed in place first row

2009-02-26 Thread Stefan Kost
DEXTER schrieb:
> Hi there,
> 
> I have a treeview and what I'd like to achieve is that the first row
> of the treeview (under the column headers) be fixed at its place so
> the scrolling won't affect it. I would use this very first row to
> filter the treeview. Attached an image showing the what I would like
> to make. (As you can see there's a row under the column headers
> including comboboxes)
> 
> I was able to access the column headers' buttons. (TreeViewColumn) The
> TreeViewColumn has a function called set_widget, and I can set any
> widget _inside_ that button, but it is not good for me, because if I
> set a combobox with this, than - since it is inside the button - it
> acts like a button too.
> 
> I also tried to replace that button with a vbox (and put the button
> and a combobox in the vbox) but as soon as I removed the button from
> the treeview, it complaind about propagating expose cannot be done (
> g_assert (child->parent == GTK_WIDGET (container));) I think this is
> because this button is a private child of the treeview, so it won't
> let me replace it with any other widget.
> 
> Is there any other way to achieve this? Any suggestions are welcome.
>
I have a simmilar need in buzztard for the first column and what I actually do
is to use two treeview and share the scrollbar. See the attched sample.

Stefan

> 
> Thx.
> Balazs
> 
> 
> 
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: GTK warning

2009-02-22 Thread Stefan Kost
Jeffrey Barish schrieb:
> Stefan Kost wrote:
> 
>> How should gobject know the name of your variable? In GStreamer we have a
>> GstObejct which has a name property, that makes it easier.
> 
> How do you know it's one of my variables that is being unreferenced?  The
> warning message refers me to line 118 where I don't see that any of my
> variables is being unreferenced.  If there's a problem in the
> set_from_pixbuf call, I don't see why GTK can't provide more information
> about the nature of the problem.  If there's a problem somewhere else, I
> don't see why GTK is directing me to line 118.

its not gtk, its glib.
/myprogram.py:118: Warning: g_object_unref: assertion `object->ref_count >
0' failed

mean when you (or something you called) call(s) unref the refount is already 0.
That is somthing forgot to ref or something unref too much. glib can just point
out that something is wrong. Imho fixing refount problem is one of the most
difficult problems, very unfortunately.

> 
> I have now established that running the program with --g-fatal-warnings on
> the command line does do something: It causes the program to exit, just as
> it does in C.  However, in Python, I need to catch the exception before
> exiting so that I can run the debugger and view the traceback, but it is
> not possible to catch SystemExit.  I'm still clinging to the hope that a
> traceback will be helpful despite your advice that it usually isn't when
> the problem is a refcount issue.  Nevertheless, I clearly have fallen out
> of the purview of this group, so I'll try to figure out a better place to
> post.  Thanks anyway for all the suggestions.

What you need to do is to get traces for all refs and unref to that instance of
the object and find where they get unbalanced. refdbg.sf.net can help to get the
traces. One thing that is needed is to filter known paired ref/unrefs (like when
you do a g_onbject_set). Right now I go manualy over the traces and remove pairs
until I have tracked the issues down.

Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GTK warning

2009-02-22 Thread Stefan Kost
hi,

Jeffrey Barish schrieb:
> Dov Grobgeld wrote:
>> 2009/2/21 Jeffrey Barish 
>>
>>> I hate the warning messages that GTK provides because they rarely help me
>>> find the problem.  What does this one mean?
>>>
>>> /myprogram.py:118: Warning: g_object_unref: assertion `object->ref_count
 0' failed
>>>  self['myimage'].set_from_pixbuf(mypb)
>>>
>>> What object is producing the warning?  I suppose it must be myimage. 
>>> What am I supposed to do?  If I exit the program and run it again, 9
>>> times out of 10 I don't get the warning.
>> The message means exactly what it sais, that you try to reduce the ref
>> count of an object that doesn't exist.
> 
> Of course.  My complaint is that the message doesn't tell me which object. 
> It refers me to a specific line in which it isn't obvious that any object
> is being unreferenced.  That line sets the pixbuf, which, if anything,
> would increase the ref count of something.  If the dereference occurs
> somewhere else, then the warning shouldn't refer me to this line of code.

How should gobject know the name of your variable? In GStreamer we have a
GstObejct which has a name property, that makes it easier.

>> But since the example you give is in Python this probably means that there
>> is an error in the python binding. You should try to create a minimum
>> example that triggers the problem and try to create a bug report.
> 
> If there were an error in the Python binding, then I would expect the
> warning to be consistent.  For that matter, it should be consistent if the
> error were in my code or in GTK.
> 
> I'm running my program with --g-fatal-warnings at the end of the command
> line.  I don't know whether that flag does anything in PyGTK, though.

That flag work on Glib level and makes warnings fatal to be able to get a
backtrace in gdb. For refcounts that is not always useful. Read the README in
refdb it explains types of refcount isssues and helps a bit for debug them.
Unfortunately its still not easy as you can't automatically tell which ref or
unref is wrong.

Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: i18n, intltool problems

2009-02-07 Thread Stefan Kost
John Coppens schrieb:
> On Thu, 5 Feb 2009 14:05:04 -0200
> John Coppens  wrote:
> 
>> During several tests, I came across the famous "your intltool is too
>> old. You need intltool 0.35.0 or newer". I have 0.40.5 installed, as
>> shown by:
>>
>> $ intltool-update --version   
>> intltool-update (intltool) 0.40.5
> 
> Solved this one partially... There was another intltool.m4 laying around
> which contained the wrong macro. Now the test succeeds, but I get:
> 
> Syntax error near unexpected token '0.35.0'. The corresponding line in
> the configure script is:
> 
> IT_PROG_INTLTOOL([0.35.0])

rerun aclocal and check that you have IT_PROG_INTLTOOL in your aclocal.m4. You
will get this error if autoconf did not replace a macro. The text will stay in
the generated configure script and the shell complains as this is not valid 
syntax.

Stefan

> 
> Suggestions?
> John
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: qt vs gtk

2009-01-18 Thread Stefan Kost
Michael Torrie schrieb:
> jvette...@users.sourceforge.net wrote:
>> I find that deriving classes in C++ is alot easier than going through 
>> the GObject type system.
> 
> Yes this is true, in C.  GTKmm makes things rather nice if you work in
> C++.  In fact I kind of like how GTKmm works without a preprocessor,
> with type-safe callbacks.  I wish Qt folks would compare Qt against
> GTKmm rather than just GTK+, as they are looking at things from a C++
> point of view anyway.
> 
>> When it comes to documentation, Qt really outshines Gtk.  I have never 
>> had to dive through code to figure something out in Qt.  I always have a 
>> copy of the Gtk source code untarred and ready, though.
> 
> GTK is always in need of people willing to flesh out the documentation.
>  It is nice that one can refer to the source code in any open source
> project.

Also to kill a myth:
> head docs/reference/gtk/gtk-undocumented.txt
93% symbol docs coverage.
5397 symbols documented.
116 symbols incomplete.
406 not documented.

Its not that bad. What imho is needed, is to move the docs inline (into the
soruces), fill the gaps and extend them. Also the tutorial could be merged and
then benefit from the xrefs (but it would need a general overhaul most probably
before).

Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to use Quarks?

2009-01-11 Thread Stefan Kost
Andrew Cowie schrieb:
> On Sat, 2009-01-03 at 10:40 -0500, Yu Feng wrote:
>> If you are accessing data member(g_object_set_data) frequently you could
>> use quarks to accelerate the looking up process(g_object_set_qdata).
> 
> On Sun, 2009-01-04 at 14:41 +0200, Stefan Kost wrote:
>> If you use a hashtable with strings as keys, a lookup on the hashtable would
>> need to compare the strings to find the entry. ... [so GQuark] as keys
>> in the hashtable [is easier]
> 
> This all begs a question: 
> 
> Is using g_object_set_qdata() and g_object_get_qdata() better because
> the "arbitrary data" capability in GObjects is
> 
> - powered by a mechanism that is going to convert string keys to
> GQuarks (interning, presumably) every time for lookups, or
> 
> - because it keeps two tables (one of string keys and one of
> integer [GQuark] keys, or
> 
> - ...?
> 
> ie, it sounds like we should switch to g_object_set_qdata() for our one
> and only use of GObject "data"; we request and set that value a *lot*,
> and I'm always pleased to use faster code paths. The key we use is
> already a static string anyway.
> 
> AfC
> Sydney
> 
The point is that if you can do the g_quark_from_string() and store the quark,
you can save the cost of this call. So if you need to lookup some struct for a
parameter already, stick the quark in there and use qdata.

Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to use Quarks?

2009-01-04 Thread Stefan Kost
hi,

Patrick Braga wrote:
> I've just begun learning GLib, and I came across Quarks. The
> documentation describes them as "association between strings and integer
> identifiers. Given either the stringo or the GQuark identifier it is
> possible to retrieve the other."
> 
> This seems really useful and all, but I have no idea when this could be
> applied. I don't necessarily want code examples, just something like "if
> you want to do this then you could use quarks to..."

If you use a hashtable with strings as keys, a lookup on the hashtable would
need to compare the strings to find the entry. In some situations you can store
the key-strings in objects and in such a situation you better store the quarks
and use the quarks as keys in the hashtable. Then the lookup only compares 
integers.

Stefan
> 
> Thanks!
> 
> Patrick Braga
> http://theunixgeek.blogspot.com
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: programmatic screenshots?

2008-12-03 Thread Stefan Kost
hi,

Andrew Cowie schrieb:
> On Mon, 2008-12-01 at 08:51 -0800, Garth's KidStuff wrote:
>   
>> I'm runnign a Gtk++ app under ubuntu 8.04 and I'd liek to take a screenshot
>> from inside the app.  Any hints?
>> 
>
> We used an adaptation of the gnome-screenshot code in gnome-utils's
> gnome-screenshot/gnome-screenshot.c
>
> It is *very * voodoo (in the sense that it makes all kinds of low level
> X calls which aren't the sort of thing that us mere mortal application
> developers using GTK have to know about, usually) but works quite
> nicely, especially the fact that it captures window decorations and adds
> a nice drop shadow. Pity it isn't out there in library form, but c'est
> la vie.
>   
do you have it in a form, where you have one *.c and one *.h file with
lots of static functions and one public function in the kind of:
take_screen_shot(GtkWindow *window,gchar *filename);
If so, could you share that code?

Stefan

> AfC
> Sydney
>
>   
> 
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: programmatic screenshots?

2008-12-01 Thread Stefan Kost
Garth's KidStuff schrieb:
> Hey All,
>
> I'm runnign a Gtk++ app under ubuntu 8.04 and I'd liek to take a screenshot
> from inside the app.  Any hints?
>
> Thanks in advance.
>
> -Garth
>
>   
http://buzztard.svn.sourceforge.net/viewvc/buzztard/trunk/buzztard/tests/bt-check.c?view=markup
look at check_make_widget_screenshot() at the bottom. Please note that
it cannot capture window-decorations :/.

Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: combobox entries background color

2008-11-17 Thread Stefan Kost
hi,
Xavier Toth schrieb:
> I didn't get any responses so I'm trying again.
>   

Look at GtkCellRenderer and its "cell-background"  property.

Stefan
> On Mon, Nov 3, 2008 at 8:37 AM, Xavier Toth <[EMAIL PROTECTED]> wrote:
>   
>> I'd like to have different background colors on combobox entries.
>> Potentially each entry would have a different background color. Is
>> there a way to do this?
>>
>> Ted
>>
>> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>   

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: how can i scale big pixbuf in realtime?

2008-10-21 Thread Stefan Kost
hi,

Mike Massonnet schrieb:
> Le Mon, 6 Oct 2008 16:13:25 +0800,
> "chen zhixin" <[EMAIL PROTECTED]> a écrit :
>
>   
>> hello
>> i have to scale the image i recived,NTSC,30f/s,yuyv->gray and 720*480
>> because i need to do something on image,so i use gray->pixmap,and use
>> cairo_t to do .
>> then i must scale the 720*480,
>> use gdk_pixbuf_scale make cpu to 100%.
>>
>> is there a better way to do this?
>> thanks
>> 
>
> The better way would be gstreamer.  Now the question is can you receive
> the image inside gstreamer?  Then you can build a pipeline with
> gstreamer elements.
>
> filesrc would be a start, then I don't know how to manipulate an
> image.  There are other elements that may be interesting
> like gdkpixbufscale, gdkpixbufsink, and gdkpixbufdec.
>   

You can use appsrc (gst-plugins-bad, as its new) to inject data in a
pipeline - it has a couple of examples or even write an own source.
Really depends from where you receive the service. videoscale can do the
scaling, ffmpegcolorspace can do colorspace conversions. Appsink can be
used to get results back to your application. The usually better way is
to write your transformations as another plugin.

Stefan

> Look forward for gstreamer.
>
> My 2 cents,
> Mike
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Column Selection

2008-10-04 Thread Stefan Kost
hi,

Jeremy Maccelari schrieb:
> Can anyone tell me how to select multiple columns in a list
> (tree view)? I'd like to be able to click on the column header
> to select/deselect...

The treeview does not support this unfortunately. It has only row selection
modes. That beeing said I faked such a behaviour by managing the selection
myself and using cell-data-functions to change the background color accordingly.

Stefan
> 
> I have an application where several columns have to be selected
> for processing and I need the column indices...
> 
> Thanks in advance,
> Jeremy
> 

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Playing video from within my gtkmm app

2008-10-01 Thread Stefan Kost
hi,

Garth's KidStuff schrieb:
> Hey All,
> 
> Does anyone have a good place to learn how to incorporate playing video from
> within my application?  I have a drawable area that I draw all my
> application stuff on and I'd like to play a .mov file in a subportion of
> that area.

You can use gstreamer (playbin). You would need to subdiving your drawable, so
that you can associate gstreamer xvimagesink (aka the xvideo port behind) with
that drawable,

Stefan

> 
> Thanks in advance
> 
> -Garth
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: [semi-OT] dependencies libraries

2008-09-07 Thread Stefan Kost

hi,

you can try gtkdoc-depscan (since gtk-doc 1.10). It will tell you which versions 
of the libs you check against you require and also because of which symbols. The 
information can be used to turn some into soft-deps (not requiring it and have 
conditional code). Only problem is that gtkdoc-depscan does not recognize 
conditional code :/ If someone has a great idea + patch, that would be awesome.


Stefan

Andrea Zagli schrieb:
how can i do to know the exact libraries versions which my applications 
depends on?


for example: if i develop with gtk 2.12 (but i can do the same reasoning 
with any other library) how can i do to know if i used (or not) new 
functions/classes introduced on that version? (of course without look 
inside library documentation for every function/class that i used)


thanks




___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Setting widget styles

2008-08-10 Thread Stefan Kost

Tony Houghton schrieb:

I want to change the cursor/caret aspect ratio for a widget on the fly.
The docs say you should "first call gtk_widget_get_modifier_style(),
make your modifications to the returned style, then call
gtk_widget_modify_style() with that style." The trouble is I can't find
any way to modify a style. I must be missing something, otherwise
there's no point in having GtkRcStyle in the API at all.

As the docs refer to "style properties" I've tried calling
g_object_set_property(..., "cursor-aspect-ratio", ...) on the GtkRcStyle
but I got an error that the property name doesn't exist or something
like that.



style-properties are not g-object properties :/ And usually they are read-only. 
It sucks because I fails to see why most apps ever would want to read them, if 
they can't modify them ...


Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkFileFilter / GtkRecentFilter not using exact mime detection.

2008-07-02 Thread Stefan Kost

hi,

can it be a bug in the backend instead? I mean the part the provides the 
mime-type? gio/gnome-vfs? Can it be a gio regression? On last 
gnome-version when I clicked such a file in nautilus it was showing the 
exact type then, now it does not anymore.


$ gvfs-info -a "standard" ../../tests/songs/melo3.xml
...
attributes:
 standard::name: melo3.xml
 ...
 standard::content-type: application/xml
 standard::fast-content-type: application/xml

I've also checked the freedesktop.org.xml. I don't see what possible I 
do different in my xml snippet:

 
   
   
 
 http://www.buzztard.org/"; offset="0:100"/>
   
   
   buzztard song (xml)
 

I've filed a ticket under:
http://bugzilla.gnome.org/show_bug.cgi?id=541236
for gio - not sure that this is the culprit though.

Stefan

Stefan Kost schrieb:

hi,

I am using GtkFileFilter / GtkRecentFilter in my app with mime-type 
filters. Unfortunately the filters use only the quick way (looking at 
extensions). Can the somehow be configured to do exact sniffing?


Stefan

> gnomevfs-info ./melo1.xml | head -n3
Name  : melo1.xml
Type  : Regular
MIME type : application/xml

> gnomevfs-info -s ./melo1.xml | head -n3
Name  : melo1.xml
Type  : Regular
MIME type : audio/x-bzt-xml

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GtkFileFilter / GtkRecentFilter not using exact mime detection.

2008-06-27 Thread Stefan Kost

hi,

I am using GtkFileFilter / GtkRecentFilter in my app with mime-type filters. 
Unfortunately the filters use only the quick way (looking at extensions). Can 
the somehow be configured to do exact sniffing?


Stefan

> gnomevfs-info ./melo1.xml | head -n3
Name  : melo1.xml
Type  : Regular
MIME type : application/xml

> gnomevfs-info -s ./melo1.xml | head -n3
Name  : melo1.xml
Type  : Regular
MIME type : audio/x-bzt-xml

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


destroing data attached to a type (qdata)

2008-05-12 Thread Stefan Kost
hi,

I have an interface, where I share some data between the instances.  
the data is created on first access. Now I also would like to release  
it when the last instance goes.

problem 1: base_finalize() is not called for static types

I thought that I could do some own ref-counting and then do  
g_object_weak_ref on the instances to decrement the ref-count.

problem 2: There is nothing in the GTypeInfo for an iface that is  
called for each new instance (using instance_init causes  
g_type_register_static (G_TYPE_INTERFACE,...) to fail as one does not  
really instantiate the iface, but the type that implements it).

Any ideas?

Stefan

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: about draw waveform by GTK

2008-05-11 Thread Stefan Kost
hi,

王跃 schrieb:
> Hi,
>  
>  
>   I am new for GTK, and  I want to use the GTK to play a music while drawing 
> the waveform, any idea about it ? ---Thanks  Best Regards. Wang Yue  

I recommend to look at the soruces of applications that draw a waveform already
[1][2] and borrow the code (if the licence fits). Its hard to come up with an
all purpose generic waveform widget, but then its not so hard to write one
thanks to cairo.

Stefan


[1] http://www.jokosher.org
[2] http://www.buzztard.org
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: valgrind helloworld example returns errors

2008-05-04 Thread Stefan Kost
hi,

Steven Kauffmann schrieb:
> Hello all,
> 
> A few weeks ago I started with the gtk tutorial. I tried some of the
> examples and everything is working fine, but valgrind reports some
> errors (first hello world example)[*].
> 
> If those little examples already returns errors, further programs I'm
> going to write will also return errors, which I better avoid.
> 
> Can someone explain me why this example returns errors and can I
> safely ignore this or how can I avoid those errors?

you seem to have no suppressions for libc-2.7. These are all things in libc 
that 
you don't need to worry about.

Stefan

> 
> Thanks in advance
> 
> Steven
> 
> [*] $ export G_DEBUG=gc-friendly
> $ export G_SLICE=always-malloc
> 
> $ valgrind --leak-check=yes ./helloworld
> ==2983== Memcheck, a memory error detector.
> ==2983== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
> ==2983== Using LibVEX rev 1804, a library for dynamic binary translation.
> ==2983== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
> ==2983== Using valgrind-3.3.0-Debian, a dynamic binary instrumentation
> framework.
> ==2983== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
> ==2983== For more details, rerun with: -v
> ==2983==
> ==2983== Invalid read of size 4
> ==2983==at 0x40151F3: (within /lib/ld-2.7.so)
> ==2983==by 0x4005C69: (within /lib/ld-2.7.so)
> ==2983==by 0x4007A97: (within /lib/ld-2.7.so)
> ==2983==by 0x4011543: (within /lib/ld-2.7.so)
> ==2983==by 0x400D5D5: (within /lib/ld-2.7.so)
> ==2983==by 0x4010F5D: (within /lib/ld-2.7.so)
> ==2983==by 0x474A161: (within /lib/i686/cmov/libc-2.7.so)
> ==2983==by 0x400D5D5: (within /lib/ld-2.7.so)
> ==2983==by 0x474A324: __libc_dlopen_mode (in /lib/i686/cmov/libc-2.7.so)
> ==2983==by 0x47240A6: __nss_lookup_function (in 
> /lib/i686/cmov/libc-2.7.so)
> ==2983==by 0x47241BF: (within /lib/i686/cmov/libc-2.7.so)
> ==2983==by 0x4725F95: __nss_passwd_lookup (in /lib/i686/cmov/libc-2.7.so)
> ==2983==  Address 0x4a79be0 is 32 bytes inside a block of size 34 alloc'd
> ==2983==at 0x4022AB8: malloc (vg_replace_malloc.c:207)
> ==2983==by 0x4008031: (within /lib/ld-2.7.so)
> ==2983==by 0x4011543: (within /lib/ld-2.7.so)
> ==2983==by 0x400D5D5: (within /lib/ld-2.7.so)
> ==2983==by 0x4010F5D: (within /lib/ld-2.7.so)
> ==2983==by 0x474A161: (within /lib/i686/cmov/libc-2.7.so)
> ==2983==by 0x400D5D5: (within /lib/ld-2.7.so)
> ==2983==by 0x474A324: __libc_dlopen_mode (in /lib/i686/cmov/libc-2.7.so)
> ==2983==by 0x47240A6: __nss_lookup_function (in 
> /lib/i686/cmov/libc-2.7.so)
> ==2983==by 0x47241BF: (within /lib/i686/cmov/libc-2.7.so)
> ==2983==by 0x4725F95: __nss_passwd_lookup (in /lib/i686/cmov/libc-2.7.so)
> ==2983==by 0x46D09E2: getpwnam_r (in /lib/i686/cmov/libc-2.7.so)
> ==2983==
> ==2983== Invalid read of size 4
> ==2983==at 0x4015220: (within /lib/ld-2.7.so)
> ==2983==by 0x4005C69: (within /lib/ld-2.7.so)
> ==2983==by 0x4007A97: (within /lib/ld-2.7.so)
> ==2983==by 0x400BC16: (within /lib/ld-2.7.so)
> ==2983==by 0x400D5D5: (within /lib/ld-2.7.so)
> ==2983==by 0x400BDF9: (within /lib/ld-2.7.so)
> ==2983==by 0x40115A3: (within /lib/ld-2.7.so)
> ==2983==by 0x400D5D5: (within /lib/ld-2.7.so)
> ==2983==by 0x4010F5D: (within /lib/ld-2.7.so)
> ==2983==by 0x474A161: (within /lib/i686/cmov/libc-2.7.so)
> ==2983==by 0x400D5D5: (within /lib/ld-2.7.so)
> ==2983==by 0x474A324: __libc_dlopen_mode (in /lib/i686/cmov/libc-2.7.so)
> ==2983==  Address 0x4a79f28 is 24 bytes inside a block of size 27 alloc'd
> ==2983==at 0x4022AB8: malloc (vg_replace_malloc.c:207)
> ==2983==by 0x4008031: (within /lib/ld-2.7.so)
> ==2983==by 0x400BC16: (within /lib/ld-2.7.so)
> ==2983==by 0x400D5D5: (within /lib/ld-2.7.so)
> ==2983==by 0x400BDF9: (within /lib/ld-2.7.so)
> ==2983==by 0x40115A3: (within /lib/ld-2.7.so)
> ==2983==by 0x400D5D5: (within /lib/ld-2.7.so)
> ==2983==by 0x4010F5D: (within /lib/ld-2.7.so)
> ==2983==by 0x474A161: (within /lib/i686/cmov/libc-2.7.so)
> ==2983==by 0x400D5D5: (within /lib/ld-2.7.so)
> ==2983==by 0x474A324: __libc_dlopen_mode (in /lib/i686/cmov/libc-2.7.so)
> ==2983==by 0x47240A6: __nss_lookup_function (in 
> /lib/i686/cmov/libc-2.7.so)
> ==2983==
> ==2983== Invalid read of size 4
> ==2983==at 0x4015237: (within /lib/ld-2.7.so)
> ==2983==by 0x4005C69: (within /lib/ld-2.7.so)
> ==2983==by 0x4007A97: (within /lib/ld-2.7.so)
> ==2983==by 0x4011543: (within /lib/ld-2.7.so)
> ==2983==by 0x400D5D5: (within /lib/ld-2.7.so)
> ==2983==by 0x4010F5D: (within /lib/ld-2.7.so)
> ==2983==by 0x474A161: (within /lib/i686/cmov/libc-2.7.so)
> ==2983==by 0x400D5D5: (within /lib/ld-2.7.so)
> ==2983==by 0x474A324: __libc_dlopen_mode (in /lib/i686/cmov/libc-2.7.so)
> ==2983==by 0x47240A6: __nss_lookup_function (in 
> /lib/i686/cmov/libc-2.7.so)
> ==2983==

Re: problem with gtk-doc

2008-04-13 Thread Stefan Kost
hi,

Tomasz Jankowski schrieb:
> Hi!
> 
> Like in topic. Everything works great, gtk-doc builds types tree, generates
> descriptions for functions, structures, enumerations and properties. The
> only thing, which doesn't is generating descriptions for signals. There is
> no information about signals in output html files. I used comment style
> described gtk-doc reference (i found it on library.gnome.org ). What can be
> the problem? I'm using gtk-doc v1.9 . If you want to see some files of my
> project just let me know.
Would be good if you can show me atleast how you documented the signals. Also 
look at the -undocumented.txt and -unused.txt files gtk-doc produces in the 
documentation dir. Are the signals listed in the .signals file? (don't add them 
yourself, if they were recognized they should appear there).

> 
> I sent this message to gtk-doc mailing list few days ago too, but I hadn't
> received any response, that's why I'm sending it here.
> 
I did not received you message there.

Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Rotating & scaling a widget or set of widgets

2008-03-31 Thread Stefan Kost
hi,

Jason Edgecombe schrieb:
> Hi There,
> 
> I'm developing an application for a Nokia N800 Internet Tablet. I want 
> to rotate and scale the whole screen or at least a set widgets so that 
> the application can be used when holding the application in portrait or 
> landscape orientations.
> 
> How can I do that?
 >
Look for xrandr. The canola2 guys did it and there are youtoube videos out.

Stefan

> 
> Thanks,
> Jason
>  
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: identify unused functions?

2008-03-30 Thread Stefan Kost
Hi,

nm --undefined-only *.o | cut -c12- | sort | uniq
would give you a list of all external symbols

nm --defined-only *.o | cut -c12- | sort | uniq
would give you a list of all defined symbols

now all enties in 2nd list, which are not in first list should be what you are 
looking for ('comm' should be able to do that).

Stefan

Dr. Michael J. Chudobiak schrieb:
> Is there any easy way to identify unused functions in source code, for 
> cruft reduction?
> 
> Using the -Wall flag identifies unused static functions, which is great, 
> but it misses the non-static ones.
> 
> - Mike
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: more keyboard accelerator woes

2008-02-19 Thread Stefan Kost
For the archive, solution (hack) to fix one issue:
Stefan Kost schrieb:
> Hi,
> 
> after I managed to get accelerators for menus and context menues working, I 
> have
> problems with some other ui items.
> 
> 1.)
> tool_item=GTK_WIDGET(gtk_toggle_tool_button_new_from_stock(GTK_STOCK_MEDIA_PLAY));
> 
> 1a.)
> gtk_widget_set_accel_path (tool_item,
>   "/MainToolbar/Play",accel_group);
> gtk_accel_map_add_entry ("/MainToolbar/Play", GDK_F5, 0);
> 
> 1b.)
> gtk_widget_add_accelerator(tool_item, "clicked", accel_group, GDK_F5, 0, 0);
> 
> both don't have any effect. using 1a.) is also showing these warnings:
> (bt-edit:12682): Gtk-CRITICAL **: gtk_widget_set_accel_path: assertion
> `GTK_WIDGET_GET_CLASS (widget)->activate_signal != 0' failed
> 
> (bt-edit:12682): Gtk-CRITICAL **: gtk_widget_set_accel_path: assertion
> `GTK_WIDGET_GET_CLASS (widget)->activate_signal != 0' failed
> 
> 
> Finaly one small thing. For the help menu I use
> subitem=gtk_image_menu_item_new_from_stock(GTK_STOCK_HELP,accel_group);
> this gets "Ctrl-H" as a shortcut, where all the other apps seem to have "F1".

subitem=gtk_image_menu_item_new_from_stock(GTK_STOCK_HELP,accel_group);
gtk_widget_remove_accelerator(subitem,accel_group,'h',GDK_CONTROL_MASK);
gtk_widget_add_accelerator(subitem,"activate",accel_group,GDK_F1,0,GTK_ACCEL_VISIBLE);

Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: What's wrong with the docs?

2008-02-03 Thread Stefan Kost
Hi,

John Coppens schrieb:
> Hello all...
> 
> There must be something terribly wrong somewhere, when I try to find
> documentation on operation with GTK+ or GDK elements, I always seem to
> get _much_ more documentation from the Python/Perl libraries than from
> the actual C interface. I'm sure others noticed the same trend.
> 
> So, why is this?
> 
> - Are the original (C/C++) docs really so scarse they don't appear at
>   the top of of the list? or...
> 
> - Is something in the google algorithms preferencial to anything but C?
> 
> - Are those docs maybe declared unaccessible by the spider engines?
>   (by robots.txt or so)

I guess library.gnome.org is just too new and maybe not linked that much yet (I
used good to search for sites that link to it and found links inside it).

> 
> - Or are those alternative languages just much more popular than C?
> 
> Which makes this question pop up: Wouldn't it be interesting/practical
> to have _common_ documentation. Say, GtkWidget is used in Python like
> this, in C like this, etc.? I could even serve as an educational tool
> to compare languages.
>
I though about this several times, but don't think it will work. Too much of the
api is specific to the environment.

Stefan

> 
> Just idle thoughts...
> 
> John
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: selecting multiple entries from GtkTreeView/GtkTreeModel/GtkTreeStore

2008-01-06 Thread Stefan Kost
hi,

Gorshkov schrieb:
> I've looked in the docs, and I keep going around and around in circles - 
> but I can't for the life of me figure out how to set a 
> TreeView/TreeModel/TreeStore to allow for the selection of multiple entries.

Have a look at GtkTreeSelection:
http://library.gnome.org/devel/gtk/stable/GtkTreeSelection.html#gtk-tree-selection-set-mode

Stefan
> 
> I'm pretty sure I'm missing something simple and obvious, but I can't 
> for the life of me find it anywhere  help, somebody?
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Signal emission in multi-threading environment

2007-12-08 Thread Stefan Kost
Hi Ben,

Ben Lau schrieb:
> hi all,
> 
>I am implementing a GObject (a simple video player) that creates a
> GStreamer pipeline for video processing. Soon it receives a new
> GstBuffer of video frame from the pipeline, it will emit a signal. As
> GStreamer processes the pipeline with multiple threads.  The signal
> handler may not be involved inside the main thread. If my GObject
> calls g_signal_emit() within the handler, then client's callback
> function may also not be involved from the main thread.
>
You should use the GstBus. In the signal handler create an application message
and post it to the bus. The bus will marshall data and invoke signal handler in
you application thread. your app need to have signal handlers on the bus to
listen for the application message.
Here is an example:
http://buzztard.cvs.sourceforge.net/buzztard/buzztard/src/ui/edit/main-toolbar.c?view=markup
look for
on_channels_negotiated()

Stefan

> 
>   If the callback uses any Gdk/Gtk functions, then it may cause a race
> condition. Ofcoz it could be avoided by using
> gdk_threads_enter/gdk_threads_leave pair. However, I want to hide the
> multi-threading issue from user ,so that they don't need to care
> about.
> 
>  To achieve this purpose, the signal should be emitted within the main
> thread. Could anybody suggest a method to ensure that a signal is
> emitted within the main thread?
> 
>  I am thinking about to create a GSource to attach to the main
> context. Soon a new frame is ready, it will dispatch the event to my
> video player in main thread. But I wonder would it have any other
> simpler method to achieve the goal?
> 
> Thanks for any advise.
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Finding API documentation by function name

2007-12-02 Thread Stefan Kost
hi,

Raja Mukherji schrieb:
> Hi all,
> 
> I'm writing a binding generator for my language to Gtk and want the
> generator to be able to insert documentation into the generated code
> automatically. Is there any existing program/script for getting the
> documentation associated with a specific api function? For example:
> 
>  gtk_about_dialog_new
> 
> could print out the lines (as copied from devhelp):
> 
> Creates a new GtkAboutDialog.
> 
> Returns :
>   a newly created GtkAboutDialog
> 
> Or it could (preferably) print them out in XML, or some other structured 
> format.
> 
> I could probably fashion something myself, possibly from the files
> that devhelp generates, but I was wondering if anyone has already done
> so, or knows of any existing solution.

Gtk-doc uses docbook-xml, so you could use xslt to cut out chunks. Unfortunately
most stuff should not be copied to bindings docs as arguments can change and
c-specific things are not needed there.

Stefan

> 
> Thanks
> Raja Mukherji
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Problem with gtk-doc

2007-11-07 Thread Stefan Kost
hi,

Quoting Tomasz Jankowski <[EMAIL PROTECTED]>:

> Hello!
>
> I have problem with gtk-doc.
There is [EMAIL PROTECTED]

> I configured it in my project an everything was
> fine (i had object hierarchy etc.). Now I added two new source files which
> decalre two new objects. Gtk-doc sees these new source files, it added
> symbols to *unused.tx file, but it did not build new documentation pages for
> them.
You add new types to the *.types file and new api to the  
*.sections.txt. If its a new section (new type) you add it to the  
*.sgml file too. *types and *-sections.txt can be autogenerated all  
the time by gtk-doc if your happy with that (see gtkdoc-scan --help).

> Morover since I added new files gtk-doc doean's add new symbols to
> documenattion, even if there are in old files.
???

> --
> Cya!
> Tom

Ciao
   Stefan

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Profiling GTK within an application

2007-10-29 Thread Stefan Kost
Hi,

Quoting Binary Chen <[EMAIL PROTECTED]>:

> On Sat, 2007-10-27 at 11:06 +0300, Stefan Kost wrote:
>> Chris Rorvick schrieb:
>> > I'm attempting to profile GTK in an application and I'm wondering what
>> > methodology others use to accomplish this.  Is there any documentation
>> > that addresses this topic that I should refer to?  Any caveats worth
>> > pointing out?  Here is where I'm at ...
>> >
>> > I recently upgraded an application using GTK 2.6 to use GTK 2.10,
>> > quickly followed by an upgrade to 2.12.  In both cases, the upgraded
>> > version of the application consumed 3-5x the CPU as compared to the
>> > original version using 2.6.  This comparison was done anecdotally using
>> > top on a Solaris workstation.
>> >
>> This is most likely caused by cairo. You should also see a bit less  
>>  CPU usage in
>> 2.12 compared to 2.10 (or more precise newer cairo should perform a  
>>  bit better).
>>
> Which version of cairo will cause this problem, more precise?

gtk-2.6 does not use cairo at all. newer version do and were causing a  
bit of slowdown. On devices without FPU its quite a notable slowdown  
as cairo uses floating point math here and there.

Stefan

>
>> >
>> > My first step was to have profiled versions of these libraries built in
>> > the hope that I could use them to isolate where the additional cycles
>> > were being burned.  Several builds and profiled runs later, and after a
>> > fair amount of searching the Internet, I've concluded that I'll never
>> > get anything out of shared objects instrumented with GCC; all code to be
>> > profiled must be statically linked.  If you know this to be untrue,
>> > please let me know!  :)  My plan now is to build static versions of all
>> > GTK libraries instrumented for profiling and link against those.
>> >
>> I would suggest to use a sampling profiler, like oprofile, sysprof, but all
>> those are linux profilers (they need a kernel module). But I am sure there a
>> sampling profilers for solaris too. The advantage is that you don't need to
>> recompile your apps (given you have debug symbols alreday) and it works with
>> shared libs too.
>>
>> Stefan
>>
>>
>> > FYI, Our platform is Solaris 10 (x86) compiling with GCC 3.4.
>> >
>> > Thanks in advance,
>> >
>> > Chris Rorvick
>> > ___
>> > gtk-app-devel-list mailing list
>> > gtk-app-devel-list@gnome.org
>> > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>>
>> ___
>> gtk-app-devel-list mailing list
>> gtk-app-devel-list@gnome.org
>> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Profiling GTK within an application

2007-10-29 Thread Stefan Kost
hi,

Chris Rorvick schrieb:
> Stefan Kost wrote:
>  > This is most likely caused by cairo. You should also see a bit less
>  > CPU usage in 2.12 compared to 2.10 (or more precise newer cairo should
>  > perform a bit better).
> 
> For some reason, this happens to be one of two libraries that I'm
> statically linking in.  I wasn't seeing a lot of time spent in it when
> looking at the gprof report.
> 
>> I would suggest to use a sampling profiler, like oprofile, sysprof,
>  > but all those are linux profilers (they need a kernel module). But I
>  > am sure there a sampling profilers for solaris too. The advantage is
>  > that you don't need to recompile your apps (given you have debug
>  > symbols alreday) and it works with shared libs too.
> 
> I figured out that Sun's dtrace tool allows me to basically script a
> sampling profiler just as you describe.  Very cool program.  My program
> is spending more than 50% of its userland time executing code in glib,
> and a vast majority of that is split evenly between two functions:
> g_slist_find() and g_slist_remove_all().
> 
> I'm going to have to do some more work to figure out the context in
> which these functions are being invoked, but I'm making progress!  :)
>
If this is infact your problem, then I wonder how the gtk version can cause a
difference here. I don't belive there is a huge increase of such calls in newer
gtk-versions. Would be good it you can get backtraces.

Stefan

> 
> Thanks,
> 
> Chris Rorvick
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Profiling GTK within an application

2007-10-27 Thread Stefan Kost
Chris Rorvick schrieb:
> I'm attempting to profile GTK in an application and I'm wondering what 
> methodology others use to accomplish this.  Is there any documentation 
> that addresses this topic that I should refer to?  Any caveats worth 
> pointing out?  Here is where I'm at ...
> 
> I recently upgraded an application using GTK 2.6 to use GTK 2.10, 
> quickly followed by an upgrade to 2.12.  In both cases, the upgraded 
> version of the application consumed 3-5x the CPU as compared to the 
> original version using 2.6.  This comparison was done anecdotally using 
> top on a Solaris workstation.
>
This is most likely caused by cairo. You should also see a bit less CPU usage in
2.12 compared to 2.10 (or more precise newer cairo should perform a bit better).

> 
> My first step was to have profiled versions of these libraries built in 
> the hope that I could use them to isolate where the additional cycles 
> were being burned.  Several builds and profiled runs later, and after a 
> fair amount of searching the Internet, I've concluded that I'll never 
> get anything out of shared objects instrumented with GCC; all code to be 
> profiled must be statically linked.  If you know this to be untrue, 
> please let me know!  :)  My plan now is to build static versions of all 
> GTK libraries instrumented for profiling and link against those.
> 
I would suggest to use a sampling profiler, like oprofile, sysprof, but all
those are linux profilers (they need a kernel module). But I am sure there a
sampling profilers for solaris too. The advantage is that you don't need to
recompile your apps (given you have debug symbols alreday) and it works with
shared libs too.

Stefan


> FYI, Our platform is Solaris 10 (x86) compiling with GCC 3.4.
> 
> Thanks in advance,
> 
> Chris Rorvick
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GParamSpecs for file-path and uris

2007-10-02 Thread Stefan Kost
hi,

is soemone aware of a GParamSpec implementation for file-path and  
uris. Most apps use GParamSpecString. Disadvantage is that one can put  
anaything there and for apps that generate UIs it impossible to detect  
that a file-cooser button would be more appropriate than a entry box.
I guess simillar would apply to fon-specifications.

Or any other ideas how to handle this.

Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Simple question - accelerator keys

2007-08-31 Thread Stefan Kost
Hi,

I am currently trying to figure out something simillar. Unfortunately it seems
that accelerators are only used for menues in most applications. If you check
gnome-bugzilla - it has several open bugs for accelerators. I recently fixed one
and right now prepared a test program for another. Lets try to track those down
and propose fixes.

Stefan

Tomasz Sałaciński wrote:
> Hi there,
> 
> Is there a possibility to simply bind a window-global accelerator key to
> a callback function? I am writing a GTK+ media player and I want to bind
> Left and Right arrow keys to seek media and F key to toggle fullscreen.
> I know that I can use gtk_widget_add_accelerator(), but then I have to
> create a new signal, which is, let's say, not so easy for me:)
> 
> Cheers,
> Tom
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

more keyboard accelerator woes

2007-08-25 Thread Stefan Kost
Hi,

after I managed to get accelerators for menus and context menues working, I have
problems with some other ui items.

1.)
tool_item=GTK_WIDGET(gtk_toggle_tool_button_new_from_stock(GTK_STOCK_MEDIA_PLAY));

1a.)
gtk_widget_set_accel_path (tool_item,
  "/MainToolbar/Play",accel_group);
gtk_accel_map_add_entry ("/MainToolbar/Play", GDK_F5, 0);

1b.)
gtk_widget_add_accelerator(tool_item, "clicked", accel_group, GDK_F5, 0, 0);

both don't have any effect. using 1a.) is also showing these warnings:
(bt-edit:12682): Gtk-CRITICAL **: gtk_widget_set_accel_path: assertion
`GTK_WIDGET_GET_CLASS (widget)->activate_signal != 0' failed

(bt-edit:12682): Gtk-CRITICAL **: gtk_widget_set_accel_path: assertion
`GTK_WIDGET_GET_CLASS (widget)->activate_signal != 0' failed


Finaly one small thing. For the help menu I use
subitem=gtk_image_menu_item_new_from_stock(GTK_STOCK_HELP,accel_group);
this gets "Ctrl-H" as a shortcut, where all the other apps seem to have "F1".

Any ideas?

Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Accelerator keys and popup menus? (really solved)

2007-08-22 Thread Stefan Kost
Its a gtk+ bug!
Files as http://bugzilla.gnome.org/show_bug.cgi?id=469374 with a patch.

After adding a g_signal_emit() as a workaround it works too.
gtk_window_add_accel_group(GTK_WINDOW(window),GTK_ACCEL_GROUP(user_data));
g_signal_emit_by_name (window, "keys-changed", 0);

Stefan


Stefan Kost wrote:
> hi,
> 
> more research and a standalone test (attached and via web [1]). The good news
> are that gtk+ supports multiple accel maps and that those can be even
> dynamically switched (activated/deactivated). The issue seems that a new
> accel_map needs to be added to the window before adding any accelerators. If 
> one
> only adds it later, it has no effect. I have not yet managed to figure out 
> what
> is causing the difference.
> 
> The problem for me is that when I construct my ui I use lots of g_objects 
> which
> init children while they are initialized. As such one cannot yet query the
> window from deep within the hierarchy :/ and passing the window down the call
> hierarchy is out of question.
> 
> Stefan
> 
> 
> [1]
> http://buzztard.cvs.sourceforge.net/buzztard/buzztard/design/gui/accelpopup.c?view=markup
> 
> Stefan Kost wrote:
>> Hi,
>>
>> Dunno if this is a bug/limmitation in gtk+. I now moved the
>> GtkAccelGroup to my ui-resource singleton and it works. That means I use
>> only *one* accel_group.
>> I have a toplevel window with views (tabs). Before I was creating a
>> separate one for my popup menu and adding/removing to the window
>> depending on which tab was visible. Seems that gtk+ is only supporting
>> one accel_group.
>>
>> Stefan
>>
>> Quoting Stefan Kost <[EMAIL PROTECTED]>:
>>
>>> hi,
>>>
>>> Gabriel Schulhof wrote:
>>>> Hi!
>>>>
>>>> On Sun, 2007-08-19 at 23:48 +0300, Stefan Kost wrote:
>>>>> I read about the differences. I really want "accelerators".
>>>> I was able to hack it:
>>>>
>>>> Create a plain old regular menubar-type menu with accelerators. Then ref
>>>> the submenu you want to make into a popup menu and detach it from its
>>>> parent menu item[0].
>>>>
>>>> [0]http://library.gnome.org/devel/gtk/unstable/GtkMenuItem.html#id3734460
>>>>
>>>>
>>>> HTH,
>>>>
>>>> Gabriel
>>>>
>>> like this?
>>>
>>> // generate the context menu
>>> GtkWidget *mb=gtk_menu_bar_new();
>>> GtkWidget *mi=gtk_menu_item_new();
>>> gtk_container_add(GTK_CONTAINER(mb),mi);
>>>
>>> self->priv->context_menu=GTK_MENU(gtk_menu_new());
>>> gtk_menu_set_accel_group(GTK_MENU(self->priv->context_menu),
>>>   self->priv->accel_group);
>>>
>>> gtk_menu_set_accel_path(GTK_MENU(self->priv->context_menu),"/PatternView/PatternContext");
>>>
>>>
>>> gtk_menu_item_set_submenu(GTK_MENU_ITEM(mi),GTK_WIDGET(self->priv->context_menu));
>>>
>>> g_object_ref(self->priv->context_menu);
>>> gtk_menu_detach(self->priv->context_menu);
>>>
>>>
>>> make no difference for me :/
>>>
>>> I also tried
>>> gtk_menu_attach_to_widget(self->priv->context_menu,
>>>   GTK_WIDGET (main_window),NULL);
>>>
>>>
>>> Stefan
>>> ___
>>> gtk-app-devel-list mailing list
>>> gtk-app-devel-list@gnome.org
>>> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>>>
>>
> 
> 
> 
> 
> /** $Id: accelpopup.c,v 1.1 2007/08/21 19:55:32 ensonic Exp $
>  * test popup menus with accelerator keys
>  *
>  * gcc -Wall -g `pkg-config gtk+-2.0 --cflags --libs` accelpopup.c -o 
> accelpopup
>  */
> 
> #include 
> #include 
> #include 
> 
> #include 
> #include 
> #include 
> #include 
> 
> static GtkWidget *window=NULL;
> 
> 
> static void destroy(GtkWidget *widget,gpointer data) {
>   gtk_main_quit();
> }
> 
> static void on_menu_activate(GtkMenuItem *menuitem,gpointer user_data) {
>   gtk_label_set_text(GTK_LABEL(user_data),"main menu");
> }
> 
> static void on_context_menu1_activate(GtkMenuItem *menuitem,gpointer 
> user_data) {
>   gtk_label_set_text(GTK_LABEL(user_data),"context menu 1");
> }
> 
> static void on_context_menu2_activate(GtkMenuItem *menuitem,gpointer 
> user_data) {
>   gtk_label_set_text(GTK_LABEL(user_data),"cont

Re: Accelerator keys and popup menus? (Solved)

2007-08-22 Thread Stefan Kost
hi,

more research and a standalone test (attached and via web [1]). The good news
are that gtk+ supports multiple accel maps and that those can be even
dynamically switched (activated/deactivated). The issue seems that a new
accel_map needs to be added to the window before adding any accelerators. If one
only adds it later, it has no effect. I have not yet managed to figure out what
is causing the difference.

The problem for me is that when I construct my ui I use lots of g_objects which
init children while they are initialized. As such one cannot yet query the
window from deep within the hierarchy :/ and passing the window down the call
hierarchy is out of question.

Stefan


[1]
http://buzztard.cvs.sourceforge.net/buzztard/buzztard/design/gui/accelpopup.c?view=markup

Stefan Kost wrote:
> Hi,
> 
> Dunno if this is a bug/limmitation in gtk+. I now moved the
> GtkAccelGroup to my ui-resource singleton and it works. That means I use
> only *one* accel_group.
> I have a toplevel window with views (tabs). Before I was creating a
> separate one for my popup menu and adding/removing to the window
> depending on which tab was visible. Seems that gtk+ is only supporting
> one accel_group.
> 
> Stefan
> 
> Quoting Stefan Kost <[EMAIL PROTECTED]>:
> 
>> hi,
>>
>> Gabriel Schulhof wrote:
>>> Hi!
>>>
>>> On Sun, 2007-08-19 at 23:48 +0300, Stefan Kost wrote:
>>>> I read about the differences. I really want "accelerators".
>>> I was able to hack it:
>>>
>>> Create a plain old regular menubar-type menu with accelerators. Then ref
>>> the submenu you want to make into a popup menu and detach it from its
>>> parent menu item[0].
>>>
>>> [0]http://library.gnome.org/devel/gtk/unstable/GtkMenuItem.html#id3734460
>>>
>>>
>>> HTH,
>>>
>>> Gabriel
>>>
>>
>> like this?
>>
>> // generate the context menu
>> GtkWidget *mb=gtk_menu_bar_new();
>> GtkWidget *mi=gtk_menu_item_new();
>> gtk_container_add(GTK_CONTAINER(mb),mi);
>>
>> self->priv->context_menu=GTK_MENU(gtk_menu_new());
>> gtk_menu_set_accel_group(GTK_MENU(self->priv->context_menu),
>>   self->priv->accel_group);
>>
>> gtk_menu_set_accel_path(GTK_MENU(self->priv->context_menu),"/PatternView/PatternContext");
>>
>>
>> gtk_menu_item_set_submenu(GTK_MENU_ITEM(mi),GTK_WIDGET(self->priv->context_menu));
>>
>> g_object_ref(self->priv->context_menu);
>> gtk_menu_detach(self->priv->context_menu);
>>
>>
>> make no difference for me :/
>>
>> I also tried
>> gtk_menu_attach_to_widget(self->priv->context_menu,
>>   GTK_WIDGET (main_window),NULL);
>>
>>
>> Stefan
>> ___
>> gtk-app-devel-list mailing list
>> gtk-app-devel-list@gnome.org
>> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>>
> 
> 

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Accelerator keys and popup menus? (Solved)

2007-08-22 Thread Stefan Kost
Hi,

Dunno if this is a bug/limmitation in gtk+. I now moved the  
GtkAccelGroup to my ui-resource singleton and it works. That means I  
use only *one* accel_group.
I have a toplevel window with views (tabs). Before I was creating a  
separate one for my popup menu and adding/removing to the window  
depending on which tab was visible. Seems that gtk+ is only supporting  
one accel_group.

Stefan

Quoting Stefan Kost <[EMAIL PROTECTED]>:

> hi,
>
> Gabriel Schulhof wrote:
>> Hi!
>>
>> On Sun, 2007-08-19 at 23:48 +0300, Stefan Kost wrote:
>>> I read about the differences. I really want "accelerators".
>> I was able to hack it:
>>
>> Create a plain old regular menubar-type menu with accelerators. Then ref
>> the submenu you want to make into a popup menu and detach it from its
>> parent menu item[0].
>>
>> [0]http://library.gnome.org/devel/gtk/unstable/GtkMenuItem.html#id3734460
>>
>> HTH,
>>
>> Gabriel
>>
>
> like this?
>
> // generate the context menu
> GtkWidget *mb=gtk_menu_bar_new();
> GtkWidget *mi=gtk_menu_item_new();
> gtk_container_add(GTK_CONTAINER(mb),mi);
>
> self->priv->context_menu=GTK_MENU(gtk_menu_new());
> gtk_menu_set_accel_group(GTK_MENU(self->priv->context_menu),
>   self->priv->accel_group);
>
> gtk_menu_set_accel_path(GTK_MENU(self->priv->context_menu),"/PatternView/PatternContext");
>
> gtk_menu_item_set_submenu(GTK_MENU_ITEM(mi),GTK_WIDGET(self->priv->context_menu));
> g_object_ref(self->priv->context_menu);
> gtk_menu_detach(self->priv->context_menu);
>
>
> make no difference for me :/
>
> I also tried
> gtk_menu_attach_to_widget(self->priv->context_menu,
>   GTK_WIDGET (main_window),NULL);
>
>
> Stefan
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Accelerator keys and popup menus?

2007-08-21 Thread Stefan Kost
hi,

Gabriel Schulhof wrote:
> Hi!
> 
> On Sun, 2007-08-19 at 23:48 +0300, Stefan Kost wrote:
>> I read about the differences. I really want "accelerators".
> I was able to hack it:
> 
> Create a plain old regular menubar-type menu with accelerators. Then ref
> the submenu you want to make into a popup menu and detach it from its
> parent menu item[0].
> 
> [0]http://library.gnome.org/devel/gtk/unstable/GtkMenuItem.html#id3734460
> 
> HTH,
> 
> Gabriel
> 

like this?

// generate the context menu
GtkWidget *mb=gtk_menu_bar_new();
GtkWidget *mi=gtk_menu_item_new();
gtk_container_add(GTK_CONTAINER(mb),mi);

self->priv->context_menu=GTK_MENU(gtk_menu_new());
gtk_menu_set_accel_group(GTK_MENU(self->priv->context_menu),
  self->priv->accel_group);

gtk_menu_set_accel_path(GTK_MENU(self->priv->context_menu),"/PatternView/PatternContext");

gtk_menu_item_set_submenu(GTK_MENU_ITEM(mi),GTK_WIDGET(self->priv->context_menu));
g_object_ref(self->priv->context_menu);
gtk_menu_detach(self->priv->context_menu);


make no difference for me :/

I also tried
gtk_menu_attach_to_widget(self->priv->context_menu,
  GTK_WIDGET (main_window),NULL);


Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Accelerator keys and popup menus?

2007-08-19 Thread Stefan Kost
Hi,

I've commented on this bug:
http://bugzilla.gnome.org/show_bug.cgi?id=143007#c6

Stefan

Stefan Kost wrote:
> Hi,
> 
> Daniel Pekelharing wrote:
>> Hi all,
>>
>> Sorry to be posting yet more questions about accel keys...
>>
>> I have created a popup menu and assigned accelerator keys to some of the
>> items,
>>
>> I assigned a GtkAccelGroup to the menu using
>> gtk_menu_set_accel_group(..),
>>
>> I attached the same GtkAccelGroup to the main window with
>> gtk_window_add_accel_group(..),
>>
>> I assigned each item an accel path gtk_menu_item_set_accel_path(..),
>> and finally I set an accelerator key with gtk_accel_map_add_entry(..).
>>
>> The problem is that the accelerator keys don't work on the popup menu,
>> using the exact same functions they work fine on the main menu..
>>
>> Am I missing something somewhere?
>>
>> Thanks!
> 
> I seem to have the same problem. Have you found a solution in the last 2 
> years?
> 
> Stefan
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Accelerator keys and popup menus?

2007-08-19 Thread Stefan Kost
Hi,

Mike Melanson wrote:
> Stefan Kost wrote:
>> Hi,
>>
>> Daniel Pekelharing wrote:
>>> Hi all,
>>>
>>> Sorry to be posting yet more questions about accel keys...
>>>
>>> I have created a popup menu and assigned accelerator keys to some of the
>>> items,
>>>
>>> I assigned a GtkAccelGroup to the menu using
>>> gtk_menu_set_accel_group(..),
>>>
>>> I attached the same GtkAccelGroup to the main window with
>>> gtk_window_add_accel_group(..),
>>>
>>> I assigned each item an accel path gtk_menu_item_set_accel_path(..),
>>> and finally I set an accelerator key with gtk_accel_map_add_entry(..).
>>>
>>> The problem is that the accelerator keys don't work on the popup menu,
>>> using the exact same functions they work fine on the main menu..
>>>
>>> Am I missing something somewhere?
>>>
>>> Thanks!
>> I seem to have the same problem. Have you found a solution in the last 2 
>> years?
> 
> I had this same problem at one point. The details are a little fuzzy,
> but the key is getting the terminology straight. Perhaps what you are
> looking for is a "mnemonic" vs. an "accelerator". Look that up. It might
> be what you're looking for.

I read about the differences. I really want "accelerators".

Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Accelerator keys and popup menus?

2007-08-19 Thread Stefan Kost
Hi,

Daniel Pekelharing wrote:
> Hi all,
> 
> Sorry to be posting yet more questions about accel keys...
> 
> I have created a popup menu and assigned accelerator keys to some of the
> items,
> 
> I assigned a GtkAccelGroup to the menu using
> gtk_menu_set_accel_group(..),
> 
> I attached the same GtkAccelGroup to the main window with
> gtk_window_add_accel_group(..),
> 
> I assigned each item an accel path gtk_menu_item_set_accel_path(..),
> and finally I set an accelerator key with gtk_accel_map_add_entry(..).
> 
> The problem is that the accelerator keys don't work on the popup menu,
> using the exact same functions they work fine on the main menu..
> 
> Am I missing something somewhere?
> 
> Thanks!

I seem to have the same problem. Have you found a solution in the last 2 years?

Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkDialog issues

2007-07-31 Thread Stefan Kost
Hi,
[EMAIL PROTECTED] wrote:
> Hi everybody.
> I want to use a GtkDialog to show a message in my application when the user
> clicks a particular button; I tried to implement this dialog in the program,
> but it appears only when the action is finished, and not when it begins.
> I insert here a snippet of the source code:
> 
> /* dialog created in the main function */
> 
>appdata->dialog = gtk_dialog_new_with_buttons(NULL,
>   GTK_WINDOW(appdata->window),
>   GTK_DIALOG_NO_SEPARATOR && GTK_DIALOG_DESTROY_WITH_PARENT,
>   NULL);
>appdata->dialogLabel = gtk_label_new("");
>gtk_box_pack_start(GTK_BOX(GTK_DIALOG(appdata->dialog)->vbox),
> appdata->dialogLabel, TRUE, TRUE, 0);
> 
> 
> /* dialog showed in the open_camera function (associated to the button) */
> 
>gtk_label_set_text(GTK_LABEL(appdata->dialogLabel), "Opening camera...");
>gtk_widget_show_all(appdata->dialog);
>start_pipeline(appdata);
>add_camera_tab(appdata);
>gtk_widget_hide_all(appdata->dialog);
> 
gtk does not get cycles to actually bring it up earlier. if you want to hide the
dialog when processing is done start the dialog with gtk_dialog_run and the
processing from e.g. an idle-handeler. Do the gtk_widget_hide_all when
processing is done.

Stefan

> I want the dialog to be showed before the start_pipeline() is called, but it
> appears for a samll time only after the add_camera_tab() is finished, then it
> is hidden.
> I don't know how to accomplish my task (I'm really really new to the dialog
> widget :-) ).
> Thanks in advance. Omar
> 
> 
> This message was sent using IMP, the Internet Messaging Program.
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: waveform display in gtk

2007-07-12 Thread Stefan Kost
Hi,

there is a few. Jokosher, Swami, they all have one. Unfortunately a  
waveform display is quite specific - its not easy to come up with a  
generic one. Some need markers, some need range-selection.

Stefan

Quoting bert <[EMAIL PROTECTED]>:

> Hi all,
>
> Is there a GTK widget to display audio or signal waveforms?
>
> If not, is there a related project in which such a widget is available?
>
> Thanks,
> Bert.
>
>
>
> -
> Yahoo! oneSearch: Finally,  mobile search that gives answers, not web links.
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: glib/gobject tutorials

2007-07-06 Thread Stefan Kost
hi,

please stop reffering to that tutorial under that address. Its part of GObject
API docs since more that a year and has also be updated in there since.

Stefan

Arx Cruz wrote:
> http://le-hacker.org/papers/gobject/
> 
> Great tutorial!
> 
> On 7/4/07, Lucas Stephanou <[EMAIL PROTECTED]> wrote:
>> Hi All ,
>>
>> I'm looking for tutorials about gobject, specially  signals handlers,
>> The Gnome Docs is just a api doc, without examples or ways to code
>> correct!
>> That api, to me is for experienced developers :-)
>>
>> Thx in advance
>>
>> --
>> Lucas Stephanou
>> ___
>> gtk-app-devel-list mailing list
>> gtk-app-devel-list@gnome.org
>> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>>
> 
> 
> 

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Main window refreshing

2007-07-01 Thread Stefan Kost
Hi,

[EMAIL PROTECTED] wrote:
> I write a little application for an embedded system (Nokia N800)
> using GTK+ and GStreamer and I need refreshing of the window.
> When I iconize the application window and then put it in foreground again,
> the gstreamer flow disappears.
> I implemented this flow in a drawing area inside the main window.
> How can I refresh my application after putting it in foreground again?

You need to handle the expose event for the drawing area. As an alternative you
could use a canvas widget.

Stefan

> 
> Thanks for the answer. Best regards.
> 
> 
> This message was sent using IMP, the Internet Messaging Program.
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


notify for first & last signal handler

2007-04-04 Thread Stefan Kost
hi,

I would like to know when the first gets connected to my signal and  
when the last one disconnects. The signal is emmitted from a process  
that I don't want to run, if nobody listens. There is  
g_signal_has_handler_pending(), but I don't want to poll that. Anyone  
aware of a way to do it?

Stefan

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Gtk-CRITICAL **: gtk_widget_event: assertion `WIDGET_REALIZED_FOR_EVENT (widget, event)' failed

2007-04-02 Thread Stefan Kost
hi david,

thanks for your help! After changing to this it works:

   if(GTK_WIDGET_REALIZED(widget)) {
 gtk_widget_grab_focus(widget);
   }

Stefan


Quoting "David Ne?as (Yeti)" <[EMAIL PROTECTED]>:

> On Thu, Mar 29, 2007 at 08:41:39AM +0200, Stefan Kost wrote:
>> I am looking for some tips of how to get the culprit for the above
>> mentioned warning. I have a notebook with 5 pages. On the first tab I
>> have a gnome-canvas with some items on. For that I have registered an
>> event handler to move objects on the canvas. The moving part works
>> fine. When I press a key I get the assertion. Still eveything works.
>> Of course I'd like to fix it anyway. So I run the app as
>>G_DEBUG="fatal_warnings" gdb ~/buzztard/bin/bt-edit
>> and dump a backtrace:
>> [Switching to Thread -1225189712 (LWP 20028)]
>> 0xb748509b in g_logv (log_domain=,
>> log_level=G_LOG_LEVEL_CRITICAL, format=0xb74ccb67 "%s: assertion `%s'
>> failed",
>>  args1=0xbf93f4bc "[EMAIL PROTECTED]") at gmessages.c:493
>> 493 G_BREAKPOINT ();
>> (gdb) bt
>> #0  0xb748509b in g_logv (log_domain=,
>> log_level=G_LOG_LEVEL_CRITICAL, format=0xb74ccb67 "%s: assertion `%s'
>> failed",
>>  args1=0xbf93f4bc "[EMAIL PROTECTED]") at gmessages.c:493
>> #1  0xb7485325 in g_log (log_domain=0xb7ac6ba7 "Gtk",
>> log_level=G_LOG_LEVEL_CRITICAL, format=0xb74ccb67 "%s: assertion `%s'
>> failed") at gmessages.c:517
>> #2  0xb748540b in g_return_if_fail_warning (log_domain=0xb7ac6ba7
>> "Gtk", pretty_function=0xb7b7875d "gtk_widget_event",
>>  expression=0xb7b76be8 "WIDGET_REALIZED_FOR_EVENT (widget,
>> event)") at gmessages.c:532
>> #3  0xb7a87769 in IA__gtk_widget_event (widget=0x833e288,
>> event=0x834b900) at gtkwidget.c:3927
>> #4  0xb7a95354 in IA__gtk_window_propagate_key_event
>> (window=0x81f0808, event=0x834b900) at gtkwindow.c:4799
>
> The key point is probably here.  Gtk+ must think the widget
> has keyboard focus for some reason -- or rather Gtk+ gives
> the widget focus for some reason.  So you have to find out
> why.
>
>> ...
>>
>> and on it goes. None of my stuff there except below gtk_main. Now
>> unfortunately the assertion dos not tell which widget is not realized.
>> So I do:
>>(gdb) select-frame 3
>>(gdb) print
>> g_type_name(((GTypeClass*)((GTypeInstance*)widget)->g_class)->g_type)
>>$1 = (gchar *) 0x8335450 "BtPatternView"
>>
>> Well this is a subclassed widget that is on the 2nd tab of the
>> notbook. The "BtPatternView" subclasses a GtkTreeView, overrides
>> realize, unrealize, expose, dispose and finalize. It does the chaining
>> up.
>
> Still, knowing normal GtkTreeView behaves the same would
> decrease the number of unknonws.
>
>> When I initially click thru all tabs (so that they get realized it
>> infact works). Explicitely calling gtk_widget_show() on it doesn't
>> help. So any idea what goes wrong here?
>
> No ideas what goes wrong, but some ideas what to try to
> debug it:
> - run with G_OBJECT_DEBUG=signals and look for is-focus in
>   the youtput, maybe you'll see a pattern, unfortunately it
>   may not be detailed enough
> - watch all changes of window->focus_widget in gtkwindow.c
>   and actions of set_focus_child() of relevant containers,
>   probably by manual insertions of some debugging messages,
>   although one can use gdb facilities too
>
> Yeti
>
> --
> http://gwyddion.net/
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkTreeView colspan, rowspan

2007-03-29 Thread Stefan Kost
Hi,

Quoting Iago Toral Quiroga <[EMAIL PROTECTED]>:

> Hi all,
>
> is it possible to create complex layouts using a GtkTreeView widget? I
> mean, being able to expand rows or columns as in GtkTable to achieve
> layouts like this one:
>
> -
> | aa | bbb| c | |
> ---IMAGE| row 1
> | ddd | |
> -
> -
> | aa | bbb| c | |
> ---IMAGE| row 2
> | ddd | |
> -
> ... More rows with the same layout ...
>
Unfortunately it is not, although I really miss it.

Stefan

> Thanks in advance for any feedback,
>
> Iago
>
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Gtk-CRITICAL **: gtk_widget_event: assertion `WIDGET_REALIZED_FOR_EVENT (widget, event)' failed

2007-03-28 Thread Stefan Kost
hi,

I am looking for some tips of how to get the culprit for the above  
mentioned warning. I have a notebook with 5 pages. On the first tab I  
have a gnome-canvas with some items on. For that I have registered an  
event handler to move objects on the canvas. The moving part works  
fine. When I press a key I get the assertion. Still eveything works.  
Of course I'd like to fix it anyway. So I run the app as
   G_DEBUG="fatal_warnings" gdb ~/buzztard/bin/bt-edit
and dump a backtrace:
[Switching to Thread -1225189712 (LWP 20028)]
0xb748509b in g_logv (log_domain=,  
log_level=G_LOG_LEVEL_CRITICAL, format=0xb74ccb67 "%s: assertion `%s'  
failed",
 args1=0xbf93f4bc "[EMAIL PROTECTED]") at gmessages.c:493
493 G_BREAKPOINT ();
(gdb) bt
#0  0xb748509b in g_logv (log_domain=,  
log_level=G_LOG_LEVEL_CRITICAL, format=0xb74ccb67 "%s: assertion `%s'  
failed",
 args1=0xbf93f4bc "[EMAIL PROTECTED]") at gmessages.c:493
#1  0xb7485325 in g_log (log_domain=0xb7ac6ba7 "Gtk",  
log_level=G_LOG_LEVEL_CRITICAL, format=0xb74ccb67 "%s: assertion `%s'  
failed") at gmessages.c:517
#2  0xb748540b in g_return_if_fail_warning (log_domain=0xb7ac6ba7  
"Gtk", pretty_function=0xb7b7875d "gtk_widget_event",
 expression=0xb7b76be8 "WIDGET_REALIZED_FOR_EVENT (widget,  
event)") at gmessages.c:532
#3  0xb7a87769 in IA__gtk_widget_event (widget=0x833e288,  
event=0x834b900) at gtkwidget.c:3927
#4  0xb7a95354 in IA__gtk_window_propagate_key_event  
(window=0x81f0808, event=0x834b900) at gtkwindow.c:4799
#5  0xb7a99aec in gtk_window_key_press_event (widget=0x81f0808,  
event=0x834b900) at gtkwindow.c:4829
#6  0xb79508f2 in _gtk_marshal_BOOLEAN__BOXED (closure=0x81d69f8,  
return_value=0xbf93f6f0, n_param_values=2, param_values=0xbf93f7fc,  
invocation_hint=0xbf93f6dc,
 marshal_data=0xb7a99a90) at gtkmarshalers.c:84
#7  0xb75185b7 in g_type_class_meta_marshal (closure=0x81d69f8,  
return_value=0xbf93f6f0, n_param_values=2, param_values=0xbf93f7fc,  
invocation_hint=0xbf93f6dc,
 marshal_data=0xcc) at gclosure.c:567
...

and on it goes. None of my stuff there except below gtk_main. Now  
unfortunately the assertion dos not tell which widget is not realized.  
So I do:
   (gdb) select-frame 3
   (gdb) print
g_type_name(((GTypeClass*)((GTypeInstance*)widget)->g_class)->g_type)
   $1 = (gchar *) 0x8335450 "BtPatternView"

Well this is a subclassed widget that is on the 2nd tab of the  
notbook. The "BtPatternView" subclasses a GtkTreeView, overrides  
realize, unrealize, expose, dispose and finalize. It does the chaining  
up.

When I initially click thru all tabs (so that they get realized it  
infact works). Explicitely calling gtk_widget_show() on it doesn't  
help. So any idea what goes wrong here?

i am testing with gtk+ 2.10.6 and svn trunk.

Stefan

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GObject docs improvements

2007-02-14 Thread Stefan Kost
Hi,

the G_DEFINE_TYPE stuff is on the list since the very beginning.
In part I (Concepts) we will explain it the long way, but mention  
G_DEFINE_TYPE. In part IV (Tutorial) we will use G_DEFINE_TYPE. You  
should always use it if it fits.

Stefan

Quoting Freddie Unpenstein <[EMAIL PROTECTED]>:

>
>> > > A point I miss in the tutorial is to mention the
>> > > G_DEFINE_TYPE()-like macros which should be prefered over
>> > > manually defining a _get_type() function whenever possible.
>> > I never did get that G_DEFINE_TYPE() stuff at all... It'd be
>> > good to see some clear documentation on it.
>> The G_DEFINE_TYPE() stuff is a macro that expands to the
>> common boilerplate code. If you have this and are able to write
>> the boilerplate code manually, what other documentation is needed?
>
> How about a real-world example, and a note on advantages (other than  
>  less typing) and disadvantages compared to doing it the long-winded  
>  way (spelling out the whole lot of boilerplate code).
>
> What are the cases where the G_DEFINE_TYPE() macros are commonly   
> useful, for what common cases AREN'T they useful (but might look   
> useful at for glance, for example), and where applicable, notes on   
> how to get around certain limitations of the macro (eg. there's a   
> lot of NULLs in the type info structure shown in the documentation)   
> and why or why not to do it that way.
>
> That kind of thing might be helpful...
>
>
> Fredderic
>
> ___
> Join Excite! - http://www.excite.com
> The most personalized portal on the Web!
>
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GObject docs improvements

2007-02-12 Thread Stefan Kost
Hi,

Shixin Zeng wrote:
> I've read it once more, with the example in David Nečas (Yeti)'s
> email. I think I understand the interfaces a bit more.
> 
> But I have some other questions:
> 
> 1) Is interface the GObject's way to implement multiple inheritance?
> 
> To my understanding, interface is a method to share some
> resources(data, methods etc.) in different classes, which can be
> implemented by inheritance. However, in Gobject system, one class can
> only have one base class, if there were no interfaces, one would have
> to inherit from the same base class with the class with which he wants
> to share some resources, or derived from that class or be that class's
> parent class. And sometimes, this method is not straightforward or
> convinient, especially for some classes with some very different
> implementation but with some same methods(interfaces), I think, this
> is where the concept interface helps.
>
This is unfortunately often mistaken. Interfaces are good if you want to hide
internals behind one and the same interface, but this covers only one aspect.
One example. You have a normal object hierarchy like in Gtk+, then you want to
implement accessibillity features for e.g. blind people (like 'give me a textual
representation of yourself'). That means that some of the object in your
hierarchy need some additional function. If you use an interface, than you can
check if the provide the extra function.

Sometimes its possible to achieve something similar to multiple inheritance by
using the delegate pattern. A will inherit from B, have one instance of C and
provice wrapper calls for C.

> 
> 2)How its intefaces handled, when a class is derived? Will the child
> classes possess the same interfaces, if they don't want to reimplement
> them?
Good question. I need to look a bit more into that.

Stefan


> 
> Thanks.
> 
> On 2/10/07, Stefan Kost <[EMAIL PROTECTED]> wrote:
>> Shixin Zeng wrote:
>>> Thanks. But I want some explanation about the interface of gobject. I
>>> can't understand what it is from a sentence like "GType's Interfaces
>>> are very similar to Java's interfaces." because I know nothing about
>>> Java, and I don't want to dig into Java just for this concept.
>>>
>> Yes this was also one on my critics and I changed it to:
>>
>> GType's Interfaces are very similar to Java's interfaces. They allow
>> to describe a common API that several classes will adhere to.
>> Imagine the play, pause and stop buttons on hifi equipment - those can
>> be seen as a playback interface. Once you know what the do, you can
>> control your cd-player, mp3-player or anything that uses these symbols.
>> To declare an interfacce you have to register a non-instantiable ...
>>
>> Don't know if this is enough already. Does this sound like a good 
>> explanation to
>> you?
>>
>> Stefan
>>
>>> On 2/8/07, Stefan Kost <[EMAIL PROTECTED]> wrote:
>>>> hi,
>>>>
>>>> yesterday I committed a first batch of cleanups to the GObject docs.
>>>> http://developer.gnome.org/doc/API/2.0/gobject/index.html
>>>>
>>>> IMHO this is a crucial documentation for the GNOME platform and it can
>>>> be improved further. Marc-Andre Lureau and Zeeshan Ali already joined
>>>> in the quest to improve this. What I like to ask you is to reply to
>>>> this mail and tell us what you don't understand yet, point out parts
>>>> that can be improved, let us know if there are some nagging concerns
>>>> about the way GObject works. Are there details that should be
>>>> explained by a picture?
>>>>
>>>> If possible then please checkout the latest version and base your
>>>> feedback on that one:
>>>>svn co http://svn.gnome.org/svn/glib/trunk glib
>>>>cd glib
>>>>./autogen.sh --prefix=$HOME/test
>>>>make
>>>>cd docs/reference/gobject
>>>>evince html/index.html &
>>>> you don't need to install it.
>>>>
>>>> Thanks!
>>>>
>>>> Stefan
>>>>
>>>> ___
>>>> gtk-app-devel-list mailing list
>>>> gtk-app-devel-list@gnome.org
>>>> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>>>>
>>>
>> ___
>> gtk-app-devel-list mailing list
>> gtk-app-devel-list@gnome.org
>> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>>
> 
> 

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: GObject docs improvements

2007-02-10 Thread Stefan Kost
Shixin Zeng wrote:
> Thanks. But I want some explanation about the interface of gobject. I
> can't understand what it is from a sentence like "GType's Interfaces
> are very similar to Java's interfaces." because I know nothing about
> Java, and I don't want to dig into Java just for this concept.
> 
Yes this was also one on my critics and I changed it to:

GType's Interfaces are very similar to Java's interfaces. They allow
to describe a common API that several classes will adhere to.
Imagine the play, pause and stop buttons on hifi equipment - those can
be seen as a playback interface. Once you know what the do, you can
control your cd-player, mp3-player or anything that uses these symbols.
To declare an interfacce you have to register a non-instantiable ...

Don't know if this is enough already. Does this sound like a good explanation to
you?

Stefan

> >
> On 2/8/07, Stefan Kost <[EMAIL PROTECTED]> wrote:
>> hi,
>>
>> yesterday I committed a first batch of cleanups to the GObject docs.
>> http://developer.gnome.org/doc/API/2.0/gobject/index.html
>>
>> IMHO this is a crucial documentation for the GNOME platform and it can
>> be improved further. Marc-Andre Lureau and Zeeshan Ali already joined
>> in the quest to improve this. What I like to ask you is to reply to
>> this mail and tell us what you don't understand yet, point out parts
>> that can be improved, let us know if there are some nagging concerns
>> about the way GObject works. Are there details that should be
>> explained by a picture?
>>
>> If possible then please checkout the latest version and base your
>> feedback on that one:
>>svn co http://svn.gnome.org/svn/glib/trunk glib
>>cd glib
>>./autogen.sh --prefix=$HOME/test
>>make
>>cd docs/reference/gobject
>>evince html/index.html &
>> you don't need to install it.
>>
>> Thanks!
>>
>> Stefan
>>
>> ___
>> gtk-app-devel-list mailing list
>> gtk-app-devel-list@gnome.org
>> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>>
> 
> 

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GObject docs improvements

2007-02-09 Thread Stefan Kost
Hi,

Quoting "David Ne?as (Yeti)" <[EMAIL PROTECTED]>:

> On Thu, Feb 08, 2007 at 08:44:50AM +0100, Stefan Kost wrote:
>>
>> What I like to ask you is to reply to
>> this mail and tell us what you don't understand yet, point out parts
>> that can be improved, let us know if there are some nagging concerns
>> about the way GObject works.
>
> Deriving from classes that implement interfaces and changing
> the implementation would worth an explanation and example.

Huh, sounds scary. We can do this. Do you have pointers to an example?
While checking for an example, just noticed that the "Implemented  
Interfaces" stuff in Gtkdoc seems quite borked. Need to fix that.
>
>> If possible then please checkout the latest version and base your
>> feedback on that one:
>>svn co http://svn.gnome.org/svn/glib/trunk glib
>>cd glib
>>./autogen.sh --prefix=$HOME/test
>
> I believe --enable-gtk-doc is missing here.
Yes. Keep forgetting that too.
>>make
>>cd docs/reference/gobject
>>evince html/index.html &
>
> Yeti

Thanks for the feedback

Stefan

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GObject docs improvements

2007-02-07 Thread Stefan Kost
hi,

yesterday I committed a first batch of cleanups to the GObject docs.
http://developer.gnome.org/doc/API/2.0/gobject/index.html

IMHO this is a crucial documentation for the GNOME platform and it can  
be improved further. Marc-Andre Lureau and Zeeshan Ali already joined  
in the quest to improve this. What I like to ask you is to reply to  
this mail and tell us what you don't understand yet, point out parts  
that can be improved, let us know if there are some nagging concerns  
about the way GObject works. Are there details that should be  
explained by a picture?

If possible then please checkout the latest version and base your  
feedback on that one:
   svn co http://svn.gnome.org/svn/glib/trunk glib
   cd glib
   ./autogen.sh --prefix=$HOME/test
   make
   cd docs/reference/gobject
   evince html/index.html &
you don't need to install it.

Thanks!

Stefan

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Question about properties in GObject

2007-02-04 Thread Stefan Kost
hi Thomas,

Tomasz Jankowski wrote:
> Hi!
> 
> I have short question. I installed G_TYPE_STRING property in my object. Will
> it free allocated memory when object will be destroyed or i should do it on
> my own?

you needs to do the ressource management yourself. That is whenever one sets the
string, free the old value and also free when you destroy the object. Same goes
for G_TYPE_OBJECT properties - there you need to unref old ones.

Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Installing property in interface

2007-02-04 Thread Stefan Kost
Hi Thomas,

only one small change needed:

static void goofy_file_transfer_base_init (gpointer g_iface) {
  static gboolean initialized = FALSE;

  if (!initialized) {
g_object_interface_install_property (g_iface,
   g_param_spec_string ("transfer-status",
 "Transfer status",
 "Specify current transfer status",
 "lol",
 G_PARAM_READWRITE));
  }
}



Tomasz Jankowski wrote:
> Hi!
> 
> I'm trying to install property into main interface, but when I run program
> it always display me this warning:
> 
> (lt-goofysender:10709): GLib-GObject-WARNING **: When installing property:
> type `GoofyFileTransfer' already has a property named `transfer-status'
> 
> Here you have some code:
> 
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


redirect GdkEvents

2007-02-02 Thread Stefan Kost
hi,

I need to do a hack :( I once submitted this together with a pack, but its not
beeing accepted.
http://bugzilla.gnome.org/show_bug.cgi?id=338271

Now I try to do a workaround for my use case. I am already able to get the
events the button inside the treeview header got. I now I want the children in
the container (=button) to handle them instead. I am currentl trying with the
code below, but I can't get the widget on the column header to do something :(

Any ideas?
  Stfean


static void
forward_event(GtkWidget *widget,gpointer user_data) {
  gtk_widget_event(widget,(GdkEvent *)user_data);
}

static gboolean
on_column_header_event(GtkWidget *widget,GdkEvent *event,gpointer user_data)
{
  GtkWidget *child=GTK_WIDGET(user_data);
  puts("header widget parent event: type=0x%x\n",event->type);

  /* forward some events to child */
  switch(event->type) {
case GDK_MOTION_NOTIFY:
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
  // this still does not cause the button clicks to work
  //gtk_widget_event(child,event);
  gtk_container_foreach(GTK_CONTAINER(child),forward_event,event);
  return(TRUE);
default:
  break;
  }
  return(FALSE);
}


static void
on_header_realize(GtkWidget *widget,gpointer user_data)
{
  GtkTreeViewColumn *tree_col=GTK_TREE_VIEW_COLUMN(user_data);
  GtkWidget *button=tree_col->button;

  g_signal_handlers_disconnect_matched(button,G_SIGNAL_MATCH_DATA,0,0,
NULL,NULL,tree_col);
  g_signal_connect(G_OBJECT(button),"event",G_CALLBACK(on_column_header_event),
(gpointer)widget);
}
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Basic GObject question

2007-01-20 Thread Stefan Kost
hi,

Andreas Stricker wrote:
>> Please don't laugh at me ;P Can someone explain me what reference counting
>> is for?
> 
> Wikipedia explain it not too bad:
> 
> http://en.wikipedia.org/wiki/Reference_counting
> 
> For glib specific implementation details I recomment to read this document:
> 
> http://le-hacker.org/papers/gobject/

or its current for in
http://developer.gnome.org/doc/API/2.0/gobject/index.html

Stefan

> 
> And a short overview in my own words:
> 
> Each GObject contains a counter that is incremented by each owner of the
> object. If one owner don't need the object anymore*, he decrement the
> counter. If the counter reach zero, there isn't an owner anymore so the
> object can be freed.
> So reference counting is something like a half-automated garbage collector.
> Reference counting in C still needs discipline and is error prone, but still
> easier than manual free() operations.
> 
> * usually before the reference (pointer) to the object is overwritten,
>replaced or just not used anymore
> 
> Cheers, Andy
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Saving a GdkWindow to a file

2007-01-09 Thread Stefan Kost
Hi,

Leandro A. F. Pereira wrote:
> Greetings,
> 
> In my application I have to save the contents of a widget to a PNG
> file. So far it works (using GDK Pixbuf and gdk_pixbuf_save), but
> garbage appears if the window is obscured by another window, or if
> some part of it is hidden.
> 
> How can someone get a GtkWidget's GdkWindow in a way no garbage will
> show up if that window isn't completely visible? I know that GTK+ is
> double-buffered, so it must be some way.
> 

as a naive idea, wouldn't it help to bring the window to front? One problem I
have with screenshooting windows is that the widnow decorations are missing.
Does somebody has a pointer to an example that includes the window decodation?

Stefan


> By the way, the code I am currently using is available at [1]. See
> tree_view_save_image().
> 
> [1] 
> http://svn.berlios.de/wsvn/hardinfo/trunk/hardinfo2/util.c?op=file&rev=0&sc=0
> 
> Thanks in advance,
> 

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: add a cursor...

2006-11-09 Thread Stefan Kost
Hi.
[EMAIL PROTECTED] wrote:
> Hi!!
> i've an x-y plot created with GTk!
> I'd like that after clicking in one of the plotted points, appear a cursor and
> then i can move it throught all the plotted points!!
> Is it possible??
>   
I would draw a cursor like object over the points. It would be a bit
confusing to move the mouse cursor in jumps over the points. What you
look for is something to highlight the current point (like a selection
or the cursor in a text field).
> I've readen information about how to set a curso to a widgetbut the 
> selected
> point is not a widget...so nothing goes!!
> Please...can anyone help me???
>
> tHANKS A LOT!
>   
Stefan

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: proper way to get cairo font width

2006-09-19 Thread Stefan Kost
Hi Tommi,

Tommi Sakari Uimonen wrote:
> Hello. What is the best way to query font width from cairo, in case that I 
> want to set size_hint for the widget that is drawing with that font?
>
> Currently I'm creating a cairo for some existing widget and set there the 
> desired font and query the width from text_extents_t struct, but it seems 
> a bit hackish.
>
>   
would it help to construcz PangoLayouts and use pango_layout_get_extents().

> Tommi
>   
Stefan

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Reference Counting

2006-09-11 Thread Stefan Kost
Hi,

Matias Torres wrote:
> Hi all,
>
> I'm working on some simple app which only use gtk and sqlite libraries 
> and i KNOW it's leaking memory.
> Would you please help me? (damn beatles!, i shouldn't be listening music 
> when writing a mail!)
> *- Is there a way to pass a function to free certain struct in a 
> GtkTreeModel so GTK frees the allocated space when the model's reference 
> count reach to 0? (without registering it as a G_TYPE).*
>
> *- When reference count starts? I read somewhere that it starts when you 
> add the widget into a container, is it always this way??? Eg:*
>
> //*No reference counting on GtkEntry*//
> GtkWidget *entry = gtk_entry_new ();
> //*Reference counting starts here *//
> gtk_container_add (GTK_CONTAINER (window), entry);/
> /* Another doubt: in this case, reference couting starts with 1 or 2? */
> /
> -* If i get a string from a GtkTreeModel, it gives me a copy or the 
> actual pointer to the data?
>   

Try http://refdbg.sf.net ! It may take a bit to get started, but its
worth it. Its a very valuable tool to track ref-counts without that you
need to modify your sources.

Stefan

> *That's it, thanks in advance. Matias.
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>   

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Recording widget motion

2006-09-11 Thread Stefan Kost
hi,

yes, using the GstController is the way to go. Initially you will record
a series of timed value changes. The GstController manages this queue
for you. If you hook these changes onto e.g. a GstVOlume element, you
can then listen to the "notify::volume" of it and from the handler set
the value of the slider. When you then replay, GstController will
activate the value changes at the right time and your slider will update
accordingly.

Stefan

Samuel Cormier-Iijima wrote:
> Thanks for the reply!
>
> That is pretty much what I'm doing currently, although your idea of
> using a GSList is a much better solution than the weird struct I'm
> using now :-). Also, I wasn't sure whether to use g_timeout_add or to
> make another thread to update the slider; I thought g_timeout_add
> would cause timing to be off (it would unsynchronize over time), but
> using a GTimer fixed it. The problem I'm currently having is this: I'd
> like to know when the user is "holding" the slider, that is, has the
> mouse button pressed on the slider itself, not in the "trough", so
> that the user can record "over" his previous recording. This is kinda
> hard to explain, and I'm not sure if it's a good idea from a UI point
> of view... I've managed to get this by digging into the private struct
> adjustment->layout->mouse_location, but that is hackish and not
> stable Anyways, I'm just rambling, it works now :-)
>
> Now I just need to hook this up to a GstController... but that's a
> topic for another list, and I have to read up more anyways. Thanks :-)
>
> Cheers,
> Samuel Cormier-Iijima
>
> On 9/7/06, David Nečas (Yeti) <[EMAIL PROTECTED]> wrote:
>   
>> On Thu, Sep 07, 2006 at 08:59:13AM -0400, Samuel Cormier-Iijima wrote:
>> 
>>> This is for music editing software I'm thinking about writing.
>>> Basically, the user should be able to "record" the volume during
>>> playback by sliding the GtkHScale around. When he plays it back the
>>> next time, the volume should change according to the way he recorded
>>> it (i.e. it'll wiggle around by itself during the song playback).
>>>   
>> Connect to the "value-changed" signal of the corresponding
>> adjustment.  In the callback, note the current time and
>> value and add it for example to a GSList (using prepend, not
>> append to keep it O(1)).  Disconnect when done.
>>
>> For replay revert the list, set up a periodically called
>> func with g_timeout_add().  When the function is called it
>> gets the current time, finds the value to set (if you save
>> the current position in the list it can be done with simple
>> forward search quite efficiently) and sets it, possibly with
>> interpolation.  Remove the func when you hit the end.
>>
>> This is quite obvious so, although I could probably patent
>> it, what I missed in the requirements?
>>
>> Yeti
>>
>>
>> --
>> Anonyms eat their boogers.
>> ___
>> gtk-app-devel-list mailing list
>> gtk-app-devel-list@gnome.org
>> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>>
>> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>   

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: frequently updated pixbuf images disapear after a while

2006-08-27 Thread Stefan Kost
rupert wrote:
> Hi,
> i update some pixbuf images once a second, when the application runs for
> more than 30minutes or so the
> images disapear and i get a bunch of the following message:
>
> cryptomaster:16742): GLib-GObject-CRITICAL **: g_object_unref: assertion
> `G_IS_OBJECT (object)' failed
>
> I assume its some unfread memory, but i havent really been able to track
> this errors.
> I tried valgrind, but im to much noob for this one. thx.
>
> this is the function that updates the pixbuf
>
>   
To track ref-count problems I recommend http://refdbg.sf.net.

Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GTK+ Draw a Rectangle over other widgets?

2006-08-20 Thread Stefan Kost
hi,

Wolfman wrote:
> Does someone know how can draw a simple rectangle over other widgets  or a
> complete window?
> Cause iam trying to write a window splitting system but i dont know how to
> draw this rectangle...:(
>
> best regards..
>   

you can subclass the widget, override the _expose_event() call parent
implementation and then draw over using normal gdk drawing functions.

Stefan

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: SPLint

2006-08-12 Thread Stefan Kost
I gave up on splint a while ago. I can't parse variadic macros too. So
unless someone continues to work on the splint parser, I don't believe
it will grok moder C.

Stefan


Will Frishe wrote:
> A while back I used SPLint on my code. Having been a little while since
> then, I decided to run through some of the newer code with it.
>
> Unfortunately, it makes all kinds of complaints, usually parse errors,
> regarding glib/gtk, e.g.:
>
> Splint 3.1.1 --- 14 Jun 2005
>
> /usr/include/glib-2.0/glib/gtypes.h:41:8: Parse Error:
> Non-function declaration: G_BEGIN_DECLS :
> int. (For help on parse errors, see splint -help parseerrors.)
> *** Cannot continue.
>
> Now I know it can work around this because I've done it before. However,
> I don't have the monstrous command line I used before handy. Does anyone
> else have a quick & easy cmdline / cfg that works well?
>
> --
> [EMAIL PROTECTED]| "So go and bow your head and weep,
> Earendel / 3rd Rail / CSC  |  for your world wont change while
> Sing your dreams, scream your song |  you sleep" -- Flogging Molly
>
>
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


set default theme for a new display

2006-08-03 Thread Stefan Kost
hi,

for unit-tests I open a second display on a Xvfb server which I start
before. This elaready works nicely. Now I also take screenshots from the
test-runs, for the manuals. This combined with altering the envoronment
(LC_ALL='en fr de ...') creates me localized screenshots. So far so
good. The issue is that gtk+ uses the default theme on the new display.
While the API docs are very sparse about how the theme stuff works, even
reading the sources did not really help.

Below is the code I use so far. As soon as I call
gtk_settings_get_for_screen(default_screen); I get stuff like

The program 'check_buzzard' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadRequest (invalid request code or no such operation)'.
  (Details: serial 96 error_code 1 request_code 0 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

Each test itself gets run in a fork(). If I add gdk_threads_leave(); ...
gdk_threads_enter(); around if(gtk_settings_get_for_screen()) ... the
application blocks :( Any idea?

Stefan


if((display_manager = gdk_display_manager_get())) {
  GdkScreen *default_screen;
  GtkSettings *default_settings;
  gchar *theme_name;
 
  default_display =
gdk_display_manager_get_default_display(display_manager);
  if((default_screen = gdk_display_get_default_screen(default_display))) {
if((default_settings = gtk_settings_get_for_screen(default_screen))) {
  g_object_get(default_settings,"gtk-theme-name",&theme_name,NULL);
  GST_INFO("current theme is \"%s\"",theme_name);
  //g_object_unref(default_settings);
}
else GST_WARNING("can't get default_settings");
//g_object_unref(default_screen);
  }
  else GST_WARNING("can't get default_screen");
 
  if((test_display = gdk_display_open(display_name))) {
GdkScreen *test_screen;
GtkSettings *test_settings;

if((test_screen = gdk_display_get_default_screen(test_display))) {
  if((test_settings = gtk_settings_get_for_screen(test_screen))) {
g_object_set(test_settings,"gtk-theme-name",theme_name,NULL);
gtk_rc_reparse_all_for_settings(test_settings,TRUE);
GST_INFO("theme switched ");
//g_object_unref(test_settings);
  }
  else GST_WARNING("can't get test_settings on display:
\"%s\"",display_name);
  //g_object_unref(test_screen);
}
else GST_WARNING("can't get test_screen on display:
\"%s\"",display_name);

gdk_display_manager_set_default_display(display_manager,test_display);
GST_INFO("display %p,\"%s\" is
active",test_display,gdk_display_get_name(test_display));   
  }
  else {
GST_WARNING("failed to open display: \"%s\"",display_name);
  }
  g_free(theme_name);
}
else {
  GST_WARNING("can't get display-manager");
}

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: New to GObject, few questions

2006-07-21 Thread Stefan Kost
hi tomasz,

Tomasz Jankowski wrote:
> Hi!
>
> Well, I'm working with GTK+ quite long, but I have never tried to get inside
> it's code. Now I'm trying to understood how GObject works and I must say,
> that it isn't as easy as I tought ;)
>
> I read few times "Gobject tutorial" provided with GLib's documentation but I
> don't understood it enouhg good, maybe because I don't like (and know)
> object languages, I know only C++ basics. So these are my questions:
>
> I. What the Interfaces are? I don't understood their predestination? I
> understood them as other type of Methods, but I'm know, that Interfaces
> aren't Methods, can someone explain me it?
>   
An example for a real world interface are play/stop/pause buttons on a
cd/tape/mp3-player. All kind of players have those. The interface would
be called "music-player-controls" and the user does not need to know
technical details to operate them. Play starts playback, if it is mp3 or
cd or whatever does not matter. In GObject if you have a "Sortable"
interface then this object can be sorted, what ever this means
internaly. The purpose is to use common operations on different objects.
Interfaces are important in GObject (and also Java) as unlike C++, it
does not support multiple inheritance.
> II. For example, object "XXX" inherits from object "ZZZ" and I defined
> *_finalize () functions for object ZZZ, but I didn't define any *finalize
> functions for object XXX. What will happen if I'll try to destroy XXX
> object? Will ZZZ's *_finalize functions will be used?
>   
yes, thats the idea.
> III. What 'GTypeInstance' is?
>   
You don't really need to deal with that usually.Its used for bookkeeping
of types (GValue, GObject based).

Stefan

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: About gtk_object_set_data()

2006-07-10 Thread Stefan Kost
hi,

chao yeaj wrote:
> Hello  everyone
>
> I have a check button
>and the check button may have an associated data,which is an
> source id returned by g_timeout_add()  function
> I do this,because,the check button may be need a function
> periodically  changing its attributes
>
>to manage the   source id returned by g_timeout_add()
>i use gtk_object_set_data() function to set the id to the
> object's data filed
>
> during the check button's life time, i may remove the data
> using g_source_remove,and may create the data again  using
> g_timeout_add()
>
> What I am not clear is that: when the check button is
> destroying ,how gtk  manage the  data i set to the object?
>   
When an object gets destroyed, its qdata list gets freed.
g_object_{s|g}et_data are convinience functions for
g_object_{s|g}et_qdata. Both work on the same data-list.

Stefan

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


noticing focus loss for a popup widnow

2006-05-16 Thread Stefan Kost
hi,

I use popup window (such as the one from the volume applet). When I
click my items on the scren I show the volume popup (a window containing
+/- buttons + a scale). I looks good and the buttons can be used. Now
the problem is that I want to hide it when one clicks somewhere else
(outside the popup).
I've seen Ronald Bultje asking this in may 2005 for the volume applet
and I've also looked at the code, but can't figure it out :(
I've monitored focus, focus-out, move-focus events for the widnow to no
avail. Any idea?

Stefan

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Gnome Help

2006-05-13 Thread Stefan Kost
Hi,

its written as docbook xml. See here for more info:
http://scrollkeeper.sourceforge.net/documentation/writing_scrollkeeper_omf_files/index.html

Stefan
Am Donnerstag, den 11.05.2006, 21:16 +0200 schrieb Fernando Apesteguía:
> Hi,
> 
> I would like to write the gnome help for a little application that I'm
> developing, but I can't find any tutorials.
> At developer.gnome.org I only found routines for displaying help, but... how
> should I write the help? Is it XML or HTML?
> 
> Thanks in advance.
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Coloring of multiple rows in List Store

2006-05-10 Thread Stefan Kost
Hi,

Am Mittwoch, den 10.05.2006, 15:58 +0530 schrieb Sailaxmi korada :
> Hi,
> 
>   I've a requirement, where I've to color multiple rows in List store, which
> are separated from each other. Is it possible to do this. Thanks for your
> suggestions

you can also add the colors to you model and connect them to the
matching property of the cell-renderer.

Stefan
> 
> Regards,
> 
> Laxmi
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: tree view header

2006-05-02 Thread Stefan Kost
Hi Thomas,

you can put own widgets in there. One way might be to put an own label
in there and set a default minimum height.

Ciao
  Stefan

Am Dienstag, den 02.05.2006, 15:21 +0200 schrieb Thomas Gilgin:
> Hi,
> 
> could someone give me a hint how to change the height of the header 
> buttons in tree view?
> 
> TIA
> Thomas
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: sidebars with gtk ?

2006-04-18 Thread Stefan Kost
Hi Kal,

I would suggest to look at the GtkExpander and pack the sideback into
the expander and the expander to the left.
Then it can be hidden and shown by the user.

Stefan

Am Montag, den 17.04.2006, 22:46 -0700 schrieb Muzaffer Kal:
> Hi,
> I am working with this app http://home.nc.rr.com/gtkwave/ which has a
> modeless dialog "Signal Search Tree" which you can see if you scroll down. I
> would like to make this tree view into a sidebar ala Firefox BookMark etc. I
> am very new to gtk so any suggestions are welcome.
> 
> Also I can't seem to position windows programmatically with gtk under win32.
> I am using gtk_window_move before I show the window but it still behaves as
> if I pass -1 instead of absolute numbers. Any ideas ?
> 
> Thanks,
> 
> Kal
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: interactive buttons inside treeview headings

2006-04-13 Thread Stefan Kost
Hi,

from the code it does not look like it was designed to support this use
case. Unfortunately the docs track one into beliving this can work.

In my case each column represents 'thing' for which I want to have a
handy shortcut to toggle some options. Have a layouted header with
interactive widgets would just 'fit'. Have the buttons in the first row
is out of question, as these buttons should not scroll away.

I'll see if I can come up with a patch for gtk+.

The only other option I see is not showing the headers at all, but
adding a table above the treeview and somehow try to make it's entries
the same width as the columns. This might be a bit tricky in one scrolls
left & right :(

Stefan

Am Donnerstag, den 13.04.2006, 18:17 -0400 schrieb Guy Rouillier:
> Stefan Kost wrote:
> > hi all,
> > 
> > just tried to set the treeview column 'clickable' property to TRUE. The
> > effect s not really what I want :(. Now the whole treeview header can be
> > clicked, but still not the buttons in there.
> 
> You are trying to make GtkTreeView do something it wasn't designed to do 
>   (clickable buttons inside a clickable header.)  If you really want 
> that,  you'll have to figure out a way to do that yourself.  What is the 
> purpose of your buttons?  If the columns are not sortable, maybe it 
> would be easier if you just put the label into the header, and then put 
> the buttons into the first row of the store.
> 

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: interactive buttons inside treeview headings

2006-04-12 Thread Stefan Kost
hi all,

just tried to set the treeview column 'clickable' property to TRUE. The
effect s not really what I want :(. Now the whole treeview header can be
clicked, but still not the buttons in there.

Stefan


Am Montag, den 10.04.2006, 21:37 +0200 schrieb Stefan Kost:
> hi list,
> 
> I've added a couple of (toggle)-buttons and a label in a box into each
> of my treeview headers. They are shown properly. I can also modify them
> programatically (toggle).
> My problem is, that I can't click them. Honestly I have no idea how to
> debug this. Any idea?
> 
> Thanks a lot.
>   Stefan
> 
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


interactive buttons inside treeview headings

2006-04-10 Thread Stefan Kost
hi list,

I've added a couple of (toggle)-buttons and a label in a box into each
of my treeview headers. They are shown properly. I can also modify them
programatically (toggle).
My problem is, that I can't click them. Honestly I have no idea how to
debug this. Any idea?

Thanks a lot.
  Stefan


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Callbacks and widgets

2006-03-28 Thread Stefan Kost

Hi Gonzalo,

I don't do that for *every* widget, just for logical groups.
In my GUI application I do this for the window, the toolbar, the statusbar, the 
content area (a notebook) and for each content page. Likewise I subclass dialogs.


Stefan

Gonzalo Aguilar Delgado wrote:

Hi, stefan.

This looks also good but it's a pain to have to instanciate every
widget. But for some special widgets may be a great solution...

Thank you for your reply.




hi,
Gonzalo Aguilar Delgado wrote:


Yep, I know about some of them:

1.- Passing a data structure
2.- Using global variables (not good threading support)
3.- Passing window to gpointer and searching.


4.- Use GObjects for you UI

In my apps I don't directly insert e.g. a gtk_hbox, but derive a class from it 
(e.g. MyOptionGroup) and this class has aditional datafields. The callback gets 
the pointer to the instance of the MyOptionGroup as user_data.


Stefan


But the point is. 


What is the best way? Is there any other way to do that? Because
structure option looks more suitable for different data to be passed not
just widgets...

I tried to set the widgets as user-data of the widget to be triggered.
But it seems not to work.

I will look anyway in the older mailing list.

Thank you.





On Tue, Mar 28, 2006 at 09:38:20AM +0200, Gonzalo Aguilar Delgado wrote:



Because receiver callback is getting only the receiver widget,


In addition, the callback gets an arbitrary pointer passed
as user_data to g_signal_connect().  A pointer can be used
to pass anything.

This is a very frequently asked question, search the
archives for discussion...

Yeti


--
That's enough.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Callbacks and widgets

2006-03-28 Thread Stefan Kost

hi,
Gonzalo Aguilar Delgado wrote:

Yep, I know about some of them:

1.- Passing a data structure
2.- Using global variables (not good threading support)
3.- Passing window to gpointer and searching.

4.- Use GObjects for you UI

In my apps I don't directly insert e.g. a gtk_hbox, but derive a class from it 
(e.g. MyOptionGroup) and this class has aditional datafields. The callback gets 
the pointer to the instance of the MyOptionGroup as user_data.


Stefan



But the point is. 


What is the best way? Is there any other way to do that? Because
structure option looks more suitable for different data to be passed not
just widgets...

I tried to set the widgets as user-data of the widget to be triggered.
But it seems not to work.

I will look anyway in the older mailing list.

Thank you.




On Tue, Mar 28, 2006 at 09:38:20AM +0200, Gonzalo Aguilar Delgado wrote:


Because receiver callback is getting only the receiver widget,


In addition, the callback gets an arbitrary pointer passed
as user_data to g_signal_connect().  A pointer can be used
to pass anything.

This is a very frequently asked question, search the
archives for discussion...

Yeti


--
That's enough.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Initilize a filter

2006-03-22 Thread Stefan Kost
Hi,

this is what I do:

GtkListStore *store;
GtkTreeModel *filtered_store;

...

// create a filterd model
filtered_store=gtk_tree_model_filter_new(GTK_TREE_MODEL(store),NULL);
gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(filtered_store),visible_filter,(gpointer)self,NULL);
// active model
gtk_tree_view_set_model(tree_view,filtered_store);

Stefan

Am Mittwoch, den 22.03.2006, 11:20 +0100 schrieb Bellicano Pascal:
> Here is my code :
> 
> GtkTreeModel *filter_model;
> filter_model=gtk_tree_model_filter_new 
> (GTK_TREE_MODEL(store_ori),
>  NULL);
>
> GtkTreeModelFilter *filter;
> gtk_tree_model_filter_clear_cache(filter);
>
>  gtk_tree_view_set_model (GTK_TREE_VIEW(tree_view),
> GTK_TREE_MODEL (filter_model));
> 
>   ...
> 
>  gtk_tree_model_filter_set_visible_column 
> (GTK_TREE_MODEL_FILTER(filter),7);
> 
>   ..
> 
> (store_ori is a liststore)
> 
> gcc complains about filter not initialised.. ok but how to initialize it ?
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: zipping/unzipping library?

2006-03-06 Thread Stefan Kost

Hi Allin,
Allin Cottrell wrote:
Before I embark on this I'd like to find out if something of the sort 
already exists, or if someone else is already working in this area.  
Also, perhaps, how much interest there might be in this project.


What I'm thinking would be useful is a library, with the portability 
level of glib, offering the functionality of creating and extracting 
files from zip archives.  I envisage it using both glib and zlib, and 
offering a basic API with these elements:


* A function to create a zip file, given a target filename, a list of 
files to archive, and a compression level.


* A function to retrieve a list of file attributes from a zip archive.

* A function to extract all, or a selected list of, files from a zip 
archive.


This functionality is already present in the Infozip packages, zip and 
unzip.  But although these packages contain some gestures toward 
offering a library API, this has not been taken very far.  And although 
the infozip programs work very nicely, the code is not pretty (for one 
thing, it's choked with #ifdefs for every ancient architecture known to 
man).


I was looking for similiar stuff and also found the infozip package. IMHO it 
would be extremly cool if someone could stuff this into handlers for gnome-vfs. 
Gnome-vfs is relative portable and does other nice things already. Right now I 
use gnome-vfs to store my application files (xml + binary data) in tar.gz 
archives. Uning a zip file would be prefered as a gzip-stream is not easy to 
recover in cases of bit-errors.


The zlib API itself is fine; but it's quite low level, and it leaves the 
application programmer to do much of the grunt work involved in creating 
or reading a multi-file zipfile.


One further comment: I can imagine the question, why bother with the 
zipfile format when gzipped tar is better?  My response is that for 
better or worse the PKzip format has become a de facto standard, now 
enshrined in the ODF specs, and I'd like for my app to be able to read 
and write ODF files.




Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkTreeView - Selecting the first row

2006-02-23 Thread Stefan Kost

hi,

just a wild guess, are use using the GTK_SELECTION_BROWSE selection mode?

GtkTreeSelection *select;

select = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
gtk_tree_selection_set_mode (select, GTK_SELECTION_BROWSE);

Ciao
  Stefan

Hannes Mayr wrote:

Hello,

I'm having a problem with the selection on a TreeView widget. I have a 
simple Treeview with one visible column and want to move the selection 
up and down with 2 buttons. When my application starts there is no row 
selected, so clicking on a button I need to set the selection to the 
first row.
I thought I could do that with gtk_tree_model_get_iter_first() and 
gtk_tree_selection_select_iter(), but this doesn't work. Until I'm not 
selecting with the mouse pointer a row, I can't set a selection with 
gtk_tree_selection_select_iter(). Calling 
gtk_tree_selection_get_selected() tells me that a row is selected, but 
the TreeView shows nothing.


Could somebody give me a hint what I'm doing wrong?

Thanks,
Hannes


Here my piece of code:

GtkTreeSelection *selection = 
gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));

GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW(treeview));
GtkTreeIter iter;

gboolean is_Selection = gtk_tree_selection_get_selected(selection, 
&model, &iter);


// Move selection up/down
if (menu_item->index==0 || menu_item->index==1) {
  if (is_Selection) {
GtkTreePath *path = gtk_tree_model_get_path(model, &iter);

if (menu_item->index==1) // down
  gtk_tree_path_next(path);
else // up
  gtk_tree_path_prev(path);

gtk_tree_model_get_iter(model, &iter, path);
  }
  else {
gtk_tree_model_get_iter_first(model, &iter);
  }

  gtk_tree_selection_select_iter(selection, &iter);
}


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GSList and g_filename_from_uri free memory problem

2006-02-23 Thread Stefan Kost

Hi again,

The list is only valid if all filenames are not free'd!
As long as you work with the list do not free the filenames.
When you are done with the list, iterate over the list, free all filenames and 
then the list. something like this (untested):


GSLIst *list,*node
for(node=list;node;node=g_slist_next(node)) {
  g_free(node->data);
}
g_slist_free(list);

Stefan

Colossus wrote:

Stefan Kost wrote:

just don't fre the filenames now. Free the filenames when you free the 
list.



Ok, but you see the while loop ? if the user drags 10 files from 
Nautilis window inside Xarchiver ( my app ) window, when I issue g_free 
later I will only free the last pointer gave me back from

g_filename_from_uri and what the others nine ones ?



___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GSList and g_filename_from_uri free memory problem

2006-02-23 Thread Stefan Kost

Hi

Colossus wrote:

Hi,

I have this code:

gchar **array = NULL;:
array = gtk_selection_data_get_uris ( data );
while (array[len])
{
   filename = g_filename_from_uri ( array[len] , NULL, NULL );
   Files_to_Add = g_slist_prepend ( Files_to_Add , filename );
   g_free (filename);
   len++;
}

The problem is that when I free filename the GSList data becames 
corrupted, but the docs says that g_filename_from_uri returns allocated 
memory, so what can I do ? Once I put filename in the GSList I don't 
need it anymore. Is filename freed when I call g_slist_free ?


just don't fre the filenames now. Free the filenames when you free the list.

Stefan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


  1   2   3   >