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 754941 - clicking on good-by button gives a error
clicking on good-by button gives a error
Status: RESOLVED WONTFIX
Product: newcomers-tutorial
Classification: Other
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Newcomers Tutorial Maintainer(s)
Newcomers Tutorial Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-09-13 01:52 UTC by Prashant Tyagi
Modified: 2018-07-05 08:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Quit function corrected and filename of gnome image corrected (1.45 KB, patch)
2015-09-13 03:05 UTC, Prashant Tyagi
none Details | Review
quit function corrected and filename of image corrected (36.85 KB, patch)
2015-09-17 07:57 UTC, Prashant Tyagi
none Details | Review
autostart-app: initialize i from previous commit (3.74 KB, patch)
2016-03-07 20:57 UTC, Ray Strode [halfline]
committed Details | Review
util: fix bug leading to cleared child environment (2.74 KB, patch)
2016-03-07 22:24 UTC, Ray Strode [halfline]
committed Details | Review

Description Prashant Tyagi 2015-09-13 01:52:12 UTC
Overview:
        when the programe contain hello.js is run,a new window pops up,but on    clicking a good-by button it gives a error.
 
Steps To Reproduce:
        1.Run a programe with a command `gjs hello.js`
        2.when a new window pops up click on "good-by' button.
 
Actual Result:
 (gjs:7906): Gjs-WARNING **: JS ERROR: ReferenceError: application is not defined
WelcomeToTheGrid<._quit@hello.js:68
wrapper@resource:///org/gnome/gjs/modules/lang.js:169
@hello.js:75
       
Expected Result:
   There should be some result which is valid on clicking that button.

Build Date & Hardware:
   Build 2015-09-12 on Ubuntu OS 15.04
Comment 1 Prashant Tyagi 2015-09-13 03:05:18 UTC
Created attachment 311223 [details] [review]
Quit function corrected and filename of gnome image corrected

This attachment is patch.
Quit function is corrected and filename of gnome image corrected
These two issues was responsible for the cause of error.
Comment 2 Prashant Tyagi 2015-09-17 07:08:52 UTC
Comment on attachment 311223 [details] [review]
Quit function corrected and filename of gnome image corrected

>From c033a83f2b085811000a71d8db7ec839e2b7453d Mon Sep 17 00:00:00 2001
>From: prashanttyagi <prashant.tyagi@research.iiit.ac.in>
>Date: Sun, 13 Sep 2015 08:00:44 +0530
>Subject: [PATCH] Corrected gnome image Filename (.jpg to .png) Correctd
> _quit() button
>
>---
> hello.js | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
>diff --git a/hello.js b/hello.js
>index 39fe8b9..b7290e0 100755
>--- a/hello.js
>+++ b/hello.js
>@@ -39,7 +39,7 @@ const WelcomeToTheGrid = new Lang.Class({
>         this._grid = new Gtk.Grid ({ row_spacing: 20 });
> 
>         // Create an image
>-        this._image = new Gtk.Image ({ file: "gnome-image.jpg" });
>+        this._image = new Gtk.Image ({ file: "gnome-image.png" });
> 
>         // Create a second image using a stock icon
>         this._icon = new Gtk.Image ({ stock: 'gtk-about' });
>@@ -49,7 +49,7 @@ const WelcomeToTheGrid = new Lang.Class({
> 
>         // Create a button
>         this._button = new Gtk.Button ({ label: ".. .and good-by" });
>-        this._button.connect ("clicked", Lang.bind(this, this._quit));
>+        this._button.connect ("clicked", Lang.bind(this,this._quit));
> 
>         // Attach the images and button to the grid
>         this._grid.attach (this._image,   0, 0, 2, 1);
>@@ -64,8 +64,8 @@ const WelcomeToTheGrid = new Lang.Class({
>         this._window.show_all();
>     },
> 
>-    _quit: function() {
>-        application.quit();
>+    _quit: function() {
>+        this.application.quit();
>     }
> 
> });
>-- 
>1.9.1
>
Comment 3 Christian Hergert 2015-09-17 07:09:27 UTC
Review of attachment 311223 [details] [review]:

Thanks for finding this!

I think two of the lines may have been changed on accident and do not need to be part of the patch. Could you restore them to their original code and attach an updated patch?

::: hello.js
@@ -50,3 +50,3 @@
         // Create a button
         this._button = new Gtk.Button ({ label: ".. .and good-by" });
-        this._button.connect ("clicked", Lang.bind(this, this._quit));
+        this._button.connect ("clicked", Lang.bind(this,this._quit));

I dont think this line needs to be changed

@@ +65,3 @@
     },
 
+    _quit:  function() {

I dont think this line needs to be changed
Comment 4 Prashant Tyagi 2015-09-17 07:57:59 UTC
Created attachment 311528 [details] [review]
quit function corrected and filename of image corrected
Comment 5 Ray Strode [halfline] 2016-03-07 20:57:56 UTC
Created attachment 323328 [details] [review]
autostart-app: initialize i from previous commit

We weren't initializing it to 0.

This commit changes the while loop to a for loop to
make room for  a natural place to initialize i.
Comment 6 Ray Strode [halfline] 2016-03-07 20:58:12 UTC
Comment on attachment 323328 [details] [review]
autostart-app: initialize i from previous commit

Attachment 323328 [details] pushed as 97d413f - autostart-app: initialize i from previous commit
Comment 7 Ray Strode [halfline] 2016-03-07 22:24:24 UTC
Created attachment 323329 [details] [review]
util: fix bug leading to cleared child environment

The code was trying to initialize the environment with g_listenv
the first time it was run, but instead, ended up using a cleared
environment everytime.
Comment 8 Ray Strode [halfline] 2016-03-07 22:24:51 UTC
Comment on attachment 323329 [details] [review]
util: fix bug leading to cleared child environment

Attachment 323329 [details] pushed as f44db06 - util: fix bug leading to cleared child environment
Comment 9 Ray Strode [halfline] 2016-03-07 22:26:01 UTC
sorry guys for coopting your bug, i meant to use bug 754951
Comment 10 André Klapper 2018-07-05 08:25:51 UTC
As this task is in the "newcomers-tutorial" product in Bugzilla, I am closing this task as per bug 685176 comment 2.