Hello all,
I asked the maintainer of fbida[1], a Motif/framebuffer image viewer,
about whether CDE integration would be accepted upstream, and received
a positive answer.
Currently I have a V1 patch that works for me, but might need work
before it gets merged upstream.

I'd like a little bit of feedback on how well it works for others;
if you have anything by way of translations, I should be able to work
those in.

To use the patch, you will need "dtappintegrate" to be in your PATH;
if you're using CDE, that should be the case already.
Apply it on top of fbida 2.10/git head, then run make and make install.
If you use "make DESTDIR=...", you will need to run the following manually
as root once installation is completed:

 dtappintegrate -s $prefix/share/ida

where prefix is the prefix you installed Ida in.

I also have a tarball containing the integration files, which could be
dropped in /etc/dt/ or $prefix/share/ida/dt/ ; if you do the latter,
you will again need to run dtappintegrate.

HOWEVER, there's a big caveat/bug report:
dtappintegrate is a shell script, and currently it sets PATH to
"/usr/dt/bin:/usr/bin", before it uses "date".
To make it work without using the /usr merge, you will need to find
the line that sets PATH and add ":/bin" at the end.
Patch pending.

Thanks,
Isaac Dunham

[1] https://www.kraxel.org/cgit/fbida/

Attachment: ida-dt.tgz
Description: application/gtar-compressed

>From 8faddd2bb94fb8efb900d9844f8894e298fbb246 Mon Sep 17 00:00:00 2001
From: Isaac Dunham <ibid...@gmail.com>
Date: Wed, 10 Jun 2015 23:02:50 -0700
Subject: [PATCH] CDE integration for Ida

This patch implements nearly full CDE integration, the way the manual
says to do it. However, it's probably not quite right yet.

Possible code problems:
* dtappdir/dtdir should probably go in mk/Variables.mk instead.
* The changes are scattered in several places.
* Test for CDE is silent.

Misfeatures/things users might want different:
* Creating a subgroup within Desktop_Apps is probably desireable.
* The user needs to run dtappintegrate manually if they don't run
"make install" without setting DESTDIR.
* If dtdir were set to $DESTDIR/etc, there would be no need for that;
alternatively, it would also work to run
  dtappintegrate -t "$DESTDIR/etc/dt"
unconditionally.
However, setting dtdir to $DESTDIR/etc goes against the advice of the
dtappintegrate manpage.
---
 .gitignore    |  1 +
 GNUmakefile   | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 cde/ida.dt.in | 17 +++++++++++++++++
 3 files changed, 70 insertions(+)
 create mode 100644 cde/ida.dt.in

diff --git a/.gitignore b/.gitignore
index d746069..4b35b3d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ ida
 logo.h
 thumbnail.cgi
 *.o
+Ida.dt
diff --git a/GNUmakefile b/GNUmakefile
index 2d18ab4..f2e1be8 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -21,6 +21,10 @@ endif
 ifeq ($(HAVE_MOTIF),yes)
   TARGETS += ida
 endif
+ifneq ($(HAVE_CDE),no)
+  TARGETS += Ida.dt
+endif
+
 
 
 #################################################################
@@ -52,12 +56,18 @@ HAVE_LIBSANE	:= $(call ac_lib,sane_init,sane)
 HAVE_LIBCURL	:= $(call ac_lib,curl_easy_init,curl)
 HAVE_LIBLIRC	:= $(call ac_lib,lirc_init,lirc_client)
 HAVE_MOTIF	:= $(call ac_lib,XmStringGenerate,Xm,-L/usr/X11R6/$(LIB) -lXpm -lXt -lXext -lX11)
+HAVE_CDE	:= $(shell which dtappintegrate || echo no)
 JPEG_VER        := $(call ac_jpeg_ver)
 endef
 
 # transposing
 CFLAGS  += -Ijpeg/$(JPEG_VER)
 
+# CDE integration is only for Ida
+ifneq ($(HAVE_MOTIF),yes)
+  HAVE_CDE  := no
+endif
+
 # transparent http/ftp access using curl depends on fopencookie (glibc)
 ifneq ($(HAVE_GLIBC),yes)
   HAVE_LIBCURL	:= no
@@ -118,6 +128,36 @@ fbi : LDLIBS += $(call ac_lib_mkvar,$(fbi_libs),LDLIBS)
 
 
 ########################################################################
+# rules for CDE integration
+
+# supported image formats, as CDE labels them
+FORMATS = BM PM JPEG
+ifeq ($(HAVE_LIBPCD),yes)
+  FORMATS += photocd-file
+endif
+ifeq ($(HAVE_LIBGIF),yes)
+  FORMATS += GIF
+endif
+ifeq ($(HAVE_LIBTIFF),yes)
+  FORMATS += TIFF
+endif
+ifeq ($(HAVE_LIBPNG),yes)
+  FORMATS += PNG
+endif
+ifneq ($(HAVE_CDE),no)
+  dtdir ?= $(shrdir)/ida
+  dtappdir ?= $(shrdir)/ida/dt/appconfig
+endif
+
+Ida.dt:
+	cp cde/ida.dt.in Ida.dt
+	for type in $(FORMATS); do \
+	  printf 'ACTION Open\n{\n\tLABEL\t\tOpen\n' >>Ida.dt	; \
+	  printf '\tARG_TYPE\t%s\n' "$${type}" >>Ida.dt 	; \
+	  printf '\tTYPE\t\tMAP\n\tMAP_ACTION\tIda_Viewer\n}\n' >>Ida.dt ; \
+	done
+
+########################################################################
 # rules for the small tools
 
 # jpeg/exif libs
@@ -214,6 +254,18 @@ ifeq ($(HAVE_MOTIF),yes)
 	$(INSTALL_DIR) $(resdir)/app-defaults
 	$(INSTALL_DATA) $(srcdir)/Ida.ad $(resdir)/app-defaults/Ida
 endif
+ifneq ($(HAVE_CDE),no)
+	$(INSTALL_DIR) $(dtappdir)/types/C/
+	$(INSTALL_DIR) $(dtappdir)/icons/C/
+	$(INSTALL_DIR) $(dtappdir)/appmanager/C/Desktop_Apps/
+	$(INSTALL_DATA) Ida.dt $(dtappdir)/types/C/
+	$(INSTALL_DATA) mallard_16.xpm $(dtappdir)/icons/C/Ida.t.pm
+	$(INSTALL_DATA) mallard_32.xpm $(dtappdir)/icons/C/Ida.m.pm
+	$(INSTALL_DATA) mallard_48.xpm $(dtappdir)/icons/C/Ida.l.pm
+ifndef DESTDIR
+	$(HAVE_CDE) -s $(dtdir)
+endif
+endif
 
 clean:
 	-rm -f *.o jpeg/$(JPEG_VER)/*.o rd/*.o wr/*.o $(depfiles) core core.*
diff --git a/cde/ida.dt.in b/cde/ida.dt.in
new file mode 100644
index 0000000..3594d62
--- /dev/null
+++ b/cde/ida.dt.in
@@ -0,0 +1,17 @@
+###########################################################
+# CDE integration for Ida.
+#
+# ida.dt.in contains fixed entries, while file associations
+# (which vary between compiles) are generated in the makefile.
+#
+###########################################################
+
+ACTION Ida_Viewer
+{
+	LABEL		Ida_Viewer
+	ICON		Ida
+	TYPE		COMMAND
+	WINDOW_TYPE	NO_STDIO
+	EXEC_STRING	ida "%Arg_1%"
+}
+
-- 
2.1.4

------------------------------------------------------------------------------
_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel

Reply via email to