[Xfce4-commits] [xfce/xfdesktop] 01/01: Add orientation option to arrange icons (Bug #14979)
noreply at xfce.org
noreply at xfce.org
Sat Dec 22 02:13:21 CET 2018
This is an automated email from the git hooks/post-receive script.
a n d r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfdesktop.
commit 608d0d4a51378e138bc064d7ce86c67e88951155
Author: Jean-Pierre Demailly <jean-pierre.demailly at univ-grenoble-alpes.fr>
Date: Fri Dec 21 20:20:49 2018 -0300
Add orientation option to arrange icons (Bug #14979)
---
settings/main.c | 9 ++
settings/xfdesktop-settings-ui.glade | 137 ++++++++++++++++++-------
src/xfdesktop-icon-view.c | 187 ++++++++++++++++++++++++++---------
3 files changed, 252 insertions(+), 81 deletions(-)
diff --git a/settings/main.c b/settings/main.c
index a99175b..38f2da3 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -88,6 +88,7 @@
#define DESKTOP_ICONS_SHOW_TOOLTIP_PROP "/desktop-icons/show-tooltips"
#define DESKTOP_ICONS_TOOLTIP_SIZE_PROP "/desktop-icons/tooltip-size"
#define DESKTOP_ICONS_SINGLE_CLICK_PROP "/desktop-icons/single-click"
+#define DESKTOP_ICONS_GRAVITY_PROP "/desktop-icons/gravity"
typedef struct
{
@@ -2042,6 +2043,14 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder *main_gxml,
#endif
xfconf_g_property_bind(channel, DESKTOP_ICONS_STYLE_PROP, G_TYPE_INT,
G_OBJECT(w), "active");
+
+ /* Orientation combo */
+ w = GTK_WIDGET(gtk_builder_get_object(main_gxml, "combo_orientation"));
+ gtk_combo_box_set_active(GTK_COMBO_BOX(w), 0);
+ xfconf_g_property_bind(channel, DESKTOP_ICONS_GRAVITY_PROP, G_TYPE_INT,
+ G_OBJECT(w), "active");
+
+ /* bindings */
xfconf_g_property_bind(channel, DESKTOP_ICONS_FONT_SIZE_PROP, G_TYPE_DOUBLE,
G_OBJECT(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(spin_font_size))),
"value");
diff --git a/settings/xfdesktop-settings-ui.glade b/settings/xfdesktop-settings-ui.glade
index 209ffb8..8816d73 100644
--- a/settings/xfdesktop-settings-ui.glade
+++ b/settings/xfdesktop-settings-ui.glade
@@ -113,6 +113,38 @@
</row>
</data>
</object>
+ <object class="GtkListStore" id="model8">
+ <columns>
+ <!-- column-name gchararray -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">Top Left Vertical</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Top Left Horizontal</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Top Right Vertical</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Top Right Horizontal</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Bottom Left Vertical</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Bottom Left Horizontal</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Bottom Right Vertical</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Bottom Right Horizontal</col>
+ </row>
+ </data>
+ </object>
<object class="XfceTitledDialog" id="prefs_dialog">
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@@ -775,54 +807,54 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="chk_custom_font_size">
- <property name="label" translatable="yes">Use custom _font size:</property>
+ <object class="GtkLabel" id="label14">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
+ <property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">Icons _orientation:</property>
<property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">3</property>
+ <property name="top_attach">2</property>
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="spin_font_size">
+ <object class="GtkComboBox" id="combo_orientation">
<property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
+ <property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="halign">start</property>
- <property name="text" translatable="yes">12</property>
- <property name="adjustment">adjustment4</property>
- <property name="value">12</property>
+ <property name="model">model8</property>
+ <child>
+ <object class="GtkCellRendererText" id="renderer8"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">3</property>
+ <property name="top_attach">2</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="chk_show_hidden_files">
- <property name="label" translatable="yes">Show hidden files on the desktop</property>
+ <object class="GtkCheckButton" id="primary">
+ <property name="label" translatable="yes">Show icons on primary display</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">5</property>
+ <property name="top_attach">3</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="chk_single_click">
- <property name="label" translatable="yes">Single _click to activate items</property>
+ <object class="GtkCheckButton" id="chk_custom_font_size">
+ <property name="label" translatable="yes">Use custom _font size:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -832,24 +864,39 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">6</property>
+ <property name="top_attach">4</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="chk_show_thumbnails">
- <property name="label" translatable="yes">Show t_humbnails</property>
+ <object class="GtkSpinButton" id="spin_font_size">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="halign">start</property>
+ <property name="text" translatable="yes">12</property>
+ <property name="adjustment">adjustment4</property>
+ <property name="value">12</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="chk_show_tooltips">
+ <property name="label" translatable="yes">Show icon tooltips. Size:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="tooltip_text" translatable="yes">Select this option to display preview-able files on the desktop as automatically generated thumbnail icons.</property>
<property name="use_underline">True</property>
+ <property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">7</property>
- <property name="width">2</property>
+ <property name="top_attach">5</property>
</packing>
</child>
<child>
@@ -865,36 +912,54 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">4</property>
+ <property name="top_attach">5</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="chk_show_tooltips">
- <property name="label" translatable="yes">Show icon tooltips. Size:</property>
+ <object class="GtkCheckButton" id="chk_show_hidden_files">
+ <property name="label" translatable="yes">Show hidden files on the desktop</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_underline">True</property>
- <property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">4</property>
+ <property name="top_attach">6</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="primary">
- <property name="label" translatable="yes">Show icons on primary display</property>
+ <object class="GtkCheckButton" id="chk_single_click">
+ <property name="label" translatable="yes">Single _click to activate items</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">2</property>
+ <property name="top_attach">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="chk_show_thumbnails">
+ <property name="label" translatable="yes">Show t_humbnails</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="tooltip_text" translatable="yes">Select this option to display preview-able files on the desktop as automatically generated thumbnail icons.</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">8</property>
+ <property name="width">2</property>
</packing>
</child>
<child>
@@ -911,7 +976,7 @@
</object>
</child>
<child type="label">
- <object class="GtkLabel" id="label14">
+ <object class="GtkLabel" id="label15">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@@ -962,7 +1027,7 @@
</object>
</child>
<child type="label">
- <object class="GtkLabel" id="label15">
+ <object class="GtkLabel" id="label16">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
diff --git a/src/xfdesktop-icon-view.c b/src/xfdesktop-icon-view.c
index 44b2a3f..6ef6053 100644
--- a/src/xfdesktop-icon-view.c
+++ b/src/xfdesktop-icon-view.c
@@ -57,6 +57,10 @@
#define DEFAULT_TOOLTIP_SIZE 128
#define MAX_TOOLTIP_SIZE 512
+#define GRAVITY_HORIZONTAL 1
+#define GRAVITY_RIGHT 2
+#define GRAVITY_BOTTOM 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)
@@ -189,6 +193,7 @@ struct _XfdesktopIconViewPrivate
double tooltip_size_from_xfconf;
gboolean single_click;
+ gint gravity;
};
static void xfce_icon_view_set_property(GObject *object,
@@ -373,6 +378,7 @@ enum
PROP_SINGLE_CLICK,
PROP_SHOW_TOOLTIPS,
PROP_TOOLTIP_SIZE,
+ PROP_GRAVITY,
};
@@ -559,6 +565,13 @@ xfdesktop_icon_view_class_init(XfdesktopIconViewClass *klass)
FALSE,
XFDESKTOP_PARAM_FLAGS));
+ g_object_class_install_property(gobject_class, PROP_GRAVITY,
+ g_param_spec_int("gravity",
+ "gravity",
+ "set gravity of 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",
@@ -719,6 +732,10 @@ xfce_icon_view_set_property(GObject *object,
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;
@@ -738,6 +755,10 @@ xfce_icon_view_get_property(GObject *object,
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;
@@ -1526,6 +1547,43 @@ xfdesktop_icon_view_drag_motion(GtkWidget *widget,
return TRUE;
}
+static void
+xfdesktop_next_slot(XfdesktopIconView *icon_view,
+ gint16 *col,
+ gint16 *row,
+ gint16 ncols,
+ gint16 nrows)
+{
+ gint scol = *col, srow = *row;
+
+ if(icon_view->priv->gravity & GRAVITY_HORIZONTAL) {
+ scol += (icon_view->priv->gravity & GRAVITY_RIGHT) ? -1 : 1;
+ if(scol < 0) {
+ scol = ncols - 1;
+ srow += (icon_view->priv->gravity & GRAVITY_BOTTOM) ? -1 : 1;
+ } else {
+ if(scol >= ncols) {
+ scol = 0;
+ srow += (icon_view->priv->gravity & GRAVITY_BOTTOM) ? -1 : 1;
+ }
+ }
+ } else {
+ srow += (icon_view->priv->gravity & GRAVITY_BOTTOM) ? -1 : 1;
+ if(srow < 0) {
+ srow = nrows - 1;
+ scol += (icon_view->priv->gravity & GRAVITY_RIGHT) ? -1 : 1;
+ } else {
+ if(srow >= nrows) {
+ srow = 0;
+ scol += (icon_view->priv->gravity & GRAVITY_RIGHT) ? -1 : 1;
+ }
+ }
+ }
+
+ *col = scol;
+ *row = srow;
+}
+
static gboolean
xfdesktop_icon_view_drag_drop(GtkWidget *widget,
GdkDragContext *context,
@@ -1598,7 +1656,7 @@ xfdesktop_icon_view_drag_drop(GtkWidget *widget,
icon = icon_view->priv->cursor;
g_return_val_if_fail(icon, FALSE);
- /* 1: Get amount of offset between the old spot and new spot
+ /* 1: Get amount of offset between the old slot and new slot
* of the icon that's being dragged.
* 2: Remove all the icons that are going to be moved from
* the desktop. That's in case the icons being moved
@@ -1631,17 +1689,9 @@ xfdesktop_icon_view_drag_drop(GtkWidget *widget,
row += icon_view->priv->nrows;
}
- /* Find the next available spot for an icon if offset spot is not available */
+ /* Find the next available slot for an icon if offset slot 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;
- }
+ xfdesktop_next_slot(icon_view, &col, &row, icon_view->priv->ncols, icon_view->priv->nrows);
}
/* set new position */
@@ -1771,14 +1821,9 @@ xfdesktop_icon_view_append_icons(XfdesktopIconView *icon_view,
GList *l = NULL;
for(l = icon_list; l != NULL; l = g_list_next(l)) {
- /* Find the next available spot for an icon */
+ /* Find the next available slot for an icon */
do {
- if(*row + 1 >= icon_view->priv->nrows) {
- ++*col;
- *row = 0;
- } else {
- ++*row;
- }
+ xfdesktop_next_slot(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 */
@@ -1797,18 +1842,13 @@ xfdesktop_icon_view_sort_icons(XfdesktopIconView *icon_view)
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;
+ gint16 row;
+ gint16 col;
for(l = icon_view->priv->icons; l; l = l->next) {
- gint16 old_row, old_col;
-
/* clear out old position */
xfdesktop_icon_view_invalidate_icon(icon_view, l->data, FALSE);
- if(xfdesktop_icon_get_position(l->data, &old_row, &old_col))
- xfdesktop_grid_set_position_free(icon_view, old_row, old_col);
-
/* Choose the correct list index */
if(XFDESKTOP_IS_SPECIAL_FILE_ICON(l->data)) {
i = 0;
@@ -1828,6 +1868,25 @@ xfdesktop_icon_view_sort_icons(XfdesktopIconView *icon_view)
icons[i] = g_list_prepend(icons[i], l->data);
}
+ /* free all positions in the layout */
+ for(col = 0; col < icon_view->priv->ncols; col++)
+ for(row = 0; row < icon_view->priv->nrows; row++)
+ icon_view->priv->grid_layout[col * icon_view->priv->nrows + row] = NULL;
+
+ /* start at appropriate position */
+ if(icon_view->priv->gravity & GRAVITY_HORIZONTAL) {
+ row = -1;
+ col = icon_view->priv->ncols - 1;
+ } else {
+ row = icon_view->priv->nrows - 1;
+ col = -1;
+ }
+
+ if(icon_view->priv->gravity & GRAVITY_RIGHT)
+ col = icon_view->priv->ncols - 1 - col;
+ if(icon_view->priv->gravity & GRAVITY_BOTTOM)
+ row = icon_view->priv->nrows - 1 - row;
+
/* Append the icons: special, folder, then regular */
for(i = 0; i < sizeof(icons) / sizeof(icons[0]); ++i) {
l = g_list_sort(icons[i],
@@ -3146,7 +3205,7 @@ xfdesktop_move_all_cached_icons_to_desktop(XfdesktopIconView *icon_view)
XF_DEBUG("icon %s setting position row%dxcol%d",
xfdesktop_icon_peek_label(icon), row, col);
- /* Make sure the spot is available */
+ /* Make sure the slot is available */
if(xfdesktop_grid_is_free_position(icon_view, row, col)) {
xfdesktop_icon_set_position(icon, row, col);
xfdesktop_icon_view_add_item_internal(icon_view, icon);
@@ -3166,7 +3225,7 @@ xfdesktop_move_all_cached_icons_to_desktop(XfdesktopIconView *icon_view)
#endif
}
-/* Takes any icons in the pending icons list that has their original spot open.
+/* Takes any icons in the pending icons list that has their original slot open.
* This way icons stay somewhat stable during minor resolution changes */
static void
xfdesktop_move_all_previous_icons_to_desktop(XfdesktopIconView *icon_view)
@@ -3307,7 +3366,7 @@ xfdesktop_grid_is_free_position(XfdesktopIconView *icon_view,
return FALSE;
}
- if(row >= icon_view->priv->nrows || col >= icon_view->priv->ncols)
+ if(row >= icon_view->priv->nrows || col >= icon_view->priv->ncols || row < 0 || col < 0)
{
return FALSE;
}
@@ -3321,19 +3380,48 @@ xfdesktop_grid_get_next_free_position(XfdesktopIconView *icon_view,
gint16 *row,
gint16 *col)
{
- gint i, maxi;
-
+ gint16 i, j, c, r, idx;
+
g_return_val_if_fail(row && col, FALSE);
-
- maxi = icon_view->priv->nrows * icon_view->priv->ncols;
- for(i = 0; i < maxi; ++i) {
- if(!icon_view->priv->grid_layout[i]) {
- *row = i % icon_view->priv->nrows;
- *col = i / icon_view->priv->nrows;
- return TRUE;
+
+ if(icon_view->priv->gravity & GRAVITY_HORIZONTAL) {
+ for(j = 0; j < icon_view->priv->nrows; ++j) {
+ r = (icon_view->priv->gravity & GRAVITY_BOTTOM) ?
+ icon_view->priv->nrows - 1 - j : j;
+
+ for(i = 0; i < icon_view->priv->ncols; ++i) {
+ c = (icon_view->priv->gravity & GRAVITY_RIGHT) ?
+ icon_view->priv->ncols - 1 - i : i;
+
+ idx = c * icon_view->priv->nrows + r;
+
+ if(!icon_view->priv->grid_layout[idx]) {
+ *col = c;
+ *row = r;
+ return TRUE;
+ }
+ }
+ }
+ } else {
+ for(i = 0; i < icon_view->priv->ncols; ++i) {
+ c = (icon_view->priv->gravity & GRAVITY_RIGHT) ?
+ icon_view->priv->ncols - 1 - i : i;
+
+ for(j = 0; j < icon_view->priv->nrows; ++j) {
+ r = (icon_view->priv->gravity & GRAVITY_BOTTOM) ?
+ icon_view->priv->nrows - 1 - j : j;
+
+ idx = c * icon_view->priv->nrows + r;
+
+ if(!icon_view->priv->grid_layout[idx]) {
+ *col = c;
+ *row = r;
+ return TRUE;
+ }
+ }
}
}
-
+
return FALSE;
}
@@ -3344,7 +3432,8 @@ xfdesktop_grid_set_position_free(XfdesktopIconView *icon_view,
gint16 col)
{
g_return_if_fail(row < icon_view->priv->nrows
- && col < icon_view->priv->ncols);
+ && col < icon_view->priv->ncols
+ && row >= 0 && col >= 0);
#if 0 /*def DEBUG*/
DUMP_GRID_LAYOUT(icon_view);
@@ -3366,7 +3455,8 @@ xfdesktop_grid_unset_position_free_raw(XfdesktopIconView *icon_view,
gint idx;
g_return_val_if_fail(row < icon_view->priv->nrows
- && col < icon_view->priv->ncols, FALSE);
+ && col < icon_view->priv->ncols
+ && row >= 0 && col >= 0, FALSE);
idx = col * icon_view->priv->nrows + row;
if(icon_view->priv->grid_layout[idx])
@@ -3523,6 +3613,12 @@ xfdesktop_icon_view_new(XfdesktopIconViewManager *manager)
"single_click");
xfconf_g_property_bind(icon_view->priv->channel,
+ "/desktop-icons/gravity",
+ G_TYPE_INT,
+ G_OBJECT(icon_view),
+ "gravity");
+
+ xfconf_g_property_bind(icon_view->priv->channel,
"/desktop-icons/show-tooltips",
G_TYPE_BOOLEAN,
G_OBJECT(icon_view),
@@ -3603,10 +3699,12 @@ xfdesktop_icon_view_icon_find_position(XfdesktopIconView *icon_view,
{
gint16 row, col;
- if(!xfdesktop_icon_get_position(icon, &row, &col)
- || !xfdesktop_grid_is_free_position(icon_view, row, col))
+ if (!xfdesktop_icon_get_position(icon, &row, &col)
+ || !xfdesktop_grid_is_free_position(icon_view, row, col)
+ || (((icon_view->priv->gravity & GRAVITY_BOTTOM) ||
+ (icon_view->priv->gravity & GRAVITY_RIGHT)) && row == 0 && col == 0))
{
- if(xfdesktop_grid_get_next_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);
@@ -3909,8 +4007,7 @@ xfdesktop_icon_view_widget_coords_to_item(XfdesktopIconView *icon_view,
gint16 row, col;
xfdesktop_xy_to_rowcol(icon_view, wx, wy, &row, &col);
- if(row < 0 || col < 0 || row >= icon_view->priv->nrows
- || col >= icon_view->priv->ncols)
+ if(row >= icon_view->priv->nrows || col >= icon_view->priv->ncols || row < 0 || col < 0)
{
return NULL;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list