[nautilus/wip/csoriano/flow] f
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/csoriano/flow] f
- Date: Tue, 29 Nov 2016 17:11:16 +0000 (UTC)
commit 78eb13398b93f939187accfc3902054235c397e4
Author: Carlos Soriano <csoriano gnome org>
Date: Tue Nov 29 18:10:47 2016 +0100
f
src/nautilus-file.c | 2 +-
src/nautilus-files-view.c | 4 ---
src/nautilus-icon-view.c | 57 +++++++++++++++++++++++++++++-----------
src/resources/css/Adwaita.css | 12 ++++++++-
4 files changed, 53 insertions(+), 22 deletions(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index e5fde42..7ac55c8 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -5338,7 +5338,7 @@ nautilus_file_get_thumbnail_icon (NautilusFile *file,
}
else
{
- nautilus_ui_frame_image (&pixbuf);
+ //nautilus_ui_frame_image (&pixbuf);
}
}
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 8435c4b..bcf64d2 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -750,10 +750,8 @@ nautilus_files_view_can_zoom_in (NautilusFilesView *view)
{
g_return_val_if_fail (NAUTILUS_IS_FILES_VIEW (view), FALSE);
- g_print ("eeo supports zooming %d\n", view->details->supports_zooming);
if (!nautilus_files_view_supports_zooming (view))
{
- g_print ("wooow\n");
return FALSE;
}
@@ -787,7 +785,6 @@ nautilus_files_view_supports_zooming (NautilusFilesView *view)
{
g_return_val_if_fail (NAUTILUS_IS_FILES_VIEW (view), FALSE);
- g_print ("supports zooming %d\n", view->details->supports_zooming);
return view->details->supports_zooming;
}
@@ -7394,7 +7391,6 @@ real_update_actions_state (NautilusFilesView *view)
"zoom-in");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
nautilus_files_view_can_zoom_in (view));
- g_print ("enabling zoom in!!!!! %d\n", nautilus_files_view_can_zoom_in (view));
action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group),
"zoom-out");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
diff --git a/src/nautilus-icon-view.c b/src/nautilus-icon-view.c
index b0f585f..f2714dc 100644
--- a/src/nautilus-icon-view.c
+++ b/src/nautilus-icon-view.c
@@ -110,7 +110,6 @@ real_remove_file (NautilusFilesView *self,
priv = nautilus_icon_view_get_instance_private (self);
- g_print ("remove file %s\n", nautilus_file_get_uri (file));
while (current_file = g_list_model_get_item (priv->model, i))
{
if (current_file == file)
@@ -174,7 +173,6 @@ real_get_zoom_level (NautilusFilesView *self)
static guint
get_icon_size_for_zoom_level (NautilusCanvasZoomLevel zoom_level)
{
- g_print ("get icon size for zoom level %d\n", zoom_level);
switch (zoom_level)
{
case NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL:
@@ -222,21 +220,26 @@ create_icon (NautilusIconView *self,
icon_pixbuf = nautilus_file_get_icon_pixbuf (file, get_icon_size_for_zoom_level (priv->zoom_level),
TRUE, 1, flags);
icon = gtk_image_new_from_pixbuf (icon_pixbuf);
- gtk_widget_set_hexpand (icon_pixbuf, TRUE);
- gtk_widget_set_vexpand (icon_pixbuf, TRUE);
- gtk_widget_set_valign (icon, GTK_ALIGN_END);
- gtk_widget_set_halign (icon, GTK_ALIGN_FILL);
+ gtk_widget_set_hexpand (icon, TRUE);
+ gtk_widget_set_vexpand (icon, TRUE);
+ gtk_widget_set_valign (icon, GTK_ALIGN_CENTER);
+ gtk_widget_set_halign (icon, GTK_ALIGN_CENTER);
+
fixed_height_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_widget_set_size_request (fixed_height_box, 96,
+ gtk_widget_set_valign (fixed_height_box, GTK_ALIGN_CENTER);
+ gtk_widget_set_halign (fixed_height_box, GTK_ALIGN_CENTER);
+ gtk_widget_set_size_request (fixed_height_box, get_icon_size_for_zoom_level (priv->zoom_level),
get_icon_size_for_zoom_level (priv->zoom_level));
- GtkStyleContext *style_contet = gtk_widget_get_style_context (icon);
+
+
+ GtkStyleContext *style_contet = gtk_widget_get_style_context (fixed_height_box);
//.icon-background {background-color:#fbfbfb; box-shadow: 0px 0px 4px #DDD; margin-bottom:4px}
gtk_style_context_add_class (style_contet, "icon-background");
#if 0
gtk_widget_set_size_request (fixed_height_box, 130,
-1);
#endif
- gtk_box_pack_start (fixed_height_box, icon, TRUE, TRUE, 0);
+ gtk_box_pack_start (fixed_height_box, icon, FALSE, FALSE, 0);
gtk_widget_show_all (fixed_height_box);
@@ -250,10 +253,14 @@ replace_icon (NautilusIconView *self,
GtkWidget *new_icon;
GtkWidget *old_icon;
GtkWidget *box;
+ GtkWidget *label;
NautilusFile *file;
+ gint label_nat_size;
+ gint icon_nat_size;
file = g_object_get_data (flow_box_item, "file");
old_icon = g_object_get_data (flow_box_item, "icon");
+ label = g_object_get_data (flow_box_item, "label");
box = gtk_bin_get_child (GTK_BIN (flow_box_item));
gtk_container_remove (GTK_CONTAINER (box), old_icon);
@@ -272,7 +279,6 @@ set_icon_size (NautilusIconView *self,
g_autoptr (GList) box_children;
GtkWidget *flow_box_item;
- g_print ("new size %d\n", icon_size);
items = gtk_container_get_children (priv->flow_box);
for (l = items; l; l = l->next)
@@ -454,7 +460,6 @@ action_zoom_to_level (GSimpleAction *action,
gpointer user_data)
{
NautilusIconView *self = NAUTILUS_ICON_VIEW (user_data);
- guint icon_size;
set_zoom_level (self, g_variant_get_int32 (state));
g_simple_action_set_state (G_SIMPLE_ACTION (action), state);
@@ -469,10 +474,13 @@ create_widget_func (gpointer item,
NautilusIconViewPrivate *priv = nautilus_icon_view_get_instance_private (self);
GtkFlowBoxChild *child;
GtkBox *container;
+ gint label_nat_size;
+ gint icon_nat_size;
GtkLabel *label;
GtkWidget *icon;
+ GtkStyleContext *style_context;
- container = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+ container = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
icon = create_icon (self, file);
gtk_box_pack_start (container, icon, FALSE, FALSE, 0);
@@ -480,20 +488,37 @@ create_widget_func (gpointer item,
label = gtk_label_new (nautilus_file_get_display_name (file));
gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_END);
gtk_label_set_max_width_chars (label, 0);
+ gtk_label_set_width_chars (label, 10);
gtk_label_set_line_wrap (label, TRUE);
gtk_label_set_line_wrap_mode (label, PANGO_WRAP_WORD_CHAR);
gtk_label_set_lines (label, 4);
gtk_label_set_justify (label, GTK_JUSTIFY_CENTER);
- gtk_widget_set_valign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (GTK_WIDGET (label), GTK_ALIGN_START);
gtk_box_pack_end (container, label, TRUE, TRUE, 0);
+ style_context = gtk_widget_get_style_context (container);
+ gtk_style_context_add_class (style_context, "icon-item-background");
+
+
+#if 0
+flowboxchild:selected{background-color:transparent;}
+flowboxchild:selected > box .icon-background {background-color:#4a90d9; border-color:#4a90d9;
border-style:solid; border-width:2px; border-radius:4px 4px 0px 0px;}
+flowboxchild > box .icon-background {border-color:transparent; border-style:solid; border-width:2px;
border-radius:4px 4px 0px 0px;}
+flowboxchild:selected > box .label-background{background-color:#4a90d9; border-color:#4a90d9;
border-style:solid; border-width:2px;border-radius:0px 0px 4px 4px;}
+flowboxchild > box .label-background{border-color:transparent; border-style:solid;
border-width:2px;border-radius:0px 0px 4px 4px;}
+#endif
gtk_widget_show_all (container);
+ gtk_widget_set_valign (container, GTK_ALIGN_START);
+ gtk_widget_set_halign (container, GTK_ALIGN_CENTER);
child = gtk_flow_box_child_new ();
gtk_container_add (child, container);
g_object_set_data (child, "file", file);
g_object_set_data (child, "icon", icon);
+ g_object_set_data (child, "label", label);
+ gtk_widget_set_size_request (GTK_WIDGET (child),
+ MAX (NAUTILUS_CANVAS_ICON_SIZE_LARGE, get_icon_size_for_zoom_level
(priv->zoom_level)), -1);
return child;
}
@@ -508,7 +533,6 @@ on_child_activated (GtkFlowBox *flow_box,
NautilusFile *file;
g_autoptr (GList) list = NULL;
- g_print ("###############ACTIVATED\n");
file = g_object_get_data (G_OBJECT (child), "file");
list = g_list_append (list, file);
@@ -586,6 +610,7 @@ nautilus_icon_view_init (NautilusIconView *self)
priv->flow_box = gtk_flow_box_new ();
gtk_flow_box_set_activate_on_single_click (priv->flow_box, FALSE);
gtk_flow_box_set_max_children_per_line (priv->flow_box, 20);
+ gtk_flow_box_set_selection_mode (priv->flow_box, GTK_SELECTION_MULTIPLE);
gtk_flow_box_bind_model (GTK_FLOW_BOX (priv->flow_box), priv->model,
create_widget_func, self, NULL);
gtk_flow_box_set_homogeneous (priv->flow_box, FALSE);
@@ -593,9 +618,9 @@ nautilus_icon_view_init (NautilusIconView *self)
gtk_flow_box_set_column_spacing (priv->flow_box, 8);
gtk_widget_set_valign (priv->flow_box, GTK_ALIGN_START);
gtk_widget_set_margin_top (priv->flow_box, 10);
- gtk_widget_set_margin_right (priv->flow_box, 10);
+ gtk_widget_set_margin_start (priv->flow_box, 10);
gtk_widget_set_margin_bottom (priv->flow_box, 10);
- gtk_widget_set_margin_left (priv->flow_box, 10);
+ gtk_widget_set_margin_end (priv->flow_box, 10);
g_signal_connect (priv->flow_box, "child-activated", (GCallback) on_child_activated, self);
diff --git a/src/resources/css/Adwaita.css b/src/resources/css/Adwaita.css
index 48beeee..8938f89 100644
--- a/src/resources/css/Adwaita.css
+++ b/src/resources/css/Adwaita.css
@@ -184,4 +184,14 @@ searchbar { border-top: 1px solid @borders; }
.conflict-row:selected {
background: @theme_selected_bg_color;
color: @theme_selected_fg_color;
-}
\ No newline at end of file
+}
+
+/* Icon view */
+flowboxchild:selected{background-color:transparent;}
+
+flowboxchild > box .icon-background {padding:0px; background-color:black; border-color:#4a90d9;
border-style:solid; border-width:0px;}
+flowboxchild:selected > box .icon-background {padding:0px; background-color:black; border-color:#4a90d9;
border-style:solid; border-width:0px;}
+
+flowboxchild > .icon-item-background {padding:4px;}
+flowboxchild:selected > .icon-item-background {padding:4px; background-color:#4a90d9; border-color:#4a90d9;
border-style:solid; border-width:0px; border-radius:4px 4px 4px 4px;}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]