|
|
|
@ -452,71 +452,39 @@ void on_app_chooser_open(GtkWidget *self, main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void yon_adapter_window_setup(main_window *widgets){
|
|
|
|
void yon_adapter_update(struct adapter_struct *adapter){
|
|
|
|
int size=0;
|
|
|
|
if (!adapter->vendor){
|
|
|
|
gtk_overlay_add_overlay(GTK_OVERLAY(widgets->InformationOverlay),widgets->InformationCompanyLogoImage);
|
|
|
|
gtk_widget_hide(adapter->widgets->InformationOverlay2);
|
|
|
|
config_str rtn = yon_config_load(get_adapter_info_json,&size);
|
|
|
|
return;
|
|
|
|
struct json_object *jsobject = json_tokener_parse(yon_char_parsed_to_string(rtn,size,""));{
|
|
|
|
}
|
|
|
|
struct json_object *item_obj = json_object_array_get_idx(jsobject, 0);
|
|
|
|
gtk_label_set_markup(GTK_LABEL(adapter->widgets->InformationLabel),adapter->adapter_text);
|
|
|
|
struct json_object *unit_obj;
|
|
|
|
if (strstr(adapter->vendor,"Intel")){
|
|
|
|
const char *desc="";
|
|
|
|
gtk_image_set_from_icon_name(GTK_IMAGE(adapter->widgets->InformationCompanyLogoImage),"com.ublinux.ubl-settings-video.intel-logo",GTK_ICON_SIZE_BUTTON);
|
|
|
|
if (json_object_object_get_ex(item_obj, "description", &unit_obj)) {
|
|
|
|
gtk_image_set_pixel_size(GTK_IMAGE(adapter->widgets->InformationCompanyLogoImage),64);
|
|
|
|
desc = json_object_get_string(unit_obj);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *product ="";
|
|
|
|
|
|
|
|
if (json_object_object_get_ex(item_obj, "product", &unit_obj)) {
|
|
|
|
|
|
|
|
product = json_object_get_string(unit_obj);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *vendor="";
|
|
|
|
|
|
|
|
if (json_object_object_get_ex(item_obj, "vendor", &unit_obj)) {
|
|
|
|
|
|
|
|
vendor = json_object_get_string(unit_obj);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *driver_use="";
|
|
|
|
|
|
|
|
if (json_object_object_get_ex(item_obj, "configuration", &unit_obj)) {
|
|
|
|
|
|
|
|
if (json_object_object_get_ex(unit_obj, "driver", &unit_obj))
|
|
|
|
|
|
|
|
driver_use = json_object_get_string(unit_obj);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *driver_all="";
|
|
|
|
|
|
|
|
int loaded_size;
|
|
|
|
|
|
|
|
config_str loaded = yon_config_load(get_drivers_for_card_command,&loaded_size);
|
|
|
|
|
|
|
|
for (int i=0;i<loaded_size;i++){
|
|
|
|
|
|
|
|
free(yon_char_divide_search(loaded[i],"=",-1));
|
|
|
|
|
|
|
|
yon_char_remove_last_symbol(loaded[i],'\n');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int pos = yon_char_parsed_check_exist(loaded,loaded_size,(char*)driver_use);
|
|
|
|
|
|
|
|
if (pos!=-1){
|
|
|
|
|
|
|
|
driver_all=yon_char_new(loaded[pos]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_char_parsed_free(loaded,loaded_size);
|
|
|
|
|
|
|
|
char *final_text = yon_char_unite("<span size=\"12pt\"><span weight='bold' color='#1a5fb4'>",DESCRIPTION_LABEL,":</span> ",_(desc),
|
|
|
|
|
|
|
|
"\n<span weight='bold' color='#1a5fb4'>",VENDOR_LABEL,":</span> ",vendor,
|
|
|
|
|
|
|
|
"\n<span weight='bold' color='#1a5fb4'>",MODEL_LABEL,":</span> ",product,
|
|
|
|
|
|
|
|
"\n<span weight='bold' color='#1a5fb4'>",USED_KERNEL_DRIVER_LABEL,":</span> ",driver_use,
|
|
|
|
|
|
|
|
"\n<span weight='bold' color='#1a5fb4'>",AVALIABLE_KERNEL_DRIVERS_LABEL,":</span> ",driver_all,"</span>",NULL);
|
|
|
|
|
|
|
|
gtk_label_set_markup(GTK_LABEL(widgets->InformationLabel),final_text);
|
|
|
|
|
|
|
|
if (strstr(vendor,"Intel")){
|
|
|
|
|
|
|
|
GtkIconTheme *icthm=gtk_icon_theme_get_default();
|
|
|
|
|
|
|
|
gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->InformationCompanyLogoImage),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, "com.ublinux.ubl-settings-video.intel-logo",64,1,GTK_ICON_LOOKUP_FORCE_SVG),NULL));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (strstr(vendor,"NVIDIA")){
|
|
|
|
else if (strstr(adapter->vendor,"NVIDIA")){
|
|
|
|
GtkIconTheme *icthm=gtk_icon_theme_get_default();
|
|
|
|
gtk_image_set_from_icon_name(GTK_IMAGE(adapter->widgets->InformationCompanyLogoImage),"com.ublinux.ubl-settings-video.nvidia-logo",GTK_ICON_SIZE_BUTTON);
|
|
|
|
gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->InformationCompanyLogoImage),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, "com.ublinux.ubl-settings-video.nvidia-logo",64,1,GTK_ICON_LOOKUP_FORCE_SVG),NULL));
|
|
|
|
gtk_image_set_pixel_size(GTK_IMAGE(adapter->widgets->InformationCompanyLogoImage),64);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (strstr(vendor,"AMD")||strstr(vendor,"Advanced Micro Devices")){
|
|
|
|
else if (strstr(adapter->vendor,"AMD")||strstr(adapter->vendor,"Advanced Micro Devices")){
|
|
|
|
GtkIconTheme *icthm=gtk_icon_theme_get_default();
|
|
|
|
gtk_image_set_from_icon_name(GTK_IMAGE(adapter->widgets->InformationCompanyLogoImage),"com.ublinux.ubl-settings-video.amd-logo",GTK_ICON_SIZE_BUTTON);
|
|
|
|
gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->InformationCompanyLogoImage),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, "com.ublinux.ubl-settings-video.amd-logo",64,1,GTK_ICON_LOOKUP_FORCE_SVG),NULL));
|
|
|
|
gtk_image_set_pixel_size(GTK_IMAGE(adapter->widgets->InformationCompanyLogoImage),64);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (strstr(vendor,"VMware")){
|
|
|
|
else if (strstr(adapter->vendor,"VMware")){
|
|
|
|
GtkIconTheme *icthm=gtk_icon_theme_get_default();
|
|
|
|
gtk_image_set_from_icon_name(GTK_IMAGE(adapter->widgets->InformationCompanyLogoImage),"com.ublinux.ubl-settings-video.vmware-logo",GTK_ICON_SIZE_BUTTON);
|
|
|
|
gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->InformationCompanyLogoImage),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, "com.ublinux.ubl-settings-video.vmware-logo",64,1,GTK_ICON_LOOKUP_FORCE_SVG),NULL));
|
|
|
|
gtk_image_set_pixel_size(GTK_IMAGE(adapter->widgets->InformationCompanyLogoImage),64);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
gtk_widget_destroy(widgets->InformationCompanyLogoImage);
|
|
|
|
gtk_widget_destroy(adapter->widgets->InformationCompanyLogoImage);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gtk_overlay_add_overlay(GTK_OVERLAY(widgets->InformationOverlay2),widgets->InformationCompanyLogoImage2);
|
|
|
|
|
|
|
|
struct json_object *item_obj = json_object_array_get_idx(jsobject, 1);
|
|
|
|
void *yon_load_adapter(main_window *widgets){
|
|
|
|
if (item_obj){
|
|
|
|
int size=0;
|
|
|
|
|
|
|
|
config_str rtn = yon_config_load(get_adapter_info_json,&size);
|
|
|
|
|
|
|
|
struct json_object *jsobject = json_tokener_parse(yon_char_parsed_to_string(rtn,size,""));
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
struct json_object *item_obj = json_object_array_get_idx(jsobject, 0);
|
|
|
|
struct json_object *unit_obj;
|
|
|
|
struct json_object *unit_obj;
|
|
|
|
const char *desc="";
|
|
|
|
const char *desc="";
|
|
|
|
if (json_object_object_get_ex(item_obj, "description", &unit_obj)) {
|
|
|
|
if (json_object_object_get_ex(item_obj, "description", &unit_obj)) {
|
|
|
|
@ -543,8 +511,8 @@ void yon_adapter_window_setup(main_window *widgets){
|
|
|
|
yon_char_remove_last_symbol(loaded[i],'\n');
|
|
|
|
yon_char_remove_last_symbol(loaded[i],'\n');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int pos = yon_char_parsed_check_exist(loaded,loaded_size,(char*)driver_use);
|
|
|
|
int pos = yon_char_parsed_check_exist(loaded,loaded_size,(char*)driver_use);
|
|
|
|
if (pos>-1){
|
|
|
|
if (pos!=-1){
|
|
|
|
driver_all=yon_char_new(loaded[pos+1]);
|
|
|
|
driver_all=yon_char_new(loaded[pos]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yon_char_parsed_free(loaded,loaded_size);
|
|
|
|
yon_char_parsed_free(loaded,loaded_size);
|
|
|
|
char *final_text = yon_char_unite("<span size=\"12pt\"><span weight='bold' color='#1a5fb4'>",DESCRIPTION_LABEL,":</span> ",_(desc),
|
|
|
|
char *final_text = yon_char_unite("<span size=\"12pt\"><span weight='bold' color='#1a5fb4'>",DESCRIPTION_LABEL,":</span> ",_(desc),
|
|
|
|
@ -552,29 +520,73 @@ void yon_adapter_window_setup(main_window *widgets){
|
|
|
|
"\n<span weight='bold' color='#1a5fb4'>",MODEL_LABEL,":</span> ",product,
|
|
|
|
"\n<span weight='bold' color='#1a5fb4'>",MODEL_LABEL,":</span> ",product,
|
|
|
|
"\n<span weight='bold' color='#1a5fb4'>",USED_KERNEL_DRIVER_LABEL,":</span> ",driver_use,
|
|
|
|
"\n<span weight='bold' color='#1a5fb4'>",USED_KERNEL_DRIVER_LABEL,":</span> ",driver_use,
|
|
|
|
"\n<span weight='bold' color='#1a5fb4'>",AVALIABLE_KERNEL_DRIVERS_LABEL,":</span> ",driver_all,"</span>",NULL);
|
|
|
|
"\n<span weight='bold' color='#1a5fb4'>",AVALIABLE_KERNEL_DRIVERS_LABEL,":</span> ",driver_all,"</span>",NULL);
|
|
|
|
gtk_label_set_markup(GTK_LABEL(widgets->InformationLabel2),final_text);
|
|
|
|
struct adapter_struct *adapter_info = malloc(sizeof(struct adapter_struct));
|
|
|
|
if (strstr(vendor,"Intel")){
|
|
|
|
memset(adapter_info,0,sizeof(struct adapter_struct));
|
|
|
|
GtkIconTheme *icthm=gtk_icon_theme_get_default();
|
|
|
|
adapter_info->widgets = widgets;
|
|
|
|
gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->InformationCompanyLogoImage2),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, "com.ublinux.ubl-settings-video.intel-logo",64,1,GTK_ICON_LOOKUP_FORCE_SVG),NULL));
|
|
|
|
adapter_info->vendor=yon_char_new(vendor);
|
|
|
|
}
|
|
|
|
adapter_info->adapter_text = yon_char_new(final_text);
|
|
|
|
else if (strstr(vendor,"NVIDIA")){
|
|
|
|
g_idle_add_once((GSourceOnceFunc)yon_adapter_update,adapter_info);
|
|
|
|
GtkIconTheme *icthm=gtk_icon_theme_get_default();
|
|
|
|
}
|
|
|
|
gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->InformationCompanyLogoImage2),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, "com.ublinux.ubl-settings-video.nvidia-logo",64,1,GTK_ICON_LOOKUP_FORCE_SVG),NULL));
|
|
|
|
{
|
|
|
|
}
|
|
|
|
struct json_object *item_obj = json_object_array_get_idx(jsobject, 1);
|
|
|
|
else if (strstr(vendor,"AMD")&&strstr(vendor,"Advanced Micro Devices")){
|
|
|
|
if (item_obj){
|
|
|
|
GtkIconTheme *icthm=gtk_icon_theme_get_default();
|
|
|
|
struct json_object *unit_obj;
|
|
|
|
gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->InformationCompanyLogoImage2),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, "com.ublinux.ubl-settings-video.amd-logo",64,1,GTK_ICON_LOOKUP_FORCE_SVG),NULL));
|
|
|
|
const char *desc="";
|
|
|
|
}
|
|
|
|
if (json_object_object_get_ex(item_obj, "description", &unit_obj)) {
|
|
|
|
else if (strstr(vendor,"VMware")){
|
|
|
|
desc = json_object_get_string(unit_obj);
|
|
|
|
GtkIconTheme *icthm=gtk_icon_theme_get_default();
|
|
|
|
}
|
|
|
|
gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->InformationCompanyLogoImage2),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, "com.ublinux.ubl-settings-video.vmware-logo",64,1,GTK_ICON_LOOKUP_FORCE_SVG),NULL));
|
|
|
|
const char *product ="";
|
|
|
|
}
|
|
|
|
if (json_object_object_get_ex(item_obj, "product", &unit_obj)) {
|
|
|
|
else {
|
|
|
|
product = json_object_get_string(unit_obj);
|
|
|
|
gtk_widget_destroy(widgets->InformationCompanyLogoImage2);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *vendor="";
|
|
|
|
|
|
|
|
if (json_object_object_get_ex(item_obj, "vendor", &unit_obj)) {
|
|
|
|
|
|
|
|
vendor = json_object_get_string(unit_obj);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *driver_use="";
|
|
|
|
|
|
|
|
if (json_object_object_get_ex(item_obj, "configuration", &unit_obj)) {
|
|
|
|
|
|
|
|
if (json_object_object_get_ex(unit_obj, "driver", &unit_obj))
|
|
|
|
|
|
|
|
driver_use = json_object_get_string(unit_obj);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *driver_all="";
|
|
|
|
|
|
|
|
int loaded_size;
|
|
|
|
|
|
|
|
config_str loaded = yon_config_load(get_drivers_for_card_command,&loaded_size);
|
|
|
|
|
|
|
|
for (int i=0;i<loaded_size;i++){
|
|
|
|
|
|
|
|
free(yon_char_divide_search(loaded[i],"=",-1));
|
|
|
|
|
|
|
|
yon_char_remove_last_symbol(loaded[i],'\n');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int pos = yon_char_parsed_check_exist(loaded,loaded_size,(char*)driver_use);
|
|
|
|
|
|
|
|
if (pos>-1){
|
|
|
|
|
|
|
|
driver_all=yon_char_new(loaded[pos+1]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_char_parsed_free(loaded,loaded_size);
|
|
|
|
|
|
|
|
char *final_text = yon_char_unite("<span size=\"12pt\"><span weight='bold' color='#1a5fb4'>",DESCRIPTION_LABEL,":</span> ",_(desc),
|
|
|
|
|
|
|
|
"\n<span weight='bold' color='#1a5fb4'>",VENDOR_LABEL,":</span> ",vendor,
|
|
|
|
|
|
|
|
"\n<span weight='bold' color='#1a5fb4'>",MODEL_LABEL,":</span> ",product,
|
|
|
|
|
|
|
|
"\n<span weight='bold' color='#1a5fb4'>",USED_KERNEL_DRIVER_LABEL,":</span> ",driver_use,
|
|
|
|
|
|
|
|
"\n<span weight='bold' color='#1a5fb4'>",AVALIABLE_KERNEL_DRIVERS_LABEL,":</span> ",driver_all,"</span>",NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct adapter_struct *adapter_info = malloc(sizeof(struct adapter_struct));
|
|
|
|
|
|
|
|
memset(adapter_info,0,sizeof(struct adapter_struct));
|
|
|
|
|
|
|
|
adapter_info->widgets = widgets;
|
|
|
|
|
|
|
|
adapter_info->vendor=yon_char_new(vendor);
|
|
|
|
|
|
|
|
adapter_info->adapter_text = yon_char_new(final_text);
|
|
|
|
|
|
|
|
g_idle_add_once((GSourceOnceFunc)yon_adapter_update,adapter_info);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
struct adapter_struct *adapter_info = malloc(sizeof(struct adapter_struct));
|
|
|
|
|
|
|
|
memset(adapter_info,0,sizeof(struct adapter_struct));
|
|
|
|
|
|
|
|
adapter_info->widgets = widgets;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g_idle_add_once((GSourceOnceFunc)yon_adapter_update,adapter_info);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
gtk_widget_hide(widgets->InformationOverlay2);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_thread_exit(NULL);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void yon_adapter_window_setup(main_window *widgets){
|
|
|
|
|
|
|
|
gtk_overlay_add_overlay(GTK_OVERLAY(widgets->InformationOverlay),widgets->InformationCompanyLogoImage);
|
|
|
|
|
|
|
|
g_thread_new("adapter_thread",(GThreadFunc)yon_load_adapter,widgets);
|
|
|
|
|
|
|
|
gtk_overlay_add_overlay(GTK_OVERLAY(widgets->InformationOverlay2),widgets->InformationCompanyLogoImage2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void yon_set_sensitive_from_combo_box(GtkComboBox *toggle, GtkWidget *target){
|
|
|
|
void yon_set_sensitive_from_combo_box(GtkComboBox *toggle, GtkWidget *target){
|
|
|
|
@ -967,8 +979,12 @@ int main(int argc, char *argv[]){
|
|
|
|
template_main_window *widgets = yon_ubl_window_setup();
|
|
|
|
template_main_window *widgets = yon_ubl_window_setup();
|
|
|
|
config_init();
|
|
|
|
config_init();
|
|
|
|
widgets = yon_main_window_complete((main_window*)widgets);
|
|
|
|
widgets = yon_main_window_complete((main_window*)widgets);
|
|
|
|
yon_packages_init();
|
|
|
|
yon_window_config_setup(GTK_WINDOW(widgets->Window));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *path = yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL);
|
|
|
|
|
|
|
|
yon_window_config_load(path);
|
|
|
|
yon_root_button_setup(widgets,argv,argc);
|
|
|
|
yon_root_button_setup(widgets,argv,argc);
|
|
|
|
|
|
|
|
yon_packages_init();
|
|
|
|
|
|
|
|
|
|
|
|
if (system(yon_check_database_command)){
|
|
|
|
if (system(yon_check_database_command)){
|
|
|
|
dialog_confirmation_data *data = yon_confirmation_dialog_data_new();
|
|
|
|
dialog_confirmation_data *data = yon_confirmation_dialog_data_new();
|
|
|
|
@ -982,10 +998,6 @@ int main(int argc, char *argv[]){
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
yon_proprietary_get_thread(NULL,(main_window*)widgets);
|
|
|
|
yon_proprietary_get_thread(NULL,(main_window*)widgets);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yon_window_config_setup(GTK_WINDOW(widgets->Window));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *path = yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL);
|
|
|
|
|
|
|
|
yon_window_config_load(path);
|
|
|
|
|
|
|
|
gtk_main();
|
|
|
|
gtk_main();
|
|
|
|
yon_packages_finish();
|
|
|
|
yon_packages_finish();
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
|