From 0064f91d31ab220a7b704ee8c1dcb728946f4434 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Thu, 23 Dec 2010 15:05:47 +0100 Subject: [PATCH] =?utf8?q?Aggiustamenti=20vari.=20Su=20windows=20va=20in?= =?utf8?q?=20crash=20se=20viene=20inizializzata=20CamelSession=20(per=20ad?= =?utf8?q?esso=20=E8=20disabilitato=20via=20preprocessore).?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- data/libsolipa/gui/libsolipa.ui | 402 +++++++++++++++++--------------- src/camelsession.c | 9 +- src/camelsession.h | 7 +- src/solipa.c | 4 +- src/solipa.h | 12 +- src/utils.c | 18 +- src/utils.h | 4 +- tests/utils.c | 2 +- 8 files changed, 240 insertions(+), 218 deletions(-) diff --git a/data/libsolipa/gui/libsolipa.ui b/data/libsolipa/gui/libsolipa.ui index f738f8d..a0739a2 100644 --- a/data/libsolipa/gui/libsolipa.ui +++ b/data/libsolipa/gui/libsolipa.ui @@ -176,247 +176,261 @@ vertical 5 - + True - 0 - + True - 5 - 5 - 5 - 5 + 0 - + True - vertical - 5 + 5 + 5 + 5 + 5 - + True - True - automatic - automatic - etched-in + vertical + 5 - + True True - lstore_treemodel_campi - False - 0 + automatic + automatic + etched-in - + + True + True + lstore_treemodel_campi + False + 0 + + + + + + 0 + + + + - - - 0 - + + Campo + + + + 2 + + + + + + 0 + + + + + True + 5 + end - - Campo - - - - 2 - - + + Deseleziona tutti + True + True + True + + False + False + 0 + + + + + Seleziona tutti + True + True + True + + + False + False + 1 + + + False + 1 + - - 0 - + + + + + True + <b>Seleziona i campi</b> + True + + + + + 0 + + + + + True + 0 + + + True + 12 - + True - 5 - end + 4 + 2 + 5 + 5 - - Deseleziona tutti + + True + 0 + Quotatura + + + GTK_FILL + GTK_FILL + + + + True True - True + + " - False - False - 0 + 1 + 2 + GTK_FILL + + + + + True + 0 + Quotare tutto + + + 1 + 2 + GTK_FILL + GTK_FILL - - Seleziona tutti + True True - True + False + True - False - False - 1 + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + 0 + Separatore + + + 2 + 3 + GTK_FILL + GTK_FILL + + + + + True + True + + , + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + True + 0 + Nomi dei campi come prima riga + + + 3 + 4 + GTK_FILL + GTK_FILL + + + + + True + True + False + True + + + 1 + 2 + 3 + 4 + GTK_FILL - - 1 - - - - - - True - <b>Seleziona i campi</b> - True - - - - - 0 - - - - - True - True - True - - - True - 4 - 2 - 5 - 5 - + True - 0 - Quotatura - - - GTK_FILL - GTK_FILL - - - - - True - True - - " - - - 1 - 2 - GTK_FILL - - - - - True - 0 - Quotare tutto - - - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - True - False - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - 0 - Separatore - - - 2 - 3 - GTK_FILL - GTK_FILL - - - - - True - True - - , - - - 1 - 2 - 2 - 3 - GTK_FILL - - - - - True - 0 - Nomi dei campi come prima riga - - - 3 - 4 - GTK_FILL - GTK_FILL - - - - - True - True - False - True + <b>Opzioni di esportazione</b> + True - - 1 - 2 - 3 - 4 - GTK_FILL - - - - - True - <b>Opzioni di esportazione</b> - True - + + 1 + - 1 + 0 @@ -434,10 +448,10 @@ True vertical - False False - save False + save + False @@ -451,7 +465,7 @@ - 2 + 1 diff --git a/src/camelsession.c b/src/camelsession.c index c3e0b52..da3892b 100644 --- a/src/camelsession.c +++ b/src/camelsession.c @@ -20,11 +20,10 @@ #include #endif - #include "camelsession.h" static void -class_init (SolipaCamelSessionClass *solipa_camel_session_class) +solipa_camel_session_class_init (SolipaCamelSessionClass *solipa_camel_session_class) { CamelSessionClass *camel_session_class = CAMEL_SESSION_CLASS (solipa_camel_session_class); } @@ -40,7 +39,7 @@ solipa_camel_session_get_type (void) "SolipaCamelSession", sizeof (SolipaCamelSession), sizeof (SolipaCamelSessionClass), - (CamelObjectClassInitFunc) class_init, + (CamelObjectClassInitFunc) solipa_camel_session_class_init, NULL, NULL, NULL); @@ -49,8 +48,8 @@ solipa_camel_session_get_type (void) return type; } -CamelSession * -solipa_camel_session_new (const gchar *path) +CamelSession +*solipa_camel_session_new (const gchar *path) { CamelSession *session; diff --git a/src/camelsession.h b/src/camelsession.h index d628016..5d5df24 100644 --- a/src/camelsession.h +++ b/src/camelsession.h @@ -29,19 +29,16 @@ G_BEGIN_DECLS #define SOLIPA_CAMEL_SESSION(obj) (CAMEL_CHECK_CAST((obj), SOLIPA_CAMEL_SESSION_TYPE, SolipaCamelSession)) #define SOLIPA_CAMEL_SESSION_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), SOLIPA_CAMEL_SESSION_TYPE, SolipaCamelSessionClass)) #define SOLIPA_CAMEL_IS_SESSION(o) (CAMEL_CHECK_TYPE((o), SOLIPA_CAMEL_SESSION_TYPE)) -#define SOLIPA_CAMEL_SESSION_IS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SOLIPA_CAMEL_SESSION_TYPE)) -#define SOLIPA_CAMEL_SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOLIPA_CAMEL_SESSION_TYPE, SolipaCamelSessionClass)) typedef struct _SolipaCamelSession SolipaCamelSession; typedef struct _SolipaCamelSessionClass SolipaCamelSessionClass; -typedef struct _SolipaCamelSession +struct _SolipaCamelSession { CamelSession parent_object; - }; -typedef struct _SolipaCamelSessionClass +struct _SolipaCamelSessionClass { CamelSessionClass parent_class; }; diff --git a/src/solipa.c b/src/solipa.c index 4a6a88e..4556771 100644 --- a/src/solipa.c +++ b/src/solipa.c @@ -39,7 +39,7 @@ static void solipa_get_property (GObject *object, GValue *value, GParamSpec *pspec); -#define SOLIPA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_SOLIPA, SolipaPrivate)) +#define SOLIPA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SOLIPA_TYPE, SolipaPrivate)) typedef struct _SolipaPrivate SolipaPrivate; struct _SolipaPrivate @@ -92,6 +92,7 @@ Solipa solipa = SOLIPA (g_object_new (solipa_get_type (), NULL)); priv = SOLIPA_GET_PRIVATE (solipa); +#ifndef G_OS_WIN32 /* creo la directory temporanea per camel */ camel_tmpdir = g_mkdtemp (g_build_filename (g_get_tmp_dir (), g_strdup ("solipa-camel-XXXXXX"), NULL)); @@ -100,6 +101,7 @@ Solipa camel_provider_init (); priv->camel_session = solipa_camel_session_new (camel_tmpdir); +#endif /* gui */ #ifdef G_OS_WIN32 diff --git a/src/solipa.h b/src/solipa.h index 3b39886..63da836 100644 --- a/src/solipa.h +++ b/src/solipa.h @@ -32,12 +32,12 @@ G_BEGIN_DECLS -#define TYPE_SOLIPA (solipa_get_type ()) -#define SOLIPA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SOLIPA, Solipa)) -#define SOLIPA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SOLIPA, SolipaClass)) -#define IS_SOLIPA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SOLIPA)) -#define IS_SOLIPA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SOLIPA)) -#define SOLIPA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SOLIPA, SolipaClass)) +#define SOLIPA_TYPE (solipa_get_type ()) +#define SOLIPA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOLIPA_TYPE, Solipa)) +#define SOLIPA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SOLIPA_TYPE, SolipaClass)) +#define IS_SOLIPA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOLIPA_TYPE)) +#define IS_SOLIPA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SOLIPA_TYPE)) +#define SOLIPA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOLIPA_TYPE, SolipaClass)) typedef struct _Solipa Solipa; typedef struct _SolipaClass SolipaClass; diff --git a/src/utils.c b/src/utils.c index 6087e46..3cea209 100644 --- a/src/utils.c +++ b/src/utils.c @@ -23,8 +23,7 @@ #include #include -#include - +#include "solipa.h" #include "utils.h" static void solipa_fixed_toggled (GtkCellRendererToggle *cell, @@ -255,9 +254,11 @@ solipa_on_btn_unselect_all_clicked (GtkButton *button, } void -solipa_gtktreemodel_to_csv_gui (Solipa *solipa, GtkTreeModel *model, - gchar **columns_title, - guint n_columns) +solipa_gtktreemodel_to_csv_gui (Solipa *solipa, + GtkWindow *parent, + GtkTreeModel *model, + gchar **columns_title, + guint n_columns) { GtkWidget *diag; GError *error; @@ -274,6 +275,8 @@ solipa_gtktreemodel_to_csv_gui (Solipa *solipa, GtkTreeModel *model, guint *columns; guint _n_columns; + g_return_if_fail (IS_SOLIPA (solipa)); + builder = solipa_get_gtkbuilder (solipa); if (!GTK_IS_BUILDER (builder)) @@ -299,6 +302,10 @@ solipa_gtktreemodel_to_csv_gui (Solipa *solipa, GtkTreeModel *model, diag = GTK_WIDGET (gtk_builder_get_object (builder, "diag_gtktreemodel_to_csv")); if (GTK_IS_WIDGET (diag)) { + /* imposto la directory di default alla directory documenti */ + gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (gtk_builder_get_object (builder, "filechooserwidget1")), + g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS)); + /* carico i nomi campi per la selezione nel model */ store = GTK_LIST_STORE (gtk_builder_get_object (builder, "lstore_treemodel_campi")); @@ -322,6 +329,7 @@ solipa_gtktreemodel_to_csv_gui (Solipa *solipa, GtkTreeModel *model, -1); } + gtk_window_set_transient_for (GTK_WINDOW (diag), parent); do { if (gtk_dialog_run (GTK_DIALOG (diag)) == GTK_RESPONSE_OK) diff --git a/src/utils.h b/src/utils.h index e73d307..843b832 100644 --- a/src/utils.h +++ b/src/utils.h @@ -38,7 +38,9 @@ void solipa_gtktreemodel_to_csv (GtkTreeModel *model, const gchar *filename, guint *columns, guint n_columns); -void solipa_gtktreemodel_to_csv_gui (Solipa *solipa, GtkTreeModel *model, +void solipa_gtktreemodel_to_csv_gui (Solipa *solipa, + GtkWindow *parent, + GtkTreeModel *model, gchar **columns_title, guint n_columns); diff --git a/tests/utils.c b/tests/utils.c index 7e64d4d..c7488ac 100644 --- a/tests/utils.c +++ b/tests/utils.c @@ -72,7 +72,7 @@ main (int argc, char *argv[]) columns, 2); - solipa_gtktreemodel_to_csv_gui (solipa, GTK_TREE_MODEL (model), + solipa_gtktreemodel_to_csv_gui (solipa, NULL, GTK_TREE_MODEL (model), columns_title, 3); return 0; -- 2.49.0