[gedit] Override signal instead of connect to it
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Override signal instead of connect to it
- Date: Tue, 17 Jul 2012 17:33:06 +0000 (UTC)
commit f93125ebf93de0070f0750c92d7628ad661b03fa
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Tue Jul 17 19:34:33 2012 +0200
Override signal instead of connect to it
gedit/gedit-replace-dialog.c | 88 ++++++++++++++++++++---------------------
1 files changed, 43 insertions(+), 45 deletions(-)
---
diff --git a/gedit/gedit-replace-dialog.c b/gedit/gedit-replace-dialog.c
index 85c981f..779507a 100644
--- a/gedit/gedit-replace-dialog.c
+++ b/gedit/gedit-replace-dialog.c
@@ -79,10 +79,53 @@ gedit_replace_dialog_present_with_time (GeditReplaceDialog *dialog,
gtk_widget_grab_focus (dialog->priv->search_text_entry);
}
+static void
+gedit_replace_dialog_response (GtkDialog *dialog,
+ gint response_id)
+{
+ GeditReplaceDialog *dlg = GEDIT_REPLACE_DIALOG (dialog);
+ const gchar *str;
+
+ switch (response_id)
+ {
+ case GEDIT_REPLACE_DIALOG_REPLACE_RESPONSE:
+ case GEDIT_REPLACE_DIALOG_REPLACE_ALL_RESPONSE:
+ str = gtk_entry_get_text (GTK_ENTRY (dlg->priv->replace_text_entry));
+ if (*str != '\0')
+ {
+ gchar *text;
+
+ text = gedit_utils_unescape_search_text (str);
+ gedit_history_entry_prepend_text
+ (GEDIT_HISTORY_ENTRY (dlg->priv->replace_entry),
+ text);
+
+ g_free (text);
+ }
+ /* fall through, so that we also save the find entry */
+ case GEDIT_REPLACE_DIALOG_FIND_RESPONSE:
+ str = gtk_entry_get_text (GTK_ENTRY (dlg->priv->search_text_entry));
+ if (*str != '\0')
+ {
+ gchar *text;
+
+ text = gedit_utils_unescape_search_text (str);
+ gedit_history_entry_prepend_text
+ (GEDIT_HISTORY_ENTRY (dlg->priv->search_entry),
+ text);
+
+ g_free (text);
+ }
+ }
+}
+
static void
gedit_replace_dialog_class_init (GeditReplaceDialogClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkDialogClass *gtkdialog_class = GTK_DIALOG_CLASS (klass);
+
+ gtkdialog_class->response = gedit_replace_dialog_response;
g_type_class_add_private (object_class, sizeof (GeditReplaceDialogPrivate));
}
@@ -151,46 +194,6 @@ search_text_entry_changed (GtkEditable *editable,
}
static void
-response_handler (GeditReplaceDialog *dialog,
- gint response_id,
- gpointer data)
-{
- const gchar *str;
-
- switch (response_id)
- {
- case GEDIT_REPLACE_DIALOG_REPLACE_RESPONSE:
- case GEDIT_REPLACE_DIALOG_REPLACE_ALL_RESPONSE:
- str = gtk_entry_get_text (GTK_ENTRY (dialog->priv->replace_text_entry));
- if (*str != '\0')
- {
- gchar *text;
-
- text = gedit_utils_unescape_search_text (str);
- gedit_history_entry_prepend_text
- (GEDIT_HISTORY_ENTRY (dialog->priv->replace_entry),
- text);
-
- g_free (text);
- }
- /* fall through, so that we also save the find entry */
- case GEDIT_REPLACE_DIALOG_FIND_RESPONSE:
- str = gtk_entry_get_text (GTK_ENTRY (dialog->priv->search_text_entry));
- if (*str != '\0')
- {
- gchar *text;
-
- text = gedit_utils_unescape_search_text (str);
- gedit_history_entry_prepend_text
- (GEDIT_HISTORY_ENTRY (dialog->priv->search_entry),
- text);
-
- g_free (text);
- }
- }
-}
-
-static void
gedit_replace_dialog_init (GeditReplaceDialog *dlg)
{
GtkWidget *content;
@@ -315,11 +318,6 @@ gedit_replace_dialog_init (GeditReplaceDialog *dlg)
G_CALLBACK (search_text_entry_changed),
dlg);
- g_signal_connect (dlg,
- "response",
- G_CALLBACK (response_handler),
- NULL);
-
gtk_widget_show_all (GTK_WIDGET (dlg));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]