[Sugar-devel] [PATCH sugar] Journal: rename object_id argument to object_id_or_path
Walter Bender
walter.bender at gmail.com
Tue Jun 12 18:08:59 EDT 2012
On Tue, Jun 12, 2012 at 6:05 PM, Bert Freudenberg <bert at freudenbergs.de> wrote:
> Any comment, anyone?
Seems like a good thing to do.
-walter
>
> This came out of the discussion that ObjectChooserResponse can not only deliver object IDs, but sometimes file paths, too. The argument name should reflect that, IMHO.
>
> - Bert -
>
> On 2012-06-05, at 12:47, Bert Freudenberg wrote:
>
>> In particular, this shows up in DBus introspection. The rename should
>> alert API users not to expect only an object_id.
>>
>> Signed-off-by: Bert Freudenberg <bert at freudenbergs.de>
>> ---
>> src/jarabe/journal/journalactivity.py | 24 ++++++++++++------------
>> 1 files changed, 12 insertions(+), 12 deletions(-)
>>
>> diff --git a/src/jarabe/journal/journalactivity.py b/src/jarabe/journal/journalactivity.py
>> index bb1c7f6..bb45cf2 100644
>> --- a/src/jarabe/journal/journalactivity.py
>> +++ b/src/jarabe/journal/journalactivity.py
>> @@ -66,19 +66,19 @@ class JournalActivityDBusService(dbus.service.Object):
>>
>> @dbus.service.method(J_DBUS_INTERFACE,
>> in_signature='s', out_signature='')
>> - def ShowObject(self, object_id):
>> - """Pop-up journal and show object with object_id"""
>> + def ShowObject(self, object_id_or_path):
>> + """Pop-up journal and show object_id_or_path"""
>>
>> - logging.debug('Trying to show object %s', object_id)
>> + logging.debug('Trying to show object %s', object_id_or_path)
>>
>> - if self._parent.show_object(object_id):
>> + if self._parent.show_object(object_id_or_path):
>> self._parent.reveal()
>>
>> def _chooser_response_cb(self, chooser, response_id, chooser_id):
>> logging.debug('JournalActivityDBusService._chooser_response_cb')
>> if response_id == gtk.RESPONSE_ACCEPT:
>> - object_id = chooser.get_selected_object_id()
>> - self.ObjectChooserResponse(chooser_id, object_id)
>> + object_id_or_path = chooser.get_selected_object_id()
>> + self.ObjectChooserResponse(chooser_id, object_id_or_path)
>> else:
>> self.ObjectChooserCancelled(chooser_id)
>> chooser.destroy()
>> @@ -99,7 +99,7 @@ class JournalActivityDBusService(dbus.service.Object):
>> return chooser_id
>>
>> @dbus.service.signal(J_DBUS_INTERFACE, signature='ss')
>> - def ObjectChooserResponse(self, chooser_id, object_id):
>> + def ObjectChooserResponse(self, chooser_id, object_id_or_path):
>> pass
>>
>> @dbus.service.signal(J_DBUS_INTERFACE, signature='s')
>> @@ -224,8 +224,8 @@ class JournalActivity(JournalWindow):
>> self.set_canvas(self._main_view)
>> self._main_view.show()
>>
>> - def _show_secondary_view(self, object_id):
>> - metadata = model.get(object_id)
>> + def _show_secondary_view(self, object_id_or_path):
>> + metadata = model.get(object_id_or_path)
>> try:
>> self._detail_toolbox.entry_toolbar.set_metadata(metadata)
>> except Exception:
>> @@ -242,12 +242,12 @@ class JournalActivity(JournalWindow):
>> self.set_canvas(self._secondary_view)
>> self._secondary_view.show()
>>
>> - def show_object(self, object_id):
>> - metadata = model.get(object_id)
>> + def show_object(self, object_id_or_path):
>> + metadata = model.get(object_id_or_path)
>> if metadata is None:
>> return False
>> else:
>> - self._show_secondary_view(object_id)
>> + self._show_secondary_view(object_id_or_path)
>> return True
>>
>> def __volume_changed_cb(self, volume_toolbar, mount_point):
>> --
>> 1.7.3.2
>>
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
--
Walter Bender
Sugar Labs
http://www.sugarlabs.org
More information about the Sugar-devel
mailing list