bigboard r7287 - in trunk/bigboard/stocks: google_calendar people
- From: marinaz svn gnome org
- To: svn-commits-list gnome org
- Subject: bigboard r7287 - in trunk/bigboard/stocks: google_calendar people
- Date: Thu, 10 Apr 2008 22:59:53 +0100 (BST)
Author: marinaz
Date: Thu Apr 10 22:59:52 2008
New Revision: 7287
URL: http://svn.gnome.org/viewvc/bigboard?rev=7287&view=rev
Log:
Close a slideout in the People stock when the same PersonItem is clicked. Preserve the behavior that a chat window, and not a slideout, is displayed if an IM status section of the PersonItem got clicked.
Check if the slideout got opened successfully in the CalendarStock.
Modified:
trunk/bigboard/stocks/google_calendar/CalendarStock.py
trunk/bigboard/stocks/people/PeopleStock.py
Modified: trunk/bigboard/stocks/google_calendar/CalendarStock.py
==============================================================================
--- trunk/bigboard/stocks/google_calendar/CalendarStock.py (original)
+++ trunk/bigboard/stocks/google_calendar/CalendarStock.py Thu Apr 10 22:59:52 2008
@@ -1035,7 +1035,14 @@
self.__slideout_event = event
coords = event.get_screen_coords()
# _logger.debug("coords are %s %s; allocation alone %s", self.__box.get_context().translate_to_screen(self.__box)[0] + self.__box.get_allocation()[0] + 4, coords[1], event.get_allocation())
- self.__slideout.slideout_from(self.__box.get_context().translate_to_screen(self.__box)[0] + self.__box.get_allocation()[0] + 4, coords[1])
+
+ # this signal is emmited if the slideout should be closed because the user clicked elsewhere
+ # on the desktop
+ self.__slideout.connect("close", self.__close_slideout)
+
+ if not self.__slideout.slideout_from(self.__box.get_context().translate_to_screen(self.__box)[0] + self.__box.get_allocation()[0] + 4, coords[1]):
+ self.__close_slideout()
+ return
calendar_dict_list = []
for calendar_link in event.get_event().get_calendar_links():
@@ -1046,9 +1053,6 @@
# this signal is emitted if the slideout should be closed do to the event with the slideout,
# e.g. a web link was clicked
p.connect("close", self.__close_slideout)
- # this signal is emmited if the slideout should be closed because the user clicked elsewhere
- # on the desktop
- self.__slideout.connect("close", self.__close_slideout)
return True
def get_events(self):
Modified: trunk/bigboard/stocks/people/PeopleStock.py
==============================================================================
--- trunk/bigboard/stocks/people/PeopleStock.py (original)
+++ trunk/bigboard/stocks/people/PeopleStock.py Thu Apr 10 22:59:52 2008
@@ -1,4 +1,4 @@
-import logging
+import logging, gtk
import hippo
@@ -32,6 +32,8 @@
self.__slideout = None
self.__slideout_item = None
+ self.__last_slideout_event_time = None
+ self.__in_slideout_close_event = False
self.__people_browser = None
self._add_more_button(self.__on_more_button)
@@ -76,8 +78,12 @@
box.insert_sorted(item, hippo.PACK_IF_FITS, lambda a,b: sort_people(a.person, b.person))
item.connect('sort-changed', resort)
- item.connect('activated', self.__handle_item_pressed)
-
+ # A PersonItem might be pressed, but not be activated, if am IM status portion
+ # of it got pressed and resulted in an IM chat window being opened. So we have
+ # to handle this event in two steps here.
+ item.connect('button-press-event', self.__handle_item_pressed)
+ item.connect('activated', self.__handle_item_activated)
+
map[person] = item
self.__set_item_size(item, self.get_size())
@@ -98,22 +104,27 @@
self.__remove_person(person, self.__person_box, self.__person_items)
def __close_slideout(self, object=None, action_taken=False):
+ self.__last_slideout_event_time = gtk.get_current_event_time()
if self.__slideout:
if action_taken:
self._panel.action_taken()
self.__slideout.destroy()
self.__slideout = None
- self.__slideout_item = None
-
- def __handle_item_pressed(self, item):
+
+ def __handle_item_pressed(self, item, event):
+ self.__in_slideout_close_event = self.__last_slideout_event_time == gtk.get_current_event_time()
+
+ def __handle_item_activated(self, item):
same_item = self.__slideout_item == item
- self.__close_slideout()
- if same_item:
+ if same_item and self.__in_slideout_close_event:
+ self.__slideout_item = None
+ self.__in_slideout_close_event = False
return True
+ self.__in_slideout_close_event = False
+
self.__slideout = bigboard.slideout.ThemedSlideout()
self.__slideout_item = item
-
coords = item.get_screen_coords()
p = ProfileItem(item.get_person(),
@@ -124,7 +135,6 @@
self.__slideout.get_root().append(p)
p.connect("close", self.__close_slideout)
self.__slideout.connect("close", self.__close_slideout)
-
try:
success = False
success = self.__slideout.slideout_from(coords[0] + item.get_allocation()[0] + 4, coords[1])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]