1 /* 2 * Copyright (C) 2009 - 2011 Vivien Malerba <malerba@gnome-db.org> 3 * Copyright (C) 2011 Murray Cumming <murrayc@murrayc.com> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the 17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef __GDAUI_LOGIN_H__ 22 #define __GDAUI_LOGIN_H__ 23 24 #include <gtk/gtk.h> 25 26 G_BEGIN_DECLS 27 28 #define GDAUI_TYPE_LOGIN (gdaui_login_get_type()) 29 #define GDAUI_LOGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, GDAUI_TYPE_LOGIN, GdauiLogin)) 30 #define GDAUI_LOGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, GDAUI_TYPE_LOGIN, GdauiLoginClass)) 31 #define GDAUI_IS_LOGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GDAUI_TYPE_LOGIN)) 32 #define GDAUI_IS_LOGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDAUI_TYPE_LOGIN)) 33 34 typedef struct _GdauiLogin GdauiLogin; 35 typedef struct _GdauiLoginClass GdauiLoginClass; 36 typedef struct _GdauiLoginPrivate GdauiLoginPrivate; 37 38 struct _GdauiLogin { 39 GtkBox parent; 40 GdauiLoginPrivate *priv; 41 }; 42 43 struct _GdauiLoginClass { 44 GtkBoxClass parent_class; 45 46 /* signals */ 47 void (*changed) (GdauiLogin *login, gboolean is_valid); 48 }; 49 50 /** 51 * GdauiLoginMode: 52 * @GDA_UI_LOGIN_ENABLE_CONTROL_CENTRE_MODE: 53 * @GDA_UI_LOGIN_HIDE_DSN_SELECTION_MODE: 54 * @GDA_UI_LOGIN_HIDE_DIRECT_CONNECTION_MODE: 55 * 56 * Defines the aspect of the #GdauiLogin widget 57 */ 58 typedef enum { 59 GDA_UI_LOGIN_ENABLE_CONTROL_CENTRE_MODE = 1 << 0, 60 GDA_UI_LOGIN_HIDE_DSN_SELECTION_MODE = 1 << 1, 61 GDA_UI_LOGIN_HIDE_DIRECT_CONNECTION_MODE = 1 << 2 62 } GdauiLoginMode; 63 64 /** 65 * SECTION:gdaui-login 66 * @short_description: Connection opening widget 67 * @title: GdauiLogin 68 * @stability: Stable 69 * @Image: vi-login.png 70 * @see_also: 71 * 72 * The #GdauiLogin widget can be used when the user needs to enter 73 * data to open a connection. It can be customized in several ways: 74 * <itemizedlist> 75 * <listitem><para>data source (DSN) selection can be shown or hidden</para></listitem> 76 * <listitem><para>the button to launch the control center to declare new data sources can be 77 * shown or hidden</para></listitem> 78 * <listitem><para>the form to open a connection not using a DSN can be shown or hidden</para></listitem> 79 * </itemizedlist> 80 */ 81 82 GType gdaui_login_get_type (void) G_GNUC_CONST; 83 GtkWidget *gdaui_login_new (const gchar *dsn); 84 void gdaui_login_set_mode (GdauiLogin *login, GdauiLoginMode mode); 85 const GdaDsnInfo *gdaui_login_get_connection_information (GdauiLogin *login); 86 87 void gdaui_login_set_dsn (GdauiLogin *login, const gchar *dsn); 88 void gdaui_login_set_connection_information (GdauiLogin *login, const GdaDsnInfo *cinfo); 89 90 G_END_DECLS 91 92 #endif 93