]> saetta.ns0.it Git - libgdaexgrid/commitdiff
Migrated from libsolipa to libzakutilsgtk for export to csv.
authorAndrea Zagli <azagli@libero.it>
Fri, 3 Jan 2020 17:38:22 +0000 (18:38 +0100)
committerAndrea Zagli <azagli@libero.it>
Fri, 3 Jan 2020 17:38:22 +0000 (18:38 +0100)
configure.ac
libgdaexgrid.pc.in
src/Makefile.am
src/grid.c
src/grid.h
tests/Makefile.am
tests/grid.c
tests/grid_tree.c

index 718a71122ff12df43b82f2d96dbf0107d50be1d9..60fab7d97a5c2bcc39e1232bb7a5c8c3b6af80dd 100644 (file)
@@ -46,7 +46,8 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
 AM_GLIB_GNU_GETTEXT
 
 # Checks for libraries.
-PKG_CHECK_MODULES(GDAEXGRID, [libgdaex >= 0.5.0])
+PKG_CHECK_MODULES(GDAEXGRID, [libgdaex >= 0.5.0
+                              libzakutilsgtk])
 
 AC_SUBST(GDAEXGRID_CFLAGS)
 AC_SUBST(GDAEXGRID_LIBS)
@@ -62,17 +63,6 @@ AC_SUBST(REPTOOL_CFLAGS)
 AC_SUBST(REPTOOL_LIBS)
 fi
 
-PKG_CHECK_EXISTS(libsolipa >= 0.4.0, [LIBSOLIPA_FOUND=yes], [LIBSOLIPA_FOUND=no])
-
-AM_CONDITIONAL(LIBSOLIPA_FOUND, test $LIBSOLIPA_FOUND = yes)
-
-if test $LIBSOLIPA_FOUND = yes; then
-PKG_CHECK_MODULES(SOLIPA, libsolipa >= 0.4.0)
-
-AC_SUBST(SOLIPA_CFLAGS)
-AC_SUBST(SOLIPA_LIBS)
-fi
-
 # Checks for header files.
 AC_HEADER_STDC
 
index 03562ddf322a65be9b2abe2b8e9018e84680ddca..472792f7b912a4612ee00e6d47507cecf723f2ce 100644 (file)
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: @PACKAGE_NAME@
 Description: A grid (Gtk)widget based on libgda.
 Version: @PACKAGE_VERSION@
-Requires: libgdaex >= 0.5.0
-Libs: -L${libdir} -lgdaexgrid
+Requires: libgdaex >= 0.5.0 libzakutilsgtk
+Libs: -L${libdir} -lgdaexgrid -lzakutilsgtk
 Cflags: -I${includedir}
index 9429b2024e005d65ed6bc442950de59b81b0d026..043def1c1e9a765f0712ea0f8d89ce7ab57a9fb1 100644 (file)
@@ -13,15 +13,6 @@ LIBS += \
         $(REPTOOL_LIBS)
 endif
 
-if LIBSOLIPA_FOUND
-AM_CPPFLAGS += \
-               $(SOLIPA_CFLAGS) \
-               -DSOLIPA_FOUND=1
-
-LIBS += \
-        $(SOLIPA_LIBS)
-endif
-
 lib_LTLIBRARIES = libgdaexgrid.la
 
 libgdaexgrid_la_SOURCES = grid.c \
index 78360445e808c27d9f3436c69da339ff24c58ed3..3e20c7d34424d5263e21e914029f8fa99a3197fa 100644 (file)
@@ -32,9 +32,7 @@
        #include <windows.h>
 #endif
 
-#if defined (REPTOOL_FOUND) || defined (SOLIPA_FOUND)
-       #include <gdk/gdk.h>
-#endif
+#include <gdk/gdk.h>
 
 #ifdef REPTOOL_FOUND
        #include <libreptool/libreptool.h>
@@ -54,21 +52,17 @@ static void gdaex_grid_get_property (GObject *object,
                                GValue *value,
                                GParamSpec *pspec);
 
-#if defined (REPTOOL_FOUND) || defined (SOLIPA_FOUND)
 static gboolean gdaex_grid_on_key_release_event (GtkWidget *widget,
                             GdkEventKey *event,
                             gpointer user_data);
-#endif
 
 #ifdef REPTOOL_FOUND
 static void gdaex_grid_on_print_menu_activate (GtkMenuItem *menuitem,
                                    gpointer user_data);
 #endif
 
-#ifdef SOLIPA_FOUND
 static void gdaex_grid_on_export_menu_activate (GtkMenuItem *menuitem,
                                    gpointer user_data);
-#endif
 
 static gboolean gdaex_grid_on_button_press_event (GtkWidget *widget,
                                                   GdkEventButton *event,
@@ -99,10 +93,6 @@ struct _GdaExGridPrivate
                GtkWidget *menu;
                GtkTreeSelection *selection;
 
-#ifdef SOLIPA_FOUND
-               Solipa *solipa;
-#endif
-
                gchar *app_textdomain;
        };
 
@@ -934,27 +924,6 @@ gdaex_grid_fill_from_sqlbuilder (GdaExGrid *grid, GdaEx *gdaex, GdaExSqlBuilder
        return gdaex_grid_fill_from_sqlbuilder_with_missing_func (grid, gdaex, builder, NULL, NULL, error);
 }
 
-#ifdef SOLIPA_FOUND
-/**
- * gdaex_grid_set_solipa:
- * @grid: a #GdaExGrid object.
- * @solipa: a #Solipa object.
- *
- * Sets the #Solipa object.
- */
-void
-gdaex_grid_set_solipa (GdaExGrid *grid, Solipa *solipa)
-{
-       GdaExGridPrivate *priv;
-
-       g_return_if_fail (GDAEX_IS_GRID (grid));
-
-       priv = GDAEX_GRID_GET_PRIVATE (grid);
-
-       priv->solipa = solipa;
-}
-#endif
-
 /* PRIVATE */
 static void
 gdaex_grid_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
@@ -1208,14 +1177,12 @@ static GtkTreeView
                                          "activate", G_CALLBACK (gdaex_grid_on_print_menu_activate), (gpointer)grid);
 #endif
 
-#ifdef SOLIPA_FOUND
                        mitem = gtk_menu_item_new_with_mnemonic (_("_Export..."));
                        gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), mitem);
                        gtk_widget_show (mitem);
 
                        g_signal_connect (mitem,
                                          "activate", G_CALLBACK (gdaex_grid_on_export_menu_activate), (gpointer)grid);
-#endif
        }
 
 #ifdef REPTOOL_FOUND
@@ -1226,7 +1193,6 @@ static GtkTreeView
        return GTK_TREE_VIEW (priv->view);
 }
 
-#if defined (REPTOOL_FOUND) || defined (SOLIPA_FOUND)
 static gboolean
 gdaex_grid_on_key_release_event (GtkWidget *widget,
                             GdkEventKey *event,
@@ -1246,7 +1212,6 @@ gdaex_grid_on_key_release_event (GtkWidget *widget,
                                }
 #endif
 
-#ifdef SOLIPA_FOUND
                        case GDK_KEY_F11:
                                {
                                        if (event->state & GDK_CONTROL_MASK)
@@ -1256,7 +1221,6 @@ gdaex_grid_on_key_release_event (GtkWidget *widget,
                                                }
                                        break;
                                }
-#endif
 
                        default:
                                break;
@@ -1264,7 +1228,6 @@ gdaex_grid_on_key_release_event (GtkWidget *widget,
 
        return FALSE;
 }
-#endif
 
 #ifdef REPTOOL_FOUND
 static void
@@ -1312,7 +1275,6 @@ gdaex_grid_on_print_menu_activate (GtkMenuItem *menuitem,
 }
 #endif
 
-#ifdef SOLIPA_FOUND
 static void
 gdaex_grid_on_export_menu_activate (GtkMenuItem *menuitem,
                                     gpointer user_data)
@@ -1325,12 +1287,6 @@ gdaex_grid_on_export_menu_activate (GtkMenuItem *menuitem,
 
        priv = GDAEX_GRID_GET_PRIVATE (user_data);
 
-       if (!IS_SOLIPA (priv->solipa))
-               {
-                       g_warning ("No Solipa object found");
-                       return;
-               }
-
        if (priv->columns->len)
                {
                        gstr = g_string_new ("");
@@ -1349,15 +1305,14 @@ gdaex_grid_on_export_menu_activate (GtkMenuItem *menuitem,
 
                        gchar **columns_title = g_strsplit (gstr->str + 1, "|", -1);
 
-                       solipa_gtktreemodel_to_csv_gui (priv->solipa, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (priv->view))), priv->model,
-                                                       columns_title, g_strv_length (columns_title));
+                       zak_utils_gtk_treemodel_to_csv_gui (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (priv->view))), priv->model,
+                                                           columns_title, g_strv_length (columns_title));
 
                        g_strfreev (columns_title);
 
                        return;
                }
 }
-#endif
 
 static gboolean
 gdaex_grid_on_button_press_event (GtkWidget *widget,
index 7b50e90efc8982a0c262ff1abf2a6b74a1191ff2..3037775f09d715733f3aae6c9837cbad0186a2c1 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  grid.h
  *
- *  Copyright (C) 2010-2016 Andrea Zagli <azagli@libero.it>
+ *  Copyright (C) 2010-2019 Andrea Zagli <azagli@libero.it>
  *
  *  This file is part of libgdaexgrid.
  *
@@ -27,9 +27,7 @@
 #include <glib.h>
 #include <glib-object.h>
 
-#ifdef SOLIPA_FOUND
-       #include <libsolipa/libsolipa.h>
-#endif
+#include <libzakutilsgtk/libzakutilsgtk.h>
 
 #include <libgdaex/libgdaex.h>
 #include "gridcolumn.h"
@@ -78,22 +76,22 @@ GtkWidget *gdaex_grid_get_widget (GdaExGrid *grid);
 typedef void (*GdaExGridFillListStoreMissingFunc) (GtkTreeStore *tstore, GtkTreeIter *iter, gpointer user_data);
 
 gboolean gdaex_grid_fill_from_sql_with_missing_func_with_sel (GdaExGrid *grid,
-                                                                                                                         GdaEx *gdaex,
-                                                                                                                         const gchar *sql,
-                                                                                                                         GdaExGridFillListStoreMissingFunc missing_func, gpointer user_data,
-                                                                                                                         GHashTable *ht_sel,
-                                                                                                                         GError **error);
+                                                              GdaEx *gdaex,
+                                                              const gchar *sql,
+                                                              GdaExGridFillListStoreMissingFunc missing_func, gpointer user_data,
+                                                              GHashTable *ht_sel,
+                                                              GError **error);
 gboolean gdaex_grid_fill_from_datamodel_with_missing_func_with_sel (GdaExGrid *grid,
-                                                                                                                                       GdaDataModel *dm,
-                                                                                                                                       GdaExGridFillListStoreMissingFunc missing_func, gpointer user_data,
-                                                                                                                                       GHashTable *ht_sel,
-                                                                                                                                       GError **error);
+                                                                    GdaDataModel *dm,
+                                                                    GdaExGridFillListStoreMissingFunc missing_func, gpointer user_data,
+                                                                    GHashTable *ht_sel,
+                                                                    GError **error);
 gboolean gdaex_grid_fill_from_sqlbuilder_with_missing_func_with_sel (GdaExGrid *grid,
-                                                                                                                                        GdaEx *gdaex,
-                                                                                                                                        GdaExSqlBuilder *sqlbuilder,
-                                                                                                                                        GdaExGridFillListStoreMissingFunc missing_func, gpointer user_data,
-                                                                                                                                        GHashTable *ht_sel,
-                                                                                                                                        GError **error);
+                                                                     GdaEx *gdaex,
+                                                                     GdaExSqlBuilder *sqlbuilder,
+                                                                     GdaExGridFillListStoreMissingFunc missing_func, gpointer user_data,
+                                                                     GHashTable *ht_sel,
+                                                                     GError **error);
 
 gboolean gdaex_grid_fill_from_sql_with_missing_func (GdaExGrid *grid,
                                                      GdaEx *gdaex,
@@ -114,10 +112,6 @@ gboolean gdaex_grid_fill_from_sql (GdaExGrid *grid, GdaEx *gdaex, const gchar *s
 gboolean gdaex_grid_fill_from_datamodel (GdaExGrid *grid, GdaDataModel *dm, GError **error);
 gboolean gdaex_grid_fill_from_sqlbuilder (GdaExGrid *grid, GdaEx *gdaex, GdaExSqlBuilder *builder, GError **error);
 
-#ifdef SOLIPA_FOUND
-void gdaex_grid_set_solipa (GdaExGrid *grid, Solipa *solipa);
-#endif
-
 
 G_END_DECLS
 
index 94539ad8a844ac7aecfe6ba17e347e6f25fd79e3..6fe973c6318686bed1737ba5f8a41ef72a811eb3 100644 (file)
@@ -5,15 +5,6 @@ AM_CPPFLAGS = $(GDAEXGRID_CFLAGS) \
               -I$(top_srcdir)/src \
               -DTESTSDIR="\"@abs_builddir@\""
 
-if LIBSOLIPA_FOUND
-AM_CPPFLAGS += \
-               $(SOLIPA_CFLAGS) \
-               -DSOLIPA_FOUND=1
-
-LIBS += \
-        $(SOLIPA_LIBS)
-endif
-
 if LIBREPTOOL_FOUND
 AM_CPPFLAGS += \
                $(REPTOOL_CFLAGS)
index c5241ccc63919fa08f520c3f3e567d285445a497..2b55dd79f7f6246b7850d58cc627076192b4a69b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011-2015 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2011-2019 Andrea Zagli <azagli@libero.it>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -85,10 +85,6 @@ main (int argc, char **argv)
        grid = gdaex_grid_new ();
        gdaex_grid_set_title (grid, "The grid title");
 
-#ifdef SOLIPA_FOUND
-       gdaex_grid_set_solipa (grid, solipa_new ());
-#endif
-
        gcol = gdaex_grid_column_new ("ID", "id", G_TYPE_INT, TRUE, FALSE, FALSE, FALSE, -1);
        gdaex_grid_add_column (grid, gcol);
 
index 4fd49c475b9d734bc402dfa233f618d7feb7f3cc..b278744ea166f46117fac7c20769b8fc376f3edf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2016-2019 Andrea Zagli <azagli@libero.it>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -54,10 +54,6 @@ main (int argc, char **argv)
        grid = gdaex_grid_new ();
        gdaex_grid_set_title (grid, "The grid title");
 
-#ifdef SOLIPA_FOUND
-       gdaex_grid_set_solipa (grid, solipa_new ());
-#endif
-
        gcol = gdaex_grid_column_new ("ID", "id", G_TYPE_INT, TRUE, FALSE, FALSE, FALSE, -1);
        gdaex_grid_add_column (grid, gcol);