diff -rc xfdesktop-4.13.2/po/fr.po xfdesktop-4.13.2b/po/fr.po *** xfdesktop-4.13.2/po/fr.po 2018-06-17 00:16:32.000000000 +0200 --- xfdesktop-4.13.2b/po/fr.po 2018-12-04 09:25:15.838606490 +0100 *************** *** 1000,1009 **** #: ../src/xfdesktop-regular-file-icon.c:799 #, c-format msgid "" "Type: %s\n" "Size: %s\n" "Last modified: %s" ! msgstr "Type : %s\nTaille : %s\nDernière modification : %s" #: ../src/xfdesktop-special-file-icon.c:297 #: ../src/xfdesktop-special-file-icon.c:479 --- 1000,1010 ---- #: ../src/xfdesktop-regular-file-icon.c:799 #, c-format msgid "" + "%s\n" "Type: %s\n" "Size: %s\n" "Last modified: %s" ! msgstr "%s\nType : %s\nTaille : %s\nDernière modification : %s" #: ../src/xfdesktop-special-file-icon.c:297 #: ../src/xfdesktop-special-file-icon.c:479 diff -rc xfdesktop-4.13.2/src/xfdesktop-icon-view.c xfdesktop-4.13.2b/src/xfdesktop-icon-view.c *** xfdesktop-4.13.2/src/xfdesktop-icon-view.c 2018-06-17 00:16:32.000000000 +0200 --- xfdesktop-4.13.2b/src/xfdesktop-icon-view.c 2018-12-04 11:27:57.917914184 +0100 *************** *** 57,62 **** --- 57,66 ---- #define DEFAULT_TOOLTIP_SIZE 128 #define MAX_TOOLTIP_SIZE 512 + #define GRAVITY_HORIZONTAL 1 + #define GRAVITY_TO_LEFT 2 + #define GRAVITY_UPWARDS 4 + #define ICON_SIZE (icon_view->priv->icon_size) #define TEXT_WIDTH ((icon_view->priv->cell_text_width_proportion) * ICON_SIZE) #define ICON_WIDTH (TEXT_WIDTH) *************** *** 188,193 **** --- 192,198 ---- double tooltip_size_from_xfconf; gboolean single_click; + gboolean gravity; }; static void xfce_icon_view_set_property(GObject *object, *************** *** 370,375 **** --- 375,381 ---- PROP_SINGLE_CLICK, PROP_SHOW_TOOLTIPS, PROP_TOOLTIP_SIZE, + PROP_GRAVITY, }; *************** *** 556,561 **** --- 562,574 ---- FALSE, XFDESKTOP_PARAM_FLAGS)); + g_object_class_install_property(gobject_class, PROP_GRAVITY, + g_param_spec_int("gravity", + "gravity", + "set gravity of new icons placement", + 0, 7, 0, + XFDESKTOP_PARAM_FLAGS)); + g_object_class_install_property(gobject_class, PROP_SHOW_TOOLTIPS, g_param_spec_boolean("show-tooltips", "show tooltips", *************** *** 654,659 **** --- 667,673 ---- icon_view->priv->source_targets = gtk_target_list_new(icon_view_targets, icon_view_n_targets); + gtk_drag_source_set(GTK_WIDGET(icon_view), 0, NULL, 0, GDK_ACTION_MOVE); icon_view->priv->dest_targets = gtk_target_list_new(icon_view_targets, *************** *** 716,721 **** --- 730,739 ---- icon_view->priv->tooltip_size_from_xfconf = g_value_get_double(value); break; + case PROP_GRAVITY: + icon_view->priv->gravity = g_value_get_int(value); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); break; *************** *** 735,740 **** --- 753,762 ---- g_value_set_boolean(value, icon_view->priv->single_click); break; + case PROP_GRAVITY: + g_value_set_int(value, icon_view->priv->gravity); + break; + case PROP_SHOW_TOOLTIPS: g_value_set_boolean(value, icon_view->priv->show_tooltips); break; *************** *** 1523,1528 **** --- 1545,1581 ---- return TRUE; } + static void + xfdesktop_next_spot(XfdesktopIconView *icon_view, guint16 *col, guint16 *row, guint16 ncols, guint16 nrows) + { + gint scol = *col, srow = *row; + if (icon_view->priv->gravity & GRAVITY_HORIZONTAL) { + scol += (icon_view->priv->gravity & GRAVITY_TO_LEFT)? -1:1; + if (scol < 0) { + scol = ncols - 1; + srow += (icon_view->priv->gravity & GRAVITY_UPWARDS)? -1:1 ; + } else { + if (scol >= ncols) { + scol = 0; + srow += (icon_view->priv->gravity & GRAVITY_UPWARDS)? -1:1; + } + } + } else { + srow += (icon_view->priv->gravity & GRAVITY_UPWARDS)? -1:1; + if (srow < 0) { + srow = nrows - 1; + scol += (icon_view->priv->gravity & GRAVITY_TO_LEFT)? -1:1; + } else { + if (srow >= nrows) { + srow = 0; + scol += (icon_view->priv->gravity & GRAVITY_TO_LEFT)? -1:1; + } + } + } + *col = (guint16) scol; + *row = (guint16) srow; + } + static gboolean xfdesktop_icon_view_drag_drop(GtkWidget *widget, GdkDragContext *context, *************** *** 1629,1646 **** } /* Find the next available spot for an icon if offset spot is not available */ ! while(!xfdesktop_grid_is_free_position(icon_view, row, col)) { ! if(row + 1 >= icon_view->priv->nrows) { ! if(col + 1 >= icon_view->priv->ncols) ! col = 0; ! else ! ++col; ! row = 0; ! } else { ! ++row; ! } } ! /* set new position */ xfdesktop_icon_set_position(l->data, row, col); xfdesktop_grid_unset_position_free(icon_view, l->data); --- 1682,1691 ---- } /* Find the next available spot for an icon if offset spot is not available */ ! while (!xfdesktop_grid_is_free_position(icon_view, row, col)) { ! xfdesktop_next_spot(icon_view, &col, &row, icon_view->priv->ncols, icon_view->priv->nrows); } ! /* set new position */ xfdesktop_icon_set_position(l->data, row, col); xfdesktop_grid_unset_position_free(icon_view, l->data); *************** *** 1770,1781 **** /* Find the next available spot for an icon */ do { ! if(*row + 1 >= icon_view->priv->nrows) { ! ++*col; ! *row = 0; ! } else { ! ++*row; ! } } while(!xfdesktop_grid_is_free_position(icon_view, *row, *col)); /* set new position */ --- 1815,1821 ---- /* Find the next available spot for an icon */ do { ! xfdesktop_next_spot(icon_view, col, row, icon_view->priv->ncols, icon_view->priv->nrows); } while(!xfdesktop_grid_is_free_position(icon_view, *row, *col)); /* set new position */ *************** *** 1794,1802 **** GList *l = NULL; guint i; GList *icons[4] = { NULL, NULL, NULL, NULL }; ! gint16 row = -1; /* start at -1 because we'll increment it */ ! gint16 col = 0; for(l = icon_view->priv->icons; l; l = l->next) { gint16 old_row, old_col; --- 1834,1852 ---- GList *l = NULL; guint i; GList *icons[4] = { NULL, NULL, NULL, NULL }; ! gint16 row; ! gint16 col; + if (icon_view->priv->gravity & GRAVITY_UPWARDS) + col = icon_view->priv->ncols; + else + /* start at -1 because we'll increment it */ + col = -1; + if (icon_view->priv->gravity & GRAVITY_TO_LEFT) + row = icon_view->priv->nrows - 1; + else + row = 0; + for(l = icon_view->priv->icons; l; l = l->next) { gint16 old_row, old_col; *************** *** 3382,3387 **** --- 3432,3438 ---- gint16 *row, gint16 *col) { + /* gint i, maxi; g_return_val_if_fail(row && col, FALSE); *************** *** 3396,3401 **** --- 3447,3497 ---- } return FALSE; + */ + + gint i, ip, j, jp, k; + + g_return_val_if_fail(row && col, FALSE); + + if (icon_view->priv->gravity & GRAVITY_HORIZONTAL) + for(j = 0; j < icon_view->priv->nrows; ++j) { + if (icon_view->priv->gravity & GRAVITY_UPWARDS) + jp = icon_view->priv->nrows - 1 - j; + else + jp = j; + for(i = 0; i < icon_view->priv->ncols; ++i) { + if (icon_view->priv->gravity & GRAVITY_TO_LEFT) + ip = icon_view->priv->ncols - 1 - i; + else + ip = i; + k = ip * icon_view->priv->nrows + jp; + if(!icon_view->priv->grid_layout[k]) { + *col = (guint16) ip; + *row = (guint16) jp; + return TRUE; + } + } + } else + for(i = 0; i < icon_view->priv->ncols; ++i) { + if (icon_view->priv->gravity & GRAVITY_TO_LEFT) + ip = icon_view->priv->ncols - 1 - i; + else + ip = i; + for(j = 0; j < icon_view->priv->nrows; ++j) { + if (icon_view->priv->gravity & GRAVITY_UPWARDS) + jp = icon_view->priv->nrows - 1 - j; + else + jp = j; + k = ip * icon_view->priv->nrows + jp; + if(!icon_view->priv->grid_layout[k]) { + *col = (guint16) ip; + *row = (guint16) jp; + return TRUE; + } + } + } + + return FALSE; } *************** *** 3569,3574 **** --- 3665,3672 ---- xfdesktop_icon_view_new(XfdesktopIconViewManager *manager) { XfdesktopIconView *icon_view; + static gboolean run = TRUE; + GValue gv = {0}; g_return_val_if_fail(XFDESKTOP_IS_ICON_VIEW_MANAGER(manager), NULL); *************** *** 3577,3582 **** --- 3675,3681 ---- icon_view->priv->channel = xfconf_channel_get(XFDESKTOP_CHANNEL); + xfconf_g_property_bind(icon_view->priv->channel, "/desktop-icons/single-click", G_TYPE_BOOLEAN, *************** *** 3584,3589 **** --- 3683,3694 ---- "single_click"); xfconf_g_property_bind(icon_view->priv->channel, + "/desktop-icons/file-icons/gravity", + G_TYPE_BOOLEAN, + G_OBJECT(icon_view), + "gravity"); + + xfconf_g_property_bind(icon_view->priv->channel, "/desktop-icons/show-tooltips", G_TYPE_BOOLEAN, G_OBJECT(icon_view), *************** *** 3664,3673 **** { gint16 row, col; ! if(!xfdesktop_icon_get_position(icon, &row, &col) ! || !xfdesktop_grid_is_free_position(icon_view, row, col)) { ! if(xfdesktop_grid_get_next_free_position(icon_view, &row, &col)) { XF_DEBUG("old position didn't exist or isn't free, got (%d,%d) instead", row, col); xfdesktop_icon_set_position(icon, row, col); --- 3769,3780 ---- { gint16 row, col; ! if (!xfdesktop_icon_get_position(icon, &row, &col) ! || !xfdesktop_grid_is_free_position(icon_view, row, col) ! || (((icon_view->priv->gravity & GRAVITY_UPWARDS) || ! (icon_view->priv->gravity & GRAVITY_TO_LEFT)) && row == 0 && col == 0)) { ! if (xfdesktop_grid_get_next_free_position(icon_view, &row, &col)) { XF_DEBUG("old position didn't exist or isn't free, got (%d,%d) instead", row, col); xfdesktop_icon_set_position(icon, row, col); diff -rc xfdesktop-4.13.2/src/xfdesktop-regular-file-icon.c xfdesktop-4.13.2b/src/xfdesktop-regular-file-icon.c *** xfdesktop-4.13.2/src/xfdesktop-regular-file-icon.c 2018-06-07 21:37:55.000000000 +0200 --- xfdesktop-4.13.2b/src/xfdesktop-regular-file-icon.c 2018-12-04 09:18:54.866597044 +0100 *************** *** 796,802 **** time_string = xfdesktop_file_utils_format_time_for_display(mtime); regular_file_icon->priv->tooltip = ! g_strdup_printf(_("Type: %s\nSize: %s\nLast modified: %s"), description, size_string, time_string); /* Extract the Comment entry from the .desktop file */ --- 796,803 ---- time_string = xfdesktop_file_utils_format_time_for_display(mtime); regular_file_icon->priv->tooltip = ! g_strdup_printf(_("%s\nType: %s\nSize: %s\nLast modified: %s"), ! g_file_get_basename(regular_file_icon->priv->file), description, size_string, time_string); /* Extract the Comment entry from the .desktop file */ Seulement dans xfdesktop-4.13.2b: xfdesktop-4.12.4b.diff