[gtk+/wip/gbsneto/other-locations] updates



commit f9b69d18b5af78e97d0045366bfe1531dd401258
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sat Jul 11 11:27:29 2015 -0300

    updates

 gtk/gtkplacesview.c        |   71 +++++++++++++++++++++++++++++++-------------
 gtk/ui/gtkplacesviewrow.ui |    2 +-
 2 files changed, 51 insertions(+), 22 deletions(-)
---
diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c
index c97b327..d8af8b5 100644
--- a/gtk/gtkplacesview.c
+++ b/gtk/gtkplacesview.c
@@ -71,6 +71,8 @@ struct _GtkPlacesViewPrivate
 
   guint                          local_only : 1;
   guint                          should_open_location : 1;
+  guint                          should_pulse_entry : 1;
+  guint                          entry_pulse_timeout_id;
 };
 
 static void        mount_volume                                  (GtkPlacesView *view,
@@ -313,6 +315,9 @@ gtk_places_view_finalize (GObject *object)
   GtkPlacesView *self = (GtkPlacesView *)object;
   GtkPlacesViewPrivate *priv = gtk_places_view_get_instance_private (self);
 
+  if (priv->entry_pulse_timeout_id > 0)
+    g_source_remove (priv->entry_pulse_timeout_id);
+
   g_cancellable_cancel (priv->cancellable);
 
   g_clear_object (&priv->volume_monitor);
@@ -487,6 +492,11 @@ insert_row (GtkPlacesView *view,
   priv = gtk_places_view_get_instance_private (view);
   list = is_network ? priv->network_listbox : priv->drives_listbox;
 
+  g_signal_connect (gtk_places_view_row_get_event_box (GTK_PLACES_VIEW_ROW (row)),
+                    "button-release-event",
+                    G_CALLBACK (on_button_release_event),
+                    row);
+
   gtk_container_add (GTK_CONTAINER (list), row);
   gtk_widget_show (list);
 }
@@ -527,11 +537,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);
-
-  if (root)
-    path = is_network ? g_file_get_uri (root) : g_file_get_path (root);
-  else
-    path = NULL;
+  path = root ? g_file_get_parse_name (root) : NULL;
 
   if (!mount ||
       (mount && !g_mount_is_shadowed (mount)))
@@ -546,11 +552,6 @@ add_volume (GtkPlacesView *view,
                       "mount", mount,
                       NULL);
 
-      g_signal_connect (gtk_places_view_row_get_event_box (GTK_PLACES_VIEW_ROW (row)),
-                        "button-release-event",
-                        G_CALLBACK (on_button_release_event),
-                        row);
-
       insert_row (view, row, is_network);
     }
 
@@ -571,16 +572,16 @@ add_mount (GtkPlacesView *view,
   GIcon *icon;
   gchar *name;
   gchar *path;
+  gchar *uri;
+  gchar *schema;
 
   icon = g_mount_get_icon (mount);
   name = g_mount_get_name (mount);
   root = g_mount_get_root (mount);
-  is_network = root ? g_file_is_native (root) : FALSE;
-
-  if (root)
-    path = is_network ? g_file_get_uri (root) : g_file_get_path (root);
-  else
-    path = NULL;
+  path = root ? g_file_get_parse_name (root) : NULL;
+  uri = g_file_get_uri (root);
+  schema = g_uri_parse_scheme (uri);
+  is_network = g_strcmp0 (schema, "file") != 0;
 
   if (!g_mount_is_shadowed (mount))
     {
@@ -594,11 +595,6 @@ add_mount (GtkPlacesView *view,
                       "mount", mount,
                       NULL);
 
-      g_signal_connect (gtk_places_view_row_get_event_box (GTK_PLACES_VIEW_ROW (row)),
-                        "button-release-event",
-                        G_CALLBACK (on_button_release_event),
-                        row);
-
       insert_row (view, row, is_network);
     }
 
@@ -606,6 +602,8 @@ add_mount (GtkPlacesView *view,
   g_clear_object (&icon);
   g_free (name);
   g_free (path);
+  g_free (uri);
+  g_free (schema);
 }
 
 static void
@@ -734,6 +732,8 @@ server_mount_ready_cb (GObject      *source_file,
   should_show = TRUE;
   error = NULL;
 
+  priv->should_pulse_entry = FALSE;
+
   g_file_mount_enclosing_volume_finish (location, res, &error);
 
   if (error)
@@ -867,6 +867,31 @@ unmount_ready_cb (GObject      *source_mount,
     }
 }
 
+
+static gboolean
+pulse_entry_cb (gpointer user_data)
+{
+  GtkPlacesViewPrivate *priv;
+
+  priv = gtk_places_view_get_instance_private (GTK_PLACES_VIEW (user_data));
+
+  if (priv->should_pulse_entry)
+    {
+      gtk_entry_progress_pulse (GTK_ENTRY (priv->address_entry));
+
+      return G_SOURCE_CONTINUE;
+    }
+  else
+    {
+      gtk_entry_set_progress_pulse_step (GTK_ENTRY (priv->address_entry), 0.0);
+      gtk_entry_set_progress_fraction (GTK_ENTRY (priv->address_entry), 0.0);
+      priv->entry_pulse_timeout_id = 0;
+
+      return G_SOURCE_REMOVE;
+    }
+}
+
+
 static void
 mount_server (GtkPlacesView *view,
               GFile         *location)
@@ -882,6 +907,10 @@ mount_server (GtkPlacesView *view,
   g_cancellable_cancel (priv->cancellable);
   priv->cancellable = g_cancellable_new ();
 
+  priv->should_pulse_entry = TRUE;
+  gtk_entry_set_progress_pulse_step (GTK_ENTRY (priv->address_entry), 0.1);
+  priv->entry_pulse_timeout_id = g_timeout_add (100, (GSourceFunc) pulse_entry_cb, view);
+
   g_mount_operation_set_password_save (operation, G_PASSWORD_SAVE_FOR_SESSION);
 
   g_file_mount_enclosing_volume (location,
diff --git a/gtk/ui/gtkplacesviewrow.ui b/gtk/ui/gtkplacesviewrow.ui
index dbebf19..80f980d 100644
--- a/gtk/ui/gtkplacesviewrow.ui
+++ b/gtk/ui/gtkplacesviewrow.ui
@@ -67,7 +67,7 @@
               <object class="GtkSpinner" id="busy_spinner">
                 <property name="visible">False</property>
                 <property name="can_focus">False</property>
-                <property name="active" bind-source="busy_spinner" bind-property="visible" 
bind-flags="default" />
+                <property name="active">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]