Don't change default build command entry color when cancelling

label editing.
Make dialogs_show_input() return NULL when cancelled.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5416 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2010-11-18 17:51:15 +00:00
parent 63df228c08
commit 554f1b0526
4 changed files with 13 additions and 5 deletions

View File

@ -5,6 +5,10 @@
command label.
Add 'parent' argument to some dialogs_show_input*() functions because
the dialog parent may not always be the main window.
* src/build.c, src/dialogs.c, src/callbacks.c:
Don't change default build command entry color when cancelling
label editing.
Make dialogs_show_input() return NULL when cancelled.
2010-11-17 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>

View File

@ -1822,6 +1822,9 @@ static void on_label_button_clicked(GtkWidget *wid, gpointer user_data)
gchar *str = dialogs_show_input(_("Set menu item label"),
NULL, NULL, old);
if (!str)
return;
gtk_button_set_label(GTK_BUTTON(wid), str);
g_free(str);
r->used_dst = TRUE;

View File

@ -1437,11 +1437,12 @@ on_insert_date_activate (GtkMenuItem *menuitem,
format = ui_prefs.custom_date_format;
else
{
setptr(ui_prefs.custom_date_format,
dialogs_show_input(_("Custom Date Format"), GTK_WINDOW(main_widgets.window),
gchar *str = 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));
ui_prefs.custom_date_format);
if (str)
setptr(ui_prefs.custom_date_format, str);
return;
}

View File

@ -1032,13 +1032,13 @@ static void on_dialog_input(const gchar *str)
}
/* Returns: newly allocated string - a copy of either the entry text or default_text. */
/* Returns: new copy of user input or NULL if cancelled. */
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, parent, label_text, default_text, FALSE, on_dialog_input, NULL);
return NVL(dialog_input, g_strdup(default_text));
return dialog_input;
}