[gevice] porting to pygobject



commit 6cf670f5a44e5319e46f5105c01d2ba5e66f5dab
Author: Alejandro Valdes Jimenez <avaldes gnome org>
Date:   Mon Oct 3 18:18:18 2011 -0300

    porting to pygobject

 ChangeLog             |   13 +
 INSTALL-DBASE         |   32 +++-
 configure.ac          |    2 +-
 gevice.sql            |  597 ++++++++++++++++++++++++++++++++++++++++++++++---
 src/gevice.py         |  224 ++++++++++---------
 src/gevicedatabase.py |   55 ++---
 src/gevicedevice.py   |   65 +++----
 src/gevicefind.py     |   68 ++++---
 src/gevicemodel.py    |   71 +++----
 src/geviceprefer.py   |   65 +++---
 src/gevicevte.py      |   26 +--
 11 files changed, 881 insertions(+), 337 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b372a60..e6371c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2011-10-03  Alejandro Valdes Jimenez  <avaldes gnome org>
+	* New Tag GEVICE_1_0_0
+	* INSTALL-DBASE: update instructions.
+	* configure.ac:
+	* gevice.sql: update file.
+	* src/gevice.py:
+	* src/gevicedatabase.py:
+	* src/gevicedevice.py:
+	* src/gevicefind.py:
+	* src/gevicemodel.py:
+	* src/geviceprefer.py:
+	* src/gevicevte.py:
+
 2011-08-25  Alejandro Valdes Jimenez  <avaldes gnome org>
 	* data/ui/gevice.xml: remove old file.
 	* Fixed bug #657326
diff --git a/INSTALL-DBASE b/INSTALL-DBASE
index 85bacdc..b9c77da 100644
--- a/INSTALL-DBASE
+++ b/INSTALL-DBASE
@@ -1,7 +1,33 @@
+# create user (for example: gevice)
+createuser -U postgres -W --no-createdb --no-createrole --no-superuser  gevice
+
+# set user  password (for example)
+psql -U postgres -W
+
+postgres=# ALTER USER gevice PASSWORD 'gevice';
+
 # create database (for example: db_gevice)
-createdb -U postgres db_gevice
+createdb -U postgres db_gevice -O gevice -E UTF8
 
 # create tables from file gevice.sql
-psql -U postgres -W -f gevice.sql db_gevice
+psql -U gevice -W -f gevice.sql db_gevice
+
+# connect to database y show tables
+psql -U gevice -W  db_gevice
 
-# set appropiate grant.
+db_gevice=> \d
+               List of relations
+ Schema |         Name         | Type  | Owner  
+--------+----------------------+-------+--------
+ public | campus               | table | gevice
+ public | conecta              | table | gevice
+ public | dispositivo          | table | gevice
+ public | edificio             | table | gevice
+ public | marca                | table | gevice
+ public | modelo               | table | gevice
+ public | nivel                | table | gevice
+ public | rack                 | table | gevice
+ public | tipo_disp            | table | gevice
+ public | tipo_enlace          | table | gevice
+ public | todoslosdispositivos | view  | gevice
+(11 rows)
diff --git a/configure.ac b/configure.ac
index e4362b9..c43295a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([gevice], [0.6.1],[http://bugzilla.gnome.org/enter_bug.cgi?product=gevice],[gevice])
+AC_INIT([gevice], [1.0.0],[http://bugzilla.gnome.org/enter_bug.cgi?product=gevice],[gevice])
 AC_CONFIG_SRCDIR(src/gevice.py)
 
 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
diff --git a/gevice.sql b/gevice.sql
index 4ec1936..cdf1b57 100644
--- a/gevice.sql
+++ b/gevice.sql
@@ -2,25 +2,90 @@
 -- PostgreSQL database dump
 --
 
+SET statement_timeout = 0;
+SET client_encoding = 'UTF8';
+SET standard_conforming_strings = off;
+SET check_function_bodies = false;
+SET client_min_messages = warning;
+SET escape_string_warning = off;
+
+SET search_path = public, pg_catalog;
+
+SET default_tablespace = '';
+
+SET default_with_oids = false;
+
+--
+-- Name: campus; Type: TABLE; Schema: public; Owner: gevice; Tablespace: 
+--
+
+CREATE TABLE campus (
+    id_campus numeric(2,0) NOT NULL,
+    nom_campus character varying(100) NOT NULL
+);
+
+
+ALTER TABLE public.campus OWNER TO gevice;
+
+--
+-- Name: conecta; Type: TABLE; Schema: public; Owner: gevice; Tablespace: 
+--
+
 CREATE TABLE conecta (
     serialp character varying(25) NOT NULL,
     serialh character varying(25) NOT NULL,
     id_tipo_enlace numeric(2,0) NOT NULL
 );
 
+
+ALTER TABLE public.conecta OWNER TO gevice;
+
+--
+-- Name: dispositivo; Type: TABLE; Schema: public; Owner: gevice; Tablespace: 
+--
+
 CREATE TABLE dispositivo (
     serial character varying(25) NOT NULL,
     id_modelo numeric(3,0),
     nom_disp character varying(50) NOT NULL,
     obs_disp character varying(250),
-    ip_disp character varying(15)
+    ip_disp character varying(15),
+    id_rack numeric(3,0) DEFAULT 0 NOT NULL,
+    ptas_disp character varying(2) DEFAULT 0
+);
+
+
+ALTER TABLE public.dispositivo OWNER TO gevice;
+
+--
+-- Name: edificio; Type: TABLE; Schema: public; Owner: gevice; Tablespace: 
+--
+
+CREATE TABLE edificio (
+    id_edif numeric(2,0) NOT NULL,
+    id_campus numeric(2,0) NOT NULL,
+    nom_edif character varying(100) NOT NULL
 );
 
+
+ALTER TABLE public.edificio OWNER TO gevice;
+
+--
+-- Name: marca; Type: TABLE; Schema: public; Owner: gevice; Tablespace: 
+--
+
 CREATE TABLE marca (
     id_marca numeric(2,0) NOT NULL,
     nom_marca character varying(50) NOT NULL
 );
 
+
+ALTER TABLE public.marca OWNER TO gevice;
+
+--
+-- Name: modelo; Type: TABLE; Schema: public; Owner: gevice; Tablespace: 
+--
+
 CREATE TABLE modelo (
     id_modelo numeric(3,0) NOT NULL,
     id_tipo_disp numeric(2,0),
@@ -28,99 +93,559 @@ CREATE TABLE modelo (
     nom_modelo character varying(50) NOT NULL
 );
 
+
+ALTER TABLE public.modelo OWNER TO gevice;
+
+--
+-- Name: nivel; Type: TABLE; Schema: public; Owner: gevice; Tablespace: 
+--
+
+CREATE TABLE nivel (
+    id_nivel numeric(2,0) NOT NULL,
+    nom_nivel character varying(100) NOT NULL
+);
+
+
+ALTER TABLE public.nivel OWNER TO gevice;
+
+--
+-- Name: rack; Type: TABLE; Schema: public; Owner: gevice; Tablespace: 
+--
+
+CREATE TABLE rack (
+    id_rack numeric(3,0) NOT NULL,
+    id_nivel numeric(2,0) NOT NULL,
+    id_edif numeric(2,0) NOT NULL,
+    detalle character varying(200)
+);
+
+
+ALTER TABLE public.rack OWNER TO gevice;
+
+--
+-- Name: tipo_disp; Type: TABLE; Schema: public; Owner: gevice; Tablespace: 
+--
+
 CREATE TABLE tipo_disp (
     id_tipo_disp numeric(2,0) NOT NULL,
     nom_tipo_disp character varying(50) NOT NULL
 );
 
+
+ALTER TABLE public.tipo_disp OWNER TO gevice;
+
+--
+-- Name: tipo_enlace; Type: TABLE; Schema: public; Owner: gevice; Tablespace: 
+--
+
 CREATE TABLE tipo_enlace (
     id_tipo_enlace numeric(2,0) NOT NULL,
     nom_tipo_enlace character varying(100) NOT NULL
 );
 
+
+ALTER TABLE public.tipo_enlace OWNER TO gevice;
+
+--
+-- Name: todoslosdispositivos; Type: VIEW; Schema: public; Owner: gevice
+--
+
 CREATE VIEW todoslosdispositivos AS
-    SELECT tipo_disp.id_tipo_disp, tipo_disp.nom_tipo_disp, marca.id_marca, marca.nom_marca, modelo.id_modelo, modelo.nom_modelo, dispositivo.serial, dispositivo.nom_disp, dispositivo.ip_disp, dispositivo.obs_disp FROM (((dispositivo JOIN modelo ON ((dispositivo.id_modelo = modelo.id_modelo))) JOIN marca ON ((modelo.id_marca = marca.id_marca))) JOIN tipo_disp ON ((modelo.id_tipo_disp = tipo_disp.id_tipo_disp))) ORDER BY dispositivo.serial;
-
-
-INSERT INTO marca VALUES (0, 'None');
-INSERT INTO marca VALUES (1, 'Cisco System');
-
-INSERT INTO modelo VALUES (0, 0, 0, 'None');
-INSERT INTO modelo VALUES (1, 1, 1, 'WS-C2950T-24');
-INSERT INTO modelo VALUES (2, 3, 1, 'AIR-AP1120B-A-K9');
-INSERT INTO modelo VALUES (3, 5, 1, 'ASA5540');
-INSERT INTO modelo VALUES (4, 7, 1, 'VPN-3005');
-INSERT INTO modelo VALUES (5, 10, 1, 'WS-C6509');
-
-INSERT INTO tipo_disp VALUES (0, 'None');
-INSERT INTO tipo_disp VALUES (1, 'Switch');
-INSERT INTO tipo_disp VALUES (2, 'Router');
-INSERT INTO tipo_disp VALUES (3, 'AP Indoor');
-INSERT INTO tipo_disp VALUES (4, 'AP Outdoor');
-INSERT INTO tipo_disp VALUES (5, 'Firewall');
-INSERT INTO tipo_disp VALUES (6, 'Gateway');
-INSERT INTO tipo_disp VALUES (7, 'VPN');
-INSERT INTO tipo_disp VALUES (8, 'Server');
-INSERT INTO tipo_disp VALUES (9, 'Hub');
-INSERT INTO tipo_disp VALUES (10, 'Router-Switch');
-
-INSERT INTO tipo_enlace VALUES (0, 'No link');
-INSERT INTO tipo_enlace VALUES (1, '10mbps UTP');
-INSERT INTO tipo_enlace VALUES (2, '100mbps UTP');
-INSERT INTO tipo_enlace VALUES (3, '1000mbps UTP');
-INSERT INTO tipo_enlace VALUES (4, '10mbps Fibre Single Mode');
-INSERT INTO tipo_enlace VALUES (5, '100mbps Fibre Single Mode');
-INSERT INTO tipo_enlace VALUES (6, '1000mbps Fibre Single Mode');
-INSERT INTO tipo_enlace VALUES (7, '10mbps Fibre Multi Mode');
-INSERT INTO tipo_enlace VALUES (8, '100mbps Fibre Multi Mode');
-INSERT INTO tipo_enlace VALUES (9, '1000mbps Fibre Multi Mode');
+    SELECT tipo_disp.id_tipo_disp, tipo_disp.nom_tipo_disp, marca.id_marca, marca.nom_marca, modelo.id_modelo, modelo.nom_modelo, dispositivo.serial, dispositivo.nom_disp, dispositivo.ip_disp, dispositivo.obs_disp, (((((((('['::text || (campus.nom_campus)::text) || ']['::text) || (edificio.nom_edif)::text) || ']['::text) || (nivel.nom_nivel)::text) || ']['::text) || (rack.detalle)::text) || ']'::text) AS ubicacion, rack.id_rack, edificio.id_edif, nivel.id_nivel, campus.id_campus, dispositivo.ptas_disp FROM (((((((dispositivo JOIN modelo ON ((dispositivo.id_modelo = modelo.id_modelo))) JOIN marca ON ((modelo.id_marca = marca.id_marca))) JOIN tipo_disp ON ((modelo.id_tipo_disp = tipo_disp.id_tipo_disp))) JOIN rack ON ((dispositivo.id_rack = rack.id_rack))) JOIN nivel ON ((rack.id_nivel = nivel.id_nivel))) JOIN edificio ON ((rack.id_edif = edificio.id_edif))) JOIN campus ON ((edificio.id_campus = campus.id_campus))) ORDER BY dispositivo.serial;
+
+
+ALTER TABLE public.todoslosdispositivos OWNER TO gevice;
+
+--
+-- Data for Name: campus; Type: TABLE DATA; Schema: public; Owner: gevice
+--
+
+COPY campus (id_campus, nom_campus) FROM stdin;
+0	None
+\.
+
+
+--
+-- Data for Name: conecta; Type: TABLE DATA; Schema: public; Owner: gevice
+--
+
+COPY conecta (serialp, serialh, id_tipo_enlace) FROM stdin;
+\.
+
+
+--
+-- Data for Name: dispositivo; Type: TABLE DATA; Schema: public; Owner: gevice
+--
+
+COPY dispositivo (serial, id_modelo, nom_disp, obs_disp, ip_disp, id_rack, ptas_disp) FROM stdin;
+\.
+
+
+--
+-- Data for Name: edificio; Type: TABLE DATA; Schema: public; Owner: gevice
+--
+
+COPY edificio (id_edif, id_campus, nom_edif) FROM stdin;
+0	0	None
+\.
+
+
+--
+-- Data for Name: marca; Type: TABLE DATA; Schema: public; Owner: gevice
+--
+
+COPY marca (id_marca, nom_marca) FROM stdin;
+0	None
+\.
 
 
+--
+-- Data for Name: modelo; Type: TABLE DATA; Schema: public; Owner: gevice
+--
+
+COPY modelo (id_modelo, id_tipo_disp, id_marca, nom_modelo) FROM stdin;
+0	0	0	None
+\.
+
+
+--
+-- Data for Name: nivel; Type: TABLE DATA; Schema: public; Owner: gevice
+--
+
+COPY nivel (id_nivel, nom_nivel) FROM stdin;
+0	None
+\.
+
+
+--
+-- Data for Name: rack; Type: TABLE DATA; Schema: public; Owner: gevice
+--
+
+COPY rack (id_rack, id_nivel, id_edif, detalle) FROM stdin;
+0	0	0	None
+\.
+
+
+--
+-- Data for Name: tipo_disp; Type: TABLE DATA; Schema: public; Owner: gevice
+--
+
+COPY tipo_disp (id_tipo_disp, nom_tipo_disp) FROM stdin;
+0	None
+\.
+
+
+--
+-- Data for Name: tipo_enlace; Type: TABLE DATA; Schema: public; Owner: gevice
+--
+
+COPY tipo_enlace (id_tipo_enlace, nom_tipo_enlace) FROM stdin;
+0	None
+\.
+
+
+--
+-- Name: pk_campus; Type: CONSTRAINT; Schema: public; Owner: gevice; Tablespace: 
+--
+
+ALTER TABLE ONLY campus
+    ADD CONSTRAINT pk_campus PRIMARY KEY (id_campus);
+
+
+--
+-- Name: pk_conecta; Type: CONSTRAINT; Schema: public; Owner: gevice; Tablespace: 
+--
+
 ALTER TABLE ONLY conecta
     ADD CONSTRAINT pk_conecta PRIMARY KEY (serialp, serialh, id_tipo_enlace);
 
+
+--
+-- Name: pk_dispositivo; Type: CONSTRAINT; Schema: public; Owner: gevice; Tablespace: 
+--
+
 ALTER TABLE ONLY dispositivo
     ADD CONSTRAINT pk_dispositivo PRIMARY KEY (serial);
 
+
+--
+-- Name: pk_edificio; Type: CONSTRAINT; Schema: public; Owner: gevice; Tablespace: 
+--
+
+ALTER TABLE ONLY edificio
+    ADD CONSTRAINT pk_edificio PRIMARY KEY (id_edif);
+
+
+--
+-- Name: pk_marca; Type: CONSTRAINT; Schema: public; Owner: gevice; Tablespace: 
+--
+
 ALTER TABLE ONLY marca
     ADD CONSTRAINT pk_marca PRIMARY KEY (id_marca);
 
+
+--
+-- Name: pk_modelo; Type: CONSTRAINT; Schema: public; Owner: gevice; Tablespace: 
+--
+
 ALTER TABLE ONLY modelo
     ADD CONSTRAINT pk_modelo PRIMARY KEY (id_modelo);
 
+
+--
+-- Name: pk_nivel; Type: CONSTRAINT; Schema: public; Owner: gevice; Tablespace: 
+--
+
+ALTER TABLE ONLY nivel
+    ADD CONSTRAINT pk_nivel PRIMARY KEY (id_nivel);
+
+
+--
+-- Name: pk_rack; Type: CONSTRAINT; Schema: public; Owner: gevice; Tablespace: 
+--
+
+ALTER TABLE ONLY rack
+    ADD CONSTRAINT pk_rack PRIMARY KEY (id_rack);
+
+
+--
+-- Name: pk_tipo_disp; Type: CONSTRAINT; Schema: public; Owner: gevice; Tablespace: 
+--
+
 ALTER TABLE ONLY tipo_disp
     ADD CONSTRAINT pk_tipo_disp PRIMARY KEY (id_tipo_disp);
 
+
+--
+-- Name: pk_tipo_enlace; Type: CONSTRAINT; Schema: public; Owner: gevice; Tablespace: 
+--
+
 ALTER TABLE ONLY tipo_enlace
     ADD CONSTRAINT pk_tipo_enlace PRIMARY KEY (id_tipo_enlace);
 
+
+--
+-- Name: association_1_fk; Type: INDEX; Schema: public; Owner: gevice; Tablespace: 
+--
+
 CREATE INDEX association_1_fk ON conecta USING btree (serialp);
+
+
+--
+-- Name: association_1_pk; Type: INDEX; Schema: public; Owner: gevice; Tablespace: 
+--
+
 CREATE UNIQUE INDEX association_1_pk ON conecta USING btree (serialp, serialh, id_tipo_enlace);
+
+
+--
+-- Name: association_2_fk; Type: INDEX; Schema: public; Owner: gevice; Tablespace: 
+--
+
 CREATE INDEX association_2_fk ON conecta USING btree (serialh);
+
+
+--
+-- Name: campus_pk; Type: INDEX; Schema: public; Owner: gevice; Tablespace: 
+--
+
+CREATE UNIQUE INDEX campus_pk ON campus USING btree (id_campus);
+
+
+--
+-- Name: conecta3_fk; Type: INDEX; Schema: public; Owner: gevice; Tablespace: 
+--
+
 CREATE INDEX conecta3_fk ON conecta USING btree (id_tipo_enlace);
+
+
+--
+-- Name: dispositivo3_fk; Type: INDEX; Schema: public; Owner: gevice; Tablespace: 
+--
+
 CREATE INDEX dispositivo3_fk ON dispositivo USING btree (id_modelo);
+
+
+--
+-- Name: dispositivo_pk; Type: INDEX; Schema: public; Owner: gevice; Tablespace: 
+--
+
 CREATE UNIQUE INDEX dispositivo_pk ON dispositivo USING btree (serial);
+
+
+--
+-- Name: edificio_pk; Type: INDEX; Schema: public; Owner: gevice; Tablespace: 
+--
+
+CREATE UNIQUE INDEX edificio_pk ON edificio USING btree (id_edif);
+
+
+--
+-- Name: marca_pk; Type: INDEX; Schema: public; Owner: gevice; Tablespace: 
+--
+
 CREATE UNIQUE INDEX marca_pk ON marca USING btree (id_marca);
+
+
+--
+-- Name: modelo_marca_fk; Type: INDEX; Schema: public; Owner: gevice; Tablespace: 
+--
+
 CREATE INDEX modelo_marca_fk ON modelo USING btree (id_marca);
+
+
+--
+-- Name: modelo_pk; Type: INDEX; Schema: public; Owner: gevice; Tablespace: 
+--
+
 CREATE UNIQUE INDEX modelo_pk ON modelo USING btree (id_modelo);
+
+
+--
+-- Name: nivel_pk; Type: INDEX; Schema: public; Owner: gevice; Tablespace: 
+--
+
+CREATE UNIQUE INDEX nivel_pk ON nivel USING btree (id_nivel);
+
+
+--
+-- Name: rack_pk; Type: INDEX; Schema: public; Owner: gevice; Tablespace: 
+--
+
+CREATE UNIQUE INDEX rack_pk ON rack USING btree (id_rack);
+
+
+--
+-- Name: relationship_10_fk; Type: INDEX; Schema: public; Owner: gevice; Tablespace: 
+--
+
+CREATE INDEX relationship_10_fk ON dispositivo USING btree (id_rack);
+
+
+--
+-- Name: relationship_12_fk; Type: INDEX; Schema: public; Owner: gevice; Tablespace: 
+--
+
+CREATE INDEX relationship_12_fk ON rack USING btree (id_nivel);
+
+
+--
+-- Name: relationship_7_fk; Type: INDEX; Schema: public; Owner: gevice; Tablespace: 
+--
+
+CREATE INDEX relationship_7_fk ON edificio USING btree (id_campus);
+
+
+--
+-- Name: relationship_9_fk; Type: INDEX; Schema: public; Owner: gevice; Tablespace: 
+--
+
+CREATE INDEX relationship_9_fk ON rack USING btree (id_edif);
+
+
+--
+-- Name: tipo_disp_modelo_fk; Type: INDEX; Schema: public; Owner: gevice; Tablespace: 
+--
+
 CREATE INDEX tipo_disp_modelo_fk ON modelo USING btree (id_tipo_disp);
+
+
+--
+-- Name: tipo_disp_pk; Type: INDEX; Schema: public; Owner: gevice; Tablespace: 
+--
+
 CREATE UNIQUE INDEX tipo_disp_pk ON tipo_disp USING btree (id_tipo_disp);
+
+
+--
+-- Name: tipo_enlace_pk; Type: INDEX; Schema: public; Owner: gevice; Tablespace: 
+--
+
 CREATE UNIQUE INDEX tipo_enlace_pk ON tipo_enlace USING btree (id_tipo_enlace);
 
+
+--
+-- Name: fk_conecta_conecta2_disposit; Type: FK CONSTRAINT; Schema: public; Owner: gevice
+--
+
 ALTER TABLE ONLY conecta
     ADD CONSTRAINT fk_conecta_conecta2_disposit FOREIGN KEY (serialh) REFERENCES dispositivo(serial) ON UPDATE RESTRICT ON DELETE RESTRICT;
 
+
+--
+-- Name: fk_conecta_conecta3_tipo_enl; Type: FK CONSTRAINT; Schema: public; Owner: gevice
+--
+
 ALTER TABLE ONLY conecta
     ADD CONSTRAINT fk_conecta_conecta3_tipo_enl FOREIGN KEY (id_tipo_enlace) REFERENCES tipo_enlace(id_tipo_enlace) ON UPDATE RESTRICT ON DELETE RESTRICT;
 
+
+--
+-- Name: fk_conecta_conecta_disposit; Type: FK CONSTRAINT; Schema: public; Owner: gevice
+--
+
 ALTER TABLE ONLY conecta
     ADD CONSTRAINT fk_conecta_conecta_disposit FOREIGN KEY (serialp) REFERENCES dispositivo(serial) ON UPDATE RESTRICT ON DELETE RESTRICT;
 
+
+--
+-- Name: fk_disposit_modelo_di_modelo; Type: FK CONSTRAINT; Schema: public; Owner: gevice
+--
+
 ALTER TABLE ONLY dispositivo
     ADD CONSTRAINT fk_disposit_modelo_di_modelo FOREIGN KEY (id_modelo) REFERENCES modelo(id_modelo) ON UPDATE RESTRICT ON DELETE RESTRICT;
 
+
+--
+-- Name: fk_edificio_relations_campus; Type: FK CONSTRAINT; Schema: public; Owner: gevice
+--
+
+ALTER TABLE ONLY edificio
+    ADD CONSTRAINT fk_edificio_relations_campus FOREIGN KEY (id_campus) REFERENCES campus(id_campus) ON UPDATE RESTRICT ON DELETE RESTRICT;
+
+
+--
+-- Name: fk_modelo_modelo_ma_marca; Type: FK CONSTRAINT; Schema: public; Owner: gevice
+--
+
 ALTER TABLE ONLY modelo
     ADD CONSTRAINT fk_modelo_modelo_ma_marca FOREIGN KEY (id_marca) REFERENCES marca(id_marca) ON UPDATE RESTRICT ON DELETE RESTRICT;
 
+
+--
+-- Name: fk_modelo_tipo_disp_tipo_dis; Type: FK CONSTRAINT; Schema: public; Owner: gevice
+--
+
 ALTER TABLE ONLY modelo
     ADD CONSTRAINT fk_modelo_tipo_disp_tipo_dis FOREIGN KEY (id_tipo_disp) REFERENCES tipo_disp(id_tipo_disp) ON UPDATE RESTRICT ON DELETE RESTRICT;
+
+
+--
+-- Name: fk_rack_relations_edificio; Type: FK CONSTRAINT; Schema: public; Owner: gevice
+--
+
+ALTER TABLE ONLY rack
+    ADD CONSTRAINT fk_rack_relations_edificio FOREIGN KEY (id_edif) REFERENCES edificio(id_edif) ON UPDATE RESTRICT ON DELETE RESTRICT;
+
+
+--
+-- Name: fk_rack_relations_nivel; Type: FK CONSTRAINT; Schema: public; Owner: gevice
+--
+
+ALTER TABLE ONLY rack
+    ADD CONSTRAINT fk_rack_relations_nivel FOREIGN KEY (id_nivel) REFERENCES nivel(id_nivel) ON UPDATE RESTRICT ON DELETE RESTRICT;
+
+
+--
+-- Name: public; Type: ACL; Schema: -; Owner: postgres
+--
+
+REVOKE ALL ON SCHEMA public FROM PUBLIC;
+REVOKE ALL ON SCHEMA public FROM postgres;
+GRANT ALL ON SCHEMA public TO postgres;
+GRANT ALL ON SCHEMA public TO PUBLIC;
+
+
+--
+-- Name: campus; Type: ACL; Schema: public; Owner: gevice
+--
+
+REVOKE ALL ON TABLE campus FROM PUBLIC;
+REVOKE ALL ON TABLE campus FROM gevice;
+GRANT ALL ON TABLE campus TO gevice;
+
+
+--
+-- Name: conecta; Type: ACL; Schema: public; Owner: gevice
+--
+
+REVOKE ALL ON TABLE conecta FROM PUBLIC;
+REVOKE ALL ON TABLE conecta FROM gevice;
+GRANT ALL ON TABLE conecta TO gevice;
+
+
+--
+-- Name: dispositivo; Type: ACL; Schema: public; Owner: gevice
+--
+
+REVOKE ALL ON TABLE dispositivo FROM PUBLIC;
+REVOKE ALL ON TABLE dispositivo FROM gevice;
+GRANT ALL ON TABLE dispositivo TO gevice;
+
+
+--
+-- Name: edificio; Type: ACL; Schema: public; Owner: gevice
+--
+
+REVOKE ALL ON TABLE edificio FROM PUBLIC;
+REVOKE ALL ON TABLE edificio FROM gevice;
+GRANT ALL ON TABLE edificio TO gevice;
+
+
+--
+-- Name: marca; Type: ACL; Schema: public; Owner: gevice
+--
+
+REVOKE ALL ON TABLE marca FROM PUBLIC;
+REVOKE ALL ON TABLE marca FROM gevice;
+GRANT ALL ON TABLE marca TO gevice;
+
+
+--
+-- Name: modelo; Type: ACL; Schema: public; Owner: gevice
+--
+
+REVOKE ALL ON TABLE modelo FROM PUBLIC;
+REVOKE ALL ON TABLE modelo FROM gevice;
+GRANT ALL ON TABLE modelo TO gevice;
+
+
+--
+-- Name: nivel; Type: ACL; Schema: public; Owner: gevice
+--
+
+REVOKE ALL ON TABLE nivel FROM PUBLIC;
+REVOKE ALL ON TABLE nivel FROM gevice;
+GRANT ALL ON TABLE nivel TO gevice;
+
+
+--
+-- Name: rack; Type: ACL; Schema: public; Owner: gevice
+--
+
+REVOKE ALL ON TABLE rack FROM PUBLIC;
+REVOKE ALL ON TABLE rack FROM gevice;
+GRANT ALL ON TABLE rack TO gevice;
+
+
+--
+-- Name: tipo_disp; Type: ACL; Schema: public; Owner: gevice
+--
+
+REVOKE ALL ON TABLE tipo_disp FROM PUBLIC;
+REVOKE ALL ON TABLE tipo_disp FROM gevice;
+GRANT ALL ON TABLE tipo_disp TO gevice;
+
+
+--
+-- Name: tipo_enlace; Type: ACL; Schema: public; Owner: gevice
+--
+
+REVOKE ALL ON TABLE tipo_enlace FROM PUBLIC;
+REVOKE ALL ON TABLE tipo_enlace FROM gevice;
+GRANT ALL ON TABLE tipo_enlace TO gevice;
+
+
+--
+-- Name: todoslosdispositivos; Type: ACL; Schema: public; Owner: gevice
+--
+
+REVOKE ALL ON TABLE todoslosdispositivos FROM PUBLIC;
+REVOKE ALL ON TABLE todoslosdispositivos FROM gevice;
+GRANT ALL ON TABLE todoslosdispositivos TO gevice;
+
+
+--
+-- PostgreSQL database dump complete
+--
+
diff --git a/src/gevice.py b/src/gevice.py
index f4f7dbd..a22b609 100755
--- a/src/gevice.py
+++ b/src/gevice.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # gevice GNOME Network Device Manager.
 # Copyright (C) Alejandro Valdes Jimenez 2008 <avaldes gnome org>
@@ -16,29 +16,24 @@
 # You should have received a copy of the GNU General Public License along
 # with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+from gi.repository import Gtk, GdkPixbuf, Vte, GLib
 
-import pygtk
-pygtk.require('2.0')
 import os
 import os.path
-import sys
-import gtk
-import gnome
-import psycopg2
-import gobject
-import pynotify
+#import sys
+#import psycopg2
 
 import config
 import gevicefind
-import gevicediagram
+#import gevicediagram
 import geviceprefer
 import gevicevte
 import gevicedevice
 import gevicemodel
 import gevicedatabase
-import geviceexport
-import gevicemaintainer
-#import geviceping
+#import geviceexport
+#import gevicemaintainer
+
 
 import gettext
 gettext.textdomain(config.PACKAGE)
@@ -53,13 +48,13 @@ class Gevice:
     self.context_id = None
     
     # model for users
-    self.modelusers = gtk.ListStore(gobject.TYPE_STRING)
+    self.modelusers = Gtk.ListStore(str)
     
     # model for devices
     self.gmodel = gevicemodel.GeviceModel(self)
     
     # get widgets of main app
-    builder = gtk.Builder()
+    builder = Gtk.Builder()
     builder.add_from_file(os.path.join (config.UIDIR, "main.xml"))
     
     self.window_main = builder.get_object ("window_main")
@@ -70,14 +65,14 @@ class Gevice:
     self.notebook = builder.get_object ("notebook")
     self.statusbar = builder.get_object ("statusbar")
     
-    self.window_main.set_icon (gtk.gdk.pixbuf_new_from_file(os.path.join (config.ARTDIR,"gevice.png")))
+    self.window_main.set_icon (GdkPixbuf.Pixbuf.new_from_file(os.path.join (config.ARTDIR,"gevice.png")))
     self.window_main.set_title(config.PACKAGE)
     self.window_main.connect ("delete_event",self.on_delete_event)
     
     self.context_id = self.statusbar.get_context_id("status")
     
     # create UIManager instance
-    self.uimanager = gtk.UIManager()
+    self.uimanager = Gtk.UIManager()
     self.uimanager.add_ui_from_file (os.path.join (config.UIDIR, "menu.xml"))
     
     # create ActionGroup and add to unimanager
@@ -94,28 +89,33 @@ class Gevice:
     
     # create a Toolbar
     self.maintoolbar = self.uimanager.get_widget ('/MainToolbar')
-    self.maintoolbar.set_style(gtk.TOOLBAR_ICONS)
+    #self.maintoolbar.set_style(Gtk.TOOLBAR_ICONS)
     
     # create horizontal container for toolbar and users combobox
-    self.hbox = gtk.HBox(False,0)
+    self.hbox = Gtk.HBox(homogeneous=False, spacing=0)
     self.vbox_main.pack_start (self.hbox,False,False,0)
     
     # create users combobox
-    self.separator_user = gtk.SeparatorToolItem()
-    self.toolitem_user = gtk.ToolItem()
+    self.separator_user = Gtk.SeparatorToolItem()
+    self.toolitem_user = Gtk.ToolItem()
     self.maintoolbar.insert(self.toolitem_user,12)
     
-    self.vboxcombo = gtk.VBox(False,0)
-    self.combobox_user = gtk.combo_box_entry_new_with_model(self.modelusers,0)
-    self.vboxcombo.pack_end (self.combobox_user,True,False)
+    self.vboxcombo = Gtk.VBox(homogeneous=False, spacing=0)
+    #self.combobox_user = Gtk.ComboBox(model=self.modelusers,has_entry=True)
+    self.combobox_user = Gtk.ComboBox(model=self.modelusers,has_entry=False)
+    self.vboxcombo.pack_end (self.combobox_user,True,False,0)
     self.toolitem_user.add(self.vboxcombo)
     
-    self.hbox.pack_start (self.maintoolbar,True,True)	
+    cell = Gtk.CellRendererText()
+    self.combobox_user.pack_start(cell, True)
+    self.combobox_user.add_attribute(cell, "text", 0)
+    
+    self.hbox.pack_start (self.maintoolbar,True,True,0)	
     
     # add treeview to vboxtreeview
-    self.scroll = gtk.ScrolledWindow()
-    self.scroll.set_shadow_type("GTK_SHADOW_ETCHED_IN")
-    self.scroll.set_policy("GTK_POLICY_AUTOMATIC","GTK_POLICY_AUTOMATIC")
+    self.scroll = Gtk.ScrolledWindow()
+    #self.scroll.set_shadow_type("GTK_SHADOW_ETCHED_IN")
+    #self.scroll.set_policy("GTK_POLICY_AUTOMATIC","GTK_POLICY_AUTOMATIC")
     self.scroll.add (self.gmodel.treeview)
     self.vboxtreeview.add (self.scroll)
     
@@ -123,7 +123,7 @@ class Gevice:
     self.notebook.set_scrollable (True)
     self.notebook.set_show_border (False)
     self.notebook.set_show_tabs (True)
-    self.notebook.set_group_id(1)
+    #self.notebook.set_group_id(1)
     
     self.hpaned.add2 (self.notebook)
     # a negative value means that the position is unset.
@@ -140,14 +140,14 @@ class Gevice:
     return
   
   def create_actionsgroups (self):
-    self.actiongroup_window = gtk.ActionGroup ('Window Actions')
-    self.actiongroup_model = gtk.ActionGroup ('Model Actions')
-    self.actiongroup_device = gtk.ActionGroup ('Device Actions')
+    self.actiongroup_window = Gtk.ActionGroup ('Window Actions')
+    self.actiongroup_model = Gtk.ActionGroup ('Model Actions')
+    self.actiongroup_device = Gtk.ActionGroup ('Device Actions')
     
     # add the accelerator group to the toplevel window
     self.accelgroup = self.uimanager.get_accel_group()
     self.window_main.add_accel_group (self.accelgroup)
-    self.actiongroup_window.add_toggle_actions([('Dual', None, '_Dual', None,_('Dual terminal'), None)])
+    self.actiongroup_window.add_toggle_actions([('Dual', Gtk.STOCK_ADD, '_Dual', None,_('Dual terminal'), None)])
     
     # creat actions
     self.actiongroup_window.add_actions([
@@ -158,35 +158,35 @@ class Gevice:
       ('HelpMenu', None, _('_Help')),
       ('Maintainer', None, _('_Maintainer')),
       ('ActionsMenu', None, _('_Actions')),
-      ('Open', gtk.STOCK_DISCONNECT, _('Connect'), None, _('Connect to database'), self.on_action_open),
-      ('OpenLocalTerminal', gtk.STOCK_HOME, _('Local'), None, _('Open local terminal'), self.on_action_open_local_terminal),
-      ('Quit', gtk.STOCK_QUIT, _('_Quit'), None, _('Quit the program'), self.on_action_quit),
-      ('Prefer', gtk.STOCK_PREFERENCES, _('Preferences'), None, _('Setting preferences'), self.on_action_preferences),
-      ('About', gtk.STOCK_ABOUT, None, None, None, self.on_action_about),
+      ('Open', Gtk.STOCK_DISCONNECT, _('Connect'), None, _('Connect to database'), self.on_action_open),
+      ('OpenLocalTerminal', Gtk.STOCK_HOME, _('Local'), None, _('Open local terminal'), self.on_action_open_local_terminal),
+      ('Quit', Gtk.STOCK_QUIT, _('_Quit'), None, _('Quit the program'), self.on_action_quit),
+      ('Prefer', Gtk.STOCK_PREFERENCES, _('Preferences'), None, _('Setting preferences'), self.on_action_preferences),
+      ('About', Gtk.STOCK_ABOUT, None, None, None, self.on_action_about),
       ])
       
     self.actiongroup_model.add_actions([
-      ('Find', gtk.STOCK_FIND, _('Find'),None, _('Search a device'), self.on_action_find),
-      ('Save', gtk.STOCK_SAVE, _('Save'), None, _('Save model'), self.on_action_save),
-      ('Refresh', gtk.STOCK_REFRESH, _('Refresh'), None, _('Refresh model'), self.on_action_refresh),
-      ('Export', gtk.STOCK_SELECT_ALL, _('Export to CSV'), None, _('Export to CSV'), self.on_action_export),
+      ('Find', Gtk.STOCK_FIND, _('Find'),None, _('Search a device'), self.on_action_find),
+      ('Save', Gtk.STOCK_SAVE, _('Save'), None, _('Save model'), self.on_action_save),
+      ('Refresh', Gtk.STOCK_REFRESH, _('Refresh'), None, _('Refresh model'), self.on_action_refresh),
+      ('Export', Gtk.STOCK_SELECT_ALL, _('Export to CSV'), None, _('Export to CSV'), self.on_action_export),
       ])
       
     self.actiongroup_device.add_actions([
-      ('AddDevice', gtk.STOCK_ADD, _('Add'),None, _('Add a device'), self.on_action_adddevice),
-      ('RemoveDevice', gtk.STOCK_REMOVE, _('Remove'), None, _('Remove device selected'), self.on_action_removedevice),
-      ('EditDevice', gtk.STOCK_EDIT, _('Edit'), None, _('Edit data of device selected'), self.on_action_editdevice),
-      ('Expand', gtk.STOCK_INDENT, _('Expand'), None, _('Expand tree of device selected'), self.on_action_expand),
-      ('Decrease', gtk.STOCK_UNINDENT, _('Decrease'), None, _('Decrease tree of device selected'), self.on_action_decrease),
-      ('Diagram', gtk.STOCK_CONVERT, _('Generate Diagram'),None, _('Generate diagram of devices'), self.on_action_diagram),
-      ('Mark', gtk.STOCK_EDIT, _('Mark'),None, _('Mark'), self.on_action_mark),
-      ('TypeOfLink', gtk.STOCK_EDIT, _('Type of link'),None, _('Type of link'), self.on_action_typeoflink),
-      ('TypeOfDev', gtk.STOCK_EDIT, _('Type of device'),None, _('Type of device'), self.on_action_typeofdev),
-      ('Model', gtk.STOCK_EDIT, _('Model of device'),None, _('Model of device'), self.on_action_model),
-      ('Level', gtk.STOCK_EDIT, _('Levels of locations'),None, _('Levels of locations'), self.on_action_level),
-      ('Campus', gtk.STOCK_EDIT, _('Campus of organization'),None, _('Campus of Organization'), self.on_action_campus),
-      ('Location', gtk.STOCK_EDIT, _('Locations of devices'),None, _('Locations of devices'),self.on_action_location),
-      ('Edifice', gtk.STOCK_EDIT, _('Edifices of campus'),None, _('Edifices of campus'), self.on_action_edifice),
+      ('AddDevice', Gtk.STOCK_ADD, _('Add'),None, _('Add a device'), self.on_action_adddevice),
+      ('RemoveDevice', Gtk.STOCK_REMOVE, _('Remove'), None, _('Remove device selected'), self.on_action_removedevice),
+      ('EditDevice', Gtk.STOCK_EDIT, _('Edit'), None, _('Edit data of device selected'), self.on_action_editdevice),
+      ('Expand', Gtk.STOCK_INDENT, _('Expand'), None, _('Expand tree of device selected'), self.on_action_expand),
+      ('Decrease', Gtk.STOCK_UNINDENT, _('Decrease'), None, _('Decrease tree of device selected'), self.on_action_decrease),
+      ('Diagram', Gtk.STOCK_CONVERT, _('Generate Diagram'),None, _('Generate diagram of devices'), self.on_action_diagram),
+      ('Mark', Gtk.STOCK_EDIT, _('Mark'),None, _('Mark'), self.on_action_mark),
+      ('TypeOfLink', Gtk.STOCK_EDIT, _('Type of link'),None, _('Type of link'), self.on_action_typeoflink),
+      ('TypeOfDev', Gtk.STOCK_EDIT, _('Type of device'),None, _('Type of device'), self.on_action_typeofdev),
+      ('Model', Gtk.STOCK_EDIT, _('Model of device'),None, _('Model of device'), self.on_action_model),
+      ('Level', Gtk.STOCK_EDIT, _('Levels of locations'),None, _('Levels of locations'), self.on_action_level),
+      ('Campus', Gtk.STOCK_EDIT, _('Campus of organization'),None, _('Campus of Organization'), self.on_action_campus),
+      ('Location', Gtk.STOCK_EDIT, _('Locations of devices'),None, _('Locations of devices'),self.on_action_location),
+      ('Edifice', Gtk.STOCK_EDIT, _('Edifices of campus'),None, _('Edifices of campus'), self.on_action_edifice),
       ])
     
     self.actiongroup_window.add_toggle_actions([
@@ -195,13 +195,13 @@ class Gevice:
       ])
     
     self.actiongroup_window.add_radio_actions([
-      ('ssh', None, _('ssh'),None, _('Use ssh protocol'), 0),
-      ('telnet', None, _('telnet'),None, _('Use telnet protocol'), 1),
-      ('local', None, _('local'),None, _('Open local terminal'), 2),
+      ('ssh', Gtk.STOCK_ADD, _('ssh'),None, _('Use ssh protocol'), 0),
+      ('telnet', Gtk.STOCK_ADD, _('telnet'),None, _('Use telnet protocol'), 1),
+      ('local', Gtk.STOCK_ADD, _('local'),None, _('Open local terminal'), 2),
       ],0, self.on_action_radio)
       
     self.actiongroup_window.add_actions([
-      ('Connect', gtk.STOCK_JUMP_TO, _('Connect'), None, _('Connect to'), self.on_action_connect),
+      ('Connect', Gtk.STOCK_JUMP_TO, _('Connect'), None, _('Connect to'), self.on_action_connect),
       ])
     
     self.actiongroup_model.set_sensitive (False)
@@ -212,17 +212,25 @@ class Gevice:
     self.modelusers.clear()
     
     for user in self.gpref.listusers:
-      self.combobox_user.append_text(user)
+      self.modelusers.append([user])
     
-    self.combobox_user.set_active (0)
+    self.combobox_user.set_active(0)
   
   def main(self):
-    gtk.main()
+    Gtk.main()
   
   def show_message (self,msg,type_msg,buttons):
-    dialog = gtk.MessageDialog(None,gtk.DIALOG_MODAL,type_msg,buttons,msg)
+    #dialog = Gtk.MessageDialog(None,Gtk.DIALOG_MODAL,type_msg,buttons,msg)
+    dialog = Gtk.Dialog(config.PACKAGE,self.window_main,flags=0,buttons=(buttons))
+    
+    label = Gtk.Label(msg)
+    content_area = dialog.get_content_area()
+    content_area.add (label)
+    dialog.show_all()
+
     result = dialog.run()
     dialog.destroy()
+    
     return result
   
   def close_page_of_notebook(self,widget,vpaned):
@@ -245,12 +253,12 @@ class Gevice:
     else:
       isdual = False
     
-    vpaned = gtk.VPaned()
+    vpaned = Gtk.VPaned()
     vpaned.set_position (-1)
     
-    label = gtk.Label()
-    button_close = self.create_button_with_image ('gtk-close',True)
-    hbox_label = gtk.HBox(False,0)
+    label = Gtk.Label()
+    button_close = self.create_button_with_image (Gtk.STOCK_CLOSE,True)
+    hbox_label = Gtk.HBox(homogeneous=False,spacing=0)
     hbox_label.pack_start(label,False,False,1)
     hbox_label.pack_start(button_close,True,False,0)
     
@@ -264,12 +272,12 @@ class Gevice:
     if local:
 
       label.set_text(_("Local"))
-      terminal.fork_command ()
+      terminal.fork_command_full (Vte.PtyFlags.DEFAULT, None, [Vte.get_user_shell()], None, GLib.SpawnFlags.SEARCH_PATH, None, None)
       
       if isdual:
         hbox_term2,terminal2 = gvte.new_terminal (self)
         vpaned.add2 (hbox_term2)
-        terminal2.fork_command ()    
+	terminal2.fork_command_full (Vte.PtyFlags.DEFAULT, None, [Vte.get_user_shell()], None, GLib.SpawnFlags.SEARCH_PATH, None, None)
     else:
       i = self.gmodel.get_iter_selected (self.gmodel.treeview)
       if i["iter"]:
@@ -277,13 +285,18 @@ class Gevice:
         data = self.gmodel.get_data_of_device_from_model(self.gmodel.treeview)
         label.set_text(data[0])
         proto = self.get_protocol_selected()
-        user = self.combobox_user.get_active_text()
-        terminal.fork_command (proto,['bash','-l',user,data[2]],[],config.DEFAULT_TMP)
+	
+	model_user = self.combobox_user.get_model()
+	iter_user = self.combobox_user.get_active_iter()
+	user = model_user.get(iter_user,0)
+
+	terminal.fork_command_full (Vte.PtyFlags.DEFAULT, None, [proto,'-l',user[0],data[2]], [], GLib.SpawnFlags.SEARCH_PATH, None, None)
         
 	if isdual:
 	  hbox_term2,terminal2 = gvte.new_terminal (self)
 	  vpaned.add2 (hbox_term2)
-	  terminal2.fork_command (proto,['bash','-l',user,data[2]],[],config.DEFAULT_TMP)
+	  terminal2.fork_command_full (Vte.PtyFlags.DEFAULT, None, [proto,'-l',user[0],data[2]], [], GLib.SpawnFlags.SEARCH_PATH, None, None)
+	  #terminal2.fork_command (proto,['bash','-l',user,data[2]],[],config.DEFAULT_TMP)
         
     page = self.notebook.append_page(vpaned,hbox_label)
     self.notebook.set_tab_reorderable(vpaned,True)
@@ -296,13 +309,14 @@ class Gevice:
   def create_button_with_image (self,id_stock,sensitive):
     "return a button with image, utilized in tool of browser"
     
-    hbox_image = gtk.HBox(False,0)
-    image = gtk.Image()
-    image.set_from_stock(id_stock,'GTK_ICON_SIZE_MENU')
+    hbox_image = Gtk.HBox(homogeneous=False,spacing=0)
+    image = Gtk.Image()
+    #image.set_from_stock(id_stock,Gtk.ICON_SIZE_MENU)
+    image.set_from_stock(id_stock,Gtk.IconSize.MENU)
     hbox_image.pack_start(image,True,False,False)
     
-    button = gtk.Button()
-    button.set_relief('GTK_RELIEF_NONE')
+    button = Gtk.Button()
+    #button.set_relief('GTK_RELIEF_NONE')
     
     button.add(hbox_image)
     button.set_sensitive (sensitive)
@@ -436,25 +450,25 @@ class Gevice:
     dialogexport.load_interface (gevice)
     dialogexport.save_file (gevice)
   
-  def on_action_refresh (gevice,action):
+  def on_action_refresh (gevice,action,data):
     gevice.gdbase.cur = gevice.gdbase.conn.cursor()
     gevice.gdbase.load_data_from_database(gevice)
     
   def on_delete_event (self,data1=None,data2=None):
-    gtk.main_quit()
+    Gtk.main_quit()
   
-  def on_action_about (self,action):
+  def on_action_about (self,action,data):
     self.create_about_dialog()
     
-  def on_action_quit (self,action):
+  def on_action_quit (self,action,data):
     self.on_delete_event ()
     
-  def on_action_preferences (gevice,action):
+  def on_action_preferences (gevice,action,data):
     gevice.gpref.load_preferences(gevice)
     gevice.gpref.load_interface(gevice)
     gevice.gpref.show_interface()
   
-  def on_action_find (gevice,action):
+  def on_action_find (gevice,action,data):
     gevice.gevicefind = gevicefind.GeviceFind ()
     gevice.gevicefind.load_interface(gevice)
     gevice.gevicefind.show_interface()
@@ -468,36 +482,36 @@ class Gevice:
       gevice.gdiagram.load_interface (gevice)
       gevice.gdiagram.show_interface ()
     else:
-      result = gevice.show_message (_("You need choose some device to generate the diagram."),gtk.MESSAGE_WARNING,gtk.BUTTONS_OK)
+      result = gevice.show_message (_("You need choose some device to generate the diagram."),Gtk.MESSAGE_WARNING,Gtk.BUTTONS_OK)
       
   def on_action_print (gevice,action):
     gprint = geviceprint.GevicePrint()
     gprint.load_interface(gevice)
     gprint.show_interface()
     
-  def on_action_expand (gevice,action):
+  def on_action_expand (gevice,action,data):
     gevice.gmodel.expand_treeview (True)
     
-  def on_action_decrease (gevice,action):
+  def on_action_decrease (gevice,action,data):
     gevice.gmodel.expand_treeview (False)
     
-  def on_action_adddevice (gevice,action):
+  def on_action_adddevice (gevice,action,data):
     gevice.gdevice = gevicedevice.GeviceDevice ()
     gevice.gdevice.load_interface (gevice)
     gevice.gdevice.add_device()
     gevice.gdevice.show_interface ()
     
-  def on_action_removedevice (gevice,action):
+  def on_action_removedevice (gevice,action,data):
     gevice.gdevice = gevicedevice.GeviceDevice ()
     gevice.gdevice.remove_device(gevice)
     
-  def on_action_editdevice (gevice,action):
+  def on_action_editdevice (gevice,action,data):
     gevice.gdevice = gevicedevice.GeviceDevice ()
     gevice.gdevice.load_interface (gevice)
     gevice.gdevice.modify_device(gevice)
     gevice.gdevice.show_interface ()
     
-  def on_action_open (gevice,action):
+  def on_action_open (gevice,action,data):
     if (not gevice.connected_to_database):
       gevice.gdbase = gevicedatabase.GeviceDatabase ()
       gevice.gdbase.load_interface (gevice)
@@ -510,7 +524,7 @@ class Gevice:
       gevice.gmodel.treeview.set_model(None)
       
     action_open = gevice.actiongroup_window.get_action("Open")
-    action_open.set_property ("stock-id",gtk.STOCK_DISCONNECT)
+    action_open.set_property ("stock-id",Gtk.STOCK_DISCONNECT)
     action_open.set_property ("tooltip",_("Connect to database"))
     action_open.set_property ("label",_("Connect"))
     
@@ -519,7 +533,7 @@ class Gevice:
     gevice.actiongroup_device.set_sensitive (False)
     gevice.connected_to_database = False
     
-  def on_action_save (gevice,action):
+  def on_action_save (gevice,action,data):
     gevice.gdbase = gevicedatabase.GeviceDatabase ()
     gevice.gdbase.load_interface (gevice,"save")
     gevice.gdbase.label_host.set_text (gevice.gpref.host)
@@ -527,7 +541,7 @@ class Gevice:
     gevice.gdbase.label_user_dbase.set_text (gevice.gpref.user_dbase)
     gevice.gdbase.show_interface()
     
-  def on_action_connect(self,action):
+  def on_action_connect(self,action,data):
     flag = True
     proto = self.get_protocol_selected()
     
@@ -539,17 +553,17 @@ class Gevice:
   def on_action_open_local_terminal(self,action):
     self.connect_to_device(True)
     
-  def on_action_radio(action,current,gevice):
+  def on_action_radio(gevice,action,current,data):
     # get the actionradio selected
-   gevice.action_radio = action
+    gevice.action_radio = action
    
-  def on_toggle_tree (gevice,action):
+  def on_toggle_tree (gevice,action,data):
     if (action.get_active() == True):
       gevice.vboxtreeview.show()
     else:
       gevice.vboxtreeview.hide ()
   
-  def on_toggle_terminal (gevice,action):
+  def on_toggle_terminal (gevice,action,data):
     if (action.get_active() == True):
       gevice.vboxterminal.show()
     else:
@@ -564,18 +578,18 @@ class Gevice:
   def create_about_dialog (self):
     authors = ('Alejandro Valdes Jimenez [avaldes gnome org]','')
     translator_credits = ('Alejandro Valdes Jimenez [avaldes gnome org]')
-    logo =  gtk.gdk.pixbuf_new_from_file (os.path.join (config.ARTDIR,"gevice.png"))
+    logo =  GdkPixbuf.Pixbuf.new_from_file (os.path.join (config.ARTDIR,"gevice.png"))
     
-    ad = gtk.AboutDialog()
-    ad.set_name(config.PACKAGE)
+    ad = Gtk.AboutDialog()
+    ad.set_name("Gevice - GNOME Network Device Manager")
     ad.set_version(config.VERSION)
     ad.set_authors(authors)
     ad.set_translator_credits(translator_credits)
+    ad.set_website("http://projects.gnome.org/gevice/";)
     ad.set_logo(logo)
     
-    ad.connect ("delete-event", self.about_delete)
-    ad.connect ("response", self.about_delete)
-    ad.show()
+    ad.run()
+    ad.destroy()
     
   def about_delete (self,about,event):
     about.destroy()
@@ -599,7 +613,5 @@ class Gevice:
     self.statusbar.push (self.context_id,msg)
 
 if __name__ == "__main__":
-  gnome.init(config.PACKAGE,config.VERSION)
-  pynotify.init(config.PACKAGE)
   gevice = Gevice()
   gevice.main()
diff --git a/src/gevicedatabase.py b/src/gevicedatabase.py
index 53cfb92..9d01d9c 100644
--- a/src/gevicedatabase.py
+++ b/src/gevicedatabase.py
@@ -1,7 +1,4 @@
-import pygtk
-pygtk.require('2.0')
-import gtk
-import gobject
+from gi.repository import Gtk, Gdk
 import os
 
 import gettext
@@ -29,7 +26,7 @@ class GeviceDatabase:
             conn = psycopg2.connect("dbname=" + gevice.gpref.dbase + " user=" + gevice.gpref.user_dbase + " host=" + gevice.gpref.host + " password=" + passwd)
             return conn
         except:
-            result = gevice.show_message (_("Unable to connect to the database"),gtk.MESSAGE_ERROR,gtk.BUTTONS_OK)
+	    result = gevice.show_message (_("Unable to connect to the database"),None,(Gtk.STOCK_OK, Gtk.ResponseType.OK))
             return False
 
 
@@ -39,7 +36,9 @@ class GeviceDatabase:
             rows = self.cur.fetchall()
             return rows
         except:
-            result = gevice.show_message (_("Unable to execute SQL: " + sql),gtk.MESSAGE_ERROR,gtk.BUTTONS_OK)
+	    #result = gevice.show_message (_("Unable to execute SQL: " + sql),None,(Gtk.STOCK_OK, Gtk.ResponseType.OK))
+	    result = gevice.show_message (_("Unable to execute SQL: "),None,(Gtk.STOCK_OK, Gtk.ResponseType.OK))
+	    print sql
             return False
         
     def execute_sql_insert (self,gevice,sql):
@@ -47,7 +46,7 @@ class GeviceDatabase:
             self.cur.execute(sql)
             return True
         except:
-            result = gevice.show_message (_("Unable to execute SQL: " + sql),gtk.MESSAGE_ERROR,gtk.BUTTONS_OK)
+            result = gevice.show_message (_("Unable to execute SQL: " + sql),Gtk.MESSAGE_ERROR,Gtk.BUTTONS_OK)
             return False
             
     def execute_sql_delete (self,gevice,sql):
@@ -55,7 +54,7 @@ class GeviceDatabase:
             self.cur.execute(sql)
             return True
         except:
-            result = gevice.show_message (_("Unable to execute SQL: " + sql),gtk.MESSAGE_ERROR,gtk.BUTTONS_OK)
+            result = gevice.show_message (_("Unable to execute SQL: " + sql),Gtk.MESSAGE_ERROR,Gtk.BUTTONS_OK)
             return False
 
     def execute_sql_update (self,gevice,sql):
@@ -63,11 +62,11 @@ class GeviceDatabase:
             self.cur.execute(sql)
             return True
         except:
-            result = gevice.show_message (_("Unable to execute SQL: " + sql),gtk.MESSAGE_ERROR,gtk.BUTTONS_OK)
+            result = gevice.show_message (_("Unable to execute SQL: " + sql),Gtk.MESSAGE_ERROR,Gtk.BUTTONS_OK)
             return False
 
     def load_interface (self,gevice,action="connect"):
-	builder = gtk.Builder()
+	builder = Gtk.Builder()
 	builder.add_from_file(os.path.join (config.UIDIR, "dbase.xml"))
 	
 	self.window_database = builder.get_object ("window_database")
@@ -95,11 +94,11 @@ class GeviceDatabase:
 
 
     def on_entry_passwd_dbase_key_press (self,widget,event,gevice):
-        if gtk.gdk.keyval_name(event.keyval) == "Return":
+        if Gdk.keyval_name(event.keyval) == "Return":
             self.on_button_connect_dbase_clicked(None,gevice)
 
     def on_entry_passwd_dbase_key_press_save (self,widget,event,gevice):
-        if gtk.gdk.keyval_name(event.keyval) == "Return":
+        if Gdk.keyval_name(event.keyval) == "Return":
             self.on_button_connect_dbase_clicked_save(None,gevice)
 
     def on_button_connect_cancel_clicked (self,button):
@@ -117,7 +116,7 @@ class GeviceDatabase:
             self.load_data_from_database(gevice)
 
             action_open = gevice.actiongroup_window.get_action("Open")
-            action_open.set_property ("stock-id",gtk.STOCK_CONNECT)
+            action_open.set_property ("stock-id",Gtk.STOCK_CONNECT)
             action_open.set_property ("tooltip",_("Disconnect from database"))
             action_open.set_property ("label",_("Disconnect"))
             
@@ -183,7 +182,7 @@ class GeviceDatabase:
         row = self.execute_sql_select(gevice,sql)
         
         if row:
-            itern = gevice.gmodel.treestore.append(iterp)        
+            itern = gevice.gmodel.treestore.append(iterp)
             gevice.gmodel.insert_new_item (itern,row,id_type_link)
 
             sql2 = "select serialh,id_tipo_enlace from conecta where serialp='" + serial + "'"
@@ -256,9 +255,7 @@ class GeviceDatabase:
 
 
     def get_list_of_models (self,gevice):
-        liststore = gtk.ListStore(
-            gobject.TYPE_STRING,
-            gobject.TYPE_INT)
+        liststore = Gtk.ListStore(str,int)
         
         sql = "select nom_tipo_disp || ' ' || nom_marca || ' ' || nom_modelo,modelo.id_modelo "
         sql = sql + "from modelo inner join tipo_disp on modelo.id_tipo_disp = tipo_disp.id_tipo_disp "
@@ -270,10 +267,8 @@ class GeviceDatabase:
         if rows:
             for row in rows:
                 iter = liststore.append ()
-                liststore.set (
-                    iter,
-                    config.COLUMN_NAME_MODEL_DEV2,row[0],
-                    config.COLUMN_ID_MODEL_DEV2,row[1])
+                liststore.set_value (iter, config.COLUMN_NAME_MODEL_DEV2,str(row[0]))
+		liststore.set_value (iter, config.COLUMN_ID_MODEL_DEV2,int(row[1]))
         
             return liststore
         else:
@@ -281,7 +276,7 @@ class GeviceDatabase:
     
     
     def get_list_of_links (self,gevice):
-        liststore = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_INT)
+        liststore = Gtk.ListStore(str,int)
             
         sql = "select nom_tipo_enlace,id_tipo_enlace from tipo_enlace"
         
@@ -290,7 +285,8 @@ class GeviceDatabase:
         if rows:
             for row in rows:
                 iter = liststore.append ()
-                liststore.set (iter,config.COLUMN_NAME_TYPE_LINK_DEV2,row[0],config.COLUMN_ID_TYPE_LINK_DEV2,row[1])
+                liststore.set_value (iter,config.COLUMN_NAME_TYPE_LINK_DEV2,str(row[0]))
+		liststore.set_value (iter,config.COLUMN_ID_TYPE_LINK_DEV2,int(row[1]))
         
             return liststore
         else:
@@ -298,7 +294,7 @@ class GeviceDatabase:
 
 
     def get_list_of_location (self,gevice):
-        liststore = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_INT)
+        liststore = Gtk.ListStore(str,int)
         
         sql = "select '[' || campus.nom_campus || '][' || edificio.nom_edif || '][' || nivel.nom_nivel || '][' || rack.detalle || ']' as location, rack.id_rack "        
         sql = sql + "from rack "
@@ -312,24 +308,23 @@ class GeviceDatabase:
         if rows:
             for row in rows:
                 iter = liststore.append ()
-                liststore.set (iter,config.COLUMN_LOCATION_DEV2,row[0],config.COLUMN_ID_LOCATION_DEV2,row[1])
+                liststore.set_value (iter,config.COLUMN_LOCATION_DEV2,str(row[0]))
+		liststore.set_value (iter,config.COLUMN_ID_LOCATION_DEV2,int(row[1]))
 
             return liststore
         else:
             return False
 
     def get_list_of_data (self,gevice,sql):
-        liststore = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_INT)
+        liststore = Gtk.ListStore(str,int)
 
         rows = self.execute_sql_select(gevice,sql)
         
         if rows:
             for row in rows:
                 iter = liststore.append ()
-                liststore.set (
-                    iter,
-                    0,row[0],
-                    1,row[1])
+                liststore.set_value (iter,0,str(row[0]))
+		liststore.set_value (iter,1,int(row[1]))
                            
             return liststore
         else:
diff --git a/src/gevicedevice.py b/src/gevicedevice.py
index 72f3ebd..3f39425 100644
--- a/src/gevicedevice.py
+++ b/src/gevicedevice.py
@@ -1,6 +1,4 @@
-import pygtk
-pygtk.require('2.0')
-import gtk
+from gi.repository import Gtk
 import os
 
 import gettext
@@ -111,28 +109,18 @@ class GeviceDevice:
         self.action = "del"
         
         data = gevice.gmodel.get_data_of_device_from_model(gevice.gmodel.treeview)
-        
-        
-        dialog = gtk.Dialog(config.PACKAGE,
-            None,
-            gtk.DIALOG_DESTROY_WITH_PARENT,
-            (gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OK,gtk.RESPONSE_ACCEPT)) 
-
-        dialog.set_has_separator(False)
-        dialog.vbox.set_spacing(15)
-        dialog.vbox.pack_start(gtk.Label(_("Do you want to remove: ") + data[0]))
-        dialog.show_all()
-
-        response = dialog.run ()
+	
+	result = gevice.show_message (_("Do you want to remove: ") + data[0],
+	  None,
+	  (Gtk.STOCK_YES, Gtk.ResponseType.YES, Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))
 
-        if response == gtk.RESPONSE_ACCEPT:
+	if result == Gtk.ResponseType.YES:
             i = gevice.gmodel.get_iter_selected (gevice.gmodel.treeview)
             gevice.gmodel.treestore.remove(i["iter"])
 
-        dialog.destroy()
 
     def load_interface (self,gevice):
-	builder = gtk.Builder()
+	builder = Gtk.Builder()
 	builder.add_from_file(os.path.join (config.UIDIR, "device.xml"))
 	
         self.window_device = builder.get_object ("window_device")
@@ -152,20 +140,20 @@ class GeviceDevice:
         self.button_cancel_device.connect ("clicked",self.on_button_cancel_device_clicked)
         self.button_accept_device.connect ("clicked",self.on_button_accept_device_clicked,gevice)
        
-	cell = gtk.CellRendererText()
-        self.combo_model.pack_start(cell)
+	cell = Gtk.CellRendererText()
+        self.combo_model.pack_start(cell,True)
         self.combo_model.add_attribute(cell, 'text', 0)
         gevice.list_models = gevice.gdbase.get_list_of_models (gevice)
         self.combo_model.set_model (gevice.list_models)
         
-	cell = gtk.CellRendererText()
-        self.combo_link.pack_start(cell)
+	cell = Gtk.CellRendererText()
+        self.combo_link.pack_start(cell,True)
         self.combo_link.add_attribute(cell, 'text', 0)
         gevice.list_links = gevice.gdbase.get_list_of_links (gevice)
         self.combo_link.set_model (gevice.list_links)
         
-	cell = gtk.CellRendererText()
-        self.combo_location.pack_start(cell)
+	cell = Gtk.CellRendererText()
+        self.combo_location.pack_start(cell,True)
         self.combo_location.add_attribute(cell, 'text', 0)
         gevice.list_location = gevice.gdbase.get_list_of_location (gevice)
         self.combo_location.set_model (gevice.list_location)        
@@ -211,17 +199,17 @@ class GeviceDevice:
         
         if (not name.strip()):
             alldata = False
-            result = gevice.show_message (_("Enter name of device"),gtk.MESSAGE_ERROR,gtk.BUTTONS_OK)
+            result = gevice.show_message (_("Enter name of device"),Gtk.MESSAGE_ERROR,Gtk.BUTTONS_OK)
         elif (not serial.strip()):
             alldata = False
-            result = gevice.show_message (_("Enter serial number of device"),gtk.MESSAGE_ERROR,gtk.BUTTONS_OK)
+            result = gevice.show_message (_("Enter serial number of device"),Gtk.MESSAGE_ERROR,Gtk.BUTTONS_OK)
 
         gevice.gmodel.treestore.foreach(self.verify_serial,serial)
 
         if self.action == "add":
             if (self.exists_serial):
                 alldata = False
-                result = gevice.show_message (_("Serial number exist, view device: " + self.exists_serial_name),gtk.MESSAGE_ERROR,gtk.BUTTONS_OK)
+                result = gevice.show_message (_("Serial number exist, view device: " + self.exists_serial_name),Gtk.MESSAGE_ERROR,Gtk.BUTTONS_OK)
 
         if alldata:        
             iter_model = self.combo_model.get_active_iter()
@@ -242,17 +230,16 @@ class GeviceDevice:
             else:
                 newiter = i["iter"]
 
-            gevice.gmodel.treestore.set (newiter,
-                config.COLUMN_NAME_DEV,name.strip(),
-                config.COLUMN_ID_MODEL_DEV,id_model,
-                config.COLUMN_NAME_MODEL_DEV,name_model,   
-                config.COLUMN_IP_DEV,ip,
-                config.COLUMN_SERIAL_DEV,serial,
-                config.COLUMN_OBS_DEV,comment,
-                config.COLUMN_LOCATION,name_location,
-                config.COLUMN_ID_LOCATION_DEV,id_location,
-                config.COLUMN_ID_TYPE_LINK_DEV,id_link,
-                config.COLUMN_PTAS_DISP,ports)
+            gevice.gmodel.treestore.set_value (newiter, config.COLUMN_NAME_DEV,str(name.strip()))
+	    gevice.gmodel.treestore.set_value (newiter, config.COLUMN_ID_MODEL_DEV,str(id_model))
+	    gevice.gmodel.treestore.set_value (newiter, config.COLUMN_NAME_MODEL_DEV,str(name_model))
+	    gevice.gmodel.treestore.set_value (newiter, config.COLUMN_IP_DEV,str(ip))
+	    gevice.gmodel.treestore.set_value (newiter, config.COLUMN_SERIAL_DEV,str(serial))
+	    gevice.gmodel.treestore.set_value (newiter, config.COLUMN_OBS_DEV,str(comment))
+	    gevice.gmodel.treestore.set_value (newiter, config.COLUMN_LOCATION,str(name_location))
+	    gevice.gmodel.treestore.set_value (newiter, config.COLUMN_ID_LOCATION_DEV,str(id_location))
+	    gevice.gmodel.treestore.set_value (newiter, config.COLUMN_ID_TYPE_LINK_DEV,str(id_link))
+	    gevice.gmodel.treestore.set_value (newiter, config.COLUMN_PTAS_DISP,str(ports))
 
             if i["path"]:
                 gevice.gmodel.treeview.expand_to_path(i["path"][0])
diff --git a/src/gevicefind.py b/src/gevicefind.py
index f136226..310e6c3 100644
--- a/src/gevicefind.py
+++ b/src/gevicefind.py
@@ -1,6 +1,4 @@
-import pygtk
-pygtk.require('2.0')
-import gtk
+from gi.repository import Gtk, Gdk
 import os
 
 import config
@@ -25,7 +23,7 @@ class GeviceFind:
         self.token = []
     
     def load_interface (self,gevice):
-	builder = gtk.Builder()
+	builder = Gtk.Builder()
 	builder.add_from_file(os.path.join (config.UIDIR, "find.xml"))
 	
 	self.window_find = builder.get_object ("window_find")
@@ -47,7 +45,7 @@ class GeviceFind:
 	self.radiobutton_serial.connect ("toggled", self.on_radiobutton_toggled)
 		
 	self.clear_lists()
-	gevice.gmodel.treestore.foreach(self.copy_models_to_lists)
+	gevice.gmodel.treestore.foreach(self.copy_models_to_lists,None)
     
     def show_interface (self):
     	self.window_find.show_all()
@@ -60,7 +58,7 @@ class GeviceFind:
     def on_radiobutton_toggled(self,radiobutton):
         self.entry_find.grab_focus()
     
-    def copy_models_to_lists(self,model,path,iter):
+    def copy_models_to_lists(self,model,path,iter,data):
         data = model.get(iter,config.COLUMN_NAME_DEV,config.COLUMN_IP_DEV,config.COLUMN_SERIAL_DEV)
         
         self.list_names[data[0]] = iter
@@ -77,31 +75,45 @@ class GeviceFind:
 	    self.close_window (window)
     
     def on_button_find_find_clicked(self,button,gevice):
-        if (self.radiobutton_namedevice.get_active() == True):
-	        list = self.list_names
-        elif (self.radiobutton_ip.get_active() == True):
-            list = self.list_ips
-        elif (self.radiobutton_serial.get_active() == True):
-            list = self.list_serials
+      if (self.radiobutton_namedevice.get_active() == True):
+	list = self.list_names
+      elif (self.radiobutton_ip.get_active() == True):
+	list = self.list_ips
+      elif (self.radiobutton_serial.get_active() == True):
+	list = self.list_serials
         
-        sname = self.entry_find.get_text().strip()
+      sname = self.entry_find.get_text().strip()
         
-        for n in list.items():
-            key = n[0]
-            iter = n[1]
+      for n in list.items():
+	key = n[0]
+	iter = n[1]
             
-            res = key.find(sname)
-            if res >= 0:
-                try:
-                    self.token.index(key)
-                except:
-                    self.token.append(key)
-                    selection = gevice.gmodel.treeview.get_selection()
-                    selection.select_iter(iter)
-                    path = gevice.gmodel.treestore.get_path(iter)
-                    gevice.gmodel.treeview.set_cursor(path,None,False)
-                    break
+	res = key.find(sname)
+	if res >= 0:
+	  try:
+	    self.token.index(key)
+	  except:
+	    self.token.append(key)
+	    selection = gevice.gmodel.treeview.get_selection()
+	    
+	    selection.set_mode(Gtk.SelectionMode.BROWSE)
+	    selection.select_iter(iter)
+	    print iter
+
+	    ####
+	    
+	    #first_iter = gevice.gmodel.treestore.get_iter_first()
+	    #path = gevice.gmodel.treestore.get_path(iter)
+	    #selection.select_iter(iter)
+	    #gevice.gmodel.treeview.grab_focus()
+	    ###
+
+	    
+	    #path = gevice.gmodel.treestore.get_path(iter)
+	    
+	    #gevice.gmodel.treeview.set_cursor(path,None,False)
+	    break
     
     def on_entry_find_key_press (self,widget,event,gevice):
-        if gtk.gdk.keyval_name(event.keyval) == "Return":
+        if Gdk.keyval_name(event.keyval) == "Return":
             self.on_button_find_find_clicked(None,gevice)
diff --git a/src/gevicemodel.py b/src/gevicemodel.py
index 8936d28..e4e3ea5 100644
--- a/src/gevicemodel.py
+++ b/src/gevicemodel.py
@@ -1,7 +1,4 @@
-import pygtk
-pygtk.require('2.0')
-import gtk
-import gobject
+from gi.repository import Gtk
 
 import gettext
 gettext.textdomain("gevice")
@@ -11,70 +8,60 @@ import config
 
 class GeviceModel:
     def __init__ (self,gevice):
-        self.treestore = gtk.TreeStore(
-        gobject.TYPE_STRING,
-        gobject.TYPE_STRING,
-        gobject.TYPE_STRING,
-        gobject.TYPE_STRING,
-        gobject.TYPE_STRING,
-        gobject.TYPE_STRING,
-        gobject.TYPE_STRING,
-        gobject.TYPE_STRING,
-        gobject.TYPE_STRING,
-        gobject.TYPE_STRING)
+        self.treestore = Gtk.TreeStore(str,str,str,str,str,str,str,str,str,str)
         
-        self.treeview = gtk.TreeView (self.treestore)
+        self.treeview = Gtk.TreeView (model=self.treestore)
         self.treeview.set_rules_hint (True)
         self.treeview.set_reorderable (True)
         
         # create columns
-        col = gtk.TreeViewColumn (_("Device"))
+        col = Gtk.TreeViewColumn (_("Device"))
         col.set_resizable (True)
         self.treeview.append_column (col)
         
-        cell =  gtk.CellRendererText()
+        cell =  Gtk.CellRendererText()
         col.pack_start (cell,True)
         col.add_attribute (cell,"text",config.COLUMN_NAME_DEV)
 
-        col = gtk.TreeViewColumn (_("Model"))
+        col = Gtk.TreeViewColumn (_("Model"))
         col.set_resizable (True)
         self.treeview.append_column (col)
-        cell =  gtk.CellRendererText()
+        cell =  Gtk.CellRendererText()
         col.pack_start (cell,True)
         col.add_attribute (cell,"text",config.COLUMN_NAME_MODEL_DEV)
 
-        col = gtk.TreeViewColumn (_("IP"))
+        col = Gtk.TreeViewColumn (_("IP"))
         col.set_resizable (True)
         self.treeview.append_column (col)
-        cell =  gtk.CellRendererText()
+        cell =  Gtk.CellRendererText()
         col.pack_start (cell,True)
         col.add_attribute (cell,"text",config.COLUMN_IP_DEV)
 
-        col = gtk.TreeViewColumn (_("Serial"))
+        col = Gtk.TreeViewColumn (_("Serial"))
         col.set_resizable (True)
         self.treeview.append_column (col)
-        cell =  gtk.CellRendererText()
+        cell =  Gtk.CellRendererText()
         col.pack_start (cell,True)
         col.add_attribute (cell,"text",config.COLUMN_SERIAL_DEV)
 
-        col = gtk.TreeViewColumn (_("Comments"))
+        col = Gtk.TreeViewColumn (_("Comments"))
         col.set_resizable (True)
         self.treeview.append_column (col)
-        cell =  gtk.CellRendererText()
+        cell =  Gtk.CellRendererText()
         col.pack_start (cell,True)
         col.add_attribute (cell,"text",config.COLUMN_OBS_DEV)
 
-        col = gtk.TreeViewColumn (_("Location"))
+        col = Gtk.TreeViewColumn (_("Location"))
         col.set_resizable (True)
         self.treeview.append_column (col)
-        cell =  gtk.CellRendererText()
+        cell =  Gtk.CellRendererText()
         col.pack_start (cell,True)
         col.add_attribute (cell,"text",config.COLUMN_LOCATION)        
 
-        col = gtk.TreeViewColumn (_("Ports Availables"))
+        col = Gtk.TreeViewColumn (_("Ports Availables"))
         col.set_resizable (True)
         self.treeview.append_column (col)
-        cell =  gtk.CellRendererText()
+        cell =  Gtk.CellRendererText()
         col.pack_start (cell,True)
         col.add_attribute (cell,"text",config.COLUMN_PTAS_DISP)        
 
@@ -84,19 +71,17 @@ class GeviceModel:
         return
 
     def insert_new_item (self,newiter,row,id_type_link):
-        self.treestore.set (newiter,
-            config.COLUMN_NAME_DEV,row[0][0],
-            config.COLUMN_ID_MODEL_DEV,row[0][1],
-            config.COLUMN_NAME_MODEL_DEV,row[0][2],            
-            config.COLUMN_IP_DEV,row[0][3],
-            config.COLUMN_SERIAL_DEV,row[0][4],
-            config.COLUMN_OBS_DEV,row[0][5],
-            config.COLUMN_LOCATION,row[0][6],
-            config.COLUMN_ID_LOCATION_DEV,row[0][7],
-            config.COLUMN_PTAS_DISP,row[0][8],
-            config.COLUMN_ID_TYPE_LINK_DEV,id_type_link)
-
-
+      self.treestore.set_value (newiter, config.COLUMN_NAME_DEV, str(row[0][0]))
+      self.treestore.set_value (newiter, config.COLUMN_ID_MODEL_DEV, str(row[0][1]))
+      self.treestore.set_value (newiter, config.COLUMN_NAME_MODEL_DEV, str(row[0][2]))
+      self.treestore.set_value (newiter, config.COLUMN_IP_DEV, str(row[0][3]))
+      self.treestore.set_value (newiter, config.COLUMN_SERIAL_DEV, str(row[0][4]))
+      self.treestore.set_value (newiter, config.COLUMN_OBS_DEV, str(row[0][5]))
+      self.treestore.set_value (newiter, config.COLUMN_LOCATION, str(row[0][6]))
+      self.treestore.set_value (newiter, config.COLUMN_ID_LOCATION_DEV, str(row[0][7]))
+      self.treestore.set_value (newiter, config.COLUMN_PTAS_DISP, str(row[0][8]))
+      self.treestore.set_value (newiter, config.COLUMN_ID_TYPE_LINK_DEV, str(id_type_link))
+    
     def on_device_selection_changed (self,selection,gevice):
         model,iter = selection.get_selected()
 
diff --git a/src/geviceprefer.py b/src/geviceprefer.py
index f5f79c0..f08dc24 100644
--- a/src/geviceprefer.py
+++ b/src/geviceprefer.py
@@ -1,9 +1,6 @@
-import pygtk
-pygtk.require('2.0')
-import gtk
+from gi.repository import Gtk, Gdk
 import os
 import gconf
-import gobject
 
 import gettext
 gettext.textdomain("gevice")
@@ -33,7 +30,7 @@ class GevicePrefer:
         
     
     def load_interface (self,gevice):
-	builder = gtk.Builder()
+	builder = Gtk.Builder()
 	builder.add_from_file(os.path.join (config.UIDIR, "pref.xml"))
       
         self.window_prefer = builder.get_object ("window_prefer")
@@ -106,9 +103,9 @@ class GevicePrefer:
                    
         self.flag_load_preferences = False
         
-        col = gtk.TreeViewColumn (_("Users"))
+        col = Gtk.TreeViewColumn (_("Users"))
         self.treeview_users.append_column (col)
-        cell =  gtk.CellRendererText()
+        cell =  Gtk.CellRendererText()
         cell.connect('edited', self.on_name_user_edited,gevice)
         col.pack_start (cell,True)
         cell.set_property('editable',True)
@@ -120,9 +117,7 @@ class GevicePrefer:
         
         for usr in self.listusers:
             iter = gevice.modelusers.append ()
-            gevice.modelusers.set (
-                    iter,
-                    0,usr)
+            gevice.modelusers.set_value (iter,0,usr)
 
 
     def on_name_user_edited(self,cell,path,newname,gevice):
@@ -138,10 +133,10 @@ class GevicePrefer:
         gevice.modelusers.foreach(self.is_newname_in_list, newname)
         
         if not self.is_in_list:
-            gevice.modelusers.set(iter,0,newname)
+            gevice.modelusers.set_value(iter,0,newname)
             self.save_preferences(gevice)
         else:
-        	result = gevice.show_message (_("Name exist: ") + newname,gtk.MESSAGE_INFO,gtk.BUTTONS_OK)
+	    result = gevice.show_message (_("Name exist: ") + newname,None,(Gtk.STOCK_OK, Gtk.ResponseType.OK))
 
 
     def is_newname_in_list(self,model,path,iter,newname):
@@ -163,9 +158,7 @@ class GevicePrefer:
     def on_button_add_user_clicked (self,button,gevice):
         liststore = self.treeview_users.get_model()
         iter = liststore.append ()
-        liststore.set (
-            iter,
-            0,"New")
+        liststore.set_value(iter,0,"New")
             
         path = liststore.get_path(iter)
         self.treeview_users.set_cursor(path,None,False)
@@ -179,9 +172,11 @@ class GevicePrefer:
         
         name = model.get(iter,0)[0]
                 
-        result = gevice.show_message (_("Do you want to remove: ") + name,gtk.MESSAGE_QUESTION,gtk.BUTTONS_YES_NO)
+	result = gevice.show_message (_("Do you want to remove: ") + name,
+	  None,
+	  (Gtk.STOCK_YES, Gtk.ResponseType.YES, Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))
         
-        if result == gtk.RESPONSE_YES:
+        if result == Gtk.ResponseType.YES:
                 model.remove(iter)
                 self.save_preferences(gevice)
             
@@ -193,25 +188,23 @@ class GevicePrefer:
         self.create_color_selection_dialog(_("Select text color"),entry)
 
     def create_color_selection_dialog (self,title,entry):
-        colord = gtk.ColorSelectionDialog(title)
-        colord.ok_button.connect ("clicked", self.get_color_preferences,colord,entry)
-        colord.cancel_button.connect ("clicked", self.close_selection_dialog,colord)
-        
+	# current color
         colorstr = entry.get_text()
-        colorgdk = gtk.gdk.color_parse(colorstr)
-        colord.colorsel.set_current_color(colorgdk)
-        
-        colord.show()
-
-    def get_color_preferences (self,button,dialog,entry):
-        gdkcolor = dialog.colorsel.get_current_color()
-        color = gdkcolor.to_string()
-        
-        entry.set_text(color)
-        self.close_selection_dialog(None,dialog)
+	status, colorgdk = Gdk.color_parse(colorstr)
+	
+        colord = Gtk.ColorSelectionDialog(title)
+	colorselection = colord.get_color_selection()
+	colorselection.set_current_color(colorgdk)	
+	
+	response = colord.run()
+	
+	if response == Gtk.ResponseType.OK:
+	  gdkcolor = colorselection.get_current_color()
+	  color = gdkcolor.to_string()
+	  entry.set_text(color)
+	  print "Colour selected: %s" % color
 
-    def close_selection_dialog(self,button,dialog):
-        dialog.destroy()
+	colord.destroy()
 
     def on_button_close_prefer_clicked (self,button):
         self.close_window (self.window_prefer)
@@ -337,13 +330,13 @@ class GevicePrefer:
             
             # clear list
             self.listusers = []
-            gevice.modelusers.foreach(self.update_list_users)
+            gevice.modelusers.foreach(self.update_list_users,None)
             client.set_list('/apps/gevice/listusers',gconf.VALUE_STRING,self.listusers)
             
             gevice.set_listusers_on_combobox()
             gevice.update_statusbar ()
     
-    def update_list_users(self,model,path,iter):
+    def update_list_users(self,model,path,iter,data):
         username = model.get(iter,0)[0]
         self.listusers.append(username)
         
diff --git a/src/gevicevte.py b/src/gevicevte.py
index b2eaf67..630cf92 100644
--- a/src/gevicevte.py
+++ b/src/gevicevte.py
@@ -1,7 +1,4 @@
-import pygtk
-pygtk.require('2.0')
-import vte
-import gtk.gdk
+from gi.repository import Gtk, Vte, Gdk
 
 import gettext
 gettext.textdomain("gevice")
@@ -14,22 +11,20 @@ class GeviceVte:
         pass
 
     def the_focus (self,widget,event,terminal):
-        if (event.type==gtk.gdk.ENTER_NOTIFY):
+        if (event.type==Gdk.EventType.ENTER_NOTIFY):
             terminal.grab_focus()
     
-    #def button_press (self,widget,event):
-    #    if event.type == gtk.gdk._2BUTTON_PRESS:
-    #        print "double click"
-
 
     def new_terminal (self,gevice):       
-        hbox_term = gtk.HBox(False,0)
+        hbox_term = Gtk.HBox(homogeneous=False,spacing=0)
          
-        terminal = vte.Terminal()
+        terminal = Vte.Terminal()
         terminal.set_mouse_autohide(True)       
         terminal.set_default_colors()
-        terminal.set_color_background(gtk.gdk.color_parse(gevice.gpref.backcolor))
-        terminal.set_color_foreground(gtk.gdk.color_parse(gevice.gpref.forecolor))
+	status,bgcolor = Gdk.color_parse(gevice.gpref.backcolor)
+	terminal.set_color_background(bgcolor)
+	status,fgcolor = Gdk.color_parse(gevice.gpref.forecolor)
+        terminal.set_color_foreground(fgcolor)
         terminal.set_size_request(10,10)
         terminal.set_size (30,1)
         terminal.set_mouse_autohide (True)    
@@ -38,9 +33,10 @@ class GeviceVte:
         terminal.set_word_chars("-A-Za-z0-9,./?%&#:_")
         
         terminal.connect('event',self.the_focus,terminal)
-        #terminal.connect('button_press_event',self.button_press)
+        ###terminal.connect('button_press_event',self.button_press)
        
-        scroll = gtk.VScrollbar(terminal.get_adjustment())
+	adj = terminal.get_vadjustment()
+	scroll = Gtk.VScrollbar.new(adj)
         
         hbox_term.pack_start(terminal,True,True,0)
         hbox_term.pack_start(scroll,False,False,0)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]