</object>
</child>
</object>
+ <object class="GtkListStore" id="lstore_treemodel_campi">
+ <columns>
+ <!-- column-name selezionato -->
+ <column type="gboolean"/>
+ <!-- column-name nome -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkDialog" id="diag_gtktreemodel_to_csv">
<property name="border_width">5</property>
<property name="title" translatable="yes">Esporta CSV</property>
<object class="GtkFileChooserWidget" id="filechooserwidget1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
+ <property name="action">save</property>
+ <property name="local_only">False</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="button2">
- <property name="label">gtk-ok</property>
+ <property name="label">gtk-save</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
</child>
<action-widgets>
- <action-widget response="0">button1</action-widget>
- <action-widget response="0">button2</action-widget>
+ <action-widget response="-6">button1</action-widget>
+ <action-widget response="-5">button2</action-widget>
</action-widgets>
</object>
- <object class="GtkListStore" id="lstore_treemodel_campi">
- <columns>
- <!-- column-name selezionato -->
- <column type="gboolean"/>
- <!-- column-name nome -->
- <column type="gchararray"/>
- </columns>
- </object>
</interface>
#include <stdlib.h>
+#include <gtk/gtk.h>
+
#include "solipa.h"
static void solipa_class_init (SolipaClass *class);
CamelSession *camel_session;
GdaEx *gdaex;
+
+ gchar *guidir;
+ gchar *guifile;
+ GtkBuilder *gtkbuilder;
};
G_DEFINE_TYPE (Solipa, solipa, G_TYPE_OBJECT)
priv->camel_session = solipa_camel_session_new (camel_tmpdir);
+ /* gui */
+#ifdef G_OS_WIN32
+
+ gchar *moddir;
+ gchar *p;
+
+ moddir = g_win32_get_package_installation_directory_of_module (NULL);
+
+ p = strrchr (moddir, G_DIR_SEPARATOR);
+ if (p != NULL
+ && (g_ascii_strcasecmp (p + 1, "src") == 0
+ || g_ascii_strcasecmp (p + 1, ".libs") == 0))
+ {
+ solipa->guidir = g_strdup (GUIDIR);
+ }
+ else
+ {
+ solipa->guidir = g_build_filename (moddir, "share", PACKAGE, "gui", NULL);
+ }
+
+#else
+
+ priv->guidir = g_strdup (GUIDIR);
+
+#endif
+
+ priv->guifile = g_build_filename (priv->guidir, "libsolipa.ui", NULL);
+
+ priv->gtkbuilder = gtk_builder_new ();
+
return solipa;
}
+Solipa
+*solipa_new_with_keyfile (const gchar *filename)
+{
+ Solipa *solipa;
+
+ solipa = solipa_new ();
+ if (solipa != NULL)
+ {
+ solipa_set_from_keyfile (solipa, filename);
+ }
+
+ return solipa;
+}
+
+void
+solipa_set_from_keyfile (Solipa *solipa, const gchar *filename)
+{
+ gchar *_filename;
+
+ GError *error;
+ GKeyFile *config;
+
+ gchar **config_params;
+ gsize n_params;
+
+ gchar *cnc_string;
+ GdaEx *gdaex;
+
+ g_return_if_fail (IS_SOLIPA (solipa));
+ g_return_if_fail (filename == NULL);
+
+ _filename = g_strstrip (g_strdup (filename));
+ g_return_if_fail (g_strcmp0 (_filename, "") != 0);
+
+ error = NULL;
+ config = g_key_file_new ();
+ if (!g_key_file_load_from_file (config, _filename, G_KEY_FILE_NONE, &error))
+ {
+ g_warning ("Error on loading solipa config from file «%s»: %s.",
+ error != NULL && error->message != NULL ? error->message : "no details");
+ return;
+ }
+ g_error_free (error);
+
+ /* db params */
+ error = NULL;
+ cnc_string = g_key_file_get_value (config, "SOLIPA_DB", "cnc_string", &error);
+ if (cnc_string == NULL)
+ {
+ g_warning ("Error on loading solipa db config from file «%s»: %s.",
+ error != NULL && error->message != NULL ? error->message : "no details");
+ return;
+ }
+
+ gdaex = gdaex_new_from_string (cnc_string);
+ if (gdaex == NULL)
+ {
+ g_warning ("Error on database connection with string: %s", cnc_string);
+ }
+ solipa_set_gdaex (solipa, gdaex);
+
+ g_error_free (error);
+}
+
CamelSession
*solipa_get_camel_session (Solipa *solipa)
{