[libgda] Meson: adding libgda-ui/demos



commit 0850c6610c30e7f47906e55f2f99fa718abed857
Author: Daniel Espinosa Ortiz <esodan gmail com>
Date:   Mon Feb 11 19:50:40 2019 -0600

    Meson: adding libgda-ui/demos
    
    Fix issue https://gitlab.gnome.org/GNOME/libgda/issues/175

 libgda-ui/demos/Makefile.am      | 10 ++---
 libgda-ui/demos/data_model_dir.c |  7 +---
 libgda-ui/demos/form_pict.c      |  7 +---
 libgda-ui/demos/geninclude.pl.in | 10 +++--
 libgda-ui/demos/grid_pict.c      |  7 +---
 libgda-ui/demos/meson.build      | 83 ++++++++++++++++++++++++++++++++++++++++
 libgda-ui/meson.build            |  6 ++-
 7 files changed, 106 insertions(+), 24 deletions(-)
---
diff --git a/libgda-ui/demos/Makefile.am b/libgda-ui/demos/Makefile.am
index e41b44660..3c62a5067 100644
--- a/libgda-ui/demos/Makefile.am
+++ b/libgda-ui/demos/Makefile.am
@@ -47,22 +47,22 @@ AM_CPPFLAGS = \
         -DDATADIR=\""$(datadir)"\" \
         -DLIBDIR=\""$(libdir)"\"
 
-bin_PROGRAMS = gdaui-demo-6.0
+bin_PROGRAMS = org.gnome.gda.Demoui
 
 BUILT_SOURCES = demos.h
 
 demos.h: $(demos) geninclude.pl
        (here=`pwd` ; cd $(srcdir) && $(PERL) $$here/geninclude.pl $(demos)) > demos.h
 
-gdaui_demo_6_0_SOURCES =               \
+org_gnome_gda_Demoui_SOURCES =                 \
        $(demos)                \
        demo-common.h           \
        main.c                  \
        demos.h
 
-gdaui_demo_6_0_DEPENDENCIES = $(DEPS)
-gdaui_demo_6_0_LDFLAGS =  $(EXTRALDFLAGS)
-gdaui_demo_6_0_LDADD =  \
+org_gnome_gda_Demoui_DEPENDENCIES = $(DEPS)
+org_gnome_gda_Demoui_LDFLAGS =  $(EXTRALDFLAGS)
+org_gnome_gda_Demoui_LDADD =  \
        $(top_builddir)/libgda/libgda-6.0.la \
        $(top_builddir)/libgda-ui/libgda-ui-6.0.la \
        $(COREDEPS_LIBS) $(GTK_LIBS)
diff --git a/libgda-ui/demos/data_model_dir.c b/libgda-ui/demos/data_model_dir.c
index 529150e42..a23609da0 100644
--- a/libgda-ui/demos/data_model_dir.c
+++ b/libgda-ui/demos/data_model_dir.c
@@ -46,8 +46,7 @@ do_data_model_dir (GtkWidget *do_widget)
                GdaSet *data_set;
                GdaHolder *param;
                gchar *path;
-               GValue *value;
-               
+
                window = gtk_dialog_new_with_buttons ("GdaDataModelDir data model",
                                                      GTK_WINDOW (do_widget),
                                                      0,
@@ -90,9 +89,7 @@ do_data_model_dir (GtkWidget *do_widget)
                data_set = GDA_SET (gdaui_data_selector_get_data_set (GDAUI_DATA_SELECTOR (grid)));
                param = gda_set_get_holder (data_set, "data");
 
-               value = gda_value_new_from_string ("picture", G_TYPE_STRING);
-               gda_holder_set_attribute_static (param, GDAUI_ATTRIBUTE_PLUGIN, value);
-               gda_value_free (value);
+               g_object_set (param, "plugin", "picture", NULL);
        }
 
        gboolean visible;
diff --git a/libgda-ui/demos/form_pict.c b/libgda-ui/demos/form_pict.c
index 18c5166cc..877f74f90 100644
--- a/libgda-ui/demos/form_pict.c
+++ b/libgda-ui/demos/form_pict.c
@@ -22,8 +22,7 @@ do_form_pict (GtkWidget *do_widget)
                GtkWidget *form;
                GdaSet *data_set;
                GdaHolder *param;
-               GValue *value;
-               
+
                window = gtk_dialog_new_with_buttons ("Form with the 'picture' plugin",
                                                      GTK_WINDOW (do_widget),
                                                      0,
@@ -61,9 +60,7 @@ do_form_pict (GtkWidget *do_widget)
                /* specify that we want to use the 'picture' plugin */
                data_set = GDA_SET (gdaui_data_selector_get_data_set (GDAUI_DATA_SELECTOR (form)));
                param = gda_set_get_holder (data_set, "pict");
-               value = gda_value_new_from_string ("picture", G_TYPE_STRING);
-               gda_holder_set_attribute_static (param, GDAUI_ATTRIBUTE_PLUGIN, value);
-               gda_value_free (value);
+               g_object_set (param, "plugin", "pict", NULL);
 
                gtk_box_pack_start (GTK_BOX (vbox), form, TRUE, TRUE, 0);
        }
diff --git a/libgda-ui/demos/geninclude.pl.in b/libgda-ui/demos/geninclude.pl.in
index 771887f6a..345dda604 100755
--- a/libgda-ui/demos/geninclude.pl.in
+++ b/libgda-ui/demos/geninclude.pl.in
@@ -15,21 +15,25 @@ struct _Demo
 
 EOT
 
+use File::Basename;
+
 for $file (@ARGV) {
     my %demo;
     
-    ($basename = $file) =~ s/\.c$//;
 
     open INFO_FILE, $file or die "Cannot open '$file'\n";
     $title = <INFO_FILE>;
     $title =~ s@^\s*/\*\s*@@;
     $title =~ s@\s*$@@;
+    my($filename,$dirs,$prefix) = fileparse($file);
+
+    ($basename = $filename) =~ s/\.c$//;
 
     close INFO_FILE;
 
     print "GtkWidget *do_$basename (GtkWidget *do_widget);\n";
 
-    push @demos, {"title" => $title, "file" => $file,
+    push @demos, {"title" => $title, "file" => $filename,
                  "func"  => "do_$basename"};
 }
 
@@ -160,4 +164,4 @@ print ",\n";
 print qq (  { NULL, NULL, NULL, NULL } );
 print "\n};\n";
 
-exit 0;
+exit 0;
\ No newline at end of file
diff --git a/libgda-ui/demos/grid_pict.c b/libgda-ui/demos/grid_pict.c
index b5d730ef0..ffe08a72a 100644
--- a/libgda-ui/demos/grid_pict.c
+++ b/libgda-ui/demos/grid_pict.c
@@ -22,8 +22,7 @@ do_grid_pict (GtkWidget *do_widget)
                GtkWidget *grid;
                GdaSet *data_set;
                GdaHolder *param;
-               GValue *value;
-               
+
                window = gtk_dialog_new_with_buttons ("Grid with the 'picture' plugin",
                                                      GTK_WINDOW (do_widget),
                                                      0,
@@ -59,9 +58,7 @@ do_grid_pict (GtkWidget *do_widget)
                /* specify that we want to use the 'picture' plugin */
                data_set = GDA_SET (gdaui_data_selector_get_data_set (GDAUI_DATA_SELECTOR (grid)));
                param = gda_set_get_holder (data_set, "pict");
-               value = gda_value_new_from_string ("picture", G_TYPE_STRING);
-               gda_holder_set_attribute_static (param, GDAUI_ATTRIBUTE_PLUGIN, value);
-               gda_value_free (value);
+               g_object_set (param, "plugin", "picture", NULL);
 
                gtk_box_pack_start (GTK_BOX (vbox), grid, TRUE, TRUE, 0);
 
diff --git a/libgda-ui/demos/meson.build b/libgda-ui/demos/meson.build
new file mode 100644
index 000000000..0575b6694
--- /dev/null
+++ b/libgda-ui/demos/meson.build
@@ -0,0 +1,83 @@
+perl = find_program('perl')
+
+if perl.found ()
+
+democonf = configuration_data()
+democonf.set('PERL', perl.path ())
+
+geninclude = configure_file(
+       configuration: democonf,
+       input: 'geninclude.pl.in',
+       output: 'genincluide.pl')
+
+demos = [
+       'basic_form.c',
+       'data_model_dir.c',
+       'form.c',
+       'form_rw.c',
+       'form_pict.c',
+       'form_data_layout.c',
+       'form_model_change.c',
+       'grid.c',
+       'grid_rw.c',
+       'grid_pict.c',
+       'grid_data_layout.c',
+       'grid_model_change.c',
+       'linked_grid_form.c',
+       'linked_model_param.c',
+       'ddl_queries.c',
+       'login.c',
+       'provider_sel.c',
+       'tree.c',
+       'cloud.c',
+       'combo.c',
+       ]
+
+demosh = custom_target('demos.h',
+       command: [
+               perl, '@INPUT@',
+       ],
+       input: [geninclude, demos],
+       output: 'demos.h',
+       capture: true,
+       )
+
+demosh_dep = declare_dependency (sources: demosh)
+
+demo_deps = [
+       libgda_dep,
+       gtk_dep,
+       gtksourceview_dep,
+       inc_rooth_dep,
+       inc_libgdah_dep,
+       inc_sqliteh_dep,
+       demosh_dep,
+       ]
+
+install_data('demo_db.db',
+       install_dir: join_paths(get_option('datadir'), project_package, 'demo')
+       )
+
+install_data('custom_layout.xml',
+       install_dir: join_paths(get_option('datadir'), project_package, 'demo')
+       )
+
+demo_sources = [
+       'main.c',
+       'demo-common.h',
+       demos
+       ]
+
+gdaui_demo = executable('org.gnome.gda.Demoui',
+       demo_sources,
+       link_with: [
+               libgda,
+               libgdaui
+               ],
+       dependencies: demo_deps,
+       c_args: [
+               libgda_ui_cargs,
+       ],
+       )
+
+endif
\ No newline at end of file
diff --git a/libgda-ui/meson.build b/libgda-ui/meson.build
index 8ad7d1094..309dd71c1 100644
--- a/libgda-ui/meson.build
+++ b/libgda-ui/meson.build
@@ -140,7 +140,9 @@ libgdaui = library('gda-ui-'+project_api_version,
                libgda_ui_deps,
                inc_rooth_dep
                ],
-       c_args: libgda_ui_cargs,
+       c_args: [
+               libgda_ui_cargs
+       ],
        link_with: [ libgda ],
        link_args: [
                '-export-dynamic'
@@ -210,3 +212,5 @@ libgdaui_vapi = custom_target('gdaui'+project_api_version+'_vapi',
        install_dir: join_paths(get_option('datadir'),'vala','vapi')
        )
 endif
+
+subdir('demos')
\ No newline at end of file


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