Ticket #89: 89.patch

File 89.patch, 2.7 KB (added by erikos, 15 years ago)

make the focus search a method in the journalactivity instead of a dbus one

  • src/jarabe/journal/journalactivity.py

    diff --git a/src/jarabe/journal/journalactivity.py b/src/jarabe/journal/journalactivity.py
    index ff73d16..a4cbdb8 100644
    a b class JournalActivityDBusService(dbus.service.Object): 
    6060        dbus.service.Object.__init__(self, bus_name, J_DBUS_PATH)
    6161
    6262    @dbus.service.method(J_DBUS_INTERFACE,
    63         in_signature='', out_signature='')
    64     def FocusSearch(self):
    65         """Become visible and give focus to the search entry
    66         """
    67         self._parent.present()
    68         self._parent.show_main_view()
    69         self._parent.search_grab_focus()
    70 
    71     @dbus.service.method(J_DBUS_INTERFACE,
    7263        in_signature='s', out_signature='')
    7364    def ShowObject(self, object_id):
    7465        """Pop-up journal and show object with object_id"""
    class JournalActivity(Window): 
    332323    def set_active_volume(self, mount):
    333324        self._volumes_toolbar.set_active_volume(mount)
    334325
     326    def focus_search(self):
     327        """Become visible and give focus to the search entry
     328        """
     329        self.present()
     330        self.show_main_view()
     331        self.search_grab_focus()
     332
    335333_journal = None
    336334
    337335def get_journal():
  • src/jarabe/view/keyhandler.py

    diff --git a/src/jarabe/view/keyhandler.py b/src/jarabe/view/keyhandler.py
    index 4a50e70..5321905 100644
    a b from jarabe.model import shell 
    3333from jarabe.view.tabbinghandler import TabbingHandler
    3434from jarabe.model.shell import ShellModel
    3535from jarabe import config
     36from jarabe.journal.journalactivity import get_journal
    3637
    3738_BRIGHTNESS_STEP = 2
    3839_VOLUME_STEP = sound.VOLUME_STEP
    _actions_table = { 
    6768    '<alt><shift>s'  : 'say_text',
    6869}
    6970
    70 J_DBUS_SERVICE = 'org.laptop.Journal'
    71 J_DBUS_PATH = '/org/laptop/Journal'
    72 J_DBUS_INTERFACE = 'org.laptop.Journal'
    73 
    7471SPEECH_DBUS_SERVICE = 'org.laptop.Speech'
    7572SPEECH_DBUS_PATH = '/org/laptop/Speech'
    7673SPEECH_DBUS_INTERFACE = 'org.laptop.Speech'
    class KeyHandler(object): 
    248245            if e.errno != errno.EINTR:
    249246                raise
    250247
    251 
    252248    def handle_quit_emulator(self):
    253249        if os.environ.has_key('SUGAR_EMULATOR_PID'):
    254250            pid = int(os.environ['SUGAR_EMULATOR_PID'])
    255251            os.kill(pid, signal.SIGTERM)
    256252
    257     def focus_journal_search(self):
    258         bus = dbus.SessionBus()
    259         obj = bus.get_object(J_DBUS_SERVICE, J_DBUS_PATH)
    260         journal = dbus.Interface(obj, J_DBUS_INTERFACE)
    261         journal.FocusSearch()
    262 
    263253    def handle_open_search(self):
    264         self.focus_journal_search()
     254        get_journal().focus_search()
    265255
    266256    def _key_pressed_cb(self, grabber, keycode, state):
    267257        key = grabber.get_key(keycode, state)