Add a method to show/hide close buttons on the tab

This commit is contained in:
Marco Pesenti Gritti 2006-04-21 15:53:26 -04:00
parent 0f202950a7
commit 79764c7d4f
3 changed files with 24 additions and 1 deletions

View File

@ -61,6 +61,13 @@ class Activity(dbus.service.Object):
def activity_get_gtk_plug(self):
return self.__plug
def activity_set_can_close(self, can_close):
self.__activity_object.set_can_close(can_close)
@dbus.service.method("com.redhat.Sugar.Activity", \
in_signature="", \
out_signature="")
def activity_set_tab_text(self, text):
self.__activity_object.set_tab_text(text)
@ -273,6 +280,7 @@ class BrowserActivity(Activity):
self.uri = uri
def activity_on_connected_to_shell(self):
self.activity_set_can_close(True)
self.activity_set_tab_text("Web Page")
vbox = gtk.VBox()

View File

@ -63,6 +63,13 @@ class Activity(dbus.service.Object):
def activity_get_gtk_plug(self):
return self.__plug
def activity_set_can_close(self, can_close):
self.__activity_object.set_can_close(can_close)
@dbus.service.method("com.redhat.Sugar.Activity", \
in_signature="", \
out_signature="")
def activity_set_tab_text(self, text):
self.__activity_object.set_tab_text(text)

View File

@ -63,7 +63,6 @@ class ActivityHost(dbus.service.Object):
self.tab_close_button.add(close_image)
self.tab_close_button.set_relief(gtk.RELIEF_NONE)
self.tab_close_button.set_focus_on_click(gtk.FALSE)
self.tab_close_button.show()
self.tab_close_button.connect("clicked", self.tab_close_button_clicked)
label_hbox.pack_start(self.tab_label)
@ -98,6 +97,15 @@ class ActivityHost(dbus.service.Object):
self.__peer_service_name, self.__peer_object_name), \
"com.redhat.Sugar.Activity")
@dbus.service.method("com.redhat.Sugar.Shell.ActivityHost", \
in_signature="b", \
out_signature="")
def set_can_close(self, can_close):
if can_close:
self.tab_close_button.show()
else:
self.tab_close_button.hide()
@dbus.service.method("com.redhat.Sugar.Shell.ActivityHost", \
in_signature="s", \
out_signature="")