[dconf-editor] Allow copying AboutList texts.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Allow copying AboutList texts.
- Date: Thu, 22 Nov 2018 12:36:21 +0000 (UTC)
commit 3eb357647d3f0f5899800a4f0f83b848c57329f3
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Wed Nov 21 21:47:58 2018 +0100
Allow copying AboutList texts.
editor/about-list.vala | 31 +++++++++++++++++++++++++++++++
editor/browser-view.vala | 8 +++++++-
editor/dconf-window.vala | 6 ++++++
3 files changed, 44 insertions(+), 1 deletion(-)
---
diff --git a/editor/about-list.vala b/editor/about-list.vala
index e8be622..a65dc64 100644
--- a/editor/about-list.vala
+++ b/editor/about-list.vala
@@ -39,6 +39,29 @@ private class AboutList : OverlayedList
show_apropos ();
}
+ internal string? get_copy_text ()
+ {
+ string? nullable_selection = Clipboard.@get (Gdk.SELECTION_PRIMARY).wait_for_text ();
+ if (nullable_selection != null)
+ {
+ string selection = ((!) nullable_selection).dup ();
+ if (selection != "")
+ return selection;
+ }
+
+ Widget? focus_child = main_list_box.get_focus_child ();
+ if (focus_child == null)
+ return null;
+ Widget? child = ((Bin) (!) focus_child).get_child ();
+ if (child == null || !((!) child is AboutListItem))
+ assert_not_reached ();
+
+ string? copy_text = ((AboutListItem) (!) child).copy_text;
+ if (copy_text == null)
+ return null;
+ return ((!) copy_text).dup ();
+ }
+
/*\
* * Action entries
\*/
@@ -111,8 +134,12 @@ private class AboutList : OverlayedList
private class AboutListItem : Grid
{
+ public string? copy_text { internal get; construct; default = null; }
+
internal AboutListItem.from_label (string text, string? css_class = null)
{
+ Object (copy_text: text);
+
Label label = new Label (text);
label.visible = true;
label.hexpand = true;
@@ -136,6 +163,8 @@ private class AboutListItem : Grid
internal AboutListItem.from_link (string link, string text)
{
+ Object (copy_text: link);
+
LinkButton button = new LinkButton.with_label (link, text);
button.visible = true;
button.hexpand = true;
@@ -153,6 +182,8 @@ private class AboutListItem : Grid
internal AboutListItem.with_title (string text, string title)
{
+ Object (copy_text: text);
+
this.orientation = Orientation.VERTICAL;
Label label = new Label (title);
diff --git a/editor/browser-view.vala b/editor/browser-view.vala
index c737e34..a98abd9 100644
--- a/editor/browser-view.vala
+++ b/editor/browser-view.vala
@@ -564,7 +564,13 @@ private class BrowserView : Stack, AdaptativeWidget
// current row property
internal string get_selected_row_name () { return current_child.get_selected_row_name (); }
- internal string? get_copy_text () { return current_child.get_copy_text (); }
+ internal string? get_copy_text ()
+ {
+ if (in_window_about)
+ return about_list.get_copy_text (); // TODO copying logo...
+ else
+ return current_child.get_copy_text ();
+ }
internal string? get_copy_path_text () { return current_child.get_copy_path_text (); }
// values changes
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 2044aa1..4797d2f 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -1666,6 +1666,9 @@ private class DConfWindow : ApplicationWindow
return true;
case "v": // https://bugzilla.gnome.org/show_bug.cgi?id=762257 is WONTFIX // TODO
<Shift><Primary>v something?
+ if (browser_view.in_window_about)
+ return false;
+
if (focus_is_text_widget)
return false;
@@ -1685,6 +1688,9 @@ private class DConfWindow : ApplicationWindow
}
}
+ if (browser_view.in_window_about)
+ return false;
+
/* don't use "else if", or some widgets will not be hidden on <ctrl>F10 or such things */
if (name == "F10" && (event.state & Gdk.ModifierType.SHIFT_MASK) != 0)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]