Removed unneeded function dialogs_show_fifo_error(), fixed small memory leak in dialogs_show_question()

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@375 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2006-05-30 15:27:38 +00:00
parent 938f7abeda
commit f4b7b988ec
3 changed files with 7 additions and 29 deletions

View File

@ -225,7 +225,7 @@ void dialogs_show_file_open_error(void)
}
/// TODO is there a difference to dialogs_show_question? if not, remove this one
/// TODO replace by dialogs_show_question
gboolean dialogs_show_not_found(const gchar *text)
{
GtkWidget *dialog;
@ -276,28 +276,6 @@ void dialogs_show_info(const gchar *text, ...)
}
/// TODO is there a difference to dialogs_show_question? if not, remove this one
gboolean dialogs_show_fifo_error(const gchar *text, ...)
{
GtkWidget *dialog;
gchar string[300];
gint ret;
va_list args;
va_start(args, text);
g_vsnprintf(string, 299, text, args);
va_end(args);
dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_BUTTONS_YES_NO, string);
ret = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
if (ret == GTK_RESPONSE_YES) return TRUE;
else return FALSE;
}
void dialogs_show_error(const gchar *text, ...)
{
#ifndef GEANY_WIN32
@ -1271,6 +1249,7 @@ GtkWidget *dialogs_add_file_open_extra_widget(void)
}
/// TODO remove this function and use dialogs_show_question instead
gboolean dialogs_show_mkcfgdir_error(gint error_nr)
{
GtkWidget *dialog;
@ -1837,12 +1816,13 @@ gboolean dialogs_show_question(const gchar *text, ...)
va_end(args);
#ifdef GEANY_WIN32
if (MessageBox(NULL, string, _("Question"), MB_YESNO | MB_ICONWARNING) == IDYES) return TRUE;
else return FALSE;
if (MessageBox(NULL, string, _("Question"), MB_YESNO | MB_ICONWARNING) == IDYES)
ret = TRUE;
#else
dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, string);
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_YES) ret = TRUE;
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_YES)
ret = TRUE;
gtk_widget_destroy(dialog);
#endif
g_free(string);

View File

@ -42,8 +42,6 @@ void dialogs_show_info(const gchar *text, ...);
void dialogs_show_error(const gchar *text, ...);
gboolean dialogs_show_fifo_error(const gchar *text, ...);
gboolean dialogs_show_unsaved_file(gint idx);
/* This shows the font selection dialog to choose a font. */

View File

@ -386,7 +386,7 @@ static void create_fifo(gint argc, gchar **argv, const gchar *config_dir)
}
else
{
if (dialogs_show_fifo_error(_("Geany is exiting because a named pipe was found. Mostly this means, Geany is already running. If you know Geany is not running, you can delete the file and start Geany anyway.\nDelete the named pipe and start Geany?")))
if (dialogs_show_question(_("Geany is exiting because a named pipe was found. Mostly this means, Geany is already running. If you know Geany is not running, you can delete the file and start Geany anyway.\nDelete the named pipe and start Geany?")))
{
unlink(fifo_name);
}