Bug 414071 - Let escape key close crash reporter dialog. r=ted

This commit is contained in:
Archana 2014-01-16 08:44:45 -05:00
parent 5f4ba8c867
commit 0ad40f7d59
3 changed files with 20 additions and 2 deletions

View File

@ -17,6 +17,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <gdk/gdkkeysyms.h>
#include <algorithm>
#include <string>
@ -27,6 +28,10 @@
#include "crashreporter.h"
#include "crashreporter_gtk_common.h"
#ifndef GDK_KEY_Escape
#define GDK_KEY_Escape GDK_Escape
#endif
using std::string;
using std::vector;
@ -215,14 +220,25 @@ gpointer SendThread(gpointer args)
}
gboolean WindowDeleted(GtkWidget* window,
GdkEvent* event,
gpointer userData)
GdkEvent* event,
gpointer userData)
{
SaveSettings();
gtk_main_quit();
return TRUE;
}
gboolean check_escape(GtkWidget* window,
GdkEventKey* event,
gpointer userData)
{
if (event->keyval == GDK_KEY_Escape) {
gtk_main_quit();
return TRUE;
}
return FALSE;
}
static void MaybeSubmitReport()
{
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gSubmitReportCheck))) {

View File

@ -39,6 +39,7 @@ gpointer SendThread(gpointer args);
gboolean WindowDeleted(GtkWidget* window,
GdkEvent* event,
gpointer userData);
gboolean check_escape(GtkWidget* window, GdkEventKey* event, gpointer data);
void SubmitReportChecked(GtkButton* sender, gpointer userData);
void IncludeURLClicked(GtkButton* sender, gpointer userData);
void CloseClicked(GtkButton* button,

View File

@ -396,6 +396,7 @@ bool UIShowCrashUI(const string& dumpfile,
gtk_window_set_position(GTK_WINDOW(gWindow), GTK_WIN_POS_CENTER);
gtk_container_set_border_width(GTK_CONTAINER(gWindow), 12);
g_signal_connect(gWindow, "delete-event", G_CALLBACK(WindowDeleted), 0);
g_signal_connect(gWindow, "key_press_event", G_CALLBACK(check_escape), nullptr);
GtkWidget* vbox = gtk_vbox_new(FALSE, 6);
gtk_container_add(GTK_CONTAINER(gWindow), vbox);