78910

How can I read out the “glade ID” of a gtk3 object

Question:

In glade it is possible to set an unique ID to an object. In the code one can obtain a pointer to this object by searching for it's "glade ID" via <a href="https://developer.gnome.org/gtk3/stable/GtkBuilder.html#gtk-builder-get-object" rel="nofollow">gtk_builder_get_object()</a>.

However for my current use-case I just want to read out this ID from an <a href="https://stackoverflow.com/questions/38254924/find-glade-gtk3-widget-by-unique-id/38287535#38287535" rel="nofollow">GObject</a>. What's the API to do so ?

Answer1:

You can't. The builder ID is stored in the builder internally, not in the GObject.

The reason for this is that IDs must be unique per builder, which would be impossible to enforce if you were able to get and set them via some GObject API.

Answer2:

You could use <a href="https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-get-name" rel="nofollow">gtk_widget_get_name()</a> to identify an object.

Recommend

  • convert gtkglade to libglade for a backwards compatibility
  • Gtk3 Image full window image from file (python3)
  • How can I read out the “glade ID” of a gtk3 object
  • android Wear 5.0 can't resolve host (Http , AsyncClient ETC. )
  • How do I connect glade signals using GtkBuilder in C#?
  • Adding custom widget to GLADE
  • Variant of defaultdict for assigning value only once
  • Converting a data frame into named object in R
  • How can i compile & run a c program (with OpenMP) in gem5 Full System?
  • Slowly changing dimension - What is Pure type 6 implementation
  • SQL append distinct values from two columns and two tables
  • Hibernate: Inheritance and relationship mapping + generics
  • Query pkg-config variable through autotools
  • Should I use composite primary keys in Grails?
  • How to use function wrapper in mustache.php?
  • git add error : “fatal : malloc, out of memory”
  • Thread 1: EXC_BAD_ACCESS (code =1 address = 0x0)
  • How to make JSON.NET deserialize to Microsoft Date Time?
  • Object and struct member access and address offset calculation
  • How to assign byte[] as a pointer in C#
  • Extracting HTML between tags
  • javaw.exe and eclipse startup problems
  • How to make Safari send if-modified-since header?
  • Adding custom controls to a full screen movie
  • How to pass list parameters for each object using Spring MVC?
  • PHP: When would you need the self:: keyword?
  • Acquiring multiple attributes from .xml file in c#
  • How to set the response of a form post action to a iframe source?
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • Change div Background jquery
  • Qt: Run a script BEFORE make
  • JaxB to read class hierarchy
  • reshape alternating columns in less time and using less memory
  • How can i traverse a binary tree from right to left in java?
  • How can I use threading to 'tick' a timer to be accessed by other threads?