Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@sugarlabs.org>2009-01-06 12:31:02 (GMT)
committer Tomeu Vizoso <tomeu@sugarlabs.org>2009-01-06 12:31:02 (GMT)
commit44f269eef00620084ab3351d5be22df9be533cb5 (patch)
tree0aaf111166235c943908cc1176d742c56cfebfc5 /src
parentdcbc9df56387f7b17178ea1b9eae96a10f3abccc (diff)
#3060 Add the possibility of filtering the object chooser by data type
Diffstat (limited to 'src')
-rw-r--r--src/jarabe/journal/journalactivity.py6
-rw-r--r--src/jarabe/journal/journaltoolbox.py13
-rw-r--r--src/jarabe/journal/objectchooser.py5
3 files changed, 20 insertions, 4 deletions
diff --git a/src/jarabe/journal/journalactivity.py b/src/jarabe/journal/journalactivity.py
index a1fd269..389dd45 100644
--- a/src/jarabe/journal/journalactivity.py
+++ b/src/jarabe/journal/journalactivity.py
@@ -79,14 +79,14 @@ class JournalActivityDBusService(dbus.service.Object):
chooser.destroy()
del chooser
- @dbus.service.method(J_DBUS_INTERFACE, in_signature='i', out_signature='s')
- def ChooseObject(self, parent_xid):
+ @dbus.service.method(J_DBUS_INTERFACE, in_signature='is', out_signature='s')
+ def ChooseObject(self, parent_xid, data_type=''):
chooser_id = uuid.uuid4().hex
if parent_xid > 0:
parent = gtk.gdk.window_foreign_new(parent_xid)
else:
parent = None
- chooser = ObjectChooser(parent)
+ chooser = ObjectChooser(parent, data_type)
chooser.connect('response', self._chooser_response_cb, chooser_id)
chooser.show()
diff --git a/src/jarabe/journal/journaltoolbox.py b/src/jarabe/journal/journaltoolbox.py
index ce20d6b..f0f454e 100644
--- a/src/jarabe/journal/journaltoolbox.py
+++ b/src/jarabe/journal/journaltoolbox.py
@@ -245,6 +245,19 @@ class SearchToolbar(gtk.Toolbar):
self._query = new_query
self.emit('query-changed', self._query)
+ def set_data_type(self, data_type):
+ model = self._what_search_combo.get_model()
+ data_type_index = -1
+ for i in range(0, len(model) - 1):
+ if model[i][0] == data_type:
+ data_type_index = i
+ break
+
+ if data_type_index == -1:
+ logging.warning('data_type %r not known' % data_type)
+ else:
+ self._what_search_combo.set_active(data_type_index)
+
def refresh_filters(self):
current_value = self._what_search_combo.props.value
current_value_index = 0
diff --git a/src/jarabe/journal/objectchooser.py b/src/jarabe/journal/objectchooser.py
index fcaed55..38b5035 100644
--- a/src/jarabe/journal/objectchooser.py
+++ b/src/jarabe/journal/objectchooser.py
@@ -39,7 +39,7 @@ class ObjectChooser(gtk.Window):
([int]))
}
- def __init__(self, parent=None):
+ def __init__(self, parent=None, data_type):
gtk.Window.__init__(self)
self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
self.set_decorated(False)
@@ -89,6 +89,9 @@ class ObjectChooser(gtk.Window):
height = gtk.gdk.screen_height() - style.GRID_CELL_SIZE * 2
self.set_size_request(width, height)
+ if data_type:
+ self._toolbar.set_data_type(data_type)
+
def __realize_cb(self, chooser, parent):
self.window.set_transient_for(parent)
# TODO: Should we disconnect the signal here?