Kaydet (Commit) e24d4fbf authored tarafından Nick Treleaven's avatar Nick Treleaven

Re-focus Set Build Commands/Project dialogs after editing a build

command label.
Add 'parent' argument to some dialogs_show_input*() functions because
the dialog parent may not always be the main window.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5414 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 3cb18693
2010-11-18 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/build.c, src/dialogs.c, src/dialogs.h, src/callbacks.c:
Re-focus Set Build Commands/Project dialogs after editing a build
command label.
Add 'parent' argument to some dialogs_show_input*() functions because
the dialog parent may not always be the main window.
2010-11-17 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/build.c, doc/geany.txt, doc/geany.html:
......
......@@ -1274,7 +1274,7 @@ static void on_build_menu_item(GtkWidget *w, gpointer user_data)
if (! dialog)
{
dialog = dialogs_show_input_persistent(_("Custom Text"),
dialog = dialogs_show_input_persistent(_("Custom Text"), GTK_WINDOW(main_widgets.window),
_("Enter custom text here, all entered text is appended to the command."),
build_info.custom_target, &on_make_custom_input_response);
}
......@@ -1816,9 +1816,11 @@ static void on_clear_dialog_regex_row(GtkEntry *regex, gpointer unused)
static void on_label_button_clicked(GtkWidget *wid, gpointer user_data)
{
RowWidgets *r = (RowWidgets*)user_data;
RowWidgets *r = user_data;
const gchar *old = gtk_button_get_label(GTK_BUTTON(wid));
gchar *str = dialogs_show_input(_("Set menu item label"), NULL, old);
/* FIXME: we should pass either build dialog or project dialog instead of NULL for parent */
gchar *str = dialogs_show_input(_("Set menu item label"),
NULL, NULL, old);
gtk_button_set_label(GTK_BUTTON(wid), str);
g_free(str);
......
......@@ -1193,7 +1193,8 @@ on_go_to_line_activate (GtkMenuItem *menuitem,
gchar *result;
result = dialogs_show_input_goto_line(
_("Go to Line"), _("Enter the line you want to go to:"), value);
_("Go to Line"), GTK_WINDOW(main_widgets.window),
_("Enter the line you want to go to:"), value);
if (result != NULL)
{
GeanyDocument *doc = document_get_current();
......@@ -1437,7 +1438,7 @@ on_insert_date_activate (GtkMenuItem *menuitem,
else
{
setptr(ui_prefs.custom_date_format,
dialogs_show_input(_("Custom Date Format"),
dialogs_show_input(_("Custom Date Format"), GTK_WINDOW(main_widgets.window),
_("Enter here a custom date and time format. "
"You can use any conversion specifiers which can be used with the ANSI C strftime function."),
ui_prefs.custom_date_format));
......
......@@ -980,12 +980,13 @@ static void add_input_widgets(GtkWidget *dialog, GtkWidget *vbox,
* and can be reshown.
* Returns: the dialog widget. */
static GtkWidget *
dialogs_show_input_full(const gchar *title, const gchar *label_text, const gchar *default_text,
dialogs_show_input_full(const gchar *title, GtkWindow *parent,
const gchar *label_text, const gchar *default_text,
gboolean persistent, GeanyInputCallback input_cb, GCallback insert_text_cb)
{
GtkWidget *dialog, *vbox;
dialog = gtk_dialog_new_with_buttons(title, GTK_WINDOW(main_widgets.window),
dialog = gtk_dialog_new_with_buttons(title, parent,
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog));
......@@ -1014,10 +1015,11 @@ dialogs_show_input_full(const gchar *title, const gchar *label_text, const gchar
/* Remember previous entry text in a combo box.
* Returns: the dialog widget. */
GtkWidget *
dialogs_show_input_persistent(const gchar *title, const gchar *label_text, const gchar *default_text,
dialogs_show_input_persistent(const gchar *title, GtkWindow *parent,
const gchar *label_text, const gchar *default_text,
GeanyInputCallback input_cb)
{
return dialogs_show_input_full(title, label_text, default_text, TRUE, input_cb, NULL);
return dialogs_show_input_full(title, parent, label_text, default_text, TRUE, input_cb, NULL);
}
......@@ -1031,23 +1033,23 @@ static void on_dialog_input(const gchar *str)
/* Returns: newly allocated string - a copy of either the entry text or default_text. */
gchar *dialogs_show_input(const gchar *title, const gchar *label_text,
gchar *dialogs_show_input(const gchar *title, GtkWindow *parent, const gchar *label_text,
const gchar *default_text)
{
dialog_input = NULL;
dialogs_show_input_full(title, label_text, default_text, FALSE, on_dialog_input, NULL);
dialogs_show_input_full(title, parent, label_text, default_text, FALSE, on_dialog_input, NULL);
return NVL(dialog_input, g_strdup(default_text));
}
/* Returns: newly allocated copy of the entry text or NULL on cancel.
* Specialised variant for Goto Line dialog. */
gchar *dialogs_show_input_goto_line(const gchar *title, const gchar *label_text,
gchar *dialogs_show_input_goto_line(const gchar *title, GtkWindow *parent, const gchar *label_text,
const gchar *default_text)
{
dialog_input = NULL;
dialogs_show_input_full(
title, label_text, default_text, FALSE, on_dialog_input,
title, parent, label_text, default_text, FALSE, on_dialog_input,
G_CALLBACK(ui_editable_insert_text_callback));
return dialog_input;
}
......
......@@ -45,17 +45,17 @@ void dialogs_show_word_count(void);
void dialogs_show_color(gchar *colour);
gchar *dialogs_show_input(const gchar *title, const gchar *label_text,
const gchar *default_text);
gchar *dialogs_show_input(const gchar *title, GtkWindow *parent,
const gchar *label_text, const gchar *default_text);
gchar *dialogs_show_input_goto_line(const gchar *title, const gchar *label_text,
const gchar *default_text);
gchar *dialogs_show_input_goto_line(const gchar *title, GtkWindow *parent,
const gchar *label_text, const gchar *default_text);
GtkWidget *dialogs_show_input_persistent(const gchar *title, const gchar *label_text,
const gchar *default_text, GeanyInputCallback input_cb);
GtkWidget *dialogs_show_input_persistent(const gchar *title, GtkWindow *parent,
const gchar *label_text, const gchar *default_text, GeanyInputCallback input_cb);
gboolean dialogs_show_input_numeric(const gchar *title, const gchar *label_text,
gdouble *value, gdouble min, gdouble max, gdouble step);
gdouble *value, gdouble min, gdouble max, gdouble step);
void dialogs_show_file_properties(GeanyDocument *doc);
......
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