olsh / Google-Tasks-Sidebar

Firefox addon that shows your Google tasks in a sidebar.
https://addons.mozilla.org/en-US/firefox/addon/google-tasks-sidebar/
Mozilla Public License 2.0
6 stars 0 forks source link

Clicking X to close doesn't work properly #2

Open pwr22 opened 10 years ago

pwr22 commented 10 years ago

After doing this firefox thinks the sidebar is still open despite it closing. So you have to press the button twice more to bring it back

pwr22 commented 9 years ago

I can see why this is happening in the code, and I'm sure I can fix it if you can provide me with any decent guide on FF plugin development

The button's toggle state is used to set the window hidden or unhidden. If you close it with the X then the sidebar is hidden without the button being toggled. There needs to be some sort of handler (onClose or something probably) that sets the buttons toggle state to false

Better yet, make a variable that represents whether the sidebar is hidden and have the button and sidebar handlers use this. Much better design and maintainability there

olsh commented 9 years ago

Thank you for the help. Yes, I know that we could subscribe to onHide event of the Sidebar and set the toggle button state to false in it. But there is an issue, I don't know why, but onHide event is fired when sidebar is loaded. Anyway, you can try to fix it, I appreciate your help, here is steps to build the addon:

  1. Install node.js and Python 2.x.
  2. Install grunt-cli globally

    npm install -g grunt-cli
  3. Clone the repo

    git clone https://github.com/olsh/Google-Tasks-Sidebar.git
  4. Go to the cloned directory

    cd Google-Tasks-Sidebar
  5. Install dependencies

    npm install
  6. Run the next grunt task

    grunt

Here is useful documentation:

  1. Toggle button
  2. Sidebar

If you have any questions, let me know.

pwr22 commented 9 years ago

Thanks for the build instructions, I'll take a look

pwr22 commented 9 years ago

I am currently stopped by this error

> grunt
Running "copy:main" (copy) task
Created 7 directories, copied 11 files

Running "mozilla-addon-sdk:stable" (mozilla-addon-sdk) task
Mozilla Addon SDK already downloaded

Running "mozilla-cfx:custom_command" (mozilla-cfx) task
Warning: There was an error running mozilla-cfx. Error: I can't find the application binary in any of its default locations
on your system. Please specify one using the -b/--binary option. Use --force to continue.

Aborted due to warnings.
pwr22 commented 9 years ago

If I manually specify where the binary is I then get the following

> grunt mozilla-cfx -b mozilla-addon-sdk/addon-sdk-1.16-official/bin/cfx
/home/peter/Google-Tasks-Sidebar/node_modules/grunt/lib/grunt/task.js:434
    process.chdir(grunt.option('base') || path.dirname(gruntfile));
            ^
Error: ENOTDIR, not a directory
    at Error (native)
    at Task.task.init (/home/peter/Google-Tasks-Sidebar/node_modules/grunt/lib/grunt/task.js:434:13)
    at Object.grunt.tasks (/home/peter/Google-Tasks-Sidebar/node_modules/grunt/lib/grunt.js:120:8)
    at Object.module.exports [as cli] (/home/peter/Google-Tasks-Sidebar/node_modules/grunt/lib/grunt/cli.js:38:9)
    at Object.<anonymous> (/home/peter/.nvm-fish/v0.11.15/lib/node_modules/grunt-cli/bin/grunt:45:20)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
pwr22 commented 9 years ago

Apparently the build script is going to open up a firefox instance using the plugin (for what I don't know) but that's what is complaining in the first place, I'm on a headless system. I intended to build and then test on another machine, but I'll set it up on a graphical vm tomorrow and work on it as necessary

pwr22 commented 9 years ago

I managed to get this working from my headless container using xforwarding, so I'm sorted with the setup now

olsh commented 9 years ago

Hi @pwr22 ,

If I manually specify where the binary is I then get the following

It is usually not necessary to specify path to binaries. But if you get the error, you need to specify these arguments here, and set the "-b" argument to Firefox binaries instead of grunt ones. More info about the parameters and cfx tool here.

Apparently the build script is going to open up a firefox instance using the plugin (for what I don't know)

It is by design, for debugging in a clean environment. If you want to build an *.xpi file, you need to run the following command

grunt build
pwr22 commented 9 years ago

I've worked out the bug that's causing anomalous hide events, it also then stops any further show or hide events, it's cause by setting the URL in sidebar.js

pwr22 commented 9 years ago

Looks like the only way to deal with this issue is for Mozilla to allow loading an external page as the sidebar. What the extension does now must be a loophole they haven't thought of or don't care to patch but it messes up the SDK stuff

olsh commented 9 years ago

Looks like the only way to deal with this issue is for Mozilla to allow loading an external page as the sidebar. What the extension does now must be a loophole they haven't thought of or don't care to patch but it messes up the SDK stuff

Exactly. We have no choice but wait the fix for the SDK or use a legal way to load Google tasks.

pwr22 commented 9 years ago

I've tried looking and I can't even find a way to contact them with feed back

Peter On 26 Jan 2015 13:44, "Oleg Shevchenko" notifications@github.com wrote:

Looks like the only way to deal with this issue is for Mozilla to allow loading an external page as the sidebar. What the extension does now must be a loophole they haven't thought of or don't care to patch but it messes up the SDK stuff

Exactly. We have no choice but wait the fix for the SDK or use a legal way to load Google tasks.

— Reply to this email directly or view it on GitHub https://github.com/olsh/Google-Tasks-Sidebar/issues/2#issuecomment-71462135 .

olsh commented 9 years ago

You can file a bug here.