]> saetta.ns0.it Git - albonline/be/commitdiff
Utilizzo di Territorio::init e Organigramma::init. develop
authorAndrea Zagli <azagli@libero.it>
Sun, 3 Dec 2017 09:56:14 +0000 (10:56 +0100)
committerAndrea Zagli <azagli@libero.it>
Sun, 3 Dec 2017 09:56:14 +0000 (10:56 +0100)
data/albonline/gui/albonline.gui
docs/albonline/examples/albonline.conf
src/main.c

index 58f68141de7164ccfc39ca5f6e7ba0cdb65e8423..8bb7dd6c4aa56221c5772fb3f9598f252565d773 100644 (file)
     <property name="transient_for">w_main</property>
     <property name="program_name">Gestione Albonline</property>
     <property name="version">0.0.2</property>
-    <property name="copyright" translatable="yes">Copyright © 2013-2016 Andrea Zagli &lt;azagli@libero.it&gt;</property>
+    <property name="copyright" translatable="yes">Copyright © 2013-2017 Andrea Zagli &lt;azagli@libero.it&gt;</property>
     <property name="authors"> Andrea Zagli &lt;azagli@libero.it&gt;</property>
     <property name="logo_icon_name">image-missing</property>
     <child internal-child="vbox">
index fb36f0786e82f04718f5db5f2ce24f7cbed96074..05197f52484efc3374ce4603c70717babb97c1aa 100644 (file)
@@ -1,13 +1,14 @@
-[DB_TERRITORIO]
+[TERRITORIO_DB]
 cnc_string=PostgreSQL://postgres:postgres@HOST=localhost;PORT=5432;DB_NAME=territorio
 
-[ZAKAUTHO_TERRITORIO]
+[TERRITORIO_ZAKAUTHO]
 cnc_string=PostgreSQL://postgres:postgres@HOST=localhost;PORT=5432;DB_NAME=autoz
 
-[DB_ORGANIGRAMMA]
+[ORGANIGRAMMA_DB]
+pg_cnc_string=host=localhost dbname=organigramma user=postgres password=postgres
 cnc_string=PostgreSQL://postgres:postgres@HOST=localhost;PORT=5432;DB_NAME=organigramma
 
-[ZAKAUTHO_ORGANIGRAMMA]
+[ORGANIGRAMMA_ZAKAUTHO]
 cnc_string=PostgreSQL://postgres:postgres@HOST=localhost;PORT=5432;DB_NAME=autoz
 
 [libzakauthe]
index 26359dfb22f62f87bb801dff9f208e587c912b32..6d21ed921d12b3ca16e7564bfbb247ac3bbdca26 100644 (file)
@@ -174,16 +174,12 @@ main (int argc, char *argv[])
        GdaConnection *gdacon;
 
        ZakAuthe *aute;
-       gchar **aute_params;
-       gsize n_aute_params;
        GSList *sl_aute_params;
 
        gchar *utente;
 
        gchar *cnc_string;
 
-       gint i;
-
        ZakAuthoIResource *ires1;
 
 #ifdef G_OS_WIN32
@@ -247,15 +243,13 @@ main (int argc, char *argv[])
        /* inizializzazione commons */
        commons = g_new0 (Commons, 1);
 
-       commons->territorio_commons = g_new0 (TerritorioCommons, 1);
-       commons->organigramma_commons = g_new0 (OrganigrammaCommons, 1);
+       commons->territorio_commons = territorio_init (confi, "TERRITORIO_");
+       commons->organigramma_commons = organigramma_init (confi, "ORGANIGRAMMA_");
 
        commons->utente = utente;
        commons->territorio_commons->utente = utente;
        commons->organigramma_commons->utente = utente;
 
-       commons->organigramma_commons->territorio_commons = commons->territorio_commons;
-
        if (argc == 3)
                {
                        commons->pr_cod_prat = strtol (argv[2], NULL, 10);
@@ -274,10 +268,6 @@ main (int argc, char *argv[])
                {
                        commons->guidir = g_strdup (GUIDIR);
                        commons->formdir = g_strdup (FORMDIR);
-                       commons->territorio_commons->guidir = g_build_filename ("/mingw", "share", "territorio", "gui", NULL);
-                       commons->territorio_commons->formdir = g_build_filename ("/mingw", "share", "territorio", "form", NULL);
-                       commons->organigramma_commons->guidir = g_build_filename ("/mingw", "share", "organigramma", "gui", NULL);
-                       commons->organigramma_commons->formdir = g_build_filename ("/mingw", "share", "organigramma", "form", NULL);
                }
        else
                {
@@ -286,26 +276,16 @@ main (int argc, char *argv[])
 
                        commons->guidir = g_build_filename (moddir, "share", PACKAGE, "gui", NULL);
                        commons->formdir = g_build_filename (moddir, "share", PACKAGE, "form", NULL);
-                       commons->territorio_commons->guidir = g_build_filename (moddir, "share", "territorio", "gui", NULL);
-                       commons->territorio_commons->formdir = g_build_filename (moddir, "share", "territorio", "form", NULL);
-                       commons->organigramma_commons->guidir = g_build_filename (moddir, "share", "organigramma", "gui", NULL);
-                       commons->organigramma_commons->formdir = g_build_filename (moddir, "share", "organigramma", "form", NULL);
                }
 
 #else
 
        commons->guidir = g_strdup (GUIDIR);
        commons->formdir = g_strdup (FORMDIR);
-       commons->territorio_commons->guidir = g_build_filename ("/usr", "local", "share", "territorio", "gui", NULL);
-       commons->territorio_commons->formdir = g_build_filename ("/usr", "local", "share", "territorio", "form", NULL);
-       commons->organigramma_commons->guidir = g_build_filename ("/usr", "local", "share", "organigramma", "gui", NULL);
-       commons->organigramma_commons->formdir = g_build_filename ("/usr", "local", "share", "organigramma", "form", NULL);
 
 #endif
 
        commons->guifile = g_build_filename (commons->guidir, "albonline.gui", NULL);
-       commons->territorio_commons->guifile = g_build_filename (commons->territorio_commons->guidir, "territorio.gui", NULL);
-       commons->organigramma_commons->guifile = g_build_filename (commons->organigramma_commons->guidir, "organigramma.gui", NULL);
 
        /* leggo la stringa di connessione al db */
        cnc_string = zak_confi_path_get_value (confi, "DB/cnc_string");
@@ -398,47 +378,6 @@ main (int argc, char *argv[])
        /* inizializzo solipa */
        commons->solipa = solipa_new ();
 
-       /* leggo la stringa di connessione al db territorio */
-       cnc_string = zak_confi_path_get_value (confi, "DB_TERRITORIO/cnc_string");
-       if (cnc_string == NULL)
-               {
-                       g_error ("Impossibile leggere la stringa di connessione dal file di configurazione.");
-               }
-
-       commons->territorio_commons->gdaex = gdaex_new_from_string (cnc_string);
-       if (commons->territorio_commons->gdaex == NULL)
-               {
-                       g_error ("Errore nella connessione al database: %s", cnc_string);
-               }
-
-       /* leggo i parametri per libzakautho di territorio */
-       cnc_string = zak_confi_path_get_value (confi, "ZAKAUTHO_TERRITORIO/cnc_string");
-       if (cnc_string == NULL)
-               {
-                       g_warning ("Impossibile leggere la stringa di connessione per libzakautho dal file di configurazione.");
-                       return 0;
-               }
-
-       error = NULL;
-       gdacon = gda_connection_open_from_string (NULL, cnc_string, NULL, 0, &error);
-       if (gdacon == NULL)
-               {
-                       g_warning ("Impossibile creare la connessione al db per libzakautho di territorio: %s.\n", error != NULL && error->message != NULL ? error->message : "nessun dettaglio");
-                       return 0;
-               }
-
-       commons->territorio_commons->autoz = zak_autho_new ();
-       if (commons->territorio_commons->autoz == NULL)
-               {
-                       g_warning ("Impossibile creare l'oggetto per libzakautho.");
-                       return 0;
-               }
-       if (!zak_autho_load_from_db (commons->territorio_commons->autoz, gdacon, NULL, TRUE))
-               {
-                       g_warning ("Impossibile caricare la configurazione per libzakauto dal db.");
-                       return 0;
-               }
-
        commons->territorio_commons->role_utente = zak_autho_get_role_from_id (commons->territorio_commons->autoz, commons->territorio_commons->utente);
        if (commons->territorio_commons->role_utente == NULL)
                {
@@ -446,47 +385,6 @@ main (int argc, char *argv[])
                        return 0;
                }
 
-       /* leggo la stringa di connessione al db organigramma */
-       cnc_string = zak_confi_path_get_value (confi, "DB_ORGANIGRAMMA/cnc_string");
-       if (cnc_string == NULL)
-               {
-                       g_error ("Impossibile leggere la stringa di connessione dal file di configurazione.");
-               }
-
-       commons->organigramma_commons->gdaex = gdaex_new_from_string (cnc_string);
-       if (commons->organigramma_commons->gdaex == NULL)
-               {
-                       g_error ("Errore nella connessione al database: %s", cnc_string);
-               }
-
-       /* leggo i parametri per libzakautho di organigramma */
-       cnc_string = zak_confi_path_get_value (confi, "ZAKAUTHO_ORGANIGRAMMA/cnc_string");
-       if (cnc_string == NULL)
-               {
-                       g_warning ("Impossibile leggere la stringa di connessione per libzakautho dal file di configurazione.");
-                       return 0;
-               }
-
-       error = NULL;
-       gdacon = gda_connection_open_from_string (NULL, cnc_string, NULL, 0, &error);
-       if (gdacon == NULL)
-               {
-                       g_warning ("Impossibile creare la connessione al db per libzakautho di organigramma: %s.\n", error != NULL && error->message != NULL ? error->message : "nessun dettaglio");
-                       return 0;
-               }
-
-       commons->organigramma_commons->autoz = zak_autho_new ();
-       if (commons->organigramma_commons->autoz == NULL)
-               {
-                       g_warning ("Impossibile creare l'oggetto per libzakautho.");
-                       return 0;
-               }
-       if (!zak_autho_load_from_db (commons->organigramma_commons->autoz, gdacon, NULL, TRUE))
-               {
-                       g_warning ("Impossibile caricare la configurazione per libzakautho dal db.");
-                       return 0;
-               }
-
        commons->organigramma_commons->role_utente = zak_autho_get_role_from_id (commons->organigramma_commons->autoz, commons->organigramma_commons->utente);
        if (commons->organigramma_commons->role_utente == NULL)
                {
@@ -496,8 +394,6 @@ main (int argc, char *argv[])
 
        /* gtkbuilder */
        commons->gtkbuilder = gtk_builder_new ();
-       commons->territorio_commons->gtkbuilder = gtk_builder_new ();
-       commons->organigramma_commons->gtkbuilder = gtk_builder_new ();
 
        error = NULL;
        gtk_builder_add_objects_from_file (commons->gtkbuilder, commons->guifile,