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



Author: mbarnes
Date: Mon Feb 11 05:43:51 2008
New Revision: 8731
URL: http://svn.gnome.org/viewvc/gtkhtml?rev=8731&view=rev

Log:
Show individual widgets within the editor, so applications just need to
call gtk_widget_show() on the top-level window.


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

Modified: branches/mbarnes-composer/components/editor/gtkhtml-editor-private.c
==============================================================================
--- branches/mbarnes-composer/components/editor/gtkhtml-editor-private.c	(original)
+++ branches/mbarnes-composer/components/editor/gtkhtml-editor-private.c	Mon Feb 11 05:43:51 2008
@@ -91,15 +91,18 @@
 	widget = gtkhtml_editor_get_managed_widget (editor, "/main-menu");
 	gtk_box_pack_start (GTK_BOX (editor->vbox), widget, FALSE, FALSE, 0);
 	priv->main_menu = g_object_ref (widget);
+	gtk_widget_show (widget);
 
 	widget = gtkhtml_editor_get_managed_widget (editor, "/main-toolbar");
 	gtk_box_pack_start (GTK_BOX (editor->vbox), widget, FALSE, FALSE, 0);
 	priv->main_toolbar = g_object_ref (widget);
+	gtk_widget_show (widget);
 
 	widget = gtkhtml_editor_get_managed_widget (editor, "/edit-toolbar");
 	gtk_toolbar_set_style (GTK_TOOLBAR (widget), GTK_TOOLBAR_ICONS);
 	gtk_box_pack_start (GTK_BOX (editor->vbox), widget, FALSE, FALSE, 0);
 	priv->edit_toolbar = g_object_ref (widget);
+	gtk_widget_show (widget);
 
 	widget = gtk_scrolled_window_new (NULL, NULL);
 	gtk_scrolled_window_set_policy (
@@ -107,17 +110,20 @@
 		GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 	gtk_box_pack_start (GTK_BOX (editor->vbox), widget, TRUE, TRUE, 0);
 	priv->scrolled_window = g_object_ref (widget);
+	gtk_widget_show (widget);
 
 	widget = gtk_html_new ();
 	gtk_html_load_empty (GTK_HTML (widget));
 	gtk_html_set_editable (GTK_HTML (widget), TRUE);
 	gtk_container_add (GTK_CONTAINER (priv->scrolled_window), widget);
 	priv->edit_area = g_object_ref (widget);
+	gtk_widget_show (widget);
 
 	/* Add some combo boxes to the "edit" toolbar. */
 
 	tool_item = gtk_separator_tool_item_new ();
 	gtk_toolbar_insert (GTK_TOOLBAR (priv->edit_toolbar), tool_item, 0);
+	gtk_widget_show_all (GTK_WIDGET (tool_item));
 
 	tool_item = gtk_tool_item_new ();
 	widget = gtkhtml_combo_box_new_with_action (
@@ -126,9 +132,11 @@
 	gtk_container_add (GTK_CONTAINER (tool_item), widget);
 	gtk_toolbar_insert (GTK_TOOLBAR (priv->edit_toolbar), tool_item, 0);
 	priv->style_combo_box = g_object_ref (widget);
+	gtk_widget_show_all (GTK_WIDGET (tool_item));
 
 	tool_item = gtk_separator_tool_item_new ();
 	gtk_toolbar_insert (GTK_TOOLBAR (priv->edit_toolbar), tool_item, 0);
+	gtk_widget_show_all (GTK_WIDGET (tool_item));
 
 	tool_item = gtk_tool_item_new ();
 	widget = gtkhtml_combo_box_new_with_action (
@@ -137,9 +145,11 @@
 	gtk_container_add (GTK_CONTAINER (tool_item), widget);
 	gtk_toolbar_insert (GTK_TOOLBAR (priv->edit_toolbar), tool_item, 0);
 	priv->size_combo_box = g_object_ref (widget);
+	gtk_widget_show_all (GTK_WIDGET (tool_item));
 
 	tool_item = gtk_separator_tool_item_new ();
 	gtk_toolbar_insert (GTK_TOOLBAR (priv->edit_toolbar), tool_item, -1);
+	gtk_widget_show_all (GTK_WIDGET (tool_item));
 
 	tool_item = gtk_tool_item_new ();
 	widget = gtkhtml_color_combo_new ();
@@ -148,6 +158,7 @@
 	gtk_container_add (GTK_CONTAINER (tool_item), widget);
 	gtk_toolbar_insert (GTK_TOOLBAR (priv->edit_toolbar), tool_item, -1);
 	priv->color_combo_box = g_object_ref (widget);
+	gtk_widget_show_all (GTK_WIDGET (tool_item));
 
 	/* Initialize painters (requires "edit_area"). */
 

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	Mon Feb 11 05:43:51 2008
@@ -660,6 +660,7 @@
 
 	editor->priv = GTKHTML_EDITOR_GET_PRIVATE (editor);
 	editor->vbox = g_object_ref_sink (gtk_vbox_new (FALSE, 0));
+	gtk_widget_show (editor->vbox);
 
 	gtkhtml_editor_private_init (editor);
 
@@ -968,7 +969,7 @@
 	g_return_if_fail (GTKHTML_IS_EDITOR (editor));
 	g_return_if_fail (text != NULL);
 
-	/* XXX GtkHTML should really do this. */
+	/* XXX gtk_html_write() should really do this. */
 	if (length < 0)
 		length = strlen (text);
 
@@ -977,7 +978,12 @@
 	gtk_html_set_editable (html, FALSE);
 
 	stream = gtk_html_begin_content (html, "text/html; charset=utf-8");
-	gtk_html_write (html, stream, text, length);
+
+	/* XXX gtk_html_write() requires length > 0, which is
+	 *     unnecessary.  Zero length should be a no-op. */
+	if (length > 0)
+		gtk_html_write (html, stream, text, length);
+
 	gtk_html_end (html, stream, GTK_HTML_STREAM_OK);
 
 	gtk_html_set_editable (html, editable);

Modified: branches/mbarnes-composer/components/editor/main.c
==============================================================================
--- branches/mbarnes-composer/components/editor/main.c	(original)
+++ branches/mbarnes-composer/components/editor/main.c	Mon Feb 11 05:43:51 2008
@@ -405,7 +405,7 @@
 	gtk_ui_manager_insert_action_group (manager, action_group, 0);
 
 	gtk_ui_manager_ensure_update (manager);
-	gtk_widget_show_all (editor);
+	gtk_widget_show (editor);
 
 	g_signal_connect (
 		editor, "destroy",



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