manno/gnome-shell-extension-quicklaunch

duplicate entries for "backup" files

Opened this issue · 0 comments

After editing some .desktop file in my quicklaunch dir, a lot of duplicate entries showed in the menu.

duplicate

I discovered that quicklaunch was showing an entry not only for firefox.desktop file but also for firefox.desktop~ file, the backup file created by my editor of choice.

This simple patch solves the issue:

diff -crB QuickLaunch@github.com/extension.js QuickLaunch@github.com_fixed/extension.js
*** QuickLaunch@github.com/extension.js 2016-04-10 18:34:35.544407572 +0200
--- QuickLaunch@github.com_fixed/extension.js   2016-04-10 18:38:04.718710209 +0200
***************
*** 145,151 ****
              if (fileType == Gio.FileType.DIRECTORY)
                  continue;
              let name = info.get_name();
!             if( name.indexOf('.desktop') > -1) {
                  let desktopPath =  GLib.build_filenamev([path, name]);
                  this._addAppItem(desktopPath);
                  i++;
--- 145,151 ----
              if (fileType == Gio.FileType.DIRECTORY)
                  continue;
              let name = info.get_name();
!             if( name.endsWith('.desktop') ) {
                  let desktopPath =  GLib.build_filenamev([path, name]);
                  this._addAppItem(desktopPath);
                  i++;