After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 70718 - new instance when open file from file system rather than through Dia's open menu
new instance when open file from file system rather than through Dia's open menu
Status: RESOLVED FIXED
Product: dia
Classification: Other
Component: win32
0.89
Other Windows
: Normal enhancement
: 0.96
Assigned To: Steffen Macke
Steffen Macke
: 85316 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2002-02-06 16:58 UTC by Craig Laurent
Modified: 2006-09-08 19:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A file to open a dia file in the same instance (via drag'n'drop (8.35 KB, patch)
2006-08-06 19:56 UTC, Steffen Macke
needs-work Details | Review
Changes to app/makefile.msc that allow to build dia-win-remote.exe (1.40 KB, patch)
2006-08-06 19:58 UTC, Steffen Macke
none Details | Review

Description Craig Laurent 2002-02-06 16:58:46 UTC
to reproduce using build .89pre1 Win NT 4 SP6 on 1/5/2002:
start Dia (will get one main Dia window - the one with the shape selector).
go to Dia file (*.dia) and open through file system (double click on it).

actual results:
The diagram was opened in a separate instance,
including a second main Dia window.

expected results:
The diagram should have been opened under the existing Dia instance, 
leaving just one main dia window.
the same is if had used file-new-diagram menu to create another diagram,
or used file-open menu to open the file through Dia directly.

Additional Notes:
The file associate for *.dia has the following command for open:
    "D:\Program Files\dia\bin\dia.exe" "%1"

This may be more of a problem with the installer than with Dia itself.
But they don't seem to have separate bug reporting locations.
Comment 1 Steffen Macke 2002-02-06 17:27:07 UTC
do you know a way how the running dia process could be notified to
open the new file?
Comment 2 Craig Laurent 2002-02-06 18:28:23 UTC
Sorry for the book (but, I did do some research).
Summary is that you might have to write some kind of socket listening 
process.  But I am not at all knowledgable about the whole instance 
management process.


I don't know the technical details.  I do know that there is a 
process called gnuclientw that works with Emacs, allowing this 
functionality in Emacs.  I do not know if it is GNU generic and so 
could work with Dia, or if it was Emacs specific.

Here is a news article about gnuclientw starting new instances and 
how to fix that.
http://mail.gnu.org/pipermail/help-emacs-windows/2001-
November/000373.html

Here is the Win FAQ for Emacs, which supposed has gnuclientw info 
buried in it.
http://www.gnu.org/software/emacs/windows/ntemacs.html
it has a link that mentions using the gnuserv to do file associations
http://www.gnu.org/software/emacs/windows/faq3.html#install
(it references the following guy.)

This person seems to have helped write gnuserv, and so may be able to 
help with the tech details.
http://www.wyrdrune.com/index.html?gnuserv.html~main

Here is a link that lists file association information.
http://list-archive.xemacs.org/xemacs-nt/200008/msg00077.html
I tried it...no luck.


Somehow plenty of apps do this, like Netscape (isn't the mozilla code 
opensource?  you could check it out, maybe even get a developer in 
the know to find the code.)


Ultimately, since the command is something like this:
"D:\Program Files\dia\bin\dia.exe" "%1"
It probably comes down to what kind of command line options does Dia 
have?  Does it have a way for a new instance to check if there is an 
existing instance running, and if so to pass the filename to the 
original instance, and then stop itself.

I think the gnuclientw probably does something like this, using 
sockets.  Should be fairly easy to have the app start listening on a 
specific socket port, and then others check that port.  And if they 
were started as an intentional instance, if they detect someone 
listening, they shouldn't bother listening...let the first one be 
the "main".  But that would take some coding time, and so wouldn't 
likely make it into .89 final.

Or easier (but less platform generic); Maybe there is a public DDE 
api that just needs to be supported?  I think this might be how 
Netscape does it.  Then again, mozilla works on multiple platforms, 
so maybe there is some more generic way to do this.
This link has links to "Netscape's DDE Implementation"
http://developer.netscape.com/docs/manuals/communicator.html
Comment 3 Hans Breuer 2002-05-20 13:23:14 UTC
This should definitely be solved on the toolkit level, not
for every app. And it has a simple workaround: 

Use drag and drop instead, which IS implemented on the 
toolkit level.

BTW: I don't even see that it is an almost desired feature to 
not create a new instance - although mostly it is. But especially
Netscape is a program where I often would like to have independent
instances so if one crashes on questionable html/java script the
others would survive.
BTW2: DDE is a rather outdated protocol and having a win32 
implementation for Mozilla doesn't make it cross platform ... 

Comment 4 Steffen Macke 2002-06-15 06:00:59 UTC
*** Bug 85316 has been marked as a duplicate of this bug. ***
Comment 5 Alan Horkan 2002-06-17 21:18:14 UTC
this also happens on win98 
the Gimp also has this problem

it there a bug filed against GTK for this?

Abiword does not have this problem, perhaps code could be reused?
Comment 6 Steffen Macke 2006-08-06 19:56:45 UTC
Created attachment 70331 [details] [review]
A file to open a dia file in the same instance (via drag'n'drop

This is copied from gimp-win-remote, which is included in the GIMP
distribution now for some time.

Should be called dia-win-remote.exe diaw.exe test.dia
Comment 7 Steffen Macke 2006-08-06 19:58:26 UTC
Created attachment 70332 [details] [review]
Changes to app/makefile.msc that allow to build dia-win-remote.exe
Comment 8 Steffen Macke 2006-08-06 20:00:59 UTC
Hans, somehow the drag'n'drop part of this is not working.
Maybe you have an idea for this. Is it possible/necessary
to assign

g_signal_connect (GTK_OBJECT (wrapbox), "drag_data_received",
		    G_CALLBACK (dia_dnd_file_drag_data_received),
                      wrapbox);

to the main window? My tests in this direction were not necessary.

I know that you don't consider this functionality very important, but
it has been asked for quite often over the time. That's why I reopened this.
Comment 9 Steffen Macke 2006-09-08 19:22:02 UTC
Things are working now with a minor modification of the patch. The code has been committed to the CVS repository and will be included in the next dia installer release.