[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: CVS update: x_compselect.c



  User: pbernaud
  Date: 06/10/13 10:31:44

  Modified:    .        x_compselect.c
  Log:
  Made the component selection dialog to close when Escape is hit
  
  
  
  
  Revision  Changes    Path
  1.5       +38 -0     eda/geda/gaf/gschem/src/x_compselect.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_compselect.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_compselect.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- x_compselect.c	4 Oct 2006 20:30:39 -0000	1.4
  +++ x_compselect.c	13 Oct 2006 14:31:44 -0000	1.5
  @@ -37,6 +37,7 @@
   
   #include <libgeda/libgeda.h>
   #include <gtk/gtk.h>
  +#include <gdk/gdkkeysyms.h> 
   
   #include "../include/globals.h"
   #include "../include/prototype.h"
  @@ -304,6 +305,38 @@
     return ret;
   }
   
  +/*! \brief Handles a key press on the dialog.
  + *  \par Function Description
  + *  This is the callback function that is connected to the key press
  + *  event of the dialog.
  + *
  + *  If the user pressed the Escape key, the close response is emitted
  + *  requesting the dialog to be deleted.
  + *
  + *  If any other key is pressed the event is further propagated.
  + *
  + *  \param [in] widget    The component selection dialog.
  + *  \param [in] event     The event structure for key pressed.
  + *  \param [in] user_data NULL.
  + *  \returns TRUE to stop other handlers from being invoked, FALSE
  + *           otherwise.
  + */
  +static gboolean
  +compselect_callback_dialog_key_press_event (GtkWidget   *widget,
  +                                            GdkEventKey *event,
  +                                            gpointer     user_data)
  +{
  +  switch (event->keyval) {
  +      case GDK_Escape:
  +        /* user pressed escape key, request close of the dialog */
  +        gtk_dialog_response (GTK_DIALOG (widget), GTK_RESPONSE_CLOSE);
  +        return TRUE;
  +  }
  +  
  +  /* returns FALSE to propagate event further */
  +  return FALSE;
  +}
  +
   /*! \brief Handles changes in the filter entry.
    *  \par Function Description
    *  This is the callback function that is called every time the user
  @@ -629,6 +662,11 @@
     g_object_set (GTK_DIALOG (compselect)->vbox,
                   "homogeneous", FALSE,
                   NULL);
  +  /* connect dialog to key press event */
  +  g_signal_connect (compselect,
  +                    "key_press_event",
  +                    G_CALLBACK (compselect_callback_dialog_key_press_event),
  +                    NULL);
   
     
     /* horizontal box selection and preview */
  
  
  


_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs