summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2017-11-03 10:08:52 -0700
committerAaron Plattner <aplattner@nvidia.com>2017-11-03 10:08:52 -0700
commit6fa8e5e7302107fa628ad8d39a3e7e82460b8ea5 (patch)
treeb41f0cbe6f9d6b91cf542728664487c5ee7aaf8c
parentda1f34ccb9d8481a356a5e7e0bb01c51e9eef5dc (diff)
384.98384.98
-rw-r--r--doc/version.mk2
-rw-r--r--samples/version.mk2
-rw-r--r--src/gtk+-2.x/ctkgridlicense.c150
-rw-r--r--src/gtk+-2.x/ctkgridlicense.h1
-rw-r--r--src/libXNVCtrl/version.mk2
-rw-r--r--src/version.h2
-rw-r--r--src/version.mk2
-rw-r--r--version.mk2
8 files changed, 155 insertions, 8 deletions
diff --git a/doc/version.mk b/doc/version.mk
index aa3eccc..38de1ec 100644
--- a/doc/version.mk
+++ b/doc/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 384.90
+NVIDIA_VERSION = 384.98
diff --git a/samples/version.mk b/samples/version.mk
index aa3eccc..38de1ec 100644
--- a/samples/version.mk
+++ b/samples/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 384.90
+NVIDIA_VERSION = 384.98
diff --git a/src/gtk+-2.x/ctkgridlicense.c b/src/gtk+-2.x/ctkgridlicense.c
index 55dc59c..a0ba600 100644
--- a/src/gtk+-2.x/ctkgridlicense.c
+++ b/src/gtk+-2.x/ctkgridlicense.c
@@ -75,6 +75,9 @@ static const char * __secondary_server_port_help =
static const char * __apply_button_help =
"Clicking the Apply button updates license settings in the gridd.conf file and "
"sends update license request to the NVIDIA GRID licensing daemon.";
+static const char * __cancel_button_help =
+"Clicking the Cancel button sets the text in all textboxes from the gridd.conf file. "
+"Any changes you have done will be lost.";
typedef struct
{
@@ -106,12 +109,14 @@ struct _DbusData
};
static void apply_clicked(GtkWidget *widget, gpointer user_data);
+static void cancel_clicked(GtkWidget *widget, gpointer user_data);
static void ctk_manage_grid_license_finalize(GObject *object);
static void ctk_manage_grid_license_class_init(CtkManageGridLicenseClass *);
static void dbusClose(DbusData *dbusData);
static gboolean checkConfigfile(gboolean *writable);
static gboolean disallow_whitespace(GtkWidget *widget, GdkEvent *event, gpointer user_data);
static gboolean allow_digits(GtkWidget *widget, GdkEvent *event, gpointer user_data);
+static gboolean enable_disable_ui_controls(GtkWidget *widget, GdkEvent *event, gpointer user_data);
GType ctk_manage_grid_license_get_type(void)
{
@@ -875,6 +880,58 @@ static void apply_clicked(GtkWidget *widget, gpointer user_data)
gtk_dialog_run(GTK_DIALOG(dlg));
gtk_widget_destroy(dlg);
}
+
+ /* Disable Apply/Cancel button. */
+ gtk_widget_set_sensitive(ctk_manage_grid_license->btn_apply, FALSE);
+ gtk_widget_set_sensitive(ctk_manage_grid_license->btn_cancel, FALSE);
+}
+
+/*
+ * cancel_clicked() - Called when the user clicks on the "Cancel" button.
+ */
+
+static void cancel_clicked(GtkWidget *widget, gpointer user_data)
+{
+ CtkManageGridLicense *ctk_manage_grid_license = CTK_MANAGE_GRID_LICENSE(user_data);
+ NvGriddConfigParams *griddConfig = NULL;
+ const char *textBoxServerStr;
+
+ griddConfig = GetNvGriddConfigParams();
+ if (!griddConfig) {
+ nv_error_msg("Null griddConfig. \n");
+ /* If griddConfig is Null, clear out all the textboxes. */
+ gtk_entry_set_text(GTK_ENTRY(ctk_manage_grid_license->txt_server_address), "");
+ gtk_entry_set_text(GTK_ENTRY(ctk_manage_grid_license->txt_server_port), "");
+ gtk_entry_set_text(GTK_ENTRY(ctk_manage_grid_license->txt_secondary_server_address), "");
+ gtk_entry_set_text(GTK_ENTRY(ctk_manage_grid_license->txt_secondary_server_port), "");
+ } else {
+ /* Set the text in all the textboxes from the griddconfig. */
+ gtk_entry_set_text(GTK_ENTRY(ctk_manage_grid_license->txt_server_address),
+ griddConfig->str[NV_GRIDD_SERVER_ADDRESS]);
+ gtk_entry_set_text(GTK_ENTRY(ctk_manage_grid_license->txt_server_port),
+ griddConfig->str[NV_GRIDD_SERVER_PORT]);
+ gtk_entry_set_text(GTK_ENTRY(ctk_manage_grid_license->txt_secondary_server_address),
+ griddConfig->str[NV_GRIDD_BACKUP_SERVER_ADDRESS]);
+ gtk_entry_set_text(GTK_ENTRY(ctk_manage_grid_license->txt_secondary_server_port),
+ griddConfig->str[NV_GRIDD_BACKUP_SERVER_PORT]);
+ }
+
+ textBoxServerStr = gtk_entry_get_text(GTK_ENTRY(ctk_manage_grid_license->txt_server_address));
+ /* Enable/Disable Secondary server address/port textboxes if Primary server address textbox string is empty. */
+ if (strcmp(textBoxServerStr, "") == 0) {
+ gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_address, FALSE);
+ gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_port, FALSE);
+ } else {
+ gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_address, TRUE);
+ gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_port, TRUE);
+ }
+
+ /* Disable Apply/Cancel button. */
+ gtk_widget_set_sensitive(ctk_manage_grid_license->btn_apply, FALSE);
+ gtk_widget_set_sensitive(ctk_manage_grid_license->btn_cancel, FALSE);
+
+ if(griddConfig)
+ FreeNvGriddConfigParams(griddConfig);
}
static void license_edition_toggled(GtkWidget *widget, gpointer user_data)
@@ -924,6 +981,54 @@ static gboolean disallow_whitespace(GtkWidget *widget, GdkEvent *event, gpointer
return FALSE;
}
+static gboolean enable_disable_ui_controls(GtkWidget *widget, GdkEvent *event, gpointer user_data)
+{
+ CtkManageGridLicense *ctk_manage_grid_license = CTK_MANAGE_GRID_LICENSE(user_data);
+ NvGriddConfigParams *griddConfig;
+ const char *textBoxServerStr, *textBoxServerPortStr, *textBoxSecondaryServerStr, *textBoxSecondaryServerPortStr;
+
+ griddConfig = GetNvGriddConfigParams();
+ if (!griddConfig)
+ return TRUE;
+
+ if (event->type == GDK_KEY_RELEASE) {
+
+ // Read license strings from textboxes.
+ textBoxServerStr = gtk_entry_get_text(GTK_ENTRY(ctk_manage_grid_license->txt_server_address));
+ textBoxServerPortStr = gtk_entry_get_text(GTK_ENTRY(ctk_manage_grid_license->txt_server_port));
+ textBoxSecondaryServerStr = gtk_entry_get_text(GTK_ENTRY(ctk_manage_grid_license->txt_secondary_server_address));
+ textBoxSecondaryServerPortStr = gtk_entry_get_text(GTK_ENTRY(ctk_manage_grid_license->txt_secondary_server_port));
+
+ /* Enable apply/cancel button if either:
+ Primary server address/port textbox string doesn't match with the Primary server string from the gridd config file or
+ Secondary server address/port textbox string doesn't match with the Secondary server string from the gridd config file. */
+ if ((strcmp(griddConfig->str[NV_GRIDD_SERVER_ADDRESS], textBoxServerStr) != 0) ||
+ ((strcmp(griddConfig->str[NV_GRIDD_BACKUP_SERVER_ADDRESS], textBoxSecondaryServerStr) != 0) ||
+ (strcmp(griddConfig->str[NV_GRIDD_BACKUP_SERVER_PORT], textBoxSecondaryServerPortStr) != 0) ||
+ (strcmp(griddConfig->str[NV_GRIDD_SERVER_PORT], textBoxServerPortStr) != 0))) {
+ gtk_widget_set_sensitive(ctk_manage_grid_license->btn_apply, TRUE);
+ gtk_widget_set_sensitive(ctk_manage_grid_license->btn_cancel, TRUE);
+ } else {
+ gtk_widget_set_sensitive(ctk_manage_grid_license->btn_apply, FALSE);
+ gtk_widget_set_sensitive(ctk_manage_grid_license->btn_cancel, FALSE);
+ }
+
+ /* Disable Secondary server address/port textboxes if Primary server address text box string is empty
+ to notify user that Primary server address is mandatory. */
+ if (strcmp(textBoxServerStr, "") == 0) {
+ gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_address, FALSE);
+ gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_port, FALSE);
+ } else {
+ gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_address, TRUE);
+ gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_port, TRUE);
+ }
+ }
+
+ FreeNvGriddConfigParams(griddConfig);
+
+ return FALSE;
+}
+
static gboolean allow_digits(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
GdkEventKey *key_event;
@@ -1288,6 +1393,9 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target,
g_signal_connect(GTK_ENTRY(ctk_manage_grid_license->txt_server_address), "key-press-event",
G_CALLBACK(disallow_whitespace),
(gpointer) ctk_manage_grid_license);
+ g_signal_connect(GTK_ENTRY(ctk_manage_grid_license->txt_server_address), "key-release-event",
+ G_CALLBACK(enable_disable_ui_controls),
+ (gpointer) ctk_manage_grid_license);
/* value */
hbox = gtk_hbox_new(FALSE, 0);
@@ -1321,12 +1429,21 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target,
g_signal_connect(GTK_ENTRY(ctk_manage_grid_license->txt_server_port), "key-press-event",
G_CALLBACK(allow_digits),
(gpointer) ctk_manage_grid_license);
-
+ g_signal_connect(GTK_ENTRY(ctk_manage_grid_license->txt_server_port), "key-release-event",
+ G_CALLBACK(enable_disable_ui_controls),
+ (gpointer) ctk_manage_grid_license);
+
/* Backup Server Address */
label = gtk_label_new("Secondary Server:");
ctk_manage_grid_license->txt_secondary_server_address = gtk_entry_new();
+
+ /* Disable Secondary server address textbox if Primary server address is empty. */
+ if (strcmp(griddConfig->str[NV_GRIDD_SERVER_ADDRESS], "") == 0) {
+ gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_address, FALSE);
+ }
gtk_entry_set_text(GTK_ENTRY(ctk_manage_grid_license->txt_secondary_server_address),
griddConfig->str[NV_GRIDD_BACKUP_SERVER_ADDRESS]);
+
hbox = gtk_hbox_new(FALSE, 0);
eventbox = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(eventbox), label);
@@ -1338,6 +1455,9 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target,
g_signal_connect(GTK_ENTRY(ctk_manage_grid_license->txt_secondary_server_address), "key-press-event",
G_CALLBACK(disallow_whitespace),
(gpointer) ctk_manage_grid_license);
+ g_signal_connect(GTK_ENTRY(ctk_manage_grid_license->txt_secondary_server_address), "key-release-event",
+ G_CALLBACK(enable_disable_ui_controls),
+ (gpointer) ctk_manage_grid_license);
/* value */
hbox = gtk_hbox_new(FALSE, 0);
@@ -1360,8 +1480,14 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target,
/* value */
ctk_manage_grid_license->txt_secondary_server_port = gtk_entry_new();
+
+ /* Disable Secondary server port textbox if Primary server address is empty. */
+ if (strcmp(griddConfig->str[NV_GRIDD_SERVER_ADDRESS], "") == 0) {
+ gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_port, FALSE);
+ }
gtk_entry_set_text(GTK_ENTRY(ctk_manage_grid_license->txt_secondary_server_port),
griddConfig->str[NV_GRIDD_BACKUP_SERVER_PORT]);
+
hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox),
ctk_manage_grid_license->txt_secondary_server_port,
@@ -1371,11 +1497,15 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target,
g_signal_connect(GTK_ENTRY(ctk_manage_grid_license->txt_secondary_server_port), "key-press-event",
G_CALLBACK(allow_digits),
(gpointer) ctk_manage_grid_license);
+ g_signal_connect(GTK_ENTRY(ctk_manage_grid_license->txt_secondary_server_port), "key-release-event",
+ G_CALLBACK(enable_disable_ui_controls),
+ (gpointer) ctk_manage_grid_license);
ctk_manage_grid_license->box_server_info = vbox2;
-
+
/* Apply button */
ctk_manage_grid_license->btn_apply = gtk_button_new_with_label
(" Apply ");
+ gtk_widget_set_sensitive(ctk_manage_grid_license->btn_apply, FALSE);
gtk_widget_set_size_request(ctk_manage_grid_license->btn_apply, 100, -1);
ctk_config_set_tooltip(ctk_config, ctk_manage_grid_license->btn_apply,
__apply_button_help);
@@ -1387,6 +1517,19 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target,
G_CALLBACK(apply_clicked),
(gpointer) ctk_manage_grid_license);
+ /* Cancel button */
+ ctk_manage_grid_license->btn_cancel = gtk_button_new_with_label
+ (" Cancel ");
+ gtk_widget_set_sensitive(ctk_manage_grid_license->btn_cancel, FALSE);
+ gtk_widget_set_size_request(ctk_manage_grid_license->btn_cancel, 100, -1);
+ ctk_config_set_tooltip(ctk_config, ctk_manage_grid_license->btn_cancel,
+ __cancel_button_help);
+ gtk_box_pack_end(GTK_BOX(hbox), ctk_manage_grid_license->btn_cancel, FALSE, FALSE, 5);
+
+ g_signal_connect(G_OBJECT(ctk_manage_grid_license->btn_cancel), "clicked",
+ G_CALLBACK(cancel_clicked),
+ (gpointer) ctk_manage_grid_license);
+
/* Set license edition toggle button active */
if (button2 && button1) {
if (strcmp(griddConfig->str[NV_GRIDD_FEATURE_TYPE], "2") == 0) {
@@ -1459,6 +1602,9 @@ GtkTextBuffer *ctk_manage_grid_license_create_help(GtkTextTagTable *table,
ctk_help_heading(b, &i, "Apply");
ctk_help_para(b, &i, "%s", __apply_button_help);
+ ctk_help_heading(b, &i, "Cancel");
+ ctk_help_para(b, &i, "%s", __cancel_button_help);
+
ctk_help_finish(b);
return b;
diff --git a/src/gtk+-2.x/ctkgridlicense.h b/src/gtk+-2.x/ctkgridlicense.h
index 057720e..54ac6d2 100644
--- a/src/gtk+-2.x/ctkgridlicense.h
+++ b/src/gtk+-2.x/ctkgridlicense.h
@@ -61,6 +61,7 @@ struct _CtkManageGridLicense
GtkWidget* txt_server_address;
GtkWidget* label_license_state;
GtkWidget* btn_apply;
+ GtkWidget* btn_cancel;
GtkWidget* box_server_info;
DbusData *dbusData;
diff --git a/src/libXNVCtrl/version.mk b/src/libXNVCtrl/version.mk
index aa3eccc..38de1ec 100644
--- a/src/libXNVCtrl/version.mk
+++ b/src/libXNVCtrl/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 384.90
+NVIDIA_VERSION = 384.98
diff --git a/src/version.h b/src/version.h
index 8b3cf8a..e415288 100644
--- a/src/version.h
+++ b/src/version.h
@@ -1 +1 @@
-#define NVIDIA_VERSION "384.90"
+#define NVIDIA_VERSION "384.98"
diff --git a/src/version.mk b/src/version.mk
index aa3eccc..38de1ec 100644
--- a/src/version.mk
+++ b/src/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 384.90
+NVIDIA_VERSION = 384.98
diff --git a/version.mk b/version.mk
index aa3eccc..38de1ec 100644
--- a/version.mk
+++ b/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 384.90
+NVIDIA_VERSION = 384.98