Re: Closing XTerm causes the GTK app to exit, inspite of disown/nohup on its PID - why?

2019-03-05 Thread James Cameron
Wild guess; use strace to look for a signal at the time the window is
closed, and add code to replace the handler for the signal.

For instance, to handle Ctrl+C gracefully in Python that uses GTK,
some of my code does this;

GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, callback)

-- 
James Cameron
http://quozl.netrek.org/
___
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list


Re: GTK window winthout main iterator

2018-09-04 Thread James Cameron
Add your logic to a function given to glib_idle_add(), and to trigger
new drawings call queue_draw and then return from your function.  GTK+
will call your draw signal handler.  As soon as GTK+ is idle again,
your function will be called again.

It isn't the usual way of doing things, but it will work.

On Tue, Sep 04, 2018 at 07:09:13PM -0300, Juan Ignacio Donoso via 
gtk-app-devel-list wrote:
> I'm trying to create a GUI using gtk I already have a loop that runs my
> logic. I was using cairo to draw to a png and flush to /dev/fb0 but now I
> want to instantiate a Gtk::Window to draw on it.
> 
> I don't want to run Gtk::Main because just want to trigger new drawings
> when my logic trigger it..
> The app is real only there aren't going to be any interactions from the app
> ui, only from the internal logic I want to draw.
> 
> Any idea where to look to implement that approach. I was thinking on using
> Gtk::main_iteration_do with Gtk::Queue_draw. But I'm not getting it work.
> 
> Do I need to ask for a cairo context on every on_draw signal call?
> Do I need to "draw" on the "draw" signal?
> 
> thanks
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

-- 
James Cameron
http://quozl.netrek.org/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: XTestFakeKeyEvent GDK-equivalent

2018-07-06 Thread James Cameron
For quick hacks or testing apps, I use xdotool.  I've no idea if it
works with Wayland though.

-- 
James Cameron
http://quozl.netrek.org/
___
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list


Re: trouble with g_stat

2018-06-03 Thread James Cameron
On Sun, Jun 03, 2018 at 10:27:48PM -0400, GaryW wrote:
> My use of g_stat causes a segfault, but regular stat works ok. I’m using
> mingw64 on Win10 under msys2.
> [...]
> 
> GString *fspec;
> 
> GStatBuf *stBuf;
> 
> //fspec->str tested to hold the correct file spec…
> 
> if(g_stat(fspec->str,stBuf)<0){… [9476 Segmentation fault]

stBuf is an uninitialised pointer.  g_stat will try to write to the
address; undefined behaviour results.

Try allocating some memory of the right size, and assign that address
to the pointer before calling g_stat?

-- 
James Cameron
http://quozl.netrek.org/
___
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list


Re: PyGObject: pep8 konform

2018-06-01 Thread James Cameron
Code that uses PyGObject can't be PEP8 conformant without generating
version warnings.  My practice is to minimise E402 by moving imports,
then add .flake8 file with;

[flake8]

# E402 module level import not at top of file
# gi.require_version() is required before later imports

ignore = E402

-- 
James Cameron
http://quozl.netrek.org/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Is it possible to catch ALT+TAB and do nothing

2018-05-07 Thread James Cameron
On Mon, May 07, 2018 at 05:03:40PM -0500, Igor Korot wrote:
> James,
> 
> On Mon, May 7, 2018 at 4:46 PM, James Cameron <qu...@laptop.org> wrote:
> > On Mon, May 07, 2018 at 04:27:57PM -0500, Igor Korot wrote:
> >> Paul et al,
> >> Any idea how to configure FVWM to not to give focus to xterm if one
> >> specific window is displayed?
> >
> > You might ask on an fvwm mailing list, but fvwm does have a
> > NeverFocus method that can be applied to an application such as xterm.
> 
> Yes, just subscribed to their forum and will ask that question.
> >
> > http://www.fvwm.org/documentation/manpages/fvwm.html
> >
> > But that would just fix your problem for xterm; to enforce focus for a
> > lock screen, there's more to do.  Have a look at the code for other
> > lock screens to find out what that is.
> 
> We do not provide any external application where the user can interact
> with the keyboard/focus handling
> in order to try and guess the information that should be secured.
> Only the xterm is a concern.

If this is an embedded system or kiosk application, replace xterm with
something of your own making that uses libvte as a widget.  That way
you can assert full control over when the widget is visible.

I've found VTE acceptable for most use cases I've thrown at it.

Though I still use xterm when I can.

> [...]

-- 
James Cameron
http://quozl.netrek.org/
___
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list


Re: Is it possible to catch ALT+TAB and do nothing

2018-05-07 Thread James Cameron
On Mon, May 07, 2018 at 04:27:57PM -0500, Igor Korot wrote:
> Paul et al,
> Any idea how to configure FVWM to not to give focus to xterm if one
> specific window is displayed?

You might ask on an fvwm mailing list, but fvwm does have a
NeverFocus method that can be applied to an application such as xterm.

http://www.fvwm.org/documentation/manpages/fvwm.html

But that would just fix your problem for xterm; to enforce focus for a
lock screen, there's more to do.  Have a look at the code for other
lock screens to find out what that is.

Briefly, make a global mouse and keyboard grab, subscribe to window
visibility events, and when they occur raise the window above whatever
was stacked on top of it.

You could also adjust xterm sources to ask for focus skip; bit 0 of
_WIN_HINTS property.

> 
> I tried:
> 
> [code]
> Key  Tab A M WindowList("!xterm")
> [/code]
> 
> but it doesn't work.
> 
> Thank you.
> 
> 
> On Mon, May 7, 2018 at 12:44 PM, Paul Davis <p...@linuxaudiosystems.com> 
> wrote:
> > the window manager can intervene to catch more or less any key combinations
> > the user has told it to be interested in. if the user told it use Alt-Tab
> > for focus switching, it will catch that. you can't stop it.
> >
> > On Mon, May 7, 2018 at 12:52 PM, Igor Korot <ikoro...@gmail.com> wrote:
> >>
> >> Hi, Paul,
> >>
> >> On Mon, May 7, 2018 at 11:42 AM, Paul Davis <p...@linuxaudiosystems.com>
> >> wrote:
> >> > If there is a window manager (and there just about always is), you can't
> >> > stop it from doing what it is configured to do. You're just an
> >> > application,
> >> > and it takes higher priority managing window events than you.
> >>
> >> Yes, we are using FVWM as WM.
> >> I got a suggestion to write a function for this WM to stop the
> >> Terminal to appear
> >> when our Lock Screen is active, but here no one is familiar enough with
> >> this WM
> >> to write such a function.
> >>
> >> And I guess a different route is just not possible.
> >>
> >> And I would also guess that even if I put the "stay on top" flag,
> >> pressing the ALT+TAB will
> >> definitely switch the focus. Am I correct?
> >>
> >> Thank you.
> >>
> >> >
> >> > On Mon, May 7, 2018 at 12:01 PM, Igor Korot <ikoro...@gmail.com> wrote:
> >> >>
> >> >>  Hi, ALL,
> >> >> Is it possible to catch the ALT+TAB when one particular window is
> >> >> displayed and do nothing, i.e. not switch to a different window?
> >> >>
> >> >> We have a program which displays a full sized window without the
> >> >> title. Its role is to Lock screen" - user should not be able to do
> >> >> anything until (s)he supplies password and hit the "Authenticate"
> >> >> button.
> >> >> problem is that t is possible to hit "ALT+TAB" and switch the focus to
> >> >> the window below it (such as Terminal) and type something.
> >> >>
> >> >> We also can't use the lock screen window because of some other issues.
> >> >>
> >> >> So is it possible to catch ALT+TAB and do nothing for one specific
> >> >> window?
> >> >>
> >> >> On the side note - is there a better list (with more traffic) where I
> >> >> can post  question like this? Or this list is still good and
> >> >> operational?
> >> >>
> >> >> Thank you.
> >> >> ___
> >> >> gtk-list mailing list
> >> >> gtk-list@gnome.org
> >> >> https://mail.gnome.org/mailman/listinfo/gtk-list
> >> >
> >> >
> >
> >
> ___
> gtk-list mailing list
> gtk-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-list

-- 
James Cameron
http://quozl.netrek.org/
___
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list


RE: EXTERNAL: stdout/sterr to GtkTextView at runtime

2015-12-21 Thread Williams, James P2
Yeah, buffering can be a sticky issue.  At a minimum, the sender needs to turn 
it off.  In your test_output.pl, you should do something like this on the file 
handle to which you’re writing,

   use IO::Handle;
   $fh->autoflush(TRUE);

which you might see done this way,

   $fhPrev=select($fh);
   $|=TRUE;
   select($fhPrev);

or with an older idiom for maximum compactness/obfuscation,

   select((select($fh),$|=TRUE)[0]);

or with an I/O layer.

   binmode($fh,”:unix”) or die “Unable to binmode: $!.\n”;

Good luck.

Jim

From: Williams, James P2 (US)
Sent: Friday, December 11, 2015 11:38 AM
To: 'orangensa...@web.de' <orangensa...@web.de>; 'gtk-perl-list@gnome.org' 
<gtk-perl-list@gnome.org>
Subject: RE: EXTERNAL: stdout/sterr to GtkTextView at runtime

One way to deal with this is to open a pipe to the program instead of using 
backticks.

   use Glib qw(TRUE FALSE);
   use IO::File;

   ...

   my($cmd)=”/usr/bin/perl test_output.pl”;
   my($fh)=new IO::File(“$cmd 2>&1 |”);
   die “$0: Unable to open pipe from $cmd: $!.\n” if !$fh;

Then, add a function to be called when input is available on that file handle.

   my($io)=Glib::IO->add_watch($fh->fileno(),[qw(in hup)],sub 
{ioCB($fh,$cmd,@_)});

where the callback would read the file handle, and append what it gets to your 
widget.

   sub ioCB
   {
  my($fh,$cmd,$fd,$cond)=@_;
  my(@lines,$done);


  if ($cond & ‘hup’) {
 @lines=$fh->getlines();
 $done=TRUE;
  } elsif ($cond & ‘in’) {
 @lines=($fh->getline());  #read only one line; may block if we try more
  }

  if (@lines) {
 ...
 $buf->insert($buf->get_end_iter(),join ‘’,@lines);
 ...
  }

  if ($done && !$fh->close()) {
 showError($!
? “Unable to close pipe to $cmd: $!.”
: “Got non-zero exit status from $cmd, $?.”);
  }

  return !$done;   #i.e., keep IO channel if not at EOF
   }

$io in the earlier code can be used to remove the callback later, or you can 
just return FALSE from the callback, as I do above.  You can get more details 
in the Glib::MainLoop docs and those for the C bindings that module wraps.

Another way to deal with this is to do blocking reads in a separate thread, but 
if your Perl skills are weak, I’d go with this simpler IO channel approach.

Good luck.

Jim

From: gtk-perl-list [mailto:gtk-perl-list-boun...@gnome.org] On Behalf Of 
orangensa...@web.de<mailto:orangensa...@web.de>
Sent: Thursday, December 10, 2015 11:14 PM
To: gtk-perl-list@gnome.org<mailto:gtk-perl-list@gnome.org>
Subject: EXTERNAL: stdout/sterr to GtkTextView at runtime

Hi,

I'm writing a gui for an existing program that can run for a while. I want to 
display all possible terminal output of this program in a GtkTextView. So far i 
failed to display the output at runtime. I tried this

my $iter = $textbuffer->get_end_iter;
my $command = `perl test_output.pl 2>&1`;
$textbuffer->insert($iter, $command);

which isn't working the way i want. My program is blocked while test_output.pl 
is running. I tried to use

my $command = system("perl test_output.pl 2>&1 &");

instead but while my program keeps running, all output is shown in the terminal 
again.


How can i achieve to get all output at runtime in my textview? And how do i 
check if test_output is done running? I found an old solution using Gtk+ itself 
but my perl skills aren't good enough to reproduce this:
https://mail.gnome.org/archives/gtk-list/2006-February/msg00040.html


I'm using Gtk3.


Thanks for any help.
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


enchant and gtk

2015-07-31 Thread James Stortz
​Hey all!

Does anybody have a copy of webkitgtk compiled without enchant, (via the
cmake flag, DENABLE_SPELLCHECK=OFF)?

or would anybody be willing to compile one for me? I'm on a laptop with a
single-core and 1.9Gb RAM, so I did start the compile process, but it's
just a little long!

Is there anything else in the GNOME 3 environment that won't launch without
libenchant, besides the gnome browser?

I noticed the welcome app that lets you choose your
launguage/keyboard/wifi settings won't launch, nor the system settings. I
didn't know if that was due to webkitgtk as well.

Thanks  Regards,
James
___
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list


Re: enchant and gtk

2015-07-31 Thread James Stortz
When trying to build myself, make freezes at Scanning dependencies of
target WebCore

Any help would be appreciated!
On Jul 31, 2015 4:39 PM, James Stortz james.ryan.sto...@gmail.com wrote:

 ​Hey all!

 Does anybody have a copy of webkitgtk compiled without enchant, (via the
 cmake flag, DENABLE_SPELLCHECK=OFF)?

 or would anybody be willing to compile one for me? I'm on a laptop with a
 single-core and 1.9Gb RAM, so I did start the compile process, but it's
 just a little long!

 Is there anything else in the GNOME 3 environment that won't launch
 without libenchant, besides the gnome browser?

 I noticed the welcome app that lets you choose your
 launguage/keyboard/wifi settings won't launch, nor the system settings. I
 didn't know if that was due to webkitgtk as well.

 Thanks  Regards,
 James

___
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list


Re: GDBusProxy missing bus signals during construction

2015-07-24 Thread Roger James

On 24/07/15 12:26, Bastien Nocera wrote:

On Thu, 2015-07-23 at 21:59 +0100, Roger James wrote:
snip

I propose to get this by round this by subscribing to the Avahi
ItemNew
signal  on my AvahiServer  proxy to catch the updates and then
unscribing it after I have connected the gobject signal on the
'AvahiServiceBrowser' proxy.  Even just typing that makes ny head
hurt!
I have no idea how that will play in the heavily multi-threaded
enviroment this is eventually to be deployed in.

I will post the new code back here for posterity later.

Or fix Avahi directly?
https://github.com/lathiat/avahi/issues/9

That will all save us time in the long run...


Hi Bastien,

I am really annoyed that that link did not come up all my searching. It 
would have saved me a lot of investigation. I suppose I did not look at 
the avahi issues list because I did not think the api could have have 
been designed that way. To old stagers like me a server that 
communicates with clients via api that potentially works over a network 
(internal or external) cannot rely on partners doing things in a 
time-scale  dictated by a server.


I will post a link to my work on that thread. But you are correct, it 
needs fixing. However it has been around a long time and it will need to 
be fixed in a way that does not break any existing applications.


Roger

Roger

Roger

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


Re: GDBusProxy missing bus signals during construction

2015-07-24 Thread Roger James

On 24/07/15 12:23, Simon McVittie wrote:

On 23/07/15 21:59, Roger James wrote:


I propose to get this by round this by subscribing to the Avahi ItemNew
signal  on my AvahiServer  proxy to catch the updates and then
unscribing it after I have connected the gobject signal on the
'AvahiServiceBrowser' proxy.

org.freedesktop.Avahi.Server does not appear to have an ItemNew signal.
I would recommend dropping down to a lower-level API than proxy objects:
using Gio.DBusConnection.signal_subscribe() to match ItemNew signals at
*any* object path (use None for the object path parameter).



Simon,

I was a bit sloppy when I typed this. I should have said on the 
DBusConnection used by my AvahiServer proxy. Sorry.


The latest version of the code is at

https://github.com/rogerjames99/unicornemu/blob/master/avahibrowser.py

It seems to run reasonably well. If will now look at integrating it into 
the rest of the stuff.


Roger
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: GDBusProxy missing bus signals during construction

2015-07-23 Thread Roger James

On 23/07/15 20:50, Simon McVittie wrote:

On 23/07/15 15:01, Roger James wrote:

I am trying to implement a Zeroconf service browser using a PyGobject
Gio.DBusProxy object to talk to avahi. It all works fine but the browser
randomly misses the initial one or more ItemNew signals from the avahi
server. It sometimes even misses the AllForNow signal. Subsequent
ItemNew signals are seen OK as services come and go.

In general, you cannot rely on seeing signals from the past. Signals
on D-Bus are not specifically for you; they are broadcasts to everyone,
and might indeed have happened already. What you're seeing is a race
condition: by the time your code receives the object path and uses it to
create a Gio.DBusProxy which subscribes to signals, you might already
have missed some signals.

The conventional pattern for D-Bus looks something like this pseudocode:

* let initialized = False

* subscribe to signals with a callback like this:

   on ItemNew signal:
   if initialized:
   print(got a new item)

* call a state-recovery method - perhaps it's called GetItems or
   something - to catch up on anything you missed, with a callback like
   this:

   on reply from GetItems:
   let initialized = True
   for item in reply:
   print(got a new item)


1. How can I stop this happening.

If Avahi's ServiceBrowser objects have a way to catch up, i.e.
download the current state, then use it as described in my pseudocode.

If they don't, then Gio.DBusProxy cannot represent this API
successfully, and you will have to use lower-level functions like
GIO.DBusConnection.signal_subscribe to subscribe to the signals in
general, before you call ServiceBrowserNew; and then in the signal
callback, use the sending object path of the signals to associate them
with a particular service browser object.


2. Is avahi breaking some sort of dbus protocol or convention in sending
these signals immediately a new bus connection is made?

If there is a way to catch up, that's conventional.

If there is no way to catch up, then Avahi is being unconventional here.


3. Is the a flaw in the GDBusProxy design/documenation? (sorry guys, but
have spent a while looing at this.)

If there is no way to catch up, then you would have the same problems
with any proxy-object-oriented binding, such as the ones in dbus-python,
dbus-glib and QtDBus.

I'm only not including libdbus in that list because its only way to
subscribe to signals is analogous to the lower-level
Gio.DBusConnection.signal_subscribe API.


Hi Simon, Hi Andrejs

The AvahiServer object (proxy) is responding to the call to it's 
ServiceBrowserNew method  by sending back the 'path' you should connect 
to and create an AvahiServiceBrowser proxy object  on. This is 
immediately followed by a broadcast of the 'catch up' information. So I 
guess it is a problem with Avahi, because it is obvious that it is 
purely chance if you manage to create the AvahiServiceBrowser proxy in 
time to get the update.


I propose to get this by round this by subscribing to the Avahi ItemNew 
signal  on my AvahiServer  proxy to catch the updates and then 
unscribing it after I have connected the gobject signal on the 
'AvahiServiceBrowser' proxy.  Even just typing that makes ny head hurt!  
I have no idea how that will play in the heavily multi-threaded  
enviroment this is eventually to be deployed in.


I will post the new code back here for posterity later.

Roger


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


GDBusProxy missing bus signals during construction

2015-07-23 Thread Roger James
I am trying to implement a Zeroconf service browser using a PyGobject 
Gio.DBusProxy object to talk to avahi. It all works fine but the browser 
randomly misses the initial one or more ItemNew signals from the avahi 
server. It sometimes even misses the AllForNow signal. Subsequent 
ItemNew signals are seen OK as services come and go.


It appears that the problem is that the GLIb objects subscribes to the 
dbus signals during the construction process (the DO_NOT_CONNECT_SIGNALS 
is not set). It then notifies(GDbusProxy.new) or 
returns(GDBusProxy.new_sync) to the calling object. Once I get the new 
proxy object back I can use connect on the parent gobject to hook the 
incoming dbus signal to my applications signal handling callback. 
However any dbus signals that arrive from server (avahi) before that 
connection is made are discarded. If set DO_NOT_CONNECT_SIGNALS I would 
have mimic the whole of DBusProxy/DBUsConection's handling of dbus side 
signal mapping. I don't want to have to do that. What am I missing?


Some fundamental questions are.

1. How can I stop this happening.
2. Is avahi breaking some sort of dbus protocol or convention in sending 
these signals immediately a new bus connection is made?
3. Is the a flaw in the GDBusProxy design/documenation? (sorry guys, but 
have spent a while looing at this.)


Thanks,

Roger

Here is my python code

#!/usr/bin/env python
from gi.repository import Gio, GLib, GObject, Gtk
import avahi
import signal
import time

class avahibrowser(Gio.Application):
def service_resolved(self, *args):
print 'service resolved'
print 'name:', args[2]
print 'address:', args[7]
print 'port:', args[8]

def print_error(self, *args):
print 'error_handler'
print args[0]

def browserCallback(self, proxy, sender, signal, args):
if signal == 'ItemNew':
# Arguments are [0] i interface, [1] i protocol [2] s name [3] s 
type  [4] s domain [5] u flags
print Found service '%s' type '%s' domain '%s'  % (args[2], 
args[3], args[4])
#self.avahiserver.ResolveService('iisssiu',
#args[0], # Interface
#args[1], # Protocol
#args[2], # Name
#args[3], # Service Type
#args[4], # Domain
#avahi.PROTO_UNSPEC, dbus.UInt32(0),
#reply_handler=self.service_resolved, 
error_handler=self.print_error)
else:
print 'signal', signal, 'arguments', args

def do_activate(self):  # Define this to suppress glib warning

pass

def new_browser_proxy_callback(self, source_object, res, user_data):

#source_object.connect('g-signal', self.browserCallback)
self.avahibrowser = Gio.DBusProxy.new_finish(res)
self.avahibrowser.connect('g-signal', self.browserCallback)

def new_server_proxy_callback(self, source_object, res, user_data):

self.avahiserver = Gio.DBusProxy.new_finish(res)
avahibrowserpath = self.avahiserver.ServiceBrowserNew('(iissu)',
avahi.IF_UNSPEC,
avahi.PROTO_INET,
'_scratch._tcp',
'local',
0)


Gio.DBusProxy.new(self.systemDBusConnection, 0, None,

avahi.DBUS_NAME,
avahibrowserpath,

avahi.DBUS_INTERFACE_SERVICE_BROWSER, None,
self.new_browser_proxy_callback, 
None)

def bus_get_callback(self, source_object, res, user_data):

self.systemDBusConnection = Gio.bus_get_finish(res)

Gio.DBusProxy.new(self.systemDBusConnection, 0, None,

avahi.DBUS_NAME,
avahi.DBUS_PATH_SERVER,
avahi.DBUS_INTERFACE_SERVER, None,
self.new_server_proxy_callback, 
None)

# Gnome application initialization routine

def __init__(self, application_id, flags):
Gio.Application.__init__(self, application_id=application_id, 
flags=flags)

Gio.bus_get(Gio.BusType.SYSTEM, None, self.bus_get_callback, None)

def InitSignal(app):

def signal_action(signal):
if signal is 1:
print(Caught signal SIGHUP(1))
elif signal is 2:
print(Caught signal SIGINT(2))
elif signal is 15:
print(Caught signal SIGTERM(15))
app.release()

def idle_handler(*args):
print(Python signal handler activated.)
GLib.idle_add(signal_action, priority=GLib.PRIORITY_HIGH)

def handler(*args):
print(GLib signal handler 

RE: EXTERNAL: Re: Gtk2::SpinButton For Hex

2015-05-22 Thread Williams, James P2
 Looks like twisting the implementation of the standard Spinbutton widget is 
 not quite easy to be achieved - maybe  my alternative is quicker to put to 
 effective use.

Yeah, I've toyed with doing something along these lines, using other widgets to 
create a poor man's spin button.  My hex inputs use Gtk2::CellRendererSpins in 
a Gtk2::TreeView, but I think the same thing could be done.  It's good to see 
an implementation if this idea, and I wasn't aware of the icon attributes 
Gtk2::Entry provides.  Thanks for posting your implementation.

Jim
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


RE: EXTERNAL: Re: Gtk2::SpinButton For Hex

2015-05-21 Thread Williams, James P2
   How can I use a Gtk2::SpinButton to prompt for an integer expressed in 
   hex?  I've tried the following, but it fails.
   
   ...
   
   The text appears to be correct while I hold either arrow button down; I 
   see hex values incrementing.  However, single clicks of an arrow button 
   fail if the displayed text contains A-F.  Hitting the Enter key also 
   fails on the same values.  In both cases, the text changes to a decimal 
   integer.
   
   What do the '$value's look like in the outputCB (either in a debugger or 
   ...).
  
  With single clicks of the up arrow button, the values in outputCB() 
  increment from 0 to 10.  10 correctly displays as A.  One more click of the 
  up arrow calls outputCB() twice for some reason, the first time with a 
  value of 0, and the second with a value of 1.  So visibly, 10 wraps to 1 
  instead of 11, or B.  If I manually type 'FF' and hit the Enter key, 
  outputCB() is called with a value of 0.  I've played with callbacks on the 
  'input' and 'changed' signals too, but nothing has worked so far.
  
  I learned something else.  If I change the sprintf() to use '0x%X' instead 
  of '%X', it seems to work.  It also works in octal with '0%o' and binary 
  with '0b%b'.
  
  Unfortunately, the '0x' prefix is unacceptable to my users.  Grr.  So I'm 
  still in search of a way to spin a hex value, but with no '0x'.  Knowing 
  this about the prefix, though, still may be useful to others wanting 
  something similar.
 
 Hi Jim
 
 If that is the case can you not use chain the sprintf through substr?
 
 e.g.
 
$spin-set_text(substr (sprintf '0x%X',$value), 2);
 
 which will drop the first 2 characters of the string that is printed  by 
 sprintf?

That's the same as what I had originally, which failed.

   $spin-set_text(sprintf('%X',$value));

Gtk2::SpinButton seems to spin hex values fine if the 0x is in the string.  
Your substr() version and my original fail, I think, because the 0x is 
missing.  My users, of course, don't want to type the 0x since the input is 
always hex, and it's really a programming convention; not something for a user 
interface.

Thanks.

Jim

___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


RE: EXTERNAL: Re: Gtk2::SpinButton For Hex

2015-05-20 Thread Williams, James P2
 How can I use a Gtk2::SpinButton to prompt for an integer expressed in hex?  
 I've tried the following, but it fails.
 
 ...
 
 The text appears to be correct while I hold either arrow button down; I see 
 hex values incrementing.  However, single clicks of an arrow button fail if 
 the displayed text contains A-F.  Hitting the Enter key also fails on the 
 same values.  In both cases, the text changes to a decimal integer.
 
 What do the '$value's look like in the outputCB (either in a debugger or ...).

With single clicks of the up arrow button, the values in outputCB() increment 
from 0 to 10.  10 correctly displays as A.  One more click of the up arrow 
calls outputCB() twice for some reason, the first time with a value of 0, and 
the second with a value of 1.  So visibly, 10 wraps to 1 instead of 11, or B.  
If I manually type 'FF' and hit the Enter key, outputCB() is called with a 
value of 0.  I've played with callbacks on the 'input' and 'changed' signals 
too, but nothing has worked so far.

I learned something else.  If I change the sprintf() to use '0x%X' instead of 
'%X', it seems to work.  It also works in octal with '0%o' and binary with 
'0b%b'.

Unfortunately, the '0x' prefix is unacceptable to my users.  Grr.  So I'm still 
in search of a way to spin a hex value, but with no '0x'.  Knowing this about 
the prefix, though, still may be useful to others wanting something similar.

 sprint - should be sprintf?

Sorry about the sprint.  We're on a closed network; that was a transcription 
typo.

 Maybe try set_value or set_digits rather than set_text?

I think I have to call set_text() to see the hex version in the entry.  I have 
tried calling set_value() too, both before and after set_text().  That gives me 
the same behavior:  spinning seems to work, but single clicks wrap to 0 or 1 as 
soon as I reach a number containing [A-F]+.

On set_digits(), I'm spinning integers, so I've left it at the default, 0.  It 
wouldn't make sense being any other value, if I understand its purpose.

 How are any of these impacted by the set_numeric statement?

I've set this to FALSE, since I have to allow A-F to be typed into the entry.  
Otherwise, those key events are ignored.

Thanks for any other ideas you may have.

Jim

-Original Message-
From: Robert Wilkinson [mailto:b...@fourtheye.org] 
Sent: Wednesday, May 20, 2015 3:12 AM
To: Williams, James P2
Cc: 'gtk-perl-list@gnome.org'
Subject: EXTERNAL: Re: Gtk2::SpinButton For Hex

On Tue, May 19, 2015 at 10:22:51PM +, Williams, James P2 wrote:
 How can I use a Gtk2::SpinButton to prompt for an integer expressed in hex?  
 I've tried the following, but it fails.
 
use strict;
use warnings;
 
use Glib qw(TRUE FALSE);
use Gtk2 qw(-init);
 
my($spin)=Gtk2::SpinButton-new_with_range(0,1000,1);
$spin-set_numeric(FALSE);
$spin-signal_connect(output = \outputCB);
 
my($win)=new Gtk2::Window();
$win-add($spin);
$win-show_all();
 
Gtk2-main();
 
sub outputCB
{
   my($spin)=@_;
   my($value)=$spin-get_adjustment()-get_value();
 
   $spin-set_text(sprint '%X',$value);
}
 
 The text appears to be correct while I hold either arrow button down; I see 
 hex values incrementing.  However, single clicks of an arrow button fail if 
 the displayed text contains A-F.  Hitting the Enter key also fails on the 
 same values.  In both cases, the text changes to a decimal integer.
 
 Thanks.
 
 Jim

Hi Jim

What do the '$value's look like in the outputCB (either in a debugger or ...).

sprint - should be sprintf?

Maybe try set_value or set_digits rather than set_text?

How are any of these impacted by the set_numeric statement?

Bob
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Gtk2::SpinButton For Hex

2015-05-19 Thread Williams, James P2
How can I use a Gtk2::SpinButton to prompt for an integer expressed in hex?  
I've tried the following, but it fails.

   use strict;
   use warnings;

   use Glib qw(TRUE FALSE);
   use Gtk2 qw(-init);

   my($spin)=Gtk2::SpinButton-new_with_range(0,1000,1);
   $spin-set_numeric(FALSE);
   $spin-signal_connect(output = \outputCB);

   my($win)=new Gtk2::Window();
   $win-add($spin);
   $win-show_all();

   Gtk2-main();

   sub outputCB
   {
  my($spin)=@_;
  my($value)=$spin-get_adjustment()-get_value();

  $spin-set_text(sprint '%X',$value);
   }

The text appears to be correct while I hold either arrow button down; I see hex 
values incrementing.  However, single clicks of an arrow button fail if the 
displayed text contains A-F.  Hitting the Enter key also fails on the same 
values.  In both cases, the text changes to a decimal integer.

Thanks.

Jim
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Using a TextView as a sort of Hbox with wrapping

2014-01-26 Thread James Tappin
Chris,
  If I interpret what you are trying to do correctly (not necessarily a
given), then I would have thought that GtkScrolledWindow (possibly in
conjunction with GtkViewport) would be the tool for the job.

James


On 26 January 2014 14:50, Chris Angelico ros...@gmail.com wrote:

 My application has a status bar which can have an arbitrary number of
 items added to it. Currently, I use an Hbox with no padding, which
 works fine as long as there aren't too many statusbar elements added;
 but if there are a lot, the tail starts wagging the dog, in that the
 size of the window becomes dictated by the status bar (which normally
 is supposed to be subtle, not intrusive/controlling). So I figured
 that wrapping elements onto another line of status bar would be a more
 useful way to lay them out, but that's really tricky. Enter TextView:
 it's a widget designed to handle wrapping, and it can have child
 widgets embedded in it.

 Here's some proof of concept code. (This is in Pike, so you may not be
 able to run it directly.)

 int main()
 {
 GTK2.setup_gtk();
 object
 buf=GTK2.TextBuffer(),view=GTK2.TextView(buf)-set_editable(0)-set_wrap_mode(GTK2.WRAP_WORD)-set_cursor_visible(0);
 view-modify_base(GTK2.STATE_NORMAL,GTK2.GdkColor(240,240,240));
 foreach (({Asdf asdf,Qwer qwer,Zxcv zxcv,Testing,
 testing,1, 2, 3, 4}),string x)
 {

 view-add_child_at_anchor(GTK2.Frame()-add(GTK2.Label(x))-set_shadow_type(GTK2.SHADOW_ETCHED_OUT),
 buf-create_child_anchor(buf-get_end_iter()));
 buf-insert(buf-get_end_iter(),  ,-1);
 }

 GTK2.Window(GTK2.WindowToplevel)-set_default_size(500,300)-add(GTK2.Vbox(0,0)
 -add(GTK2.Label(Blah blah blah, this\nhas lots and\nlots of
 content\n\nLorem ipsum dolor sit\namet))
 -pack_start(GTK2.Button(This sets the base width),0,0,0)
 -pack_start(view,0,0,0)
 )-show_all()-signal_connect(delete-event,lambda() {exit(0);});
 return -1;
 }

 Two questions.

 Firstly: Is this a really REALLY stupid thing to do? When I Googled
 for a wrapping layout manager, nothing mentioned this possibility, so
 I'm wondering if this is somehow fundamentally bad and I just haven't
 seen it.

 And secondly: The TextArea defaults to having a white background, but
 I want to use the window's default background. On my system, setting
 the color to (240,240,240) does that, but that means I'm explicitly
 setting a color, so it's going to be grey even if the UI theme
 specifies that a window's background should be vibrant orange. Is
 there a way to tell the TextView not to draw its background, or
 alternatively, a way to query the default background color for a
 window?

 Thanks in advance!

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

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


GtkWidget focus line color

2013-12-29 Thread James Robertson
I am creating a GTK3 theme and want to have all indicator focus lines
a particular color in all states.

At the moment the focus lines uses the color of the widget state it is
on... for example:

.button {
-GtkWidget-focus-padding: 2;
-GtkWidget-focus-line-pattern: \0\0;
padding: 1px;
border-width: 1px;
border-style: solid;
border-color: @theme_base_color;
border-bottom-color: @gradient_from_color;
background-image: -gtk-gradient(linear, left top, left bottom,
from (@gradient_from_color),
to (@gradient_to_color));
color: @theme_fg_color;
}

.button:hover {
border-color: @insensitive_color;
background-image: none;
background-color: @theme_selected_bg_color;
color: @theme_selected_fg_color;
}

When the mouse hovers over a button the focus line color changes from
@theme_fg_color; to @theme_selected_fg_color but I might want it to
stay @theme_fg_color (or perhaps another color set globally).

In GTK2 I achieved this using the pixmap engine and an png image:

image
{
function= FOCUS
recolorable = TRUE
file= Others/focus.png
border  = { 1, 1, 1, 1 }
stretch = TRUE
}

I am not using any GTK3 engine and had hoped something like this would
have worked (it doesn't).

*:focus {
color: @theme_fg_color;
}

I am looking for something like an option
-GtkWidget-focus-line-color which doesn't exist or someone who knows
how I might achieve this.  I don't mind if I have to use an image and
have actually been trying to use border-images and such but haven't
been successful.

Thanks

James
___
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list


Re: Get column no. of edited cell.

2013-06-02 Thread James Tappin
Another possibility would be to use  g_object_set_data to give the renderer
a column number, and g_object_get_data in the handler.


On 2 June 2013 07:15, dE de.tec...@gmail.com wrote:

 On 06/02/13 00:27, Arnel A. Borja wrote:

 On Sunday, 02 June, 2013 01:44 AM, dE wrote:

 I've set the editable property of GtkCellRenderer to true, and set the
 call back for the edited signal.

 This particular signal tells the node/row in which the edit has
 occurred, but not the column/filed. How can I get that?

 Thanks!


 Use a different renderer for each column. Then check in the edited signal
 which renderer was edited.


 I'm trying this out, but isnt this also possible with
 gtk_tree_view_get_cursor clubbed with gtk_tree_view_column_get_sort_**
 column_id.

 Cause I'm getting segfault with --

 gtk_tree_view_get_cursor ( detect_object ( DataDisplay, build_object ),
 tree_path, focus_column );

 Where --

 GtkTreeViewColumn **focus_column;
 GtkTreePath **tree_path;

 __**_
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/**mailman/listinfo/gtk-app-**devel-listhttps://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

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


In-App Analytics

2013-05-08 Thread Cassidy James
Does anyone know of a library for in-app analytics for GTK apps?

On mobile platforms it's pretty popular to have analytics where, like on
the web, anonymous usage stats can be collected. This really helps
developers understand how their app is being used, what features are or
aren't used, etc.

Regards,
Cassidy James
___
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list


Question about a Gtk-WARNING message when running gedit

2013-03-28 Thread Tilton, James C. (GSFC-6063)
Hi gtk-list:



I recently built and installed GTK+ version 3.6.4.  This ended up 'breaking' my 
old RHEL system supplied version of gedit (version 2.16.0).



So I went ahead and built and installed gedit version 3.2.6.  This version 
works, but I get the following Gtk-WARNING every time I run gedit:



(gedit:9928): Gtk-WARNING **: Theme parsing error: data:5:10: Not using units 
is deprecated. Assuming 'px'.



It appears to me that this may be caused by a call to a GTK+ function somewhere 
in the gedit source code using a deprecated call format.

However, I don't know what to look for in the gedit source code.



What GTK+ function would such a WARNING be associated with?



Or is this caused by some other problem?



Jim Tilton


Dr. James C. TiltonVoice:   
301-286-9510
NASA Goddard Space Flight Center   FAX: 301-286-1776
Mail Code 606.3E-Mail:  
james.c.til...@nasa.govmailto:james.c.til...@nasa.gov
(Computational  Information Sciences and Technology Office)
Greenbelt, MD 20771
URLs:  http://ipp.gsfc.nasa.gov/ft_tech_rhseg.shtm, 
http://science.gsfc.nasa.gov/606.3/TILTON/ and
https://powellcenter.usgs.gov/globalcroplandwater/.




___
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list


OT: tcl/tk GUI app

2013-01-17 Thread Fred James

All
My apologies for being somewhat off topic (OT), but I don't know where 
else to turn (your pointers in that arena would be appreciated as well).


I am trying to learn some GUI programming and what is readily available 
to me is tck/tk, and I have a (very) little experience with it.


I want to open a dialog to choose a directory, and then put that choice 
into a variable to be used by another action.


So far I can only get the dialog
set dir [tk_chooseDirectory -initialdir ~ -title Choose a directory]
which works fine in and of itself, of course, but I haven't been able to 
use the result for anything as yet.


Any help you may be able to offer would be appreciated.  Thank you
Regards
Fred James

___
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list


Re: OT: tcl/tk GUI app

2013-01-17 Thread Fred James

Georgios Petasis wrote:

if {$dir ne } {
# your action here...
}

Georgios Petasis
Thank you ... at least with that, so far I can display the selected 
directory in the main window ... that is more than I had.


(for those not interested ... you may easily stop reading here ... thank 
you)


What is the action, you ask?
(1) enter a search string (exact match, but not case sensitive)
(2) select a starting directory
(3) search recursively from there
(3.1) search first for a list of files ending in *.odt
(3.2) search each file on the list (found in 3.1) for the string
(3.2.1) make a list of matches
(3.2.2) display the match list in a scroll box
... or some variation of that.

I have odt2txt (downloaded and running), and I have a couple of (BASH) 
shell scripts that complete the set.  I put all three in /usr/bin.  The 
set works like this ...

(1) in a terminal window
(1.1) cd to /desired/path
(1.2) enter the following: searchODT string [string [string ... 
[string]]]
(1.2.1) that is, at least 1 and up to 9 space separated arguments 
(hard coded arbitrary limit)
(1.3) searchODT sorts out the string, combining all arguments into 
one string
(1.4) searchODT calls depthODT, which generates the list (file) of 
*.odt files
(1.3.1) search is recursive beginning at the 'pwd' where the 
original searchODT command was issued

(1.4) searchODT then calls odt2txt for each entry in the list (file)
(1.4.1) the output from odt2txt is grep'd for the string(s) (grep -i)
(1.4.2) matches are put into another file for display
(1.4.2.1) it is possible to use: more, soffice, kwrite (and I am 
sure others) for the display.
Other than argument count, there is basically no error checking at the 
moment.


(scripts available, if interested)

The original project was to done to help my spouse, because dolphin 
(file manager) doesn't seem to be able to search inside OOo documents?  
And the current version functions well enough.  But I though I might be 
able to use this opportunity to learn some more tcl/tk.


Thank you for your help
Regards
Fred James


___
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list


g_timeout handling, is this the best way?

2012-11-20 Thread James Tappin
I have a program that uses a g_timeout loop to control the display of a
sequence of plots (produced via plplot), and I need to be able to change
the delay between displaying the plots.

The method I am using is this:

   1. Use g_timeout_add_full to create the timeout, with the GSourceFunc as
   a routine that checks whether a termination flag has been set, and either
   displays the next frame and returns TRUE or just returns FALSE.
   2. Set up a GDestroyNotify function that checks if a restart flag is set
   and if it has then starts a new timeout loop.
   3. The callback that changes the speed, updates the delay and then sets
   both the termination and restart flags, so that on the next timeout call,
   the loop is destroyed and recreated with the new delay.

Is this the best way to do it or is there a more convenient way?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Lack of gtk_application_get_window_by_id function despite of documentation

2012-11-17 Thread James Tappin
On 17 November 2012 16:05, Jakub Kucharski dexc...@gmail.com wrote:

 I was trying to compile my application and it appears that one documented
 function called 'gtk_application_get_window_**by_id' (
 http://developer.gnome.org/**gtk3/stable/GtkApplication.**
 html#gtk-application-get-**window-by-idhttp://developer.gnome.org/gtk3/stable/GtkApplication.html#gtk-application-get-window-by-id)
 doesn't exist. I run Debian Sid on my machine and I've installed
 'libgtk-3-dev' package, so I don't really see what's wrong. Maybe this
 output will be useful for you:


According to the Debian package list they are still at 3.4 in Sid, and the
routine is marked Since 3.6.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Examples of ComboBox using an explicit model?

2012-07-31 Thread James Tappin
Thanks to those who send examples on or off list. With the guidance of
those I was able to figure out how the different bits fit together and get
a working code.

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


Examples of ComboBox using an explicit model?

2012-07-30 Thread James Tappin
I am currently trying to implement combobox cell renderers in the
high-level gtk-fortran code. Unfortunately unlike normal comboboxes where
there is the convenience type of GtkComboBoxText this is not available for
cell renderers.

I have hunted for examples of a working combobox that uses an explicit tree
model without any success. Does anybody on this list have such an example
(or even better, of a CellRendererCombo) that they would be willing to
share.

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


g_value_set_instance -- how to use?

2012-07-23 Thread James Tappin
There is very little documentation that I can find explaining how
g_value_set_instance is supposed to work. Is the following anywhere near
correct?

void my_gvalue_setter( const GValue *gv,
 gpointer  val,
 Gtype type)
 {
  g_value_unset(gv);
  g_value_init(gv, type);
  g_value_set_instance(gv,  val);
 }

Then provided val is a pointer to a quantity of type type, it's equivalent
to using the specific setting routine or am I barking up quite the wrong
tree?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Threads and idle functions

2012-07-02 Thread James Morris
(sorry forgot list)
On 3 July 2012 01:50, David Buchan pdbuc...@yahoo.com wrote:
 My understanding is that child threads must never alter the UI in any way.

 If I have a program which spawns a child thread to download some data and I 
 want to be able to have a dialog pop up should an error occur, is it correct 
 to say that I need an idle function to be running concurrently to monitor 
 some global variable which would contain the status (set by the download 
 thread), and then the idle function would create the dialog pop-up?

 Put another way, if only the GTK+ main iteration is allowed to alter the GUI, 
 then how does someone get information out of a child thread and to the UI?

Well from what I hear, g_idle_add offers some form of thread safety so
a child thread can communicate some item of data via a callback
executed in the GUI thread.

The documentation also seems to support this view:
http://developer.gnome.org/glib/2.31/glib-The-Main-Event-Loop.html#glib-The-Main-Event-Loop.description

your child/download thread does the monitoring of the error status and
when an error is found, use g_idle_add to wait some moments and then
communicate the error to a callback.

HTH,
James.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Threads and idle functions

2012-07-02 Thread James Morris
On 3 July 2012 02:10, James Morris jwm.art@gmail.com wrote:
 (sorry forgot list)
 On 3 July 2012 01:50, David Buchan pdbuc...@yahoo.com wrote:
 My understanding is that child threads must never alter the UI in any way.

 If I have a program which spawns a child thread to download some data and I 
 want to be able to have a dialog pop up should an error occur, is it correct 
 to say that I need an idle function to be running concurrently to monitor 
 some global variable which would contain the status (set by the download 
 thread), and then the idle function would create the dialog pop-up?

 Put another way, if only the GTK+ main iteration is allowed to alter the 
 GUI, then how does someone get information out of a child thread and to the 
 UI?

 Well from what I hear, g_idle_add offers some form of thread safety so
 a child thread can communicate some item of data via a callback
 executed in the GUI thread.

 The documentation also seems to support this view:
 http://developer.gnome.org/glib/2.31/glib-The-Main-Event-Loop.html#glib-The-Main-Event-Loop.description


Forgive me if I speak as if the thread safety of g_idle_add is
something to be doubted. Multi-threaded applications are typically
complicated affairs and the ease of use of g_idle_add rather contrasts
with my (non-professional) experience. That being said, there are
probably limits to what can be accomplished using it but for basic
use-cases such as these it is perfect.


 your child/download thread does the monitoring of the error status and
 when an error is found, use g_idle_add to wait some moments and then
 communicate the error to a callback.

 HTH,
 James.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


custom widget theme change problem

2012-06-21 Thread James Morris
Hi,

I have a custom GTK widget which renders using Cairo. In the expose
callback gtk_widget_get_style is called to obtain colours to render
the widget with some theme consistency.

When a theme is changed (ie using gtk-chtheme) any of my custom
widgets that are visible are not updated. However, after switching to
a different notebook tab, I can see previously hidden instances of the
custom widget have been updated (switching notebook tabs back again
does not trigger update).

Can anyone give any pointers as to what might be happening?

Thanks,
James.

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


Re: custom widget theme change problem

2012-06-21 Thread James Morris
Hello again,

Seems to be a habit of mine here, I ask a question, don't get an
immediate response and then look further into it and find some sort of
solution...

On 21 June 2012 10:42, James Morris jwm.art@gmail.com wrote:
 Hi,

 I have a custom GTK widget which renders using Cairo. In the expose
 callback gtk_widget_get_style is called to obtain colours to render
 the widget with some theme consistency.

 When a theme is changed (ie using gtk-chtheme) any of my custom
 widgets that are visible are not updated. However, after switching to
 a different notebook tab, I can see previously hidden instances of the
 custom widget have been updated (switching notebook tabs back again
 does not trigger update).

 Can anyone give any pointers as to what might be happening?

I've found the culprit, or put another way, I've found what to comment
out to fix the problem.

In my custom_widget_realize callback it has the following code which
if I comment out the last three lines of, the problem resolves:

window = gtk_widget_get_parent_window (widget);
gtk_widget_set_window(widget, window);
g_object_ref (window);

style = gtk_widget_get_style(widget);
style = gtk_style_attach(style, window);
gtk_widget_set_style(widget, style);

It is code I updated from this old code (which won't compile with
GTK_DISABLE_DEPRECATED etc):

widget-window = gtk_widget_get_parent_window (widget);
g_object_ref (widget-window);
widget-style = gtk_style_attach (widget-style, widget-window);

This old code (which uses GDK rather than Cairo) doesn't have any
problem with theme changes... but without it the widgets aren't
updated after theme changes.

Scratching head..
James.


 Thanks,
 James.

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


Re: custom widget theme change problem

2012-06-21 Thread James Morris
On 22 June 2012 01:50, James Morris jwm.art@gmail.com wrote:
 Can anyone give any pointers as to what might be happening?

 I've found the culprit, or put another way, I've found what to comment
 out to fix the problem.

 In my custom_widget_realize callback it has the following code which
 if I comment out the last three lines of, the problem resolves:

    window = gtk_widget_get_parent_window (widget);
    gtk_widget_set_window(widget, window);
    g_object_ref (window);

    style = gtk_widget_get_style(widget);
    style = gtk_style_attach(style, window);
    gtk_widget_set_style(widget, style);

Ok I discovered that solution to cause an alternative problem:
 Gtk-CRITICAL **: IA__gtk_style_detach: assertion `style-attach_count
 0' failed

Which caused me to the first two of the last three lines (ie without
gtk_widget_set_style).

The docs for gtk_style_attach say:
Since this function may return a new object, you have to use it in
the following way: style = gtk_style_attach (style, window)

So what am I meant to do with it?

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


GtkFileChooser selection-changed signal emission on gtk_dialog_run()

2012-06-14 Thread James Morris
Hi,

I've got a problem with the selection-changed signal being emitted
as soon as gtk_dialog_run is called on a GtkFileChooserDialog. I tried
delaying connection of the callback until right before calling
gtk_dialog_run but there were still four calls (in a row AFAICT) to
the callback.

I am now using g_timeout_add as a work-around to delay connection of
the signal to my callback and thus prevent the four initial
selection-changed emissions activating the callback.

Is this normal? Is there a more standard way of doing this?

I'm using GTK 2.24.10 in 64bit Arch Linux.

Thanks,
James.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkFileChooser selection-changed signal emission on gtk_dialog_run()

2012-06-14 Thread James Morris
On 14 June 2012 16:54, James Morris jwm.art@gmail.com wrote:
 Hi,

 I've got a problem with the selection-changed signal being emitted
 as soon as gtk_dialog_run is called on a GtkFileChooserDialog. I tried
 delaying connection of the callback until right before calling
 gtk_dialog_run but there were still four calls (in a row AFAICT) to
 the callback.

 I am now using g_timeout_add as a work-around to delay connection of
 the signal to my callback and thus prevent the four initial
 selection-changed emissions activating the callback.

To put this in context, it's for auto-previewing audio files.

The simple implementation causes an audio file to be previewed when
gtk_dialog_run is called* or when the current folder is changed in the
chooser. By using a dont_preview boolean and connecting the
current-folder-changed signal to a callback I can then use
g_timeout_add to cancel the dont_preview flag. The flag must be set
before gtk_dialog_run is called, and will always be set when the
folder is changed.

*provided the item initially selected in the chooser is an audio file.

 Is this normal? Is there a more standard way of doing this?

I'm guessing it is normal/standard and that work-a-rounds are
necessary if you want to do something like this.


 I'm using GTK 2.24.10 in 64bit Arch Linux.

 Thanks,
 James.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


RE: Re: Can't locate object method add_actions...

2012-06-08 Thread Williams, James P2 (N-UNITED SPACE ALLIANCE, LLC)
I've done lots of XS, and can help if you need it.  Here are the resources I 
used to learn it, the first two being the most helpful.  They're listed in 
order, from gentlest to most blood-curdling.  Nah, it's not so bad.

   http://world.std.com/~swmcd/steven/perl/pm/xs/intro/index.html
   http://www.amazon.com/Extending-Embedding-Perl-Tim-Jenness/dp/1930110820
   http://www.johnkeiser.com/perl-xs-c++.html
   perlxstut
   perlxs

Good luck.

Jim

 -Original Message-
 From: gtk-perl-list-boun...@gnome.org [mailto:gtk-perl-list-
 boun...@gnome.org] On Behalf Of Dave M
 Sent: Friday, June 08, 2012 10:21 AM
 To: gtk-perl mailing list
 Subject: Re: Can't locate object method add_actions...
 
 On Fri, Jun 8, 2012 at 10:14 AM, Torsten Schoenfeld kaffeeti...@gmx.de
 wrote:
  On 08.06.2012 16:57, Dave M wrote:
 
  I'll give it a shot.
 
 
  That's the spirit! :-)
 
 
  Be warned that this will be my first run-in with the demon known as
  XS, so it might not be pretty.
 
 
  The pygobject override might be a place to start, if Python is more
 familiar
  to you:
 
  http://git.gnome.org/browse/pygobject/tree/gi/overrides/Gtk.py#n124
 
  But I notice that this implementation is less complete than our old XS
  implementation: it lacks the translation and accelerator handling.
 
  ___
 
 No, definitely more familiar with Perl.   I've already started, but it
 might take me a little time, especially since I'll be at YAPCNA next
 week.
 
 This looks useful for XS:
 http://search.cpan.org/dist/perl/pod/perlguts.pod
 
 Thanks,
 Dave M
 ___
 gtk-perl-list mailing list
 gtk-perl-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-perl-list
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: How do I fix the window size?

2012-06-05 Thread James Tappin
On 5 June 2012 11:00, Ferdinand Ramirez ramirez.ferdin...@yahoo.com wrote:

 I have a treeview and a scrollbar which are both within a hbox. The hbox
 is within a window. When I expand the treeview, the window resizes itself
 to include the whole treeview.

 The biggest problem is when the treeview has more elements than what can
 be seen on a single screen. The window size becomes larger than the display.

 I want the window size to remain the same and use my scrollbar to navigate
 my treeview. How do I achieve this? gtk_window_resize does not seem to be
 the solution.


I think the solution is to place the treeview in a gtk_scrolled_window
rather than using an hbox and an explicit scrollbar. You may also need to
make a call to gtk_widget_set_size_request on the scrolled window to get
what you want.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How do I fix the window size?

2012-06-05 Thread James Tappin
On 5 June 2012 12:50, Ferdinand Ramirez ramirez.ferdin...@yahoo.com wrote:

 --- On Tue, 6/5/12, James Tappin jtap...@gmail.com wrote:

  I think the solution is to place the treeview in a gtk_scrolled_window
  rather than using an hbox and an explicit scrollbar.

 The reason for trying out with an explicit hbox is that the column headers
 scroll out of view with a gtk_scrolled_window.


I'm puzzled as it doesn't do that in my RPN calculator stack and registers
display. This uses a list model (i.e. no sub-rows).  Here are the key bits
of code (in Fortran 2003 -- I'm not a C programmer).

The list creator function:

  function hl_gtk_listn_new(scroll, ncols, types, changed, data, multiple,
width, titles, height, swidth, align, ixpad, iypad, sensitive, 
tooltip, sortable, editable, colnos, edited, data_edited)
result(list)

type(c_ptr) :: list
type(c_ptr), intent(out) :: scroll
integer(kind=c_int), intent(in), optional :: ncols
integer(kind=type_kind), dimension(:), intent(in), optional :: types
 .
 .
 .
! Create the storage model
model = gtk_list_store_newv(ncols_all, c_loc(types_all))

! Create the list in the scroll box
scroll = gtk_scrolled_window_new(C_NULL_PTR, C_NULL_PTR)
call gtk_scrolled_window_set_policy(scroll, GTK_POLICY_AUTOMATIC, 
  GTK_POLICY_AUTOMATIC)
list = gtk_tree_view_new_with_model(model)
call gtk_container_add(scroll, list)
  .
  .
  .

And in the calculator itself:

  ! Registers.
  jbase = hl_gtk_box_new()
  idx = hl_gtk_notebook_add_page(mstabs, jbase, 
label=Registers//c_null_char)
  fmemory = hl_gtk_listn_new(smemory, changed=c_funloc(memsel), 
height=300, titles= (/ Index//c_null_char, Value//c_null_char
/), 
types = (/ g_type_int, g_type_double /))
  call hl_gtk_listn_set_cell_data_func(fmemory, memcol, 
func=c_funloc(show_list), data=c_loc(memcol))
  call hl_gtk_box_pack(jbase, smemory)

I hope that this will at least give some clues as to how the bits fit
together.

P.S. hl_gtk_* routines are Fortran routines that bundle settings together
and use Fortran's optional argument system to hide much of the complexity
of the raw gtk_* calls.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Multiple selections in list/treeview widgets and accelerator groups?

2012-06-01 Thread James Tappin
Is it possible that having an accelerator group associated with the
top-level window of a hierarchy could prevent multiple selections in a list
widget within that window from working?

I have an application that is supposed to have multiple selections enabled
(gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE) has been
called on the selection object associated with the treeview). But when I do
a control-click or shift-click on the list nothing happens [I don't expect
Ctrl-A to work as that is bound to a button]. The only significant
difference I can see from a demo program that does work is that the
top-level window has an accelerator group in the application and not in the
demo.

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


Re: gtk-app to search google scholar

2012-05-25 Thread James Morris
On 22 May 2012 21:20, Rudra Banerjee bnrj.ru...@yahoo.com wrote:
 Dear friends,
 I am trying to make a gtk application that will create a bibtex.
 The problem is I am a novice in C/gtk programming(this will be only my
 2nd programme in gtk).
 To do that, First and foremost, I need to search google scholar from the
 code. I tried using lynx and failed.
 Can anyone kindly show me a simple code in C that can fetch data from
 google scholar with Import into bibtex entry on?

According to 
http://en.wikipedia.org/wiki/Google_Scholar#Features_and_specifications
As of March 2012, Google Scholar is not yet available to the Google AJAX API.
So I would guess there will not be any simple C code to achieve what you want.
James.


 Best and Regards,
 --
 Rudra Banerjee

 If possible, plz. don't send me MsWord/PowerPoint mails. Why? See
 http://www.gnu.org/philosophy/no-word-attachments.html

 ___
 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
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkTable cells resizing

2012-05-18 Thread James Steward

On 15/05/12 14:45, Tristan Van Berkom wrote:

On Mon, May 14, 2012 at 10:29 PM, James Steward
jamesstew...@optusnet.com.au  wrote:
   

On 15/05/12 11:56, Tristan Van Berkom wrote:
 


... perhaps it's worth trying an extra call to gtk_widget_queue_resize()
after modifying your table.

   


I'm trying that.   I have signals connected thus;

g_signal_connect(G_OBJECT(p-canvas), expose-event,
 G_CALLBACK(plot_expose_event), p);

g_signal_connect(G_OBJECT(p-canvas), select-item,
 G_CALLBACK(plot_select_event), p);

and get the plot_select_event() routine to calculate and set new canvas
sizes with

gtk_plot_canvas_set_size(GTK_PLOT_CANVAS(p-canvas), width, height);

then call gtk_widget_queue_resize(GTK_WIDGET(p-table));

This causes plot_expose_event() to get called, which calls
gtk_plot_canvas_paint(GTK_PLOT_CANVAS(canvas));

But the table rows seem to expand to the largest canvas and don't seem to
take on variable heights.

Feel I've been around and around the mulberry bush on this ;-)
 


Hard to say whats going on here, I wonder who is responding
to the size requests for these items which are getting drawn.

It seems you connect to a signal to draw on a widget, which
means the content is not the widget, so probably you need
to also connect a signal to override the size request of the
said widget you intend painting onto ?

Perhaps you are using forced size requests to accomplish
this (using gtk_widget_set_size_request() or such), and
have somehow mixed up the size requests while swapping
your content onto new rows/columns ?

Other than that, child 'expand' properties will be considered
by the GtkTable (if all children can expand, then it's quite
possible that after reaching a large window size the content
will be evenly  spread).
   
Thanks for your ideas.  I had another.  I could define the table as 
having twice as many rows, then (hopefully) just reassigning the attach 
points.  I.e. where I now have;


gtk_table_attach_defaults(table1, canvas1, 0, 1, 0, 1);
gtk_table_attach_defaults(table1, canvas2, 0, 1, 1, 2);
gtk_table_attach_defaults(table1, canvas3, 0, 1, 2, 3);

instead I'll define a 6 row table and initialise as;

gtk_table_attach_defaults(table1, canvas1, 0, 1, 0, 2);
gtk_table_attach_defaults(table1, canvas2, 0, 1, 2, 4);
gtk_table_attach_defaults(table1, canvas3, 0, 1, 4, 6);

Then to zoom canvas2, I can hopefully somehow move the attachment points to;

gtk_table_attach_defaults(table1, canvas1, 0, 1, 0, 1);
gtk_table_attach_defaults(table1, canvas2, 0, 1, 1, 5);
gtk_table_attach_defaults(table1, canvas3, 0, 1, 5, 6);

I'd obviously need to fix the row size by making the table homogeneous.

What do you think?

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


RE: probable gtk_window_present and pango help

2012-05-18 Thread Tilton, James C. (GSFC-6063)
Also consider hiding your window (with a call to window-hide()) instead of 
destroying it, and making  it reappear with a call to window-show().

Jim Tilton

-Original Message-
From: gtk-app-devel-list-boun...@gnome.org 
[mailto:gtk-app-devel-list-boun...@gnome.org] On Behalf Of David Necas
Sent: Friday, May 18, 2012 2:19 PM
To: Rudra Banerjee
Cc: gtk-app-devel-list
Subject: Re: probable gtk_window_present and pango help

On Fri, May 18, 2012 at 09:12:45PM +0530, Rudra Banerjee wrote:
 Here is a minimal example of a program, where if i click the button, a 
 pop up window appears. I am posting both the call back function and 
 the main routine (table.c).
 I am facing 2 problem.

Unfortunately, you are facing much more problems.

For start

gtk_container_add(GTK_CONTAINER(window1), vbox1);

is called with an unitialised variable window1 (i.e. no window1 is ever 
created).  This leads to a CRITICAL message to console and/or crash.

And if window1 existed then vbox1 would be packed into two different containers 
(window1 and window) which is not possible.  So I'm ignoring that part 
altogether.

The callback should look like

void
callback_it(GtkWidget *button, gpointer user_data) {
   ...
}

where in user_data the callback receives the last argument you passed to 
g_signal_connect().  It is rarely useful to pass a constant such as Call 
there.

The callback is *not* another main() function; it should *not* call
gtk_init() again, etc.  Please read the signals section in the Gtk+ tutorial

http://developer.gnome.org/gtk-tutorial/2.90/x159.html

There are several other highly suspicious things:
- redeclaration of global variables (such as window) inside a function;
  are you aware this creates a new local variable window that has nothing
  to do with the global one?
- inclusion of .c files instead of separate compilation + linking them
  together
- calling gtk_widget_show() on individual widgets and then again showing
  everything using gtk_widget_show_all()
- not terminating the Gtk+ main loop when the main window is destroyed;
  this is usually the first thing to set up in a Gtk+ program, see

http://developer.gnome.org/gtk-tutorial/2.90/c39.html#SEC-HELLOWORLD

etc.

 1) The problem is evry time I click the button main, a new window 
 appears(obviously). What I want to achive is, if the window is already 
 present, it should not open again; rather it should focus that window. 
 I believe, this can be achived by gtk_window_present(may be I am wrong).
 But I don't know how to use it.

You use it just by calling gtk_window_present() on the window object.
To that meaningfully you need not only to keep the window object around but 
also get notified when the window is destroyed.  Either by connecting to the 
destroy signal or, if you just want to set a pointer to NULL once it is gone, 
by using g_object_add_weak_pointer().

 2) In the callback function, I have C_1 and C_2. What I want to achive 
 is Csub1/sub etc via pango(or any other).

For simple things you can sometimes just use UTF-8.  But generally, you need to 
use Pango markup.  If the widget does not have function to set the markup it 
has a function to obtain the label widget so that you can use 
gtk_label_set_markup() on that.

See the attached code with main problems fixed (and merged to one file).
Please go through the Gtk+ tutorial farther that you perhaps have done.

Yeti

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


Unable To Control Focus In A Gtk2::Notebook

2012-05-18 Thread Williams, James P2 (N-UNITED SPACE ALLIANCE, LLC)
I wrote a small example of my problem below.  It's just a simple window with a 
Gtk2::Notebook that contains a few pages, each with its own Gtk2::Entry.  When 
I change pages by clicking the tabs, the focus moves to the label on the new 
tab, but only if it was originally on the label of the previous tab. This is 
exactly what I want in all cases.
However, if the focus was originally somewhere inside the previous page, like 
one of the Gtk2::Entry widgets in the example below, the focus moves to a 
widget inside the new page.  Instead, I'd like the focus to always move to the 
label of the new tab.
I've tried attaching callbacks to different signals so I can call 
$w-grab_focus() on the label or notebook, but nothing seems to keep the focus 
on the new tab's label after page turns.  How can I make that happen?
Thanks,
Jim
#!/usr/bin/perl

use strict;
use warnings;

use Gtk2 -init;

my($win)=create();

Gtk2-main();


sub create
{
   my($win,$book);


   $win=new Gtk2::Window();
   $win-signal_connect(delete_event = sub {Gtk2-main_quit()});

   $win-add($book=new Gtk2::Notebook());

   $book-append_page(new Gtk2::Entry(),new Gtk2::Label($_))
  foreach qw(Goo Moo Foo);

   $win-show_all();

   return $win;
}

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


GtkTable cells resizing

2012-05-14 Thread James Steward

Hi,

I have an application with a tabbed view.  On two tabs I have a table, 
one is a 2x2 table, the other a 3x1 table (3 rows).


In each cell is a canvas that has a gtk plot.

I want to be able to click one of the plots in the 3x1 table and change 
the canvas size to 2/3 the original, with the other two canvases being 
1/6 the original size.


After redrawing and resizing and mucking about, I can't get the table 
rows to be different sizes, accommodating the different sized canvases 
properly, even though I have gtk_table_set_homogeneous (table, FALSE);


Any clues how to do this?

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


Re: GtkTable cells resizing

2012-05-14 Thread James Steward

On 15/05/12 11:56, Tristan Van Berkom wrote:

Are you using GTK+ 3 ?
   

Still on GTK+ 2.0.


If so, use GtkGrid instead... possibly just that will fix things for you.

Short of that, if I understand correctly, you have a target state/configuration
of a GtkTable (or GtkGrid), if you construct the table in the target
configuration
from scratch, I take it things work as you want... but dont work properly
after performing some kind of a transformation to reach your target
state...
   

That's about it.

... perhaps it's worth trying an extra call to gtk_widget_queue_resize()
after modifying your table.
   


I'm trying that.   I have signals connected thus;

g_signal_connect(G_OBJECT(p-canvas), expose-event,
 G_CALLBACK(plot_expose_event), p);

g_signal_connect(G_OBJECT(p-canvas), select-item,
 G_CALLBACK(plot_select_event), p);

and get the plot_select_event() routine to calculate and set new canvas 
sizes with


gtk_plot_canvas_set_size(GTK_PLOT_CANVAS(p-canvas), width, height);

then call gtk_widget_queue_resize(GTK_WIDGET(p-table));

This causes plot_expose_event() to get called, which calls 
gtk_plot_canvas_paint(GTK_PLOT_CANVAS(canvas));


But the table rows seem to expand to the largest canvas and don't seem 
to take on variable heights.


Feel I've been around and around the mulberry bush on this ;-)

Regards,
James.

On Mon, May 14, 2012 at 9:21 PM, James Steward

jamesstew...@optusnet.com.au  wrote:
   

Hi,

I have an application with a tabbed view.  On two tabs I have a table, one
is a 2x2 table, the other a 3x1 table (3 rows).

In each cell is a canvas that has a gtk plot.

I want to be able to click one of the plots in the 3x1 table and change the
canvas size to 2/3 the original, with the other two canvases being 1/6 the
original size.

After redrawing and resizing and mucking about, I can't get the table rows
to be different sizes, accommodating the different sized canvases properly,
even though I have gtk_table_set_homogeneous (table, FALSE);

Any clues how to do this?

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


Trouble with button mask

2012-05-13 Thread James Steward

Hi,

I've been trying to get a canvas select item event to fire for a 
gtk_plot_canvas.


Upon left clicking inside a plot canvas, I can see that 
gtk_plot_canvas_button_press(...) gets called, and the following lines 
near the beginning of that function (in the gtkextra lib) cause the 
function to exit without anything being selected.


  gdk_window_get_pointer(widget-window, NULL, NULL, mods);
  if(!(mods  GDK_BUTTON1_MASK)) return FALSE;

Upon inspection of the variable mods, it appears to have a value of 
GDK_MOD2_MASK, according to GDB.


Anyone know why a GDK_BUTTON1_MASK isn't read when I left click?

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


Re: Trouble with button mask

2012-05-13 Thread James Steward

Stupid question below.  Please ignore.

James.

On 14/05/12 15:47, James Steward wrote:

Hi,

I've been trying to get a canvas select item event to fire for a 
gtk_plot_canvas.


Upon left clicking inside a plot canvas, I can see that 
gtk_plot_canvas_button_press(...) gets called, and the following lines 
near the beginning of that function (in the gtkextra lib) cause the 
function to exit without anything being selected.


  gdk_window_get_pointer(widget-window, NULL, NULL, mods);
  if(!(mods  GDK_BUTTON1_MASK)) return FALSE;

Upon inspection of the variable mods, it appears to have a value of 
GDK_MOD2_MASK, according to GDB.


Anyone know why a GDK_BUTTON1_MASK isn't read when I left click?

Regards,
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: Unable To Keep Showing Last Item In Gtk2::TreeView

2012-04-12 Thread Williams, James P2 (N-UNITED SPACE ALLIANCE, LLC)
 Williams, James P2 james.p2.willi...@lmco.com wrote:
  How can I keep my automatic scrolling, even after these kinds of events?
  I’ve tried reacting to various signals, but the tree view seems too stale
  for $tree-get_visible_range() or $tree-scroll_to_cell() to work.
 You might react to size-allocate events, but a slightly different approach
 is necessary. Here's a hack around your test code:

Your suggestion was enough to get something running.  I had to keep track of 
how many items were added, and had to watch for scroll bar changes.  As far as 
I can tell, the scroll bar stays at the bottom now unless I move it, even if I 
resize the window to be shorter.  My modified version follows, for reference.

Thanks,

Jim

#!/usr/bin/perl

use strict;
use warnings;

use Glib qw(TRUE FALSE);
use Gtk2 -init;

my($numAdded)=0;

my($win,$tree)=createWin();
Glib::Timeout-add(1000,sub {tickCB($tree)});

$win-show_all();
Gtk2-main();


#
# Creates the widgets in the application.  Returns the main
# window and tree view.
#
sub createWin
{
   my($win,$scroll,$tree,$model,$mustScroll);


   $win=new Gtk2::Window();
   $win-set_default_size(250,300);
   $win-signal_connect(destroy = \Gtk2::main_quit);

   $win-add($scroll=new Gtk2::ScrolledWindow());
   $scroll-add($tree=new Gtk2::TreeView());
   $tree-set_rules_hint(TRUE);

   $tree-insert_column_with_attributes(-1,'Goo',
  new Gtk2::CellRendererText(),text = 0);
   $tree-set_model($model=
  new Gtk2::ListStore('Glib::String'));

   $tree-signal_connect(
  size_allocate = sub {sizeCB(\$mustScroll,@_)});

   $model-signal_connect(
  row_inserted = sub {rowCB(\$mustScroll,$tree,@_)});

   $scroll-get_vadjustment()-signal_connect(
  value_changed = sub {$numAdded=0});

   addWords($model,100);
   showLast($tree,\$mustScroll);

   return ($win,$tree);
}


#
# Called at regular intervals to add more random words to
# the bottom of the tree view.  If the previous word was
# visible beforehand, scrolls the tree view so the new
# words are visible.
#
sub tickCB
{
   my($tree)=@_;

   addWords($tree-get_model(),100);
   return TRUE;
}


#
# Adds random words to the bottom of the tree view.
#
sub addWords
{
   my($model,$numAdd)=@_;
   my(@cons)=grep !/[aeiou]/,'a' .. 'z';

   for (1 .. $numAdd) {
  $model-set($model-append(),0,
 $cons[rand @cons] . 'oo');
  $numAdded++;
   }
}


#
# Scrolls the tree view so the last row is visible.
#
sub showLast
{
   my($tree,$mustScroll)=@_;
   my($numRows)=$tree-get_model()-iter_n_children(undef);

   $tree-scroll_to_cell(
  new Gtk2::TreePath($numRows-1),undef,TRUE,0.0,1.0);
   $$mustScroll=TRUE;
   $numAdded=0;
}


#
# Called each time the tree view is resized.  This is where
# we correct the scroll bar, moving it to the bottom if
# appropriate.
#
sub sizeCB
{
   my($mustScroll,$tree,$rect)=@_;

   showLast($tree,$mustScroll) if $$mustScroll;
}


#
# Called each time a row is added to the model.
#
sub rowCB
{
   my($mustScroll,$tree,$model,$path,$it)=@_;
   my($numRows)=$model-iter_n_children(undef);
   my($lastVis);


   if ($tree-realized()) {
  $lastVis=($tree-get_visible_range())[1];
  $$mustScroll=$lastVis 
 $lastVis-get_indices() == $numRows-2-$numAdded;
   } else {
  $$mustScroll=TRUE;
   }
}

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


Re: Getting the busy cursor to display.

2012-04-11 Thread James Tappin
On 11 April 2012 04:36, jcup...@gmail.com wrote:

 On 10 April 2012 18:33, James Tappin jtap...@gmail.com wrote:
  Thanks for the suggestion. Unfortunately in this case it doesn't help. (I
  have also tried gdk_display_flush and gdk_window_flush, but still the
 same
  story).

 Here's a tiny test program that works for me with gtk2. It just uses:

  gdk_window_set_cursor( win-window, busy_cursor );
  gdk_flush();

 J


 That program works, as does a translation into Fortran. But I'm still not
having any joy with my display monitor. Maybe the only convenient fix is to
show a window with a message Reading database during the read and then
create the monitor afterwards.

To Igor: I thought that a progress bar in activity mode had to be prodded
to show the animation, which is not possible while I'm doing the read.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Getting the busy cursor to display.

2012-04-11 Thread James Tappin
On 11 April 2012 09:25, James Tappin jtap...@gmail.com wrote:



 On 11 April 2012 04:36, jcup...@gmail.com wrote:

 On 10 April 2012 18:33, James Tappin jtap...@gmail.com wrote:
  Thanks for the suggestion. Unfortunately in this case it doesn't help.
 (I
  have also tried gdk_display_flush and gdk_window_flush, but still the
 same
  story).

 Here's a tiny test program that works for me with gtk2. It just uses:

  gdk_window_set_cursor( win-window, busy_cursor );
  gdk_flush();

 J


 That program works, as does a translation into Fortran. But I'm still not
 having any joy with my display monitor. Maybe the only convenient fix is to
 show a window with a message Reading database during the read and then
 create the monitor afterwards.

 To Igor: I thought that a progress bar in activity mode had to be prodded
 to show the animation, which is not possible while I'm doing the read.


I'm now really confused -- I've reordered some of the code so that the
set_cursor call precedes putting a message in the status bar. And the
status bar updates but not the cursor.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Getting the busy cursor to display.

2012-04-11 Thread James Tappin
On 11 April 2012 10:51, James Tappin jtap...@gmail.com wrote:


 I'm now really confused -- I've reordered some of the code so that the
 set_cursor call precedes putting a message in the status bar. And the
 status bar updates but not the cursor.


OK: I think I've figured it. The problem is/was that since the pointer was
not normally inside the monitor window when the cursor change was made AND
there was no event polling during the read, the cursor was stuck in what
ever state it entered the window.

Since other parts of the program use openmp for parallel DO loops, I've put
a parallel section so that one thread polls events while the other does the
reads.

Thanks for all the comments, they did help getting me thinking down the
right lines.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


RE: Making a cursor (cross hair) track between image displays

2012-04-10 Thread Tilton, James C. (GSFC-6063)
Hi again,

I've made a lot of progress on this task - but I still am having trouble with 
manipulating the appearance of the Cursor. Apparently the approach for doing 
this has changed between gtkmm 2 and 3, and apparently all the solutions I can 
find via Google are for gtkmm 2.  How can I change the default appearance of my 
cursor from the default cursor to something else (e.g. a CrossHair) in gtkmm 3?

Thanks.

Jim Tilton

-Original Message-
From: gtk-app-devel-list-boun...@gnome.org 
[mailto:gtk-app-devel-list-boun...@gnome.org] On Behalf Of Tilton, James C. 
(GSFC-6063)
Sent: Monday, April 02, 2012 12:00 PM
To: gtk-app-devel-list@gnome.org
Subject: Making a cursor (cross hair) track between image displays

Hi GTK+ application developers!

I have developed an application using gtkmm in which I display related images 
in multiple Gtk::Window's.

I have two types of display images.  One is based on Gtk::Image and the other 
is based on Gtk::DrawingArea.
For the Gtk::Image case I add the Gtk::Image to a Gtk::EventBox, which in turn 
I add to a Gtk::ScrolledWindow.
For the Gtk::DrawingArea, is directly add the Gtk::DrawingArea to a 
Gtk::ScrolledWindow (without the intervening Gtk::EventBox).

When the image sizes exceed the ScrolledWindow display area, I use the 
Gtk::Adjustment associated with each Gtk::ScrolledWindow to have the 
pan-scrolling of each window track each other.

When I place the cursor in one of the display images, I would like to have a 
cross hair appear at the cursor location of the window in which the cursor is 
placed at the location currently pointed to by the cursor. I would ALSO like to 
have a similar cross hair appear in each of the other associated display images.

How can I make this happen with GTK+/gtkmm? I've looked for examples of this 
and haven't found any. Can anyone point me in the right direction for 
implementing this feature in my application?

(In my current application, the normal arrow cursor appears in just one window, 
and if I hold the either the left or right mouse button down, I have the column 
and row location and image data value(s) appear in text below the Scrolled 
Window image display.)

Thanks.

Jim Tilton

Dr. James C. TiltonVoice:   
301-286-9510
NASA Goddard Space Flight Center   FAX: 301-286-1776
Mail Code 606.3E-Mail:  
james.c.til...@nasa.govmailto:james.c.til...@nasa.gov
(Computational  Information Sciences and Technology Office)
Greenbelt, MD 20771
URLs:  http://ipp.gsfc.nasa.gov/ft_tech_rhseg.shtm and 
http://science.gsfc.nasa.gov/606.3/TILTON/



___
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


Getting the busy cursor to display.

2012-04-10 Thread James Tappin
I have a gtk (fortran) application that displays a progress monitor while
computing, and I would like to display the busy cursor while the program is
reading a large data file.

Right now what I have is:

To define the busy cursor and GDK window (module [global] variables).

   draw_window = gtk_widget_get_window(window)
   busy_cursor = gdk_cursor_new_for_display(gdk_display_get_default(), 
 GDK_WATCH)

and then to activate/deactivate it:

 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ! Set a busy cursor on the progress monitor (for reading the database)
 subroutine set_monitor_busy(is_busy)
   logical, intent(in) :: is_busy

   if (is_busy) then
  call gdk_display_sync(gdk_display_get_default())
  call gdk_window_set_cursor(draw_window, busy_cursor)
  call gdk_display_sync(gdk_display_get_default())
   else
  call gdk_display_sync(gdk_display_get_default())
  call gdk_window_set_cursor(draw_window, NULL)
  call gdk_display_sync(gdk_display_get_default())
   end if
 end subroutine set_monitor_busy

The just before I start to read the big file I have:
  call set_monitor_busy(.TRUE.)

and after reading:
 call set_monitor_busy(.FALSE.)

However, even with both gdk_display_sync calls as shown, sometimes the busy
cursor appears and sometimes it doesn't (in fact sometimes the whole window
shows blank until after the file read). The commonest case is that the
monitor window renders but still keeps the regular cursor.

Is there some other call (or calls) I should be making to force the updates
to take place?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Getting the busy cursor to display.

2012-04-10 Thread James Tappin
On 10 April 2012 10:09, jcup...@gmail.com wrote:

 On 10 April 2012 16:58, James Tappin jtap...@gmail.com wrote:
   call gdk_display_sync(gdk_display_get_default())
   call gdk_window_set_cursor(draw_window, busy_cursor)
   call gdk_display_sync(gdk_display_get_default())

 My gtk2 program does this with:

gdk_window_set_cursor( window, cursor );
gdk_flush();

 If that's any help :( I've not tried gtk3 yet.

 J


Thanks for the suggestion. Unfortunately in this case it doesn't help. (I
have also tried gdk_display_flush and gdk_window_flush, but still the same
story).
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


RE: Making a cursor (cross hair) track between image displays

2012-04-10 Thread Tilton, James C. (GSFC-6063)
Hi GTK+ application developers:

As it often happens, the inquirer often answers his own question. I finally 
found clear enough example of something similar in gtkmm 3 and through a little 
trial and error found the solution. Here it is for gtkmm 3:

  Glib::RefPtr Gdk::Window ref_Gdk_window = get_window();
  Glib::RefPtrGdk::Cursor display_cursor = 
Gdk::Cursor::create(ref_Gdk_window-get_display(), Gdk::CROSSHAIR);
  ref_Gdk_window-set_cursor(display_cursor);

Now, to complete my application, I just need to draw a cursor clone 
(crosshair) at the corresponding location in the associated gtkmm windows.

Jim Tilton

-Original Message-
From: gtk-app-devel-list-boun...@gnome.org 
[mailto:gtk-app-devel-list-boun...@gnome.org] On Behalf Of Tilton, James C. 
(GSFC-6063)
Sent: Tuesday, April 10, 2012 9:28 AM
To: gtk-app-devel-list@gnome.org
Subject: RE: Making a cursor (cross hair) track between image displays

Hi again,

I've made a lot of progress on this task - but I still am having trouble with 
manipulating the appearance of the Cursor. Apparently the approach for doing 
this has changed between gtkmm 2 and 3, and apparently all the solutions I can 
find via Google are for gtkmm 2.  How can I change the default appearance of my 
cursor from the default cursor to something else (e.g. a CrossHair) in gtkmm 3?

Thanks.

Jim Tilton

-Original Message-
From: gtk-app-devel-list-boun...@gnome.org 
[mailto:gtk-app-devel-list-boun...@gnome.org] On Behalf Of Tilton, James C. 
(GSFC-6063)
Sent: Monday, April 02, 2012 12:00 PM
To: gtk-app-devel-list@gnome.org
Subject: Making a cursor (cross hair) track between image displays

Hi GTK+ application developers!

I have developed an application using gtkmm in which I display related images 
in multiple Gtk::Window's.

I have two types of display images.  One is based on Gtk::Image and the other 
is based on Gtk::DrawingArea.
For the Gtk::Image case I add the Gtk::Image to a Gtk::EventBox, which in turn 
I add to a Gtk::ScrolledWindow.
For the Gtk::DrawingArea, is directly add the Gtk::DrawingArea to a 
Gtk::ScrolledWindow (without the intervening Gtk::EventBox).

When the image sizes exceed the ScrolledWindow display area, I use the 
Gtk::Adjustment associated with each Gtk::ScrolledWindow to have the 
pan-scrolling of each window track each other.

When I place the cursor in one of the display images, I would like to have a 
cross hair appear at the cursor location of the window in which the cursor is 
placed at the location currently pointed to by the cursor. I would ALSO like to 
have a similar cross hair appear in each of the other associated display images.

How can I make this happen with GTK+/gtkmm? I've looked for examples of this 
and haven't found any. Can anyone point me in the right direction for 
implementing this feature in my application?

(In my current application, the normal arrow cursor appears in just one window, 
and if I hold the either the left or right mouse button down, I have the column 
and row location and image data value(s) appear in text below the Scrolled 
Window image display.)

Thanks.

Jim Tilton

Dr. James C. TiltonVoice:   
301-286-9510
NASA Goddard Space Flight Center   FAX: 301-286-1776
Mail Code 606.3E-Mail:  
james.c.til...@nasa.govmailto:james.c.til...@nasa.gov
(Computational  Information Sciences and Technology Office)
Greenbelt, MD 20771
URLs:  http://ipp.gsfc.nasa.gov/ft_tech_rhseg.shtm and 
http://science.gsfc.nasa.gov/606.3/TILTON/



___
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: Getting the busy cursor to display.

2012-04-10 Thread James Tappin
On 10 April 2012 11:36, Michael Cronenworth m...@cchtml.com wrote:

 James Tappin wrote:
  Is there some other call (or calls) I should be making to force the
 updates
  to take place?

 I use the following for widget updates during background processing:

while ( gtk_events_pending( ) )
gtk_main_iteration(  );

 Not sure if it will work for cursor drawing though.
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


I have tried that as well -- and still no joy.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Unable To Keep Showing Last Item In Gtk2::TreeView

2012-04-09 Thread Williams, James P2 (N-UNITED SPACE ALLIANCE, LLC)
The code below illustrates a problem I'm having with 
Gtk2::TreeViewhttp://gtk2-perl.sourceforge.net/doc/pod/Gtk2/TreeView.html (or 
herehttp://developer.gnome.org/gtk/2.24/GtkTreeView.html). It just displays a 
list of random words, and adds a new one at the bottom once every second. I'd 
like to automatically scroll the new word into view, but only if the one just 
before it was visible. That way, this automatic scrolling won't annoy someone 
looking elsewhere in the tree view.

Everything words fine until something causes the tree view to shrink. Making 
the window smaller is an example. The actual application I'm working on has 
other examples, e.g., a 
Gtk2::Expanderhttp://gtk2-perl.sourceforge.net/doc/pod/Gtk2/Expander.html (or 
herehttp://developer.gnome.org/gtk/2.24/GtkExpander.html). If you resize the 
window to be smaller, you should see the problem. The gravity of the scroll 
bar, or whatever, moves it slightly off the bottom of the view after the 
shrink, turning off the automatic scrolling.

How can I keep my automatic scrolling, even after these kinds of events?  I've 
tried reacting to various signals, but the tree view seems too stale for 
$tree-get_visible_range() or $tree-scroll_to_cell() to work.

Thanks,

Jim

#!/usr/bin/perl



use strict;

use warnings;



use Glib qw(TRUE FALSE);

use Gtk2 -init;



my($win,$tree)=createWin();

Glib::Timeout-add(1000,sub {tickCB($tree)});



$win-show_all();

Gtk2-main();





#

# Creates the widgets in the application.  Returns the main

# window and tree view.

#

sub createWin

{

   my($win,$scroll,$tree,$model);





   $win=new Gtk2::Window();

   $win-set_default_size(250,300);

   $win-signal_connect(destroy = \Gtk2::main_quit);



   $win-add($scroll=new Gtk2::ScrolledWindow());

   $scroll-add($tree=new Gtk2::TreeView());

   $tree-set_rules_hint(TRUE);



   $tree-insert_column_with_attributes(-1,'Goo',

  new Gtk2::CellRendererText(),text = 0);

   $tree-set_model($model=

  new Gtk2::ListStore('Glib::String'));



   addWord($model) for 0 .. 100;

   showLast($tree);



   return ($win,$tree);

}





#

# Called at regular intervals to add another random word

# to the bottom of the tree view.  If the previous word was

# visible beforehand, scrolls the tree view so the new word

# is visible.

#

sub tickCB

{

   my($tree)=@_;

   my($model)=$tree-get_model();

   my($numRows)=$model-iter_n_children(undef);

   my($lastVis)=($tree-get_visible_range())[1];

   my($mustScroll)=$lastVis 

  $lastVis-get_indices() == $numRows-1;





   addWord($model);

   showLast($tree) if $mustScroll;



   return TRUE;

}





#

# Adds a random word to the bottom of the tree view.

#

sub addWord

{

   my($model)=@_;

   my(@cons)=grep !/[aeiou]/,'a' .. 'z';



   $model-set($model-append(),0,

  $cons[rand @cons] . 'oo');

}





#

# Scrolls the tree view so the last row is visible.

#

sub showLast

{

   my($tree)=@_;

   my($numRows)=$tree-get_model()-iter_n_children(undef);



   $tree-scroll_to_cell(

  new Gtk2::TreePath($numRows-1),undef,TRUE,0.0,1.0);

}

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


RE: Making a cursor (cross hair) track between image displays

2012-04-04 Thread Tilton, James C. (GSFC-6063)
Thanks John,



Your response is very helpful. The one key question that remains for me is:



How do I draw a floating crosshair?



Thanks.


Jim

Dr. James C. TiltonVoice:   
301-286-9510
NASA Goddard Space Flight Center   FAX: 301-286-1776
Mail Code 606.3E-Mail:  
james.c.til...@nasa.govmailto:james.c.til...@nasa.gov
(Computational  Information Sciences and Technology Office)
Greenbelt, MD 20771
URLs:  http://ipp.gsfc.nasa.gov/ft_tech_rhseg.shtm and 
http://science.gsfc.nasa.gov/606.3/TILTON/




-Original Message-
From: jcup...@gmail.com [mailto:jcup...@gmail.com]
Sent: Wednesday, April 04, 2012 4:00 AM
To: Tilton, James C. (GSFC-6063)
Cc: gtk-app-devel-list@gnome.org
Subject: Re: Making a cursor (cross hair) track between image displays



Hi Jim,



On 2 April 2012 17:00, Tilton, James C. (GSFC-6063)

james.c.til...@nasa.gov wrote:

 When I place the cursor in one of the display images, I would like to have a 
 cross hair appear at the cursor location of the window in which the cursor is 
 placed at the location currently pointed to by the cursor. I would ALSO like 
 to have a similar cross hair appear in each of the other associated display 
 images.



Add an event handler to the eventbox and listen for GDK_MOTION_NOTIFY.

You need to use gtk_widget_add_events() and turn on motion events with

GDK_POINTER_MOTION_MASK, gtk will not deliver motion events to windows

by default to try to cut down on unnecessary signalling.



(gtk used to support motion event compression, where it would just

report the most recent position rather than all positions since the

last event delivery, but I think this has been deprecated ... perhaps

an expert knows)



Once you have a motion events, use motion.x and motion.y to get the

mouse position, map this to image space, then map out to the

coordinate space for your other image windows. On those other

displays, draw a floating crosshair at the right spot.



My program does something like this, you're welcome to look at the

source if it might help. Though it's a large, hairy thing and perhaps

not a clear example.



http://www.vips.ecs.soton.ac.uk/index.php?title=VIPS



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


Making a cursor (cross hair) track between image displays

2012-04-02 Thread Tilton, James C. (GSFC-6063)
Hi GTK+ application developers!

I have developed an application using gtkmm in which I display related images 
in multiple Gtk::Window's.

I have two types of display images.  One is based on Gtk::Image and the other 
is based on Gtk::DrawingArea.
For the Gtk::Image case I add the Gtk::Image to a Gtk::EventBox, which in turn 
I add to a Gtk::ScrolledWindow.
For the Gtk::DrawingArea, is directly add the Gtk::DrawingArea to a 
Gtk::ScrolledWindow (without the intervening Gtk::EventBox).

When the image sizes exceed the ScrolledWindow display area, I use the 
Gtk::Adjustment associated with each Gtk::ScrolledWindow to have the 
pan-scrolling of each window track each other.

When I place the cursor in one of the display images, I would like to have a 
cross hair appear at the cursor location of the window in which the cursor is 
placed at the location currently pointed to by the cursor. I would ALSO like to 
have a similar cross hair appear in each of the other associated display images.

How can I make this happen with GTK+/gtkmm? I've looked for examples of this 
and haven't found any. Can anyone point me in the right direction for 
implementing this feature in my application?

(In my current application, the normal arrow cursor appears in just one window, 
and if I hold the either the left or right mouse button down, I have the column 
and row location and image data value(s) appear in text below the Scrolled 
Window image display.)

Thanks.

Jim Tilton

Dr. James C. TiltonVoice:   
301-286-9510
NASA Goddard Space Flight Center   FAX: 301-286-1776
Mail Code 606.3E-Mail:  
james.c.til...@nasa.govmailto:james.c.til...@nasa.gov
(Computational  Information Sciences and Technology Office)
Greenbelt, MD 20771
URLs:  http://ipp.gsfc.nasa.gov/ft_tech_rhseg.shtm and 
http://science.gsfc.nasa.gov/606.3/TILTON/



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


Trouble with TreeView

2012-03-21 Thread James Steward

Hi All,

I've built a TreeModel by creating a new TreeStore, and populating it with;

for (rp = parent; rp; rp = rp-next) {
gtk_tree_store_append(store, iter, NULL);
gtk_tree_store_set(store, iter,
0, rp-number, -1);

for (ep = rp-child; ep; ep = ep-next) {
gtk_tree_store_append(store, child, iter);
gtk_tree_store_set(store, child,
0, ep-number,
1, ep-name,
2, ep-mean,
3, ep-std_dev,
-1);
}
}

Then created a new view, associated the model with it, and inserted columns.

I add the view to a scrolled window, which is in turn added to a dialog 
content area.


When I display the dialog, the tree is not quite what I expect.

In the first row (0), the values for name, mean and std_dev have not 
been defined, yet the mean and std_dev (which are floats) are shown as 
0.00.  I don't want them to be displayed at all.


So to clarify, the first part of the tree looks like

 1 |  |  0.00  |  0.00
  5 |  Fu Bar  |  0.345123  |  0.051234
  3 |  Snafu   |  0.765432  |  0.145678

Is there a way to suppress the display of some columns that don't make 
sense for the parent node, I.e. columns 1, 2, 3 in row 0?


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


An issue with Qt styling and/or threads?

2012-02-17 Thread James Tappin
I have a problem running a Gtk program when using the Qt style as
supplied via gtk-qt-engine and kde-config-gtk-style.

The program is a fairly heavy duty computation that uses openmp for
parallel computation and has a gtk progress monitor (which is updated
from within a critical section so it can never be accessed by more
than one thread at a time). When the Qt style is selected, the
progress bars (gtk_progress_bar) are corrupted and the errors below
are displayed repeatedly:

(th_run:2015): Gdk-CRITICAL **: gdk_pixmap_foreign_new_for_display:
assertion `(anid != 0)' failed

(th_run:2015): Gdk-CRITICAL **: gdk_draw_drawable: assertion
`GDK_IS_DRAWABLE (src)' failed

(th_run:2015): GLib-GObject-CRITICAL **: g_object_unref: assertion
`G_IS_OBJECT (object)' failed
QPixmap: It is not safe to use pixmaps outside the GUI thread
QPixmap: It is not safe to use pixmaps outside the GUI thread
QPainter::begin: Paint device returned engine == 0, type: 2
QPixmap: It is not safe to use pixmaps outside the GUI thread
QPainter::end: Painter not active, aborted

The problem does not occur with other Gtk style settings (e.g. Nuvola).
I'm not sure if the problem is with the Qt wrapper, Gtk+ or my code.

FWIW I'm running Debian stable, with Gtk+ 2.20.

Any ideas?
James
___
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 install pangocairo

2012-02-02 Thread Tilton, James C. (GSFC-6063)
All:

Answered my own question.  The pangocairo option failed to install because I 
did not have fontconfig installed.

Installing fontconfig and reinstallaing cairo with fontconfig available solved 
the problem.

Jim Tilton

From: gtk-i18n-list-boun...@gnome.org [mailto:gtk-i18n-list-boun...@gnome.org] 
On Behalf Of Tilton, James C. (GSFC-6063)
Sent: Wednesday, February 01, 2012 5:23 PM
To: gtk-i18n-list@gnome.org
Subject: How to install pangocairo

I am installing some software that depends upon the pango - and pangocairo 
packages.

I downloaded pango version 1.29.3 and performed the ./configure - make - make 
install sequence with no apparent errors

(Note: I had previously install cairo version 1.10.2, also with no apparent 
errors.)

However, even though it appears that the  pango make built the pangocairo 
module, the make install step did not install it.

How can I force the install of the pangocairo module?

Thanks.

Jim Tilton

Dr. James C. TiltonVoice:   
301-286-9510
NASA Goddard Space Flight Center   FAX: 301-286-1776
Mail Code 606.3E-Mail:  
james.c.til...@nasa.govmailto:james.c.til...@nasa.gov
(Computational  Information Sciences and Technology Office)
Greenbelt, MD 20771
URLs:  http://ipp.gsfc.nasa.gov/ft_tech_rhseg.shtm and 
http://science.gsfc.nasa.gov/606.3/TILTON/

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


How to install pangocairo

2012-02-01 Thread Tilton, James C. (GSFC-6063)
I am installing some software that depends upon the pango - and pangocairo 
packages.

I downloaded pango version 1.29.3 and performed the ./configure - make - make 
install sequence with no apparent errors

(Note: I had previously install cairo version 1.10.2, also with no apparent 
errors.)

However, even though it appears that the  pango make built the pangocairo 
module, the make install step did not install it.

How can I force the install of the pangocairo module?

Thanks.

Jim Tilton

Dr. James C. TiltonVoice:   
301-286-9510
NASA Goddard Space Flight Center   FAX: 301-286-1776
Mail Code 606.3E-Mail:  
james.c.til...@nasa.govmailto:james.c.til...@nasa.gov
(Computational  Information Sciences and Technology Office)
Greenbelt, MD 20771
URLs:  http://ipp.gsfc.nasa.gov/ft_tech_rhseg.shtm and 
http://science.gsfc.nasa.gov/606.3/TILTON/

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


Re: misc and a question...

2011-12-28 Thread James Steward

On 29/12/11 11:05, Gary Kline wrote:


  ... due to people on this list who have been patient and
'splained things ... and who have NOT said: 'go read the man page'
--well, nutshell, in ~ 3 weeks, i'm starting to see how gtk works.

i just learned that TRUE == 1 and not 0.  i haven't used the access()
call in awhile.  i am trying to catch catch errors before they crop
up.

the way i see my application being used, there won't be   any xterms
or konsoles open to print a stderr or stdout.  So: is there a way in
gtk to have a message dialog open that prints warning or whatever to
the new user?


#define eprintf(...) do { \
GtkWidget *dialog; \
dialog = gtk_message_dialog_new ((GtkWindow *)window, \
GTK_DIALOG_DESTROY_WITH_PARENT, \
GTK_MESSAGE_ERROR, \
GTK_BUTTONS_CLOSE, \
__VA_ARGS__); \
gtk_dialog_set_default_response(GTK_DIALOG (dialog), 
GTK_RESPONSE_CLOSE); \
gtk_dialog_run (GTK_DIALOG (dialog)); \
gtk_widget_destroy (dialog); \
} while (0)

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


Re: no luck with dialogs and ecrooolbars, and gtktext..

2011-12-20 Thread James Morris
 n Tue, Dec 20, 2011 at 02:52:10PM -0800, Gary Kline wrote:
         text = gtk_text_view_new();
         gtk_container_add(GTK_CONTAINER(window),text);
         buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
 
 and fopen some file and display the text in the buffer.  The
 question remains: how? what am i missing to display some
 miscellaneous words in the text window?


http://www.gtk.org/documentation.php
___
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 hbox?

2011-12-11 Thread James Tappin
2011/12/11 Gary Kline kl...@thought.org:
        can somebody help me figure out how to pack the buttons
        horizontally, or is is not possible to mix hbox and vbox?

It should be as simple as:
make the vbox
put the various items in it, including the hbox
put the increase  decrease buttons in the hbox.

That certainly works in one of the example codes in gtk-fortran
(hl_containers.f90).

[An alternative might be to use a 2xn table and make most of the items
span 2 columns.]
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Alignment of markup labels in menu items

2011-11-30 Thread James Tappin
I'm trying to add the capability to add a label formatted with Pango
markup to buttons and menu items in the high-level interface to
gtk-fortran.

While the following is successful in producing subscripts in labels
when the markup flag is set, there is a problem with alignment: while
a plain text label is correctly centred in the pulldown menu, a markup
label begins at the centre (even if it does not actually include any
markup).

      if (markup) then
         item=gtk_menu_item_new()
         label_w=gtk_label_new(label)
         call gtk_label_set_markup(label_w, label)
         call gtk_container_add(item,label_w)
      else
         item = gtk_menu_item_new_with_label(label)
      end if

Am I missing something, or is that a fundamental limitation?

I'm using Gtk+-3.2.0, in Ubuntu 11.10, with gcc  gfortran 4.6.1.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Alignment of markup labels in menu items

2011-11-30 Thread James Tappin
On 30 November 2011 11:31, James Tappin jtap...@gmail.com wrote:

 there is a problem with alignment: while
 a plain text label is correctly centred in the pulldown menu, a markup
 label begins at the centre (even if it does not actually include any
 markup).

I should add, the problem does not manifest itself for simple gtk buttons.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gtk_tree_view_column_set_cell_data_func gives GTK-CRITICAL error

2011-11-30 Thread James Steward

On 30/11/11 20:04, Tadej Borovšak wrote:

Hi.

2011/11/30 James Stewardjamesstew...@optusnet.com.au:

col = gtk_tree_view_insert_column_with_attributes (
GTK_TREE_VIEW (view),
-1,
Title,
renderer,
text, i,
strikethrough, j,
background, k,
background-set, TRUE,
NULL);

gtk_tree_view_column_set_cell_data_func(
gtk_tree_view_get_column(GTK_TREE_VIEW(view), col),
renderer,
render_float,
GINT_TO_POINTER(i),
NULL);


IIRC, gtk_tree_view_insert_column_with_attributes() returns number of
columns and gtk_tree_view_get_column() expects to get column number
where first column is 0. So you may be off-by-one in your call to
gtk_tree_view_column_set_cell_data_func().


Well spotted!  Thanks very much.

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

gtk_tree_view_column_set_cell_data_func gives GTK-CRITICAL error

2011-11-29 Thread James Steward

Hi,

Wanting to display floats with a particular format in a tree view.

void render_float(GtkTreeViewColumn *column,
GtkCellRenderer   *renderer,
GtkTreeModel  *model,
GtkTreeIter   *iter,
gpointer   user_data)
{
gfloat  f;
gchar   buf[20];

int col = GPOINTER_TO_INT(user_data);

gtk_tree_model_get(model, iter, col, f, -1);

g_snprintf(buf, sizeof(buf), %.2f, f);

g_object_set(renderer, text, buf, NULL);
}

G_MODULE_EXPORT gboolean on_menu_show_results_activate(
GtkWidget *w,
GdkEvent *event,
gpointer user_data)
{

...

renderer = gtk_cell_renderer_text_new ();

col = gtk_tree_view_insert_column_with_attributes (
GTK_TREE_VIEW (view),
-1,
Title,
renderer,
text, i,
strikethrough, j,
background, k,
background-set, TRUE,
NULL);

gtk_tree_view_column_set_cell_data_func(
gtk_tree_view_get_column(GTK_TREE_VIEW(view), col),
renderer,
render_float,
GINT_TO_POINTER(i),
NULL);
...

}

When I run the app I get:

Gtk-CRITICAL **: gtk_cell_layout_set_cell_data_func: assertion 
`GTK_IS_CELL_LAYOUT (cell_layout)' failed


Can anyone spot what I've done wrong?  There's no compiler warnings, 
just this runtime error.


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


Change in FileChooser behavior

2011-11-11 Thread Tilton, James C. (GSFC-6063)
Hello List,

I recently upgraded GTK+ version 2.24.7 and discovered that the behavior of the 
FileChooser has changed. This change makes FileChooser very inconvenient to use.

Previously, the file selection dialog would automatically show the files in the 
current working directory.
Now, the file selection dialog automatically lists Recently Used files, and 
there is no option to select the current working directory.

Apparently I am setting up my FileChooser incorrectly. How to I set up 
FileChooser so that it provides me with an option to look in the current 
working directory?

I see that there is a member function add_shortcut_folder that I could use to 
add the current working directory as a shortcut folder (but then I would have 
to mess around with C's getcwd() function). But I didn't need to explicitly  
set the current previously. Is it a requirement that I explicitly set it now?  
If so, why was this change made?

It seems this should be a simple thing. What am I missing?

Thanks.

Jim Tilton


Dr. James C. TiltonVoice:   
301-286-9510
NASA Goddard Space Flight Center   FAX: 301-286-1776
Mail Code 606.3E-Mail:  
james.c.til...@nasa.govmailto:james.c.til...@nasa.gov
(Computational  Information Sciences and Technology Office)
Greenbelt, MD 20771
URLs:  http://ipp.gsfc.nasa.gov/ft_tech_rhseg.shtm and 
http://science.gsfc.nasa.gov/606.3/TILTON/

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


Re: 'irregular shaped' windows without deprecated gdk code or compositing

2011-08-01 Thread James Morris
On 31 July 2011 23:24, James Morris jwm.art@gmail.com wrote:
 Hi,

 It appears that the 'irregularly shaped' windows which used to be
 possible by using now-deprecated GDK code even without full
 compositing available, are no longer possible using non-deprecated
 code.

 Using the old deprecated code, a GdkRegion could be created with the
 desired window shape (with the region defining fully transparent and
 fully opaque areas) and a call to gdk_window_shape_combine_region to
 bring it about.

 I've been trying to work around this but feel like a dog running in
 circles chasing my tail.

 gdk_window_shape_combine_region is not deprecated, but GdkRegion will
 be replaced in GTK3.0 with cairo_region_t for which there is no
 gdk_window_shape_combine_region equivalent. Furthermore the
 gdk_region_polygon call necessary to create the GdkRegion of the
 desired shape, is deprecated without replacement.

 So I look into gdk_window_shape_combine_mask instead, but
 gdk_bitmap_create_from_data  is of course deprecated. The docs do at
 least suggest cairo alternatives, but none of which are compatible
 with gdk_window_shape_combine_mask.


I'm just going to start looking into these functions:

cairo_xlib_surface_create_for_bitmap

as they *might* do what I wish.

 Please please tell me if there's anyway around this mess. I can't
 force or assume use of compositing.

 Cheers,
 James.

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


'irregular shaped' windows without deprecated gdk code or compositing

2011-07-31 Thread James Morris
Hi,

It appears that the 'irregularly shaped' windows which used to be
possible by using now-deprecated GDK code even without full
compositing available, are no longer possible using non-deprecated
code.

Using the old deprecated code, a GdkRegion could be created with the
desired window shape (with the region defining fully transparent and
fully opaque areas) and a call to gdk_window_shape_combine_region to
bring it about.

I've been trying to work around this but feel like a dog running in
circles chasing my tail.

gdk_window_shape_combine_region is not deprecated, but GdkRegion will
be replaced in GTK3.0 with cairo_region_t for which there is no
gdk_window_shape_combine_region equivalent. Furthermore the
gdk_region_polygon call necessary to create the GdkRegion of the
desired shape, is deprecated without replacement.

So I look into gdk_window_shape_combine_mask instead, but
gdk_bitmap_create_from_data  is of course deprecated. The docs do at
least suggest cairo alternatives, but none of which are compatible
with gdk_window_shape_combine_mask.

Please please tell me if there's anyway around this mess. I can't
force or assume use of compositing.

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


slightly OT: install IITM multi-lingual editor

2011-07-28 Thread Fred James
OT: install IITM multi-lingual editor on Linux (developed using the GTK 
tool kit and so the GTK library is required for running the editor. The 
current implementation has been tried only under RedHat 6.2 and RedHat 7.2.)


$ uname -a
Linux localhost 2.6.22.19-desktop-2mdv #1 SMP Mon May 5 20:55:05 EDT 
2008 i686 Intel(R) Pentium(R) 4 CPU 1.70GHz GNU/Linux


Install went without error, but upon trying to run the application, 
while I got the expected window (and the GUI appears to respond 
properly...at least superficially, as I haven't tried to do anything as 
yet) I also got the following error messages in the terminal window 
(CLI) ...

$ ./iitmeditor

Gtk-WARNING **: Failed to load module libgail.so: libgail.so: cannot 
open shared object file: No such file or directory


Gtk-WARNING **: Failed to load module libatk-bridge.so: 
libatk-bridge.so: cannot open shared object file: No such file or directory


** WARNING **: Couldn't find pixmap file: new.xpm

** WARNING **: Couldn't find pixmap file: open.xpm

** WARNING **: Couldn't find pixmap file: save.xpm

More detail upon request, of course ... any help or pointers would 
greatly be appreciated ... Thank you

Regards
Fred James

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


Append to list store doesn't get all column attributes

2011-07-27 Thread James
Hi,

(Sorry if this appears twice.  I sent it from the wrong address earlier.)

In a dialog with a scrolled window displaying a list, with one column in
the view, where the cells are editable;

gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view),
-1,
Name,
renderer,
text, 0,
editable, TRUE,
NULL);


A button in the dialog allows the user to add to the list with;

gtk_list_store_append(store, iter);
gtk_list_store_set(store, iter,
0, New,
1, 0, 
-1);

p = gtk_tree_model_get_path(model, iter);
c = gtk_tree_view_get_column(GTK_TREE_VIEW (view), 0);
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW (view), p, NULL, FALSE, 0.0,
0.0);
gtk_tree_view_set_cursor(GTK_TREE_VIEW (view), p, c, TRUE);
gtk_widget_grab_focus (view);

The item New is indeed appended to the list, and it scrolls to the
correct cell, however New is not editable, and no matter what I've
tried, I can't make it editable.

Can anyone offer a clue as to why?

Regards,
James.


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


Re: Append to list store doesn't get all column attributes

2011-07-27 Thread James
On Thu, 2011-07-28 at 07:08 +0200, Florian Müllner wrote:
 Hey,
 
 2011/7/28 James jamesstew...@optusnet.com.au
 In a dialog with a scrolled window displaying a list, with one
 column in
 the view, where the cells are editable;
 
  
 gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW
 (view),
-1,
Name,
renderer,
text, 0,
editable, TRUE,
NULL);
 
  
 This links the text (content) attribute of the tree view column to
 the first column of the model, and the editable attribute to the
 second one (TRUE == 1).

Well, that's embarrassing.  It is so obvious when you point it out.  Can
I claim tired eyes? ;-)

 
 
 A button in the dialog allows the user to add to the list
 with;
 
 gtk_list_store_append(store, iter);
 gtk_list_store_set(store, iter,
0, New,
1, 0,
-1);
 
 Here you add a row with (New, 0) to the list - whatever the
 intention of the second column, the tree view will use it to determine
 whether the cell should be editable, and given that 0 == FALSE, it
 won't be :-)
 
 If you want all cells to be editable, the easiest way is to call
 
   g_object_set (renderer, editable, TRUE, NULL);
 
 when setting up the tree view (assuming that you are using a
 GtkCellRendererText). Of course, changing the gtk_list_store_set()
 call to set the second column to TRUE would work as well ...

Yup, all fixed now.  Thanks, Florian.

Regards,
James.


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

Re: Check if dbus program is running

2011-07-20 Thread Fred James

Kevin Anthony wrote:

Hello
What would be the best way, in C, to check if a dbus program was
running, before i ran a dbus command against it?

  
Lost me ... at the system level, ps -ef (or some similar call) piped to 
grep dbus

   ps -ef | grep dbus | grep -v grep
will probably show several hits ... anywhere near what you are talking 
about?

Regards
Fred James

[fredjame@localhost ~]$ ps -ef | grep dbus | grep -v grep
145631 1  0 01:10 ?00:00:00 dbus-daemon --system
fredjame  7403 1  0 07:52 ?00:00:00 /usr/bin/dbus-launch 
--exit-with-session --sh-syntax
fredjame  7404 1  0 07:52 ?00:00:00 /usr/bin/dbus-daemon 
--fork --print-pid 4 --print-address 8 --session

[fredjame@localhost ~]$
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Making widgets visible outside their containing window

2011-07-13 Thread James Morris
2011/7/13 Felix H. Dahlke f...@ubercode.de:
 Thanks for your answers. I did fool around with a popup, but it would
 also overlap other windows, transient or not. Furthermore, I need it to
 move relative to the window if that is moved.

 Maybe it's best if I tell you what I'm trying to do in particular:
 I'm working on something like a tooltip. However, I don't think I can
 use normal tooltips, since I need to position it manually (actually, I
 need it to move out of the way if the mouse cursor approaches it).

 A popup sounds like the right way to do this, but I need to somehow wire
 the popup's movement to the window's movement. Is there an easy way to
 do that?

Take a look at PHAT fan sliders. These are sliders which
vertical-mouse-movement brings up a fan through which the user gains
more precision in the slider position. The fans are not bounded by any
window the widget is associated with. There might be some pointers in
there for how to do what you want, but note it's unmaintained code by
now, and also contains some deprecated code.

http://phat.berlios.de/

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


gobject and gtk_widget_set_sensitive

2011-07-04 Thread James Morris
Hi,

I have a custom widget I've created which uses widgets from a 3rd
party library. When I use gtk_widget_set_sensitive(my_widget, FALSE),
some of the widgets from the other library remain sensitive.

Is this a bug in the 3rd party library?

Or should I be using a callback to handle the state-changed signal
to set_sensitive on all the widgets?

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


Re: Changing a GtkToolButton icon_widget on the fly

2011-06-22 Thread James Morris
On 22 June 2011 05:43, James jamesstew...@optusnet.com.au wrote:
 Hi,

 I've been trying to change the icon_widget that's displayed for a
 toolbar button while the main window is displayed.  I can't seem to get
 the actual image to change, although the functions that call
 gtk_tool_button_set_icon_widget(0 do get called.  There's no warnings
 either.

 I do something like...

 GtkWidget *eject_widget;
 GtkWidget *eject_red_widget;
 GtkToolButton *eject_button;

 void green(void)
 {
        gtk_tool_button_set_icon_widget(eject_button, eject_widget);
 }

 void red(void)
 {
        gtk_tool_button_set_icon_widget(eject_button, eject_red_widget);
 }


 int main(int argc, char **argv)
 {
 snip
        GtkBuilder *builder;

        builder = gtk_builder_new();
        gtk_builder_add_from_file(builder, stridemaster.xml, NULL);

        eject_widget = GTK_WIDGET(gtk_builder_get_object(builder,
 eject_tracker_image));
        eject_red_widget = GTK_WIDGET(gtk_builder_get_object(builder,
 eject_tracker_red_image));
        eject_button = GTK_TOOL_BUTTON(gtk_builder_get_object(builder,
 toolbutton_eject_tracker));

        g_object_unref(G_OBJECT(builder));

        gtk_widget_show(window);

        gtk_main();

 snip
 }

 What am I missing?

The problem might be to do with floating versus fixed references. GTK
will usually unreference the images once it thinks they're finished
with - ie when you change the icon, it will think you no longer wish
to use the previous icon.

Try calling g_object_ref_sink on all of the widget icons once you've
created them, and then g_object_unref after you're done.

James.



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


Changing a GtkToolButton icon_widget on the fly

2011-06-21 Thread James
Hi,

I've been trying to change the icon_widget that's displayed for a
toolbar button while the main window is displayed.  I can't seem to get
the actual image to change, although the functions that call
gtk_tool_button_set_icon_widget(0 do get called.  There's no warnings
either.

I do something like...

GtkWidget *eject_widget;
GtkWidget *eject_red_widget;
GtkToolButton *eject_button;

void green(void)
{
gtk_tool_button_set_icon_widget(eject_button, eject_widget);
}

void red(void)
{
gtk_tool_button_set_icon_widget(eject_button, eject_red_widget);
}


int main(int argc, char **argv)
{
snip
GtkBuilder *builder;

builder = gtk_builder_new();
gtk_builder_add_from_file(builder, stridemaster.xml, NULL);

eject_widget = GTK_WIDGET(gtk_builder_get_object(builder,
eject_tracker_image));
eject_red_widget = GTK_WIDGET(gtk_builder_get_object(builder,
eject_tracker_red_image));
eject_button = GTK_TOOL_BUTTON(gtk_builder_get_object(builder,
toolbutton_eject_tracker));

g_object_unref(G_OBJECT(builder));

gtk_widget_show(window);

gtk_main();

snip
}

What am I missing?

Regards,
James.

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


Re: Cairo, Gtk+, Gdk GdkPixbuf -- making a pixel-based backing store for vector graphics

2011-06-17 Thread James Tappin
Just to let folks know that the pointers here have given me the lead
in that I needed and I've got a working code. (A bit more elegant in
the Gtk3 case than Gtk2 but both work).
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Cairo, Gtk+, Gdk GdkPixbuf -- making a pixel-based backing store for vector graphics

2011-06-14 Thread James Tappin
I would like to be able to make a code that draws some (possibly very
complex) vector graphics, copies it to an off-screen backing store and
then when an expose-event (Gtk2) or draw signal (Gtk3) is received,
the backing store is copied to the screen rather than doing a complete
redraw of all the vectors which could potentially take several
seconds. Unfortunately all the potential model codes I've been able to
find use the obsolete Gdk Pixmap as backing store.

Likewise the routine that looks promising
gdk_pixbuf_render_to_drawable () is marked as deprecated (since 2.4)
and suggests gdk_draw_pixbuf () as an alternative. However that is
also marked deprecated (since 2.22) and recommends
gdk_cairo_set_source_pixbuf() and cairo_paint() or cairo_rectangle()
and cairo_fill() but it is not at all clear how to combine those
routines to produce the required effect.

I have searched many times for suitable examples and come up empty. So
does anybody here have any suggestions, examples or link that provide
pointers to the following operations?:

1) Getting cairo to draw to a pixmap or pixbuf, or draw to a window
and then copy the resulting window contents to an in-memory storage.

2) Making the expose handler copy that pixbuf (or whatever) to the
visible window (while only copying the affected region  would be the
best option I can live with copying the whole window).

3) (Less important for now) Adding new material to the plot and
updating the backing store -- my guess is that once I crack 1  2 then
3 will be fairly obvious.

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


Re: Cairo, Gtk+, Gdk GdkPixbuf -- making a pixel-based backing store for vector graphics

2011-06-14 Thread James Tappin
On 14 June 2011 15:00, Stefan Salewski m...@ssalewski.de wrote:
 On Tue, 2011-06-14 at 14:30 -0600, James Tappin wrote:
 I would like to be able to make a code that draws some (possibly very
 complex) vector graphics,

 A better place for asking may be the cairo mailing list? At least there
 was some discussion about such tasks in the past. One recommended way
 was using cairos create_similar() function for creating the backup
 surface. I did a small demo in Ruby some time ago, see

 http://www.ssalewski.de/PetEd-Demo.html.en

 I found this related thread with some helpful replies:

 http://lists.freedesktop.org/archives/cairo/2009-March/016756.html



It looks as if this example:
http://www.gtkforums.com/viewtopic.php?t=5204, may at least provide
part of the answer to (1) in my original posting -- I'm still trying
to disentangle the housekeeping and the real logic, to figure exactly
what it does.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Maximize on Windows 7 seems broken.

2011-05-12 Thread James Steward

On 11/05/2011 8:07 AM, James Steward wrote:

Hi,

I'm developing on Windows 7, 64 bit, using MinGW/MSYS for familiarity
with a Posix type system.

I have installed gtk+-bundle_2.22.1-20101227_win32.zip, and building a
32bit app for compatibility.

My application calls gtk_window_maximize(GTK_WINDOW(window)); but the
resulting window is not maximized properly. It sits below the top of
the screen, and is cut off at the bottom of the screen.

Also, restoring the window, then dragging to the top of the screen to
allow Bill to maximize it results in the same.

Running on an XP machine, the maximize works fine, as it does on Linux.

Is this a known Windows 7 (possibly also Vista) problem with GTK+ apps?
Is there a fix?

I've googled around, but not hit on any solutions yet.


I have a v small test case.  Can I attach it here?  Let's find out...

I also have a screenshot if anyone is interested.

Regards,
James.

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

Re: Maximize on Windows 7 seems broken.

2011-05-12 Thread James Steward

On 13/05/2011 8:03 AM, James Steward wrote:

On 11/05/2011 8:07 AM, James Steward wrote:

Hi,

I'm developing on Windows 7, 64 bit, using MinGW/MSYS for familiarity
with a Posix type system.

I have installed gtk+-bundle_2.22.1-20101227_win32.zip, and building a
32bit app for compatibility.

My application calls gtk_window_maximize(GTK_WINDOW(window)); but the
resulting window is not maximized properly. It sits below the top of
the screen, and is cut off at the bottom of the screen.

Also, restoring the window, then dragging to the top of the screen to
allow Bill to maximize it results in the same.

Running on an XP machine, the maximize works fine, as it does on Linux.

Is this a known Windows 7 (possibly also Vista) problem with GTK+ apps?
Is there a fix?

I've googled around, but not hit on any solutions yet.


I have a v small test case.  Can I attach it here?  Let's find out...

I also have a screenshot if anyone is interested.


Well, that didn't seem to work very well.  In the meantime I've found 
the answer.  I had these properties set on the main window.

property name=window_positioncenter-always/property
property name=default_width1024/property

Removing them and the window maximizes properly.  The hint came from bug 
https://bugzilla.gnome.org/show_bug.cgi?id=587591 .   Hope this helps 
someone else.


Regards,
James.

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


GdkEvent question (is it a bug?)

2011-05-11 Thread James Tappin
While working on a script to convert the GdkEvent structures to
Fortran derived types for the GtkFortran project I came across the
following

struct _GdkEventClient
{
  GdkEventType type;
  GdkWindow *window;
  gint8 send_event;
  GdkAtom message_type;
  gushort data_format;
  union {
char b[20];
short s[10];
long l[5];
  } data;
};

This looks to me like a 32-bit-specific construct as (a) there's no
int type and (b) on a 64-bit system the long tag in the union will be
twice as long as the short  char tags, should this be regarded as a
bug?

Also, since Fortran's iso_c_binding does not have any support for
unions so any attempt to include this will be at best a kludge, is
this an important event ?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Maximize on Windows 7 seems broken.

2011-05-10 Thread James Steward

Hi,

I'm developing on Windows 7, 64 bit, using MinGW/MSYS for familiarity
with a Posix type system.

I have installed gtk+-bundle_2.22.1-20101227_win32.zip, and building a 
32bit app for compatibility.


My application calls gtk_window_maximize(GTK_WINDOW(window)); but the
resulting window is not maximized properly. It sits below the top of
the screen, and is cut off at the bottom of the screen.

Also, restoring the window, then dragging to the top of the screen to
allow Bill to maximize it results in the same.

Running on an XP machine, the maximize works fine, as it does on Linux.

Is this a known Windows 7 (possibly also Vista) problem with GTK+ apps?
Is there a fix?

I've googled around, but not hit on any solutions yet.

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


Re: Maximize on Windows 7 seems broken.

2011-05-10 Thread James Steward

On 11/05/2011 8:19 AM, Matteo Landi wrote:

On Wed, May 11, 2011 at 12:07 AM, James Steward
jamesstew...@optusnet.com.au  wrote:

Hi,

I'm developing on Windows 7, 64 bit, using MinGW/MSYS for familiarity
with a Posix type system.

I have installed gtk+-bundle_2.22.1-20101227_win32.zip, and building a 32bit
app for compatibility.

My application calls gtk_window_maximize(GTK_WINDOW(window)); but the
resulting window is not maximized properly. It sits below the top of
the screen, and is cut off at the bottom of the screen.

Also, restoring the window, then dragging to the top of the screen to
allow Bill to maximize it results in the same.

Running on an XP machine, the maximize works fine, as it does on Linux.

Is this a known Windows 7 (possibly also Vista) problem with GTK+ apps?
Is there a fix?

I've googled around, but not hit on any solutions yet.

Is it maybe a problem with the window manager? I had problem trying to
raise a window up if covered.
Just guessing...


Whether a problem with Bill's window manager or not, there must be a 
solution from Gtk.


JS.

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


Basic GStreamer level example converted from C

2011-04-19 Thread James Bromberger
Hello all,

I'm trying to convert into Perl the given C example of the level
element (using a message) found at:
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-level.html

Trivial, right? I'm using Debian/unstable, so GStreamer 0.15-2 (amd64
build) - nothing very bizzare. 42 lines of code that should be printing
out an RMS level from testaudiosrc for each channel every second:

#!/usr/bin/perl
use strict;
use warnings;
use GStreamer -init;

my $loop = Glib::MainLoop-new;

my $pipeline = GStreamer::Pipeline-new(sample);
my $caps = GStreamer::Caps-from_string(audio/x-raw-int,channels=2);

my $testsrc = GStreamer::ElementFactory-make(audiotestsrc, src);
my $convert = GStreamer::ElementFactory-make(audioconvert,
convert);
my $level = GStreamer::ElementFactory-make(level, level);
my $sink = GStreamer::ElementFactory-make(fakesink, sink);

$pipeline-add($testsrc, $convert, $level, $sink);
$testsrc-link($convert);
$convert-link_filtered($level, $caps);
$level-link($sink);

$level-set(message, 1);
$level-set(interval, 10); # 1 second interval
$pipeline-get_bus-add_watch(\hdl_level, $loop);
$pipeline-set_state(playing);

$loop-run;
$pipeline-set_state(null);
exit;

sub hdl_level {
  my ($bus, $message, $loop) = @_;
  printf Got message: %s\n, $message-type;
  return unless $message-type eq element;
  my $structure = $message-get_structure;
  my $name = $structure-get_name;
  return unless $name eq level;
  my @rms = $structure-get_value(rms);
  foreach (@rms) {
print RMS: $_\n;
  }
  return 1;
}


And my output is:

Got message: [ unknown state-changed ]
Use of uninitialized value in subroutine entry at ./simple.pl line 26.

So 1st line is fine, I know the handler callback is registered; but
what's uninitalized (at the run() call) and why isn't it printing the
RMS output? I can;t see what I've missed from the C example here

Many thanks,

  James

-- 
Email: james_AT_rcpt.to

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


gtk_tree_view_column query.

2011-03-17 Thread James Tappin
Hello,
  I'm working on some aspects of gtk-fortran (an interface of GTK+ to
Fortran95/2003), and so need to implement things without using varargs
routines. However I'm getting unexpected behaviours. I don't think the
problem is in the Fortran interface as I can reproduce the errors in
C-examples.

The first is in setting up the column attributes, the original C code was:

  column = gtk_tree_view_column_new_with_attributes(#, renderer,
  text, 0, NULL);

Which if I interpret the manual correctly ought to be replaceable by:
column = gtk_tree_view_column_new();
gtk_tree_view_column_set_title(column, #);
gtk_tree_view_column_add_attribute(column, renderer, 
  text, 0);

But the latter gives an assertion error:
(list1:6044): Gtk-CRITICAL **:
gtk_tree_view_column_cell_layout_add_attribute: assertion `info !=
NULL' failed


The second comes when trying to add a value to a column, the original was:
gtk_list_store_set(store,iter, 0, nrow, -1); /* The index column */

Which (again if I'm interpreting the manual right) should be equivalent to:
gtk_list_store_set_value(store, iter, 0, (Gvalue *) nrow);

but instead the latter gives a segfault
0x755effc9 in type_check_is_value_type_U (value=0x7fffdcac)
at /build/buildd/glib2.0-2.26.1/gobject/gtype.c:4073


Does anybody see a grave error in interpreting the manual or is there
a real problem with some of these routines?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gtk_tree_view_column query.

2011-03-17 Thread James Tappin
On 17 March 2011 15:55, James Tappin jtap...@gmail.com wrote:
 Hello,
  I'm working on some aspects of gtk-fortran (an interface of GTK+ to
 Fortran95/2003), and so need to implement things without using varargs
 routines. However I'm getting unexpected behaviours. I don't think the
 problem is in the Fortran interface as I can reproduce the errors in
 C-examples.

I should have added: I'm running 64-bit Linux and using gcc
___
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 make the toolbar button flashing

2011-03-01 Thread James Morris
On 1 March 2011 08:20, Miroslav Rajcic raj...@sokrates.hr wrote:
 I am trying to make the Pause button flash (or show any similar behaviour
 similar to that) when the pause state is active.
 So far I tried many things, but none of these seem to work:
 - changing the button background color
 - changing the button stock icon


Alternating between two different stock items is quite easy when you
know how, but I had to ask here for help.
If you have two images,

--8---
img1 = gtk_image_new_from_stock( GTK_STOCK_MEDIA_PLAY,
GTK_ICON_SIZE_SMALL_TOOLBAR);
img2 = gtk_image_new_from_stock( GTK_STOCK_MEDIA_STOP,
GTK_ICON_SIZE_SMALL_TOOLBAR);

 /* convert img1 and img2 from floating references which
are deleted when no longer in use, to a normal reference.
this prevents either of the images being deleted when we
swap the play/stop button images. unref'd after gtk_main.
*/
g_object_ref_sink(img1);
g_object_ref_sink(img2);
--8---

then in your idle callback simply use gtk_button_set_image,
alternating between the two images every time the function is called
(ie you could use a static gboolean to track which button to show each
time).

then once gtk_main returns:
--8---
gtk_main();

/* free the play  stop images */
g_object_unref(img1);
g_object_unref(img2);
--8---




http://github.com/jwm-art-net/BoxySeq/blob/master/boxyseq_gui/gui_main.c









 - changing the button relief style

 Relevant code is following:

 //start timer to alternate the button state
 nBlinkButtonTimerID  = g_timeout_add (900, flash_pause_button_timer, NULL);

 gboolean flash_pause_button_timer(gpointer data)
 {
 static bool bFlipFlop = false;
 bFlipFlop = !bFlipFlop;

 //get pointers to the relevant buttons
 GtkToolbar *toolbar2 = (GtkToolbar *)lookup_widget(window1, toolbar2);
 GtkWidget *tool_pause = (GtkWidget *)gtk_toolbar_get_nth_item(toolbar2, 2);
 GList *children1 = gtk_container_get_children(GTK_CONTAINER(tool_pause));
 GtkButton *button = (GtkButton *)g_list_nth_data (children1, 0);
 g_list_free(children1);
 GtkWidget *tool_stop = (GtkWidget *)gtk_toolbar_get_nth_item(toolbar2, 1);

 //create two alternating colors (standard bkg and black bkg)
 GtkStyle* style = gtk_rc_get_style(tool_stop);
 GdkColor rgbStart = style-bg[GTK_STATE_NORMAL];
 GdkColor rgbEnd = { 0, 0, 0, 0 };

 //modify color
 gtk_widget_modify_bg (GTK_WIDGET(button), GTK_STATE_NORMAL, (bFlipFlop)?
 rgbEnd : rgbStart);
 gtk_widget_modify_bg (GTK_WIDGET(button), GTK_STATE_ACTIVE, (bFlipFlop)?
 rgbEnd : rgbStart);
 gtk_widget_modify_base (GTK_WIDGET(button), GTK_STATE_NORMAL, (bFlipFlop)?
 rgbEnd : rgbStart);
 gtk_widget_modify_base (GTK_WIDGET(button), GTK_STATE_ACTIVE, (bFlipFlop)?
 rgbEnd : rgbStart);
 gtk_widget_queue_draw (GTK_WIDGET(button));
 #if GTK_CHECK_VERSION(2,18,0)
 gdk_window_process_updates (gtk_widget_get_window(GTK_WIDGET(button)),
 TRUE);
 #else
 gdk_window_process_updates (GTK_WIDGET(button)-window, TRUE);
 #endif

 /*
 GtkWidget *w1 =
 gtk_tool_button_get_icon_widget(GTK_TOOL_BUTTON(tool_pause));
 gtk_widget_modify_bg (w1, GTK_STATE_NORMAL, (bFlipFlop)? rgbEnd :
 rgbStart);
 gtk_widget_modify_bg (w1, GTK_STATE_ACTIVE, (bFlipFlop)? rgbEnd :
 rgbStart);
 gtk_widget_modify_base (w1, GTK_STATE_NORMAL, (bFlipFlop)? rgbEnd :
 rgbStart);
 gtk_widget_modify_base (w1, GTK_STATE_ACTIVE, (bFlipFlop)? rgbEnd :
 rgbStart);
 */

 //modify relief style
 gtk_button_set_relief(button, (bFlipFlop)?
 GTK_RELIEF_NORMAL:GTK_RELIEF_NONE);

 //modify stock icon
 gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(tool_pause), (bFlipFlop)?
 GTK_STOCK_MEDIA_PAUSE : GTK_STOCK_MEDIA_RECORD);

 gtk_tool_item_toolbar_reconfigured (GTK_TOOL_ITEM(tool_pause));

 return TRUE;
 }

 Why doesn't any of these work ? Any tips ?
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




-- 
_
: http://jwm-art.net/
-audio/image/text/code/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: g_remove

2011-02-17 Thread James Morris
On 17 February 2011 12:27, Craig Bakalian craigbakal...@verizon.net wrote:
 Hi,

 I am using g_remove to remove some temporary files from the /tmp folder.
 It is working as expected.  Yet, gcc is complaining that I am making an
 implicit declaration.  What is up with this?

You've not #include-ed the necessary files?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: adding button events to a gtkdrawingarea based gobject

2011-02-15 Thread James Morris
On 14 February 2011 13:20, James Morris jwm.art@gmail.com wrote:
 Hi,

 (forgive some imprecise names here, am writing from memory and in a
 rush before work)

 I'm adapting some code which uses gobject to create a widget. The code
 previously used GtkWidget as the parent_class but I am trying to adapt
 it to GtkDrawingArea as the parent_class.

 However, the button_press_event code is no longer activated within the
 custom widget now that it's a drawing area. How do I activate it?

 I know with an ordinary GtkDrawingArea if I want to add
 button-press-events to use gtk_add_events, but the code that uses the
 custom widget shouldn't need to do this and besides the widget needs
 to connect to it's own internal private implementation code anyway so
 gtk_add_events is obviously wrong.

 Can anyone provide some pointers please?

Yes James, just add the call to gtk_widget_add_events into the
yourwidget_init function.

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


adding button events to a gtkdrawingarea based gobject

2011-02-14 Thread James Morris
Hi,

(forgive some imprecise names here, am writing from memory and in a
rush before work)

I'm adapting some code which uses gobject to create a widget. The code
previously used GtkWidget as the parent_class but I am trying to adapt
it to GtkDrawingArea as the parent_class.

However, the button_press_event code is no longer activated within the
custom widget now that it's a drawing area. How do I activate it?

I know with an ordinary GtkDrawingArea if I want to add
button-press-events to use gtk_add_events, but the code that uses the
custom widget shouldn't need to do this and besides the widget needs
to connect to it's own internal private implementation code anyway so
gtk_add_events is obviously wrong.

Can anyone provide some pointers please?

Thanks,
James.
___
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 James Morris
On 9 February 2011 11:13, Tor Lillqvist t...@iki.fi wrote:

 With the right tool there is no problem at all in finding such true
 leaks.

How does one gain this mysterious tool for Linux?

I have used Valgrind but as mentioned by numerous souls at numerous
times in the past, a suppressions file is needed for GTK/GLIB. And
creating a suppressions file is more work than actually writing the
code of the program I'm trying to debug in the first place is.


james.
___
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 James Morris
On 9 February 2011 16:10, Michael Cronenworth m...@cchtml.com wrote:
 James Morris wrote:

 How does one gain this mysterious tool for Linux?

 It's called Google. There's a web page[1] that details how to setup valgrind
 to debug gtk/glib apps and even a preliminary suppression file.

 [1] http://live.gnome.org/Valgrind

That's called patronising. I have been there already. What good is a
work in progress when the progress stopped over two years ago?

Not only do we have to write our own code, we have to put work into
making other peoples code ignore the errors in other peoples code so
we can see the errors in our own code. It's a bloody outrage!
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


  1   2   3   4   5   >