Bug 265559 - x11-toolkits/gtksourceview4: Options for docs and the glade catalog
Summary: x11-toolkits/gtksourceview4: Options for docs and the glade catalog
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-gnome (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-01 21:58 UTC by Sean Champ
Modified: 2022-08-02 07:05 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (gnome)


Attachments
Adding options for docs and the glade catalog (1.70 KB, patch)
2022-08-01 21:58 UTC, Sean Champ
no flags Details | Diff
files/patch for glade catalog compatibility (914 bytes, patch)
2022-08-01 23:03 UTC, Sean Champ
no flags Details | Diff
Updated patch - Adding options for docs and the glade catalog, with a patch file for widget group availability (2.89 KB, patch)
2022-08-01 23:34 UTC, Sean Champ
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sean Champ 2022-08-01 21:58:09 UTC
Created attachment 235616 [details]
Adding options for docs and the glade catalog

This diff is based on the changeset c13acc0d2139 in git @ FreeBSD ports
circa 2022-05-15 16:30:54 -0700 for x11-toolkits/gtksourceview4
version 4.8.3

Options added:
- GLADE: Build and install the gtksourceview4 Glade catalog file.

  This option will conflict with any GLADE option added for
  gtksourceview3

  A patch for adding a GLADE option to gtksourceview3 has been
  published separately 
  https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265558

- DOCS: Build and install the GtkSourceView 4 Reference Manual

  For a purpose of easing maintenance, gtk-doc files installed to
  the gtk-doc dir will automatically be added to the plist with
  add-plist-docs

  The project's NEWS file will be installed under the DOCS
  option. This file is added to pkg-plist


Known Limitation: Concerning the conflict for installing the glade catalog with patches for gtksourceview3 and gtksourceview4 

With the additional glade option enabled for the gtksourceview3 port, a Glade catalog file is installed to /usr/local/share/glade/catalogs/gtksourceview-3.xml

With the additional glade option enabled for this port, a Glade catalog file is installed to /usr/local/share/glade/catalogs/gtksourceview.xml

The conflict is not in the files itself. If both catalogs are built and installed, the Glade UI designer will only show one set of GTK Sourceview widgets however. 

Maybe there's a way to patch this in the source. 

This is actually a fairly old diff here, I wanted to send it along presently, will take a look at the possibility of patching each catalog to differentiate which set of sourceview widgets will show up in Glade, maybe there's a simple label field that can be patched?
Comment 1 Sean Champ 2022-08-01 22:35:18 UTC
Adding the following to the patched Makefile for this port, the gtksourceview3 and gtksourceview4 catalogs will both show up under Glade if installed concurrently.

~~~~
post-stage-GLADE-on:
	${SED} -e 's@\([[:space:]]\)name="gtksourceview"@\1name="${PORTNAME}-${PKGNAMESUFFIX}"@' \
		${WRKSRC}/${MESON_BUILD_DIR}/data/glade/gtksourceview.xml > \
		${STAGEDIR}${PREFIX}/share/glade/catalogs/gtksourceview.xml
~~~~

However, they'll both be shown in Glade as providing a GtkSourceView catalog. 

The difference in the catalog 'name' field will not be reflected in the Glade widget selection.

It seems that the glade-widget-group element in the catalog file will also have to be patched.

I'm certain that a simple 'sed' patch for post-stage would be easier to maintain. I'll try to limit the patching to this scope, for compatibility with the gtksourceview3 glade option
Comment 2 Sean Champ 2022-08-01 23:03:08 UTC
Created attachment 235619 [details]
files/patch for glade catalog compatibility

After adding this patch file to the patched port, the gtksourceview3 and gtksourceview4 catalogs can be installed concurrently, with the GLADE option enabled in each patched port. The main catalog components from each catalog will then be available under a distinct category name and widget group, in the Glade UI designer.

I'll try to add an udpdated patch that includes this patch file, also updating the glade option description in the patch.

afaict it should be fairly simple to send a similar patch for gtksourceview3.
Comment 3 Sean Champ 2022-08-01 23:04:55 UTC
Albeit if both sourceview ports are each built for GTK3 rather than GTK4, perhaps it may seem redundant to add a catalog option to both? 

Ostensibly towards an idea of supporting GTK4, I'll try look at adding a patch for building with a GTK4 flavor in lieu of a default GTK 3
Comment 4 Sean Champ 2022-08-01 23:34:06 UTC
Created attachment 235620 [details]
Updated patch - Adding options for docs and the glade catalog, with a patch file for widget group availability

This diff is based on the changeset c13acc0d2139 in git @ FreeBSD ports
circa 2022-05-15 16:30:54 -0700 for x11-toolkits/gtksourceview4
version 4.8.3

Options added:
- GLADE: Build and install the gtksourceview4 Glade catalog file.

  A patch file is added for supporting this option. This patch will
  allow for installing the patched gtksourceview3 and gtksourceview4
  ports concurrently, such that the Glade catalog components provided by
  each port will then be available under a distinct category name and
  widget group, in the Glade UI designer.
  
  A patch for adding a GLADE option to gtksourceview3 has been
  published separately 
  https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265558

- DOCS: Build and install the GtkSourceView 4 Reference Manual

  For a purpose of easing maintenance, gtk-doc files installed to
  the gtk-doc dir will automatically be added to the plist with
  add-plist-docs

  The project's NEWS file will be installed under the DOCS
  option. This file is added to pkg-plist
Comment 5 Sean Champ 2022-08-02 06:46:52 UTC
For each of this port and gtksourceview3, the patch on the Glade catalog file may have side effects with regards to how the Glade 'Read documentation' button resolves the Devehlp manual name.

With the patches presently, if both gtksourceview3 and gtksourceview4 are installed with each built under the added 'GLADE' option, Glade will resolve the manual for gtksourceview3 for widgets inserted for either the gtksourceview4 or gtksourceview3 catalog

Perhaps this can be addressed by adding one or more additional XML attributes in the catalog file, with the patch. There is a `book` attribute for the glade-catalog XML element, mentioned in the Glade devhelp docs lol.

I'll try to test out an update for this patch and that for gtksourceview4, to resolve this quirk with the patched catalog files
Comment 6 Sean Champ 2022-08-02 07:05:24 UTC
The Glade catalog files already have a 'book' attribute value, in each.

Perhaps the Glade/Devhelp "Read Documentation" quirk might be difficult to work around with a simple patch. Glade might be using each widget/group name, independent of the containing scope? If two widgets with a same name though installed from separate catalogs are being resolved to one devehelp book, it might not be very well useful to patch any widget names in either catalog.

Maybe a notice could be added to the pkg-message for either or both of gtksourceview3 and gtksourceview4 with the added glade option, if the issue itself is not too complex to explain succinctly? 

With the patches and a catalog file rename during stage in the gtksourceview3 port, the catalog files don't conflict at a file level. 

With both catalog files patched and installed, there is at least this quirk with regards to how the documentation is resolved from  Glade.

There are some slight differences between the gtksourceview3 and gtksourceview4 catalog files. I'm not certain how it could be reflected in the widget API environment, if both are installed and then used from any source code. 

I can try testing this in Ruby. Assuming that Gtk::Builder would use the same catalog resolution algorithm as presented in Glade, perhaps it would break the code too when both catalogs are installed. I wonder Gtk::Builder might simply use the first catalog it finds, for some named widget?

Perhaps it may be advisable to simply warn the user to not install both catalogs?