psppire-var-sheet: Refresh var sheet when variables change. 20120711001900/pspp 20120712001839/pspp 20120713001847/pspp
authorBen Pfaff <blp@cs.stanford.edu>
Wed, 11 Jul 2012 05:08:25 +0000 (22:08 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Wed, 11 Jul 2012 05:08:25 +0000 (22:08 -0700)
Otherwise changes made through popup dialogs in the variable sheet
don't necessarily show until the mouse moves across the row that
changed.

Reported by John Darrington.

src/ui/gui/psppire-empty-list-store.c
src/ui/gui/psppire-empty-list-store.h
src/ui/gui/psppire-var-sheet.c
src/ui/gui/psppire-var-sheet.h

index b7bc569def5bf5c14be51e87cab10f1428910d64..1658d1fde5ec3cdc29f6d127a4ddce7d170ff3f9 100644 (file)
@@ -180,6 +180,20 @@ psppire_empty_list_store_set_n_rows (PsppireEmptyListStore *obj,
   obj->n_rows = n_rows;
 }
 
+void
+psppire_empty_list_store_row_changed (PsppireEmptyListStore *obj,
+                                      gint row)
+{
+  GtkTreeModel *tree_model = GTK_TREE_MODEL (obj);
+  GtkTreeIter iter;
+  GtkTreePath *path;
+
+  path = gtk_tree_path_new_from_indices (row, -1);
+  gtk_tree_model_get_iter (tree_model, &iter, path);
+  gtk_tree_model_row_changed (tree_model, path, &iter);
+  gtk_tree_path_free (path);
+}
+
 void
 psppire_empty_list_store_row_inserted (PsppireEmptyListStore *obj,
                                        gint row)
index ae6d36c483c99266ffb1f4466251e8295d9a9ae8..c2078439d106519b50bf4cafd0a521d5e17651d7 100644 (file)
@@ -56,6 +56,8 @@ gint psppire_empty_list_store_get_n_rows (const PsppireEmptyListStore *);
 void psppire_empty_list_store_set_n_rows (PsppireEmptyListStore *,
                                           gint n_rows);
 
+void psppire_empty_list_store_row_changed (PsppireEmptyListStore *,
+                                           gint row);
 void psppire_empty_list_store_row_inserted (PsppireEmptyListStore *,
                                             gint row);
 void psppire_empty_list_store_row_deleted (PsppireEmptyListStore *,
index 930c27797ff8c0b2d5ec0da37567d7e5e1bc0c38..76cf51038d04bdc056b5c6388bb80aafd35b69dd 100644 (file)
@@ -1266,6 +1266,20 @@ refresh_model (PsppireVarSheet *var_sheet)
     }
 }
 
+static void
+on_var_changed (PsppireDict *dict, glong row, PsppireVarSheet *var_sheet)
+{
+  PsppireEmptyListStore *store;
+
+  g_return_if_fail (dict == var_sheet->dict);
+
+  store = PSPPIRE_EMPTY_LIST_STORE (pspp_sheet_view_get_model (
+                                      PSPP_SHEET_VIEW (var_sheet)));
+  g_return_if_fail (store != NULL);
+
+  psppire_empty_list_store_row_changed (store, row);
+}
+
 static void
 on_var_inserted (PsppireDict *dict, glong row, PsppireVarSheet *var_sheet)
 {
@@ -1341,6 +1355,10 @@ psppire_var_sheet_set_dictionary (PsppireVarSheet *var_sheet,
         = g_signal_connect (dict, "backend-changed",
                             G_CALLBACK (on_backend_changed), var_sheet);
 
+      var_sheet->dict_signals[PSPPIRE_VAR_SHEET_VARIABLE_CHANGED]
+        = g_signal_connect (dict, "variable-changed",
+                            G_CALLBACK (on_var_changed), var_sheet);
+
       var_sheet->dict_signals[PSPPIRE_VAR_SHEET_VARIABLE_DELETED]
         = g_signal_connect (dict, "variable-inserted",
                             G_CALLBACK (on_var_inserted), var_sheet);
index 754dd258928b46143503da9808a9381f752b0503..cd4bd20b3b0e36d6dad9fd8f6b157eefe1260847 100644 (file)
@@ -47,6 +47,7 @@ typedef struct _PsppireVarSheetClass  PsppireVarSheetClass;
 enum
 {
     PSPPIRE_VAR_SHEET_BACKEND_CHANGED,
+    PSPPIRE_VAR_SHEET_VARIABLE_CHANGED,
     PSPPIRE_VAR_SHEET_VARIABLE_INSERTED,
     PSPPIRE_VAR_SHEET_VARIABLE_DELETED,
     PSPPIRE_VAR_SHEET_N_SIGNALS