Package: sysinfo / 0.7-8

06-check_nvidia_settings.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#! /bin/sh /usr/share/dpatch/dpatch-run
## 04_check_nvidia_settings.dpatch by Koen Beek <koen.beek@gmail.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: don't show link to nvidia-settings if it is not installed

@DPATCH@

Index: sysinfo-0.7/Sysinfo/gui.glade
===================================================================
--- sysinfo-0.7.orig/Sysinfo/gui.glade	2008-12-29 18:26:47.000000000 +0000
+++ sysinfo-0.7/Sysinfo/gui.glade	2008-12-29 18:26:48.000000000 +0000
@@ -2753,7 +2753,24 @@
 				      <property name="y_options"></property>
 				    </packing>
 				  </child>
-
+				  <child>
+                                      <widget class="GtkEntry" id="nvidia_settings_not_installed">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="tooltip" translatable="yes">"nvidia-settings" is not installed - install it with a package manager</property>
+                                        <property name="editable">False</property>
+                                        <property name="has_frame">False</property>
+                                        <property name="invisible_char">•</property>
+                                        <property name="width_chars">2</property>
+                                      </widget>
+                                      <packing>
+                                        <property name="left_attach">1</property>
+                                        <property name="right_attach">2</property>
+                                        <property name="top_attach">4</property>
+                                        <property name="bottom_attach">5</property>
+                                        <property name="y_options"></property>
+                                      </packing>
+                                  </child>
 				  <child>
 				    <widget class="GtkEntry" id="nvidia_ctype_entry">
 				      <property name="visible">True</property>
Index: sysinfo-0.7/Sysinfo/Main.cs
===================================================================
--- sysinfo-0.7.orig/Sysinfo/Main.cs	2008-12-29 18:26:47.000000000 +0000
+++ sysinfo-0.7/Sysinfo/Main.cs	2008-12-29 18:26:48.000000000 +0000
@@ -94,7 +94,8 @@
 		//nvidia
 		[Widget] DrawingArea nvidia_top_drawingarea;
 		[Widget] Image nvidia_image;
-		[Widget] Entry nvidia_model_entry, nvidia_ctype_entry, nvidia_version_entry, nvidia_videoram_entry, nvidia_gpu_entry;
+		[Widget] Button nvidia_button;
+		[Widget] Entry nvidia_model_entry, nvidia_ctype_entry, nvidia_settings_not_installed, nvidia_version_entry, nvidia_videoram_entry, nvidia_gpu_entry;
 		
 		//base directory - not needed now
 		//String base_directory = System.AppDomain.CurrentDomain.BaseDirectory;
@@ -888,6 +889,18 @@
 					nvidia_gpu_entry.Text = nvidia_info.nvidia_gpu;
 					
 					nvidia_version_entry.Text = nvidia_info.nvidia_version;
+
+                                        if ( ! nvidia_info.nvidiaSettings ) {
+                                           nvidia_settings_not_installed.Text = "Please install nvidia-settings for more information";
+                                           nvidia_settings_not_installed.Visible = true;
+                                           nvidia_button.Sensitive = false;
+                                           nvidia_button.Visible = false;
+                                        } else {
+                                           nvidia_settings_not_installed.Text = "";
+                                           nvidia_settings_not_installed.Visible = false;
+                                           nvidia_button.Sensitive = true;
+                                           nvidia_button.Visible = true;
+                                        }
 					
 					nvidiaA = false;
 				}
Index: sysinfo-0.7/Sysinfo/NvidiaInfo.cs
===================================================================
--- sysinfo-0.7.orig/Sysinfo/NvidiaInfo.cs	2008-12-29 18:26:26.000000000 +0000
+++ sysinfo-0.7/Sysinfo/NvidiaInfo.cs	2008-12-29 18:27:23.000000000 +0000
@@ -10,6 +10,7 @@
 	public class NvidiaInfo {
 		
 		public Boolean nvidiaB = false;
+		public Boolean nvidiaSettings = false;
 		
 		public String nvidia_model = "unknown";
 		public String nvidia_ctype = "unknown";
@@ -26,6 +27,13 @@
 			if ( Directory.Exists("/proc/driver/nvidia/") )
 				nvidiaB = true;
 		}
+
+                 //check nvidia-settings is installed
+		public void NvidiaSettingsInstalled() {
+
+			if ( System.IO.File.Exists("/usr/bin/nvidia-settings") )
+				nvidiaSettings = true;
+		}
 		
 		//read some basic info
 		public void MainInfo(){
@@ -93,6 +101,9 @@
 			String temp;
 			
 			try {
+				NvidiaSettingsInstalled();
+
+				if (nvidiaSettings) {
 				
 				//run command and read output: nvidia-settings --query
 				//video ram
@@ -145,6 +156,8 @@
 				nvidia_gpu = temp.Remove(temp.LastIndexOf(","), 5) + " MHz";
 				
 				proc3.Close();
+
+				} // end of nvidiaSettings test
 			}
 			catch (System.ComponentModel.Win32Exception ex) {  Console.WriteLine( ex );  }
 			catch (ArgumentOutOfRangeException ex) {  Console.WriteLine( ex );  }