diff --git a/default.glade b/default.glade
index 8be8490..919e554 100644
--- a/default.glade
+++ b/default.glade
@@ -21,6 +21,7 @@
True
False
+
@@ -61,6 +62,7 @@
True
_View
True
+
diff --git a/mytwitter.py b/mytwitter.py
index 2f9adaf..f42d566 100755
--- a/mytwitter.py
+++ b/mytwitter.py
@@ -167,7 +167,7 @@ class MyTwitter():
# Remove one of the views from the tweet notebook.
# Called when the close button is clicked on one of the views
- def remove_view(self, event, name):
+ def remove_view(self, name):
for i in range(self.tweet_notebook.get_n_pages()):
pane = self.tweet_notebook.get_nth_page(i)
if (pane.get_list_name() == name):
@@ -175,6 +175,10 @@ class MyTwitter():
return
+ def remove_view_callback(self, event, name):
+ self.remove_view(name)
+
+
def add_to_notebook(self, name, single_tweet=None):
# If it already exists, don't add it, just switch to it
for i in range(self.tweet_notebook.get_n_pages()):
@@ -197,7 +201,7 @@ class MyTwitter():
following = self.check_following(name)
new_pane = TweetPane(name, num_entries=self.num_entries, single_tweet=single_tweet, is_user=is_user, following=following)
self.tweet_notebook.append_page_menu(new_pane, new_pane.get_tab_label(), gtk.Label(name))
- new_pane.get_tab_label().connect('close-clicked', self.remove_view, name)
+ 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)
new_pane.connect('tweet-in-reply-to', self.on_reply_to)
@@ -285,6 +289,17 @@ class MyTwitter():
self.add_to_notebook('@' + user_name)
+ def global_key_press_handler(self, widget, event):
+ keyname = gtk.gdk.keyval_name(event.keyval)
+ if keyname == 'w' and event.state & gtk.gdk.CONTROL_MASK:
+ self.close_current_tab()
+
+
+ def close_current_tab(self):
+ current_pane = self.tweet_notebook.get_nth_page(self.tweet_notebook.get_current_page())
+ self.remove_view(current_pane.get_list_name())
+
+
### end class MyTwitter
diff --git a/twitterwidgets.py b/twitterwidgets.py
index c83361c..a550ec7 100644
--- a/twitterwidgets.py
+++ b/twitterwidgets.py
@@ -41,7 +41,7 @@ class TweetPane(gtk.ScrolledWindow):
def init_widgets(self):
- self.tab_label.connect('label_clicked', self.set_tweets_read_callback)
+ self.tab_label.connect('label-clicked', self.set_tweets_read_callback)
tweet_box = gtk.VBox()
viewport = gtk.Viewport()
@@ -59,7 +59,7 @@ class TweetPane(gtk.ScrolledWindow):
# Several different actions should mark the tweets as 'read'
self.connect('focus', self.set_tweets_read_callback)
- viewport.connect('button_press_event', self.set_tweets_read_callback)
+ viewport.connect('button-press-event', self.set_tweets_read_callback)
self.connect('scroll-event', self.set_tweets_read_callback)
self.connect('scroll-child', self.set_tweets_read_callback)