Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2006-05-22 21:59:42 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2006-05-22 21:59:42 (GMT)
commitd213eada769f337bf0f538b1d670c0ab97caec54 (patch)
tree15fcf93826fda089e30331ecb5d7622d0abdf97a /sugar
parenta6b1307eb4452fdd092a5218a825c1fe0fae5cb0 (diff)
Change tab label color when there are
Diffstat (limited to 'sugar')
-rwxr-xr-xsugar/chat/chat.py13
-rw-r--r--sugar/shell/activity.py24
-rwxr-xr-xsugar/shell/shell.py12
3 files changed, 40 insertions, 9 deletions
diff --git a/sugar/chat/chat.py b/sugar/chat/chat.py
index 6e246ea..514c47a 100755
--- a/sugar/chat/chat.py
+++ b/sugar/chat/chat.py
@@ -271,10 +271,15 @@ class Chat(activity.Activity):
self.activity_shutdown()
def activity_on_lost_focus(self):
- print "act %d: in activity_on_lost_focus" % self.activity_get_id()
+ activity.Activity.activity_on_lost_focus()
def activity_on_got_focus(self):
- print "act %d: in activity_on_got_focus" % self.activity_get_id()
+ activity.Activity.activity_on_got_focus()
+ self.activity_set_has_changes(False)
+
+ def _message_inserted(self):
+ if not self.get_has_focus():
+ self.activity_set_has_changes(True)
def _insert_buddy(self, buf, nick):
buddy = self._controller.get_group().get_buddy(nick)
@@ -286,6 +291,8 @@ class Chat(activity.Activity):
aniter = buf.get_end_iter()
buf.insert(aniter, nick + ": ")
+
+ self._message_inserted()
def _insert_rich_message(self, nick, msg):
msg = Emoticons.get_instance().replace(msg)
@@ -299,6 +306,8 @@ class Chat(activity.Activity):
aniter = buf.get_end_iter()
buf.insert(aniter, "\n")
+
+ self._message_inserted()
def _insert_sketch(self, nick, svgdata):
"""Insert a sketch object into the chat buffer."""
diff --git a/sugar/shell/activity.py b/sugar/shell/activity.py
index f7e5909..e0f26d1 100644
--- a/sugar/shell/activity.py
+++ b/sugar/shell/activity.py
@@ -12,7 +12,10 @@ class Activity(dbus.service.Object):
""" Base Sugar activity object from which all other Activities should inherit """
def __init__(self):
- pass
+ self._has_focus = False
+
+ def get_has_focus(self):
+ return self._has_focus
def name_owner_changed(self, service_name, old_service_name, new_service_name):
#print "in name_owner_changed: svc=%s oldsvc=%s newsvc=%s"%(service_name, old_service_name, new_service_name)
@@ -102,6 +105,13 @@ class Activity(dbus.service.Object):
in_signature="", \
out_signature="")
+ def activity_set_has_changes(self, has_changes):
+ self.__activity_object.set_has_changes(has_changes)
+
+ @dbus.service.method("com.redhat.Sugar.Activity", \
+ in_signature="", \
+ out_signature="")
+
def activity_set_tab_icon_name(self, icon_name):
icon_theme = gtk.icon_theme_get_default()
icon_info = icon_theme.lookup_icon(icon_name, gtk.ICON_SIZE_MENU, 0)
@@ -161,6 +171,12 @@ class Activity(dbus.service.Object):
def activity_shutdown(self):
self.__activity_object.shutdown(reply_handler = self.__shutdown_reply_cb, error_handler = self.__shutdown_error_cb)
+ def activity_on_lost_focus(self):
+ self._has_focus = False;
+
+ def activity_on_got_focus(self):
+ self._has_focus = True
+
# pure virtual methods
def activity_on_connected_to_shell(self):
@@ -171,9 +187,3 @@ class Activity(dbus.service.Object):
def activity_on_close_from_user(self):
print "act %d: you need to override activity_on_close_from_user" % self.activity_get_id()
-
- def activity_on_lost_focus(self):
- print "act %d: you need to override activity_on_lost_focus" % self.activity_get_id()
-
- def activity_on_got_focus(self):
- print "act %d: you need to override activity_on_got_focus" % self.activity_get_id()
diff --git a/sugar/shell/shell.py b/sugar/shell/shell.py
index 394efde..0b9aea1 100755
--- a/sugar/shell/shell.py
+++ b/sugar/shell/shell.py
@@ -131,6 +131,18 @@ class ActivityHost(dbus.service.Object):
self.tab_activity_image.hide()
@dbus.service.method("com.redhat.Sugar.Shell.ActivityHost", \
+ in_signature="b", \
+ out_signature="")
+ def set_has_changes(self, has_changes):
+ if has_changes:
+ attrs = pango.AttrList()
+ attrs.insert(pango.AttrForeground(65535, 0, 0, 0, -1))
+ attrs.insert(pango.AttrWeight(pango.WEIGHT_BOLD, 0, -1))
+ self.tab_label.set_attributes(attrs)
+ else:
+ self.tab_label.set_attributes(pango.AttrList())
+
+ @dbus.service.method("com.redhat.Sugar.Shell.ActivityHost", \
in_signature="s", \
out_signature="")
def set_tab_text(self, text):