After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 709106 - Add new "page-changed" signal
Add new "page-changed" signal
Status: RESOLVED FIXED
Product: atk
Classification: Platform
Component: atk
unspecified
Other Linux
: Normal normal
: ---
Assigned To: ATK maintainer(s)
ATK maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-09-30 15:08 UTC by Joanmarie Diggs (IRC: joanie)
Modified: 2013-11-06 17:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
First version of the signal (1.42 KB, patch)
2013-10-01 17:15 UTC, Alejandro Piñeiro Iglesias (IRC: infapi00)
none Details | Review
Add page-changed signal (1.64 KB, patch)
2013-10-04 16:29 UTC, Alejandro Piñeiro Iglesias (IRC: infapi00)
committed Details | Review
tests: add testdocument (5.03 KB, patch)
2013-10-04 16:36 UTC, Alejandro Piñeiro Iglesias (IRC: infapi00)
committed Details | Review

Description Joanmarie Diggs (IRC: joanie) 2013-09-30 15:08:44 UTC
There is currently no signal specific to page changes in a document, e.g. pressing page up/page down in Evince, LibreOffice Writer, LibreOffice Impress, LibreOffice Calc, etc. As a result, ATs have to make heuristic guesses based on the events they do receive.
Comment 1 Alejandro Piñeiro Iglesias (IRC: infapi00) 2013-10-01 17:15:01 UTC
Created attachment 256204 [details] [review]
First version of the signal

First version of the signal. This is just a page-changed signal, without any parameters. Anyway I can think on some parameters:
  * prev_page_number: page number just before the signal emission
  * new_page_number: page number just after the signal emission

Anyway, imho, if we add parameters I think that just the new page number would be enough.

Note: to the native english speakers reading this:
1.) I based the signal documentation on the bug description feedback.
2.) Documenting the parameters, I documented @atkdocument as "the object which emitted the signal". But on the other AtkDocument signals, it is "the object which received the signal". For me it makes more sense the one I used. And after all, the implementors will need to call g_signal_emit with that instance. Looking at gtk, they have the following:
   a.) "@accel_group: the #GtkAccelGroup which received the signal" (gtkaccelgroup)
   b.) "label: The object on which the signal was emitted" (gtkaboutdialog)
   c.) "@application: the #GtkApplication which emitted the signal" (gtkapplication)

So they are not consistent. Taking into account g_signal_emit documentation:
"instance : the instance the signal is being emitted on."

Probably b.) is the more suitable one.
Comment 2 Joanmarie Diggs (IRC: joanie) 2013-10-01 17:51:08 UTC
(In reply to comment #1)
> Created an attachment (id=256204) [details] [review]

Nit on the docs:

+       * The 'page-changed' signal is emitted when the current page of
+       * a document changes, e.g. pressing page up/down on a document
+       * viewer.

s/on a document/in a document/
 
> First version of the signal. This is just a page-changed signal, without any
> parameters. Anyway I can think on some parameters:
>   * prev_page_number: page number just before the signal emission
>   * new_page_number: page number just after the signal emission

Knowing what the current page number is would be quite helpful. The use case is that Orca could present the new page number to the user.

Knowing what the old page number is might not be needed/used. I cannot think of a use case right now. And requiring both might be more work for the implementor depending on the implementation.

So... I'm leaning towards just one parameter: The number of the newly-selected page. And if for some reason the implementor doesn't know that (or numbers don't apply or whatever), -1 should be provided.

> Anyway, imho, if we add parameters I think that just the new page number would
> be enough.

Agreed. :)

> 2.) Documenting the parameters, I documented @atkdocument as "the object which
> emitted the signal".

Makes sense to me.

> Probably b.) is the more suitable one.

Agreed. :)

Thanks!!
Comment 3 Alejandro Piñeiro Iglesias (IRC: infapi00) 2013-10-04 16:29:38 UTC
Created attachment 256486 [details] [review]
Add page-changed signal

Adds signal AtkDocument::page-changed. It adds one parameter page-number
Comment 4 Alejandro Piñeiro Iglesias (IRC: infapi00) 2013-10-04 16:36:06 UTC
Created attachment 256488 [details] [review]
tests: add testdocument

In order to try the signal (basically that I didn't commit any mistake with it) I created a little program. I modified it in order to be included on testdocuments. But right now is somewhat silly, as in order to check if the test fails or not, it only check that the expected number of callback calls is the same that the expected number of signal emission.

Anyway, right now the tests that atk have at the tests directory are also really shallow, so I'm biased to just add it, and improve it later. Anyway feedback are welcome.
Comment 5 Alejandro Piñeiro Iglesias (IRC: infapi00) 2013-10-04 16:36:41 UTC
(In reply to comment #3)
> Created an attachment (id=256486) [details] [review]
> Add page-changed signal
> 
> Adds signal AtkDocument::page-changed. It adds one parameter page-number

BTW: I updated the documentation, and also added page_number documentation. Native-speaking feedback are welcome.