# Path: meld/paths.py
# def locale_dir(*args): # i18n files
# def help_dir(*args): # help
# def share_dir(*args):
# def ui_dir(*args):
# def icon_dir(*args):


from meld import paths
from . import gnomeglade
### but WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
### GNU General Public License for more details.

### You should have received a copy of the GNU General Public License
### along with this program; if not, write to the Free Software
### Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
### USA.




class ListWidget(gnomeglade.Component):

    def __init__(self, ui_file, widget, store, treeview, new_row_data=None):
        gnomeglade.Component.__init__(self, paths.ui_dir(ui_file),
                                      widget, store)
        self.new_row_data = new_row_data
        self.list = getattr(self, treeview)
        self.model = self.list.get_model()
        selection = self.list.get_selection()
        selection.connect("changed", self._update_sensitivity)

    def _update_sensitivity(self, *args):
        (model, it, path) = self._get_selected()
        if not it:
            self.remove.set_sensitive(False)
            self.move_up.set_sensitive(False)
            self.move_down.set_sensitive(False)
        else:

# Path: meld/paths.py
# def locale_dir(*args): # i18n files
# def help_dir(*args): # help
# def share_dir(*args):
# def ui_dir(*args):
# def icon_dir(*args):


# Path: meld/ui/listwidget.py
from meld import paths
from . import gnomeglade

### but WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
### GNU General Public License for more details.

### You should have received a copy of the GNU General Public License
### along with this program; if not, write to the Free Software
### Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
### USA.




class ListWidget(gnomeglade.Component):

    def __init__(self, ui_file, widget, store, treeview, new_row_data=None):
        gnomeglade.Component.__init__(self, paths.ui_dir(ui_file),
                                      widget, store)
        self.new_row_data = new_row_data
        self.list = getattr(self, treeview)
        self.model = self.list.get_model()
        selection = self.list.get_selection()
        selection.connect("changed", self._update_sensitivity)

    def _update_sensitivity(self, *args):
        (model, it, path) = self._get_selected()
        if not it:
            self.remove.set_sensitive(False)
            self.move_up.set_sensitive(False)
            self.move_down.set_sensitive(False)
        else:

            self.remove.set_sensitive(True)