Friday, 24 February 2012

new on GNOME Shell extension gtg

During these two weeks, I continue my work on GNOME Shell Extensions for GTG. Last week, I add a filter that can only shows today's task. So by default when the extensions loaded, it will display the top K tasks.

But when click button "today", it only shows those tasks that are already started but haven't yet ended.

The main problems I encountered are the date calculation and how to hook a event so that when click different button, the shown tasks are different.

Then the next thins I did is to enable the Open GTG button at the bottom of the tasksbox. This took longer time than I though. At first I totally have no idea how to implement it. Then I searched with Google but can not find what I needed. Then I looked at some gnome shell document and still nothing found. But lucky when I have a look at the gnome shell code, just the same as gnome shell "Open calendar" function, using misc.util.spawn() function, finally I make it work.

During the next two weeks what I plan to do is autostart gtg headless when the extension start and add a search button.

Thursday, 9 February 2012

GNOME Shell extensions for GTG

Due to some reason, after discussion with my mentor, I decided my next mission to be written the GNOME Shell Extensions for GTG.
In order to develop the GNOME Shell Extensions, I read some materials from the following websites:

These information is very helpful and follow the tutorial I did my first simple GNOME Shell Extensions which adds a button in the panel and display hello world message.

But there are still lots problem occurs. My first question is how the extensions be loaded. It seems that the extensions will not be loaded itself when GNOME Shell start. We need to add the extension uid:
$gsettings set enabled-extensions "[]"
$gsettings get enable-extensions

But when I did some changes to the extension file, I log out the gnome and then log in so that the new files can be loaded. Then I found a way that can make GNOME Shell reload extensions without log out, which is press Alt + F2, and type r.

The next problem is debug. I did not know how to debug it. After lots Google searching, I finally know that all the log information was displayed through global.log() function, and the way to see it is press Alt + F2 and type lg. And the global.breakpoint() can force a gdb breakpoint from _javascript_.

The hardest problem is that I found there are few materials about GNOME Shell Extensions. So when some problem occurs it took longer time to solve. But lucky I download the GNOME Shell code, I am sure I can learn a lots of stuff from there.