From 8154ee59c86532af970c492b58c91cb20d7569e8 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Tue, 24 Apr 2007 10:52:08 +0000 Subject: [PATCH] Disable FIF extra options entry when checkbox is not checked. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1476 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 6 ++++++ src/search.c | 16 +++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 60d55351..87d53a05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-04-24 Nick Treleaven + + * src/search.c: + Disable FIF extra options entry when checkbox is not checked. + + 2007-04-23 Nick Treleaven * src/build.c: diff --git a/src/search.c b/src/search.c index 052742e0..580909cc 100644 --- a/src/search.c +++ b/src/search.c @@ -530,12 +530,11 @@ void search_show_replace_dialog() } -static gboolean on_entry_extra_key_press(GtkWidget *widget, GdkEventKey *event, - gpointer user_data) +static void on_extra_options_toggled(GtkToggleButton *togglebutton, gpointer user_data) { - // enable extra option checkbutton when extra entry is edited - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(user_data), TRUE); - return FALSE; + // disable extra option entry when checkbutton not checked + gtk_widget_set_sensitive(GTK_WIDGET(user_data), + gtk_toggle_button_get_active(togglebutton)); } @@ -682,13 +681,16 @@ void search_show_find_in_files_dialog() entry_extra = gtk_entry_new(); if (search_prefs.fif_extra_options) gtk_entry_set_text(GTK_ENTRY(entry_extra), search_prefs.fif_extra_options); + gtk_widget_set_sensitive(entry_extra, FALSE); g_object_set_data_full(G_OBJECT(widgets.find_in_files_dialog), "entry_extra", gtk_widget_ref(entry_extra), (GDestroyNotify)gtk_widget_unref); - g_signal_connect(G_OBJECT(entry_extra), "key-press-event", - G_CALLBACK(on_entry_extra_key_press), check_extra); gtk_tooltips_set_tip(tooltips, entry_extra, _("Other options to pass to Grep"), NULL); + // enable entry_extra when check_extra is checked + g_signal_connect(G_OBJECT(check_extra), "toggled", + G_CALLBACK(on_extra_options_toggled), entry_extra); + hbox = gtk_hbox_new(FALSE, 6); gtk_box_pack_start(GTK_BOX(hbox), check_extra, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), entry_extra, TRUE, TRUE, 0);