X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fui%2Fgui%2Fgoto-case-dialog.c;h=282f41636883c21315d1f21d6ed08cfa1903a922;hb=refs%2Fbuilds%2F20130402031823%2Fpspp;hp=32e93dbd4ca37afe07f9bd14ebcf01953199ec27;hpb=82d3fc0e14c1465eb2d1de00796317d062151fe0;p=pspp
diff --git a/src/ui/gui/goto-case-dialog.c b/src/ui/gui/goto-case-dialog.c
index 32e93dbd4c..282f416368 100644
--- a/src/ui/gui/goto-case-dialog.c
+++ b/src/ui/gui/goto-case-dialog.c
@@ -1,5 +1,5 @@
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2007 Free Software Foundation
+ Copyright (C) 2007, 2011, 2012 Free Software Foundation
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -15,69 +15,54 @@
along with this program. If not, see . */
+#include
#include "goto-case-dialog.h"
-#include "helper.h"
+#include "builder-wrapper.h"
#include "psppire-dialog.h"
-#include "data-editor.h"
+#include "psppire-data-window.h"
#include "psppire-data-store.h"
-#include
static void
-refresh (const struct data_editor *de, GladeXML *xml)
+refresh (PsppireDataSheet *ds, GtkBuilder *xml)
{
- GtkSheet *data_sheet =
- GTK_SHEET (get_widget_assert (de->xml, "data_sheet"));
+ PsppireDataStore *data_store = psppire_data_sheet_get_data_store (ds);
+ casenumber case_count ;
- PsppireDataStore *ds =
- PSPPIRE_DATA_STORE (gtk_sheet_get_model (data_sheet));
+ GtkWidget *case_num_entry = get_widget_assert (xml, "goto-case-case-num-entry");
- GtkWidget *case_num_entry =
- get_widget_assert (xml, "goto-case-case-num-entry");
+ case_count = psppire_data_store_get_case_count (data_store);
- casenumber case_count =
- psppire_data_store_get_case_count (ds);
-
- gtk_spin_button_set_range (GTK_SPIN_BUTTON (case_num_entry),
- 1, case_count);
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON (case_num_entry), 1, case_count);
}
void
-goto_case_dialog (GObject *o, gpointer data)
+goto_case_dialog (PsppireDataSheet *ds)
{
+ GtkWindow *top_level;
gint response;
- GladeXML *xml = XML_NEW ("psppire.glade");
- struct data_editor *de = data;
-
+ GtkBuilder *xml = builder_new ("goto-case.ui");
GtkWidget *dialog = get_widget_assert (xml, "goto-case-dialog");
+ top_level = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (ds)));
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), top_level);
- gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
-
- refresh (de, xml);
+ refresh (ds, xml);
response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
if ( response == PSPPIRE_RESPONSE_GOTO )
{
- gint row, column;
- GtkSheet *data_sheet =
- GTK_SHEET (get_widget_assert (de->xml, "data_sheet"));
-
-
+ PsppireDataStore *data_store = psppire_data_sheet_get_data_store (ds);
+ glong case_num;
GtkWidget *case_num_entry =
get_widget_assert (xml, "goto-case-case-num-entry");
- gtk_sheet_get_active_cell (data_sheet, &row, &column);
-
- row =
- gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (case_num_entry))
+ case_num = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (case_num_entry))
- FIRST_CASE_NUMBER ;
- gtk_sheet_moveto (data_sheet,
- row, column,
- 0.5, 0.5);
-
- gtk_sheet_set_active_cell (data_sheet, row, column);
+ if (case_num >= 0
+ && case_num < psppire_data_store_get_case_count (data_store))
+ psppire_data_sheet_goto_case (ds, case_num);
}
}