1 /*
2  * Copyright (C) 2009 - 2011 Vivien Malerba <malerba@gnome-db.org>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  */
18 
19 #ifndef __SUPPORT_H__
20 #define __SUPPORT_H__
21 
22 #include <libgda/libgda.h>
23 #include <gtk/gtk.h>
24 #include "browser-connection.h"
25 
26 #ifdef HAVE_MAC_INTEGRATION
27 #include <gtkosxapplication.h>
28 extern GtkOSXApplication *theApp;
29 #endif
30 #ifdef HAVE_LDAP
31 #include <libgda/sqlite/virtual/gda-ldap-connection.h>
32 #endif
33 
34 G_BEGIN_DECLS
35 
36 /**
37  * SECTION:support
38  * @short_description: Misc. functions for various situations
39  * @title: Support functions
40  * @stability: Stable
41  * @see_also:
42  */
43 
44 BrowserConnection *browser_connection_open (GError **error);
45 gboolean           browser_connection_close (GtkWindow *parent, BrowserConnection *bcnc);
46 void               browser_show_error (GtkWindow *parent, const gchar *format, ...);
47 void               browser_show_message (GtkWindow *parent, const gchar *format, ...);
48 #ifdef HAVE_GDU
49 void               browser_show_help (GtkWindow *parent, const gchar *topic);
50 #endif
51 
52 GtkWidget*         browser_make_tab_label_with_stock (const gchar *label,
53 						      const gchar *stock_id, gboolean with_close,
54 						      GtkWidget **out_close_button);
55 GtkWidget*         browser_make_tab_label_with_pixbuf (const gchar *label,
56 						       GdkPixbuf *pixbuf, gboolean with_close,
57 						       GtkWidget **out_close_button);
58 
59 GtkWidget          *browser_make_small_button (gboolean is_toggle, gboolean with_arrow,
60 					       const gchar *label, const gchar *stock_id,
61 					       const gchar *tooltip);
62 GtkWidget          *browser_make_tree_view (GtkTreeModel *model);
63 
64 /*
65  * Widgets navigation
66  */
67 GtkWidget          *browser_find_parent_widget (GtkWidget *current, GType requested_type);
68 
69 /*
70  * icons, see browser_get_pixbuf_icon() for the associated icons
71  */
72 typedef enum {
73 	BROWSER_ICON_BOOKMARK,
74 	BROWSER_ICON_SCHEMA,
75 	BROWSER_ICON_TABLE,
76 	BROWSER_ICON_COLUMN,
77 	BROWSER_ICON_COLUMN_PK,
78 	BROWSER_ICON_COLUMN_FK,
79 	BROWSER_ICON_COLUMN_FK_NN,
80 	BROWSER_ICON_COLUMN_NN,
81 	BROWSER_ICON_REFERENCE,
82 	BROWSER_ICON_DIAGRAM,
83 	BROWSER_ICON_QUERY,
84 	BROWSER_ICON_ACTION,
85 
86 	BROWSER_ICON_MENU_INDICATOR,
87 
88 	BROWSER_ICON_LDAP_ENTRY,
89 	BROWSER_ICON_LDAP_GROUP,
90 	BROWSER_ICON_LDAP_ORGANIZATION,
91 	BROWSER_ICON_LDAP_PERSON,
92 	BROWSER_ICON_LDAP_CLASS_STRUCTURAL,
93 	BROWSER_ICON_LDAP_CLASS_ABSTRACT,
94 	BROWSER_ICON_LDAP_CLASS_AUXILIARY,
95 	BROWSER_ICON_LDAP_CLASS_UNKNOWN,
96 
97 	BROWSER_ICON_LAST
98 } BrowserIconType;
99 
100 GdkPixbuf          *browser_get_pixbuf_icon (BrowserIconType type);
101 #ifdef HAVE_LDAP
102 GdkPixbuf          *browser_get_pixbuf_for_ldap_class (GdaLdapClassKind kind);
103 const gchar        *browser_get_kind_for_ldap_class (GdaLdapClassKind kind);
104 #endif
105 
106 /*
107  * Connections list
108  */
109 enum
110 {
111 	CNC_LIST_COLUMN_BCNC = 0,
112 	CNC_LIST_COLUMN_NAME = 1,
113 	CNC_LIST_NUM_COLUMNS
114 };
115 GdaDataModel       *browser_get_connections_list (void);
116 
117 #define VARIABLES_HELP _("<small>This area allows to give values to\n" \
118 			 "variables defined in the SQL code\n"		\
119 			 "using the following syntax:\n"		\
120 			 "<b><tt>##&lt;variable name&gt;::&lt;type&gt;[::null]</tt></b>\n" \
121 			 "For example:\n"				\
122 			 "<span foreground=\"#4e9a06\"><b><tt>##id::int</tt></b></span>\n      defines <b>id</b> as a non NULL integer\n" \
123 			 "<span foreground=\"#4e9a06\"><b><tt>##age::string::null</tt></b></span>\n      defines <b>age</b> as a string\n\n" \
124 			 "Valid types are: <tt>string</tt>, <tt>boolean</tt>, <tt>int</tt>,\n" \
125 			 "<tt>date</tt>, <tt>time</tt>, <tt>timestamp</tt>, <tt>guint</tt>, <tt>blob</tt> and\n" \
126 			 "<tt>binary</tt></small>")
127 
128 G_END_DECLS
129 
130 #endif
131