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 754165 - Replace uses of "instanceof" with virtual functions
Replace uses of "instanceof" with virtual functions
Status: RESOLVED FIXED
Product: gnome-documents
Classification: Core
Component: general
3.17.x
Other All
: Normal normal
: ---
Assigned To: GNOME documents maintainer(s)
GNOME documents maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-08-27 10:44 UTC by Alessandro Bono
Modified: 2015-09-29 17:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
documents, properties: Replace uses of "instanceof" with virtual functions (5.78 KB, patch)
2015-08-27 10:46 UTC, Alessandro Bono
none Details | Review
documents, properties: Replace uses of "instanceof" with virtual functions (6.26 KB, patch)
2015-08-27 13:00 UTC, Alessandro Bono
none Details | Review
documents, properties: Replace uses of "instanceof" with virtual functions (5.46 KB, patch)
2015-09-18 16:29 UTC, Bastien Nocera
none Details | Review
documents, properties: Replace uses of "instanceof" with virtual functions (5.62 KB, patch)
2015-09-24 12:19 UTC, Bastien Nocera
committed Details | Review

Description Alessandro Bono 2015-08-27 10:44:56 UTC
When adding support for new remote services, it helps to have all the service-specific code in one place instead of being scattered across the code base.
Comment 1 Alessandro Bono 2015-08-27 10:46:33 UTC
Created attachment 310083 [details] [review]
documents, properties: Replace uses of "instanceof" with virtual functions

When adding support for new remote services, it helps to have
all the service-specific code in one place instead of being
scattered across the code base.
Comment 2 Debarshi Ray 2015-08-27 11:36:44 UTC
Review of attachment 310083 [details] [review]:

::: src/documents.js
@@ +782,3 @@
+                                   use_markup: true,
+                                   halign: Gtk.Align.START,
+                                   ellipsize: Pango.EllipsizeMode.END });

The "const Pango = imports.gi.Pango;" line has to be moved to this file.

::: src/properties.js
@@ +168,1 @@
 

This newline can now be removed.
Comment 3 Alessandro Bono 2015-08-27 13:00:41 UTC
Created attachment 310095 [details] [review]
documents, properties: Replace uses of "instanceof" with virtual functions

When adding support for new remote services, it helps to have
all the service-specific code in one place instead of being
scattered across the code base.
Comment 4 Bastien Nocera 2015-09-18 16:04:09 UTC
Review of attachment 310095 [details] [review]:

::: src/properties.js
@@ +165,2 @@
         // Source value
+        this._sourceData = doc.getSourceWidget()

Is there a reason why we don't get back a URI and a display name from the source specific functions?

And we'd create a label in the UI code.
Comment 5 Bastien Nocera 2015-09-18 16:29:50 UTC
Created attachment 311644 [details] [review]
documents, properties: Replace uses of "instanceof" with virtual functions

When adding support for new remote services, it helps to have
all the service-specific code in one place instead of being
scattered across the code base.
Comment 6 Cosimo Cecchi 2015-09-18 16:58:05 UTC
Review of attachment 311644 [details] [review]:

Looks good, feel free to push after freeze with these style nits fixed

::: src/documents.js
@@ +774,3 @@
+        if (this.collection) {
+            return [ null, this.sourceName ];
+        } else {

No need for an else block

@@ +1020,3 @@
+        let source = Application.sourceManager.getItemById(this.resourceUrn);
+        let account = source.object.get_account();
+        let presentation_identity = account.presentation_identity;

Please use camel case for variables

::: src/properties.js
@@ +173,3 @@
+        } else {
+            // Collections don't have links
+            this._sourceData = new Gtk.Label({ label: name, halign: Gtk.Align.START });

One property per line
Comment 7 Bastien Nocera 2015-09-24 12:19:51 UTC
Created attachment 312049 [details] [review]
documents, properties: Replace uses of "instanceof" with virtual functions

When adding support for new remote services, it helps to have
all the service-specific code in one place instead of being
scattered across the code base.
Comment 8 Bastien Nocera 2015-09-24 12:21:06 UTC
Attachment 312049 [details] pushed as 14acf23 - documents, properties: Replace uses of "instanceof" with virtual functions
Comment 9 Debarshi Ray 2015-09-29 17:45:14 UTC
(In reply to Bastien Nocera from comment #4)
> Review of attachment 310095 [details] [review] [review]:
> 
> ::: src/properties.js
> @@ +165,2 @@
>          // Source value
> +        this._sourceData = doc.getSourceWidget()
> 
> Is there a reason why we don't get back a URI and a display name from the
> source specific functions?

Because prior to commit 44780682c56ee43 (bug 754149), we weren't always creating a GtkLabel. However, as you have shown, it is not convincing enough as a reason. :)