Commit 9b004e83 authored by Paolo Maggi's avatar Paolo Maggi Committed by Paolo Maggi

Fixes weird focus behavior in the search/replace dialog

2007-06-17  Paolo Maggi  <paolo@gnome.org>

	Fixes weird focus behavior in the search/replace dialog
	
	* gedit/dialogs/gedit-search-dialog.c
	(gedit_search_dialog_present_with_time): new function
	(gedit_search_dialog_focus_in_event): removed
	(gedit_search_dialog_class_init): don't use 
	gedit_search_dialog_focus_in_event
	
	* gedit/dialogs/gedit-search-dialog.h: added prototype of
	gedit_search_dialog_present_with_time
	
	* gedit/gedit-commands-search.c (_gedit_cmd_search_find),
	(_gedit_cmd_search_replace): call 
gedit_search_dialog_present_with_time
	instead if gtk_window_present


svn path=/trunk/; revision=5631
parent 7bfee1e4
2007-06-17 Paolo Maggi <paolo@gnome.org>
Fixes weird focus behavior in the search/replace dialog
* gedit/dialogs/gedit-search-dialog.c
(gedit_search_dialog_present_with_time): new function
(gedit_search_dialog_focus_in_event): removed
(gedit_search_dialog_class_init): don't use
gedit_search_dialog_focus_in_event
* gedit/dialogs/gedit-search-dialog.h: added prototype of
gedit_search_dialog_present_with_time
* gedit/gedit-commands-search.c (_gedit_cmd_search_find),
(_gedit_cmd_search_replace): call gedit_search_dialog_present_with_time
instead if gtk_window_present
2007-06-13 Steve Frécinaux <code@istique.net>
* configure.ac:
......
......@@ -123,28 +123,15 @@ gedit_search_dialog_get_property (GObject *object,
}
}
static gboolean
gedit_search_dialog_focus_in_event (GtkWidget *widget,
GdkEventFocus *event)
void
gedit_search_dialog_present_with_time (GeditSearchDialog *dialog,
guint32 timestamp)
{
gboolean res;
GeditSearchDialog *dlg = GEDIT_SEARCH_DIALOG (widget);
res = GTK_WIDGET_CLASS (gedit_search_dialog_parent_class)->focus_in_event (widget, event);
g_return_if_fail (GEDIT_SEARCH_DIALOG (dialog));
/*
* If the document is focused and we print ctrl+F
* we want the focus to go on the entry even if it
* currently was on the Find button.
*/
if (!GTK_WIDGET_HAS_FOCUS (dlg->priv->search_text_entry))
{
gtk_widget_grab_focus (dlg->priv->search_text_entry);
gtk_editable_set_position (GTK_EDITABLE (dlg->priv->search_text_entry),
-1);
}
gtk_window_present_with_time (GTK_WINDOW (dialog), timestamp);
return res;
gtk_widget_grab_focus (dialog->priv->search_text_entry);
}
static gboolean
......@@ -159,12 +146,10 @@ static void
gedit_search_dialog_class_init (GeditSearchDialogClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkBindingSet *binding_set;
object_class->set_property = gedit_search_dialog_set_property;
object_class->get_property = gedit_search_dialog_get_property;
widget_class->focus_in_event = gedit_search_dialog_focus_in_event;
klass->show_replace = show_replace;
......
......@@ -90,6 +90,9 @@ GType gedit_search_dialog_get_type (void) G_GNUC_CONST;
GtkWidget *gedit_search_dialog_new (GtkWindow *parent,
gboolean show_replace);
void gedit_search_dialog_present_with_time (GeditSearchDialog *dialog,
guint32 timestamp);
gboolean gedit_search_dialog_get_show_replace (GeditSearchDialog *dialog);
void gedit_search_dialog_set_show_replace (GeditSearchDialog *dialog,
......
......@@ -536,7 +536,8 @@ _gedit_cmd_search_find (GtkAction *action,
* it is already open
*/
gtk_window_present (GTK_WINDOW (data));
gedit_search_dialog_present_with_time (GEDIT_SEARCH_DIALOG (data),
GDK_CURRENT_TIME);
return;
}
......@@ -618,7 +619,8 @@ _gedit_cmd_search_replace (GtkAction *action,
gedit_search_dialog_set_show_replace (GEDIT_SEARCH_DIALOG (data),
TRUE);
gtk_window_present (GTK_WINDOW (data));
gedit_search_dialog_present_with_time (GEDIT_SEARCH_DIALOG (data),
GDK_CURRENT_TIME);
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment