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
117
118
119
120
121
122
123
124
125
126
127
|
diff -Naur sensors-applet-3.0.0.orig/sensors-applet/sensors-applet.c sensors-applet-3.0.0/sensors-applet/sensors-applet.c
--- sensors-applet-3.0.0.orig/sensors-applet/sensors-applet.c 2011-11-03 12:33:36.000000000 +0100
+++ sensors-applet-3.0.0/sensors-applet/sensors-applet.c 2013-04-28 20:08:31.002620583 +0200
@@ -641,122 +641,8 @@
/* get the first active sensor */
first_sensor = (ActiveSensor *)sensors_applet->active_sensors->data;
- switch (display_mode) {
- case DISPLAY_VALUE:
- gtk_widget_size_request(GTK_WIDGET(first_sensor->value),
- &req);
- value_width = req.width + COLUMN_SPACING;
- value_height = req.height + ROW_SPACING;
+ num_sensors_per_group = 1;
- /* make sure all widths and heights are non zero,
- * otherwise will get a divide by zero exception below
- * - is a non critical error since can happen when
- * elements first added to list, so simply return - is
- * not a programming error */
- if (value_width == 0 && value_height == 0) {
- return;
- }
-
- num_sensors_per_group = (sensors_applet->size /
- (horizontal ? value_height :
- value_width));
- break;
-
- case DISPLAY_LABEL_WITH_VALUE:
- /* even though we end up packing the event boxes into the
- * panel, these dont give back request sizes, so need to ask
- * widgets directly */
- gtk_widget_size_request(GTK_WIDGET(first_sensor->value),
- &req);
- value_width = req.width + COLUMN_SPACING;
- value_height = req.height + ROW_SPACING;
-
- gtk_widget_size_request(GTK_WIDGET(first_sensor->label),
- &req);
- label_width = req.width + COLUMN_SPACING;
- label_height = req.height + ROW_SPACING;
-
- /* make sure all widths and heights are non zero, otherwise
- * will get a divide by zero exception below
- * - is a non critical error since can happen when
- * elements first added to list, so simply return - is
- * not a programming error */
- if (!(label_width && label_height &&
- value_width && value_height)) {
- return;
- }
-
- switch (layout_mode) {
- case VALUE_BESIDE_LABEL:
- num_sensors_per_group = (sensors_applet->size /
- (horizontal ? MAX(label_height, value_height) :
- (label_width + value_width)));
- break;
- case VALUE_BELOW_LABEL:
- num_sensors_per_group = (sensors_applet->size /
- (horizontal ? (label_height + value_height) :
- MAX(label_width, value_width)));
-
-
- break;
- }
- break;
-
- case DISPLAY_ICON_WITH_VALUE:
- gtk_widget_size_request(GTK_WIDGET(first_sensor->value),
- &req);
- value_width = req.width + COLUMN_SPACING;
- value_height = req.height + ROW_SPACING;
-
- gtk_widget_size_request(GTK_WIDGET(first_sensor->icon),
- &req);
- icon_width = req.width + COLUMN_SPACING;
- icon_height = req.height + ROW_SPACING;
-
- //watch out if num_sensors_per_group is correctly computed
- //while icon_height is 0
- if (!(icon_width &&
- value_width && value_height)) {
- return;
- }
-
-
- switch (layout_mode) {
- case VALUE_BESIDE_LABEL:
- num_sensors_per_group = (sensors_applet->size /
- (horizontal ? MAX(icon_height, value_height) :
- (icon_width + value_width)));
- break;
- case VALUE_BELOW_LABEL:
- num_sensors_per_group = (sensors_applet->size /
- (horizontal ? (icon_height + value_height) :
- MAX(icon_width, value_width)));
-
-
- break;
- }
- break;
-
- case DISPLAY_ICON:
- gtk_widget_size_request(GTK_WIDGET(first_sensor->icon),
- &req);
- icon_width = req.width + COLUMN_SPACING;
- icon_height = req.height + ROW_SPACING;
- if (!(icon_width && icon_height)) {
- return;
- }
-
- num_sensors_per_group = (sensors_applet->size /
- (horizontal ? icon_height :
- icon_width));
- break;
-
- case DISPLAY_GRAPH:
- /* only show graphs in a line like System Monitor
- * applet */
- num_sensors_per_group = 1;
- break;
- }
/* ensure always atleast 1 sensor per group */
if (num_sensors_per_group < 1) {
/* force a better layout */
|