X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-dialog-action-var-info.c;h=9c7d4fd3e2b374d6632408aa42362afecf115977;hb=17339b8ef2b6c9c403ceccb9f0ab534a943f92e1;hp=4e2d8ea039cd8bd8623959aed52de07c44377b3c;hpb=2a71889bf86463fb752bcbab248da47b25b4fd9a;p=pspp diff --git a/src/ui/gui/psppire-dialog-action-var-info.c b/src/ui/gui/psppire-dialog-action-var-info.c index 4e2d8ea039..9c7d4fd3e2 100644 --- a/src/ui/gui/psppire-dialog-action-var-info.c +++ b/src/ui/gui/psppire-dialog-action-var-info.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2007, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation + Copyright (C) 2007, 2009, 2010, 2011, 2012, 2013, 2014, 2016 Free Software Foundation This program is free software: you can redistribute it and/or modify @@ -52,11 +52,11 @@ treeview_item_selected (gpointer data) GtkTreeView *tv = GTK_TREE_VIEW (pda->source); GtkTreeSelection *selection = gtk_tree_view_get_selection (tv); - return gtk_tree_selection_count_selected_rows (selection) == 1; + return gtk_tree_selection_count_selected_rows (selection) >= 1; } static gchar * -generate_syntax__ (PsppireDialogAction *act, const char *prefix) +generate_syntax__ (const PsppireDialogAction *act, const char *prefix) { struct variable **vars; size_t n_vars; @@ -101,11 +101,13 @@ generate_syntax__ (PsppireDialogAction *act, const char *prefix) } static gchar * -generate_syntax (PsppireDialogAction *act) +generate_syntax (const PsppireDialogAction *act) { return generate_syntax__ (act, ""); } + + static void populate_output (GtkTreeSelection *selection, gpointer data) { @@ -163,15 +165,17 @@ jump_to (PsppireDialog *d, gint response, gpointer data) g_free (vars); } -static void -psppire_dialog_action_var_info_activate (GtkAction *a) +static GtkBuilder * +psppire_dialog_action_var_info_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionVarInfo *act = PSPPIRE_DIALOG_ACTION_VAR_INFO (pda); - GtkBuilder *xml = builder_new ("variable-info.ui"); - act->output = psppire_output_view_new ( - GTK_LAYOUT (get_widget_assert (xml, "layout1")), NULL, NULL, NULL); + GtkBuilder *xml = builder_new ( "variable-info.ui"); + + act->output = + psppire_output_view_new (GTK_LAYOUT (get_widget_assert (xml, "layout1")), + NULL); pda->dialog = get_widget_assert (xml, "variable-info-dialog"); pda->source = get_widget_assert (xml, "treeview2"); @@ -181,26 +185,22 @@ psppire_dialog_action_var_info_activate (GtkAction *a) NULL); g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (pda->source)), - "changed", G_CALLBACK (populate_output), + "changed", G_CALLBACK (populate_output), act); - g_signal_connect (pda->dialog, "response", G_CALLBACK (jump_to), pda); psppire_dialog_action_set_valid_predicate (pda, treeview_item_selected); - g_object_unref (xml); - - if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_var_info_parent_class)->activate) - PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_var_info_parent_class)->activate (pda); + return xml; } static void psppire_dialog_action_var_info_class_init (PsppireDialogActionVarInfoClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_var_info_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_var_info_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; }