[nautilus] Add an "highlighted-for-clipboard" property to the item.
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] Add an "highlighted-for-clipboard" property to the item.
- Date: Thu, 20 May 2010 09:39:29 +0000 (UTC)
commit 226e7ba044f15cb22e8f9c3966625c496913f3df
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sat May 15 15:32:20 2010 +0200
Add an "highlighted-for-clipboard" property to the item.
libnautilus-private/nautilus-icon-canvas-item.c | 33 ++++++++++++++++++++---
libnautilus-private/nautilus-icon-container.c | 27 ++++++++++++++++++
libnautilus-private/nautilus-icon-container.h | 2 +
3 files changed, 58 insertions(+), 4 deletions(-)
---
diff --git a/libnautilus-private/nautilus-icon-canvas-item.c b/libnautilus-private/nautilus-icon-canvas-item.c
index ed7992b..f6c0b93 100644
--- a/libnautilus-private/nautilus-icon-canvas-item.c
+++ b/libnautilus-private/nautilus-icon-canvas-item.c
@@ -117,12 +117,14 @@ struct NautilusIconCanvasItemDetails {
guint is_highlighted_for_selection : 1;
guint is_highlighted_as_keyboard_focus: 1;
guint is_highlighted_for_drop : 1;
+ guint is_highlighted_for_clipboard : 1;
guint show_stretch_handles : 1;
guint is_prelit : 1;
guint rendered_is_active : 1;
guint rendered_is_highlighted_for_selection : 1;
guint rendered_is_highlighted_for_drop : 1;
+ guint rendered_is_highlighted_for_clipboard : 1;
guint rendered_is_prelit : 1;
guint rendered_is_focused : 1;
@@ -160,7 +162,8 @@ enum {
PROP_ADDITIONAL_TEXT,
PROP_HIGHLIGHTED_FOR_SELECTION,
PROP_HIGHLIGHTED_AS_KEYBOARD_FOCUS,
- PROP_HIGHLIGHTED_FOR_DROP
+ PROP_HIGHLIGHTED_FOR_DROP,
+ PROP_HIGHLIGHTED_FOR_CLIPBOARD
};
typedef enum {
@@ -446,7 +449,14 @@ nautilus_icon_canvas_item_set_property (GObject *object,
}
details->is_highlighted_for_drop = g_value_get_boolean (value);
break;
-
+
+ case PROP_HIGHLIGHTED_FOR_CLIPBOARD:
+ if (!details->is_highlighted_for_clipboard == !g_value_get_boolean (value)) {
+ return;
+ }
+ details->is_highlighted_for_clipboard = g_value_get_boolean (value);
+ break;
+
default:
g_warning ("nautilus_icons_view_item_item_set_arg on unknown argument");
return;
@@ -488,6 +498,10 @@ nautilus_icon_canvas_item_get_property (GObject *object,
g_value_set_boolean (value, details->is_highlighted_for_drop);
break;
+ case PROP_HIGHLIGHTED_FOR_CLIPBOARD:
+ g_value_set_boolean (value, details->is_highlighted_for_clipboard);
+ break;
+
default:
g_warning ("invalid property %d", property_id);
break;
@@ -1708,7 +1722,8 @@ real_map_pixbuf (NautilusIconCanvasItem *icon_item)
g_object_ref (temp_pixbuf);
- if (icon_item->details->is_prelit) {
+ if (icon_item->details->is_prelit ||
+ icon_item->details->is_highlighted_for_clipboard) {
old_pixbuf = temp_pixbuf;
gtk_widget_style_get (GTK_WIDGET (container),
@@ -1821,6 +1836,7 @@ map_pixbuf (NautilusIconCanvasItem *icon_item)
&& icon_item->details->rendered_is_prelit == icon_item->details->is_prelit
&& icon_item->details->rendered_is_highlighted_for_selection == icon_item->details->is_highlighted_for_selection
&& icon_item->details->rendered_is_highlighted_for_drop == icon_item->details->is_highlighted_for_drop
+ && icon_item->details->rendered_is_highlighted_for_clipboard == icon_item->details->is_highlighted_for_clipboard
&& (icon_item->details->is_highlighted_for_selection && icon_item->details->rendered_is_focused == gtk_widget_has_focus (GTK_WIDGET (EEL_CANVAS_ITEM (icon_item)->canvas))))) {
if (icon_item->details->rendered_pixbuf != NULL) {
g_object_unref (icon_item->details->rendered_pixbuf);
@@ -1830,6 +1846,7 @@ map_pixbuf (NautilusIconCanvasItem *icon_item)
icon_item->details->rendered_is_prelit = icon_item->details->is_prelit;
icon_item->details->rendered_is_highlighted_for_selection = icon_item->details->is_highlighted_for_selection;
icon_item->details->rendered_is_highlighted_for_drop = icon_item->details->is_highlighted_for_drop;
+ icon_item->details->rendered_is_highlighted_for_clipboard = icon_item->details->is_highlighted_for_clipboard;
icon_item->details->rendered_is_focused = gtk_widget_has_focus (GTK_WIDGET (EEL_CANVAS_ITEM (icon_item)->canvas));
}
@@ -3518,7 +3535,15 @@ nautilus_icon_canvas_item_class_init (NautilusIconCanvasItemClass *class)
g_param_spec_boolean ("highlighted_for_drop",
"highlighted for drop",
"whether we are highlighted for a D&D drop",
- FALSE, G_PARAM_READWRITE));
+ FALSE, G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_HIGHLIGHTED_FOR_CLIPBOARD,
+ g_param_spec_boolean ("highlighted_for_clipboard",
+ "highlighted for clipboard",
+ "whether we are highlighted for a clipboard paste (after we have been cut)",
+ FALSE, G_PARAM_READWRITE));
item_class->update = nautilus_icon_canvas_item_update;
item_class->draw = nautilus_icon_canvas_item_draw;
diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c
index 5f06f5c..c554c8c 100644
--- a/libnautilus-private/nautilus-icon-container.c
+++ b/libnautilus-private/nautilus-icon-container.c
@@ -8946,6 +8946,33 @@ nautilus_icon_container_set_all_columns_same_width (NautilusIconContainer *conta
}
}
+/**
+ * nautilus_icon_container_set_highlighted_for_clipboard
+ * @container: An icon container widget.
+ * @data: Icon Data associated with all icons that should be highlighted.
+ * Others will be unhighlighted.
+ **/
+void
+nautilus_icon_container_set_highlighted_for_clipboard (NautilusIconContainer *container,
+ GList *clipboard_icon_data)
+{
+ GList *l;
+ NautilusIcon *icon;
+ gboolean highlighted_for_clipboard;
+
+ g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
+
+ for (l = container->details->icons; l != NULL; l = l->next) {
+ icon = l->data;
+ highlighted_for_clipboard = (g_list_find (clipboard_icon_data, icon->data) != NULL);
+
+ eel_canvas_item_set (EEL_CANVAS_ITEM (icon->item),
+ "highlighted-for-clipboard", highlighted_for_clipboard,
+ NULL);
+ }
+
+}
+
/* NautilusIconContainerAccessible */
static NautilusIconContainerAccessiblePrivate *
diff --git a/libnautilus-private/nautilus-icon-container.h b/libnautilus-private/nautilus-icon-container.h
index 0ec896d..b5f0dce 100644
--- a/libnautilus-private/nautilus-icon-container.h
+++ b/libnautilus-private/nautilus-icon-container.h
@@ -285,6 +285,8 @@ void nautilus_icon_container_freeze_icon_positions (Nautilu
int nautilus_icon_container_get_max_layout_lines (NautilusIconContainer *container);
int nautilus_icon_container_get_max_layout_lines_for_pango (NautilusIconContainer *container);
+void nautilus_icon_container_set_highlighted_for_clipboard (NautilusIconContainer *container,
+ GList *clipboard_icon_data);
/* operations on all icons */
void nautilus_icon_container_unselect_all (NautilusIconContainer *view);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]