Commit 9c09fec1 authored by Juan Pablo Ugarte's avatar Juan Pablo Ugarte

GladeModelData: remove use of idle functions

Idle functions where causing a crash and do not seem to be needed
anymore since calling them directly seems to work just fine.

Fix issue #194 "Using List Store can result in program crash."
parent 70a9d4c2
...@@ -294,6 +294,12 @@ clear_view (GladeEditorProperty *eprop) ...@@ -294,6 +294,12 @@ clear_view (GladeEditorProperty *eprop)
GladeEPropModelData *eprop_data = GLADE_EPROP_MODEL_DATA (eprop); GladeEPropModelData *eprop_data = GLADE_EPROP_MODEL_DATA (eprop);
GtkTreeViewColumn *column; GtkTreeViewColumn *column;
//eprop_data->adding_row = 0;
//eprop_data->want_focus = 0;
//eprop_data->setting_focus = 0;
eprop_data->editing_row = -1;
eprop_data->editing_column = -1;
/* Clear columns ... */ /* Clear columns ... */
while ((column = gtk_tree_view_get_column (eprop_data->view, 0)) != NULL) while ((column = gtk_tree_view_get_column (eprop_data->view, 0)) != NULL)
gtk_tree_view_remove_column (eprop_data->view, column); gtk_tree_view_remove_column (eprop_data->view, column);
...@@ -303,8 +309,8 @@ clear_view (GladeEditorProperty *eprop) ...@@ -303,8 +309,8 @@ clear_view (GladeEditorProperty *eprop)
} }
static gboolean static void
update_data_tree_idle (GladeEditorProperty *eprop) update_data_tree (GladeEditorProperty *eprop)
{ {
GladeEPropModelData *eprop_data = GLADE_EPROP_MODEL_DATA (eprop); GladeEPropModelData *eprop_data = GLADE_EPROP_MODEL_DATA (eprop);
GladeProperty *property = glade_editor_property_get_property (eprop); GladeProperty *property = glade_editor_property_get_property (eprop);
...@@ -323,37 +329,32 @@ update_data_tree_idle (GladeEditorProperty *eprop) ...@@ -323,37 +329,32 @@ update_data_tree_idle (GladeEditorProperty *eprop)
g_value_unset (&value); g_value_unset (&value);
eprop_data->pending_data_tree = NULL; eprop_data->pending_data_tree = NULL;
return FALSE;
} }
static gboolean static void
update_and_focus_data_tree_idle (GladeEditorProperty *eprop) update_and_focus_data_tree (GladeEditorProperty *eprop)
{ {
GladeEPropModelData *eprop_data = GLADE_EPROP_MODEL_DATA (eprop); GladeEPropModelData *eprop_data = GLADE_EPROP_MODEL_DATA (eprop);
GladeProperty *property = glade_editor_property_get_property (eprop); GladeProperty *property = glade_editor_property_get_property (eprop);
eprop_data->want_focus = TRUE; eprop_data->want_focus = TRUE;
update_data_tree_idle (eprop);
/* XXX Have to load it regardless if it changed, this is a slow and redundant way... */ /* XXX Have to load it regardless if it changed, this is a slow and redundant way... */
glade_editor_property_load (eprop, property); glade_editor_property_load (eprop, property);
eprop_data->want_focus = FALSE; update_data_tree (eprop);
return FALSE; eprop_data->want_focus = FALSE;
} }
static gboolean static void
focus_data_tree_idle (GladeEditorProperty *eprop) focus_data_tree (GladeEditorProperty *eprop)
{ {
GladeEPropModelData *eprop_data = GLADE_EPROP_MODEL_DATA (eprop); GladeEPropModelData *eprop_data = GLADE_EPROP_MODEL_DATA (eprop);
eprop_data->want_focus = TRUE; eprop_data->want_focus = TRUE;
eprop_data_focus_editing_cell (eprop_data); eprop_data_focus_editing_cell (eprop_data);
eprop_data->want_focus = FALSE; eprop_data->want_focus = FALSE;
return FALSE;
} }
static void static void
...@@ -421,7 +422,7 @@ glade_eprop_model_data_delete_selected (GladeEditorProperty *eprop) ...@@ -421,7 +422,7 @@ glade_eprop_model_data_delete_selected (GladeEditorProperty *eprop)
glade_model_data_tree_free (eprop_data->pending_data_tree); glade_model_data_tree_free (eprop_data->pending_data_tree);
eprop_data->pending_data_tree = data_tree; eprop_data->pending_data_tree = data_tree;
g_idle_add ((GSourceFunc) update_data_tree_idle, eprop); update_data_tree (eprop);
} }
static void static void
...@@ -458,8 +459,8 @@ eprop_treeview_key_press (GtkWidget *treeview, ...@@ -458,8 +459,8 @@ eprop_treeview_key_press (GtkWidget *treeview,
return FALSE; return FALSE;
} }
static gboolean static void
data_changed_idle (GladeEditorProperty *eprop) data_changed (GladeEditorProperty *eprop)
{ {
GladeEPropModelData *eprop_data = GLADE_EPROP_MODEL_DATA (eprop); GladeEPropModelData *eprop_data = GLADE_EPROP_MODEL_DATA (eprop);
GladeProperty *property = glade_editor_property_get_property (eprop); GladeProperty *property = glade_editor_property_get_property (eprop);
...@@ -495,9 +496,7 @@ data_changed_idle (GladeEditorProperty *eprop) ...@@ -495,9 +496,7 @@ data_changed_idle (GladeEditorProperty *eprop)
if (eprop_data->pending_data_tree) if (eprop_data->pending_data_tree)
glade_model_data_tree_free (eprop_data->pending_data_tree); glade_model_data_tree_free (eprop_data->pending_data_tree);
eprop_data->pending_data_tree = new_tree; eprop_data->pending_data_tree = new_tree;
update_data_tree_idle (eprop); update_data_tree (eprop);
return FALSE;
} }
static void static void
...@@ -508,7 +507,7 @@ eprop_treeview_row_deleted (GtkTreeModel *tree_model, ...@@ -508,7 +507,7 @@ eprop_treeview_row_deleted (GtkTreeModel *tree_model,
if (glade_editor_property_loading (eprop)) if (glade_editor_property_loading (eprop))
return; return;
g_idle_add ((GSourceFunc) data_changed_idle, eprop); data_changed (eprop);
} }
...@@ -626,7 +625,7 @@ value_toggled (GtkCellRendererToggle *cell, gchar *path, GladeEditorProperty *ep ...@@ -626,7 +625,7 @@ value_toggled (GtkCellRendererToggle *cell, gchar *path, GladeEditorProperty *ep
glade_model_data_tree_free (eprop_data->pending_data_tree); glade_model_data_tree_free (eprop_data->pending_data_tree);
eprop_data->pending_data_tree = data_tree; eprop_data->pending_data_tree = data_tree;
g_idle_add ((GSourceFunc) update_and_focus_data_tree_idle, eprop); update_and_focus_data_tree (eprop);
} }
static void static void
...@@ -677,7 +676,7 @@ value_i18n_activate (GladeCellRendererIcon *cell, ...@@ -677,7 +676,7 @@ value_i18n_activate (GladeCellRendererIcon *cell,
glade_model_data_tree_free (eprop_data->pending_data_tree); glade_model_data_tree_free (eprop_data->pending_data_tree);
eprop_data->pending_data_tree = data_tree; eprop_data->pending_data_tree = data_tree;
g_idle_add ((GSourceFunc) update_and_focus_data_tree_idle, eprop); update_and_focus_data_tree (eprop);
} }
else else
glade_model_data_tree_free (data_tree); glade_model_data_tree_free (data_tree);
...@@ -760,7 +759,7 @@ value_text_edited (GtkCellRendererText *cell, ...@@ -760,7 +759,7 @@ value_text_edited (GtkCellRendererText *cell,
glade_model_data_tree_free (eprop_data->pending_data_tree); glade_model_data_tree_free (eprop_data->pending_data_tree);
eprop_data->pending_data_tree = data_tree; eprop_data->pending_data_tree = data_tree;
g_idle_add ((GSourceFunc) update_and_focus_data_tree_idle, eprop); update_and_focus_data_tree (eprop);
} }
...@@ -821,7 +820,7 @@ data_editing_canceled (GtkCellRenderer *renderer, GladeEditorProperty *eprop) ...@@ -821,7 +820,7 @@ data_editing_canceled (GtkCellRenderer *renderer, GladeEditorProperty *eprop)
if (eprop_data->setting_focus) if (eprop_data->setting_focus)
return; return;
g_idle_add ((GSourceFunc) focus_data_tree_idle, eprop); focus_data_tree (eprop);
} }
static gint static gint
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment