From 5ac428c6250f723b46d14e8e4de1b26c53a0ae65 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Thu, 6 Nov 2014 11:01:12 +0100 Subject: [PATCH] Started migration to gtk3 and libgda5. --- .gitignore | 55 + .in | 22 - autogen.sh | 73 +- configure.ac | 13 +- data/gconfi/glade/gconfi.glade | 2713 ++++++++++++++------------------ src/main.c | 408 +++-- 6 files changed, 1446 insertions(+), 1838 deletions(-) create mode 100644 .gitignore delete mode 100644 .in diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..29e3115 --- /dev/null +++ b/.gitignore @@ -0,0 +1,55 @@ +compile +*~ +*.rpath +*.pot +*.mo +*.gmo +*.o +*.lo +*.la +*.bak +*.stamp +*.tar.gz +*.pc +*.sed +*.sin +*.header +.libs +.deps +ABOUT-NLS +INSTALL +Makefile +Makefile.in +Makefile.in.in +Makevars +aclocal.m4 +autom4te.cache/ +config.guess +config.log +config.sub +config.h.in +configure +depcomp +gtk-doc.make +install-sh +ltmain.sh +m4/ +missing +config.h +config.status +docs/reference/version.xml +docs/reference/html/ +docs/reference/xml/ +libtool +stamp-h1 +tests/test +POTFILES +mkinstalldirs +stamp-it +intltool-* +Rules-quot +*.exe +tests/test +*.csv +gtk-doc.m4 +COPYING diff --git a/.in b/.in deleted file mode 100644 index 0d1e77c..0000000 --- a/.in +++ /dev/null @@ -1,22 +0,0 @@ -/* .in. Generated from configure.ac by autoheader. */ - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Version number of package */ -#undef VERSION diff --git a/autogen.sh b/autogen.sh index 6b2c713..3a7dd78 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,70 +1,23 @@ -#!/bin/sh +#!/bin/bash # Run this to generate all the initial makefiles, etc. srcdir=`dirname $0` test -z "$srcdir" && srcdir=. -ORIGDIR=`pwd` -cd $srcdir -PROJECT=gconfi -TEST_TYPE=-f -FILE=configure.ac +PKG_NAME="gconfi" -DIE=0 - -(autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have autoconf installed to compile $PROJECT." - echo "Install the appropriate package for your distribution," - echo "or get the source tarball at http://ftp.gnu.org/gnu/autoconf/" - DIE=1 +(test -f $srcdir/configure.ac \ + && test -d $srcdir/src \ + && test -f $srcdir/src/main.c) || { + echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" + echo " top-level gconfi directory" + exit 1 } -if automake --version < /dev/null > /dev/null 2>&1 ; then - AUTOMAKE=automake - ACLOCAL=aclocal -else - echo - echo "You must have automake 1.7.x installed to compile $PROJECT." - echo "Install the appropriate package for your distribution," - echo "or get the source tarball at http://ftp.gnu.org/gnu/automake/" - DIE=1 -fi - -if test "$DIE" -eq 1; then - exit 1 -fi - -test $TEST_TYPE $FILE || { - echo "You must run this script in the top-level $PROJECT directory" - exit 1 +which gnome-autogen.sh || { + echo "You need to install gnome-common from GNOME and make" + echo "sure the gnome-autogen.sh script is in your \$PATH." + exit 1 } -if test -z "$AUTOGEN_SUBDIR_MODE"; then - if test -z "$*"; then - echo "I am going to run ./configure with no arguments - if you wish " - echo "to pass any to it, please specify them on the $0 command line." - fi -fi - -rm -rf autom4te.cache - -# README and INSTALL are required by automake, but may be deleted by clean -# up rules. to get automake to work, simply touch these here, they will be -# regenerated from their corresponding *.in files by ./configure anyway. -touch README INSTALL - -$ACLOCAL || exit $? - -autoheader || exit $? - -$AUTOMAKE --add-missing || exit $? -autoconf || exit $? -cd $ORIGDIR || exit $? - -if test -z "$AUTOGEN_SUBDIR_MODE"; then - $srcdir/configure --enable-maintainer-mode $AUTOGEN_CONFIGURE_ARGS "$@" || exit $? - - echo - echo "Now type 'make' to compile $PROJECT." -fi +USE_GNOME2_MACROS=1 . gnome-autogen.sh diff --git a/configure.ac b/configure.ac index eb5a9cb..53b43ae 100644 --- a/configure.ac +++ b/configure.ac @@ -2,10 +2,13 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT([gConfi], [0.0.2], [azagli@inwind.it]) +AC_INIT([gConfi], [0.5.0], [azagli@libero.it]) AC_CONFIG_SRCDIR([src/main.c]) -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE(-Wall) + +m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) + AM_MAINTAINER_MODE AC_CANONICAL_SYSTEM @@ -14,10 +17,8 @@ AC_CANONICAL_SYSTEM AC_PROG_CC # Checks for libraries. -PKG_CHECK_MODULES(GCONFI, [gtk+-2.0 >= 2.8.0 - libglade-2.0 >= 2.5.0 - libxml-2.0 >= 2.6.0 - libconfi >= 0.0.2]) +PKG_CHECK_MODULES(GCONFI, [gtk+-3.0 >= 3.0.0 + libconfi >= 0.5.0]) AC_SUBST(GCONFI_CFLAGS) AC_SUBST(GCONFI_LIBS) diff --git a/data/gconfi/glade/gconfi.glade b/data/gconfi/glade/gconfi.glade index a18c28e..202ce68 100644 --- a/data/gconfi/glade/gconfi.glade +++ b/data/gconfi/glade/gconfi.glade @@ -1,334 +1,14 @@ - - - - - - - 1 - True - gConfi - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - 600 - 400 - True - False - - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - False - - - - - True - False - 0 - - - - True - GTK_PACK_DIRECTION_LTR - GTK_PACK_DIRECTION_LTR - - - - True - _Database - True - - - - - - - True - gtk-new - True - - - - - - - True - gtk-open - True - - - - - - - True - gtk-close - True - - - - - - - True - - - - - - True - gtk-refresh - True - - - - - - - True - - - - - - True - gtk-quit - True - - - - - - - - - - - True - _Configuration - True - - - - - - - True - gtk-new - True - - - - - - - True - New from _schema - True - - - - - - - True - gtk-edit - True - - - - - - - True - gtk-delete - True - - - - - - - True - E_xport - True - - - - - True - gtk-save-as - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - - - - - True - _Key - True - - - - - - - True - gtk-new - True - - - - - - - True - New from _schema - True - - - - - - - True - gtk-edit - True - - - - - - - True - gtk-delete - True - - - - - - - True - E_xport - True - - - - - True - gtk-save-as - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - - - - - True - _Help - True - - - - - - - True - gtk-about - True - - - - - - - - - - 0 - False - False - - - - - - True - True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - False - False - False - - - - - - - - 0 - True - True - - - - - - True - True - - - 0 - False - False - - - - - - - - True - False - gConfi - Copyright (C) 2005 Andrea Zagli - gConfi is free software; you can redistribute it and/or modify + + + + + + + True + False + normal + Copyright (C) 2005-2014 Andrea Zagli + gConfi is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. @@ -342,1213 +22,1164 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - False - Andrea Zagli <azagli@inwind.it> - translator-credits - - - - True - Open - gConfi - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - True - 300 - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - True - - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - -6 - - - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - -5 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 3 - True - 3 - 2 - False - 3 - 3 - - - - True - Provider ID - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - Connection String - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - False - True - - - 1 - 2 - 0 - 1 - fill - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 1 - 2 - - - - - - - True - Configurations Filter - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 2 - 3 - fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 2 - 3 - - - - - - 0 - True - True - - - - - - - - True - Configuration - gConfi - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - True - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - True - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - -6 - - - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - -5 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 3 - True - 3 - 2 - False - 3 - 3 - - - - True - ID - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - Name - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - Description - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 2 - 3 - fill - - - - - - - True - True - False - True - 0 - - True - * - False - - - 1 - 2 - 0 - 1 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 1 - 2 - - - - - - - True - True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - 1 - 2 - 2 - 3 - fill - - - - - 0 - True - True - - - - - - - - True - Key - gConfi - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - True - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - True - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - -6 - - - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - -5 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 3 - True - 6 - 2 - False - 3 - 3 - - - - True - Configuration - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - ID - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - Parent - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 2 - 3 - fill - - - - - - - True - True - False - True - 0 - - True - * - False - - - 1 - 2 - 1 - 2 - - - - - - - True - Name - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 3 - 4 - fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 3 - 4 - - - - - - - True - Value - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 4 - 5 - fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 4 - 5 - - - - - - - True - Description - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 5 - 6 - fill - - - - - - - True - True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - 1 - 2 - 5 - 6 - fill - - - - - - True - False - 0 - - - - True - True - False - True - 0 - - True - * - False - - - 0 - False - False - - - - - - True - True - False - True - 0 - - True - * - False - - - 0 - True - True - - - - - 1 - 2 - 2 - 3 - fill - fill - - - - - - True - False - 0 - - - - True - True - False - True - 0 - - True - * - False - - - 0 - False - False - - - - - - True - True - False - True - 0 - - True - * - False - - - 0 - True - True - - - - - 1 - 2 - 0 - 1 - fill - fill - - - - - 0 - True - True - - - - - - - - True - New - gConfi - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - True - 300 - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - True - - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - -6 - - - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - -5 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 3 - True - 4 - 2 - False - 3 - 3 - - - - True - Provider ID - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - 1° Connection String - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - False - True - - - 1 - 2 - 0 - 1 - fill - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 1 - 2 - - - - - - - True - Database Name - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 2 - 3 - fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 2 - 3 - - - - - - - True - 2° Connection String - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 3 - 4 - fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 3 - 4 - - - - - - 0 - True - True - - - - - - - + Andrea Zagli <azagli@libero.it> + translator-credits + image-missing + + + False + vertical + + + False + + + True + True + 0 + + + + + + + True + False + New - gConfi + True + 300 + dialog + + + + True + False + vertical + + + True + False + end + + + gtk-cancel + True + True + True + False + True + + + False + False + 0 + + + + + gtk-ok + True + True + True + False + True + + + False + False + 1 + + + + + False + True + end + 0 + + + + + True + False + 3 + 4 + 2 + 3 + 3 + + + True + False + 0 + Provider ID + + + GTK_FILL + + + + + + True + False + 0 + 1° Connection String + + + 1 + 2 + GTK_FILL + + + + + + True + False + + + 1 + 2 + GTK_FILL + + + + + True + True + False + False + + + 1 + 2 + 1 + 2 + + + + + + True + False + 0 + Database Name + + + 2 + 3 + GTK_FILL + + + + + + True + True + False + False + + + 1 + 2 + 2 + 3 + + + + + + True + False + 0 + 2° Connection String + + + 3 + 4 + GTK_FILL + + + + + + True + True + False + False + + + 1 + 2 + 3 + 4 + + + + + + True + True + 2 + + + + + + button1 + button2 + + + + True + False + Open - gConfi + True + 300 + dialog + + + + True + False + vertical + + + True + False + end + + + gtk-cancel + True + True + True + False + True + + + False + False + 0 + + + + + gtk-ok + True + True + True + False + True + + + False + False + 1 + + + + + False + True + end + 0 + + + + + True + False + 3 + 3 + 2 + 3 + 3 + + + True + False + 0 + Provider ID + + + GTK_FILL + + + + + + True + False + 0 + Connection String + + + 1 + 2 + GTK_FILL + + + + + + True + False + + + 1 + 2 + GTK_FILL + + + + + True + True + False + False + + + 1 + 2 + 1 + 2 + + + + + + True + False + 0 + Configurations Filter + + + 2 + 3 + GTK_FILL + + + + + + True + True + False + False + + + 1 + 2 + 2 + 3 + + + + + + True + True + 2 + + + + + + cancelbutton1 + okbutton1 + + + + True + False + gtk-save-as + 1 + + + True + False + gtk-save-as + 1 + + + True + False + 1 + gConfi + 600 + 400 + + + + + + + True + False + + + True + False + + + True + False + _Database + True + + + False + + + gtk-new + True + False + True + True + accelgroup1 + + + + + + gtk-open + True + False + True + True + accelgroup1 + + + + + + gtk-close + True + False + True + True + accelgroup1 + + + + + + True + False + + + + + gtk-refresh + True + False + True + True + accelgroup1 + + + + + + True + False + + + + + gtk-quit + True + False + True + True + accelgroup1 + + + + + + + + + + True + False + _Configuration + True + + + False + + + gtk-new + True + False + True + True + accelgroup1 + + + + + + True + False + New from _schema + True + + + + + + gtk-edit + True + False + True + True + accelgroup1 + + + + + + gtk-delete + True + False + True + True + accelgroup1 + + + + + + E_xport + True + False + True + image2 + False + + + + + + + + + + True + False + _Key + True + + + False + + + gtk-new + True + False + True + True + accelgroup1 + + + + + + True + False + New from _schema + True + + + + + + gtk-edit + True + False + True + True + accelgroup1 + + + + + + gtk-delete + True + False + True + True + accelgroup1 + + + + + + E_xport + True + False + True + image3 + False + + + + + + + + + + True + False + _Help + True + + + False + + + gtk-about + True + False + True + True + accelgroup1 + + + + + + + + + + False + False + 0 + + + + + True + True + in + + + True + True + + + + + + + + + + + True + True + 1 + + + + + True + False + + + False + False + 2 + + + + + + + + True + False + Configuration - gConfi + True + dialog + + + True + False + vertical + + + True + False + end + + + gtk-cancel + True + True + True + False + True + + + False + False + 0 + + + + + gtk-ok + True + True + True + False + True + + + False + False + 1 + + + + + False + True + end + 0 + + + + + True + False + 3 + 3 + 2 + 3 + 3 + + + True + False + 0 + ID + + + GTK_FILL + + + + + + True + False + 0 + Name + + + 1 + 2 + GTK_FILL + + + + + + True + False + 0 + Description + + + 2 + 3 + GTK_FILL + + + + + + True + True + False + False + False + + + 1 + 2 + + + + + + True + True + False + False + + + 1 + 2 + 1 + 2 + + + + + + True + True + in + + + True + True + word + textbuffer1 + + + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + True + True + 2 + + + + + + btnCancel + btnOk + + + + + True + False + Key - gConfi + True + dialog + + + True + False + vertical + + + True + False + end + + + gtk-cancel + True + True + True + False + True + + + False + False + 0 + + + + + gtk-ok + True + True + True + False + True + + + False + False + 1 + + + + + False + True + end + 0 + + + + + True + False + 3 + 6 + 2 + 3 + 3 + + + True + False + 0 + Configuration + + + GTK_FILL + + + + + + True + False + 0 + ID + + + 1 + 2 + GTK_FILL + + + + + + True + False + 0 + Parent + + + 2 + 3 + GTK_FILL + + + + + + True + True + False + False + False + + + 1 + 2 + 1 + 2 + + + + + + True + False + 0 + Name + + + 3 + 4 + GTK_FILL + + + + + + True + True + False + False + + + 1 + 2 + 3 + 4 + + + + + + True + False + 0 + Value + + + 4 + 5 + GTK_FILL + + + + + + True + True + False + False + + + 1 + 2 + 4 + 5 + + + + + + True + False + 0 + Description + + + 5 + 6 + GTK_FILL + + + + + + True + True + in + + + True + True + word + textbuffer2 + + + + + 1 + 2 + 5 + 6 + GTK_FILL + + + + + True + False + + + True + True + False + False + False + + + False + False + 0 + + + + + True + True + False + False + False + + + True + True + 1 + + + + + 1 + 2 + 2 + 3 + GTK_FILL + GTK_FILL + + + + + True + False + + + True + True + False + False + False + + + False + False + 0 + + + + + True + True + False + False + False + + + True + True + 1 + + + + + 1 + 2 + GTK_FILL + GTK_FILL + + + + + True + True + 2 + + + + + + btnCancel1 + btnOk1 + + + diff --git a/src/main.c b/src/main.c index ce25b13..df6380f 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2006 Andrea Zagli + * Copyright (C) 2005-2014 Andrea Zagli * * 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 @@ -19,8 +19,7 @@ #include #include -#include -#include +#include #include #include #include @@ -37,23 +36,22 @@ enum FOLDERS_COLS }; -static GtkWidget *w, - *trFolders, - *mnuConfigs, - *mnuConfigsEdit, - *mnuKeys, - *mnuKeysEdit, - *mnuDbClose, - *mnuDbRefresh, - *stbar; +static GtkWidget *w; +static GtkWidget *trFolders; +static GtkWidget *mnuConfigs; +static GtkWidget *mnuConfigsEdit; +static GtkWidget *mnuKeys; +static GtkWidget *mnuKeysEdit; +static GtkWidget *mnuDbClose; +static GtkWidget *mnuDbRefresh; +static GtkWidget *stbar; static GtkTreeStore *storeFolders; static GtkTreeSelection *selFolders; -static gchar *provider_id, - *cnc_string, - *filter; +static gchar *cnc_string; +static gchar *filter; void on_mnuConfigsNew_activate (GtkMenuItem *menuitem, gpointer user_data); void on_mnuConfigsEdit_activate (GtkMenuItem *menuitem, gpointer user_data); @@ -122,12 +120,12 @@ fill_trFolders_Keys (GNode *node, GtkTreeIter parent) gtk_tree_store_append (storeFolders, &child, &parent); gtk_tree_store_set (storeFolders, &child, - FOLDERS_COL_ID, ck->id, - FOLDERS_COL_NAME, ck->key, - FOLDERS_COL_DESCRIPTION, ck->description, - FOLDERS_COL_VALUE, ck->value, - FOLDERS_COL_OBJPTR, ck, - -1); + FOLDERS_COL_ID, ck->id, + FOLDERS_COL_NAME, ck->key, + FOLDERS_COL_DESCRIPTION, ck->description, + FOLDERS_COL_VALUE, ck->value, + FOLDERS_COL_OBJPTR, ck, + -1); fill_trFolders_Keys (node, child); @@ -136,11 +134,11 @@ fill_trFolders_Keys (GNode *node, GtkTreeIter parent) } static gboolean -fill_trFolders (const gchar *provider_id, const gchar *cnc_string, const gchar *filter) +fill_trFolders (const gchar *cnc_string, const gchar *filter) { gboolean ret = FALSE; - GList *lstConfigs = confi_get_configs_list (NULL, provider_id, cnc_string, filter); + GList *lstConfigs = confi_get_configs_list (cnc_string, filter); gtk_tree_store_clear (storeFolders); @@ -150,8 +148,8 @@ fill_trFolders (const gchar *provider_id, const gchar *cnc_string, const gchar * Confi *confi; GdaDataModel *dmKeys; gint id; - gchar *name, - *description; + gchar *name; + gchar *description; GNode *tree; lstConfigs = g_list_first (lstConfigs); @@ -160,18 +158,18 @@ fill_trFolders (const gchar *provider_id, const gchar *cnc_string, const gchar * confi = (Confi *)lstConfigs->data; g_object_get (G_OBJECT (confi), - "id_config", &id, - "name", &name, - "description", &description, - NULL); + "id_config", &id, + "name", &name, + "description", &description, + NULL); gtk_tree_store_append (storeFolders, &iter, NULL); gtk_tree_store_set (storeFolders, &iter, - FOLDERS_COL_ID, id, - FOLDERS_COL_NAME, name, - FOLDERS_COL_DESCRIPTION, description, - FOLDERS_COL_OBJPTR, confi, - -1); + FOLDERS_COL_ID, id, + FOLDERS_COL_NAME, name, + FOLDERS_COL_DESCRIPTION, description, + FOLDERS_COL_OBJPTR, confi, + -1); tree = confi_get_tree (confi); if (tree != NULL) @@ -241,8 +239,8 @@ view_trFolders_popup_menu (GdkEventButton *event) gtk_widget_show_all (menu); gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, - (event != NULL) ? event->button : 0, - gdk_event_get_time ((GdkEvent*)event)); + (event != NULL) ? event->button : 0, + gdk_event_get_time ((GdkEvent*)event)); } } @@ -384,7 +382,7 @@ create_config_from_xml (xmlNode *xnode, xmlXPathContextPtr xpcontext) if (xnodeset->nodeNr == 1) { - confi = confi_new (NULL, provider_id, cnc_string, + confi = confi_new (cnc_string, (const gchar *)xmlNodeGetContent (xnodeset->nodeTab[0]), NULL, TRUE); if (confi != NULL) { @@ -486,8 +484,8 @@ load_xml_configuration_schema (const gchar *filename) Confi *confi; gtk_tree_model_get (GTK_TREE_MODEL (storeFolders), &iter, - FOLDERS_COL_OBJPTR, &confi, - -1); + FOLDERS_COL_OBJPTR, &confi, + -1); create_key_from_xml (confi, "", &iter, xnode, xpcontext); } @@ -502,12 +500,12 @@ load_xml_configuration_schema (const gchar *filename) ConfiKey *ck; gtk_tree_model_get (GTK_TREE_MODEL (storeFolders), &iterConfi, - FOLDERS_COL_OBJPTR, &confi, - -1); + FOLDERS_COL_OBJPTR, &confi, + -1); gtk_tree_model_get (GTK_TREE_MODEL (storeFolders), &iter, - FOLDERS_COL_OBJPTR, &ck, - -1); + FOLDERS_COL_OBJPTR, &ck, + -1); if (IS_CONFI (confi)) { @@ -544,13 +542,13 @@ void on_mnuDbNew_activate (GtkMenuItem *menuitem, gpointer user_data) { - GladeXML *glaOpenDbCfg = glade_xml_new (GLADEDIR "/gconfi.glade", "diagNewDbCfg", NULL); - GtkWidget *diag = glade_xml_get_widget (glaOpenDbCfg, "diagNewDbCfg"); - - GtkWidget *cbProvider = glade_xml_get_widget (glaOpenDbCfg, "cbProvider"), - *txtCncString1 = glade_xml_get_widget (glaOpenDbCfg, "txtCncString1"), - *txtDbName = glade_xml_get_widget (glaOpenDbCfg, "txtDbName"), - *txtCncString2 = glade_xml_get_widget (glaOpenDbCfg, "txtCncString2"); + GtkBuilder *glaOpenDbCfg = gtk_builder_new_from_file (GLADEDIR "/gconfi.glade"); + GtkWidget *diag = GTK_WIDGET (gtk_builder_get_object (glaOpenDbCfg, "diagNewDbCfg")); + + GtkWidget *cbProvider = GTK_WIDGET (gtk_builder_get_object (glaOpenDbCfg, "cbProvider")); + GtkWidget *txtCncString1 = GTK_WIDGET (gtk_builder_get_object (glaOpenDbCfg, "txtCncString1")); + GtkWidget *txtDbName = GTK_WIDGET (gtk_builder_get_object (glaOpenDbCfg, "txtDbName")); + GtkWidget *txtCncString2 = GTK_WIDGET (gtk_builder_get_object (glaOpenDbCfg, "txtCncString2")); GtkListStore *store; GtkTreeIter iter; @@ -565,31 +563,31 @@ on_mnuDbNew_activate (GtkMenuItem *menuitem, "text", 0); /* fill providers list */ - GList *providers = gda_config_get_provider_list (); + GdaDataModel *providers = gda_config_list_providers (); if (providers != NULL) { - do { - GdaProviderInfo *pi = (GdaProviderInfo *)providers->data; + int i; + for (i = 0; i < gda_data_model_get_n_rows (providers); i++) + { + GdaProviderInfo *pi = gda_config_get_provider_info (gdaex_data_model_get_value_stringify_at (providers, 0, 0)); - gtk_list_store_append (store, &iter); - gtk_list_store_set (store, &iter, 0, pi->id, -1); - } while ((providers = g_list_next (providers)) != NULL); + gtk_list_store_append (store, &iter); + gtk_list_store_set (store, &iter, 0, pi->id, -1); + } - gda_config_free_provider_list (providers); + g_object_unref (providers); } if (gtk_dialog_run (GTK_DIALOG (diag)) == GTK_RESPONSE_OK) { - provider_id = g_strstrip (g_strdup (gtk_combo_box_get_active_text (GTK_COMBO_BOX (cbProvider)))); cnc_string = g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (txtCncString1)))); gchar *dbName = g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (txtDbName)))); - if (strcmp (provider_id, "") != 0 && - strcmp (cnc_string, "") != 0) + if (strcmp (cnc_string, "") != 0) { - GdaO *gdao = gdao_new_from_string (NULL, provider_id, cnc_string); + GdaEx *gdao = gdaex_new_from_string (cnc_string); if (gdao != NULL) { - GdaConnection *gdaConn = (GdaConnection *)gdao_get_gdaconnection (gdao); + GdaConnection *gdaConn = (GdaConnection *)gdaex_get_gdaconnection (gdao); if (gdaConn == NULL) { /* TO DO */ @@ -602,24 +600,24 @@ on_mnuDbNew_activate (GtkMenuItem *menuitem, cnc_string = g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (txtCncString2)))); if (strcmp (cnc_string, "") != 0) { - if (!gda_connection_create_database (gdaConn, dbName)) + GError *error; + GdaServerOperation *op = gda_server_operation_prepare_create_database (gda_connection_get_provider_name (gdaConn), dbName, &error); + if (op == NULL || error != NULL) { /* TO DO */ - g_fprintf(stderr,"error on database creation\n"); + g_fprintf(stderr,"error on database creation\n%s", + error != NULL && error->message != NULL ? error->message : "no details"); gdao = NULL; } else { - if (!gda_connection_change_database (gdaConn, dbName)) + gda_connection_close (gdaConn); + gdao = gdaex_new_from_string (cnc_string); + if (gdao == NULL) { - gda_connection_close (gdaConn); - gdao = gdao_new_from_string (NULL, provider_id, cnc_string); - if (gdao == NULL) - { - /* TO DO */ - g_fprintf(stderr,"error on second connection\n"); - gdao = NULL; - } + /* TO DO */ + g_fprintf(stderr,"error on second connection\n"); + gdao = NULL; } } } @@ -633,7 +631,7 @@ on_mnuDbNew_activate (GtkMenuItem *menuitem, if (gdao != NULL) { - if (gdao_execute (gdao, "CREATE TABLE configs " + if (gdaex_execute (gdao, "CREATE TABLE configs " "(" " id integer NOT NULL, " " name varchar(100) DEFAULT '', " @@ -650,11 +648,6 @@ on_mnuDbNew_activate (GtkMenuItem *menuitem, gchar chrquot = '\"'; gchar *sql; - if (strcmp (provider_id, "MySQL") == 0) - { - chrquot = '`'; - } - sql = g_strdup_printf ("CREATE TABLE %cvalues%c " "(" " id_configs integer NOT NULL, " @@ -668,14 +661,14 @@ on_mnuDbNew_activate (GtkMenuItem *menuitem, ")", chrquot, chrquot, chrquot, chrquot, chrquot, chrquot); - if (gdao_execute (gdao, sql) == -1) + if (gdaex_execute (gdao, sql) == -1) { /* TO DO */ gdao = NULL; } else { - if (fill_trFolders (provider_id, cnc_string, NULL)) + if (fill_trFolders (cnc_string, NULL)) { gtk_widget_set_sensitive (mnuDbClose, TRUE); gtk_widget_set_sensitive (mnuDbRefresh, TRUE); @@ -684,7 +677,7 @@ on_mnuDbNew_activate (GtkMenuItem *menuitem, gtk_statusbar_pop (GTK_STATUSBAR (stbar), 0); gtk_statusbar_push (GTK_STATUSBAR (stbar), 0, - g_strconcat ("Provider: ", provider_id, " - Connection string: ", cnc_string, NULL)); + g_strconcat ("Connection string: ", cnc_string, NULL)); } } } @@ -701,12 +694,12 @@ void on_mnuDbOpen_activate (GtkMenuItem *menuitem, gpointer user_data) { - GladeXML *glaOpenDbCfg = glade_xml_new (GLADEDIR "/gconfi.glade", "diagOpenDbCfg", NULL); - GtkWidget *diag = glade_xml_get_widget (glaOpenDbCfg, "diagOpenDbCfg"); + GtkBuilder *glaOpenDbCfg = gtk_builder_new_from_file (GLADEDIR "/gconfi.glade"); + GtkWidget *diag = GTK_WIDGET (gtk_builder_get_object (glaOpenDbCfg, "diagOpenDbCfg")); - GtkWidget *cbProvider = glade_xml_get_widget (glaOpenDbCfg, "cbProvider"), - *txtCncString = glade_xml_get_widget (glaOpenDbCfg, "txtCncString"), - *txtConfigsFilter = glade_xml_get_widget (glaOpenDbCfg, "txtConfigsFilter"); + GtkWidget *cbProvider = GTK_WIDGET (gtk_builder_get_object (glaOpenDbCfg, "cbProvider")); + GtkWidget *txtCncString = GTK_WIDGET (gtk_builder_get_object (glaOpenDbCfg, "txtCncString")); + GtkWidget *txtConfigsFilter = GTK_WIDGET (gtk_builder_get_object (glaOpenDbCfg, "txtConfigsFilter")); GtkListStore *store; GtkTreeIter iter; @@ -721,28 +714,28 @@ on_mnuDbOpen_activate (GtkMenuItem *menuitem, "text", 0); /* fill providers list */ - GList *providers = gda_config_get_provider_list (); + GdaDataModel *providers = gda_config_list_providers (); if (providers != NULL) { - do { - GdaProviderInfo *pi = (GdaProviderInfo *)providers->data; + int i; + for (i = 0; i < gda_data_model_get_n_rows (providers); i++) + { + GdaProviderInfo *pi = gda_config_get_provider_info (gdaex_data_model_get_value_stringify_at (providers, 0, 0)); - gtk_list_store_append (store, &iter); - gtk_list_store_set (store, &iter, 0, pi->id, -1); - - } while ((providers = g_list_next (providers)) != NULL); + gtk_list_store_append (store, &iter); + gtk_list_store_set (store, &iter, 0, pi->id, -1); + } - gda_config_free_provider_list (providers); + g_object_unref (providers); } if (gtk_dialog_run (GTK_DIALOG (diag)) == GTK_RESPONSE_OK) { - provider_id = g_strdup (gtk_combo_box_get_active_text (GTK_COMBO_BOX (cbProvider))); cnc_string = g_strdup (gtk_entry_get_text (GTK_ENTRY (txtCncString))); - if (provider_id != NULL && cnc_string != NULL) + if (cnc_string != NULL) { filter = (gchar *)gtk_entry_get_text (GTK_ENTRY (txtConfigsFilter)); - if (fill_trFolders (provider_id, cnc_string, filter)) + if (fill_trFolders (cnc_string, filter)) { gtk_widget_set_sensitive (mnuDbClose, TRUE); gtk_widget_set_sensitive (mnuDbRefresh, TRUE); @@ -751,7 +744,7 @@ on_mnuDbOpen_activate (GtkMenuItem *menuitem, gtk_statusbar_pop (GTK_STATUSBAR (stbar), 0); gtk_statusbar_push (GTK_STATUSBAR (stbar), 0, - g_strconcat ("Provider: ", provider_id, " - Connection string: ", cnc_string, NULL)); + g_strconcat ("Connection string: ", cnc_string, NULL)); } } } @@ -763,7 +756,6 @@ void on_mnuDbClose_activate (GtkMenuItem *menuitem, gpointer user_data) { - provider_id = g_strdup (""); cnc_string = g_strdup (""); /* TO DO */ @@ -783,29 +775,29 @@ void on_mnuDbRefresh_activate (GtkMenuItem *menuitem, gpointer user_data) { - fill_trFolders (provider_id, cnc_string, filter); + fill_trFolders (cnc_string, filter); } void on_mnuConfigsNew_activate (GtkMenuItem *menuitem, gpointer user_data) { - GladeXML *glaCNew = glade_xml_new (GLADEDIR "/gconfi.glade", "wConfiguration", NULL); - GtkWidget *diag = glade_xml_get_widget (glaCNew, "wConfiguration"); + GtkBuilder *glaCNew = gtk_builder_new_from_file (GLADEDIR "/gconfi.glade"); + GtkWidget *diag = GTK_WIDGET (gtk_builder_get_object (glaCNew, "wConfiguration")); if (gtk_dialog_run (GTK_DIALOG (diag)) == GTK_RESPONSE_OK) { - GtkWidget *txtName, - *txtvDescription, - *fcbSchema; + GtkWidget *txtName; + GtkWidget *txtvDescription; + GtkWidget *fcbSchema; GtkTextBuffer *buffer; GtkTextIter iter1, iter2; - gchar *name, - *description; + gchar *name; + gchar *description; Confi *confi; - txtName = glade_xml_get_widget (glaCNew, "txtName"); - txtvDescription = glade_xml_get_widget (glaCNew, "txtvDescription"); + txtName = GTK_WIDGET (gtk_builder_get_object (glaCNew, "txtName")); + txtvDescription = GTK_WIDGET (gtk_builder_get_object (glaCNew, "txtvDescription")); name = (gchar *)gtk_entry_get_text (GTK_ENTRY (txtName)); @@ -813,7 +805,7 @@ on_mnuConfigsNew_activate (GtkMenuItem *menuitem, gtk_text_buffer_get_bounds (buffer, &iter1, &iter2); description = gtk_text_buffer_get_text (buffer, &iter1, &iter2, FALSE); - confi = confi_new (NULL, provider_id, cnc_string, + confi = confi_new (cnc_string, name, NULL, TRUE); if (confi != NULL) @@ -875,26 +867,26 @@ on_mnuConfigsEdit_activate (GtkMenuItem *menuitem, { Confi *confi; - GladeXML *glaConfig = glade_xml_new (GLADEDIR "/gconfi.glade", "wConfiguration", NULL); - GtkWidget *diag = glade_xml_get_widget (glaConfig, "wConfiguration"), - *txtID = glade_xml_get_widget (glaConfig, "txtID"), - *txtName = glade_xml_get_widget (glaConfig, "txtName"), - *txtvDescription = glade_xml_get_widget (glaConfig, "txtvDescription"); + GtkBuilder *glaConfig = gtk_builder_new_from_file (GLADEDIR "/gconfi.glade"); + GtkWidget *diag = GTK_WIDGET (gtk_builder_get_object (glaConfig, "wConfiguration")); + GtkWidget *txtID = GTK_WIDGET (gtk_builder_get_object (glaConfig, "txtID")); + GtkWidget *txtName = GTK_WIDGET (gtk_builder_get_object (glaConfig, "txtName")); + GtkWidget *txtvDescription = GTK_WIDGET (gtk_builder_get_object (glaConfig, "txtvDescription")); GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (txtvDescription)); gint id; - gchar *name, - *description; + gchar *name; + gchar *description; gtk_tree_model_get (GTK_TREE_MODEL (storeFolders), &iter, - FOLDERS_COL_OBJPTR, &confi, - -1); + FOLDERS_COL_OBJPTR, &confi, + -1); g_object_get (G_OBJECT (confi), - "id_config", &id, - "name", &name, - "description", &description, - NULL); + "id_config", &id, + "name", &name, + "description", &description, + NULL); gtk_entry_set_text (GTK_ENTRY (txtID), g_strdup_printf ("%d", id)); gtk_entry_set_text (GTK_ENTRY (txtName), name); @@ -909,15 +901,15 @@ on_mnuConfigsEdit_activate (GtkMenuItem *menuitem, description = gtk_text_buffer_get_text (buffer, &iter1, &iter2, FALSE); g_object_set (G_OBJECT (confi), - "name", name, - "description", description, - NULL); + "name", name, + "description", description, + NULL); gtk_tree_store_set (storeFolders, &iter, - FOLDERS_COL_NAME, name, - FOLDERS_COL_DESCRIPTION, description, + FOLDERS_COL_NAME, name, + FOLDERS_COL_DESCRIPTION, description, FOLDERS_COL_OBJPTR, confi, - -1); + -1); } gtk_widget_destroy (diag); @@ -939,15 +931,15 @@ on_mnuConfigsDelete_activate (GtkMenuItem *menuitem, Confi *confi; gtk_tree_model_get (GTK_TREE_MODEL (storeFolders), &iter, - FOLDERS_COL_OBJPTR, &confi, - -1); + FOLDERS_COL_OBJPTR, &confi, + -1); if (IS_CONFI (confi)) { GtkWidget *diag = gtk_message_dialog_new (GTK_WINDOW (w), - GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_YES_NO, - "Are you sure you want to delete the selected configuration from database?"); + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + "Are you sure you want to delete the selected configuration from database?"); if (gtk_dialog_run (GTK_DIALOG (diag)) == GTK_RESPONSE_YES) { if (confi_remove (confi)) @@ -1011,7 +1003,7 @@ on_mnuConfigsExport_activate (GtkMenuItem *menuitem, else { /* saving all configurations */ - GList *configs = confi_get_configs_list (NULL, provider_id, cnc_string, filter); + GList *configs = confi_get_configs_list (cnc_string, filter); if (configs != NULL) { xmlDocPtr xdoc; @@ -1054,20 +1046,20 @@ on_mnuKeysNew_activate (GtkMenuItem *menuitem, { Confi *confi; ConfiKey *ck; - GladeXML *glaKey = glade_xml_new (GLADEDIR "/gconfi.glade", "wKey", NULL); - GtkWidget *diag = glade_xml_get_widget (glaKey, "wKey"), - *txtIDConfig = glade_xml_get_widget (glaKey, "txtIDConfig"), - *txtConfig = glade_xml_get_widget (glaKey, "txtConfig"), - *txtID = glade_xml_get_widget (glaKey, "txtID"), - *txtIDParent = glade_xml_get_widget (glaKey, "txtIDParent"), - *txtParent = glade_xml_get_widget (glaKey, "txtParent"), - *txtName = glade_xml_get_widget (glaKey, "txtName"), - *txtValue = glade_xml_get_widget (glaKey, "txtValue"), - *txtvDescription = glade_xml_get_widget (glaKey, "txtvDescription"); + GtkBuilder *glaKey = gtk_builder_new_from_file (GLADEDIR "/gconfi.glade"); + GtkWidget *diag = GTK_WIDGET (gtk_builder_get_object (glaKey, "wKey")); + GtkWidget *txtIDConfig = GTK_WIDGET (gtk_builder_get_object (glaKey, "txtIDConfig")); + GtkWidget *txtConfig = GTK_WIDGET (gtk_builder_get_object (glaKey, "txtConfig")); + GtkWidget *txtID = GTK_WIDGET (gtk_builder_get_object (glaKey, "txtID")); + GtkWidget *txtIDParent = GTK_WIDGET (gtk_builder_get_object (glaKey, "txtIDParent")); + GtkWidget *txtParent = GTK_WIDGET (gtk_builder_get_object (glaKey, "txtParent")); + GtkWidget *txtName = GTK_WIDGET (gtk_builder_get_object (glaKey, "txtName")); + GtkWidget *txtValue = GTK_WIDGET (gtk_builder_get_object (glaKey, "txtValue")); + GtkWidget *txtvDescription = GTK_WIDGET (gtk_builder_get_object (glaKey, "txtvDescription")); GtkTreeIter iterConfi; gint id_config; - gchar *name, - *keyPath = ""; + gchar *name; + gchar *keyPath = ""; if (gtk_tree_path_get_depth (path) == 1) { @@ -1077,27 +1069,26 @@ on_mnuKeysNew_activate (GtkMenuItem *menuitem, else { gtk_tree_model_get_iter (GTK_TREE_MODEL (storeFolders), &iterConfi, - gtk_tree_path_new_from_indices (gtk_tree_path_get_indices (path)[0], -1)); - + gtk_tree_path_new_from_indices (gtk_tree_path_get_indices (path)[0], -1)); + gtk_tree_model_get (GTK_TREE_MODEL (storeFolders), &iter, - FOLDERS_COL_OBJPTR, &ck, - -1); + FOLDERS_COL_OBJPTR, &ck, + -1); keyPath = g_strjoin (NULL, ck->path, "/", ck->key, NULL); gtk_entry_set_text (GTK_ENTRY (txtIDParent), g_strdup_printf ("%d", ck->id)); gtk_entry_set_text (GTK_ENTRY (txtParent), ck->key); } - gtk_tree_model_get (GTK_TREE_MODEL (storeFolders), &iterConfi, - FOLDERS_COL_OBJPTR, &confi, - -1); + FOLDERS_COL_OBJPTR, &confi, + -1); g_object_get (G_OBJECT (confi), - "id_config", &id_config, - "name", &name, - NULL); - + "id_config", &id_config, + "name", &name, + NULL); + gtk_entry_set_text (GTK_ENTRY (txtIDConfig), g_strdup_printf ("%d", id_config)); gtk_entry_set_text (GTK_ENTRY (txtConfig), name); @@ -1107,9 +1098,9 @@ on_mnuKeysNew_activate (GtkMenuItem *menuitem, GtkTreeIter parent = iter; gint id; - gchar *name = (gchar *)gtk_entry_get_text (GTK_ENTRY (txtName)), - *value = (gchar *)gtk_entry_get_text (GTK_ENTRY (txtValue)), - *description; + gchar *name = (gchar *)gtk_entry_get_text (GTK_ENTRY (txtName)); + gchar *value = (gchar *)gtk_entry_get_text (GTK_ENTRY (txtValue)); + gchar *description; GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (txtvDescription)); gtk_text_buffer_get_bounds (buffer, &iter1, &iter2); @@ -1124,12 +1115,12 @@ on_mnuKeysNew_activate (GtkMenuItem *menuitem, gtk_tree_store_append (storeFolders, &iter, &parent); gtk_tree_store_set (storeFolders, &iter, - FOLDERS_COL_ID, ck->id, - FOLDERS_COL_NAME, name, - FOLDERS_COL_VALUE, value, - FOLDERS_COL_DESCRIPTION, description, + FOLDERS_COL_ID, ck->id, + FOLDERS_COL_NAME, name, + FOLDERS_COL_VALUE, value, + FOLDERS_COL_DESCRIPTION, description, FOLDERS_COL_OBJPTR, ck, - -1); + -1); } } @@ -1170,22 +1161,22 @@ on_mnuKeysEdit_activate (GtkMenuItem *menuitem, if (path != NULL && gtk_tree_path_get_depth (path) > 1) { Confi *confi; - GladeXML *glaKey = glade_xml_new (GLADEDIR "/gconfi.glade", "wKey", NULL); - GtkWidget *diag = glade_xml_get_widget (glaKey, "wKey"), - *txtIDConfig = glade_xml_get_widget (glaKey, "txtIDConfig"), - *txtConfig = glade_xml_get_widget (glaKey, "txtConfig"), - *txtID = glade_xml_get_widget (glaKey, "txtID"), - *txtIDParent = glade_xml_get_widget (glaKey, "txtIDParent"), - *txtParent = glade_xml_get_widget (glaKey, "txtParent"), - *txtName = glade_xml_get_widget (glaKey, "txtName"), - *txtValue = glade_xml_get_widget (glaKey, "txtValue"), - *txtvDescription = glade_xml_get_widget (glaKey, "txtvDescription"); + GtkBuilder *glaKey = gtk_builder_new_from_file (GLADEDIR "/gconfi.glade"); + GtkWidget *diag = GTK_WIDGET (gtk_builder_get_object (glaKey, "wKey")); + GtkWidget *txtIDConfig = GTK_WIDGET (gtk_builder_get_object (glaKey, "txtIDConfig")); + GtkWidget *txtConfig = GTK_WIDGET (gtk_builder_get_object (glaKey, "txtConfig")); + GtkWidget *txtID = GTK_WIDGET (gtk_builder_get_object (glaKey, "txtID")); + GtkWidget *txtIDParent = GTK_WIDGET (gtk_builder_get_object (glaKey, "txtIDParent")); + GtkWidget *txtParent = GTK_WIDGET (gtk_builder_get_object (glaKey, "txtParent")); + GtkWidget *txtName = GTK_WIDGET (gtk_builder_get_object (glaKey, "txtName")); + GtkWidget *txtValue = GTK_WIDGET (gtk_builder_get_object (glaKey, "txtValue")); + GtkWidget *txtvDescription = GTK_WIDGET (gtk_builder_get_object (glaKey, "txtvDescription")); GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (txtvDescription)); ConfiKey *ck; - GtkTreeIter iterConfi, - iterParent; + GtkTreeIter iterConfi; + GtkTreeIter iterParent; if (gtk_tree_model_get_iter (GTK_TREE_MODEL (storeFolders), &iterConfi, gtk_tree_path_new_from_indices (gtk_tree_path_get_indices (path)[0], -1))) @@ -1193,8 +1184,8 @@ on_mnuKeysEdit_activate (GtkMenuItem *menuitem, gchar *name; gtk_tree_model_get (GTK_TREE_MODEL (storeFolders), &iterConfi, - FOLDERS_COL_OBJPTR, &confi, - -1); + FOLDERS_COL_OBJPTR, &confi, + -1); g_object_get (G_OBJECT (confi), "name", &name, @@ -1221,7 +1212,7 @@ on_mnuKeysEdit_activate (GtkMenuItem *menuitem, ConfiKey *ckParent; gtk_tree_model_get (GTK_TREE_MODEL (storeFolders), &iterParent, - FOLDERS_COL_OBJPTR, &ckParent, + FOLDERS_COL_OBJPTR, &ckParent, -1); gtk_entry_set_text (GTK_ENTRY (txtParent), ckParent->key); @@ -1265,10 +1256,10 @@ on_mnuKeysDelete_activate (GtkMenuItem *menuitem, if (path != NULL && gtk_tree_path_get_depth (path) > 1) { GtkWidget *diag = gtk_message_dialog_new (GTK_WINDOW (w), - GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_YES_NO, - "Are you sure you want to delete the selected key from database?"); + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + "Are you sure you want to delete the selected key from database?"); if (gtk_dialog_run (GTK_DIALOG (diag)) == GTK_RESPONSE_YES) { Confi *confi; @@ -1278,16 +1269,16 @@ on_mnuKeysDelete_activate (GtkMenuItem *menuitem, gtk_tree_path_new_from_indices (gtk_tree_path_get_indices (path)[0], -1)); gtk_tree_model_get (GTK_TREE_MODEL (storeFolders), &iterConfig, - FOLDERS_COL_OBJPTR, &confi, - -1); + FOLDERS_COL_OBJPTR, &confi, + -1); if (IS_CONFI (confi)) { ConfiKey *ck; gtk_tree_model_get (GTK_TREE_MODEL (storeFolders), &iter, - FOLDERS_COL_OBJPTR, &ck, - -1); + FOLDERS_COL_OBJPTR, &ck, + -1); if (confi_remove_path (confi, g_strconcat (ck->path, "/", ck->key, NULL))) { @@ -1311,8 +1302,8 @@ void on_mnuHelpAbout_activate (GtkMenuItem *menuitem, gpointer user_data) { - GladeXML *glaAbout = glade_xml_new (GLADEDIR "/gconfi.glade", "diagAbout", NULL); - GtkWidget *diag = glade_xml_get_widget (glaAbout, "diagAbout"); + GtkBuilder *glaAbout = gtk_builder_new_from_file (GLADEDIR "/gconfi.glade"); + GtkWidget *diag = GTK_WIDGET (gtk_builder_get_object (glaAbout, "diagAbout")); gtk_dialog_run (GTK_DIALOG (diag)); gtk_widget_destroy (diag); } @@ -1384,11 +1375,10 @@ on_trFolders_row_activated (GtkTreeView *tree_view, int main (int argc, char **argv) { - GladeXML *glaMain; + GtkBuilder *glaMain; GOptionEntry entries[] = { - { "provider_id", 'p', 0, G_OPTION_ARG_STRING, &provider_id, "Provider ID", NULL }, { "cnc_string", 'c', 0, G_OPTION_ARG_STRING, &cnc_string, "Connection string", NULL }, { "filter", 'f', 0, G_OPTION_ARG_STRING, &filter, "Configurations filter", NULL }, { NULL } @@ -1399,18 +1389,18 @@ main (int argc, char **argv) gtk_init (&argc, &argv); - glaMain = glade_xml_new (GLADEDIR "/gconfi.glade", "wMain", NULL); - glade_xml_signal_autoconnect (glaMain); + glaMain = gtk_builder_new_from_file (GLADEDIR "/gconfi.glade"); + gtk_builder_connect_signals (glaMain, NULL); - w = glade_xml_get_widget (glaMain, "wMain"); - trFolders = glade_xml_get_widget (glaMain, "trFolders"); - mnuDbClose = glade_xml_get_widget (glaMain, "mnuDbClose"); - mnuDbRefresh = glade_xml_get_widget (glaMain, "mnuDbRefresh"); - mnuConfigs = glade_xml_get_widget (glaMain, "mnuConfigs"); - mnuConfigsEdit = glade_xml_get_widget (glaMain, "mnuConfigsEdit"); - mnuKeys = glade_xml_get_widget (glaMain, "mnuKeys"); - mnuKeysEdit = glade_xml_get_widget (glaMain, "mnuKeysEdit"); - stbar = glade_xml_get_widget (glaMain, "stbar"); + w = GTK_WIDGET (gtk_builder_get_object (glaMain, "wMain")); + trFolders = GTK_WIDGET (gtk_builder_get_object (glaMain, "trFolders")); + mnuDbClose = GTK_WIDGET (gtk_builder_get_object (glaMain, "mnuDbClose")); + mnuDbRefresh = GTK_WIDGET (gtk_builder_get_object (glaMain, "mnuDbRefresh")); + mnuConfigs = GTK_WIDGET (gtk_builder_get_object (glaMain, "mnuConfigs")); + mnuConfigsEdit = GTK_WIDGET (gtk_builder_get_object (glaMain, "mnuConfigsEdit")); + mnuKeys = GTK_WIDGET (gtk_builder_get_object (glaMain, "mnuKeys")); + mnuKeysEdit = GTK_WIDGET (gtk_builder_get_object (glaMain, "mnuKeysEdit")); + stbar = GTK_WIDGET (gtk_builder_get_object (glaMain, "stbar")); gtk_widget_set_sensitive (mnuDbClose, FALSE); gtk_widget_set_sensitive (mnuDbRefresh, FALSE); @@ -1428,9 +1418,9 @@ main (int argc, char **argv) return 0; } - if (provider_id != NULL && cnc_string != NULL) + if (cnc_string != NULL) { - if (fill_trFolders (provider_id, cnc_string, filter)) + if (fill_trFolders (cnc_string, filter)) { gtk_widget_set_sensitive (mnuDbClose, TRUE); gtk_widget_set_sensitive (mnuDbRefresh, TRUE); @@ -1439,7 +1429,7 @@ main (int argc, char **argv) gtk_statusbar_pop (GTK_STATUSBAR (stbar), 0); gtk_statusbar_push (GTK_STATUSBAR (stbar), 0, - g_strconcat ("Provider: ", provider_id, " - Connection string: ", cnc_string, NULL)); + g_strconcat ("Connection string: ", cnc_string, NULL)); } } -- 2.49.0