[the-board] [chrome] Set link on all added things



commit af4a3cc4196cdd37681a781771f637d48daff6ec
Author: Lucas Rocha <lucasr gnome org>
Date:   Sun Dec 5 20:35:51 2010 +0000

    [chrome] Set link on all added things

 src/chrome/background.js |   21 +++++++++++++++------
 src/chrome/manifest.json |    1 +
 2 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/src/chrome/background.js b/src/chrome/background.js
index 12244d6..940564a 100644
--- a/src/chrome/background.js
+++ b/src/chrome/background.js
@@ -114,8 +114,11 @@ function addPhotoToTheBoard(imageUrl) {
                         String.fromCharCode(imageReq.responseText.charCodeAt(i) & 0xff);
                 }
 
-                callMethod("addThing", args,
-                           null, showErrorNotification);
+                chrome.tabs.getSelected(null, function(tab) {
+                    args.link = tab.url;
+                    callMethod("addThing", args,
+                               null, showErrorNotification);
+                });
             }
         }
     }
@@ -134,16 +137,22 @@ function addNoteToTheBoard(text) {
     var args = { id: "note",
                  text: text };
 
-    callMethod("addThing", args,
-               null, showErrorNotification);
+    chrome.tabs.getSelected(null, function(tab) {
+        args.link = tab.url;
+        callMethod("addThing", args,
+                   null, showErrorNotification);
+    });
 }
 
 function addLabelToTheBoard(text) {
     var args = { id: "label",
                  text: text };
 
-    callMethod("addThing", args,
-               null, showErrorNotification);
+    chrome.tabs.getSelected(null, function(tab) {
+        args.link = tab.url;
+        callMethod("addThing", args,
+                   null, showErrorNotification);
+    });
 }
 
 function onMenuClick(info, tab) {
diff --git a/src/chrome/manifest.json b/src/chrome/manifest.json
index 4cd4f43..5ce9405 100644
--- a/src/chrome/manifest.json
+++ b/src/chrome/manifest.json
@@ -4,6 +4,7 @@
   "description": "Chrome's integration with GNOME's The Board",
   "background_page": "background.html",
   "permissions": [
+    "tabs",
     "contextMenus",
     "notifications",
     "http://*/*";,



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