[gnome-documents/sharing] sharing: add changes to git master



commit f2db6ccd47547ad8ad799510e6d37538ed00cf32
Author: Meg Ford <megford gnome org>
Date:   Tue Jan 8 11:18:37 2013 -0600

    sharing: add changes to git master

 src/Makefile-js.am |    1 +
 src/selections.js  |   27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile-js.am b/src/Makefile-js.am
index 4f7a576..8872353 100644
--- a/src/Makefile-js.am
+++ b/src/Makefile-js.am
@@ -16,6 +16,7 @@ dist_js_DATA = \
     search.js \
     searchbar.js \
     selections.js \
+    sharing.js \
     shellSearchProvider.js \
     trackerController.js \
     trackerUtils.js \
diff --git a/src/selections.js b/src/selections.js
index 435bbe1..f44d6cf 100644
--- a/src/selections.js
+++ b/src/selections.js
@@ -36,6 +36,7 @@ const Manager = imports.manager;
 const Notifications = imports.notifications;
 const Properties = imports.properties;
 const Query = imports.query;
+const Sharing = imports.sharing;
 const Tweener = imports.util.tweener;
 const Utils = imports.utils;
 
@@ -792,6 +793,13 @@ const SelectionToolbar = new Lang.Class({
         this._rightBox.add(this._toolbarProperties);
         this._toolbarProperties.connect('clicked', Lang.bind(this, this._onToolbarProperties));
 
+        // share button
+	    this._toolbarShare = new Gtk.Button({ child: new Gtk.Image ({ icon_name: 'emblem-shared-symbolic',
+                                                                      pixel_size: 16 })});
+        this._toolbarShare.set_tooltip_text(_("Share"));
+        this._rightBox.add(this._toolbarShare);
+        this._toolbarShare.connect('clicked', Lang.bind(this, this._onToolbarShare));
+
         this.widget.show_all();
 
         Application.selectionController.connect('selection-mode-changed',
@@ -843,6 +851,7 @@ const SelectionToolbar = new Lang.Class({
         let showPrint = true;
         let showProperties = true;
         let showOpen = true;
+        let showShare = true;
 
         this._insideRefresh = true;
 
@@ -854,6 +863,10 @@ const SelectionToolbar = new Lang.Class({
                 if ((doc.defaultAppName) &&
                     (apps.indexOf(doc.defaultAppName) == -1))
                     apps.push(doc.defaultAppName);
+                if ((doc instanceof Documents.LocalDocument) ||
+                    (doc.collection != false) ||
+                    (selection.length > 1))
+                    showShare = false;
 
                 showTrash &= doc.canTrash();
                 showPrint &= !doc.collection;
@@ -880,6 +893,7 @@ const SelectionToolbar = new Lang.Class({
         this._toolbarProperties.set_visible(showProperties);
         this._toolbarTrash.set_visible(showTrash);
         this._toolbarOpen.set_visible(showOpen);
+        this._toolbarShare.set_visible(showShare);
 
         this._insideRefresh = false;
     },
@@ -933,6 +947,19 @@ const SelectionToolbar = new Lang.Class({
             }));
     },
 
+   _onToolbarShare: function(widget) {
+	    let dialog = new Sharing.SharingDialog();
+        this._fadeOut();
+
+        dialog.widget.connect('response', Lang.bind(this,
+            function(widget, response) {
+                if (response == Gtk.ResponseType.OK) {
+                    dialog.widget.destroy();
+                    this._fadeIn();
+                }
+            }));
+    },
+
     _onToolbarPrint: function(widget) {
         let selection = Application.selectionController.getSelection();
 



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