diff --git a/default.glade b/default.glade
index 99051d3..8df5bad 100644
--- a/default.glade
+++ b/default.glade
@@ -79,10 +79,15 @@
-
@@ -163,7 +168,7 @@
True
GTK_RELIEF_NORMAL
True
-
+
0
@@ -173,19 +178,7 @@
-
- True
- Home
- False
- True
- True
-
-
-
- 0
- False
- False
-
+
diff --git a/mytwitter.py b/mytwitter.py
index 85a3c1e..271c18e 100755
--- a/mytwitter.py
+++ b/mytwitter.py
@@ -29,8 +29,6 @@ class MyTwitter():
self.tweets = []
self.list = None
self.reply_id = None
- self.last_tweet_read = None
- self.latest_tweet = None
# Authenticate with twitter, set up the API object
self.api = twitter.Api(username=self.username, password=self.password)
@@ -47,7 +45,6 @@ class MyTwitter():
def init_widgets(self):
# Get widgets from glade
- self.list_select = self.widget_tree.get_widget('list_select')
self.tweet_notebook = self.widget_tree.get_widget('tweet_notebook')
self.view_menu = self.widget_tree.get_widget('view_menu')
self.update_entry = self.widget_tree.get_widget('update_entry')
@@ -62,35 +59,41 @@ class MyTwitter():
self.tweet_notebook.append_page(self.tweet_panes[0])
self.tweet_notebook.set_tab_label_text(self.tweet_panes[0], 'Home')
- # Fill the ComboBox with entries
- self.list_select.append_text('@' + self.username)
+ # Put Home, @user, and lists in the View menu...
lists = self.api.GetUserLists()
list_names = []
- # two passes to sort this nicely
for l in lists['lists']:
list_names.append(l.name)
list_names.sort()
+ list_names.insert(0, 'Home')
+ list_names.insert(1, '@' + self.username)
for l in list_names:
- self.list_select.append_text(l)
+ menu_item = gtk.MenuItem(l)
+ self.view_menu.append(menu_item)
+ menu_item.connect('activate', self.on_view_selected, l)
+ menu_item.show()
# Timer to update periodically
- self.update_window()
- gobject.timeout_add(self.refresh_time * 1000, self.update_window)
+ self.update_windows()
+ gobject.timeout_add(self.refresh_time * 1000, self.update_windows)
- def update_window(self):
- if self.list is None or self.list == 'Home':
- statuses = self.api.GetHomeTimeline(count=self.num_entries)
- elif self.list == '@' + self.username:
- statuses = self.api.GetMentions(count=self.num_entries)
- else:
- statuses = self.api.GetListStatuses(self.list, per_page=self.num_entries)
+ def update_windows(self):
+ for pane in self.tweet_panes:
+ list_name = pane.get_list_name()
- self.tweet_panes[0].update_window(statuses)
+ if list_name is None or list_name == 'Home':
+ statuses = self.api.GetHomeTimeline(count=self.num_entries)
+ elif list_name == '@' + self.username:
+ statuses = self.api.GetMentions(count=self.num_entries)
+ else:
+ statuses = self.api.GetListStatuses(list_name, per_page=self.num_entries)
+
+ pane.update_window(statuses)
- def update_window_callback(self, widget):
- self.update_window()
+ def update_windows_callback(self, widget):
+ self.update_windows()
def update_status(self):
@@ -124,12 +127,6 @@ class MyTwitter():
print "STUB: help->about not yet implemented"
- def on_list_select_changed(self, widget):
- self.list = widget.get_active_text()
- self.last_tweet_read = None
- self.update_window()
-
-
def on_reply(self, widget):
self.update_entry.set_text('@' + widget.screen_name + ' ')
self.reply_id = widget.id
@@ -148,6 +145,10 @@ class MyTwitter():
def set_tweets_read_callback(self, event):
self.set_tweets_read()
+
+ def on_view_selected(self, event, name):
+ print 'debug: on_view_selected(): ' + name
+
### end class MyTwitter
@@ -217,6 +218,10 @@ class TweetPane(gtk.ScrolledWindow):
if num_new_tweets > 0:
pass # fixme: change the label here, or maybe in mytwitter?
+
+ def get_list_name(self):
+ return self.list_name
+
### end class TweetPane