summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2014-12-04 14:34:17 -0800
committerAaron Plattner <aplattner@nvidia.com>2014-12-04 14:34:17 -0800
commit469380366c68ebd8ca3732ef9c3fafc599d836fe (patch)
treeff56e0ed0930d7b9b0899f487842c8b7545229b5
parent6101dbee74c1a2997e8ca0f24ea59dd38ab79b46 (diff)
343.36343.36343
-rw-r--r--doc/version.mk2
-rw-r--r--samples/version.mk2
-rw-r--r--src/gtk+-2.x/ctkappprofile.c24
-rw-r--r--src/gtk+-2.x/ctkconfig.c15
-rw-r--r--src/gtk+-2.x/ctkdisplayconfig-utils.c13
-rw-r--r--src/gtk+-2.x/ctkedid.c24
-rw-r--r--src/gtk+-2.x/ctkutils.c75
-rw-r--r--src/gtk+-2.x/ctkutils.h5
-rw-r--r--src/libXNVCtrl/version.mk2
-rw-r--r--src/version.mk2
-rw-r--r--version.mk2
11 files changed, 115 insertions, 51 deletions
diff --git a/doc/version.mk b/doc/version.mk
index 66ba96f..a8ef5e7 100644
--- a/doc/version.mk
+++ b/doc/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 343.22
+NVIDIA_VERSION = 343.36
diff --git a/samples/version.mk b/samples/version.mk
index 66ba96f..a8ef5e7 100644
--- a/samples/version.mk
+++ b/samples/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 343.22
+NVIDIA_VERSION = 343.36
diff --git a/src/gtk+-2.x/ctkappprofile.c b/src/gtk+-2.x/ctkappprofile.c
index 70a2ecf..e552b75 100644
--- a/src/gtk+-2.x/ctkappprofile.c
+++ b/src/gtk+-2.x/ctkappprofile.c
@@ -1345,14 +1345,14 @@ static gboolean rule_browse_button_clicked(GtkWidget *widget, gpointer user_data
gtk_window_set_transient_for(GTK_WINDOW(dialog->file_sel),
GTK_WINDOW(dialog->top_window));
- gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog->file_sel), filename);
+ ctk_file_chooser_set_filename(dialog->file_sel, filename);
result = gtk_dialog_run(GTK_DIALOG(dialog->file_sel));
switch (result) {
case GTK_RESPONSE_ACCEPT:
case GTK_RESPONSE_OK:
- filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog->file_sel));
+ filename = ctk_file_chooser_get_filename(dialog->file_sel);
gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(dialog->source_file_combo))),
filename);
default:
@@ -1372,14 +1372,14 @@ static gboolean profile_browse_button_clicked(GtkWidget *widget, gpointer user_d
gtk_window_set_transient_for(GTK_WINDOW(dialog->file_sel),
GTK_WINDOW(dialog->top_window));
- gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog->file_sel), filename);
+ ctk_file_chooser_set_filename(dialog->file_sel, filename);
result = gtk_dialog_run(GTK_DIALOG(dialog->file_sel));
switch (result) {
case GTK_RESPONSE_ACCEPT:
case GTK_RESPONSE_OK:
- filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog->file_sel));
+ filename = ctk_file_chooser_get_filename(dialog->file_sel);
gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(dialog->source_file_combo))),
filename);
default:
@@ -2033,11 +2033,9 @@ static EditRuleDialog* edit_rule_dialog_new(CtkAppProfile *ctk_app_profile)
dialog->matches = g_string_new("");
dialog->profile_name = g_string_new("");
dialog->profile_settings_store = gtk_list_store_new(SETTING_LIST_STORE_NUM_COLS, G_TYPE_POINTER);
- dialog->file_sel = gtk_file_chooser_dialog_new("Please select a source file for the rule",
- GTK_WINDOW(NULL), GTK_FILE_CHOOSER_ACTION_SAVE,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
- NULL);
+ dialog->file_sel =
+ ctk_file_chooser_dialog_new("Please select a source file for the rule",
+ NULL, GTK_FILE_CHOOSER_ACTION_SAVE);
gtk_widget_set_size_request(dialog->top_window, 500, 480);
@@ -3000,11 +2998,9 @@ static EditProfileDialog *edit_profile_dialog_new(CtkAppProfile *ctk_app_profile
dialog->settings = json_array();
dialog->settings_store = gtk_list_store_new(SETTING_LIST_STORE_NUM_COLS, G_TYPE_POINTER);
- dialog->file_sel = gtk_file_chooser_dialog_new("Please select a source file for the profile",
- GTK_WINDOW(NULL), GTK_FILE_CHOOSER_ACTION_SAVE,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
- NULL);
+ dialog->file_sel =
+ ctk_file_chooser_dialog_new("Please select a source file for the profile",
+ NULL, GTK_FILE_CHOOSER_ACTION_SAVE);
main_vbox = gtk_vbox_new(FALSE, 0);
gtk_box_set_spacing(GTK_BOX(main_vbox), 8);
diff --git a/src/gtk+-2.x/ctkconfig.c b/src/gtk+-2.x/ctkconfig.c
index 5e78021..090182f 100644
--- a/src/gtk+-2.x/ctkconfig.c
+++ b/src/gtk+-2.x/ctkconfig.c
@@ -315,19 +315,16 @@ GtkWidget* ctk_config_new(ConfigProperties *conf, CtrlHandles *pCtrlHandles)
/* Create the file selector for rc file */
ctk_config->rc_file_selector =
- gtk_file_chooser_dialog_new("Please select a file to save to",
+ ctk_file_chooser_dialog_new("Please select a file to save to",
GTK_WINDOW(ctk_get_parent_window(GTK_WIDGET(ctk_config))),
- GTK_FILE_CHOOSER_ACTION_OPEN,
- "Cancel", GTK_RESPONSE_CANCEL,
- "Open", GTK_RESPONSE_ACCEPT,
- NULL);
+ GTK_FILE_CHOOSER_ACTION_SAVE);
g_signal_connect(G_OBJECT(ctk_config->button_save_rc), "clicked",
G_CALLBACK(save_rc_clicked),
(gpointer) ctk_config);
- gtk_file_chooser_set_filename
- (GTK_FILE_CHOOSER(ctk_config->rc_file_selector), DEFAULT_RC_FILE);
+ ctk_file_chooser_set_filename(ctk_config->rc_file_selector,
+ DEFAULT_RC_FILE);
ctk_config_set_tooltip(ctk_config, ctk_config->button_save_rc,
__save_current_config_help);
@@ -356,8 +353,8 @@ static void save_rc_clicked(GtkWidget *widget, gpointer user_data)
switch (result) {
case GTK_RESPONSE_ACCEPT:
case GTK_RESPONSE_OK:
- rc_filename = gtk_file_chooser_get_filename
- (GTK_FILE_CHOOSER(ctk_config->rc_file_selector));
+ rc_filename = ctk_file_chooser_get_filename
+ (ctk_config->rc_file_selector);
break;
default:
return;
diff --git a/src/gtk+-2.x/ctkdisplayconfig-utils.c b/src/gtk+-2.x/ctkdisplayconfig-utils.c
index 48ab4ae..51683d9 100644
--- a/src/gtk+-2.x/ctkdisplayconfig-utils.c
+++ b/src/gtk+-2.x/ctkdisplayconfig-utils.c
@@ -4369,8 +4369,7 @@ static void xconfig_file_clicked(GtkWidget *widget, gpointer user_data)
(GTK_WINDOW(dlg->dlg_xconfig_file),
GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(dlg->parent))));
- gtk_file_chooser_set_filename
- (GTK_FILE_CHOOSER(dlg->dlg_xconfig_file), filename);
+ ctk_file_chooser_set_filename(dlg->dlg_xconfig_file, filename);
result = gtk_dialog_run(GTK_DIALOG(dlg->dlg_xconfig_file));
gtk_widget_hide(dlg->dlg_xconfig_file);
@@ -4378,8 +4377,7 @@ static void xconfig_file_clicked(GtkWidget *widget, gpointer user_data)
switch (result) {
case GTK_RESPONSE_ACCEPT:
case GTK_RESPONSE_OK:
- filename = gtk_file_chooser_get_filename
- (GTK_FILE_CHOOSER(dlg->dlg_xconfig_file));
+ filename = ctk_file_chooser_get_filename(dlg->dlg_xconfig_file);
gtk_entry_set_text(GTK_ENTRY(dlg->txt_xconfig_file), filename);
@@ -4575,11 +4573,8 @@ SaveXConfDlg *create_save_xconfig_dialog(GtkWidget *parent,
G_CALLBACK(xconfig_file_clicked),
(gpointer) dlg);
dlg->dlg_xconfig_file =
- gtk_file_chooser_dialog_new("Please select the X configuration file",
- NULL, GTK_FILE_CHOOSER_ACTION_OPEN,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
- NULL);
+ ctk_file_chooser_dialog_new("Please select the X configuration file",
+ NULL, GTK_FILE_CHOOSER_ACTION_OPEN);
/* Create the merge checkbox */
dlg->btn_xconfig_merge =
diff --git a/src/gtk+-2.x/ctkedid.c b/src/gtk+-2.x/ctkedid.c
index edf9049..65203a8 100644
--- a/src/gtk+-2.x/ctkedid.c
+++ b/src/gtk+-2.x/ctkedid.c
@@ -27,6 +27,7 @@
#include "ctkscale.h"
#include "ctkconfig.h"
#include "ctkhelp.h"
+#include "ctkutils.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -120,14 +121,11 @@ GtkWidget* ctk_edid_new(NvCtrlAttributeHandle *handle,
ctk_edid->filename = DEFAULT_EDID_FILENAME_BINARY;
ctk_edid->file_format = FILE_FORMAT_BINARY;
ctk_edid->file_selector =
- gtk_file_chooser_dialog_new("Please select file where "
+ ctk_file_chooser_dialog_new("Please select file where "
"EDID data will be saved.",
- NULL, GTK_FILE_CHOOSER_ACTION_SAVE,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
- NULL);
- gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(ctk_edid->file_selector),
- ctk_edid->filename);
+ NULL, GTK_FILE_CHOOSER_ACTION_SAVE);
+ ctk_file_chooser_set_filename(ctk_edid->file_selector,
+ ctk_edid->filename);
/* create the frame and vbox */
@@ -191,8 +189,7 @@ GtkWidget* ctk_edid_new(NvCtrlAttributeHandle *handle,
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON(ctk_edid->file_format_binary_radio_button), TRUE);
gtk_widget_show_all(frame);
- gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(ctk_edid->file_selector),
- frame);
+ ctk_file_chooser_set_extra_widget(ctk_edid->file_selector, frame);
gtk_widget_show_all(GTK_WIDGET(object));
@@ -210,7 +207,7 @@ static void normalize_filename(CtkEdid *ctk_edid)
int len = 0, n;
ctk_edid->filename =
- gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(ctk_edid->file_selector));
+ ctk_file_chooser_get_filename(ctk_edid->file_selector);
if (!ctk_edid->filename) {
goto done;
@@ -278,8 +275,7 @@ static void normalize_filename(CtkEdid *ctk_edid)
}
/* modify the file name as per the format selected */
- gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(ctk_edid->file_selector),
- slash);
+ ctk_file_chooser_set_filename(ctk_edid->file_selector, slash);
done:
free(filename);
free(buffer);
@@ -313,7 +309,7 @@ static void button_clicked(GtkButton *button, gpointer user_data)
/* Ask user for filename */
- gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(ctk_edid->file_selector),
+ ctk_file_chooser_set_filename(ctk_edid->file_selector,
ctk_edid->filename);
result = gtk_dialog_run(GTK_DIALOG(ctk_edid->file_selector));
@@ -325,7 +321,7 @@ static void button_clicked(GtkButton *button, gpointer user_data)
normalize_filename(ctk_edid);
ctk_edid->filename =
- gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(ctk_edid->file_selector));
+ ctk_file_chooser_get_filename(ctk_edid->file_selector);
write_edid_to_file(ctk_edid->ctk_config, ctk_edid->filename,
ctk_edid->file_format, data, len);
diff --git a/src/gtk+-2.x/ctkutils.c b/src/gtk+-2.x/ctkutils.c
index db88640..25f665b 100644
--- a/src/gtk+-2.x/ctkutils.c
+++ b/src/gtk+-2.x/ctkutils.c
@@ -266,6 +266,81 @@ void ctk_combo_box_text_append_text(GtkWidget *widget, const gchar *text)
#endif
}
+GtkWidget *ctk_file_chooser_dialog_new(const gchar *title,
+ GtkWindow *parent,
+ GtkFileChooserAction action)
+{
+#ifdef CTK_GTK3
+ /* Added in 2.4 */
+ gboolean open = (action == GTK_FILE_CHOOSER_ACTION_OPEN);
+
+ return gtk_file_chooser_dialog_new(title, parent, action,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL,
+ open ? GTK_STOCK_OPEN : GTK_STOCK_SAVE,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
+#else
+ /*
+ * There is an issue on some platforms that causes the UI to hang when
+ * creating a GtkFileChooserDialog from a shared library. For now, we will
+ * continue to use the GtkFileSelection.
+ *
+ * Deprecated in 2.4 and removed in 3.0
+ */
+ return gtk_file_selection_new("FileSelector");
+#endif
+}
+
+void ctk_file_chooser_set_filename(GtkWidget *widget, const gchar *filename)
+{
+#ifdef CTK_GTK3
+ GtkFileChooserAction action =
+ gtk_file_chooser_get_action(GTK_FILE_CHOOSER(widget));
+ char *full_filename = tilde_expansion(filename);
+ char *basename = g_path_get_basename(full_filename);
+ char *dirname = NULL;
+
+ if (action == GTK_FILE_CHOOSER_ACTION_SAVE &&
+ (!g_file_test(full_filename, G_FILE_TEST_EXISTS) ||
+ basename[0] == '.')) {
+
+ char *dirname = g_path_get_dirname(full_filename);
+
+ gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(widget), dirname);
+ gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(widget), basename);
+
+ } else {
+ gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(widget), full_filename);
+ }
+
+ free(dirname);
+ free(basename);
+ free(full_filename);
+#else
+ gtk_file_selection_set_filename(GTK_FILE_SELECTION(widget), filename);
+#endif
+}
+
+const gchar *ctk_file_chooser_get_filename(GtkWidget *widget)
+{
+#ifdef CTK_GTK3
+ return gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
+#else
+ return gtk_file_selection_get_filename(GTK_FILE_SELECTION(widget));
+#endif
+}
+
+void ctk_file_chooser_set_extra_widget(GtkWidget *widget, GtkWidget *extra)
+{
+#ifdef CTK_GTK3
+ gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(widget), extra);
+#else
+ gtk_box_pack_start(GTK_BOX(GTK_FILE_SELECTION(widget)->main_vbox),
+ extra, FALSE, FALSE, 15);
+#endif
+}
+
/* end of GTK2/3 util functions */
diff --git a/src/gtk+-2.x/ctkutils.h b/src/gtk+-2.x/ctkutils.h
index d5ae1a9..d1cfe48 100644
--- a/src/gtk+-2.x/ctkutils.h
+++ b/src/gtk+-2.x/ctkutils.h
@@ -57,6 +57,11 @@ void ctk_adjustment_set_lower(GtkAdjustment *a, gdouble x);
GtkWidget *ctk_scrolled_window_get_vscrollbar(GtkScrolledWindow *sw);
GtkWidget *ctk_statusbar_get_message_area(GtkStatusbar *statusbar);
+GtkWidget *ctk_file_chooser_dialog_new(const gchar *title, GtkWindow *parent,
+ GtkFileChooserAction action);
+void ctk_file_chooser_set_filename(GtkWidget *widget, const gchar *filename);
+const gchar *ctk_file_chooser_get_filename(GtkWidget *widget);
+void ctk_file_chooser_set_extra_widget(GtkWidget *widget, GtkWidget *extra);
GtkWidget *ctk_combo_box_text_new(void);
GtkWidget *ctk_combo_box_text_new_with_entry(void);
diff --git a/src/libXNVCtrl/version.mk b/src/libXNVCtrl/version.mk
index 66ba96f..a8ef5e7 100644
--- a/src/libXNVCtrl/version.mk
+++ b/src/libXNVCtrl/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 343.22
+NVIDIA_VERSION = 343.36
diff --git a/src/version.mk b/src/version.mk
index 66ba96f..a8ef5e7 100644
--- a/src/version.mk
+++ b/src/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 343.22
+NVIDIA_VERSION = 343.36
diff --git a/version.mk b/version.mk
index 66ba96f..a8ef5e7 100644
--- a/version.mk
+++ b/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 343.22
+NVIDIA_VERSION = 343.36