[gnome-shell] st-widget: Move reactivity tracking to StWidget, use "insensitive"
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] st-widget: Move reactivity tracking to StWidget, use "insensitive"
- Date: Tue, 24 Jul 2012 09:11:55 +0000 (UTC)
commit 414fe75d02d83dbfebffa75db29a8ac74681c1e3
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Sun Jul 22 20:46:48 2012 -0300
st-widget: Move reactivity tracking to StWidget, use "insensitive"
This lets use remove another few pieces of code that do the tracking
manually.
https://bugzilla.gnome.org/show_bug.cgi?id=680426
data/theme/gnome-shell.css | 4 ++--
js/ui/messageTray.js | 4 ----
js/ui/popupMenu.js | 13 -------------
src/st/st-button.c | 12 ------------
src/st/st-widget.c | 12 ++++++++++++
5 files changed, 14 insertions(+), 31 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index f2b5f33..189b417 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -202,7 +202,7 @@ StScrollBar StButton#vhandle:hover
background-color: #4c4c4c;
}
-.popup-menu-item:insensitive {
+StButton.popup-menu-item:insensitive {
color: #9f9f9f;
}
@@ -1630,7 +1630,7 @@ StScrollBar StButton#vhandle:hover
padding: 4px 32px 5px;
}
-.modal-dialog-button:disabled {
+.modal-dialog-button:insensitive {
color: rgb(60, 60, 60);
}
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index d1c726d..d7b7647 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -799,10 +799,6 @@ const Notification = new Lang.Class({
return;
button.reactive = sensitive;
- if (sensitive)
- button.remove_style_pseudo_class('insensitive');
- else
- button.add_style_pseudo_class('insensitive');
},
setUrgency: function(urgency) {
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 7570d6e..0517837 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -135,10 +135,6 @@ const PopupBaseMenuItem = new Lang.Class({
this.sensitive = sensitive;
this.actor.reactive = sensitive;
- if (sensitive)
- this.actor.remove_style_pseudo_class('insensitive');
- else
- this.actor.add_style_pseudo_class('insensitive');
this.emit('sensitive-changed', sensitive);
},
@@ -1900,10 +1896,6 @@ const RemoteMenu = new Lang.Class({
}
item.actor.reactive = action.enabled;
- if (action.enabled)
- item.actor.remove_style_pseudo_class('insensitive');
- else
- item.actor.add_style_pseudo_class('insensitive');
destroyId = item.connect('destroy', Lang.bind(this, function() {
item.disconnect(destroyId);
@@ -2036,11 +2028,6 @@ const RemoteMenu = new Lang.Class({
for (let i = 0; i < action.items.length; i++) {
let item = action.items[i];
item.actor.reactive = action.enabled;
-
- if (action.enabled)
- item.actor.remove_style_pseudo_class('insensitive');
- else
- item.actor.add_style_pseudo_class('insensitive');
}
}
}
diff --git a/src/st/st-button.c b/src/st/st-button.c
index e3c46f9..a4edbe7 100644
--- a/src/st/st-button.c
+++ b/src/st/st-button.c
@@ -447,15 +447,6 @@ st_button_class_init (StButtonClass *klass)
}
static void
-notify_reactive_cb (StWidget *button)
-{
- if (clutter_actor_get_reactive (CLUTTER_ACTOR (button)))
- st_widget_remove_style_pseudo_class (button, "disabled");
- else
- st_widget_add_style_pseudo_class (button, "disabled");
-}
-
-static void
st_button_init (StButton *button)
{
button->priv = ST_BUTTON_GET_PRIVATE (button);
@@ -464,9 +455,6 @@ st_button_init (StButton *button)
clutter_actor_set_reactive (CLUTTER_ACTOR (button), TRUE);
st_widget_set_track_hover (ST_WIDGET (button), TRUE);
-
- g_signal_connect(button, "notify::reactive",
- G_CALLBACK (notify_reactive_cb), NULL);
}
/**
diff --git a/src/st/st-widget.c b/src/st/st-widget.c
index 6d65393..7678082 100644
--- a/src/st/st-widget.c
+++ b/src/st/st-widget.c
@@ -1405,6 +1405,17 @@ st_widget_name_notify (StWidget *widget,
}
static void
+st_widget_reactive_notify (StWidget *widget,
+ GParamSpec *pspec,
+ gpointer data)
+{
+ if (clutter_actor_get_reactive (CLUTTER_ACTOR (widget)))
+ st_widget_remove_style_pseudo_class (widget, "insensitive");
+ else
+ st_widget_add_style_pseudo_class (widget, "insensitive");
+}
+
+static void
st_widget_first_child_notify (StWidget *widget,
GParamSpec *pspec,
gpointer data)
@@ -1466,6 +1477,7 @@ st_widget_init (StWidget *actor)
/* connect style changed */
g_signal_connect (actor, "notify::name", G_CALLBACK (st_widget_name_notify), NULL);
+ g_signal_connect (actor, "notify::reactive", G_CALLBACK (st_widget_reactive_notify), NULL);
g_signal_connect (actor, "notify::first-child", G_CALLBACK (st_widget_first_child_notify), NULL);
g_signal_connect (actor, "notify::last-child", G_CALLBACK (st_widget_last_child_notify), NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]