libgnomedb r1731 - in trunk: . libgnomedb-extra
- From: vivien svn gnome org
- To: svn-commits-list gnome org
- Subject: libgnomedb r1731 - in trunk: . libgnomedb-extra
- Date: Thu, 19 Jun 2008 22:03:17 +0000 (UTC)
Author: vivien
Date: Thu Jun 19 22:03:16 2008
New Revision: 1731
URL: http://svn.gnome.org/viewvc/libgnomedb?rev=1731&view=rev
Log:
2008-06-19 Vivien Malerba <malerba gnome-db org>
* configure.in:
* libgnomedb-extra/gnome-db-editor.c: now use GtkSourceView 2, fixes
bug #520463
Modified:
trunk/ChangeLog
trunk/configure.in
trunk/libgnomedb-extra/gnome-db-editor.c
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Thu Jun 19 22:03:16 2008
@@ -308,7 +308,7 @@
dnl Checks for GtkSourceView
dnl ******************************
-PKG_CHECK_MODULES(GTKSOURCEVIEW, gtksourceview-1.0, have_gtksourceview=yes, have_gtksourceview=no)
+PKG_CHECK_MODULES(GTKSOURCEVIEW, gtksourceview-2.0, have_gtksourceview=yes, have_gtksourceview=no)
AM_CONDITIONAL(HAVE_GTKSOURCEVIEW, test x"$have_gtksourceview" = "xyes")
GTKSOURCEVIEW_CFLAGS="$GTKSOURCEVIEW_CFLAGS"
if test x"$have_gtksourceview" = "xyes"
Modified: trunk/libgnomedb-extra/gnome-db-editor.c
==============================================================================
--- trunk/libgnomedb-extra/gnome-db-editor.c (original)
+++ trunk/libgnomedb-extra/gnome-db-editor.c Thu Jun 19 22:03:16 2008
@@ -25,8 +25,8 @@
#include <gtk/gtkscrolledwindow.h>
#ifdef HAVE_GTKSOURCEVIEW
#include <gtksourceview/gtksourceview.h>
-#include <gtksourceview/gtksourcelanguagesmanager.h>
-#include <gtksourceview/gtksourcetag.h>
+#include <gtksourceview/gtksourcelanguagemanager.h>
+#include <gtksourceview/gtksourcebuffer.h>
#endif
#include <libgda/gda-util.h>
#include <libgda/gda-config.h>
@@ -67,7 +67,7 @@
{
GtkTextBuffer *buffer;
#ifdef HAVE_GTKSOURCEVIEW
- GtkSourceLanguagesManager *mgr;
+ GtkSourceLanguageManager *mgr;
GtkSourceLanguage *lang;
#endif
@@ -76,56 +76,12 @@
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (editor->priv->text));
#ifdef HAVE_GTKSOURCEVIEW
- mgr = gtk_source_languages_manager_new ();
- lang = gtk_source_languages_manager_get_language_from_mime_type (mgr, "text/x-sql");
+ mgr = gtk_source_language_manager_new ();
+ lang = gtk_source_language_manager_get_language (mgr, "sql");
- if (lang)
+ if (lang) {
gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (buffer), lang);
- else {
- GtkTextTag *tag;
- GList *tag_list = NULL;
-
- /* add SQL keywords */
- tag = gtk_pattern_tag_new ("keywords", "keywords",
- "\\b\\(add\\|alter\\|and\\|as\\|begin\\|by\\|commit\\|create\\|delete"
- "\\|drop\\|exists\\|from\\|group\\|having\\|in\\|insert\\|into"
- "\\|is\\|key\\|not\\|null\\|or\\|order\\|primary\\|references"
- "\\|rollback\\|select\\|set"
- "\\|table\\|unique\\|update\\|values\\|view\\|where\\)\\b");
- g_object_set (G_OBJECT (tag), "foreground", "blue", NULL);
- tag_list = g_list_append (tag_list, tag);
-
- /* add aggregates */
- tag = gtk_pattern_tag_new ("functions", "functions",
- "\\b\\(avg\\|count\\|max\\|min\\|sum\\)\\b");
- g_object_set (G_OBJECT (tag), "foreground", "navy", NULL);
- tag_list = g_list_append (tag_list, tag);
-
- /* add strings and numbers */
- tag = gtk_syntax_tag_new ("string", "string", "\"", "\"");
- g_object_set (G_OBJECT (tag), "foreground", "forest green", NULL);
- tag_list = g_list_append (tag_list, tag);
-
- tag = gtk_syntax_tag_new ("single_quoted_string", "single_quoted_string", "'", "'");
- g_object_set (G_OBJECT (tag), "foreground", "forest green", NULL);
- tag_list = g_list_append (tag_list, tag);
-
- tag = gtk_pattern_tag_new ("numbers", "numbers", "\\b[0-9]+\\.?\\b");
- g_object_set (G_OBJECT (tag), "weight", PANGO_WEIGHT_BOLD, NULL);
- tag_list = g_list_append (tag_list, tag);
-
- /* add comments */
- tag = gtk_syntax_tag_new ("comment", "comment", "--", "\n");
- g_object_set (G_OBJECT (tag), "foreground", "gray", "style", PANGO_STYLE_ITALIC, NULL);
- tag_list = g_list_append (tag_list, tag);
-
- tag = gtk_syntax_tag_new ("comment_multiline", "comment_multiline", "/\\*", "\\*/");
- g_object_set (G_OBJECT (tag), "foreground", "gray", "style", PANGO_STYLE_ITALIC, NULL);
- tag_list = g_list_append (tag_list, tag);
-
- /* install new tags */
- /* FIXME: gtk_source_buffer_install_regex_tags (GTK_SOURCE_BUFFER (buffer), tag_list); */
- g_list_free (tag_list);
+ /* FIXME: extend for Gda's variables syntax */
}
g_object_unref (mgr);
@@ -164,12 +120,12 @@
} else if (!strcmp (entry->key, GNOME_DB_CONFIG_KEY_EDITOR_TAB_STOP)) {
#ifdef HAVE_GTKSOURCEVIEW
int tab = gconf_client_get_int (gconf_client_get_default (), GNOME_DB_CONFIG_KEY_EDITOR_TAB_STOP, NULL);
- gtk_source_view_set_tabs_width (GTK_SOURCE_VIEW (editor->priv->text),
- tab ? tab : 8);
+ gtk_source_view_set_tab_width (GTK_SOURCE_VIEW (editor->priv->text),
+ tab ? tab : 8);
#else
#endif
} else if (!strcmp (entry->key, GNOME_DB_CONFIG_KEY_EDITOR_HIGHLIGHT)) {
- gnome_db_editor_set_highlight (editor,
+ gnome_db_editor_set_highlight_syntax (editor,
gconf_client_get_bool (gconf_client_get_default (),
GNOME_DB_CONFIG_KEY_EDITOR_HIGHLIGHT, NULL));
}
@@ -210,10 +166,10 @@
#ifdef HAVE_GTKSOURCEVIEW
editor->priv->text = gtk_source_view_new ();
- gtk_source_buffer_set_highlight (GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (editor->priv->text))),
+ gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (editor->priv->text))),
highlight);
gtk_source_view_set_show_line_numbers (GTK_SOURCE_VIEW (editor->priv->text), showlinesno);
- gtk_source_view_set_tabs_width (GTK_SOURCE_VIEW (editor->priv->text), tab);
+ gtk_source_view_set_tab_width (GTK_SOURCE_VIEW (editor->priv->text), tab);
gtk_widget_show (editor->priv->text);
#else
editor->priv->text = gnome_db_new_text_widget (NULL);
@@ -344,7 +300,7 @@
g_return_val_if_fail (GNOME_DB_IS_EDITOR (editor), FALSE);
#ifdef HAVE_GTKSOURCEVIEW
- return gtk_source_buffer_get_highlight (
+ return gtk_source_buffer_get_highlight_syntax (
GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (editor->priv->text))));
#else
return FALSE;
@@ -364,7 +320,7 @@
g_return_if_fail (GNOME_DB_IS_EDITOR (editor));
#ifdef HAVE_GTKSOURCEVIEW
- gtk_source_buffer_set_highlight (
+ gtk_source_buffer_set_highlight_syntax (
GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (editor->priv->text))), highlight);
#endif
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]