[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: x_compselect.c
User: cnieves
Date: 07/06/13 12:59:31
Modified: . x_compselect.c x_multiattrib.c x_print.c
Log:
Removed code handling escape key presses in dialogs.
Since GTK takes care of escape key presses, this code
is not needed. Applied patch from Ivan Stankovic.
Fixes bug #1710818 for gschem. Thanks.
Revision Changes Path
1.25 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.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- x_compselect.c 9 Jun 2007 20:30:14 -0000 1.24
+++ x_compselect.c 13 Jun 2007 16:59:31 -0000 1.25
@@ -352,38 +352,6 @@
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 treeview selection.
* \par Function Description
* This is the callback function that is called every time the user
@@ -711,13 +679,6 @@
"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 */
hbox = GTK_WIDGET (g_object_new (GTK_TYPE_HBOX,
/* GtkBox */
1.11 eda/geda/gaf/gschem/src/x_multiattrib.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_multiattrib.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_multiattrib.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- x_multiattrib.c 29 May 2007 23:06:05 -0000 1.10
+++ x_multiattrib.c 13 Jun 2007 16:59:31 -0000 1.11
@@ -68,9 +68,9 @@
multiattrib_update (MULTIATTRIB(dialog));
gtk_widget_show (dialog);
switch (gtk_dialog_run ((GtkDialog*)dialog)) {
- case MULTIATTRIB_RESPONSE_CLOSE:
+ case GTK_RESPONSE_CLOSE:
case GTK_RESPONSE_DELETE_EVENT:
- /* resets state and update message in toolbar */
+ /* reset state and update message in toolbar */
i_set_state (toplevel, SELECT);
i_update_toolbar (toplevel);
break;
@@ -1008,29 +1008,6 @@
}
-
-/*! \todo Finish function documentation
- * \brief
- * \par Function Description
- *
- */
-static gboolean multiattrib_callback_dialog_key_pressed(GtkWidget *widget,
- GdkEventKey *event,
- gpointer user_data)
-{
- Multiattrib *multiattrib = (Multiattrib*)widget;
- gboolean retval = FALSE;
-
- /* close the dialog if the Escape key is pressed */
- if (event->keyval == GDK_Escape) {
- gtk_dialog_response ((GtkDialog*)multiattrib,
- MULTIATTRIB_RESPONSE_CLOSE);
- retval = TRUE;
- }
-
- return retval;
-}
-
/*! \todo Finish function documentation
* \brief
* \par Function Description
@@ -1316,12 +1293,6 @@
multiattrib->object = NULL;
- /* connect to the key-press-event of dialog */
- g_signal_connect (multiattrib,
- "key-press-event",
- G_CALLBACK (multiattrib_callback_dialog_key_pressed),
- multiattrib);
-
/* create the attribute list frame */
frame = GTK_WIDGET (g_object_new (GTK_TYPE_FRAME,
/* GtkFrame */
@@ -1587,7 +1558,7 @@
/* now add the close button to the action area */
gtk_dialog_add_button (GTK_DIALOG (multiattrib),
- GTK_STOCK_CLOSE, MULTIATTRIB_RESPONSE_CLOSE);
+ GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
}
1.37 eda/geda/gaf/gschem/src/x_print.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_print.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_print.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- x_print.c 29 May 2007 23:06:05 -0000 1.36
+++ x_print.c 13 Jun 2007 16:59:31 -0000 1.37
@@ -49,9 +49,6 @@
/* Private functions */
-static gboolean print_dialog_action_keypress (GtkWidget * widget,
- GdkEventKey * event,
- PrintDialog * dialog);
static void print_dialog_action_radio_toggled (GtkWidget * w,
PrintDialog * dialog);
@@ -122,40 +119,6 @@
}
/*!
- * \brief Handle keypress events caught by the print dialog.
- *
- * \par Private callback function, should not be called by any code
- * outside x_print.c
- */
-static gboolean
-print_dialog_action_keypress (GtkWidget * widget, GdkEventKey * event,
- PrintDialog * dialog)
-{
- char *key_name;
-
- key_name = gdk_keyval_name (event->keyval);
- if ( key_name == NULL ) return FALSE;
-
- if (widget == GTK_WIDGET (dialog))
- {
- if (strcmp (key_name, "Escape") == 0)
- {
- gtk_dialog_response (GTK_DIALOG (dialog),
- GTK_RESPONSE_REJECT);
- return TRUE;
- }
- if (strcmp (key_name, "Return") == 0)
- {
- gtk_dialog_response (GTK_DIALOG (dialog),
- GTK_RESPONSE_ACCEPT);
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-/*!
* \brief Create, initialize and populate a combobox for selecting
* what paper size to print to.
* \par Private function, should not be
@@ -311,6 +274,7 @@
GtkWidget *frame;
GtkWidget *settingstable, *desttable;
GtkWidget *label;
+ GtkWidget *print_button;
/* Initialize properties */
g_object_set (G_OBJECT (dialog),
@@ -318,11 +282,6 @@
"title", _("Print..."),
"modal", TRUE, "destroy-with-parent", TRUE, NULL);
- /* Connect key-press event */
- g_signal_connect (dialog,
- "key_press_event",
- GTK_SIGNAL_FUNC (print_dialog_action_keypress), dialog);
-
/* Setup hbox for two main panes */
box = gtk_vbox_new (FALSE, 2);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), box);
@@ -431,10 +390,11 @@
1, 3, 1, 2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
/* Add "Cancel" and "Print" buttons */
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
- GTK_STOCK_PRINT, GTK_RESPONSE_ACCEPT,
- NULL);
+ gtk_dialog_add_button (GTK_DIALOG (dialog),
+ GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT);
+ print_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
+ GTK_STOCK_PRINT, GTK_RESPONSE_ACCEPT);
+ gtk_widget_grab_focus(print_button);
#if GTK_CHECK_VERSION (2,6,0)
/* Set the alternative button order (ok, cancel, help) for other systems */
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs