[Gambas-user] mutex applications

2012-06-06 Thread Bruce
I have been mucking around with this for about a year now and haven't
found a solution.

We have a few gambas applications that are treated as pop-ups by the
users.  That is, they click on some type of launcher (be it a desktop
item, a menu item or in our case a wbar icon) and the application
starts.
Then they minimize it, or go to another desktop, or any other way to
hide the application window.
Then they relaunch it...

... and get another instance running.

However, sort of like things like Evolution, we only want to have one
copy of these applications running.  So we need some sort of mutex
checker that ensures that they can only run one instance of the
application.

So far, I have found that I can use gb.desktop to detect another
instance via the window title and just exit gracefully with a Another
instance of xxx is running message.

Blah!

That doesn't really do what I want.  What I want (what I really, really
want) is a way to activate the window found and then exit.

Any clues?

regards 
Bruce


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] mutex applications

2012-06-06 Thread Benoît Minisini
Le 06/06/2012 11:18, Bruce a écrit :
 I have been mucking around with this for about a year now and haven't
 found a solution.

 We have a few gambas applications that are treated as pop-ups by the
 users.  That is, they click on some type of launcher (be it a desktop
 item, a menu item or in our case a wbar icon) and the application
 starts.
 Then they minimize it, or go to another desktop, or any other way to
 hide the application window.
 Then they relaunch it...

 ... and get another instance running.

 However, sort of like things like Evolution, we only want to have one
 copy of these applications running.  So we need some sort of mutex
 checker that ensures that they can only run one instance of the
 application.

 So far, I have found that I can use gb.desktop to detect another
 instance via the window title and just exit gracefully with a Another
 instance of xxx is running message.

 Blah!

 That doesn't really do what I want.  What I want (what I really, really
 want) is a way to activate the window found and then exit.

 Any clues?

 regards
 Bruce


AFAIK, this is now done through D-Bus on Linux desktop. But you must 
investigate how exactly, as I didn't look at it yet.

The idea should be the following:

1) Register on the D-Bus with an unique name.

2) If it works, then export a class on the D-Bus with a method that 
activates yourself and eventually opens a specific document.

3) If it does not works, find the application that has registered on the 
bus, and use its method defined in 2) to activate it, and eventually ask 
it to open a new document.

Regards,

-- 
Benoît Minisini

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] mutex applications

2012-06-06 Thread Rolf-Werner Eilert
Am 06.06.2012 11:18, schrieb Bruce:
 I have been mucking around with this for about a year now and haven't
 found a solution.

 We have a few gambas applications that are treated as pop-ups by the
 users.  That is, they click on some type of launcher (be it a desktop
 item, a menu item or in our case a wbar icon) and the application
 starts.
 Then they minimize it, or go to another desktop, or any other way to
 hide the application window.
 Then they relaunch it...

 ... and get another instance running.

 However, sort of like things like Evolution, we only want to have one
 copy of these applications running.  So we need some sort of mutex
 checker that ensures that they can only run one instance of the
 application.

 So far, I have found that I can use gb.desktop to detect another
 instance via the window title and just exit gracefully with a Another
 instance of xxx is running message.

 Blah!

 That doesn't really do what I want.  What I want (what I really, really
 want) is a way to activate the window found and then exit.

 Any clues?

 regards
 Bruce

Hi Bruce,

I have successfully used this code which is from Jussi Lahtinen. I built 
it into two of my applications, and it works reliably, at least under 
Gambas2 on our somewhat older system:

PUBLIC SUB Form_Open()
DIM sOutput AS String

   EXEC [pgrep, -f, -l, -u, System.User.Name, Stein3.gambas] 
WAIT TO sOutput

   IF Split(Trim$(sOutput), gb.NewLine).Count  1 THEN
 QUIT
   ENDIF

Just replace Stein3 by your binary's name.

Regards

Rolf

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] Gridview keypress question

2012-06-06 Thread Richard Terry
Hi List,

I've got a grid with several columns.

If I use the arrow keys, then the grid focus moves up/down or to the 
next/previous column.

I want to over-ride this keypress behaviour, but can't manage it.

If iI even try and detect a keypress n this event, nothing happens

public Sub  Gridview1_Keypress()

 print key.code

end

I''ve looked at the properties and can't seem to find one which will 
allow me to over-ride this behaviour.
Probably something dumb I'm not seeing.

Any help appreciated.

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Gridview keypress question

2012-06-06 Thread Bruce
On Wed, 2012-06-06 at 21:29 +1000, Richard Terry wrote:
 public Sub  Gridview1_Keypress()
 
  print key.code
 
 end 

Quick guess.  lookup STOP EVENT.

Not really sure ( I'm busy on the other thing).
hth
Bruce


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Gridview keypress question

2012-06-06 Thread Richard Terry
Bruce wrote:
 On Wed, 2012-06-06 at 21:29 +1000, Richard Terry wrote:
   
 public Sub  Gridview1_Keypress()

  print key.code

 end 
 

 Quick guess.  lookup STOP EVENT.

 Not really sure ( I'm busy on the other thing).
 hth
 Bruce

   
Tried that, anyway, just experimented after my last post

Seems that everytime you hit an up/down/right/left arrow in the grid, 
the gridview1_select event is triggered and I guess if you could see 
what was happening, the next column would be moved to (my grid I've 
constructed to effectively look like and behave like a columnview, so I 
couldn't see that).

To effectively capture the key.code = key.right (or equivalent of this), 
I just put a if gridview1.column  0 then .

Not elegant, but it does what I wanted.

Must be a better way.

Regards

richard

 --
 Live Security Virtual Conference
 Exclusive live event will cover all the ways today's security and 
 threat landscape has changed and how IT managers can respond. Discussions 
 will include endpoint security, mobile security and the latest in malware 
 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user

   

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] mutex applications

2012-06-06 Thread Bruce
On Wed, 2012-06-06 at 12:38 +0200, Rolf-Werner Eilert wrote:

 Hi Bruce,
 
 I have successfully used this code which is from Jussi Lahtinen. I built 
 it into two of my applications, and it works reliably, at least under 
 Gambas2 on our somewhat older system:
 
 PUBLIC SUB Form_Open()
 DIM sOutput AS String
 
EXEC [pgrep, -f, -l, -u, System.User.Name, Stein3.gambas] 
 WAIT TO sOutput
 
IF Split(Trim$(sOutput), gb.NewLine).Count  1 THEN
  QUIT
ENDIF
 
 Just replace Stein3 by your binary's name.
 
 Regards
 
 Rolf


Nice! A lot quicker than using gb.Desktop.


Sadly!
It doesn't solve the problem of activating the desired window.

And there is a slight weird, it doesn't detect an instance that is
running via the IDE.  No idea, but don't really care much, that's not
the problem.

Ah well, back to Benoit's dbus suggestion.  Oh, how I hate having to
learn these new techo things.

Back tomorrow.

regards
Bruce  
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] mutex applications

2012-06-06 Thread Benoît Minisini
Le 06/06/2012 14:32, tobi a écrit :
 On Wed, 06 Jun 2012, Bruce wrote:
 On Wed, 2012-06-06 at 12:38 +0200, Rolf-Werner Eilert wrote:

 Hi Bruce,

 I have successfully used this code which is from Jussi Lahtinen. I built
 it into two of my applications, and it works reliably, at least under
 Gambas2 on our somewhat older system:

 PUBLIC SUB Form_Open()
 DIM sOutput AS String

 EXEC [pgrep, -f, -l, -u, System.User.Name, Stein3.gambas]
 WAIT TO sOutput

 IF Split(Trim$(sOutput), gb.NewLine).Count  1 THEN
   QUIT
 ENDIF

 Just replace Stein3 by your binary's name.

 Regards

 Rolf


 Nice! A lot quicker than using gb.Desktop.


 Sadly!
 It doesn't solve the problem of activating the desired window.

 And there is a slight weird, it doesn't detect an instance that is
 running via the IDE.  No idea, but don't really care much, that's not
 the problem.

 Ah well, back to Benoit's dbus suggestion.  Oh, how I hate having to
 learn these new techo things.

 Back tomorrow.

 regards
 Bruce

The good solution is using D-Bus. It is not very difficult actually.

As soon as I have time I will try to make a Gambas function in the 
gb.dbus component so that you can create unique application as simply 
as possible.

Regards,

-- 
Benoît Minisini

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] Configuration issue with gb.desktop

2012-06-06 Thread tobi
Hi,

I just moved to a new machine and tried to compile gambas3 again. On make, I 
get with gb.desktop:

make[5]: Entering directory `/home/woodap/sources/gambas3/gb.desktop/src'
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  
-D_REENTRANT   -pipe
-Wall -Wno-unused-value -fsigned-char -fvisibility=hidden -g -ggdb -Os  -MT 
gb_desktop_la-main.lo
-MD -MP -MF .deps/gb_desktop_la-main.Tpo -c -o gb_desktop_la-main.lo `test -f 
'main.c' || echo
'./'`main.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -D_REENTRANT -pipe -Wall 
-Wno-unused-value
-fsigned-char -fvisibility=hidden -g -ggdb -Os -MT gb_desktop_la-main.lo -MD 
-MP -MF
.deps/gb_desktop_la-main.Tpo -c main.c  -fPIC -DPIC -o 
.libs/gb_desktop_la-main.o
In file included from main.c:26:0:
x11.h:27:22: fatal error: X11/Xlib.h: No such file or directory
compilation terminated.

Yes! I never had any X on this machine (unlike on the old one where everything 
got compiled).
Shouldn't the component be disabled by the configure script when required 
headers are not found?

Regards,
Tobi

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Problems building Gambas3 on Mageia2

2012-06-06 Thread Matteo Pasotti
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 06/06/2012 02:42, RICHARD WALKER wrote:
 The long preparation, configuring making and installing of Gambas 
 3.1.90, revision #4809 I think, completed without apparent error.
 
 Part of the preparation was to fetch the Mageia 2 Gambas 3 (sounds 
 like a football score) source rpm (version 3.1.1) and install it
 so that I could (1) get any of the missing build requirements, and
 (2) test build to check the environment. The rpm rebuild was
 trouble-free and all have been installed. So far, so good.
 
 I have uninstalled the 3.1.1 packages and done the reconf-all, 
 configure, make bit. This took several hours, with a two hour car 
 journey in the middle, but from shaky memory the only advisories I
 got were about jit and gnome desktop not being built.
 
 When it came to installing everything I was belatedly advised that 
 several components were missing: gb.qt4 gb.qt4.opengl gb.xml.rpc 
 gb.xml gb.xml.rpc gb.xml.rpc gb.xml.rpc
 
 Probably as a consequence, I could not get anything to work; ide, 
 previously built gambas projects, no menu entries, that sort of
 thing.
 
 So I was wondering, are there some new requirements for building
 the current Gambas 3 over and above those which are used to build
 version 3.1.1?
 
 Richard
 
 --

 
Live Security Virtual Conference
 Exclusive live event will cover all the ways today's security and 
 threat landscape has changed and how IT managers can respond.
 Discussions will include endpoint security, mobile security and the
 latest in malware threats.
 http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ 
 ___ Gambas-user mailing
 list Gambas-user@lists.sourceforge.net 
 https://lists.sourceforge.net/lists/listinfo/gambas-user

Hi Richard,
there's http://gambasdoc.org/help/install/mageia?v3 to know how to
build gambas3 on Mageia.
Two devel packages was missing: gsl-devel and qtwebkit-devel, now it
should be almost complete.
Let us know if something is missing.
Regards
- -- 
Matteo
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPz86fAAoJED3LowjDDWbNMj4IAK1Pc09YfrLFDjol0eYTJFrO
ScZKIufR4weimlh5QZauxkvEerTPd8Ul7r0K/e7w4tmBAkVOblEi7jzEQ/sNfuRG
YZsxy9sBIejkSu0bl6vxF7bRcfXpVhLC+NH8Bupl+96qVtrOsxeOf1dJZmjM7iMF
vyV2d7jof/4JfLFoDqIVigZ/bNEHXjSZUXwy2ELvEQYvGxbDmgPcYHYNAPysZ4CP
WY0jfD5/0aPeZtPzhrQxltH/W9NsHuWjAX5pezSECJOJ3Nrx7LobGeGJ54ms/GCD
EWg3KNGg027P1BRxUzCbEuw0BOM4ChwvhB5FVcTVzW8R91Fge9LaUDNPawp4JgY=
=an2s
-END PGP SIGNATURE-

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Problems building Gambas3 on Mageia2

2012-06-06 Thread RICHARD WALKER
On 06/06/2012, Matteo Pasotti matteo.paso...@gmail.com wrote:
 there's http://gambasdoc.org/help/install/mageia?v3 to know how to
 build gambas3 on Mageia.
 Two devel packages was missing: gsl-devel and qtwebkit-devel, now it
 should be almost complete.
 Let us know if something is missing.

I used that page to compare with the buildrequires in the mga2 source
rpm for Gambas 3.1.1.
There are quite a few differences, but as I already had executed urpmi
--buildrequires [...].mga2.rpm the two libraries you mention were
indeed already installed.

My difficulty is in building revision #4809, or rather, it builds
without obvious fault and then makes a mess of the install. My latest
result is an apparently faultless install (don't ask how I achieved
that, I thought I was repeating a known failing method) but still no
obvious evidence that Gambas 3 is really there. There is nothing in
the menu, desktop shortcuts to the ide and to a few pre-compiled
Gambas 3 projects produce no visible result and executing gambas3 in a
console produces the strangest error message:

[richard@Bathtub gambas3-sources]$ gambas3
gbr3: no project file in '/usr/bin/gambas3'.

I have reached tether's end with this one. I had just decided to
update from subversion again when I saw your reply. My intention was
to check out a fix for a bug on xinerama screens which Benoît had
committed in revision #4808. The Big Plan was to analyse the fix and
see if I could derive a patch to apply to MGA2's version 3.1.1, and
then submit that to the maintainer so I could go on using stock Mageia
packages for Gambas (I know my brother would benefit from the fix
too).

So, if you have no startling insight into why the built gb.qt4 and
gb.xml stuff is not installing (every time) and why the installed
gambas3 is babbling on about a Gambas project file being missing, then
I think I will dump this revision and try tonight's available
offering.

I might sound grumpy, but I am actually having fun!

Richard

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] mutex applications

2012-06-06 Thread nando
I'd like to suggest a form property called 'Singleton'
when _new or _init is called (whichever creates the object)
then it will not create a second and only
return the first instance of it.  Somewhat like a module.


-- Original Message ---
From: Benoît Minisini gam...@users.sourceforge.net
To: mailing list for gambas users gambas-user@lists.sourceforge.net
Sent: Wed, 06 Jun 2012 19:05:31 +0200
Subject: Re: [Gambas-user] mutex applications

 Le 06/06/2012 14:32, tobi a écrit :
  On Wed, 06 Jun 2012, Bruce wrote:
  On Wed, 2012-06-06 at 12:38 +0200, Rolf-Werner Eilert wrote:
 
  Hi Bruce,
 
  I have successfully used this code which is from Jussi Lahtinen. I built
  it into two of my applications, and it works reliably, at least under
  Gambas2 on our somewhat older system:
 
  PUBLIC SUB Form_Open()
  DIM sOutput AS String
 
  EXEC [pgrep, -f, -l, -u, System.User.Name, Stein3.gambas]
  WAIT TO sOutput
 
  IF Split(Trim$(sOutput), gb.NewLine).Count  1 THEN
QUIT
  ENDIF
 
  Just replace Stein3 by your binary's name.
 
  Regards
 
  Rolf
 
 
  Nice! A lot quicker than using gb.Desktop.
 
 
  Sadly!
  It doesn't solve the problem of activating the desired window.
 
  And there is a slight weird, it doesn't detect an instance that is
  running via the IDE.  No idea, but don't really care much, that's not
  the problem.
 
  Ah well, back to Benoit's dbus suggestion.  Oh, how I hate having to
  learn these new techo things.
 
  Back tomorrow.
 
  regards
  Bruce
 
 The good solution is using D-Bus. It is not very difficult actually.
 
 As soon as I have time I will try to make a Gambas function in the 
 gb.dbus component so that you can create unique application as simply 
 as possible.
 
 Regards,
 
 -- 
 Benoît Minisini
 
 --
 Live Security Virtual Conference
 Exclusive live event will cover all the ways today's security and 
 threat landscape has changed and how IT managers can respond. Discussions 
 will include endpoint security, mobile security and the latest in malware 
 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user
--- End of Original Message ---


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] mutex applications

2012-06-06 Thread Bruce
On Wed, 2012-06-06 at 21:49 -0400, nando wrote:
 I'd like to suggest a form property called 'Singleton'
 when _new or _init is called (whichever creates the object)
 then it will not create a second and only
 return the first instance of it.  Somewhat like a module.

nando,

That is quite easy to implement (for forms and any class) using a static
boolean set true in the _Init() method and checked in the _New() method.

This is a different thing altogether, I am trying to ensure that only
one instance of an application is running.

regards
Bruce


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] mutex applications

2012-06-06 Thread Bruce
On Thu, 2012-06-07 at 12:09 +0930, Bruce wrote:
 On Wed, 2012-06-06 at 21:49 -0400, nando wrote:
  I'd like to suggest a form property called 'Singleton'
  when _new or _init is called (whichever creates the object)
  then it will not create a second and only
  return the first instance of it.  Somewhat like a module.
 
 nando,
 
 That is quite easy to implement (for forms and any class) using a static
 boolean set true in the _Init() method and checked in the _New() method.
 
 This is a different thing altogether, I am trying to ensure that only
 one instance of an application is running.
 
 regards
 Bruce
 
Sorry that's both checked and set in the _new() method.
(Can't think on two things at once.)
B 


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user