2
Eiciel - GNOME editor of ACL file permissions.
3
Copyright (C) 2004-2010 Roger Ferrer Ibáñez
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
20
#include "eiciel_xattr_controller.hpp"
22
EicielXAttrController::EicielXAttrController()
23
: _xattr_manager(NULL), _window(NULL), _opened_file(false)
27
void EicielXAttrController::open_file(const Glib::ustring& filename) throw (XAttrManagerException)
29
if (_xattr_manager != NULL)
31
delete _xattr_manager;
36
_xattr_manager = new XAttrManager(filename);
39
_window->set_active(true);
43
_window->fill_attributes(_xattr_manager->get_attributes_list());
45
catch (XAttrManagerException e)
47
delete _xattr_manager;
48
_xattr_manager = NULL;
50
_window->set_active(false);
54
void EicielXAttrController::remove_attribute(const Glib::ustring& nomAtrib) throw (XAttrManagerException)
56
_xattr_manager->remove_attribute(nomAtrib);
59
void EicielXAttrController::add_attribute(const Glib::ustring& nomAtrib, const Glib::ustring& valorAtrib) throw (XAttrManagerException)
61
_xattr_manager->add_attribute(nomAtrib, valorAtrib);
64
void EicielXAttrController::update_attribute_value(const Glib::ustring& nomAtrib, const Glib::ustring& valorNouAtrib) throw (XAttrManagerException)
66
_xattr_manager->add_attribute(nomAtrib, valorNouAtrib);
69
void EicielXAttrController::update_attribute_name(const Glib::ustring& nomAnticAtribut, const Glib::ustring& nomNouAtribut) throw (XAttrManagerException)
71
_xattr_manager->change_attribute_name(nomAnticAtribut, nomNouAtribut);
74
void EicielXAttrController::check_editable()
77
* Comprovem que es el propietari o root
79
uid_t real_user = getuid();
80
if ((real_user != 0) && (real_user != _xattr_manager->get_owner_uid()))
82
_window->set_readonly(true);
86
_window->set_readonly(false);