[vte/vte-next] emulation: Allow unsetting the current-{directory, file}-uri



commit 2e2777cb9fe91ded130af6f072327ed4496cfb60
Author: Christian Persch <chpe gnome org>
Date:   Sat Jun 1 19:07:55 2013 +0200

    emulation: Allow unsetting the current-{directory,file}-uri
    
    By passing "" (or an invalid, non-URI value), unset the property.
    (cherry picked from commit 89f6741d8e0ce481b7ec188043e26488edb5a455)

 src/vteseq.c |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)
---
diff --git a/src/vteseq.c b/src/vteseq.c
index dc78526..89db5c9 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -2481,13 +2481,15 @@ vte_sequence_handler_set_current_directory_uri (VteBuffer *buffer, GValueArray *
         }
 
         /* Validate URI */
-        filename = g_filename_from_uri (uri, NULL, NULL);
-        if (filename == NULL) {
-                /* invalid URI */
-                g_free (uri);
-                uri = NULL;
-        } else {
-                g_free (filename);
+        if (uri && uri[0]) {
+                filename = g_filename_from_uri (uri, NULL, NULL);
+                if (filename == NULL) {
+                        /* invalid URI */
+                        g_free (uri);
+                        uri = NULL;
+                } else {
+                        g_free (filename);
+                }
         }
 
         g_free(buffer->pvt->current_directory_uri_changed);
@@ -2513,13 +2515,15 @@ vte_sequence_handler_set_current_file_uri (VteBuffer *buffer, GValueArray *param
         }
 
         /* Validate URI */
-        filename = g_filename_from_uri (uri, NULL, NULL);
-        if (filename == NULL) {
-                /* invalid URI */
-                g_free (uri);
-                uri = NULL;
-        } else {
-                g_free (filename);
+        if (uri && uri[0]) {
+                filename = g_filename_from_uri (uri, NULL, NULL);
+                if (filename == NULL) {
+                        /* invalid URI */
+                        g_free (uri);
+                        uri = NULL;
+                } else {
+                        g_free (filename);
+                }
         }
 
         g_free(buffer->pvt->current_file_uri_changed);


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