[gnome-shell] Remove ShellButtonBox, button.js; Use St.Clickable in panel.js



commit 2f1ca7bf28326073dd95d58215c300b890d0e417
Author: Colin Walters <walters verbum org>
Date:   Mon Nov 16 14:16:22 2009 -0500

    Remove ShellButtonBox, button.js; Use St.Clickable in panel.js
    
    StClickable replaces ShellButtonBox.  Reduce the number of
    button-like things by deleting button.js.
    
    To do so, add CSS style for the actitivies button.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=602131

 data/theme/gnome-shell.css |   10 ++
 js/ui/Makefile.am          |    3 +-
 js/ui/altTab.js            |   12 +-
 js/ui/button.js            |  172 ------------------------
 js/ui/dash.js              |    1 -
 js/ui/panel.js             |   19 ++--
 src/Makefile.am            |    2 -
 src/shell-button-box.c     |  317 --------------------------------------------
 src/shell-button-box.h     |   36 -----
 9 files changed, 28 insertions(+), 544 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 16b6f76..ab2d8ac 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -287,6 +287,16 @@ StTooltip {
   spacing: 4px;
 }
 
+/* Panel */
+
+#panelActivities {
+    color: #ffffff;
+}
+
+#panelActivities:pressed {
+    background-color: rgba(50,76,111,0.98);
+}
+
 /* Calendar popup */
 
 #calendarPopup {
diff --git a/js/ui/Makefile.am b/js/ui/Makefile.am
index a74fb86..4b6260c 100644
--- a/js/ui/Makefile.am
+++ b/js/ui/Makefile.am
@@ -4,8 +4,7 @@ dist_jsui_DATA =		\
 	altTab.js		\
 	appDisplay.js		\
 	appFavorites.js		\
-	appIcon.js		\
-	button.js		\
+	appIcon.js      \
 	calendar.js		\
 	chrome.js		\
 	dash.js			\
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index add986f..78f8262 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -440,16 +440,18 @@ SwitcherList.prototype = {
     addItem : function(item) {
         // We want the St.Bin's padding to be clickable (since it will
         // be part of the highlighted background color), so we put the
-        // bin inside the ButtonBox rather than vice versa.
+        // bin inside the Clickable rather than vice versa.
         let bin = new St.Bin({ style_class: 'item-box' });
-        let bbox = new Shell.ButtonBox({ reactive: true });
+        let bbox = new St.Clickable({ reactive: true,
+                                      x_fill: true,
+                                      y_fill: true });
 
         bin.add_actor(item);
-        bbox.append(bin, Big.BoxPackFlags.NONE);
+        bbox.set_child(bin);
         this._list.add_actor(bbox);
 
         let n = this._items.length;
-        bbox.connect('activate', Lang.bind(this, function () {
+        bbox.connect('clicked', Lang.bind(this, function () {
                                                this._itemActivated(n);
                                           }));
         bbox.connect('enter-event', Lang.bind(this, function () {
@@ -681,7 +683,7 @@ AppSwitcher.prototype = {
         this.icons.push(appIcon);
         this.addItem(appIcon.actor);
 
-        // SwitcherList creates its own Shell.ButtonBox; we want to
+        // SwitcherList creates its own St.Clickable; we want to
         // avoid intercepting the events it wants.
         appIcon.actor.reactive = false;
 
diff --git a/js/ui/dash.js b/js/ui/dash.js
index 3a2f5e4..1fc2184 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -16,7 +16,6 @@ const AppDisplay = imports.ui.appDisplay;
 const DocDisplay = imports.ui.docDisplay;
 const PlaceDisplay = imports.ui.placeDisplay;
 const GenericDisplay = imports.ui.genericDisplay;
-const Button = imports.ui.button;
 const Main = imports.ui.main;
 
 const DEFAULT_PADDING = 4;
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 6d126a8..9ae999b 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -13,7 +13,6 @@ const Signals = imports.signals;
 const Gettext = imports.gettext.domain('gnome-shell');
 const _ = Gettext.gettext;
 
-const Button = imports.ui.button;
 const Calendar = imports.ui.calendar;
 const Main = imports.ui.main;
 const StatusMenu = imports.ui.statusMenu;
@@ -274,11 +273,12 @@ Panel.prototype = {
 
         /* Button on the left side of the panel. */
         /* Translators: If there is no suitable word for "Activities" in your language, you can use the word for "Overview". */
-        this.button = new Button.Button(_("Activities"), PANEL_BUTTON_COLOR, PRESSED_BUTTON_BACKGROUND_COLOR,
-                                        PANEL_FOREGROUND_COLOR, DEFAULT_FONT);
-        this.button.actor.height = PANEL_HEIGHT;
+        let label = new St.Label({ text: _("Activities") });
+        this.button = new St.Clickable({ name: 'panelActivities' });
+        this.button.set_child(label);
+        this.button.height = PANEL_HEIGHT;
 
-        this._leftBox.append(this.button.actor, Big.BoxPackFlags.NONE);
+        this._leftBox.append(this.button, Big.BoxPackFlags.NONE);
 
         // We use this flag to mark the case where the user has entered the
         // hot corner and has not left both the hot corner and a surrounding
@@ -402,8 +402,9 @@ Panel.prototype = {
         // We get into the Overview mode on button-press-event as opposed to button-release-event because eventually we'll probably
         // have the Overview act like a menu that allows the user to release the mouse on the activity the user wants
         // to switch to.
-        this.button.actor.connect('button-press-event', Lang.bind(this, function(b, e) {
-            if (e.get_button() == 1 && e.get_click_count() == 1 && !Main.overview.animationInProgress) {
+        this.button.connect('clicked', Lang.bind(this, function(b) {
+            let event = Clutter.get_current_event();
+            if (!Main.overview.animationInProgress) {
                 this._maybeToggleOverviewOnClick();
                 return true;
             } else {
@@ -414,10 +415,10 @@ Panel.prototype = {
         // pressing the System key, Alt+F1 or Esc. We want the button to be pressed in when the Overview is entered
         // and to be released when it is exited regardless of how it was triggered.
         Main.overview.connect('showing', Lang.bind(this, function() {
-            this.button.actor.active = true;
+            this.button.active = true;
         }));
         Main.overview.connect('hiding', Lang.bind(this, function() {
-            this.button.actor.active = false;
+            this.button.active = false;
         }));
 
         Main.chrome.addActor(this.actor, { visibleInOverview: true });
diff --git a/src/Makefile.am b/src/Makefile.am
index ed9ae60..29c36cb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -63,8 +63,6 @@ libgnome_shell_la_SOURCES =			\
 	shell-app-usage.h			\
 	shell-arrow.c			\
 	shell-arrow.h			\
-	shell-button-box.c           \
-	shell-button-box.h           \
 	shell-drawing.c            \
 	shell-drawing.h            \
 	shell-embedded-window.c			\



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