~ubuntu-branches/ubuntu/trusty/eiciel/trusty-proposed

« back to all changes in this revision

Viewing changes to src/eiciel_nautilus_page.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2010-06-04 02:38:02 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100604023802-jp2v6c9uviiioc5z
* New upstream release.
* debian/patches/02-gio.patch
  - Removed, merged upstream.
* debian/patches/03-no-libgnomeui.patch
  - Removed, merged upstream.
* debian/patches/01-fix-gettext-translations.patch
  - Fix gettext translations by using dgettext and specifying the correct
    domainname.
* debian/patches/02-de-po.patch
  - Update and complete German translation.
* debian/rules
  - Remove de.gmo on clean and rebuild it on build.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
    Eiciel - GNOME editor of ACL file permissions.
3
 
    Copyright (C) 2004-2005 Roger Ferrer Ib��ez
 
3
    Copyright (C) 2004-2010 Roger Ferrer Ib��ez
4
4
 
5
5
    This program is free software; you can redistribute it and/or modify
6
6
    it under the terms of the GNU General Public License as published by
14
14
 
15
15
    You should have received a copy of the GNU General Public License
16
16
    along with this program; if not, write to the Free Software
17
 
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
17
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,  USA
18
18
*/
19
19
 
20
20
#include <config.hpp>
26
26
#include <gio/gio.h>
27
27
#include <gettext.h>
28
28
 
29
 
#include "eiciel_main_controler.hpp"
 
29
#include "eiciel_main_controller.hpp"
30
30
#include "eiciel_main_window.hpp"
31
31
#include "eiciel_nautilus_page.hpp"
32
32
 
33
33
#ifdef ENABLE_USER_XATTR
34
 
  #include "eiciel_xattr_controler.hpp"
 
34
  #include "eiciel_xattr_controller.hpp"
35
35
  #include "eiciel_xattr_window.hpp"
36
36
#endif
37
37
 
71
71
}
72
72
 
73
73
 
74
 
// Aquesta funci� retorna una GList amb les
75
 
// p�gines que proporcionarem a Nautilus
 
74
// Returns a GList wit the pages we're going to provide
 
75
// to Nautilus 
76
76
static GList* nautilus_get_property_pages (NautilusPropertyPageProvider *provider,
77
77
                    GList *files)
78
78
{
82
82
        NautilusPropertyPage *real_page;
83
83
        NautilusFileInfo* file;
84
84
 
85
 
        // Obtenim la informaci� dels fitxers i comprovem que nom�s s'ha
86
 
        // sel�leccionat un
 
85
    // Check that only one file has been selected
87
86
        if (!files || files->next != NULL) 
88
87
        {
89
88
                return NULL;
90
89
        }
91
90
        file = (NautilusFileInfo*)files->data;
92
91
 
93
 
        // Ara obtenim la URI de Nautilus
 
92
        // Get the uri from nautilus
94
93
        uri = nautilus_file_info_get_uri (file);
95
94
 
96
95
    if (uri == NULL)
98
97
        return NULL;
99
98
    }
100
99
 
101
 
        GFile *guri = g_file_new_for_uri (uri);
 
100
    GFile* guri = g_file_new_for_uri(uri);
102
101
 
103
 
        // i comprovem que �s local
104
 
        if (!g_file_has_uri_scheme (guri, "file"))
 
102
        // and check that it is local
 
103
        if (!g_file_has_uri_scheme(guri, "file"))
105
104
        {
106
 
                g_object_unref (guri);
 
105
                g_object_unref(guri);
107
106
                return NULL;
108
107
        }
109
108
 
110
 
        // Si �s local obtenim el path del fitxer
111
 
        local_file = g_file_get_path (guri);
112
 
        g_object_unref (guri);
 
109
        // if local, get the path of the file
 
110
        local_file = g_file_get_path(guri);
 
111
        g_object_unref(guri);
113
112
 
114
 
        // Alguns fitxers son locals pero no corresponen a un fitxer real
 
113
    // Well, some files are local but do not have a real file behind them
115
114
        if (local_file == NULL)
116
115
        {
117
116
                return NULL;
118
117
        }
119
118
 
120
 
        // Inicialitzem gtkmm
121
 
        // TODO - �?�? Preguntar a la gent de gtkmm
 
119
        // Initialize gtkmm
 
120
        // TODO: Is this correct ? (it works, though)
122
121
        Gtk::Main::init_gtkmm_internals();
123
122
 
124
 
        // Ara creem el controlador i la vista
125
 
        EicielMainControler* main_controler = new EicielMainControler();
126
 
        EicielWindow* eiciel_window = Gtk::manage(new EicielWindow(main_controler));
127
 
        // I obrim el fitxer
128
 
        main_controler->obreFitxer(std::string(local_file));
 
123
        // Now create the controller and the view
 
124
        EicielMainController* main_controller = new EicielMainController();
 
125
        EicielWindow* eiciel_window = Gtk::manage(new EicielWindow(main_controller));
 
126
        // and open the file
 
127
        main_controller->open_file(std::string(local_file));
129
128
 
130
 
        if (!main_controler->fitxerObert())
 
129
        if (!main_controller->opened_file())
131
130
        {
132
131
                delete eiciel_window;
133
132
        }
134
133
        else
135
134
        {
136
 
                eiciel_window->show_all();
137
 
 
138
135
                real_page = nautilus_property_page_new
139
136
                        ("EicielPropertyPage::property_page", 
140
137
                         gtk_label_new (_("Access Control List")),
142
139
                pages = g_list_append (pages, real_page);
143
140
        }
144
141
 
 
142
    // Likewise for user_xattr
145
143
#ifdef ENABLE_USER_XATTR
146
 
        EicielXAttrControler* xattr_controler = new EicielXAttrControler();
147
 
        EicielXAttrWindow* xattr_window = Gtk::manage(new EicielXAttrWindow(xattr_controler));
148
 
 
149
 
        xattr_controler->obrirFitxer(std::string(local_file));
150
 
 
151
 
        if (!xattr_controler->fitxerObert())
 
144
        EicielXAttrController* xattr_controller = new EicielXAttrController();
 
145
        EicielXAttrWindow* xattr_window = Gtk::manage(new EicielXAttrWindow(xattr_controller));
 
146
 
 
147
        xattr_controller->open_file(std::string(local_file));
 
148
 
 
149
        if (!xattr_controller->opened_file())
152
150
        {
153
151
                delete xattr_window;
154
152
        }
155
153
        else
156
154
        {
157
 
                xattr_window->show_all();
158
 
 
159
155
                real_page = nautilus_property_page_new
160
156
                        ("EicielPropertyPage::property_page", 
161
157
                         gtk_label_new (_("Extended user attributes")),
204
200
}
205
201
 
206
202
/*
207
 
 * Rutines que cridar� el loader de nautilus
 
203
 * Routines called by the Nautilus loader
208
204
 */
209
205
extern void nautilus_module_initialize (GTypeModule  *module)
210
206
{
211
 
        // g_print ("Inicialitzant la pagina de propietats de Eiciel\n");
 
207
        // g_print ("Initializing Eiciel property page\n");
212
208
        nautilus_eiciel_register_type(module);
213
 
        // g_print ("Inicialitzacio realitzada\n");
 
209
        // g_print ("Initialization done\n");
214
210
#ifdef ENABLE_NLS
215
211
        setlocale(LC_ALL, "");
216
212
    bindtextdomain("eiciel", DATADIR "/locale");
217
213
    
218
 
    // Volem les traduccions en UTF-8 (independentment del
219
 
    // format usat per a traduir)
 
214
    // We want translations in UTF-8, regardless
 
215
    // of the actual encoding used for translation
220
216
    bind_textdomain_codeset ("eiciel", "UTF-8");
221
217
#endif
222
218
}
224
220
/* Perform module-specific shutdown. */
225
221
extern void nautilus_module_shutdown   (void)
226
222
{
227
 
        // g_print ("Finalitzant la pagina de propietats de Eiciel\n");
 
223
        // g_print ("Ending Eiciel property page\n");
228
224
}
229
225
 
230
226
/* List all the extension types.  */