Author Topic: gtk2, gtksourceview2  (Read 2408 times)

0 Members and 1 Guest are viewing this topic.

Offline DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 3918
  • Country: gb
gtk2, gtksourceview2
« on: February 10, 2022, 03:43:14 pm »
Code: [Select]
#include <gtk/gtk.h>
#include <gtksourceview/gtksourceview.h>
#include <gtksourceview/gtksourcebuffer.h>
#include <gtksourceview/gtksourcelanguage.h>
#include <gtksourceview/gtksourcelanguagesmanager.h>

static gboolean open_file (GtkSourceBuffer *sBuf, const gchar *filename);

int main( int argc, char *argv[] )
{
  static GtkWidget *window, *pScrollWin, *sView;
  PangoFontDescription *font_desc;
  GtkSourceLanguagesManager *lm;
  GtkSourceBuffer *sBuf;

  /* Create a Window. */
  gtk_init (&argc, &argv);
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_signal_connect (G_OBJECT(window),"destroy",G_CALLBACK(gtk_main_quit),NULL);
  gtk_container_set_border_width (GTK_CONTAINER (window), 10);
  gtk_window_set_default_size (GTK_WINDOW(window), 660, 500);
  gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);

  /* Create a Scrolled Window that will contain the GtkSourceView */
  pScrollWin = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (pScrollWin),
                                  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

  /* Now create a GtkSourceLanguagesManager */
  lm = gtk_source_languages_manager_new();

  /* and a GtkSourceBuffer to hold text (similar to GtkTextBuffer) */
  sBuf = GTK_SOURCE_BUFFER (gtk_source_buffer_new (NULL));
  g_object_ref (lm);
  g_object_set_data_full ( G_OBJECT (sBuf), "languages-manager",
                           lm, (GDestroyNotify) g_object_unref);

  /* Create the GtkSourceView and associate it with the buffer */
  sView = gtk_source_view_new_with_buffer(sBuf);
     /* Set default Font name,size */
     font_desc = pango_font_description_from_string ("mono 8");
     gtk_widget_modify_font (sView, font_desc);
     pango_font_description_free (font_desc);

  /* Attach the GtkSourceView to the scrolled Window */
  gtk_container_add (GTK_CONTAINER (pScrollWin), GTK_WIDGET (sView));
  /* And the Scrolled Window to the main Window */
  gtk_container_add (GTK_CONTAINER (window), pScrollWin);
  gtk_widget_show_all (pScrollWin);

  /* Finally load an example file to see how it works */
  open_file (sBuf, "srcview.c");

  gtk_widget_show (window);

  gtk_main();
  return 0;
}


static gboolean
open_file (GtkSourceBuffer *sBuf, const gchar *filename)
{
  GtkSourceLanguagesManager *lm;
  GtkSourceLanguage *language = NULL;
  GError *err = NULL;
  gboolean reading;
  GtkTextIter iter;
  GIOChannel *io;
  gchar *buffer;

  g_return_val_if_fail (sBuf != NULL, FALSE);
  g_return_val_if_fail (filename != NULL, FALSE);
  g_return_val_if_fail (GTK_IS_SOURCE_BUFFER (sBuf), FALSE);

  /* get the Language for C source mimetype */
  lm = g_object_get_data (G_OBJECT (sBuf), "languages-manager");

  language = gtk_source_languages_manager_get_language_from_mime_type (lm,
                                                                "text/x-csrc");
  //g_print("Language: [%s]\n", gtk_source_language_get_name(language));

  if (language == NULL)
  {
    g_print ("No language found for mime type `%s'\n", "text/x-csrc");
    g_object_set (G_OBJECT (sBuf), "highlight", FALSE, NULL);
  }
  else
  {
   gtk_source_buffer_set_language (sBuf, language);
   g_object_set (G_OBJECT (sBuf), "highlight", TRUE, NULL);
  }

  /* Now load the file from Disk */
  io = g_io_channel_new_file (filename, "r", &err);
  if (!io)
  {
    g_print("error: %s %s\n", (err)->message, filename);
    return FALSE;
  }

  if (g_io_channel_set_encoding (io, "utf-8", &err) != G_IO_STATUS_NORMAL)
  {
   g_print("err: Failed to set encoding:\n%s\n%s", filename, (err)->message);
   return FALSE;
  }

  gtk_source_buffer_begin_not_undoable_action (sBuf);

  //gtk_text_buffer_set_text (GTK_TEXT_BUFFER (sBuf), "", 0);
  buffer = g_malloc (4096);
  reading = TRUE;
  while (reading)
  {
    gsize bytes_read;
    GIOStatus status;

    status = g_io_channel_read_chars (io, buffer, 4096, &bytes_read, &err);
    switch (status)
    {
      case G_IO_STATUS_EOF: reading = FALSE;

      case G_IO_STATUS_NORMAL:
        if (bytes_read == 0) continue;
        gtk_text_buffer_get_end_iter ( GTK_TEXT_BUFFER (sBuf), &iter);
        gtk_text_buffer_insert (GTK_TEXT_BUFFER(sBuf),&iter,buffer,bytes_read);
        break;

      case G_IO_STATUS_AGAIN: continue;

      case G_IO_STATUS_ERROR:

      default:
        g_print("err (%s): %s", filename, (err)->message);
        /* because of error in input we clear already loaded text */
        gtk_text_buffer_set_text (GTK_TEXT_BUFFER (sBuf), "", 0);

        reading = FALSE;
        break;
      }
  }
  g_free (buffer);

  gtk_source_buffer_end_not_undoable_action (sBuf);
  g_io_channel_unref (io);

  if (err)
  {
   g_error_free (err);
   return FALSE;
  }

  gtk_text_buffer_set_modified (GTK_TEXT_BUFFER (sBuf), FALSE);

  /* move cursor to the beginning */
  gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (sBuf), &iter);
  gtk_text_buffer_place_cursor (GTK_TEXT_BUFFER (sBuf), &iter);

  g_object_set_data_full (G_OBJECT (sBuf),"filename", g_strdup (filename),
                                                (GDestroyNotify) g_free);

  return TRUE;
}


I am trying to compile this example, but there is an header missing
Code: [Select]
<gtksourceview/gtksourcelanguagesmanager.h>

and I don't understand where it should come from  :-//

It's not included with gtksourceview-2.10.5-r3
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6323
  • Country: fi
    • My home page and email address
Re: gtk2, gtksourceview2
« Reply #1 on: February 10, 2022, 05:36:09 pm »
If I download gtksourceview-2.10.5.tar.bz2 and configure and build it using
    ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
    make
and installing it under /tmp/gtksourceview2 instead of root,
    make DESTDIR=/tmp/gtksourceview2 install
does provide files
    /tmp/gtksourceview2/usr/include/gtksourceview-2.0/gtksourceview/gtksourcelanguage.h
    /tmp/gtksourceview2/usr/include/gtksourceview-2.0/gtksourceview/gtksourcelanguagemanager.h
which indicates that they should be present.  Note that if installed,
    pkg-config --cflags gtksourceview-2.0
should include  -I/usr/include/gtksourceview-2.0 in its output, so that e.g. #include <gtksourceview/gtksourcelanguagemanager.h> includes /usr/include/gtksourceview-2.0/gtksourceview/gtksourcelanguagemanager.h.

After sed'ing s/languagesmanager/languagemanager/g; s/languages_manager/language_manager/g; s/languages-manager/language-manager/g; s/LanguagesManager/LanguageManager/g and changing lines 76-81 into
      lm = gtk_source_language_manager_get_default();
      language = gtk_source_language_manager_get_language(lm, "c");
the example works.  I used gcc -Wall -O2 `pkg-config --cflags gtk+-2.0 gtksourceview-2.0` ex.c `pkg-config --libs gtk+-2.0 gtksourceview-2.0` -o ex
noting that both gtk+ and gtksourceview do install the relevant pkg-config .pc files in /usr/lib/pkgconfig/ if using the above configuration.  A multilib installation like Debian derivatives prefer --libdir=/usr/lib/hardware-arch instead.
 

Offline DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 3918
  • Country: gb
Re: gtk2, gtksourceview2
« Reply #2 on: February 10, 2022, 08:37:49 pm »
That's what emerge fetches when I emerge x11-libs/gtksourceview:2 -> gtksourceview-2.10.5-r3.
It emerges correctly, and applications like "xpad" work correctly with that dependency, but there is any "gtksourcelanguagemanager.h" installed.

Listing files from "gtksourceview-2.10.5.tar.bz2" I can see the file
Code: [Select]
tar -tjf gtksourceview-2.10.5.tar.bz2 | grep "gtksourcelanguagemanager.h"

gtksourceview-2.10.5/gtksourceview/gtksourcelanguagemanager.h

so it's in the source archive, but not installed.

Code: [Select]
find /usr/include/gtksourceview-2.0/gtksourceview/ | grep gtksourcelanguagemanager.h

That's a mystery ... or probably a bug?!?

I am going to check with a 2022 portage, the one I am working with is a 2021 one.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 3918
  • Country: gb
Re: gtk2, gtksourceview2
« Reply #3 on: February 10, 2022, 08:49:00 pm »
Just tried gtksourceview-2.10.5-r4

Something starts moving: gtksourcelanguagesmanager.h is still not installed, but now there is a new file gtksourcelanguagemanager.h

gtksourcelanguagesmanager.h
gtksourcelanguagemanager.h

The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 3918
  • Country: gb
Re: gtk2, gtksourceview2
« Reply #4 on: February 10, 2022, 08:58:20 pm »
Code: [Select]
grep "gtk_source_languages_manager_get_language_from_mime_type" /usr/lib/libgtksourceview-*
Not compiled, it's not in the library  :palm:
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 3918
  • Country: gb
Re: gtk2, gtksourceview2
« Reply #5 on: February 10, 2022, 09:05:36 pm »
Code: [Select]
strings /usr/lib/libgtksourceview-2.0.so | grep language_manager
gtk_source_language_manager_get_language
gtk_source_language_manager_get_type
gtk_source_language_manager_new
gtk_source_language_manager_get_default
gtk_source_language_manager_set_search_path
gtk_source_language_manager_get_search_path
gtk_source_language_manager_get_language_ids
gtk_source_language_manager_guess_language
_gtk_source_language_get_language_manager
gtk_source_language_manager_guess_language
gtk_source_language_manager_get_language
gtk_source_language_manager_get_language_ids
_gtk_source_language_manager_get_rng_file
gtk_source_language_manager_get_search_path
gtk_source_language_manager_set_search_path

it looks a mess. OK
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 3918
  • Country: gb
Re: gtk2, gtksourceview2
« Reply #6 on: February 10, 2022, 09:31:31 pm »
Code: [Select]
#include <gtk/gtk.h>
#include <gtksourceview/gtksourceview.h>
#include <gtksourceview/gtksourcebuffer.h>
#include <gtksourceview/gtksourcelanguage.h>
#include <gtksourceview/gtksourcelanguagemanager.h>

static gboolean open_file (GtkSourceBuffer *sBuf, const gchar *filename);


void foo()
{
  GtkSourceLanguageManager *manager;
  GtkSourceLanguage *language;
  GtkTextBuffer *buffer;
  char value[]="c";

  manager = gtk_source_language_manager_get_default();
  language = gtk_source_language_manager_get_language (manager, value);


}

int main( int argc, char *argv[] )
{
  static GtkWidget *window, *pScrollWin, *sView;
  PangoFontDescription *font_desc;
  GtkSourceLanguageManager *manager;
  GtkSourceBuffer *sBuf;

  /* Create a Window. */
  gtk_init (&argc, &argv);
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_signal_connect (G_OBJECT(window),"destroy",G_CALLBACK(gtk_main_quit),NULL);
  gtk_container_set_border_width (GTK_CONTAINER (window), 10);
  gtk_window_set_default_size (GTK_WINDOW(window), 660, 500);
  gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);

  /* Create a Scrolled Window that will contain the GtkSourceView */
  pScrollWin = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (pScrollWin),
                                  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

  /* Now create a GtkSourceLanguageManager */
  manager = gtk_source_language_manager_new();

  /* and a GtkSourceBuffer to hold text (similar to GtkTextBuffer) */
  sBuf = GTK_SOURCE_BUFFER (gtk_source_buffer_new (NULL));
  g_object_ref (manager);
  g_object_set_data_full ( G_OBJECT (sBuf), "language-manager",
                           manager, (GDestroyNotify) g_object_unref);

  /* Create the GtkSourceView and associate it with the buffer */
  sView = gtk_source_view_new_with_buffer(sBuf);
     /* Set default Font name,size */
     font_desc = pango_font_description_from_string ("mono 8");
     gtk_widget_modify_font (sView, font_desc);
     pango_font_description_free (font_desc);

  /* Attach the GtkSourceView to the scrolled Window */
  gtk_container_add (GTK_CONTAINER (pScrollWin), GTK_WIDGET (sView));
  /* And the Scrolled Window to the main Window */
  gtk_container_add (GTK_CONTAINER (window), pScrollWin);
  gtk_widget_show_all (pScrollWin);

  /* Finally load an example file to see how it works */
  open_file (sBuf, "guineapig.c");

  gtk_widget_show (window);

  gtk_main();
  return 0;
}


static gboolean
open_file (GtkSourceBuffer *sBuf, const gchar *filename)
{
  GtkSourceLanguageManager *manager;
  GtkSourceLanguage *language = NULL;
  GError *err = NULL;
  gboolean reading;
  GtkTextIter iter;
  GIOChannel *io;
  gchar *buffer;

  g_return_val_if_fail (sBuf != NULL, FALSE);
  g_return_val_if_fail (filename != NULL, FALSE);
  g_return_val_if_fail (GTK_IS_SOURCE_BUFFER (sBuf), FALSE);

  /* get the Language for C source mimetype */
  manager = g_object_get_data (G_OBJECT (sBuf), "language-manager");

  language = gtk_source_language_manager_get_language (manager, "c");
  //language = gtk_source_language_manager_get_language_from_mime_type (manager, "text/x-csrc");

  //g_print("Language: [%s]\n", gtk_source_language_get_name(language));

  if (language == NULL)
  {
    g_print ("No language found for mime type `%s'\n", "text/x-csrc");
    g_object_set (G_OBJECT (sBuf), "highlight", FALSE, NULL);
  }
  else
  {
   gtk_source_buffer_set_language (sBuf, language);
   g_object_set (G_OBJECT (sBuf), "highlight", TRUE, NULL);
  }

  /* Now load the file from Disk */
  io = g_io_channel_new_file (filename, "r", &err);
  if (!io)
  {
    g_print("error: %s %s\n", (err)->message, filename);
    return FALSE;
  }

  if (g_io_channel_set_encoding (io, "utf-8", &err) != G_IO_STATUS_NORMAL)
  {
   g_print("err: Failed to set encoding:\n%s\n%s", filename, (err)->message);
   return FALSE;
  }

  gtk_source_buffer_begin_not_undoable_action (sBuf);

  //gtk_text_buffer_set_text (GTK_TEXT_BUFFER (sBuf), "", 0);
  buffer = g_malloc (4096);
  reading = TRUE;
  while (reading)
  {
    gsize bytes_read;
    GIOStatus status;

    status = g_io_channel_read_chars (io, buffer, 4096, &bytes_read, &err);
    switch (status)
    {
      case G_IO_STATUS_EOF: reading = FALSE;

      case G_IO_STATUS_NORMAL:
        if (bytes_read == 0) continue;
        gtk_text_buffer_get_end_iter ( GTK_TEXT_BUFFER (sBuf), &iter);
        gtk_text_buffer_insert (GTK_TEXT_BUFFER(sBuf),&iter,buffer,bytes_read);
        break;

      case G_IO_STATUS_AGAIN: continue;

      case G_IO_STATUS_ERROR:

      default:
        g_print("err (%s): %s", filename, (err)->message);
        /* because of error in input we clear already loaded text */
        gtk_text_buffer_set_text (GTK_TEXT_BUFFER (sBuf), "", 0);

        reading = FALSE;
        break;
      }
  }
  g_free (buffer);

  gtk_source_buffer_end_not_undoable_action (sBuf);
  g_io_channel_unref (io);

  if (err)
  {
   g_error_free (err);
   return FALSE;
  }

  gtk_text_buffer_set_modified (GTK_TEXT_BUFFER (sBuf), FALSE);

  /* move cursor to the beginning */
  gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (sBuf), &iter);
  gtk_text_buffer_place_cursor (GTK_TEXT_BUFFER (sBuf), &iter);

  g_object_set_data_full (G_OBJECT (sBuf),"filename", g_strdup (filename),
                                                (GDestroyNotify) g_free);

  return TRUE;
}


Code: [Select]
/usr/include/gtksourceview-2.0
/usr/include/gtk-2.0
/usr/lib/gtk-2.0/include
/usr/include/pango-1.0
/usr/include/glib-2.0
/usr/lib/glib-2.0/include
/usr/lib/libffi/include
/usr/include/fribidi
/usr/include/cairo
/usr/include/pixman-1
/usr/include/freetype2
/usr/include/uuid
/usr/include/libpng16
/usr/include/harfbuzz
/usr/include/gdk-pixbuf-2.0
/usr/include/libmount
/usr/include/blkid
/usr/include/atk-1.0
/usr/include/libxml2

(dep headers)

Code: [Select]
gtksourceview-2.0
gtk-x11-2.0
gdk-x11-2.0
pangocairo-1.0
atk-1.0
cairo
gdk_pixbuf-2.0
gio-2.0
pangoft2-1.0
pango-1.0
gobject-2.0
glib-2.0
fontconfig
freetype

(dep libraries)

This compiles and works

I renamed "languages" into "language", and changed this line
Code: [Select]
  language = gtk_source_language_manager_get_language (manager, "c");
  //language = gtk_source_language_manager_get_language_from_mime_type (manager, "text/x-csrc");


I don't know what's wrong, it needs more investigation, but I have other priorities at the moment  :-//

The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline PKTKS

  • Super Contributor
  • ***
  • Posts: 1766
  • Country: br
Re: gtk2, gtksourceview2
« Reply #7 on: February 11, 2022, 10:50:59 am »
You have a bad crippled installed package...

I will not be surprised if this kind of poisoned thing happens over here and there...  :-\
More and more these common repos have been poisoned by 3rd part interests
and unreliable packed distros made to oversimplify deployments.

Reason why I have been using my own trusted forked LFS builds.. more and more..

From my own pack manager I can tell you that the HEADER is incorrectly installed..
Probably the whole thing is bad..

Get a fresh one as Nominal pointed you...
build a sane safe from sources..

Correct header tree attached, shot by my own pack manager tool
that tracks my LFS builds..  in PERL::Curses

Paul
« Last Edit: February 11, 2022, 11:01:01 am by PKTKS »
 

Offline DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 3918
  • Country: gb
Re: gtk2, gtksourceview2
« Reply #8 on: February 11, 2022, 11:23:29 am »
You have a bad crippled installed package...

Gentoo has problems, we know, but the problem here seems only related to gtksourceview2.

*every* package I tried to emerge with gtksourceview2 dependency worked out of the box.

e.g.
xpad needs gtksourceview2: it emerges, and it works, without any issue!
geany needs gtksourceview2: it emerges, and it works, without any issue!


The problem arose yesterday with an example (the source in my first post) I found in public gtk2 documentation.

With gentoo, well ... there was an issue with the slot (gtksourceview2 -> slot2, gtksourceview2 -> slot3) which caused a collision between them; my portage is one 400 days old, I cannot sync because I have special support for Ada (my Overlays have dependencies with the current portage eclasses, a thing that is "updated" when you update the portage) and it would for sure break with a sync, so I sorted it out manually the defect.

Talking about official portage, the slot-issue got sorted out one years ago and it's currently sorted out in current 2022 portages

So, this issue is solved, but there is now something wrong with the function names of the libgtksourceview2 dynamic library. I don't understand why, the ebuild script looks correct.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline PKTKS

  • Super Contributor
  • ***
  • Posts: 1766
  • Country: br
Re: gtk2, gtksourceview2
« Reply #9 on: February 11, 2022, 11:46:55 am »
if the source  got poisoned or crippled somehow it wont matter if you build or rebuild with any distro..  the bottom line is having a reliable source to build from...

This has always been a problem.. eventually you can retrieve a proper build release..

IMHO as far as reliable is concerned plain Debian repos have far more alternatives..
which ultimately lead to being more difficult to poison or just screw the sources..
they are spread over educational institutions and nor exclusive profit corps..
(which not prevent rsync clones to spread poisoned.... but more difficult it is)

And as more and more of the Internet  is being privatized..
and more and more "linux friends"  corps (fill blanks)  are taking over the code..
buying assets and promoting their own products...

you got the point

Paul
 

Offline DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 3918
  • Country: gb
Re: gtk2, gtksourceview2
« Reply #10 on: February 11, 2022, 12:04:18 pm »
gtksourceview/gtksourcelanguagesmanager.h
gtksourceview/gtksourcelanguagemanager.h

"languageS" instead of "language", why should it be plural? that's the first question  :D
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline PKTKS

  • Super Contributor
  • ***
  • Posts: 1766
  • Country: br
Re: gtk2, gtksourceview2
« Reply #11 on: February 11, 2022, 12:06:41 pm »
gtksourceview/gtksourcelanguagesmanager.h
gtksourceview/gtksourcelanguagemanager.h

"languageS" instead of "language", why should it be plural? that's the first question  :D

Obviously some smart ass crippled the source...

for fun for just the sake of messing everybody else's life ...

whatever..
the world is full of irrational ones..

do not expect otherwise

Paul
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6323
  • Country: fi
    • My home page and email address
Re: gtk2, gtksourceview2
« Reply #12 on: February 11, 2022, 01:29:06 pm »
gtksourceview/gtksourcelanguagesmanager.h
gtksourceview/gtksourcelanguagemanager.h

"languageS" instead of "language", why should it be plural? that's the first question  :D
Doing a deep dive in official gtksourceview archives, the singular name has been valid since gtksourceview-2.0.0 (2007).

Before that, gtksourceview-0.x and gtksourceview-1.x used the plural.

So, if you see <gtksourceview/gtksourcelanguagesmanager.h>, you're looking at code written for GtkSourceView-0 or GtkSourceView-1 (at least fourteen years ago), and not for GtkSourceView-2 (which works for Gtk+ version 2.0).

(There are also GtkSourceView-3 for Gtk+ 3, and GtkSourceView-4 for Gtk+ 4.  These major versions are not compatible with each other; you must pair Gtk+ major version with same GtkSourceView version.)

(I find the old documentation (developer-old.gnome.org) better than the new one (developer.gnome.org); see Gtk+ 2, GtkSourceView-2, Gtk+ 3, GtkSourceView-3.22/3.24, Gtk+ 4, GtkSourceView-4.2, for example.)

No nefarious business afoot, just an old, old API change in GtkSourceView.
 
The following users thanked this post: DiTBho

Offline PKTKS

  • Super Contributor
  • ***
  • Posts: 1766
  • Country: br
Re: gtk2, gtksourceview2
« Reply #13 on: February 11, 2022, 01:51:29 pm »
lets hope for the best...
prepare for the nastiest...

WTF a 14yo piece of code is doing there....

Paul
 
The following users thanked this post: Ed.Kloonk

Offline DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 3918
  • Country: gb
Re: gtk2, gtksourceview2
« Reply #14 on: February 11, 2022, 02:24:01 pm »
I'm not a fan of GnomeToolKit in general, nor do I like the KDE alternative.
Somehow I like Motif because it is simpler and runs on my old TekX terminal.
Anyway, Scintilla and GTKSourceView are really powerful and do a great job :D


I've never seriously programmed anything with them, so I have these kind of silly doubts and made the mistake of reading the wrong manual.
Also, GTK, GTK2, GTK3 are a bit confusing about the portage, but this is the Gentoo way to handle them.

x11-libs/gtksourceview:2 ->2.10.5-r4 -> { /usr/lib/libgtk-2.so, /usr/include/gtksourceview-2.0 }
x11-libs/gtksourceview:3 ->3.24.11 -> { /usr/lib/libgtk-3.so, /usr/include/gtksourceview-3.0 }
x11-libs/gtksourceview:4 ->4.6.1-r1 -> { /usr/lib/libgtk-4.so, /usr/include/gtksourceview-4 }

If I were them, I would have supported gtk, gtk2 and gtk3 in three dedicated ebuilds, one for each

e.g.
x11-libs/gtksourceview2
x11-libs/gtksourceview3
x11-libs/gtksourceview4

instead of grouping them all in the same (x11-libs/gtksourceview) ebuild with a SLOT to select.

I spent three days on this type of problem because it was buggy and (also due to my ignorance with gtk) I didn't understand what was going on under the shell.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6323
  • Country: fi
    • My home page and email address
Re: gtk2, gtksourceview2
« Reply #15 on: February 11, 2022, 04:30:44 pm »
If I were them, I would have supported gtk, gtk2 and gtk3 in three dedicated ebuilds, one for each, e.g.
x11-libs/gtksourceview2
x11-libs/gtksourceview3
x11-libs/gtksourceview4
Exactly.  That also lets them co-exist simultaneously, like they do on e.g. Debian, which uses gtksourceview2, gtksourceview3, and gtksourceview4 for the source packages.  This is important for compatibility, since the major versions are not downwards (binary or API) compatible.

I spent three days on this type of problem because it was buggy and (also due to my ignorance with gtk) I didn't understand what was going on under the shell.
I wasn't aware of it either, until I started looking into it; I didn't even catch the plural at first.
When I realized the plural issue, I did some web searching (dammit, DuckDuckGo no longer does verbatim searches!), and noticed both singular and plural exist on the web. 
The dates on the pages hinted that perhaps the plural was old, and singular current; an API change.
Based on that, I started looking at the gtksourceview release tarballs, and discovered what I posted above.
 
The following users thanked this post: DiTBho


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf