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 jan...@xfce.org 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 jan...@xfce.org 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 jan...@xfce.org 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 tadeb...@gmail.com
 wrote:
 
 All that being said, maybe you could cook up a patch for API docs
 with this info? I'm sure people would find it useful.

 
 Is there a starting place to read how to go about doing that?
 
 
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 files
* 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: 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: 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 libintl.h
 #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: 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
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: 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: 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: i18n, intltool problems

2009-02-07 Thread Stefan Kost
John Coppens schrieb:
 On Thu, 5 Feb 2009 14:05:04 -0200
 John Coppens j...@jcoppens.com 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: 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-22 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


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==by 0x4F82FFB: (within /lib/i686/cmov/libnss_compat-2.7.so)
 ==2983==by 0x4F845D4: 

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: 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,
   Buzztard-Main/MainToolbar/Play,accel_group);
 gtk_accel_map_add_entry (Buzztard-Main/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:
 
 program 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-30 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,
  Buzztard-Main/MainToolbar/Play,accel_group);
gtk_accel_map_add_entry (Buzztard-Main/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? (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),Buzztard-Main/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,

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),Buzztard-Main/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? (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),Buzztard-Main/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 stdio.h
 #include stdlib.h
 #include string.h
 
 #include gtk/gtk.h
 #include gdk/gdk.h
 #include gdk/gdkkeysyms.h
 #include glib.h
 
 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),context menu 2);
 }
 
 static void on_popup_button_clicked(GtkButton *widget,gpointer user_data) {
   
 gtk_menu_popup(GTK_MENU(user_data),NULL,NULL,NULL,NULL,3,gtk_get_current_event_time());
 }
 
 static void on_check_toggled(GtkToggleButton *togglebutton,gpointer 
 user_data) {
   if(gtk_toggle_button_get_active(togglebutton)) {
 gtk_window_add_accel_group(GTK_WINDOW(window),GTK_ACCEL_GROUP(user_data));
 puts(2nd accel group added);
   }
   else {
 
 gtk_window_remove_accel_group(GTK_WINDOW(window),GTK_ACCEL_GROUP(user_data));
 puts(2nd accel group removed);
   }
 }
 
 static void init() {
   GtkWidget *vbox,*hbox;
   GtkWidget *button;
   GtkWidget *mb,*pm,*sm,*mi;
   GtkAccelGroup *accel_group;
   GtkWidget *label,*ck;
 
   window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
   gtk_window_set_title(GTK_WINDOW(window), Popup with accelerator);
   g_signal_connect(G_OBJECT(window), destroy,   G_CALLBACK (destroy), 
 NULL);
 
   accel_group=gtk_accel_group_new();
   gtk_window_add_accel_group(GTK_WINDOW(window),accel_group);
 
   vbox=gtk_vbox_new(FALSE,0);
   gtk_container_add(GTK_CONTAINER(window),vbox

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),Buzztard-Main/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,

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: 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,

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: 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


notify for first last signal handler

2007-04-05 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=value optimized out,
 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=value optimized out,
 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: 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-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: 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


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


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: 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=filerev=0sc=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: 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: 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: 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


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


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: 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


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 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,

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: 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: 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


Re: How to identify the idle state of the GTK+ application?

2006-02-15 Thread Stefan Kost
hi,

I would write an xscreensaver module and use that :)

stefan

sadhees kumar schrieb:
 Friends,
 
In my GTK application, If  no action(event) is taken place in
 the screen, I need to turn OFF the backlight of an TFT monitor. If any
 key pressed, or mouse movement occured, I need to turn ON the
 backlight.
 
 I have the API for toggling the backlight. My problem is , how to
 identify the idle state of the screen?
 
 Can you help me.
 
 Thanks in advance..
 
 
 --
 _
 Regards,
 
 K.Sadheeskumar.
 ___
 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 get selected row AND column

2006-02-14 Thread Stefan Kost

Juan Pablo wrote:

Hi list!
I have a GtkTreeView and what I want to do is when the user is over an
editable cell, the editing begins automatically without having to press
enter. And the other thing that i want to do is that when the user is
over a cell on a certain column the cursor changes automatically to the
next (he cant edit that cell).

The GtkTreeView is a ticket editor, when the user is on the first
column, the editing should be started automatically so he puts a product
code, then when he press enter, the second column is filled with the 
description of the product wich has that code and the third column

should get the focus, where, again without having to press enter, he
inputs the amount and then it jumps to the first column on the next row.

This is why i need to know the row and column, so in the cursor_changed
signal i can decide to emmit start_editing or to pass the focus some
where else.


you can use gtk_tree_view_set_cursor() and gtk_tree_view_get_cursor().
I store the row number in my model for easy reference.

GtkTreePath *path;
GtkTreeViewColumn *column;
glong column_ix,row_ix;

gtk_tree_view_get_cursor(treeview,path,column);
if(path  column) {
  GtkTreeIter iter;

  if(gtk_tree_model_get_iter(treestore),iter,path)) {
GList *columns=gtk_tree_view_get_columns(treeview);

column_ix=g_list_index(columns,(gpointer)column)-1;
g_list_free(columns);
gtk_tree_model_get(treestore,iter,TABLE_POS,row_ix,-1);
  }
}
if(path) gtk_tree_path_free(path);

printf(cursor at col/row = %d,%d\n,column_ix,row_ix);



If is any other way to do it, please! :D

Thanks all.


Saludos, Juan Pablo.


___ 
A tu celular ¿no le falta algo? 
Usá Yahoo! Messenger y Correo Yahoo! en tu teléfono celular. 
Más información en http://movil.yahoo.com.ar

___
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: images inside labels

2006-01-30 Thread Stefan Kost
hi,

you need to put in an event box first. the tab has no window.

eventbox(hbox(icon,label))

Stefan

devel wrote:
 Well, I have tried placing an image and a label inside an hbox, but no
 such luck. For some reason, the notebook's tab label is not showing
 the hbox. Its not showing anything, not even the page number. Very
 certain I am packing what and where I need to. Little stumped. Thanks.

 gtk_box_pack_start(GTK_BOX (hbox), icon, FALSE, FALSE, 0);
 gtk_box_pack_start(GTK_BOX (hbox), label, FALSE, FALSE, 0);
 gtk_notebook_append_page(GTK_NOTEBOOK (notebook), scroll, hbox);


 Travis

 - Original Message - From: devel [EMAIL PROTECTED]
 To: Tristan Van Berkom [EMAIL PROTECTED]
 Cc: GTK gtk-app-devel-list@gnome.org
 Sent: Monday, January 30, 2006 11:52 AM
 Subject: Re: images inside labels


 To answer your question, the latter of what you mentioned. I just
 need a small icon/image next to a one-word blurb on the tab. So the
 1st idea you mentioned sounds reasonable enough.

 Good thing I'm not a betting man, eh?

 Thanks

 Travis


 - Original Message - From: Tristan Van Berkom [EMAIL PROTECTED]
 To: devel [EMAIL PROTECTED]
 Cc: GTK gtk-app-devel-list@gnome.org
 Sent: Monday, January 30, 2006 12:56 PM
 Subject: Re: images inside labels


 devel wrote:
 I have a gtknotebook that I would like to put small images inside
 the tab labels. I've looked around, but haven't seen how to do
 that. I am willing to bet that it can't be done, but I'll just ask
 as a last resort. Thanks.

 Hmmm how much you wanna bet ?

 heh, so do you want images as a background of the label
 or do you want images beside the labels in the notebook ?

 You can:
o Create a hbox and add an Image and a Label to it, then call
  gtk_notebook_set_tab_label (if thats what the function is called)
  with the hbox as an argument (you can use anything as a
 tab-label).

o If you want the label to draw onto an image, you'll have to dig
  a little deeper; you need to use the theme engine to associate
  a graphic file with the background of the label (or its parent
  widget), you could do this via a gtkrc file also but I think
  you'll want it to be theme independant.

  This func: gtk_widget_modify_style () should be a good lead on
  how to do that :)

 Cheers,
  -Tristan




 ___
 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: Replacement for gtk_tree_set_view_lines]

2006-01-29 Thread Stefan Kost

Hi Jim,

I am not sure, but I belive the display style of the treeview is theme related. 
Means you can't programmatically change it.


Stefan

Jim Harford wrote:


Does anyone know the answer to this?  Do I need to try a different email 
list?


Jim Harford

 Original Message 
Subject: Replacement for gtk_tree_set_view_lines
Date: Wed, 25 Jan 2006 10:52:10 -0500
From: Jim Harford [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
Organization: Blue Wave Labs
To: gtk-app-devel-list@gnome.org



Hi,
I'm trying to display a GtkTree with those familiar vertical lines that 
indicate nesting levels within a tree.  I think there used to be a 
function, gtk_tree_set_view_lines, to do this, but it has been 
deprecated.  How do I do this?  I have looked at the documentation, 
searched the mailing list archives, but I still can't figure it out.


Jim Harford

P.S. - I am brand new to GTK  GNOME, so I would appreciate your patience.


___
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: programming practices with regard to gtk and networking

2006-01-25 Thread Stefan Kost
Hi Ken,

Ken Nagorski wrote:
 Hi there,

 I just started working with GTK. I have a some background with C which
 means I can do OK but when it comes to working with the two together
 it gets harder...

 My question is really this. I have a very simple IM program that I
 wrote in java (had to take a class on it) and I started porting the
 application to C and GTK but here is where I run into a problem. I
 have a button that says connect. and when clicked it creates the
 connection all that works fine, however unlike calling a normal
 function I can't really pass data back from the function the button
 called. Can I... What I need to do is somehow create the connection
 when the button is clicked and then pass the
 sockfd to the calling part of the programming (main) so I can then use
 that in the calls to send().

 What I really need is someone to point me in the right direction.
When you connect an event handler to a signal, you can pass a user_data
parameter. If you design you app in oo-style then you can pass a
reference of e.g. you application-objsct as user_data. When the event
triggers the handler will receive this reference and can access you
applications methods and members.


 Thanks alot
 Ken

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


Re: programming practices with regard to gtk and networking

2006-01-25 Thread Stefan Kost

Hi Amitesh,

Amitesh Singh wrote:

Hi
is to possibble to Draw moving Graphs in GTK+ ?
 i tried to post this query in group .but its unable to deliver this
message ///dunno why :-p


are you subscribed to the list?

Anyway, you can use a Drawable or a Canvas-widget to draw your graphs. The can 
certainly be animated.


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


Re: Differences beetwen ref and weak ref

2006-01-18 Thread Stefan Kost

Hi,
Uzytkownik wrote:

I'm so sorry - when should I use weak reference?



I use waek references in the class collaboration hierarchy. Imagine classes 
GGroup and GItem, where GGroup has GItems. GItem instances need access to 
GGroup, thus they have a GGroup *container element;. When setting the container 
element for an item I use a weak ref to not introduce a circular dependency 
(GGroup references GItem and GItem references GGroup). This works as whenever 
GGroup gets destroyed it will release all GItems.
So one might ask when I take the weak_ref at all? I something is behaving wrong 
like I unref an GGroup too often, I will access dead memory. When using the 
weak_ref the GGroup pointer will be set to NULL and my assertions will trigger 
when doing checks like G_IS_GROUP(self-container).


Hope that this makes any sense for you :)

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


Re: some questions, please help

2005-12-11 Thread Stefan Kost
hi Luka,
Luka Napotnik wrote:
 Another question.

 Does GTK+ have functions to get the file type via MIME? If not, how can
 I get that?

   
Have a look at gnome-vfs. This is the component that handles that and more.

 Greets,
 Luka
   

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


Re: Inner window size issue

2005-11-26 Thread Stefan Kost

Hi Gus,

Gus Koppel wrote:

Nikolaj Kiær Thygesen wrote:



How on earth do I open a window containing a couple of widgets,
one of which is a ScrolledWindow?? This ScrolledWindow displays
an image, and now I'd like to fit the size of the ScrolledWindow
to the size of the image in pixels.



I have understood it like this: you have a GtkImage inside a
GtkScrolledWindow. The GtkScrolledWindow should be just large enough to
allow the GtkImage to be entirely visible, i.e. there is no need to
scroll the GtkImage (the contents of the GtkScrolledWindow).

Pardon me, but why is there a GtkScrolledWindow at all if you apparently
intend to avoid the need of scrolling inside the bitmap (because it's
entirely visible)? Wouldn't just removing the GtkScrolledWindow and
placing the GtkImage directly into the container fulfill your demand?


No that wont do, I have a simillar problem here. I generate a UI for plugins. 
The UI consists of a scrollarbe windows with a table-layout inside. The table 
has label + widget per row. The number of row can be anything from 1 to say 
1000. Therefore the scrollable windows is needed if the height of the window 
would exceed the screen height. Anyway if it does not, I'd prefer to make the 
window as tall as possible to show the entries without needing to scroll.


I am not be able to achive this yet.

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


Re: Inner window size issue

2005-11-26 Thread Stefan Kost

Hi Gus,

Gus Koppel wrote:

Stefan Kost wrote:



[...]
Therefore the scrollable windows is needed if the height of the
window would exceed the screen height. Anyway if it does not,
I'd prefer to make the window as tall as possible to show the
entries without needing to scroll.

I am not be able to achive this yet.



I suppose gtk_window_maximize () doesn't match your notion of make the
window as tall as possible?


No, I want as tall as needed to display content without scrolling.

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


Re: confused about pango_cairo_font_map_set_resolution API

2005-11-15 Thread Stefan Kost

Hi Axel,

Axel Simon wrote:

Hi,

I'm slightly confused about the pango_cairo_font_map_set_resolution
function and friends, mainly because it only takes one argument, namely
a scaling factor between em*1/72 (font size in inch (why oh why?!)) and
pixels. Given that my monitor (and probably other output media) has a
different resolution in x and y direction this seems weird.


Computer monitor pixels are square. The monitor itself has an aspect ration of 
4:3 or 16:9, but will be compensated by using more pixels on the x axis.


Can't answer the rest though.

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


Re: confused about pango_cairo_font_map_set_resolution API

2005-11-15 Thread Stefan Kost

Axel Simon wrote:

On Tue, 2005-11-15 at 09:05 +0100, Stefan Kost wrote:

Hi Axel,

Axel Simon wrote:


Hi,

I'm slightly confused about the pango_cairo_font_map_set_resolution
function and friends, mainly because it only takes one argument, namely
a scaling factor between em*1/72 (font size in inch (why oh why?!)) and
pixels. Given that my monitor (and probably other output media) has a
different resolution in x and y direction this seems weird.


Computer monitor pixels are square. The monitor itself has an aspect ration of 
4:3 or 16:9, but will be compensated by using more pixels on the x axis.



The mask of a screen might be, but depending on the resolution, the
displayed pixels are not: I can use the VESA mode 1280x1024 (5:4) on
either a 4:3 or 16:9 monitor.
Thats why this resolution IMHO is rarely used, atleast not when you do video 
editing or graphics. But for common resultions the aspects stuff works. 1280x960 
wold be correct again.


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


Re: optimal way to use Memory Chunks

2005-11-09 Thread Stefan Kost

Gus Koppel wrote:

Too much
ardour for that might let some people end up one terrible day by writing
x = g_math_add (g_math_sub (a, g_math_mul (b, c)), d);
instead of just
x = a - b * c + d;


You mean of course
g_math_assign(x, g_math_add (g_math_sub (a, g_math_mul (b, c)), d));

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


Re: Programming style

2005-11-01 Thread Stefan Kost

hi,

Wallace Owen wrote:

On Mon, 2005-10-24 at 17:21 -0400, Tristan Van Berkom wrote:


...
I just wanted to point out that the user data argument is usable and
efficient (since nobody had mentioned that yet).

Ofcourse there are cases where it isn't convenient to use the user_data;
I might as well also note that, with the cost of a slight overhead;
g_object_set_data (); is often usefull for this type of inconvenience.



gtk_object_set_user_data() is deprecated, so we're left with

tristan mentioned g_object_set_data()

g_object_set_data(), which will involve a string lookup.
and if the string lookup is concerning you there is g_object_set_qdata() where 
you pre-allocate the GQuark from the string and use that.


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


Re: strange problem with radiomenuitem

2005-10-27 Thread Stefan Kost

Hi
Alexander Nagel wrote:

Hi all,
i created some radiomenuitem with this.

string tmp;
for (int i = 0; i10;i++)
{
ostringstream outStream;
outStream  i;
tmp = Gruppe  +outStream.str();


char tmp[10]; // length of Gruppe xx
for (int i = 0; i10;i++)
{
  sprintf(tmp,Gruppe %d,i);

the're a thousand more ways to do it (e.g. to avoid copying the 'Gruppe' string 
in there again and again).


Stefan



Widgets_MainWindow.menugroupitems[i] = 
gtk_radio_menu_item_new_with_label (Widgets_MainWindow.GroupList, tmp.c_str());
gtk_menu_shell_append (GTK_MENU_SHELL (Widgets_MainWindow.menugroups), 
Widgets_MainWindow.menugroupitems[i]);
Widgets_MainWindow.GroupList = gtk_radio_menu_item_get_group 
(GTK_RADIO_MENU_ITEM (Widgets_MainWindow.menugroupitems[i]));
gtk_widget_add_accelerator (Widgets_MainWindow.menugroupitems[i], 
activate, Widgets_MainWindow.accel_group, gdk_keyval_from_name 
(outStream.str().c_str()), GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
gtk_widget_show (Widgets_MainWindow.menugroupitems[i]);
g_signal_connect ((gpointer) Widgets_MainWindow.menugroupitems [i], 
activate, G_CALLBACK (on_menugroup_items_activate), (gpointer) i);
}

(don't laugh about the stream thing. If someone could give me a hint to
make that better would be great.)

and this is the callback:
void on_menugroup_items_activate (GtkObject *object, gpointer user_data)
{
cout  Gruppe   (int) user_data  endl;
}

So the callback just print the number of the chosen group.
And this work.
But
1. During compilation i get a warning about
'cast to pointer from integer of different size'
for the g_signal_connect line. How can i avoid this?

2. It is normal that the callback is called twice?
For example if group 3 is marked and i change to 5 i get
Gruppe 3
Gruppe 5
then marking group 9
Gruppe 5
Gruppe 9
Is that normal?

3. When i choose group 1 the callback always produces
Gruppe 1
Gruppe 0
regardless from the previous group.
Why?


any ideas would be much appreciated.. 


regards
Alex


___
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 - hide some rows

2005-10-17 Thread Stefan Kost

Hi,
HuamiSoft Hubert Sokolowski wrote:

Hi!

I have a treeview which is a list. is it possible to hide some
particular rows? I want to implement some filter on my treeview, so the
user could find quicker some rows.

regards


have look at
http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeModelFilter.html

esies would be to add a boolean entry to you model and set this to true for 
columns to hide. The filter hook could then just look at this entry to filter.


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


Re: GOption replacement for poptPrintUsage needed

2005-10-13 Thread Stefan Kost

Hi Matthias,

On Wed, 2005-10-12 at 23:10 +0200, Stefan Kost wrote:


hi,

has anyone written a replacement for poptPrintUsage for GOption?
IMHO that would fit well into glib.


What does poptPrintUsage do ?


It prints the usage. That is the short help summary. GOption naturally does not 
detect if e.g. an argument is not valid. In the case the application could call 
g_option_context_print_usage(ctx);

and below print the error (valid range for timeout is 10...20);

The g_option_context_print_usage(ctx); could determine the comman dline template 
from the given GOptionEntries and list tha usage in the form:

myapp required options ...


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


GOption replacement for poptPrintUsage needed

2005-10-12 Thread Stefan Kost

hi,

has anyone written a replacement for poptPrintUsage for GOption?
IMHO that would fit well into glib.

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   >