1. 15 Oct, 2018 1 commit
    • Sergio Costas's avatar
      Add symlink emblem to symbolic links · 9e34cee1
      Sergio Costas authored
      When a file in the desktop is a symbolic link, it should show the "symlink
      emblem", the little curved arrow in the lower-right corner specifying that
      the file isn't a normal file, but a symbolic link to another file. But
      currently the extension lacks it.
      
      This patch fixes this, and adds the emblem to the symbolic links.
      9e34cee1
  2. 14 Oct, 2018 2 commits
  3. 11 Oct, 2018 1 commit
    • Sergio Costas's avatar
      Fix launching .desktop files with field codes · 935685be
      Sergio Costas authored
      .desktop files can add field codes to the EXEC field to specify extra data
      needed to launch a program. For example, %F will be replaced by a list of
      files separated by blank spaces, that will be processed as a command line
      parameter by the program being launched. Unfortunately, the current code
      in desktop-icons extract that line as-is and uses it to launch the
      program without doing any replacement, so .desktop files that include
      field codes fail to launch.
      
      This patch fixes this by creating a Gio.DesktopAppInfo object with the
      .desktop file, and using it to launch the program itself, and also
      takes advantage of its methods to extract the icon path.
      935685be
  4. 10 Oct, 2018 1 commit
    • Sergio Costas's avatar
      Allow both SHIFT and CONTROL keys for multiple selection · 952c985b
      Sergio Costas authored
      Currently, to select several files the user must press SHIFT key. But
      the SHIFT key is used in Nautilus to do a range selection, this is, to
      select all the files located between the first selected file up to the
      last one, while the key used to do individual selections is CONTROL. This
      makes the desktop work in an inconsisten way.
      
      This patch allows to do multiple selection any of both keys, and also to
      allow to join several rubberband selections using also any of SHIFT or
      CONTROL keys.
      952c985b
  5. 09 Oct, 2018 1 commit
    • Sergio Costas's avatar
      Add SHIFT support for rubberband selection · 6b75a22f
      Sergio Costas authored
      Currently, when using rubberband in the desktop, it is not possible to
      join several selections, because every time the left button is released
      and pressed again to do a second selection, the first one is erased.
      
      This patch allows to join several rubberband selections: if the SHIFT
      key is pressed when the user presses the left button in the mouse, the
      current rubberband selection won't be erased, and the new selection will
      be added to the previous one.
      6b75a22f
  6. 08 Oct, 2018 3 commits
    • Sergio Costas's avatar
      Optimize finding the best location for a new icon · 06c12e3c
      Sergio Costas authored
      The code used to find the best location for a new icon when they are added
      to the desktop performs a sweep over all the grid elements for each icon.
      This is very inefficient because the majority of the icons are going to be
      put in their original location, and only a very small number, if any, will
      require finding the nearest free place.
      
      This patch transforms the original icon coordinates into the final row and
      column, and checks if there is already an icon. If not, that position will
      be assigned without performing the sweep.
      
      This algorithm reduces the time needed to repaint 30 icons from about 180
      milliseconds to approximately 30 ms.
      06c12e3c
    • Carlos Soriano's avatar
      8fac8eb7
    • Carlos Soriano's avatar
      desktopManager: Use better wording for recreating desktop icons · 18a573c3
      Carlos Soriano authored
      "addDesktopIcons" was not entirely clear that it was removing them first
      to recreate them later.
      18a573c3
  7. 04 Oct, 2018 1 commit
  8. 03 Oct, 2018 1 commit
  9. 02 Oct, 2018 3 commits
    • Sergio Costas's avatar
      Fix icon size problems including hiDPI problem · 2f9b97bb
      Sergio Costas authored
      The icons plus their file name has some problems. Depending on the screen
      resolution, they can fit fine, or lack too much space. It also lacks
      scale and hiDPI support. The problem seems to be that the size specified
      for each element (icon plus text) is used as a maximum value, instead of
      the minimum needed to ensure that both fit.
      
      This patch fixes this problem by calculating a number of rows and columns
      that guarantee that each grid element is, at least, as big as the desired
      size, thus ensuring that each element in the icon grid will have always
      enough space. It also adds support for hiDPI screens using this mode.
      2f9b97bb
    • Sergio Costas's avatar
      Add HiDPI support · 429609f5
      Sergio Costas authored
      When changing to a HiDPI mode for Retina-like displays, the files are
      placed incorrectly because the icon size is doubled, but not the grid
      size, so they are put one over another.
      
      This patch fixes this by allowing to configure different values for
      each scale factor.
      429609f5
    • Marek Černocký's avatar
      Add Czech translation · 36f45beb
      Marek Černocký authored
      36f45beb
  10. 01 Oct, 2018 7 commits
  11. 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
  12. 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
  13. 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
  14. 24 Sep, 2018 2 commits
  15. 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
  16. 19 Sep, 2018 1 commit
  17. 15 Sep, 2018 3 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