Results 1 to 1 of 1

Thread: The Open With Menu when select multiple files calls multiple times my program?

  1. #1
    hakermania's Avatar
    hakermania is offline Τώρα ξέρεις τι γράφω εδώ!
    Join Date
    Aug 2009
    Location
    Greece
    Beans
    1,705
    Distro
    Ubuntu Development Release

    Cool The Open With Menu when select multiple files calls multiple times my program?

    Ok, so, when I select a lot of my app's project files and I select Open With 'myapp' the system calls:
    Code:
    myapp path/to/the/project/file1
    myapp path/to/the/project/file2
    myapp path/to/the/project/file3
    You understand that this is a big problem, especially when you don't want multiple instants of your application, and I don't want either! So, when I do this, I get 'N' number of messages telling me that the process is already running, where 'N' is the number of project files I selected to open!
    The thing is, that my program has the option to open multiple files very well and handle them with ease, but you have to use:
    Code:
    myapp path/to/the/project/file1 path/to/the/project/file2 path/to/the/project/file3
    and not multiple instants of 'myapp'.

    How can I set this by default? Has it to do with the mime-type? Because it is a new mime-type that opens by default with 'myapp'.
    I've coded the program in C++ (with QtCreator), so I don't know if I can handle this from there, I've tried when opening the program to write to a file if it has arguments (so you have selected a project file to open), then the second instance will see this file and send a Dbus message to the already running one with the path to the other project etc, but this doesn't work because all these instances are called concurrently with such a speed that you can't do anything!

    So, any suggestion deeply appreciated!
    Last edited by hakermania; February 5th, 2011 at 09:35 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •