[gnome-taquin/arnaudb/wip/gtk4: 12/43] Comment clipboard related things.



commit c22573e0fecdf13da55c7db6bdf610cd480966ab
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Wed Feb 19 22:01:11 2020 +0100

    Comment clipboard related things.

 src/base-window.vala | 116 +++++++++++++++++++++++++--------------------------
 src/taquin-main.vala |  10 ++---
 2 files changed, 63 insertions(+), 63 deletions(-)
---
diff --git a/src/base-window.vala b/src/base-window.vala
index 5df3323..e4b6271 100644
--- a/src/base-window.vala
+++ b/src/base-window.vala
@@ -156,16 +156,16 @@ private class BaseWindow : AdaptativeWindow, AdaptativeWidget
     }
     internal static bool copy_clipboard_text (out string copy_text)
     {
-        string? nullable_selection = Clipboard.@get (Gdk.SELECTION_PRIMARY).wait_for_text ();
-        if (nullable_selection != null)
-        {
-             string selection = ((!) nullable_selection).dup ();
-             if (selection != "")
-             {
-                copy_text = selection;
-                return true;
-             }
-        }
+//        string? nullable_selection = Clipboard.@get (Gdk.SELECTION_PRIMARY).wait_for_text ();
+//        if (nullable_selection != null)
+//        {
+//             string selection = ((!) nullable_selection).dup ();
+//             if (selection != "")
+//             {
+//                copy_text = selection;
+//                return true;
+//             }
+//        }
         return no_copy_text (out copy_text);
     }
     internal static inline bool is_empty_text (string text)
@@ -175,42 +175,42 @@ private class BaseWindow : AdaptativeWindow, AdaptativeWidget
 
     private void copy (/* SimpleAction action, Variant? path_variant */)
     {
-        Widget? focus = get_focus ();
-        if (focus != null)
-        {
-            if ((!) focus is Editable)  // GtkEntry, GtkSearchEntry, GtkSpinButton
-            {
-                int garbage1, garbage2;
-                if (((Editable) (!) focus).get_selection_bounds (out garbage1, out garbage2))
-                {
-                    ((Editable) (!) focus).copy_clipboard ();
-                    return;
-                }
-            }
-            else if ((!) focus is TextView)
-            {
-                if (((TextView) (!) focus).get_buffer ().get_has_selection ())
-                {
-                    ((TextView) (!) focus).copy_clipboard ();
-                    return;
-                }
-            }
-            else if ((!) focus is Label)
-            {
-                int garbage1, garbage2;
-                if (((Label) (!) focus).get_selection_bounds (out garbage1, out garbage2))
-                {
-                    ((Label) (!) focus).copy_clipboard ();
-                    return;
-                }
-            }
-        }
-
-        main_view.close_popovers ();
-
-        string text;
-        if (handle_copy_text (out text))
-            copy_text (text);
+//        Widget? focus = get_focus ();
+//        if (focus != null)
+//        {
+//            if ((!) focus is Editable)  // GtkEntry, GtkSearchEntry, GtkSpinButton
+//            {
+//                int garbage1, garbage2;
+//                if (((Editable) (!) focus).get_selection_bounds (out garbage1, out garbage2))
+//                {
+//                    ((Editable) (!) focus).copy_clipboard ();
+//                    return;
+//                }
+//            }
+//            else if ((!) focus is TextView)
+//            {
+//                if (((TextView) (!) focus).get_buffer ().get_has_selection ())
+//                {
+//                    ((TextView) (!) focus).copy_clipboard ();
+//                    return;
+//                }
+//            }
+//            else if ((!) focus is Label)
+//            {
+//                int garbage1, garbage2;
+//                if (((Label) (!) focus).get_selection_bounds (out garbage1, out garbage2))
+//                {
+//                    ((Label) (!) focus).copy_clipboard ();
+//                    return;
+//                }
+//            }
+//        }
+
+//        main_view.close_popovers ();
+
+//        string text;
+//        if (handle_copy_text (out text))
+//            copy_text (text);
     }
 
     private void copy_alt (/* SimpleAction action, Variant? path_variant */)
@@ -245,11 +245,11 @@ private class BaseWindow : AdaptativeWindow, AdaptativeWidget
         Widget? focus = get_focus ();
         if (focus != null)
         {
-            if ((!) focus is Entry)
-            {
-                ((Entry) (!) focus).paste_clipboard ();
-                return;
-            }
+//            if ((!) focus is Entry)
+//            {
+//                ((Entry) (!) focus).paste_clipboard ();
+//                return;
+//            }
             if ((!) focus is TextView)
             {
                 ((TextView) (!) focus).paste_clipboard ();
@@ -280,14 +280,14 @@ private class BaseWindow : AdaptativeWindow, AdaptativeWidget
 
     private static inline bool get_clipboard_content (out string? clipboard_content)
     {
-        Gdk.Display? display = Gdk.Display.get_default ();
-        if (display == null)            // ?
-        {
-            clipboard_content = null;   // garbage
-            return false;
-        }
+//        Gdk.Display? display = Gdk.Display.get_default ();
+//        if (display == null)            // ?
+//        {
+//            clipboard_content = null;   // garbage
+//            return false;
+//        }
 
-        clipboard_content = Clipboard.get_default ((!) display).wait_for_text ();
+//        clipboard_content = Clipboard.get_default ((!) display).wait_for_text ();
         return true;
     }
 
diff --git a/src/taquin-main.vala b/src/taquin-main.vala
index 70e2d4c..f6f6225 100644
--- a/src/taquin-main.vala
+++ b/src/taquin-main.vala
@@ -620,12 +620,12 @@ private class Taquin : Gtk.Application, BaseApplication
 
     internal void copy (string text)
     {
-        Gdk.Display? display = Gdk.Display.get_default ();
-        if (display == null)
-            return;
+//        Gdk.Display? display = Gdk.Display.get_default ();
+//        if (display == null)
+//            return;
 
-        Gtk.Clipboard clipboard = Gtk.Clipboard.get_default ((!) display);
-        clipboard.set_text (text, text.length);
+//        Gtk.Clipboard clipboard = Gtk.Clipboard.get_default ((!) display);
+//        clipboard.set_text (text, text.length);
     }
 
     /*\


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