Garethmoffatt
Posts: 44
Joined: Sat Feb 25, 2017 10:11 pm

Converting to gtk3 : ** (gtk3test:1621): WARNING **: Error r

Sat Jun 10, 2017 4:29 pm

I'm in the process of converting from gtk-2 to gtk-3 - just because it seams like a good idea.

To get started I downloaded a version of Hello World from

Code: Select all

https://developer.gnome.org/gtk3/stable/gtk-getting-started.html
It compiles ok, but when I run it I get the warning

Code: Select all

** (gtk3test:1621): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
It doesn't appear to stop the program running, so is this something I should worry about? I figure that ignored warnings will eventually come back to bite you!

Here is the code

Code: Select all

#include <gtk/gtk.h>

static void
print_hello (GtkWidget *widget,
             gpointer   data)
{
  g_print ("Hello World\n");
}

static void
activate (GtkApplication *app,
          gpointer        user_data)
{
  GtkWidget *window;
  GtkWidget *button;
  GtkWidget *button_box;

  window = gtk_application_window_new (app);
  gtk_window_set_title (GTK_WINDOW (window), "Window");
  gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);

  button_box = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
  gtk_container_add (GTK_CONTAINER (window), button_box);

  button = gtk_button_new_with_label ("Hello World");
  g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
  g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
  gtk_container_add (GTK_CONTAINER (button_box), button);

  gtk_widget_show_all (window);
}

int
main (int    argc,
      char **argv)
{
  GtkApplication *app;
  int status;

  app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
  g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
  status = g_application_run (G_APPLICATION (app), argc, argv);
  g_object_unref (app);

  return status;
}
Here is how I am compiling and linking from inside Geany

Code: Select all

gcc -Wall -c "%f" `pkg-config --cflags --libs gtk+-3.0`

Code: Select all

gcc -Wall -o "%e" "%f" `pkg-config --cflags --libs gtk+-3.0`
(I have already done apt-get update & apt-get upgrade and it made no difference)

Any suggestions?

Thanks

Garethh

User avatar
PeterO
Posts: 4750
Joined: Sun Jul 22, 2012 4:14 pm

Re: Converting to gtk3 : ** (gtk3test:1621): WARNING **: Err

Sat Jun 10, 2017 6:48 pm

Been there.....

As far as I remember when I researched the messages it turned out it's a configuration bug in Raspbian. But since most applications are not launched from the command line no one ever sees the warning messages, so nothing has been done to fix it !

You just have to get used to ignoring the messages.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Garethmoffatt
Posts: 44
Joined: Sat Feb 25, 2017 10:11 pm

Re: Converting to gtk3 : ** (gtk3test:1621): WARNING **: Err

Sat Jun 10, 2017 7:24 pm

Thanks Peter.

Good to speak to you again. G0DZB, that means you are in the UK right? My grandpa was G2TA. It was him that got me in to electronics in the first place. He would have liked one of us grandsons to take up radio and one day his call sign, but as a dyslexic I didn't think I would get the hang of morse so din't pursue it that hard and got in to programming instead.

I have a few other issues with the conversion from gtk2 to gtk3, but I thought that I should tackle them one at a time in order to get the best answers.

Many thanks,

Gareth

User avatar
PeterO
Posts: 4750
Joined: Sun Jul 22, 2012 4:14 pm

Re: Converting to gtk3 : ** (gtk3test:1621): WARNING **: Err

Sat Jun 10, 2017 7:27 pm

OK, well I've just done an update of a major project of mine from Gtk+2 to Gtk+3 so I'll help where ever I can.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
Paeryn
Posts: 2570
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Converting to gtk3 : ** (gtk3test:1621): WARNING **: Err

Sat Jun 10, 2017 9:51 pm

org.a11y.bus is the Assisted Technologies D-Bus, it looks like something is trying to acces it but it probaby isn't installed (I think at-spi2 or something similar provides it). You should be able to tell applications that it doesn't exist by exporting the environment variable NO_AT_BRIDGE set to 1, e.g.

Code: Select all

export NO_AT_BRIDGE=1
It's a harmless warning as long as you aren't expecting to use the accessibility stuff.
She who travels light — forgot something.

Garethmoffatt
Posts: 44
Joined: Sat Feb 25, 2017 10:11 pm

Re: Converting to gtk3 : ** (gtk3test:1621): WARNING **: Err

Sat Jun 10, 2017 10:20 pm

For anybody else who follows this, I found that the export does work.
export NO_AT_BRIDGE=1
Can you tell me how to make it "permanent" so I don't have to type it in to the shell each time?

Thanks

Gareth

User avatar
Paeryn
Posts: 2570
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Converting to gtk3 : ** (gtk3test:1621): WARNING **: Err

Sat Jun 10, 2017 10:25 pm

Garethmoffatt wrote:For anybody else who follows this, I found that the export does work.
export NO_AT_BRIDGE=1
Can you tell me how to make it "permanent" so I don't have to type it in to the shell each time?

Thanks

Gareth
You can put it at the end of ~/.bashrc then it should be set every time you start a shell.
She who travels light — forgot something.

kriskizlyk
Posts: 1
Joined: Wed Sep 26, 2018 4:25 am

Re: Converting to gtk3 : ** (gtk3test:1621): WARNING **: Error r

Wed Sep 26, 2018 4:28 am

This guy nailed it: http://lubuntuhowto.blogspot.com/2017/1 ... y-bus.html

Installing 'at-spi2-core' package should be enough to solve the issue, simply run this from lubuntu terminal/command line:

sudo apt-get update
sudo apt-get install at-spi2-core

Return to “Graphics programming”