Ticket #10351: 0001-Feedback-when-deleting-files-on-a-USB-Stick-10351.patch

File 0001-Feedback-when-deleting-files-on-a-USB-Stick-10351.patch, 4.1 KB (added by erikos, 4 years ago)

The patch does inform the view about the change

  • src/jarabe/journal/listview.py

    From 83e912b9b7e2e24fcb8b627d0c13db5010d4e23f Mon Sep 17 00:00:00 2001
    From: Simon Schampijer <simon@schampijer.de>
    Date: Fri, 3 Sep 2010 15:27:21 +0200
    Subject: [PATCH] Feedback when deleting files on a USB-Stick #10351
    
    ---
     src/jarabe/journal/listview.py |   39 ++++++++++++---------------------------
     src/jarabe/journal/model.py    |    4 +++-
     2 files changed, 15 insertions(+), 28 deletions(-)
    
    diff --git a/src/jarabe/journal/listview.py b/src/jarabe/journal/listview.py
    index 6556b08..e1ca620 100644
    a b  
    1 # Copyright (C) 2007, One Laptop Per Child 
     1# Copyright (C) 2007, 2010 One Laptop Per Child 
    22# 
    33# This program is free software; you can redistribute it and/or modify 
    44# it under the terms of the GNU General Public License as published by 
     
    2323import hippo 
    2424import gobject 
    2525import gtk 
    26 import dbus 
    2726 
    2827from sugar.graphics import style 
    2928from sugar.graphics.icon import CanvasIcon, Icon 
     
    3130from jarabe.journal.collapsedentry import CollapsedEntry 
    3231from jarabe.journal import model 
    3332 
    34 DS_DBUS_SERVICE = 'org.laptop.sugar.DataStore' 
    35 DS_DBUS_INTERFACE = 'org.laptop.sugar.DataStore' 
    36 DS_DBUS_PATH = '/org/laptop/sugar/DataStore' 
    37  
    3833UPDATE_INTERVAL = 300 
    3934 
    4035EMPTY_JOURNAL = _("Your Journal is empty") 
     
    109104        self._refresh_idle_handler = None 
    110105        self._update_dates_timer = None 
    111106 
    112         bus = dbus.SessionBus() 
    113         datastore = dbus.Interface( 
    114             bus.get_object(DS_DBUS_SERVICE, DS_DBUS_PATH), DS_DBUS_INTERFACE) 
    115         self._datastore_created_handler = \ 
    116                 datastore.connect_to_signal('Created', 
    117                                              self.__datastore_created_cb) 
    118         self._datastore_updated_handler = \ 
    119                 datastore.connect_to_signal('Updated', 
    120                                             self.__datastore_updated_cb) 
     107        model.created.connect(self.__model_created_cb) 
     108        model.updated.connect(self.__model_updated_cb) 
     109        model.deleted.connect(self.__model_deleted_cb) 
     110 
     111    def __model_created_cb(self, sender, **kwargs): 
     112        self._set_dirty() 
     113 
     114    def __model_updated_cb(self, sender, **kwargs): 
     115        self._set_dirty() 
    121116 
    122         self._datastore_deleted_handler = \ 
    123                 datastore.connect_to_signal('Deleted', 
    124                                             self.__datastore_deleted_cb) 
     117    def __model_deleted_cb(self, sender, **kwargs): 
     118        self._set_dirty() 
    125119 
    126120    def __destroy_cb(self, widget): 
    127121        self._datastore_created_handler.remove() 
     
    463457            if entry.get_visible(): 
    464458                entry.update_date() 
    465459 
    466     def __datastore_created_cb(self, uid): 
    467         self._set_dirty() 
    468          
    469     def __datastore_updated_cb(self, uid): 
    470         self._set_dirty() 
    471          
    472     def __datastore_deleted_cb(self, uid): 
    473         self._set_dirty() 
    474  
    475460    def _set_dirty(self): 
    476461        if self._fully_obscured: 
    477462            self._dirty = True 
  • src/jarabe/journal/model.py

    diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
    index 50e8dc1..f4186f0 100644
    a b  
    1 # Copyright (C) 2007-2008, One Laptop Per Child 
     1# Copyright (C) 2007, 2008, 2010 One Laptop Per Child 
    22# 
    33# This program is free software; you can redistribute it and/or modify 
    44# it under the terms of the GNU General Public License as published by 
     
    460460    """ 
    461461    if os.path.exists(object_id): 
    462462        os.unlink(object_id) 
     463        deleted.send(None, object_id=object_id) 
    463464    else: 
    464465        _get_datastore().delete(object_id) 
    465466 
     
    504505        destination_path = os.path.join(metadata['mountpoint'], file_name) 
    505506        shutil.copy(file_path, destination_path) 
    506507        object_id = destination_path 
     508        created.send(None, object_id=object_id) 
    507509 
    508510    return object_id 
    509511