1. 01 Oct, 2018 2 commits
  2. 30 Sep, 2018 2 commits
    • Sergio Costas's avatar
      Fix error when resizing screen in VirtualBox · 04f7bb1b
      Sergio Costas authored
      Related to the previous error, after fixing it there is still this error
      when the window of an emulated system in VirtualBox is resized or an
      external screen is attached:
      
      JS ERROR: TypeError: this._bgManager.backgroundActor is null
      _onDestroy@desktop-icons@csoriano/desktopGrid.js:170:13
      DesktopGrid</<@desktop-icons@csoriano/desktopGrid.js:89:45
      _destroyDesktopIcons/<@desktop-icons@csoriano/desktopManager.js:100:59
      _destroyDesktopIcons@desktop-icons@csoriano/desktopManager.js:100:9
      _addDesktopIcons@desktop-icons@csoriano/desktopManager.js:81:9
      DesktopManager</this._monitorsChangedId<@desktop-icons@csoriano/desktopManager.js:67:88
      _emit@resource:///org/gnome/gjs/modules/signals.js:128:27
      _monitorsChanged@resource:///org/gnome/shell/ui/layout.js:530:9
      wrapper@resource:///org/gnome/gjs/modules/_legacy.js:82:22
      
      This patch fixes it just by adding a check before trying to disconnect
      the signal from bgManager.backgroundActor.
      04f7bb1b
    • Sergio Costas's avatar
      Fix error when connecting an external monitor · afb61bae
      Sergio Costas authored
      When having a laptop and connecting an external screen, the desktop is
      rebuilt; unfortunately there is this error message:
      
      Object St.Widget (0x5557c3a01a70), has been already deallocated -
      impossible to access to it. This might be caused by the fact that the
      object has been destroyed from C code using something such as destroy(),
      dispose(), or remove() vfuncs
      == Stack trace for context 0x5557c1bcb4d0 ==
      
      This fix connects to the destroy signal of the actors in the grid objects
      and remove a grid from the grid list when its actor has been destroyed.
      afb61bae
  3. 27 Sep, 2018 3 commits
    • Sergio Costas's avatar
      Changed grid parameters from an array to a dictionary · c89878c9
      Sergio Costas authored
      The grid parameters (grid width and height, and icon size) are stored in
      a simple array, which gives poor information about what means each value.
      
      This patch replaces the array with an associative array or dictionary,
      where each value is addresed by an string that specify the setting that
      corresponds to it, instead of using its possition.
      c89878c9
    • Sergio Costas's avatar
      Add a separation around each selected icon · 7c398354
      Sergio Costas authored
      Now, with the selection width always set to the maximum, when several
      adjacent icons are selected the result is an uniform "blue block" with
      the icons inside. This change adds a separation between icons, helping
      to keep the visual notion of several elements selected, instead of a
      single big one.
      
      It is a must to put the pading in the file-item part instead of the
      file-item:selected because doing the later makes the icon move downwards
      each time it is selected.
      
      It also adds a 1px border to visually enhance it.
      7c398354
    • Sergio Costas's avatar
      Fix different highlight width size · 518bd0b3
      Sergio Costas authored
      When selecting icons, the highlight is as wide as the text, thus icons with
      large names will have a highlight box wider than icons with shorter names.
      
      This patch fixes it by setting to the maximum value the width of the
      element that changes its color when selected.
      518bd0b3
  4. 25 Sep, 2018 7 commits
    • Sergio Costas's avatar
      Renamed savedPositions to savedCoordinates · f9b16bc0
      Sergio Costas authored
      For consistency, the savedPositions property in fileItem.js is changed to
      savedCoordinates, because "position" means the location in the icon grid,
      while "coordinates" refers to the screen coordinates in pixels, which is
      what is stored in that property.
      f9b16bc0
    • Sergio Costas's avatar
      Removed sqrt in equation for distance between two points · 15d3365d
      Sergio Costas authored
      When relocating an icon in another place because its original place is
      already occupied by another icon, or when searching an empty place for
      a new file, distance from the original place (or 0,0 when it is a new
      icon) is used to find the nearest free position. Since the true distance
      is not needed, but only compare between distances, it is possible to
      remove the square root in the ecuation, because if sqrt(a) < sqrt(b),
      then a < b.
      15d3365d
    • Sergio Costas's avatar
      Replace for loops with numerical index with "of" version · ba988d92
      Sergio Costas authored
      Several loops iterate over arrays using a for loop that counts from zero
      up to the length of the array, like this:
      
          for (let i = 0; i < array.length; i++) {
              let element = array[i];
              ...
      
      This patch replaces all these loops with the more efficient form:
      
          for (let element of array) {
              ...
      ba988d92
    • Sergio Costas's avatar
      Added missing semicolons · 83e9c101
      Sergio Costas authored
      Several lines lack the semicolon at the end.
      83e9c101
    • Sergio Costas's avatar
      Removed unnecesary blank spaces and relocated braces · 45be874e
      Sergio Costas authored
      The code had several lines containing only blank spaces, and also
      some lines ended with a blank space before the carriage return. This
      patch removes those unnecesary blank spaces.
      
      Also it moves the open braces in functions to the same line in some
      functions that have them in the next line, to ensure consistency
      in the coding style.
      45be874e
    • Sergio Costas's avatar
      Fix icons jumping after every refresh · 6789b803
      Sergio Costas authored
      By default, all files are painted secuentially, in the order provided by
      the call that returns the content of the desktop folder.
      
      Each file at the desktop folder store their current coordinates along them
      at "metadata::nautilus-icon-position" property, using the metadata
      capabilities from the filesystem. This allows to paint them in the same
      place every time the computer boots. But when a file is new (because it
      has been created, copied or moved), it must be assigned new coordinates.
      These are, by default, (0,0).
      
      When the desktop is repainted, the icons are painted strictly in the same
      order returned by the operating system when the list of files in the
      desktop folder is required. This means that, if a new file (which still
      doesn't have assigned new coordinates) is located in the list before a
      file with coordinates (0,0), it will be painted at (0,0); then, when the
      algorithm reaches the file that originally was located at (0,0), it finds
      that those coordinates are already in use, so it will try to relocate
      that file to the nearest free location. This can result in a chain
      reaction, moving several files out of place only by adding a new file
      to the desktop.
      
      The solution consists in doing the paint process in two passes: in the
      first one, only those files that already have assigned coordinates in
      their "metadata::nautilus-icon-position" entry are painted, thus ensuring
      that they will be painted in the right position; and in the second pass,
      only the files that still doesn't have assigned coordinates. This ensures
      that the new files will fill the free places, instead of pushing other
      files out of their original place.
      
      Co-author: csoriano
      6789b803
    • Sergio Costas's avatar
      Add support for icons in .desktop files · 5fd754c8
      Sergio Costas authored
      .desktop files contain an entry with the path to a picture file that should
      be used as the icon for this file. There were two bugs that prevented this
      to work, so these files shown the standard icon:
      
      - use new Gio.FileIcon( {file: iconFile} ) instead of
      new Gio.FileIcon(iconFile), which causes Gnome Shell to crash after several
      GLib-GIO-CRITICAL errors
      
      - a typo in one variable name that prevented the previous code to be run
      
      This path fix the typo and the construction call.
      5fd754c8
  5. 24 Sep, 2018 2 commits
  6. 20 Sep, 2018 1 commit
    • Sergio Costas's avatar
      Fixes critical errors during bootup · 67103e23
      Sergio Costas authored
      When Gnome-Shell is launched from GDM3 and has enabled the Desktop Icons extension,
      several critical errors are shown in the console, like:
      
        (gnome-shell.bin:6393): Gjs-CRITICAL **: 18:13:23.999: Object St.Widget
        (0x5648ac6b7150), has been already deallocated - impossible to access to it. This
        might be caused by the fact that the object has been destroyed from C code using
        something such as destroy(), dispose(), or remove() vfuncs
      
        == Stack trace for context 0x5648aa7af320 ==
      
      They are caused because the extension is loaded before the desktop is ready.
      
      The fix checks, during the extension launch, whether the shell startup process
      has been completed or not. If it is still in progress (which happens when the
      extension is loaded during Gnome Shell startup), it subscribes to the
      "startup-complete" signal in order to continue only when the shell is ready.
      
      On the other hand, if the extension was disabled and it is enabled manually by
      the user (like when it is installed from the Gnome Extensions website), since
      the shell startup process have been already completed, the extension starts
      inmediately.
      
      This process ensures that all the elements in Gnome Shell needed by the
      desktop-icons extension have been created and are in place and ready.
      67103e23
  7. 19 Sep, 2018 1 commit
  8. 15 Sep, 2018 4 commits
    • Sergio Costas's avatar
      Align icons to the top · 4501cb5e
      Sergio Costas authored
      Icons and their text are, currently, being aligned to the middle of the grid.
      This means that when the icon name has two lines, the icon is placed a little
      bit upper than the ones with one line. This change fixes this, putting all
      the icons aligned to the top.
      4501cb5e
    • Florian Müllner's avatar
      cleanup: Simplify map iteration · 9fba6a40
      Florian Müllner authored
      Maps allow to iterate over key and value simultaneously, which
      makes for a nice cleanup.
      9fba6a40
    • Florian Müllner's avatar
      cleanup: Use Object.values() where appropriate · 347e87db
      Florian Müllner authored
      Instead of iterating over the keys and fetch each corresponding value,
      just iterate over the values.
      347e87db
    • Sergio Costas's avatar
      Rework of the click-event code · d60a0a1b
      Sergio Costas authored
      This new code calls doOpen() always in the Release event, both for single-click and
      double-click policy.
      
      It also removes the unneeded variable _doubleClicked, because it is possible to
      detect the same using event.get_click_count().
      
      Finally, if in single-click mode, pressing the Shift key allows to select several
      files without opening them, like in double-click mode.
      d60a0a1b
  9. 14 Sep, 2018 1 commit
    • Sergio Costas's avatar
      Fix error message when the desktop icons are reloaded · 5fc14194
      Sergio Costas authored
      Every time the desktop has to be refreshed (like when a file or folder is deleted
      or created), mutter outputs this error (repeated several times, exactly once per
      icon in the desktop):
      
      (gnome-shell.bin:1348): Gjs-CRITICAL **: 17:01:05.735: Attempting to call back
      into JSAPI during the sweeping phase of GC. This is most likely caused by not
      destroying a Clutter actor or Gtk+ widget with ::destroy signals connected, but
      can also be caused by using the destroy(), dispose(), or remove() vfuncs. Because
      it would crash the application, it has been blocked and the JS callback not invoked.
      
      (gnome-shell.bin:1348): Gjs-CRITICAL **: 17:01:05.735: The offending signal was
      destroy on StBin 0x5625dcb5f0c0. == Stack trace for context 0x5625d9dac4b0 ==
      5fc14194
  10. 13 Sep, 2018 1 commit
    • Sergio Costas's avatar
      Adds support for showing the HOME, Trash and other user folders · 3adf465c
      Sergio Costas authored
      Allows to show the Home, Trash, Documents, Downloads, Pictures, Videos and
      Music folders in the desktop
      
      Fix to detect when a new file is added to the trash
      
      The creation of a file was not correctly managed in the monitoring. Creating
      a file in the desktop is detected fine, but a file moved inside the trash is not
      detected. Deleting a file from the desktop changes the trash can icon because the
      delete operation is detected in the desktop, and all icons are refreshed. But
      without this fix, deleting a file from Nautilus, located in other folder, is not
      detected and the trash icon is not updated.
      3adf465c
  11. 08 Sep, 2018 4 commits
    • Carlos Soriano's avatar
      desktopManager: Fix 3.30 compat · 1154e098
      Carlos Soriano authored
      Seems hasOwnProperty didn't really work in 3.28. In any case, this
      solution looks simpler.
      1154e098
    • Sergio Costas's avatar
      Fixes the bug in the rubberband selection when it ends over an icon · df54502e
      Sergio Costas authored
      When doing a rubberband selection, if the user releases the button when the mouse
      cursor is over an icon, the selection isn't terminated; instead, moving the cursor
      without the button pressed still selects more icons, and only pressing and releasing
      it ends the selection.
      
      The problem is that the _onReleaseButton callback in the icon class blindy stops the
      event propagation when the button release is button 1, without taking into account if
      the user really pressed on it or not.
      df54502e
    • Sergio Costas's avatar
      Added support for single-click open · 340e90c1
      Sergio Costas authored
      Nautilus has support for opening files with a single click, instead of a double-click,
      by setting the dconf key "org.gnome.nautilus.preferences.click-policy" to "single".
      This patch reads and tracks the value of that key and honors it to keep Desktop icons
      behavior consistent with Nautilus.
      
      Avoid opening the file when moving it with "single-click" mode enabled
      
      The previous patch didn't allow to move the icons because it opened the file with
      the press event. Changed to the release event, thus allowing to click and move the
      icon into a new possition. It also doesn't open twice a file if the user double
      clicks on it when the "single-click" mode is enabled.
      
      Avoid opening an icon when a multiple selection ends over an icon
      
      If the "single click" mode is used, starting a lazo selection and releasing the
      left button over an icon also launched the icon. This patch fixes this, launching
      the icon only when the user clicks without moving the mouse to start a selection.
      
      Removed unneeded blank space
      
      Used spaces instead of tabs
      
      Another forgotten tab
      
      desktopManager: Split out findMonitorForPos() helper
      
      It makes the code more readable and gives us a common place to add
      compatibility with different shell versions.
      
      #12
      
      desktopManager: Adjust for global.screen removal in 3.30
      
      This should be enough to make the extension work in both 3.28 and
      3.30.
      
      #12
      
      Several fixes asked for merging
      
      Several changes and fixes asked by the author for merging
      
      * Use camelCase style in the new variables and properties
      * Move the nautilus settings code into settings.js
      * Change "lazo selection" with "rubberband selection"
      
      If one branch in an IF has brackets, it should have them in both branches
      
      Removed tabs
      
      Single line IFs don't use brackets
      
      Adjusted _onChangedNautilusSettings to the standard pattern (_onNautilusSettingsChanged)
      340e90c1
    • Carlos Soriano 's avatar
      Merge branch '3-30-compat' into 'master' · 59553937
      Carlos Soriano authored
      Make the extension 3.30 compatible
      
      Closes #12
      
      See merge request !7
      59553937
  12. 07 Sep, 2018 2 commits
  13. 22 Aug, 2018 5 commits
  14. 21 Aug, 2018 4 commits
  15. 20 Aug, 2018 1 commit