Compare commits
6 Commits
async-colo
...
wip/gbsnet
Author | SHA1 | Date | |
---|---|---|---|
|
6db38ae891 | ||
|
b4389ffb5e | ||
|
63b626deba | ||
|
08bc1a4363 | ||
|
d128fc1b76 | ||
|
6d20d810a4 |
@@ -4707,7 +4707,8 @@ gtk_places_sidebar_set_show_connect_to_server (GtkPlacesSidebar *sidebar,
|
||||
*
|
||||
* Returns: %TRUE if the sidebar will display a “Connect to Server” item.
|
||||
*
|
||||
* Deprecated: 3.18: use gtk_places_sidebar_get_show_other_locations() instead.
|
||||
* Deprecated: 3.18: It is recommended to group this functionality with the drives
|
||||
* and network location under the new 'Other Location' item
|
||||
*/
|
||||
gboolean
|
||||
gtk_places_sidebar_get_show_connect_to_server (GtkPlacesSidebar *sidebar)
|
||||
@@ -4729,7 +4730,7 @@ gtk_places_sidebar_get_show_connect_to_server (GtkPlacesSidebar *sidebar)
|
||||
* If you enable this, you should connect to the
|
||||
* #GtkPlacesSidebar::show-enter-location signal.
|
||||
*
|
||||
* Deprecated: 3.18: use gtk_places_sidebar_set_show_other_locations() instead.
|
||||
* Since: 3.14
|
||||
*/
|
||||
void
|
||||
gtk_places_sidebar_set_show_enter_location (GtkPlacesSidebar *sidebar,
|
||||
|
@@ -47,19 +47,11 @@
|
||||
* selects a location to open in the view.
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MODE_BROWSE,
|
||||
MODE_EMPTY,
|
||||
MODE_EMPTY_SEARCH
|
||||
} PlacesViewMode;
|
||||
|
||||
struct _GtkPlacesViewPrivate
|
||||
{
|
||||
GVolumeMonitor *volume_monitor;
|
||||
GtkPlacesOpenFlags open_flags;
|
||||
GtkPlacesOpenFlags current_open_flags;
|
||||
PlacesViewMode mode;
|
||||
|
||||
GFile *server_list_file;
|
||||
GFileMonitor *server_list_monitor;
|
||||
@@ -71,10 +63,7 @@ struct _GtkPlacesViewPrivate
|
||||
GtkWidget *actionbar;
|
||||
GtkWidget *address_entry;
|
||||
GtkWidget *connect_button;
|
||||
GtkWidget *drives_box;
|
||||
GtkWidget *drives_listbox;
|
||||
GtkWidget *network_grid;
|
||||
GtkWidget *network_listbox;
|
||||
GtkWidget *listbox;
|
||||
GtkWidget *popup_menu;
|
||||
GtkWidget *recent_servers_listbox;
|
||||
GtkWidget *recent_servers_popover;
|
||||
@@ -342,16 +331,22 @@ activate_row (GtkPlacesView *view,
|
||||
GtkPlacesViewPrivate *priv;
|
||||
GVolume *volume;
|
||||
GMount *mount;
|
||||
GFile *file;
|
||||
|
||||
priv = gtk_places_view_get_instance_private (view);
|
||||
mount = gtk_places_view_row_get_mount (row);
|
||||
volume = gtk_places_view_row_get_volume (row);
|
||||
file = gtk_places_view_row_get_file (row);
|
||||
|
||||
if (mount)
|
||||
if (file)
|
||||
{
|
||||
emit_open_location (view, file, flags);
|
||||
}
|
||||
else if (mount)
|
||||
{
|
||||
GFile *location = g_mount_get_root (mount);
|
||||
|
||||
emit_open_location (view, location, GTK_PLACES_OPEN_NORMAL);
|
||||
emit_open_location (view, location, flags);
|
||||
|
||||
g_object_unref (location);
|
||||
}
|
||||
@@ -588,97 +583,41 @@ populate_servers (GtkPlacesView *view)
|
||||
g_bookmark_file_free (server_list);
|
||||
}
|
||||
|
||||
static void
|
||||
places_view_mode_set (GtkPlacesView *view,
|
||||
PlacesViewMode mode)
|
||||
{
|
||||
GtkPlacesViewPrivate *priv;
|
||||
|
||||
priv = gtk_places_view_get_instance_private (view);
|
||||
|
||||
gtk_widget_set_visible (priv->network_grid, !priv->local_only);
|
||||
|
||||
if (priv->mode != mode)
|
||||
{
|
||||
priv->mode = mode;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case MODE_BROWSE:
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), "browse");
|
||||
break;
|
||||
|
||||
case MODE_EMPTY:
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), "empty");
|
||||
break;
|
||||
|
||||
case MODE_EMPTY_SEARCH:
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), "search");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
update_view_mode (GtkPlacesView *view)
|
||||
{
|
||||
GtkPlacesViewPrivate *priv;
|
||||
GList *children;
|
||||
GList *l;
|
||||
gboolean show_drives;
|
||||
gboolean show_networks;
|
||||
gboolean show_listbox;
|
||||
|
||||
priv = gtk_places_view_get_instance_private (view);
|
||||
show_drives = FALSE;
|
||||
show_networks = FALSE;
|
||||
show_listbox = FALSE;
|
||||
|
||||
/* drives */
|
||||
children = gtk_container_get_children (GTK_CONTAINER (priv->drives_listbox));
|
||||
children = gtk_container_get_children (GTK_CONTAINER (priv->listbox));
|
||||
|
||||
for (l = children; l; l = l->next)
|
||||
{
|
||||
/* GtkListBox filter rows by changing their GtkWidget::child-visible property */
|
||||
if (gtk_widget_get_child_visible (l->data))
|
||||
{
|
||||
show_drives = TRUE;
|
||||
show_listbox = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free (children);
|
||||
|
||||
/* networks */
|
||||
if (!priv->local_only)
|
||||
if (!show_listbox &&
|
||||
priv->search_query &&
|
||||
priv->search_query[0] != '\0')
|
||||
{
|
||||
children = gtk_container_get_children (GTK_CONTAINER (priv->network_listbox));
|
||||
|
||||
for (l = children; l; l = l->next)
|
||||
{
|
||||
/* GtkListBox filter rows by changing their GtkWidget::child-visible property */
|
||||
if (gtk_widget_get_child_visible (l->data))
|
||||
{
|
||||
show_networks = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free (children);
|
||||
}
|
||||
|
||||
gtk_widget_set_visible (priv->drives_box, show_drives);
|
||||
gtk_widget_set_visible (priv->network_grid, show_networks);
|
||||
|
||||
if (!show_drives && !show_networks)
|
||||
{
|
||||
if (priv->search_query && priv->search_query[0] != '\0')
|
||||
places_view_mode_set (view, MODE_EMPTY_SEARCH);
|
||||
else
|
||||
places_view_mode_set (view, MODE_EMPTY);
|
||||
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), "empty-search");
|
||||
}
|
||||
else
|
||||
{
|
||||
places_view_mode_set (view, MODE_BROWSE);
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), "browse");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -688,12 +627,10 @@ insert_row (GtkPlacesView *view,
|
||||
gboolean is_network)
|
||||
{
|
||||
GtkPlacesViewPrivate *priv;
|
||||
GtkWidget *container;
|
||||
GtkWidget *list;
|
||||
|
||||
priv = gtk_places_view_get_instance_private (view);
|
||||
list = is_network ? priv->network_listbox : priv->drives_listbox;
|
||||
container = is_network ? priv->network_grid : priv->drives_box;
|
||||
|
||||
g_object_set_data (G_OBJECT (row), "is-network", GINT_TO_POINTER (is_network));
|
||||
|
||||
g_signal_connect_swapped (gtk_places_view_row_get_event_box (GTK_PLACES_VIEW_ROW (row)),
|
||||
"button-press-event",
|
||||
@@ -710,15 +647,7 @@ insert_row (GtkPlacesView *view,
|
||||
G_CALLBACK (on_eject_button_clicked),
|
||||
row);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (list), row);
|
||||
|
||||
if (!priv->local_only || (priv->local_only && !is_network))
|
||||
{
|
||||
gtk_widget_show (container);
|
||||
|
||||
if (priv->mode == MODE_EMPTY)
|
||||
places_view_mode_set (view, MODE_BROWSE);
|
||||
}
|
||||
gtk_container_add (GTK_CONTAINER (priv->listbox), row);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -758,7 +687,7 @@ add_volume (GtkPlacesView *view,
|
||||
root = mount ? g_mount_get_root (mount) : NULL;
|
||||
icon = g_volume_get_icon (volume);
|
||||
name = g_volume_get_name (volume);
|
||||
path = root ? g_file_get_parse_name (root) : NULL;
|
||||
path = !is_network ? g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE) : NULL;
|
||||
|
||||
if (!mount ||
|
||||
(mount && !g_mount_is_shadowed (mount)))
|
||||
@@ -771,6 +700,7 @@ add_volume (GtkPlacesView *view,
|
||||
"path", path ? path : "",
|
||||
"volume", volume,
|
||||
"mount", mount,
|
||||
"file", NULL,
|
||||
NULL);
|
||||
|
||||
insert_row (view, row, is_network);
|
||||
@@ -814,6 +744,7 @@ add_mount (GtkPlacesView *view,
|
||||
"path", path ? path : "",
|
||||
"volume", NULL,
|
||||
"mount", mount,
|
||||
"file", NULL,
|
||||
NULL);
|
||||
|
||||
insert_row (view, row, is_network);
|
||||
@@ -846,6 +777,31 @@ add_drive (GtkPlacesView *view,
|
||||
g_list_free_full (volumes, g_object_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
add_computer (GtkPlacesView *view)
|
||||
{
|
||||
GtkWidget *row;
|
||||
GIcon *icon;
|
||||
GFile *file;
|
||||
|
||||
file = g_file_new_for_path ("/");
|
||||
icon = g_themed_icon_new_with_default_fallbacks ("drive-harddisk");
|
||||
|
||||
row = g_object_new (GTK_TYPE_PLACES_VIEW_ROW,
|
||||
"icon", icon,
|
||||
"name", _("Computer"),
|
||||
"path", "/",
|
||||
"volume", NULL,
|
||||
"mount", NULL,
|
||||
"file", file,
|
||||
NULL);
|
||||
|
||||
insert_row (view, row, FALSE);
|
||||
|
||||
g_object_unref (icon);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
static void
|
||||
update_places (GtkPlacesView *view)
|
||||
{
|
||||
@@ -859,18 +815,11 @@ update_places (GtkPlacesView *view)
|
||||
priv = gtk_places_view_get_instance_private (view);
|
||||
|
||||
/* Clear all previously added items */
|
||||
children = gtk_container_get_children (GTK_CONTAINER (priv->drives_listbox));
|
||||
children = gtk_container_get_children (GTK_CONTAINER (priv->listbox));
|
||||
g_list_free_full (children, (GDestroyNotify) gtk_widget_destroy);
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (priv->network_listbox));
|
||||
g_list_free_full (children, (GDestroyNotify) gtk_widget_destroy);
|
||||
|
||||
/*
|
||||
* Hide both networks and drives lists, and only show them when
|
||||
* a row is added.
|
||||
*/
|
||||
gtk_widget_hide (priv->drives_box);
|
||||
gtk_widget_hide (priv->network_grid);
|
||||
/* Add "Computer" row */
|
||||
add_computer (view);
|
||||
|
||||
/* Add currently connected drives */
|
||||
drives = g_volume_monitor_get_connected_drives (priv->volume_monitor);
|
||||
@@ -934,15 +883,7 @@ update_places (GtkPlacesView *view)
|
||||
/* load saved servers */
|
||||
populate_servers (view);
|
||||
|
||||
if (priv->search_query && priv->search_query[0] != '\0')
|
||||
{
|
||||
update_view_mode (view);
|
||||
}
|
||||
else if (!gtk_widget_get_visible (priv->drives_box) &&
|
||||
!gtk_widget_get_visible (priv->network_grid))
|
||||
{
|
||||
places_view_mode_set (view, MODE_EMPTY);
|
||||
}
|
||||
update_view_mode (view);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1640,6 +1581,7 @@ listbox_filter_func (GtkListBoxRow *row,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkPlacesViewPrivate *priv;
|
||||
gboolean is_network;
|
||||
gboolean retval;
|
||||
gchar *name;
|
||||
gchar *path;
|
||||
@@ -1647,6 +1589,11 @@ listbox_filter_func (GtkListBoxRow *row,
|
||||
priv = gtk_places_view_get_instance_private (GTK_PLACES_VIEW (user_data));
|
||||
retval = FALSE;
|
||||
|
||||
is_network = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row), "is-network"));
|
||||
|
||||
if (is_network && priv->local_only)
|
||||
return FALSE;
|
||||
|
||||
if (!priv->search_query || priv->search_query[0] == '\0')
|
||||
return TRUE;
|
||||
|
||||
@@ -1667,6 +1614,83 @@ listbox_filter_func (GtkListBoxRow *row,
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void
|
||||
listbox_header_func (GtkListBoxRow *row,
|
||||
GtkListBoxRow *before,
|
||||
gpointer user_data)
|
||||
{
|
||||
gboolean row_is_network;
|
||||
gchar *text;
|
||||
|
||||
text = NULL;
|
||||
row_is_network = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row), "is-network"));
|
||||
|
||||
if (!before)
|
||||
{
|
||||
text = g_strdup_printf ("<b>%s</b>", row_is_network ? _("Networks") : _("On This Computer"));
|
||||
}
|
||||
else
|
||||
{
|
||||
gboolean before_is_network;
|
||||
|
||||
before_is_network = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (before), "is-network"));
|
||||
|
||||
if (before_is_network != row_is_network)
|
||||
text = g_strdup_printf ("<b>%s</b>", row_is_network ? _("Networks") : _("On This Computer"));
|
||||
|
||||
}
|
||||
|
||||
if (text)
|
||||
{
|
||||
GtkWidget *header;
|
||||
GtkWidget *label;
|
||||
GtkWidget *separator;
|
||||
|
||||
header = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
||||
|
||||
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
|
||||
label = g_object_new (GTK_TYPE_LABEL,
|
||||
"hexpand", TRUE,
|
||||
"use_markup", TRUE,
|
||||
"label", text,
|
||||
"xalign", 0,
|
||||
NULL);
|
||||
|
||||
g_object_set (label,
|
||||
"margin-top", 6,
|
||||
"margin-start", 12,
|
||||
"margin-end", 12,
|
||||
NULL);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (header), label);
|
||||
gtk_container_add (GTK_CONTAINER (header), separator);
|
||||
gtk_widget_show_all (header);
|
||||
|
||||
gtk_list_box_row_set_header (row, header);
|
||||
|
||||
g_free (text);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_list_box_row_set_header (row, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
listbox_sort_func (GtkListBoxRow *row1,
|
||||
GtkListBoxRow *row2,
|
||||
gpointer user_data)
|
||||
{
|
||||
gboolean row1_is_network;
|
||||
gboolean row2_is_network;
|
||||
|
||||
row1_is_network = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row1), "is-network"));
|
||||
row2_is_network = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row2), "is-network"));
|
||||
|
||||
return row1_is_network - row2_is_network;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_places_view_constructed (GObject *object)
|
||||
{
|
||||
@@ -1676,12 +1700,16 @@ gtk_places_view_constructed (GObject *object)
|
||||
|
||||
G_OBJECT_CLASS (gtk_places_view_parent_class)->constructed (object);
|
||||
|
||||
gtk_list_box_set_filter_func (GTK_LIST_BOX (priv->drives_listbox),
|
||||
gtk_list_box_set_sort_func (GTK_LIST_BOX (priv->listbox),
|
||||
listbox_sort_func,
|
||||
object,
|
||||
NULL);
|
||||
gtk_list_box_set_filter_func (GTK_LIST_BOX (priv->listbox),
|
||||
listbox_filter_func,
|
||||
object,
|
||||
NULL);
|
||||
gtk_list_box_set_filter_func (GTK_LIST_BOX (priv->network_listbox),
|
||||
listbox_filter_func,
|
||||
gtk_list_box_set_header_func (GTK_LIST_BOX (priv->listbox),
|
||||
listbox_header_func,
|
||||
object,
|
||||
NULL);
|
||||
|
||||
@@ -1812,10 +1840,7 @@ gtk_places_view_class_init (GtkPlacesViewClass *klass)
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkPlacesView, address_entry_completion);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkPlacesView, completion_store);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkPlacesView, connect_button);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkPlacesView, drives_box);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkPlacesView, drives_listbox);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkPlacesView, network_grid);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkPlacesView, network_listbox);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkPlacesView, listbox);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkPlacesView, recent_servers_listbox);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkPlacesView, recent_servers_popover);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkPlacesView, recent_servers_stack);
|
||||
@@ -1943,7 +1968,7 @@ gtk_places_view_get_search_query (GtkPlacesView *view)
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_places_view_get_search_query:
|
||||
* gtk_places_view_set_search_query:
|
||||
* @view: a #GtkPlacesView
|
||||
* @query_text: the query, or NULL.
|
||||
*
|
||||
@@ -1967,8 +1992,8 @@ gtk_places_view_set_search_query (GtkPlacesView *view,
|
||||
g_clear_pointer (&priv->search_query, g_free);
|
||||
priv->search_query = g_strdup (query_text);
|
||||
|
||||
gtk_list_box_invalidate_filter (GTK_LIST_BOX (priv->drives_listbox));
|
||||
gtk_list_box_invalidate_filter (GTK_LIST_BOX (priv->network_listbox));
|
||||
gtk_list_box_invalidate_filter (GTK_LIST_BOX (priv->listbox));
|
||||
gtk_list_box_invalidate_headers (GTK_LIST_BOX (priv->listbox));
|
||||
|
||||
update_view_mode (view);
|
||||
}
|
||||
@@ -2023,7 +2048,7 @@ gtk_places_view_set_local_only (GtkPlacesView *view,
|
||||
priv->local_only = local_only;
|
||||
|
||||
gtk_widget_set_visible (priv->actionbar, !local_only);
|
||||
gtk_widget_set_visible (priv->network_grid, !local_only);
|
||||
gtk_list_box_invalidate_filter (GTK_LIST_BOX (priv->listbox));
|
||||
|
||||
update_view_mode (view);
|
||||
|
||||
|
@@ -38,6 +38,7 @@ struct _GtkPlacesViewRow
|
||||
|
||||
GVolume *volume;
|
||||
GMount *mount;
|
||||
GFile *file;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkPlacesViewRow, gtk_places_view_row, GTK_TYPE_LIST_BOX_ROW)
|
||||
@@ -49,11 +50,22 @@ enum {
|
||||
PROP_PATH,
|
||||
PROP_VOLUME,
|
||||
PROP_MOUNT,
|
||||
PROP_FILE,
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
static GParamSpec *properties [LAST_PROP];
|
||||
|
||||
static void
|
||||
gtk_places_view_row_finalize (GObject *object)
|
||||
{
|
||||
GtkPlacesViewRow *self = GTK_PLACES_VIEW_ROW (object);
|
||||
|
||||
g_clear_object (&self->volume);
|
||||
g_clear_object (&self->mount);
|
||||
g_clear_object (&self->file);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_places_view_row_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
@@ -89,6 +101,10 @@ gtk_places_view_row_get_property (GObject *object,
|
||||
g_value_set_object (value, self->mount);
|
||||
break;
|
||||
|
||||
case PROP_FILE:
|
||||
g_value_set_object (value, self->file);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
@@ -119,14 +135,18 @@ gtk_places_view_row_set_property (GObject *object,
|
||||
break;
|
||||
|
||||
case PROP_VOLUME:
|
||||
self->volume = g_value_get_object (value);
|
||||
g_set_object (&self->volume, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_MOUNT:
|
||||
self->mount = g_value_get_object (value);
|
||||
g_set_object (&self->mount, g_value_get_object (value));
|
||||
gtk_widget_set_visible (GTK_WIDGET (self->eject_button), self->mount != NULL);
|
||||
break;
|
||||
|
||||
case PROP_FILE:
|
||||
g_set_object (&self->file, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
@@ -138,6 +158,7 @@ gtk_places_view_row_class_init (GtkPlacesViewRowClass *klass)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->finalize = gtk_places_view_row_finalize;
|
||||
object_class->get_property = gtk_places_view_row_get_property;
|
||||
object_class->set_property = gtk_places_view_row_set_property;
|
||||
|
||||
@@ -176,6 +197,13 @@ gtk_places_view_row_class_init (GtkPlacesViewRowClass *klass)
|
||||
G_TYPE_MOUNT,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
|
||||
|
||||
properties[PROP_FILE] =
|
||||
g_param_spec_object ("file",
|
||||
P_("File represented by the row"),
|
||||
P_("The file represented by the row, if any"),
|
||||
G_TYPE_FILE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
|
||||
|
||||
g_object_class_install_properties (object_class, LAST_PROP, properties);
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/ui/gtkplacesviewrow.ui");
|
||||
@@ -220,6 +248,14 @@ gtk_places_view_row_get_volume (GtkPlacesViewRow *row)
|
||||
return row->volume;
|
||||
}
|
||||
|
||||
GFile*
|
||||
gtk_places_view_row_get_file (GtkPlacesViewRow *row)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_PLACES_VIEW_ROW (row), NULL);
|
||||
|
||||
return row->file;
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
gtk_places_view_row_get_eject_button (GtkPlacesViewRow *row)
|
||||
{
|
||||
|
@@ -43,6 +43,8 @@ GMount* gtk_places_view_row_get_mount (GtkPlacesViewR
|
||||
|
||||
GVolume* gtk_places_view_row_get_volume (GtkPlacesViewRow *row);
|
||||
|
||||
GFile* gtk_places_view_row_get_file (GtkPlacesViewRow *row);
|
||||
|
||||
void gtk_places_view_row_set_busy (GtkPlacesViewRow *row,
|
||||
gboolean is_busy);
|
||||
|
||||
|
@@ -151,134 +151,11 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="main_box">
|
||||
<object class="GtkListBox" id="listbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="drives_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin_start">12</property>
|
||||
<property name="margin_end">12</property>
|
||||
<property name="margin_top">6</property>
|
||||
<property name="margin_bottom">6</property>
|
||||
<property name="label" translatable="yes">This Computer</property>
|
||||
<property name="xalign">0</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBox" id="drives_listbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="selection_mode">none</property>
|
||||
<signal name="row-activated" handler="on_listbox_row_activated" object="GtkPlacesView" swapped="yes" />
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="network_grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin_start">12</property>
|
||||
<property name="margin_end">12</property>
|
||||
<property name="margin_top">6</property>
|
||||
<property name="margin_bottom">6</property>
|
||||
<property name="hexpand">False</property>
|
||||
<property name="label" translatable="yes" comments="Translators: header of the Network section of the Other Locations view">Network</property>
|
||||
<property name="ellipsize">end</property>
|
||||
<property name="xalign">0</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinner" id="network_spinner">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator">
|
||||
<property name="visible">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBox" id="network_listbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="selection_mode">none</property>
|
||||
<signal name="row-activated" handler="on_listbox_row_activated" object="GtkPlacesView" swapped="yes" />
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="selection_mode">none</property>
|
||||
<signal name="row-activated" handler="on_listbox_row_activated" object="GtkPlacesView" swapped="yes" />
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
@@ -293,54 +170,6 @@
|
||||
<property name="name">browse</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="pixel_size">72</property>
|
||||
<property name="icon_name">drive-harddisk-symbolic</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">No drives or networks found</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
<attribute name="scale" value="1.44"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">empty</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
@@ -400,8 +229,7 @@
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">search</property>
|
||||
<property name="position">2</property>
|
||||
<property name="name">empty-search</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
@@ -53,6 +53,8 @@
|
||||
<property name="justify">right</property>
|
||||
<property name="ellipsize">middle</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="width_chars">15</property>
|
||||
<property name="max_width_chars">15</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user