summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRazvan Chitu <razvan.ch95@gmail.com>2016-07-12 13:01:47 +0300
committerRazvan Chitu <razvan.ch95@gmail.com>2016-07-12 13:16:57 +0300
commit25f4baffb49f834d4df41646795e621bc8214d0d (patch)
tree83f85b340563a95f1b3e6db94151171b13134051
parent410e511581cc10fe716f226c144ac4e31fd43bc8 (diff)
downloadnautilus-25f4baffb49f834d4df41646795e621bc8214d0d.tar.gz
places-view: fetch updates from gtk+ repo
https://bugzilla.gnome.org/show_bug.cgi?id=768657
-rw-r--r--src/gtk/nautilusgtkplacesview.c68
-rw-r--r--src/gtk/nautilusgtkplacesview.ui294
-rw-r--r--src/gtk/nautilusgtkplacesviewrow.c4
-rw-r--r--src/gtk/nautilusgtkplacesviewrow.ui25
4 files changed, 319 insertions, 72 deletions
diff --git a/src/gtk/nautilusgtkplacesview.c b/src/gtk/nautilusgtkplacesview.c
index 43c47c81e..fd813c7c1 100644
--- a/src/gtk/nautilusgtkplacesview.c
+++ b/src/gtk/nautilusgtkplacesview.c
@@ -21,6 +21,7 @@
#include <gtk/gtk.h>
#include <gio/gio.h>
+#include <gio/gvfs.h>
#include <gtk/gtk.h>
#include "nautilusgtkplacesviewprivate.h"
@@ -68,6 +69,7 @@ struct _NautilusGtkPlacesViewPrivate
GtkWidget *recent_servers_popover;
GtkWidget *recent_servers_stack;
GtkWidget *stack;
+ GtkWidget *server_adresses_popover;
GtkWidget *network_placeholder;
GtkWidget *network_placeholder_label;
@@ -472,9 +474,7 @@ is_external_volume (GVolume *volume)
is_external |= !id;
if (drive)
- is_external |= g_drive_can_eject (drive) ||
- g_drive_is_media_removable (drive) ||
- g_drive_can_stop (drive);
+ is_external |= g_drive_is_removable (drive);
g_clear_object (&drive);
g_free (id);
@@ -704,8 +704,7 @@ add_volume (NautilusGtkPlacesView *view,
name = g_volume_get_name (volume);
path = !is_network ? g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE) : NULL;
- if (!mount ||
- (mount && !g_mount_is_shadowed (mount)))
+ if (!mount || !g_mount_is_shadowed (mount))
{
GtkWidget *row;
@@ -1003,8 +1002,19 @@ fetch_networks (NautilusGtkPlacesView *view)
{
NautilusGtkPlacesViewPrivate *priv;
GFile *network_file;
+ const gchar * const *supported_uris;
+ gboolean found;
priv = nautilus_gtk_places_view_get_instance_private (view);
+ supported_uris = g_vfs_get_supported_uri_schemes (g_vfs_get_default ());
+
+ for (found = FALSE; !found && supported_uris && supported_uris[0]; supported_uris++)
+ if (g_strcmp0 (supported_uris[0], "network") == 0)
+ found = TRUE;
+
+ if (!found)
+ return;
+
network_file = g_file_new_for_uri ("network:///");
g_cancellable_cancel (priv->networks_fetching_cancellable);
@@ -1458,11 +1468,20 @@ get_view_and_file (NautilusGtkPlacesViewRow *row,
mount = nautilus_gtk_places_view_row_get_mount (row);
if (mount)
- *file = g_mount_get_default_location (mount);
+ {
+ *file = g_mount_get_default_location (mount);
+ }
else if (volume)
- *file = g_volume_get_activation_root (volume);
+ {
+ *file = g_volume_get_activation_root (volume);
+ }
else
- *file = NULL;
+ {
+ *file = nautilus_gtk_places_view_row_get_file (row);
+ if (*file) {
+ g_object_ref (*file);
+ }
+ }
}
}
@@ -1812,15 +1831,6 @@ on_address_entry_text_changed (NautilusGtkPlacesView *view)
address = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->address_entry)));
scheme = g_uri_parse_scheme (address);
- if (strlen (address) > 0)
- gtk_entry_set_icon_from_icon_name (GTK_ENTRY (priv->address_entry),
- GTK_ENTRY_ICON_SECONDARY,
- "edit-clear-symbolic");
- else
- gtk_entry_set_icon_from_icon_name (GTK_ENTRY (priv->address_entry),
- GTK_ENTRY_ICON_SECONDARY,
- NULL);
-
if (!supported_protocols)
goto out;
@@ -1837,12 +1847,23 @@ out:
}
static void
-on_address_entry_clear_pressed (NautilusGtkPlacesView *view,
- GtkEntryIconPosition icon_pos,
- GdkEvent *event,
- GtkEntry *entry)
+on_address_entry_show_help_pressed (NautilusGtkPlacesView *view,
+ GtkEntryIconPosition icon_pos,
+ GdkEvent *event,
+ GtkEntry *entry)
{
- gtk_entry_set_text (entry, "");
+ NautilusGtkPlacesViewPrivate *priv;
+ GdkRectangle rect;
+
+ priv = nautilus_gtk_places_view_get_instance_private (view);
+
+ /* Setup the auxiliary popover's rectangle */
+ gtk_entry_get_icon_area (GTK_ENTRY (priv->address_entry),
+ GTK_ENTRY_ICON_SECONDARY,
+ &rect);
+
+ gtk_popover_set_pointing_to (GTK_POPOVER (priv->server_adresses_popover), &rect);
+ gtk_widget_set_visible (priv->server_adresses_popover, TRUE);
}
static void
@@ -2217,9 +2238,10 @@ nautilus_gtk_places_view_class_init (NautilusGtkPlacesViewClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, recent_servers_popover);
gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, recent_servers_stack);
gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, stack);
+ gtk_widget_class_bind_template_child_private (widget_class, NautilusGtkPlacesView, server_adresses_popover);
gtk_widget_class_bind_template_callback (widget_class, on_address_entry_text_changed);
- gtk_widget_class_bind_template_callback (widget_class, on_address_entry_clear_pressed);
+ gtk_widget_class_bind_template_callback (widget_class, on_address_entry_show_help_pressed);
gtk_widget_class_bind_template_callback (widget_class, on_connect_button_clicked);
gtk_widget_class_bind_template_callback (widget_class, on_key_press_event);
gtk_widget_class_bind_template_callback (widget_class, on_listbox_row_activated);
diff --git a/src/gtk/nautilusgtkplacesview.ui b/src/gtk/nautilusgtkplacesview.ui
index c339b8439..87b368d67 100644
--- a/src/gtk/nautilusgtkplacesview.ui
+++ b/src/gtk/nautilusgtkplacesview.ui
@@ -11,9 +11,234 @@
</object>
<object class="GtkEntryCompletion" id="address_entry_completion">
<property name="model">completion_store</property>
- <property name="text_column">1</property>
- <property name="inline_completion">1</property>
- <property name="popup_completion">0</property>
+ <property name="text-column">1</property>
+ <property name="inline-completion">1</property>
+ <property name="popup-completion">0</property>
+ </object>
+ <object class="GtkPopover" id="server_adresses_popover">
+ <property name="relative-to">address_entry</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">1</property>
+ <property name="border-width">18</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="hexpand">1</property>
+ <property name="label" translatable="yes">Server Addresses</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="hexpand">1</property>
+ <property name="label" translatable="yes">Server addresses are made up of a protocol prefix and an address. Examples:</property>
+ <property name="wrap">1</property>
+ <property name="width-chars">40</property>
+ <property name="max-width-chars">40</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="hexpand">1</property>
+ <property name="label" translatable="yes">smb://foo.example.com, ssh://192.168.0.1</property>
+ <property name="wrap">1</property>
+ <property name="width-chars">40</property>
+ <property name="max-width-chars">40</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid">
+ <property name="visible">1</property>
+ <property name="margin-top">12</property>
+ <property name="hexpand">1</property>
+ <property name="row-spacing">6</property>
+ <property name="column-spacing">12</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="hexpand">1</property>
+ <property name="label" translatable="yes">Available Protocols</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="GtkLabel">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">AppleTalk</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">File Transfer Protocol</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">Network File System</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">Samba</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">SSH File Transfer Protocol</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">WebDav</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">Prefix</property>
+ <property name="xalign">0</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="label">afp://</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes" comments="Translators: do not translate ftp:// and ftps://">ftp:// or ftps://</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="label">nfs://</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">smb://</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="label" comments="Translators: do not translate sftp:// and ssh://">sftp:// or ssh://</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes" comments="Translators: do not translate dav:// and davs://">dav:// or davs://</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">6</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ </child>
</object>
<object class="GtkPopover" id="recent_servers_popover">
<child>
@@ -30,7 +255,7 @@
<object class="GtkImage">
<property name="visible">1</property>
<property name="pixel-size">48</property>
- <property name="icon_name">network-server-symbolic</property>
+ <property name="icon-name">network-server-symbolic</property>
<style>
<class name="dim-label"/>
</style>
@@ -56,7 +281,7 @@
<child>
<object class="GtkBox">
<property name="visible">1</property>
- <property name="border_width">12</property>
+ <property name="border-width">12</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
@@ -71,20 +296,20 @@
<child>
<object class="GtkScrolledWindow">
<property name="visible">1</property>
- <property name="can_focus">1</property>
+ <property name="can-focus">1</property>
<property name="vexpand">1</property>
- <property name="shadow_type">in</property>
- <property name="min_content_width">250</property>
- <property name="min_content_height">200</property>
+ <property name="shadow-type">in</property>
+ <property name="min-content-width">250</property>
+ <property name="min-content-height">200</property>
<child>
<object class="GtkViewport">
<property name="visible">1</property>
- <property name="shadow_type">none</property>
+ <property name="shadow-type">none</property>
<child>
<object class="GtkListBox" id="recent_servers_listbox">
<property name="visible">1</property>
- <property name="can_focus">1</property>
- <property name="selection_mode">none</property>
+ <property name="can-focus">1</property>
+ <property name="selection-mode">none</property>
<signal name="row-activated" handler="on_recent_servers_listbox_row_activated" object="NautilusGtkPlacesView" swapped="yes"/>
</object>
</child>
@@ -105,18 +330,18 @@
</object>
<template class="NautilusGtkPlacesView" parent="GtkBox">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="orientation">vertical</property>
<signal name="key-press-event" handler="on_key_press_event" object="NautilusGtkPlacesView" swapped="no"/>
<child>
<object class="GtkStack" id="stack">
<property name="visible">1</property>
<property name="vhomogeneous">0</property>
- <property name="transition_type">crossfade</property>
+ <property name="transition-type">crossfade</property>
<child>
<object class="GtkFrame">
<property name="visible">1</property>
- <property name="shadow_type">none</property>
+ <property name="shadow-type">none</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">1</property>
@@ -125,12 +350,12 @@
<child>
<object class="GtkViewport">
<property name="visible">1</property>
- <property name="shadow_type">none</property>
+ <property name="shadow-type">none</property>
<child>
<object class="GtkListBox" id="listbox">
<property name="visible">1</property>
- <property name="can_focus">1</property>
- <property name="selection_mode">none</property>
+ <property name="can-focus">1</property>
+ <property name="selection-mode">none</property>
<signal name="row-activated" handler="on_listbox_row_activated" object="NautilusGtkPlacesView" swapped="yes"/>
</object>
</child>
@@ -155,8 +380,8 @@
<child>
<object class="GtkImage">
<property name="visible">1</property>
- <property name="pixel_size">72</property>
- <property name="icon_name">edit-find-symbolic</property>
+ <property name="pixel-size">72</property>
+ <property name="icon-name">edit-find-symbolic</property>
<style>
<class name="dim-label"/>
</style>
@@ -212,8 +437,8 @@
<property name="hexpand">1</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Connect to _Server</property>
- <property name="mnemonic_widget">address_entry</property>
- <property name="use_underline">1</property>
+ <property name="mnemonic-widget">address_entry</property>
+ <property name="use-underline">1</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@@ -222,16 +447,16 @@
<child>
<object class="GtkButton" id="connect_button">
<property name="label" translatable="yes">Con_nect</property>
- <property name="use_underline">1</property>
+ <property name="use-underline">1</property>
<property name="visible">1</property>
- <property name="can_focus">1</property>
+ <property name="can-focus">1</property>
<property name="sensitive">0</property>
- <property name="receives_default">1</property>
+ <property name="receives-default">1</property>
<property name="valign">center</property>
<signal name="clicked" handler="on_connect_button_clicked" object="NautilusGtkPlacesView" swapped="yes"/>
</object>
<packing>
- <property name="pack_type">end</property>
+ <property name="pack-type">end</property>
</packing>
</child>
<child>
@@ -241,21 +466,22 @@
<child>
<object class="GtkEntry" id="address_entry">
<property name="visible">1</property>
- <property name="can_focus">1</property>
+ <property name="can-focus">1</property>
<property name="hexpand">1</property>
- <property name="width_chars">20</property>
- <property name="placeholder_text" translatable="yes">Enter server address…</property>
+ <property name="width-chars">20</property>
+ <property name="placeholder-text" translatable="yes">Enter server address…</property>
+ <property name="secondary-icon-name">dialog-question-symbolic</property>
<property name="completion">address_entry_completion</property>
<signal name="notify::text" handler="on_address_entry_text_changed" object="NautilusGtkPlacesView" swapped="yes"/>
<signal name="activate" handler="on_connect_button_clicked" object="NautilusGtkPlacesView" swapped="yes"/>
- <signal name="icon-press" handler="on_address_entry_clear_pressed" object="NautilusGtkPlacesView" swapped="yes"/>
+ <signal name="icon-press" handler="on_address_entry_show_help_pressed" object="NautilusGtkPlacesView" swapped="yes"/>
</object>
</child>
<child>
<object class="GtkMenuButton" id="server_list_button">
<property name="visible">1</property>
- <property name="can_focus">1</property>
- <property name="receives_default">1</property>
+ <property name="can-focus">1</property>
+ <property name="receives-default">1</property>
<property name="direction">up</property>
<property name="popover">recent_servers_popover</property>
<style>
@@ -264,7 +490,7 @@
<child>
<object class="GtkImage">
<property name="visible">1</property>
- <property name="icon_name">pan-down-symbolic</property>
+ <property name="icon-name">pan-down-symbolic</property>
</object>
</child>
</object>
@@ -274,7 +500,7 @@
</style>
</object>
<packing>
- <property name="pack_type">end</property>
+ <property name="pack-type">end</property>
</packing>
</child>
</object>
diff --git a/src/gtk/nautilusgtkplacesviewrow.c b/src/gtk/nautilusgtkplacesviewrow.c
index eb498d3b6..5c820cf3d 100644
--- a/src/gtk/nautilusgtkplacesviewrow.c
+++ b/src/gtk/nautilusgtkplacesviewrow.c
@@ -17,6 +17,7 @@
*/
#include "config.h"
+#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
@@ -37,7 +38,6 @@
#include "gtktypebuiltins.h"
#else
#include <gtk/gtk.h>
-#include <glib/gi18n.h>
#endif
struct _NautilusGtkPlacesViewRow
@@ -131,7 +131,7 @@ measure_available_space_finished (GObject *object,
* should be based on the free space available.
* i.e. 1 GB / 24 GB available.
*/
- label = g_strdup_printf (ngettext ("%s / %s available", "%s / %s available", plural_form),
+ label = g_strdup_printf (dngettext (GETTEXT_PACKAGE, "%s / %s available", "%s / %s available", plural_form),
formatted_free_size, formatted_total_size);
gtk_label_set_label (row->available_space_label, label);
diff --git a/src/gtk/nautilusgtkplacesviewrow.ui b/src/gtk/nautilusgtkplacesviewrow.ui
index 2cf538332..f1460e163 100644
--- a/src/gtk/nautilusgtkplacesviewrow.ui
+++ b/src/gtk/nautilusgtkplacesviewrow.ui
@@ -2,24 +2,24 @@
<interface domain="gtk30">
<requires lib="gtk+" version="3.16"/>
<template class="NautilusGtkPlacesViewRow" parent="GtkListBoxRow">
- <property name="width_request">100</property>
+ <property name="width-request">100</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can-focus">True</property>
<child>
<object class="GtkEventBox" id="event_box">
<property name="visible">1</property>
<child>
<object class="GtkBox" id="box">
<property name="visible">1</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="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="margin-top">6</property>
+ <property name="margin-bottom">6</property>
<property name="spacing">18</property>
<child>
<object class="GtkImage" id="icon_image">
<property name="visible">1</property>
- <property name="pixel_size">32</property>
+ <property name="pixel-size">32</property>
</object>
</child>
<child>
@@ -35,10 +35,9 @@
</child>
<child>
<object class="GtkLabel" id="available_space_label">
- <property name="visible">False</property>
<property name="xalign">1</property>
<style>
- <class name="dim-label" />
+ <class name="dim-label"/>
</style>
</object>
<packing>
@@ -51,7 +50,7 @@
<property name="justify">right</property>
<property name="ellipsize">middle</property>
<property name="xalign">0</property>
- <property name="max_width_chars">15</property>
+ <property name="max-width-chars">15</property>
<style>
<class name="dim-label"/>
</style>
@@ -62,15 +61,15 @@
</child>
<child>
<object class="GtkButton" id="eject_button">
- <property name="visible">True</property>
+ <property name="visible">1</property>
<property name="halign">end</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>
+ <property name="icon-name">media-eject-symbolic</property>
+ <property name="icon-size">1</property>
</object>
</child>
<style>