Fixed crashes when using some dialogs after they were closed before.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1209 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2007-01-19 23:17:40 +00:00
parent 44f105e7ff
commit 278458e436
5 changed files with 18 additions and 21 deletions

View File

@ -4,6 +4,8 @@
available on all systems.
* geany.desktop.in: Added more mimetypes supplied by Nick Schermer.
* doc/geany.docbook: Documented GEANY_PROJECT_EXT.
* src/dialogs.c, src/prefs.c, src/prefs.h, src/search.c:
Fixed crashes when using some dialogs after they were closed before.
2007-01-18 Enrico Tröger <enrico.troeger@uvena.de>

View File

@ -127,7 +127,7 @@ void dialogs_show_open_file ()
g_signal_connect((gpointer) app->open_filesel, "selection-changed",
G_CALLBACK(on_file_open_selection_changed), NULL);
g_signal_connect ((gpointer) app->open_filesel, "delete_event",
G_CALLBACK(gtk_widget_hide), NULL);
G_CALLBACK(gtk_widget_hide_on_delete), NULL);
g_signal_connect((gpointer) app->open_filesel, "response",
G_CALLBACK(on_file_open_dialog_response), NULL);
}
@ -267,8 +267,10 @@ gboolean dialogs_show_save_as()
gtk_window_set_type_hint(GTK_WINDOW(app->save_filesel), GDK_WINDOW_TYPE_HINT_DIALOG);
gtk_dialog_set_default_response(GTK_DIALOG(app->save_filesel), GTK_RESPONSE_ACCEPT);
g_signal_connect((gpointer) app->save_filesel, "delete_event", G_CALLBACK(gtk_widget_hide), NULL);
g_signal_connect((gpointer) app->save_filesel, "response", G_CALLBACK(on_file_save_dialog_response), NULL);
g_signal_connect((gpointer) app->save_filesel, "delete_event",
G_CALLBACK(gtk_widget_hide_on_delete), NULL);
g_signal_connect((gpointer) app->save_filesel, "response",
G_CALLBACK(on_file_save_dialog_response), NULL);
gtk_window_set_transient_for(GTK_WINDOW(app->save_filesel), GTK_WINDOW(app->window));
}
@ -415,7 +417,7 @@ void dialogs_show_open_font()
gtk_widget_show(GTK_FONT_SELECTION_DIALOG(app->open_fontsel)->apply_button);
g_signal_connect((gpointer) app->open_fontsel,
"delete_event", G_CALLBACK(gtk_widget_hide), NULL);
"delete_event", G_CALLBACK(gtk_widget_hide_on_delete), NULL);
g_signal_connect((gpointer) GTK_FONT_SELECTION_DIALOG(app->open_fontsel)->ok_button,
"clicked", G_CALLBACK(on_font_ok_button_clicked), NULL);
g_signal_connect((gpointer) GTK_FONT_SELECTION_DIALOG(app->open_fontsel)->cancel_button,
@ -423,7 +425,8 @@ void dialogs_show_open_font()
g_signal_connect((gpointer) GTK_FONT_SELECTION_DIALOG(app->open_fontsel)->apply_button,
"clicked", G_CALLBACK(on_font_apply_button_clicked), NULL);
gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(app->open_fontsel), app->editor_font);
gtk_font_selection_dialog_set_font_name(
GTK_FONT_SELECTION_DIALOG(app->open_fontsel), app->editor_font);
gtk_window_set_transient_for(GTK_WINDOW(app->open_fontsel), GTK_WINDOW(app->window));
}
/* We make sure the dialog is visible. */
@ -546,7 +549,7 @@ void dialogs_show_color(gchar *colour)
g_signal_connect(GTK_COLOR_SELECTION_DIALOG(app->open_colorsel)->ok_button, "clicked",
G_CALLBACK(on_color_ok_button_clicked), NULL);
g_signal_connect(app->open_colorsel, "delete_event",
G_CALLBACK(gtk_widget_hide), NULL);
G_CALLBACK(gtk_widget_hide_on_delete), NULL);
}
// if colour is non-NULL set it in the dialog as preselected colour
if (colour != NULL && (colour[0] == '0' || colour[0] == '#'))

View File

@ -684,14 +684,6 @@ void on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_dat
}
gboolean on_prefs_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
gtk_widget_hide(widget);
return TRUE;
}
void on_prefs_color_choosed(GtkColorButton *widget, gpointer user_data)
{
GdkColor color;
@ -987,8 +979,10 @@ void dialogs_show_prefs_dialog(void)
vte_append_preferences_tab();
#endif
g_signal_connect((gpointer) app->prefs_dialog, "response", G_CALLBACK(on_prefs_button_clicked), NULL);
g_signal_connect((gpointer) app->prefs_dialog, "delete_event", G_CALLBACK(on_prefs_delete_event), NULL);
g_signal_connect((gpointer) app->prefs_dialog, "response",
G_CALLBACK(on_prefs_button_clicked), NULL);
g_signal_connect((gpointer) app->prefs_dialog, "delete_event",
G_CALLBACK(gtk_widget_hide_on_delete), NULL);
g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "tagbar_font"),
"font-set", G_CALLBACK(on_prefs_font_choosed), GINT_TO_POINTER(1));
g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "msgwin_font"),

View File

@ -28,8 +28,6 @@ void prefs_init_dialog(void);
void on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_data);
gboolean on_prefs_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data);
void on_prefs_font_choosed(GtkFontButton *widget, gpointer user_data);
void on_prefs_color_choosed(GtkColorButton *widget, gpointer user_data);

View File

@ -286,7 +286,7 @@ void search_show_find_dialog()
g_signal_connect((gpointer) widgets.find_dialog, "response",
G_CALLBACK(on_find_dialog_response), entry);
g_signal_connect((gpointer) widgets.find_dialog, "delete_event",
G_CALLBACK(gtk_widget_hide), NULL);
G_CALLBACK(gtk_widget_hide_on_delete), NULL);
sbox = gtk_hbox_new(FALSE, 6);
gtk_box_pack_start(GTK_BOX(sbox), label, FALSE, FALSE, 0);
@ -416,7 +416,7 @@ void search_show_replace_dialog()
g_signal_connect((gpointer) widgets.replace_dialog, "response",
G_CALLBACK(on_replace_dialog_response), entry_replace);
g_signal_connect((gpointer) widgets.replace_dialog, "delete_event",
G_CALLBACK(gtk_widget_hide), NULL);
G_CALLBACK(gtk_widget_hide_on_delete), NULL);
fbox = gtk_hbox_new(FALSE, 6);
gtk_box_pack_start(GTK_BOX(fbox), label_find, FALSE, FALSE, 0);
@ -620,7 +620,7 @@ void search_show_find_in_files_dialog()
g_signal_connect((gpointer) widgets.find_in_files_dialog, "response",
G_CALLBACK(on_find_in_files_dialog_response), combo);
g_signal_connect((gpointer) widgets.find_in_files_dialog, "delete_event",
G_CALLBACK(gtk_widget_hide), NULL);
G_CALLBACK(gtk_widget_hide_on_delete), NULL);
gtk_widget_show_all(widgets.find_in_files_dialog);
sel = get_default_text(idx);