[meld/pathlabel: 71/73] ui.filebutton: Support passing through the local-only file dialog flag




commit 386368beededc7b001e80478e5af5c06bfdc20b4
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Aug 15 09:09:01 2021 +1000

    ui.filebutton: Support passing through the local-only file dialog flag
    
    We want this so that we can specify that file comparisons are remote
    capable, but that folder and VC comparisons are not.

 meld/resources/ui/filediff.ui |  3 +++
 meld/ui/filebutton.py         | 11 +++++++++++
 2 files changed, 14 insertions(+)
---
diff --git a/meld/resources/ui/filediff.ui b/meld/resources/ui/filediff.ui
index 1a8612c3..521b5ad1 100644
--- a/meld/resources/ui/filediff.ui
+++ b/meld/resources/ui/filediff.ui
@@ -44,6 +44,7 @@
                 <property name="can_focus">False</property>
                 <property name="pane">2</property>
                 <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
+                <property name="local-only">False</property>
                 <property name="dialog_label">Select File</property>
                 <property name="tooltip_text" translatable="yes">Open file in this pane</property>
                 <signal name="file-selected" handler="on_file_selected" swapped="no"/>
@@ -106,6 +107,7 @@
                 <property name="can_focus">False</property>
                 <property name="pane">1</property>
                 <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
+                <property name="local-only">False</property>
                 <property name="dialog_label">Select File</property>
                 <property name="tooltip_text" translatable="yes">Open file in this pane</property>
                 <signal name="file-selected" handler="on_file_selected" swapped="no"/>
@@ -168,6 +170,7 @@
                 <property name="can_focus">False</property>
                 <property name="pane">0</property>
                 <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
+                <property name="local-only">False</property>
                 <property name="dialog_label">Select File</property>
                 <property name="tooltip_text" translatable="yes">Open file in this pane</property>
                 <signal name="file-selected" handler="on_file_selected" swapped="no"/>
diff --git a/meld/ui/filebutton.py b/meld/ui/filebutton.py
index 665ec986..b985b93b 100644
--- a/meld/ui/filebutton.py
+++ b/meld/ui/filebutton.py
@@ -31,6 +31,16 @@ class MeldFileButton(Gtk.Button):
         default=Gtk.FileChooserAction.OPEN,
     )
 
+    local_only: bool = GObject.Property(
+        type=bool,
+        nick="Whether selected files should be limited to local file:// URIs",
+        flags=(
+            GObject.ParamFlags.READWRITE |
+            GObject.ParamFlags.CONSTRUCT_ONLY
+        ),
+        default=True,
+    )
+
     dialog_label: str = GObject.Property(
         type=str,
         nick="Label for the file selector dialog",
@@ -61,6 +71,7 @@ class MeldFileButton(Gtk.Button):
             title=self.dialog_label,
             transient_for=self.get_toplevel(),
             action=self.action,
+            local_only=self.local_only
         )
 
         if self.file:


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