[gnome-characters] character: Add to Recent list when copied not viewed



commit 652d62cb2fc01172005c3204fdfcbb275f1add3d
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Aug 14 13:30:51 2017 +0200

    character: Add to Recent list when copied not viewed
    
    Otherwise one would end up with loads of uninteresting characters
    in the Recent view.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786274

 src/character.js |    4 ++++
 src/window.js    |    6 +++++-
 2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/character.js b/src/character.js
index 1ba985d..13d6f11 100644
--- a/src/character.js
+++ b/src/character.js
@@ -30,6 +30,9 @@ const Util = imports.util;
 const CharacterDialog = new Lang.Class({
     Name: 'CharacterDialog',
     Extends: Gtk.Dialog,
+    Signals: {
+        'character-copied': { param_types: [ GObject.TYPE_STRING ] }
+    },
     Template: 'resource:///org/gnome/Characters/character.ui',
     InternalChildren: ['main-stack', 'character-stack',
                        'character-label', 'missing-label', 'detail-label',
@@ -181,6 +184,7 @@ const CharacterDialog = new Lang.Class({
                                               this._clipboardOwnerChanged));
         }
         this._clipboard.set_text(this._character, -1);
+        this.emit('character-copied', this._character);
 
         // Show a feedback message with a revealer.  The message is
         // hidden after 2 seconds, or when another client set a
diff --git a/src/window.js b/src/window.js
index dd018df..a05ace0 100644
--- a/src/window.js
+++ b/src/window.js
@@ -351,9 +351,11 @@ const MainView = new Lang.Class({
         }
     },
 
-    _handleCharacterSelected: function(widget, uc) {
+    _addToRecent: function(widget, uc) {
         this.addToRecent(uc);
+    },
 
+    _handleCharacterSelected: function(widget, uc) {
         let dialog = new Character.CharacterDialog({
             character: uc,
             modal: true,
@@ -362,6 +364,8 @@ const MainView = new Lang.Class({
         });
 
         dialog.show();
+        dialog.connect('character-copied',
+                       Lang.bind(this, this._addToRecent));
         dialog.connect('response', function(self, response_id) {
             if (response_id == Gtk.ResponseType.CLOSE)
                 dialog.destroy();


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