gtkhtml r8739 - branches/mbarnes-composer/components/editor



Author: mbarnes
Date: Wed Feb 13 20:11:27 2008
New Revision: 8739
URL: http://svn.gnome.org/viewvc/gtkhtml?rev=8739&view=rev

Log:
Add properties: "inline-spelling", "magic-links", "magic-smileys"


Modified:
   branches/mbarnes-composer/components/editor/gtkhtml-editor.c
   branches/mbarnes-composer/components/editor/gtkhtml-editor.h

Modified: branches/mbarnes-composer/components/editor/gtkhtml-editor.c
==============================================================================
--- branches/mbarnes-composer/components/editor/gtkhtml-editor.c	(original)
+++ branches/mbarnes-composer/components/editor/gtkhtml-editor.c	Wed Feb 13 20:11:27 2008
@@ -28,7 +28,10 @@
 	PROP_0,
 	PROP_CURRENT_FOLDER,
 	PROP_FILENAME,
-	PROP_HTML_MODE
+	PROP_HTML_MODE,
+	PROP_INLINE_SPELLING,
+	PROP_MAGIC_LINKS,
+	PROP_MAGIC_SMILEYS
 };
 
 enum {
@@ -529,6 +532,24 @@
 				GTKHTML_EDITOR (object),
 				g_value_get_boolean (value));
 			return;
+
+		case PROP_INLINE_SPELLING:
+			gtkhtml_editor_set_inline_spelling (
+				GTKHTML_EDITOR (object),
+				g_value_get_boolean (value));
+			return;
+
+		case PROP_MAGIC_LINKS:
+			gtkhtml_editor_set_magic_links (
+				GTKHTML_EDITOR (object),
+				g_value_get_boolean (value));
+			return;
+
+		case PROP_MAGIC_SMILEYS:
+			gtkhtml_editor_set_magic_smileys (
+				GTKHTML_EDITOR (object),
+				g_value_get_boolean (value));
+			return;
 	}
 
 	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -558,6 +579,24 @@
 				value, gtkhtml_editor_get_html_mode (
 				GTKHTML_EDITOR (object)));
 			return;
+
+		case PROP_INLINE_SPELLING:
+			g_value_set_boolean (
+				value, gtkhtml_editor_get_inline_spelling (
+				GTKHTML_EDITOR (object)));
+			return;
+
+		case PROP_MAGIC_LINKS:
+			g_value_set_boolean (
+				value, gtkhtml_editor_get_magic_links (
+				GTKHTML_EDITOR (object)));
+			return;
+
+		case PROP_MAGIC_SMILEYS:
+			g_value_set_boolean (
+				value, gtkhtml_editor_get_magic_smileys (
+				GTKHTML_EDITOR (object)));
+			return;
 	}
 
 	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -640,6 +679,39 @@
 			G_PARAM_CONSTRUCT |
 			G_PARAM_READWRITE));
 
+	g_object_class_install_property (
+		object_class,
+		PROP_INLINE_SPELLING,
+		g_param_spec_boolean (
+			"inline-spelling",
+			_("Inline Spelling"),
+			_("Check your spelling as you type"),
+			TRUE,
+			G_PARAM_CONSTRUCT |
+			G_PARAM_READWRITE));
+
+	g_object_class_install_property (
+		object_class,
+		PROP_MAGIC_LINKS,
+		g_param_spec_boolean (
+			"magic-links",
+			_("Magic Links"),
+			_("Make URIs clickable as you type"),
+			TRUE,
+			G_PARAM_CONSTRUCT |
+			G_PARAM_READWRITE));
+
+	g_object_class_install_property (
+		object_class,
+		PROP_MAGIC_SMILEYS,
+		g_param_spec_boolean (
+			"magic-smileys",
+			_("Magic Smileys"),
+			_("Convert emoticons to images as you type"),
+			TRUE,
+			G_PARAM_CONSTRUCT |
+			G_PARAM_READWRITE));
+
 	signals[URL_REQUESTED] = g_signal_new (
 		"url-requested",
 		G_OBJECT_CLASS_TYPE (class),
@@ -802,6 +874,49 @@
 	return widget;
 }
 
+const gchar *
+gtkhtml_editor_get_current_folder (GtkhtmlEditor *editor)
+{
+	g_return_val_if_fail (GTKHTML_IS_EDITOR (editor), NULL);
+
+	return editor->priv->current_folder;
+}
+
+void
+gtkhtml_editor_set_current_folder (GtkhtmlEditor *editor,
+                                   const gchar *current_folder)
+{
+	g_return_if_fail (GTKHTML_IS_EDITOR (editor));
+
+	if (current_folder == NULL)
+		current_folder = g_get_home_dir ();
+
+	g_free (editor->priv->current_folder);
+	editor->priv->current_folder = g_strdup (current_folder);
+
+	g_object_notify (G_OBJECT (editor), "current-folder");
+}
+
+const gchar *
+gtkhtml_editor_get_filename (GtkhtmlEditor *editor)
+{
+	g_return_val_if_fail (GTKHTML_IS_EDITOR (editor), NULL);
+
+	return editor->priv->filename;
+}
+
+void
+gtkhtml_editor_set_filename (GtkhtmlEditor *editor,
+                             const gchar *filename)
+{
+	g_return_if_fail (GTKHTML_IS_EDITOR (editor));
+
+	g_free (editor->priv->filename);
+	editor->priv->filename = g_strdup (filename);
+
+	g_object_notify (G_OBJECT (editor), "filename");
+}
+
 gboolean
 gtkhtml_editor_get_html_mode (GtkhtmlEditor *editor)
 {
@@ -810,6 +925,7 @@
 	g_return_val_if_fail (GTKHTML_IS_EDITOR (editor), FALSE);
 
 	action = GTK_TOGGLE_ACTION (ACTION (HTML_MODE));
+
 	return gtk_toggle_action_get_active (action);
 }
 
@@ -827,47 +943,82 @@
 	g_object_notify (G_OBJECT (editor), "html-mode");
 }
 
-const gchar *
-gtkhtml_editor_get_current_folder (GtkhtmlEditor *editor)
+gboolean
+gtkhtml_editor_get_inline_spelling (GtkhtmlEditor *editor)
 {
-	g_return_val_if_fail (GTKHTML_IS_EDITOR (editor), NULL);
+	GtkHTML *html;
 
-	return editor->priv->current_folder;
+	g_return_val_if_fail (GTKHTML_IS_EDITOR (editor), FALSE);
+
+	html = gtkhtml_editor_get_html (editor);
+
+	return gtk_html_get_inline_spelling (html);
 }
 
 void
-gtkhtml_editor_set_current_folder (GtkhtmlEditor *editor,
-                                   const gchar *current_folder)
+gtkhtml_editor_set_inline_spelling (GtkhtmlEditor *editor,
+                                    gboolean inline_spelling)
 {
+	GtkHTML *html;
+
 	g_return_if_fail (GTKHTML_IS_EDITOR (editor));
 
-	if (current_folder == NULL)
-		current_folder = g_get_home_dir ();
+	html = gtkhtml_editor_get_html (editor);
+	gtk_html_set_inline_spelling (html, inline_spelling);
 
-	g_free (editor->priv->current_folder);
-	editor->priv->current_folder = g_strdup (current_folder);
+	g_object_notify (G_OBJECT (editor), "inline-spelling");
+}
 
-	g_object_notify (G_OBJECT (editor), "current-folder");
+gboolean
+gtkhtml_editor_get_magic_links (GtkhtmlEditor *editor)
+{
+	GtkHTML *html;
+
+	g_return_val_if_fail (GTKHTML_IS_EDITOR (editor), FALSE);
+
+	html = gtkhtml_editor_get_html (editor);
+
+	return gtk_html_get_magic_links (html);
 }
 
-const gchar *
-gtkhtml_editor_get_filename (GtkhtmlEditor *editor)
+void
+gtkhtml_editor_set_magic_links (GtkhtmlEditor *editor,
+                                gboolean magic_links)
 {
-	g_return_val_if_fail (GTKHTML_IS_EDITOR (editor), NULL);
+	GtkHTML *html;
 
-	return editor->priv->filename;
+	g_return_if_fail (GTKHTML_IS_EDITOR (editor));
+
+	html = gtkhtml_editor_get_html (editor);
+	gtk_html_set_magic_links (html, magic_links);
+
+	g_object_notify (G_OBJECT (editor), "magic-links");
+}
+
+gboolean
+gtkhtml_editor_get_magic_smileys (GtkhtmlEditor *editor)
+{
+	GtkHTML *html;
+
+	g_return_val_if_fail (GTKHTML_IS_EDITOR (editor), FALSE);
+
+	html = gtkhtml_editor_get_html (editor);
+
+	return gtk_html_get_magic_smileys (html);
 }
 
 void
-gtkhtml_editor_set_filename (GtkhtmlEditor *editor,
-                             const gchar *filename)
+gtkhtml_editor_set_magic_smileys (GtkhtmlEditor *editor,
+                                  gboolean magic_smileys)
 {
+	GtkHTML *html;
+
 	g_return_if_fail (GTKHTML_IS_EDITOR (editor));
 
-	g_free (editor->priv->filename);
-	editor->priv->filename = g_strdup (filename);
+	html = gtkhtml_editor_get_html (editor);
+	gtk_html_set_magic_smileys (html, magic_smileys);
 
-	g_object_notify (G_OBJECT (editor), "filename");
+	g_object_notify (G_OBJECT (editor), "magic-smileys");
 }
 
 gint

Modified: branches/mbarnes-composer/components/editor/gtkhtml-editor.h
==============================================================================
--- branches/mbarnes-composer/components/editor/gtkhtml-editor.h	(original)
+++ branches/mbarnes-composer/components/editor/gtkhtml-editor.h	Wed Feb 13 20:11:27 2008
@@ -83,9 +83,6 @@
 GtkWidget *	gtkhtml_editor_get_managed_widget
 						(GtkhtmlEditor *editor,
 						 const gchar *widget_path);
-gboolean	gtkhtml_editor_get_html_mode	(GtkhtmlEditor *editor);
-void		gtkhtml_editor_set_html_mode	(GtkhtmlEditor *editor,
-						 gboolean html_mode);
 const gchar *	gtkhtml_editor_get_current_folder
 						(GtkhtmlEditor *editor);
 void		gtkhtml_editor_set_current_folder
@@ -94,6 +91,20 @@
 const gchar *	gtkhtml_editor_get_filename	(GtkhtmlEditor *editor);
 void		gtkhtml_editor_set_filename	(GtkhtmlEditor *editor,
 						 const gchar *filename);
+gboolean	gtkhtml_editor_get_html_mode	(GtkhtmlEditor *editor);
+void		gtkhtml_editor_set_html_mode	(GtkhtmlEditor *editor,
+						 gboolean html_mode);
+gboolean	gtkhtml_editor_get_inline_spelling
+						(GtkhtmlEditor *editor);
+void		gtkhtml_editor_set_inline_spelling
+						(GtkhtmlEditor *editor,
+						 gboolean inline_spelling);
+gboolean	gtkhtml_editor_get_magic_links	(GtkhtmlEditor *editor);
+void		gtkhtml_editor_set_magic_links	(GtkhtmlEditor *editor,
+						 gboolean magic_links);
+gboolean	gtkhtml_editor_get_magic_smileys(GtkhtmlEditor *editor);
+void		gtkhtml_editor_set_magic_smileys(GtkhtmlEditor *editor,
+						 gboolean magic_smileys);
 gint		gtkhtml_editor_file_chooser_dialog_run
 						(GtkhtmlEditor *editor,
 						 GtkWidget *dialog);



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