зеркало из https://github.com/mozilla/gecko-dev.git
(*) Only toggle checkboxes in setup type dlg on spacebar keypress.
(*) Make next buttons be default. b=206783; r=ssu; sr=bryner
This commit is contained in:
Родитель
d6507e92a9
Коммит
4976ca5f5b
|
@ -26,9 +26,11 @@
|
|||
#include "nsXInstaller.h"
|
||||
#include "check_on.xpm"
|
||||
#include "check_off.xpm"
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
static nsSetupType *sCustomST; // cache a pointer to the custom setup type
|
||||
static GtkWidget *sDescLong;
|
||||
static gint sCurrRowSelected;
|
||||
|
||||
nsComponentsDlg::nsComponentsDlg() :
|
||||
mMsg0(NULL),
|
||||
|
@ -348,8 +350,13 @@ nsComponentsDlg::Show(int aDirection)
|
|||
currComp = currComp->GetNext();
|
||||
}
|
||||
|
||||
// by default, first row selected upon Show()
|
||||
sCurrRowSelected = 0;
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(list), "select_row",
|
||||
GTK_SIGNAL_FUNC(RowSelected), NULL);
|
||||
gtk_signal_connect(GTK_OBJECT(list), "key_press_event",
|
||||
GTK_SIGNAL_FUNC(KeyPressed), NULL);
|
||||
gtk_container_add(GTK_CONTAINER(scrollwin), list);
|
||||
gtk_widget_show(list);
|
||||
gtk_widget_show(scrollwin);
|
||||
|
@ -468,6 +475,28 @@ nsComponentsDlg::RowSelected(GtkWidget *aWidget, gint aRow, gint aColumn,
|
|||
{
|
||||
DUMP("RowSelected");
|
||||
|
||||
sCurrRowSelected = aRow;
|
||||
|
||||
// only toggle row selection state for clicks on the row
|
||||
if (aColumn == -1 && !aEvent)
|
||||
return;
|
||||
|
||||
ToggleRowSelection(aWidget, aRow);
|
||||
}
|
||||
|
||||
void
|
||||
nsComponentsDlg::KeyPressed(GtkWidget *aWidget, GdkEventKey *aEvent,
|
||||
gpointer aData)
|
||||
{
|
||||
DUMP("KeyPressed");
|
||||
|
||||
if (aEvent->keyval == GDK_space)
|
||||
ToggleRowSelection(aWidget, sCurrRowSelected);
|
||||
}
|
||||
|
||||
void
|
||||
nsComponentsDlg::ToggleRowSelection(GtkWidget *aWidget, gint aRow)
|
||||
{
|
||||
int numRows = 0, currRow = 0;
|
||||
GtkStyle *style = NULL;
|
||||
GdkBitmap *ch_mask = NULL;
|
||||
|
|
|
@ -50,6 +50,9 @@ public:
|
|||
|
||||
static void RowSelected(GtkWidget *aWidget, gint aRow, gint aColumn,
|
||||
GdkEventButton *aEvent, gpointer aData);
|
||||
static void KeyPressed(GtkWidget *aWidget, GdkEventKey *aEvent,
|
||||
gpointer aData);
|
||||
static void ToggleRowSelection(GtkWidget *aEvent, gint aRow);
|
||||
|
||||
/*--------------------------------------------------------------------*
|
||||
* INI Properties
|
||||
|
|
|
@ -176,6 +176,9 @@ nsWelcomeDlg::Show(int aDirection)
|
|||
if (gCtx->back)
|
||||
gtk_widget_hide(gCtx->back);
|
||||
|
||||
GTK_WIDGET_SET_FLAGS(gCtx->next, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default(gCtx->next);
|
||||
|
||||
if (aDirection == nsXInstallerDlg::BACKWARD_MOVE)
|
||||
{
|
||||
// change the button titles back to Back/Next
|
||||
|
|
|
@ -312,6 +312,8 @@ nsXInstaller::DrawNavButtons()
|
|||
gtk_container_add(GTK_CONTAINER(gCtx->back), gCtx->backLabel);
|
||||
gtk_widget_show(gCtx->nextLabel);
|
||||
gtk_widget_show(gCtx->backLabel);
|
||||
GTK_WIDGET_SET_FLAGS(gCtx->next, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default(gCtx->next);
|
||||
|
||||
navbtnhbox = gtk_hbox_new(TRUE, 10);
|
||||
canvasvbox = gtk_vbox_new(TRUE, 10);
|
||||
|
@ -324,11 +326,11 @@ nsXInstaller::DrawNavButtons()
|
|||
|
||||
gtk_table_attach(GTK_TABLE(navbtntable), gCtx->back, 2, 3, 0, 1,
|
||||
static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND),
|
||||
static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND),
|
||||
static_cast<GtkAttachOptions>(GTK_SHRINK),
|
||||
5, 5);
|
||||
gtk_table_attach(GTK_TABLE(navbtntable), gCtx->next, 3, 4, 0, 1,
|
||||
static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND),
|
||||
static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND),
|
||||
static_cast<GtkAttachOptions>(GTK_SHRINK),
|
||||
5, 5);
|
||||
|
||||
gtk_widget_show(navbtntable);
|
||||
|
@ -446,6 +448,8 @@ ErrorHandler(int aErr, const char* aErrMsg)
|
|||
|
||||
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(sErrDlg)->vbox), label);
|
||||
|
||||
GTK_WIDGET_SET_FLAGS(okButton, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default(okButton);
|
||||
gtk_widget_show_all(sErrDlg);
|
||||
|
||||
return aErr;
|
||||
|
|
Загрузка…
Ссылка в новой задаче