Made tabs reorderable, and added code to persist the ordering changes

This commit is contained in:
Anna 2010-04-21 10:01:59 -04:00
parent 5220961620
commit 5c7798398b
3 changed files with 18 additions and 5 deletions

3
TODO
View File

@ -11,4 +11,5 @@ features:
bugs:
* Direct Messages have no names...
* Direct Messages have no names
* single-tweet tabs will not persist properly

View File

@ -158,6 +158,8 @@
<property name="tab_pos">GTK_POS_TOP</property>
<property name="scrollable">True</property>
<property name="enable_popup">True</property>
<signal name="switch_page" handler="on_tab_change" last_modification_time="Wed, 21 Apr 2010 13:37:05 GMT"/>
<signal name="page_reordered" handler="on_tabs_reordered" last_modification_time="Wed, 21 Apr 2010 13:38:13 GMT"/>
<child>
<widget class="GtkVBox" id="vbox1">

View File

@ -65,7 +65,8 @@ class MyTwitter():
self.context_id = self.status_bar.get_context_id('message')
self.tweet_notebook.remove_page(0) # kill the page that glade makes us have
# Manual tweaks to the glade UI, to overcome its limitations
self.tweet_notebook.remove_page(0)
self.account_select.remove_text(0)
# Add entries to the account select box, set the default entry
@ -73,9 +74,6 @@ class MyTwitter():
self.account_select.append_text(username)
self.account_select.set_active(0)
# When we change tabs, any unread tweets in it become read
self.tweet_notebook.connect('switch_page', self.on_tab_change)
# Add the tabs from last session to the notebook
for tab in self.db['open_tabs']:
self.add_to_notebook(tab)
@ -268,6 +266,7 @@ class MyTwitter():
verified = self.check_verified(name)
new_pane = TweetPane(name, num_entries=self.num_entries, single_tweet=single_tweet, is_user=is_user, following=following, verified=verified)
self.tweet_notebook.append_page_menu(new_pane, new_pane.get_tab_label(), gtk.Label(name))
self.tweet_notebook.set_tab_reorderable(new_pane, True)
new_pane.get_tab_label().connect('close-clicked', self.remove_view_callback, name)
new_pane.connect('tweet-reply', self.on_reply)
new_pane.connect('tweet-retweet', self.on_retweet)
@ -303,6 +302,17 @@ class MyTwitter():
self.verified_label.hide()
def on_tabs_reordered(self, widget, child, page_num):
# Clear the persistent tabs list, and recreate it
# from scratch
tab_names = []
for i in range(self.tweet_notebook.get_n_pages()):
tab_names.append(self.tweet_notebook.get_nth_page(i).get_list_name())
self.db['open_tabs'] = tab_names
def on_search(self, event):
search_string = self.search_entry.get_text()
self.search_entry.set_text('')