Expose GtkBuilder widget identifiers

Bug #1082391 reported by Martin Pitt
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
autopilot-gtk
Fix Released
High
Martin Pitt
autopilot-gtk (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

I'm trying to write some tests for evince or gedit for evalutating autopilot with GTK. I currently find it really hard to test the expected state as the widget tree is not very easy to traverse (see also bug 1082388 and bug 1082385).

The objects on the application widget tree should have proper identifiers that are given to them in the GtkBuilder .ui files. These identifiers are the ones that the actual program code uses to refer to them, so they are both stable, and also the most appropriate means to identify a particular widget.

I know that GTK currently does not seem to expose the GtkBuilder IDs to the widgets, so we might need to fix that (and add a GTK+ task). It might be possible to access them at the C level though, in the autobuilder GTK module?

Tags: patch

Related branches

Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

This sounds like an issue in autopilot-gtk to me. I've assigned Allan Lesage to look into this - hopefully between the three of us we can work this out.

Cheers,

Changed in autopilot:
assignee: nobody → Thomi Richards (thomir)
Revision history for this message
Allan LeSage (allanlesage) wrote :

I'm aware of the problem but had no idea how to solve--I'm now investigating on advice from ted, will report.

Changed in autopilot-gtk:
assignee: nobody → Allan LeSage (allanlesage)
Revision history for this message
Allan LeSage (allanlesage) wrote :

This is on hold for the moment as I'm deluged with other work items--Martin would you contact me when you see me online to discuss? I'm able to help guide you into the code, etc., until I'm able to help directly. . . .

Changed in autopilot-gtk:
assignee: Allan LeSage (allanlesage) → nobody
Revision history for this message
Martin Pitt (pitti) wrote :

Right, let's say I'll ask you on this bug or on IRC once I (or someone else) finds time to work on this. Thanks!

Changed in autopilot:
assignee: Thomi Richards (thomir) → nobody
no longer affects: autopilot
Revision history for this message
Martin Pitt (pitti) wrote :

This is still one of the most important issues in my opinion. I'll try and see if this can be done entirely within ap-gtk, or whether it actually needs a GTK patch.

Changed in autopilot-gtk:
assignee: nobody → Martin Pitt (pitti)
status: New → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

So, the existing "name" property, which is usually empty, actually comes from GtkWidget and is a custom name that the code can set with gtk_widget_set_name(), or a GtkBuilder file can set with "name", which can be referred to with CSS stylesheets, etc. So we should let this alone.

The name that I'm interested in is the GtkBuilder ID, which is unique and usually doesn't change in a project as code uses this to actually deal with the widgets (gtk_builder_get_object() ). So what we want to do is to use gtk_buildable_get_name() to get the GtkBuilder ID and export that to a property like "builder_name". I already verified that this gives the expected names, one can call Gtk.Buildable.get_name(obj) in GI.

summary: - Needs proper widget identifiers
+ Expose GtkBuilder widget identifiers
Revision history for this message
Martin Pitt (pitti) wrote :

It turned out to be surprisingly simple. The hardest part is to pick a name for it, but the existing convention (globalRect, Children) seems to be to use identifiers with capital names as these don't occur as "real" GtkWidget GObject properties. So I picked BuilderName for now, but I'm open to changing this.

Not a branch for now, as this adds new tests, and this depends on https://code.launchpad.net/~pitti/autopilot-gtk/add-tests/+merge/171036 (which is in turn blocked by https://code.launchpad.net/~pitti/autopilot-gtk/testsuite/+merge/170607). To avoid having to do excessive branch surgery, I keep this as a patch for now.

Martin Pitt (pitti)
Changed in autopilot-gtk:
importance: Undecided → High
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:autopilot-gtk at revision 48, scheduled for release in autopilot-gtk, milestone Unknown

Changed in autopilot-gtk:
status: In Progress → Fix Committed
tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package autopilot-gtk - 1.3+13.10.20130628-0ubuntu1

---------------
autopilot-gtk (1.3+13.10.20130628-0ubuntu1) saucy; urgency=low

  [ Martin Pitt ]
  * Handle enum and flags properties. (LP: #1193342). (LP: #1193342)
  * Expose GtkBuilder widget identifiers as "BuilderName" property. (LP:
    #1082391). (LP: #1082391)
  * This fixes the two test failures on raring which Francis saw in
    https://code.launchpad.net/~pitti/autopilot-gtk/add-
    tests/+merge/171036/comments/382574 I also sneaked in an unrelated,
    but trivial change for dropping a leftover debugging statement, in
    the interest of saving human reviewer and builder resources.
  * Support GtkTextBuffer properties, to introspect GtkTextView
    contents. (LP: #1194371)

  [ Ubuntu daily release ]
  * Automatic snapshot from revision 51
 -- Ubuntu daily release <email address hidden> Fri, 28 Jun 2013 00:01:10 +0000

Changed in autopilot-gtk (Ubuntu):
status: New → Fix Released
Martin Pitt (pitti)
Changed in autopilot-gtk:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.