diff options
author | Marco 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) |
commit | d213eada769f337bf0f538b1d670c0ab97caec54 (patch) | |
tree | 15fcf93826fda089e30331ecb5d7622d0abdf97a /sugar/shell | |
parent | a6b1307eb4452fdd092a5218a825c1fe0fae5cb0 (diff) |
Change tab label color when there are
Diffstat (limited to 'sugar/shell')
-rw-r--r-- | sugar/shell/activity.py | 24 | ||||
-rwxr-xr-x | sugar/shell/shell.py | 12 |
2 files changed, 29 insertions, 7 deletions
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): |