Select Cases Dialog: Make the 'All Cases' button easier to select.
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 19 Sep 2020 06:54:40 +0000 (08:54 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 19 Sep 2020 06:54:54 +0000 (08:54 +0200)
The radiobutton area is very small and hard to click.
This change adds an Eventbox under the corresponding
label, So clicking on the label will have the same effect.

src/ui/gui/psppire-dialog-action-select.c
src/ui/gui/select-cases.ui

index 51767430235bae4419987d1abcf960105abad5ac..5ee493a45f7fa79190c1daba34f975bcece675a4 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2007, 2008, 2009, 2010, 2011, 2014, 2015 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2008, 2009, 2010, 2011, 2014, 2015, 2020 Free Software Foundation, Inc.
 
    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
@@ -255,6 +255,20 @@ consistency (GtkSpinButton *spin, PsppireDialogActionSelect *act)
     }
 }
 
+
+/* When the all cases label button is clicked, set the corresponding button
+   to active.    This is a convenience thing, since the button itself has
+   a very small area and is hard to find with the mouse pointer.  */
+static gboolean
+on_button_release  (GtkWidget *w, GdkEvent *e, gpointer a)
+{
+  PsppireDialogActionSelect *act = PSPPIRE_DIALOG_ACTION_SELECT (a);
+
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (act->radiobutton_all), TRUE);
+
+  return FALSE;
+}
+
 static GtkBuilder *
 psppire_dialog_action_select_activate (PsppireDialogAction *a, GVariant *param)
 {
@@ -301,8 +315,10 @@ psppire_dialog_action_select_activate (PsppireDialogAction *a, GVariant *param)
   act->radiobutton_filter =  get_widget_assert (xml, "radiobutton-filter");
   act->radiobutton_delete = get_widget_assert (xml,   "radiobutton-delete");
 
+  GtkWidget *all_cases_event = get_widget_assert (xml, "all-cases-event");
+  g_signal_connect (all_cases_event, "button-release-event", G_CALLBACK (on_button_release), act);
 
-  GtkWidget    *button_range = get_widget_assert (xml, "button-range");
+  GtkWidget *button_range = get_widget_assert (xml, "button-range");
   GtkWidget *button_sample = get_widget_assert (xml, "button-sample");
 
   GtkWidget *button_if =get_widget_assert (xml, "button-if");
index 23b22dc2746ea964a1670189914ff738c1ae575f..4f9840d4bd10194c94545675266ab5b445288379 100644 (file)
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkLabel" id="all-cases-label">
+                          <object class="GtkEventBox" id="all-cases-event">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                            <property name="halign">start</property>
-                            <property name="label" translatable="yes">All Cases</property>
+                            <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="visible_window">False</property>
+                            <child>
+                              <object class="GtkLabel" id="all-cases-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="halign">start</property>
+                                <property name="label" translatable="yes">All Cases</property>
+                              </object>
+                            </child>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>