Fix preferences help button when activated with the keyboard

Don't hack around to trigger the help when the help button is clicked
on, simply handle the HELP dialog response. This makes the button
correctly show help rather than close the dialog when activated using
the keyboard.

This also drops _button_press_event() need and hack, making the button
correctly respond visually to mouse clicks.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5820 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Colomban Wendling 2011-05-27 21:00:41 +00:00
parent 7f8ffc982f
commit fdc80371c8
2 changed files with 12 additions and 15 deletions

View File

@ -1,3 +1,9 @@
2011-05-27 Colomban Wendling <colomban(at)geany(dot)org>
* src/prefs.c:
Fix preferences help button when activated with the keyboard.
2011-05-22 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/about.c, src/build.c, tagmanager/tm_workspace.c:

View File

@ -93,6 +93,7 @@ static void on_open_encoding_toggled(GtkToggleButton *togglebutton, gpointer use
static void on_sidebar_visible_toggled(GtkToggleButton *togglebutton, gpointer user_data);
static void on_prefs_print_radio_button_toggled(GtkToggleButton *togglebutton, gpointer user_data);
static void on_prefs_print_page_header_toggled(GtkToggleButton *togglebutton, gpointer user_data);
static void open_preferences_help(void);
typedef enum PrefCallbackAction
@ -1224,7 +1225,11 @@ on_prefs_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)
configuration_save();
}
if (response != GTK_RESPONSE_APPLY)
if (response == GTK_RESPONSE_HELP)
{
open_preferences_help();
}
else if (response != GTK_RESPONSE_APPLY)
{
gtk_tree_store_clear(store);
gtk_widget_hide(GTK_WIDGET(dialog));
@ -1592,18 +1597,6 @@ static gboolean prefs_dialog_key_press_response_cb(GtkWidget *dialog, GdkEventKe
}
static gboolean prefs_dialog_button_press_event_cb(GtkWidget *dialog, GdkEventButton *event,
gpointer data)
{
if (event->button == 1)
{
open_preferences_help();
return TRUE;
}
return FALSE;
}
void prefs_show_dialog(void)
{
if (ui_widgets.prefs_dialog == NULL)
@ -1767,8 +1760,6 @@ void prefs_show_dialog(void)
g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "check_sidebar_visible"),
"toggled", G_CALLBACK(on_sidebar_visible_toggled), NULL);
g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "button_help"),
"button-press-event", G_CALLBACK(prefs_dialog_button_press_event_cb), NULL);
g_signal_connect(ui_widgets.prefs_dialog,
"key-press-event", G_CALLBACK(prefs_dialog_key_press_response_cb), NULL);
}