anjuta-extras r17 - in trunk: . plugins/scintilla plugins/scintilla/scintilla



Author: mcora
Date: Fri Apr 10 22:36:36 2009
New Revision: 17
URL: http://svn.gnome.org/viewvc/anjuta-extras?rev=17&view=rev

Log:
	* configure.ac:
	fixed preferences/data files install. Now they'll be placed under 
	share/anjuta-extras/properties and similar.

	* plugins/scintilla/Makefile.am:
	* plugins/scintilla/print.c (anjuta_print_setup):
	* plugins/scintilla/scintilla/PlatGTK.cxx:
	* plugins/scintilla/scintilla/ScintillaGTK.cxx:
	* plugins/scintilla/scintilla/test-scintilla.cxx:
	* plugins/scintilla/style-editor.c (on_hilite_style_entry_changed),
	(sync_from_props), (sync_to_props), (create_style_editor_gui):
	* plugins/scintilla/text-editor-iterable.c:
	* plugins/scintilla/text_editor.c (text_editor_instance_init),
	(text_editor_dispose), (text_editor_hilite_one), (load_from_file),
	(save_to_file), (text_editor_load_file),
	(text_editor_set_line_number_width):
	* plugins/scintilla/text_editor.h:
	* plugins/scintilla/text_editor_cbs.c:
	* plugins/scintilla/text_editor_cbs.h:
	* plugins/scintilla/text_editor_prefs.c (pref_notify),
	(set_n_get_prop_bool), (on_notify_disable_hilite),
	(on_notify_zoom_factor), (on_notify_tab_size),
	(on_notify_use_tab_for_indentation), (on_notify_indent_size),
	(on_notify_wrap_bookmarks), (on_notify_braces_check),
	(on_notify_indent_maintain), (on_notify_tab_indents),
	(on_notify_backspace_unindents), (on_notify_view_eols),
	(on_notify_view_whitespaces), (on_notify_view_linewrap),
	(on_notify_view_indentation_guides), (on_notify_view_folds),
	(on_notify_view_markers), (on_notify_view_linenums),
	(on_notify_fold_symbols), (on_notify_fold_underline),
	(on_notify_edge_column), (text_editor_prefs_init),
	(text_editor_prefs_finalize):
	update scintilla to anjuta rev 4919. This fixes a bunch of errors like
	preferences management.

Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/plugins/scintilla/Makefile.am
   trunk/plugins/scintilla/print.c
   trunk/plugins/scintilla/scintilla/PlatGTK.cxx
   trunk/plugins/scintilla/scintilla/ScintillaGTK.cxx
   trunk/plugins/scintilla/scintilla/test-scintilla.cxx
   trunk/plugins/scintilla/style-editor.c
   trunk/plugins/scintilla/text-editor-iterable.c
   trunk/plugins/scintilla/text_editor.c
   trunk/plugins/scintilla/text_editor.h
   trunk/plugins/scintilla/text_editor_cbs.c
   trunk/plugins/scintilla/text_editor_cbs.h
   trunk/plugins/scintilla/text_editor_prefs.c

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Fri Apr 10 22:36:36 2009
@@ -206,11 +206,11 @@
 anjutadatadir=`pkg-config --variable=datadir libanjuta-1.0`
 AC_SUBST(anjutalibdir)
 AC_SUBST(anjutadatadir)
-anjuta_plugin_dir='$(anjutalibdir)/anjuta'
-anjuta_data_dir='$(anjutadatadir)/anjuta'
-anjuta_ui_dir='$(anjutadatadir)/anjuta/ui'
-anjuta_glade_dir='$(anjutadatadir)/anjuta/glade'
-anjuta_image_dir='$(anjutadatadir)/pixmaps/anjuta'
+anjuta_plugin_dir='$(anjutalibdir)/anjuta-extras'
+anjuta_data_dir='$(anjutadatadir)/anjuta-extras'
+anjuta_ui_dir='$(anjutadatadir)/anjuta-extras/ui'
+anjuta_glade_dir='$(anjutadatadir)/anjuta-extras/glade'
+anjuta_image_dir='$(anjutadatadir)/pixmaps/anjuta-extras'
 AC_SUBST(anjuta_plugin_dir)
 AC_SUBST(anjuta_data_dir)
 AC_SUBST(anjuta_ui_dir)

Modified: trunk/plugins/scintilla/Makefile.am
==============================================================================
--- trunk/plugins/scintilla/Makefile.am	(original)
+++ trunk/plugins/scintilla/Makefile.am	Fri Apr 10 22:36:36 2009
@@ -22,6 +22,7 @@
 plugin_LTLIBRARIES = libanjuta-editor.la
 
 AM_CPPFLAGS = \
+  $(GIO_CFLAGS) \
 	$(LIBANJUTA_CFLAGS) \
 	$(GTK_CFLAGS) \
 	$(GLIB_CFLAGS) \
@@ -33,10 +34,12 @@
 libanjuta_editor_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
 
 libanjuta_editor_la_LIBADD = \
+  $(GIO_LIBS) \
 	$(LIBANJUTA_LIBS) \
 	$(GTK_LIBS) \
 	$(GLIB_LIBS) \
-	$(GLADE_LIBS)
+	$(GLADE_LIBS) \
+  scintilla/libanjuta-scintilla.la
 
 libanjuta_editor_la_SOURCES= \
 	properties.cxx \

Modified: trunk/plugins/scintilla/print.c
==============================================================================
--- trunk/plugins/scintilla/print.c	(original)
+++ trunk/plugins/scintilla/print.c	Fri Apr 10 22:36:36 2009
@@ -25,6 +25,7 @@
 #endif
 
 #include <ctype.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include <libanjuta/anjuta-utils.h>
@@ -919,13 +920,13 @@
 	
 	/* Set preferences */
 	pji->print_line_numbers =
-		anjuta_preferences_get_int_with_default (p, PRINT_LINENUM_COUNT, 1);
+		anjuta_preferences_get_bool_with_default (p, PRINT_LINENUM_COUNT, 1);
 	pji->print_header =
-		anjuta_preferences_get_int_with_default (p, PRINT_HEADER, 1);
+		anjuta_preferences_get_bool_with_default (p, PRINT_HEADER, 1);
 	pji->print_color =
-		anjuta_preferences_get_int_with_default (p, PRINT_COLOR, 1);
+		anjuta_preferences_get_bool_with_default (p, PRINT_COLOR, 1);
 	pji->wrapping =
-		anjuta_preferences_get_int_with_default (p, PRINT_WRAP, 1);
+		anjuta_preferences_get_bool_with_default (p, PRINT_WRAP, 1);
 	pji->tab_width =
 		anjuta_preferences_get_int_with_default (p, TAB_SIZE, 8);
 	pji->zoom_factor = anjuta_preferences_get_int (te->preferences,

Modified: trunk/plugins/scintilla/scintilla/PlatGTK.cxx
==============================================================================
--- trunk/plugins/scintilla/scintilla/PlatGTK.cxx	(original)
+++ trunk/plugins/scintilla/scintilla/PlatGTK.cxx	Fri Apr 10 22:36:36 2009
@@ -1760,7 +1760,7 @@
 #else
 
 	gtk_widget_set_uposition(id, rc.left, rc.top);
-	gtk_widget_set_usize(id, rc.right - rc.left, rc.bottom - rc.top);
+	gtk_widget_set_size_request(id, rc.right - rc.left, rc.bottom - rc.top);
 #endif
 }
 
@@ -1787,7 +1787,7 @@
 	if (oy + sizey > screenHeight)
 		oy = screenHeight - sizey;
 
-	gtk_widget_set_uposition(PWidget(id), ox, oy);
+	gdk_window_move(PWidget(id)->window, ox, oy);
 #if 0
 
 	GtkAllocation alloc;
@@ -1797,7 +1797,7 @@
 	alloc.height = rc.bottom - rc.top;
 	gtk_widget_size_allocate(id, &alloc);
 #endif
-	gtk_widget_set_usize(PWidget(id), sizex, sizey);
+	gtk_widget_set_size_request(PWidget(id), sizex, sizey);
 }
 
 PRectangle Window::GetClientPosition() {
@@ -1917,7 +1917,7 @@
 		gdk_bitmap_unref(list_image->bitmap);
 #else
 	if (list_image->pixbuf)
-		gdk_pixbuf_unref (list_image->pixbuf);
+		g_object_unref (list_image->pixbuf);
 #endif
 	g_free(list_image);
 }
@@ -2178,14 +2178,14 @@
 		          + 2 * (ythickness
 		                 + GTK_CONTAINER(PWidget(list))->border_width + 1));
 #endif
-		gtk_widget_set_usize(GTK_WIDGET(PWidget(list)), -1, height);
+		gtk_widget_set_size_request(GTK_WIDGET(PWidget(list)), -1, height);
 
 		// Get the size of the scroller because we set usize on the window
 		gtk_widget_size_request(GTK_WIDGET(scroller), &req);
 		rc.right = req.width;
 		rc.bottom = req.height;
 
-		gtk_widget_set_usize(GTK_WIDGET(list), -1, -1);
+		gtk_widget_set_size_request(GTK_WIDGET(list), -1, -1);
 		int width = maxItemCharacters;
 		if (width < 12)
 			width = 12;
@@ -2247,7 +2247,7 @@
 	}
 #else
 	if (list_image->pixbuf)
-		gdk_pixbuf_unref(list_image->pixbuf);
+		g_object_unref(list_image->pixbuf);
 	list_image->pixbuf =
 		gdk_pixbuf_new_from_xpm_data((const gchar**)xpm_lineform);
 #endif
@@ -2474,7 +2474,7 @@
 		list_image->bitmap = 0;
 #else
 		if (list_image->pixbuf)
-			gdk_pixbuf_unref(list_image->pixbuf);
+			g_object_unref(list_image->pixbuf);
 		list_image->pixbuf = NULL;
 #endif
 		list_image->xpm_data = xpm_data;

Modified: trunk/plugins/scintilla/scintilla/ScintillaGTK.cxx
==============================================================================
--- trunk/plugins/scintilla/scintilla/ScintillaGTK.cxx	(original)
+++ trunk/plugins/scintilla/scintilla/ScintillaGTK.cxx	Fri Apr 10 22:36:36 2009
@@ -992,7 +992,11 @@
 	if (timer.ticking != on) {
 		timer.ticking = on;
 		if (timer.ticking) {
+#if GLIB_MAJOR_VERSION < 2
 			timer.tickerID = reinterpret_cast<TickerID>(gtk_timeout_add(timer.tickSize, (GtkFunction)TimeOut, this));
+#else
+			timer.tickerID = reinterpret_cast<TickerID>(g_timeout_add(timer.tickSize, (GSourceFunc)TimeOut, this));
+#endif
 		} else {
 			gtk_timeout_remove(GPOINTER_TO_UINT(timer.tickerID));
 		}

Modified: trunk/plugins/scintilla/scintilla/test-scintilla.cxx
==============================================================================
--- trunk/plugins/scintilla/scintilla/test-scintilla.cxx	(original)
+++ trunk/plugins/scintilla/scintilla/test-scintilla.cxx	Fri Apr 10 22:36:36 2009
@@ -95,7 +95,7 @@
 	gtk_container_add (GTK_CONTAINER(win), sci);
 	g_signal_connect (G_OBJECT (win), "delete-event",
 					  G_CALLBACK (gtk_main_quit), NULL);
-	gtk_widget_set_usize (GTK_WIDGET (win), 500, 600);
+	gtk_widget_set_size_request (GTK_WIDGET (win), 500, 600);
 	gtk_window_set_default_size (GTK_WINDOW (win), 500, 600);
 	gtk_widget_show (sci);
 	gtk_widget_show (win);

Modified: trunk/plugins/scintilla/style-editor.c
==============================================================================
--- trunk/plugins/scintilla/style-editor.c	(original)
+++ trunk/plugins/scintilla/style-editor.c	Fri Apr 10 22:36:36 2009
@@ -21,7 +21,10 @@
 #endif
 
 #include <ctype.h>
-#include <gnome.h>
+#include <stdlib.h>
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+#include <gdk/gdkkeysyms.h>
 #include <glade/glade.h>
 
 #include <libanjuta/anjuta-utils.h>
@@ -83,7 +86,7 @@
 {
 	/* Widgets */
 	GtkWidget *dialog;
-	GtkWidget *hilite_item_combo;
+	GtkWidget *hilite_item_combobox;
 	GtkWidget *font_picker;
 	GtkWidget *font_bold_check;
 	GtkWidget *font_italics_check;
@@ -562,7 +565,7 @@
 }
 
 static void
-on_hilite_style_entry_changed (GtkEditable * editable, gpointer user_data)
+on_hilite_style_entry_changed (GtkComboBox * combobox, gpointer user_data)
 {
 	StyleEditor *p;
 	const gchar *style_item;
@@ -570,7 +573,7 @@
 	g_return_if_fail (user_data);
 	p = user_data;
 
-	style_item = gtk_entry_get_text (GTK_ENTRY (editable));
+	style_item = gtk_combo_box_get_active_text (combobox);
 	if (!style_item || strlen (style_item) <= 0)
 		return;
 	if (p->priv->current_style)
@@ -689,15 +692,14 @@
 		style_data_set_item (sdata, hilite_style[i]);
 		g_object_set_data_full (G_OBJECT (se->priv->dialog),
 					  hilite_style[i], sdata,
-					  (GtkDestroyNotify)style_data_destroy);
+					  (GDestroyNotify)style_data_destroy);
 	}
 	se->priv->default_style =
-		gtk_object_get_data (GTK_OBJECT (se->priv->dialog),
+		g_object_get_data (G_OBJECT (se->priv->dialog),
 				     hilite_style[0]);
 	se->priv->current_style = NULL;
 
-	on_hilite_style_entry_changed (GTK_EDITABLE (GTK_COMBO
-					(se->priv->hilite_item_combo)->entry), se);
+	on_hilite_style_entry_changed (GTK_COMBO_BOX (se->priv->hilite_item_combobox), se);
 
 	str = sci_prop_get (se->props, CARET_FORE_COLOR);
 	if(str)
@@ -800,8 +802,7 @@
 
 	g_return_if_fail (se);
 	/* Sync the current item */	
-	on_hilite_style_entry_changed (GTK_EDITABLE (GTK_COMBO
-					(se->priv->hilite_item_combo)->entry), se);
+	on_hilite_style_entry_changed (GTK_COMBO_BOX (se->priv->hilite_item_combobox), se);
 	
 	/* Transfer to props */
 	for (i = 0;; i += 2)
@@ -811,7 +812,7 @@
 		if (hilite_style[i] == NULL)
 			break;
 		sdata =
-			gtk_object_get_data (GTK_OBJECT (se->priv->dialog),
+			g_object_get_data (G_OBJECT (se->priv->dialog),
 								 hilite_style[i]);
 		str = style_data_get_string (sdata);
 		if (str)
@@ -883,7 +884,6 @@
 {
 	GladeXML *gxml;
 	GtkWidget *pref_dialog;
-	GList *list = NULL;
 	gint i;
 
 	g_return_if_fail (se);
@@ -893,7 +893,7 @@
 	se->priv->dialog = glade_xml_get_widget (gxml, "style_editor_dialog");
 	gtk_widget_show (se->priv->dialog);
 	se->priv->font_picker = glade_xml_get_widget (gxml, "font");
-	se->priv->hilite_item_combo = glade_xml_get_widget (gxml, "combo");
+	se->priv->hilite_item_combobox = glade_xml_get_widget (gxml, "comboBox");
 	se->priv->font_bold_check = glade_xml_get_widget (gxml, "bold");
 	se->priv->font_italics_check = glade_xml_get_widget (gxml, "italic");
 	se->priv->font_underlined_check = glade_xml_get_widget (gxml, "underlined");
@@ -912,17 +912,15 @@
 	{
 		if (hilite_style[i] == NULL)
 			break;
-		list = g_list_append (list, hilite_style[i]);
+		gtk_combo_box_append_text (GTK_COMBO_BOX (se->priv->hilite_item_combobox), hilite_style[i]);
+
 	}
-	gtk_combo_set_popdown_strings (GTK_COMBO (se->priv->hilite_item_combo), list);
-	g_list_free (list);
 	
 	pref_dialog = anjuta_preferences_get_dialog (se->prefs);
 	gtk_window_set_transient_for (GTK_WINDOW (se->priv->dialog),
 								  GTK_WINDOW (pref_dialog));
 	
-	g_signal_connect (G_OBJECT (GTK_COMBO(se->priv->hilite_item_combo)->entry),
-					  "changed", G_CALLBACK (on_hilite_style_entry_changed),
+	g_signal_connect (se->priv->hilite_item_combobox, "changed", G_CALLBACK (on_hilite_style_entry_changed),
 					  se);
 	g_signal_connect (G_OBJECT (se->priv->font_use_default_check),
 					  "toggled", G_CALLBACK (on_use_default_font_toggled),

Modified: trunk/plugins/scintilla/text-editor-iterable.c
==============================================================================
--- trunk/plugins/scintilla/text-editor-iterable.c	(original)
+++ trunk/plugins/scintilla/text-editor-iterable.c	Fri Apr 10 22:36:36 2009
@@ -23,6 +23,7 @@
 #endif
 
 #include <ctype.h>
+#include <stdlib.h>
 #include <libanjuta/anjuta-utils.h>
 #include <libanjuta/anjuta-debug.h>
 #include <libanjuta/interfaces/ianjuta-iterable.h>

Modified: trunk/plugins/scintilla/text_editor.c
==============================================================================
--- trunk/plugins/scintilla/text_editor.c	(original)
+++ trunk/plugins/scintilla/text_editor.c	Fri Apr 10 22:36:36 2009
@@ -25,9 +25,11 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <string.h>
+#include <stdlib.h>
 #include <ctype.h>
 #include <gio/gio.h>
-#include <gnome.h>
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
 #include <errno.h>
 
 #include <libanjuta/resources.h>
@@ -130,7 +132,7 @@
 	te->props_base = 0;
 	te->first_time_expose = TRUE;
 	te->encoding = NULL;
-	te->gconf_notify_ids = NULL;
+	te->notify_ids = NULL;
 	te->hover_tip_on = FALSE;
 	te->last_saved_content = NULL;
 	te->force_not_saved = FALSE;
@@ -612,10 +614,10 @@
 		te->editor_id = 0;
 		te->views = NULL;
 	}
-	if (te->gconf_notify_ids)
+	if (te->notify_ids)
 	{
 		text_editor_prefs_finalize (te);
-		te->gconf_notify_ids = NULL;
+		te->notify_ids = NULL;
 	}
 	G_OBJECT_CLASS (parent_class)->dispose (obj);
 }
@@ -671,7 +673,7 @@
 {
 	/* If syntax highlighting is disabled ... */
 	if (override_by_pref &&
-		anjuta_preferences_get_int (ANJUTA_PREFERENCES (te->preferences),
+		anjuta_preferences_get_bool (ANJUTA_PREFERENCES (te->preferences),
 									DISABLE_SYNTAX_HILIGHTING))
 	{
 		aneditor_command (editor_id, ANE_SETHILITE, (glong) "plain.txt", 0);
@@ -1406,7 +1408,7 @@
 		/* DEBUG_PRINT ("File size and loaded size not matching"); */
 	}
 	dos_filter = 
-		anjuta_preferences_get_int (ANJUTA_PREFERENCES (te->preferences),
+		anjuta_preferences_get_bool (ANJUTA_PREFERENCES (te->preferences),
 									DOS_EOL_CHECK);
 	
 	/* Set editor mode */
@@ -1528,7 +1530,7 @@
 		}				
 		
 		/* Strip trailing spaces */
-		strip = anjuta_preferences_get_int (te->preferences,
+		strip = anjuta_preferences_get_bool (te->preferences,
 											STRIP_TRAILING_SPACES);
 		if (strip)
 		{
@@ -1540,7 +1542,7 @@
 			data[size] = '\n';
 			++ size;
 		}
-		dos_filter = anjuta_preferences_get_int (te->preferences,
+		dos_filter = anjuta_preferences_get_bool (te->preferences,
 												 DOS_EOL_CHECK);
 		editor_mode =  scintilla_send_message (SCINTILLA (te->scintilla),
 											   SCI_GETEOLMODE, 0, 0);
@@ -1607,7 +1609,7 @@
 	scintilla_send_message (SCINTILLA (te->scintilla),
 							SCI_EMPTYUNDOBUFFER, 0, 0);
 	text_editor_set_hilite_type (te, NULL);
-	if (anjuta_preferences_get_int (te->preferences, FOLD_ON_OPEN))
+	if (anjuta_preferences_get_bool (te->preferences, FOLD_ON_OPEN))
 	{
 		aneditor_command (te->editor_id, ANE_CLOSE_FOLDALL, 0, 0);
 	}
@@ -2060,8 +2062,8 @@
 text_editor_set_line_number_width (TextEditor* te)
 {
 	/* Set line numbers with according to file size */
-	if (anjuta_preferences_get_int_with_default(te->preferences,
-			"margin.linenumber.visible", 0))
+	if (anjuta_preferences_get_bool_with_default(te->preferences,
+			"margin.linenumber.visible", FALSE))
 	{
 		int lines, line_number_width;
 		gchar* line_number;

Modified: trunk/plugins/scintilla/text_editor.h
==============================================================================
--- trunk/plugins/scintilla/text_editor.h	(original)
+++ trunk/plugins/scintilla/text_editor.h	Fri Apr 10 22:36:36 2009
@@ -95,8 +95,8 @@
 	/* Popup menu widget */
 	GtkWidget *popup_menu;
 	
-	/* Gconf notify IDs */
-	GList* gconf_notify_ids;
+	/* notify IDs */
+	GList* notify_ids;
 	
 	/* Current zoom factor */
 	gint zoom_factor;

Modified: trunk/plugins/scintilla/text_editor_cbs.c
==============================================================================
--- trunk/plugins/scintilla/text_editor_cbs.c	(original)
+++ trunk/plugins/scintilla/text_editor_cbs.c	Fri Apr 10 22:36:36 2009
@@ -20,7 +20,9 @@
 #  include <config.h>
 #endif
 
-#include <gnome.h>
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+#include <gdk/gdkkeysyms.h>
 #include <ctype.h>
 
 #include <libanjuta/resources.h>

Modified: trunk/plugins/scintilla/text_editor_cbs.h
==============================================================================
--- trunk/plugins/scintilla/text_editor_cbs.h	(original)
+++ trunk/plugins/scintilla/text_editor_cbs.h	Fri Apr 10 22:36:36 2009
@@ -19,7 +19,8 @@
 #ifndef _TEXT_EDITOR_CBS_H_
 #define _TEXT_EDITOR_CBS_H_
 
-#include <gnome.h>
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
 #include "text_editor.h"
 
 gboolean

Modified: trunk/plugins/scintilla/text_editor_prefs.c
==============================================================================
--- trunk/plugins/scintilla/text_editor_prefs.c	(original)
+++ trunk/plugins/scintilla/text_editor_prefs.c	Fri Apr 10 22:36:36 2009
@@ -20,9 +20,6 @@
 #include <libanjuta/anjuta-preferences.h>
 #include <libanjuta/anjuta-debug.h>
 
-#include <glib.h>
-#include <gconf/gconf-client.h>
-
 #include "properties.h"
 #include "text_editor_prefs.h"
 #include "text_editor_cbs.h"
@@ -65,7 +62,7 @@
 }
 
 static void
-pref_gconf_notify (GConfClient *gclient, guint cnxn_id,
+pref_notify (GConfClient *gclient, guint cnxn_id,
 				   GConfEntry *entry, gpointer user_data)
 {
 	PrefPassedData *pd = (PrefPassedData*)user_data;
@@ -90,6 +87,17 @@
 	return val;
 }
 
+static gint
+set_n_get_prop_bool (TextEditor *te, const gchar *key)
+{
+	gboolean val;
+	AnjutaPreferences *pr;
+	pr = te->preferences;
+	val = anjuta_preferences_get_bool (pr, key);
+	sci_prop_set_int_with_key (text_editor_get_props (), key, val);
+	return val;
+}
+
 static gchar *
 set_n_get_prop_string (TextEditor *te, const gchar *key)
 {
@@ -102,8 +110,10 @@
 }
 
 static void
-on_gconf_notify_disable_hilite (GConfClient *gclient, guint cnxn_id,
-								GConfEntry *entry, gpointer user_data)
+on_notify_disable_hilite (AnjutaPreferences* prefs,
+                          const gchar* key,
+                          gboolean value,
+                          gpointer user_data)
 {
 	TextEditor *te;
 	
@@ -113,12 +123,14 @@
 }
 
 static void
-on_gconf_notify_zoom_factor (GConfClient *gclient, guint cnxn_id,
-							 GConfEntry *entry, gpointer user_data)
+on_notify_zoom_factor(AnjutaPreferences* prefs,
+                      const gchar* key,
+                      gint value,
+                      gpointer user_data)
 {
 	TextEditor *te;
 	gint zoom_factor;
-	
+
 	te = TEXT_EDITOR (user_data);
 	zoom_factor = set_n_get_prop_int (te, TEXT_ZOOM_FACTOR);
 	text_editor_set_zoom_factor (te, zoom_factor);
@@ -126,222 +138,211 @@
 }
 
 static void
-on_gconf_notify_tab_size (GConfClient *gclient, guint cnxn_id,
-						  GConfEntry *entry, gpointer user_data)
+on_notify_tab_size (AnjutaPreferences* prefs,
+                    const gchar* key,
+                    gint value,
+                    gpointer user_data)
 {
 	TextEditor *te;
 	gint tab_size;
-	
+
 	te = TEXT_EDITOR (user_data);
 	tab_size = set_n_get_prop_int (te, TAB_SIZE);
 	text_editor_command (te, ANE_SETTABSIZE, tab_size, 0);
 }
 
 static void
-on_gconf_notify_use_tab_for_indentation (GConfClient *gclient, guint cnxn_id,
-										 GConfEntry *entry, gpointer user_data)
+on_notify_use_tab_for_indentation(AnjutaPreferences* prefs,
+                                  const gchar* key,
+                                  gboolean value,
+                                  gpointer user_data)
 {
 	TextEditor *te;
 	gboolean use_tabs;
-	
+
 	te = TEXT_EDITOR (user_data);
 	use_tabs = set_n_get_prop_int (te, USE_TABS);
 	text_editor_command (te, ANE_SETUSETABFORINDENT, use_tabs, 0);
 	// text_editor_scintilla_command (te, SCI_SETTABWIDTH,	use_tabs, 0);
 }
 
-#if 0
-static void
-on_gconf_notify_automatic_indentation (GConfClient *gclient, guint cnxn_id,
-									   GConfEntry *entry, gpointer user_data)
-{
-	TextEditor *te;
-	gboolean indent_automatic;
-	
-	te = TEXT_EDITOR (user_data);
-	indent_automatic = set_n_get_prop_int (te, INDENT_AUTOMATIC);
-	text_editor_command (te, ANE_SETAUTOINDENTATION, indent_automatic, 0);
-}
-#endif
-
 static void
-on_gconf_notify_indent_size (GConfClient *gclient, guint cnxn_id,
-							 GConfEntry *entry, gpointer user_data)
+on_notify_indent_size (AnjutaPreferences* prefs,
+                       const gchar* key,
+                       gint value,
+                       gpointer user_data)
 {
 	TextEditor *te;
 	gint indent_size;
-	
+
 	te = TEXT_EDITOR (user_data);
 	indent_size = set_n_get_prop_int (te, INDENT_SIZE);
 	text_editor_command (te, ANE_SETINDENTSIZE, indent_size, 0);
 }
 
 static void
-on_gconf_notify_wrap_bookmarks (GConfClient *gclient, guint cnxn_id,
-								GConfEntry *entry, gpointer user_data)
+on_notify_wrap_bookmarks(AnjutaPreferences* prefs,
+                         const gchar* key,
+                         gboolean value,
+                         gpointer user_data)
 {
 	TextEditor *te;
 	gboolean state;
-	
+
 	te = TEXT_EDITOR (user_data);
 	state = set_n_get_prop_int (te, WRAP_BOOKMARKS);
 	text_editor_command (te, ANE_SETWRAPBOOKMARKS, state, 0);
 }
 
 static void
-on_gconf_notify_braces_check (GConfClient *gclient, guint cnxn_id,
-							  GConfEntry *entry, gpointer user_data)
+on_notify_braces_check (AnjutaPreferences* prefs,
+                        const gchar* key,
+                        gboolean value,
+                        gpointer user_data)
 {
 	TextEditor *te;
 	gboolean state;
-	
+
 	te = TEXT_EDITOR (user_data);
 	state = set_n_get_prop_int (te, BRACES_CHECK);
 	text_editor_command (te, ANE_SETINDENTBRACESCHECK, state, 0);
 }
 
-#if 0
 static void
-on_gconf_notify_indent_opening (GConfClient *gclient, guint cnxn_id,
-								GConfEntry *entry, gpointer user_data)
+on_notify_indent_maintain (AnjutaPreferences* prefs,
+                           const gchar* key,
+                           gboolean value,
+                           gpointer user_data)
 {
 	TextEditor *te;
 	gboolean state;
-	
-	te = TEXT_EDITOR (user_data);
-	state = set_n_get_prop_int (te, INDENT_OPENING);
-	text_editor_command (te, ANE_SETINDENTOPENING, state, 0);
-}
 
-static void
-on_gconf_notify_indent_closing (GConfClient *gclient, guint cnxn_id,
-								GConfEntry *entry, gpointer user_data)
-{
-	TextEditor *te;
-	gboolean state;
-	
-	te = TEXT_EDITOR (user_data);
-	state = set_n_get_prop_int (te, INDENT_CLOSING);
-	text_editor_command (te, ANE_SETINDENTCLOSING, state, 0);
-}
-
-#endif
-
-static void
-on_gconf_notify_indent_maintain (GConfClient *gclient, guint cnxn_id,
-								 GConfEntry *entry, gpointer user_data)
-{
-	TextEditor *te;
-	gboolean state;
-	
 	te = TEXT_EDITOR (user_data);
 	state = set_n_get_prop_int (te, INDENT_MAINTAIN);
 	text_editor_command (te, ANE_SETINDENTMAINTAIN, state, 0);
 }
 
 static void
-on_gconf_notify_tab_indents (GConfClient *gclient, guint cnxn_id,
-							 GConfEntry *entry, gpointer user_data)
+on_notify_tab_indents (AnjutaPreferences* prefs,
+                       const gchar* key,
+                       gboolean value,
+                       gpointer user_data)
 {
 	TextEditor *te;
 	gboolean state;
-	
+
 	te = TEXT_EDITOR (user_data);
 	state = set_n_get_prop_int (te, TAB_INDENTS);
 	text_editor_command (te, ANE_SETTABINDENTS, state, 0);
 }
 
 static void
-on_gconf_notify_backspace_unindents (GConfClient *gclient, guint cnxn_id,
-									 GConfEntry *entry, gpointer user_data)
+on_notify_backspace_unindents (AnjutaPreferences* prefs,
+                               const gchar* key,
+                               gboolean value,
+                               gpointer user_data)
 {
 	TextEditor *te;
 	gboolean state;
-	
+
 	te = TEXT_EDITOR (user_data);
 	state = set_n_get_prop_int (te, BACKSPACE_UNINDENTS);
 	text_editor_command (te, ANE_SETBACKSPACEUNINDENTS, state, 0);
 }
 
 static void
-on_gconf_notify_view_eols (GConfClient *gclient, guint cnxn_id,
-							   GConfEntry *entry, gpointer user_data)
+on_notify_view_eols (AnjutaPreferences* prefs,
+                     const gchar* key,
+                     gint value,
+                     gpointer user_data)
 {
 	TextEditor *te;
 	gboolean state;
-	
+
 	te = TEXT_EDITOR (user_data);
 	state = set_n_get_prop_int (te, VIEW_EOL);
 	text_editor_command (te, ANE_VIEWEOL, state, 0);
 }
 
 static void
-on_gconf_notify_view_whitespaces (GConfClient *gclient, guint cnxn_id,
-								  GConfEntry *entry, gpointer user_data)
+on_notify_view_whitespaces (AnjutaPreferences* prefs,
+                            const gchar* key,
+                            gint value,
+                            gpointer user_data)
 {
 	TextEditor *te;
 	gboolean state;
-	
+
 	te = TEXT_EDITOR (user_data);
 	state = set_n_get_prop_int (te, VIEW_WHITE_SPACES);
 	text_editor_command (te, ANE_VIEWSPACE, state, 0);
 }
 
 static void
-on_gconf_notify_view_linewrap (GConfClient *gclient, guint cnxn_id,
-						  GConfEntry *entry, gpointer user_data)
+on_notify_view_linewrap (AnjutaPreferences* prefs,
+                         const gchar* key,
+                         gint value,
+                         gpointer user_data)
 {
 	TextEditor *te;
 	gboolean state;
-	
+
 	te = TEXT_EDITOR (user_data);
 	state = set_n_get_prop_int (te, VIEW_LINE_WRAP);
 	text_editor_command (te, ANE_LINEWRAP, state, 0);
 }
 
 static void
-on_gconf_notify_view_indentation_guides (GConfClient *gclient, guint cnxn_id,
-										 GConfEntry *entry, gpointer user_data)
+on_notify_view_indentation_guides (AnjutaPreferences* prefs,
+                                   const gchar* key,
+                                   gint value,
+                                   gpointer user_data)
 {
 	TextEditor *te;
 	gboolean state;
-	
+
 	te = TEXT_EDITOR (user_data);
 	state = set_n_get_prop_int (te, VIEW_INDENTATION_GUIDES);
 	text_editor_command (te, ANE_VIEWGUIDES, state, 0);
 }
 
 static void
-on_gconf_notify_view_folds (GConfClient *gclient, guint cnxn_id,
-							GConfEntry *entry, gpointer user_data)
+on_notify_view_folds (AnjutaPreferences* prefs,
+                      const gchar* key,
+                      gint value,
+                      gpointer user_data)
 {
 	TextEditor *te;
 	gboolean state;
-	
+
 	te = TEXT_EDITOR (user_data);
 	state = set_n_get_prop_int (te, VIEW_FOLD_MARGIN);
 	text_editor_command (te, ANE_FOLDMARGIN, state, 0);
 }
 
 static void
-on_gconf_notify_view_markers (GConfClient *gclient, guint cnxn_id,
-							  GConfEntry *entry, gpointer user_data)
+on_notify_view_markers (AnjutaPreferences* prefs,
+                        const gchar* key,
+                        gint value,
+                        gpointer user_data)
 {
 	TextEditor *te;
 	gboolean state;
-	
+
 	te = TEXT_EDITOR (user_data);
 	state = set_n_get_prop_int (te, VIEW_MARKER_MARGIN);
 	text_editor_command (te, ANE_SELMARGIN, state, 0);
 }
 
 static void
-on_gconf_notify_view_linenums (GConfClient *gclient, guint cnxn_id,
-							   GConfEntry *entry, gpointer user_data)
+on_notify_view_linenums (AnjutaPreferences* prefs,
+                         const gchar* key,
+                         gint value,
+                         gpointer user_data)
 {
 	TextEditor *te;
 	gboolean state;
-	
+
 	te = TEXT_EDITOR (user_data);
 	state = set_n_get_prop_int (te, VIEW_LINENUMBERS_MARGIN);
 	text_editor_command (te, ANE_LINENUMBERMARGIN, state, 0);
@@ -349,12 +350,14 @@
 }
 
 static void
-on_gconf_notify_fold_symbols (GConfClient *gclient, guint cnxn_id,
-							  GConfEntry *entry, gpointer user_data)
+on_notify_fold_symbols (AnjutaPreferences* prefs,
+                        const gchar* key,
+                        gint value,
+                        gpointer user_data)
 {
 	TextEditor *te;
 	gchar *symbols;
-	
+
 	te = TEXT_EDITOR (user_data);
 	symbols = set_n_get_prop_string (te, FOLD_SYMBOLS);
 	text_editor_command (te, ANE_SETFOLDSYMBOLS, (long)symbols, 0);
@@ -362,33 +365,37 @@
 }
 
 static void
-on_gconf_notify_fold_underline (GConfClient *gclient, guint cnxn_id,
-								GConfEntry *entry, gpointer user_data)
+on_notify_fold_underline (AnjutaPreferences* prefs,
+                          const gchar* key,
+                          gint value,
+                          gpointer user_data)
 {
 	TextEditor *te;
 	gboolean state;
-	
+
 	te = TEXT_EDITOR (user_data);
 	state = set_n_get_prop_int (te, FOLD_UNDERLINE);
 	text_editor_command (te, ANE_SETFOLDUNDERLINE, state, 0);
 }
 
 static void
-on_gconf_notify_edge_column (GConfClient *gclient, guint cnxn_id,
-								GConfEntry *entry, gpointer user_data)
+on_notify_edge_column (AnjutaPreferences* prefs,
+                       const gchar* key,
+                       gint value,
+                       gpointer user_data)
 {
 	TextEditor *te;
 	gint size;
-	
+
 	te = TEXT_EDITOR (user_data);
 	size = set_n_get_prop_int (te, EDGE_COLUMN);
 	text_editor_command (te, ANE_SETEDGECOLUMN, size, 0);
 }
 
-#define REGISTER_NOTIFY(key, func) \
-	notify_id = anjuta_preferences_notify_add (te->preferences, \
+#define REGISTER_NOTIFY(key, func, type) \
+	notify_id = anjuta_preferences_notify_add_##type (te->preferences, \
 											   key, func, te, NULL); \
-	te->gconf_notify_ids = g_list_prepend (te->gconf_notify_ids, \
+	te->notify_ids = g_list_prepend (te->notify_ids, \
 										   GUINT_TO_POINTER (notify_id));
 
 void
@@ -401,76 +408,68 @@
 	set_n_get_prop_int (te, TAB_SIZE);
 	set_n_get_prop_int (te, TEXT_ZOOM_FACTOR);
 	set_n_get_prop_int (te, INDENT_SIZE);
-	set_n_get_prop_int (te, USE_TABS);
-	set_n_get_prop_int (te, DISABLE_SYNTAX_HILIGHTING);
-	/* set_n_get_prop_int (te, INDENT_AUTOMATIC); */
-	set_n_get_prop_int (te, WRAP_BOOKMARKS);
-	set_n_get_prop_int (te, BRACES_CHECK);
-	/*
-	set_n_get_prop_int (te, INDENT_OPENING);
-	set_n_get_prop_int (te, INDENT_CLOSING);
-	*/
+	set_n_get_prop_bool (te, USE_TABS);
+	set_n_get_prop_bool (te, DISABLE_SYNTAX_HILIGHTING);
+	set_n_get_prop_bool (te, WRAP_BOOKMARKS);
+	set_n_get_prop_bool (te, BRACES_CHECK);
+
 	
 	/* This one is special */
-	val = set_n_get_prop_int (te, INDENT_MAINTAIN);
+	val = set_n_get_prop_bool (te, INDENT_MAINTAIN);
 	if (val)
 		sci_prop_set_int_with_key (te->props_base, INDENT_MAINTAIN".*", 1);
 	else
-		sci_prop_set_with_key (te->props_base, INDENT_MAINTAIN".*", "");
+		sci_prop_set_int_with_key (te->props_base, INDENT_MAINTAIN".*", 0);
 	
-	set_n_get_prop_int (te, TAB_INDENTS);
-	set_n_get_prop_int (te, BACKSPACE_UNINDENTS);
+	set_n_get_prop_bool (te, TAB_INDENTS);
+	set_n_get_prop_bool (te, BACKSPACE_UNINDENTS);
 	
-	set_n_get_prop_int (te, VIEW_EOL);
-	set_n_get_prop_int (te, VIEW_LINE_WRAP);
-	set_n_get_prop_int (te, VIEW_WHITE_SPACES);
-	set_n_get_prop_int (te, VIEW_INDENTATION_GUIDES);
-	set_n_get_prop_int (te, VIEW_FOLD_MARGIN);
-	set_n_get_prop_int (te, VIEW_MARKER_MARGIN);
-	set_n_get_prop_int (te, VIEW_LINENUMBERS_MARGIN);
+	set_n_get_prop_bool (te, VIEW_EOL);
+	set_n_get_prop_bool (te, VIEW_LINE_WRAP);
+	set_n_get_prop_bool (te, VIEW_WHITE_SPACES);
+	set_n_get_prop_bool (te, VIEW_INDENTATION_GUIDES);
+	set_n_get_prop_bool (te, VIEW_FOLD_MARGIN);
+	set_n_get_prop_bool (te, VIEW_MARKER_MARGIN);
+	set_n_get_prop_bool (te, VIEW_LINENUMBERS_MARGIN);
 	g_free (set_n_get_prop_string (te, FOLD_SYMBOLS));
-	set_n_get_prop_int (te, FOLD_UNDERLINE);
+	set_n_get_prop_bool (te, FOLD_UNDERLINE);
 	set_n_get_prop_int (te, EDGE_COLUMN);
 	
 	/* Register gconf notifications */
-	REGISTER_NOTIFY (TAB_SIZE, on_gconf_notify_tab_size);
-	REGISTER_NOTIFY (TEXT_ZOOM_FACTOR, on_gconf_notify_zoom_factor);
-	REGISTER_NOTIFY (INDENT_SIZE, on_gconf_notify_indent_size);
-	REGISTER_NOTIFY (USE_TABS, on_gconf_notify_use_tab_for_indentation);
-	REGISTER_NOTIFY (DISABLE_SYNTAX_HILIGHTING, on_gconf_notify_disable_hilite);
-	/* REGISTER_NOTIFY (INDENT_AUTOMATIC, on_gconf_notify_automatic_indentation); */
-	REGISTER_NOTIFY (WRAP_BOOKMARKS, on_gconf_notify_wrap_bookmarks);
-	REGISTER_NOTIFY (BRACES_CHECK, on_gconf_notify_braces_check);
-	/*
-	REGISTER_NOTIFY (INDENT_OPENING, on_gconf_notify_indent_opening);
-	REGISTER_NOTIFY (INDENT_CLOSING, on_gconf_notify_indent_closing);
-	*/
-	REGISTER_NOTIFY (INDENT_MAINTAIN, on_gconf_notify_indent_maintain);
-	REGISTER_NOTIFY (TAB_INDENTS, on_gconf_notify_tab_indents);
-	REGISTER_NOTIFY (BACKSPACE_UNINDENTS, on_gconf_notify_backspace_unindents);
-	REGISTER_NOTIFY (VIEW_EOL, on_gconf_notify_view_eols);
-	REGISTER_NOTIFY (VIEW_LINE_WRAP, on_gconf_notify_view_linewrap);
-	REGISTER_NOTIFY (VIEW_WHITE_SPACES, on_gconf_notify_view_whitespaces);
-	REGISTER_NOTIFY (VIEW_INDENTATION_GUIDES, on_gconf_notify_view_indentation_guides);
-	REGISTER_NOTIFY (VIEW_FOLD_MARGIN, on_gconf_notify_view_folds);
-	REGISTER_NOTIFY (VIEW_MARKER_MARGIN, on_gconf_notify_view_markers);
-	REGISTER_NOTIFY (VIEW_LINENUMBERS_MARGIN, on_gconf_notify_view_linenums);
-	REGISTER_NOTIFY (FOLD_SYMBOLS, on_gconf_notify_fold_symbols);
-	REGISTER_NOTIFY (FOLD_UNDERLINE, on_gconf_notify_fold_underline);
-	REGISTER_NOTIFY (EDGE_COLUMN, on_gconf_notify_edge_column);
+	REGISTER_NOTIFY (TAB_SIZE, on_notify_tab_size, int);
+	REGISTER_NOTIFY (TEXT_ZOOM_FACTOR, on_notify_zoom_factor, int);
+	REGISTER_NOTIFY (INDENT_SIZE, on_notify_indent_size, int);
+	REGISTER_NOTIFY (USE_TABS, on_notify_use_tab_for_indentation, bool);
+	REGISTER_NOTIFY (DISABLE_SYNTAX_HILIGHTING, on_notify_disable_hilite, bool);
+	/* REGISTER_NOTIFY (INDENT_AUTOMATIC, on_notify_automatic_indentation); */
+	REGISTER_NOTIFY (WRAP_BOOKMARKS, on_notify_wrap_bookmarks, bool);
+	REGISTER_NOTIFY (BRACES_CHECK, on_notify_braces_check, bool);
+	REGISTER_NOTIFY (INDENT_MAINTAIN, on_notify_indent_maintain, bool);
+	REGISTER_NOTIFY (TAB_INDENTS, on_notify_tab_indents, bool);
+	REGISTER_NOTIFY (BACKSPACE_UNINDENTS, on_notify_backspace_unindents, bool);
+	REGISTER_NOTIFY (VIEW_EOL, on_notify_view_eols, bool);
+	REGISTER_NOTIFY (VIEW_LINE_WRAP, on_notify_view_linewrap, bool);
+	REGISTER_NOTIFY (VIEW_WHITE_SPACES, on_notify_view_whitespaces, bool);
+	REGISTER_NOTIFY (VIEW_INDENTATION_GUIDES, on_notify_view_indentation_guides, bool);
+	REGISTER_NOTIFY (VIEW_FOLD_MARGIN, on_notify_view_folds, bool);
+	REGISTER_NOTIFY (VIEW_MARKER_MARGIN, on_notify_view_markers, bool);
+	REGISTER_NOTIFY (VIEW_LINENUMBERS_MARGIN, on_notify_view_linenums, bool);
+	REGISTER_NOTIFY (FOLD_SYMBOLS, on_notify_fold_symbols, bool);
+	REGISTER_NOTIFY (FOLD_UNDERLINE, on_notify_fold_underline, bool);
+	REGISTER_NOTIFY (EDGE_COLUMN, on_notify_edge_column, int);
 }
 
 void
 text_editor_prefs_finalize (TextEditor *te)
 {
 	GList *node;
-	node = te->gconf_notify_ids;
+	node = te->notify_ids;
 	while (node)
 	{
 		anjuta_preferences_notify_remove (te->preferences,
 										  GPOINTER_TO_UINT (node->data));
 		node = g_list_next (node);
 	}
-	g_list_free (te->gconf_notify_ids);
-	te->gconf_notify_ids = NULL;
+	g_list_free (te->notify_ids);
+	te->notify_ids = NULL;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]