PsppireDataWindow (on_switch_page): Add comment and reformat
authorJohn Darrington <john@darrington.wattle.id.au>
Mon, 27 Jul 2015 15:14:54 +0000 (17:14 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 28 Jul 2015 02:12:43 +0000 (04:12 +0200)
src/ui/gui/psppire-data-window.c

index 5c1b48dc833efcf71b1fc3488ee4e85ce44f09d5..a301dda27d813747b8d4eb952fbd005f86df2bf4 100644 (file)
@@ -840,15 +840,16 @@ static void
 on_switch_page (PsppireDataEditor *de, gpointer p,
                gint pagenum, PsppireDataWindow *dw)
 {
-  GtkWidget *page_menu_item;
-  gboolean is_ds;
-  const char *path;
+  /* Set the appropriate ui_manager according to the selected page.
+     This is necessary, because the menus for the variable view and
+     the data view are different (slightly). */
 
-  is_ds = pagenum == PSPPIRE_DATA_EDITOR_DATA_VIEW;
-  path = (is_ds
+  gboolean is_ds = pagenum == PSPPIRE_DATA_EDITOR_DATA_VIEW;
+  const char *path = (is_ds
           ? "/ui/menubar/view/view_data"
           : "/ui/menubar/view/view_variables");
-  page_menu_item = gtk_ui_manager_get_widget (dw->ui_manager, path);
+
+  GtkWidget *page_menu_item = gtk_ui_manager_get_widget (dw->ui_manager, path);
   gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (page_menu_item), TRUE);
 }