code: def rename_page(self, page_index, new_text, user_set=False):
          
          page = self.get_nth_page(page_index)
          if not getattr(page, "custom_label_set", False) or user_set:
              old_label = self.get_tab_label(page)
              if isinstance(old_label, TabLabelEventBox):
                  old_label.set_text(new_text)
              else:
                  label = TabLabelEventBox(self, new_text, self.guake.settings)
                  label.add_events(Gdk.EventMask.SCROLL_MASK)
                  label.connect('scroll-event', self.scroll_callback.on_scroll)
  
                  self.set_tab_label(page, label)
              if user_set:
                  setattr(page, "custom_label_set", new_text != "-")
docs: Rename an already added page by its index. Use user_set to define
          if the rename was triggered by the user (eg. rename dialog) or by
          an update from the vte (eg. vte:window-title-changed)