Hello, This patch replaces the old completion widgets (GTK+ 1.x) by a new standalone one. I completely rewrote it since the last patch I posted ; this one is cleaner, simpler, usable. Nicolas Centa "HappyPeng" The tarball countains the new files, the patch countains the modification to existing ones.
? test.diff ? src/mlview-completion-table.c ? src/mlview-completion-table.h Index: src/Makefile.am =================================================================== RCS file: /cvs/gnome/mlview/src/Makefile.am,v retrieving revision 1.30 diff -a -u -r1.30 Makefile.am --- src/Makefile.am 24 Nov 2003 23:18:05 -0000 1.30 +++ src/Makefile.am 8 Jan 2004 21:02:00 -0000 @@ -54,8 +54,9 @@ mlview-icon-tree.c \ mlview-icon-tree.h \ mlview-xslt-utils.c \ - mlview-xslt-utils.h - + mlview-xslt-utils.h \ + mlview-completion-table.c \ + mlview-completion-table.h bin_PROGRAMS = mlv mlv_SOURCES = main.c Index: src/mlview-tree-view.c =================================================================== RCS file: /cvs/gnome/mlview/src/mlview-tree-view.c,v retrieving revision 1.17 diff -a -u -r1.17 mlview-tree-view.c --- src/mlview-tree-view.c 25 Dec 2003 23:10:49 -0000 1.17 +++ src/mlview-tree-view.c 8 Jan 2004 21:02:03 -0000 @@ -24,10 +24,13 @@ */ #include <string.h> + #include <glade/glade.h> + #include "mlview-tree-view.h" #include "mlview-tree-editor2.h" #include "mlview-icon-tree.h" +#include "mlview-completion-table.h" /** * file @@ -48,10 +51,6 @@ /*The main paned that divides the view in two main parts */ GtkPaned *main_paned; GtkPaned *upper_paned1; - GtkCList *feasible_children; - GtkCList *feasible_prev_siblings; - GtkCList *feasible_next_siblings; - GtkCList *feasible_attributes ; guint main_paned_percentage; gboolean dispose_has_run; } ; @@ -64,11 +63,6 @@ #define PRIVATE(tree_view) (tree_view->priv) static void -visual_node_selected_cb (MlViewTreeEditor2 * a_editor, - GtkTreeRowReference *a_ref, - gpointer a_user_data); - -static void tree_selected_cb (GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, @@ -80,37 +74,6 @@ static void toggle_expand_to_leaves_cb (GtkToggleButton * a_toggle_button, gpointer * a_depth_entry); -static void update_feasible_attributes_list_cb (MlViewTreeEditor2 * a_editor, - GtkTreeRowReference *a_ref, - gpointer a_user_data) ; - -static void update_feasible_next_siblings_list_cb (MlViewTreeEditor2 * a_editor, - GtkTreeRowReference * a_ref, - gpointer a_user_data); - -static void update_feasible_prev_siblings_list_cb (MlViewTreeEditor2 * a_editor, - GtkTreeRowReference * a_ref, - gpointer a_user_data); - -static void update_feasible_children_list_cb (MlViewTreeEditor2 * a_editor, - GtkTreeRowReference *a_ref, - gpointer a_user_data); - -static void selected_a_possible_child_cb (GtkCList * a_possible_children, - gint a_row, gint a_column, - GdkEventButton * event, - gpointer a_user_data); - -static void selected_a_possible_next_sibling_cb (GtkCList * a_possible_next_siblings, - gint a_row, gint a_column, - GdkEventButton * event, - gpointer a_user_data); - -static void selected_a_possible_prev_sibling_cb (GtkCList * a_possible_prev_siblings, - gint a_row, gint a_column, - GdkEventButton * event, - gpointer a_user_data); - static void doc_path_changed_cb (MlViewXMLDocument * a_xml_doc, gpointer a_xml_doc_tree_view); @@ -316,52 +279,6 @@ } /** - *This callback is called when an xml - *node is selected by the user. It calls the - *mlview_node_editor_edit_xml_node() method of the MlViewNodeEditor object. - * - */ -static void -visual_node_selected_cb (MlViewTreeEditor2 * a_editor, - GtkTreeRowReference * a_ref, - gpointer a_user_data) -{ - MlViewTreeView *view = NULL; - xmlNode *xml_node = NULL; - MlViewXMLDocument *mlview_xml_doc = NULL; - GtkTreeView *tree_view = NULL ; - - g_return_if_fail (a_editor - && MLVIEW_IS_TREE_EDITOR2 (a_editor) - && PRIVATE (a_editor) - && a_ref - && a_user_data) ; - tree_view = mlview_tree_editor2_get_tree_view (a_editor) ; - g_return_if_fail (tree_view && GTK_IS_TREE_VIEW (tree_view)) ; - view = a_user_data ; - g_return_if_fail (MLVIEW_IS_TREE_VIEW (view) - && PRIVATE (view) - && PRIVATE (view)->node_editor - && MLVIEW_IS_NODE_EDITOR - (PRIVATE (view)->node_editor)) ; - - xml_node = - mlview_tree_editor2_get_xml_node2 (a_editor, a_ref) ; - g_return_if_fail (xml_node) ; - - PRIVATE (view)->current_node = xml_node; - - mlview_iview_get_document - (MLVIEW_IVIEW (view), &mlview_xml_doc); - g_return_if_fail (mlview_xml_doc); - - mlview_node_editor_edit_xml_node (PRIVATE (view)->node_editor, - mlview_xml_doc, xml_node); - gtk_widget_show_all (GTK_WIDGET - (PRIVATE (view)->node_editor)); -} - -/** *The callback of the "element-changed signal" *emited by the element editor of MlViewEditor */ @@ -423,444 +340,20 @@ } /** - *This callback is invoked when the user selects a visual xml node. - *It's a callback function for the "node-selected" signal of - *#MlViewTreeEditor2. - * - */ -void -update_feasible_children_list_cb (MlViewTreeEditor2 * a_editor, - GtkTreeRowReference * a_ref, - gpointer a_user_data) -{ - MlViewTreeView *view = NULL; - xmlNode *xml_node = NULL; - GList *children_name_list = NULL; - gint nb_of_names = 0; - GtkTreeView *tree_view=NULL ; - - g_return_if_fail (a_editor - && MLVIEW_IS_TREE_EDITOR2 (a_editor) - && a_ref && a_user_data - && MLVIEW_IS_TREE_VIEW - (a_user_data)); - tree_view = mlview_tree_editor2_get_tree_view (a_editor) ; - g_return_if_fail (tree_view - && GTK_IS_TREE_VIEW (tree_view)) ; - view = MLVIEW_TREE_VIEW (a_user_data); - g_return_if_fail (PRIVATE (view) != NULL); - gtk_clist_clear (PRIVATE (view)->feasible_children); - xml_node = mlview_tree_editor2_get_xml_node2 (a_editor, - a_ref) ; - g_return_if_fail (xml_node) ; - if (xml_node->type == XML_ELEMENT_NODE) { - - nb_of_names = - mlview_parsing_utils_build_element_name_completion_list - (PRIVATE (view)->app_context, - ADD_CHILD, - xml_node, &children_name_list); - - } - if (nb_of_names > 0) { - gchar *clist_text[1] = { NULL }; - gchar *cur_name = - (gchar *) children_name_list->data; - GList *cur = children_name_list; - - while (cur_name) { - clist_text[0] = cur_name; - gtk_clist_append (PRIVATE (view)-> - feasible_children, - clist_text); - - cur = (cur->next) ? cur->next : NULL; - cur_name = - (cur) ? (gchar *) cur-> - data : NULL; - } - } -} - -/** - *This callback is invoked when the user selects a visual xml node. - *It is a callback of the "node-selected" signal. - */ -static void -update_feasible_prev_siblings_list_cb (MlViewTreeEditor2 *a_editor, - GtkTreeRowReference *a_ref, - gpointer a_user_data) -{ - MlViewTreeView *view = NULL; - xmlNode *xml_node = NULL; - GList *children_name_list = NULL; - gint nb_of_names = 0; - GtkTreeView *tree_view=NULL ; - - g_return_if_fail (a_editor - && MLVIEW_IS_TREE_EDITOR2 (a_editor) - && PRIVATE (a_editor) - && a_ref - && a_user_data) ; - tree_view = mlview_tree_editor2_get_tree_view (a_editor) ; - g_return_if_fail (tree_view) ; - view = MLVIEW_TREE_VIEW (a_user_data); - g_return_if_fail (PRIVATE (view) != NULL); - - gtk_clist_clear (PRIVATE (view)->feasible_prev_siblings); - xml_node = - mlview_tree_editor2_get_xml_node2 (a_editor, - a_ref) ; - g_return_if_fail (xml_node); - if (xml_node->type == XML_ELEMENT_NODE) { - nb_of_names = - mlview_parsing_utils_build_element_name_completion_list - (PRIVATE (view)->app_context, - INSERT_BEFORE, - xml_node, &children_name_list); - } - if (nb_of_names > 0) { - gchar *clist_text[1] = { NULL }; - gchar *cur_name = - (gchar *) children_name_list->data; - GList *cur = children_name_list; - - while (cur_name) { - clist_text[0] = cur_name; - gtk_clist_append - (PRIVATE (view)-> - feasible_prev_siblings, - clist_text); - cur = (cur->next) ? cur->next : NULL; - cur_name = - (cur) ? (gchar *) cur-> - data : NULL; - } - } -} - - -/** - *This callback is invoked when the user selects a visual xml node. - *This is a callback for the "node-selected" signal. - */ -static void -update_feasible_next_siblings_list_cb (MlViewTreeEditor2 *a_editor, - GtkTreeRowReference *a_ref, - gpointer a_user_data) -{ - MlViewTreeView *view = NULL; - xmlNode *xml_node = NULL; - GList *children_name_list = NULL; - gint nb_of_names = 0; - GtkTreeView *tree_view=NULL ; - - g_return_if_fail (a_editor - && MLVIEW_IS_TREE_EDITOR2 (a_editor) - && PRIVATE (a_editor) - && a_ref - && a_user_data) ; - tree_view = mlview_tree_editor2_get_tree_view (a_editor) ; - g_return_if_fail (tree_view) ; - view = MLVIEW_TREE_VIEW (a_user_data); - g_return_if_fail (PRIVATE (view) != NULL); - gtk_clist_clear (PRIVATE (view)->feasible_next_siblings); - xml_node = - mlview_tree_editor2_get_xml_node2 (a_editor, a_ref) ; - g_return_if_fail (xml_node != NULL); - if (xml_node->type == XML_ELEMENT_NODE) { - nb_of_names = - mlview_parsing_utils_build_element_name_completion_list - (PRIVATE (view)->app_context, - INSERT_AFTER, xml_node, - &children_name_list); - } - if (nb_of_names > 0) { - gchar *clist_text[1] = { NULL }; - gchar *cur_name = - (gchar *) children_name_list->data; - GList *cur = children_name_list; - - while (cur_name) { - clist_text[0] = cur_name; - gtk_clist_append - (PRIVATE (view)-> - feasible_next_siblings, - clist_text); - cur = (cur->next) ? cur->next : NULL; - cur_name = - (cur) ? (gchar *) cur-> - data : NULL; - } - } -} - - -/** - *This callback is invoked when the user selects a visual xml node. - * - */ - -static void -update_feasible_attributes_list_cb (MlViewTreeEditor2 * a_editor, - GtkTreeRowReference *a_ref, - gpointer a_user_data) -{ - MlViewTreeView *view = NULL; - xmlNode *xml_node = NULL; - GList *children_name_list = NULL; - gint nb_of_names = 0; - GtkTreeView *tree_view=NULL ; - - g_return_if_fail (a_editor - && MLVIEW_IS_TREE_EDITOR2 (a_editor) - && PRIVATE (a_editor) - && a_ref - && a_user_data) ; - g_return_if_fail (MLVIEW_IS_TREE_VIEW - (a_user_data)); - - tree_view = mlview_tree_editor2_get_tree_view (a_editor) ; - g_return_if_fail (tree_view) ; - view = MLVIEW_TREE_VIEW (a_user_data); - g_return_if_fail (PRIVATE (view) != NULL); - gtk_clist_clear (PRIVATE (view)->feasible_attributes); - xml_node = mlview_tree_editor2_get_xml_node2 (a_editor, - a_ref) ; - g_return_if_fail (xml_node != NULL); - if (xml_node->type == XML_ELEMENT_NODE) { - nb_of_names = - mlview_parsing_utils_build_attribute_name_completion_list - (PRIVATE (view)->app_context, xml_node, - &children_name_list, FALSE); - } - if (nb_of_names > 0) { - gchar *clist_text[1] = { NULL }; - gchar *cur_name = - (gchar *) children_name_list->data; - GList *cur = children_name_list; - - while (cur_name) { - clist_text[0] = cur_name; - gtk_clist_append (PRIVATE (view)-> - feasible_attributes, - clist_text); - cur = (cur->next) ? cur->next : NULL; - cur_name = - (cur) ? (gchar *) cur-> - data : NULL; - } - } -} - - -static void -selected_a_possible_child_cb (GtkCList * a_possible_children, - gint a_row, gint a_column, - GdkEventButton * event, - gpointer a_user_data) -{ - MlViewTreeView *doc_tree_view = NULL; - GtkTreeIter cur_sel_start={0} ; - gchar *element_name = NULL; - gint ret_code = 0; - enum MlViewStatus status = MLVIEW_OK ; - - g_return_if_fail (a_possible_children != NULL); - g_return_if_fail (GTK_IS_CLIST (a_possible_children)); - g_return_if_fail (a_user_data != NULL); - g_return_if_fail (MLVIEW_IS_TREE_VIEW - (a_user_data)); - - doc_tree_view = MLVIEW_TREE_VIEW (a_user_data); - g_return_if_fail (PRIVATE (doc_tree_view) != NULL); - g_return_if_fail (PRIVATE (doc_tree_view)->tree_editor != - NULL); - status = mlview_tree_editor2_get_cur_sel_start_iter - (PRIVATE (doc_tree_view)->tree_editor, - &cur_sel_start) ; - g_return_if_fail (status == MLVIEW_OK) ; - /*do not free element_name!! */ - ret_code = gtk_clist_get_text (a_possible_children, - a_row, a_column, - &element_name); - if (ret_code == 1) { - /*text retrieved ! */ - xmlNode *new_node = NULL; - - if (strcmp (element_name, "#PCDATA") == 0) { - new_node = xmlNewNode (NULL, "text"); - new_node->type = XML_TEXT_NODE; - } else { - new_node = - xmlNewNode (NULL, element_name); - } - mlview_tree_editor2_add_child_node - (PRIVATE (doc_tree_view)->tree_editor, - &cur_sel_start, new_node) ; - } -} - -static void -selected_a_possible_prev_sibling_cb (GtkCList * a_possible_prev_siblings, - gint a_row, gint a_column, - GdkEventButton * event, - gpointer a_user_data) -{ - MlViewTreeView *doc_tree_view = NULL; - enum MlViewStatus stat = MLVIEW_OK ; - GtkTreeIter cur_sel_start = {0} ; - gchar *element_name = NULL; - gint ret_code = 0; - - g_return_if_fail (a_possible_prev_siblings != NULL); - g_return_if_fail (GTK_IS_CLIST - (a_possible_prev_siblings)); - g_return_if_fail (a_user_data != NULL); - g_return_if_fail (MLVIEW_IS_TREE_VIEW - (a_user_data)); - doc_tree_view = MLVIEW_TREE_VIEW (a_user_data); - g_return_if_fail (PRIVATE (doc_tree_view) != NULL); - g_return_if_fail (PRIVATE (doc_tree_view)->tree_editor != - NULL); - stat = mlview_tree_editor2_get_cur_sel_start_iter - (PRIVATE (doc_tree_view)->tree_editor, - &cur_sel_start) ; - g_return_if_fail (stat == MLVIEW_OK) ; - /*do not free element_name!! */ - ret_code = gtk_clist_get_text (a_possible_prev_siblings, - a_row, a_column, - &element_name); - if (ret_code == 1) { - /*text retrieved ! */ - xmlNode *new_node = NULL; - if (strcmp (element_name, "#PCDATA") == 0) { - new_node = xmlNewNode (NULL, "text"); - new_node->type = XML_TEXT_NODE; - } else { - new_node = - xmlNewNode (NULL, element_name); - } - stat = mlview_tree_editor2_insert_sibling_node - (PRIVATE (doc_tree_view)->tree_editor, - &cur_sel_start, new_node, TRUE) ; - g_return_if_fail (stat == MLVIEW_OK); - } -} - - -static void -selected_a_possible_next_sibling_cb (GtkCList * a_possible_next_siblings, - gint a_row, gint a_column, - GdkEventButton * event, - gpointer a_user_data) -{ - MlViewTreeView *doc_tree_view = NULL; - GtkTreeIter cur_sel_start = {0} ; - enum MlViewStatus stat = MLVIEW_OK ; - gchar *element_name = NULL; - gint ret_code = 0; - - g_return_if_fail (a_possible_next_siblings != NULL); - g_return_if_fail (GTK_IS_CLIST - (a_possible_next_siblings)); - g_return_if_fail (a_user_data != NULL); - g_return_if_fail (MLVIEW_IS_TREE_VIEW - (a_user_data)); - doc_tree_view = MLVIEW_TREE_VIEW (a_user_data); - g_return_if_fail (PRIVATE (doc_tree_view) != NULL); - g_return_if_fail (PRIVATE (doc_tree_view)->tree_editor != - NULL); - stat = mlview_tree_editor2_get_cur_sel_start_iter - (PRIVATE (doc_tree_view)->tree_editor, - &cur_sel_start) ; - g_return_if_fail (stat == MLVIEW_OK) ; - /*do not free element_name!! */ - ret_code = gtk_clist_get_text (a_possible_next_siblings, - a_row, a_column, - &element_name); - if (ret_code == 1) { - /*text retrieved ! */ - xmlNode *new_node = NULL; - if (strcmp (element_name, "#PCDATA") == 0) { - new_node = xmlNewNode (NULL, "text"); - new_node->type = XML_TEXT_NODE; - } else { - new_node = - xmlNewNode (NULL, element_name); - } - stat = mlview_tree_editor2_insert_sibling_node - (PRIVATE (doc_tree_view)->tree_editor, - &cur_sel_start, new_node, FALSE) ; - } -} - - -/** - * + *Callback called when the MlViewXMLDocument emits + *a "node-selected" signal ; updates the MlViewCompletionTable. */ static void -selected_a_possible_attribute_cb (GtkCList * a_possible_attributes, - gint a_row, gint a_column, - GdkEventButton * a_event, - gpointer a_user_data) -{ - MlViewTreeView *doc_tree_view = NULL; - MlViewXMLDocument *mlview_xml_doc = NULL; - enum MlViewStatus stat = MLVIEW_OK ; - GtkTreeIter cur_sel_start = {0} ; - GtkTreeView *visual_tree = NULL; - gchar *attribute_name = NULL; - gint ret_code = 0; - - g_return_if_fail (a_possible_attributes != NULL); - g_return_if_fail (GTK_IS_CLIST (a_possible_attributes)); - g_return_if_fail (a_user_data != NULL); - g_return_if_fail (MLVIEW_IS_TREE_VIEW - (a_user_data)); - - doc_tree_view = MLVIEW_TREE_VIEW (a_user_data); +update_completion_widget_cb (MlViewXMLDocument *a_xml_doc, + xmlNode *a_node_found, + gpointer a_user_data) +{ + g_return_if_fail (a_xml_doc && MLVIEW_IS_XML_DOCUMENT (a_xml_doc)); + g_return_if_fail (a_node_found); + g_return_if_fail (a_user_data && MLVIEW_IS_COMPLETION_TABLE (a_user_data)); - g_return_if_fail (PRIVATE (doc_tree_view) != NULL); - g_return_if_fail (MLVIEW_IS_TREE_VIEW - (doc_tree_view)); - g_return_if_fail (PRIVATE (doc_tree_view)->tree_editor != - NULL); - g_return_if_fail (PRIVATE (doc_tree_view)->node_editor != - NULL); - mlview_iview_get_document - (MLVIEW_IVIEW (doc_tree_view), &mlview_xml_doc); - g_return_if_fail (mlview_xml_doc != NULL); - stat = mlview_tree_editor2_get_cur_sel_start_iter - (PRIVATE (doc_tree_view)->tree_editor, - &cur_sel_start) ; - g_return_if_fail (stat == MLVIEW_OK) ; - - visual_tree = mlview_tree_editor2_get_tree_view - (PRIVATE (doc_tree_view)->tree_editor) ; - g_return_if_fail (visual_tree != NULL); - ret_code = gtk_clist_get_text - (a_possible_attributes, a_row, - a_column, &attribute_name); /*do not free attribute_name!! */ - if (ret_code == 1) { - /*text retrieved ! */ - xmlNode *xml_node = NULL; - xmlAttr *attr = NULL; - xml_node = mlview_tree_editor2_get_xml_node - (PRIVATE (doc_tree_view)->tree_editor, - &cur_sel_start) ; - g_return_if_fail (xml_node != NULL); - attr = xmlNewProp (xml_node, - attribute_name, - "value"); - stat = mlview_tree_editor2_update_visual_node - (PRIVATE (doc_tree_view)->tree_editor, - &cur_sel_start) ; - g_return_if_fail (stat == MLVIEW_OK) ; - mlview_node_editor_edit_xml_node - (PRIVATE (doc_tree_view)->node_editor, - mlview_xml_doc, xml_node) ; - } + mlview_completion_table_select_node (MLVIEW_COMPLETION_TABLE (a_user_data), + a_node_found); } /** @@ -1322,7 +815,7 @@ gchar * a_name, MlViewAppContext *a_app_context) { - GtkWidget *table = NULL, + GtkWidget *compl = NULL, *scrolled = NULL; MlViewTreeEditor2 *raw_xml = NULL; MlViewTreeEditor2 *elements = NULL; @@ -1330,17 +823,6 @@ MlViewTreeEditor2 *tree_editor; enum MLVIEW_VIEW_ADAPTER_STATUS status = NOK; - const gchar *feasible_children_titles[1] = - { _("Possible Children") }; - - const gchar *feasible_prev_siblings_titles[1] = - { _("Possible previous siblings") }; - - const gchar *feasible_next_siblings_titles[1] = - { _("Possible next siblings") }; - - const gchar *feasible_attributes_titles[1] = - { _("Possible attributes") }; g_return_if_fail (MLVIEW_IS_TREE_VIEW (a_this)); @@ -1396,97 +878,16 @@ GTK_WIDGET (raw_xml), gtk_label_new (_("Raw XML"))); - /*the table with the feasible children, siblings and attributes */ - PRIVATE (a_this)->feasible_children = - GTK_CLIST (gtk_clist_new_with_titles - (1, (gchar**)feasible_children_titles)); - - g_signal_connect (G_OBJECT - (PRIVATE (a_this)-> - feasible_children), "select-row", - G_CALLBACK - (selected_a_possible_child_cb), - a_this); - - PRIVATE (a_this)->feasible_prev_siblings = - GTK_CLIST (gtk_clist_new_with_titles - (1, (gchar**)feasible_prev_siblings_titles)); - - g_signal_connect (G_OBJECT - (PRIVATE (a_this)-> - feasible_prev_siblings), "select-row", - G_CALLBACK - (selected_a_possible_prev_sibling_cb), - a_this); - - PRIVATE (a_this)->feasible_next_siblings = - GTK_CLIST (gtk_clist_new_with_titles - (1, (gchar**) feasible_next_siblings_titles)); - - g_signal_connect (G_OBJECT - (PRIVATE (a_this)-> - feasible_next_siblings), "select-row", - G_CALLBACK - (selected_a_possible_next_sibling_cb), - a_this); - - PRIVATE (a_this)->feasible_attributes = - GTK_CLIST - (gtk_clist_new_with_titles - (1, (gchar**)feasible_attributes_titles)); - - g_signal_connect (G_OBJECT - (PRIVATE (a_this)-> - feasible_attributes), "select-row", - GTK_SIGNAL_FUNC - (selected_a_possible_attribute_cb), - a_this); - - table = gtk_table_new (2, 2, TRUE); - - scrolled = gtk_scrolled_window_new (NULL, NULL); - - gtk_container_add - (GTK_CONTAINER (scrolled), - GTK_WIDGET (PRIVATE (a_this)-> - feasible_children)); - - gtk_table_attach_defaults (GTK_TABLE (table), scrolled, - 0, 1, 0, 1); - - scrolled = gtk_scrolled_window_new (NULL, NULL); - - gtk_container_add (GTK_CONTAINER (scrolled), - GTK_WIDGET - (PRIVATE (a_this)-> - feasible_prev_siblings)); - - gtk_table_attach_defaults (GTK_TABLE (table), scrolled, - 1, 2, 0, 1); - - scrolled = gtk_scrolled_window_new (NULL, NULL); - - gtk_container_add (GTK_CONTAINER (scrolled), - GTK_WIDGET - (PRIVATE (a_this)-> - feasible_next_siblings)); - - gtk_table_attach_defaults (GTK_TABLE (table), scrolled, - 1, 2, 1, 2); - - scrolled = gtk_scrolled_window_new (NULL, NULL); - - gtk_container_add (GTK_CONTAINER (scrolled), - GTK_WIDGET - (PRIVATE (a_this)-> - feasible_attributes)); + /* The widget with the feasible children, siblings and attributes */ + + compl = mlview_completion_table_new (a_mlview_xml_doc); - gtk_table_attach_defaults (GTK_TABLE (table), scrolled, - 0, 1, 1, 2); + g_signal_connect (a_mlview_xml_doc, "node-selected", + (GCallback)update_completion_widget_cb, compl); gtk_paned_pack2 (GTK_PANED (PRIVATE (a_this)->upper_paned1), - table, FALSE, TRUE); + compl, FALSE, TRUE); /*The node editor */ PRIVATE (a_this)->node_editor = @@ -1521,40 +922,7 @@ tree_editor = MLVIEW_TREE_EDITOR2 (gtk_notebook_get_nth_page (PRIVATE (a_this)->trees, i)); mlview_tree_editor2_edit_xml_doc - (tree_editor, a_mlview_xml_doc, NULL); -/* - g_signal_connect (G_OBJECT - (tree), - "node-selected", - G_CALLBACK (visual_node_selected_cb), - a_this); -*/ - g_signal_connect (G_OBJECT - (tree_editor), - "node-selected", - G_CALLBACK - (update_feasible_children_list_cb), - a_this); - - g_signal_connect (G_OBJECT - (tree_editor), - "node-selected", - G_CALLBACK - (update_feasible_prev_siblings_list_cb), - a_this); - g_signal_connect (G_OBJECT - (tree_editor), - "node-selected", - G_CALLBACK - (update_feasible_next_siblings_list_cb), - a_this); - g_signal_connect (GTK_OBJECT - (tree_editor), - "node-selected", - G_CALLBACK - (update_feasible_attributes_list_cb), - a_this); - + (tree_editor, a_mlview_xml_doc, NULL); } g_signal_connect (G_OBJECT (a_mlview_xml_doc), "file-path-changed",
Attachment:
completion.tar.gz
Description: application/compressed-tar