Commit 5b2c35bd authored by Sébastien Wilmet's avatar Sébastien Wilmet

gedit_replace_dialog_new(): GeditWindow parameter

Currently GeditReplaceDialog contains almost only the UI. It doesn't
interact with the GeditDocuments. The purpose is to move some code from
gedit-commands-search.c to GeditReplaceDialog. The latter is a more
logical place in my opinion.
parent 2b6e1659
......@@ -673,9 +673,7 @@ active_tab_changed_cb (GeditWindow *window,
static GtkWidget *
create_dialog (GeditWindow *window)
{
GtkWidget *dialog;
dialog = gedit_replace_dialog_new (GTK_WINDOW (window));
GtkWidget *dialog = gedit_replace_dialog_new (window);
g_signal_connect (dialog,
"response",
......
......@@ -51,8 +51,6 @@ struct _GeditReplaceDialogPrivate
GtkWidget *wrap_around_checkbutton;
GtkSourceSearchSettings *search_settings;
gboolean ui_error;
};
G_DEFINE_TYPE_WITH_PRIVATE (GeditReplaceDialog, gedit_replace_dialog, GTK_TYPE_DIALOG)
......@@ -255,23 +253,18 @@ gedit_replace_dialog_init (GeditReplaceDialog *dlg)
}
GtkWidget *
gedit_replace_dialog_new (GtkWindow *parent)
gedit_replace_dialog_new (GeditWindow *window)
{
GeditReplaceDialog *dlg;
dlg = g_object_new (GEDIT_TYPE_REPLACE_DIALOG,
NULL);
GeditReplaceDialog *dialog;
if (parent != NULL)
{
gtk_window_set_transient_for (GTK_WINDOW (dlg),
parent);
g_return_val_if_fail (GEDIT_IS_WINDOW (window), NULL);
gtk_window_set_destroy_with_parent (GTK_WINDOW (dlg),
TRUE);
}
dialog = g_object_new (GEDIT_TYPE_REPLACE_DIALOG,
"transient-for", window,
"destroy-with-parent", TRUE,
NULL);
return GTK_WIDGET (dlg);
return GTK_WIDGET (dialog);
}
const gchar *
......
......@@ -33,6 +33,7 @@
#include <gtk/gtk.h>
#include <gtksourceview/gtksource.h>
#include "gedit-window.h"
G_BEGIN_DECLS
......@@ -85,18 +86,18 @@ enum
*/
GType gedit_replace_dialog_get_type (void) G_GNUC_CONST;
GtkWidget *gedit_replace_dialog_new (GtkWindow *parent);
GtkWidget *gedit_replace_dialog_new (GeditWindow *window);
void gedit_replace_dialog_present_with_time (GeditReplaceDialog *dialog,
guint32 timestamp);
const gchar *gedit_replace_dialog_get_replace_text (GeditReplaceDialog *dialog);
const gchar *gedit_replace_dialog_get_search_text (GeditReplaceDialog *dialog);
void gedit_replace_dialog_set_search_text (GeditReplaceDialog *dialog,
const gchar *search_text);
const gchar *gedit_replace_dialog_get_replace_text (GeditReplaceDialog *dialog);
gboolean gedit_replace_dialog_get_backwards (GeditReplaceDialog *dialog);
GtkSourceSearchSettings *gedit_replace_dialog_get_search_settings (GeditReplaceDialog *dialog);
......
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