diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2013-05-02 08:02:33 -0700 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2013-05-02 08:02:33 -0700 |
commit | b9b1fd8f08cd7ccda0f2edea50fc87b3383af52a (patch) | |
tree | 9f0f22aba118f768ee6a721088cdfdc544bc7111 | |
parent | 8600b2a00d39fef61123f5eec972d8508740e460 (diff) |
319.17319.17
-rw-r--r-- | COPYING | 29 | ||||
-rw-r--r-- | doc/version.mk | 2 | ||||
-rw-r--r-- | samples/version.mk | 2 | ||||
-rw-r--r-- | src/common-utils/common-utils.c | 99 | ||||
-rw-r--r-- | src/common-utils/common-utils.h | 5 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkappprofile.c | 197 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkappprofile.h | 3 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkconfig.c | 82 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkconfig.h | 5 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkdisplayconfig.c | 34 | ||||
-rw-r--r-- | src/gtk+-2.x/ctkvdpau.c | 2 | ||||
-rw-r--r-- | src/version.mk | 2 | ||||
-rw-r--r-- | version.mk | 2 |
13 files changed, 349 insertions, 115 deletions
@@ -1,12 +1,12 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to +the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not @@ -56,7 +56,7 @@ patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - GNU GENERAL PUBLIC LICENSE + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains @@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN @@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Programs + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -303,10 +303,9 @@ the "copyright" line and a pointer to where the full notice is found. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. @@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names: This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General +library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. diff --git a/doc/version.mk b/doc/version.mk index 69efa2d..8e97966 100644 --- a/doc/version.mk +++ b/doc/version.mk @@ -1 +1 @@ -NVIDIA_VERSION = 319.12 +NVIDIA_VERSION = 319.17 diff --git a/samples/version.mk b/samples/version.mk index 69efa2d..8e97966 100644 --- a/samples/version.mk +++ b/samples/version.mk @@ -1 +1 @@ -NVIDIA_VERSION = 319.12 +NVIDIA_VERSION = 319.17 diff --git a/src/common-utils/common-utils.c b/src/common-utils/common-utils.c index a11d996..7b18294 100644 --- a/src/common-utils/common-utils.c +++ b/src/common-utils/common-utils.c @@ -319,6 +319,19 @@ char *tilde_expansion(const char *str) } /* tilde_expansion() */ +/* + * nv_prepend_to_string_list() - add a new string to a string list, delimited + * by the given string delimiter. The original list is freed. + */ + +char *nv_prepend_to_string_list(char *list, const char *item, const char *delim) +{ + char *new_list = nvstrcat(item, list ? delim : NULL, list, NULL); + nvfree(list); + return new_list; +} + + /****************************************************************************/ /* TextRows helper functions */ /****************************************************************************/ @@ -693,3 +706,89 @@ char *nvstrchrnul(char *s, int c) } return result; } + + +/****************************************************************************/ +/* string helper functions */ +/****************************************************************************/ + +/* + * nv_trim_space() - remove any leading and trailing whitespace from a string + * and return a pointer to the modified string. The original string may be + * modified; the returned value should *NOT* be deallocated with free(), since + * it may point somewhere other than the beginning of the original string. If + * the original string was a malloc()ed buffer, that string should be stored + * separately from the returned value of nv_strip_space, and freed. + */ + +char *nv_trim_space(char *string) { + char *ret, *end; + + for (ret = string; *ret && isspace(*ret); ret++); + for (end = ret + strlen(ret); end >= ret && isspace(*end); end--) { + *end = '\0'; + } + + return ret; +} + +/* + * trim_char() - helper function to remove a character from the initial and + * final positions of a string, and optionally report how many replacements + * were made. The returned value should not be free()d (see nv_trim_space()). + */ + +static char *trim_char(char *string, char trim, int *count) { + int len, replaced = 0; + + if (!string || trim == '\0') { + return NULL; + } + + len = strlen(string); + + if (string[0] == trim) { + string++; + replaced++; + } + + if (string[len - 1] == trim) { + string[len - 1] = '\0'; + replaced++; + } + + if (count) { + *count = replaced; + } + + return string; +} + +/* + * nv_trim_char() - remove a character from the initial and final positions of + * a string. The returned value should not be free()d (see nv_trim_space()). + */ + +char *nv_trim_char(char *string, char trim) { + return trim_char(string, trim, NULL); +} + +/* + * nv_trim_char_strict() - remove a character from the initial and final + * positions of a string. If no replacements were made, or if replacements were + * made at both positions, return the modified string. Otherwise, return NULL. + * The returned value should not be free()d (see nv_trim_space()). + */ + +char *nv_trim_char_strict(char *string, char trim) { + int count = 0; + char *trimmed; + + trimmed = trim_char(string, trim, &count); + + if (count == 0 || count == 2) { + return trimmed; + } + + return NULL; +} diff --git a/src/common-utils/common-utils.h b/src/common-utils/common-utils.h index 7e2838f..6dced25 100644 --- a/src/common-utils/common-utils.h +++ b/src/common-utils/common-utils.h @@ -70,6 +70,7 @@ char *nvasprintf(const char *fmt, ...) NV_ATTRIBUTE_PRINTF(1, 2); void nvfree(void *s); char *tilde_expansion(const char *str); +char *nv_prepend_to_string_list(char *list, const char *item, const char *delim); TextRows *nv_format_text_rows(const char *prefix, const char *str, @@ -89,6 +90,10 @@ void fmt(FILE *stream, const char *prefix, const char *fmt, ...) NV_ATTRIBUTE_PR char *fget_next_line(FILE *fp, int *eof); +char *nv_trim_space(char *string); +char *nv_trim_char(char *string, char trim); +char *nv_trim_char_strict(char *string, char trim); + /* * NV_VSNPRINTF(): macro that assigns buf using vsnprintf(). This is * correct for differing semantics of the vsnprintf() return value: diff --git a/src/gtk+-2.x/ctkappprofile.c b/src/gtk+-2.x/ctkappprofile.c index a7183ed..da4c88b 100644 --- a/src/gtk+-2.x/ctkappprofile.c +++ b/src/gtk+-2.x/ctkappprofile.c @@ -178,6 +178,7 @@ enum { typedef struct _WidgetDataItem { gchar *label; GtkWidget *widget; + guint flags; } WidgetDataItem; /* @@ -188,11 +189,14 @@ typedef struct _ToolbarItemTemplate { const gchar *icon_id; GCallback callback; gpointer user_data; + guint flags; const gchar *help_text; const gchar *extended_help_text; } ToolbarItemTemplate; +#define TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED (1 << 0) + /* * Template used to construct tree view columns and generate help text with * populate_tree_view(). @@ -395,13 +399,29 @@ static void widget_data_list_free_full(GList *list) g_list_free(list); } +static void tree_view_cursor_changed_toolbar_item_ghost(GtkTreeView *tree_view, + gpointer user_data) +{ + GtkTreePath *path; + GtkWidget *widget = (GtkWidget *)user_data; + + gtk_tree_view_get_cursor(tree_view, &path, NULL); + if (path) { + gtk_widget_set_sensitive(widget, TRUE); + } else { + gtk_widget_set_sensitive(widget, FALSE); + } + gtk_tree_path_free(path); +} + /* Simple helper function to fill a toolbar with buttons from a table */ static void populate_toolbar(GtkToolbar *toolbar, const ToolbarItemTemplate *item, size_t num_items, GList **help_data, - GList **widget_data) + GList **widget_data, + GtkTreeView *selection_tree_view) { WidgetDataItem *widget_data_item; GtkWidget *widget; @@ -439,6 +459,16 @@ static void populate_toolbar(GtkToolbar *toolbar, widget_data_item->widget = widget; *widget_data = g_list_prepend(*widget_data, widget_data_item); } + + if (item->flags & TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED) { + assert(selection_tree_view); + g_signal_connect(G_OBJECT(selection_tree_view), "cursor-changed", + G_CALLBACK(tree_view_cursor_changed_toolbar_item_ghost), + (gpointer)widget); + tree_view_cursor_changed_toolbar_item_ghost(selection_tree_view, + (gpointer)widget); + } + item++; } @@ -1834,6 +1864,7 @@ static ToolbarItemTemplate *get_edit_rule_dialog_toolbar_items(EditRuleDialog *d .icon_id = GTK_STOCK_SAVE, .callback = G_CALLBACK(edit_rule_dialog_save_changes), .user_data = dialog, + .flags = 0, }, { .text = "Cancel", @@ -1841,6 +1872,7 @@ static ToolbarItemTemplate *get_edit_rule_dialog_toolbar_items(EditRuleDialog *d .icon_id = GTK_STOCK_CANCEL, .callback = G_CALLBACK(edit_rule_dialog_cancel), .user_data = dialog, + .flags = 0, } }; @@ -2038,13 +2070,16 @@ static EditRuleDialog* edit_rule_dialog_new(CtkAppProfile *ctk_app_profile) edit_rule_dialog_toolbar_items, num_edit_rule_dialog_toolbar_items, &toolbar_help_items, - &toolbar_widget_items); + &toolbar_widget_items, + NULL); dialog->help_data = g_list_concat(dialog->help_data, toolbar_help_items); // Save off the "Update Rule" button for later use dialog->add_edit_rule_button = find_widget_in_widget_data_list(toolbar_widget_items, UPDATE_RULE_LABEL); + widget_data_list_free_full(toolbar_widget_items); + free(edit_rule_dialog_toolbar_items); gtk_container_add(GTK_CONTAINER(alignment), toolbar); @@ -2377,6 +2412,7 @@ static void get_profile_dialog_toolbar_items(EditProfileDialog *dialog, .icon_id = GTK_STOCK_ADD, .callback = G_CALLBACK(edit_profile_dialog_add_setting), .user_data = dialog, + .flags = 0, }, { .text = "Delete Setting", @@ -2386,6 +2422,7 @@ static void get_profile_dialog_toolbar_items(EditProfileDialog *dialog, .icon_id = GTK_STOCK_REMOVE, .callback = G_CALLBACK(edit_profile_dialog_delete_setting), .user_data = dialog, + .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED }, { .text = "Edit Setting", @@ -2395,6 +2432,7 @@ static void get_profile_dialog_toolbar_items(EditProfileDialog *dialog, .icon_id = GTK_STOCK_PREFERENCES, .callback = G_CALLBACK(edit_profile_dialog_edit_setting), .user_data = dialog, + .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED }, }; @@ -2405,6 +2443,7 @@ static void get_profile_dialog_toolbar_items(EditProfileDialog *dialog, .icon_id = GTK_STOCK_SAVE, .callback = G_CALLBACK(edit_profile_dialog_save_changes), .user_data = dialog, + .flags = 0, }, { .text = "Cancel", @@ -2412,6 +2451,7 @@ static void get_profile_dialog_toolbar_items(EditProfileDialog *dialog, .icon_id = GTK_STOCK_CANCEL, .callback = G_CALLBACK(edit_profile_dialog_cancel), .user_data = dialog, + .flags = 0, } }; @@ -2424,6 +2464,26 @@ static void get_profile_dialog_toolbar_items(EditProfileDialog *dialog, *num_dialog_items = ARRAY_LEN(dialog_items); } +static void edit_profile_dialog_statusbar_message(EditProfileDialog *dialog, + const char *fmt, ...) +{ + va_list ap; + gchar *str; + + va_start(ap, fmt); + str = g_strdup_vprintf(fmt, ap); + va_end(ap); + + ctk_statusbar_message(&dialog->error_statusbar, str); + + g_free(str); +} + +static void edit_profile_dialog_statusbar_clear(EditProfileDialog *dialog) +{ + ctk_statusbar_clear(&dialog->error_statusbar); +} + static void setting_key_edited(GtkCellRendererText *renderer, gchar *path_s, @@ -2434,7 +2494,6 @@ static void setting_key_edited(GtkCellRendererText *renderer, GtkTreePath *path; GtkTreeIter iter; json_t *setting; - GString *error_string; const gchar *canonical_key; if (dialog->setting_update_canceled) { @@ -2449,19 +2508,17 @@ static void setting_key_edited(GtkCellRendererText *renderer, return; } + edit_profile_dialog_statusbar_clear(dialog); + gtk_tree_model_get(GTK_TREE_MODEL(dialog->settings_store), &iter, SETTING_LIST_STORE_COL_SETTING, &setting, -1); canonical_key = get_canonical_setting_key(new_text); if (!canonical_key) { - error_string = g_string_new(""); - g_string_printf(error_string, "The key [%s] is not recognized by nvidia-settings." - "Please check for spelling errors (keys " - "are NOT case sensitive).", new_text); - gtk_statusbar_push(GTK_STATUSBAR(dialog->error_statusbar), - dialog->setting_error_context_id, - error_string->str); - g_string_free(error_string, TRUE); + edit_profile_dialog_statusbar_message(dialog, + "The key [%s] is not recognized by nvidia-settings. " + "Please check for spelling errors (keys " + "are NOT case sensitive).", new_text); } if (canonical_key) { @@ -2511,7 +2568,7 @@ static void setting_value_edited(GtkCellRendererText *renderer, json_t *setting; json_t *value; json_error_t error; - GString *error_string; + gboolean update_value = TRUE; if (dialog->setting_update_canceled) { // Don't update anything @@ -2524,6 +2581,8 @@ static void setting_value_edited(GtkCellRendererText *renderer, return; } + edit_profile_dialog_statusbar_clear(dialog); + gtk_tree_model_get(GTK_TREE_MODEL(dialog->settings_store), &iter, SETTING_LIST_STORE_COL_SETTING, &setting, -1); @@ -2531,26 +2590,23 @@ static void setting_value_edited(GtkCellRendererText *renderer, value = json_loads(new_text_in_json, JSON_DECODE_ANY, &error); if (!value) { - error_string = g_string_new(""); - g_string_printf(error_string, "The value [%s] was not understood by the JSON parser.", - new_text); - gtk_statusbar_push(GTK_STATUSBAR(dialog->error_statusbar), - dialog->setting_error_context_id, - error_string->str); - g_string_free(error_string, TRUE); - value = json_false(); + edit_profile_dialog_statusbar_message(dialog, + "The value [%s] was not understood by the JSON parser.", + new_text); + update_value = FALSE; } else if (!is_valid_setting_value(value, &invalid_type_str)) { - error_string = g_string_new(""); - g_string_printf(error_string, "A value of type \"%s\" is not allowed in the configuration.", - invalid_type_str); - gtk_statusbar_push(GTK_STATUSBAR(dialog->error_statusbar), - dialog->setting_error_context_id, - error_string->str); - g_string_free(error_string, TRUE); - value = json_false(); + edit_profile_dialog_statusbar_message(dialog, + "A value of type \"%s\" is not allowed in the configuration.", + invalid_type_str); + update_value = FALSE; + } + + if (update_value) { + json_object_set_new(setting, "value", value); + } else { + json_decref(value); } - json_object_set_new(setting, "value", value); free(new_text_in_json); gtk_tree_path_free(path); } @@ -2618,8 +2674,6 @@ static gboolean profile_settings_tree_view_key_press_event(GtkWidget *widget, edit_profile_dialog_delete_setting_common(dialog); propagate = TRUE; } - - gtk_statusbar_pop(GTK_STATUSBAR(dialog->error_statusbar), dialog->setting_error_context_id); } return propagate; @@ -2669,7 +2723,6 @@ static EditProfileDialog *edit_profile_dialog_new(CtkAppProfile *ctk_app_profile GtkWidget *tree_view; GtkWidget *scroll_win; GtkWidget *alignment; - GtkWidget *statusbar; GtkWidget *button; GList *toolbar_widget_items; @@ -2765,15 +2818,17 @@ static EditProfileDialog *edit_profile_dialog_new(CtkAppProfile *ctk_app_profile gtk_box_pack_start(GTK_BOX(main_vbox), container, FALSE, FALSE, 0); toolbar = gtk_toolbar_new(); + tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(dialog->settings_store)); + populate_toolbar(GTK_TOOLBAR(toolbar), edit_profile_settings_toolbar_items, num_edit_profile_settings_toolbar_items, &dialog->setting_toolbar_help_data, - NULL); + NULL, + GTK_TREE_VIEW(tree_view)); gtk_box_pack_start(GTK_BOX(main_vbox), toolbar, FALSE, FALSE, 0); - tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(dialog->settings_store)); populate_tree_view(GTK_TREE_VIEW(tree_view), settings_tree_view_columns, ctk_app_profile, @@ -2794,20 +2849,20 @@ static EditProfileDialog *edit_profile_dialog_new(CtkAppProfile *ctk_app_profile dialog->setting_update_canceled = FALSE; - dialog->error_statusbar = statusbar = gtk_statusbar_new(); - gtk_box_pack_start(GTK_BOX(main_vbox), statusbar, FALSE, FALSE, 0); + ctk_statusbar_init(&dialog->error_statusbar); - dialog->setting_error_context_id = - gtk_statusbar_get_context_id(GTK_STATUSBAR(statusbar), - "Profile Settings"); + gtk_box_pack_start(GTK_BOX(main_vbox), dialog->error_statusbar.widget, + FALSE, FALSE, 0); alignment = gtk_alignment_new(1.0, 0.5, 0.0, 0.0); toolbar = gtk_toolbar_new(); + populate_toolbar(GTK_TOOLBAR(toolbar), edit_profile_dialog_toolbar_items, num_edit_profile_dialog_toolbar_items, &dialog->bottom_help_data, - &toolbar_widget_items); + &toolbar_widget_items, + NULL); // Save off the "Update Profile" button for later use dialog->add_edit_profile_button = find_widget_in_widget_data_list(toolbar_widget_items, UPDATE_PROFILE_LABEL); @@ -2864,14 +2919,16 @@ static GtkWidget* create_rules_page(CtkAppProfile *ctk_app_profile) "information on adding new rules.", .icon_id = GTK_STOCK_ADD, .callback = (GCallback)add_rule_callback, - .user_data = ctk_app_profile + .user_data = ctk_app_profile, + .flags = 0, }, { .text = "Delete Rule", .help_text = "The Delete Rule button allows you to remove a highlighted rule from the list.", .icon_id = GTK_STOCK_REMOVE, .callback = (GCallback)delete_rule_callback, - .user_data = ctk_app_profile + .user_data = ctk_app_profile, + .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED }, { .text = "Increase Rule Priority", @@ -2885,7 +2942,8 @@ static GtkWidget* create_rules_page(CtkAppProfile *ctk_app_profile) "a particular priority.", .icon_id = GTK_STOCK_GO_UP, .callback = (GCallback)increase_rule_priority_callback, - .user_data = ctk_app_profile + .user_data = ctk_app_profile, + .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED }, { .text = "Decrease Rule Priority", @@ -2894,7 +2952,8 @@ static GtkWidget* create_rules_page(CtkAppProfile *ctk_app_profile) "take on the setting value of the highest-priority rule (lowest number) in the list.", .icon_id = GTK_STOCK_GO_DOWN, .callback = (GCallback)decrease_rule_priority_callback, - .user_data = ctk_app_profile + .user_data = ctk_app_profile, + .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED }, { .text = "Edit Rule", @@ -2905,7 +2964,8 @@ static GtkWidget* create_rules_page(CtkAppProfile *ctk_app_profile) // available from 2.6 onwards... .icon_id = GTK_STOCK_PREFERENCES, .callback = (GCallback)edit_rule_callback, - .user_data = ctk_app_profile + .user_data = ctk_app_profile, + .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED }, }; @@ -2957,22 +3017,24 @@ static GtkWidget* create_rules_page(CtkAppProfile *ctk_app_profile) vbox = gtk_vbox_new(FALSE, 0); - /* Create the toolbar */ + /* Create the toolbar and main tree view */ toolbar = gtk_toolbar_new(); + + model = GTK_TREE_MODEL(ctk_app_profile->apc_rule_model); + tree_view = gtk_tree_view_new_with_model(model); + populate_toolbar(GTK_TOOLBAR(toolbar), rules_toolbar_items, ARRAY_LEN(rules_toolbar_items), &ctk_app_profile->rules_help_data, - NULL); + NULL, + GTK_TREE_VIEW(tree_view)); gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); - /* Create the main tree view */ scroll_win = gtk_scrolled_window_new(NULL, NULL); - model = GTK_TREE_MODEL(ctk_app_profile->apc_rule_model); - tree_view = gtk_tree_view_new_with_model(model); populate_tree_view(GTK_TREE_VIEW(tree_view), rules_tree_view_columns, @@ -3250,14 +3312,16 @@ static GtkWidget* create_profiles_page(CtkAppProfile *ctk_app_profile) "information on adding new profiles.", .icon_id = GTK_STOCK_ADD, .callback = (GCallback)add_profile_callback, - .user_data = ctk_app_profile + .user_data = ctk_app_profile, + .flags = 0 }, { .text = "Delete Profile", .help_text = "The Delete Profile button allows you to remove a highlighted profile from the list.", .icon_id = GTK_STOCK_REMOVE, .callback = (GCallback)delete_profile_callback, - .user_data = ctk_app_profile + .user_data = ctk_app_profile, + .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED }, { .text = "Edit Profile", @@ -3268,7 +3332,8 @@ static GtkWidget* create_profiles_page(CtkAppProfile *ctk_app_profile) // available from 2.6 onwards... .icon_id = GTK_STOCK_PREFERENCES, .callback = (GCallback)edit_profile_callback, - .user_data = ctk_app_profile + .user_data = ctk_app_profile, + .flags = TOOLBAR_ITEM_GHOST_IF_NOTHING_SELECTED }, }; @@ -3303,22 +3368,23 @@ static GtkWidget* create_profiles_page(CtkAppProfile *ctk_app_profile) vbox = gtk_vbox_new(FALSE, 0); - /* Create the toolbar */ + /* Create the toolbar and main tree view */ toolbar = gtk_toolbar_new(); + + model = GTK_TREE_MODEL(ctk_app_profile->apc_profile_model); + tree_view = gtk_tree_view_new_with_model(model); + populate_toolbar(GTK_TOOLBAR(toolbar), profiles_toolbar_items, ARRAY_LEN(profiles_toolbar_items), &ctk_app_profile->profiles_help_data, - NULL); + NULL, + GTK_TREE_VIEW(tree_view)); gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); - /* Create the main tree view */ scroll_win = gtk_scrolled_window_new(NULL, NULL); - model = GTK_TREE_MODEL(ctk_app_profile->apc_profile_model); - tree_view = gtk_tree_view_new_with_model(model); - populate_tree_view(GTK_TREE_VIEW(tree_view), profiles_tree_view_columns, ctk_app_profile, @@ -3480,7 +3546,8 @@ static ToolbarItemTemplate *get_save_reload_toolbar_items(CtkAppProfile *ctk_app "should make backup copies of the original files before overwriting existing files.", .icon_id = GTK_STOCK_SAVE, .callback = (GCallback)save_changes_callback, - .user_data = ctk_app_profile + .user_data = ctk_app_profile, + .flags = 0, }, { .text = "Reload", @@ -3490,7 +3557,8 @@ static ToolbarItemTemplate *get_save_reload_toolbar_items(CtkAppProfile *ctk_app "display a dialog box to warn you before attempting to reload.", .icon_id = GTK_STOCK_REFRESH, .callback = (GCallback)reload_callback, - .user_data = ctk_app_profile + .user_data = ctk_app_profile, + .flags = 0, } }; @@ -3588,6 +3656,7 @@ static ToolbarItemTemplate *get_save_app_profile_changes_toolbar_items(SaveAppPr .icon_id = GTK_STOCK_SAVE, .callback = G_CALLBACK(save_app_profile_changes_dialog_save_changes), .user_data = dialog, + .flags = 0, }, { .text = "Cancel", @@ -3595,6 +3664,7 @@ static ToolbarItemTemplate *get_save_app_profile_changes_toolbar_items(SaveAppPr .icon_id = GTK_STOCK_CANCEL, .callback = G_CALLBACK(save_app_profile_changes_dialog_cancel), .user_data = dialog, + .flags = 0, } }; @@ -3792,8 +3862,7 @@ static SaveAppProfileChangesDialog *save_app_profile_changes_dialog_new(CtkAppPr populate_toolbar(GTK_TOOLBAR(toolbar), toolbar_items, num_toolbar_items, - NULL, - NULL); + NULL, NULL, NULL); free(toolbar_items); gtk_container_add(GTK_CONTAINER(alignment), toolbar); @@ -4139,7 +4208,7 @@ GtkWidget* ctk_app_profile_new(CtkConfig *ctk_config) save_reload_toolbar_items, num_save_reload_toolbar_items, &ctk_app_profile->save_reload_help_data, - NULL); + NULL, NULL); free(save_reload_toolbar_items); gtk_container_add(GTK_CONTAINER(alignment), toolbar); diff --git a/src/gtk+-2.x/ctkappprofile.h b/src/gtk+-2.x/ctkappprofile.h index add8118..5a34f1d 100644 --- a/src/gtk+-2.x/ctkappprofile.h +++ b/src/gtk+-2.x/ctkappprofile.h @@ -114,8 +114,7 @@ typedef struct _EditProfileDialog { // the model. gboolean setting_update_canceled; - GtkWidget *error_statusbar; - guint setting_error_context_id; + CtkStatusBar error_statusbar; // Data for constructing the help text for this dialog GList *top_help_data; diff --git a/src/gtk+-2.x/ctkconfig.c b/src/gtk+-2.x/ctkconfig.c index 7293f9a..921b60b 100644 --- a/src/gtk+-2.x/ctkconfig.c +++ b/src/gtk+-2.x/ctkconfig.c @@ -138,6 +138,23 @@ static void ctk_config_class_init(CtkConfigClass *ctk_config_class) G_TYPE_NONE, 0); } +void ctk_statusbar_init(CtkStatusBar *status_bar) +{ + + status_bar->widget = gtk_statusbar_new(); + status_bar->prev_message_id = 0; + status_bar->enabled = TRUE; + + gtk_statusbar_set_has_resize_grip + (GTK_STATUSBAR(status_bar->widget), FALSE); + + /* XXX force the status bar window to be vertically centered */ + + gtk_misc_set_alignment + (GTK_MISC(GTK_STATUSBAR(status_bar->widget)->label), + 0.0, 0.5); +} + GtkWidget* ctk_config_new(ConfigProperties *conf, CtrlHandles *pCtrlHandles) { gint i; @@ -207,21 +224,17 @@ GtkWidget* ctk_config_new(ConfigProperties *conf, CtrlHandles *pCtrlHandles) gtk_box_set_spacing(GTK_BOX(ctk_config), 10); - /* initialize the statusbar widget */ - ctk_config->status_bar.widget = gtk_statusbar_new(); - ctk_config->status_bar.prev_message_id = 0; - ctk_config->status_bar.enabled = TRUE; - - gtk_statusbar_set_has_resize_grip - (GTK_STATUSBAR(ctk_config->status_bar.widget), FALSE); + /* initialize the statusbar widget */ + ctk_statusbar_init(&ctk_config->status_bar); - /* XXX force the status bar window to be vertially centered */ + /* XXX force the status bar window to be vertically centered */ gtk_misc_set_alignment (GTK_MISC(GTK_STATUSBAR(ctk_config->status_bar.widget)->label), 0.0, 0.5); + /* initialize the tooltips widget */ ctk_config->tooltips.object = gtk_tooltips_new(); @@ -353,36 +366,61 @@ static void save_rc_clicked(GtkWidget *widget, gpointer user_data) ctk_window->attribute_list, ctk_config->conf); } +void ctk_statusbar_clear(CtkStatusBar *status_bar) +{ + if ((!status_bar->enabled) || + (!status_bar->widget)) { + return; + } + + if (status_bar->prev_message_id) { + gtk_statusbar_remove(GTK_STATUSBAR(status_bar->widget), + 1, status_bar->prev_message_id); + } +} + +void ctk_statusbar_message(CtkStatusBar *status_bar, + const gchar *str) +{ + + if ((!status_bar->enabled) || + (!status_bar->widget)) { + return; + } + + if (status_bar->prev_message_id) { + gtk_statusbar_remove(GTK_STATUSBAR(status_bar->widget), + 1, status_bar->prev_message_id); + } + + status_bar->prev_message_id = + gtk_statusbar_push + (GTK_STATUSBAR(status_bar->widget), 1, str); + +} /* ctk_config_statusbar_message() */ -void ctk_config_statusbar_message(CtkConfig *ctk_config, const char *fmt, ...) +void ctk_config_statusbar_message(CtkConfig *ctk_config, + const char *fmt, + ...) { va_list ap; gchar *str; if ((!ctk_config) || - (!ctk_config->status_bar.enabled) || - (!ctk_config->status_bar.widget) || (!(ctk_config->conf->booleans & CONFIG_PROPERTIES_DISPLAY_STATUS_BAR))) { return; } - if (ctk_config->status_bar.prev_message_id) { - gtk_statusbar_remove(GTK_STATUSBAR(ctk_config->status_bar.widget), - 1, ctk_config->status_bar.prev_message_id); - } - va_start(ap, fmt); str = g_strdup_vprintf(fmt, ap); va_end(ap); - - ctk_config->status_bar.prev_message_id = - gtk_statusbar_push - (GTK_STATUSBAR(ctk_config->status_bar.widget), 1, str); + + ctk_statusbar_message(&ctk_config->status_bar, + str); g_free(str); - -} /* ctk_config_statusbar_message() */ +} diff --git a/src/gtk+-2.x/ctkconfig.h b/src/gtk+-2.x/ctkconfig.h index b3bf286..ab6a352 100644 --- a/src/gtk+-2.x/ctkconfig.h +++ b/src/gtk+-2.x/ctkconfig.h @@ -115,6 +115,11 @@ void ctk_config_set_tooltip_and_add_help_data(CtkConfig *config, const gchar *help_text, const gchar *extended_help_text); +// Helper functions for other components which use CtkStatusBar +void ctk_statusbar_init(CtkStatusBar *status_bar); +void ctk_statusbar_message(CtkStatusBar *status_bar, const gchar *str); +void ctk_statusbar_clear(CtkStatusBar *status_bar); + G_END_DECLS #endif /* __CTK_CONFIG_H__ */ diff --git a/src/gtk+-2.x/ctkdisplayconfig.c b/src/gtk+-2.x/ctkdisplayconfig.c index b9797f5..bd81ab8 100644 --- a/src/gtk+-2.x/ctkdisplayconfig.c +++ b/src/gtk+-2.x/ctkdisplayconfig.c @@ -191,7 +191,9 @@ static const char * __dpy_configuration_mnu_help = static const char * __dpy_resolution_mnu_help = "The Resolution drop-down allows you to select a desired resolution " -"for the currently selected display device."; +"for the currently selected display device. The 'scaled' qualifier indicates " +"an aspect-scaled common resolution simulated through a MetaMode ViewPort " +"configuration."; static const char * __dpy_refresh_mnu_help = "The Refresh drop-down allows you to select a desired refresh rate " @@ -5519,17 +5521,35 @@ static void do_configure_display_for_xscreen(CtkDisplayConfig *ctk_object, } - /* Translate mode positional relationships to screen relationships */ + /* Set the position of all the new screens to the position of the displays + * for the current mode. + */ for (display = gpu->displays; display; display = display->next_on_gpu) { + nvModePtr cur_mode; if (!display->screen) continue; + cur_mode = display->cur_mode; + if (!cur_mode) { + continue; + } + + /* Translate the positional relationship of the current mode from + * the display to its screen. + */ + if (cur_mode->relative_to && + (cur_mode->relative_to->gpu == cur_mode->display->gpu)) { + display->screen->position_type = cur_mode->position_type; + display->screen->relative_to = cur_mode->relative_to->screen; + } + + /* Position the modes of the display to be where the current mode is, + * and to use absolute positioning since it should now be the only + * display in the X screen. + */ for (mode = display->modes; mode; mode = mode->next) { - if (mode->relative_to && - (mode->relative_to->gpu == mode->display->gpu)) { - display->screen->position_type = mode->position_type; - display->screen->relative_to = mode->relative_to->screen; - } + mode->pan.x = cur_mode->pan.x; + mode->pan.y = cur_mode->pan.y; mode->position_type = CONF_ADJ_ABSOLUTE; mode->relative_to = NULL; } diff --git a/src/gtk+-2.x/ctkvdpau.c b/src/gtk+-2.x/ctkvdpau.c index 8a834e8..ac4c388 100644 --- a/src/gtk+-2.x/ctkvdpau.c +++ b/src/gtk+-2.x/ctkvdpau.c @@ -1429,7 +1429,7 @@ GtkWidget* ctk_vdpau_new(NvCtrlAttributeHandle *handle, gtk_box_pack_start(GTK_BOX(ctk_vdpau), banner, FALSE, FALSE, 0); /* open VDPAU library */ - vdpau_handle = dlopen("libvdpau.so", RTLD_NOW); + vdpau_handle = dlopen("libvdpau.so.1", RTLD_NOW); if (!vdpau_handle) { goto fail; } diff --git a/src/version.mk b/src/version.mk index 69efa2d..8e97966 100644 --- a/src/version.mk +++ b/src/version.mk @@ -1 +1 @@ -NVIDIA_VERSION = 319.12 +NVIDIA_VERSION = 319.17 @@ -1 +1 @@ -NVIDIA_VERSION = 319.12 +NVIDIA_VERSION = 319.17 |