Re: focus line pattern around gtk event box

2011-12-20 Thread Andrew Cowie
On Tue, 2011-12-20 at 09:25 +0100, David Nečas wrote:

 Using gtk_paint_focus() in the draw handler...

Deprecated now, apparently; refers to
http://developer.gnome.org/gtk3/3.3/GtkStyleContext.html#gtk-render-focus
instead.

AfC
Sydney


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

Re: GTK 3 support status

2011-12-06 Thread Andrew Cowie
On Tue, 2011-12-06 at 17:47 +0900, Tristan Van Berkom wrote:

 gtk_widget_set_size_request() should still succeed with the expected behaviour
 of setting the minimum size of a widget,

So, does it do so for GtkLabel? ie, is it acceptable to call it?

[this thread has become a bit confusing]

AfC
Sydney


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


RE: Valgrind questions

2011-11-23 Thread Andrew Cowie
On Wed, 2011-11-23 at 18:07 +, Thomas Harty wrote:
 I'll see if I can narrow down exactly what's causing this...

Still, looks like you're pretty close to a good suppression file.

Where should we install it?

/usr/share/suppression/glib.sup
/usr/share/suppression/gtk.sup
/usr/share/suppression/pango.sup

Perhaps? [it would be really nifty if valgrind would then pick those up
automatically, but I guess we'd need to discuss that with them]

AfC
Sydney


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


Re: pango -- prevent line break?

2011-10-27 Thread Andrew Cowie
On Wed, 2011-10-19 at 16:28 -0400, Allin Cottrell wrote:
 I have some text I'm displaying via pango and while in general 
 I want to allow automatic line breaks, I want to prevent line 
 breaks from occurring in certain contexts.
 
 Specifically, what I'm trying to avoid is the breaking of 
 option-flag strings such as --quiet in online documentation 
 (with -- appearing on one line and quiet on the next).

What I've tended to do in this sort of situation is insert a Zero Width
Word Joiner character (it's U+200D, see General Punctuation in
`gucharmap`) into my text where I want to inhibit breaks happening
mid-word when line wrapping is happening.

[the one that gets me is function(args) getting split before the '('
character, so I stream out f u n c t i o n ZWJ ( a r g s ) or so]

For me this is Pango rendering via Cairo to PDF, so I'm not worrying
about this messing up offsets in an GtkTextView editor. I haven't found
a good way to handle that.

AfC
Prague

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

Re: Valgrind questions

2011-10-07 Thread Andrew Cowie
On Tue, 2011-09-20 at 12:48 +0100, jcup...@gmail.com wrote:

 Ooop, thanks. I hadn't realised but I'd not updated the version on the
 website for a while. I've put my current one up now and it includes a
 thing for g_type_add_interface_static(), as you also found.

Might it be a good idea to put the suppression file directly into the
GTK sources, and perhaps even distribute it via the -dev / -devel
packages for libgtk?

Might help the FAQ factor a bit if everyone can just be told to find The
Suppression File in /usr/share/something...

AfC
Sydney


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


Re: interested in gtk+ project development

2011-02-15 Thread Andrew Cowie
On Tue, 2011-02-15 at 20:47 -0800, Patrick Noble wrote:
 My names Patrick Noble, and was hoping for a few pointers... I am interested
 in learning about and helping out in a development project 

The best thing to do is get involved in a project that _uses_ GTK. Pick
something on the GNOME desktop that you like and have a good poke around
inside it to see how it does business. Evince, the PDF viewer, has a
good reputation. I'm sure others can suggest different apps worthy of
study.

Concurrently, start working on something *small* that uses GTK so you
get a good feel, over time, for what it's like to use the library and
its API. After a while you'll start to get a sense of things.

Finally, you can certainly subscribe to the other GTK lists (and if
you're really brave, to the gtk+ bugzilla traffic) and start seeing how
development happens.

The biggest thing, though, is that you don't have to learn it all by
yourself. Studying (and, more to the point, working on) existing code
bases (such as the Evince example earlier) will help you learn about how
to pull larger applications together. No one teaches that part in
school.

Enjoy,

AfC
Sydney

-- 
Andrew Frederick Cowie

Operational Dynamics is an operations and engineering consultancy
focusing on IT strategy, organizational architecture, systems
review, and effective procedures for change management: enabling
successful deployment of mission critical information technology in
enterprises, worldwide.

http://www.operationaldynamics.com/

Sydney   New York   Toronto   London
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Memory leaks

2011-02-09 Thread Andrew Cowie
On Wed, 2011-02-09 at 10:44 +0200, Tor Lillqvist wrote:
 And anyway, this OMG GTK+ leaks memory discussion has been had
 several times already over the years. This parrot is dead.

True.

But it is a shame that there isn't a
gtk_unload_no_I_mean_really_unload_honest() function that we could use -
not for normal use, because with modules etc there are too many
resurrection corner cases - but as a last call before exit() when
testing to make valgrind's life a little easier.

{shrug}

AfC
Sydney

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

Re: GTK Logging

2010-12-05 Thread Andrew Cowie
On Sun, 2010-12-05 at 14:41 -0500, Tim Corio wrote:
 I'm using g_debug(...) in my application.  Is there a way to turn off
 all debug messages?

I suppose you could call g_log_set_default_handler() and replace the
default handler with a local custom one which would either ditch all
logged messages [bad] or manually dispatch anything !G_LOG_LEVEL_DEBUG.

AfC
Sydney

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

Re: Creating an aggregating GtkContainer

2009-11-18 Thread Andrew Cowie
On Wed, 2009-11-18 at 22:22 +0100, Per Hermansson wrote:
 The user will then probably experience some flicker as containers are 
 repainted and widgets moved.

As an aside [and not otherwise commenting on what you're trying to
achieve], Evolution's preferences dialog has for years behaved somewhat
this way. The resizing flicker is awful. Really jarring.

AfC
Sydney


___
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-05-25 Thread Andrew Cowie
On Mon, 2009-05-25 at 14:20 +0800, donglongchao wrote:
 I want to know that when I start a window,how can I set it's default
 size to fill the whole screen?

Sounds like gtk_window_maximize() is what you want.
http://library.gnome.org/devel/gtk/stable/GtkWindow.html#gtk-window-maximize

AfC
Sydney

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

Re: Status Indication GUI development using GTK++

2009-02-19 Thread Andrew Cowie
On Thu, 2009-02-19 at 02:41 -0800, Adeel Malik wrote:

 As I would be starting the GTK+ development on Fedora Core 6 Linux
 machine

Since no one else said it, I'll note that FC6 is kinda getting a bit
long in the tooth. If at all possible, you really want to be using the
latest release of your Linux distro if doing development because that's
where all the bug fixes will be.

Meanwhile,

 2. In the tutorial I couldn't find the reference code to load images
 as gdkimages and then using gtk_image_set_image. 

Look up GdkPixbuf [instead]. What you probably want is
gdk_pixbuf_new_from_file().

You can then feed that to a GtkImage constructor or setter.

AfC
Sydney

___
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 Andrew Cowie
On Sat, 2009-01-03 at 10:40 -0500, Yu Feng wrote:
 If you are accessing data member(g_object_set_data) frequently you could
 use quarks to accelerate the looking up process(g_object_set_qdata).

On Sun, 2009-01-04 at 14:41 +0200, Stefan Kost wrote:
 If you use a hashtable with strings as keys, a lookup on the hashtable would
 need to compare the strings to find the entry. ... [so GQuark] as keys
 in the hashtable [is easier]

This all begs a question: 

Is using g_object_set_qdata() and g_object_get_qdata() better because
the arbitrary data capability in GObjects is

- powered by a mechanism that is going to convert string keys to
GQuarks (interning, presumably) every time for lookups, or

- because it keeps two tables (one of string keys and one of
integer [GQuark] keys, or

- ...?

ie, it sounds like we should switch to g_object_set_qdata() for our one
and only use of GObject data; we request and set that value a *lot*,
and I'm always pleased to use faster code paths. The key we use is
already a static string anyway.

AfC
Sydney

___
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 Andrew Cowie
On Wed, 2008-12-03 at 12:19 +0200, Stefan Kost wrote:
 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

More or less.

It's in the Java bindings as a function[1] that returns a Pixbuf, as in:

pixbuf = Screenshot.capture();

which a few layers later reaches this:

http://research.operationaldynamics.com/bzr/java-gnome/mainline/src/jni/gnome_screenshot_capture.c
http://research.operationaldynamics.com/bzr/java-gnome/mainline/src/jni/gnome_screenshot.h

which in turn just calls the stuff from what in gnome-utils is
gnome-screenshot/screenshot-utils.c and friends.

AfC
Sydney

[1]: yes yes, I realize full well that a class method is still a method
in Java speak. Still, I've taken to calling them functions since
everyone else tends to use method to exclusively refer to functions
that are members of, and operate on, object instances. Whatever. Anyway,
http://java-gnome.sourceforge.net/4.0/doc/api/org/gnome/screenshot/Screenshot.html

-- 
Andrew Frederick Cowie

Operational Dynamics is an operations and engineering consultancy
focusing on IT strategy, organizational architecture, systems
review, and effective procedures for change management: enabling
successful deployment of mission critical information technology in
enterprises, worldwide.

http://www.operationaldynamics.com/

Sydney   New York   Toronto   London
___
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-02 Thread Andrew Cowie
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.

AfC
Sydney

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

Re: questions on gtk_entry gtk_text_view

2008-11-30 Thread Andrew Cowie
On Sun, 2008-11-30 at 18:04 +0800, Gregory Hosler wrote:

 I have a gtk_entry field,and i wish to make use of gtkspell.

Perhaps try SexySpellEntry from libsexy?
http://www.chipx86.com/w/index.php/Libsexy#SexySpellEntry

(it's a shame that the conventional way to add spell checking to a
GtkTextView and to a GtkEntry are not the same)

AfC
Sydney

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

Re: XML and treeviews

2008-07-24 Thread Andrew Cowie
On Thu, 2008-07-24 at 10:48 +0200, Gabriele Greco wrote:
 root
   o node
   |  |
   |  --subnode/
   |
   -/node

Couldn't you just add another row in the TreeStore for the closing tag?
If root is 0 and node is 0:0, then inserting a row after node
with parent root would be 0:1.

AfC
Sydney

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

Re: Screenshot of a GtkWindow

2008-07-23 Thread Andrew Cowie
On Wed, 2008-07-23 at 13:32 +0200, Gabriele Greco wrote:
 I need to make a screenshot of a GtkWindow from the program itself

We used code from gnome-utils's gnome-screenshot/gnome-screenshot.c and
gnome-screenshot/screenshot-utils.c to add a capture capability to
java-gnome (we wanted window decorations and all, not just the GdkWindow
behind something; the drop shadows are nice too). We use this when
generating our API documentation, for example:
http://java-gnome.sourceforge.net/4.0/doc/api/org/gnome/gtk/AboutDialog.html

I certainly appreciate now that gathering a screenshot (window borders
and all) is very tricky and involves some voodoo mucking about with X. I
am quite thankful that such code existed to be reused.

Unfortunately it's not a library as yet, so we had to copy it manually.
Our import of it was a bit hack-and-slash, but our versions of the above
two files, as gnome_screenshot_capture.c and gnome_screenshot_utils.c,
can be found in a checkout of a java-gnome in the src/jni/ directory,
ie
http://research.operationaldynamics.com/bzr/java-gnome/mainline/src/jni/

AfC
Sydney

-- 
Andrew Frederick Cowie

Operational Dynamics is an operations and engineering consultancy
focusing on IT strategy, organizational architecture, systems
review, and effective procedures for change management. We actively
carry out research and development in these areas on behalf of our
clients, and enable successful use of open source in their mission
critical enterprises, worldwide.

http://www.operationaldynamics.com/

Sydney   New York   Toronto   London
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Freeze/Thaw a GtkWidget

2008-03-28 Thread Andrew Cowie
On Tue, 2008-03-25 at 22:24 -0400, Evan Charlton wrote:
 I'm curious how one would go about freezing (stopping UI updates) and
 thawing (applying and resuming UI updates) a GtkWidget, as well as any
 children of it.

You might have some success if you use the low level mechanism:
http://library.gnome.org/devel/gobject/stable/gobject-Signals.html#g-signal-handler-block
and/or
http://library.gnome.org/devel/gobject/stable/gobject-Signals.html#g-signal-handlers-block-matched
and/or
http://library.gnome.org/devel/gobject/stable/gobject-Signals.html#g-signal-stop-emission-by-name
etc. That's all at the individual signal level, but probably the
behaviour you're trying to block is in a signal handler somewhere.

A different tack would be to desensitize (grey out) the Widget, ie
http://library.gnome.org/devel/gtk/2.12/GtkWidget.html#gtk-widget-set-sensitive
though that's probably not stop UI updates like you asked.

AfC
Sydney

-- 
Andrew Frederick Cowie
Managing Director
Operational Dynamics

Need sorting out or help scaling up? Call us.

http://www.operationaldynamics.com/

Sydney   New York   Toronto   London
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Testing keyboard state

2008-01-15 Thread Andrew Cowie
On Tue, 2008-01-15 at 20:17 +, John Franklin wrote:
 I've just started using GTK and Glade to develop a small app
 I want to determine if the Ctrl key is also pressed.

GdkModifierType.

When the 'key-press-event' signal or 'key-release-event' signal are
emitted, the handler you hookup includes an argument of type
GdkEventKey.
http://library.gnome.org/devel/gtk/2.12/GtkWidget.html#GtkWidget-key-press-event
http://library.gnome.org/devel/gdk/2.12/gdk-Event-Structures.html#GdkEventKey

The GdkEventKey struct, in turn, has a field called state which is a
bitmask of the various flags in GdkModifierType. You check for
GDK_CONTROL_MASK being set when you get a key pressed.
http://library.gnome.org/devel/gdk/2.12/gdk-Windows.html#GdkModifierType

++

 I've found some SDL library functions

In general, you do not want to mix toolkits, and in this case you
certainly don't need or want to use SDL. GTK and the rest of the GNOME
libraries provide everything you need to manage a graphical user
interface.

GTK isn't blocking the keyboard handling of course (else nothing on the
GNOME Desktop would work!). You just need to work with it according to
the APIs it presents.

AfC
Sydney
-- 
Andrew Frederick Cowie

We are an operations engineering consultancy focusing on strategy,
organizational architecture, systems review, and change management
procedures: enabling successful use of open source in mission
critical enterprises, worldwide.

http://www.operationaldynamics.com/

Sydney   New York   Toronto   London
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: make a window without the title bar

2007-12-18 Thread Andrew Cowie
On Fri, 2007-12-14 at 20:52 +0800, Binary Chen wrote:
 I know it is a feature of window manager, but is there any portable way
 in GTK+ to do this?

In C...

gtk_window_set_decorated(GTK_WINDOW(window), FALSE);

or Python...

window.set_decorated(False);

or Java...

window.setDecorated(false);

etc :)

As you noted in your question, this is a *request*. The window manager
may choose to ignore you.

AfC
Sydney


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

Re: Date and time

2007-10-24 Thread Andrew Cowie

On Wed, 2007-10-24 at 11:19 +0200, Olivier Delhomme wrote:
 I'm looking for a function that will return a date and time
 as a gchar * in a format that is made accordingly to the
 user preferences.

The traditional way of custom formatting dates on Unix has long been
strftime(); the formatting tokens are a bit arcane but nevertheless
quite powerful. See

$ man strftime

on your system.

AfC
Sydney

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

Re: Spontaneous background colors in treeview

2007-10-10 Thread Andrew Cowie
On Wed, 2007-10-10 at 19:45 -0600, Jeffrey Barish wrote:
 I believe that
 the manual is wrong when it says that an arrow appears.

One most certainly does appear when you click on the header to sort. Do
you have gtk_tree_view_column_set_headers_visible() set to true? That's
where the arrow shows up.

*(assuming you have a proper Linux distro that maintains GNOME properly
and that you are using a sane and maintained theme)

AfC
San Francisco


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

Re: Xlib: unexpected async reply (sequence #####)!

2007-08-06 Thread Andrew Cowie
On Sat, 2007-08-04 at 22:07 +0800, Gregory Hosler wrote:
 That threads_enter/threads_leave doesn't look so bad, since I'm not
 doing a lot of gtk withing my thread. Looks like it might be the way
 to go for me.

Beware that you need to ensure that you call gdk_threads_enter() before
calling gtk_main(). That _is_ stated in the docs' examples but it's not
entirely obvious.

I wrote about it in some detail here:
http://research.operationaldynamics.com/blogs/andrew/software/gnome-desktop/gtk-thread-awareness.html

AfC
Sydney

-- 
Andrew Frederick Cowie
Managing Director
Operational Dynamics Consulting, Pty Ltd

Sydney+61 2 9977 6866
New York  +1 646 472 5054
Toronto   +1 647 477 5603
London+44 207 1019201

We are an operations engineering consultancy focusing on strategy,
organizational architecture, systems review, and change management
procedures: enabling successful use of open source in mission
critical enterprises, worldwide.

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

Re: my summary on how to use gtk with threads

2007-05-23 Thread Andrew Cowie
On Sun, 2007-05-20 at 12:15 +0200, Felix Kater wrote:
 here is my short summery of how to use gtk with threads

Ironically, your email rolled in Monday right after I had managed to
come up with most of the same information independently. I just blogged
about my own findings which are fairly close to your own observations!
http://research.operationaldynamics.com/blogs/andrew/#gtk-thread-awareness

I didn't quite agree with this conclusion:

 do not use gdk_threads_set_lock_functions() to facilitate (a)

as that was rather critical to things working [so far] for us; hang
tight until I get a chance to write up part 2, but I am going to take
the time this week to carefully consider the traps you cite and try and
see how they affect the pattern we developed.

I'm quite certain that this sort of thing will expose bugs in GTK for
the simple reason that this style of doing multi-threaded apps is not
prevalent -- but such bugs will do well to be smoked out and fixed
regardless.

Regards,

AfC
Sydney


-- 
Andrew Frederick Cowie

We are an operations engineering consultancy focusing on strategy,
organizational architecture, systems review, and change management
procedures: enabling successful use of open source in mission
critical enterprises, worldwide.

http://www.operationaldynamics.com/

Sydney   New York   Toronto   London
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Accessing a GtkTable's children.

2007-04-07 Thread Andrew Cowie
On Fri, 2007-04-06 at 23:45 -0700, Craig Pemberton wrote: 
 GList *children = g_list_first(parent-children);

For starters, you want

gtk_container_get_children()

From there, you might also double check you're using the GList API
properly.

AfC
Sydney

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