Commit 398a88a9 authored by Vivien Malerba's avatar Vivien Malerba

Added a UI extension and some tools

* UI widgets are migrated from Libgnomedb
* added tools include control center (to define DSN and list providers)
  and new database browser (kind of clone of Mergeant)
* documentation not yet updated
parent 527cd3fd
2009-05-17 Vivien Malerba <malerba@gnome-db.org>
* configure.in:
* testing/:
* libgdaui/: moved some contents from Libgnomedb
* control-center/: moved Libgnomedb's control center
* tools/browser/: new browser tool
* po/: added new files
2009-06-08 Vivien Malerba <malerba@gnome-db.org>
* libgda-report/RML/trml2html/Makefile.am:
......
......@@ -2,6 +2,13 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
if HAVE_LIBXSLT
XSLT_DIR=libgda-xslt
XSLT_PC=libgda-xslt-$(GDA_ABI_VERSION).pc
endif
if HAVE_UI
UI_DIRS=libgdaui \
control-center
UI_PC=libgdaui-$(GDA_ABI_VERSION).pc
endif
SUBDIRS = \
......@@ -10,6 +17,7 @@ SUBDIRS = \
providers \
libgda-report \
$(XSLT_DIR) \
$(UI_DIRS) \
tools \
tests \
testing \
......@@ -89,7 +97,7 @@ EXTRA_DIST = \
getsp.java
pkgconfigdir=$(libdir)/pkgconfig
pkgconfig_DATA = libgda-$(GDA_ABI_VERSION).pc libgda-report-$(GDA_ABI_VERSION).pc libgda-xslt-$(GDA_ABI_VERSION).pc
pkgconfig_DATA = libgda-$(GDA_ABI_VERSION).pc libgda-report-$(GDA_ABI_VERSION).pc $(XSLT_PC) $(UI_PC)
all-local: libgda.spec
......
......@@ -125,7 +125,7 @@ dnl ******************************
PKG_PROG_PKG_CONFIG([0.18])
dnl ******************************
dnl Checks for libraries
dnl Checks for required libraries
dnl ******************************
PKG_CHECK_MODULES(LIBGDA, [
......@@ -138,6 +138,121 @@ PKG_CHECK_MODULES(LIBGDA, [
TST_CFLAGS="$LIBGDA_CFLAGS"
LIBGDA_CFLAGS="$LIBGDA_CFLAGS -DLIBGDA_ABI_NAME=$LIBGDA_ABI_NAME"
dnl ******************************
dnl Checks for UI extension
dnl ******************************
have_ui=no
have_goocanvas=no
have_graphviz=no
AC_ARG_WITH(ui,
AS_HELP_STRING([--with-ui], [Enable GTK+ extension and tools]),
,with_ui=auto)
if test "$with_ui" = "auto" -o "$with_ui" = "yes"
then
GTK_MODULES="gtk+-2.0 >= 2.12.0"
PKG_CHECK_MODULES(GTK, $GTK_MODULES, [
AC_DEFINE(HAVE_UI, [1], [GTK+ support enabled])
have_ui=yes], [
if test "$with_ui" = "yes"
then
AC_MSG_ERROR([GTK+ support requested but not found.])
fi
have_ui=no])
fi
AM_CONDITIONAL(HAVE_UI, test x"$have_ui" = "xyes")
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
AC_ARG_WITH(goocanvas,
AS_HELP_STRING([--with-goocanvas], [Enable using GooCanvas]),
,with_goo=auto)
AC_ARG_WITH(graphviz,
AS_HELP_STRING([--with-graphviz], [Enable using Graphviz]),
,with_graphviz=auto)
if test x"$have_ui" = "xyes"
then
if test "$with_goo" = "auto" -o "$with_goo" = "yes"
then
PKG_CHECK_MODULES(GOOCANVAS, "goocanvas", [
AC_DEFINE(HAVE_GOOCANVAS, [1], [GooCanvas support enabled])
have_goocanvas=yes], [
if test "$with_goo" = "yes"
then
AC_MSG_ERROR([GooCanvas support requested but not found.])
fi
have_goocanvas=no])
fi
if test "$with_graphviz" = "auto" -o "$with_graphviz" = "yes"
then
PKG_CHECK_MODULES(GRAPHVIZ, "libgvc", [
AC_DEFINE(HAVE_GRAPHVIZ, [1], [Graphviz support enabled])
have_graphviz=yes], [
if test "$with_graphviz" = "yes"
then
AC_MSG_ERROR([Graphviz support requested but not found.])
fi
have_graphviz=no])
fi
fi
AM_CONDITIONAL(HAVE_GOOCANVAS, test x"$have_goocanvas" = "xyes")
AC_SUBST(GOOCANVAS_CFLAGS)
AC_SUBST(GOOCANVAS_LIBS)
AM_CONDITIONAL(HAVE_GRAPHVIZ, test x"$have_graphviz" = "xyes")
AC_SUBST(GRAPHVIZ_CFLAGS)
AC_SUBST(GRAPHVIZ_LIBS)
dnl ******************************
dnl Checks for LibUnique
dnl ******************************
have_unique=no
AC_ARG_WITH(unique,
AS_HELP_STRING([--with-unique], [Use LibUnique to have only one control center]),
,with_unique=auto)
if test "$with_unique" = "auto" -o "$with_unique" = "yes"
then
PKG_CHECK_MODULES(UNIQUE, "unique-1.0", [
AC_DEFINE(HAVE_UNIQUE, [1], [LibUnique support enabled])
have_unique=yes], [
if test "$with_unique" = "yes"
then
AC_MSG_ERROR([LibUnique support requested but not found.])
fi
have_unique=no])
fi
AM_CONDITIONAL(HAVE_UNIQUE, test x"$have_unique" = "xyes")
AC_SUBST(UNIQUE_CFLAGS)
AC_SUBST(UNIQUE_LIBS)
dnl ******************************
dnl Checks for iso codes
dnl ******************************
ISO_CODES_MODULES="iso-codes"
PKG_CHECK_MODULES(ISO_CODES, $ISO_CODES_MODULES, have_iso_codes=yes, have_iso_codes=no)
if test x"$have_iso_codes" = "xyes"
then
AC_MSG_CHECKING([whether iso-codes has iso-4217 domain])
if $PKG_CONFIG --variable=domains iso-codes | grep -q 4217 ; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["`$PKG_CONFIG --variable=prefix iso-codes`"],[ISO codes prefix])
else
AC_MSG_RESULT([no])
AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],"")
fi
else
AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],"")
fi
dnl ******************************
dnl Check for Win32
dnl ******************************
......@@ -145,6 +260,7 @@ dnl linklibext is the shared link library extension, which varies by platform
EXPORT_SYM_REGEX='-export-symbols-regex "^(gda_|fnYM49765777344607__gda).*"'
EXPORT_PROV_SYM_REGEX='-export-symbols-regex "^(plugin_|Java_|g_module).*"'
EXPORT_UI_SYM_REGEX='-export-symbols-regex "^(gdaui_).*"'
AC_MSG_CHECKING([for platform])
platform_win32=no
platform_carbon=no
......@@ -156,6 +272,7 @@ case "$host" in
SOPREFIX='cyg'
LIBTOOL_EXPORT_OPTIONS=$EXPORT_SYM_REGEX
LIBTOOL_PROV_EXPORT_OPTIONS=$EXPORT_PROV_SYM_REGEX
LIBTOOL_UI_EXPORT_OPTIONS=$EXPORT_UI_SYM_REGEX
linklibext=".dll.a"
AC_MSG_RESULT([Win32])
;;
......@@ -167,6 +284,7 @@ case "$host" in
SOPREFIX='lib'
LIBTOOL_EXPORT_OPTIONS=
LIBTOOL_PROV_EXPORT_OPTIONS=
LIBTOOL_UI_EXPORT_OPTIONS=
linklibext=".dll.a"
AC_CHECK_TOOL(WINDRES, windres, windres)
AC_SUBST(WINDRES)
......@@ -181,6 +299,7 @@ case "$host" in
AM_BINRELOC
LIBTOOL_EXPORT_OPTIONS=$EXPORT_SYM_REGEX
LIBTOOL_PROV_EXPORT_OPTIONS=$EXPORT_PROV_SYM_REGEX
LIBTOOL_UI_EXPORT_OPTIONS=$EXPORT_UI_SYM_REGEX
AC_DEFINE(HAVE_CARBON)
LIBGDA_LIBS="$LIBGDA_LIBS -framework Carbon"
dnl SO_SUFFIX=dylib
......@@ -192,6 +311,7 @@ case "$host" in
AM_BINRELOC
LIBTOOL_EXPORT_OPTIONS=$EXPORT_SYM_REGEX
LIBTOOL_PROV_EXPORT_OPTIONS=$EXPORT_PROV_SYM_REGEX
LIBTOOL_UI_EXPORT_OPTIONS=$EXPORT_UI_SYM_REGEX
;;
esac
......@@ -199,6 +319,7 @@ AM_CONDITIONAL(PLATFORM_WIN32, [test $platform_win32 = yes])
AM_CONDITIONAL(PLATFORM_CARBON, [test $platform_carbon = yes])
AC_SUBST(LIBTOOL_EXPORT_OPTIONS)
AC_SUBST(LIBTOOL_PROV_EXPORT_OPTIONS)
AC_SUBST(LIBTOOL_UI_EXPORT_OPTIONS)
AC_SUBST(NO_UNDEFINED)
AC_SUBST(SOPREFIX)
......@@ -280,6 +401,39 @@ fi
AC_SUBST(JSON_GLIB_CFLAGS)
AC_SUBST(JSON_GLIB_LIBS)
dnl ******************************
dnl Checks for libgcrypt
dnl ******************************
LIBGCRYPT_CFLAGS=""
LIBGCRYPT_LIBS=""
if test x$platform_win32 != xyes; then
AC_DEFUN([VERSION_TO_NUMBER],[`$1 | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`])
AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no)
if test "$LIBGCRYPT_CONFIG" != "no" ; then
LIBGCRYPT_VERSION=`$LIBGCRYPT_CONFIG --version`
if test VERSION_TO_NUMBER(echo $LIBGCRYPT_VERSION) -lt VERSION_TO_NUMBER(echo "1.1.42") ; then
LIBGCRYPT_CFLAGS=""
LIBGCRYPT_LIBS=""
AM_CONDITIONAL(HAVE_LIBGCRYPT, 0)
echo "Password entry plugin will not be compiled, install libgcrypt >= 1.1.42 and reconfigure to make available."
else
LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG $libgcrypt_config_args --cflags`
LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG $libgcrypt_config_args --libs`
AM_CONDITIONAL(HAVE_LIBGCRYPT, true)
fi
else
LIBGCRYPT_CFLAGS=""
LIBGCRYPT_LIBS=""
AM_CONDITIONAL(HAVE_LIBGCRYPT, 0)
echo "Password entry plugin will not be compiled, install libgcrypt and reconfigure to make available."
fi
else
AM_CONDITIONAL(HAVE_LIBGCRYPT, false)
fi
AC_SUBST(LIBGCRYPT_CFLAGS)
AC_SUBST(LIBGCRYPT_LIBS)
dnl ******************************
dnl gtk-doc
dnl ******************************
......@@ -1493,6 +1647,7 @@ AC_OUTPUT([
Makefile
libgda.spec
libgda-4.0.pc
libgdaui-4.0.pc
libgda-report-4.0.pc
libgda-xslt-4.0.pc
po/Makefile.in
......@@ -1533,8 +1688,20 @@ libgda-report/RML/Makefile
libgda-report/RML/trml2html/Makefile
libgda-report/RML/trml2pdf/Makefile
libgda-xslt/Makefile
libgdaui/Makefile
libgdaui/marshallers/Makefile
libgdaui/internal/Makefile
libgdaui/data-entries/Makefile
libgdaui/data-entries/plugins/Makefile
libgdaui/data/Makefile
libgdaui/demos/Makefile
libgdaui/demos/geninclude.pl
control-center/Makefile
tools/Makefile
tools/gda-sql-4.1.1:tools/gda-sql.1.in
tools/gda-sql-4.0.1:tools/gda-sql.1.in
tools/browser/Makefile
tools/browser/schema-browser/Makefile
tools/browser/dummy-perspective/Makefile
tools/binreloc/Makefile
testing/Makefile
tests/Makefile
......@@ -1556,6 +1723,7 @@ dnl Print configuration summary
echo ""
echo " Configuration summary for version $GDA_VERSION"
echo " Installation prefix = $prefix"
echo " Building GTK+ UI extension: `if test x$have_ui != xno; then echo yes; else echo no; fi`"
echo " Building Libxslt extension: `if test x$have_xslt != xno; then echo yes; else echo no; fi`"
echo " Compiled providers:"
echo " Berkeley DB = `if test x$bdbdir != x; then echo yes; else echo no; fi`"
......
gda-control-center-4.*
gda-control-center-4.*.desktop
bin_PROGRAMS=gda-control-center-4.0
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/libgda \
-I$(top_builddir) \
$(LIBGDA_CFLAGS) \
$(GTK_CFLAGS) \
$(UNIQUE_CFLAGS) \
-DPREFIX=\""$(prefix)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBDIR=\""$(libdir)"\" \
-DGDA_ABI_VERSION=\""$(GDA_ABI_VERSION)"\"
# rename gdaui-dsn-editor as dsn-properties-editor
gda_control_center_4_0_SOURCES=\
gdaui-login-dialog.c \
gdaui-login-dialog.h \
cc-gray-bar.c \
cc-gray-bar.h \
cc-utility.c \
cc-utility.h \
dsn-config.c \
dsn-config.h \
gdaui-dsn-assistant.c \
gdaui-dsn-assistant.h \
gdaui-dsn-editor.c \
gdaui-dsn-editor.h \
dsn-properties-dialog.c \
dsn-properties-dialog.h \
main.c \
provider-config.c \
provider-config.h
if PLATFORM_WIN32
EXTRALDFLAGS=-mwindows
gda_control_center_4_0_SOURCES += control-center-res.rc
else
EXTRALDFLAGS=
endif
.rc.o:
$(WINDRES) $^ -o $@
control-center-res.o: control-center-res.rc
$(WINDRES) $^ -o $@
gda_control_center_4_0_LDFLAGS = $(EXTRALDFLAGS)
gda_control_center_4_0_LDADD=\
$(top_builddir)/libgdaui/internal/libgdaui-internal.la \
$(top_builddir)/libgda/libgda-4.0.la \
$(top_builddir)/libgdaui/libgdaui-4.0.la \
$(LIBGDA_LIBS) $(GTK_LIBS) $(UNIQUE_LIBS)
@INTLTOOL_DESKTOP_RULE@
desktopdir=$(datadir)/applications
Desktop_in_files = gda-control-center-4.0.desktop.in
desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop)
# icons
iconsdir=$(datadir)/pixmaps
icons_DATA= \
gda-control-center.png \
gda-control-center-newcnc.png
EXTRA_DIST = \
control-center-res.rc \
gda-control-center.ico \
$(Desktop_in_files) $(icons_DATA)
DISTCLEANFILES = $(desktop_DATA)
/* GNOME DB library
*
* Copyright (C) 1999 - 2009 The GNOME Foundation.
*
* AUTHORS:
* Rodrigo Moya <rodrigo@gnome-db.org>
* Vivien Malerba <malerba@gnome-db.org>
*
* This Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This Library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this Library; see the file COPYING.LIB. If not,
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <gtk/gtk.h>
#include "cc-gray-bar.h"
#define PARENT_TYPE GTK_TYPE_BIN
struct _CcGrayBarPrivate {
GtkWidget *hbox;
GtkWidget *icon;
gboolean show_icon;
GtkWidget *label;
};
static void cc_gray_bar_class_init (CcGrayBarClass *klass);
static void cc_gray_bar_init (CcGrayBar *bar,
CcGrayBarClass *klass);
static void cc_gray_bar_realize (GtkWidget *widget);
static void cc_gray_bar_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void cc_gray_bar_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void cc_gray_bar_paint (GtkWidget *widget,
GdkRectangle *area);
static gint cc_gray_bar_expose (GtkWidget *widget,
GdkEventExpose *event);
static void cc_gray_bar_style_set (GtkWidget *w,
GtkStyle *previous_style);
static void cc_gray_bar_set_property (GObject *object,
guint paramid,
const GValue *value,
GParamSpec *pspec);
static void cc_gray_bar_get_property (GObject *object,
guint param_id,
GValue *value,
GParamSpec *pspec);
static void cc_gray_bar_finalize (GObject *object);
/* Properties */
enum {
PROP_0,
PROP_TEXT,
PROP_SHOW_ICON
};
static GObjectClass *parent_class = NULL;
/*
* CcGrayBar class implementation
*/
static void
cc_gray_bar_realize (GtkWidget *widget)
{
GdkWindowAttr attributes;
gint attributes_mask;
gint border_width;
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
border_width = GTK_CONTAINER (widget)->border_width;
attributes.x = widget->allocation.x + border_width;
attributes.y = widget->allocation.y + border_width;
attributes.width = widget->allocation.width - 2*border_width;
attributes.height = widget->allocation.height - 2*border_width;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
attributes.event_mask = gtk_widget_get_events (widget)
| GDK_BUTTON_MOTION_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_EXPOSURE_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gdk_window_set_user_data (widget->window, widget);
widget->style = gtk_style_attach (widget->style, widget->window);
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
}
static void
cc_gray_bar_size_request (GtkWidget *widget, GtkRequisition *requisition)
{
GtkBin *bin = GTK_BIN (widget);
GtkRequisition child_requisition;
requisition->width = GTK_CONTAINER (widget)->border_width * 2;
requisition->height = GTK_CONTAINER (widget)->border_width * 2;
if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) {
gtk_widget_size_request (bin->child, &child_requisition);
requisition->width += child_requisition.width;
requisition->height += child_requisition.height;
}
}
static void
cc_gray_bar_allocate (GtkWidget *widget, GtkAllocation *allocation)
{
GtkBin *bin;
GtkAllocation child_allocation;
widget->allocation = *allocation;
bin = GTK_BIN (widget);
child_allocation.x = 0;
child_allocation.y = 0;
child_allocation.width = MAX (allocation->width - GTK_CONTAINER (widget)->border_width * 2, 0);
child_allocation.height = MAX (allocation->height - GTK_CONTAINER (widget)->border_width * 2, 0);
if (GTK_WIDGET_REALIZED (widget)) {
gdk_window_move_resize (widget->window,
allocation->x + GTK_CONTAINER (widget)->border_width,
allocation->y + GTK_CONTAINER (widget)->border_width,
child_allocation.width,
child_allocation.height);
}
if (bin->child)
gtk_widget_size_allocate (bin->child, &child_allocation);
}
static void
cc_gray_bar_style_set (GtkWidget *w, GtkStyle *previous_style)
{
static int in_style_set = 0;
GtkStyle *style;
if (in_style_set > 0)
return;
in_style_set ++;
style = gtk_rc_get_style (GTK_WIDGET (w));
gtk_widget_modify_bg (GTK_WIDGET (w), GTK_STATE_NORMAL, &style->bg[GTK_STATE_ACTIVE]);
in_style_set --;
GTK_WIDGET_CLASS (parent_class)->style_set (w, previous_style);
}
static void
cc_gray_bar_paint (GtkWidget *widget, GdkRectangle *area)
{
if (!GTK_WIDGET_APP_PAINTABLE (widget)) {
gtk_paint_flat_box (widget->style, widget->window,
widget->state, GTK_SHADOW_NONE,
area, widget, "gnomedbgraybar",
1, 1,
(widget->allocation.width - 2),
(widget->allocation.height - 2));
}
}
static gboolean
cc_gray_bar_expose (GtkWidget *widget, GdkEventExpose *event)
{
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (CC_IS_GRAY_BAR (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (event->count > 0)
return FALSE;
if (GTK_WIDGET_DRAWABLE (widget)) {
cc_gray_bar_paint (widget, &event->area);
(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
}
return FALSE;
}
static void
cc_gray_bar_class_init (CcGrayBarClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->set_property = cc_gray_bar_set_property;
object_class->get_property = cc_gray_bar_get_property;
object_class->finalize = cc_gray_bar_finalize;
widget_class->style_set = cc_gray_bar_style_set;
widget_class->realize = cc_gray_bar_realize;
widget_class->size_request = cc_gray_bar_size_request;
widget_class->size_allocate = cc_gray_bar_allocate;
widget_class->expose_event = cc_gray_bar_expose;
/* add class properties */
g_object_class_install_property (
object_class, PROP_TEXT,
g_param_spec_string ("text", NULL, "Text showed inside the widget.", NULL,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
g_object_class_install_property (
object_class, PROP_SHOW_ICON,
g_param_spec_boolean ("show_icon", NULL, NULL, FALSE,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
}
static void
cc_gray_bar_init (CcGrayBar *bar, CcGrayBarClass *klass)
{
GTK_WIDGET_UNSET_FLAGS (bar, GTK_NO_WINDOW);