diff options
author | Carlos Soriano <csoriano@gnome.org> | 2016-10-11 19:01:43 +0200 |
---|---|---|
committer | Carlos Soriano <csoriano@gnome.org> | 2016-10-11 19:03:04 +0200 |
commit | 397f0ffde35c62d340b772ad1fb0c1375186c1e9 (patch) | |
tree | 7de03157b75a4a3bdd6c3040a063b2b481e3bda4 /src/gtk | |
parent | 91c37ec449a6a1d15d2ef6ceef9a32b2b5ec939a (diff) | |
download | nautilus-397f0ffde35c62d340b772ad1fb0c1375186c1e9.tar.gz |
gtkplacesview: update to latest code
https://bugzilla.gnome.org/show_bug.cgi?id=771161
Diffstat (limited to 'src/gtk')
-rw-r--r-- | src/gtk/nautilusgtkplacesviewrow.c | 31 | ||||
-rw-r--r-- | src/gtk/nautilusgtkplacesviewrow.ui | 45 |
2 files changed, 47 insertions, 29 deletions
diff --git a/src/gtk/nautilusgtkplacesviewrow.c b/src/gtk/nautilusgtkplacesviewrow.c index 5c820cf3d..121c5823b 100644 --- a/src/gtk/nautilusgtkplacesviewrow.c +++ b/src/gtk/nautilusgtkplacesviewrow.c @@ -35,6 +35,7 @@ #include "gtkintl.h" #include "gtklabel.h" #include "gtkspinner.h" +#include "gtkstack.h" #include "gtktypebuiltins.h" #else #include <gtk/gtk.h> @@ -45,6 +46,7 @@ struct _NautilusGtkPlacesViewRow GtkListBoxRow parent_instance; GtkLabel *available_space_label; + GtkStack *mount_stack; GtkSpinner *busy_spinner; GtkButton *eject_button; GtkImage *eject_icon; @@ -287,15 +289,15 @@ nautilus_gtk_places_view_row_set_property (GObject *object, case PROP_MOUNT: g_set_object (&self->mount, g_value_get_object (value)); - - /* - * When we hide the eject button, no size is allocated for it. Since - * we want to have alignment between rows, it needs an empty space - * when the eject button is not available. So, call then - * gtk_widget_set_child_visible(), which makes the button allocate the - * size but it stays hidden when needed. - */ - gtk_widget_set_child_visible (GTK_WIDGET (self->eject_button), self->mount != NULL); + if (self->mount != NULL) + { + gtk_stack_set_visible_child (self->mount_stack, GTK_WIDGET (self->eject_button)); + gtk_widget_set_child_visible (GTK_WIDGET (self->mount_stack), TRUE); + } + else + { + gtk_widget_set_child_visible (GTK_WIDGET (self->mount_stack), FALSE); + } measure_available_space (self); break; @@ -378,6 +380,7 @@ nautilus_gtk_places_view_row_class_init (NautilusGtkPlacesViewRowClass *klass) gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/nautilus/gtk/ui/nautilusgtkplacesviewrow.ui"); gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesViewRow, available_space_label); + gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesViewRow, mount_stack); gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesViewRow, busy_spinner); gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesViewRow, eject_button); gtk_widget_class_bind_template_child (widget_class, NautilusGtkPlacesViewRow, eject_icon); @@ -449,7 +452,15 @@ nautilus_gtk_places_view_row_set_busy (NautilusGtkPlacesViewRow *row, { g_return_if_fail (NAUTILUS_IS_GTK_PLACES_VIEW_ROW (row)); - gtk_widget_set_visible (GTK_WIDGET (row->busy_spinner), is_busy); + if (is_busy) + { + gtk_stack_set_visible_child (row->mount_stack, GTK_WIDGET (row->busy_spinner)); + gtk_widget_set_child_visible (GTK_WIDGET (row->mount_stack), TRUE); + } + else + { + gtk_widget_set_child_visible (GTK_WIDGET (row->mount_stack), FALSE); + } } gboolean diff --git a/src/gtk/nautilusgtkplacesviewrow.ui b/src/gtk/nautilusgtkplacesviewrow.ui index f1460e163..99d2dcb42 100644 --- a/src/gtk/nautilusgtkplacesviewrow.ui +++ b/src/gtk/nautilusgtkplacesviewrow.ui @@ -60,35 +60,42 @@ </packing> </child> <child> - <object class="GtkButton" id="eject_button"> + <object class="GtkStack" id="mount_stack"> <property name="visible">1</property> - <property name="halign">end</property> - <property name="valign">center</property> - <property name="tooltip-text" translatable="yes">Unmount</property> + <property name="hhomogeneous">1</property> + <property name="vhomogeneous">1</property> <child> - <object class="GtkImage" id="eject_icon"> + <object class="GtkButton" id="eject_button"> <property name="visible">1</property> - <property name="icon-name">media-eject-symbolic</property> - <property name="icon-size">1</property> + <property name="halign">center</property> + <property name="valign">center</property> + <property name="tooltip-text" translatable="yes">Unmount</property> + <child> + <object class="GtkImage" id="eject_icon"> + <property name="visible">1</property> + <property name="icon-name">media-eject-symbolic</property> + <property name="icon-size">1</property> + </object> + </child> + <style> + <class name="image-button"/> + <class name="sidebar-button"/> + </style> + </object> + </child> + <child> + <object class="GtkSpinner" id="busy_spinner"> + <property name="visible">1</property> + <property name="active">1</property> + <property name="halign">center</property> + <property name="valign">center</property> </object> </child> - <style> - <class name="image-button"/> - <class name="sidebar-button"/> - </style> </object> <packing> <property name="position">4</property> </packing> </child> - <child> - <object class="GtkSpinner" id="busy_spinner"> - <property name="active">1</property> - </object> - <packing> - <property name="position">5</property> - </packing> - </child> </object> </child> </object> |