diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 4a6260a7..5f07a966 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -153,6 +153,7 @@ class Controller(object): widgetUtils.connect_event(self.view, widgetUtils.MENU, self.update_profile, menuitem=self.view.updateProfile) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.user_details, menuitem=self.view.details) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.toggle_autoread, menuitem=self.view.autoread) + widgetUtils.connect_event(self.view, widgetUtils.MENU, self.toggle_buffer_mute, self.view.mute_buffer) widgetUtils.connect_event(self.view.nb, widgetUtils.NOTEBOOK_PAGE_CHANGED, self.buffer_changed) def set_systray_icon(self): @@ -720,8 +721,17 @@ class Controller(object): self.view.advance_selection(forward) def buffer_changed(self, *args, **kwargs): - if self.get_current_buffer().account != self.current_account: - self.current_account = self.get_current_buffer().account + buffer = self.get_current_buffer() + if buffer.account != self.current_account: + self.current_account = buffer.account + if not hasattr(buffer, "session") or buffer.session == None: return + muted = autoread = False + if buffer.name in buffer.session.settings["other_buffers"]["muted_buffers"]: + muted = True + elif buffer.name in buffer.session.settings["other_buffers"]["autoread_buffers"]: + autoread = True + self.view.check_menuitem("mute_buffer", muted) + self.view.check_menuitem("autoread", autoread) def fix_wrong_buffer(self): buffer = self.get_current_buffer() diff --git a/src/wxUI/view.py b/src/wxUI/view.py index 26d85b2f..c8298810 100644 --- a/src/wxUI/view.py +++ b/src/wxUI/view.py @@ -61,8 +61,9 @@ class mainFrame(wx.Frame): # buffer menu buffer = wx.Menu() self.load_previous_items = buffer.Append(wx.NewId(), _(u"&Load previous items")) - self.mute = buffer.Append(wx.NewId(), _(u"&Mute")) - self.autoread = buffer.Append(wx.NewId(), _(u"&Autoread tweets for this buffer")) + buffer.AppendSeparator() + self.mute_buffer = buffer.AppendCheckItem(wx.NewId(), _(u"&Mute")) + self.autoread = buffer.AppendCheckItem(wx.NewId(), _(u"&Autoread tweets for this buffer")) self.clear = buffer.Append(wx.NewId(), _(u"&Clear buffer")) self.deleteTl = buffer.Append(wx.NewId(), _(u"&Remove buffer")) @@ -181,5 +182,9 @@ class mainFrame(wx.Frame): def set_focus(self): self.SetFocus() + def check_menuitem(self, menuitem, check=True): + if hasattr(self, menuitem): + getattr(self, menuitem).Check(check) + def no_update_available(): wx.MessageDialog(None, _(u"Your TW Blue version is up to date"), _(u"Update"), style=wx.OK).ShowModal()