diff options
Diffstat (limited to '2023-06-12-021133-6157-1@0aec03c16de2_in-process')
13 files changed, 15533 insertions, 0 deletions
diff --git a/2023-06-12-021133-6157-1@0aec03c16de2_in-process/index.html b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/index.html new file mode 100644 index 0000000..4b99e37 --- /dev/null +++ b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/index.html @@ -0,0 +1,124 @@ +<html> +<head> +<title>rootdir - scan-build results</title> +<link type="text/css" rel="stylesheet" href="scanview.css"/> +<script src="sorttable.js"></script> +<script language='javascript' type="text/javascript"> +function SetDisplay(RowClass, DisplayVal) +{ + var Rows = document.getElementsByTagName("tr"); + for ( var i = 0 ; i < Rows.length; ++i ) { + if (Rows[i].className == RowClass) { + Rows[i].style.display = DisplayVal; + } + } +} + +function CopyCheckedStateToCheckButtons(SummaryCheckButton) { + var Inputs = document.getElementsByTagName("input"); + for ( var i = 0 ; i < Inputs.length; ++i ) { + if (Inputs[i].type == "checkbox") { + if(Inputs[i] != SummaryCheckButton) { + Inputs[i].checked = SummaryCheckButton.checked; + Inputs[i].onclick(); + } + } + } +} + +function returnObjById( id ) { + if (document.getElementById) + var returnVar = document.getElementById(id); + else if (document.all) + var returnVar = document.all[id]; + else if (document.layers) + var returnVar = document.layers[id]; + return returnVar; +} + +var NumUnchecked = 0; + +function ToggleDisplay(CheckButton, ClassName) { + if (CheckButton.checked) { + SetDisplay(ClassName, ""); + if (--NumUnchecked == 0) { + returnObjById("AllBugsCheck").checked = true; + } + } + else { + SetDisplay(ClassName, "none"); + NumUnchecked++; + returnObjById("AllBugsCheck").checked = false; + } +} +</script> +<!-- SUMMARYENDHEAD --> +</head> +<body> +<h1>rootdir - scan-build results</h1> + +<table> +<tr><th>User:</th><td>root@e25d61d3d37b</td></tr> +<tr><th>Working Directory:</th><td>/rootdir</td></tr> +<tr><th>Command Line:</th><td>make -j 2</td></tr> +<tr><th>Clang Version:</th><td>clang version 16.0.5 (Fedora 16.0.5-1.fc38) +</td></tr> +<tr><th>Date:</th><td>Mon Jun 12 02:11:33 2023</td></tr> +</table> +<h2>Bug Summary</h2><table> +<thead><tr><td>Bug Type</td><td>Quantity</td><td class="sorttable_nosort">Display?</td></tr></thead> +<tr style="font-weight:bold"><td class="SUMM_DESC">All Bugs</td><td class="Q">10</td><td><center><input type="checkbox" id="AllBugsCheck" onClick="CopyCheckedStateToCheckButtons(this);" checked/></center></td></tr> +<tr><th>Logic error</th><th colspan=2></th></tr> +<tr><td class="SUMM_DESC">Cast from non-struct type to struct type</td><td class="Q">7</td><td><center><input type="checkbox" onClick="ToggleDisplay(this,'bt_logic_error_cast_from_non-struct_type_to_struct_type');" checked/></center></td></tr> +<tr><td class="SUMM_DESC">Division by zero</td><td class="Q">1</td><td><center><input type="checkbox" onClick="ToggleDisplay(this,'bt_logic_error_division_by_zero');" checked/></center></td></tr> +<tr><th>Unused code</th><th colspan=2></th></tr> +<tr><td class="SUMM_DESC">Dead assignment</td><td class="Q">2</td><td><center><input type="checkbox" onClick="ToggleDisplay(this,'bt_unused_code_dead_assignment');" checked/></center></td></tr> +</table> +<h2>Reports</h2> + +<table class="sortable" style="table-layout:automatic"> +<thead><tr> + <td>Bug Group</td> + <td class="sorttable_sorted">Bug Type<span id="sorttable_sortfwdind"> ▾</span></td> + <td>File</td> + <td>Function/Method</td> + <td class="Q">Line</td> + <td class="Q">Path Length</td> + <td class="sorttable_nosort"></td> + <!-- REPORTBUGCOL --> +</tr></thead> +<tbody> +<tr class="bt_logic_error_cast_from_non-struct_type_to_struct_type"><td class="DESC">Logic error</td><td class="DESC">Cast from non-struct type to struct type</td><td>plugins/udisks2/udisks2-plugin.c</td><td class="DESC">udisks2_plugin_get_sensors</td><td class="Q">315</td><td class="Q">1</td><td><a href="report-1191e2.html#EndPath">View Report</a></td> +<!-- REPORTBUG id="report-1191e2.html" --> +</tr> +<tr class="bt_logic_error_cast_from_non-struct_type_to_struct_type"><td class="DESC">Logic error</td><td class="DESC">Cast from non-struct type to struct type</td><td>plugins/udisks2/udisks2-plugin.c</td><td class="DESC">udisks2_plugin_get_sensors</td><td class="Q">295</td><td class="Q">1</td><td><a href="report-1e32d3.html#EndPath">View Report</a></td> +<!-- REPORTBUG id="report-1e32d3.html" --> +</tr> +<tr class="bt_logic_error_cast_from_non-struct_type_to_struct_type"><td class="DESC">Logic error</td><td class="DESC">Cast from non-struct type to struct type</td><td>sensors-applet/sensors-applet.c</td><td class="DESC">prefs_cb</td><td class="Q">61</td><td class="Q">1</td><td><a href="report-407f6f.html#EndPath">View Report</a></td> +<!-- REPORTBUG id="report-407f6f.html" --> +</tr> +<tr class="bt_logic_error_cast_from_non-struct_type_to_struct_type"><td class="DESC">Logic error</td><td class="DESC">Cast from non-struct type to struct type</td><td>plugins/udisks2/udisks2-plugin.c</td><td class="DESC">udisks2_plugin_get_sensors</td><td class="Q">316</td><td class="Q">1</td><td><a href="report-48fbd5.html#EndPath">View Report</a></td> +<!-- REPORTBUG id="report-48fbd5.html" --> +</tr> +<tr class="bt_logic_error_cast_from_non-struct_type_to_struct_type"><td class="DESC">Logic error</td><td class="DESC">Cast from non-struct type to struct type</td><td>plugins/udisks2/udisks2-plugin.c</td><td class="DESC">udisks2_plugin_get_sensors</td><td class="Q">319</td><td class="Q">1</td><td><a href="report-782a54.html#EndPath">View Report</a></td> +<!-- REPORTBUG id="report-782a54.html" --> +</tr> +<tr class="bt_logic_error_cast_from_non-struct_type_to_struct_type"><td class="DESC">Logic error</td><td class="DESC">Cast from non-struct type to struct type</td><td>plugins/udisks2/udisks2-plugin.c</td><td class="DESC">udisks2_plugin_get_sensors</td><td class="Q">318</td><td class="Q">1</td><td><a href="report-e082ac.html#EndPath">View Report</a></td> +<!-- REPORTBUG id="report-e082ac.html" --> +</tr> +<tr class="bt_logic_error_cast_from_non-struct_type_to_struct_type"><td class="DESC">Logic error</td><td class="DESC">Cast from non-struct type to struct type</td><td>plugins/udisks2/udisks2-plugin.c</td><td class="DESC">udisks2_plugin_get_sensors</td><td class="Q">296</td><td class="Q">1</td><td><a href="report-f7fb7e.html#EndPath">View Report</a></td> +<!-- REPORTBUG id="report-f7fb7e.html" --> +</tr> +<tr class="bt_unused_code_dead_assignment"><td class="DESC">Unused code</td><td class="DESC">Dead assignment</td><td>sensors-applet/sensors-applet.c</td><td class="DESC">sensors_applet_add_sensor</td><td class="Q">860</td><td class="Q">1</td><td><a href="report-5f1566.html#EndPath">View Report</a></td> +<!-- REPORTBUG id="report-5f1566.html" --> +</tr> +<tr class="bt_unused_code_dead_assignment"><td class="DESC">Unused code</td><td class="DESC">Dead assignment</td><td>sensors-applet/sensors-applet.c</td><td class="DESC">sensors_applet_add_sensor</td><td class="Q">887</td><td class="Q">1</td><td><a href="report-699f6d.html#EndPath">View Report</a></td> +<!-- REPORTBUG id="report-699f6d.html" --> +</tr> +<tr class="bt_logic_error_division_by_zero"><td class="DESC">Logic error</td><td class="DESC">Division by zero</td><td>sensors-applet/sensors-applet.c</td><td class="DESC">sensors_applet_pack_display</td><td class="Q">529</td><td class="Q">13</td><td><a href="report-f0c410.html#EndPath">View Report</a></td> +<!-- REPORTBUG id="report-f0c410.html" --> +</tr> +</tbody> +</table> + +</body></html> diff --git a/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-1191e2.html b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-1191e2.html new file mode 100644 index 0000000..8f52d3b --- /dev/null +++ b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-1191e2.html @@ -0,0 +1,1133 @@ +<!doctype html> +<html> +<head> +<title>udisks2-plugin.c</title> + +<style type="text/css"> +body { color:#000000; background-color:#ffffff } +body { font-family:Helvetica, sans-serif; font-size:10pt } +h1 { font-size:14pt } +.FileName { margin-top: 5px; margin-bottom: 5px; display: inline; } +.FileNav { margin-left: 5px; margin-right: 5px; display: inline; } +.FileNav a { text-decoration:none; font-size: larger; } +.divider { margin-top: 30px; margin-bottom: 30px; height: 15px; } +.divider { background-color: gray; } +.code { border-collapse:collapse; width:100%; } +.code { font-family: "Monospace", monospace; font-size:10pt } +.code { line-height: 1.2em } +.comment { color: green; font-style: oblique } +.keyword { color: blue } +.string_literal { color: red } +.directive { color: darkmagenta } + +/* Macros and variables could have pop-up notes hidden by default. + - Macro pop-up: expansion of the macro + - Variable pop-up: value (table) of the variable */ +.macro_popup, .variable_popup { display: none; } + +/* Pop-up appears on mouse-hover event. */ +.macro:hover .macro_popup, .variable:hover .variable_popup { + display: block; + padding: 2px; + -webkit-border-radius:5px; + -webkit-box-shadow:1px 1px 7px #000; + border-radius:5px; + box-shadow:1px 1px 7px #000; + position: absolute; + top: -1em; + left:10em; + z-index: 1 +} + +.macro_popup { + border: 2px solid red; + background-color:#FFF0F0; + font-weight: normal; +} + +.variable_popup { + border: 2px solid blue; + background-color:#F0F0FF; + font-weight: bold; + font-family: Helvetica, sans-serif; + font-size: 9pt; +} + +/* Pop-up notes needs a relative position as a base where they pops up. */ +.macro, .variable { + background-color: PaleGoldenRod; + position: relative; +} +.macro { color: DarkMagenta; } + +#tooltiphint { + position: fixed; + width: 50em; + margin-left: -25em; + left: 50%; + padding: 10px; + border: 1px solid #b0b0b0; + border-radius: 2px; + box-shadow: 1px 1px 7px black; + background-color: #c0c0c0; + z-index: 2; +} + +.num { width:2.5em; padding-right:2ex; background-color:#eeeeee } +.num { text-align:right; font-size:8pt } +.num { color:#444444 } +.line { padding-left: 1ex; border-left: 3px solid #ccc } +.line { white-space: pre } +.msg { -webkit-box-shadow:1px 1px 7px #000 } +.msg { box-shadow:1px 1px 7px #000 } +.msg { -webkit-border-radius:5px } +.msg { border-radius:5px } +.msg { font-family:Helvetica, sans-serif; font-size:8pt } +.msg { float:left } +.msg { position:relative } +.msg { padding:0.25em 1ex 0.25em 1ex } +.msg { margin-top:10px; margin-bottom:10px } +.msg { font-weight:bold } +.msg { max-width:60em; word-wrap: break-word; white-space: pre-wrap } +.msgT { padding:0x; spacing:0x } +.msgEvent { background-color:#fff8b4; color:#000000 } +.msgControl { background-color:#bbbbbb; color:#000000 } +.msgNote { background-color:#ddeeff; color:#000000 } +.mrange { background-color:#dfddf3 } +.mrange { border-bottom:1px solid #6F9DBE } +.PathIndex { font-weight: bold; padding:0px 5px; margin-right:5px; } +.PathIndex { -webkit-border-radius:8px } +.PathIndex { border-radius:8px } +.PathIndexEvent { background-color:#bfba87 } +.PathIndexControl { background-color:#8c8c8c } +.PathIndexPopUp { background-color: #879abc; } +.PathNav a { text-decoration:none; font-size: larger } +.CodeInsertionHint { font-weight: bold; background-color: #10dd10 } +.CodeRemovalHint { background-color:#de1010 } +.CodeRemovalHint { border-bottom:1px solid #6F9DBE } +.msg.selected{ background-color:orange !important; } + +table.simpletable { + padding: 5px; + font-size:12pt; + margin:20px; + border-collapse: collapse; border-spacing: 0px; +} +td.rowname { + text-align: right; + vertical-align: top; + font-weight: bold; + color:#444444; + padding-right:2ex; +} + +/* Hidden text. */ +input.spoilerhider + label { + cursor: pointer; + text-decoration: underline; + display: block; +} +input.spoilerhider { + display: none; +} +input.spoilerhider ~ .spoiler { + overflow: hidden; + margin: 10px auto 0; + height: 0; + opacity: 0; +} +input.spoilerhider:checked + label + .spoiler{ + height: auto; + opacity: 1; +} +</style> +</head> +<body> +<!-- BUGDESC Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption --> + +<!-- BUGTYPE Cast from non-struct type to struct type --> + +<!-- BUGCATEGORY Logic error --> + +<!-- BUGFILE /rootdir/plugins/udisks2/udisks2-plugin.c --> + +<!-- FILENAME udisks2-plugin.c --> + +<!-- FUNCTIONNAME udisks2_plugin_get_sensors --> + +<!-- ISSUEHASHCONTENTOFLINEINCONTEXT 1191e24604f93e3d6f293330eaed807e --> + +<!-- BUGLINE 315 --> + +<!-- BUGCOLUMN 90 --> + +<!-- BUGPATHLENGTH 1 --> + +<!-- BUGMETAEND --> +<!-- REPORTHEADER --> +<h3>Bug Summary</h3> +<table class="simpletable"> +<tr><td class="rowname">File:</td><td>plugins/udisks2/udisks2-plugin.c</td></tr> +<tr><td class="rowname">Warning:</td><td><a href="#EndPath">line 315, column 90</a><br />Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption</td></tr> + +</table> +<!-- REPORTSUMMARYEXTRA --> +<h3>Annotated Source Code</h3> +<p>Press <a href="#" onclick="toggleHelp(); return false;">'?'</a> + to see keyboard shortcuts</p> +<input type="checkbox" class="spoilerhider" id="showinvocation" /> +<label for="showinvocation" >Show analyzer invocation</label> +<div class="spoiler">clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name udisks2-plugin.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/plugins/udisks2 -resource-dir /usr/lib64/clang/16 -D HAVE_CONFIG_H -I . -I ../../sensors-applet -D MATELOCALEDIR="/usr/local/share/locale/" -D G_LOG_DOMAIN="sensors-applet" -D PIXMAPS_DIR="/usr/local/share/pixmaps/mate-sensors-applet/" -D DATADIR="/usr/local/share" -D LIBDIR="/usr/local/lib" -D SYSCONFDIR="/usr/local/etc" -D PREFIX="/usr/local" -I ../.. -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -D PIC -internal-isystem /usr/lib64/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/plugins/udisks2 -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2023-06-12-021133-6157-1 -x c udisks2-plugin.c +</div> +<div id='tooltiphint' hidden="true"> + <p>Keyboard shortcuts: </p> + <ul> + <li>Use 'j/k' keys for keyboard navigation</li> + <li>Use 'Shift+S' to show/hide relevant lines</li> + <li>Use '?' to toggle this window</li> + </ul> + <a href="#" onclick="toggleHelp(); return false;">Close</a> +</div> +<script type='text/javascript'> +var relevant_lines = {"1": {"315": 1}}; + +var filterCounterexample = function (hide) { + var tables = document.getElementsByClassName("code"); + for (var t=0; t<tables.length; t++) { + var table = tables[t]; + var file_id = table.getAttribute("data-fileid"); + var lines_in_fid = relevant_lines[file_id]; + if (!lines_in_fid) { + lines_in_fid = {}; + } + var lines = table.getElementsByClassName("codeline"); + for (var i=0; i<lines.length; i++) { + var el = lines[i]; + var lineNo = el.getAttribute("data-linenumber"); + if (!lines_in_fid[lineNo]) { + if (hide) { + el.setAttribute("hidden", ""); + } else { + el.removeAttribute("hidden"); + } + } + } + } +} + +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + // SHIFT + S + if (event.shiftKey && event.keyCode == 83) { + var checked = document.getElementsByName("showCounterexample")[0].checked; + filterCounterexample(!checked); + document.getElementsByName("showCounterexample")[0].click(); + } else { + return; + } + event.preventDefault(); +}, true); + +document.addEventListener("DOMContentLoaded", function() { + document.querySelector('input[name="showCounterexample"]').onchange= + function (event) { + filterCounterexample(this.checked); + }; +}); +</script> + +<form> + <input type="checkbox" name="showCounterexample" id="showCounterexample" /> + <label for="showCounterexample"> + Show only relevant lines + </label> + <input type="checkbox" name="showArrows" + id="showArrows" style="margin-left: 10px" /> + <label for="showArrows"> + Show control flow arrows + </label> +</form> + +<script type='text/javascript'> +// Return range of numbers from a range [lower, upper). +function range(lower, upper) { + var array = []; + for (var i = lower; i <= upper; ++i) { + array.push(i); + } + return array; +} + +var getRelatedArrowIndices = function(pathId) { + // HTML numeration of events is a bit different than it is in the path. + // Everything is rotated one step to the right, so the last element + // (error diagnostic) has index 0. + if (pathId == 0) { + // arrowIndices has at least 2 elements + pathId = arrowIndices.length - 1; + } + + return range(arrowIndices[pathId], arrowIndices[pathId - 1]); +} + +var highlightArrowsForSelectedEvent = function() { + const selectedNum = findNum(); + const arrowIndicesToHighlight = getRelatedArrowIndices(selectedNum); + arrowIndicesToHighlight.forEach((index) => { + var arrow = document.querySelector("#arrow" + index); + if(arrow) { + classListAdd(arrow, "selected") + } + }); +} + +var getAbsoluteBoundingRect = function(element) { + const relative = element.getBoundingClientRect(); + return { + left: relative.left + window.pageXOffset, + right: relative.right + window.pageXOffset, + top: relative.top + window.pageYOffset, + bottom: relative.bottom + window.pageYOffset, + height: relative.height, + width: relative.width + }; +} + +var drawArrow = function(index) { + // This function is based on the great answer from SO: + // https://stackoverflow.com/a/39575674/11582326 + var start = document.querySelector("#start" + index); + var end = document.querySelector("#end" + index); + var arrow = document.querySelector("#arrow" + index); + + var startRect = getAbsoluteBoundingRect(start); + var endRect = getAbsoluteBoundingRect(end); + + // It is an arrow from a token to itself, no need to visualize it. + if (startRect.top == endRect.top && + startRect.left == endRect.left) + return; + + // Each arrow is a very simple Bézier curve, with two nodes and + // two handles. So, we need to calculate four points in the window: + // * start node + var posStart = { x: 0, y: 0 }; + // * end node + var posEnd = { x: 0, y: 0 }; + // * handle for the start node + var startHandle = { x: 0, y: 0 }; + // * handle for the end node + var endHandle = { x: 0, y: 0 }; + // One can visualize it as follows: + // + // start handle + // / + // X"""_.-""""X + // .' \ + // / start node + // | + // | + // | end node + // \ / + // `->X + // X-' + // \ + // end handle + // + // NOTE: (0, 0) is the top left corner of the window. + + // We have 3 similar, but still different scenarios to cover: + // + // 1. Two tokens on different lines. + // -xxx + // / + // \ + // -> xxx + // In this situation, we draw arrow on the left curving to the left. + // 2. Two tokens on the same line, and the destination is on the right. + // ____ + // / \ + // / V + // xxx xxx + // In this situation, we draw arrow above curving upwards. + // 3. Two tokens on the same line, and the destination is on the left. + // xxx xxx + // ^ / + // \____/ + // In this situation, we draw arrow below curving downwards. + const onDifferentLines = startRect.top <= endRect.top - 5 || + startRect.top >= endRect.top + 5; + const leftToRight = startRect.left < endRect.left; + + // NOTE: various magic constants are chosen empirically for + // better positioning and look + if (onDifferentLines) { + // Case #1 + const topToBottom = startRect.top < endRect.top; + posStart.x = startRect.left - 1; + // We don't want to start it at the top left corner of the token, + // it doesn't feel like this is where the arrow comes from. + // For this reason, we start it in the middle of the left side + // of the token. + posStart.y = startRect.top + startRect.height / 2; + + // End node has arrow head and we give it a bit more space. + posEnd.x = endRect.left - 4; + posEnd.y = endRect.top; + + // Utility object with x and y offsets for handles. + var curvature = { + // We want bottom-to-top arrow to curve a bit more, so it doesn't + // overlap much with top-to-bottom curves (much more frequent). + x: topToBottom ? 15 : 25, + y: Math.min((posEnd.y - posStart.y) / 3, 10) + } + + // When destination is on the different line, we can make a + // curvier arrow because we have space for it. + // So, instead of using + // + // startHandle.x = posStart.x - curvature.x + // endHandle.x = posEnd.x - curvature.x + // + // We use the leftmost of these two values for both handles. + startHandle.x = Math.min(posStart.x, posEnd.x) - curvature.x; + endHandle.x = startHandle.x; + + // Curving downwards from the start node... + startHandle.y = posStart.y + curvature.y; + // ... and upwards from the end node. + endHandle.y = posEnd.y - curvature.y; + + } else if (leftToRight) { + // Case #2 + // Starting from the top right corner... + posStart.x = startRect.right - 1; + posStart.y = startRect.top; + + // ...and ending at the top left corner of the end token. + posEnd.x = endRect.left + 1; + posEnd.y = endRect.top - 1; + + // Utility object with x and y offsets for handles. + var curvature = { + x: Math.min((posEnd.x - posStart.x) / 3, 15), + y: 5 + } + + // Curving to the right... + startHandle.x = posStart.x + curvature.x; + // ... and upwards from the start node. + startHandle.y = posStart.y - curvature.y; + + // And to the left... + endHandle.x = posEnd.x - curvature.x; + // ... and upwards from the end node. + endHandle.y = posEnd.y - curvature.y; + + } else { + // Case #3 + // Starting from the bottom right corner... + posStart.x = startRect.right; + posStart.y = startRect.bottom; + + // ...and ending also at the bottom right corner, but of the end token. + posEnd.x = endRect.right - 1; + posEnd.y = endRect.bottom + 1; + + // Utility object with x and y offsets for handles. + var curvature = { + x: Math.min((posStart.x - posEnd.x) / 3, 15), + y: 5 + } + + // Curving to the left... + startHandle.x = posStart.x - curvature.x; + // ... and downwards from the start node. + startHandle.y = posStart.y + curvature.y; + + // And to the right... + endHandle.x = posEnd.x + curvature.x; + // ... and downwards from the end node. + endHandle.y = posEnd.y + curvature.y; + } + + // Put it all together into a path. + // More information on the format: + // https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths + var pathStr = "M" + posStart.x + "," + posStart.y + " " + + "C" + startHandle.x + "," + startHandle.y + " " + + endHandle.x + "," + endHandle.y + " " + + posEnd.x + "," + posEnd.y; + + arrow.setAttribute("d", pathStr); +}; + +var drawArrows = function() { + const numOfArrows = document.querySelectorAll("path[id^=arrow]").length; + for (var i = 0; i < numOfArrows; ++i) { + drawArrow(i); + } +} + +var toggleArrows = function(event) { + const arrows = document.querySelector("#arrows"); + if (event.target.checked) { + arrows.setAttribute("visibility", "visible"); + } else { + arrows.setAttribute("visibility", "hidden"); + } +} + +window.addEventListener("resize", drawArrows); +document.addEventListener("DOMContentLoaded", function() { + // Whenever we show invocation, locations change, i.e. we + // need to redraw arrows. + document + .querySelector('input[id="showinvocation"]') + .addEventListener("click", drawArrows); + // Hiding irrelevant lines also should cause arrow rerender. + document + .querySelector('input[name="showCounterexample"]') + .addEventListener("change", drawArrows); + document + .querySelector('input[name="showArrows"]') + .addEventListener("change", toggleArrows); + drawArrows(); + // Default highlighting for the last event. + highlightArrowsForSelectedEvent(); +}); +</script> + +<script type='text/javascript'> +var digitMatcher = new RegExp("[0-9]+"); + +var querySelectorAllArray = function(selector) { + return Array.prototype.slice.call( + document.querySelectorAll(selector)); +} + +document.addEventListener("DOMContentLoaded", function() { + querySelectorAllArray(".PathNav > a").forEach( + function(currentValue, currentIndex) { + var hrefValue = currentValue.getAttribute("href"); + currentValue.onclick = function() { + scrollTo(document.querySelector(hrefValue)); + return false; + }; + }); +}); + +var findNum = function() { + var s = document.querySelector(".msg.selected"); + if (!s || s.id == "EndPath") { + return 0; + } + var out = parseInt(digitMatcher.exec(s.id)[0]); + return out; +}; + +var classListAdd = function(el, theClass) { + if(!el.className.baseVal) + el.className += " " + theClass; + else + el.className.baseVal += " " + theClass; +}; + +var classListRemove = function(el, theClass) { + var className = (!el.className.baseVal) ? + el.className : el.className.baseVal; + className = className.replace(" " + theClass, ""); + if(!el.className.baseVal) + el.className = className; + else + el.className.baseVal = className; +}; + +var scrollTo = function(el) { + querySelectorAllArray(".selected").forEach(function(s) { + classListRemove(s, "selected"); + }); + classListAdd(el, "selected"); + window.scrollBy(0, el.getBoundingClientRect().top - + (window.innerHeight / 2)); + highlightArrowsForSelectedEvent(); +}; + +var move = function(num, up, numItems) { + if (num == 1 && up || num == numItems - 1 && !up) { + return 0; + } else if (num == 0 && up) { + return numItems - 1; + } else if (num == 0 && !up) { + return 1 % numItems; + } + return up ? num - 1 : num + 1; +} + +var numToId = function(num) { + if (num == 0) { + return document.getElementById("EndPath") + } + return document.getElementById("Path" + num); +}; + +var navigateTo = function(up) { + var numItems = document.querySelectorAll( + ".line > .msgEvent, .line > .msgControl").length; + var currentSelected = findNum(); + var newSelected = move(currentSelected, up, numItems); + var newEl = numToId(newSelected, numItems); + + // Scroll element into center. + scrollTo(newEl); +}; + +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + // key 'j' + if (event.keyCode == 74) { + navigateTo(/*up=*/false); + // key 'k' + } else if (event.keyCode == 75) { + navigateTo(/*up=*/true); + } else { + return; + } + event.preventDefault(); +}, true); +</script> + +<script type='text/javascript'> + +var toggleHelp = function() { + var hint = document.querySelector("#tooltiphint"); + var attributeName = "hidden"; + if (hint.hasAttribute(attributeName)) { + hint.removeAttribute(attributeName); + } else { + hint.setAttribute("hidden", "true"); + } +}; +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + if (event.key == "?") { + toggleHelp(); + } else { + return; + } + event.preventDefault(); +}); +</script> + +<style type="text/css"> + svg { + position:absolute; + top:0; + left:0; + height:100%; + width:100%; + pointer-events: none; + overflow: visible + } + .arrow { + stroke-opacity: 0.2; + stroke-width: 1; + marker-end: url(#arrowhead); + } + + .arrow.selected { + stroke-opacity: 0.6; + stroke-width: 2; + marker-end: url(#arrowheadSelected); + } + + .arrowhead { + orient: auto; + stroke: none; + opacity: 0.6; + fill: blue; + } +</style> +<svg xmlns="http://www.w3.org/2000/svg"> + <defs> + <marker id="arrowheadSelected" class="arrowhead" opacity="0.6" + viewBox="0 0 10 10" refX="3" refY="5" + markerWidth="4" markerHeight="4"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + <marker id="arrowhead" class="arrowhead" opacity="0.2" + viewBox="0 0 10 10" refX="3" refY="5" + markerWidth="4" markerHeight="4"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + </defs> + <g id="arrows" fill="none" stroke="blue" visibility="hidden"> + + </g> +</svg> +<script type='text/javascript'> +const arrowIndices = [ 0,0 ] +</script> +<table class="code" data-fileid="1"> +<tr class="codeline" data-linenumber="1"><td class="num" id="LN1">1</td><td class="line"><span class='comment'>/*</span></td></tr> +<tr class="codeline" data-linenumber="2"><td class="num" id="LN2">2</td><td class="line"> <span class='comment'>* Copyright (C) 2017 info-cppsp <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="3"><td class="num" id="LN3">3</td><td class="line"> <span class='comment'>* Copyright (C) 2005-2009 Alex Murray <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="4"><td class="num" id="LN4">4</td><td class="line"> <span class='comment'>* Copyright (C) 2012-2021 MATE Developers</span></td></tr> +<tr class="codeline" data-linenumber="5"><td class="num" id="LN5">5</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="6"><td class="num" id="LN6">6</td><td class="line"> <span class='comment'>* This program is free software; you can redistribute it and/or modify</span></td></tr> +<tr class="codeline" data-linenumber="7"><td class="num" id="LN7">7</td><td class="line"> <span class='comment'>* it under the terms of the GNU General Public License as published by</span></td></tr> +<tr class="codeline" data-linenumber="8"><td class="num" id="LN8">8</td><td class="line"> <span class='comment'>* the Free Software Foundation; either version 2 of the License, or</span></td></tr> +<tr class="codeline" data-linenumber="9"><td class="num" id="LN9">9</td><td class="line"> <span class='comment'>* (at your option) any later version.</span></td></tr> +<tr class="codeline" data-linenumber="10"><td class="num" id="LN10">10</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="11"><td class="num" id="LN11">11</td><td class="line"> <span class='comment'>* This program is distributed in the hope that it will be useful,</span></td></tr> +<tr class="codeline" data-linenumber="12"><td class="num" id="LN12">12</td><td class="line"> <span class='comment'>* but WITHOUT ANY WARRANTY; without even the implied warranty of</span></td></tr> +<tr class="codeline" data-linenumber="13"><td class="num" id="LN13">13</td><td class="line"> <span class='comment'>* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></td></tr> +<tr class="codeline" data-linenumber="14"><td class="num" id="LN14">14</td><td class="line"> <span class='comment'>* GNU General Public License for more details.</span></td></tr> +<tr class="codeline" data-linenumber="15"><td class="num" id="LN15">15</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="16"><td class="num" id="LN16">16</td><td class="line"> <span class='comment'>* You should have received a copy of the GNU General Public License</span></td></tr> +<tr class="codeline" data-linenumber="17"><td class="num" id="LN17">17</td><td class="line"> <span class='comment'>* along with this program; if not, write to the Free Software</span></td></tr> +<tr class="codeline" data-linenumber="18"><td class="num" id="LN18">18</td><td class="line"> <span class='comment'>* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</span></td></tr> +<tr class="codeline" data-linenumber="19"><td class="num" id="LN19">19</td><td class="line"> <span class='comment'>*/</span></td></tr> +<tr class="codeline" data-linenumber="20"><td class="num" id="LN20">20</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="21"><td class="num" id="LN21">21</td><td class="line"><span class='comment'>/*</span></td></tr> +<tr class="codeline" data-linenumber="22"><td class="num" id="LN22">22</td><td class="line"><span class='comment'>Udisks2 plugin for the mate-sensors-applet</span></td></tr> +<tr class="codeline" data-linenumber="23"><td class="num" id="LN23">23</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="24"><td class="num" id="LN24">24</td><td class="line"><span class='comment'>written using the structure and code of the previous version</span></td></tr> +<tr class="codeline" data-linenumber="25"><td class="num" id="LN25">25</td><td class="line"><span class='comment'>from Pramod Dematagoda <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="26"><td class="num" id="LN26">26</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="27"><td class="num" id="LN27">27</td><td class="line"><span class='comment'>dbus-glib documentation</span></td></tr> +<tr class="codeline" data-linenumber="28"><td class="num" id="LN28">28</td><td class="line"><span class='comment'>https://dbus.freedesktop.org/doc/dbus-glib/</span></td></tr> +<tr class="codeline" data-linenumber="29"><td class="num" id="LN29">29</td><td class="line"><span class='comment'>GDBUS documentation</span></td></tr> +<tr class="codeline" data-linenumber="30"><td class="num" id="LN30">30</td><td class="line"><span class='comment'>https://developer.gnome.org/gio/stable/index.html</span></td></tr> +<tr class="codeline" data-linenumber="31"><td class="num" id="LN31">31</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="32"><td class="num" id="LN32">32</td><td class="line"><span class='comment'>*/</span></td></tr> +<tr class="codeline" data-linenumber="33"><td class="num" id="LN33">33</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="34"><td class="num" id="LN34">34</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_CONFIG_H<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="35"><td class="num" id="LN35">35</td><td class="line"><span class='directive'>#include "config.h"</span></td></tr> +<tr class="codeline" data-linenumber="36"><td class="num" id="LN36">36</td><td class="line"><span class='directive'>#endif /* HAVE_CONFIG_H */</span></td></tr> +<tr class="codeline" data-linenumber="37"><td class="num" id="LN37">37</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="38"><td class="num" id="LN38">38</td><td class="line"><span class='directive'>#include <stdio.h></span></td></tr> +<tr class="codeline" data-linenumber="39"><td class="num" id="LN39">39</td><td class="line"><span class='directive'>#include <gio/gio.h></span></td></tr> +<tr class="codeline" data-linenumber="40"><td class="num" id="LN40">40</td><td class="line"><span class='directive'>#include "udisks2-plugin.h"</span></td></tr> +<tr class="codeline" data-linenumber="41"><td class="num" id="LN41">41</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="42"><td class="num" id="LN42">42</td><td class="line"><span class='comment'>/* remove // from next line for syslog debug */</span></td></tr> +<tr class="codeline" data-linenumber="43"><td class="num" id="LN43">43</td><td class="line"><span class='comment'>//#define UD2PD 1</span></td></tr> +<tr class="codeline" data-linenumber="44"><td class="num" id="LN44">44</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="45"><td class="num" id="LN45">45</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="46"><td class="num" id="LN46">46</td><td class="line"><span class='directive'>#include <syslog.h></span></td></tr> +<tr class="codeline" data-linenumber="47"><td class="num" id="LN47">47</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="48"><td class="num" id="LN48">48</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="49"><td class="num" id="LN49">49</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_BUS_NAME<span class='macro_popup'>"org.freedesktop.UDisks2"</span></span> "org.freedesktop.UDisks2"</span></td></tr> +<tr class="codeline" data-linenumber="50"><td class="num" id="LN50">50</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.DBus.ObjectManager"</span></span> "org.freedesktop.DBus.ObjectManager"</span></td></tr> +<tr class="codeline" data-linenumber="51"><td class="num" id="LN51">51</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_DEVICE_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive"</span></span> "org.freedesktop.UDisks2.Drive"</span></td></tr> +<tr class="codeline" data-linenumber="52"><td class="num" id="LN52">52</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_DEVICE_INTERFACE2_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive.Ata"</span></span> "org.freedesktop.UDisks2.Drive.Ata"</span></td></tr> +<tr class="codeline" data-linenumber="53"><td class="num" id="LN53">53</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="54"><td class="num" id="LN54">54</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_PROPERTIES_INTERFACE<span class='macro_popup'>"org.freedesktop.DBus.Properties"</span></span> "org.freedesktop.DBus.Properties"</span></td></tr> +<tr class="codeline" data-linenumber="55"><td class="num" id="LN55">55</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_OBJECT_PATH<span class='macro_popup'>"/org/freedesktop/UDisks2"</span></span> "/org/freedesktop/UDisks2"</span></td></tr> +<tr class="codeline" data-linenumber="56"><td class="num" id="LN56">56</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="57"><td class="num" id="LN57">57</td><td class="line"><span class='comment'>/* Info about a single sensor */</span></td></tr> +<tr class="codeline" data-linenumber="58"><td class="num" id="LN58">58</td><td class="line"><span class='keyword'>typedef</span> <span class='keyword'>struct</span> _DevInfo {</td></tr> +<tr class="codeline" data-linenumber="59"><td class="num" id="LN59">59</td><td class="line"> gchar *path;</td></tr> +<tr class="codeline" data-linenumber="60"><td class="num" id="LN60">60</td><td class="line"> gchar *id;</td></tr> +<tr class="codeline" data-linenumber="61"><td class="num" id="LN61">61</td><td class="line"> gdouble temp;</td></tr> +<tr class="codeline" data-linenumber="62"><td class="num" id="LN62">62</td><td class="line"> GDBusProxy *sensor_proxy; <span class='comment'>/* dbus object */</span></td></tr> +<tr class="codeline" data-linenumber="63"><td class="num" id="LN63">63</td><td class="line"> GError *error;</td></tr> +<tr class="codeline" data-linenumber="64"><td class="num" id="LN64">64</td><td class="line">} DevInfo;</td></tr> +<tr class="codeline" data-linenumber="65"><td class="num" id="LN65">65</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="66"><td class="num" id="LN66">66</td><td class="line"><span class='keyword'>const</span> gchar *plugin_name = <span class='string_literal'>"udisks2"</span>;</td></tr> +<tr class="codeline" data-linenumber="67"><td class="num" id="LN67">67</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="68"><td class="num" id="LN68">68</td><td class="line"><span class='comment'>/* a container for the devices found to have smart enabled */</span></td></tr> +<tr class="codeline" data-linenumber="69"><td class="num" id="LN69">69</td><td class="line">GHashTable *devices = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="70"><td class="num" id="LN70">70</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="71"><td class="num" id="LN71">71</td><td class="line"><span class='comment'>/* This is a global variable for convenience */</span></td></tr> +<tr class="codeline" data-linenumber="72"><td class="num" id="LN72">72</td><td class="line">GDBusConnection *connection = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="73"><td class="num" id="LN73">73</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="74"><td class="num" id="LN74">74</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> update_device (DevInfo *info) {</td></tr> +<tr class="codeline" data-linenumber="75"><td class="num" id="LN75">75</td><td class="line"> GError *error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="76"><td class="num" id="LN76">76</td><td class="line"> GVariant *tempgvar = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="77"><td class="num" id="LN77">77</td><td class="line"> GVariant *tempgvar2 = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="78"><td class="num" id="LN78">78</td><td class="line"> gdouble temp;</td></tr> +<tr class="codeline" data-linenumber="79"><td class="num" id="LN79">79</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="80"><td class="num" id="LN80">80</td><td class="line"> <span class='comment'>/* check valid input parameter */</span></td></tr> +<tr class="codeline" data-linenumber="81"><td class="num" id="LN81">81</td><td class="line"> <span class='macro'>g_return_if_fail (info != NULL)<span class='macro_popup'>do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_16<br>; if (info != ((void*)0)) _g_boolean_var_16 = 1; else _g_boolean_var_16<br> = 0; _g_boolean_var_16; }), 1))) { } else { g_return_if_fail_warning<br> ("sensors-applet", ((const char*) (__func__)), "info != NULL"<br>); return; } } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="82"><td class="num" id="LN82">82</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="83"><td class="num" id="LN83">83</td><td class="line"> <span class='comment'>/* check connection too */</span></td></tr> +<tr class="codeline" data-linenumber="84"><td class="num" id="LN84">84</td><td class="line"> <span class='macro'>g_return_if_fail (connection != NULL)<span class='macro_popup'>do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_17<br>; if (connection != ((void*)0)) _g_boolean_var_17 = 1; else _g_boolean_var_17<br> = 0; _g_boolean_var_17; }), 1))) { } else { g_return_if_fail_warning<br> ("sensors-applet", ((const char*) (__func__)), "connection != NULL"<br>); return; } } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="85"><td class="num" id="LN85">85</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="86"><td class="num" id="LN86">86</td><td class="line"> g_clear_error (&info->error);</td></tr> +<tr class="codeline" data-linenumber="87"><td class="num" id="LN87">87</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="88"><td class="num" id="LN88">88</td><td class="line"> <span class='comment'>/* check for sensor_proxy, which should exist at this point, make one if necessary and save it into DevInfo</span></td></tr> +<tr class="codeline" data-linenumber="89"><td class="num" id="LN89">89</td><td class="line"> <span class='comment'>* this is used to get the temp value the direct way */</span></td></tr> +<tr class="codeline" data-linenumber="90"><td class="num" id="LN90">90</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == info->sensor_proxy) {</td></tr> +<tr class="codeline" data-linenumber="91"><td class="num" id="LN91">91</td><td class="line"> info->sensor_proxy = g_dbus_proxy_new_sync (connection, G_DBUS_PROXY_FLAGS_NONE, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="92"><td class="num" id="LN92">92</td><td class="line"> <span class='macro'>UDISKS2_BUS_NAME<span class='macro_popup'>"org.freedesktop.UDisks2"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="93"><td class="num" id="LN93">93</td><td class="line"> info->path,</td></tr> +<tr class="codeline" data-linenumber="94"><td class="num" id="LN94">94</td><td class="line"> <span class='macro'>UDISKS2_PROPERTIES_INTERFACE<span class='macro_popup'>"org.freedesktop.DBus.Properties"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="95"><td class="num" id="LN95">95</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, &error);</td></tr> +<tr class="codeline" data-linenumber="96"><td class="num" id="LN96">96</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="97"><td class="num" id="LN97">97</td><td class="line"> <span class='comment'>/* check, just to be sure */</span></td></tr> +<tr class="codeline" data-linenumber="98"><td class="num" id="LN98">98</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == info->sensor_proxy) {</td></tr> +<tr class="codeline" data-linenumber="99"><td class="num" id="LN99">99</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="100"><td class="num" id="LN100">100</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="101"><td class="num" id="LN101">101</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Failed to get drive temperature 1"</span>);</td></tr> +<tr class="codeline" data-linenumber="102"><td class="num" id="LN102">102</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="103"><td class="num" id="LN103">103</td><td class="line"> g_debug (<span class='string_literal'>"Failed to get drive temperature 1: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="104"><td class="num" id="LN104">104</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="105"><td class="num" id="LN105">105</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="106"><td class="num" id="LN106">106</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="107"><td class="num" id="LN107">107</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="108"><td class="num" id="LN108">108</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="109"><td class="num" id="LN109">109</td><td class="line"><span class='comment'>/* note on timing:</span></td></tr> +<tr class="codeline" data-linenumber="110"><td class="num" id="LN110">110</td><td class="line"> <span class='comment'>* it seems to me that smart updates occur automatically every 10 minutes</span></td></tr> +<tr class="codeline" data-linenumber="111"><td class="num" id="LN111">111</td><td class="line"> <span class='comment'>* mate-sensor-applet has a default refresh of 2 seconds...</span></td></tr> +<tr class="codeline" data-linenumber="112"><td class="num" id="LN112">112</td><td class="line"> <span class='comment'>* it is possible to force a smart update with udisks2: SmartUpdate (IN a{sv} options); */</span></td></tr> +<tr class="codeline" data-linenumber="113"><td class="num" id="LN113">113</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="114"><td class="num" id="LN114">114</td><td class="line"> <span class='comment'>/* directly asking the device's DBus object for the temp */</span></td></tr> +<tr class="codeline" data-linenumber="115"><td class="num" id="LN115">115</td><td class="line"> tempgvar = g_dbus_proxy_call_sync (info->sensor_proxy, <span class='string_literal'>"Get"</span>,</td></tr> +<tr class="codeline" data-linenumber="116"><td class="num" id="LN116">116</td><td class="line"> g_variant_new (<span class='string_literal'>"(ss)"</span>,</td></tr> +<tr class="codeline" data-linenumber="117"><td class="num" id="LN117">117</td><td class="line"> <span class='macro'>UDISKS2_DEVICE_INTERFACE2_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive.Ata"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="118"><td class="num" id="LN118">118</td><td class="line"> <span class='string_literal'>"SmartTemperature"</span>), <span class='comment'>/* parameters */</span></td></tr> +<tr class="codeline" data-linenumber="119"><td class="num" id="LN119">119</td><td class="line"> G_DBUS_CALL_FLAGS_NONE, <span class='comment'>/* flags */</span></td></tr> +<tr class="codeline" data-linenumber="120"><td class="num" id="LN120">120</td><td class="line"> -1, <span class='comment'>/* timeout */</span></td></tr> +<tr class="codeline" data-linenumber="121"><td class="num" id="LN121">121</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='comment'>/* cancellable */</span></td></tr> +<tr class="codeline" data-linenumber="122"><td class="num" id="LN122">122</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="123"><td class="num" id="LN123">123</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="124"><td class="num" id="LN124">124</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == tempgvar) {</td></tr> +<tr class="codeline" data-linenumber="125"><td class="num" id="LN125">125</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="126"><td class="num" id="LN126">126</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="127"><td class="num" id="LN127">127</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Failed to get drive temperature 2"</span>);</td></tr> +<tr class="codeline" data-linenumber="128"><td class="num" id="LN128">128</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="129"><td class="num" id="LN129">129</td><td class="line"> g_debug (<span class='string_literal'>"Failed to get drive temperature 2: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="130"><td class="num" id="LN130">130</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="131"><td class="num" id="LN131">131</td><td class="line"> <span class='comment'>/* throw away proxy, maybe next time it will be better */</span></td></tr> +<tr class="codeline" data-linenumber="132"><td class="num" id="LN132">132</td><td class="line"> <span class='macro'>g_clear_object (&info->sensor_proxy)<span class='macro_popup'>do { _Static_assert (sizeof *((&info->sensor_proxy)) ==<br> sizeof (gpointer), "Expression evaluates to false"); __typeof__<br> (((&info->sensor_proxy))) _pp = ((&info->sensor_proxy<br>)); __typeof__ (*((&info->sensor_proxy))) _ptr = *_pp;<br> *_pp = ((void*)0); if (_ptr) (g_object_unref) (_ptr); } while<br> (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="133"><td class="num" id="LN133">133</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="134"><td class="num" id="LN134">134</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="135"><td class="num" id="LN135">135</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="136"><td class="num" id="LN136">136</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="137"><td class="num" id="LN137">137</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="138"><td class="num" id="LN138">138</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"tempgvar value: %s"</span>, g_variant_print(tempgvar, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="139"><td class="num" id="LN139">139</td><td class="line"><span class='comment'>/* leaks memory! */</span></td></tr> +<tr class="codeline" data-linenumber="140"><td class="num" id="LN140">140</td><td class="line"><span class='comment'>//syslog(LOG_ERR, "tempgvar value: %s", g_variant_print(g_variant_get_variant(g_variant_get_child_value(tempgvar, 0)), TRUE));</span></td></tr> +<tr class="codeline" data-linenumber="141"><td class="num" id="LN141">141</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="142"><td class="num" id="LN142">142</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="143"><td class="num" id="LN143">143</td><td class="line"> <span class='comment'>/* tempgvar comes back as something along the lines of array(gvariant(tempasdouble))</span></td></tr> +<tr class="codeline" data-linenumber="144"><td class="num" id="LN144">144</td><td class="line"> <span class='comment'>* hence unpacking</span></td></tr> +<tr class="codeline" data-linenumber="145"><td class="num" id="LN145">145</td><td class="line"> <span class='comment'>* need to free up every param / return value, so can't do it like:</span></td></tr> +<tr class="codeline" data-linenumber="146"><td class="num" id="LN146">146</td><td class="line"> <span class='comment'>* temp = g_variant_get_double(g_variant_get_variant(g_variant_get_child_value(tempgvar, 0))); */</span></td></tr> +<tr class="codeline" data-linenumber="147"><td class="num" id="LN147">147</td><td class="line"> tempgvar2 = g_variant_get_child_value (tempgvar, 0);</td></tr> +<tr class="codeline" data-linenumber="148"><td class="num" id="LN148">148</td><td class="line"> g_variant_unref (tempgvar);</td></tr> +<tr class="codeline" data-linenumber="149"><td class="num" id="LN149">149</td><td class="line"> tempgvar = g_variant_get_variant (tempgvar2);</td></tr> +<tr class="codeline" data-linenumber="150"><td class="num" id="LN150">150</td><td class="line"> g_variant_unref (tempgvar2);</td></tr> +<tr class="codeline" data-linenumber="151"><td class="num" id="LN151">151</td><td class="line"> temp = g_variant_get_double (tempgvar);</td></tr> +<tr class="codeline" data-linenumber="152"><td class="num" id="LN152">152</td><td class="line"> g_variant_unref (tempgvar);</td></tr> +<tr class="codeline" data-linenumber="153"><td class="num" id="LN153">153</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="154"><td class="num" id="LN154">154</td><td class="line"> <span class='comment'>/* temp in K */</span></td></tr> +<tr class="codeline" data-linenumber="155"><td class="num" id="LN155">155</td><td class="line"> info->temp = temp - 273.15;</td></tr> +<tr class="codeline" data-linenumber="156"><td class="num" id="LN156">156</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="157"><td class="num" id="LN157">157</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="158"><td class="num" id="LN158">158</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Refresh udisks2 device temp: '%f'\n"</span>, info->temp);</td></tr> +<tr class="codeline" data-linenumber="159"><td class="num" id="LN159">159</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="160"><td class="num" id="LN160">160</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="161"><td class="num" id="LN161">161</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="162"><td class="num" id="LN162">162</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="163"><td class="num" id="LN163">163</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="164"><td class="num" id="LN164">164</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="165"><td class="num" id="LN165">165</td><td class="line"><span class='comment'>/* in this function we would like to get a list of device (hdd/ssd) paths</span></td></tr> +<tr class="codeline" data-linenumber="166"><td class="num" id="LN166">166</td><td class="line"> <span class='comment'>* then with each path we get the temperature</span></td></tr> +<tr class="codeline" data-linenumber="167"><td class="num" id="LN167">167</td><td class="line"> <span class='comment'>* it is possible with udisks2 to get all the above information in one g_dbus_proxy_call_sync(), so that is how I did it</span></td></tr> +<tr class="codeline" data-linenumber="168"><td class="num" id="LN168">168</td><td class="line"> <span class='comment'>* maybe a better version would be to use GDBusObjectManager Server + Client ?? */</span></td></tr> +<tr class="codeline" data-linenumber="169"><td class="num" id="LN169">169</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> udisks2_plugin_get_sensors (GList **sensors) {</td></tr> +<tr class="codeline" data-linenumber="170"><td class="num" id="LN170">170</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="171"><td class="num" id="LN171">171</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="172"><td class="num" id="LN172">172</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"fstart"</span>);</td></tr> +<tr class="codeline" data-linenumber="173"><td class="num" id="LN173">173</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="174"><td class="num" id="LN174">174</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="175"><td class="num" id="LN175">175</td><td class="line"> GDBusProxy *proxy = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="176"><td class="num" id="LN176">176</td><td class="line"> GError *error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="177"><td class="num" id="LN177">177</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="178"><td class="num" id="LN178">178</td><td class="line"> DevInfo *info;</td></tr> +<tr class="codeline" data-linenumber="179"><td class="num" id="LN179">179</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="180"><td class="num" id="LN180">180</td><td class="line"> <span class='comment'>/* This connection will be used for everything, including the obtaining of sensor data */</span></td></tr> +<tr class="codeline" data-linenumber="181"><td class="num" id="LN181">181</td><td class="line"> connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, &error);</td></tr> +<tr class="codeline" data-linenumber="182"><td class="num" id="LN182">182</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == connection) {</td></tr> +<tr class="codeline" data-linenumber="183"><td class="num" id="LN183">183</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="184"><td class="num" id="LN184">184</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="185"><td class="num" id="LN185">185</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn fail"</span>);</td></tr> +<tr class="codeline" data-linenumber="186"><td class="num" id="LN186">186</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="187"><td class="num" id="LN187">187</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="188"><td class="num" id="LN188">188</td><td class="line"> g_debug (<span class='string_literal'>"Failed to open connection to DBUS: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="189"><td class="num" id="LN189">189</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="190"><td class="num" id="LN190">190</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="191"><td class="num" id="LN191">191</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="192"><td class="num" id="LN192">192</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="193"><td class="num" id="LN193">193</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="194"><td class="num" id="LN194">194</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn success"</span>);</td></tr> +<tr class="codeline" data-linenumber="195"><td class="num" id="LN195">195</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="196"><td class="num" id="LN196">196</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="197"><td class="num" id="LN197">197</td><td class="line"> <span class='comment'>/* I use this proxy to get all info of all devices at once */</span></td></tr> +<tr class="codeline" data-linenumber="198"><td class="num" id="LN198">198</td><td class="line"> proxy = g_dbus_proxy_new_sync (connection, G_DBUS_PROXY_FLAGS_NONE, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="199"><td class="num" id="LN199">199</td><td class="line"> <span class='macro'>UDISKS2_BUS_NAME<span class='macro_popup'>"org.freedesktop.UDisks2"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="200"><td class="num" id="LN200">200</td><td class="line"> <span class='macro'>UDISKS2_OBJECT_PATH<span class='macro_popup'>"/org/freedesktop/UDisks2"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="201"><td class="num" id="LN201">201</td><td class="line"> <span class='macro'>UDISKS2_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.DBus.ObjectManager"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="202"><td class="num" id="LN202">202</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, &error);</td></tr> +<tr class="codeline" data-linenumber="203"><td class="num" id="LN203">203</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="204"><td class="num" id="LN204">204</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == proxy) {</td></tr> +<tr class="codeline" data-linenumber="205"><td class="num" id="LN205">205</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="206"><td class="num" id="LN206">206</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="207"><td class="num" id="LN207">207</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn proxy fail"</span>);</td></tr> +<tr class="codeline" data-linenumber="208"><td class="num" id="LN208">208</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="209"><td class="num" id="LN209">209</td><td class="line"> g_debug (<span class='string_literal'>"dbus conn proxy fail: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="210"><td class="num" id="LN210">210</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="211"><td class="num" id="LN211">211</td><td class="line"> <span class='macro'>g_clear_object (&connection)<span class='macro_popup'>do { _Static_assert (sizeof *((&connection)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&connection<br>))) _pp = ((&connection)); __typeof__ (*((&connection<br>))) _ptr = *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref<br>) (_ptr); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="212"><td class="num" id="LN212">212</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="213"><td class="num" id="LN213">213</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="214"><td class="num" id="LN214">214</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="215"><td class="num" id="LN215">215</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="216"><td class="num" id="LN216">216</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn proxy success"</span>);</td></tr> +<tr class="codeline" data-linenumber="217"><td class="num" id="LN217">217</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="218"><td class="num" id="LN218">218</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="219"><td class="num" id="LN219">219</td><td class="line"> <span class='comment'>/* The object paths of the disks are enumerated and placed in an array of object paths</span></td></tr> +<tr class="codeline" data-linenumber="220"><td class="num" id="LN220">220</td><td class="line"> <span class='comment'>* "GetManagedObjects" returns dict of (objectpath, (dict of (string [ie. if. name], dict of(string [ie. property name], variant [ie. prop. value])))) */</span></td></tr> +<tr class="codeline" data-linenumber="221"><td class="num" id="LN221">221</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="222"><td class="num" id="LN222">222</td><td class="line"> <span class='comment'>/* g_dbus_proxy_call_sync() returns NULL on error, GVariant * otherwise</span></td></tr> +<tr class="codeline" data-linenumber="223"><td class="num" id="LN223">223</td><td class="line"> <span class='comment'>* need second variable to prevent memory leak */</span></td></tr> +<tr class="codeline" data-linenumber="224"><td class="num" id="LN224">224</td><td class="line"> GVariant *managed_objects = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="225"><td class="num" id="LN225">225</td><td class="line"> GVariant *managed_objects2 = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="226"><td class="num" id="LN226">226</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="227"><td class="num" id="LN227">227</td><td class="line"> managed_objects2 = g_dbus_proxy_call_sync (proxy, <span class='string_literal'>"GetManagedObjects"</span>,</td></tr> +<tr class="codeline" data-linenumber="228"><td class="num" id="LN228">228</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='comment'>/* parameters */</span></td></tr> +<tr class="codeline" data-linenumber="229"><td class="num" id="LN229">229</td><td class="line"> G_DBUS_CALL_FLAGS_NONE, <span class='comment'>/* flags */</span></td></tr> +<tr class="codeline" data-linenumber="230"><td class="num" id="LN230">230</td><td class="line"> -1, <span class='comment'>/* timeout */</span></td></tr> +<tr class="codeline" data-linenumber="231"><td class="num" id="LN231">231</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='comment'>/* cancellable */</span></td></tr> +<tr class="codeline" data-linenumber="232"><td class="num" id="LN232">232</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="233"><td class="num" id="LN233">233</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="234"><td class="num" id="LN234">234</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == managed_objects2) {</td></tr> +<tr class="codeline" data-linenumber="235"><td class="num" id="LN235">235</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="236"><td class="num" id="LN236">236</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="237"><td class="num" id="LN237">237</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Failed to enumerate disk devices"</span>);</td></tr> +<tr class="codeline" data-linenumber="238"><td class="num" id="LN238">238</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="239"><td class="num" id="LN239">239</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="240"><td class="num" id="LN240">240</td><td class="line"> g_debug (<span class='string_literal'>"Failed to enumerate disk devices: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="241"><td class="num" id="LN241">241</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="242"><td class="num" id="LN242">242</td><td class="line"> <span class='macro'>g_clear_object (&proxy)<span class='macro_popup'>do { _Static_assert (sizeof *((&proxy)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&proxy<br>))) _pp = ((&proxy)); __typeof__ (*((&proxy))) _ptr =<br> *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref) (_ptr); }<br> while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="243"><td class="num" id="LN243">243</td><td class="line"> <span class='macro'>g_clear_object (&connection)<span class='macro_popup'>do { _Static_assert (sizeof *((&connection)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&connection<br>))) _pp = ((&connection)); __typeof__ (*((&connection<br>))) _ptr = *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref<br>) (_ptr); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="244"><td class="num" id="LN244">244</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="245"><td class="num" id="LN245">245</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="246"><td class="num" id="LN246">246</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="247"><td class="num" id="LN247">247</td><td class="line"> <span class='comment'>/* the result dictionary is enclosed in an array, unpack */</span></td></tr> +<tr class="codeline" data-linenumber="248"><td class="num" id="LN248">248</td><td class="line"> managed_objects = g_variant_get_child_value (managed_objects2, 0);</td></tr> +<tr class="codeline" data-linenumber="249"><td class="num" id="LN249">249</td><td class="line"> g_variant_unref (managed_objects2);</td></tr> +<tr class="codeline" data-linenumber="250"><td class="num" id="LN250">250</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="251"><td class="num" id="LN251">251</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="252"><td class="num" id="LN252">252</td><td class="line"><span class='comment'>//syslog(LOG_ERR, "managed_objects type: %s", g_variant_print(managed_objects, TRUE));</span></td></tr> +<tr class="codeline" data-linenumber="253"><td class="num" id="LN253">253</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"success to enumerate disk devices"</span>);</td></tr> +<tr class="codeline" data-linenumber="254"><td class="num" id="LN254">254</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="255"><td class="num" id="LN255">255</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="256"><td class="num" id="LN256">256</td><td class="line"> <span class='comment'>/* iterator for the result dictionary</span></td></tr> +<tr class="codeline" data-linenumber="257"><td class="num" id="LN257">257</td><td class="line"> <span class='comment'>* iterator code is based on the g_variant_iter_next() documentation</span></td></tr> +<tr class="codeline" data-linenumber="258"><td class="num" id="LN258">258</td><td class="line"> <span class='comment'>* iter is freed if the GVariant is, when using g_variant_iter_init() */</span></td></tr> +<tr class="codeline" data-linenumber="259"><td class="num" id="LN259">259</td><td class="line"> GVariantIter iter;</td></tr> +<tr class="codeline" data-linenumber="260"><td class="num" id="LN260">260</td><td class="line"> gchar *key = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; <span class='comment'>/* object path (like '/org/freedesktop/UDisks2/drives/Samsung_SSD_840_EVO_250GB_*insert drive serial nr.*') */</span></td></tr> +<tr class="codeline" data-linenumber="261"><td class="num" id="LN261">261</td><td class="line"> GVariant *value = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="262"><td class="num" id="LN262">262</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="263"><td class="num" id="LN263">263</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="264"><td class="num" id="LN264">264</td><td class="line"><span class='comment'>/* log collection size */</span></td></tr> +<tr class="codeline" data-linenumber="265"><td class="num" id="LN265">265</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"iter init count: %d"</span>, (<span class='keyword'>int</span>) g_variant_iter_init (&iter, managed_objects));</td></tr> +<tr class="codeline" data-linenumber="266"><td class="num" id="LN266">266</td><td class="line"><span class='directive'>#else</span></td></tr> +<tr class="codeline" data-linenumber="267"><td class="num" id="LN267">267</td><td class="line"> g_variant_iter_init (&iter, managed_objects);</td></tr> +<tr class="codeline" data-linenumber="268"><td class="num" id="LN268">268</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="269"><td class="num" id="LN269">269</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="270"><td class="num" id="LN270">270</td><td class="line"> <span class='comment'>/* "{sv}" is a GVariant format string</span></td></tr> +<tr class="codeline" data-linenumber="271"><td class="num" id="LN271">271</td><td class="line"> <span class='comment'>* {} dictionary of, s string, v GVariant</span></td></tr> +<tr class="codeline" data-linenumber="272"><td class="num" id="LN272">272</td><td class="line"> <span class='comment'>* changed to "{oa{sa{sv}}}" on error message 'the GVariant format string '{sv}' has a type of '{sv}' but the given value has a type of 'a{oa{sa{sv}}}''</span></td></tr> +<tr class="codeline" data-linenumber="273"><td class="num" id="LN273">273</td><td class="line"> <span class='comment'>* a is array, o is object path</span></td></tr> +<tr class="codeline" data-linenumber="274"><td class="num" id="LN274">274</td><td class="line"> <span class='comment'>* NOO!! the right format string is "{o@*}", which means get an object path into the 1st variable (key)</span></td></tr> +<tr class="codeline" data-linenumber="275"><td class="num" id="LN275">275</td><td class="line"> <span class='comment'>* and get 'everything else' (as a GVariant) into the 2nd variable (value)</span></td></tr> +<tr class="codeline" data-linenumber="276"><td class="num" id="LN276">276</td><td class="line"> <span class='comment'>* needs the & before the key and value params! */</span></td></tr> +<tr class="codeline" data-linenumber="277"><td class="num" id="LN277">277</td><td class="line"> <span class='keyword'>while</span> (g_variant_iter_next (&iter, <span class='string_literal'>"{o@*}"</span>, &key, &value)) {</td></tr> +<tr class="codeline" data-linenumber="278"><td class="num" id="LN278">278</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="279"><td class="num" id="LN279">279</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="280"><td class="num" id="LN280">280</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"in iter while loop"</span>);</td></tr> +<tr class="codeline" data-linenumber="281"><td class="num" id="LN281">281</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"key value: %s"</span>, key);</td></tr> +<tr class="codeline" data-linenumber="282"><td class="num" id="LN282">282</td><td class="line"><span class='comment'>//syslog(LOG_ERR, "value type: %s", g_variant_print(value, TRUE));</span></td></tr> +<tr class="codeline" data-linenumber="283"><td class="num" id="LN283">283</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="284"><td class="num" id="LN284">284</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="285"><td class="num" id="LN285">285</td><td class="line"> <span class='comment'>/* level 2</span></td></tr> +<tr class="codeline" data-linenumber="286"><td class="num" id="LN286">286</td><td class="line"> <span class='comment'>* create a dictionary of value</span></td></tr> +<tr class="codeline" data-linenumber="287"><td class="num" id="LN287">287</td><td class="line"> <span class='comment'>* the two interface names that we are searching for are known and defined</span></td></tr> +<tr class="codeline" data-linenumber="288"><td class="num" id="LN288">288</td><td class="line"> <span class='comment'>* can't use GVariantDict, it only supports '{sv}' but the given value has a type of '{sa{sv}}'</span></td></tr> +<tr class="codeline" data-linenumber="289"><td class="num" id="LN289">289</td><td class="line"> <span class='comment'>* using general lookup */</span></td></tr> +<tr class="codeline" data-linenumber="290"><td class="num" id="LN290">290</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="291"><td class="num" id="LN291">291</td><td class="line"> GVariant *propdict = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; <span class='comment'>/* drive data */</span></td></tr> +<tr class="codeline" data-linenumber="292"><td class="num" id="LN292">292</td><td class="line"> GVariant *propdict2 = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; <span class='comment'>/* drive smart data */</span></td></tr> +<tr class="codeline" data-linenumber="293"><td class="num" id="LN293">293</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="294"><td class="num" id="LN294">294</td><td class="line"> <span class='comment'>/* make two dictionaries that contain the properties of the drive interfaces */</span></td></tr> +<tr class="codeline" data-linenumber="295"><td class="num" id="LN295">295</td><td class="line"> propdict = g_variant_lookup_value (value, <span class='macro'>UDISKS2_DEVICE_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive"</span></span>, <span class='macro'>G_VARIANT_TYPE_DICTIONARY<span class='macro_popup'>((const GVariantType *) "a{?*}")</span></span>);</td></tr> +<tr class="codeline" data-linenumber="296"><td class="num" id="LN296">296</td><td class="line"> propdict2 = g_variant_lookup_value (value, <span class='macro'>UDISKS2_DEVICE_INTERFACE2_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive.Ata"</span></span>, <span class='macro'>G_VARIANT_TYPE_DICTIONARY<span class='macro_popup'>((const GVariantType *) "a{?*}")</span></span>);</td></tr> +<tr class="codeline" data-linenumber="297"><td class="num" id="LN297">297</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="298"><td class="num" id="LN298">298</td><td class="line"> <span class='comment'>/* do we have the right ifname keys? */</span></td></tr> +<tr class="codeline" data-linenumber="299"><td class="num" id="LN299">299</td><td class="line"> <span class='keyword'>if</span> ((<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict) && (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict2)) {</td></tr> +<tr class="codeline" data-linenumber="300"><td class="num" id="LN300">300</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="301"><td class="num" id="LN301">301</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="302"><td class="num" id="LN302">302</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"propdict type: %s"</span>, g_variant_print(propdict, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="303"><td class="num" id="LN303">303</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"propdict2 type: %s"</span>, g_variant_print(propdict2, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="304"><td class="num" id="LN304">304</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="305"><td class="num" id="LN305">305</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="306"><td class="num" id="LN306">306</td><td class="line"> <span class='comment'>/* get data */</span></td></tr> +<tr class="codeline" data-linenumber="307"><td class="num" id="LN307">307</td><td class="line"> gchar *id = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="308"><td class="num" id="LN308">308</td><td class="line"> gchar *model = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="309"><td class="num" id="LN309">309</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="310"><td class="num" id="LN310">310</td><td class="line"> gboolean smartenabled;</td></tr> +<tr class="codeline" data-linenumber="311"><td class="num" id="LN311">311</td><td class="line"> gdouble temp;</td></tr> +<tr class="codeline" data-linenumber="312"><td class="num" id="LN312">312</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="313"><td class="num" id="LN313">313</td><td class="line"> <span class='comment'>/* NULL, bc we don't care about the length of the string</span></td></tr> +<tr class="codeline" data-linenumber="314"><td class="num" id="LN314">314</td><td class="line"> <span class='comment'>* typecast bc g_variant_get_string() returns const char* */</span></td></tr> +<tr class="codeline" data-linenumber="315"><td class="num" id="LN315">315</td><td class="line"> id = (gchar *) g_variant_get_string (g_variant_lookup_value (propdict, <span class='string_literal'>"Id"</span>, <span class="mrange"><span class="mrange"><span class='macro'>G_VARIANT_TYPE_STRING<span class='macro_popup'>((const GVariantType *) "s")</span></span></span></span>), <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr><td class="num"></td><td class="line"><div id="EndPath" class="msg msgEvent" style="margin-left:90ex; max-width:31em">Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption</div></td></tr> +<tr class="codeline" data-linenumber="316"><td class="num" id="LN316">316</td><td class="line"> model = (gchar *) g_variant_get_string (g_variant_lookup_value (propdict, <span class='string_literal'>"Model"</span>, <span class='macro'>G_VARIANT_TYPE_STRING<span class='macro_popup'>((const GVariantType *) "s")</span></span>), <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="317"><td class="num" id="LN317">317</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="318"><td class="num" id="LN318">318</td><td class="line"> smartenabled = g_variant_get_boolean (g_variant_lookup_value (propdict2, <span class='string_literal'>"SmartEnabled"</span>, <span class='macro'>G_VARIANT_TYPE_BOOLEAN<span class='macro_popup'>((const GVariantType *) "b")</span></span>));</td></tr> +<tr class="codeline" data-linenumber="319"><td class="num" id="LN319">319</td><td class="line"> temp = g_variant_get_double (g_variant_lookup_value (propdict2, <span class='string_literal'>"SmartTemperature"</span>, <span class='macro'>G_VARIANT_TYPE_DOUBLE<span class='macro_popup'>((const GVariantType *) "d")</span></span>));</td></tr> +<tr class="codeline" data-linenumber="320"><td class="num" id="LN320">320</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="321"><td class="num" id="LN321">321</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="322"><td class="num" id="LN322">322</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device id: '%s'\n"</span>, id);</td></tr> +<tr class="codeline" data-linenumber="323"><td class="num" id="LN323">323</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device model: '%s'\n"</span>, model);</td></tr> +<tr class="codeline" data-linenumber="324"><td class="num" id="LN324">324</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device smartenabled: '%d'\n"</span>, smartenabled);</td></tr> +<tr class="codeline" data-linenumber="325"><td class="num" id="LN325">325</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device temp: '%f'\n"</span>, temp);</td></tr> +<tr class="codeline" data-linenumber="326"><td class="num" id="LN326">326</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="327"><td class="num" id="LN327">327</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="328"><td class="num" id="LN328">328</td><td class="line"> <span class='comment'>/* only go on if smart is enabled</span></td></tr> +<tr class="codeline" data-linenumber="329"><td class="num" id="LN329">329</td><td class="line"> <span class='comment'>* save data */</span></td></tr> +<tr class="codeline" data-linenumber="330"><td class="num" id="LN330">330</td><td class="line"> <span class='keyword'>if</span> (smartenabled) {</td></tr> +<tr class="codeline" data-linenumber="331"><td class="num" id="LN331">331</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="332"><td class="num" id="LN332">332</td><td class="line"> info = <span class='macro'>g_new0 (DevInfo, 1)<span class='macro_popup'>(DevInfo *) (__extension__ ({ gsize __n = (gsize) (1); gsize __s<br> = sizeof (DevInfo); gpointer __p; if (__s == 1) __p = g_malloc0<br> (__n); else if (__builtin_constant_p (__n) && (__s ==<br> 0 || __n <= (9223372036854775807L *2UL+1UL) / __s)) __p =<br> g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s); __p<br>; }))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="333"><td class="num" id="LN333">333</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == devices) {</td></tr> +<tr class="codeline" data-linenumber="334"><td class="num" id="LN334">334</td><td class="line"> devices = g_hash_table_new (g_str_hash, g_str_equal);</td></tr> +<tr class="codeline" data-linenumber="335"><td class="num" id="LN335">335</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="336"><td class="num" id="LN336">336</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="337"><td class="num" id="LN337">337</td><td class="line"> info->id = <span class='macro'>g_strdup (id)<span class='macro_popup'>g_strdup_inline (id)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="338"><td class="num" id="LN338">338</td><td class="line"> info->path = <span class='macro'>g_strdup (key)<span class='macro_popup'>g_strdup_inline (key)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="339"><td class="num" id="LN339">339</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="340"><td class="num" id="LN340">340</td><td class="line"> <span class='comment'>/* temp in K</span></td></tr> +<tr class="codeline" data-linenumber="341"><td class="num" id="LN341">341</td><td class="line"> <span class='comment'>* this could be left at 0.0, 2 seconds later it will be refreshed anyway */</span></td></tr> +<tr class="codeline" data-linenumber="342"><td class="num" id="LN342">342</td><td class="line"> info->temp = (gdouble) temp - 273.15;</td></tr> +<tr class="codeline" data-linenumber="343"><td class="num" id="LN343">343</td><td class="line"> g_hash_table_insert (devices, info->id, info);</td></tr> +<tr class="codeline" data-linenumber="344"><td class="num" id="LN344">344</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="345"><td class="num" id="LN345">345</td><td class="line"> <span class='comment'>/* Write the sensor data */</span></td></tr> +<tr class="codeline" data-linenumber="346"><td class="num" id="LN346">346</td><td class="line"> sensors_applet_plugin_add_sensor (sensors,</td></tr> +<tr class="codeline" data-linenumber="347"><td class="num" id="LN347">347</td><td class="line"> id,</td></tr> +<tr class="codeline" data-linenumber="348"><td class="num" id="LN348">348</td><td class="line"> <span class='string_literal'>"Disk Temperature"</span>,</td></tr> +<tr class="codeline" data-linenumber="349"><td class="num" id="LN349">349</td><td class="line"> model,</td></tr> +<tr class="codeline" data-linenumber="350"><td class="num" id="LN350">350</td><td class="line"> TEMP_SENSOR,</td></tr> +<tr class="codeline" data-linenumber="351"><td class="num" id="LN351">351</td><td class="line"> <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="352"><td class="num" id="LN352">352</td><td class="line"> HDD_ICON,</td></tr> +<tr class="codeline" data-linenumber="353"><td class="num" id="LN353">353</td><td class="line"> <span class='macro'>DEFAULT_GRAPH_COLOR<span class='macro_popup'>"#ff0000"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="354"><td class="num" id="LN354">354</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="355"><td class="num" id="LN355">355</td><td class="line"> g_debug (<span class='string_literal'>"Added %s"</span>, id);</td></tr> +<tr class="codeline" data-linenumber="356"><td class="num" id="LN356">356</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="357"><td class="num" id="LN357">357</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="358"><td class="num" id="LN358">358</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Added %s"</span>, id);</td></tr> +<tr class="codeline" data-linenumber="359"><td class="num" id="LN359">359</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="360"><td class="num" id="LN360">360</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="361"><td class="num" id="LN361">361</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="362"><td class="num" id="LN362">362</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="363"><td class="num" id="LN363">363</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="364"><td class="num" id="LN364">364</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"No temp data for device: %s\n"</span>, key);</td></tr> +<tr class="codeline" data-linenumber="365"><td class="num" id="LN365">365</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="366"><td class="num" id="LN366">366</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="367"><td class="num" id="LN367">367</td><td class="line"> g_debug (<span class='string_literal'>"No temp data for device: %s\n"</span>, key);</td></tr> +<tr class="codeline" data-linenumber="368"><td class="num" id="LN368">368</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="369"><td class="num" id="LN369">369</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="370"><td class="num" id="LN370">370</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="371"><td class="num" id="LN371">371</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"b4 free1"</span>);</td></tr> +<tr class="codeline" data-linenumber="372"><td class="num" id="LN372">372</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="373"><td class="num" id="LN373">373</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="374"><td class="num" id="LN374">374</td><td class="line"> g_free (id);</td></tr> +<tr class="codeline" data-linenumber="375"><td class="num" id="LN375">375</td><td class="line"> g_free (model);</td></tr> +<tr class="codeline" data-linenumber="376"><td class="num" id="LN376">376</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="377"><td class="num" id="LN377">377</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="378"><td class="num" id="LN378">378</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="379"><td class="num" id="LN379">379</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="380"><td class="num" id="LN380">380</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"b4 free2"</span>);</td></tr> +<tr class="codeline" data-linenumber="381"><td class="num" id="LN381">381</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="382"><td class="num" id="LN382">382</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="383"><td class="num" id="LN383">383</td><td class="line"> <span class='comment'>/* free propdict, propdict2</span></td></tr> +<tr class="codeline" data-linenumber="384"><td class="num" id="LN384">384</td><td class="line"> <span class='comment'>* g_variant_dict_unref() may not work a few times, gives error</span></td></tr> +<tr class="codeline" data-linenumber="385"><td class="num" id="LN385">385</td><td class="line"> <span class='comment'>* this one seems to do fine */</span></td></tr> +<tr class="codeline" data-linenumber="386"><td class="num" id="LN386">386</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict) {g_variant_unref (propdict);}</td></tr> +<tr class="codeline" data-linenumber="387"><td class="num" id="LN387">387</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict2) {g_variant_unref (propdict2);}</td></tr> +<tr class="codeline" data-linenumber="388"><td class="num" id="LN388">388</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="389"><td class="num" id="LN389">389</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="390"><td class="num" id="LN390">390</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"b4 free3"</span>);</td></tr> +<tr class="codeline" data-linenumber="391"><td class="num" id="LN391">391</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="392"><td class="num" id="LN392">392</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="393"><td class="num" id="LN393">393</td><td class="line"> g_free (key);</td></tr> +<tr class="codeline" data-linenumber="394"><td class="num" id="LN394">394</td><td class="line"> g_variant_unref (value);</td></tr> +<tr class="codeline" data-linenumber="395"><td class="num" id="LN395">395</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="396"><td class="num" id="LN396">396</td><td class="line"> } <span class='comment'>/* end of while loop */</span></td></tr> +<tr class="codeline" data-linenumber="397"><td class="num" id="LN397">397</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="398"><td class="num" id="LN398">398</td><td class="line"> g_variant_unref (managed_objects);</td></tr> +<tr class="codeline" data-linenumber="399"><td class="num" id="LN399">399</td><td class="line"> <span class='macro'>g_clear_object (&proxy)<span class='macro_popup'>do { _Static_assert (sizeof *((&proxy)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&proxy<br>))) _pp = ((&proxy)); __typeof__ (*((&proxy))) _ptr =<br> *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref) (_ptr); }<br> while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="400"><td class="num" id="LN400">400</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == devices) {</td></tr> +<tr class="codeline" data-linenumber="401"><td class="num" id="LN401">401</td><td class="line"> <span class='macro'>g_clear_object (&connection)<span class='macro_popup'>do { _Static_assert (sizeof *((&connection)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&connection<br>))) _pp = ((&connection)); __typeof__ (*((&connection<br>))) _ptr = *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref<br>) (_ptr); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="402"><td class="num" id="LN402">402</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="403"><td class="num" id="LN403">403</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="404"><td class="num" id="LN404">404</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="405"><td class="num" id="LN405">405</td><td class="line"><span class='comment'>/* this function is called every refresh cycle */</span></td></tr> +<tr class="codeline" data-linenumber="406"><td class="num" id="LN406">406</td><td class="line"><span class='keyword'>static</span> gdouble udisks2_plugin_get_sensor_value (<span class='keyword'>const</span> gchar *path,</td></tr> +<tr class="codeline" data-linenumber="407"><td class="num" id="LN407">407</td><td class="line"> <span class='keyword'>const</span> gchar *id,</td></tr> +<tr class="codeline" data-linenumber="408"><td class="num" id="LN408">408</td><td class="line"> SensorType type,</td></tr> +<tr class="codeline" data-linenumber="409"><td class="num" id="LN409">409</td><td class="line"> GError **error) {</td></tr> +<tr class="codeline" data-linenumber="410"><td class="num" id="LN410">410</td><td class="line"> DevInfo *info = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="411"><td class="num" id="LN411">411</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="412"><td class="num" id="LN412">412</td><td class="line"> <span class='comment'>/* get device stuct from data store */</span></td></tr> +<tr class="codeline" data-linenumber="413"><td class="num" id="LN413">413</td><td class="line"> info = (DevInfo *) g_hash_table_lookup (devices, path);</td></tr> +<tr class="codeline" data-linenumber="414"><td class="num" id="LN414">414</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == info) {</td></tr> +<tr class="codeline" data-linenumber="415"><td class="num" id="LN415">415</td><td class="line"> g_set_error (error, <span class='macro'>SENSORS_APPLET_PLUGIN_ERROR<span class='macro_popup'>(sensors_applet_plugin_error_quark())</span></span>, 0, <span class='string_literal'>"Error finding disk with path %s"</span>, path);</td></tr> +<tr class="codeline" data-linenumber="416"><td class="num" id="LN416">416</td><td class="line"> <span class='keyword'>return</span> 0.0;</td></tr> +<tr class="codeline" data-linenumber="417"><td class="num" id="LN417">417</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="418"><td class="num" id="LN418">418</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="419"><td class="num" id="LN419">419</td><td class="line"> <span class='keyword'>if</span> (info->error) {</td></tr> +<tr class="codeline" data-linenumber="420"><td class="num" id="LN420">420</td><td class="line"> *error = info->error;</td></tr> +<tr class="codeline" data-linenumber="421"><td class="num" id="LN421">421</td><td class="line"> info->error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="422"><td class="num" id="LN422">422</td><td class="line"> <span class='keyword'>return</span> 0.0;</td></tr> +<tr class="codeline" data-linenumber="423"><td class="num" id="LN423">423</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="424"><td class="num" id="LN424">424</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="425"><td class="num" id="LN425">425</td><td class="line"> <span class='comment'>/* refresh device temp */</span></td></tr> +<tr class="codeline" data-linenumber="426"><td class="num" id="LN426">426</td><td class="line"> update_device (info);</td></tr> +<tr class="codeline" data-linenumber="427"><td class="num" id="LN427">427</td><td class="line"> <span class='keyword'>return</span> info->temp;</td></tr> +<tr class="codeline" data-linenumber="428"><td class="num" id="LN428">428</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="429"><td class="num" id="LN429">429</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="430"><td class="num" id="LN430">430</td><td class="line"><span class='comment'>/* API functions */</span></td></tr> +<tr class="codeline" data-linenumber="431"><td class="num" id="LN431">431</td><td class="line"><span class='keyword'>const</span> gchar *sensors_applet_plugin_name (<span class='keyword'>void</span>) {</td></tr> +<tr class="codeline" data-linenumber="432"><td class="num" id="LN432">432</td><td class="line"> <span class='keyword'>return</span> plugin_name;</td></tr> +<tr class="codeline" data-linenumber="433"><td class="num" id="LN433">433</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="434"><td class="num" id="LN434">434</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="435"><td class="num" id="LN435">435</td><td class="line"><span class='keyword'>static</span> GList *udisks2_plugin_init (<span class='keyword'>void</span>) {</td></tr> +<tr class="codeline" data-linenumber="436"><td class="num" id="LN436">436</td><td class="line"> GList *sensors = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="437"><td class="num" id="LN437">437</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="438"><td class="num" id="LN438">438</td><td class="line"> udisks2_plugin_get_sensors (&sensors);</td></tr> +<tr class="codeline" data-linenumber="439"><td class="num" id="LN439">439</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="440"><td class="num" id="LN440">440</td><td class="line"> <span class='keyword'>return</span> sensors;</td></tr> +<tr class="codeline" data-linenumber="441"><td class="num" id="LN441">441</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="442"><td class="num" id="LN442">442</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="443"><td class="num" id="LN443">443</td><td class="line">GList *sensors_applet_plugin_init (<span class='keyword'>void</span>) {</td></tr> +<tr class="codeline" data-linenumber="444"><td class="num" id="LN444">444</td><td class="line"> <span class='keyword'>return</span> udisks2_plugin_init ();</td></tr> +<tr class="codeline" data-linenumber="445"><td class="num" id="LN445">445</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="446"><td class="num" id="LN446">446</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="447"><td class="num" id="LN447">447</td><td class="line">gdouble sensors_applet_plugin_get_sensor_value (<span class='keyword'>const</span> gchar *path,</td></tr> +<tr class="codeline" data-linenumber="448"><td class="num" id="LN448">448</td><td class="line"> <span class='keyword'>const</span> gchar *id,</td></tr> +<tr class="codeline" data-linenumber="449"><td class="num" id="LN449">449</td><td class="line"> SensorType type,</td></tr> +<tr class="codeline" data-linenumber="450"><td class="num" id="LN450">450</td><td class="line"> GError **error) {</td></tr> +<tr class="codeline" data-linenumber="451"><td class="num" id="LN451">451</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="452"><td class="num" id="LN452">452</td><td class="line"> <span class='keyword'>return</span> udisks2_plugin_get_sensor_value (path, id, type, error);</td></tr> +<tr class="codeline" data-linenumber="453"><td class="num" id="LN453">453</td><td class="line">}</td></tr> +</table></body></html> diff --git a/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-1e32d3.html b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-1e32d3.html new file mode 100644 index 0000000..ed82c68 --- /dev/null +++ b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-1e32d3.html @@ -0,0 +1,1133 @@ +<!doctype html> +<html> +<head> +<title>udisks2-plugin.c</title> + +<style type="text/css"> +body { color:#000000; background-color:#ffffff } +body { font-family:Helvetica, sans-serif; font-size:10pt } +h1 { font-size:14pt } +.FileName { margin-top: 5px; margin-bottom: 5px; display: inline; } +.FileNav { margin-left: 5px; margin-right: 5px; display: inline; } +.FileNav a { text-decoration:none; font-size: larger; } +.divider { margin-top: 30px; margin-bottom: 30px; height: 15px; } +.divider { background-color: gray; } +.code { border-collapse:collapse; width:100%; } +.code { font-family: "Monospace", monospace; font-size:10pt } +.code { line-height: 1.2em } +.comment { color: green; font-style: oblique } +.keyword { color: blue } +.string_literal { color: red } +.directive { color: darkmagenta } + +/* Macros and variables could have pop-up notes hidden by default. + - Macro pop-up: expansion of the macro + - Variable pop-up: value (table) of the variable */ +.macro_popup, .variable_popup { display: none; } + +/* Pop-up appears on mouse-hover event. */ +.macro:hover .macro_popup, .variable:hover .variable_popup { + display: block; + padding: 2px; + -webkit-border-radius:5px; + -webkit-box-shadow:1px 1px 7px #000; + border-radius:5px; + box-shadow:1px 1px 7px #000; + position: absolute; + top: -1em; + left:10em; + z-index: 1 +} + +.macro_popup { + border: 2px solid red; + background-color:#FFF0F0; + font-weight: normal; +} + +.variable_popup { + border: 2px solid blue; + background-color:#F0F0FF; + font-weight: bold; + font-family: Helvetica, sans-serif; + font-size: 9pt; +} + +/* Pop-up notes needs a relative position as a base where they pops up. */ +.macro, .variable { + background-color: PaleGoldenRod; + position: relative; +} +.macro { color: DarkMagenta; } + +#tooltiphint { + position: fixed; + width: 50em; + margin-left: -25em; + left: 50%; + padding: 10px; + border: 1px solid #b0b0b0; + border-radius: 2px; + box-shadow: 1px 1px 7px black; + background-color: #c0c0c0; + z-index: 2; +} + +.num { width:2.5em; padding-right:2ex; background-color:#eeeeee } +.num { text-align:right; font-size:8pt } +.num { color:#444444 } +.line { padding-left: 1ex; border-left: 3px solid #ccc } +.line { white-space: pre } +.msg { -webkit-box-shadow:1px 1px 7px #000 } +.msg { box-shadow:1px 1px 7px #000 } +.msg { -webkit-border-radius:5px } +.msg { border-radius:5px } +.msg { font-family:Helvetica, sans-serif; font-size:8pt } +.msg { float:left } +.msg { position:relative } +.msg { padding:0.25em 1ex 0.25em 1ex } +.msg { margin-top:10px; margin-bottom:10px } +.msg { font-weight:bold } +.msg { max-width:60em; word-wrap: break-word; white-space: pre-wrap } +.msgT { padding:0x; spacing:0x } +.msgEvent { background-color:#fff8b4; color:#000000 } +.msgControl { background-color:#bbbbbb; color:#000000 } +.msgNote { background-color:#ddeeff; color:#000000 } +.mrange { background-color:#dfddf3 } +.mrange { border-bottom:1px solid #6F9DBE } +.PathIndex { font-weight: bold; padding:0px 5px; margin-right:5px; } +.PathIndex { -webkit-border-radius:8px } +.PathIndex { border-radius:8px } +.PathIndexEvent { background-color:#bfba87 } +.PathIndexControl { background-color:#8c8c8c } +.PathIndexPopUp { background-color: #879abc; } +.PathNav a { text-decoration:none; font-size: larger } +.CodeInsertionHint { font-weight: bold; background-color: #10dd10 } +.CodeRemovalHint { background-color:#de1010 } +.CodeRemovalHint { border-bottom:1px solid #6F9DBE } +.msg.selected{ background-color:orange !important; } + +table.simpletable { + padding: 5px; + font-size:12pt; + margin:20px; + border-collapse: collapse; border-spacing: 0px; +} +td.rowname { + text-align: right; + vertical-align: top; + font-weight: bold; + color:#444444; + padding-right:2ex; +} + +/* Hidden text. */ +input.spoilerhider + label { + cursor: pointer; + text-decoration: underline; + display: block; +} +input.spoilerhider { + display: none; +} +input.spoilerhider ~ .spoiler { + overflow: hidden; + margin: 10px auto 0; + height: 0; + opacity: 0; +} +input.spoilerhider:checked + label + .spoiler{ + height: auto; + opacity: 1; +} +</style> +</head> +<body> +<!-- BUGDESC Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption --> + +<!-- BUGTYPE Cast from non-struct type to struct type --> + +<!-- BUGCATEGORY Logic error --> + +<!-- BUGFILE /rootdir/plugins/udisks2/udisks2-plugin.c --> + +<!-- FILENAME udisks2-plugin.c --> + +<!-- FUNCTIONNAME udisks2_plugin_get_sensors --> + +<!-- ISSUEHASHCONTENTOFLINEINCONTEXT 1e32d31ee67d0fa10b1e8f056a7b66dd --> + +<!-- BUGLINE 295 --> + +<!-- BUGCOLUMN 82 --> + +<!-- BUGPATHLENGTH 1 --> + +<!-- BUGMETAEND --> +<!-- REPORTHEADER --> +<h3>Bug Summary</h3> +<table class="simpletable"> +<tr><td class="rowname">File:</td><td>plugins/udisks2/udisks2-plugin.c</td></tr> +<tr><td class="rowname">Warning:</td><td><a href="#EndPath">line 295, column 82</a><br />Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption</td></tr> + +</table> +<!-- REPORTSUMMARYEXTRA --> +<h3>Annotated Source Code</h3> +<p>Press <a href="#" onclick="toggleHelp(); return false;">'?'</a> + to see keyboard shortcuts</p> +<input type="checkbox" class="spoilerhider" id="showinvocation" /> +<label for="showinvocation" >Show analyzer invocation</label> +<div class="spoiler">clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name udisks2-plugin.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/plugins/udisks2 -resource-dir /usr/lib64/clang/16 -D HAVE_CONFIG_H -I . -I ../../sensors-applet -D MATELOCALEDIR="/usr/local/share/locale/" -D G_LOG_DOMAIN="sensors-applet" -D PIXMAPS_DIR="/usr/local/share/pixmaps/mate-sensors-applet/" -D DATADIR="/usr/local/share" -D LIBDIR="/usr/local/lib" -D SYSCONFDIR="/usr/local/etc" -D PREFIX="/usr/local" -I ../.. -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -D PIC -internal-isystem /usr/lib64/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/plugins/udisks2 -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2023-06-12-021133-6157-1 -x c udisks2-plugin.c +</div> +<div id='tooltiphint' hidden="true"> + <p>Keyboard shortcuts: </p> + <ul> + <li>Use 'j/k' keys for keyboard navigation</li> + <li>Use 'Shift+S' to show/hide relevant lines</li> + <li>Use '?' to toggle this window</li> + </ul> + <a href="#" onclick="toggleHelp(); return false;">Close</a> +</div> +<script type='text/javascript'> +var relevant_lines = {"1": {"295": 1}}; + +var filterCounterexample = function (hide) { + var tables = document.getElementsByClassName("code"); + for (var t=0; t<tables.length; t++) { + var table = tables[t]; + var file_id = table.getAttribute("data-fileid"); + var lines_in_fid = relevant_lines[file_id]; + if (!lines_in_fid) { + lines_in_fid = {}; + } + var lines = table.getElementsByClassName("codeline"); + for (var i=0; i<lines.length; i++) { + var el = lines[i]; + var lineNo = el.getAttribute("data-linenumber"); + if (!lines_in_fid[lineNo]) { + if (hide) { + el.setAttribute("hidden", ""); + } else { + el.removeAttribute("hidden"); + } + } + } + } +} + +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + // SHIFT + S + if (event.shiftKey && event.keyCode == 83) { + var checked = document.getElementsByName("showCounterexample")[0].checked; + filterCounterexample(!checked); + document.getElementsByName("showCounterexample")[0].click(); + } else { + return; + } + event.preventDefault(); +}, true); + +document.addEventListener("DOMContentLoaded", function() { + document.querySelector('input[name="showCounterexample"]').onchange= + function (event) { + filterCounterexample(this.checked); + }; +}); +</script> + +<form> + <input type="checkbox" name="showCounterexample" id="showCounterexample" /> + <label for="showCounterexample"> + Show only relevant lines + </label> + <input type="checkbox" name="showArrows" + id="showArrows" style="margin-left: 10px" /> + <label for="showArrows"> + Show control flow arrows + </label> +</form> + +<script type='text/javascript'> +// Return range of numbers from a range [lower, upper). +function range(lower, upper) { + var array = []; + for (var i = lower; i <= upper; ++i) { + array.push(i); + } + return array; +} + +var getRelatedArrowIndices = function(pathId) { + // HTML numeration of events is a bit different than it is in the path. + // Everything is rotated one step to the right, so the last element + // (error diagnostic) has index 0. + if (pathId == 0) { + // arrowIndices has at least 2 elements + pathId = arrowIndices.length - 1; + } + + return range(arrowIndices[pathId], arrowIndices[pathId - 1]); +} + +var highlightArrowsForSelectedEvent = function() { + const selectedNum = findNum(); + const arrowIndicesToHighlight = getRelatedArrowIndices(selectedNum); + arrowIndicesToHighlight.forEach((index) => { + var arrow = document.querySelector("#arrow" + index); + if(arrow) { + classListAdd(arrow, "selected") + } + }); +} + +var getAbsoluteBoundingRect = function(element) { + const relative = element.getBoundingClientRect(); + return { + left: relative.left + window.pageXOffset, + right: relative.right + window.pageXOffset, + top: relative.top + window.pageYOffset, + bottom: relative.bottom + window.pageYOffset, + height: relative.height, + width: relative.width + }; +} + +var drawArrow = function(index) { + // This function is based on the great answer from SO: + // https://stackoverflow.com/a/39575674/11582326 + var start = document.querySelector("#start" + index); + var end = document.querySelector("#end" + index); + var arrow = document.querySelector("#arrow" + index); + + var startRect = getAbsoluteBoundingRect(start); + var endRect = getAbsoluteBoundingRect(end); + + // It is an arrow from a token to itself, no need to visualize it. + if (startRect.top == endRect.top && + startRect.left == endRect.left) + return; + + // Each arrow is a very simple Bézier curve, with two nodes and + // two handles. So, we need to calculate four points in the window: + // * start node + var posStart = { x: 0, y: 0 }; + // * end node + var posEnd = { x: 0, y: 0 }; + // * handle for the start node + var startHandle = { x: 0, y: 0 }; + // * handle for the end node + var endHandle = { x: 0, y: 0 }; + // One can visualize it as follows: + // + // start handle + // / + // X"""_.-""""X + // .' \ + // / start node + // | + // | + // | end node + // \ / + // `->X + // X-' + // \ + // end handle + // + // NOTE: (0, 0) is the top left corner of the window. + + // We have 3 similar, but still different scenarios to cover: + // + // 1. Two tokens on different lines. + // -xxx + // / + // \ + // -> xxx + // In this situation, we draw arrow on the left curving to the left. + // 2. Two tokens on the same line, and the destination is on the right. + // ____ + // / \ + // / V + // xxx xxx + // In this situation, we draw arrow above curving upwards. + // 3. Two tokens on the same line, and the destination is on the left. + // xxx xxx + // ^ / + // \____/ + // In this situation, we draw arrow below curving downwards. + const onDifferentLines = startRect.top <= endRect.top - 5 || + startRect.top >= endRect.top + 5; + const leftToRight = startRect.left < endRect.left; + + // NOTE: various magic constants are chosen empirically for + // better positioning and look + if (onDifferentLines) { + // Case #1 + const topToBottom = startRect.top < endRect.top; + posStart.x = startRect.left - 1; + // We don't want to start it at the top left corner of the token, + // it doesn't feel like this is where the arrow comes from. + // For this reason, we start it in the middle of the left side + // of the token. + posStart.y = startRect.top + startRect.height / 2; + + // End node has arrow head and we give it a bit more space. + posEnd.x = endRect.left - 4; + posEnd.y = endRect.top; + + // Utility object with x and y offsets for handles. + var curvature = { + // We want bottom-to-top arrow to curve a bit more, so it doesn't + // overlap much with top-to-bottom curves (much more frequent). + x: topToBottom ? 15 : 25, + y: Math.min((posEnd.y - posStart.y) / 3, 10) + } + + // When destination is on the different line, we can make a + // curvier arrow because we have space for it. + // So, instead of using + // + // startHandle.x = posStart.x - curvature.x + // endHandle.x = posEnd.x - curvature.x + // + // We use the leftmost of these two values for both handles. + startHandle.x = Math.min(posStart.x, posEnd.x) - curvature.x; + endHandle.x = startHandle.x; + + // Curving downwards from the start node... + startHandle.y = posStart.y + curvature.y; + // ... and upwards from the end node. + endHandle.y = posEnd.y - curvature.y; + + } else if (leftToRight) { + // Case #2 + // Starting from the top right corner... + posStart.x = startRect.right - 1; + posStart.y = startRect.top; + + // ...and ending at the top left corner of the end token. + posEnd.x = endRect.left + 1; + posEnd.y = endRect.top - 1; + + // Utility object with x and y offsets for handles. + var curvature = { + x: Math.min((posEnd.x - posStart.x) / 3, 15), + y: 5 + } + + // Curving to the right... + startHandle.x = posStart.x + curvature.x; + // ... and upwards from the start node. + startHandle.y = posStart.y - curvature.y; + + // And to the left... + endHandle.x = posEnd.x - curvature.x; + // ... and upwards from the end node. + endHandle.y = posEnd.y - curvature.y; + + } else { + // Case #3 + // Starting from the bottom right corner... + posStart.x = startRect.right; + posStart.y = startRect.bottom; + + // ...and ending also at the bottom right corner, but of the end token. + posEnd.x = endRect.right - 1; + posEnd.y = endRect.bottom + 1; + + // Utility object with x and y offsets for handles. + var curvature = { + x: Math.min((posStart.x - posEnd.x) / 3, 15), + y: 5 + } + + // Curving to the left... + startHandle.x = posStart.x - curvature.x; + // ... and downwards from the start node. + startHandle.y = posStart.y + curvature.y; + + // And to the right... + endHandle.x = posEnd.x + curvature.x; + // ... and downwards from the end node. + endHandle.y = posEnd.y + curvature.y; + } + + // Put it all together into a path. + // More information on the format: + // https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths + var pathStr = "M" + posStart.x + "," + posStart.y + " " + + "C" + startHandle.x + "," + startHandle.y + " " + + endHandle.x + "," + endHandle.y + " " + + posEnd.x + "," + posEnd.y; + + arrow.setAttribute("d", pathStr); +}; + +var drawArrows = function() { + const numOfArrows = document.querySelectorAll("path[id^=arrow]").length; + for (var i = 0; i < numOfArrows; ++i) { + drawArrow(i); + } +} + +var toggleArrows = function(event) { + const arrows = document.querySelector("#arrows"); + if (event.target.checked) { + arrows.setAttribute("visibility", "visible"); + } else { + arrows.setAttribute("visibility", "hidden"); + } +} + +window.addEventListener("resize", drawArrows); +document.addEventListener("DOMContentLoaded", function() { + // Whenever we show invocation, locations change, i.e. we + // need to redraw arrows. + document + .querySelector('input[id="showinvocation"]') + .addEventListener("click", drawArrows); + // Hiding irrelevant lines also should cause arrow rerender. + document + .querySelector('input[name="showCounterexample"]') + .addEventListener("change", drawArrows); + document + .querySelector('input[name="showArrows"]') + .addEventListener("change", toggleArrows); + drawArrows(); + // Default highlighting for the last event. + highlightArrowsForSelectedEvent(); +}); +</script> + +<script type='text/javascript'> +var digitMatcher = new RegExp("[0-9]+"); + +var querySelectorAllArray = function(selector) { + return Array.prototype.slice.call( + document.querySelectorAll(selector)); +} + +document.addEventListener("DOMContentLoaded", function() { + querySelectorAllArray(".PathNav > a").forEach( + function(currentValue, currentIndex) { + var hrefValue = currentValue.getAttribute("href"); + currentValue.onclick = function() { + scrollTo(document.querySelector(hrefValue)); + return false; + }; + }); +}); + +var findNum = function() { + var s = document.querySelector(".msg.selected"); + if (!s || s.id == "EndPath") { + return 0; + } + var out = parseInt(digitMatcher.exec(s.id)[0]); + return out; +}; + +var classListAdd = function(el, theClass) { + if(!el.className.baseVal) + el.className += " " + theClass; + else + el.className.baseVal += " " + theClass; +}; + +var classListRemove = function(el, theClass) { + var className = (!el.className.baseVal) ? + el.className : el.className.baseVal; + className = className.replace(" " + theClass, ""); + if(!el.className.baseVal) + el.className = className; + else + el.className.baseVal = className; +}; + +var scrollTo = function(el) { + querySelectorAllArray(".selected").forEach(function(s) { + classListRemove(s, "selected"); + }); + classListAdd(el, "selected"); + window.scrollBy(0, el.getBoundingClientRect().top - + (window.innerHeight / 2)); + highlightArrowsForSelectedEvent(); +}; + +var move = function(num, up, numItems) { + if (num == 1 && up || num == numItems - 1 && !up) { + return 0; + } else if (num == 0 && up) { + return numItems - 1; + } else if (num == 0 && !up) { + return 1 % numItems; + } + return up ? num - 1 : num + 1; +} + +var numToId = function(num) { + if (num == 0) { + return document.getElementById("EndPath") + } + return document.getElementById("Path" + num); +}; + +var navigateTo = function(up) { + var numItems = document.querySelectorAll( + ".line > .msgEvent, .line > .msgControl").length; + var currentSelected = findNum(); + var newSelected = move(currentSelected, up, numItems); + var newEl = numToId(newSelected, numItems); + + // Scroll element into center. + scrollTo(newEl); +}; + +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + // key 'j' + if (event.keyCode == 74) { + navigateTo(/*up=*/false); + // key 'k' + } else if (event.keyCode == 75) { + navigateTo(/*up=*/true); + } else { + return; + } + event.preventDefault(); +}, true); +</script> + +<script type='text/javascript'> + +var toggleHelp = function() { + var hint = document.querySelector("#tooltiphint"); + var attributeName = "hidden"; + if (hint.hasAttribute(attributeName)) { + hint.removeAttribute(attributeName); + } else { + hint.setAttribute("hidden", "true"); + } +}; +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + if (event.key == "?") { + toggleHelp(); + } else { + return; + } + event.preventDefault(); +}); +</script> + +<style type="text/css"> + svg { + position:absolute; + top:0; + left:0; + height:100%; + width:100%; + pointer-events: none; + overflow: visible + } + .arrow { + stroke-opacity: 0.2; + stroke-width: 1; + marker-end: url(#arrowhead); + } + + .arrow.selected { + stroke-opacity: 0.6; + stroke-width: 2; + marker-end: url(#arrowheadSelected); + } + + .arrowhead { + orient: auto; + stroke: none; + opacity: 0.6; + fill: blue; + } +</style> +<svg xmlns="http://www.w3.org/2000/svg"> + <defs> + <marker id="arrowheadSelected" class="arrowhead" opacity="0.6" + viewBox="0 0 10 10" refX="3" refY="5" + markerWidth="4" markerHeight="4"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + <marker id="arrowhead" class="arrowhead" opacity="0.2" + viewBox="0 0 10 10" refX="3" refY="5" + markerWidth="4" markerHeight="4"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + </defs> + <g id="arrows" fill="none" stroke="blue" visibility="hidden"> + + </g> +</svg> +<script type='text/javascript'> +const arrowIndices = [ 0,0 ] +</script> +<table class="code" data-fileid="1"> +<tr class="codeline" data-linenumber="1"><td class="num" id="LN1">1</td><td class="line"><span class='comment'>/*</span></td></tr> +<tr class="codeline" data-linenumber="2"><td class="num" id="LN2">2</td><td class="line"> <span class='comment'>* Copyright (C) 2017 info-cppsp <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="3"><td class="num" id="LN3">3</td><td class="line"> <span class='comment'>* Copyright (C) 2005-2009 Alex Murray <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="4"><td class="num" id="LN4">4</td><td class="line"> <span class='comment'>* Copyright (C) 2012-2021 MATE Developers</span></td></tr> +<tr class="codeline" data-linenumber="5"><td class="num" id="LN5">5</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="6"><td class="num" id="LN6">6</td><td class="line"> <span class='comment'>* This program is free software; you can redistribute it and/or modify</span></td></tr> +<tr class="codeline" data-linenumber="7"><td class="num" id="LN7">7</td><td class="line"> <span class='comment'>* it under the terms of the GNU General Public License as published by</span></td></tr> +<tr class="codeline" data-linenumber="8"><td class="num" id="LN8">8</td><td class="line"> <span class='comment'>* the Free Software Foundation; either version 2 of the License, or</span></td></tr> +<tr class="codeline" data-linenumber="9"><td class="num" id="LN9">9</td><td class="line"> <span class='comment'>* (at your option) any later version.</span></td></tr> +<tr class="codeline" data-linenumber="10"><td class="num" id="LN10">10</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="11"><td class="num" id="LN11">11</td><td class="line"> <span class='comment'>* This program is distributed in the hope that it will be useful,</span></td></tr> +<tr class="codeline" data-linenumber="12"><td class="num" id="LN12">12</td><td class="line"> <span class='comment'>* but WITHOUT ANY WARRANTY; without even the implied warranty of</span></td></tr> +<tr class="codeline" data-linenumber="13"><td class="num" id="LN13">13</td><td class="line"> <span class='comment'>* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></td></tr> +<tr class="codeline" data-linenumber="14"><td class="num" id="LN14">14</td><td class="line"> <span class='comment'>* GNU General Public License for more details.</span></td></tr> +<tr class="codeline" data-linenumber="15"><td class="num" id="LN15">15</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="16"><td class="num" id="LN16">16</td><td class="line"> <span class='comment'>* You should have received a copy of the GNU General Public License</span></td></tr> +<tr class="codeline" data-linenumber="17"><td class="num" id="LN17">17</td><td class="line"> <span class='comment'>* along with this program; if not, write to the Free Software</span></td></tr> +<tr class="codeline" data-linenumber="18"><td class="num" id="LN18">18</td><td class="line"> <span class='comment'>* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</span></td></tr> +<tr class="codeline" data-linenumber="19"><td class="num" id="LN19">19</td><td class="line"> <span class='comment'>*/</span></td></tr> +<tr class="codeline" data-linenumber="20"><td class="num" id="LN20">20</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="21"><td class="num" id="LN21">21</td><td class="line"><span class='comment'>/*</span></td></tr> +<tr class="codeline" data-linenumber="22"><td class="num" id="LN22">22</td><td class="line"><span class='comment'>Udisks2 plugin for the mate-sensors-applet</span></td></tr> +<tr class="codeline" data-linenumber="23"><td class="num" id="LN23">23</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="24"><td class="num" id="LN24">24</td><td class="line"><span class='comment'>written using the structure and code of the previous version</span></td></tr> +<tr class="codeline" data-linenumber="25"><td class="num" id="LN25">25</td><td class="line"><span class='comment'>from Pramod Dematagoda <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="26"><td class="num" id="LN26">26</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="27"><td class="num" id="LN27">27</td><td class="line"><span class='comment'>dbus-glib documentation</span></td></tr> +<tr class="codeline" data-linenumber="28"><td class="num" id="LN28">28</td><td class="line"><span class='comment'>https://dbus.freedesktop.org/doc/dbus-glib/</span></td></tr> +<tr class="codeline" data-linenumber="29"><td class="num" id="LN29">29</td><td class="line"><span class='comment'>GDBUS documentation</span></td></tr> +<tr class="codeline" data-linenumber="30"><td class="num" id="LN30">30</td><td class="line"><span class='comment'>https://developer.gnome.org/gio/stable/index.html</span></td></tr> +<tr class="codeline" data-linenumber="31"><td class="num" id="LN31">31</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="32"><td class="num" id="LN32">32</td><td class="line"><span class='comment'>*/</span></td></tr> +<tr class="codeline" data-linenumber="33"><td class="num" id="LN33">33</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="34"><td class="num" id="LN34">34</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_CONFIG_H<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="35"><td class="num" id="LN35">35</td><td class="line"><span class='directive'>#include "config.h"</span></td></tr> +<tr class="codeline" data-linenumber="36"><td class="num" id="LN36">36</td><td class="line"><span class='directive'>#endif /* HAVE_CONFIG_H */</span></td></tr> +<tr class="codeline" data-linenumber="37"><td class="num" id="LN37">37</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="38"><td class="num" id="LN38">38</td><td class="line"><span class='directive'>#include <stdio.h></span></td></tr> +<tr class="codeline" data-linenumber="39"><td class="num" id="LN39">39</td><td class="line"><span class='directive'>#include <gio/gio.h></span></td></tr> +<tr class="codeline" data-linenumber="40"><td class="num" id="LN40">40</td><td class="line"><span class='directive'>#include "udisks2-plugin.h"</span></td></tr> +<tr class="codeline" data-linenumber="41"><td class="num" id="LN41">41</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="42"><td class="num" id="LN42">42</td><td class="line"><span class='comment'>/* remove // from next line for syslog debug */</span></td></tr> +<tr class="codeline" data-linenumber="43"><td class="num" id="LN43">43</td><td class="line"><span class='comment'>//#define UD2PD 1</span></td></tr> +<tr class="codeline" data-linenumber="44"><td class="num" id="LN44">44</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="45"><td class="num" id="LN45">45</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="46"><td class="num" id="LN46">46</td><td class="line"><span class='directive'>#include <syslog.h></span></td></tr> +<tr class="codeline" data-linenumber="47"><td class="num" id="LN47">47</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="48"><td class="num" id="LN48">48</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="49"><td class="num" id="LN49">49</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_BUS_NAME<span class='macro_popup'>"org.freedesktop.UDisks2"</span></span> "org.freedesktop.UDisks2"</span></td></tr> +<tr class="codeline" data-linenumber="50"><td class="num" id="LN50">50</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.DBus.ObjectManager"</span></span> "org.freedesktop.DBus.ObjectManager"</span></td></tr> +<tr class="codeline" data-linenumber="51"><td class="num" id="LN51">51</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_DEVICE_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive"</span></span> "org.freedesktop.UDisks2.Drive"</span></td></tr> +<tr class="codeline" data-linenumber="52"><td class="num" id="LN52">52</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_DEVICE_INTERFACE2_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive.Ata"</span></span> "org.freedesktop.UDisks2.Drive.Ata"</span></td></tr> +<tr class="codeline" data-linenumber="53"><td class="num" id="LN53">53</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="54"><td class="num" id="LN54">54</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_PROPERTIES_INTERFACE<span class='macro_popup'>"org.freedesktop.DBus.Properties"</span></span> "org.freedesktop.DBus.Properties"</span></td></tr> +<tr class="codeline" data-linenumber="55"><td class="num" id="LN55">55</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_OBJECT_PATH<span class='macro_popup'>"/org/freedesktop/UDisks2"</span></span> "/org/freedesktop/UDisks2"</span></td></tr> +<tr class="codeline" data-linenumber="56"><td class="num" id="LN56">56</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="57"><td class="num" id="LN57">57</td><td class="line"><span class='comment'>/* Info about a single sensor */</span></td></tr> +<tr class="codeline" data-linenumber="58"><td class="num" id="LN58">58</td><td class="line"><span class='keyword'>typedef</span> <span class='keyword'>struct</span> _DevInfo {</td></tr> +<tr class="codeline" data-linenumber="59"><td class="num" id="LN59">59</td><td class="line"> gchar *path;</td></tr> +<tr class="codeline" data-linenumber="60"><td class="num" id="LN60">60</td><td class="line"> gchar *id;</td></tr> +<tr class="codeline" data-linenumber="61"><td class="num" id="LN61">61</td><td class="line"> gdouble temp;</td></tr> +<tr class="codeline" data-linenumber="62"><td class="num" id="LN62">62</td><td class="line"> GDBusProxy *sensor_proxy; <span class='comment'>/* dbus object */</span></td></tr> +<tr class="codeline" data-linenumber="63"><td class="num" id="LN63">63</td><td class="line"> GError *error;</td></tr> +<tr class="codeline" data-linenumber="64"><td class="num" id="LN64">64</td><td class="line">} DevInfo;</td></tr> +<tr class="codeline" data-linenumber="65"><td class="num" id="LN65">65</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="66"><td class="num" id="LN66">66</td><td class="line"><span class='keyword'>const</span> gchar *plugin_name = <span class='string_literal'>"udisks2"</span>;</td></tr> +<tr class="codeline" data-linenumber="67"><td class="num" id="LN67">67</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="68"><td class="num" id="LN68">68</td><td class="line"><span class='comment'>/* a container for the devices found to have smart enabled */</span></td></tr> +<tr class="codeline" data-linenumber="69"><td class="num" id="LN69">69</td><td class="line">GHashTable *devices = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="70"><td class="num" id="LN70">70</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="71"><td class="num" id="LN71">71</td><td class="line"><span class='comment'>/* This is a global variable for convenience */</span></td></tr> +<tr class="codeline" data-linenumber="72"><td class="num" id="LN72">72</td><td class="line">GDBusConnection *connection = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="73"><td class="num" id="LN73">73</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="74"><td class="num" id="LN74">74</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> update_device (DevInfo *info) {</td></tr> +<tr class="codeline" data-linenumber="75"><td class="num" id="LN75">75</td><td class="line"> GError *error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="76"><td class="num" id="LN76">76</td><td class="line"> GVariant *tempgvar = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="77"><td class="num" id="LN77">77</td><td class="line"> GVariant *tempgvar2 = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="78"><td class="num" id="LN78">78</td><td class="line"> gdouble temp;</td></tr> +<tr class="codeline" data-linenumber="79"><td class="num" id="LN79">79</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="80"><td class="num" id="LN80">80</td><td class="line"> <span class='comment'>/* check valid input parameter */</span></td></tr> +<tr class="codeline" data-linenumber="81"><td class="num" id="LN81">81</td><td class="line"> <span class='macro'>g_return_if_fail (info != NULL)<span class='macro_popup'>do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_12<br>; if (info != ((void*)0)) _g_boolean_var_12 = 1; else _g_boolean_var_12<br> = 0; _g_boolean_var_12; }), 1))) { } else { g_return_if_fail_warning<br> ("sensors-applet", ((const char*) (__func__)), "info != NULL"<br>); return; } } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="82"><td class="num" id="LN82">82</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="83"><td class="num" id="LN83">83</td><td class="line"> <span class='comment'>/* check connection too */</span></td></tr> +<tr class="codeline" data-linenumber="84"><td class="num" id="LN84">84</td><td class="line"> <span class='macro'>g_return_if_fail (connection != NULL)<span class='macro_popup'>do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_13<br>; if (connection != ((void*)0)) _g_boolean_var_13 = 1; else _g_boolean_var_13<br> = 0; _g_boolean_var_13; }), 1))) { } else { g_return_if_fail_warning<br> ("sensors-applet", ((const char*) (__func__)), "connection != NULL"<br>); return; } } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="85"><td class="num" id="LN85">85</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="86"><td class="num" id="LN86">86</td><td class="line"> g_clear_error (&info->error);</td></tr> +<tr class="codeline" data-linenumber="87"><td class="num" id="LN87">87</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="88"><td class="num" id="LN88">88</td><td class="line"> <span class='comment'>/* check for sensor_proxy, which should exist at this point, make one if necessary and save it into DevInfo</span></td></tr> +<tr class="codeline" data-linenumber="89"><td class="num" id="LN89">89</td><td class="line"> <span class='comment'>* this is used to get the temp value the direct way */</span></td></tr> +<tr class="codeline" data-linenumber="90"><td class="num" id="LN90">90</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == info->sensor_proxy) {</td></tr> +<tr class="codeline" data-linenumber="91"><td class="num" id="LN91">91</td><td class="line"> info->sensor_proxy = g_dbus_proxy_new_sync (connection, G_DBUS_PROXY_FLAGS_NONE, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="92"><td class="num" id="LN92">92</td><td class="line"> <span class='macro'>UDISKS2_BUS_NAME<span class='macro_popup'>"org.freedesktop.UDisks2"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="93"><td class="num" id="LN93">93</td><td class="line"> info->path,</td></tr> +<tr class="codeline" data-linenumber="94"><td class="num" id="LN94">94</td><td class="line"> <span class='macro'>UDISKS2_PROPERTIES_INTERFACE<span class='macro_popup'>"org.freedesktop.DBus.Properties"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="95"><td class="num" id="LN95">95</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, &error);</td></tr> +<tr class="codeline" data-linenumber="96"><td class="num" id="LN96">96</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="97"><td class="num" id="LN97">97</td><td class="line"> <span class='comment'>/* check, just to be sure */</span></td></tr> +<tr class="codeline" data-linenumber="98"><td class="num" id="LN98">98</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == info->sensor_proxy) {</td></tr> +<tr class="codeline" data-linenumber="99"><td class="num" id="LN99">99</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="100"><td class="num" id="LN100">100</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="101"><td class="num" id="LN101">101</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Failed to get drive temperature 1"</span>);</td></tr> +<tr class="codeline" data-linenumber="102"><td class="num" id="LN102">102</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="103"><td class="num" id="LN103">103</td><td class="line"> g_debug (<span class='string_literal'>"Failed to get drive temperature 1: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="104"><td class="num" id="LN104">104</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="105"><td class="num" id="LN105">105</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="106"><td class="num" id="LN106">106</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="107"><td class="num" id="LN107">107</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="108"><td class="num" id="LN108">108</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="109"><td class="num" id="LN109">109</td><td class="line"><span class='comment'>/* note on timing:</span></td></tr> +<tr class="codeline" data-linenumber="110"><td class="num" id="LN110">110</td><td class="line"> <span class='comment'>* it seems to me that smart updates occur automatically every 10 minutes</span></td></tr> +<tr class="codeline" data-linenumber="111"><td class="num" id="LN111">111</td><td class="line"> <span class='comment'>* mate-sensor-applet has a default refresh of 2 seconds...</span></td></tr> +<tr class="codeline" data-linenumber="112"><td class="num" id="LN112">112</td><td class="line"> <span class='comment'>* it is possible to force a smart update with udisks2: SmartUpdate (IN a{sv} options); */</span></td></tr> +<tr class="codeline" data-linenumber="113"><td class="num" id="LN113">113</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="114"><td class="num" id="LN114">114</td><td class="line"> <span class='comment'>/* directly asking the device's DBus object for the temp */</span></td></tr> +<tr class="codeline" data-linenumber="115"><td class="num" id="LN115">115</td><td class="line"> tempgvar = g_dbus_proxy_call_sync (info->sensor_proxy, <span class='string_literal'>"Get"</span>,</td></tr> +<tr class="codeline" data-linenumber="116"><td class="num" id="LN116">116</td><td class="line"> g_variant_new (<span class='string_literal'>"(ss)"</span>,</td></tr> +<tr class="codeline" data-linenumber="117"><td class="num" id="LN117">117</td><td class="line"> <span class='macro'>UDISKS2_DEVICE_INTERFACE2_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive.Ata"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="118"><td class="num" id="LN118">118</td><td class="line"> <span class='string_literal'>"SmartTemperature"</span>), <span class='comment'>/* parameters */</span></td></tr> +<tr class="codeline" data-linenumber="119"><td class="num" id="LN119">119</td><td class="line"> G_DBUS_CALL_FLAGS_NONE, <span class='comment'>/* flags */</span></td></tr> +<tr class="codeline" data-linenumber="120"><td class="num" id="LN120">120</td><td class="line"> -1, <span class='comment'>/* timeout */</span></td></tr> +<tr class="codeline" data-linenumber="121"><td class="num" id="LN121">121</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='comment'>/* cancellable */</span></td></tr> +<tr class="codeline" data-linenumber="122"><td class="num" id="LN122">122</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="123"><td class="num" id="LN123">123</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="124"><td class="num" id="LN124">124</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == tempgvar) {</td></tr> +<tr class="codeline" data-linenumber="125"><td class="num" id="LN125">125</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="126"><td class="num" id="LN126">126</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="127"><td class="num" id="LN127">127</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Failed to get drive temperature 2"</span>);</td></tr> +<tr class="codeline" data-linenumber="128"><td class="num" id="LN128">128</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="129"><td class="num" id="LN129">129</td><td class="line"> g_debug (<span class='string_literal'>"Failed to get drive temperature 2: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="130"><td class="num" id="LN130">130</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="131"><td class="num" id="LN131">131</td><td class="line"> <span class='comment'>/* throw away proxy, maybe next time it will be better */</span></td></tr> +<tr class="codeline" data-linenumber="132"><td class="num" id="LN132">132</td><td class="line"> <span class='macro'>g_clear_object (&info->sensor_proxy)<span class='macro_popup'>do { _Static_assert (sizeof *((&info->sensor_proxy)) ==<br> sizeof (gpointer), "Expression evaluates to false"); __typeof__<br> (((&info->sensor_proxy))) _pp = ((&info->sensor_proxy<br>)); __typeof__ (*((&info->sensor_proxy))) _ptr = *_pp;<br> *_pp = ((void*)0); if (_ptr) (g_object_unref) (_ptr); } while<br> (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="133"><td class="num" id="LN133">133</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="134"><td class="num" id="LN134">134</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="135"><td class="num" id="LN135">135</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="136"><td class="num" id="LN136">136</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="137"><td class="num" id="LN137">137</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="138"><td class="num" id="LN138">138</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"tempgvar value: %s"</span>, g_variant_print(tempgvar, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="139"><td class="num" id="LN139">139</td><td class="line"><span class='comment'>/* leaks memory! */</span></td></tr> +<tr class="codeline" data-linenumber="140"><td class="num" id="LN140">140</td><td class="line"><span class='comment'>//syslog(LOG_ERR, "tempgvar value: %s", g_variant_print(g_variant_get_variant(g_variant_get_child_value(tempgvar, 0)), TRUE));</span></td></tr> +<tr class="codeline" data-linenumber="141"><td class="num" id="LN141">141</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="142"><td class="num" id="LN142">142</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="143"><td class="num" id="LN143">143</td><td class="line"> <span class='comment'>/* tempgvar comes back as something along the lines of array(gvariant(tempasdouble))</span></td></tr> +<tr class="codeline" data-linenumber="144"><td class="num" id="LN144">144</td><td class="line"> <span class='comment'>* hence unpacking</span></td></tr> +<tr class="codeline" data-linenumber="145"><td class="num" id="LN145">145</td><td class="line"> <span class='comment'>* need to free up every param / return value, so can't do it like:</span></td></tr> +<tr class="codeline" data-linenumber="146"><td class="num" id="LN146">146</td><td class="line"> <span class='comment'>* temp = g_variant_get_double(g_variant_get_variant(g_variant_get_child_value(tempgvar, 0))); */</span></td></tr> +<tr class="codeline" data-linenumber="147"><td class="num" id="LN147">147</td><td class="line"> tempgvar2 = g_variant_get_child_value (tempgvar, 0);</td></tr> +<tr class="codeline" data-linenumber="148"><td class="num" id="LN148">148</td><td class="line"> g_variant_unref (tempgvar);</td></tr> +<tr class="codeline" data-linenumber="149"><td class="num" id="LN149">149</td><td class="line"> tempgvar = g_variant_get_variant (tempgvar2);</td></tr> +<tr class="codeline" data-linenumber="150"><td class="num" id="LN150">150</td><td class="line"> g_variant_unref (tempgvar2);</td></tr> +<tr class="codeline" data-linenumber="151"><td class="num" id="LN151">151</td><td class="line"> temp = g_variant_get_double (tempgvar);</td></tr> +<tr class="codeline" data-linenumber="152"><td class="num" id="LN152">152</td><td class="line"> g_variant_unref (tempgvar);</td></tr> +<tr class="codeline" data-linenumber="153"><td class="num" id="LN153">153</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="154"><td class="num" id="LN154">154</td><td class="line"> <span class='comment'>/* temp in K */</span></td></tr> +<tr class="codeline" data-linenumber="155"><td class="num" id="LN155">155</td><td class="line"> info->temp = temp - 273.15;</td></tr> +<tr class="codeline" data-linenumber="156"><td class="num" id="LN156">156</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="157"><td class="num" id="LN157">157</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="158"><td class="num" id="LN158">158</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Refresh udisks2 device temp: '%f'\n"</span>, info->temp);</td></tr> +<tr class="codeline" data-linenumber="159"><td class="num" id="LN159">159</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="160"><td class="num" id="LN160">160</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="161"><td class="num" id="LN161">161</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="162"><td class="num" id="LN162">162</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="163"><td class="num" id="LN163">163</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="164"><td class="num" id="LN164">164</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="165"><td class="num" id="LN165">165</td><td class="line"><span class='comment'>/* in this function we would like to get a list of device (hdd/ssd) paths</span></td></tr> +<tr class="codeline" data-linenumber="166"><td class="num" id="LN166">166</td><td class="line"> <span class='comment'>* then with each path we get the temperature</span></td></tr> +<tr class="codeline" data-linenumber="167"><td class="num" id="LN167">167</td><td class="line"> <span class='comment'>* it is possible with udisks2 to get all the above information in one g_dbus_proxy_call_sync(), so that is how I did it</span></td></tr> +<tr class="codeline" data-linenumber="168"><td class="num" id="LN168">168</td><td class="line"> <span class='comment'>* maybe a better version would be to use GDBusObjectManager Server + Client ?? */</span></td></tr> +<tr class="codeline" data-linenumber="169"><td class="num" id="LN169">169</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> udisks2_plugin_get_sensors (GList **sensors) {</td></tr> +<tr class="codeline" data-linenumber="170"><td class="num" id="LN170">170</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="171"><td class="num" id="LN171">171</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="172"><td class="num" id="LN172">172</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"fstart"</span>);</td></tr> +<tr class="codeline" data-linenumber="173"><td class="num" id="LN173">173</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="174"><td class="num" id="LN174">174</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="175"><td class="num" id="LN175">175</td><td class="line"> GDBusProxy *proxy = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="176"><td class="num" id="LN176">176</td><td class="line"> GError *error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="177"><td class="num" id="LN177">177</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="178"><td class="num" id="LN178">178</td><td class="line"> DevInfo *info;</td></tr> +<tr class="codeline" data-linenumber="179"><td class="num" id="LN179">179</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="180"><td class="num" id="LN180">180</td><td class="line"> <span class='comment'>/* This connection will be used for everything, including the obtaining of sensor data */</span></td></tr> +<tr class="codeline" data-linenumber="181"><td class="num" id="LN181">181</td><td class="line"> connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, &error);</td></tr> +<tr class="codeline" data-linenumber="182"><td class="num" id="LN182">182</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == connection) {</td></tr> +<tr class="codeline" data-linenumber="183"><td class="num" id="LN183">183</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="184"><td class="num" id="LN184">184</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="185"><td class="num" id="LN185">185</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn fail"</span>);</td></tr> +<tr class="codeline" data-linenumber="186"><td class="num" id="LN186">186</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="187"><td class="num" id="LN187">187</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="188"><td class="num" id="LN188">188</td><td class="line"> g_debug (<span class='string_literal'>"Failed to open connection to DBUS: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="189"><td class="num" id="LN189">189</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="190"><td class="num" id="LN190">190</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="191"><td class="num" id="LN191">191</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="192"><td class="num" id="LN192">192</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="193"><td class="num" id="LN193">193</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="194"><td class="num" id="LN194">194</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn success"</span>);</td></tr> +<tr class="codeline" data-linenumber="195"><td class="num" id="LN195">195</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="196"><td class="num" id="LN196">196</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="197"><td class="num" id="LN197">197</td><td class="line"> <span class='comment'>/* I use this proxy to get all info of all devices at once */</span></td></tr> +<tr class="codeline" data-linenumber="198"><td class="num" id="LN198">198</td><td class="line"> proxy = g_dbus_proxy_new_sync (connection, G_DBUS_PROXY_FLAGS_NONE, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="199"><td class="num" id="LN199">199</td><td class="line"> <span class='macro'>UDISKS2_BUS_NAME<span class='macro_popup'>"org.freedesktop.UDisks2"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="200"><td class="num" id="LN200">200</td><td class="line"> <span class='macro'>UDISKS2_OBJECT_PATH<span class='macro_popup'>"/org/freedesktop/UDisks2"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="201"><td class="num" id="LN201">201</td><td class="line"> <span class='macro'>UDISKS2_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.DBus.ObjectManager"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="202"><td class="num" id="LN202">202</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, &error);</td></tr> +<tr class="codeline" data-linenumber="203"><td class="num" id="LN203">203</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="204"><td class="num" id="LN204">204</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == proxy) {</td></tr> +<tr class="codeline" data-linenumber="205"><td class="num" id="LN205">205</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="206"><td class="num" id="LN206">206</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="207"><td class="num" id="LN207">207</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn proxy fail"</span>);</td></tr> +<tr class="codeline" data-linenumber="208"><td class="num" id="LN208">208</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="209"><td class="num" id="LN209">209</td><td class="line"> g_debug (<span class='string_literal'>"dbus conn proxy fail: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="210"><td class="num" id="LN210">210</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="211"><td class="num" id="LN211">211</td><td class="line"> <span class='macro'>g_clear_object (&connection)<span class='macro_popup'>do { _Static_assert (sizeof *((&connection)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&connection<br>))) _pp = ((&connection)); __typeof__ (*((&connection<br>))) _ptr = *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref<br>) (_ptr); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="212"><td class="num" id="LN212">212</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="213"><td class="num" id="LN213">213</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="214"><td class="num" id="LN214">214</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="215"><td class="num" id="LN215">215</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="216"><td class="num" id="LN216">216</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn proxy success"</span>);</td></tr> +<tr class="codeline" data-linenumber="217"><td class="num" id="LN217">217</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="218"><td class="num" id="LN218">218</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="219"><td class="num" id="LN219">219</td><td class="line"> <span class='comment'>/* The object paths of the disks are enumerated and placed in an array of object paths</span></td></tr> +<tr class="codeline" data-linenumber="220"><td class="num" id="LN220">220</td><td class="line"> <span class='comment'>* "GetManagedObjects" returns dict of (objectpath, (dict of (string [ie. if. name], dict of(string [ie. property name], variant [ie. prop. value])))) */</span></td></tr> +<tr class="codeline" data-linenumber="221"><td class="num" id="LN221">221</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="222"><td class="num" id="LN222">222</td><td class="line"> <span class='comment'>/* g_dbus_proxy_call_sync() returns NULL on error, GVariant * otherwise</span></td></tr> +<tr class="codeline" data-linenumber="223"><td class="num" id="LN223">223</td><td class="line"> <span class='comment'>* need second variable to prevent memory leak */</span></td></tr> +<tr class="codeline" data-linenumber="224"><td class="num" id="LN224">224</td><td class="line"> GVariant *managed_objects = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="225"><td class="num" id="LN225">225</td><td class="line"> GVariant *managed_objects2 = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="226"><td class="num" id="LN226">226</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="227"><td class="num" id="LN227">227</td><td class="line"> managed_objects2 = g_dbus_proxy_call_sync (proxy, <span class='string_literal'>"GetManagedObjects"</span>,</td></tr> +<tr class="codeline" data-linenumber="228"><td class="num" id="LN228">228</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='comment'>/* parameters */</span></td></tr> +<tr class="codeline" data-linenumber="229"><td class="num" id="LN229">229</td><td class="line"> G_DBUS_CALL_FLAGS_NONE, <span class='comment'>/* flags */</span></td></tr> +<tr class="codeline" data-linenumber="230"><td class="num" id="LN230">230</td><td class="line"> -1, <span class='comment'>/* timeout */</span></td></tr> +<tr class="codeline" data-linenumber="231"><td class="num" id="LN231">231</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='comment'>/* cancellable */</span></td></tr> +<tr class="codeline" data-linenumber="232"><td class="num" id="LN232">232</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="233"><td class="num" id="LN233">233</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="234"><td class="num" id="LN234">234</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == managed_objects2) {</td></tr> +<tr class="codeline" data-linenumber="235"><td class="num" id="LN235">235</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="236"><td class="num" id="LN236">236</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="237"><td class="num" id="LN237">237</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Failed to enumerate disk devices"</span>);</td></tr> +<tr class="codeline" data-linenumber="238"><td class="num" id="LN238">238</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="239"><td class="num" id="LN239">239</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="240"><td class="num" id="LN240">240</td><td class="line"> g_debug (<span class='string_literal'>"Failed to enumerate disk devices: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="241"><td class="num" id="LN241">241</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="242"><td class="num" id="LN242">242</td><td class="line"> <span class='macro'>g_clear_object (&proxy)<span class='macro_popup'>do { _Static_assert (sizeof *((&proxy)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&proxy<br>))) _pp = ((&proxy)); __typeof__ (*((&proxy))) _ptr =<br> *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref) (_ptr); }<br> while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="243"><td class="num" id="LN243">243</td><td class="line"> <span class='macro'>g_clear_object (&connection)<span class='macro_popup'>do { _Static_assert (sizeof *((&connection)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&connection<br>))) _pp = ((&connection)); __typeof__ (*((&connection<br>))) _ptr = *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref<br>) (_ptr); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="244"><td class="num" id="LN244">244</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="245"><td class="num" id="LN245">245</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="246"><td class="num" id="LN246">246</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="247"><td class="num" id="LN247">247</td><td class="line"> <span class='comment'>/* the result dictionary is enclosed in an array, unpack */</span></td></tr> +<tr class="codeline" data-linenumber="248"><td class="num" id="LN248">248</td><td class="line"> managed_objects = g_variant_get_child_value (managed_objects2, 0);</td></tr> +<tr class="codeline" data-linenumber="249"><td class="num" id="LN249">249</td><td class="line"> g_variant_unref (managed_objects2);</td></tr> +<tr class="codeline" data-linenumber="250"><td class="num" id="LN250">250</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="251"><td class="num" id="LN251">251</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="252"><td class="num" id="LN252">252</td><td class="line"><span class='comment'>//syslog(LOG_ERR, "managed_objects type: %s", g_variant_print(managed_objects, TRUE));</span></td></tr> +<tr class="codeline" data-linenumber="253"><td class="num" id="LN253">253</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"success to enumerate disk devices"</span>);</td></tr> +<tr class="codeline" data-linenumber="254"><td class="num" id="LN254">254</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="255"><td class="num" id="LN255">255</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="256"><td class="num" id="LN256">256</td><td class="line"> <span class='comment'>/* iterator for the result dictionary</span></td></tr> +<tr class="codeline" data-linenumber="257"><td class="num" id="LN257">257</td><td class="line"> <span class='comment'>* iterator code is based on the g_variant_iter_next() documentation</span></td></tr> +<tr class="codeline" data-linenumber="258"><td class="num" id="LN258">258</td><td class="line"> <span class='comment'>* iter is freed if the GVariant is, when using g_variant_iter_init() */</span></td></tr> +<tr class="codeline" data-linenumber="259"><td class="num" id="LN259">259</td><td class="line"> GVariantIter iter;</td></tr> +<tr class="codeline" data-linenumber="260"><td class="num" id="LN260">260</td><td class="line"> gchar *key = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; <span class='comment'>/* object path (like '/org/freedesktop/UDisks2/drives/Samsung_SSD_840_EVO_250GB_*insert drive serial nr.*') */</span></td></tr> +<tr class="codeline" data-linenumber="261"><td class="num" id="LN261">261</td><td class="line"> GVariant *value = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="262"><td class="num" id="LN262">262</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="263"><td class="num" id="LN263">263</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="264"><td class="num" id="LN264">264</td><td class="line"><span class='comment'>/* log collection size */</span></td></tr> +<tr class="codeline" data-linenumber="265"><td class="num" id="LN265">265</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"iter init count: %d"</span>, (<span class='keyword'>int</span>) g_variant_iter_init (&iter, managed_objects));</td></tr> +<tr class="codeline" data-linenumber="266"><td class="num" id="LN266">266</td><td class="line"><span class='directive'>#else</span></td></tr> +<tr class="codeline" data-linenumber="267"><td class="num" id="LN267">267</td><td class="line"> g_variant_iter_init (&iter, managed_objects);</td></tr> +<tr class="codeline" data-linenumber="268"><td class="num" id="LN268">268</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="269"><td class="num" id="LN269">269</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="270"><td class="num" id="LN270">270</td><td class="line"> <span class='comment'>/* "{sv}" is a GVariant format string</span></td></tr> +<tr class="codeline" data-linenumber="271"><td class="num" id="LN271">271</td><td class="line"> <span class='comment'>* {} dictionary of, s string, v GVariant</span></td></tr> +<tr class="codeline" data-linenumber="272"><td class="num" id="LN272">272</td><td class="line"> <span class='comment'>* changed to "{oa{sa{sv}}}" on error message 'the GVariant format string '{sv}' has a type of '{sv}' but the given value has a type of 'a{oa{sa{sv}}}''</span></td></tr> +<tr class="codeline" data-linenumber="273"><td class="num" id="LN273">273</td><td class="line"> <span class='comment'>* a is array, o is object path</span></td></tr> +<tr class="codeline" data-linenumber="274"><td class="num" id="LN274">274</td><td class="line"> <span class='comment'>* NOO!! the right format string is "{o@*}", which means get an object path into the 1st variable (key)</span></td></tr> +<tr class="codeline" data-linenumber="275"><td class="num" id="LN275">275</td><td class="line"> <span class='comment'>* and get 'everything else' (as a GVariant) into the 2nd variable (value)</span></td></tr> +<tr class="codeline" data-linenumber="276"><td class="num" id="LN276">276</td><td class="line"> <span class='comment'>* needs the & before the key and value params! */</span></td></tr> +<tr class="codeline" data-linenumber="277"><td class="num" id="LN277">277</td><td class="line"> <span class='keyword'>while</span> (g_variant_iter_next (&iter, <span class='string_literal'>"{o@*}"</span>, &key, &value)) {</td></tr> +<tr class="codeline" data-linenumber="278"><td class="num" id="LN278">278</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="279"><td class="num" id="LN279">279</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="280"><td class="num" id="LN280">280</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"in iter while loop"</span>);</td></tr> +<tr class="codeline" data-linenumber="281"><td class="num" id="LN281">281</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"key value: %s"</span>, key);</td></tr> +<tr class="codeline" data-linenumber="282"><td class="num" id="LN282">282</td><td class="line"><span class='comment'>//syslog(LOG_ERR, "value type: %s", g_variant_print(value, TRUE));</span></td></tr> +<tr class="codeline" data-linenumber="283"><td class="num" id="LN283">283</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="284"><td class="num" id="LN284">284</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="285"><td class="num" id="LN285">285</td><td class="line"> <span class='comment'>/* level 2</span></td></tr> +<tr class="codeline" data-linenumber="286"><td class="num" id="LN286">286</td><td class="line"> <span class='comment'>* create a dictionary of value</span></td></tr> +<tr class="codeline" data-linenumber="287"><td class="num" id="LN287">287</td><td class="line"> <span class='comment'>* the two interface names that we are searching for are known and defined</span></td></tr> +<tr class="codeline" data-linenumber="288"><td class="num" id="LN288">288</td><td class="line"> <span class='comment'>* can't use GVariantDict, it only supports '{sv}' but the given value has a type of '{sa{sv}}'</span></td></tr> +<tr class="codeline" data-linenumber="289"><td class="num" id="LN289">289</td><td class="line"> <span class='comment'>* using general lookup */</span></td></tr> +<tr class="codeline" data-linenumber="290"><td class="num" id="LN290">290</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="291"><td class="num" id="LN291">291</td><td class="line"> GVariant *propdict = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; <span class='comment'>/* drive data */</span></td></tr> +<tr class="codeline" data-linenumber="292"><td class="num" id="LN292">292</td><td class="line"> GVariant *propdict2 = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; <span class='comment'>/* drive smart data */</span></td></tr> +<tr class="codeline" data-linenumber="293"><td class="num" id="LN293">293</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="294"><td class="num" id="LN294">294</td><td class="line"> <span class='comment'>/* make two dictionaries that contain the properties of the drive interfaces */</span></td></tr> +<tr class="codeline" data-linenumber="295"><td class="num" id="LN295">295</td><td class="line"> propdict = g_variant_lookup_value (value, <span class='macro'>UDISKS2_DEVICE_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive"</span></span>, <span class="mrange"><span class="mrange"><span class='macro'>G_VARIANT_TYPE_DICTIONARY<span class='macro_popup'>((const GVariantType *) "a{?*}")</span></span></span></span>);</td></tr> +<tr><td class="num"></td><td class="line"><div id="EndPath" class="msg msgEvent" style="margin-left:82ex; max-width:31em">Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption</div></td></tr> +<tr class="codeline" data-linenumber="296"><td class="num" id="LN296">296</td><td class="line"> propdict2 = g_variant_lookup_value (value, <span class='macro'>UDISKS2_DEVICE_INTERFACE2_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive.Ata"</span></span>, <span class='macro'>G_VARIANT_TYPE_DICTIONARY<span class='macro_popup'>((const GVariantType *) "a{?*}")</span></span>);</td></tr> +<tr class="codeline" data-linenumber="297"><td class="num" id="LN297">297</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="298"><td class="num" id="LN298">298</td><td class="line"> <span class='comment'>/* do we have the right ifname keys? */</span></td></tr> +<tr class="codeline" data-linenumber="299"><td class="num" id="LN299">299</td><td class="line"> <span class='keyword'>if</span> ((<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict) && (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict2)) {</td></tr> +<tr class="codeline" data-linenumber="300"><td class="num" id="LN300">300</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="301"><td class="num" id="LN301">301</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="302"><td class="num" id="LN302">302</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"propdict type: %s"</span>, g_variant_print(propdict, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="303"><td class="num" id="LN303">303</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"propdict2 type: %s"</span>, g_variant_print(propdict2, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="304"><td class="num" id="LN304">304</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="305"><td class="num" id="LN305">305</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="306"><td class="num" id="LN306">306</td><td class="line"> <span class='comment'>/* get data */</span></td></tr> +<tr class="codeline" data-linenumber="307"><td class="num" id="LN307">307</td><td class="line"> gchar *id = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="308"><td class="num" id="LN308">308</td><td class="line"> gchar *model = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="309"><td class="num" id="LN309">309</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="310"><td class="num" id="LN310">310</td><td class="line"> gboolean smartenabled;</td></tr> +<tr class="codeline" data-linenumber="311"><td class="num" id="LN311">311</td><td class="line"> gdouble temp;</td></tr> +<tr class="codeline" data-linenumber="312"><td class="num" id="LN312">312</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="313"><td class="num" id="LN313">313</td><td class="line"> <span class='comment'>/* NULL, bc we don't care about the length of the string</span></td></tr> +<tr class="codeline" data-linenumber="314"><td class="num" id="LN314">314</td><td class="line"> <span class='comment'>* typecast bc g_variant_get_string() returns const char* */</span></td></tr> +<tr class="codeline" data-linenumber="315"><td class="num" id="LN315">315</td><td class="line"> id = (gchar *) g_variant_get_string (g_variant_lookup_value (propdict, <span class='string_literal'>"Id"</span>, <span class='macro'>G_VARIANT_TYPE_STRING<span class='macro_popup'>((const GVariantType *) "s")</span></span>), <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="316"><td class="num" id="LN316">316</td><td class="line"> model = (gchar *) g_variant_get_string (g_variant_lookup_value (propdict, <span class='string_literal'>"Model"</span>, <span class='macro'>G_VARIANT_TYPE_STRING<span class='macro_popup'>((const GVariantType *) "s")</span></span>), <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="317"><td class="num" id="LN317">317</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="318"><td class="num" id="LN318">318</td><td class="line"> smartenabled = g_variant_get_boolean (g_variant_lookup_value (propdict2, <span class='string_literal'>"SmartEnabled"</span>, <span class='macro'>G_VARIANT_TYPE_BOOLEAN<span class='macro_popup'>((const GVariantType *) "b")</span></span>));</td></tr> +<tr class="codeline" data-linenumber="319"><td class="num" id="LN319">319</td><td class="line"> temp = g_variant_get_double (g_variant_lookup_value (propdict2, <span class='string_literal'>"SmartTemperature"</span>, <span class='macro'>G_VARIANT_TYPE_DOUBLE<span class='macro_popup'>((const GVariantType *) "d")</span></span>));</td></tr> +<tr class="codeline" data-linenumber="320"><td class="num" id="LN320">320</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="321"><td class="num" id="LN321">321</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="322"><td class="num" id="LN322">322</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device id: '%s'\n"</span>, id);</td></tr> +<tr class="codeline" data-linenumber="323"><td class="num" id="LN323">323</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device model: '%s'\n"</span>, model);</td></tr> +<tr class="codeline" data-linenumber="324"><td class="num" id="LN324">324</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device smartenabled: '%d'\n"</span>, smartenabled);</td></tr> +<tr class="codeline" data-linenumber="325"><td class="num" id="LN325">325</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device temp: '%f'\n"</span>, temp);</td></tr> +<tr class="codeline" data-linenumber="326"><td class="num" id="LN326">326</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="327"><td class="num" id="LN327">327</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="328"><td class="num" id="LN328">328</td><td class="line"> <span class='comment'>/* only go on if smart is enabled</span></td></tr> +<tr class="codeline" data-linenumber="329"><td class="num" id="LN329">329</td><td class="line"> <span class='comment'>* save data */</span></td></tr> +<tr class="codeline" data-linenumber="330"><td class="num" id="LN330">330</td><td class="line"> <span class='keyword'>if</span> (smartenabled) {</td></tr> +<tr class="codeline" data-linenumber="331"><td class="num" id="LN331">331</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="332"><td class="num" id="LN332">332</td><td class="line"> info = <span class='macro'>g_new0 (DevInfo, 1)<span class='macro_popup'>(DevInfo *) (__extension__ ({ gsize __n = (gsize) (1); gsize __s<br> = sizeof (DevInfo); gpointer __p; if (__s == 1) __p = g_malloc0<br> (__n); else if (__builtin_constant_p (__n) && (__s ==<br> 0 || __n <= (9223372036854775807L *2UL+1UL) / __s)) __p =<br> g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s); __p<br>; }))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="333"><td class="num" id="LN333">333</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == devices) {</td></tr> +<tr class="codeline" data-linenumber="334"><td class="num" id="LN334">334</td><td class="line"> devices = g_hash_table_new (g_str_hash, g_str_equal);</td></tr> +<tr class="codeline" data-linenumber="335"><td class="num" id="LN335">335</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="336"><td class="num" id="LN336">336</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="337"><td class="num" id="LN337">337</td><td class="line"> info->id = <span class='macro'>g_strdup (id)<span class='macro_popup'>g_strdup_inline (id)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="338"><td class="num" id="LN338">338</td><td class="line"> info->path = <span class='macro'>g_strdup (key)<span class='macro_popup'>g_strdup_inline (key)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="339"><td class="num" id="LN339">339</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="340"><td class="num" id="LN340">340</td><td class="line"> <span class='comment'>/* temp in K</span></td></tr> +<tr class="codeline" data-linenumber="341"><td class="num" id="LN341">341</td><td class="line"> <span class='comment'>* this could be left at 0.0, 2 seconds later it will be refreshed anyway */</span></td></tr> +<tr class="codeline" data-linenumber="342"><td class="num" id="LN342">342</td><td class="line"> info->temp = (gdouble) temp - 273.15;</td></tr> +<tr class="codeline" data-linenumber="343"><td class="num" id="LN343">343</td><td class="line"> g_hash_table_insert (devices, info->id, info);</td></tr> +<tr class="codeline" data-linenumber="344"><td class="num" id="LN344">344</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="345"><td class="num" id="LN345">345</td><td class="line"> <span class='comment'>/* Write the sensor data */</span></td></tr> +<tr class="codeline" data-linenumber="346"><td class="num" id="LN346">346</td><td class="line"> sensors_applet_plugin_add_sensor (sensors,</td></tr> +<tr class="codeline" data-linenumber="347"><td class="num" id="LN347">347</td><td class="line"> id,</td></tr> +<tr class="codeline" data-linenumber="348"><td class="num" id="LN348">348</td><td class="line"> <span class='string_literal'>"Disk Temperature"</span>,</td></tr> +<tr class="codeline" data-linenumber="349"><td class="num" id="LN349">349</td><td class="line"> model,</td></tr> +<tr class="codeline" data-linenumber="350"><td class="num" id="LN350">350</td><td class="line"> TEMP_SENSOR,</td></tr> +<tr class="codeline" data-linenumber="351"><td class="num" id="LN351">351</td><td class="line"> <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="352"><td class="num" id="LN352">352</td><td class="line"> HDD_ICON,</td></tr> +<tr class="codeline" data-linenumber="353"><td class="num" id="LN353">353</td><td class="line"> <span class='macro'>DEFAULT_GRAPH_COLOR<span class='macro_popup'>"#ff0000"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="354"><td class="num" id="LN354">354</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="355"><td class="num" id="LN355">355</td><td class="line"> g_debug (<span class='string_literal'>"Added %s"</span>, id);</td></tr> +<tr class="codeline" data-linenumber="356"><td class="num" id="LN356">356</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="357"><td class="num" id="LN357">357</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="358"><td class="num" id="LN358">358</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Added %s"</span>, id);</td></tr> +<tr class="codeline" data-linenumber="359"><td class="num" id="LN359">359</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="360"><td class="num" id="LN360">360</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="361"><td class="num" id="LN361">361</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="362"><td class="num" id="LN362">362</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="363"><td class="num" id="LN363">363</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="364"><td class="num" id="LN364">364</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"No temp data for device: %s\n"</span>, key);</td></tr> +<tr class="codeline" data-linenumber="365"><td class="num" id="LN365">365</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="366"><td class="num" id="LN366">366</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="367"><td class="num" id="LN367">367</td><td class="line"> g_debug (<span class='string_literal'>"No temp data for device: %s\n"</span>, key);</td></tr> +<tr class="codeline" data-linenumber="368"><td class="num" id="LN368">368</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="369"><td class="num" id="LN369">369</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="370"><td class="num" id="LN370">370</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="371"><td class="num" id="LN371">371</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"b4 free1"</span>);</td></tr> +<tr class="codeline" data-linenumber="372"><td class="num" id="LN372">372</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="373"><td class="num" id="LN373">373</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="374"><td class="num" id="LN374">374</td><td class="line"> g_free (id);</td></tr> +<tr class="codeline" data-linenumber="375"><td class="num" id="LN375">375</td><td class="line"> g_free (model);</td></tr> +<tr class="codeline" data-linenumber="376"><td class="num" id="LN376">376</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="377"><td class="num" id="LN377">377</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="378"><td class="num" id="LN378">378</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="379"><td class="num" id="LN379">379</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="380"><td class="num" id="LN380">380</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"b4 free2"</span>);</td></tr> +<tr class="codeline" data-linenumber="381"><td class="num" id="LN381">381</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="382"><td class="num" id="LN382">382</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="383"><td class="num" id="LN383">383</td><td class="line"> <span class='comment'>/* free propdict, propdict2</span></td></tr> +<tr class="codeline" data-linenumber="384"><td class="num" id="LN384">384</td><td class="line"> <span class='comment'>* g_variant_dict_unref() may not work a few times, gives error</span></td></tr> +<tr class="codeline" data-linenumber="385"><td class="num" id="LN385">385</td><td class="line"> <span class='comment'>* this one seems to do fine */</span></td></tr> +<tr class="codeline" data-linenumber="386"><td class="num" id="LN386">386</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict) {g_variant_unref (propdict);}</td></tr> +<tr class="codeline" data-linenumber="387"><td class="num" id="LN387">387</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict2) {g_variant_unref (propdict2);}</td></tr> +<tr class="codeline" data-linenumber="388"><td class="num" id="LN388">388</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="389"><td class="num" id="LN389">389</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="390"><td class="num" id="LN390">390</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"b4 free3"</span>);</td></tr> +<tr class="codeline" data-linenumber="391"><td class="num" id="LN391">391</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="392"><td class="num" id="LN392">392</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="393"><td class="num" id="LN393">393</td><td class="line"> g_free (key);</td></tr> +<tr class="codeline" data-linenumber="394"><td class="num" id="LN394">394</td><td class="line"> g_variant_unref (value);</td></tr> +<tr class="codeline" data-linenumber="395"><td class="num" id="LN395">395</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="396"><td class="num" id="LN396">396</td><td class="line"> } <span class='comment'>/* end of while loop */</span></td></tr> +<tr class="codeline" data-linenumber="397"><td class="num" id="LN397">397</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="398"><td class="num" id="LN398">398</td><td class="line"> g_variant_unref (managed_objects);</td></tr> +<tr class="codeline" data-linenumber="399"><td class="num" id="LN399">399</td><td class="line"> <span class='macro'>g_clear_object (&proxy)<span class='macro_popup'>do { _Static_assert (sizeof *((&proxy)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&proxy<br>))) _pp = ((&proxy)); __typeof__ (*((&proxy))) _ptr =<br> *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref) (_ptr); }<br> while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="400"><td class="num" id="LN400">400</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == devices) {</td></tr> +<tr class="codeline" data-linenumber="401"><td class="num" id="LN401">401</td><td class="line"> <span class='macro'>g_clear_object (&connection)<span class='macro_popup'>do { _Static_assert (sizeof *((&connection)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&connection<br>))) _pp = ((&connection)); __typeof__ (*((&connection<br>))) _ptr = *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref<br>) (_ptr); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="402"><td class="num" id="LN402">402</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="403"><td class="num" id="LN403">403</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="404"><td class="num" id="LN404">404</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="405"><td class="num" id="LN405">405</td><td class="line"><span class='comment'>/* this function is called every refresh cycle */</span></td></tr> +<tr class="codeline" data-linenumber="406"><td class="num" id="LN406">406</td><td class="line"><span class='keyword'>static</span> gdouble udisks2_plugin_get_sensor_value (<span class='keyword'>const</span> gchar *path,</td></tr> +<tr class="codeline" data-linenumber="407"><td class="num" id="LN407">407</td><td class="line"> <span class='keyword'>const</span> gchar *id,</td></tr> +<tr class="codeline" data-linenumber="408"><td class="num" id="LN408">408</td><td class="line"> SensorType type,</td></tr> +<tr class="codeline" data-linenumber="409"><td class="num" id="LN409">409</td><td class="line"> GError **error) {</td></tr> +<tr class="codeline" data-linenumber="410"><td class="num" id="LN410">410</td><td class="line"> DevInfo *info = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="411"><td class="num" id="LN411">411</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="412"><td class="num" id="LN412">412</td><td class="line"> <span class='comment'>/* get device stuct from data store */</span></td></tr> +<tr class="codeline" data-linenumber="413"><td class="num" id="LN413">413</td><td class="line"> info = (DevInfo *) g_hash_table_lookup (devices, path);</td></tr> +<tr class="codeline" data-linenumber="414"><td class="num" id="LN414">414</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == info) {</td></tr> +<tr class="codeline" data-linenumber="415"><td class="num" id="LN415">415</td><td class="line"> g_set_error (error, <span class='macro'>SENSORS_APPLET_PLUGIN_ERROR<span class='macro_popup'>(sensors_applet_plugin_error_quark())</span></span>, 0, <span class='string_literal'>"Error finding disk with path %s"</span>, path);</td></tr> +<tr class="codeline" data-linenumber="416"><td class="num" id="LN416">416</td><td class="line"> <span class='keyword'>return</span> 0.0;</td></tr> +<tr class="codeline" data-linenumber="417"><td class="num" id="LN417">417</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="418"><td class="num" id="LN418">418</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="419"><td class="num" id="LN419">419</td><td class="line"> <span class='keyword'>if</span> (info->error) {</td></tr> +<tr class="codeline" data-linenumber="420"><td class="num" id="LN420">420</td><td class="line"> *error = info->error;</td></tr> +<tr class="codeline" data-linenumber="421"><td class="num" id="LN421">421</td><td class="line"> info->error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="422"><td class="num" id="LN422">422</td><td class="line"> <span class='keyword'>return</span> 0.0;</td></tr> +<tr class="codeline" data-linenumber="423"><td class="num" id="LN423">423</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="424"><td class="num" id="LN424">424</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="425"><td class="num" id="LN425">425</td><td class="line"> <span class='comment'>/* refresh device temp */</span></td></tr> +<tr class="codeline" data-linenumber="426"><td class="num" id="LN426">426</td><td class="line"> update_device (info);</td></tr> +<tr class="codeline" data-linenumber="427"><td class="num" id="LN427">427</td><td class="line"> <span class='keyword'>return</span> info->temp;</td></tr> +<tr class="codeline" data-linenumber="428"><td class="num" id="LN428">428</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="429"><td class="num" id="LN429">429</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="430"><td class="num" id="LN430">430</td><td class="line"><span class='comment'>/* API functions */</span></td></tr> +<tr class="codeline" data-linenumber="431"><td class="num" id="LN431">431</td><td class="line"><span class='keyword'>const</span> gchar *sensors_applet_plugin_name (<span class='keyword'>void</span>) {</td></tr> +<tr class="codeline" data-linenumber="432"><td class="num" id="LN432">432</td><td class="line"> <span class='keyword'>return</span> plugin_name;</td></tr> +<tr class="codeline" data-linenumber="433"><td class="num" id="LN433">433</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="434"><td class="num" id="LN434">434</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="435"><td class="num" id="LN435">435</td><td class="line"><span class='keyword'>static</span> GList *udisks2_plugin_init (<span class='keyword'>void</span>) {</td></tr> +<tr class="codeline" data-linenumber="436"><td class="num" id="LN436">436</td><td class="line"> GList *sensors = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="437"><td class="num" id="LN437">437</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="438"><td class="num" id="LN438">438</td><td class="line"> udisks2_plugin_get_sensors (&sensors);</td></tr> +<tr class="codeline" data-linenumber="439"><td class="num" id="LN439">439</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="440"><td class="num" id="LN440">440</td><td class="line"> <span class='keyword'>return</span> sensors;</td></tr> +<tr class="codeline" data-linenumber="441"><td class="num" id="LN441">441</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="442"><td class="num" id="LN442">442</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="443"><td class="num" id="LN443">443</td><td class="line">GList *sensors_applet_plugin_init (<span class='keyword'>void</span>) {</td></tr> +<tr class="codeline" data-linenumber="444"><td class="num" id="LN444">444</td><td class="line"> <span class='keyword'>return</span> udisks2_plugin_init ();</td></tr> +<tr class="codeline" data-linenumber="445"><td class="num" id="LN445">445</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="446"><td class="num" id="LN446">446</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="447"><td class="num" id="LN447">447</td><td class="line">gdouble sensors_applet_plugin_get_sensor_value (<span class='keyword'>const</span> gchar *path,</td></tr> +<tr class="codeline" data-linenumber="448"><td class="num" id="LN448">448</td><td class="line"> <span class='keyword'>const</span> gchar *id,</td></tr> +<tr class="codeline" data-linenumber="449"><td class="num" id="LN449">449</td><td class="line"> SensorType type,</td></tr> +<tr class="codeline" data-linenumber="450"><td class="num" id="LN450">450</td><td class="line"> GError **error) {</td></tr> +<tr class="codeline" data-linenumber="451"><td class="num" id="LN451">451</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="452"><td class="num" id="LN452">452</td><td class="line"> <span class='keyword'>return</span> udisks2_plugin_get_sensor_value (path, id, type, error);</td></tr> +<tr class="codeline" data-linenumber="453"><td class="num" id="LN453">453</td><td class="line">}</td></tr> +</table></body></html> diff --git a/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-407f6f.html b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-407f6f.html new file mode 100644 index 0000000..ac26f98 --- /dev/null +++ b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-407f6f.html @@ -0,0 +1,2005 @@ +<!doctype html> +<html> +<head> +<title>sensors-applet.c</title> + +<style type="text/css"> +body { color:#000000; background-color:#ffffff } +body { font-family:Helvetica, sans-serif; font-size:10pt } +h1 { font-size:14pt } +.FileName { margin-top: 5px; margin-bottom: 5px; display: inline; } +.FileNav { margin-left: 5px; margin-right: 5px; display: inline; } +.FileNav a { text-decoration:none; font-size: larger; } +.divider { margin-top: 30px; margin-bottom: 30px; height: 15px; } +.divider { background-color: gray; } +.code { border-collapse:collapse; width:100%; } +.code { font-family: "Monospace", monospace; font-size:10pt } +.code { line-height: 1.2em } +.comment { color: green; font-style: oblique } +.keyword { color: blue } +.string_literal { color: red } +.directive { color: darkmagenta } + +/* Macros and variables could have pop-up notes hidden by default. + - Macro pop-up: expansion of the macro + - Variable pop-up: value (table) of the variable */ +.macro_popup, .variable_popup { display: none; } + +/* Pop-up appears on mouse-hover event. */ +.macro:hover .macro_popup, .variable:hover .variable_popup { + display: block; + padding: 2px; + -webkit-border-radius:5px; + -webkit-box-shadow:1px 1px 7px #000; + border-radius:5px; + box-shadow:1px 1px 7px #000; + position: absolute; + top: -1em; + left:10em; + z-index: 1 +} + +.macro_popup { + border: 2px solid red; + background-color:#FFF0F0; + font-weight: normal; +} + +.variable_popup { + border: 2px solid blue; + background-color:#F0F0FF; + font-weight: bold; + font-family: Helvetica, sans-serif; + font-size: 9pt; +} + +/* Pop-up notes needs a relative position as a base where they pops up. */ +.macro, .variable { + background-color: PaleGoldenRod; + position: relative; +} +.macro { color: DarkMagenta; } + +#tooltiphint { + position: fixed; + width: 50em; + margin-left: -25em; + left: 50%; + padding: 10px; + border: 1px solid #b0b0b0; + border-radius: 2px; + box-shadow: 1px 1px 7px black; + background-color: #c0c0c0; + z-index: 2; +} + +.num { width:2.5em; padding-right:2ex; background-color:#eeeeee } +.num { text-align:right; font-size:8pt } +.num { color:#444444 } +.line { padding-left: 1ex; border-left: 3px solid #ccc } +.line { white-space: pre } +.msg { -webkit-box-shadow:1px 1px 7px #000 } +.msg { box-shadow:1px 1px 7px #000 } +.msg { -webkit-border-radius:5px } +.msg { border-radius:5px } +.msg { font-family:Helvetica, sans-serif; font-size:8pt } +.msg { float:left } +.msg { position:relative } +.msg { padding:0.25em 1ex 0.25em 1ex } +.msg { margin-top:10px; margin-bottom:10px } +.msg { font-weight:bold } +.msg { max-width:60em; word-wrap: break-word; white-space: pre-wrap } +.msgT { padding:0x; spacing:0x } +.msgEvent { background-color:#fff8b4; color:#000000 } +.msgControl { background-color:#bbbbbb; color:#000000 } +.msgNote { background-color:#ddeeff; color:#000000 } +.mrange { background-color:#dfddf3 } +.mrange { border-bottom:1px solid #6F9DBE } +.PathIndex { font-weight: bold; padding:0px 5px; margin-right:5px; } +.PathIndex { -webkit-border-radius:8px } +.PathIndex { border-radius:8px } +.PathIndexEvent { background-color:#bfba87 } +.PathIndexControl { background-color:#8c8c8c } +.PathIndexPopUp { background-color: #879abc; } +.PathNav a { text-decoration:none; font-size: larger } +.CodeInsertionHint { font-weight: bold; background-color: #10dd10 } +.CodeRemovalHint { background-color:#de1010 } +.CodeRemovalHint { border-bottom:1px solid #6F9DBE } +.msg.selected{ background-color:orange !important; } + +table.simpletable { + padding: 5px; + font-size:12pt; + margin:20px; + border-collapse: collapse; border-spacing: 0px; +} +td.rowname { + text-align: right; + vertical-align: top; + font-weight: bold; + color:#444444; + padding-right:2ex; +} + +/* Hidden text. */ +input.spoilerhider + label { + cursor: pointer; + text-decoration: underline; + display: block; +} +input.spoilerhider { + display: none; +} +input.spoilerhider ~ .spoiler { + overflow: hidden; + margin: 10px auto 0; + height: 0; + opacity: 0; +} +input.spoilerhider:checked + label + .spoiler{ + height: auto; + opacity: 1; +} +</style> +</head> +<body> +<!-- BUGDESC Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption --> + +<!-- BUGTYPE Cast from non-struct type to struct type --> + +<!-- BUGCATEGORY Logic error --> + +<!-- BUGFILE /rootdir/sensors-applet/sensors-applet.c --> + +<!-- FILENAME sensors-applet.c --> + +<!-- FUNCTIONNAME prefs_cb --> + +<!-- ISSUEHASHCONTENTOFLINEINCONTEXT 407f6fd6b71a8f5fd66d529440e47789 --> + +<!-- BUGLINE 61 --> + +<!-- BUGCOLUMN 22 --> + +<!-- BUGPATHLENGTH 1 --> + +<!-- BUGMETAEND --> +<!-- REPORTHEADER --> +<h3>Bug Summary</h3> +<table class="simpletable"> +<tr><td class="rowname">File:</td><td>sensors-applet/sensors-applet.c</td></tr> +<tr><td class="rowname">Warning:</td><td><a href="#EndPath">line 61, column 22</a><br />Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption</td></tr> + +</table> +<!-- REPORTSUMMARYEXTRA --> +<h3>Annotated Source Code</h3> +<p>Press <a href="#" onclick="toggleHelp(); return false;">'?'</a> + to see keyboard shortcuts</p> +<input type="checkbox" class="spoilerhider" id="showinvocation" /> +<label for="showinvocation" >Show analyzer invocation</label> +<div class="spoiler">clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name sensors-applet.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/sensors-applet -resource-dir /usr/lib64/clang/16 -D HAVE_CONFIG_H -I . -D MATELOCALEDIR="/usr/local/share/locale/" -D G_LOG_DOMAIN="sensors-applet" -D PIXMAPS_DIR="/usr/local/share/pixmaps/mate-sensors-applet/" -D DATADIR="/usr/local/share" -D LIBDIR="/usr/local/lib" -D UIDIR="/usr/local/share/mate-sensors-applet/ui" -D SENSORS_APPLET_PLUGIN_DIR="/usr/local/lib/mate-sensors-applet/plugins" -D SYSCONFDIR="/usr/local/etc" -D PREFIX="/usr/local" -I .. -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/mate-panel-4.0/libmate-panel-applet -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/cairo -I /usr/include/libpng16 -I /usr/include/freetype2 -I /usr/include/harfbuzz -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libxml2 -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -D PIC -internal-isystem /usr/lib64/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/sensors-applet -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2023-06-12-021133-6157-1 -x c sensors-applet.c +</div> +<div id='tooltiphint' hidden="true"> + <p>Keyboard shortcuts: </p> + <ul> + <li>Use 'j/k' keys for keyboard navigation</li> + <li>Use 'Shift+S' to show/hide relevant lines</li> + <li>Use '?' to toggle this window</li> + </ul> + <a href="#" onclick="toggleHelp(); return false;">Close</a> +</div> +<script type='text/javascript'> +var relevant_lines = {"1": {"61": 1}}; + +var filterCounterexample = function (hide) { + var tables = document.getElementsByClassName("code"); + for (var t=0; t<tables.length; t++) { + var table = tables[t]; + var file_id = table.getAttribute("data-fileid"); + var lines_in_fid = relevant_lines[file_id]; + if (!lines_in_fid) { + lines_in_fid = {}; + } + var lines = table.getElementsByClassName("codeline"); + for (var i=0; i<lines.length; i++) { + var el = lines[i]; + var lineNo = el.getAttribute("data-linenumber"); + if (!lines_in_fid[lineNo]) { + if (hide) { + el.setAttribute("hidden", ""); + } else { + el.removeAttribute("hidden"); + } + } + } + } +} + +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + // SHIFT + S + if (event.shiftKey && event.keyCode == 83) { + var checked = document.getElementsByName("showCounterexample")[0].checked; + filterCounterexample(!checked); + document.getElementsByName("showCounterexample")[0].click(); + } else { + return; + } + event.preventDefault(); +}, true); + +document.addEventListener("DOMContentLoaded", function() { + document.querySelector('input[name="showCounterexample"]').onchange= + function (event) { + filterCounterexample(this.checked); + }; +}); +</script> + +<form> + <input type="checkbox" name="showCounterexample" id="showCounterexample" /> + <label for="showCounterexample"> + Show only relevant lines + </label> + <input type="checkbox" name="showArrows" + id="showArrows" style="margin-left: 10px" /> + <label for="showArrows"> + Show control flow arrows + </label> +</form> + +<script type='text/javascript'> +// Return range of numbers from a range [lower, upper). +function range(lower, upper) { + var array = []; + for (var i = lower; i <= upper; ++i) { + array.push(i); + } + return array; +} + +var getRelatedArrowIndices = function(pathId) { + // HTML numeration of events is a bit different than it is in the path. + // Everything is rotated one step to the right, so the last element + // (error diagnostic) has index 0. + if (pathId == 0) { + // arrowIndices has at least 2 elements + pathId = arrowIndices.length - 1; + } + + return range(arrowIndices[pathId], arrowIndices[pathId - 1]); +} + +var highlightArrowsForSelectedEvent = function() { + const selectedNum = findNum(); + const arrowIndicesToHighlight = getRelatedArrowIndices(selectedNum); + arrowIndicesToHighlight.forEach((index) => { + var arrow = document.querySelector("#arrow" + index); + if(arrow) { + classListAdd(arrow, "selected") + } + }); +} + +var getAbsoluteBoundingRect = function(element) { + const relative = element.getBoundingClientRect(); + return { + left: relative.left + window.pageXOffset, + right: relative.right + window.pageXOffset, + top: relative.top + window.pageYOffset, + bottom: relative.bottom + window.pageYOffset, + height: relative.height, + width: relative.width + }; +} + +var drawArrow = function(index) { + // This function is based on the great answer from SO: + // https://stackoverflow.com/a/39575674/11582326 + var start = document.querySelector("#start" + index); + var end = document.querySelector("#end" + index); + var arrow = document.querySelector("#arrow" + index); + + var startRect = getAbsoluteBoundingRect(start); + var endRect = getAbsoluteBoundingRect(end); + + // It is an arrow from a token to itself, no need to visualize it. + if (startRect.top == endRect.top && + startRect.left == endRect.left) + return; + + // Each arrow is a very simple Bézier curve, with two nodes and + // two handles. So, we need to calculate four points in the window: + // * start node + var posStart = { x: 0, y: 0 }; + // * end node + var posEnd = { x: 0, y: 0 }; + // * handle for the start node + var startHandle = { x: 0, y: 0 }; + // * handle for the end node + var endHandle = { x: 0, y: 0 }; + // One can visualize it as follows: + // + // start handle + // / + // X"""_.-""""X + // .' \ + // / start node + // | + // | + // | end node + // \ / + // `->X + // X-' + // \ + // end handle + // + // NOTE: (0, 0) is the top left corner of the window. + + // We have 3 similar, but still different scenarios to cover: + // + // 1. Two tokens on different lines. + // -xxx + // / + // \ + // -> xxx + // In this situation, we draw arrow on the left curving to the left. + // 2. Two tokens on the same line, and the destination is on the right. + // ____ + // / \ + // / V + // xxx xxx + // In this situation, we draw arrow above curving upwards. + // 3. Two tokens on the same line, and the destination is on the left. + // xxx xxx + // ^ / + // \____/ + // In this situation, we draw arrow below curving downwards. + const onDifferentLines = startRect.top <= endRect.top - 5 || + startRect.top >= endRect.top + 5; + const leftToRight = startRect.left < endRect.left; + + // NOTE: various magic constants are chosen empirically for + // better positioning and look + if (onDifferentLines) { + // Case #1 + const topToBottom = startRect.top < endRect.top; + posStart.x = startRect.left - 1; + // We don't want to start it at the top left corner of the token, + // it doesn't feel like this is where the arrow comes from. + // For this reason, we start it in the middle of the left side + // of the token. + posStart.y = startRect.top + startRect.height / 2; + + // End node has arrow head and we give it a bit more space. + posEnd.x = endRect.left - 4; + posEnd.y = endRect.top; + + // Utility object with x and y offsets for handles. + var curvature = { + // We want bottom-to-top arrow to curve a bit more, so it doesn't + // overlap much with top-to-bottom curves (much more frequent). + x: topToBottom ? 15 : 25, + y: Math.min((posEnd.y - posStart.y) / 3, 10) + } + + // When destination is on the different line, we can make a + // curvier arrow because we have space for it. + // So, instead of using + // + // startHandle.x = posStart.x - curvature.x + // endHandle.x = posEnd.x - curvature.x + // + // We use the leftmost of these two values for both handles. + startHandle.x = Math.min(posStart.x, posEnd.x) - curvature.x; + endHandle.x = startHandle.x; + + // Curving downwards from the start node... + startHandle.y = posStart.y + curvature.y; + // ... and upwards from the end node. + endHandle.y = posEnd.y - curvature.y; + + } else if (leftToRight) { + // Case #2 + // Starting from the top right corner... + posStart.x = startRect.right - 1; + posStart.y = startRect.top; + + // ...and ending at the top left corner of the end token. + posEnd.x = endRect.left + 1; + posEnd.y = endRect.top - 1; + + // Utility object with x and y offsets for handles. + var curvature = { + x: Math.min((posEnd.x - posStart.x) / 3, 15), + y: 5 + } + + // Curving to the right... + startHandle.x = posStart.x + curvature.x; + // ... and upwards from the start node. + startHandle.y = posStart.y - curvature.y; + + // And to the left... + endHandle.x = posEnd.x - curvature.x; + // ... and upwards from the end node. + endHandle.y = posEnd.y - curvature.y; + + } else { + // Case #3 + // Starting from the bottom right corner... + posStart.x = startRect.right; + posStart.y = startRect.bottom; + + // ...and ending also at the bottom right corner, but of the end token. + posEnd.x = endRect.right - 1; + posEnd.y = endRect.bottom + 1; + + // Utility object with x and y offsets for handles. + var curvature = { + x: Math.min((posStart.x - posEnd.x) / 3, 15), + y: 5 + } + + // Curving to the left... + startHandle.x = posStart.x - curvature.x; + // ... and downwards from the start node. + startHandle.y = posStart.y + curvature.y; + + // And to the right... + endHandle.x = posEnd.x + curvature.x; + // ... and downwards from the end node. + endHandle.y = posEnd.y + curvature.y; + } + + // Put it all together into a path. + // More information on the format: + // https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths + var pathStr = "M" + posStart.x + "," + posStart.y + " " + + "C" + startHandle.x + "," + startHandle.y + " " + + endHandle.x + "," + endHandle.y + " " + + posEnd.x + "," + posEnd.y; + + arrow.setAttribute("d", pathStr); +}; + +var drawArrows = function() { + const numOfArrows = document.querySelectorAll("path[id^=arrow]").length; + for (var i = 0; i < numOfArrows; ++i) { + drawArrow(i); + } +} + +var toggleArrows = function(event) { + const arrows = document.querySelector("#arrows"); + if (event.target.checked) { + arrows.setAttribute("visibility", "visible"); + } else { + arrows.setAttribute("visibility", "hidden"); + } +} + +window.addEventListener("resize", drawArrows); +document.addEventListener("DOMContentLoaded", function() { + // Whenever we show invocation, locations change, i.e. we + // need to redraw arrows. + document + .querySelector('input[id="showinvocation"]') + .addEventListener("click", drawArrows); + // Hiding irrelevant lines also should cause arrow rerender. + document + .querySelector('input[name="showCounterexample"]') + .addEventListener("change", drawArrows); + document + .querySelector('input[name="showArrows"]') + .addEventListener("change", toggleArrows); + drawArrows(); + // Default highlighting for the last event. + highlightArrowsForSelectedEvent(); +}); +</script> + +<script type='text/javascript'> +var digitMatcher = new RegExp("[0-9]+"); + +var querySelectorAllArray = function(selector) { + return Array.prototype.slice.call( + document.querySelectorAll(selector)); +} + +document.addEventListener("DOMContentLoaded", function() { + querySelectorAllArray(".PathNav > a").forEach( + function(currentValue, currentIndex) { + var hrefValue = currentValue.getAttribute("href"); + currentValue.onclick = function() { + scrollTo(document.querySelector(hrefValue)); + return false; + }; + }); +}); + +var findNum = function() { + var s = document.querySelector(".msg.selected"); + if (!s || s.id == "EndPath") { + return 0; + } + var out = parseInt(digitMatcher.exec(s.id)[0]); + return out; +}; + +var classListAdd = function(el, theClass) { + if(!el.className.baseVal) + el.className += " " + theClass; + else + el.className.baseVal += " " + theClass; +}; + +var classListRemove = function(el, theClass) { + var className = (!el.className.baseVal) ? + el.className : el.className.baseVal; + className = className.replace(" " + theClass, ""); + if(!el.className.baseVal) + el.className = className; + else + el.className.baseVal = className; +}; + +var scrollTo = function(el) { + querySelectorAllArray(".selected").forEach(function(s) { + classListRemove(s, "selected"); + }); + classListAdd(el, "selected"); + window.scrollBy(0, el.getBoundingClientRect().top - + (window.innerHeight / 2)); + highlightArrowsForSelectedEvent(); +}; + +var move = function(num, up, numItems) { + if (num == 1 && up || num == numItems - 1 && !up) { + return 0; + } else if (num == 0 && up) { + return numItems - 1; + } else if (num == 0 && !up) { + return 1 % numItems; + } + return up ? num - 1 : num + 1; +} + +var numToId = function(num) { + if (num == 0) { + return document.getElementById("EndPath") + } + return document.getElementById("Path" + num); +}; + +var navigateTo = function(up) { + var numItems = document.querySelectorAll( + ".line > .msgEvent, .line > .msgControl").length; + var currentSelected = findNum(); + var newSelected = move(currentSelected, up, numItems); + var newEl = numToId(newSelected, numItems); + + // Scroll element into center. + scrollTo(newEl); +}; + +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + // key 'j' + if (event.keyCode == 74) { + navigateTo(/*up=*/false); + // key 'k' + } else if (event.keyCode == 75) { + navigateTo(/*up=*/true); + } else { + return; + } + event.preventDefault(); +}, true); +</script> + +<script type='text/javascript'> + +var toggleHelp = function() { + var hint = document.querySelector("#tooltiphint"); + var attributeName = "hidden"; + if (hint.hasAttribute(attributeName)) { + hint.removeAttribute(attributeName); + } else { + hint.setAttribute("hidden", "true"); + } +}; +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + if (event.key == "?") { + toggleHelp(); + } else { + return; + } + event.preventDefault(); +}); +</script> + +<style type="text/css"> + svg { + position:absolute; + top:0; + left:0; + height:100%; + width:100%; + pointer-events: none; + overflow: visible + } + .arrow { + stroke-opacity: 0.2; + stroke-width: 1; + marker-end: url(#arrowhead); + } + + .arrow.selected { + stroke-opacity: 0.6; + stroke-width: 2; + marker-end: url(#arrowheadSelected); + } + + .arrowhead { + orient: auto; + stroke: none; + opacity: 0.6; + fill: blue; + } +</style> +<svg xmlns="http://www.w3.org/2000/svg"> + <defs> + <marker id="arrowheadSelected" class="arrowhead" opacity="0.6" + viewBox="0 0 10 10" refX="3" refY="5" + markerWidth="4" markerHeight="4"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + <marker id="arrowhead" class="arrowhead" opacity="0.2" + viewBox="0 0 10 10" refX="3" refY="5" + markerWidth="4" markerHeight="4"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + </defs> + <g id="arrows" fill="none" stroke="blue" visibility="hidden"> + + </g> +</svg> +<script type='text/javascript'> +const arrowIndices = [ 0,0 ] +</script> +<table class="code" data-fileid="1"> +<tr class="codeline" data-linenumber="1"><td class="num" id="LN1">1</td><td class="line"><span class='comment'>/*</span></td></tr> +<tr class="codeline" data-linenumber="2"><td class="num" id="LN2">2</td><td class="line"> <span class='comment'>* Copyright (C) 2005-2009 Alex Murray <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="3"><td class="num" id="LN3">3</td><td class="line"> <span class='comment'>* Copyright (C) 2012-2021 MATE Developers</span></td></tr> +<tr class="codeline" data-linenumber="4"><td class="num" id="LN4">4</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="5"><td class="num" id="LN5">5</td><td class="line"> <span class='comment'>* This program is free software; you can redistribute it and/or modify</span></td></tr> +<tr class="codeline" data-linenumber="6"><td class="num" id="LN6">6</td><td class="line"> <span class='comment'>* it under the terms of the GNU General Public License as published by</span></td></tr> +<tr class="codeline" data-linenumber="7"><td class="num" id="LN7">7</td><td class="line"> <span class='comment'>* the Free Software Foundation; either version 2 of the License, or</span></td></tr> +<tr class="codeline" data-linenumber="8"><td class="num" id="LN8">8</td><td class="line"> <span class='comment'>* (at your option) any later version.</span></td></tr> +<tr class="codeline" data-linenumber="9"><td class="num" id="LN9">9</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="10"><td class="num" id="LN10">10</td><td class="line"> <span class='comment'>* This program is distributed in the hope that it will be useful,</span></td></tr> +<tr class="codeline" data-linenumber="11"><td class="num" id="LN11">11</td><td class="line"> <span class='comment'>* but WITHOUT ANY WARRANTY; without even the implied warranty of</span></td></tr> +<tr class="codeline" data-linenumber="12"><td class="num" id="LN12">12</td><td class="line"> <span class='comment'>* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></td></tr> +<tr class="codeline" data-linenumber="13"><td class="num" id="LN13">13</td><td class="line"> <span class='comment'>* GNU General Public License for more details.</span></td></tr> +<tr class="codeline" data-linenumber="14"><td class="num" id="LN14">14</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="15"><td class="num" id="LN15">15</td><td class="line"> <span class='comment'>* You should have received a copy of the GNU General Public License</span></td></tr> +<tr class="codeline" data-linenumber="16"><td class="num" id="LN16">16</td><td class="line"> <span class='comment'>* along with this program; if not, write to the Free Software</span></td></tr> +<tr class="codeline" data-linenumber="17"><td class="num" id="LN17">17</td><td class="line"> <span class='comment'>* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</span></td></tr> +<tr class="codeline" data-linenumber="18"><td class="num" id="LN18">18</td><td class="line"> <span class='comment'>*/</span></td></tr> +<tr class="codeline" data-linenumber="19"><td class="num" id="LN19">19</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="20"><td class="num" id="LN20">20</td><td class="line"><span class='comment'>/** Contain the functions for operating on the SensorsApplet structure</span></td></tr> +<tr class="codeline" data-linenumber="21"><td class="num" id="LN21">21</td><td class="line"> <span class='comment'>* (represents the applet itself, and its associated variables.</span></td></tr> +<tr class="codeline" data-linenumber="22"><td class="num" id="LN22">22</td><td class="line"> <span class='comment'>*/</span></td></tr> +<tr class="codeline" data-linenumber="23"><td class="num" id="LN23">23</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="24"><td class="num" id="LN24">24</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_CONFIG_H<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="25"><td class="num" id="LN25">25</td><td class="line"><span class='directive'>#include "config.h"</span></td></tr> +<tr class="codeline" data-linenumber="26"><td class="num" id="LN26">26</td><td class="line"><span class='directive'>#endif /* HAVE_CONFIG_H */</span></td></tr> +<tr class="codeline" data-linenumber="27"><td class="num" id="LN27">27</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="28"><td class="num" id="LN28">28</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_UNISTD_H<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="29"><td class="num" id="LN29">29</td><td class="line"><span class='directive'>#include <unistd.h></span></td></tr> +<tr class="codeline" data-linenumber="30"><td class="num" id="LN30">30</td><td class="line"><span class='directive'>#endif /* HAVE_UNISTD_H */</span></td></tr> +<tr class="codeline" data-linenumber="31"><td class="num" id="LN31">31</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="32"><td class="num" id="LN32">32</td><td class="line"><span class='directive'>#include <glib/gi18n.h></span></td></tr> +<tr class="codeline" data-linenumber="33"><td class="num" id="LN33">33</td><td class="line"><span class='directive'>#include <glib/gprintf.h></span></td></tr> +<tr class="codeline" data-linenumber="34"><td class="num" id="LN34">34</td><td class="line"><span class='directive'>#include <gio/gio.h></span></td></tr> +<tr class="codeline" data-linenumber="35"><td class="num" id="LN35">35</td><td class="line"><span class='directive'>#include "sensors-applet.h"</span></td></tr> +<tr class="codeline" data-linenumber="36"><td class="num" id="LN36">36</td><td class="line"><span class='directive'>#include "active-sensor.h"</span></td></tr> +<tr class="codeline" data-linenumber="37"><td class="num" id="LN37">37</td><td class="line"><span class='directive'>#include "sensors-applet-settings.h"</span></td></tr> +<tr class="codeline" data-linenumber="38"><td class="num" id="LN38">38</td><td class="line"><span class='directive'>#include "sensors-applet-plugins.h"</span></td></tr> +<tr class="codeline" data-linenumber="39"><td class="num" id="LN39">39</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="40"><td class="num" id="LN40">40</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_LIBNOTIFY<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="41"><td class="num" id="LN41">41</td><td class="line"><span class='directive'>#include "active-sensor-libnotify.h"</span></td></tr> +<tr class="codeline" data-linenumber="42"><td class="num" id="LN42">42</td><td class="line"><span class='directive'>#define <span class='macro'>DEFAULT_NOTIFY_TIMEOUT<span class='macro_popup'>3000</span></span> 3000</span></td></tr> +<tr class="codeline" data-linenumber="43"><td class="num" id="LN43">43</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="44"><td class="num" id="LN44">44</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="45"><td class="num" id="LN45">45</td><td class="line"><span class='directive'>#include "prefs-dialog.h"</span></td></tr> +<tr class="codeline" data-linenumber="46"><td class="num" id="LN46">46</td><td class="line"><span class='directive'>#include "about-dialog.h"</span></td></tr> +<tr class="codeline" data-linenumber="47"><td class="num" id="LN47">47</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="48"><td class="num" id="LN48">48</td><td class="line"><span class='directive'>#define <span class='macro'>SENSORS_APPLET_MENU_FILE<span class='macro_popup'>"SensorsApplet.xml"</span></span> "SensorsApplet.xml"</span></td></tr> +<tr class="codeline" data-linenumber="49"><td class="num" id="LN49">49</td><td class="line"><span class='comment'>/* initially set as sensors_applet->size to ensure a real value is stored */</span></td></tr> +<tr class="codeline" data-linenumber="50"><td class="num" id="LN50">50</td><td class="line"><span class='directive'>#define <span class='macro'>DEFAULT_APPLET_SIZE<span class='macro_popup'>24</span></span> 24</span></td></tr> +<tr class="codeline" data-linenumber="51"><td class="num" id="LN51">51</td><td class="line"><span class='directive'>#define <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span> 2</span></td></tr> +<tr class="codeline" data-linenumber="52"><td class="num" id="LN52">52</td><td class="line"><span class='directive'>#define <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span> 1</span></td></tr> +<tr class="codeline" data-linenumber="53"><td class="num" id="LN53">53</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="54"><td class="num" id="LN54">54</td><td class="line"><span class='comment'>/* builder for sensor sorting verification */</span></td></tr> +<tr class="codeline" data-linenumber="55"><td class="num" id="LN55">55</td><td class="line"><span class='keyword'>static</span> GVariantBuilder gvb_sensors_hash_list;</td></tr> +<tr class="codeline" data-linenumber="56"><td class="num" id="LN56">56</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="57"><td class="num" id="LN57">57</td><td class="line"><span class='comment'>/* callbacks for panel menu */</span></td></tr> +<tr class="codeline" data-linenumber="58"><td class="num" id="LN58">58</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> prefs_cb(GtkAction *action, gpointer *data) {</td></tr> +<tr class="codeline" data-linenumber="59"><td class="num" id="LN59">59</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="60"><td class="num" id="LN60">60</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="61"><td class="num" id="LN61">61</td><td class="line"> sensors_applet = <span class="mrange"><span class="mrange">(SensorsApplet *)data</span></span>;</td></tr> +<tr><td class="num"></td><td class="line"><div id="EndPath" class="msg msgEvent" style="margin-left:22ex; max-width:31em">Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption</div></td></tr> +<tr class="codeline" data-linenumber="62"><td class="num" id="LN62">62</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="63"><td class="num" id="LN63">63</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->prefs_dialog) {</td></tr> +<tr class="codeline" data-linenumber="64"><td class="num" id="LN64">64</td><td class="line"> gtk_window_present(<span class='macro'>GTK_WINDOW(sensors_applet->prefs_dialog->dialog)<span class='macro_popup'>((((GtkWindow*) (void *) ((sensors_applet->prefs_dialog-><br>dialog)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="65"><td class="num" id="LN65">65</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="66"><td class="num" id="LN66">66</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="67"><td class="num" id="LN67">67</td><td class="line"> prefs_dialog_open(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="68"><td class="num" id="LN68">68</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="69"><td class="num" id="LN69">69</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="70"><td class="num" id="LN70">70</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> about_cb(GtkAction *action, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="71"><td class="num" id="LN71">71</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="72"><td class="num" id="LN72">72</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="73"><td class="num" id="LN73">73</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="74"><td class="num" id="LN74">74</td><td class="line"> about_dialog_open(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="75"><td class="num" id="LN75">75</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="76"><td class="num" id="LN76">76</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="77"><td class="num" id="LN77">77</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> help_cb(GtkAction *action, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="78"><td class="num" id="LN78">78</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="79"><td class="num" id="LN79">79</td><td class="line"> GError *error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="80"><td class="num" id="LN80">80</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="81"><td class="num" id="LN81">81</td><td class="line"> gtk_show_uri_on_window(<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='string_literal'>"help:mate-sensors-applet"</span>,</td></tr> +<tr class="codeline" data-linenumber="82"><td class="num" id="LN82">82</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="83"><td class="num" id="LN83">83</td><td class="line"> gtk_get_current_event_time(),</td></tr> +<tr class="codeline" data-linenumber="84"><td class="num" id="LN84">84</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="85"><td class="num" id="LN85">85</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="86"><td class="num" id="LN86">86</td><td class="line"> <span class='keyword'>if</span> (error) {</td></tr> +<tr class="codeline" data-linenumber="87"><td class="num" id="LN87">87</td><td class="line"> g_debug(<span class='string_literal'>"Could not open help document: %s "</span>,error->message);</td></tr> +<tr class="codeline" data-linenumber="88"><td class="num" id="LN88">88</td><td class="line"> g_error_free(error);</td></tr> +<tr class="codeline" data-linenumber="89"><td class="num" id="LN89">89</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="90"><td class="num" id="LN90">90</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="91"><td class="num" id="LN91">91</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="92"><td class="num" id="LN92">92</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> destroy_cb(GtkWidget *widget, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="93"><td class="num" id="LN93">93</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="94"><td class="num" id="LN94">94</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="95"><td class="num" id="LN95">95</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="96"><td class="num" id="LN96">96</td><td class="line"> <span class='comment'>/* destroy dialogs, remove timeout and clear sensors tree and finally the applet */</span></td></tr> +<tr class="codeline" data-linenumber="97"><td class="num" id="LN97">97</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->prefs_dialog != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="98"><td class="num" id="LN98">98</td><td class="line"> <span class='comment'>/* destroy's dialog too */</span></td></tr> +<tr class="codeline" data-linenumber="99"><td class="num" id="LN99">99</td><td class="line"> prefs_dialog_close(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="100"><td class="num" id="LN100">100</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="101"><td class="num" id="LN101">101</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="102"><td class="num" id="LN102">102</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->timeout_id) {</td></tr> +<tr class="codeline" data-linenumber="103"><td class="num" id="LN103">103</td><td class="line"> g_source_remove(sensors_applet->timeout_id);</td></tr> +<tr class="codeline" data-linenumber="104"><td class="num" id="LN104">104</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="105"><td class="num" id="LN105">105</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="106"><td class="num" id="LN106">106</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->settings) {</td></tr> +<tr class="codeline" data-linenumber="107"><td class="num" id="LN107">107</td><td class="line"> g_object_unref (sensors_applet->settings);</td></tr> +<tr class="codeline" data-linenumber="108"><td class="num" id="LN108">108</td><td class="line"> sensors_applet->settings = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="109"><td class="num" id="LN109">109</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="110"><td class="num" id="LN110">110</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="111"><td class="num" id="LN111">111</td><td class="line"> <span class='comment'>/* destroy all active sensors */</span></td></tr> +<tr class="codeline" data-linenumber="112"><td class="num" id="LN112">112</td><td class="line"> g_list_foreach(sensors_applet->active_sensors,</td></tr> +<tr class="codeline" data-linenumber="113"><td class="num" id="LN113">113</td><td class="line"> (GFunc)active_sensor_destroy,</td></tr> +<tr class="codeline" data-linenumber="114"><td class="num" id="LN114">114</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="115"><td class="num" id="LN115">115</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="116"><td class="num" id="LN116">116</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->sensors != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="117"><td class="num" id="LN117">117</td><td class="line"> gtk_tree_store_clear(sensors_applet->sensors);</td></tr> +<tr class="codeline" data-linenumber="118"><td class="num" id="LN118">118</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="119"><td class="num" id="LN119">119</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="120"><td class="num" id="LN120">120</td><td class="line"> gtk_widget_destroy(<span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="121"><td class="num" id="LN121">121</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="122"><td class="num" id="LN122">122</td><td class="line"> g_free(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="123"><td class="num" id="LN123">123</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="124"><td class="num" id="LN124">124</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="125"><td class="num" id="LN125">125</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="126"><td class="num" id="LN126">126</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> change_orient_cb (MatePanelApplet *applet,</td></tr> +<tr class="codeline" data-linenumber="127"><td class="num" id="LN127">127</td><td class="line"> MatePanelAppletOrient orient,</td></tr> +<tr class="codeline" data-linenumber="128"><td class="num" id="LN128">128</td><td class="line"> gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="129"><td class="num" id="LN129">129</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="130"><td class="num" id="LN130">130</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="131"><td class="num" id="LN131">131</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="132"><td class="num" id="LN132">132</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="133"><td class="num" id="LN133">133</td><td class="line"> sensors_applet_display_layout_changed(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="134"><td class="num" id="LN134">134</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="135"><td class="num" id="LN135">135</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="136"><td class="num" id="LN136">136</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> size_allocate_cb(MatePanelApplet *applet,</td></tr> +<tr class="codeline" data-linenumber="137"><td class="num" id="LN137">137</td><td class="line"> GtkAllocation *allocation,</td></tr> +<tr class="codeline" data-linenumber="138"><td class="num" id="LN138">138</td><td class="line"> gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="139"><td class="num" id="LN139">139</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="140"><td class="num" id="LN140">140</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="141"><td class="num" id="LN141">141</td><td class="line"> MatePanelAppletOrient orient;</td></tr> +<tr class="codeline" data-linenumber="142"><td class="num" id="LN142">142</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="143"><td class="num" id="LN143">143</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="144"><td class="num" id="LN144">144</td><td class="line"> orient = mate_panel_applet_get_orient(sensors_applet->applet);</td></tr> +<tr class="codeline" data-linenumber="145"><td class="num" id="LN145">145</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="146"><td class="num" id="LN146">146</td><td class="line"> <span class='keyword'>if</span> ((orient == MATE_PANEL_APPLET_ORIENT_LEFT) ||</td></tr> +<tr class="codeline" data-linenumber="147"><td class="num" id="LN147">147</td><td class="line"> (orient == MATE_PANEL_APPLET_ORIENT_RIGHT)) {</td></tr> +<tr class="codeline" data-linenumber="148"><td class="num" id="LN148">148</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="149"><td class="num" id="LN149">149</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->size == allocation->width)</td></tr> +<tr class="codeline" data-linenumber="150"><td class="num" id="LN150">150</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="151"><td class="num" id="LN151">151</td><td class="line"> sensors_applet->size = allocation->width;</td></tr> +<tr class="codeline" data-linenumber="152"><td class="num" id="LN152">152</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="153"><td class="num" id="LN153">153</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->size == allocation->height)</td></tr> +<tr class="codeline" data-linenumber="154"><td class="num" id="LN154">154</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="155"><td class="num" id="LN155">155</td><td class="line"> sensors_applet->size = allocation->height;</td></tr> +<tr class="codeline" data-linenumber="156"><td class="num" id="LN156">156</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="157"><td class="num" id="LN157">157</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="158"><td class="num" id="LN158">158</td><td class="line"> <span class='comment'>/* update if new value */</span></td></tr> +<tr class="codeline" data-linenumber="159"><td class="num" id="LN159">159</td><td class="line"> sensors_applet_graph_size_changed(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="160"><td class="num" id="LN160">160</td><td class="line"> sensors_applet_display_layout_changed(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="161"><td class="num" id="LN161">161</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="162"><td class="num" id="LN162">162</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="163"><td class="num" id="LN163">163</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> style_set_cb(GtkWidget *widget, GtkStyle *old_style, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="164"><td class="num" id="LN164">164</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="165"><td class="num" id="LN165">165</td><td class="line"> <span class='comment'>/* update all icons in the sensors tree and update all active sensors */</span></td></tr> +<tr class="codeline" data-linenumber="166"><td class="num" id="LN166">166</td><td class="line"> GtkTreeIter interfaces_iter, sensors_iter;</td></tr> +<tr class="codeline" data-linenumber="167"><td class="num" id="LN167">167</td><td class="line"> gboolean not_end_of_interfaces = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>, not_end_of_sensors = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="168"><td class="num" id="LN168">168</td><td class="line"> IconType icon_type;</td></tr> +<tr class="codeline" data-linenumber="169"><td class="num" id="LN169">169</td><td class="line"> gboolean enabled;</td></tr> +<tr class="codeline" data-linenumber="170"><td class="num" id="LN170">170</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="171"><td class="num" id="LN171">171</td><td class="line"> DisplayMode display_mode;</td></tr> +<tr class="codeline" data-linenumber="172"><td class="num" id="LN172">172</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="173"><td class="num" id="LN173">173</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="174"><td class="num" id="LN174">174</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="175"><td class="num" id="LN175">175</td><td class="line"> display_mode = g_settings_get_int (sensors_applet->settings, <span class='macro'>DISPLAY_MODE<span class='macro_popup'>"display-mode"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="176"><td class="num" id="LN176">176</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->sensors) {</td></tr> +<tr class="codeline" data-linenumber="177"><td class="num" id="LN177">177</td><td class="line"> <span class='keyword'>for</span> (gtk_tree_model_get_iter_first(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &interfaces_iter);</td></tr> +<tr class="codeline" data-linenumber="178"><td class="num" id="LN178">178</td><td class="line"> not_end_of_interfaces;</td></tr> +<tr class="codeline" data-linenumber="179"><td class="num" id="LN179">179</td><td class="line"> not_end_of_interfaces = gtk_tree_model_iter_next(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &interfaces_iter)) {</td></tr> +<tr class="codeline" data-linenumber="180"><td class="num" id="LN180">180</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="181"><td class="num" id="LN181">181</td><td class="line"> <span class='comment'>/* reset sensors sentinel */</span></td></tr> +<tr class="codeline" data-linenumber="182"><td class="num" id="LN182">182</td><td class="line"> not_end_of_sensors = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="183"><td class="num" id="LN183">183</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="184"><td class="num" id="LN184">184</td><td class="line"> <span class='keyword'>for</span> (gtk_tree_model_iter_children(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter, &interfaces_iter);</td></tr> +<tr class="codeline" data-linenumber="185"><td class="num" id="LN185">185</td><td class="line"> not_end_of_sensors;</td></tr> +<tr class="codeline" data-linenumber="186"><td class="num" id="LN186">186</td><td class="line"> not_end_of_sensors = gtk_tree_model_iter_next(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter)) {</td></tr> +<tr class="codeline" data-linenumber="187"><td class="num" id="LN187">187</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="188"><td class="num" id="LN188">188</td><td class="line"> GdkPixbuf *new_icon;</td></tr> +<tr class="codeline" data-linenumber="189"><td class="num" id="LN189">189</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="190"><td class="num" id="LN190">190</td><td class="line"> gtk_tree_model_get(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="191"><td class="num" id="LN191">191</td><td class="line"> &sensors_iter,</td></tr> +<tr class="codeline" data-linenumber="192"><td class="num" id="LN192">192</td><td class="line"> ENABLE_COLUMN, &enabled,</td></tr> +<tr class="codeline" data-linenumber="193"><td class="num" id="LN193">193</td><td class="line"> ICON_TYPE_COLUMN, &icon_type,</td></tr> +<tr class="codeline" data-linenumber="194"><td class="num" id="LN194">194</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="195"><td class="num" id="LN195">195</td><td class="line"> <span class='comment'>/* update icons */</span></td></tr> +<tr class="codeline" data-linenumber="196"><td class="num" id="LN196">196</td><td class="line"> new_icon = sensors_applet_load_icon(icon_type);</td></tr> +<tr class="codeline" data-linenumber="197"><td class="num" id="LN197">197</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="198"><td class="num" id="LN198">198</td><td class="line"> gtk_tree_store_set(sensors_applet->sensors,</td></tr> +<tr class="codeline" data-linenumber="199"><td class="num" id="LN199">199</td><td class="line"> &sensors_iter,</td></tr> +<tr class="codeline" data-linenumber="200"><td class="num" id="LN200">200</td><td class="line"> ICON_PIXBUF_COLUMN, new_icon,</td></tr> +<tr class="codeline" data-linenumber="201"><td class="num" id="LN201">201</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="202"><td class="num" id="LN202">202</td><td class="line"> g_object_unref(new_icon);</td></tr> +<tr class="codeline" data-linenumber="203"><td class="num" id="LN203">203</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="204"><td class="num" id="LN204">204</td><td class="line"> <span class='comment'>/* update icons only if currently being displayed */</span></td></tr> +<tr class="codeline" data-linenumber="205"><td class="num" id="LN205">205</td><td class="line"> <span class='keyword'>if</span> (enabled &&</td></tr> +<tr class="codeline" data-linenumber="206"><td class="num" id="LN206">206</td><td class="line"> (display_mode == DISPLAY_ICON ||</td></tr> +<tr class="codeline" data-linenumber="207"><td class="num" id="LN207">207</td><td class="line"> display_mode == DISPLAY_ICON_WITH_VALUE)) {</td></tr> +<tr class="codeline" data-linenumber="208"><td class="num" id="LN208">208</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="209"><td class="num" id="LN209">209</td><td class="line"> GtkTreePath *path;</td></tr> +<tr class="codeline" data-linenumber="210"><td class="num" id="LN210">210</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="211"><td class="num" id="LN211">211</td><td class="line"> path = gtk_tree_model_get_path(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter);</td></tr> +<tr class="codeline" data-linenumber="212"><td class="num" id="LN212">212</td><td class="line"> sensors_applet_icon_changed(sensors_applet, path);</td></tr> +<tr class="codeline" data-linenumber="213"><td class="num" id="LN213">213</td><td class="line"> gtk_tree_path_free(path);</td></tr> +<tr class="codeline" data-linenumber="214"><td class="num" id="LN214">214</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="215"><td class="num" id="LN215">215</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="216"><td class="num" id="LN216">216</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="217"><td class="num" id="LN217">217</td><td class="line"> <span class='comment'>/* now update layout as size may have changed */</span></td></tr> +<tr class="codeline" data-linenumber="218"><td class="num" id="LN218">218</td><td class="line"> sensors_applet_display_layout_changed(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="219"><td class="num" id="LN219">219</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="220"><td class="num" id="LN220">220</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="221"><td class="num" id="LN221">221</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="222"><td class="num" id="LN222">222</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="223"><td class="num" id="LN223">223</td><td class="line"><span class='keyword'>static</span> gboolean mouse_enter_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data)</td></tr> +<tr class="codeline" data-linenumber="224"><td class="num" id="LN224">224</td><td class="line">{</td></tr> +<tr class="codeline" data-linenumber="225"><td class="num" id="LN225">225</td><td class="line"> SensorsApplet *sensor_applet = data;</td></tr> +<tr class="codeline" data-linenumber="226"><td class="num" id="LN226">226</td><td class="line"> sensor_applet->show_tooltip = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="227"><td class="num" id="LN227">227</td><td class="line"> sensors_applet_update_active_sensors(sensor_applet);</td></tr> +<tr class="codeline" data-linenumber="228"><td class="num" id="LN228">228</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="229"><td class="num" id="LN229">229</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="230"><td class="num" id="LN230">230</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="231"><td class="num" id="LN231">231</td><td class="line"><span class='keyword'>static</span> gboolean mouse_leave_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data)</td></tr> +<tr class="codeline" data-linenumber="232"><td class="num" id="LN232">232</td><td class="line">{</td></tr> +<tr class="codeline" data-linenumber="233"><td class="num" id="LN233">233</td><td class="line"> SensorsApplet *sensor_applet = data;</td></tr> +<tr class="codeline" data-linenumber="234"><td class="num" id="LN234">234</td><td class="line"> sensor_applet->show_tooltip = <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="235"><td class="num" id="LN235">235</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="236"><td class="num" id="LN236">236</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="237"><td class="num" id="LN237">237</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="238"><td class="num" id="LN238">238</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>const</span> GtkActionEntry sensors_applet_menu_actions[] = {</td></tr> +<tr class="codeline" data-linenumber="239"><td class="num" id="LN239">239</td><td class="line"> { <span class='string_literal'>"Preferences"</span>, <span class='string_literal'>"document-properties"</span>, <span class='macro'>N_(<span class='string_literal'>"_Preferences"</span>)<span class='macro_popup'>("_Preferences")</span></span>,</td></tr> +<tr class="codeline" data-linenumber="240"><td class="num" id="LN240">240</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="241"><td class="num" id="LN241">241</td><td class="line"> <span class='macro'>G_CALLBACK(prefs_cb)<span class='macro_popup'>((GCallback) (prefs_cb))</span></span> },</td></tr> +<tr class="codeline" data-linenumber="242"><td class="num" id="LN242">242</td><td class="line"> { <span class='string_literal'>"Help"</span>, <span class='string_literal'>"help-browser"</span>, <span class='macro'>N_(<span class='string_literal'>"_Help"</span>)<span class='macro_popup'>("_Help")</span></span>,</td></tr> +<tr class="codeline" data-linenumber="243"><td class="num" id="LN243">243</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="244"><td class="num" id="LN244">244</td><td class="line"> <span class='macro'>G_CALLBACK(help_cb)<span class='macro_popup'>((GCallback) (help_cb))</span></span> },</td></tr> +<tr class="codeline" data-linenumber="245"><td class="num" id="LN245">245</td><td class="line"> { <span class='string_literal'>"About"</span>, <span class='string_literal'>"help-about"</span>, <span class='macro'>N_(<span class='string_literal'>"_About"</span>)<span class='macro_popup'>("_About")</span></span>,</td></tr> +<tr class="codeline" data-linenumber="246"><td class="num" id="LN246">246</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="247"><td class="num" id="LN247">247</td><td class="line"> <span class='macro'>G_CALLBACK(about_cb)<span class='macro_popup'>((GCallback) (about_cb))</span></span> }</td></tr> +<tr class="codeline" data-linenumber="248"><td class="num" id="LN248">248</td><td class="line">};</td></tr> +<tr class="codeline" data-linenumber="249"><td class="num" id="LN249">249</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="250"><td class="num" id="LN250">250</td><td class="line"><span class='keyword'>void</span> sensors_applet_notify_active_sensor(ActiveSensor *active_sensor, NotifType notif_type) {</td></tr> +<tr class="codeline" data-linenumber="251"><td class="num" id="LN251">251</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_LIBNOTIFY<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="252"><td class="num" id="LN252">252</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="253"><td class="num" id="LN253">253</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="254"><td class="num" id="LN254">254</td><td class="line"> gchar *summary, *message;</td></tr> +<tr class="codeline" data-linenumber="255"><td class="num" id="LN255">255</td><td class="line"> gint timeout_msecs;</td></tr> +<tr class="codeline" data-linenumber="256"><td class="num" id="LN256">256</td><td class="line"> gchar *sensor_label;</td></tr> +<tr class="codeline" data-linenumber="257"><td class="num" id="LN257">257</td><td class="line"> gchar *sensor_path;</td></tr> +<tr class="codeline" data-linenumber="258"><td class="num" id="LN258">258</td><td class="line"> SensorType sensor_type;</td></tr> +<tr class="codeline" data-linenumber="259"><td class="num" id="LN259">259</td><td class="line"> TemperatureScale temp_scale;</td></tr> +<tr class="codeline" data-linenumber="260"><td class="num" id="LN260">260</td><td class="line"> GtkTreeIter iter;</td></tr> +<tr class="codeline" data-linenumber="261"><td class="num" id="LN261">261</td><td class="line"> GtkTreePath *path;</td></tr> +<tr class="codeline" data-linenumber="262"><td class="num" id="LN262">262</td><td class="line"> <span class='keyword'>const</span> gchar *unit_type = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="263"><td class="num" id="LN263">263</td><td class="line"> <span class='keyword'>const</span> gchar *unit_type_title = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="264"><td class="num" id="LN264">264</td><td class="line"> <span class='keyword'>const</span> gchar *relation = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="265"><td class="num" id="LN265">265</td><td class="line"> <span class='keyword'>const</span> gchar *limit_type = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="266"><td class="num" id="LN266">266</td><td class="line"> <span class='keyword'>const</span> gchar *units = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="267"><td class="num" id="LN267">267</td><td class="line"> gdouble limit_value;</td></tr> +<tr class="codeline" data-linenumber="268"><td class="num" id="LN268">268</td><td class="line"> gdouble seconds;</td></tr> +<tr class="codeline" data-linenumber="269"><td class="num" id="LN269">269</td><td class="line"> gboolean show_notification = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="270"><td class="num" id="LN270">270</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="271"><td class="num" id="LN271">271</td><td class="line"> sensors_applet = active_sensor->sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="272"><td class="num" id="LN272">272</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="273"><td class="num" id="LN273">273</td><td class="line"> <span class='keyword'>if</span> (!g_settings_get_boolean (sensors_applet->settings, <span class='macro'>DISPLAY_NOTIFICATIONS<span class='macro_popup'>"display-notifications"</span></span>)) {</td></tr> +<tr class="codeline" data-linenumber="274"><td class="num" id="LN274">274</td><td class="line"> g_debug(<span class='string_literal'>"Wanted to display notification, but user has disabled them"</span>);</td></tr> +<tr class="codeline" data-linenumber="275"><td class="num" id="LN275">275</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="276"><td class="num" id="LN276">276</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="277"><td class="num" id="LN277">277</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="278"><td class="num" id="LN278">278</td><td class="line"> path = gtk_tree_row_reference_get_path(active_sensor->sensor_row);</td></tr> +<tr class="codeline" data-linenumber="279"><td class="num" id="LN279">279</td><td class="line"> <span class='keyword'>if</span> (gtk_tree_model_get_iter(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &iter, path)) {</td></tr> +<tr class="codeline" data-linenumber="280"><td class="num" id="LN280">280</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="281"><td class="num" id="LN281">281</td><td class="line"> gtk_tree_model_get(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &iter,</td></tr> +<tr class="codeline" data-linenumber="282"><td class="num" id="LN282">282</td><td class="line"> LABEL_COLUMN, &sensor_label,</td></tr> +<tr class="codeline" data-linenumber="283"><td class="num" id="LN283">283</td><td class="line"> PATH_COLUMN, &sensor_path,</td></tr> +<tr class="codeline" data-linenumber="284"><td class="num" id="LN284">284</td><td class="line"> SENSOR_TYPE_COLUMN, &sensor_type,</td></tr> +<tr class="codeline" data-linenumber="285"><td class="num" id="LN285">285</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="286"><td class="num" id="LN286">286</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="287"><td class="num" id="LN287">287</td><td class="line"> g_warning(<span class='string_literal'>"Error getting data from tree for notification..."</span>);</td></tr> +<tr class="codeline" data-linenumber="288"><td class="num" id="LN288">288</td><td class="line"> gtk_tree_path_free(path);</td></tr> +<tr class="codeline" data-linenumber="289"><td class="num" id="LN289">289</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="290"><td class="num" id="LN290">290</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="291"><td class="num" id="LN291">291</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="292"><td class="num" id="LN292">292</td><td class="line"> gtk_tree_path_free(path);</td></tr> +<tr class="codeline" data-linenumber="293"><td class="num" id="LN293">293</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="294"><td class="num" id="LN294">294</td><td class="line"> <span class='comment'>/* do different stuff for different notif types */</span></td></tr> +<tr class="codeline" data-linenumber="295"><td class="num" id="LN295">295</td><td class="line"> <span class='keyword'>switch</span> (notif_type) {</td></tr> +<tr class="codeline" data-linenumber="296"><td class="num" id="LN296">296</td><td class="line"> <span class='keyword'>case</span> LOW_ALARM: <span class='comment'>/* fall thru */</span></td></tr> +<tr class="codeline" data-linenumber="297"><td class="num" id="LN297">297</td><td class="line"> <span class='keyword'>case</span> HIGH_ALARM:</td></tr> +<tr class="codeline" data-linenumber="298"><td class="num" id="LN298">298</td><td class="line"> <span class='keyword'>if</span> (active_sensor->sensor_values[0] <= active_sensor->sensor_low_value && notif_type == LOW_ALARM) {</td></tr> +<tr class="codeline" data-linenumber="299"><td class="num" id="LN299">299</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="300"><td class="num" id="LN300">300</td><td class="line"> relation = <span class='macro'>_(<span class='string_literal'>"is very low"</span>)<span class='macro_popup'>dcgettext (((void*)0), "is very low", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="301"><td class="num" id="LN301">301</td><td class="line"> limit_type = <span class='macro'>_(<span class='string_literal'>"lower limit"</span>)<span class='macro_popup'>dcgettext (((void*)0), "lower limit", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="302"><td class="num" id="LN302">302</td><td class="line"> limit_value = active_sensor->sensor_low_value;</td></tr> +<tr class="codeline" data-linenumber="303"><td class="num" id="LN303">303</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (active_sensor->sensor_values[0] >= active_sensor->sensor_high_value && notif_type == HIGH_ALARM) {</td></tr> +<tr class="codeline" data-linenumber="304"><td class="num" id="LN304">304</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="305"><td class="num" id="LN305">305</td><td class="line"> <span class='comment'>/* assume high alarm condition */</span></td></tr> +<tr class="codeline" data-linenumber="306"><td class="num" id="LN306">306</td><td class="line"> relation = <span class='macro'>_(<span class='string_literal'>"is very high"</span>)<span class='macro_popup'>dcgettext (((void*)0), "is very high", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="307"><td class="num" id="LN307">307</td><td class="line"> limit_type = <span class='macro'>_(<span class='string_literal'>"upper limit"</span>)<span class='macro_popup'>dcgettext (((void*)0), "upper limit", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="308"><td class="num" id="LN308">308</td><td class="line"> limit_value = active_sensor->sensor_high_value;</td></tr> +<tr class="codeline" data-linenumber="309"><td class="num" id="LN309">309</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="310"><td class="num" id="LN310">310</td><td class="line"> g_warning(<span class='string_literal'>"Alarm notify called when no alarm condition!"</span>);</td></tr> +<tr class="codeline" data-linenumber="311"><td class="num" id="LN311">311</td><td class="line"> g_free(sensor_path);</td></tr> +<tr class="codeline" data-linenumber="312"><td class="num" id="LN312">312</td><td class="line"> g_free(sensor_label);</td></tr> +<tr class="codeline" data-linenumber="313"><td class="num" id="LN313">313</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="314"><td class="num" id="LN314">314</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="315"><td class="num" id="LN315">315</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="316"><td class="num" id="LN316">316</td><td class="line"> <span class='keyword'>switch</span> ((SensorType)sensor_type) {</td></tr> +<tr class="codeline" data-linenumber="317"><td class="num" id="LN317">317</td><td class="line"> <span class='keyword'>case</span> TEMP_SENSOR:</td></tr> +<tr class="codeline" data-linenumber="318"><td class="num" id="LN318">318</td><td class="line"> unit_type_title = <span class='macro'>_(<span class='string_literal'>"Temperature"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Temperature", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="319"><td class="num" id="LN319">319</td><td class="line"> unit_type = <span class='macro'>_(<span class='string_literal'>"temperature"</span>)<span class='macro_popup'>dcgettext (((void*)0), "temperature", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="320"><td class="num" id="LN320">320</td><td class="line"> temp_scale = (TemperatureScale) g_settings_get_int (active_sensor->sensors_applet->settings, <span class='macro'>TEMPERATURE_SCALE<span class='macro_popup'>"temperature-scale"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="321"><td class="num" id="LN321">321</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="322"><td class="num" id="LN322">322</td><td class="line"> <span class='keyword'>switch</span> (temp_scale) {</td></tr> +<tr class="codeline" data-linenumber="323"><td class="num" id="LN323">323</td><td class="line"> <span class='keyword'>case</span> CELSIUS:</td></tr> +<tr class="codeline" data-linenumber="324"><td class="num" id="LN324">324</td><td class="line"> units = <span class='macro'>UNITS_CELSIUS<span class='macro_popup'>"\302\260C"</span></span>;</td></tr> +<tr class="codeline" data-linenumber="325"><td class="num" id="LN325">325</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="326"><td class="num" id="LN326">326</td><td class="line"> <span class='keyword'>case</span> FAHRENHEIT:</td></tr> +<tr class="codeline" data-linenumber="327"><td class="num" id="LN327">327</td><td class="line"> units = <span class='macro'>UNITS_FAHRENHEIT<span class='macro_popup'>"\302\260F"</span></span>;</td></tr> +<tr class="codeline" data-linenumber="328"><td class="num" id="LN328">328</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="329"><td class="num" id="LN329">329</td><td class="line"> <span class='keyword'>case</span> KELVIN:</td></tr> +<tr class="codeline" data-linenumber="330"><td class="num" id="LN330">330</td><td class="line"> units = <span class='macro'>UNITS_KELVIN<span class='macro_popup'>""</span></span>;</td></tr> +<tr class="codeline" data-linenumber="331"><td class="num" id="LN331">331</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="332"><td class="num" id="LN332">332</td><td class="line"> <span class='keyword'>default</span>:</td></tr> +<tr class="codeline" data-linenumber="333"><td class="num" id="LN333">333</td><td class="line"> units = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="334"><td class="num" id="LN334">334</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="335"><td class="num" id="LN335">335</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="336"><td class="num" id="LN336">336</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="337"><td class="num" id="LN337">337</td><td class="line"> <span class='keyword'>case</span> VOLTAGE_SENSOR:</td></tr> +<tr class="codeline" data-linenumber="338"><td class="num" id="LN338">338</td><td class="line"> unit_type_title = <span class='macro'>_(<span class='string_literal'>"Voltage"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Voltage", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="339"><td class="num" id="LN339">339</td><td class="line"> unit_type = <span class='macro'>_(<span class='string_literal'>"voltage"</span>)<span class='macro_popup'>dcgettext (((void*)0), "voltage", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="340"><td class="num" id="LN340">340</td><td class="line"> units = <span class='macro'>UNITS_VOLTAGE<span class='macro_popup'>dcgettext (((void*)0), "V", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="341"><td class="num" id="LN341">341</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="342"><td class="num" id="LN342">342</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="343"><td class="num" id="LN343">343</td><td class="line"> <span class='keyword'>case</span> FAN_SENSOR:</td></tr> +<tr class="codeline" data-linenumber="344"><td class="num" id="LN344">344</td><td class="line"> unit_type_title = <span class='macro'>_(<span class='string_literal'>"Fan Speed"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Fan Speed", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="345"><td class="num" id="LN345">345</td><td class="line"> unit_type = <span class='macro'>_(<span class='string_literal'>"fan speed"</span>)<span class='macro_popup'>dcgettext (((void*)0), "fan speed", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="346"><td class="num" id="LN346">346</td><td class="line"> units = <span class='macro'>UNITS_RPM<span class='macro_popup'>dcgettext (((void*)0), "RPM", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="347"><td class="num" id="LN347">347</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="348"><td class="num" id="LN348">348</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="349"><td class="num" id="LN349">349</td><td class="line"> <span class='keyword'>case</span> CURRENT_SENSOR:</td></tr> +<tr class="codeline" data-linenumber="350"><td class="num" id="LN350">350</td><td class="line"> unit_type_title = <span class='macro'>_(<span class='string_literal'>"Current"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Current", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="351"><td class="num" id="LN351">351</td><td class="line"> unit_type = <span class='macro'>_(<span class='string_literal'>"current"</span>)<span class='macro_popup'>dcgettext (((void*)0), "current", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="352"><td class="num" id="LN352">352</td><td class="line"> units = <span class='macro'>UNITS_CURRENT<span class='macro_popup'>dcgettext (((void*)0), "A", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="353"><td class="num" id="LN353">353</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="354"><td class="num" id="LN354">354</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="355"><td class="num" id="LN355">355</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="356"><td class="num" id="LN356">356</td><td class="line"> timeout_msecs = (active_sensor->alarm_timeout ? <span class='macro'>MIN(DEFAULT_NOTIFY_TIMEOUT, (active_sensor->alarm_timeout * 1000))<span class='macro_popup'>(((3000) < ((active_sensor->alarm_timeout * 1000))) ? (<br>3000) : ((active_sensor->alarm_timeout * 1000)))</span></span> : <span class='macro'>DEFAULT_NOTIFY_TIMEOUT<span class='macro_popup'>3000</span></span>);</td></tr> +<tr class="codeline" data-linenumber="357"><td class="num" id="LN357">357</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="358"><td class="num" id="LN358">358</td><td class="line"> summary = g_strdup_printf(<span class='string_literal'>"%s %s %s"</span>, sensor_label, unit_type_title, <span class='macro'>_(<span class='string_literal'>"Alarm"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Alarm", 5)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="359"><td class="num" id="LN359">359</td><td class="line"> message = g_strdup_printf(<span class='string_literal'>"%s %s %s (%s %2.0f%s)"</span>, sensor_label, unit_type, relation, limit_type, limit_value, units);</td></tr> +<tr class="codeline" data-linenumber="360"><td class="num" id="LN360">360</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="361"><td class="num" id="LN361">361</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="362"><td class="num" id="LN362">362</td><td class="line"> <span class='keyword'>case</span> SENSOR_INTERFACE_ERROR:</td></tr> +<tr class="codeline" data-linenumber="363"><td class="num" id="LN363">363</td><td class="line"> <span class='comment'>/* get time since the last error */</span></td></tr> +<tr class="codeline" data-linenumber="364"><td class="num" id="LN364">364</td><td class="line"> seconds = difftime(time(<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>), active_sensor->ierror_ts);</td></tr> +<tr class="codeline" data-linenumber="365"><td class="num" id="LN365">365</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="366"><td class="num" id="LN366">366</td><td class="line"> <span class='comment'>/* if the last error happened less than 10 seconds ago, don't display this one</span></td></tr> +<tr class="codeline" data-linenumber="367"><td class="num" id="LN367">367</td><td class="line"> <span class='comment'>* this should prevent recurring popups for removed sensors, like USB-HDDs */</span></td></tr> +<tr class="codeline" data-linenumber="368"><td class="num" id="LN368">368</td><td class="line"> <span class='keyword'>if</span> (seconds < 11.0) {</td></tr> +<tr class="codeline" data-linenumber="369"><td class="num" id="LN369">369</td><td class="line"> show_notification = <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="370"><td class="num" id="LN370">370</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="371"><td class="num" id="LN371">371</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="372"><td class="num" id="LN372">372</td><td class="line"> summary = g_strdup_printf(<span class='macro'>_(<span class='string_literal'>"Error updating sensor %s"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Error updating sensor %s", 5)</span></span>, sensor_label);</td></tr> +<tr class="codeline" data-linenumber="373"><td class="num" id="LN373">373</td><td class="line"> message = g_strdup_printf(<span class='macro'>_(<span class='string_literal'>"An error occurred while trying to update the value of the sensor %s located at %s."</span>)<span class='macro_popup'>dcgettext (((void*)0), "An error occurred while trying to update the value of the sensor %s located at %s."<br>, 5)</span></span>, sensor_label, sensor_path);</td></tr> +<tr class="codeline" data-linenumber="374"><td class="num" id="LN374">374</td><td class="line"> timeout_msecs = g_settings_get_int (active_sensor->sensors_applet->settings, <span class='macro'>TIMEOUT<span class='macro_popup'>"timeout-delay"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="375"><td class="num" id="LN375">375</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="376"><td class="num" id="LN376">376</td><td class="line"> <span class='comment'>/* update timestamp */</span></td></tr> +<tr class="codeline" data-linenumber="377"><td class="num" id="LN377">377</td><td class="line"> time(&(active_sensor->ierror_ts));</td></tr> +<tr class="codeline" data-linenumber="378"><td class="num" id="LN378">378</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="379"><td class="num" id="LN379">379</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="380"><td class="num" id="LN380">380</td><td class="line"> <span class='keyword'>default</span>:</td></tr> +<tr class="codeline" data-linenumber="381"><td class="num" id="LN381">381</td><td class="line"> <span class='macro'>g_assert_not_reached()<span class='macro_popup'>do { g_assertion_message_expr ("sensors-applet", "sensors-applet.c"<br>, 381, ((const char*) (__func__)), ((void*)0)); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="382"><td class="num" id="LN382">382</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="383"><td class="num" id="LN383">383</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="384"><td class="num" id="LN384">384</td><td class="line"> <span class='keyword'>if</span> (show_notification) {</td></tr> +<tr class="codeline" data-linenumber="385"><td class="num" id="LN385">385</td><td class="line"> active_sensor_libnotify_notify(active_sensor,</td></tr> +<tr class="codeline" data-linenumber="386"><td class="num" id="LN386">386</td><td class="line"> notif_type,</td></tr> +<tr class="codeline" data-linenumber="387"><td class="num" id="LN387">387</td><td class="line"> summary,</td></tr> +<tr class="codeline" data-linenumber="388"><td class="num" id="LN388">388</td><td class="line"> message,</td></tr> +<tr class="codeline" data-linenumber="389"><td class="num" id="LN389">389</td><td class="line"> <span class='string_literal'>"dialog-warning"</span>,</td></tr> +<tr class="codeline" data-linenumber="390"><td class="num" id="LN390">390</td><td class="line"> timeout_msecs);</td></tr> +<tr class="codeline" data-linenumber="391"><td class="num" id="LN391">391</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="392"><td class="num" id="LN392">392</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="393"><td class="num" id="LN393">393</td><td class="line"> g_free(sensor_path);</td></tr> +<tr class="codeline" data-linenumber="394"><td class="num" id="LN394">394</td><td class="line"> g_free(sensor_label);</td></tr> +<tr class="codeline" data-linenumber="395"><td class="num" id="LN395">395</td><td class="line"> g_free(summary);</td></tr> +<tr class="codeline" data-linenumber="396"><td class="num" id="LN396">396</td><td class="line"> g_free(message);</td></tr> +<tr class="codeline" data-linenumber="397"><td class="num" id="LN397">397</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="398"><td class="num" id="LN398">398</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="399"><td class="num" id="LN399">399</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="400"><td class="num" id="LN400">400</td><td class="line"><span class='keyword'>void</span> sensors_applet_notify_end(ActiveSensor *active_sensor, NotifType notif_type) {</td></tr> +<tr class="codeline" data-linenumber="401"><td class="num" id="LN401">401</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_LIBNOTIFY<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="402"><td class="num" id="LN402">402</td><td class="line"> active_sensor_libnotify_notify_end(active_sensor, notif_type);</td></tr> +<tr class="codeline" data-linenumber="403"><td class="num" id="LN403">403</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="404"><td class="num" id="LN404">404</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="405"><td class="num" id="LN405">405</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="406"><td class="num" id="LN406">406</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_LIBNOTIFY<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="407"><td class="num" id="LN407">407</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> sensors_applet_notify_end_all_gfunc(ActiveSensor *active_sensor, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="408"><td class="num" id="LN408">408</td><td class="line"> active_sensor_libnotify_notify_end(active_sensor, LOW_ALARM);</td></tr> +<tr class="codeline" data-linenumber="409"><td class="num" id="LN409">409</td><td class="line"> active_sensor_libnotify_notify_end(active_sensor, HIGH_ALARM);</td></tr> +<tr class="codeline" data-linenumber="410"><td class="num" id="LN410">410</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="411"><td class="num" id="LN411">411</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="412"><td class="num" id="LN412">412</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="413"><td class="num" id="LN413">413</td><td class="line"><span class='keyword'>void</span> sensors_applet_notify_end_all(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="414"><td class="num" id="LN414">414</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_LIBNOTIFY<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="415"><td class="num" id="LN415">415</td><td class="line"> g_list_foreach(sensors_applet->active_sensors, (GFunc)sensors_applet_notify_end_all_gfunc, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="416"><td class="num" id="LN416">416</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="417"><td class="num" id="LN417">417</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="418"><td class="num" id="LN418">418</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="419"><td class="num" id="LN419">419</td><td class="line"><span class='comment'>/* internal helper functions for updating display etc */</span></td></tr> +<tr class="codeline" data-linenumber="420"><td class="num" id="LN420">420</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="421"><td class="num" id="LN421">421</td><td class="line"><span class='comment'>/* should be called as a g_container_foreach at the start of</span></td></tr> +<tr class="codeline" data-linenumber="422"><td class="num" id="LN422">422</td><td class="line"> <span class='comment'>* pack_display if the grid already exists to remove but keep alive</span></td></tr> +<tr class="codeline" data-linenumber="423"><td class="num" id="LN423">423</td><td class="line"> <span class='comment'>* all children of the grid before repacking it */</span></td></tr> +<tr class="codeline" data-linenumber="424"><td class="num" id="LN424">424</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> sensors_applet_pack_display_empty_grid_cb(GtkWidget *widget, gpointer data)</td></tr> +<tr class="codeline" data-linenumber="425"><td class="num" id="LN425">425</td><td class="line">{</td></tr> +<tr class="codeline" data-linenumber="426"><td class="num" id="LN426">426</td><td class="line"> GtkContainer *container;</td></tr> +<tr class="codeline" data-linenumber="427"><td class="num" id="LN427">427</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="428"><td class="num" id="LN428">428</td><td class="line"> container = <span class='macro'>GTK_CONTAINER(data)<span class='macro_popup'>((((GtkContainer*) (void *) ((data)))))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="429"><td class="num" id="LN429">429</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="430"><td class="num" id="LN430">430</td><td class="line"> <span class='comment'>/* ref then remove widget */</span></td></tr> +<tr class="codeline" data-linenumber="431"><td class="num" id="LN431">431</td><td class="line"> <span class='macro'>g_object_ref(widget)<span class='macro_popup'>((__typeof__ (widget)) (g_object_ref) (widget))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="432"><td class="num" id="LN432">432</td><td class="line"> gtk_container_remove(container, widget);</td></tr> +<tr class="codeline" data-linenumber="433"><td class="num" id="LN433">433</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="434"><td class="num" id="LN434">434</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="435"><td class="num" id="LN435">435</td><td class="line"><span class='comment'>/* should be called as a g_container_foreach at the end of</span></td></tr> +<tr class="codeline" data-linenumber="436"><td class="num" id="LN436">436</td><td class="line"> <span class='comment'>* pack_display to unref any of the old children that we have readdded</span></td></tr> +<tr class="codeline" data-linenumber="437"><td class="num" id="LN437">437</td><td class="line"> <span class='comment'>* to the table to stop reference creep from the g_object_ref called</span></td></tr> +<tr class="codeline" data-linenumber="438"><td class="num" id="LN438">438</td><td class="line"> <span class='comment'>* on each child at the start of pack labels */</span></td></tr> +<tr class="codeline" data-linenumber="439"><td class="num" id="LN439">439</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> sensors_applet_pack_display_cleanup_refs_cb(GtkWidget *widget, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="440"><td class="num" id="LN440">440</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="441"><td class="num" id="LN441">441</td><td class="line"> GList *old_children;</td></tr> +<tr class="codeline" data-linenumber="442"><td class="num" id="LN442">442</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="443"><td class="num" id="LN443">443</td><td class="line"> old_children = (GList *)data;</td></tr> +<tr class="codeline" data-linenumber="444"><td class="num" id="LN444">444</td><td class="line"> <span class='keyword'>if</span> (g_list_find(old_children, widget)) {</td></tr> +<tr class="codeline" data-linenumber="445"><td class="num" id="LN445">445</td><td class="line"> g_object_unref(widget);</td></tr> +<tr class="codeline" data-linenumber="446"><td class="num" id="LN446">446</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="447"><td class="num" id="LN447">447</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="448"><td class="num" id="LN448">448</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="449"><td class="num" id="LN449">449</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> sensors_applet_pack_display(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="450"><td class="num" id="LN450">450</td><td class="line"> <span class='comment'>/* note the if () around each widget is to ensure we only</span></td></tr> +<tr class="codeline" data-linenumber="451"><td class="num" id="LN451">451</td><td class="line"> <span class='comment'>* operate on those that actually exist */</span></td></tr> +<tr class="codeline" data-linenumber="452"><td class="num" id="LN452">452</td><td class="line"> GtkLabel *no_sensors_enabled_label = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="453"><td class="num" id="LN453">453</td><td class="line"> gint num_active_sensors = 0, num_sensors_per_group = 0, rows, cols, i, j;</td></tr> +<tr class="codeline" data-linenumber="454"><td class="num" id="LN454">454</td><td class="line"> GList *old_grid_children = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="455"><td class="num" id="LN455">455</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="456"><td class="num" id="LN456">456</td><td class="line"> GList *current_sensor;</td></tr> +<tr class="codeline" data-linenumber="457"><td class="num" id="LN457">457</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="458"><td class="num" id="LN458">458</td><td class="line"> DisplayMode display_mode;</td></tr> +<tr class="codeline" data-linenumber="459"><td class="num" id="LN459">459</td><td class="line"> LayoutMode layout_mode;</td></tr> +<tr class="codeline" data-linenumber="460"><td class="num" id="LN460">460</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="461"><td class="num" id="LN461">461</td><td class="line"> gboolean horizontal;</td></tr> +<tr class="codeline" data-linenumber="462"><td class="num" id="LN462">462</td><td class="line"> gint label_width, icon_width, value_width;</td></tr> +<tr class="codeline" data-linenumber="463"><td class="num" id="LN463">463</td><td class="line"> gint label_height, icon_height, value_height;</td></tr> +<tr class="codeline" data-linenumber="464"><td class="num" id="LN464">464</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="465"><td class="num" id="LN465">465</td><td class="line"> GtkRequisition req;</td></tr> +<tr class="codeline" data-linenumber="466"><td class="num" id="LN466">466</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="467"><td class="num" id="LN467">467</td><td class="line"> ActiveSensor *first_sensor;</td></tr> +<tr class="codeline" data-linenumber="468"><td class="num" id="LN468">468</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="469"><td class="num" id="LN469">469</td><td class="line"> <span class='comment'>/* it is possible that there could be no active sensors so</span></td></tr> +<tr class="codeline" data-linenumber="470"><td class="num" id="LN470">470</td><td class="line"> <span class='comment'>* handle that case first - make sure we dont do a NULL</span></td></tr> +<tr class="codeline" data-linenumber="471"><td class="num" id="LN471">471</td><td class="line"> <span class='comment'>* pointer access first though */</span></td></tr> +<tr class="codeline" data-linenumber="472"><td class="num" id="LN472">472</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->active_sensors == <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> || g_list_length(sensors_applet->active_sensors) == 0) {</td></tr> +<tr class="codeline" data-linenumber="473"><td class="num" id="LN473">473</td><td class="line"> g_debug(<span class='string_literal'>"no active sensors to pack in grid"</span>);</td></tr> +<tr class="codeline" data-linenumber="474"><td class="num" id="LN474">474</td><td class="line"> no_sensors_enabled_label = g_object_new(<span class='macro'>GTK_TYPE_LABEL<span class='macro_popup'>(gtk_label_get_type ())</span></span>, <span class='string_literal'>"label"</span>, <span class='macro'>_(<span class='string_literal'>"No sensors enabled!"</span>)<span class='macro_popup'>dcgettext (((void*)0), "No sensors enabled!", 5)</span></span>, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="475"><td class="num" id="LN475">475</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="476"><td class="num" id="LN476">476</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->grid == <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="477"><td class="num" id="LN477">477</td><td class="line"> <span class='comment'>/* only need 1 row and 1 col */</span></td></tr> +<tr class="codeline" data-linenumber="478"><td class="num" id="LN478">478</td><td class="line"> sensors_applet->grid = gtk_grid_new();</td></tr> +<tr class="codeline" data-linenumber="479"><td class="num" id="LN479">479</td><td class="line"> gtk_grid_set_column_spacing(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>, <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>);</td></tr> +<tr class="codeline" data-linenumber="480"><td class="num" id="LN480">480</td><td class="line"> gtk_grid_set_row_spacing(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>, <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>);</td></tr> +<tr class="codeline" data-linenumber="481"><td class="num" id="LN481">481</td><td class="line"> gtk_widget_set_halign(sensors_applet->grid, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="482"><td class="num" id="LN482">482</td><td class="line"> gtk_widget_set_valign(sensors_applet->grid, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="483"><td class="num" id="LN483">483</td><td class="line"> <span class='comment'>/* add grid to applet */</span></td></tr> +<tr class="codeline" data-linenumber="484"><td class="num" id="LN484">484</td><td class="line"> gtk_container_add(<span class='macro'>GTK_CONTAINER(sensors_applet->applet)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->applet)))))</span></span>, sensors_applet->grid);</td></tr> +<tr class="codeline" data-linenumber="485"><td class="num" id="LN485">485</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="486"><td class="num" id="LN486">486</td><td class="line"> <span class='comment'>/* destroy existing widgets - could be an</span></td></tr> +<tr class="codeline" data-linenumber="487"><td class="num" id="LN487">487</td><td class="line"> <span class='comment'>* existing version of no sensors label - okay</span></td></tr> +<tr class="codeline" data-linenumber="488"><td class="num" id="LN488">488</td><td class="line"> <span class='comment'>* to just add again though if destroy first */</span></td></tr> +<tr class="codeline" data-linenumber="489"><td class="num" id="LN489">489</td><td class="line"> g_debug(<span class='string_literal'>"destroying any existing widgets in container"</span>);</td></tr> +<tr class="codeline" data-linenumber="490"><td class="num" id="LN490">490</td><td class="line"> gtk_container_foreach(<span class='macro'>GTK_CONTAINER(sensors_applet->grid)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->grid)))))</span></span>, (GtkCallback)gtk_widget_destroy, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="491"><td class="num" id="LN491">491</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="492"><td class="num" id="LN492">492</td><td class="line"> g_debug(<span class='string_literal'>"packing no sensors enabled label"</span>);</td></tr> +<tr class="codeline" data-linenumber="493"><td class="num" id="LN493">493</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="494"><td class="num" id="LN494">494</td><td class="line"> <span class='macro'>GTK_WIDGET(no_sensors_enabled_label)<span class='macro_popup'>((((GtkWidget*) (void *) ((no_sensors_enabled_label)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="495"><td class="num" id="LN495">495</td><td class="line"> 0, 0, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="496"><td class="num" id="LN496">496</td><td class="line"> gtk_widget_show_all(<span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="497"><td class="num" id="LN497">497</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="498"><td class="num" id="LN498">498</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="499"><td class="num" id="LN499">499</td><td class="line"> <span class='comment'>/* otherwise can acess active_sensors without any worries */</span></td></tr> +<tr class="codeline" data-linenumber="500"><td class="num" id="LN500">500</td><td class="line"> num_active_sensors = g_list_length(sensors_applet->active_sensors);</td></tr> +<tr class="codeline" data-linenumber="501"><td class="num" id="LN501">501</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="502"><td class="num" id="LN502">502</td><td class="line"> display_mode = (DisplayMode) g_settings_get_int (sensors_applet->settings, <span class='macro'>DISPLAY_MODE<span class='macro_popup'>"display-mode"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="503"><td class="num" id="LN503">503</td><td class="line"> layout_mode = (LayoutMode) g_settings_get_int (sensors_applet->settings, <span class='macro'>LAYOUT_MODE<span class='macro_popup'>"layout-mode"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="504"><td class="num" id="LN504">504</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="505"><td class="num" id="LN505">505</td><td class="line"> horizontal = (((mate_panel_applet_get_orient(sensors_applet->applet) == MATE_PANEL_APPLET_ORIENT_UP) ||</td></tr> +<tr class="codeline" data-linenumber="506"><td class="num" id="LN506">506</td><td class="line"> (mate_panel_applet_get_orient(sensors_applet->applet) == MATE_PANEL_APPLET_ORIENT_DOWN)));</td></tr> +<tr class="codeline" data-linenumber="507"><td class="num" id="LN507">507</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="508"><td class="num" id="LN508">508</td><td class="line"> <span class='comment'>/* figure out num rows / cols by how high / wide sensors</span></td></tr> +<tr class="codeline" data-linenumber="509"><td class="num" id="LN509">509</td><td class="line"> <span class='comment'>* labels / icons are and how much size we have to put them in */</span></td></tr> +<tr class="codeline" data-linenumber="510"><td class="num" id="LN510">510</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="511"><td class="num" id="LN511">511</td><td class="line"> <span class='comment'>/* get the first active sensor */</span></td></tr> +<tr class="codeline" data-linenumber="512"><td class="num" id="LN512">512</td><td class="line"> first_sensor = (ActiveSensor *)sensors_applet->active_sensors->data;</td></tr> +<tr class="codeline" data-linenumber="513"><td class="num" id="LN513">513</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="514"><td class="num" id="LN514">514</td><td class="line"> <span class='keyword'>switch</span> (display_mode) {</td></tr> +<tr class="codeline" data-linenumber="515"><td class="num" id="LN515">515</td><td class="line"> <span class='keyword'>case</span> DISPLAY_VALUE:</td></tr> +<tr class="codeline" data-linenumber="516"><td class="num" id="LN516">516</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->value)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->value)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="517"><td class="num" id="LN517">517</td><td class="line"> value_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="518"><td class="num" id="LN518">518</td><td class="line"> value_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="519"><td class="num" id="LN519">519</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="520"><td class="num" id="LN520">520</td><td class="line"> <span class='comment'>/* make sure all widths and heights are non zero,</span></td></tr> +<tr class="codeline" data-linenumber="521"><td class="num" id="LN521">521</td><td class="line"> <span class='comment'>* otherwise will get a divide by zero exception below</span></td></tr> +<tr class="codeline" data-linenumber="522"><td class="num" id="LN522">522</td><td class="line"> <span class='comment'>* - is a non critical error since can happen when</span></td></tr> +<tr class="codeline" data-linenumber="523"><td class="num" id="LN523">523</td><td class="line"> <span class='comment'>* elements first added to list, so simply return - is</span></td></tr> +<tr class="codeline" data-linenumber="524"><td class="num" id="LN524">524</td><td class="line"> <span class='comment'>* not a programming error */</span></td></tr> +<tr class="codeline" data-linenumber="525"><td class="num" id="LN525">525</td><td class="line"> <span class='keyword'>if</span> (value_width == 0 && value_height == 0) {</td></tr> +<tr class="codeline" data-linenumber="526"><td class="num" id="LN526">526</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="527"><td class="num" id="LN527">527</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="528"><td class="num" id="LN528">528</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="529"><td class="num" id="LN529">529</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? value_height : value_width));</td></tr> +<tr class="codeline" data-linenumber="530"><td class="num" id="LN530">530</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="531"><td class="num" id="LN531">531</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="532"><td class="num" id="LN532">532</td><td class="line"> <span class='keyword'>case</span> DISPLAY_LABEL_WITH_VALUE:</td></tr> +<tr class="codeline" data-linenumber="533"><td class="num" id="LN533">533</td><td class="line"> <span class='comment'>/* even though we end up packing the event boxes into the</span></td></tr> +<tr class="codeline" data-linenumber="534"><td class="num" id="LN534">534</td><td class="line"> <span class='comment'>* panel, these dont give back request sizes, so need to ask</span></td></tr> +<tr class="codeline" data-linenumber="535"><td class="num" id="LN535">535</td><td class="line"> <span class='comment'>* widgets directly */</span></td></tr> +<tr class="codeline" data-linenumber="536"><td class="num" id="LN536">536</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->value)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->value)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="537"><td class="num" id="LN537">537</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="538"><td class="num" id="LN538">538</td><td class="line"> value_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="539"><td class="num" id="LN539">539</td><td class="line"> value_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="540"><td class="num" id="LN540">540</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="541"><td class="num" id="LN541">541</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->label)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->label)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="542"><td class="num" id="LN542">542</td><td class="line"> label_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="543"><td class="num" id="LN543">543</td><td class="line"> label_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="544"><td class="num" id="LN544">544</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="545"><td class="num" id="LN545">545</td><td class="line"> <span class='comment'>/* make sure all widths and heights are non zero, otherwise</span></td></tr> +<tr class="codeline" data-linenumber="546"><td class="num" id="LN546">546</td><td class="line"> <span class='comment'>* will get a divide by zero exception below</span></td></tr> +<tr class="codeline" data-linenumber="547"><td class="num" id="LN547">547</td><td class="line"> <span class='comment'>* - is a non critical error since can happen when</span></td></tr> +<tr class="codeline" data-linenumber="548"><td class="num" id="LN548">548</td><td class="line"> <span class='comment'>* elements first added to list, so simply return - is</span></td></tr> +<tr class="codeline" data-linenumber="549"><td class="num" id="LN549">549</td><td class="line"> <span class='comment'>* not a programming error */</span></td></tr> +<tr class="codeline" data-linenumber="550"><td class="num" id="LN550">550</td><td class="line"> <span class='keyword'>if</span> (!(label_width && label_height && value_width && value_height)) {</td></tr> +<tr class="codeline" data-linenumber="551"><td class="num" id="LN551">551</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="552"><td class="num" id="LN552">552</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="553"><td class="num" id="LN553">553</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="554"><td class="num" id="LN554">554</td><td class="line"> <span class='keyword'>switch</span> (layout_mode) {</td></tr> +<tr class="codeline" data-linenumber="555"><td class="num" id="LN555">555</td><td class="line"> <span class='keyword'>case</span> VALUE_BESIDE_LABEL:</td></tr> +<tr class="codeline" data-linenumber="556"><td class="num" id="LN556">556</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? <span class='macro'>MAX(label_height, value_height)<span class='macro_popup'>(((label_height) > (value_height)) ? (label_height) : (value_height<br>))</span></span> : (label_width + value_width)));</td></tr> +<tr class="codeline" data-linenumber="557"><td class="num" id="LN557">557</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="558"><td class="num" id="LN558">558</td><td class="line"> <span class='keyword'>case</span> VALUE_BELOW_LABEL:</td></tr> +<tr class="codeline" data-linenumber="559"><td class="num" id="LN559">559</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? (label_height + value_height) : <span class='macro'>MAX(label_width, value_width)<span class='macro_popup'>(((label_width) > (value_width)) ? (label_width) : (value_width<br>))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="560"><td class="num" id="LN560">560</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="561"><td class="num" id="LN561">561</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="562"><td class="num" id="LN562">562</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="563"><td class="num" id="LN563">563</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="564"><td class="num" id="LN564">564</td><td class="line"> <span class='keyword'>case</span> DISPLAY_ICON_WITH_VALUE:</td></tr> +<tr class="codeline" data-linenumber="565"><td class="num" id="LN565">565</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->value)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->value)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="566"><td class="num" id="LN566">566</td><td class="line"> value_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="567"><td class="num" id="LN567">567</td><td class="line"> value_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="568"><td class="num" id="LN568">568</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="569"><td class="num" id="LN569">569</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->icon)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->icon)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="570"><td class="num" id="LN570">570</td><td class="line"> icon_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="571"><td class="num" id="LN571">571</td><td class="line"> icon_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="572"><td class="num" id="LN572">572</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="573"><td class="num" id="LN573">573</td><td class="line"> <span class='keyword'>if</span> (!(icon_width && icon_height && value_width && value_height)) {</td></tr> +<tr class="codeline" data-linenumber="574"><td class="num" id="LN574">574</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="575"><td class="num" id="LN575">575</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="576"><td class="num" id="LN576">576</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="577"><td class="num" id="LN577">577</td><td class="line"> <span class='keyword'>switch</span> (layout_mode) {</td></tr> +<tr class="codeline" data-linenumber="578"><td class="num" id="LN578">578</td><td class="line"> <span class='keyword'>case</span> VALUE_BESIDE_LABEL:</td></tr> +<tr class="codeline" data-linenumber="579"><td class="num" id="LN579">579</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? <span class='macro'>MAX(icon_height, value_height)<span class='macro_popup'>(((icon_height) > (value_height)) ? (icon_height) : (value_height<br>))</span></span> : (icon_width + value_width)));</td></tr> +<tr class="codeline" data-linenumber="580"><td class="num" id="LN580">580</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="581"><td class="num" id="LN581">581</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="582"><td class="num" id="LN582">582</td><td class="line"> <span class='keyword'>case</span> VALUE_BELOW_LABEL:</td></tr> +<tr class="codeline" data-linenumber="583"><td class="num" id="LN583">583</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? (icon_height + value_height) : <span class='macro'>MAX(icon_width, value_width)<span class='macro_popup'>(((icon_width) > (value_width)) ? (icon_width) : (value_width<br>))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="584"><td class="num" id="LN584">584</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="585"><td class="num" id="LN585">585</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="586"><td class="num" id="LN586">586</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="587"><td class="num" id="LN587">587</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="588"><td class="num" id="LN588">588</td><td class="line"> <span class='keyword'>case</span> DISPLAY_ICON:</td></tr> +<tr class="codeline" data-linenumber="589"><td class="num" id="LN589">589</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->icon)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->icon)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="590"><td class="num" id="LN590">590</td><td class="line"> icon_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="591"><td class="num" id="LN591">591</td><td class="line"> icon_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="592"><td class="num" id="LN592">592</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="593"><td class="num" id="LN593">593</td><td class="line"> <span class='keyword'>if</span> (!(icon_width && icon_height)) {</td></tr> +<tr class="codeline" data-linenumber="594"><td class="num" id="LN594">594</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="595"><td class="num" id="LN595">595</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="596"><td class="num" id="LN596">596</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="597"><td class="num" id="LN597">597</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? icon_height : icon_width));</td></tr> +<tr class="codeline" data-linenumber="598"><td class="num" id="LN598">598</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="599"><td class="num" id="LN599">599</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="600"><td class="num" id="LN600">600</td><td class="line"> <span class='keyword'>case</span> DISPLAY_GRAPH:</td></tr> +<tr class="codeline" data-linenumber="601"><td class="num" id="LN601">601</td><td class="line"> <span class='comment'>/* only show graphs in a line like System Monitor applet */</span></td></tr> +<tr class="codeline" data-linenumber="602"><td class="num" id="LN602">602</td><td class="line"> num_sensors_per_group = 1;</td></tr> +<tr class="codeline" data-linenumber="603"><td class="num" id="LN603">603</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="604"><td class="num" id="LN604">604</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="605"><td class="num" id="LN605">605</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="606"><td class="num" id="LN606">606</td><td class="line"> <span class='comment'>/* ensure always atleast 1 sensor per group */</span></td></tr> +<tr class="codeline" data-linenumber="607"><td class="num" id="LN607">607</td><td class="line"> <span class='keyword'>if</span> (num_sensors_per_group < 1) {</td></tr> +<tr class="codeline" data-linenumber="608"><td class="num" id="LN608">608</td><td class="line"> <span class='comment'>/* force a better layout */</span></td></tr> +<tr class="codeline" data-linenumber="609"><td class="num" id="LN609">609</td><td class="line"> <span class='keyword'>if</span> (horizontal && layout_mode == VALUE_BELOW_LABEL) {</td></tr> +<tr class="codeline" data-linenumber="610"><td class="num" id="LN610">610</td><td class="line"> layout_mode = VALUE_BESIDE_LABEL;</td></tr> +<tr class="codeline" data-linenumber="611"><td class="num" id="LN611">611</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (!horizontal && layout_mode == VALUE_BESIDE_LABEL) {</td></tr> +<tr class="codeline" data-linenumber="612"><td class="num" id="LN612">612</td><td class="line"> layout_mode = VALUE_BELOW_LABEL;</td></tr> +<tr class="codeline" data-linenumber="613"><td class="num" id="LN613">613</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="614"><td class="num" id="LN614">614</td><td class="line"> num_sensors_per_group = 1;</td></tr> +<tr class="codeline" data-linenumber="615"><td class="num" id="LN615">615</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="616"><td class="num" id="LN616">616</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="617"><td class="num" id="LN617">617</td><td class="line"> <span class='keyword'>if</span> (horizontal) {</td></tr> +<tr class="codeline" data-linenumber="618"><td class="num" id="LN618">618</td><td class="line"> <span class='comment'>/* if oriented horizontally, want as many</span></td></tr> +<tr class="codeline" data-linenumber="619"><td class="num" id="LN619">619</td><td class="line"> <span class='comment'>sensors per column as user has defined, then</span></td></tr> +<tr class="codeline" data-linenumber="620"><td class="num" id="LN620">620</td><td class="line"> <span class='comment'>enough columns to hold all the widgets */</span></td></tr> +<tr class="codeline" data-linenumber="621"><td class="num" id="LN621">621</td><td class="line"> rows = num_sensors_per_group;</td></tr> +<tr class="codeline" data-linenumber="622"><td class="num" id="LN622">622</td><td class="line"> cols = num_active_sensors / num_sensors_per_group;</td></tr> +<tr class="codeline" data-linenumber="623"><td class="num" id="LN623">623</td><td class="line"> <span class='keyword'>while</span> (rows * cols < num_active_sensors || cols == 0) {</td></tr> +<tr class="codeline" data-linenumber="624"><td class="num" id="LN624">624</td><td class="line"> cols++;</td></tr> +<tr class="codeline" data-linenumber="625"><td class="num" id="LN625">625</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="626"><td class="num" id="LN626">626</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="627"><td class="num" id="LN627">627</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="628"><td class="num" id="LN628">628</td><td class="line"> <span class='comment'>/* if oriented vertically, want as many</span></td></tr> +<tr class="codeline" data-linenumber="629"><td class="num" id="LN629">629</td><td class="line"> <span class='comment'>sensors per row as user has defined, then</span></td></tr> +<tr class="codeline" data-linenumber="630"><td class="num" id="LN630">630</td><td class="line"> <span class='comment'>enough rows to hold all the widgets*/</span></td></tr> +<tr class="codeline" data-linenumber="631"><td class="num" id="LN631">631</td><td class="line"> cols = num_sensors_per_group;</td></tr> +<tr class="codeline" data-linenumber="632"><td class="num" id="LN632">632</td><td class="line"> rows = num_active_sensors / num_sensors_per_group;</td></tr> +<tr class="codeline" data-linenumber="633"><td class="num" id="LN633">633</td><td class="line"> <span class='keyword'>while</span> (rows * cols < num_active_sensors || rows == 0) {</td></tr> +<tr class="codeline" data-linenumber="634"><td class="num" id="LN634">634</td><td class="line"> rows++;</td></tr> +<tr class="codeline" data-linenumber="635"><td class="num" id="LN635">635</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="636"><td class="num" id="LN636">636</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="637"><td class="num" id="LN637">637</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="638"><td class="num" id="LN638">638</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="639"><td class="num" id="LN639">639</td><td class="line"> <span class='comment'>/* if displaying labels / icons and values need to modify</span></td></tr> +<tr class="codeline" data-linenumber="640"><td class="num" id="LN640">640</td><td class="line"> <span class='comment'>number of rows / colums to accomodate this */</span></td></tr> +<tr class="codeline" data-linenumber="641"><td class="num" id="LN641">641</td><td class="line"> <span class='keyword'>if</span> (display_mode == DISPLAY_LABEL_WITH_VALUE || display_mode == DISPLAY_ICON_WITH_VALUE) {</td></tr> +<tr class="codeline" data-linenumber="642"><td class="num" id="LN642">642</td><td class="line"> <span class='keyword'>if</span> (layout_mode == VALUE_BESIDE_LABEL) {</td></tr> +<tr class="codeline" data-linenumber="643"><td class="num" id="LN643">643</td><td class="line"> <span class='comment'>/* to display labels next to values need twice as many columns */</span></td></tr> +<tr class="codeline" data-linenumber="644"><td class="num" id="LN644">644</td><td class="line"> cols *= 2;</td></tr> +<tr class="codeline" data-linenumber="645"><td class="num" id="LN645">645</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="646"><td class="num" id="LN646">646</td><td class="line"> <span class='comment'>/* to display labels above values, we need twice as many rows as without */</span></td></tr> +<tr class="codeline" data-linenumber="647"><td class="num" id="LN647">647</td><td class="line"> rows *= 2;</td></tr> +<tr class="codeline" data-linenumber="648"><td class="num" id="LN648">648</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="649"><td class="num" id="LN649">649</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="650"><td class="num" id="LN650">650</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="651"><td class="num" id="LN651">651</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->grid == <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="652"><td class="num" id="LN652">652</td><td class="line"> <span class='comment'>/* create grid and add to applet */</span></td></tr> +<tr class="codeline" data-linenumber="653"><td class="num" id="LN653">653</td><td class="line"> sensors_applet->grid = gtk_grid_new();</td></tr> +<tr class="codeline" data-linenumber="654"><td class="num" id="LN654">654</td><td class="line"> gtk_grid_set_column_spacing(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>, <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>);</td></tr> +<tr class="codeline" data-linenumber="655"><td class="num" id="LN655">655</td><td class="line"> gtk_grid_set_row_spacing(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>, <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>);</td></tr> +<tr class="codeline" data-linenumber="656"><td class="num" id="LN656">656</td><td class="line"> gtk_widget_set_halign(sensors_applet->grid, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="657"><td class="num" id="LN657">657</td><td class="line"> gtk_widget_set_valign(sensors_applet->grid, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="658"><td class="num" id="LN658">658</td><td class="line"> gtk_container_add(<span class='macro'>GTK_CONTAINER(sensors_applet->applet)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->applet)))))</span></span>, sensors_applet->grid);</td></tr> +<tr class="codeline" data-linenumber="659"><td class="num" id="LN659">659</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="660"><td class="num" id="LN660">660</td><td class="line"> <span class='comment'>/* remove all children if grid already exists so we can start again */</span></td></tr> +<tr class="codeline" data-linenumber="661"><td class="num" id="LN661">661</td><td class="line"> <span class='comment'>/* save a list of the old children for later */</span></td></tr> +<tr class="codeline" data-linenumber="662"><td class="num" id="LN662">662</td><td class="line"> old_grid_children = gtk_container_get_children(<span class='macro'>GTK_CONTAINER(sensors_applet->grid)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->grid)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="663"><td class="num" id="LN663">663</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="664"><td class="num" id="LN664">664</td><td class="line"> gtk_container_foreach(<span class='macro'>GTK_CONTAINER(sensors_applet->grid)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="665"><td class="num" id="LN665">665</td><td class="line"> sensors_applet_pack_display_empty_grid_cb,</td></tr> +<tr class="codeline" data-linenumber="666"><td class="num" id="LN666">666</td><td class="line"> sensors_applet->grid);</td></tr> +<tr class="codeline" data-linenumber="667"><td class="num" id="LN667">667</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="668"><td class="num" id="LN668">668</td><td class="line"> <span class='comment'>/* pack icons / labels and values into grid */</span></td></tr> +<tr class="codeline" data-linenumber="669"><td class="num" id="LN669">669</td><td class="line"> current_sensor = sensors_applet->active_sensors;</td></tr> +<tr class="codeline" data-linenumber="670"><td class="num" id="LN670">670</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="671"><td class="num" id="LN671">671</td><td class="line"> <span class='comment'>/* if showing labels / icons and values, need to pack labels / icons these first */</span></td></tr> +<tr class="codeline" data-linenumber="672"><td class="num" id="LN672">672</td><td class="line"> <span class='keyword'>if</span> (display_mode == DISPLAY_ICON_WITH_VALUE || display_mode == DISPLAY_LABEL_WITH_VALUE) {</td></tr> +<tr class="codeline" data-linenumber="673"><td class="num" id="LN673">673</td><td class="line"> <span class='comment'>/* loop through columns */</span></td></tr> +<tr class="codeline" data-linenumber="674"><td class="num" id="LN674">674</td><td class="line"> <span class='keyword'>for</span> (i = 0; current_sensor != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> && i < cols; <span class='comment'>/* increments depends on how we lay them out - see below */</span>) {</td></tr> +<tr class="codeline" data-linenumber="675"><td class="num" id="LN675">675</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="676"><td class="num" id="LN676">676</td><td class="line"> <span class='comment'>/* loop through rows in a column */</span></td></tr> +<tr class="codeline" data-linenumber="677"><td class="num" id="LN677">677</td><td class="line"> <span class='keyword'>for</span> (j = 0; current_sensor && j < rows; <span class='comment'>/* see bottom of for loop*/</span>) {</td></tr> +<tr class="codeline" data-linenumber="678"><td class="num" id="LN678">678</td><td class="line"> <span class='comment'>/* attach label / icon at this point */</span></td></tr> +<tr class="codeline" data-linenumber="679"><td class="num" id="LN679">679</td><td class="line"> <span class='keyword'>if</span> (display_mode == DISPLAY_ICON_WITH_VALUE) {</td></tr> +<tr class="codeline" data-linenumber="680"><td class="num" id="LN680">680</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->icon) {</td></tr> +<tr class="codeline" data-linenumber="681"><td class="num" id="LN681">681</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="682"><td class="num" id="LN682">682</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->icon,</td></tr> +<tr class="codeline" data-linenumber="683"><td class="num" id="LN683">683</td><td class="line"> i, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="684"><td class="num" id="LN684">684</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="685"><td class="num" id="LN685">685</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="686"><td class="num" id="LN686">686</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->label) {</td></tr> +<tr class="codeline" data-linenumber="687"><td class="num" id="LN687">687</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="688"><td class="num" id="LN688">688</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->label,</td></tr> +<tr class="codeline" data-linenumber="689"><td class="num" id="LN689">689</td><td class="line"> i, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="690"><td class="num" id="LN690">690</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="691"><td class="num" id="LN691">691</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="692"><td class="num" id="LN692">692</td><td class="line"> <span class='comment'>/* now attach sensor value to either row below or column next to */</span></td></tr> +<tr class="codeline" data-linenumber="693"><td class="num" id="LN693">693</td><td class="line"> <span class='keyword'>if</span> (layout_mode == VALUE_BESIDE_LABEL) {</td></tr> +<tr class="codeline" data-linenumber="694"><td class="num" id="LN694">694</td><td class="line"> <span class='comment'>/* left align labels */</span></td></tr> +<tr class="codeline" data-linenumber="695"><td class="num" id="LN695">695</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->icon) {</td></tr> +<tr class="codeline" data-linenumber="696"><td class="num" id="LN696">696</td><td class="line"> gtk_widget_set_halign (((ActiveSensor *)(current_sensor->data))->icon, GTK_ALIGN_START);</td></tr> +<tr class="codeline" data-linenumber="697"><td class="num" id="LN697">697</td><td class="line"> gtk_widget_set_valign (((ActiveSensor *)(current_sensor->data))->icon, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="698"><td class="num" id="LN698">698</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="699"><td class="num" id="LN699">699</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->label) {</td></tr> +<tr class="codeline" data-linenumber="700"><td class="num" id="LN700">700</td><td class="line"> gtk_label_set_xalign (<span class='macro'>GTK_LABEL(((ActiveSensor *)(current_sensor->data))->label)<span class='macro_popup'>((((GtkLabel*) (void *) ((((ActiveSensor *)(current_sensor-><br>data))->label)))))</span></span>, 0);</td></tr> +<tr class="codeline" data-linenumber="701"><td class="num" id="LN701">701</td><td class="line"> gtk_label_set_yalign (<span class='macro'>GTK_LABEL(((ActiveSensor *)(current_sensor->data))->label)<span class='macro_popup'>((((GtkLabel*) (void *) ((((ActiveSensor *)(current_sensor-><br>data))->label)))))</span></span>, 0.5);</td></tr> +<tr class="codeline" data-linenumber="702"><td class="num" id="LN702">702</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="703"><td class="num" id="LN703">703</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="704"><td class="num" id="LN704">704</td><td class="line"> gtk_widget_set_halign (((ActiveSensor *)(current_sensor->data))->value, GTK_ALIGN_START);</td></tr> +<tr class="codeline" data-linenumber="705"><td class="num" id="LN705">705</td><td class="line"> gtk_widget_set_valign (((ActiveSensor *)(current_sensor->data))->value, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="706"><td class="num" id="LN706">706</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="707"><td class="num" id="LN707">707</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="708"><td class="num" id="LN708">708</td><td class="line"> <span class='comment'>/* place value next to label */</span></td></tr> +<tr class="codeline" data-linenumber="709"><td class="num" id="LN709">709</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="710"><td class="num" id="LN710">710</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="711"><td class="num" id="LN711">711</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->value,</td></tr> +<tr class="codeline" data-linenumber="712"><td class="num" id="LN712">712</td><td class="line"> i + 1, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="713"><td class="num" id="LN713">713</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="714"><td class="num" id="LN714">714</td><td class="line"> j++;</td></tr> +<tr class="codeline" data-linenumber="715"><td class="num" id="LN715">715</td><td class="line"> } <span class='keyword'>else</span> { <span class='comment'>/* place value below label */</span></td></tr> +<tr class="codeline" data-linenumber="716"><td class="num" id="LN716">716</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="717"><td class="num" id="LN717">717</td><td class="line"> <span class='comment'>/* center align labels */</span></td></tr> +<tr class="codeline" data-linenumber="718"><td class="num" id="LN718">718</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->icon) {</td></tr> +<tr class="codeline" data-linenumber="719"><td class="num" id="LN719">719</td><td class="line"> gtk_widget_set_halign (((ActiveSensor *)(current_sensor->data))->icon, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="720"><td class="num" id="LN720">720</td><td class="line"> gtk_widget_set_valign (((ActiveSensor *)(current_sensor->data))->icon, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="721"><td class="num" id="LN721">721</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="722"><td class="num" id="LN722">722</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->label) {</td></tr> +<tr class="codeline" data-linenumber="723"><td class="num" id="LN723">723</td><td class="line"> gtk_label_set_xalign (<span class='macro'>GTK_LABEL(((ActiveSensor *)(current_sensor->data))->label)<span class='macro_popup'>((((GtkLabel*) (void *) ((((ActiveSensor *)(current_sensor-><br>data))->label)))))</span></span>, 0.5);</td></tr> +<tr class="codeline" data-linenumber="724"><td class="num" id="LN724">724</td><td class="line"> gtk_label_set_yalign (<span class='macro'>GTK_LABEL(((ActiveSensor *)(current_sensor->data))->label)<span class='macro_popup'>((((GtkLabel*) (void *) ((((ActiveSensor *)(current_sensor-><br>data))->label)))))</span></span>, 0.5);</td></tr> +<tr class="codeline" data-linenumber="725"><td class="num" id="LN725">725</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="726"><td class="num" id="LN726">726</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="727"><td class="num" id="LN727">727</td><td class="line"> gtk_widget_set_halign (((ActiveSensor *)(current_sensor->data))->value, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="728"><td class="num" id="LN728">728</td><td class="line"> gtk_widget_set_valign (((ActiveSensor *)(current_sensor->data))->value, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="729"><td class="num" id="LN729">729</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="730"><td class="num" id="LN730">730</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="731"><td class="num" id="LN731">731</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="732"><td class="num" id="LN732">732</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="733"><td class="num" id="LN733">733</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->value,</td></tr> +<tr class="codeline" data-linenumber="734"><td class="num" id="LN734">734</td><td class="line"> i, j + 1, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="735"><td class="num" id="LN735">735</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="736"><td class="num" id="LN736">736</td><td class="line"> j += 2;</td></tr> +<tr class="codeline" data-linenumber="737"><td class="num" id="LN737">737</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="738"><td class="num" id="LN738">738</td><td class="line"> current_sensor = <span class='macro'>g_list_next(current_sensor)<span class='macro_popup'>((current_sensor) ? (((GList *)(current_sensor))->next) : (<br>(void*)0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="739"><td class="num" id="LN739">739</td><td class="line"> } <span class='comment'>/* end row loop */</span></td></tr> +<tr class="codeline" data-linenumber="740"><td class="num" id="LN740">740</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="741"><td class="num" id="LN741">741</td><td class="line"> <span class='comment'>/* now increment column index as needed */</span></td></tr> +<tr class="codeline" data-linenumber="742"><td class="num" id="LN742">742</td><td class="line"> <span class='keyword'>if</span> (layout_mode == VALUE_BESIDE_LABEL) { <span class='comment'>/* place value next to label */</span></td></tr> +<tr class="codeline" data-linenumber="743"><td class="num" id="LN743">743</td><td class="line"> i += 2;</td></tr> +<tr class="codeline" data-linenumber="744"><td class="num" id="LN744">744</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="745"><td class="num" id="LN745">745</td><td class="line"> i++;</td></tr> +<tr class="codeline" data-linenumber="746"><td class="num" id="LN746">746</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="747"><td class="num" id="LN747">747</td><td class="line"> } <span class='comment'>/* end column loop */</span></td></tr> +<tr class="codeline" data-linenumber="748"><td class="num" id="LN748">748</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="749"><td class="num" id="LN749">749</td><td class="line"> } <span class='keyword'>else</span> { <span class='comment'>/* not showing labels and icons with values, so just pack either only icons or values */</span></td></tr> +<tr class="codeline" data-linenumber="750"><td class="num" id="LN750">750</td><td class="line"> <span class='keyword'>for</span> (i = 0; current_sensor != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> && i < cols; ++i) {</td></tr> +<tr class="codeline" data-linenumber="751"><td class="num" id="LN751">751</td><td class="line"> <span class='keyword'>for</span> (j = 0; current_sensor!= <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> && j < rows; ++j) {</td></tr> +<tr class="codeline" data-linenumber="752"><td class="num" id="LN752">752</td><td class="line"> <span class='keyword'>if</span> (display_mode == DISPLAY_VALUE) {</td></tr> +<tr class="codeline" data-linenumber="753"><td class="num" id="LN753">753</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="754"><td class="num" id="LN754">754</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="755"><td class="num" id="LN755">755</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->value,</td></tr> +<tr class="codeline" data-linenumber="756"><td class="num" id="LN756">756</td><td class="line"> i, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="757"><td class="num" id="LN757">757</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="758"><td class="num" id="LN758">758</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (display_mode == DISPLAY_ICON) {</td></tr> +<tr class="codeline" data-linenumber="759"><td class="num" id="LN759">759</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="760"><td class="num" id="LN760">760</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="761"><td class="num" id="LN761">761</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->icon,</td></tr> +<tr class="codeline" data-linenumber="762"><td class="num" id="LN762">762</td><td class="line"> i, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="763"><td class="num" id="LN763">763</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="764"><td class="num" id="LN764">764</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (display_mode == DISPLAY_GRAPH) {</td></tr> +<tr class="codeline" data-linenumber="765"><td class="num" id="LN765">765</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->graph) {</td></tr> +<tr class="codeline" data-linenumber="766"><td class="num" id="LN766">766</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="767"><td class="num" id="LN767">767</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->graph_frame,</td></tr> +<tr class="codeline" data-linenumber="768"><td class="num" id="LN768">768</td><td class="line"> i, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="769"><td class="num" id="LN769">769</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="770"><td class="num" id="LN770">770</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="771"><td class="num" id="LN771">771</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="772"><td class="num" id="LN772">772</td><td class="line"> current_sensor = <span class='macro'>g_list_next(current_sensor)<span class='macro_popup'>((current_sensor) ? (((GList *)(current_sensor))->next) : (<br>(void*)0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="773"><td class="num" id="LN773">773</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="774"><td class="num" id="LN774">774</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="775"><td class="num" id="LN775">775</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="776"><td class="num" id="LN776">776</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="777"><td class="num" id="LN777">777</td><td class="line"> <span class='keyword'>if</span> (old_grid_children != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="778"><td class="num" id="LN778">778</td><td class="line"> gtk_container_foreach(<span class='macro'>GTK_CONTAINER(sensors_applet->grid)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="779"><td class="num" id="LN779">779</td><td class="line"> sensors_applet_pack_display_cleanup_refs_cb,</td></tr> +<tr class="codeline" data-linenumber="780"><td class="num" id="LN780">780</td><td class="line"> old_grid_children);</td></tr> +<tr class="codeline" data-linenumber="781"><td class="num" id="LN781">781</td><td class="line"> g_list_free(old_grid_children);</td></tr> +<tr class="codeline" data-linenumber="782"><td class="num" id="LN782">782</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="783"><td class="num" id="LN783">783</td><td class="line"> gtk_widget_show_all(<span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="784"><td class="num" id="LN784">784</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="785"><td class="num" id="LN785">785</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="786"><td class="num" id="LN786">786</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="787"><td class="num" id="LN787">787</td><td class="line"><span class='comment'>/* must unref when done with returned pixbuf */</span></td></tr> +<tr class="codeline" data-linenumber="788"><td class="num" id="LN788">788</td><td class="line">GdkPixbuf *sensors_applet_load_icon(IconType icon_type) {</td></tr> +<tr class="codeline" data-linenumber="789"><td class="num" id="LN789">789</td><td class="line"> GtkIconTheme *icon_theme;</td></tr> +<tr class="codeline" data-linenumber="790"><td class="num" id="LN790">790</td><td class="line"> GdkPixbuf *icon = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="791"><td class="num" id="LN791">791</td><td class="line"> GError *error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="792"><td class="num" id="LN792">792</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="793"><td class="num" id="LN793">793</td><td class="line"> <span class='comment'>/* try to load the icon */</span></td></tr> +<tr class="codeline" data-linenumber="794"><td class="num" id="LN794">794</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="795"><td class="num" id="LN795">795</td><td class="line"> <span class='comment'>/* not allowed to unref or ref icon_theme once we have it */</span></td></tr> +<tr class="codeline" data-linenumber="796"><td class="num" id="LN796">796</td><td class="line"> icon_theme = gtk_icon_theme_get_default();</td></tr> +<tr class="codeline" data-linenumber="797"><td class="num" id="LN797">797</td><td class="line"> icon = gtk_icon_theme_load_icon(icon_theme,</td></tr> +<tr class="codeline" data-linenumber="798"><td class="num" id="LN798">798</td><td class="line"> stock_icons[icon_type],</td></tr> +<tr class="codeline" data-linenumber="799"><td class="num" id="LN799">799</td><td class="line"> <span class='macro'>DEFAULT_ICON_SIZE<span class='macro_popup'>22</span></span>,</td></tr> +<tr class="codeline" data-linenumber="800"><td class="num" id="LN800">800</td><td class="line"> GTK_ICON_LOOKUP_USE_BUILTIN,</td></tr> +<tr class="codeline" data-linenumber="801"><td class="num" id="LN801">801</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="802"><td class="num" id="LN802">802</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="803"><td class="num" id="LN803">803</td><td class="line"> <span class='keyword'>if</span> (error) {</td></tr> +<tr class="codeline" data-linenumber="804"><td class="num" id="LN804">804</td><td class="line"> g_warning (<span class='string_literal'>"Could not load icon: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="805"><td class="num" id="LN805">805</td><td class="line"> g_error_free(error);</td></tr> +<tr class="codeline" data-linenumber="806"><td class="num" id="LN806">806</td><td class="line"> error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="807"><td class="num" id="LN807">807</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="808"><td class="num" id="LN808">808</td><td class="line"> <span class='comment'>/* try again with default icon */</span></td></tr> +<tr class="codeline" data-linenumber="809"><td class="num" id="LN809">809</td><td class="line"> icon = gtk_icon_theme_load_icon(icon_theme,</td></tr> +<tr class="codeline" data-linenumber="810"><td class="num" id="LN810">810</td><td class="line"> <span class='string_literal'>"image-missing"</span>,</td></tr> +<tr class="codeline" data-linenumber="811"><td class="num" id="LN811">811</td><td class="line"> <span class='macro'>DEFAULT_ICON_SIZE<span class='macro_popup'>22</span></span>,</td></tr> +<tr class="codeline" data-linenumber="812"><td class="num" id="LN812">812</td><td class="line"> GTK_ICON_LOOKUP_USE_BUILTIN,</td></tr> +<tr class="codeline" data-linenumber="813"><td class="num" id="LN813">813</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="814"><td class="num" id="LN814">814</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="815"><td class="num" id="LN815">815</td><td class="line"> <span class='keyword'>if</span> (error) {</td></tr> +<tr class="codeline" data-linenumber="816"><td class="num" id="LN816">816</td><td class="line"> <span class='comment'>/* this will quit sensors-applet but it is a pretty major error so may as well */</span></td></tr> +<tr class="codeline" data-linenumber="817"><td class="num" id="LN817">817</td><td class="line"> g_error(<span class='string_literal'>"Could not load GTK_STOCK_MISSING_IMAGE - major error!!!: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="818"><td class="num" id="LN818">818</td><td class="line"> g_error_free(error);</td></tr> +<tr class="codeline" data-linenumber="819"><td class="num" id="LN819">819</td><td class="line"> error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="820"><td class="num" id="LN820">820</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="821"><td class="num" id="LN821">821</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="822"><td class="num" id="LN822">822</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="823"><td class="num" id="LN823">823</td><td class="line"> <span class='keyword'>return</span> icon;</td></tr> +<tr class="codeline" data-linenumber="824"><td class="num" id="LN824">824</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="825"><td class="num" id="LN825">825</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="826"><td class="num" id="LN826">826</td><td class="line"><span class='comment'>// MUST FREE STRINGS AFTER CALLING THIS FUNCTION!!</span></td></tr> +<tr class="codeline" data-linenumber="827"><td class="num" id="LN827">827</td><td class="line">gboolean sensors_applet_add_sensor(SensorsApplet *sensors_applet,</td></tr> +<tr class="codeline" data-linenumber="828"><td class="num" id="LN828">828</td><td class="line"> <span class='keyword'>const</span> gchar *path,</td></tr> +<tr class="codeline" data-linenumber="829"><td class="num" id="LN829">829</td><td class="line"> <span class='keyword'>const</span> gchar *id,</td></tr> +<tr class="codeline" data-linenumber="830"><td class="num" id="LN830">830</td><td class="line"> <span class='keyword'>const</span> gchar *label,</td></tr> +<tr class="codeline" data-linenumber="831"><td class="num" id="LN831">831</td><td class="line"> <span class='keyword'>const</span> gchar *interface,</td></tr> +<tr class="codeline" data-linenumber="832"><td class="num" id="LN832">832</td><td class="line"> SensorType type,</td></tr> +<tr class="codeline" data-linenumber="833"><td class="num" id="LN833">833</td><td class="line"> gboolean enable,</td></tr> +<tr class="codeline" data-linenumber="834"><td class="num" id="LN834">834</td><td class="line"> gdouble low_value,</td></tr> +<tr class="codeline" data-linenumber="835"><td class="num" id="LN835">835</td><td class="line"> gdouble high_value,</td></tr> +<tr class="codeline" data-linenumber="836"><td class="num" id="LN836">836</td><td class="line"> gboolean alarm_enable,</td></tr> +<tr class="codeline" data-linenumber="837"><td class="num" id="LN837">837</td><td class="line"> <span class='keyword'>const</span> gchar *low_alarm_command,</td></tr> +<tr class="codeline" data-linenumber="838"><td class="num" id="LN838">838</td><td class="line"> <span class='keyword'>const</span> gchar *high_alarm_command,</td></tr> +<tr class="codeline" data-linenumber="839"><td class="num" id="LN839">839</td><td class="line"> gint alarm_timeout,</td></tr> +<tr class="codeline" data-linenumber="840"><td class="num" id="LN840">840</td><td class="line"> gdouble multiplier,</td></tr> +<tr class="codeline" data-linenumber="841"><td class="num" id="LN841">841</td><td class="line"> gdouble offset,</td></tr> +<tr class="codeline" data-linenumber="842"><td class="num" id="LN842">842</td><td class="line"> IconType icon_type,</td></tr> +<tr class="codeline" data-linenumber="843"><td class="num" id="LN843">843</td><td class="line"> <span class='keyword'>const</span> gchar *graph_color) {</td></tr> +<tr class="codeline" data-linenumber="844"><td class="num" id="LN844">844</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="845"><td class="num" id="LN845">845</td><td class="line"> GtkTreeIter interfaces_iter, sensors_iter;</td></tr> +<tr class="codeline" data-linenumber="846"><td class="num" id="LN846">846</td><td class="line"> gboolean not_empty_tree;</td></tr> +<tr class="codeline" data-linenumber="847"><td class="num" id="LN847">847</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="848"><td class="num" id="LN848">848</td><td class="line"> gchar *node_interface;</td></tr> +<tr class="codeline" data-linenumber="849"><td class="num" id="LN849">849</td><td class="line"> gboolean not_end_of_interfaces = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>, interface_exists = <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="850"><td class="num" id="LN850">850</td><td class="line"> gboolean not_end_of_sensors = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="851"><td class="num" id="LN851">851</td><td class="line"> gchar *sensor_id;</td></tr> +<tr class="codeline" data-linenumber="852"><td class="num" id="LN852">852</td><td class="line"> gchar *sensor_path;</td></tr> +<tr class="codeline" data-linenumber="853"><td class="num" id="LN853">853</td><td class="line"> SensorType sensor_type;</td></tr> +<tr class="codeline" data-linenumber="854"><td class="num" id="LN854">854</td><td class="line"> GdkPixbuf *icon;</td></tr> +<tr class="codeline" data-linenumber="855"><td class="num" id="LN855">855</td><td class="line"> GtkTreePath *tree_path;</td></tr> +<tr class="codeline" data-linenumber="856"><td class="num" id="LN856">856</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="857"><td class="num" id="LN857">857</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_23<br>; if (sensors_applet) _g_boolean_var_23 = 1; else _g_boolean_var_23<br> = 0; _g_boolean_var_23; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 857, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="858"><td class="num" id="LN858">858</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="859"><td class="num" id="LN859">859</td><td class="line"> <span class='comment'>/* assume tree is not empty */</span></td></tr> +<tr class="codeline" data-linenumber="860"><td class="num" id="LN860">860</td><td class="line"> not_empty_tree = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="861"><td class="num" id="LN861">861</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="862"><td class="num" id="LN862">862</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == sensors_applet->sensors) {</td></tr> +<tr class="codeline" data-linenumber="863"><td class="num" id="LN863">863</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="864"><td class="num" id="LN864">864</td><td class="line"> sensors_applet->sensors = gtk_tree_store_new(N_COLUMNS,</td></tr> +<tr class="codeline" data-linenumber="865"><td class="num" id="LN865">865</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* path */</span></td></tr> +<tr class="codeline" data-linenumber="866"><td class="num" id="LN866">866</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* id */</span></td></tr> +<tr class="codeline" data-linenumber="867"><td class="num" id="LN867">867</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* label */</span></td></tr> +<tr class="codeline" data-linenumber="868"><td class="num" id="LN868">868</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* interface */</span></td></tr> +<tr class="codeline" data-linenumber="869"><td class="num" id="LN869">869</td><td class="line"> <span class='macro'>G_TYPE_UINT<span class='macro_popup'>((GType) ((7) << (2)))</span></span>, <span class='comment'>/* sensor type */</span></td></tr> +<tr class="codeline" data-linenumber="870"><td class="num" id="LN870">870</td><td class="line"> <span class='macro'>G_TYPE_BOOLEAN<span class='macro_popup'>((GType) ((5) << (2)))</span></span>, <span class='comment'>/* enable */</span></td></tr> +<tr class="codeline" data-linenumber="871"><td class="num" id="LN871">871</td><td class="line"> <span class='macro'>G_TYPE_BOOLEAN<span class='macro_popup'>((GType) ((5) << (2)))</span></span>, <span class='comment'>/* visible */</span></td></tr> +<tr class="codeline" data-linenumber="872"><td class="num" id="LN872">872</td><td class="line"> <span class='macro'>G_TYPE_DOUBLE<span class='macro_popup'>((GType) ((15) << (2)))</span></span>, <span class='comment'>/* low value */</span></td></tr> +<tr class="codeline" data-linenumber="873"><td class="num" id="LN873">873</td><td class="line"> <span class='macro'>G_TYPE_DOUBLE<span class='macro_popup'>((GType) ((15) << (2)))</span></span>, <span class='comment'>/* high type */</span></td></tr> +<tr class="codeline" data-linenumber="874"><td class="num" id="LN874">874</td><td class="line"> <span class='macro'>G_TYPE_BOOLEAN<span class='macro_popup'>((GType) ((5) << (2)))</span></span>, <span class='comment'>/* alarm enable */</span></td></tr> +<tr class="codeline" data-linenumber="875"><td class="num" id="LN875">875</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* low alarm command */</span></td></tr> +<tr class="codeline" data-linenumber="876"><td class="num" id="LN876">876</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* high alarm command */</span></td></tr> +<tr class="codeline" data-linenumber="877"><td class="num" id="LN877">877</td><td class="line"> <span class='macro'>G_TYPE_UINT<span class='macro_popup'>((GType) ((7) << (2)))</span></span>, <span class='comment'>/* alarm timeout */</span></td></tr> +<tr class="codeline" data-linenumber="878"><td class="num" id="LN878">878</td><td class="line"> <span class='macro'>G_TYPE_DOUBLE<span class='macro_popup'>((GType) ((15) << (2)))</span></span>, <span class='comment'>/* multiplier */</span></td></tr> +<tr class="codeline" data-linenumber="879"><td class="num" id="LN879">879</td><td class="line"> <span class='macro'>G_TYPE_DOUBLE<span class='macro_popup'>((GType) ((15) << (2)))</span></span>, <span class='comment'>/* offset */</span></td></tr> +<tr class="codeline" data-linenumber="880"><td class="num" id="LN880">880</td><td class="line"> <span class='macro'>G_TYPE_UINT<span class='macro_popup'>((GType) ((7) << (2)))</span></span>, <span class='comment'>/* icon type */</span></td></tr> +<tr class="codeline" data-linenumber="881"><td class="num" id="LN881">881</td><td class="line"> <span class='macro'>GDK_TYPE_PIXBUF<span class='macro_popup'>(gdk_pixbuf_get_type ())</span></span>, <span class='comment'>/* icon pixbuf */</span></td></tr> +<tr class="codeline" data-linenumber="882"><td class="num" id="LN882">882</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>); <span class='comment'>/* graph color */</span></td></tr> +<tr class="codeline" data-linenumber="883"><td class="num" id="LN883">883</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="884"><td class="num" id="LN884">884</td><td class="line"> g_debug(<span class='string_literal'>"Sensor tree created."</span>);</td></tr> +<tr class="codeline" data-linenumber="885"><td class="num" id="LN885">885</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="886"><td class="num" id="LN886">886</td><td class="line"> <span class='comment'>/* we know tree is actually empty since we just created it */</span></td></tr> +<tr class="codeline" data-linenumber="887"><td class="num" id="LN887">887</td><td class="line"> not_empty_tree = <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="888"><td class="num" id="LN888">888</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="889"><td class="num" id="LN889">889</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="890"><td class="num" id="LN890">890</td><td class="line"> <span class='comment'>/* search sensor tree for the parent interface to place this sensor under */</span></td></tr> +<tr class="codeline" data-linenumber="891"><td class="num" id="LN891">891</td><td class="line"> <span class='keyword'>for</span> (not_empty_tree = gtk_tree_model_get_iter_first(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &interfaces_iter);</td></tr> +<tr class="codeline" data-linenumber="892"><td class="num" id="LN892">892</td><td class="line"> not_empty_tree && not_end_of_interfaces && !interface_exists;</td></tr> +<tr class="codeline" data-linenumber="893"><td class="num" id="LN893">893</td><td class="line"> not_end_of_interfaces = gtk_tree_model_iter_next(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &interfaces_iter)) {</td></tr> +<tr class="codeline" data-linenumber="894"><td class="num" id="LN894">894</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="895"><td class="num" id="LN895">895</td><td class="line"> gtk_tree_model_get(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &interfaces_iter, INTERFACE_COLUMN, &node_interface, -1);</td></tr> +<tr class="codeline" data-linenumber="896"><td class="num" id="LN896">896</td><td class="line"> <span class='keyword'>if</span> (g_ascii_strcasecmp(interface, node_interface) == 0) {</td></tr> +<tr class="codeline" data-linenumber="897"><td class="num" id="LN897">897</td><td class="line"> <span class='comment'>/* found interface in tree */</span></td></tr> +<tr class="codeline" data-linenumber="898"><td class="num" id="LN898">898</td><td class="line"> interface_exists = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="899"><td class="num" id="LN899">899</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="900"><td class="num" id="LN900">900</td><td class="line"> <span class='comment'>/* now see if this actual sensor already exists within this interface - don't want to add duplicates */</span></td></tr> +<tr class="codeline" data-linenumber="901"><td class="num" id="LN901">901</td><td class="line"> <span class='comment'>/* see if have children */</span></td></tr> +<tr class="codeline" data-linenumber="902"><td class="num" id="LN902">902</td><td class="line"> <span class='keyword'>for</span> (not_end_of_sensors = gtk_tree_model_iter_children(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter, &interfaces_iter);</td></tr> +<tr class="codeline" data-linenumber="903"><td class="num" id="LN903">903</td><td class="line"> not_end_of_sensors;</td></tr> +<tr class="codeline" data-linenumber="904"><td class="num" id="LN904">904</td><td class="line"> not_end_of_sensors = gtk_tree_model_iter_next(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter)) {</td></tr> +<tr class="codeline" data-linenumber="905"><td class="num" id="LN905">905</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="906"><td class="num" id="LN906">906</td><td class="line"> gtk_tree_model_get(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter,</td></tr> +<tr class="codeline" data-linenumber="907"><td class="num" id="LN907">907</td><td class="line"> PATH_COLUMN, &sensor_path,</td></tr> +<tr class="codeline" data-linenumber="908"><td class="num" id="LN908">908</td><td class="line"> ID_COLUMN, &sensor_id,</td></tr> +<tr class="codeline" data-linenumber="909"><td class="num" id="LN909">909</td><td class="line"> SENSOR_TYPE_COLUMN, &sensor_type,</td></tr> +<tr class="codeline" data-linenumber="910"><td class="num" id="LN910">910</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="911"><td class="num" id="LN911">911</td><td class="line"> <span class='keyword'>if</span> (g_ascii_strcasecmp(sensor_id, id) == 0 && g_ascii_strcasecmp(sensor_path, path) == 0 && sensor_type == type) {</td></tr> +<tr class="codeline" data-linenumber="912"><td class="num" id="LN912">912</td><td class="line"> <span class='comment'>/* sensor already exists so dont add a second time */</span></td></tr> +<tr class="codeline" data-linenumber="913"><td class="num" id="LN913">913</td><td class="line"> g_debug(<span class='string_literal'>"sensor with path: %s, id: %s already exists in tree, not adding a second time"</span>, sensor_path, sensor_id);</td></tr> +<tr class="codeline" data-linenumber="914"><td class="num" id="LN914">914</td><td class="line"> g_free(sensor_id);</td></tr> +<tr class="codeline" data-linenumber="915"><td class="num" id="LN915">915</td><td class="line"> g_free(sensor_path);</td></tr> +<tr class="codeline" data-linenumber="916"><td class="num" id="LN916">916</td><td class="line"> g_free(node_interface);</td></tr> +<tr class="codeline" data-linenumber="917"><td class="num" id="LN917">917</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="918"><td class="num" id="LN918">918</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="919"><td class="num" id="LN919">919</td><td class="line"> g_free(sensor_id);</td></tr> +<tr class="codeline" data-linenumber="920"><td class="num" id="LN920">920</td><td class="line"> g_free(sensor_path);</td></tr> +<tr class="codeline" data-linenumber="921"><td class="num" id="LN921">921</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="922"><td class="num" id="LN922">922</td><td class="line"> g_free(node_interface);</td></tr> +<tr class="codeline" data-linenumber="923"><td class="num" id="LN923">923</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="924"><td class="num" id="LN924">924</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="925"><td class="num" id="LN925">925</td><td class="line"> g_free(node_interface);</td></tr> +<tr class="codeline" data-linenumber="926"><td class="num" id="LN926">926</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="927"><td class="num" id="LN927">927</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="928"><td class="num" id="LN928">928</td><td class="line"> <span class='keyword'>if</span> (!interface_exists) {</td></tr> +<tr class="codeline" data-linenumber="929"><td class="num" id="LN929">929</td><td class="line"> <span class='comment'>/* add to required plugins hash table so we ensure this</span></td></tr> +<tr class="codeline" data-linenumber="930"><td class="num" id="LN930">930</td><td class="line"> <span class='comment'>plugin stays loaded to make sure we have a get sensor</span></td></tr> +<tr class="codeline" data-linenumber="931"><td class="num" id="LN931">931</td><td class="line"> <span class='comment'>value function if possible */</span></td></tr> +<tr class="codeline" data-linenumber="932"><td class="num" id="LN932">932</td><td class="line"> g_hash_table_insert(sensors_applet->required_plugins,</td></tr> +<tr class="codeline" data-linenumber="933"><td class="num" id="LN933">933</td><td class="line"> <span class='macro'>g_strdup(interface)<span class='macro_popup'>g_strdup_inline (interface)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="934"><td class="num" id="LN934">934</td><td class="line"> <span class='macro'>GINT_TO_POINTER(TRUE)<span class='macro_popup'>((gpointer) (glong) ((!(0))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="935"><td class="num" id="LN935">935</td><td class="line"> g_debug(<span class='string_literal'>"added interface %s to required plugins"</span>, interface);</td></tr> +<tr class="codeline" data-linenumber="936"><td class="num" id="LN936">936</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="937"><td class="num" id="LN937">937</td><td class="line"> <span class='comment'>/* wasn't able to find interface root node so create it */</span></td></tr> +<tr class="codeline" data-linenumber="938"><td class="num" id="LN938">938</td><td class="line"> gtk_tree_store_append(sensors_applet->sensors,</td></tr> +<tr class="codeline" data-linenumber="939"><td class="num" id="LN939">939</td><td class="line"> &interfaces_iter,</td></tr> +<tr class="codeline" data-linenumber="940"><td class="num" id="LN940">940</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="941"><td class="num" id="LN941">941</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="942"><td class="num" id="LN942">942</td><td class="line"> gtk_tree_store_set(sensors_applet->sensors,</td></tr> +<tr class="codeline" data-linenumber="943"><td class="num" id="LN943">943</td><td class="line"> &interfaces_iter,</td></tr> +<tr class="codeline" data-linenumber="944"><td class="num" id="LN944">944</td><td class="line"> ID_COLUMN, interface,</td></tr> +<tr class="codeline" data-linenumber="945"><td class="num" id="LN945">945</td><td class="line"> INTERFACE_COLUMN, interface,</td></tr> +<tr class="codeline" data-linenumber="946"><td class="num" id="LN946">946</td><td class="line"> VISIBLE_COLUMN, <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="947"><td class="num" id="LN947">947</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="948"><td class="num" id="LN948">948</td><td class="line"> g_debug(<span class='string_literal'>"Added sensor interface %s to tree"</span>, interface);</td></tr> +<tr class="codeline" data-linenumber="949"><td class="num" id="LN949">949</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="950"><td class="num" id="LN950">950</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="951"><td class="num" id="LN951">951</td><td class="line"> <span class='comment'>/* then add sensor as a child under interface node - ie assume</span></td></tr> +<tr class="codeline" data-linenumber="952"><td class="num" id="LN952">952</td><td class="line"> <span class='comment'>* we either found it or created it - the inteface node that is */</span></td></tr> +<tr class="codeline" data-linenumber="953"><td class="num" id="LN953">953</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="954"><td class="num" id="LN954">954</td><td class="line"> <span class='comment'>/* for now just add sensors all in a single list */</span></td></tr> +<tr class="codeline" data-linenumber="955"><td class="num" id="LN955">955</td><td class="line"> gtk_tree_store_append(sensors_applet->sensors, &sensors_iter, &interfaces_iter);</td></tr> +<tr class="codeline" data-linenumber="956"><td class="num" id="LN956">956</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="957"><td class="num" id="LN957">957</td><td class="line"> <span class='comment'>/* if sensor is already in settings, load values from there */</span></td></tr> +<tr class="codeline" data-linenumber="958"><td class="num" id="LN958">958</td><td class="line"> gchar *applet_path = mate_panel_applet_get_preferences_path (sensors_applet->applet);</td></tr> +<tr class="codeline" data-linenumber="959"><td class="num" id="LN959">959</td><td class="line"> gchar *gsuid = sensors_applet_settings_get_unique_id (interface, id, path);</td></tr> +<tr class="codeline" data-linenumber="960"><td class="num" id="LN960">960</td><td class="line"> gchar *settings_path = g_strdup_printf (<span class='string_literal'>"%s%s/"</span>, applet_path, gsuid);</td></tr> +<tr class="codeline" data-linenumber="961"><td class="num" id="LN961">961</td><td class="line"> GSettings *settings = g_settings_new_with_path (<span class='string_literal'>"org.mate.sensors-applet.sensor"</span>, settings_path);</td></tr> +<tr class="codeline" data-linenumber="962"><td class="num" id="LN962">962</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="963"><td class="num" id="LN963">963</td><td class="line"> <span class='comment'>/* add hash to temp sorting list */</span></td></tr> +<tr class="codeline" data-linenumber="964"><td class="num" id="LN964">964</td><td class="line"> g_variant_builder_add (&gvb_sensors_hash_list, <span class='string_literal'>"s"</span>, gsuid);</td></tr> +<tr class="codeline" data-linenumber="965"><td class="num" id="LN965">965</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="966"><td class="num" id="LN966">966</td><td class="line"> g_free (applet_path);</td></tr> +<tr class="codeline" data-linenumber="967"><td class="num" id="LN967">967</td><td class="line"> g_free (gsuid);</td></tr> +<tr class="codeline" data-linenumber="968"><td class="num" id="LN968">968</td><td class="line"> g_free (settings_path);</td></tr> +<tr class="codeline" data-linenumber="969"><td class="num" id="LN969">969</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="970"><td class="num" id="LN970">970</td><td class="line"> gchar *settings_id = g_settings_get_string (settings, <span class='macro'>ID<span class='macro_popup'>"id"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="971"><td class="num" id="LN971">971</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="972"><td class="num" id="LN972">972</td><td class="line"> <span class='keyword'>if</span> (settings_id != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> && settings_id[0] != '\0') {</td></tr> +<tr class="codeline" data-linenumber="973"><td class="num" id="LN973">973</td><td class="line"> enable = g_settings_get_boolean (settings, <span class='macro'>ENABLED<span class='macro_popup'>"enabled"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="974"><td class="num" id="LN974">974</td><td class="line"> icon = sensors_applet_load_icon(g_settings_get_int (settings, <span class='macro'>ICON_TYPE<span class='macro_popup'>"icon-type"</span></span>));</td></tr> +<tr class="codeline" data-linenumber="975"><td class="num" id="LN975">975</td><td class="line"> gtk_tree_store_set(sensors_applet->sensors,</td></tr> +<tr class="codeline" data-linenumber="976"><td class="num" id="LN976">976</td><td class="line"> &sensors_iter,</td></tr> +<tr class="codeline" data-linenumber="977"><td class="num" id="LN977">977</td><td class="line"> PATH_COLUMN, g_settings_get_string (settings, <span class='macro'>PATH<span class='macro_popup'>"path"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="978"><td class="num" id="LN978">978</td><td class="line"> ID_COLUMN, settings_id,</td></tr> +<tr class="codeline" data-linenumber="979"><td class="num" id="LN979">979</td><td class="line"> LABEL_COLUMN, g_settings_get_string (settings, <span class='macro'>LABEL<span class='macro_popup'>"label"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="980"><td class="num" id="LN980">980</td><td class="line"> INTERFACE_COLUMN, g_settings_get_string (settings, <span class='macro'>INTERFACE<span class='macro_popup'>"interface"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="981"><td class="num" id="LN981">981</td><td class="line"> SENSOR_TYPE_COLUMN, g_settings_get_int (settings, <span class='macro'>SENSOR_TYPE<span class='macro_popup'>"sensor-type"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="982"><td class="num" id="LN982">982</td><td class="line"> ENABLE_COLUMN, enable,</td></tr> +<tr class="codeline" data-linenumber="983"><td class="num" id="LN983">983</td><td class="line"> VISIBLE_COLUMN, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="984"><td class="num" id="LN984">984</td><td class="line"> LOW_VALUE_COLUMN, g_settings_get_double (settings, <span class='macro'>LOW_VALUE<span class='macro_popup'>"low-value"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="985"><td class="num" id="LN985">985</td><td class="line"> HIGH_VALUE_COLUMN, g_settings_get_double (settings, <span class='macro'>HIGH_VALUE<span class='macro_popup'>"high-value"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="986"><td class="num" id="LN986">986</td><td class="line"> ALARM_ENABLE_COLUMN, g_settings_get_boolean (settings, <span class='macro'>ALARM_ENABLED<span class='macro_popup'>"alarm-enabled"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="987"><td class="num" id="LN987">987</td><td class="line"> ALARM_TIMEOUT_COLUMN, g_settings_get_int (settings, <span class='macro'>ALARM_TIMEOUT<span class='macro_popup'>"alarm-timeout"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="988"><td class="num" id="LN988">988</td><td class="line"> LOW_ALARM_COMMAND_COLUMN, g_settings_get_string (settings, <span class='macro'>LOW_ALARM_COMMAND<span class='macro_popup'>"low-alarm-command"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="989"><td class="num" id="LN989">989</td><td class="line"> HIGH_ALARM_COMMAND_COLUMN, g_settings_get_string (settings, <span class='macro'>HIGH_ALARM_COMMAND<span class='macro_popup'>"high-alarm-command"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="990"><td class="num" id="LN990">990</td><td class="line"> MULTIPLIER_COLUMN, g_settings_get_double (settings, <span class='macro'>MULTIPLIER<span class='macro_popup'>"multiplier"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="991"><td class="num" id="LN991">991</td><td class="line"> OFFSET_COLUMN, g_settings_get_double (settings, <span class='macro'>OFFSET<span class='macro_popup'>"offset"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="992"><td class="num" id="LN992">992</td><td class="line"> ICON_TYPE_COLUMN, g_settings_get_int (settings, <span class='macro'>ICON_TYPE<span class='macro_popup'>"icon-type"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="993"><td class="num" id="LN993">993</td><td class="line"> ICON_PIXBUF_COLUMN, icon,</td></tr> +<tr class="codeline" data-linenumber="994"><td class="num" id="LN994">994</td><td class="line"> GRAPH_COLOR_COLUMN, g_settings_get_string (settings, <span class='macro'>GRAPH_COLOR<span class='macro_popup'>"graph-color"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="995"><td class="num" id="LN995">995</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="996"><td class="num" id="LN996">996</td><td class="line"> g_free (settings_id);</td></tr> +<tr class="codeline" data-linenumber="997"><td class="num" id="LN997">997</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="998"><td class="num" id="LN998">998</td><td class="line"> icon = sensors_applet_load_icon(icon_type);</td></tr> +<tr class="codeline" data-linenumber="999"><td class="num" id="LN999">999</td><td class="line"> gtk_tree_store_set(sensors_applet->sensors,</td></tr> +<tr class="codeline" data-linenumber="1000"><td class="num" id="LN1000">1000</td><td class="line"> &sensors_iter,</td></tr> +<tr class="codeline" data-linenumber="1001"><td class="num" id="LN1001">1001</td><td class="line"> PATH_COLUMN, path,</td></tr> +<tr class="codeline" data-linenumber="1002"><td class="num" id="LN1002">1002</td><td class="line"> ID_COLUMN, id,</td></tr> +<tr class="codeline" data-linenumber="1003"><td class="num" id="LN1003">1003</td><td class="line"> LABEL_COLUMN, label,</td></tr> +<tr class="codeline" data-linenumber="1004"><td class="num" id="LN1004">1004</td><td class="line"> INTERFACE_COLUMN, interface,</td></tr> +<tr class="codeline" data-linenumber="1005"><td class="num" id="LN1005">1005</td><td class="line"> SENSOR_TYPE_COLUMN, type,</td></tr> +<tr class="codeline" data-linenumber="1006"><td class="num" id="LN1006">1006</td><td class="line"> ENABLE_COLUMN, enable,</td></tr> +<tr class="codeline" data-linenumber="1007"><td class="num" id="LN1007">1007</td><td class="line"> VISIBLE_COLUMN, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="1008"><td class="num" id="LN1008">1008</td><td class="line"> LOW_VALUE_COLUMN, low_value,</td></tr> +<tr class="codeline" data-linenumber="1009"><td class="num" id="LN1009">1009</td><td class="line"> HIGH_VALUE_COLUMN, high_value,</td></tr> +<tr class="codeline" data-linenumber="1010"><td class="num" id="LN1010">1010</td><td class="line"> ALARM_ENABLE_COLUMN, alarm_enable,</td></tr> +<tr class="codeline" data-linenumber="1011"><td class="num" id="LN1011">1011</td><td class="line"> ALARM_TIMEOUT_COLUMN, alarm_timeout,</td></tr> +<tr class="codeline" data-linenumber="1012"><td class="num" id="LN1012">1012</td><td class="line"> LOW_ALARM_COMMAND_COLUMN, low_alarm_command,</td></tr> +<tr class="codeline" data-linenumber="1013"><td class="num" id="LN1013">1013</td><td class="line"> HIGH_ALARM_COMMAND_COLUMN, high_alarm_command,</td></tr> +<tr class="codeline" data-linenumber="1014"><td class="num" id="LN1014">1014</td><td class="line"> MULTIPLIER_COLUMN, multiplier,</td></tr> +<tr class="codeline" data-linenumber="1015"><td class="num" id="LN1015">1015</td><td class="line"> OFFSET_COLUMN, offset,</td></tr> +<tr class="codeline" data-linenumber="1016"><td class="num" id="LN1016">1016</td><td class="line"> ICON_TYPE_COLUMN, icon_type,</td></tr> +<tr class="codeline" data-linenumber="1017"><td class="num" id="LN1017">1017</td><td class="line"> ICON_PIXBUF_COLUMN, icon,</td></tr> +<tr class="codeline" data-linenumber="1018"><td class="num" id="LN1018">1018</td><td class="line"> GRAPH_COLOR_COLUMN, graph_color,</td></tr> +<tr class="codeline" data-linenumber="1019"><td class="num" id="LN1019">1019</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="1020"><td class="num" id="LN1020">1020</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1021"><td class="num" id="LN1021">1021</td><td class="line"> g_object_unref (settings);</td></tr> +<tr class="codeline" data-linenumber="1022"><td class="num" id="LN1022">1022</td><td class="line"> g_debug(<span class='string_literal'>"added sensor %s to tree"</span>, path);</td></tr> +<tr class="codeline" data-linenumber="1023"><td class="num" id="LN1023">1023</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1024"><td class="num" id="LN1024">1024</td><td class="line"> <span class='comment'>/* remove reference to icon as tree now has ref */</span></td></tr> +<tr class="codeline" data-linenumber="1025"><td class="num" id="LN1025">1025</td><td class="line"> g_object_unref(icon);</td></tr> +<tr class="codeline" data-linenumber="1026"><td class="num" id="LN1026">1026</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1027"><td class="num" id="LN1027">1027</td><td class="line"> <span class='comment'>/* create the active sensor */</span></td></tr> +<tr class="codeline" data-linenumber="1028"><td class="num" id="LN1028">1028</td><td class="line"> <span class='keyword'>if</span> (enable) {</td></tr> +<tr class="codeline" data-linenumber="1029"><td class="num" id="LN1029">1029</td><td class="line"> tree_path = gtk_tree_model_get_path(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter);</td></tr> +<tr class="codeline" data-linenumber="1030"><td class="num" id="LN1030">1030</td><td class="line"> sensors_applet_sensor_enabled(sensors_applet, tree_path);</td></tr> +<tr class="codeline" data-linenumber="1031"><td class="num" id="LN1031">1031</td><td class="line"> gtk_tree_path_free(tree_path);</td></tr> +<tr class="codeline" data-linenumber="1032"><td class="num" id="LN1032">1032</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1033"><td class="num" id="LN1033">1033</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1034"><td class="num" id="LN1034">1034</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1035"><td class="num" id="LN1035">1035</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1036"><td class="num" id="LN1036">1036</td><td class="line"><span class='keyword'>static</span> ActiveSensor *sensors_applet_find_active_sensor(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1037"><td class="num" id="LN1037">1037</td><td class="line"> GtkTreePath *sensor_tree_path;</td></tr> +<tr class="codeline" data-linenumber="1038"><td class="num" id="LN1038">1038</td><td class="line"> GList *current_sensor;</td></tr> +<tr class="codeline" data-linenumber="1039"><td class="num" id="LN1039">1039</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1040"><td class="num" id="LN1040">1040</td><td class="line"> <span class='keyword'>for</span> (current_sensor = sensors_applet->active_sensors; current_sensor != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; current_sensor = <span class='macro'>g_list_next(current_sensor)<span class='macro_popup'>((current_sensor) ? (((GList *)(current_sensor))->next) : (<br>(void*)0))</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="1041"><td class="num" id="LN1041">1041</td><td class="line"> sensor_tree_path = gtk_tree_row_reference_get_path(((ActiveSensor *)(current_sensor->data))->sensor_row);</td></tr> +<tr class="codeline" data-linenumber="1042"><td class="num" id="LN1042">1042</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1043"><td class="num" id="LN1043">1043</td><td class="line"> <span class='keyword'>if</span> (gtk_tree_path_compare(path, sensor_tree_path) == 0) {</td></tr> +<tr class="codeline" data-linenumber="1044"><td class="num" id="LN1044">1044</td><td class="line"> gtk_tree_path_free(sensor_tree_path);</td></tr> +<tr class="codeline" data-linenumber="1045"><td class="num" id="LN1045">1045</td><td class="line"> <span class='keyword'>return</span> ((ActiveSensor *)(current_sensor->data));</td></tr> +<tr class="codeline" data-linenumber="1046"><td class="num" id="LN1046">1046</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1047"><td class="num" id="LN1047">1047</td><td class="line"> gtk_tree_path_free(sensor_tree_path);</td></tr> +<tr class="codeline" data-linenumber="1048"><td class="num" id="LN1048">1048</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1049"><td class="num" id="LN1049">1049</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1050"><td class="num" id="LN1050">1050</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1051"><td class="num" id="LN1051">1051</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1052"><td class="num" id="LN1052">1052</td><td class="line"><span class='comment'>/* path should be the full path to a file representing the sensor (eg</span></td></tr> +<tr class="codeline" data-linenumber="1053"><td class="num" id="LN1053">1053</td><td class="line"> <span class='comment'>* /dev/hda or /sys/devices/platform/i2c-0/0-0290/temp1_input) */</span></td></tr> +<tr class="codeline" data-linenumber="1054"><td class="num" id="LN1054">1054</td><td class="line"><span class='keyword'>void</span> sensors_applet_display_layout_changed(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="1055"><td class="num" id="LN1055">1055</td><td class="line"> <span class='comment'>/* update sensors since will need to update icons / graphs etc</span></td></tr> +<tr class="codeline" data-linenumber="1056"><td class="num" id="LN1056">1056</td><td class="line"> <span class='comment'>* if weren't displayed before */</span></td></tr> +<tr class="codeline" data-linenumber="1057"><td class="num" id="LN1057">1057</td><td class="line"> GList *list = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1058"><td class="num" id="LN1058">1058</td><td class="line"> <span class='keyword'>for</span> (list = sensors_applet->active_sensors; list != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; list = list->next) {</td></tr> +<tr class="codeline" data-linenumber="1059"><td class="num" id="LN1059">1059</td><td class="line"> ActiveSensor *as = (ActiveSensor *)list->data;</td></tr> +<tr class="codeline" data-linenumber="1060"><td class="num" id="LN1060">1060</td><td class="line"> as->updated = <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1061"><td class="num" id="LN1061">1061</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1062"><td class="num" id="LN1062">1062</td><td class="line"> sensors_applet_update_active_sensors(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1063"><td class="num" id="LN1063">1063</td><td class="line"> sensors_applet_pack_display(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1064"><td class="num" id="LN1064">1064</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1065"><td class="num" id="LN1065">1065</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1066"><td class="num" id="LN1066">1066</td><td class="line"><span class='keyword'>void</span> sensors_applet_alarm_off(SensorsApplet *sensors_applet,</td></tr> +<tr class="codeline" data-linenumber="1067"><td class="num" id="LN1067">1067</td><td class="line"> GtkTreePath *path,</td></tr> +<tr class="codeline" data-linenumber="1068"><td class="num" id="LN1068">1068</td><td class="line"> NotifType notif_type) {</td></tr> +<tr class="codeline" data-linenumber="1069"><td class="num" id="LN1069">1069</td><td class="line"> ActiveSensor *active_sensor;</td></tr> +<tr class="codeline" data-linenumber="1070"><td class="num" id="LN1070">1070</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1071"><td class="num" id="LN1071">1071</td><td class="line"> <span class='keyword'>if</span> ((active_sensor = sensors_applet_find_active_sensor(sensors_applet, path)) != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="1072"><td class="num" id="LN1072">1072</td><td class="line"> active_sensor_alarm_off(active_sensor, notif_type);</td></tr> +<tr class="codeline" data-linenumber="1073"><td class="num" id="LN1073">1073</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1074"><td class="num" id="LN1074">1074</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1075"><td class="num" id="LN1075">1075</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1076"><td class="num" id="LN1076">1076</td><td class="line"><span class='keyword'>void</span> sensors_applet_all_alarms_off(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1077"><td class="num" id="LN1077">1077</td><td class="line"> sensors_applet_alarm_off(sensors_applet, path, LOW_ALARM);</td></tr> +<tr class="codeline" data-linenumber="1078"><td class="num" id="LN1078">1078</td><td class="line"> sensors_applet_alarm_off(sensors_applet, path, HIGH_ALARM);</td></tr> +<tr class="codeline" data-linenumber="1079"><td class="num" id="LN1079">1079</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1080"><td class="num" id="LN1080">1080</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1081"><td class="num" id="LN1081">1081</td><td class="line"><span class='keyword'>void</span> sensors_applet_sensor_enabled(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1082"><td class="num" id="LN1082">1082</td><td class="line"> ActiveSensor *active_sensor;</td></tr> +<tr class="codeline" data-linenumber="1083"><td class="num" id="LN1083">1083</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1084"><td class="num" id="LN1084">1084</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_24<br>; if (sensors_applet) _g_boolean_var_24 = 1; else _g_boolean_var_24<br> = 0; _g_boolean_var_24; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1084, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1085"><td class="num" id="LN1085">1085</td><td class="line"> <span class='macro'>g_assert(path)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_25<br>; if (path) _g_boolean_var_25 = 1; else _g_boolean_var_25 = 0<br>; _g_boolean_var_25; }), 1)) ; else g_assertion_message_expr (<br>"sensors-applet", "sensors-applet.c", 1085, ((const char*) (__func__<br>)), "path"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1086"><td class="num" id="LN1086">1086</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1087"><td class="num" id="LN1087">1087</td><td class="line"> active_sensor = active_sensor_new(sensors_applet, gtk_tree_row_reference_new(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, path));</td></tr> +<tr class="codeline" data-linenumber="1088"><td class="num" id="LN1088">1088</td><td class="line"> active_sensor_update(active_sensor, sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1089"><td class="num" id="LN1089">1089</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1090"><td class="num" id="LN1090">1090</td><td class="line"> <span class='comment'>/* keep list sorted */</span></td></tr> +<tr class="codeline" data-linenumber="1091"><td class="num" id="LN1091">1091</td><td class="line"> sensors_applet->active_sensors = g_list_insert_sorted(sensors_applet->active_sensors,</td></tr> +<tr class="codeline" data-linenumber="1092"><td class="num" id="LN1092">1092</td><td class="line"> active_sensor,</td></tr> +<tr class="codeline" data-linenumber="1093"><td class="num" id="LN1093">1093</td><td class="line"> (GCompareFunc)active_sensor_compare);</td></tr> +<tr class="codeline" data-linenumber="1094"><td class="num" id="LN1094">1094</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1095"><td class="num" id="LN1095">1095</td><td class="line"> sensors_applet_pack_display(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1096"><td class="num" id="LN1096">1096</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1097"><td class="num" id="LN1097">1097</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1098"><td class="num" id="LN1098">1098</td><td class="line"><span class='keyword'>void</span> sensors_applet_reorder_sensors(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="1099"><td class="num" id="LN1099">1099</td><td class="line"> sensors_applet->active_sensors = g_list_sort(sensors_applet->active_sensors, (GCompareFunc)active_sensor_compare);</td></tr> +<tr class="codeline" data-linenumber="1100"><td class="num" id="LN1100">1100</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1101"><td class="num" id="LN1101">1101</td><td class="line"> sensors_applet_pack_display(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1102"><td class="num" id="LN1102">1102</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1103"><td class="num" id="LN1103">1103</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1104"><td class="num" id="LN1104">1104</td><td class="line"><span class='keyword'>void</span> sensors_applet_sensor_disabled(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1105"><td class="num" id="LN1105">1105</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1106"><td class="num" id="LN1106">1106</td><td class="line"> ActiveSensor *active_sensor;</td></tr> +<tr class="codeline" data-linenumber="1107"><td class="num" id="LN1107">1107</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1108"><td class="num" id="LN1108">1108</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_26<br>; if (sensors_applet) _g_boolean_var_26 = 1; else _g_boolean_var_26<br> = 0; _g_boolean_var_26; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1108, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1109"><td class="num" id="LN1109">1109</td><td class="line"> <span class='macro'>g_assert(path)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_27<br>; if (path) _g_boolean_var_27 = 1; else _g_boolean_var_27 = 0<br>; _g_boolean_var_27; }), 1)) ; else g_assertion_message_expr (<br>"sensors-applet", "sensors-applet.c", 1109, ((const char*) (__func__<br>)), "path"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1110"><td class="num" id="LN1110">1110</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1111"><td class="num" id="LN1111">1111</td><td class="line"> <span class='keyword'>if</span> ((active_sensor = sensors_applet_find_active_sensor(sensors_applet, path)) != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="1112"><td class="num" id="LN1112">1112</td><td class="line"> g_debug(<span class='string_literal'>"Destroying active sensor..."</span>);</td></tr> +<tr class="codeline" data-linenumber="1113"><td class="num" id="LN1113">1113</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1114"><td class="num" id="LN1114">1114</td><td class="line"> g_debug(<span class='string_literal'>"-- removing from list..."</span>);</td></tr> +<tr class="codeline" data-linenumber="1115"><td class="num" id="LN1115">1115</td><td class="line"> sensors_applet->active_sensors = g_list_remove(sensors_applet->active_sensors, active_sensor);</td></tr> +<tr class="codeline" data-linenumber="1116"><td class="num" id="LN1116">1116</td><td class="line"> g_debug(<span class='string_literal'>"-- repacking display...."</span>);</td></tr> +<tr class="codeline" data-linenumber="1117"><td class="num" id="LN1117">1117</td><td class="line"> sensors_applet_pack_display(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1118"><td class="num" id="LN1118">1118</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1119"><td class="num" id="LN1119">1119</td><td class="line"> active_sensor_destroy(active_sensor);</td></tr> +<tr class="codeline" data-linenumber="1120"><td class="num" id="LN1120">1120</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1121"><td class="num" id="LN1121">1121</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1122"><td class="num" id="LN1122">1122</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1123"><td class="num" id="LN1123">1123</td><td class="line"><span class='keyword'>void</span> sensors_applet_update_sensor(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1124"><td class="num" id="LN1124">1124</td><td class="line"> ActiveSensor *active_sensor;</td></tr> +<tr class="codeline" data-linenumber="1125"><td class="num" id="LN1125">1125</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1126"><td class="num" id="LN1126">1126</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_28<br>; if (sensors_applet) _g_boolean_var_28 = 1; else _g_boolean_var_28<br> = 0; _g_boolean_var_28; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1126, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1127"><td class="num" id="LN1127">1127</td><td class="line"> <span class='macro'>g_assert(path)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_29<br>; if (path) _g_boolean_var_29 = 1; else _g_boolean_var_29 = 0<br>; _g_boolean_var_29; }), 1)) ; else g_assertion_message_expr (<br>"sensors-applet", "sensors-applet.c", 1127, ((const char*) (__func__<br>)), "path"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1128"><td class="num" id="LN1128">1128</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1129"><td class="num" id="LN1129">1129</td><td class="line"> <span class='keyword'>if</span> ((active_sensor = sensors_applet_find_active_sensor(sensors_applet, path)) != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="1130"><td class="num" id="LN1130">1130</td><td class="line"> active_sensor_update(active_sensor, sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1131"><td class="num" id="LN1131">1131</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1132"><td class="num" id="LN1132">1132</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1133"><td class="num" id="LN1133">1133</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1134"><td class="num" id="LN1134">1134</td><td class="line"><span class='keyword'>void</span> sensors_applet_icon_changed(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1135"><td class="num" id="LN1135">1135</td><td class="line"> ActiveSensor *active_sensor;</td></tr> +<tr class="codeline" data-linenumber="1136"><td class="num" id="LN1136">1136</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1137"><td class="num" id="LN1137">1137</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_30<br>; if (sensors_applet) _g_boolean_var_30 = 1; else _g_boolean_var_30<br> = 0; _g_boolean_var_30; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1137, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1138"><td class="num" id="LN1138">1138</td><td class="line"> <span class='macro'>g_assert(path)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_31<br>; if (path) _g_boolean_var_31 = 1; else _g_boolean_var_31 = 0<br>; _g_boolean_var_31; }), 1)) ; else g_assertion_message_expr (<br>"sensors-applet", "sensors-applet.c", 1138, ((const char*) (__func__<br>)), "path"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1139"><td class="num" id="LN1139">1139</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1140"><td class="num" id="LN1140">1140</td><td class="line"> <span class='keyword'>if</span> ((active_sensor = sensors_applet_find_active_sensor(sensors_applet, path)) != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="1141"><td class="num" id="LN1141">1141</td><td class="line"> active_sensor_icon_changed(active_sensor, sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1142"><td class="num" id="LN1142">1142</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1143"><td class="num" id="LN1143">1143</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1144"><td class="num" id="LN1144">1144</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1145"><td class="num" id="LN1145">1145</td><td class="line"><span class='comment'>/* Cycle thru ActiveSensors and update them all */</span></td></tr> +<tr class="codeline" data-linenumber="1146"><td class="num" id="LN1146">1146</td><td class="line">gboolean sensors_applet_update_active_sensors(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="1147"><td class="num" id="LN1147">1147</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_32<br>; if (sensors_applet) _g_boolean_var_32 = 1; else _g_boolean_var_32<br> = 0; _g_boolean_var_32; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1147, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1148"><td class="num" id="LN1148">1148</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1149"><td class="num" id="LN1149">1149</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->active_sensors) {</td></tr> +<tr class="codeline" data-linenumber="1150"><td class="num" id="LN1150">1150</td><td class="line"> g_list_foreach(sensors_applet->active_sensors,</td></tr> +<tr class="codeline" data-linenumber="1151"><td class="num" id="LN1151">1151</td><td class="line"> (GFunc)active_sensor_update,</td></tr> +<tr class="codeline" data-linenumber="1152"><td class="num" id="LN1152">1152</td><td class="line"> sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1153"><td class="num" id="LN1153">1153</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1154"><td class="num" id="LN1154">1154</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1155"><td class="num" id="LN1155">1155</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1156"><td class="num" id="LN1156">1156</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1157"><td class="num" id="LN1157">1157</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1158"><td class="num" id="LN1158">1158</td><td class="line"><span class='comment'>/* Cycle thru ActiveSensors and set new graph dimensions */</span></td></tr> +<tr class="codeline" data-linenumber="1159"><td class="num" id="LN1159">1159</td><td class="line"><span class='keyword'>void</span> sensors_applet_graph_size_changed(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="1160"><td class="num" id="LN1160">1160</td><td class="line"> gint dimensions[2];</td></tr> +<tr class="codeline" data-linenumber="1161"><td class="num" id="LN1161">1161</td><td class="line"> gint graph_size;</td></tr> +<tr class="codeline" data-linenumber="1162"><td class="num" id="LN1162">1162</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_33<br>; if (sensors_applet) _g_boolean_var_33 = 1; else _g_boolean_var_33<br> = 0; _g_boolean_var_33; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1162, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1163"><td class="num" id="LN1163">1163</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1164"><td class="num" id="LN1164">1164</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->active_sensors) {</td></tr> +<tr class="codeline" data-linenumber="1165"><td class="num" id="LN1165">1165</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1166"><td class="num" id="LN1166">1166</td><td class="line"> graph_size = g_settings_get_int (sensors_applet->settings, <span class='macro'>GRAPH_SIZE<span class='macro_popup'>"graph-size"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1167"><td class="num" id="LN1167">1167</td><td class="line"> <span class='keyword'>if</span> (mate_panel_applet_get_orient(sensors_applet->applet) == MATE_PANEL_APPLET_ORIENT_UP ||</td></tr> +<tr class="codeline" data-linenumber="1168"><td class="num" id="LN1168">1168</td><td class="line"> mate_panel_applet_get_orient(sensors_applet->applet) == MATE_PANEL_APPLET_ORIENT_DOWN) {</td></tr> +<tr class="codeline" data-linenumber="1169"><td class="num" id="LN1169">1169</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1170"><td class="num" id="LN1170">1170</td><td class="line"> <span class='comment'>/* is horizontal so set graph_size as width */</span></td></tr> +<tr class="codeline" data-linenumber="1171"><td class="num" id="LN1171">1171</td><td class="line"> dimensions[0] = graph_size;</td></tr> +<tr class="codeline" data-linenumber="1172"><td class="num" id="LN1172">1172</td><td class="line"> dimensions[1] = sensors_applet->size;</td></tr> +<tr class="codeline" data-linenumber="1173"><td class="num" id="LN1173">1173</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="1174"><td class="num" id="LN1174">1174</td><td class="line"> dimensions[0] = sensors_applet->size;</td></tr> +<tr class="codeline" data-linenumber="1175"><td class="num" id="LN1175">1175</td><td class="line"> dimensions[1] = graph_size;</td></tr> +<tr class="codeline" data-linenumber="1176"><td class="num" id="LN1176">1176</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1177"><td class="num" id="LN1177">1177</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1178"><td class="num" id="LN1178">1178</td><td class="line"> g_list_foreach(sensors_applet->active_sensors,</td></tr> +<tr class="codeline" data-linenumber="1179"><td class="num" id="LN1179">1179</td><td class="line"> (GFunc)active_sensor_update_graph_dimensions,</td></tr> +<tr class="codeline" data-linenumber="1180"><td class="num" id="LN1180">1180</td><td class="line"> &dimensions);</td></tr> +<tr class="codeline" data-linenumber="1181"><td class="num" id="LN1181">1181</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1182"><td class="num" id="LN1182">1182</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1183"><td class="num" id="LN1183">1183</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1184"><td class="num" id="LN1184">1184</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1185"><td class="num" id="LN1185">1185</td><td class="line">gdouble sensors_applet_convert_temperature(gdouble value, TemperatureScale old, TemperatureScale new) {</td></tr> +<tr class="codeline" data-linenumber="1186"><td class="num" id="LN1186">1186</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1187"><td class="num" id="LN1187">1187</td><td class="line"> <span class='keyword'>switch</span> (old) {</td></tr> +<tr class="codeline" data-linenumber="1188"><td class="num" id="LN1188">1188</td><td class="line"> <span class='keyword'>case</span> KELVIN:</td></tr> +<tr class="codeline" data-linenumber="1189"><td class="num" id="LN1189">1189</td><td class="line"> <span class='keyword'>switch</span> (new) {</td></tr> +<tr class="codeline" data-linenumber="1190"><td class="num" id="LN1190">1190</td><td class="line"> <span class='keyword'>case</span> CELSIUS:</td></tr> +<tr class="codeline" data-linenumber="1191"><td class="num" id="LN1191">1191</td><td class="line"> value = value - 273.0;</td></tr> +<tr class="codeline" data-linenumber="1192"><td class="num" id="LN1192">1192</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1193"><td class="num" id="LN1193">1193</td><td class="line"> <span class='keyword'>case</span> FAHRENHEIT:</td></tr> +<tr class="codeline" data-linenumber="1194"><td class="num" id="LN1194">1194</td><td class="line"> value = (9.0 * (value - 273) / 5.0) + 32.0;</td></tr> +<tr class="codeline" data-linenumber="1195"><td class="num" id="LN1195">1195</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1196"><td class="num" id="LN1196">1196</td><td class="line"> <span class='keyword'>case</span> KELVIN:</td></tr> +<tr class="codeline" data-linenumber="1197"><td class="num" id="LN1197">1197</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1198"><td class="num" id="LN1198">1198</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1199"><td class="num" id="LN1199">1199</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1200"><td class="num" id="LN1200">1200</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1201"><td class="num" id="LN1201">1201</td><td class="line"> <span class='keyword'>case</span> CELSIUS:</td></tr> +<tr class="codeline" data-linenumber="1202"><td class="num" id="LN1202">1202</td><td class="line"> <span class='keyword'>switch</span> (new) {</td></tr> +<tr class="codeline" data-linenumber="1203"><td class="num" id="LN1203">1203</td><td class="line"> <span class='keyword'>case</span> FAHRENHEIT:</td></tr> +<tr class="codeline" data-linenumber="1204"><td class="num" id="LN1204">1204</td><td class="line"> value = (9.0 * value / 5.0) + 32.0;</td></tr> +<tr class="codeline" data-linenumber="1205"><td class="num" id="LN1205">1205</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1206"><td class="num" id="LN1206">1206</td><td class="line"> <span class='keyword'>case</span> KELVIN:</td></tr> +<tr class="codeline" data-linenumber="1207"><td class="num" id="LN1207">1207</td><td class="line"> value = value + 273.0;</td></tr> +<tr class="codeline" data-linenumber="1208"><td class="num" id="LN1208">1208</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1209"><td class="num" id="LN1209">1209</td><td class="line"> <span class='keyword'>case</span> CELSIUS:</td></tr> +<tr class="codeline" data-linenumber="1210"><td class="num" id="LN1210">1210</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1211"><td class="num" id="LN1211">1211</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1212"><td class="num" id="LN1212">1212</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1213"><td class="num" id="LN1213">1213</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1214"><td class="num" id="LN1214">1214</td><td class="line"> <span class='keyword'>case</span> FAHRENHEIT:</td></tr> +<tr class="codeline" data-linenumber="1215"><td class="num" id="LN1215">1215</td><td class="line"> <span class='keyword'>switch</span> (new) {</td></tr> +<tr class="codeline" data-linenumber="1216"><td class="num" id="LN1216">1216</td><td class="line"> <span class='keyword'>case</span> CELSIUS:</td></tr> +<tr class="codeline" data-linenumber="1217"><td class="num" id="LN1217">1217</td><td class="line"> value = (5.0 * (value - 32.0) / 9.0);</td></tr> +<tr class="codeline" data-linenumber="1218"><td class="num" id="LN1218">1218</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1219"><td class="num" id="LN1219">1219</td><td class="line"> <span class='keyword'>case</span> KELVIN:</td></tr> +<tr class="codeline" data-linenumber="1220"><td class="num" id="LN1220">1220</td><td class="line"> value = (5.0 * (value - 32.0) / 9.0) + 273.0;</td></tr> +<tr class="codeline" data-linenumber="1221"><td class="num" id="LN1221">1221</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1222"><td class="num" id="LN1222">1222</td><td class="line"> <span class='keyword'>case</span> FAHRENHEIT:</td></tr> +<tr class="codeline" data-linenumber="1223"><td class="num" id="LN1223">1223</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1224"><td class="num" id="LN1224">1224</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1225"><td class="num" id="LN1225">1225</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1226"><td class="num" id="LN1226">1226</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1227"><td class="num" id="LN1227">1227</td><td class="line"> <span class='keyword'>return</span> value;</td></tr> +<tr class="codeline" data-linenumber="1228"><td class="num" id="LN1228">1228</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1229"><td class="num" id="LN1229">1229</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1230"><td class="num" id="LN1230">1230</td><td class="line"><span class='keyword'>void</span> sensors_applet_init(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="1231"><td class="num" id="LN1231">1231</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1232"><td class="num" id="LN1232">1232</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_34<br>; if (sensors_applet) _g_boolean_var_34 = 1; else _g_boolean_var_34<br> = 0; _g_boolean_var_34; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1232, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1233"><td class="num" id="LN1233">1233</td><td class="line"> <span class='macro'>g_assert(sensors_applet->applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_35<br>; if (sensors_applet->applet) _g_boolean_var_35 = 1; else _g_boolean_var_35<br> = 0; _g_boolean_var_35; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1233, ((const char*) (<br>__func__)), "sensors_applet->applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1234"><td class="num" id="LN1234">1234</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1235"><td class="num" id="LN1235">1235</td><td class="line"> GtkActionGroup *action_group;</td></tr> +<tr class="codeline" data-linenumber="1236"><td class="num" id="LN1236">1236</td><td class="line"> gchar *ui_path;</td></tr> +<tr class="codeline" data-linenumber="1237"><td class="num" id="LN1237">1237</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1238"><td class="num" id="LN1238">1238</td><td class="line"> <span class='comment'>/* Have our background automatically painted. */</span></td></tr> +<tr class="codeline" data-linenumber="1239"><td class="num" id="LN1239">1239</td><td class="line"> mate_panel_applet_set_background_widget(MATE_PANEL_APPLET(sensors_applet->applet), <span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1240"><td class="num" id="LN1240">1240</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1241"><td class="num" id="LN1241">1241</td><td class="line"> <span class='comment'>/* plugin functions are stored as name -> get_value_function pairs so</span></td></tr> +<tr class="codeline" data-linenumber="1242"><td class="num" id="LN1242">1242</td><td class="line"> <span class='comment'>* use standard string functions on hash table */</span></td></tr> +<tr class="codeline" data-linenumber="1243"><td class="num" id="LN1243">1243</td><td class="line"> sensors_applet->plugins = g_hash_table_new(g_str_hash, g_str_equal);</td></tr> +<tr class="codeline" data-linenumber="1244"><td class="num" id="LN1244">1244</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1245"><td class="num" id="LN1245">1245</td><td class="line"> sensors_applet->required_plugins = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1246"><td class="num" id="LN1246">1246</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1247"><td class="num" id="LN1247">1247</td><td class="line"> <span class='comment'>/* initialise size */</span></td></tr> +<tr class="codeline" data-linenumber="1248"><td class="num" id="LN1248">1248</td><td class="line"> sensors_applet->size = <span class='macro'>DEFAULT_APPLET_SIZE<span class='macro_popup'>24</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1249"><td class="num" id="LN1249">1249</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1250"><td class="num" id="LN1250">1250</td><td class="line"> mate_panel_applet_set_flags(sensors_applet->applet, MATE_PANEL_APPLET_EXPAND_MINOR);</td></tr> +<tr class="codeline" data-linenumber="1251"><td class="num" id="LN1251">1251</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1252"><td class="num" id="LN1252">1252</td><td class="line"> <span class='macro'>g_signal_connect(sensors_applet->applet, <span class='string_literal'>"destroy"</span>,<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("destroy"<br>), (((GCallback) (destroy_cb))), (sensors_applet), ((void*)0)<br>, (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1253"><td class="num" id="LN1253">1253</td><td class="line"> <span class='macro'>G_CALLBACK(destroy_cb),<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("destroy"<br>), (((GCallback) (destroy_cb))), (sensors_applet), ((void*)0)<br>, (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1254"><td class="num" id="LN1254">1254</td><td class="line"> <span class='macro'>sensors_applet)<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("destroy"<br>), (((GCallback) (destroy_cb))), (sensors_applet), ((void*)0)<br>, (GConnectFlags) 0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1255"><td class="num" id="LN1255">1255</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1256"><td class="num" id="LN1256">1256</td><td class="line"> <span class='comment'>/* init gsettings */</span></td></tr> +<tr class="codeline" data-linenumber="1257"><td class="num" id="LN1257">1257</td><td class="line"> sensors_applet->settings = mate_panel_applet_settings_new (sensors_applet->applet, <span class='string_literal'>"org.mate.sensors-applet"</span>);</td></tr> +<tr class="codeline" data-linenumber="1258"><td class="num" id="LN1258">1258</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1259"><td class="num" id="LN1259">1259</td><td class="line"> <span class='comment'>/* set up builder for sorting verification */</span></td></tr> +<tr class="codeline" data-linenumber="1260"><td class="num" id="LN1260">1260</td><td class="line"> g_variant_builder_init (&gvb_sensors_hash_list, <span class='macro'>G_VARIANT_TYPE (<span class='string_literal'>"as"</span>)<span class='macro_popup'>(g_variant_type_checked_ (("as")))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1261"><td class="num" id="LN1261">1261</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1262"><td class="num" id="LN1262">1262</td><td class="line"> <span class='comment'>/* set up / load sensors from the plugins */</span></td></tr> +<tr class="codeline" data-linenumber="1263"><td class="num" id="LN1263">1263</td><td class="line"> sensors_applet_plugins_load_all(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1264"><td class="num" id="LN1264">1264</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1265"><td class="num" id="LN1265">1265</td><td class="line"> <span class='comment'>/* set sorting hash array */</span></td></tr> +<tr class="codeline" data-linenumber="1266"><td class="num" id="LN1266">1266</td><td class="line"> GVariant *gv_temp = g_variant_builder_end (&gvb_sensors_hash_list);</td></tr> +<tr class="codeline" data-linenumber="1267"><td class="num" id="LN1267">1267</td><td class="line"> sensors_applet->sensors_hash_array = g_variant_dup_strv (gv_temp, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1268"><td class="num" id="LN1268">1268</td><td class="line"> g_variant_unref (gv_temp);</td></tr> +<tr class="codeline" data-linenumber="1269"><td class="num" id="LN1269">1269</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1270"><td class="num" id="LN1270">1270</td><td class="line"> <span class='comment'>/* sort sensors based on saved sorting */</span></td></tr> +<tr class="codeline" data-linenumber="1271"><td class="num" id="LN1271">1271</td><td class="line"> sensors_applet_settings_sort_sensors(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1272"><td class="num" id="LN1272">1272</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1273"><td class="num" id="LN1273">1273</td><td class="line"> <span class='comment'>/* free hash array */</span></td></tr> +<tr class="codeline" data-linenumber="1274"><td class="num" id="LN1274">1274</td><td class="line"> g_strfreev (sensors_applet->sensors_hash_array);</td></tr> +<tr class="codeline" data-linenumber="1275"><td class="num" id="LN1275">1275</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1276"><td class="num" id="LN1276">1276</td><td class="line"> <span class='comment'>/* should have created sensors tree above, but if have not was because we couldn't find any sensors */</span></td></tr> +<tr class="codeline" data-linenumber="1277"><td class="num" id="LN1277">1277</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == sensors_applet->sensors) {</td></tr> +<tr class="codeline" data-linenumber="1278"><td class="num" id="LN1278">1278</td><td class="line"> GtkWidget *label;</td></tr> +<tr class="codeline" data-linenumber="1279"><td class="num" id="LN1279">1279</td><td class="line"> label = gtk_label_new(<span class='macro'>_(<span class='string_literal'>"No sensors found!"</span>)<span class='macro_popup'>dcgettext (((void*)0), "No sensors found!", 5)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1280"><td class="num" id="LN1280">1280</td><td class="line"> gtk_container_add(<span class='macro'>GTK_CONTAINER(sensors_applet->applet)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->applet)))))</span></span>, label);</td></tr> +<tr class="codeline" data-linenumber="1281"><td class="num" id="LN1281">1281</td><td class="line"> gtk_widget_show_all(<span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1282"><td class="num" id="LN1282">1282</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="1283"><td class="num" id="LN1283">1283</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1284"><td class="num" id="LN1284">1284</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1285"><td class="num" id="LN1285">1285</td><td class="line"> <span class='comment'>/* only do menu and signal connections if sensors are found */</span></td></tr> +<tr class="codeline" data-linenumber="1286"><td class="num" id="LN1286">1286</td><td class="line"> action_group = gtk_action_group_new (<span class='string_literal'>"Sensors Applet Actions"</span>);</td></tr> +<tr class="codeline" data-linenumber="1287"><td class="num" id="LN1287">1287</td><td class="line"> gtk_action_group_set_translation_domain (action_group, <span class='macro'>GETTEXT_PACKAGE<span class='macro_popup'>"mate-sensors-applet"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1288"><td class="num" id="LN1288">1288</td><td class="line"> gtk_action_group_add_actions (action_group,</td></tr> +<tr class="codeline" data-linenumber="1289"><td class="num" id="LN1289">1289</td><td class="line"> sensors_applet_menu_actions,</td></tr> +<tr class="codeline" data-linenumber="1290"><td class="num" id="LN1290">1290</td><td class="line"> <span class='macro'>G_N_ELEMENTS (sensors_applet_menu_actions)<span class='macro_popup'>(sizeof (sensors_applet_menu_actions) / sizeof ((sensors_applet_menu_actions<br>)[0]))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="1291"><td class="num" id="LN1291">1291</td><td class="line"> sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1292"><td class="num" id="LN1292">1292</td><td class="line"> ui_path = g_build_filename (<span class='macro'>UIDIR<span class='macro_popup'>"/usr/local/share/mate-sensors-applet/ui"</span></span>, <span class='macro'>SENSORS_APPLET_MENU_FILE<span class='macro_popup'>"SensorsApplet.xml"</span></span>, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1293"><td class="num" id="LN1293">1293</td><td class="line"> mate_panel_applet_setup_menu_from_file (sensors_applet->applet, ui_path, action_group);</td></tr> +<tr class="codeline" data-linenumber="1294"><td class="num" id="LN1294">1294</td><td class="line"> g_free (ui_path);</td></tr> +<tr class="codeline" data-linenumber="1295"><td class="num" id="LN1295">1295</td><td class="line"> g_object_unref (action_group);</td></tr> +<tr class="codeline" data-linenumber="1296"><td class="num" id="LN1296">1296</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1297"><td class="num" id="LN1297">1297</td><td class="line"> <span class='macro'>g_signal_connect(sensors_applet->applet, <span class='string_literal'>"style-set"</span>,<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("style-set"<br>), (((GCallback) (style_set_cb))), (sensors_applet), ((void*)<br>0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1298"><td class="num" id="LN1298">1298</td><td class="line"> <span class='macro'>G_CALLBACK(style_set_cb),<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("style-set"<br>), (((GCallback) (style_set_cb))), (sensors_applet), ((void*)<br>0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1299"><td class="num" id="LN1299">1299</td><td class="line"> <span class='macro'>sensors_applet)<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("style-set"<br>), (((GCallback) (style_set_cb))), (sensors_applet), ((void*)<br>0), (GConnectFlags) 0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1300"><td class="num" id="LN1300">1300</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1301"><td class="num" id="LN1301">1301</td><td class="line"> <span class='macro'>g_signal_connect(G_OBJECT(sensors_applet->applet), <span class='string_literal'>"change_orient"</span>,<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("change_orient"), (((GCallback) (change_orient_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1302"><td class="num" id="LN1302">1302</td><td class="line"> <span class='macro'>G_CALLBACK(change_orient_cb),<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("change_orient"), (((GCallback) (change_orient_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1303"><td class="num" id="LN1303">1303</td><td class="line"> <span class='macro'>sensors_applet)<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("change_orient"), (((GCallback) (change_orient_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1304"><td class="num" id="LN1304">1304</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1305"><td class="num" id="LN1305">1305</td><td class="line"> <span class='macro'>g_signal_connect(G_OBJECT(sensors_applet->applet), <span class='string_literal'>"size_allocate"</span>,<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("size_allocate"), (((GCallback) (size_allocate_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1306"><td class="num" id="LN1306">1306</td><td class="line"> <span class='macro'>G_CALLBACK(size_allocate_cb),<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("size_allocate"), (((GCallback) (size_allocate_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1307"><td class="num" id="LN1307">1307</td><td class="line"> <span class='macro'>sensors_applet)<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("size_allocate"), (((GCallback) (size_allocate_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1308"><td class="num" id="LN1308">1308</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1309"><td class="num" id="LN1309">1309</td><td class="line"> <span class='macro'>g_signal_connect(G_OBJECT(sensors_applet->applet), <span class='string_literal'>"leave_notify_event"</span>,<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("leave_notify_event"), (((GCallback) (mouse_leave_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span></td></tr> +<tr class="codeline" data-linenumber="1310"><td class="num" id="LN1310">1310</td><td class="line"> <span class='macro'>G_CALLBACK(mouse_leave_cb),<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("leave_notify_event"), (((GCallback) (mouse_leave_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span></td></tr> +<tr class="codeline" data-linenumber="1311"><td class="num" id="LN1311">1311</td><td class="line"> <span class='macro'>(gpointer)sensors_applet)<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("leave_notify_event"), (((GCallback) (mouse_leave_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1312"><td class="num" id="LN1312">1312</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1313"><td class="num" id="LN1313">1313</td><td class="line"> <span class='macro'>g_signal_connect(G_OBJECT(sensors_applet->applet), <span class='string_literal'>"enter_notify_event"</span>,<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("enter_notify_event"), (((GCallback) (mouse_enter_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span></td></tr> +<tr class="codeline" data-linenumber="1314"><td class="num" id="LN1314">1314</td><td class="line"> <span class='macro'>G_CALLBACK(mouse_enter_cb),<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("enter_notify_event"), (((GCallback) (mouse_enter_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span></td></tr> +<tr class="codeline" data-linenumber="1315"><td class="num" id="LN1315">1315</td><td class="line"> <span class='macro'>(gpointer)sensors_applet)<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("enter_notify_event"), (((GCallback) (mouse_enter_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1316"><td class="num" id="LN1316">1316</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1317"><td class="num" id="LN1317">1317</td><td class="line"> sensors_applet_update_active_sensors(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1318"><td class="num" id="LN1318">1318</td><td class="line"> sensors_applet_pack_display(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1319"><td class="num" id="LN1319">1319</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1320"><td class="num" id="LN1320">1320</td><td class="line"> sensors_applet->timeout_id = g_timeout_add_seconds(g_settings_get_int(sensors_applet->settings, <span class='macro'>TIMEOUT<span class='macro_popup'>"timeout-delay"</span></span>) / 1000,</td></tr> +<tr class="codeline" data-linenumber="1321"><td class="num" id="LN1321">1321</td><td class="line"> (GSourceFunc)sensors_applet_update_active_sensors,</td></tr> +<tr class="codeline" data-linenumber="1322"><td class="num" id="LN1322">1322</td><td class="line"> sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1323"><td class="num" id="LN1323">1323</td><td class="line"> gtk_widget_show_all(<span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1324"><td class="num" id="LN1324">1324</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1325"><td class="num" id="LN1325">1325</td><td class="line"> </td></tr> +</table></body></html> diff --git a/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-48fbd5.html b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-48fbd5.html new file mode 100644 index 0000000..72349cf --- /dev/null +++ b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-48fbd5.html @@ -0,0 +1,1133 @@ +<!doctype html> +<html> +<head> +<title>udisks2-plugin.c</title> + +<style type="text/css"> +body { color:#000000; background-color:#ffffff } +body { font-family:Helvetica, sans-serif; font-size:10pt } +h1 { font-size:14pt } +.FileName { margin-top: 5px; margin-bottom: 5px; display: inline; } +.FileNav { margin-left: 5px; margin-right: 5px; display: inline; } +.FileNav a { text-decoration:none; font-size: larger; } +.divider { margin-top: 30px; margin-bottom: 30px; height: 15px; } +.divider { background-color: gray; } +.code { border-collapse:collapse; width:100%; } +.code { font-family: "Monospace", monospace; font-size:10pt } +.code { line-height: 1.2em } +.comment { color: green; font-style: oblique } +.keyword { color: blue } +.string_literal { color: red } +.directive { color: darkmagenta } + +/* Macros and variables could have pop-up notes hidden by default. + - Macro pop-up: expansion of the macro + - Variable pop-up: value (table) of the variable */ +.macro_popup, .variable_popup { display: none; } + +/* Pop-up appears on mouse-hover event. */ +.macro:hover .macro_popup, .variable:hover .variable_popup { + display: block; + padding: 2px; + -webkit-border-radius:5px; + -webkit-box-shadow:1px 1px 7px #000; + border-radius:5px; + box-shadow:1px 1px 7px #000; + position: absolute; + top: -1em; + left:10em; + z-index: 1 +} + +.macro_popup { + border: 2px solid red; + background-color:#FFF0F0; + font-weight: normal; +} + +.variable_popup { + border: 2px solid blue; + background-color:#F0F0FF; + font-weight: bold; + font-family: Helvetica, sans-serif; + font-size: 9pt; +} + +/* Pop-up notes needs a relative position as a base where they pops up. */ +.macro, .variable { + background-color: PaleGoldenRod; + position: relative; +} +.macro { color: DarkMagenta; } + +#tooltiphint { + position: fixed; + width: 50em; + margin-left: -25em; + left: 50%; + padding: 10px; + border: 1px solid #b0b0b0; + border-radius: 2px; + box-shadow: 1px 1px 7px black; + background-color: #c0c0c0; + z-index: 2; +} + +.num { width:2.5em; padding-right:2ex; background-color:#eeeeee } +.num { text-align:right; font-size:8pt } +.num { color:#444444 } +.line { padding-left: 1ex; border-left: 3px solid #ccc } +.line { white-space: pre } +.msg { -webkit-box-shadow:1px 1px 7px #000 } +.msg { box-shadow:1px 1px 7px #000 } +.msg { -webkit-border-radius:5px } +.msg { border-radius:5px } +.msg { font-family:Helvetica, sans-serif; font-size:8pt } +.msg { float:left } +.msg { position:relative } +.msg { padding:0.25em 1ex 0.25em 1ex } +.msg { margin-top:10px; margin-bottom:10px } +.msg { font-weight:bold } +.msg { max-width:60em; word-wrap: break-word; white-space: pre-wrap } +.msgT { padding:0x; spacing:0x } +.msgEvent { background-color:#fff8b4; color:#000000 } +.msgControl { background-color:#bbbbbb; color:#000000 } +.msgNote { background-color:#ddeeff; color:#000000 } +.mrange { background-color:#dfddf3 } +.mrange { border-bottom:1px solid #6F9DBE } +.PathIndex { font-weight: bold; padding:0px 5px; margin-right:5px; } +.PathIndex { -webkit-border-radius:8px } +.PathIndex { border-radius:8px } +.PathIndexEvent { background-color:#bfba87 } +.PathIndexControl { background-color:#8c8c8c } +.PathIndexPopUp { background-color: #879abc; } +.PathNav a { text-decoration:none; font-size: larger } +.CodeInsertionHint { font-weight: bold; background-color: #10dd10 } +.CodeRemovalHint { background-color:#de1010 } +.CodeRemovalHint { border-bottom:1px solid #6F9DBE } +.msg.selected{ background-color:orange !important; } + +table.simpletable { + padding: 5px; + font-size:12pt; + margin:20px; + border-collapse: collapse; border-spacing: 0px; +} +td.rowname { + text-align: right; + vertical-align: top; + font-weight: bold; + color:#444444; + padding-right:2ex; +} + +/* Hidden text. */ +input.spoilerhider + label { + cursor: pointer; + text-decoration: underline; + display: block; +} +input.spoilerhider { + display: none; +} +input.spoilerhider ~ .spoiler { + overflow: hidden; + margin: 10px auto 0; + height: 0; + opacity: 0; +} +input.spoilerhider:checked + label + .spoiler{ + height: auto; + opacity: 1; +} +</style> +</head> +<body> +<!-- BUGDESC Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption --> + +<!-- BUGTYPE Cast from non-struct type to struct type --> + +<!-- BUGCATEGORY Logic error --> + +<!-- BUGFILE /rootdir/plugins/udisks2/udisks2-plugin.c --> + +<!-- FILENAME udisks2-plugin.c --> + +<!-- FUNCTIONNAME udisks2_plugin_get_sensors --> + +<!-- ISSUEHASHCONTENTOFLINEINCONTEXT 48fbd5bbf21b5599a8e361c870fc80d5 --> + +<!-- BUGLINE 316 --> + +<!-- BUGCOLUMN 96 --> + +<!-- BUGPATHLENGTH 1 --> + +<!-- BUGMETAEND --> +<!-- REPORTHEADER --> +<h3>Bug Summary</h3> +<table class="simpletable"> +<tr><td class="rowname">File:</td><td>plugins/udisks2/udisks2-plugin.c</td></tr> +<tr><td class="rowname">Warning:</td><td><a href="#EndPath">line 316, column 96</a><br />Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption</td></tr> + +</table> +<!-- REPORTSUMMARYEXTRA --> +<h3>Annotated Source Code</h3> +<p>Press <a href="#" onclick="toggleHelp(); return false;">'?'</a> + to see keyboard shortcuts</p> +<input type="checkbox" class="spoilerhider" id="showinvocation" /> +<label for="showinvocation" >Show analyzer invocation</label> +<div class="spoiler">clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name udisks2-plugin.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/plugins/udisks2 -resource-dir /usr/lib64/clang/16 -D HAVE_CONFIG_H -I . -I ../../sensors-applet -D MATELOCALEDIR="/usr/local/share/locale/" -D G_LOG_DOMAIN="sensors-applet" -D PIXMAPS_DIR="/usr/local/share/pixmaps/mate-sensors-applet/" -D DATADIR="/usr/local/share" -D LIBDIR="/usr/local/lib" -D SYSCONFDIR="/usr/local/etc" -D PREFIX="/usr/local" -I ../.. -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -D PIC -internal-isystem /usr/lib64/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/plugins/udisks2 -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2023-06-12-021133-6157-1 -x c udisks2-plugin.c +</div> +<div id='tooltiphint' hidden="true"> + <p>Keyboard shortcuts: </p> + <ul> + <li>Use 'j/k' keys for keyboard navigation</li> + <li>Use 'Shift+S' to show/hide relevant lines</li> + <li>Use '?' to toggle this window</li> + </ul> + <a href="#" onclick="toggleHelp(); return false;">Close</a> +</div> +<script type='text/javascript'> +var relevant_lines = {"1": {"316": 1}}; + +var filterCounterexample = function (hide) { + var tables = document.getElementsByClassName("code"); + for (var t=0; t<tables.length; t++) { + var table = tables[t]; + var file_id = table.getAttribute("data-fileid"); + var lines_in_fid = relevant_lines[file_id]; + if (!lines_in_fid) { + lines_in_fid = {}; + } + var lines = table.getElementsByClassName("codeline"); + for (var i=0; i<lines.length; i++) { + var el = lines[i]; + var lineNo = el.getAttribute("data-linenumber"); + if (!lines_in_fid[lineNo]) { + if (hide) { + el.setAttribute("hidden", ""); + } else { + el.removeAttribute("hidden"); + } + } + } + } +} + +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + // SHIFT + S + if (event.shiftKey && event.keyCode == 83) { + var checked = document.getElementsByName("showCounterexample")[0].checked; + filterCounterexample(!checked); + document.getElementsByName("showCounterexample")[0].click(); + } else { + return; + } + event.preventDefault(); +}, true); + +document.addEventListener("DOMContentLoaded", function() { + document.querySelector('input[name="showCounterexample"]').onchange= + function (event) { + filterCounterexample(this.checked); + }; +}); +</script> + +<form> + <input type="checkbox" name="showCounterexample" id="showCounterexample" /> + <label for="showCounterexample"> + Show only relevant lines + </label> + <input type="checkbox" name="showArrows" + id="showArrows" style="margin-left: 10px" /> + <label for="showArrows"> + Show control flow arrows + </label> +</form> + +<script type='text/javascript'> +// Return range of numbers from a range [lower, upper). +function range(lower, upper) { + var array = []; + for (var i = lower; i <= upper; ++i) { + array.push(i); + } + return array; +} + +var getRelatedArrowIndices = function(pathId) { + // HTML numeration of events is a bit different than it is in the path. + // Everything is rotated one step to the right, so the last element + // (error diagnostic) has index 0. + if (pathId == 0) { + // arrowIndices has at least 2 elements + pathId = arrowIndices.length - 1; + } + + return range(arrowIndices[pathId], arrowIndices[pathId - 1]); +} + +var highlightArrowsForSelectedEvent = function() { + const selectedNum = findNum(); + const arrowIndicesToHighlight = getRelatedArrowIndices(selectedNum); + arrowIndicesToHighlight.forEach((index) => { + var arrow = document.querySelector("#arrow" + index); + if(arrow) { + classListAdd(arrow, "selected") + } + }); +} + +var getAbsoluteBoundingRect = function(element) { + const relative = element.getBoundingClientRect(); + return { + left: relative.left + window.pageXOffset, + right: relative.right + window.pageXOffset, + top: relative.top + window.pageYOffset, + bottom: relative.bottom + window.pageYOffset, + height: relative.height, + width: relative.width + }; +} + +var drawArrow = function(index) { + // This function is based on the great answer from SO: + // https://stackoverflow.com/a/39575674/11582326 + var start = document.querySelector("#start" + index); + var end = document.querySelector("#end" + index); + var arrow = document.querySelector("#arrow" + index); + + var startRect = getAbsoluteBoundingRect(start); + var endRect = getAbsoluteBoundingRect(end); + + // It is an arrow from a token to itself, no need to visualize it. + if (startRect.top == endRect.top && + startRect.left == endRect.left) + return; + + // Each arrow is a very simple Bézier curve, with two nodes and + // two handles. So, we need to calculate four points in the window: + // * start node + var posStart = { x: 0, y: 0 }; + // * end node + var posEnd = { x: 0, y: 0 }; + // * handle for the start node + var startHandle = { x: 0, y: 0 }; + // * handle for the end node + var endHandle = { x: 0, y: 0 }; + // One can visualize it as follows: + // + // start handle + // / + // X"""_.-""""X + // .' \ + // / start node + // | + // | + // | end node + // \ / + // `->X + // X-' + // \ + // end handle + // + // NOTE: (0, 0) is the top left corner of the window. + + // We have 3 similar, but still different scenarios to cover: + // + // 1. Two tokens on different lines. + // -xxx + // / + // \ + // -> xxx + // In this situation, we draw arrow on the left curving to the left. + // 2. Two tokens on the same line, and the destination is on the right. + // ____ + // / \ + // / V + // xxx xxx + // In this situation, we draw arrow above curving upwards. + // 3. Two tokens on the same line, and the destination is on the left. + // xxx xxx + // ^ / + // \____/ + // In this situation, we draw arrow below curving downwards. + const onDifferentLines = startRect.top <= endRect.top - 5 || + startRect.top >= endRect.top + 5; + const leftToRight = startRect.left < endRect.left; + + // NOTE: various magic constants are chosen empirically for + // better positioning and look + if (onDifferentLines) { + // Case #1 + const topToBottom = startRect.top < endRect.top; + posStart.x = startRect.left - 1; + // We don't want to start it at the top left corner of the token, + // it doesn't feel like this is where the arrow comes from. + // For this reason, we start it in the middle of the left side + // of the token. + posStart.y = startRect.top + startRect.height / 2; + + // End node has arrow head and we give it a bit more space. + posEnd.x = endRect.left - 4; + posEnd.y = endRect.top; + + // Utility object with x and y offsets for handles. + var curvature = { + // We want bottom-to-top arrow to curve a bit more, so it doesn't + // overlap much with top-to-bottom curves (much more frequent). + x: topToBottom ? 15 : 25, + y: Math.min((posEnd.y - posStart.y) / 3, 10) + } + + // When destination is on the different line, we can make a + // curvier arrow because we have space for it. + // So, instead of using + // + // startHandle.x = posStart.x - curvature.x + // endHandle.x = posEnd.x - curvature.x + // + // We use the leftmost of these two values for both handles. + startHandle.x = Math.min(posStart.x, posEnd.x) - curvature.x; + endHandle.x = startHandle.x; + + // Curving downwards from the start node... + startHandle.y = posStart.y + curvature.y; + // ... and upwards from the end node. + endHandle.y = posEnd.y - curvature.y; + + } else if (leftToRight) { + // Case #2 + // Starting from the top right corner... + posStart.x = startRect.right - 1; + posStart.y = startRect.top; + + // ...and ending at the top left corner of the end token. + posEnd.x = endRect.left + 1; + posEnd.y = endRect.top - 1; + + // Utility object with x and y offsets for handles. + var curvature = { + x: Math.min((posEnd.x - posStart.x) / 3, 15), + y: 5 + } + + // Curving to the right... + startHandle.x = posStart.x + curvature.x; + // ... and upwards from the start node. + startHandle.y = posStart.y - curvature.y; + + // And to the left... + endHandle.x = posEnd.x - curvature.x; + // ... and upwards from the end node. + endHandle.y = posEnd.y - curvature.y; + + } else { + // Case #3 + // Starting from the bottom right corner... + posStart.x = startRect.right; + posStart.y = startRect.bottom; + + // ...and ending also at the bottom right corner, but of the end token. + posEnd.x = endRect.right - 1; + posEnd.y = endRect.bottom + 1; + + // Utility object with x and y offsets for handles. + var curvature = { + x: Math.min((posStart.x - posEnd.x) / 3, 15), + y: 5 + } + + // Curving to the left... + startHandle.x = posStart.x - curvature.x; + // ... and downwards from the start node. + startHandle.y = posStart.y + curvature.y; + + // And to the right... + endHandle.x = posEnd.x + curvature.x; + // ... and downwards from the end node. + endHandle.y = posEnd.y + curvature.y; + } + + // Put it all together into a path. + // More information on the format: + // https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths + var pathStr = "M" + posStart.x + "," + posStart.y + " " + + "C" + startHandle.x + "," + startHandle.y + " " + + endHandle.x + "," + endHandle.y + " " + + posEnd.x + "," + posEnd.y; + + arrow.setAttribute("d", pathStr); +}; + +var drawArrows = function() { + const numOfArrows = document.querySelectorAll("path[id^=arrow]").length; + for (var i = 0; i < numOfArrows; ++i) { + drawArrow(i); + } +} + +var toggleArrows = function(event) { + const arrows = document.querySelector("#arrows"); + if (event.target.checked) { + arrows.setAttribute("visibility", "visible"); + } else { + arrows.setAttribute("visibility", "hidden"); + } +} + +window.addEventListener("resize", drawArrows); +document.addEventListener("DOMContentLoaded", function() { + // Whenever we show invocation, locations change, i.e. we + // need to redraw arrows. + document + .querySelector('input[id="showinvocation"]') + .addEventListener("click", drawArrows); + // Hiding irrelevant lines also should cause arrow rerender. + document + .querySelector('input[name="showCounterexample"]') + .addEventListener("change", drawArrows); + document + .querySelector('input[name="showArrows"]') + .addEventListener("change", toggleArrows); + drawArrows(); + // Default highlighting for the last event. + highlightArrowsForSelectedEvent(); +}); +</script> + +<script type='text/javascript'> +var digitMatcher = new RegExp("[0-9]+"); + +var querySelectorAllArray = function(selector) { + return Array.prototype.slice.call( + document.querySelectorAll(selector)); +} + +document.addEventListener("DOMContentLoaded", function() { + querySelectorAllArray(".PathNav > a").forEach( + function(currentValue, currentIndex) { + var hrefValue = currentValue.getAttribute("href"); + currentValue.onclick = function() { + scrollTo(document.querySelector(hrefValue)); + return false; + }; + }); +}); + +var findNum = function() { + var s = document.querySelector(".msg.selected"); + if (!s || s.id == "EndPath") { + return 0; + } + var out = parseInt(digitMatcher.exec(s.id)[0]); + return out; +}; + +var classListAdd = function(el, theClass) { + if(!el.className.baseVal) + el.className += " " + theClass; + else + el.className.baseVal += " " + theClass; +}; + +var classListRemove = function(el, theClass) { + var className = (!el.className.baseVal) ? + el.className : el.className.baseVal; + className = className.replace(" " + theClass, ""); + if(!el.className.baseVal) + el.className = className; + else + el.className.baseVal = className; +}; + +var scrollTo = function(el) { + querySelectorAllArray(".selected").forEach(function(s) { + classListRemove(s, "selected"); + }); + classListAdd(el, "selected"); + window.scrollBy(0, el.getBoundingClientRect().top - + (window.innerHeight / 2)); + highlightArrowsForSelectedEvent(); +}; + +var move = function(num, up, numItems) { + if (num == 1 && up || num == numItems - 1 && !up) { + return 0; + } else if (num == 0 && up) { + return numItems - 1; + } else if (num == 0 && !up) { + return 1 % numItems; + } + return up ? num - 1 : num + 1; +} + +var numToId = function(num) { + if (num == 0) { + return document.getElementById("EndPath") + } + return document.getElementById("Path" + num); +}; + +var navigateTo = function(up) { + var numItems = document.querySelectorAll( + ".line > .msgEvent, .line > .msgControl").length; + var currentSelected = findNum(); + var newSelected = move(currentSelected, up, numItems); + var newEl = numToId(newSelected, numItems); + + // Scroll element into center. + scrollTo(newEl); +}; + +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + // key 'j' + if (event.keyCode == 74) { + navigateTo(/*up=*/false); + // key 'k' + } else if (event.keyCode == 75) { + navigateTo(/*up=*/true); + } else { + return; + } + event.preventDefault(); +}, true); +</script> + +<script type='text/javascript'> + +var toggleHelp = function() { + var hint = document.querySelector("#tooltiphint"); + var attributeName = "hidden"; + if (hint.hasAttribute(attributeName)) { + hint.removeAttribute(attributeName); + } else { + hint.setAttribute("hidden", "true"); + } +}; +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + if (event.key == "?") { + toggleHelp(); + } else { + return; + } + event.preventDefault(); +}); +</script> + +<style type="text/css"> + svg { + position:absolute; + top:0; + left:0; + height:100%; + width:100%; + pointer-events: none; + overflow: visible + } + .arrow { + stroke-opacity: 0.2; + stroke-width: 1; + marker-end: url(#arrowhead); + } + + .arrow.selected { + stroke-opacity: 0.6; + stroke-width: 2; + marker-end: url(#arrowheadSelected); + } + + .arrowhead { + orient: auto; + stroke: none; + opacity: 0.6; + fill: blue; + } +</style> +<svg xmlns="http://www.w3.org/2000/svg"> + <defs> + <marker id="arrowheadSelected" class="arrowhead" opacity="0.6" + viewBox="0 0 10 10" refX="3" refY="5" + markerWidth="4" markerHeight="4"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + <marker id="arrowhead" class="arrowhead" opacity="0.2" + viewBox="0 0 10 10" refX="3" refY="5" + markerWidth="4" markerHeight="4"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + </defs> + <g id="arrows" fill="none" stroke="blue" visibility="hidden"> + + </g> +</svg> +<script type='text/javascript'> +const arrowIndices = [ 0,0 ] +</script> +<table class="code" data-fileid="1"> +<tr class="codeline" data-linenumber="1"><td class="num" id="LN1">1</td><td class="line"><span class='comment'>/*</span></td></tr> +<tr class="codeline" data-linenumber="2"><td class="num" id="LN2">2</td><td class="line"> <span class='comment'>* Copyright (C) 2017 info-cppsp <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="3"><td class="num" id="LN3">3</td><td class="line"> <span class='comment'>* Copyright (C) 2005-2009 Alex Murray <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="4"><td class="num" id="LN4">4</td><td class="line"> <span class='comment'>* Copyright (C) 2012-2021 MATE Developers</span></td></tr> +<tr class="codeline" data-linenumber="5"><td class="num" id="LN5">5</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="6"><td class="num" id="LN6">6</td><td class="line"> <span class='comment'>* This program is free software; you can redistribute it and/or modify</span></td></tr> +<tr class="codeline" data-linenumber="7"><td class="num" id="LN7">7</td><td class="line"> <span class='comment'>* it under the terms of the GNU General Public License as published by</span></td></tr> +<tr class="codeline" data-linenumber="8"><td class="num" id="LN8">8</td><td class="line"> <span class='comment'>* the Free Software Foundation; either version 2 of the License, or</span></td></tr> +<tr class="codeline" data-linenumber="9"><td class="num" id="LN9">9</td><td class="line"> <span class='comment'>* (at your option) any later version.</span></td></tr> +<tr class="codeline" data-linenumber="10"><td class="num" id="LN10">10</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="11"><td class="num" id="LN11">11</td><td class="line"> <span class='comment'>* This program is distributed in the hope that it will be useful,</span></td></tr> +<tr class="codeline" data-linenumber="12"><td class="num" id="LN12">12</td><td class="line"> <span class='comment'>* but WITHOUT ANY WARRANTY; without even the implied warranty of</span></td></tr> +<tr class="codeline" data-linenumber="13"><td class="num" id="LN13">13</td><td class="line"> <span class='comment'>* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></td></tr> +<tr class="codeline" data-linenumber="14"><td class="num" id="LN14">14</td><td class="line"> <span class='comment'>* GNU General Public License for more details.</span></td></tr> +<tr class="codeline" data-linenumber="15"><td class="num" id="LN15">15</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="16"><td class="num" id="LN16">16</td><td class="line"> <span class='comment'>* You should have received a copy of the GNU General Public License</span></td></tr> +<tr class="codeline" data-linenumber="17"><td class="num" id="LN17">17</td><td class="line"> <span class='comment'>* along with this program; if not, write to the Free Software</span></td></tr> +<tr class="codeline" data-linenumber="18"><td class="num" id="LN18">18</td><td class="line"> <span class='comment'>* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</span></td></tr> +<tr class="codeline" data-linenumber="19"><td class="num" id="LN19">19</td><td class="line"> <span class='comment'>*/</span></td></tr> +<tr class="codeline" data-linenumber="20"><td class="num" id="LN20">20</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="21"><td class="num" id="LN21">21</td><td class="line"><span class='comment'>/*</span></td></tr> +<tr class="codeline" data-linenumber="22"><td class="num" id="LN22">22</td><td class="line"><span class='comment'>Udisks2 plugin for the mate-sensors-applet</span></td></tr> +<tr class="codeline" data-linenumber="23"><td class="num" id="LN23">23</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="24"><td class="num" id="LN24">24</td><td class="line"><span class='comment'>written using the structure and code of the previous version</span></td></tr> +<tr class="codeline" data-linenumber="25"><td class="num" id="LN25">25</td><td class="line"><span class='comment'>from Pramod Dematagoda <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="26"><td class="num" id="LN26">26</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="27"><td class="num" id="LN27">27</td><td class="line"><span class='comment'>dbus-glib documentation</span></td></tr> +<tr class="codeline" data-linenumber="28"><td class="num" id="LN28">28</td><td class="line"><span class='comment'>https://dbus.freedesktop.org/doc/dbus-glib/</span></td></tr> +<tr class="codeline" data-linenumber="29"><td class="num" id="LN29">29</td><td class="line"><span class='comment'>GDBUS documentation</span></td></tr> +<tr class="codeline" data-linenumber="30"><td class="num" id="LN30">30</td><td class="line"><span class='comment'>https://developer.gnome.org/gio/stable/index.html</span></td></tr> +<tr class="codeline" data-linenumber="31"><td class="num" id="LN31">31</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="32"><td class="num" id="LN32">32</td><td class="line"><span class='comment'>*/</span></td></tr> +<tr class="codeline" data-linenumber="33"><td class="num" id="LN33">33</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="34"><td class="num" id="LN34">34</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_CONFIG_H<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="35"><td class="num" id="LN35">35</td><td class="line"><span class='directive'>#include "config.h"</span></td></tr> +<tr class="codeline" data-linenumber="36"><td class="num" id="LN36">36</td><td class="line"><span class='directive'>#endif /* HAVE_CONFIG_H */</span></td></tr> +<tr class="codeline" data-linenumber="37"><td class="num" id="LN37">37</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="38"><td class="num" id="LN38">38</td><td class="line"><span class='directive'>#include <stdio.h></span></td></tr> +<tr class="codeline" data-linenumber="39"><td class="num" id="LN39">39</td><td class="line"><span class='directive'>#include <gio/gio.h></span></td></tr> +<tr class="codeline" data-linenumber="40"><td class="num" id="LN40">40</td><td class="line"><span class='directive'>#include "udisks2-plugin.h"</span></td></tr> +<tr class="codeline" data-linenumber="41"><td class="num" id="LN41">41</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="42"><td class="num" id="LN42">42</td><td class="line"><span class='comment'>/* remove // from next line for syslog debug */</span></td></tr> +<tr class="codeline" data-linenumber="43"><td class="num" id="LN43">43</td><td class="line"><span class='comment'>//#define UD2PD 1</span></td></tr> +<tr class="codeline" data-linenumber="44"><td class="num" id="LN44">44</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="45"><td class="num" id="LN45">45</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="46"><td class="num" id="LN46">46</td><td class="line"><span class='directive'>#include <syslog.h></span></td></tr> +<tr class="codeline" data-linenumber="47"><td class="num" id="LN47">47</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="48"><td class="num" id="LN48">48</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="49"><td class="num" id="LN49">49</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_BUS_NAME<span class='macro_popup'>"org.freedesktop.UDisks2"</span></span> "org.freedesktop.UDisks2"</span></td></tr> +<tr class="codeline" data-linenumber="50"><td class="num" id="LN50">50</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.DBus.ObjectManager"</span></span> "org.freedesktop.DBus.ObjectManager"</span></td></tr> +<tr class="codeline" data-linenumber="51"><td class="num" id="LN51">51</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_DEVICE_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive"</span></span> "org.freedesktop.UDisks2.Drive"</span></td></tr> +<tr class="codeline" data-linenumber="52"><td class="num" id="LN52">52</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_DEVICE_INTERFACE2_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive.Ata"</span></span> "org.freedesktop.UDisks2.Drive.Ata"</span></td></tr> +<tr class="codeline" data-linenumber="53"><td class="num" id="LN53">53</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="54"><td class="num" id="LN54">54</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_PROPERTIES_INTERFACE<span class='macro_popup'>"org.freedesktop.DBus.Properties"</span></span> "org.freedesktop.DBus.Properties"</span></td></tr> +<tr class="codeline" data-linenumber="55"><td class="num" id="LN55">55</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_OBJECT_PATH<span class='macro_popup'>"/org/freedesktop/UDisks2"</span></span> "/org/freedesktop/UDisks2"</span></td></tr> +<tr class="codeline" data-linenumber="56"><td class="num" id="LN56">56</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="57"><td class="num" id="LN57">57</td><td class="line"><span class='comment'>/* Info about a single sensor */</span></td></tr> +<tr class="codeline" data-linenumber="58"><td class="num" id="LN58">58</td><td class="line"><span class='keyword'>typedef</span> <span class='keyword'>struct</span> _DevInfo {</td></tr> +<tr class="codeline" data-linenumber="59"><td class="num" id="LN59">59</td><td class="line"> gchar *path;</td></tr> +<tr class="codeline" data-linenumber="60"><td class="num" id="LN60">60</td><td class="line"> gchar *id;</td></tr> +<tr class="codeline" data-linenumber="61"><td class="num" id="LN61">61</td><td class="line"> gdouble temp;</td></tr> +<tr class="codeline" data-linenumber="62"><td class="num" id="LN62">62</td><td class="line"> GDBusProxy *sensor_proxy; <span class='comment'>/* dbus object */</span></td></tr> +<tr class="codeline" data-linenumber="63"><td class="num" id="LN63">63</td><td class="line"> GError *error;</td></tr> +<tr class="codeline" data-linenumber="64"><td class="num" id="LN64">64</td><td class="line">} DevInfo;</td></tr> +<tr class="codeline" data-linenumber="65"><td class="num" id="LN65">65</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="66"><td class="num" id="LN66">66</td><td class="line"><span class='keyword'>const</span> gchar *plugin_name = <span class='string_literal'>"udisks2"</span>;</td></tr> +<tr class="codeline" data-linenumber="67"><td class="num" id="LN67">67</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="68"><td class="num" id="LN68">68</td><td class="line"><span class='comment'>/* a container for the devices found to have smart enabled */</span></td></tr> +<tr class="codeline" data-linenumber="69"><td class="num" id="LN69">69</td><td class="line">GHashTable *devices = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="70"><td class="num" id="LN70">70</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="71"><td class="num" id="LN71">71</td><td class="line"><span class='comment'>/* This is a global variable for convenience */</span></td></tr> +<tr class="codeline" data-linenumber="72"><td class="num" id="LN72">72</td><td class="line">GDBusConnection *connection = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="73"><td class="num" id="LN73">73</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="74"><td class="num" id="LN74">74</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> update_device (DevInfo *info) {</td></tr> +<tr class="codeline" data-linenumber="75"><td class="num" id="LN75">75</td><td class="line"> GError *error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="76"><td class="num" id="LN76">76</td><td class="line"> GVariant *tempgvar = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="77"><td class="num" id="LN77">77</td><td class="line"> GVariant *tempgvar2 = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="78"><td class="num" id="LN78">78</td><td class="line"> gdouble temp;</td></tr> +<tr class="codeline" data-linenumber="79"><td class="num" id="LN79">79</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="80"><td class="num" id="LN80">80</td><td class="line"> <span class='comment'>/* check valid input parameter */</span></td></tr> +<tr class="codeline" data-linenumber="81"><td class="num" id="LN81">81</td><td class="line"> <span class='macro'>g_return_if_fail (info != NULL)<span class='macro_popup'>do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_18<br>; if (info != ((void*)0)) _g_boolean_var_18 = 1; else _g_boolean_var_18<br> = 0; _g_boolean_var_18; }), 1))) { } else { g_return_if_fail_warning<br> ("sensors-applet", ((const char*) (__func__)), "info != NULL"<br>); return; } } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="82"><td class="num" id="LN82">82</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="83"><td class="num" id="LN83">83</td><td class="line"> <span class='comment'>/* check connection too */</span></td></tr> +<tr class="codeline" data-linenumber="84"><td class="num" id="LN84">84</td><td class="line"> <span class='macro'>g_return_if_fail (connection != NULL)<span class='macro_popup'>do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_19<br>; if (connection != ((void*)0)) _g_boolean_var_19 = 1; else _g_boolean_var_19<br> = 0; _g_boolean_var_19; }), 1))) { } else { g_return_if_fail_warning<br> ("sensors-applet", ((const char*) (__func__)), "connection != NULL"<br>); return; } } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="85"><td class="num" id="LN85">85</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="86"><td class="num" id="LN86">86</td><td class="line"> g_clear_error (&info->error);</td></tr> +<tr class="codeline" data-linenumber="87"><td class="num" id="LN87">87</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="88"><td class="num" id="LN88">88</td><td class="line"> <span class='comment'>/* check for sensor_proxy, which should exist at this point, make one if necessary and save it into DevInfo</span></td></tr> +<tr class="codeline" data-linenumber="89"><td class="num" id="LN89">89</td><td class="line"> <span class='comment'>* this is used to get the temp value the direct way */</span></td></tr> +<tr class="codeline" data-linenumber="90"><td class="num" id="LN90">90</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == info->sensor_proxy) {</td></tr> +<tr class="codeline" data-linenumber="91"><td class="num" id="LN91">91</td><td class="line"> info->sensor_proxy = g_dbus_proxy_new_sync (connection, G_DBUS_PROXY_FLAGS_NONE, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="92"><td class="num" id="LN92">92</td><td class="line"> <span class='macro'>UDISKS2_BUS_NAME<span class='macro_popup'>"org.freedesktop.UDisks2"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="93"><td class="num" id="LN93">93</td><td class="line"> info->path,</td></tr> +<tr class="codeline" data-linenumber="94"><td class="num" id="LN94">94</td><td class="line"> <span class='macro'>UDISKS2_PROPERTIES_INTERFACE<span class='macro_popup'>"org.freedesktop.DBus.Properties"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="95"><td class="num" id="LN95">95</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, &error);</td></tr> +<tr class="codeline" data-linenumber="96"><td class="num" id="LN96">96</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="97"><td class="num" id="LN97">97</td><td class="line"> <span class='comment'>/* check, just to be sure */</span></td></tr> +<tr class="codeline" data-linenumber="98"><td class="num" id="LN98">98</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == info->sensor_proxy) {</td></tr> +<tr class="codeline" data-linenumber="99"><td class="num" id="LN99">99</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="100"><td class="num" id="LN100">100</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="101"><td class="num" id="LN101">101</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Failed to get drive temperature 1"</span>);</td></tr> +<tr class="codeline" data-linenumber="102"><td class="num" id="LN102">102</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="103"><td class="num" id="LN103">103</td><td class="line"> g_debug (<span class='string_literal'>"Failed to get drive temperature 1: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="104"><td class="num" id="LN104">104</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="105"><td class="num" id="LN105">105</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="106"><td class="num" id="LN106">106</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="107"><td class="num" id="LN107">107</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="108"><td class="num" id="LN108">108</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="109"><td class="num" id="LN109">109</td><td class="line"><span class='comment'>/* note on timing:</span></td></tr> +<tr class="codeline" data-linenumber="110"><td class="num" id="LN110">110</td><td class="line"> <span class='comment'>* it seems to me that smart updates occur automatically every 10 minutes</span></td></tr> +<tr class="codeline" data-linenumber="111"><td class="num" id="LN111">111</td><td class="line"> <span class='comment'>* mate-sensor-applet has a default refresh of 2 seconds...</span></td></tr> +<tr class="codeline" data-linenumber="112"><td class="num" id="LN112">112</td><td class="line"> <span class='comment'>* it is possible to force a smart update with udisks2: SmartUpdate (IN a{sv} options); */</span></td></tr> +<tr class="codeline" data-linenumber="113"><td class="num" id="LN113">113</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="114"><td class="num" id="LN114">114</td><td class="line"> <span class='comment'>/* directly asking the device's DBus object for the temp */</span></td></tr> +<tr class="codeline" data-linenumber="115"><td class="num" id="LN115">115</td><td class="line"> tempgvar = g_dbus_proxy_call_sync (info->sensor_proxy, <span class='string_literal'>"Get"</span>,</td></tr> +<tr class="codeline" data-linenumber="116"><td class="num" id="LN116">116</td><td class="line"> g_variant_new (<span class='string_literal'>"(ss)"</span>,</td></tr> +<tr class="codeline" data-linenumber="117"><td class="num" id="LN117">117</td><td class="line"> <span class='macro'>UDISKS2_DEVICE_INTERFACE2_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive.Ata"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="118"><td class="num" id="LN118">118</td><td class="line"> <span class='string_literal'>"SmartTemperature"</span>), <span class='comment'>/* parameters */</span></td></tr> +<tr class="codeline" data-linenumber="119"><td class="num" id="LN119">119</td><td class="line"> G_DBUS_CALL_FLAGS_NONE, <span class='comment'>/* flags */</span></td></tr> +<tr class="codeline" data-linenumber="120"><td class="num" id="LN120">120</td><td class="line"> -1, <span class='comment'>/* timeout */</span></td></tr> +<tr class="codeline" data-linenumber="121"><td class="num" id="LN121">121</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='comment'>/* cancellable */</span></td></tr> +<tr class="codeline" data-linenumber="122"><td class="num" id="LN122">122</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="123"><td class="num" id="LN123">123</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="124"><td class="num" id="LN124">124</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == tempgvar) {</td></tr> +<tr class="codeline" data-linenumber="125"><td class="num" id="LN125">125</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="126"><td class="num" id="LN126">126</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="127"><td class="num" id="LN127">127</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Failed to get drive temperature 2"</span>);</td></tr> +<tr class="codeline" data-linenumber="128"><td class="num" id="LN128">128</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="129"><td class="num" id="LN129">129</td><td class="line"> g_debug (<span class='string_literal'>"Failed to get drive temperature 2: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="130"><td class="num" id="LN130">130</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="131"><td class="num" id="LN131">131</td><td class="line"> <span class='comment'>/* throw away proxy, maybe next time it will be better */</span></td></tr> +<tr class="codeline" data-linenumber="132"><td class="num" id="LN132">132</td><td class="line"> <span class='macro'>g_clear_object (&info->sensor_proxy)<span class='macro_popup'>do { _Static_assert (sizeof *((&info->sensor_proxy)) ==<br> sizeof (gpointer), "Expression evaluates to false"); __typeof__<br> (((&info->sensor_proxy))) _pp = ((&info->sensor_proxy<br>)); __typeof__ (*((&info->sensor_proxy))) _ptr = *_pp;<br> *_pp = ((void*)0); if (_ptr) (g_object_unref) (_ptr); } while<br> (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="133"><td class="num" id="LN133">133</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="134"><td class="num" id="LN134">134</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="135"><td class="num" id="LN135">135</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="136"><td class="num" id="LN136">136</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="137"><td class="num" id="LN137">137</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="138"><td class="num" id="LN138">138</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"tempgvar value: %s"</span>, g_variant_print(tempgvar, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="139"><td class="num" id="LN139">139</td><td class="line"><span class='comment'>/* leaks memory! */</span></td></tr> +<tr class="codeline" data-linenumber="140"><td class="num" id="LN140">140</td><td class="line"><span class='comment'>//syslog(LOG_ERR, "tempgvar value: %s", g_variant_print(g_variant_get_variant(g_variant_get_child_value(tempgvar, 0)), TRUE));</span></td></tr> +<tr class="codeline" data-linenumber="141"><td class="num" id="LN141">141</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="142"><td class="num" id="LN142">142</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="143"><td class="num" id="LN143">143</td><td class="line"> <span class='comment'>/* tempgvar comes back as something along the lines of array(gvariant(tempasdouble))</span></td></tr> +<tr class="codeline" data-linenumber="144"><td class="num" id="LN144">144</td><td class="line"> <span class='comment'>* hence unpacking</span></td></tr> +<tr class="codeline" data-linenumber="145"><td class="num" id="LN145">145</td><td class="line"> <span class='comment'>* need to free up every param / return value, so can't do it like:</span></td></tr> +<tr class="codeline" data-linenumber="146"><td class="num" id="LN146">146</td><td class="line"> <span class='comment'>* temp = g_variant_get_double(g_variant_get_variant(g_variant_get_child_value(tempgvar, 0))); */</span></td></tr> +<tr class="codeline" data-linenumber="147"><td class="num" id="LN147">147</td><td class="line"> tempgvar2 = g_variant_get_child_value (tempgvar, 0);</td></tr> +<tr class="codeline" data-linenumber="148"><td class="num" id="LN148">148</td><td class="line"> g_variant_unref (tempgvar);</td></tr> +<tr class="codeline" data-linenumber="149"><td class="num" id="LN149">149</td><td class="line"> tempgvar = g_variant_get_variant (tempgvar2);</td></tr> +<tr class="codeline" data-linenumber="150"><td class="num" id="LN150">150</td><td class="line"> g_variant_unref (tempgvar2);</td></tr> +<tr class="codeline" data-linenumber="151"><td class="num" id="LN151">151</td><td class="line"> temp = g_variant_get_double (tempgvar);</td></tr> +<tr class="codeline" data-linenumber="152"><td class="num" id="LN152">152</td><td class="line"> g_variant_unref (tempgvar);</td></tr> +<tr class="codeline" data-linenumber="153"><td class="num" id="LN153">153</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="154"><td class="num" id="LN154">154</td><td class="line"> <span class='comment'>/* temp in K */</span></td></tr> +<tr class="codeline" data-linenumber="155"><td class="num" id="LN155">155</td><td class="line"> info->temp = temp - 273.15;</td></tr> +<tr class="codeline" data-linenumber="156"><td class="num" id="LN156">156</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="157"><td class="num" id="LN157">157</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="158"><td class="num" id="LN158">158</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Refresh udisks2 device temp: '%f'\n"</span>, info->temp);</td></tr> +<tr class="codeline" data-linenumber="159"><td class="num" id="LN159">159</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="160"><td class="num" id="LN160">160</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="161"><td class="num" id="LN161">161</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="162"><td class="num" id="LN162">162</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="163"><td class="num" id="LN163">163</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="164"><td class="num" id="LN164">164</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="165"><td class="num" id="LN165">165</td><td class="line"><span class='comment'>/* in this function we would like to get a list of device (hdd/ssd) paths</span></td></tr> +<tr class="codeline" data-linenumber="166"><td class="num" id="LN166">166</td><td class="line"> <span class='comment'>* then with each path we get the temperature</span></td></tr> +<tr class="codeline" data-linenumber="167"><td class="num" id="LN167">167</td><td class="line"> <span class='comment'>* it is possible with udisks2 to get all the above information in one g_dbus_proxy_call_sync(), so that is how I did it</span></td></tr> +<tr class="codeline" data-linenumber="168"><td class="num" id="LN168">168</td><td class="line"> <span class='comment'>* maybe a better version would be to use GDBusObjectManager Server + Client ?? */</span></td></tr> +<tr class="codeline" data-linenumber="169"><td class="num" id="LN169">169</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> udisks2_plugin_get_sensors (GList **sensors) {</td></tr> +<tr class="codeline" data-linenumber="170"><td class="num" id="LN170">170</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="171"><td class="num" id="LN171">171</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="172"><td class="num" id="LN172">172</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"fstart"</span>);</td></tr> +<tr class="codeline" data-linenumber="173"><td class="num" id="LN173">173</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="174"><td class="num" id="LN174">174</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="175"><td class="num" id="LN175">175</td><td class="line"> GDBusProxy *proxy = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="176"><td class="num" id="LN176">176</td><td class="line"> GError *error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="177"><td class="num" id="LN177">177</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="178"><td class="num" id="LN178">178</td><td class="line"> DevInfo *info;</td></tr> +<tr class="codeline" data-linenumber="179"><td class="num" id="LN179">179</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="180"><td class="num" id="LN180">180</td><td class="line"> <span class='comment'>/* This connection will be used for everything, including the obtaining of sensor data */</span></td></tr> +<tr class="codeline" data-linenumber="181"><td class="num" id="LN181">181</td><td class="line"> connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, &error);</td></tr> +<tr class="codeline" data-linenumber="182"><td class="num" id="LN182">182</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == connection) {</td></tr> +<tr class="codeline" data-linenumber="183"><td class="num" id="LN183">183</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="184"><td class="num" id="LN184">184</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="185"><td class="num" id="LN185">185</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn fail"</span>);</td></tr> +<tr class="codeline" data-linenumber="186"><td class="num" id="LN186">186</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="187"><td class="num" id="LN187">187</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="188"><td class="num" id="LN188">188</td><td class="line"> g_debug (<span class='string_literal'>"Failed to open connection to DBUS: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="189"><td class="num" id="LN189">189</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="190"><td class="num" id="LN190">190</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="191"><td class="num" id="LN191">191</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="192"><td class="num" id="LN192">192</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="193"><td class="num" id="LN193">193</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="194"><td class="num" id="LN194">194</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn success"</span>);</td></tr> +<tr class="codeline" data-linenumber="195"><td class="num" id="LN195">195</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="196"><td class="num" id="LN196">196</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="197"><td class="num" id="LN197">197</td><td class="line"> <span class='comment'>/* I use this proxy to get all info of all devices at once */</span></td></tr> +<tr class="codeline" data-linenumber="198"><td class="num" id="LN198">198</td><td class="line"> proxy = g_dbus_proxy_new_sync (connection, G_DBUS_PROXY_FLAGS_NONE, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="199"><td class="num" id="LN199">199</td><td class="line"> <span class='macro'>UDISKS2_BUS_NAME<span class='macro_popup'>"org.freedesktop.UDisks2"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="200"><td class="num" id="LN200">200</td><td class="line"> <span class='macro'>UDISKS2_OBJECT_PATH<span class='macro_popup'>"/org/freedesktop/UDisks2"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="201"><td class="num" id="LN201">201</td><td class="line"> <span class='macro'>UDISKS2_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.DBus.ObjectManager"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="202"><td class="num" id="LN202">202</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, &error);</td></tr> +<tr class="codeline" data-linenumber="203"><td class="num" id="LN203">203</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="204"><td class="num" id="LN204">204</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == proxy) {</td></tr> +<tr class="codeline" data-linenumber="205"><td class="num" id="LN205">205</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="206"><td class="num" id="LN206">206</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="207"><td class="num" id="LN207">207</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn proxy fail"</span>);</td></tr> +<tr class="codeline" data-linenumber="208"><td class="num" id="LN208">208</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="209"><td class="num" id="LN209">209</td><td class="line"> g_debug (<span class='string_literal'>"dbus conn proxy fail: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="210"><td class="num" id="LN210">210</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="211"><td class="num" id="LN211">211</td><td class="line"> <span class='macro'>g_clear_object (&connection)<span class='macro_popup'>do { _Static_assert (sizeof *((&connection)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&connection<br>))) _pp = ((&connection)); __typeof__ (*((&connection<br>))) _ptr = *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref<br>) (_ptr); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="212"><td class="num" id="LN212">212</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="213"><td class="num" id="LN213">213</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="214"><td class="num" id="LN214">214</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="215"><td class="num" id="LN215">215</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="216"><td class="num" id="LN216">216</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn proxy success"</span>);</td></tr> +<tr class="codeline" data-linenumber="217"><td class="num" id="LN217">217</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="218"><td class="num" id="LN218">218</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="219"><td class="num" id="LN219">219</td><td class="line"> <span class='comment'>/* The object paths of the disks are enumerated and placed in an array of object paths</span></td></tr> +<tr class="codeline" data-linenumber="220"><td class="num" id="LN220">220</td><td class="line"> <span class='comment'>* "GetManagedObjects" returns dict of (objectpath, (dict of (string [ie. if. name], dict of(string [ie. property name], variant [ie. prop. value])))) */</span></td></tr> +<tr class="codeline" data-linenumber="221"><td class="num" id="LN221">221</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="222"><td class="num" id="LN222">222</td><td class="line"> <span class='comment'>/* g_dbus_proxy_call_sync() returns NULL on error, GVariant * otherwise</span></td></tr> +<tr class="codeline" data-linenumber="223"><td class="num" id="LN223">223</td><td class="line"> <span class='comment'>* need second variable to prevent memory leak */</span></td></tr> +<tr class="codeline" data-linenumber="224"><td class="num" id="LN224">224</td><td class="line"> GVariant *managed_objects = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="225"><td class="num" id="LN225">225</td><td class="line"> GVariant *managed_objects2 = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="226"><td class="num" id="LN226">226</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="227"><td class="num" id="LN227">227</td><td class="line"> managed_objects2 = g_dbus_proxy_call_sync (proxy, <span class='string_literal'>"GetManagedObjects"</span>,</td></tr> +<tr class="codeline" data-linenumber="228"><td class="num" id="LN228">228</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='comment'>/* parameters */</span></td></tr> +<tr class="codeline" data-linenumber="229"><td class="num" id="LN229">229</td><td class="line"> G_DBUS_CALL_FLAGS_NONE, <span class='comment'>/* flags */</span></td></tr> +<tr class="codeline" data-linenumber="230"><td class="num" id="LN230">230</td><td class="line"> -1, <span class='comment'>/* timeout */</span></td></tr> +<tr class="codeline" data-linenumber="231"><td class="num" id="LN231">231</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='comment'>/* cancellable */</span></td></tr> +<tr class="codeline" data-linenumber="232"><td class="num" id="LN232">232</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="233"><td class="num" id="LN233">233</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="234"><td class="num" id="LN234">234</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == managed_objects2) {</td></tr> +<tr class="codeline" data-linenumber="235"><td class="num" id="LN235">235</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="236"><td class="num" id="LN236">236</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="237"><td class="num" id="LN237">237</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Failed to enumerate disk devices"</span>);</td></tr> +<tr class="codeline" data-linenumber="238"><td class="num" id="LN238">238</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="239"><td class="num" id="LN239">239</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="240"><td class="num" id="LN240">240</td><td class="line"> g_debug (<span class='string_literal'>"Failed to enumerate disk devices: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="241"><td class="num" id="LN241">241</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="242"><td class="num" id="LN242">242</td><td class="line"> <span class='macro'>g_clear_object (&proxy)<span class='macro_popup'>do { _Static_assert (sizeof *((&proxy)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&proxy<br>))) _pp = ((&proxy)); __typeof__ (*((&proxy))) _ptr =<br> *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref) (_ptr); }<br> while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="243"><td class="num" id="LN243">243</td><td class="line"> <span class='macro'>g_clear_object (&connection)<span class='macro_popup'>do { _Static_assert (sizeof *((&connection)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&connection<br>))) _pp = ((&connection)); __typeof__ (*((&connection<br>))) _ptr = *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref<br>) (_ptr); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="244"><td class="num" id="LN244">244</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="245"><td class="num" id="LN245">245</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="246"><td class="num" id="LN246">246</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="247"><td class="num" id="LN247">247</td><td class="line"> <span class='comment'>/* the result dictionary is enclosed in an array, unpack */</span></td></tr> +<tr class="codeline" data-linenumber="248"><td class="num" id="LN248">248</td><td class="line"> managed_objects = g_variant_get_child_value (managed_objects2, 0);</td></tr> +<tr class="codeline" data-linenumber="249"><td class="num" id="LN249">249</td><td class="line"> g_variant_unref (managed_objects2);</td></tr> +<tr class="codeline" data-linenumber="250"><td class="num" id="LN250">250</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="251"><td class="num" id="LN251">251</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="252"><td class="num" id="LN252">252</td><td class="line"><span class='comment'>//syslog(LOG_ERR, "managed_objects type: %s", g_variant_print(managed_objects, TRUE));</span></td></tr> +<tr class="codeline" data-linenumber="253"><td class="num" id="LN253">253</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"success to enumerate disk devices"</span>);</td></tr> +<tr class="codeline" data-linenumber="254"><td class="num" id="LN254">254</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="255"><td class="num" id="LN255">255</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="256"><td class="num" id="LN256">256</td><td class="line"> <span class='comment'>/* iterator for the result dictionary</span></td></tr> +<tr class="codeline" data-linenumber="257"><td class="num" id="LN257">257</td><td class="line"> <span class='comment'>* iterator code is based on the g_variant_iter_next() documentation</span></td></tr> +<tr class="codeline" data-linenumber="258"><td class="num" id="LN258">258</td><td class="line"> <span class='comment'>* iter is freed if the GVariant is, when using g_variant_iter_init() */</span></td></tr> +<tr class="codeline" data-linenumber="259"><td class="num" id="LN259">259</td><td class="line"> GVariantIter iter;</td></tr> +<tr class="codeline" data-linenumber="260"><td class="num" id="LN260">260</td><td class="line"> gchar *key = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; <span class='comment'>/* object path (like '/org/freedesktop/UDisks2/drives/Samsung_SSD_840_EVO_250GB_*insert drive serial nr.*') */</span></td></tr> +<tr class="codeline" data-linenumber="261"><td class="num" id="LN261">261</td><td class="line"> GVariant *value = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="262"><td class="num" id="LN262">262</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="263"><td class="num" id="LN263">263</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="264"><td class="num" id="LN264">264</td><td class="line"><span class='comment'>/* log collection size */</span></td></tr> +<tr class="codeline" data-linenumber="265"><td class="num" id="LN265">265</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"iter init count: %d"</span>, (<span class='keyword'>int</span>) g_variant_iter_init (&iter, managed_objects));</td></tr> +<tr class="codeline" data-linenumber="266"><td class="num" id="LN266">266</td><td class="line"><span class='directive'>#else</span></td></tr> +<tr class="codeline" data-linenumber="267"><td class="num" id="LN267">267</td><td class="line"> g_variant_iter_init (&iter, managed_objects);</td></tr> +<tr class="codeline" data-linenumber="268"><td class="num" id="LN268">268</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="269"><td class="num" id="LN269">269</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="270"><td class="num" id="LN270">270</td><td class="line"> <span class='comment'>/* "{sv}" is a GVariant format string</span></td></tr> +<tr class="codeline" data-linenumber="271"><td class="num" id="LN271">271</td><td class="line"> <span class='comment'>* {} dictionary of, s string, v GVariant</span></td></tr> +<tr class="codeline" data-linenumber="272"><td class="num" id="LN272">272</td><td class="line"> <span class='comment'>* changed to "{oa{sa{sv}}}" on error message 'the GVariant format string '{sv}' has a type of '{sv}' but the given value has a type of 'a{oa{sa{sv}}}''</span></td></tr> +<tr class="codeline" data-linenumber="273"><td class="num" id="LN273">273</td><td class="line"> <span class='comment'>* a is array, o is object path</span></td></tr> +<tr class="codeline" data-linenumber="274"><td class="num" id="LN274">274</td><td class="line"> <span class='comment'>* NOO!! the right format string is "{o@*}", which means get an object path into the 1st variable (key)</span></td></tr> +<tr class="codeline" data-linenumber="275"><td class="num" id="LN275">275</td><td class="line"> <span class='comment'>* and get 'everything else' (as a GVariant) into the 2nd variable (value)</span></td></tr> +<tr class="codeline" data-linenumber="276"><td class="num" id="LN276">276</td><td class="line"> <span class='comment'>* needs the & before the key and value params! */</span></td></tr> +<tr class="codeline" data-linenumber="277"><td class="num" id="LN277">277</td><td class="line"> <span class='keyword'>while</span> (g_variant_iter_next (&iter, <span class='string_literal'>"{o@*}"</span>, &key, &value)) {</td></tr> +<tr class="codeline" data-linenumber="278"><td class="num" id="LN278">278</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="279"><td class="num" id="LN279">279</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="280"><td class="num" id="LN280">280</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"in iter while loop"</span>);</td></tr> +<tr class="codeline" data-linenumber="281"><td class="num" id="LN281">281</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"key value: %s"</span>, key);</td></tr> +<tr class="codeline" data-linenumber="282"><td class="num" id="LN282">282</td><td class="line"><span class='comment'>//syslog(LOG_ERR, "value type: %s", g_variant_print(value, TRUE));</span></td></tr> +<tr class="codeline" data-linenumber="283"><td class="num" id="LN283">283</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="284"><td class="num" id="LN284">284</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="285"><td class="num" id="LN285">285</td><td class="line"> <span class='comment'>/* level 2</span></td></tr> +<tr class="codeline" data-linenumber="286"><td class="num" id="LN286">286</td><td class="line"> <span class='comment'>* create a dictionary of value</span></td></tr> +<tr class="codeline" data-linenumber="287"><td class="num" id="LN287">287</td><td class="line"> <span class='comment'>* the two interface names that we are searching for are known and defined</span></td></tr> +<tr class="codeline" data-linenumber="288"><td class="num" id="LN288">288</td><td class="line"> <span class='comment'>* can't use GVariantDict, it only supports '{sv}' but the given value has a type of '{sa{sv}}'</span></td></tr> +<tr class="codeline" data-linenumber="289"><td class="num" id="LN289">289</td><td class="line"> <span class='comment'>* using general lookup */</span></td></tr> +<tr class="codeline" data-linenumber="290"><td class="num" id="LN290">290</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="291"><td class="num" id="LN291">291</td><td class="line"> GVariant *propdict = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; <span class='comment'>/* drive data */</span></td></tr> +<tr class="codeline" data-linenumber="292"><td class="num" id="LN292">292</td><td class="line"> GVariant *propdict2 = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; <span class='comment'>/* drive smart data */</span></td></tr> +<tr class="codeline" data-linenumber="293"><td class="num" id="LN293">293</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="294"><td class="num" id="LN294">294</td><td class="line"> <span class='comment'>/* make two dictionaries that contain the properties of the drive interfaces */</span></td></tr> +<tr class="codeline" data-linenumber="295"><td class="num" id="LN295">295</td><td class="line"> propdict = g_variant_lookup_value (value, <span class='macro'>UDISKS2_DEVICE_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive"</span></span>, <span class='macro'>G_VARIANT_TYPE_DICTIONARY<span class='macro_popup'>((const GVariantType *) "a{?*}")</span></span>);</td></tr> +<tr class="codeline" data-linenumber="296"><td class="num" id="LN296">296</td><td class="line"> propdict2 = g_variant_lookup_value (value, <span class='macro'>UDISKS2_DEVICE_INTERFACE2_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive.Ata"</span></span>, <span class='macro'>G_VARIANT_TYPE_DICTIONARY<span class='macro_popup'>((const GVariantType *) "a{?*}")</span></span>);</td></tr> +<tr class="codeline" data-linenumber="297"><td class="num" id="LN297">297</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="298"><td class="num" id="LN298">298</td><td class="line"> <span class='comment'>/* do we have the right ifname keys? */</span></td></tr> +<tr class="codeline" data-linenumber="299"><td class="num" id="LN299">299</td><td class="line"> <span class='keyword'>if</span> ((<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict) && (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict2)) {</td></tr> +<tr class="codeline" data-linenumber="300"><td class="num" id="LN300">300</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="301"><td class="num" id="LN301">301</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="302"><td class="num" id="LN302">302</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"propdict type: %s"</span>, g_variant_print(propdict, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="303"><td class="num" id="LN303">303</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"propdict2 type: %s"</span>, g_variant_print(propdict2, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="304"><td class="num" id="LN304">304</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="305"><td class="num" id="LN305">305</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="306"><td class="num" id="LN306">306</td><td class="line"> <span class='comment'>/* get data */</span></td></tr> +<tr class="codeline" data-linenumber="307"><td class="num" id="LN307">307</td><td class="line"> gchar *id = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="308"><td class="num" id="LN308">308</td><td class="line"> gchar *model = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="309"><td class="num" id="LN309">309</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="310"><td class="num" id="LN310">310</td><td class="line"> gboolean smartenabled;</td></tr> +<tr class="codeline" data-linenumber="311"><td class="num" id="LN311">311</td><td class="line"> gdouble temp;</td></tr> +<tr class="codeline" data-linenumber="312"><td class="num" id="LN312">312</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="313"><td class="num" id="LN313">313</td><td class="line"> <span class='comment'>/* NULL, bc we don't care about the length of the string</span></td></tr> +<tr class="codeline" data-linenumber="314"><td class="num" id="LN314">314</td><td class="line"> <span class='comment'>* typecast bc g_variant_get_string() returns const char* */</span></td></tr> +<tr class="codeline" data-linenumber="315"><td class="num" id="LN315">315</td><td class="line"> id = (gchar *) g_variant_get_string (g_variant_lookup_value (propdict, <span class='string_literal'>"Id"</span>, <span class='macro'>G_VARIANT_TYPE_STRING<span class='macro_popup'>((const GVariantType *) "s")</span></span>), <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="316"><td class="num" id="LN316">316</td><td class="line"> model = (gchar *) g_variant_get_string (g_variant_lookup_value (propdict, <span class='string_literal'>"Model"</span>, <span class="mrange"><span class="mrange"><span class='macro'>G_VARIANT_TYPE_STRING<span class='macro_popup'>((const GVariantType *) "s")</span></span></span></span>), <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr><td class="num"></td><td class="line"><div id="EndPath" class="msg msgEvent" style="margin-left:96ex; max-width:31em">Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption</div></td></tr> +<tr class="codeline" data-linenumber="317"><td class="num" id="LN317">317</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="318"><td class="num" id="LN318">318</td><td class="line"> smartenabled = g_variant_get_boolean (g_variant_lookup_value (propdict2, <span class='string_literal'>"SmartEnabled"</span>, <span class='macro'>G_VARIANT_TYPE_BOOLEAN<span class='macro_popup'>((const GVariantType *) "b")</span></span>));</td></tr> +<tr class="codeline" data-linenumber="319"><td class="num" id="LN319">319</td><td class="line"> temp = g_variant_get_double (g_variant_lookup_value (propdict2, <span class='string_literal'>"SmartTemperature"</span>, <span class='macro'>G_VARIANT_TYPE_DOUBLE<span class='macro_popup'>((const GVariantType *) "d")</span></span>));</td></tr> +<tr class="codeline" data-linenumber="320"><td class="num" id="LN320">320</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="321"><td class="num" id="LN321">321</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="322"><td class="num" id="LN322">322</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device id: '%s'\n"</span>, id);</td></tr> +<tr class="codeline" data-linenumber="323"><td class="num" id="LN323">323</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device model: '%s'\n"</span>, model);</td></tr> +<tr class="codeline" data-linenumber="324"><td class="num" id="LN324">324</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device smartenabled: '%d'\n"</span>, smartenabled);</td></tr> +<tr class="codeline" data-linenumber="325"><td class="num" id="LN325">325</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device temp: '%f'\n"</span>, temp);</td></tr> +<tr class="codeline" data-linenumber="326"><td class="num" id="LN326">326</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="327"><td class="num" id="LN327">327</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="328"><td class="num" id="LN328">328</td><td class="line"> <span class='comment'>/* only go on if smart is enabled</span></td></tr> +<tr class="codeline" data-linenumber="329"><td class="num" id="LN329">329</td><td class="line"> <span class='comment'>* save data */</span></td></tr> +<tr class="codeline" data-linenumber="330"><td class="num" id="LN330">330</td><td class="line"> <span class='keyword'>if</span> (smartenabled) {</td></tr> +<tr class="codeline" data-linenumber="331"><td class="num" id="LN331">331</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="332"><td class="num" id="LN332">332</td><td class="line"> info = <span class='macro'>g_new0 (DevInfo, 1)<span class='macro_popup'>(DevInfo *) (__extension__ ({ gsize __n = (gsize) (1); gsize __s<br> = sizeof (DevInfo); gpointer __p; if (__s == 1) __p = g_malloc0<br> (__n); else if (__builtin_constant_p (__n) && (__s ==<br> 0 || __n <= (9223372036854775807L *2UL+1UL) / __s)) __p =<br> g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s); __p<br>; }))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="333"><td class="num" id="LN333">333</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == devices) {</td></tr> +<tr class="codeline" data-linenumber="334"><td class="num" id="LN334">334</td><td class="line"> devices = g_hash_table_new (g_str_hash, g_str_equal);</td></tr> +<tr class="codeline" data-linenumber="335"><td class="num" id="LN335">335</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="336"><td class="num" id="LN336">336</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="337"><td class="num" id="LN337">337</td><td class="line"> info->id = <span class='macro'>g_strdup (id)<span class='macro_popup'>g_strdup_inline (id)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="338"><td class="num" id="LN338">338</td><td class="line"> info->path = <span class='macro'>g_strdup (key)<span class='macro_popup'>g_strdup_inline (key)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="339"><td class="num" id="LN339">339</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="340"><td class="num" id="LN340">340</td><td class="line"> <span class='comment'>/* temp in K</span></td></tr> +<tr class="codeline" data-linenumber="341"><td class="num" id="LN341">341</td><td class="line"> <span class='comment'>* this could be left at 0.0, 2 seconds later it will be refreshed anyway */</span></td></tr> +<tr class="codeline" data-linenumber="342"><td class="num" id="LN342">342</td><td class="line"> info->temp = (gdouble) temp - 273.15;</td></tr> +<tr class="codeline" data-linenumber="343"><td class="num" id="LN343">343</td><td class="line"> g_hash_table_insert (devices, info->id, info);</td></tr> +<tr class="codeline" data-linenumber="344"><td class="num" id="LN344">344</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="345"><td class="num" id="LN345">345</td><td class="line"> <span class='comment'>/* Write the sensor data */</span></td></tr> +<tr class="codeline" data-linenumber="346"><td class="num" id="LN346">346</td><td class="line"> sensors_applet_plugin_add_sensor (sensors,</td></tr> +<tr class="codeline" data-linenumber="347"><td class="num" id="LN347">347</td><td class="line"> id,</td></tr> +<tr class="codeline" data-linenumber="348"><td class="num" id="LN348">348</td><td class="line"> <span class='string_literal'>"Disk Temperature"</span>,</td></tr> +<tr class="codeline" data-linenumber="349"><td class="num" id="LN349">349</td><td class="line"> model,</td></tr> +<tr class="codeline" data-linenumber="350"><td class="num" id="LN350">350</td><td class="line"> TEMP_SENSOR,</td></tr> +<tr class="codeline" data-linenumber="351"><td class="num" id="LN351">351</td><td class="line"> <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="352"><td class="num" id="LN352">352</td><td class="line"> HDD_ICON,</td></tr> +<tr class="codeline" data-linenumber="353"><td class="num" id="LN353">353</td><td class="line"> <span class='macro'>DEFAULT_GRAPH_COLOR<span class='macro_popup'>"#ff0000"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="354"><td class="num" id="LN354">354</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="355"><td class="num" id="LN355">355</td><td class="line"> g_debug (<span class='string_literal'>"Added %s"</span>, id);</td></tr> +<tr class="codeline" data-linenumber="356"><td class="num" id="LN356">356</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="357"><td class="num" id="LN357">357</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="358"><td class="num" id="LN358">358</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Added %s"</span>, id);</td></tr> +<tr class="codeline" data-linenumber="359"><td class="num" id="LN359">359</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="360"><td class="num" id="LN360">360</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="361"><td class="num" id="LN361">361</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="362"><td class="num" id="LN362">362</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="363"><td class="num" id="LN363">363</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="364"><td class="num" id="LN364">364</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"No temp data for device: %s\n"</span>, key);</td></tr> +<tr class="codeline" data-linenumber="365"><td class="num" id="LN365">365</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="366"><td class="num" id="LN366">366</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="367"><td class="num" id="LN367">367</td><td class="line"> g_debug (<span class='string_literal'>"No temp data for device: %s\n"</span>, key);</td></tr> +<tr class="codeline" data-linenumber="368"><td class="num" id="LN368">368</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="369"><td class="num" id="LN369">369</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="370"><td class="num" id="LN370">370</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="371"><td class="num" id="LN371">371</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"b4 free1"</span>);</td></tr> +<tr class="codeline" data-linenumber="372"><td class="num" id="LN372">372</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="373"><td class="num" id="LN373">373</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="374"><td class="num" id="LN374">374</td><td class="line"> g_free (id);</td></tr> +<tr class="codeline" data-linenumber="375"><td class="num" id="LN375">375</td><td class="line"> g_free (model);</td></tr> +<tr class="codeline" data-linenumber="376"><td class="num" id="LN376">376</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="377"><td class="num" id="LN377">377</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="378"><td class="num" id="LN378">378</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="379"><td class="num" id="LN379">379</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="380"><td class="num" id="LN380">380</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"b4 free2"</span>);</td></tr> +<tr class="codeline" data-linenumber="381"><td class="num" id="LN381">381</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="382"><td class="num" id="LN382">382</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="383"><td class="num" id="LN383">383</td><td class="line"> <span class='comment'>/* free propdict, propdict2</span></td></tr> +<tr class="codeline" data-linenumber="384"><td class="num" id="LN384">384</td><td class="line"> <span class='comment'>* g_variant_dict_unref() may not work a few times, gives error</span></td></tr> +<tr class="codeline" data-linenumber="385"><td class="num" id="LN385">385</td><td class="line"> <span class='comment'>* this one seems to do fine */</span></td></tr> +<tr class="codeline" data-linenumber="386"><td class="num" id="LN386">386</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict) {g_variant_unref (propdict);}</td></tr> +<tr class="codeline" data-linenumber="387"><td class="num" id="LN387">387</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict2) {g_variant_unref (propdict2);}</td></tr> +<tr class="codeline" data-linenumber="388"><td class="num" id="LN388">388</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="389"><td class="num" id="LN389">389</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="390"><td class="num" id="LN390">390</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"b4 free3"</span>);</td></tr> +<tr class="codeline" data-linenumber="391"><td class="num" id="LN391">391</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="392"><td class="num" id="LN392">392</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="393"><td class="num" id="LN393">393</td><td class="line"> g_free (key);</td></tr> +<tr class="codeline" data-linenumber="394"><td class="num" id="LN394">394</td><td class="line"> g_variant_unref (value);</td></tr> +<tr class="codeline" data-linenumber="395"><td class="num" id="LN395">395</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="396"><td class="num" id="LN396">396</td><td class="line"> } <span class='comment'>/* end of while loop */</span></td></tr> +<tr class="codeline" data-linenumber="397"><td class="num" id="LN397">397</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="398"><td class="num" id="LN398">398</td><td class="line"> g_variant_unref (managed_objects);</td></tr> +<tr class="codeline" data-linenumber="399"><td class="num" id="LN399">399</td><td class="line"> <span class='macro'>g_clear_object (&proxy)<span class='macro_popup'>do { _Static_assert (sizeof *((&proxy)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&proxy<br>))) _pp = ((&proxy)); __typeof__ (*((&proxy))) _ptr =<br> *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref) (_ptr); }<br> while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="400"><td class="num" id="LN400">400</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == devices) {</td></tr> +<tr class="codeline" data-linenumber="401"><td class="num" id="LN401">401</td><td class="line"> <span class='macro'>g_clear_object (&connection)<span class='macro_popup'>do { _Static_assert (sizeof *((&connection)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&connection<br>))) _pp = ((&connection)); __typeof__ (*((&connection<br>))) _ptr = *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref<br>) (_ptr); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="402"><td class="num" id="LN402">402</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="403"><td class="num" id="LN403">403</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="404"><td class="num" id="LN404">404</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="405"><td class="num" id="LN405">405</td><td class="line"><span class='comment'>/* this function is called every refresh cycle */</span></td></tr> +<tr class="codeline" data-linenumber="406"><td class="num" id="LN406">406</td><td class="line"><span class='keyword'>static</span> gdouble udisks2_plugin_get_sensor_value (<span class='keyword'>const</span> gchar *path,</td></tr> +<tr class="codeline" data-linenumber="407"><td class="num" id="LN407">407</td><td class="line"> <span class='keyword'>const</span> gchar *id,</td></tr> +<tr class="codeline" data-linenumber="408"><td class="num" id="LN408">408</td><td class="line"> SensorType type,</td></tr> +<tr class="codeline" data-linenumber="409"><td class="num" id="LN409">409</td><td class="line"> GError **error) {</td></tr> +<tr class="codeline" data-linenumber="410"><td class="num" id="LN410">410</td><td class="line"> DevInfo *info = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="411"><td class="num" id="LN411">411</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="412"><td class="num" id="LN412">412</td><td class="line"> <span class='comment'>/* get device stuct from data store */</span></td></tr> +<tr class="codeline" data-linenumber="413"><td class="num" id="LN413">413</td><td class="line"> info = (DevInfo *) g_hash_table_lookup (devices, path);</td></tr> +<tr class="codeline" data-linenumber="414"><td class="num" id="LN414">414</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == info) {</td></tr> +<tr class="codeline" data-linenumber="415"><td class="num" id="LN415">415</td><td class="line"> g_set_error (error, <span class='macro'>SENSORS_APPLET_PLUGIN_ERROR<span class='macro_popup'>(sensors_applet_plugin_error_quark())</span></span>, 0, <span class='string_literal'>"Error finding disk with path %s"</span>, path);</td></tr> +<tr class="codeline" data-linenumber="416"><td class="num" id="LN416">416</td><td class="line"> <span class='keyword'>return</span> 0.0;</td></tr> +<tr class="codeline" data-linenumber="417"><td class="num" id="LN417">417</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="418"><td class="num" id="LN418">418</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="419"><td class="num" id="LN419">419</td><td class="line"> <span class='keyword'>if</span> (info->error) {</td></tr> +<tr class="codeline" data-linenumber="420"><td class="num" id="LN420">420</td><td class="line"> *error = info->error;</td></tr> +<tr class="codeline" data-linenumber="421"><td class="num" id="LN421">421</td><td class="line"> info->error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="422"><td class="num" id="LN422">422</td><td class="line"> <span class='keyword'>return</span> 0.0;</td></tr> +<tr class="codeline" data-linenumber="423"><td class="num" id="LN423">423</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="424"><td class="num" id="LN424">424</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="425"><td class="num" id="LN425">425</td><td class="line"> <span class='comment'>/* refresh device temp */</span></td></tr> +<tr class="codeline" data-linenumber="426"><td class="num" id="LN426">426</td><td class="line"> update_device (info);</td></tr> +<tr class="codeline" data-linenumber="427"><td class="num" id="LN427">427</td><td class="line"> <span class='keyword'>return</span> info->temp;</td></tr> +<tr class="codeline" data-linenumber="428"><td class="num" id="LN428">428</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="429"><td class="num" id="LN429">429</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="430"><td class="num" id="LN430">430</td><td class="line"><span class='comment'>/* API functions */</span></td></tr> +<tr class="codeline" data-linenumber="431"><td class="num" id="LN431">431</td><td class="line"><span class='keyword'>const</span> gchar *sensors_applet_plugin_name (<span class='keyword'>void</span>) {</td></tr> +<tr class="codeline" data-linenumber="432"><td class="num" id="LN432">432</td><td class="line"> <span class='keyword'>return</span> plugin_name;</td></tr> +<tr class="codeline" data-linenumber="433"><td class="num" id="LN433">433</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="434"><td class="num" id="LN434">434</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="435"><td class="num" id="LN435">435</td><td class="line"><span class='keyword'>static</span> GList *udisks2_plugin_init (<span class='keyword'>void</span>) {</td></tr> +<tr class="codeline" data-linenumber="436"><td class="num" id="LN436">436</td><td class="line"> GList *sensors = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="437"><td class="num" id="LN437">437</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="438"><td class="num" id="LN438">438</td><td class="line"> udisks2_plugin_get_sensors (&sensors);</td></tr> +<tr class="codeline" data-linenumber="439"><td class="num" id="LN439">439</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="440"><td class="num" id="LN440">440</td><td class="line"> <span class='keyword'>return</span> sensors;</td></tr> +<tr class="codeline" data-linenumber="441"><td class="num" id="LN441">441</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="442"><td class="num" id="LN442">442</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="443"><td class="num" id="LN443">443</td><td class="line">GList *sensors_applet_plugin_init (<span class='keyword'>void</span>) {</td></tr> +<tr class="codeline" data-linenumber="444"><td class="num" id="LN444">444</td><td class="line"> <span class='keyword'>return</span> udisks2_plugin_init ();</td></tr> +<tr class="codeline" data-linenumber="445"><td class="num" id="LN445">445</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="446"><td class="num" id="LN446">446</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="447"><td class="num" id="LN447">447</td><td class="line">gdouble sensors_applet_plugin_get_sensor_value (<span class='keyword'>const</span> gchar *path,</td></tr> +<tr class="codeline" data-linenumber="448"><td class="num" id="LN448">448</td><td class="line"> <span class='keyword'>const</span> gchar *id,</td></tr> +<tr class="codeline" data-linenumber="449"><td class="num" id="LN449">449</td><td class="line"> SensorType type,</td></tr> +<tr class="codeline" data-linenumber="450"><td class="num" id="LN450">450</td><td class="line"> GError **error) {</td></tr> +<tr class="codeline" data-linenumber="451"><td class="num" id="LN451">451</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="452"><td class="num" id="LN452">452</td><td class="line"> <span class='keyword'>return</span> udisks2_plugin_get_sensor_value (path, id, type, error);</td></tr> +<tr class="codeline" data-linenumber="453"><td class="num" id="LN453">453</td><td class="line">}</td></tr> +</table></body></html> diff --git a/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-5f1566.html b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-5f1566.html new file mode 100644 index 0000000..6712b90 --- /dev/null +++ b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-5f1566.html @@ -0,0 +1,2005 @@ +<!doctype html> +<html> +<head> +<title>sensors-applet.c</title> + +<style type="text/css"> +body { color:#000000; background-color:#ffffff } +body { font-family:Helvetica, sans-serif; font-size:10pt } +h1 { font-size:14pt } +.FileName { margin-top: 5px; margin-bottom: 5px; display: inline; } +.FileNav { margin-left: 5px; margin-right: 5px; display: inline; } +.FileNav a { text-decoration:none; font-size: larger; } +.divider { margin-top: 30px; margin-bottom: 30px; height: 15px; } +.divider { background-color: gray; } +.code { border-collapse:collapse; width:100%; } +.code { font-family: "Monospace", monospace; font-size:10pt } +.code { line-height: 1.2em } +.comment { color: green; font-style: oblique } +.keyword { color: blue } +.string_literal { color: red } +.directive { color: darkmagenta } + +/* Macros and variables could have pop-up notes hidden by default. + - Macro pop-up: expansion of the macro + - Variable pop-up: value (table) of the variable */ +.macro_popup, .variable_popup { display: none; } + +/* Pop-up appears on mouse-hover event. */ +.macro:hover .macro_popup, .variable:hover .variable_popup { + display: block; + padding: 2px; + -webkit-border-radius:5px; + -webkit-box-shadow:1px 1px 7px #000; + border-radius:5px; + box-shadow:1px 1px 7px #000; + position: absolute; + top: -1em; + left:10em; + z-index: 1 +} + +.macro_popup { + border: 2px solid red; + background-color:#FFF0F0; + font-weight: normal; +} + +.variable_popup { + border: 2px solid blue; + background-color:#F0F0FF; + font-weight: bold; + font-family: Helvetica, sans-serif; + font-size: 9pt; +} + +/* Pop-up notes needs a relative position as a base where they pops up. */ +.macro, .variable { + background-color: PaleGoldenRod; + position: relative; +} +.macro { color: DarkMagenta; } + +#tooltiphint { + position: fixed; + width: 50em; + margin-left: -25em; + left: 50%; + padding: 10px; + border: 1px solid #b0b0b0; + border-radius: 2px; + box-shadow: 1px 1px 7px black; + background-color: #c0c0c0; + z-index: 2; +} + +.num { width:2.5em; padding-right:2ex; background-color:#eeeeee } +.num { text-align:right; font-size:8pt } +.num { color:#444444 } +.line { padding-left: 1ex; border-left: 3px solid #ccc } +.line { white-space: pre } +.msg { -webkit-box-shadow:1px 1px 7px #000 } +.msg { box-shadow:1px 1px 7px #000 } +.msg { -webkit-border-radius:5px } +.msg { border-radius:5px } +.msg { font-family:Helvetica, sans-serif; font-size:8pt } +.msg { float:left } +.msg { position:relative } +.msg { padding:0.25em 1ex 0.25em 1ex } +.msg { margin-top:10px; margin-bottom:10px } +.msg { font-weight:bold } +.msg { max-width:60em; word-wrap: break-word; white-space: pre-wrap } +.msgT { padding:0x; spacing:0x } +.msgEvent { background-color:#fff8b4; color:#000000 } +.msgControl { background-color:#bbbbbb; color:#000000 } +.msgNote { background-color:#ddeeff; color:#000000 } +.mrange { background-color:#dfddf3 } +.mrange { border-bottom:1px solid #6F9DBE } +.PathIndex { font-weight: bold; padding:0px 5px; margin-right:5px; } +.PathIndex { -webkit-border-radius:8px } +.PathIndex { border-radius:8px } +.PathIndexEvent { background-color:#bfba87 } +.PathIndexControl { background-color:#8c8c8c } +.PathIndexPopUp { background-color: #879abc; } +.PathNav a { text-decoration:none; font-size: larger } +.CodeInsertionHint { font-weight: bold; background-color: #10dd10 } +.CodeRemovalHint { background-color:#de1010 } +.CodeRemovalHint { border-bottom:1px solid #6F9DBE } +.msg.selected{ background-color:orange !important; } + +table.simpletable { + padding: 5px; + font-size:12pt; + margin:20px; + border-collapse: collapse; border-spacing: 0px; +} +td.rowname { + text-align: right; + vertical-align: top; + font-weight: bold; + color:#444444; + padding-right:2ex; +} + +/* Hidden text. */ +input.spoilerhider + label { + cursor: pointer; + text-decoration: underline; + display: block; +} +input.spoilerhider { + display: none; +} +input.spoilerhider ~ .spoiler { + overflow: hidden; + margin: 10px auto 0; + height: 0; + opacity: 0; +} +input.spoilerhider:checked + label + .spoiler{ + height: auto; + opacity: 1; +} +</style> +</head> +<body> +<!-- BUGDESC Value stored to 'not_empty_tree' is never read --> + +<!-- BUGTYPE Dead assignment --> + +<!-- BUGCATEGORY Unused code --> + +<!-- BUGFILE /rootdir/sensors-applet/sensors-applet.c --> + +<!-- FILENAME sensors-applet.c --> + +<!-- FUNCTIONNAME sensors_applet_add_sensor --> + +<!-- ISSUEHASHCONTENTOFLINEINCONTEXT 5f1566e639ef1083a056bb2d86cd69e7 --> + +<!-- BUGLINE 860 --> + +<!-- BUGCOLUMN 5 --> + +<!-- BUGPATHLENGTH 1 --> + +<!-- BUGMETAEND --> +<!-- REPORTHEADER --> +<h3>Bug Summary</h3> +<table class="simpletable"> +<tr><td class="rowname">File:</td><td>sensors-applet/sensors-applet.c</td></tr> +<tr><td class="rowname">Warning:</td><td><a href="#EndPath">line 860, column 5</a><br />Value stored to 'not_empty_tree' is never read</td></tr> + +</table> +<!-- REPORTSUMMARYEXTRA --> +<h3>Annotated Source Code</h3> +<p>Press <a href="#" onclick="toggleHelp(); return false;">'?'</a> + to see keyboard shortcuts</p> +<input type="checkbox" class="spoilerhider" id="showinvocation" /> +<label for="showinvocation" >Show analyzer invocation</label> +<div class="spoiler">clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name sensors-applet.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/sensors-applet -resource-dir /usr/lib64/clang/16 -D HAVE_CONFIG_H -I . -D MATELOCALEDIR="/usr/local/share/locale/" -D G_LOG_DOMAIN="sensors-applet" -D PIXMAPS_DIR="/usr/local/share/pixmaps/mate-sensors-applet/" -D DATADIR="/usr/local/share" -D LIBDIR="/usr/local/lib" -D UIDIR="/usr/local/share/mate-sensors-applet/ui" -D SENSORS_APPLET_PLUGIN_DIR="/usr/local/lib/mate-sensors-applet/plugins" -D SYSCONFDIR="/usr/local/etc" -D PREFIX="/usr/local" -I .. -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/mate-panel-4.0/libmate-panel-applet -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/cairo -I /usr/include/libpng16 -I /usr/include/freetype2 -I /usr/include/harfbuzz -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libxml2 -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -D PIC -internal-isystem /usr/lib64/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/sensors-applet -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2023-06-12-021133-6157-1 -x c sensors-applet.c +</div> +<div id='tooltiphint' hidden="true"> + <p>Keyboard shortcuts: </p> + <ul> + <li>Use 'j/k' keys for keyboard navigation</li> + <li>Use 'Shift+S' to show/hide relevant lines</li> + <li>Use '?' to toggle this window</li> + </ul> + <a href="#" onclick="toggleHelp(); return false;">Close</a> +</div> +<script type='text/javascript'> +var relevant_lines = {"1": {"860": 1}}; + +var filterCounterexample = function (hide) { + var tables = document.getElementsByClassName("code"); + for (var t=0; t<tables.length; t++) { + var table = tables[t]; + var file_id = table.getAttribute("data-fileid"); + var lines_in_fid = relevant_lines[file_id]; + if (!lines_in_fid) { + lines_in_fid = {}; + } + var lines = table.getElementsByClassName("codeline"); + for (var i=0; i<lines.length; i++) { + var el = lines[i]; + var lineNo = el.getAttribute("data-linenumber"); + if (!lines_in_fid[lineNo]) { + if (hide) { + el.setAttribute("hidden", ""); + } else { + el.removeAttribute("hidden"); + } + } + } + } +} + +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + // SHIFT + S + if (event.shiftKey && event.keyCode == 83) { + var checked = document.getElementsByName("showCounterexample")[0].checked; + filterCounterexample(!checked); + document.getElementsByName("showCounterexample")[0].click(); + } else { + return; + } + event.preventDefault(); +}, true); + +document.addEventListener("DOMContentLoaded", function() { + document.querySelector('input[name="showCounterexample"]').onchange= + function (event) { + filterCounterexample(this.checked); + }; +}); +</script> + +<form> + <input type="checkbox" name="showCounterexample" id="showCounterexample" /> + <label for="showCounterexample"> + Show only relevant lines + </label> + <input type="checkbox" name="showArrows" + id="showArrows" style="margin-left: 10px" /> + <label for="showArrows"> + Show control flow arrows + </label> +</form> + +<script type='text/javascript'> +// Return range of numbers from a range [lower, upper). +function range(lower, upper) { + var array = []; + for (var i = lower; i <= upper; ++i) { + array.push(i); + } + return array; +} + +var getRelatedArrowIndices = function(pathId) { + // HTML numeration of events is a bit different than it is in the path. + // Everything is rotated one step to the right, so the last element + // (error diagnostic) has index 0. + if (pathId == 0) { + // arrowIndices has at least 2 elements + pathId = arrowIndices.length - 1; + } + + return range(arrowIndices[pathId], arrowIndices[pathId - 1]); +} + +var highlightArrowsForSelectedEvent = function() { + const selectedNum = findNum(); + const arrowIndicesToHighlight = getRelatedArrowIndices(selectedNum); + arrowIndicesToHighlight.forEach((index) => { + var arrow = document.querySelector("#arrow" + index); + if(arrow) { + classListAdd(arrow, "selected") + } + }); +} + +var getAbsoluteBoundingRect = function(element) { + const relative = element.getBoundingClientRect(); + return { + left: relative.left + window.pageXOffset, + right: relative.right + window.pageXOffset, + top: relative.top + window.pageYOffset, + bottom: relative.bottom + window.pageYOffset, + height: relative.height, + width: relative.width + }; +} + +var drawArrow = function(index) { + // This function is based on the great answer from SO: + // https://stackoverflow.com/a/39575674/11582326 + var start = document.querySelector("#start" + index); + var end = document.querySelector("#end" + index); + var arrow = document.querySelector("#arrow" + index); + + var startRect = getAbsoluteBoundingRect(start); + var endRect = getAbsoluteBoundingRect(end); + + // It is an arrow from a token to itself, no need to visualize it. + if (startRect.top == endRect.top && + startRect.left == endRect.left) + return; + + // Each arrow is a very simple Bézier curve, with two nodes and + // two handles. So, we need to calculate four points in the window: + // * start node + var posStart = { x: 0, y: 0 }; + // * end node + var posEnd = { x: 0, y: 0 }; + // * handle for the start node + var startHandle = { x: 0, y: 0 }; + // * handle for the end node + var endHandle = { x: 0, y: 0 }; + // One can visualize it as follows: + // + // start handle + // / + // X"""_.-""""X + // .' \ + // / start node + // | + // | + // | end node + // \ / + // `->X + // X-' + // \ + // end handle + // + // NOTE: (0, 0) is the top left corner of the window. + + // We have 3 similar, but still different scenarios to cover: + // + // 1. Two tokens on different lines. + // -xxx + // / + // \ + // -> xxx + // In this situation, we draw arrow on the left curving to the left. + // 2. Two tokens on the same line, and the destination is on the right. + // ____ + // / \ + // / V + // xxx xxx + // In this situation, we draw arrow above curving upwards. + // 3. Two tokens on the same line, and the destination is on the left. + // xxx xxx + // ^ / + // \____/ + // In this situation, we draw arrow below curving downwards. + const onDifferentLines = startRect.top <= endRect.top - 5 || + startRect.top >= endRect.top + 5; + const leftToRight = startRect.left < endRect.left; + + // NOTE: various magic constants are chosen empirically for + // better positioning and look + if (onDifferentLines) { + // Case #1 + const topToBottom = startRect.top < endRect.top; + posStart.x = startRect.left - 1; + // We don't want to start it at the top left corner of the token, + // it doesn't feel like this is where the arrow comes from. + // For this reason, we start it in the middle of the left side + // of the token. + posStart.y = startRect.top + startRect.height / 2; + + // End node has arrow head and we give it a bit more space. + posEnd.x = endRect.left - 4; + posEnd.y = endRect.top; + + // Utility object with x and y offsets for handles. + var curvature = { + // We want bottom-to-top arrow to curve a bit more, so it doesn't + // overlap much with top-to-bottom curves (much more frequent). + x: topToBottom ? 15 : 25, + y: Math.min((posEnd.y - posStart.y) / 3, 10) + } + + // When destination is on the different line, we can make a + // curvier arrow because we have space for it. + // So, instead of using + // + // startHandle.x = posStart.x - curvature.x + // endHandle.x = posEnd.x - curvature.x + // + // We use the leftmost of these two values for both handles. + startHandle.x = Math.min(posStart.x, posEnd.x) - curvature.x; + endHandle.x = startHandle.x; + + // Curving downwards from the start node... + startHandle.y = posStart.y + curvature.y; + // ... and upwards from the end node. + endHandle.y = posEnd.y - curvature.y; + + } else if (leftToRight) { + // Case #2 + // Starting from the top right corner... + posStart.x = startRect.right - 1; + posStart.y = startRect.top; + + // ...and ending at the top left corner of the end token. + posEnd.x = endRect.left + 1; + posEnd.y = endRect.top - 1; + + // Utility object with x and y offsets for handles. + var curvature = { + x: Math.min((posEnd.x - posStart.x) / 3, 15), + y: 5 + } + + // Curving to the right... + startHandle.x = posStart.x + curvature.x; + // ... and upwards from the start node. + startHandle.y = posStart.y - curvature.y; + + // And to the left... + endHandle.x = posEnd.x - curvature.x; + // ... and upwards from the end node. + endHandle.y = posEnd.y - curvature.y; + + } else { + // Case #3 + // Starting from the bottom right corner... + posStart.x = startRect.right; + posStart.y = startRect.bottom; + + // ...and ending also at the bottom right corner, but of the end token. + posEnd.x = endRect.right - 1; + posEnd.y = endRect.bottom + 1; + + // Utility object with x and y offsets for handles. + var curvature = { + x: Math.min((posStart.x - posEnd.x) / 3, 15), + y: 5 + } + + // Curving to the left... + startHandle.x = posStart.x - curvature.x; + // ... and downwards from the start node. + startHandle.y = posStart.y + curvature.y; + + // And to the right... + endHandle.x = posEnd.x + curvature.x; + // ... and downwards from the end node. + endHandle.y = posEnd.y + curvature.y; + } + + // Put it all together into a path. + // More information on the format: + // https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths + var pathStr = "M" + posStart.x + "," + posStart.y + " " + + "C" + startHandle.x + "," + startHandle.y + " " + + endHandle.x + "," + endHandle.y + " " + + posEnd.x + "," + posEnd.y; + + arrow.setAttribute("d", pathStr); +}; + +var drawArrows = function() { + const numOfArrows = document.querySelectorAll("path[id^=arrow]").length; + for (var i = 0; i < numOfArrows; ++i) { + drawArrow(i); + } +} + +var toggleArrows = function(event) { + const arrows = document.querySelector("#arrows"); + if (event.target.checked) { + arrows.setAttribute("visibility", "visible"); + } else { + arrows.setAttribute("visibility", "hidden"); + } +} + +window.addEventListener("resize", drawArrows); +document.addEventListener("DOMContentLoaded", function() { + // Whenever we show invocation, locations change, i.e. we + // need to redraw arrows. + document + .querySelector('input[id="showinvocation"]') + .addEventListener("click", drawArrows); + // Hiding irrelevant lines also should cause arrow rerender. + document + .querySelector('input[name="showCounterexample"]') + .addEventListener("change", drawArrows); + document + .querySelector('input[name="showArrows"]') + .addEventListener("change", toggleArrows); + drawArrows(); + // Default highlighting for the last event. + highlightArrowsForSelectedEvent(); +}); +</script> + +<script type='text/javascript'> +var digitMatcher = new RegExp("[0-9]+"); + +var querySelectorAllArray = function(selector) { + return Array.prototype.slice.call( + document.querySelectorAll(selector)); +} + +document.addEventListener("DOMContentLoaded", function() { + querySelectorAllArray(".PathNav > a").forEach( + function(currentValue, currentIndex) { + var hrefValue = currentValue.getAttribute("href"); + currentValue.onclick = function() { + scrollTo(document.querySelector(hrefValue)); + return false; + }; + }); +}); + +var findNum = function() { + var s = document.querySelector(".msg.selected"); + if (!s || s.id == "EndPath") { + return 0; + } + var out = parseInt(digitMatcher.exec(s.id)[0]); + return out; +}; + +var classListAdd = function(el, theClass) { + if(!el.className.baseVal) + el.className += " " + theClass; + else + el.className.baseVal += " " + theClass; +}; + +var classListRemove = function(el, theClass) { + var className = (!el.className.baseVal) ? + el.className : el.className.baseVal; + className = className.replace(" " + theClass, ""); + if(!el.className.baseVal) + el.className = className; + else + el.className.baseVal = className; +}; + +var scrollTo = function(el) { + querySelectorAllArray(".selected").forEach(function(s) { + classListRemove(s, "selected"); + }); + classListAdd(el, "selected"); + window.scrollBy(0, el.getBoundingClientRect().top - + (window.innerHeight / 2)); + highlightArrowsForSelectedEvent(); +}; + +var move = function(num, up, numItems) { + if (num == 1 && up || num == numItems - 1 && !up) { + return 0; + } else if (num == 0 && up) { + return numItems - 1; + } else if (num == 0 && !up) { + return 1 % numItems; + } + return up ? num - 1 : num + 1; +} + +var numToId = function(num) { + if (num == 0) { + return document.getElementById("EndPath") + } + return document.getElementById("Path" + num); +}; + +var navigateTo = function(up) { + var numItems = document.querySelectorAll( + ".line > .msgEvent, .line > .msgControl").length; + var currentSelected = findNum(); + var newSelected = move(currentSelected, up, numItems); + var newEl = numToId(newSelected, numItems); + + // Scroll element into center. + scrollTo(newEl); +}; + +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + // key 'j' + if (event.keyCode == 74) { + navigateTo(/*up=*/false); + // key 'k' + } else if (event.keyCode == 75) { + navigateTo(/*up=*/true); + } else { + return; + } + event.preventDefault(); +}, true); +</script> + +<script type='text/javascript'> + +var toggleHelp = function() { + var hint = document.querySelector("#tooltiphint"); + var attributeName = "hidden"; + if (hint.hasAttribute(attributeName)) { + hint.removeAttribute(attributeName); + } else { + hint.setAttribute("hidden", "true"); + } +}; +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + if (event.key == "?") { + toggleHelp(); + } else { + return; + } + event.preventDefault(); +}); +</script> + +<style type="text/css"> + svg { + position:absolute; + top:0; + left:0; + height:100%; + width:100%; + pointer-events: none; + overflow: visible + } + .arrow { + stroke-opacity: 0.2; + stroke-width: 1; + marker-end: url(#arrowhead); + } + + .arrow.selected { + stroke-opacity: 0.6; + stroke-width: 2; + marker-end: url(#arrowheadSelected); + } + + .arrowhead { + orient: auto; + stroke: none; + opacity: 0.6; + fill: blue; + } +</style> +<svg xmlns="http://www.w3.org/2000/svg"> + <defs> + <marker id="arrowheadSelected" class="arrowhead" opacity="0.6" + viewBox="0 0 10 10" refX="3" refY="5" + markerWidth="4" markerHeight="4"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + <marker id="arrowhead" class="arrowhead" opacity="0.2" + viewBox="0 0 10 10" refX="3" refY="5" + markerWidth="4" markerHeight="4"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + </defs> + <g id="arrows" fill="none" stroke="blue" visibility="hidden"> + + </g> +</svg> +<script type='text/javascript'> +const arrowIndices = [ 0,0 ] +</script> +<table class="code" data-fileid="1"> +<tr class="codeline" data-linenumber="1"><td class="num" id="LN1">1</td><td class="line"><span class='comment'>/*</span></td></tr> +<tr class="codeline" data-linenumber="2"><td class="num" id="LN2">2</td><td class="line"> <span class='comment'>* Copyright (C) 2005-2009 Alex Murray <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="3"><td class="num" id="LN3">3</td><td class="line"> <span class='comment'>* Copyright (C) 2012-2021 MATE Developers</span></td></tr> +<tr class="codeline" data-linenumber="4"><td class="num" id="LN4">4</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="5"><td class="num" id="LN5">5</td><td class="line"> <span class='comment'>* This program is free software; you can redistribute it and/or modify</span></td></tr> +<tr class="codeline" data-linenumber="6"><td class="num" id="LN6">6</td><td class="line"> <span class='comment'>* it under the terms of the GNU General Public License as published by</span></td></tr> +<tr class="codeline" data-linenumber="7"><td class="num" id="LN7">7</td><td class="line"> <span class='comment'>* the Free Software Foundation; either version 2 of the License, or</span></td></tr> +<tr class="codeline" data-linenumber="8"><td class="num" id="LN8">8</td><td class="line"> <span class='comment'>* (at your option) any later version.</span></td></tr> +<tr class="codeline" data-linenumber="9"><td class="num" id="LN9">9</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="10"><td class="num" id="LN10">10</td><td class="line"> <span class='comment'>* This program is distributed in the hope that it will be useful,</span></td></tr> +<tr class="codeline" data-linenumber="11"><td class="num" id="LN11">11</td><td class="line"> <span class='comment'>* but WITHOUT ANY WARRANTY; without even the implied warranty of</span></td></tr> +<tr class="codeline" data-linenumber="12"><td class="num" id="LN12">12</td><td class="line"> <span class='comment'>* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></td></tr> +<tr class="codeline" data-linenumber="13"><td class="num" id="LN13">13</td><td class="line"> <span class='comment'>* GNU General Public License for more details.</span></td></tr> +<tr class="codeline" data-linenumber="14"><td class="num" id="LN14">14</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="15"><td class="num" id="LN15">15</td><td class="line"> <span class='comment'>* You should have received a copy of the GNU General Public License</span></td></tr> +<tr class="codeline" data-linenumber="16"><td class="num" id="LN16">16</td><td class="line"> <span class='comment'>* along with this program; if not, write to the Free Software</span></td></tr> +<tr class="codeline" data-linenumber="17"><td class="num" id="LN17">17</td><td class="line"> <span class='comment'>* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</span></td></tr> +<tr class="codeline" data-linenumber="18"><td class="num" id="LN18">18</td><td class="line"> <span class='comment'>*/</span></td></tr> +<tr class="codeline" data-linenumber="19"><td class="num" id="LN19">19</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="20"><td class="num" id="LN20">20</td><td class="line"><span class='comment'>/** Contain the functions for operating on the SensorsApplet structure</span></td></tr> +<tr class="codeline" data-linenumber="21"><td class="num" id="LN21">21</td><td class="line"> <span class='comment'>* (represents the applet itself, and its associated variables.</span></td></tr> +<tr class="codeline" data-linenumber="22"><td class="num" id="LN22">22</td><td class="line"> <span class='comment'>*/</span></td></tr> +<tr class="codeline" data-linenumber="23"><td class="num" id="LN23">23</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="24"><td class="num" id="LN24">24</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_CONFIG_H<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="25"><td class="num" id="LN25">25</td><td class="line"><span class='directive'>#include "config.h"</span></td></tr> +<tr class="codeline" data-linenumber="26"><td class="num" id="LN26">26</td><td class="line"><span class='directive'>#endif /* HAVE_CONFIG_H */</span></td></tr> +<tr class="codeline" data-linenumber="27"><td class="num" id="LN27">27</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="28"><td class="num" id="LN28">28</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_UNISTD_H<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="29"><td class="num" id="LN29">29</td><td class="line"><span class='directive'>#include <unistd.h></span></td></tr> +<tr class="codeline" data-linenumber="30"><td class="num" id="LN30">30</td><td class="line"><span class='directive'>#endif /* HAVE_UNISTD_H */</span></td></tr> +<tr class="codeline" data-linenumber="31"><td class="num" id="LN31">31</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="32"><td class="num" id="LN32">32</td><td class="line"><span class='directive'>#include <glib/gi18n.h></span></td></tr> +<tr class="codeline" data-linenumber="33"><td class="num" id="LN33">33</td><td class="line"><span class='directive'>#include <glib/gprintf.h></span></td></tr> +<tr class="codeline" data-linenumber="34"><td class="num" id="LN34">34</td><td class="line"><span class='directive'>#include <gio/gio.h></span></td></tr> +<tr class="codeline" data-linenumber="35"><td class="num" id="LN35">35</td><td class="line"><span class='directive'>#include "sensors-applet.h"</span></td></tr> +<tr class="codeline" data-linenumber="36"><td class="num" id="LN36">36</td><td class="line"><span class='directive'>#include "active-sensor.h"</span></td></tr> +<tr class="codeline" data-linenumber="37"><td class="num" id="LN37">37</td><td class="line"><span class='directive'>#include "sensors-applet-settings.h"</span></td></tr> +<tr class="codeline" data-linenumber="38"><td class="num" id="LN38">38</td><td class="line"><span class='directive'>#include "sensors-applet-plugins.h"</span></td></tr> +<tr class="codeline" data-linenumber="39"><td class="num" id="LN39">39</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="40"><td class="num" id="LN40">40</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_LIBNOTIFY<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="41"><td class="num" id="LN41">41</td><td class="line"><span class='directive'>#include "active-sensor-libnotify.h"</span></td></tr> +<tr class="codeline" data-linenumber="42"><td class="num" id="LN42">42</td><td class="line"><span class='directive'>#define <span class='macro'>DEFAULT_NOTIFY_TIMEOUT<span class='macro_popup'>3000</span></span> 3000</span></td></tr> +<tr class="codeline" data-linenumber="43"><td class="num" id="LN43">43</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="44"><td class="num" id="LN44">44</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="45"><td class="num" id="LN45">45</td><td class="line"><span class='directive'>#include "prefs-dialog.h"</span></td></tr> +<tr class="codeline" data-linenumber="46"><td class="num" id="LN46">46</td><td class="line"><span class='directive'>#include "about-dialog.h"</span></td></tr> +<tr class="codeline" data-linenumber="47"><td class="num" id="LN47">47</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="48"><td class="num" id="LN48">48</td><td class="line"><span class='directive'>#define <span class='macro'>SENSORS_APPLET_MENU_FILE<span class='macro_popup'>"SensorsApplet.xml"</span></span> "SensorsApplet.xml"</span></td></tr> +<tr class="codeline" data-linenumber="49"><td class="num" id="LN49">49</td><td class="line"><span class='comment'>/* initially set as sensors_applet->size to ensure a real value is stored */</span></td></tr> +<tr class="codeline" data-linenumber="50"><td class="num" id="LN50">50</td><td class="line"><span class='directive'>#define <span class='macro'>DEFAULT_APPLET_SIZE<span class='macro_popup'>24</span></span> 24</span></td></tr> +<tr class="codeline" data-linenumber="51"><td class="num" id="LN51">51</td><td class="line"><span class='directive'>#define <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span> 2</span></td></tr> +<tr class="codeline" data-linenumber="52"><td class="num" id="LN52">52</td><td class="line"><span class='directive'>#define <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span> 1</span></td></tr> +<tr class="codeline" data-linenumber="53"><td class="num" id="LN53">53</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="54"><td class="num" id="LN54">54</td><td class="line"><span class='comment'>/* builder for sensor sorting verification */</span></td></tr> +<tr class="codeline" data-linenumber="55"><td class="num" id="LN55">55</td><td class="line"><span class='keyword'>static</span> GVariantBuilder gvb_sensors_hash_list;</td></tr> +<tr class="codeline" data-linenumber="56"><td class="num" id="LN56">56</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="57"><td class="num" id="LN57">57</td><td class="line"><span class='comment'>/* callbacks for panel menu */</span></td></tr> +<tr class="codeline" data-linenumber="58"><td class="num" id="LN58">58</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> prefs_cb(GtkAction *action, gpointer *data) {</td></tr> +<tr class="codeline" data-linenumber="59"><td class="num" id="LN59">59</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="60"><td class="num" id="LN60">60</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="61"><td class="num" id="LN61">61</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="62"><td class="num" id="LN62">62</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="63"><td class="num" id="LN63">63</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->prefs_dialog) {</td></tr> +<tr class="codeline" data-linenumber="64"><td class="num" id="LN64">64</td><td class="line"> gtk_window_present(<span class='macro'>GTK_WINDOW(sensors_applet->prefs_dialog->dialog)<span class='macro_popup'>((((GtkWindow*) (void *) ((sensors_applet->prefs_dialog-><br>dialog)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="65"><td class="num" id="LN65">65</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="66"><td class="num" id="LN66">66</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="67"><td class="num" id="LN67">67</td><td class="line"> prefs_dialog_open(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="68"><td class="num" id="LN68">68</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="69"><td class="num" id="LN69">69</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="70"><td class="num" id="LN70">70</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> about_cb(GtkAction *action, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="71"><td class="num" id="LN71">71</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="72"><td class="num" id="LN72">72</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="73"><td class="num" id="LN73">73</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="74"><td class="num" id="LN74">74</td><td class="line"> about_dialog_open(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="75"><td class="num" id="LN75">75</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="76"><td class="num" id="LN76">76</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="77"><td class="num" id="LN77">77</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> help_cb(GtkAction *action, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="78"><td class="num" id="LN78">78</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="79"><td class="num" id="LN79">79</td><td class="line"> GError *error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="80"><td class="num" id="LN80">80</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="81"><td class="num" id="LN81">81</td><td class="line"> gtk_show_uri_on_window(<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='string_literal'>"help:mate-sensors-applet"</span>,</td></tr> +<tr class="codeline" data-linenumber="82"><td class="num" id="LN82">82</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="83"><td class="num" id="LN83">83</td><td class="line"> gtk_get_current_event_time(),</td></tr> +<tr class="codeline" data-linenumber="84"><td class="num" id="LN84">84</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="85"><td class="num" id="LN85">85</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="86"><td class="num" id="LN86">86</td><td class="line"> <span class='keyword'>if</span> (error) {</td></tr> +<tr class="codeline" data-linenumber="87"><td class="num" id="LN87">87</td><td class="line"> g_debug(<span class='string_literal'>"Could not open help document: %s "</span>,error->message);</td></tr> +<tr class="codeline" data-linenumber="88"><td class="num" id="LN88">88</td><td class="line"> g_error_free(error);</td></tr> +<tr class="codeline" data-linenumber="89"><td class="num" id="LN89">89</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="90"><td class="num" id="LN90">90</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="91"><td class="num" id="LN91">91</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="92"><td class="num" id="LN92">92</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> destroy_cb(GtkWidget *widget, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="93"><td class="num" id="LN93">93</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="94"><td class="num" id="LN94">94</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="95"><td class="num" id="LN95">95</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="96"><td class="num" id="LN96">96</td><td class="line"> <span class='comment'>/* destroy dialogs, remove timeout and clear sensors tree and finally the applet */</span></td></tr> +<tr class="codeline" data-linenumber="97"><td class="num" id="LN97">97</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->prefs_dialog != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="98"><td class="num" id="LN98">98</td><td class="line"> <span class='comment'>/* destroy's dialog too */</span></td></tr> +<tr class="codeline" data-linenumber="99"><td class="num" id="LN99">99</td><td class="line"> prefs_dialog_close(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="100"><td class="num" id="LN100">100</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="101"><td class="num" id="LN101">101</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="102"><td class="num" id="LN102">102</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->timeout_id) {</td></tr> +<tr class="codeline" data-linenumber="103"><td class="num" id="LN103">103</td><td class="line"> g_source_remove(sensors_applet->timeout_id);</td></tr> +<tr class="codeline" data-linenumber="104"><td class="num" id="LN104">104</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="105"><td class="num" id="LN105">105</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="106"><td class="num" id="LN106">106</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->settings) {</td></tr> +<tr class="codeline" data-linenumber="107"><td class="num" id="LN107">107</td><td class="line"> g_object_unref (sensors_applet->settings);</td></tr> +<tr class="codeline" data-linenumber="108"><td class="num" id="LN108">108</td><td class="line"> sensors_applet->settings = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="109"><td class="num" id="LN109">109</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="110"><td class="num" id="LN110">110</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="111"><td class="num" id="LN111">111</td><td class="line"> <span class='comment'>/* destroy all active sensors */</span></td></tr> +<tr class="codeline" data-linenumber="112"><td class="num" id="LN112">112</td><td class="line"> g_list_foreach(sensors_applet->active_sensors,</td></tr> +<tr class="codeline" data-linenumber="113"><td class="num" id="LN113">113</td><td class="line"> (GFunc)active_sensor_destroy,</td></tr> +<tr class="codeline" data-linenumber="114"><td class="num" id="LN114">114</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="115"><td class="num" id="LN115">115</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="116"><td class="num" id="LN116">116</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->sensors != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="117"><td class="num" id="LN117">117</td><td class="line"> gtk_tree_store_clear(sensors_applet->sensors);</td></tr> +<tr class="codeline" data-linenumber="118"><td class="num" id="LN118">118</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="119"><td class="num" id="LN119">119</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="120"><td class="num" id="LN120">120</td><td class="line"> gtk_widget_destroy(<span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="121"><td class="num" id="LN121">121</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="122"><td class="num" id="LN122">122</td><td class="line"> g_free(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="123"><td class="num" id="LN123">123</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="124"><td class="num" id="LN124">124</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="125"><td class="num" id="LN125">125</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="126"><td class="num" id="LN126">126</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> change_orient_cb (MatePanelApplet *applet,</td></tr> +<tr class="codeline" data-linenumber="127"><td class="num" id="LN127">127</td><td class="line"> MatePanelAppletOrient orient,</td></tr> +<tr class="codeline" data-linenumber="128"><td class="num" id="LN128">128</td><td class="line"> gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="129"><td class="num" id="LN129">129</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="130"><td class="num" id="LN130">130</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="131"><td class="num" id="LN131">131</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="132"><td class="num" id="LN132">132</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="133"><td class="num" id="LN133">133</td><td class="line"> sensors_applet_display_layout_changed(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="134"><td class="num" id="LN134">134</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="135"><td class="num" id="LN135">135</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="136"><td class="num" id="LN136">136</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> size_allocate_cb(MatePanelApplet *applet,</td></tr> +<tr class="codeline" data-linenumber="137"><td class="num" id="LN137">137</td><td class="line"> GtkAllocation *allocation,</td></tr> +<tr class="codeline" data-linenumber="138"><td class="num" id="LN138">138</td><td class="line"> gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="139"><td class="num" id="LN139">139</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="140"><td class="num" id="LN140">140</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="141"><td class="num" id="LN141">141</td><td class="line"> MatePanelAppletOrient orient;</td></tr> +<tr class="codeline" data-linenumber="142"><td class="num" id="LN142">142</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="143"><td class="num" id="LN143">143</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="144"><td class="num" id="LN144">144</td><td class="line"> orient = mate_panel_applet_get_orient(sensors_applet->applet);</td></tr> +<tr class="codeline" data-linenumber="145"><td class="num" id="LN145">145</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="146"><td class="num" id="LN146">146</td><td class="line"> <span class='keyword'>if</span> ((orient == MATE_PANEL_APPLET_ORIENT_LEFT) ||</td></tr> +<tr class="codeline" data-linenumber="147"><td class="num" id="LN147">147</td><td class="line"> (orient == MATE_PANEL_APPLET_ORIENT_RIGHT)) {</td></tr> +<tr class="codeline" data-linenumber="148"><td class="num" id="LN148">148</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="149"><td class="num" id="LN149">149</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->size == allocation->width)</td></tr> +<tr class="codeline" data-linenumber="150"><td class="num" id="LN150">150</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="151"><td class="num" id="LN151">151</td><td class="line"> sensors_applet->size = allocation->width;</td></tr> +<tr class="codeline" data-linenumber="152"><td class="num" id="LN152">152</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="153"><td class="num" id="LN153">153</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->size == allocation->height)</td></tr> +<tr class="codeline" data-linenumber="154"><td class="num" id="LN154">154</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="155"><td class="num" id="LN155">155</td><td class="line"> sensors_applet->size = allocation->height;</td></tr> +<tr class="codeline" data-linenumber="156"><td class="num" id="LN156">156</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="157"><td class="num" id="LN157">157</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="158"><td class="num" id="LN158">158</td><td class="line"> <span class='comment'>/* update if new value */</span></td></tr> +<tr class="codeline" data-linenumber="159"><td class="num" id="LN159">159</td><td class="line"> sensors_applet_graph_size_changed(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="160"><td class="num" id="LN160">160</td><td class="line"> sensors_applet_display_layout_changed(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="161"><td class="num" id="LN161">161</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="162"><td class="num" id="LN162">162</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="163"><td class="num" id="LN163">163</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> style_set_cb(GtkWidget *widget, GtkStyle *old_style, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="164"><td class="num" id="LN164">164</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="165"><td class="num" id="LN165">165</td><td class="line"> <span class='comment'>/* update all icons in the sensors tree and update all active sensors */</span></td></tr> +<tr class="codeline" data-linenumber="166"><td class="num" id="LN166">166</td><td class="line"> GtkTreeIter interfaces_iter, sensors_iter;</td></tr> +<tr class="codeline" data-linenumber="167"><td class="num" id="LN167">167</td><td class="line"> gboolean not_end_of_interfaces = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>, not_end_of_sensors = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="168"><td class="num" id="LN168">168</td><td class="line"> IconType icon_type;</td></tr> +<tr class="codeline" data-linenumber="169"><td class="num" id="LN169">169</td><td class="line"> gboolean enabled;</td></tr> +<tr class="codeline" data-linenumber="170"><td class="num" id="LN170">170</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="171"><td class="num" id="LN171">171</td><td class="line"> DisplayMode display_mode;</td></tr> +<tr class="codeline" data-linenumber="172"><td class="num" id="LN172">172</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="173"><td class="num" id="LN173">173</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="174"><td class="num" id="LN174">174</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="175"><td class="num" id="LN175">175</td><td class="line"> display_mode = g_settings_get_int (sensors_applet->settings, <span class='macro'>DISPLAY_MODE<span class='macro_popup'>"display-mode"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="176"><td class="num" id="LN176">176</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->sensors) {</td></tr> +<tr class="codeline" data-linenumber="177"><td class="num" id="LN177">177</td><td class="line"> <span class='keyword'>for</span> (gtk_tree_model_get_iter_first(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &interfaces_iter);</td></tr> +<tr class="codeline" data-linenumber="178"><td class="num" id="LN178">178</td><td class="line"> not_end_of_interfaces;</td></tr> +<tr class="codeline" data-linenumber="179"><td class="num" id="LN179">179</td><td class="line"> not_end_of_interfaces = gtk_tree_model_iter_next(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &interfaces_iter)) {</td></tr> +<tr class="codeline" data-linenumber="180"><td class="num" id="LN180">180</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="181"><td class="num" id="LN181">181</td><td class="line"> <span class='comment'>/* reset sensors sentinel */</span></td></tr> +<tr class="codeline" data-linenumber="182"><td class="num" id="LN182">182</td><td class="line"> not_end_of_sensors = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="183"><td class="num" id="LN183">183</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="184"><td class="num" id="LN184">184</td><td class="line"> <span class='keyword'>for</span> (gtk_tree_model_iter_children(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter, &interfaces_iter);</td></tr> +<tr class="codeline" data-linenumber="185"><td class="num" id="LN185">185</td><td class="line"> not_end_of_sensors;</td></tr> +<tr class="codeline" data-linenumber="186"><td class="num" id="LN186">186</td><td class="line"> not_end_of_sensors = gtk_tree_model_iter_next(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter)) {</td></tr> +<tr class="codeline" data-linenumber="187"><td class="num" id="LN187">187</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="188"><td class="num" id="LN188">188</td><td class="line"> GdkPixbuf *new_icon;</td></tr> +<tr class="codeline" data-linenumber="189"><td class="num" id="LN189">189</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="190"><td class="num" id="LN190">190</td><td class="line"> gtk_tree_model_get(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="191"><td class="num" id="LN191">191</td><td class="line"> &sensors_iter,</td></tr> +<tr class="codeline" data-linenumber="192"><td class="num" id="LN192">192</td><td class="line"> ENABLE_COLUMN, &enabled,</td></tr> +<tr class="codeline" data-linenumber="193"><td class="num" id="LN193">193</td><td class="line"> ICON_TYPE_COLUMN, &icon_type,</td></tr> +<tr class="codeline" data-linenumber="194"><td class="num" id="LN194">194</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="195"><td class="num" id="LN195">195</td><td class="line"> <span class='comment'>/* update icons */</span></td></tr> +<tr class="codeline" data-linenumber="196"><td class="num" id="LN196">196</td><td class="line"> new_icon = sensors_applet_load_icon(icon_type);</td></tr> +<tr class="codeline" data-linenumber="197"><td class="num" id="LN197">197</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="198"><td class="num" id="LN198">198</td><td class="line"> gtk_tree_store_set(sensors_applet->sensors,</td></tr> +<tr class="codeline" data-linenumber="199"><td class="num" id="LN199">199</td><td class="line"> &sensors_iter,</td></tr> +<tr class="codeline" data-linenumber="200"><td class="num" id="LN200">200</td><td class="line"> ICON_PIXBUF_COLUMN, new_icon,</td></tr> +<tr class="codeline" data-linenumber="201"><td class="num" id="LN201">201</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="202"><td class="num" id="LN202">202</td><td class="line"> g_object_unref(new_icon);</td></tr> +<tr class="codeline" data-linenumber="203"><td class="num" id="LN203">203</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="204"><td class="num" id="LN204">204</td><td class="line"> <span class='comment'>/* update icons only if currently being displayed */</span></td></tr> +<tr class="codeline" data-linenumber="205"><td class="num" id="LN205">205</td><td class="line"> <span class='keyword'>if</span> (enabled &&</td></tr> +<tr class="codeline" data-linenumber="206"><td class="num" id="LN206">206</td><td class="line"> (display_mode == DISPLAY_ICON ||</td></tr> +<tr class="codeline" data-linenumber="207"><td class="num" id="LN207">207</td><td class="line"> display_mode == DISPLAY_ICON_WITH_VALUE)) {</td></tr> +<tr class="codeline" data-linenumber="208"><td class="num" id="LN208">208</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="209"><td class="num" id="LN209">209</td><td class="line"> GtkTreePath *path;</td></tr> +<tr class="codeline" data-linenumber="210"><td class="num" id="LN210">210</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="211"><td class="num" id="LN211">211</td><td class="line"> path = gtk_tree_model_get_path(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter);</td></tr> +<tr class="codeline" data-linenumber="212"><td class="num" id="LN212">212</td><td class="line"> sensors_applet_icon_changed(sensors_applet, path);</td></tr> +<tr class="codeline" data-linenumber="213"><td class="num" id="LN213">213</td><td class="line"> gtk_tree_path_free(path);</td></tr> +<tr class="codeline" data-linenumber="214"><td class="num" id="LN214">214</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="215"><td class="num" id="LN215">215</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="216"><td class="num" id="LN216">216</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="217"><td class="num" id="LN217">217</td><td class="line"> <span class='comment'>/* now update layout as size may have changed */</span></td></tr> +<tr class="codeline" data-linenumber="218"><td class="num" id="LN218">218</td><td class="line"> sensors_applet_display_layout_changed(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="219"><td class="num" id="LN219">219</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="220"><td class="num" id="LN220">220</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="221"><td class="num" id="LN221">221</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="222"><td class="num" id="LN222">222</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="223"><td class="num" id="LN223">223</td><td class="line"><span class='keyword'>static</span> gboolean mouse_enter_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data)</td></tr> +<tr class="codeline" data-linenumber="224"><td class="num" id="LN224">224</td><td class="line">{</td></tr> +<tr class="codeline" data-linenumber="225"><td class="num" id="LN225">225</td><td class="line"> SensorsApplet *sensor_applet = data;</td></tr> +<tr class="codeline" data-linenumber="226"><td class="num" id="LN226">226</td><td class="line"> sensor_applet->show_tooltip = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="227"><td class="num" id="LN227">227</td><td class="line"> sensors_applet_update_active_sensors(sensor_applet);</td></tr> +<tr class="codeline" data-linenumber="228"><td class="num" id="LN228">228</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="229"><td class="num" id="LN229">229</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="230"><td class="num" id="LN230">230</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="231"><td class="num" id="LN231">231</td><td class="line"><span class='keyword'>static</span> gboolean mouse_leave_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data)</td></tr> +<tr class="codeline" data-linenumber="232"><td class="num" id="LN232">232</td><td class="line">{</td></tr> +<tr class="codeline" data-linenumber="233"><td class="num" id="LN233">233</td><td class="line"> SensorsApplet *sensor_applet = data;</td></tr> +<tr class="codeline" data-linenumber="234"><td class="num" id="LN234">234</td><td class="line"> sensor_applet->show_tooltip = <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="235"><td class="num" id="LN235">235</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="236"><td class="num" id="LN236">236</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="237"><td class="num" id="LN237">237</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="238"><td class="num" id="LN238">238</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>const</span> GtkActionEntry sensors_applet_menu_actions[] = {</td></tr> +<tr class="codeline" data-linenumber="239"><td class="num" id="LN239">239</td><td class="line"> { <span class='string_literal'>"Preferences"</span>, <span class='string_literal'>"document-properties"</span>, <span class='macro'>N_(<span class='string_literal'>"_Preferences"</span>)<span class='macro_popup'>("_Preferences")</span></span>,</td></tr> +<tr class="codeline" data-linenumber="240"><td class="num" id="LN240">240</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="241"><td class="num" id="LN241">241</td><td class="line"> <span class='macro'>G_CALLBACK(prefs_cb)<span class='macro_popup'>((GCallback) (prefs_cb))</span></span> },</td></tr> +<tr class="codeline" data-linenumber="242"><td class="num" id="LN242">242</td><td class="line"> { <span class='string_literal'>"Help"</span>, <span class='string_literal'>"help-browser"</span>, <span class='macro'>N_(<span class='string_literal'>"_Help"</span>)<span class='macro_popup'>("_Help")</span></span>,</td></tr> +<tr class="codeline" data-linenumber="243"><td class="num" id="LN243">243</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="244"><td class="num" id="LN244">244</td><td class="line"> <span class='macro'>G_CALLBACK(help_cb)<span class='macro_popup'>((GCallback) (help_cb))</span></span> },</td></tr> +<tr class="codeline" data-linenumber="245"><td class="num" id="LN245">245</td><td class="line"> { <span class='string_literal'>"About"</span>, <span class='string_literal'>"help-about"</span>, <span class='macro'>N_(<span class='string_literal'>"_About"</span>)<span class='macro_popup'>("_About")</span></span>,</td></tr> +<tr class="codeline" data-linenumber="246"><td class="num" id="LN246">246</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="247"><td class="num" id="LN247">247</td><td class="line"> <span class='macro'>G_CALLBACK(about_cb)<span class='macro_popup'>((GCallback) (about_cb))</span></span> }</td></tr> +<tr class="codeline" data-linenumber="248"><td class="num" id="LN248">248</td><td class="line">};</td></tr> +<tr class="codeline" data-linenumber="249"><td class="num" id="LN249">249</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="250"><td class="num" id="LN250">250</td><td class="line"><span class='keyword'>void</span> sensors_applet_notify_active_sensor(ActiveSensor *active_sensor, NotifType notif_type) {</td></tr> +<tr class="codeline" data-linenumber="251"><td class="num" id="LN251">251</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_LIBNOTIFY<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="252"><td class="num" id="LN252">252</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="253"><td class="num" id="LN253">253</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="254"><td class="num" id="LN254">254</td><td class="line"> gchar *summary, *message;</td></tr> +<tr class="codeline" data-linenumber="255"><td class="num" id="LN255">255</td><td class="line"> gint timeout_msecs;</td></tr> +<tr class="codeline" data-linenumber="256"><td class="num" id="LN256">256</td><td class="line"> gchar *sensor_label;</td></tr> +<tr class="codeline" data-linenumber="257"><td class="num" id="LN257">257</td><td class="line"> gchar *sensor_path;</td></tr> +<tr class="codeline" data-linenumber="258"><td class="num" id="LN258">258</td><td class="line"> SensorType sensor_type;</td></tr> +<tr class="codeline" data-linenumber="259"><td class="num" id="LN259">259</td><td class="line"> TemperatureScale temp_scale;</td></tr> +<tr class="codeline" data-linenumber="260"><td class="num" id="LN260">260</td><td class="line"> GtkTreeIter iter;</td></tr> +<tr class="codeline" data-linenumber="261"><td class="num" id="LN261">261</td><td class="line"> GtkTreePath *path;</td></tr> +<tr class="codeline" data-linenumber="262"><td class="num" id="LN262">262</td><td class="line"> <span class='keyword'>const</span> gchar *unit_type = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="263"><td class="num" id="LN263">263</td><td class="line"> <span class='keyword'>const</span> gchar *unit_type_title = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="264"><td class="num" id="LN264">264</td><td class="line"> <span class='keyword'>const</span> gchar *relation = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="265"><td class="num" id="LN265">265</td><td class="line"> <span class='keyword'>const</span> gchar *limit_type = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="266"><td class="num" id="LN266">266</td><td class="line"> <span class='keyword'>const</span> gchar *units = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="267"><td class="num" id="LN267">267</td><td class="line"> gdouble limit_value;</td></tr> +<tr class="codeline" data-linenumber="268"><td class="num" id="LN268">268</td><td class="line"> gdouble seconds;</td></tr> +<tr class="codeline" data-linenumber="269"><td class="num" id="LN269">269</td><td class="line"> gboolean show_notification = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="270"><td class="num" id="LN270">270</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="271"><td class="num" id="LN271">271</td><td class="line"> sensors_applet = active_sensor->sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="272"><td class="num" id="LN272">272</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="273"><td class="num" id="LN273">273</td><td class="line"> <span class='keyword'>if</span> (!g_settings_get_boolean (sensors_applet->settings, <span class='macro'>DISPLAY_NOTIFICATIONS<span class='macro_popup'>"display-notifications"</span></span>)) {</td></tr> +<tr class="codeline" data-linenumber="274"><td class="num" id="LN274">274</td><td class="line"> g_debug(<span class='string_literal'>"Wanted to display notification, but user has disabled them"</span>);</td></tr> +<tr class="codeline" data-linenumber="275"><td class="num" id="LN275">275</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="276"><td class="num" id="LN276">276</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="277"><td class="num" id="LN277">277</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="278"><td class="num" id="LN278">278</td><td class="line"> path = gtk_tree_row_reference_get_path(active_sensor->sensor_row);</td></tr> +<tr class="codeline" data-linenumber="279"><td class="num" id="LN279">279</td><td class="line"> <span class='keyword'>if</span> (gtk_tree_model_get_iter(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &iter, path)) {</td></tr> +<tr class="codeline" data-linenumber="280"><td class="num" id="LN280">280</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="281"><td class="num" id="LN281">281</td><td class="line"> gtk_tree_model_get(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &iter,</td></tr> +<tr class="codeline" data-linenumber="282"><td class="num" id="LN282">282</td><td class="line"> LABEL_COLUMN, &sensor_label,</td></tr> +<tr class="codeline" data-linenumber="283"><td class="num" id="LN283">283</td><td class="line"> PATH_COLUMN, &sensor_path,</td></tr> +<tr class="codeline" data-linenumber="284"><td class="num" id="LN284">284</td><td class="line"> SENSOR_TYPE_COLUMN, &sensor_type,</td></tr> +<tr class="codeline" data-linenumber="285"><td class="num" id="LN285">285</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="286"><td class="num" id="LN286">286</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="287"><td class="num" id="LN287">287</td><td class="line"> g_warning(<span class='string_literal'>"Error getting data from tree for notification..."</span>);</td></tr> +<tr class="codeline" data-linenumber="288"><td class="num" id="LN288">288</td><td class="line"> gtk_tree_path_free(path);</td></tr> +<tr class="codeline" data-linenumber="289"><td class="num" id="LN289">289</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="290"><td class="num" id="LN290">290</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="291"><td class="num" id="LN291">291</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="292"><td class="num" id="LN292">292</td><td class="line"> gtk_tree_path_free(path);</td></tr> +<tr class="codeline" data-linenumber="293"><td class="num" id="LN293">293</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="294"><td class="num" id="LN294">294</td><td class="line"> <span class='comment'>/* do different stuff for different notif types */</span></td></tr> +<tr class="codeline" data-linenumber="295"><td class="num" id="LN295">295</td><td class="line"> <span class='keyword'>switch</span> (notif_type) {</td></tr> +<tr class="codeline" data-linenumber="296"><td class="num" id="LN296">296</td><td class="line"> <span class='keyword'>case</span> LOW_ALARM: <span class='comment'>/* fall thru */</span></td></tr> +<tr class="codeline" data-linenumber="297"><td class="num" id="LN297">297</td><td class="line"> <span class='keyword'>case</span> HIGH_ALARM:</td></tr> +<tr class="codeline" data-linenumber="298"><td class="num" id="LN298">298</td><td class="line"> <span class='keyword'>if</span> (active_sensor->sensor_values[0] <= active_sensor->sensor_low_value && notif_type == LOW_ALARM) {</td></tr> +<tr class="codeline" data-linenumber="299"><td class="num" id="LN299">299</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="300"><td class="num" id="LN300">300</td><td class="line"> relation = <span class='macro'>_(<span class='string_literal'>"is very low"</span>)<span class='macro_popup'>dcgettext (((void*)0), "is very low", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="301"><td class="num" id="LN301">301</td><td class="line"> limit_type = <span class='macro'>_(<span class='string_literal'>"lower limit"</span>)<span class='macro_popup'>dcgettext (((void*)0), "lower limit", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="302"><td class="num" id="LN302">302</td><td class="line"> limit_value = active_sensor->sensor_low_value;</td></tr> +<tr class="codeline" data-linenumber="303"><td class="num" id="LN303">303</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (active_sensor->sensor_values[0] >= active_sensor->sensor_high_value && notif_type == HIGH_ALARM) {</td></tr> +<tr class="codeline" data-linenumber="304"><td class="num" id="LN304">304</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="305"><td class="num" id="LN305">305</td><td class="line"> <span class='comment'>/* assume high alarm condition */</span></td></tr> +<tr class="codeline" data-linenumber="306"><td class="num" id="LN306">306</td><td class="line"> relation = <span class='macro'>_(<span class='string_literal'>"is very high"</span>)<span class='macro_popup'>dcgettext (((void*)0), "is very high", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="307"><td class="num" id="LN307">307</td><td class="line"> limit_type = <span class='macro'>_(<span class='string_literal'>"upper limit"</span>)<span class='macro_popup'>dcgettext (((void*)0), "upper limit", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="308"><td class="num" id="LN308">308</td><td class="line"> limit_value = active_sensor->sensor_high_value;</td></tr> +<tr class="codeline" data-linenumber="309"><td class="num" id="LN309">309</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="310"><td class="num" id="LN310">310</td><td class="line"> g_warning(<span class='string_literal'>"Alarm notify called when no alarm condition!"</span>);</td></tr> +<tr class="codeline" data-linenumber="311"><td class="num" id="LN311">311</td><td class="line"> g_free(sensor_path);</td></tr> +<tr class="codeline" data-linenumber="312"><td class="num" id="LN312">312</td><td class="line"> g_free(sensor_label);</td></tr> +<tr class="codeline" data-linenumber="313"><td class="num" id="LN313">313</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="314"><td class="num" id="LN314">314</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="315"><td class="num" id="LN315">315</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="316"><td class="num" id="LN316">316</td><td class="line"> <span class='keyword'>switch</span> ((SensorType)sensor_type) {</td></tr> +<tr class="codeline" data-linenumber="317"><td class="num" id="LN317">317</td><td class="line"> <span class='keyword'>case</span> TEMP_SENSOR:</td></tr> +<tr class="codeline" data-linenumber="318"><td class="num" id="LN318">318</td><td class="line"> unit_type_title = <span class='macro'>_(<span class='string_literal'>"Temperature"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Temperature", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="319"><td class="num" id="LN319">319</td><td class="line"> unit_type = <span class='macro'>_(<span class='string_literal'>"temperature"</span>)<span class='macro_popup'>dcgettext (((void*)0), "temperature", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="320"><td class="num" id="LN320">320</td><td class="line"> temp_scale = (TemperatureScale) g_settings_get_int (active_sensor->sensors_applet->settings, <span class='macro'>TEMPERATURE_SCALE<span class='macro_popup'>"temperature-scale"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="321"><td class="num" id="LN321">321</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="322"><td class="num" id="LN322">322</td><td class="line"> <span class='keyword'>switch</span> (temp_scale) {</td></tr> +<tr class="codeline" data-linenumber="323"><td class="num" id="LN323">323</td><td class="line"> <span class='keyword'>case</span> CELSIUS:</td></tr> +<tr class="codeline" data-linenumber="324"><td class="num" id="LN324">324</td><td class="line"> units = <span class='macro'>UNITS_CELSIUS<span class='macro_popup'>"\302\260C"</span></span>;</td></tr> +<tr class="codeline" data-linenumber="325"><td class="num" id="LN325">325</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="326"><td class="num" id="LN326">326</td><td class="line"> <span class='keyword'>case</span> FAHRENHEIT:</td></tr> +<tr class="codeline" data-linenumber="327"><td class="num" id="LN327">327</td><td class="line"> units = <span class='macro'>UNITS_FAHRENHEIT<span class='macro_popup'>"\302\260F"</span></span>;</td></tr> +<tr class="codeline" data-linenumber="328"><td class="num" id="LN328">328</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="329"><td class="num" id="LN329">329</td><td class="line"> <span class='keyword'>case</span> KELVIN:</td></tr> +<tr class="codeline" data-linenumber="330"><td class="num" id="LN330">330</td><td class="line"> units = <span class='macro'>UNITS_KELVIN<span class='macro_popup'>""</span></span>;</td></tr> +<tr class="codeline" data-linenumber="331"><td class="num" id="LN331">331</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="332"><td class="num" id="LN332">332</td><td class="line"> <span class='keyword'>default</span>:</td></tr> +<tr class="codeline" data-linenumber="333"><td class="num" id="LN333">333</td><td class="line"> units = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="334"><td class="num" id="LN334">334</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="335"><td class="num" id="LN335">335</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="336"><td class="num" id="LN336">336</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="337"><td class="num" id="LN337">337</td><td class="line"> <span class='keyword'>case</span> VOLTAGE_SENSOR:</td></tr> +<tr class="codeline" data-linenumber="338"><td class="num" id="LN338">338</td><td class="line"> unit_type_title = <span class='macro'>_(<span class='string_literal'>"Voltage"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Voltage", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="339"><td class="num" id="LN339">339</td><td class="line"> unit_type = <span class='macro'>_(<span class='string_literal'>"voltage"</span>)<span class='macro_popup'>dcgettext (((void*)0), "voltage", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="340"><td class="num" id="LN340">340</td><td class="line"> units = <span class='macro'>UNITS_VOLTAGE<span class='macro_popup'>dcgettext (((void*)0), "V", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="341"><td class="num" id="LN341">341</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="342"><td class="num" id="LN342">342</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="343"><td class="num" id="LN343">343</td><td class="line"> <span class='keyword'>case</span> FAN_SENSOR:</td></tr> +<tr class="codeline" data-linenumber="344"><td class="num" id="LN344">344</td><td class="line"> unit_type_title = <span class='macro'>_(<span class='string_literal'>"Fan Speed"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Fan Speed", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="345"><td class="num" id="LN345">345</td><td class="line"> unit_type = <span class='macro'>_(<span class='string_literal'>"fan speed"</span>)<span class='macro_popup'>dcgettext (((void*)0), "fan speed", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="346"><td class="num" id="LN346">346</td><td class="line"> units = <span class='macro'>UNITS_RPM<span class='macro_popup'>dcgettext (((void*)0), "RPM", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="347"><td class="num" id="LN347">347</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="348"><td class="num" id="LN348">348</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="349"><td class="num" id="LN349">349</td><td class="line"> <span class='keyword'>case</span> CURRENT_SENSOR:</td></tr> +<tr class="codeline" data-linenumber="350"><td class="num" id="LN350">350</td><td class="line"> unit_type_title = <span class='macro'>_(<span class='string_literal'>"Current"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Current", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="351"><td class="num" id="LN351">351</td><td class="line"> unit_type = <span class='macro'>_(<span class='string_literal'>"current"</span>)<span class='macro_popup'>dcgettext (((void*)0), "current", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="352"><td class="num" id="LN352">352</td><td class="line"> units = <span class='macro'>UNITS_CURRENT<span class='macro_popup'>dcgettext (((void*)0), "A", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="353"><td class="num" id="LN353">353</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="354"><td class="num" id="LN354">354</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="355"><td class="num" id="LN355">355</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="356"><td class="num" id="LN356">356</td><td class="line"> timeout_msecs = (active_sensor->alarm_timeout ? <span class='macro'>MIN(DEFAULT_NOTIFY_TIMEOUT, (active_sensor->alarm_timeout * 1000))<span class='macro_popup'>(((3000) < ((active_sensor->alarm_timeout * 1000))) ? (<br>3000) : ((active_sensor->alarm_timeout * 1000)))</span></span> : <span class='macro'>DEFAULT_NOTIFY_TIMEOUT<span class='macro_popup'>3000</span></span>);</td></tr> +<tr class="codeline" data-linenumber="357"><td class="num" id="LN357">357</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="358"><td class="num" id="LN358">358</td><td class="line"> summary = g_strdup_printf(<span class='string_literal'>"%s %s %s"</span>, sensor_label, unit_type_title, <span class='macro'>_(<span class='string_literal'>"Alarm"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Alarm", 5)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="359"><td class="num" id="LN359">359</td><td class="line"> message = g_strdup_printf(<span class='string_literal'>"%s %s %s (%s %2.0f%s)"</span>, sensor_label, unit_type, relation, limit_type, limit_value, units);</td></tr> +<tr class="codeline" data-linenumber="360"><td class="num" id="LN360">360</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="361"><td class="num" id="LN361">361</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="362"><td class="num" id="LN362">362</td><td class="line"> <span class='keyword'>case</span> SENSOR_INTERFACE_ERROR:</td></tr> +<tr class="codeline" data-linenumber="363"><td class="num" id="LN363">363</td><td class="line"> <span class='comment'>/* get time since the last error */</span></td></tr> +<tr class="codeline" data-linenumber="364"><td class="num" id="LN364">364</td><td class="line"> seconds = difftime(time(<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>), active_sensor->ierror_ts);</td></tr> +<tr class="codeline" data-linenumber="365"><td class="num" id="LN365">365</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="366"><td class="num" id="LN366">366</td><td class="line"> <span class='comment'>/* if the last error happened less than 10 seconds ago, don't display this one</span></td></tr> +<tr class="codeline" data-linenumber="367"><td class="num" id="LN367">367</td><td class="line"> <span class='comment'>* this should prevent recurring popups for removed sensors, like USB-HDDs */</span></td></tr> +<tr class="codeline" data-linenumber="368"><td class="num" id="LN368">368</td><td class="line"> <span class='keyword'>if</span> (seconds < 11.0) {</td></tr> +<tr class="codeline" data-linenumber="369"><td class="num" id="LN369">369</td><td class="line"> show_notification = <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="370"><td class="num" id="LN370">370</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="371"><td class="num" id="LN371">371</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="372"><td class="num" id="LN372">372</td><td class="line"> summary = g_strdup_printf(<span class='macro'>_(<span class='string_literal'>"Error updating sensor %s"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Error updating sensor %s", 5)</span></span>, sensor_label);</td></tr> +<tr class="codeline" data-linenumber="373"><td class="num" id="LN373">373</td><td class="line"> message = g_strdup_printf(<span class='macro'>_(<span class='string_literal'>"An error occurred while trying to update the value of the sensor %s located at %s."</span>)<span class='macro_popup'>dcgettext (((void*)0), "An error occurred while trying to update the value of the sensor %s located at %s."<br>, 5)</span></span>, sensor_label, sensor_path);</td></tr> +<tr class="codeline" data-linenumber="374"><td class="num" id="LN374">374</td><td class="line"> timeout_msecs = g_settings_get_int (active_sensor->sensors_applet->settings, <span class='macro'>TIMEOUT<span class='macro_popup'>"timeout-delay"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="375"><td class="num" id="LN375">375</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="376"><td class="num" id="LN376">376</td><td class="line"> <span class='comment'>/* update timestamp */</span></td></tr> +<tr class="codeline" data-linenumber="377"><td class="num" id="LN377">377</td><td class="line"> time(&(active_sensor->ierror_ts));</td></tr> +<tr class="codeline" data-linenumber="378"><td class="num" id="LN378">378</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="379"><td class="num" id="LN379">379</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="380"><td class="num" id="LN380">380</td><td class="line"> <span class='keyword'>default</span>:</td></tr> +<tr class="codeline" data-linenumber="381"><td class="num" id="LN381">381</td><td class="line"> <span class='macro'>g_assert_not_reached()<span class='macro_popup'>do { g_assertion_message_expr ("sensors-applet", "sensors-applet.c"<br>, 381, ((const char*) (__func__)), ((void*)0)); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="382"><td class="num" id="LN382">382</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="383"><td class="num" id="LN383">383</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="384"><td class="num" id="LN384">384</td><td class="line"> <span class='keyword'>if</span> (show_notification) {</td></tr> +<tr class="codeline" data-linenumber="385"><td class="num" id="LN385">385</td><td class="line"> active_sensor_libnotify_notify(active_sensor,</td></tr> +<tr class="codeline" data-linenumber="386"><td class="num" id="LN386">386</td><td class="line"> notif_type,</td></tr> +<tr class="codeline" data-linenumber="387"><td class="num" id="LN387">387</td><td class="line"> summary,</td></tr> +<tr class="codeline" data-linenumber="388"><td class="num" id="LN388">388</td><td class="line"> message,</td></tr> +<tr class="codeline" data-linenumber="389"><td class="num" id="LN389">389</td><td class="line"> <span class='string_literal'>"dialog-warning"</span>,</td></tr> +<tr class="codeline" data-linenumber="390"><td class="num" id="LN390">390</td><td class="line"> timeout_msecs);</td></tr> +<tr class="codeline" data-linenumber="391"><td class="num" id="LN391">391</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="392"><td class="num" id="LN392">392</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="393"><td class="num" id="LN393">393</td><td class="line"> g_free(sensor_path);</td></tr> +<tr class="codeline" data-linenumber="394"><td class="num" id="LN394">394</td><td class="line"> g_free(sensor_label);</td></tr> +<tr class="codeline" data-linenumber="395"><td class="num" id="LN395">395</td><td class="line"> g_free(summary);</td></tr> +<tr class="codeline" data-linenumber="396"><td class="num" id="LN396">396</td><td class="line"> g_free(message);</td></tr> +<tr class="codeline" data-linenumber="397"><td class="num" id="LN397">397</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="398"><td class="num" id="LN398">398</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="399"><td class="num" id="LN399">399</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="400"><td class="num" id="LN400">400</td><td class="line"><span class='keyword'>void</span> sensors_applet_notify_end(ActiveSensor *active_sensor, NotifType notif_type) {</td></tr> +<tr class="codeline" data-linenumber="401"><td class="num" id="LN401">401</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_LIBNOTIFY<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="402"><td class="num" id="LN402">402</td><td class="line"> active_sensor_libnotify_notify_end(active_sensor, notif_type);</td></tr> +<tr class="codeline" data-linenumber="403"><td class="num" id="LN403">403</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="404"><td class="num" id="LN404">404</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="405"><td class="num" id="LN405">405</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="406"><td class="num" id="LN406">406</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_LIBNOTIFY<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="407"><td class="num" id="LN407">407</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> sensors_applet_notify_end_all_gfunc(ActiveSensor *active_sensor, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="408"><td class="num" id="LN408">408</td><td class="line"> active_sensor_libnotify_notify_end(active_sensor, LOW_ALARM);</td></tr> +<tr class="codeline" data-linenumber="409"><td class="num" id="LN409">409</td><td class="line"> active_sensor_libnotify_notify_end(active_sensor, HIGH_ALARM);</td></tr> +<tr class="codeline" data-linenumber="410"><td class="num" id="LN410">410</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="411"><td class="num" id="LN411">411</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="412"><td class="num" id="LN412">412</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="413"><td class="num" id="LN413">413</td><td class="line"><span class='keyword'>void</span> sensors_applet_notify_end_all(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="414"><td class="num" id="LN414">414</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_LIBNOTIFY<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="415"><td class="num" id="LN415">415</td><td class="line"> g_list_foreach(sensors_applet->active_sensors, (GFunc)sensors_applet_notify_end_all_gfunc, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="416"><td class="num" id="LN416">416</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="417"><td class="num" id="LN417">417</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="418"><td class="num" id="LN418">418</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="419"><td class="num" id="LN419">419</td><td class="line"><span class='comment'>/* internal helper functions for updating display etc */</span></td></tr> +<tr class="codeline" data-linenumber="420"><td class="num" id="LN420">420</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="421"><td class="num" id="LN421">421</td><td class="line"><span class='comment'>/* should be called as a g_container_foreach at the start of</span></td></tr> +<tr class="codeline" data-linenumber="422"><td class="num" id="LN422">422</td><td class="line"> <span class='comment'>* pack_display if the grid already exists to remove but keep alive</span></td></tr> +<tr class="codeline" data-linenumber="423"><td class="num" id="LN423">423</td><td class="line"> <span class='comment'>* all children of the grid before repacking it */</span></td></tr> +<tr class="codeline" data-linenumber="424"><td class="num" id="LN424">424</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> sensors_applet_pack_display_empty_grid_cb(GtkWidget *widget, gpointer data)</td></tr> +<tr class="codeline" data-linenumber="425"><td class="num" id="LN425">425</td><td class="line">{</td></tr> +<tr class="codeline" data-linenumber="426"><td class="num" id="LN426">426</td><td class="line"> GtkContainer *container;</td></tr> +<tr class="codeline" data-linenumber="427"><td class="num" id="LN427">427</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="428"><td class="num" id="LN428">428</td><td class="line"> container = <span class='macro'>GTK_CONTAINER(data)<span class='macro_popup'>((((GtkContainer*) (void *) ((data)))))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="429"><td class="num" id="LN429">429</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="430"><td class="num" id="LN430">430</td><td class="line"> <span class='comment'>/* ref then remove widget */</span></td></tr> +<tr class="codeline" data-linenumber="431"><td class="num" id="LN431">431</td><td class="line"> <span class='macro'>g_object_ref(widget)<span class='macro_popup'>((__typeof__ (widget)) (g_object_ref) (widget))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="432"><td class="num" id="LN432">432</td><td class="line"> gtk_container_remove(container, widget);</td></tr> +<tr class="codeline" data-linenumber="433"><td class="num" id="LN433">433</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="434"><td class="num" id="LN434">434</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="435"><td class="num" id="LN435">435</td><td class="line"><span class='comment'>/* should be called as a g_container_foreach at the end of</span></td></tr> +<tr class="codeline" data-linenumber="436"><td class="num" id="LN436">436</td><td class="line"> <span class='comment'>* pack_display to unref any of the old children that we have readdded</span></td></tr> +<tr class="codeline" data-linenumber="437"><td class="num" id="LN437">437</td><td class="line"> <span class='comment'>* to the table to stop reference creep from the g_object_ref called</span></td></tr> +<tr class="codeline" data-linenumber="438"><td class="num" id="LN438">438</td><td class="line"> <span class='comment'>* on each child at the start of pack labels */</span></td></tr> +<tr class="codeline" data-linenumber="439"><td class="num" id="LN439">439</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> sensors_applet_pack_display_cleanup_refs_cb(GtkWidget *widget, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="440"><td class="num" id="LN440">440</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="441"><td class="num" id="LN441">441</td><td class="line"> GList *old_children;</td></tr> +<tr class="codeline" data-linenumber="442"><td class="num" id="LN442">442</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="443"><td class="num" id="LN443">443</td><td class="line"> old_children = (GList *)data;</td></tr> +<tr class="codeline" data-linenumber="444"><td class="num" id="LN444">444</td><td class="line"> <span class='keyword'>if</span> (g_list_find(old_children, widget)) {</td></tr> +<tr class="codeline" data-linenumber="445"><td class="num" id="LN445">445</td><td class="line"> g_object_unref(widget);</td></tr> +<tr class="codeline" data-linenumber="446"><td class="num" id="LN446">446</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="447"><td class="num" id="LN447">447</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="448"><td class="num" id="LN448">448</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="449"><td class="num" id="LN449">449</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> sensors_applet_pack_display(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="450"><td class="num" id="LN450">450</td><td class="line"> <span class='comment'>/* note the if () around each widget is to ensure we only</span></td></tr> +<tr class="codeline" data-linenumber="451"><td class="num" id="LN451">451</td><td class="line"> <span class='comment'>* operate on those that actually exist */</span></td></tr> +<tr class="codeline" data-linenumber="452"><td class="num" id="LN452">452</td><td class="line"> GtkLabel *no_sensors_enabled_label = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="453"><td class="num" id="LN453">453</td><td class="line"> gint num_active_sensors = 0, num_sensors_per_group = 0, rows, cols, i, j;</td></tr> +<tr class="codeline" data-linenumber="454"><td class="num" id="LN454">454</td><td class="line"> GList *old_grid_children = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="455"><td class="num" id="LN455">455</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="456"><td class="num" id="LN456">456</td><td class="line"> GList *current_sensor;</td></tr> +<tr class="codeline" data-linenumber="457"><td class="num" id="LN457">457</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="458"><td class="num" id="LN458">458</td><td class="line"> DisplayMode display_mode;</td></tr> +<tr class="codeline" data-linenumber="459"><td class="num" id="LN459">459</td><td class="line"> LayoutMode layout_mode;</td></tr> +<tr class="codeline" data-linenumber="460"><td class="num" id="LN460">460</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="461"><td class="num" id="LN461">461</td><td class="line"> gboolean horizontal;</td></tr> +<tr class="codeline" data-linenumber="462"><td class="num" id="LN462">462</td><td class="line"> gint label_width, icon_width, value_width;</td></tr> +<tr class="codeline" data-linenumber="463"><td class="num" id="LN463">463</td><td class="line"> gint label_height, icon_height, value_height;</td></tr> +<tr class="codeline" data-linenumber="464"><td class="num" id="LN464">464</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="465"><td class="num" id="LN465">465</td><td class="line"> GtkRequisition req;</td></tr> +<tr class="codeline" data-linenumber="466"><td class="num" id="LN466">466</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="467"><td class="num" id="LN467">467</td><td class="line"> ActiveSensor *first_sensor;</td></tr> +<tr class="codeline" data-linenumber="468"><td class="num" id="LN468">468</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="469"><td class="num" id="LN469">469</td><td class="line"> <span class='comment'>/* it is possible that there could be no active sensors so</span></td></tr> +<tr class="codeline" data-linenumber="470"><td class="num" id="LN470">470</td><td class="line"> <span class='comment'>* handle that case first - make sure we dont do a NULL</span></td></tr> +<tr class="codeline" data-linenumber="471"><td class="num" id="LN471">471</td><td class="line"> <span class='comment'>* pointer access first though */</span></td></tr> +<tr class="codeline" data-linenumber="472"><td class="num" id="LN472">472</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->active_sensors == <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> || g_list_length(sensors_applet->active_sensors) == 0) {</td></tr> +<tr class="codeline" data-linenumber="473"><td class="num" id="LN473">473</td><td class="line"> g_debug(<span class='string_literal'>"no active sensors to pack in grid"</span>);</td></tr> +<tr class="codeline" data-linenumber="474"><td class="num" id="LN474">474</td><td class="line"> no_sensors_enabled_label = g_object_new(<span class='macro'>GTK_TYPE_LABEL<span class='macro_popup'>(gtk_label_get_type ())</span></span>, <span class='string_literal'>"label"</span>, <span class='macro'>_(<span class='string_literal'>"No sensors enabled!"</span>)<span class='macro_popup'>dcgettext (((void*)0), "No sensors enabled!", 5)</span></span>, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="475"><td class="num" id="LN475">475</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="476"><td class="num" id="LN476">476</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->grid == <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="477"><td class="num" id="LN477">477</td><td class="line"> <span class='comment'>/* only need 1 row and 1 col */</span></td></tr> +<tr class="codeline" data-linenumber="478"><td class="num" id="LN478">478</td><td class="line"> sensors_applet->grid = gtk_grid_new();</td></tr> +<tr class="codeline" data-linenumber="479"><td class="num" id="LN479">479</td><td class="line"> gtk_grid_set_column_spacing(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>, <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>);</td></tr> +<tr class="codeline" data-linenumber="480"><td class="num" id="LN480">480</td><td class="line"> gtk_grid_set_row_spacing(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>, <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>);</td></tr> +<tr class="codeline" data-linenumber="481"><td class="num" id="LN481">481</td><td class="line"> gtk_widget_set_halign(sensors_applet->grid, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="482"><td class="num" id="LN482">482</td><td class="line"> gtk_widget_set_valign(sensors_applet->grid, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="483"><td class="num" id="LN483">483</td><td class="line"> <span class='comment'>/* add grid to applet */</span></td></tr> +<tr class="codeline" data-linenumber="484"><td class="num" id="LN484">484</td><td class="line"> gtk_container_add(<span class='macro'>GTK_CONTAINER(sensors_applet->applet)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->applet)))))</span></span>, sensors_applet->grid);</td></tr> +<tr class="codeline" data-linenumber="485"><td class="num" id="LN485">485</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="486"><td class="num" id="LN486">486</td><td class="line"> <span class='comment'>/* destroy existing widgets - could be an</span></td></tr> +<tr class="codeline" data-linenumber="487"><td class="num" id="LN487">487</td><td class="line"> <span class='comment'>* existing version of no sensors label - okay</span></td></tr> +<tr class="codeline" data-linenumber="488"><td class="num" id="LN488">488</td><td class="line"> <span class='comment'>* to just add again though if destroy first */</span></td></tr> +<tr class="codeline" data-linenumber="489"><td class="num" id="LN489">489</td><td class="line"> g_debug(<span class='string_literal'>"destroying any existing widgets in container"</span>);</td></tr> +<tr class="codeline" data-linenumber="490"><td class="num" id="LN490">490</td><td class="line"> gtk_container_foreach(<span class='macro'>GTK_CONTAINER(sensors_applet->grid)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->grid)))))</span></span>, (GtkCallback)gtk_widget_destroy, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="491"><td class="num" id="LN491">491</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="492"><td class="num" id="LN492">492</td><td class="line"> g_debug(<span class='string_literal'>"packing no sensors enabled label"</span>);</td></tr> +<tr class="codeline" data-linenumber="493"><td class="num" id="LN493">493</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="494"><td class="num" id="LN494">494</td><td class="line"> <span class='macro'>GTK_WIDGET(no_sensors_enabled_label)<span class='macro_popup'>((((GtkWidget*) (void *) ((no_sensors_enabled_label)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="495"><td class="num" id="LN495">495</td><td class="line"> 0, 0, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="496"><td class="num" id="LN496">496</td><td class="line"> gtk_widget_show_all(<span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="497"><td class="num" id="LN497">497</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="498"><td class="num" id="LN498">498</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="499"><td class="num" id="LN499">499</td><td class="line"> <span class='comment'>/* otherwise can acess active_sensors without any worries */</span></td></tr> +<tr class="codeline" data-linenumber="500"><td class="num" id="LN500">500</td><td class="line"> num_active_sensors = g_list_length(sensors_applet->active_sensors);</td></tr> +<tr class="codeline" data-linenumber="501"><td class="num" id="LN501">501</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="502"><td class="num" id="LN502">502</td><td class="line"> display_mode = (DisplayMode) g_settings_get_int (sensors_applet->settings, <span class='macro'>DISPLAY_MODE<span class='macro_popup'>"display-mode"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="503"><td class="num" id="LN503">503</td><td class="line"> layout_mode = (LayoutMode) g_settings_get_int (sensors_applet->settings, <span class='macro'>LAYOUT_MODE<span class='macro_popup'>"layout-mode"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="504"><td class="num" id="LN504">504</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="505"><td class="num" id="LN505">505</td><td class="line"> horizontal = (((mate_panel_applet_get_orient(sensors_applet->applet) == MATE_PANEL_APPLET_ORIENT_UP) ||</td></tr> +<tr class="codeline" data-linenumber="506"><td class="num" id="LN506">506</td><td class="line"> (mate_panel_applet_get_orient(sensors_applet->applet) == MATE_PANEL_APPLET_ORIENT_DOWN)));</td></tr> +<tr class="codeline" data-linenumber="507"><td class="num" id="LN507">507</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="508"><td class="num" id="LN508">508</td><td class="line"> <span class='comment'>/* figure out num rows / cols by how high / wide sensors</span></td></tr> +<tr class="codeline" data-linenumber="509"><td class="num" id="LN509">509</td><td class="line"> <span class='comment'>* labels / icons are and how much size we have to put them in */</span></td></tr> +<tr class="codeline" data-linenumber="510"><td class="num" id="LN510">510</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="511"><td class="num" id="LN511">511</td><td class="line"> <span class='comment'>/* get the first active sensor */</span></td></tr> +<tr class="codeline" data-linenumber="512"><td class="num" id="LN512">512</td><td class="line"> first_sensor = (ActiveSensor *)sensors_applet->active_sensors->data;</td></tr> +<tr class="codeline" data-linenumber="513"><td class="num" id="LN513">513</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="514"><td class="num" id="LN514">514</td><td class="line"> <span class='keyword'>switch</span> (display_mode) {</td></tr> +<tr class="codeline" data-linenumber="515"><td class="num" id="LN515">515</td><td class="line"> <span class='keyword'>case</span> DISPLAY_VALUE:</td></tr> +<tr class="codeline" data-linenumber="516"><td class="num" id="LN516">516</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->value)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->value)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="517"><td class="num" id="LN517">517</td><td class="line"> value_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="518"><td class="num" id="LN518">518</td><td class="line"> value_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="519"><td class="num" id="LN519">519</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="520"><td class="num" id="LN520">520</td><td class="line"> <span class='comment'>/* make sure all widths and heights are non zero,</span></td></tr> +<tr class="codeline" data-linenumber="521"><td class="num" id="LN521">521</td><td class="line"> <span class='comment'>* otherwise will get a divide by zero exception below</span></td></tr> +<tr class="codeline" data-linenumber="522"><td class="num" id="LN522">522</td><td class="line"> <span class='comment'>* - is a non critical error since can happen when</span></td></tr> +<tr class="codeline" data-linenumber="523"><td class="num" id="LN523">523</td><td class="line"> <span class='comment'>* elements first added to list, so simply return - is</span></td></tr> +<tr class="codeline" data-linenumber="524"><td class="num" id="LN524">524</td><td class="line"> <span class='comment'>* not a programming error */</span></td></tr> +<tr class="codeline" data-linenumber="525"><td class="num" id="LN525">525</td><td class="line"> <span class='keyword'>if</span> (value_width == 0 && value_height == 0) {</td></tr> +<tr class="codeline" data-linenumber="526"><td class="num" id="LN526">526</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="527"><td class="num" id="LN527">527</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="528"><td class="num" id="LN528">528</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="529"><td class="num" id="LN529">529</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? value_height : value_width));</td></tr> +<tr class="codeline" data-linenumber="530"><td class="num" id="LN530">530</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="531"><td class="num" id="LN531">531</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="532"><td class="num" id="LN532">532</td><td class="line"> <span class='keyword'>case</span> DISPLAY_LABEL_WITH_VALUE:</td></tr> +<tr class="codeline" data-linenumber="533"><td class="num" id="LN533">533</td><td class="line"> <span class='comment'>/* even though we end up packing the event boxes into the</span></td></tr> +<tr class="codeline" data-linenumber="534"><td class="num" id="LN534">534</td><td class="line"> <span class='comment'>* panel, these dont give back request sizes, so need to ask</span></td></tr> +<tr class="codeline" data-linenumber="535"><td class="num" id="LN535">535</td><td class="line"> <span class='comment'>* widgets directly */</span></td></tr> +<tr class="codeline" data-linenumber="536"><td class="num" id="LN536">536</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->value)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->value)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="537"><td class="num" id="LN537">537</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="538"><td class="num" id="LN538">538</td><td class="line"> value_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="539"><td class="num" id="LN539">539</td><td class="line"> value_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="540"><td class="num" id="LN540">540</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="541"><td class="num" id="LN541">541</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->label)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->label)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="542"><td class="num" id="LN542">542</td><td class="line"> label_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="543"><td class="num" id="LN543">543</td><td class="line"> label_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="544"><td class="num" id="LN544">544</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="545"><td class="num" id="LN545">545</td><td class="line"> <span class='comment'>/* make sure all widths and heights are non zero, otherwise</span></td></tr> +<tr class="codeline" data-linenumber="546"><td class="num" id="LN546">546</td><td class="line"> <span class='comment'>* will get a divide by zero exception below</span></td></tr> +<tr class="codeline" data-linenumber="547"><td class="num" id="LN547">547</td><td class="line"> <span class='comment'>* - is a non critical error since can happen when</span></td></tr> +<tr class="codeline" data-linenumber="548"><td class="num" id="LN548">548</td><td class="line"> <span class='comment'>* elements first added to list, so simply return - is</span></td></tr> +<tr class="codeline" data-linenumber="549"><td class="num" id="LN549">549</td><td class="line"> <span class='comment'>* not a programming error */</span></td></tr> +<tr class="codeline" data-linenumber="550"><td class="num" id="LN550">550</td><td class="line"> <span class='keyword'>if</span> (!(label_width && label_height && value_width && value_height)) {</td></tr> +<tr class="codeline" data-linenumber="551"><td class="num" id="LN551">551</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="552"><td class="num" id="LN552">552</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="553"><td class="num" id="LN553">553</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="554"><td class="num" id="LN554">554</td><td class="line"> <span class='keyword'>switch</span> (layout_mode) {</td></tr> +<tr class="codeline" data-linenumber="555"><td class="num" id="LN555">555</td><td class="line"> <span class='keyword'>case</span> VALUE_BESIDE_LABEL:</td></tr> +<tr class="codeline" data-linenumber="556"><td class="num" id="LN556">556</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? <span class='macro'>MAX(label_height, value_height)<span class='macro_popup'>(((label_height) > (value_height)) ? (label_height) : (value_height<br>))</span></span> : (label_width + value_width)));</td></tr> +<tr class="codeline" data-linenumber="557"><td class="num" id="LN557">557</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="558"><td class="num" id="LN558">558</td><td class="line"> <span class='keyword'>case</span> VALUE_BELOW_LABEL:</td></tr> +<tr class="codeline" data-linenumber="559"><td class="num" id="LN559">559</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? (label_height + value_height) : <span class='macro'>MAX(label_width, value_width)<span class='macro_popup'>(((label_width) > (value_width)) ? (label_width) : (value_width<br>))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="560"><td class="num" id="LN560">560</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="561"><td class="num" id="LN561">561</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="562"><td class="num" id="LN562">562</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="563"><td class="num" id="LN563">563</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="564"><td class="num" id="LN564">564</td><td class="line"> <span class='keyword'>case</span> DISPLAY_ICON_WITH_VALUE:</td></tr> +<tr class="codeline" data-linenumber="565"><td class="num" id="LN565">565</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->value)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->value)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="566"><td class="num" id="LN566">566</td><td class="line"> value_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="567"><td class="num" id="LN567">567</td><td class="line"> value_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="568"><td class="num" id="LN568">568</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="569"><td class="num" id="LN569">569</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->icon)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->icon)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="570"><td class="num" id="LN570">570</td><td class="line"> icon_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="571"><td class="num" id="LN571">571</td><td class="line"> icon_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="572"><td class="num" id="LN572">572</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="573"><td class="num" id="LN573">573</td><td class="line"> <span class='keyword'>if</span> (!(icon_width && icon_height && value_width && value_height)) {</td></tr> +<tr class="codeline" data-linenumber="574"><td class="num" id="LN574">574</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="575"><td class="num" id="LN575">575</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="576"><td class="num" id="LN576">576</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="577"><td class="num" id="LN577">577</td><td class="line"> <span class='keyword'>switch</span> (layout_mode) {</td></tr> +<tr class="codeline" data-linenumber="578"><td class="num" id="LN578">578</td><td class="line"> <span class='keyword'>case</span> VALUE_BESIDE_LABEL:</td></tr> +<tr class="codeline" data-linenumber="579"><td class="num" id="LN579">579</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? <span class='macro'>MAX(icon_height, value_height)<span class='macro_popup'>(((icon_height) > (value_height)) ? (icon_height) : (value_height<br>))</span></span> : (icon_width + value_width)));</td></tr> +<tr class="codeline" data-linenumber="580"><td class="num" id="LN580">580</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="581"><td class="num" id="LN581">581</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="582"><td class="num" id="LN582">582</td><td class="line"> <span class='keyword'>case</span> VALUE_BELOW_LABEL:</td></tr> +<tr class="codeline" data-linenumber="583"><td class="num" id="LN583">583</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? (icon_height + value_height) : <span class='macro'>MAX(icon_width, value_width)<span class='macro_popup'>(((icon_width) > (value_width)) ? (icon_width) : (value_width<br>))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="584"><td class="num" id="LN584">584</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="585"><td class="num" id="LN585">585</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="586"><td class="num" id="LN586">586</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="587"><td class="num" id="LN587">587</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="588"><td class="num" id="LN588">588</td><td class="line"> <span class='keyword'>case</span> DISPLAY_ICON:</td></tr> +<tr class="codeline" data-linenumber="589"><td class="num" id="LN589">589</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->icon)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->icon)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="590"><td class="num" id="LN590">590</td><td class="line"> icon_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="591"><td class="num" id="LN591">591</td><td class="line"> icon_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="592"><td class="num" id="LN592">592</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="593"><td class="num" id="LN593">593</td><td class="line"> <span class='keyword'>if</span> (!(icon_width && icon_height)) {</td></tr> +<tr class="codeline" data-linenumber="594"><td class="num" id="LN594">594</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="595"><td class="num" id="LN595">595</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="596"><td class="num" id="LN596">596</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="597"><td class="num" id="LN597">597</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? icon_height : icon_width));</td></tr> +<tr class="codeline" data-linenumber="598"><td class="num" id="LN598">598</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="599"><td class="num" id="LN599">599</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="600"><td class="num" id="LN600">600</td><td class="line"> <span class='keyword'>case</span> DISPLAY_GRAPH:</td></tr> +<tr class="codeline" data-linenumber="601"><td class="num" id="LN601">601</td><td class="line"> <span class='comment'>/* only show graphs in a line like System Monitor applet */</span></td></tr> +<tr class="codeline" data-linenumber="602"><td class="num" id="LN602">602</td><td class="line"> num_sensors_per_group = 1;</td></tr> +<tr class="codeline" data-linenumber="603"><td class="num" id="LN603">603</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="604"><td class="num" id="LN604">604</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="605"><td class="num" id="LN605">605</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="606"><td class="num" id="LN606">606</td><td class="line"> <span class='comment'>/* ensure always atleast 1 sensor per group */</span></td></tr> +<tr class="codeline" data-linenumber="607"><td class="num" id="LN607">607</td><td class="line"> <span class='keyword'>if</span> (num_sensors_per_group < 1) {</td></tr> +<tr class="codeline" data-linenumber="608"><td class="num" id="LN608">608</td><td class="line"> <span class='comment'>/* force a better layout */</span></td></tr> +<tr class="codeline" data-linenumber="609"><td class="num" id="LN609">609</td><td class="line"> <span class='keyword'>if</span> (horizontal && layout_mode == VALUE_BELOW_LABEL) {</td></tr> +<tr class="codeline" data-linenumber="610"><td class="num" id="LN610">610</td><td class="line"> layout_mode = VALUE_BESIDE_LABEL;</td></tr> +<tr class="codeline" data-linenumber="611"><td class="num" id="LN611">611</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (!horizontal && layout_mode == VALUE_BESIDE_LABEL) {</td></tr> +<tr class="codeline" data-linenumber="612"><td class="num" id="LN612">612</td><td class="line"> layout_mode = VALUE_BELOW_LABEL;</td></tr> +<tr class="codeline" data-linenumber="613"><td class="num" id="LN613">613</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="614"><td class="num" id="LN614">614</td><td class="line"> num_sensors_per_group = 1;</td></tr> +<tr class="codeline" data-linenumber="615"><td class="num" id="LN615">615</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="616"><td class="num" id="LN616">616</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="617"><td class="num" id="LN617">617</td><td class="line"> <span class='keyword'>if</span> (horizontal) {</td></tr> +<tr class="codeline" data-linenumber="618"><td class="num" id="LN618">618</td><td class="line"> <span class='comment'>/* if oriented horizontally, want as many</span></td></tr> +<tr class="codeline" data-linenumber="619"><td class="num" id="LN619">619</td><td class="line"> <span class='comment'>sensors per column as user has defined, then</span></td></tr> +<tr class="codeline" data-linenumber="620"><td class="num" id="LN620">620</td><td class="line"> <span class='comment'>enough columns to hold all the widgets */</span></td></tr> +<tr class="codeline" data-linenumber="621"><td class="num" id="LN621">621</td><td class="line"> rows = num_sensors_per_group;</td></tr> +<tr class="codeline" data-linenumber="622"><td class="num" id="LN622">622</td><td class="line"> cols = num_active_sensors / num_sensors_per_group;</td></tr> +<tr class="codeline" data-linenumber="623"><td class="num" id="LN623">623</td><td class="line"> <span class='keyword'>while</span> (rows * cols < num_active_sensors || cols == 0) {</td></tr> +<tr class="codeline" data-linenumber="624"><td class="num" id="LN624">624</td><td class="line"> cols++;</td></tr> +<tr class="codeline" data-linenumber="625"><td class="num" id="LN625">625</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="626"><td class="num" id="LN626">626</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="627"><td class="num" id="LN627">627</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="628"><td class="num" id="LN628">628</td><td class="line"> <span class='comment'>/* if oriented vertically, want as many</span></td></tr> +<tr class="codeline" data-linenumber="629"><td class="num" id="LN629">629</td><td class="line"> <span class='comment'>sensors per row as user has defined, then</span></td></tr> +<tr class="codeline" data-linenumber="630"><td class="num" id="LN630">630</td><td class="line"> <span class='comment'>enough rows to hold all the widgets*/</span></td></tr> +<tr class="codeline" data-linenumber="631"><td class="num" id="LN631">631</td><td class="line"> cols = num_sensors_per_group;</td></tr> +<tr class="codeline" data-linenumber="632"><td class="num" id="LN632">632</td><td class="line"> rows = num_active_sensors / num_sensors_per_group;</td></tr> +<tr class="codeline" data-linenumber="633"><td class="num" id="LN633">633</td><td class="line"> <span class='keyword'>while</span> (rows * cols < num_active_sensors || rows == 0) {</td></tr> +<tr class="codeline" data-linenumber="634"><td class="num" id="LN634">634</td><td class="line"> rows++;</td></tr> +<tr class="codeline" data-linenumber="635"><td class="num" id="LN635">635</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="636"><td class="num" id="LN636">636</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="637"><td class="num" id="LN637">637</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="638"><td class="num" id="LN638">638</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="639"><td class="num" id="LN639">639</td><td class="line"> <span class='comment'>/* if displaying labels / icons and values need to modify</span></td></tr> +<tr class="codeline" data-linenumber="640"><td class="num" id="LN640">640</td><td class="line"> <span class='comment'>number of rows / colums to accomodate this */</span></td></tr> +<tr class="codeline" data-linenumber="641"><td class="num" id="LN641">641</td><td class="line"> <span class='keyword'>if</span> (display_mode == DISPLAY_LABEL_WITH_VALUE || display_mode == DISPLAY_ICON_WITH_VALUE) {</td></tr> +<tr class="codeline" data-linenumber="642"><td class="num" id="LN642">642</td><td class="line"> <span class='keyword'>if</span> (layout_mode == VALUE_BESIDE_LABEL) {</td></tr> +<tr class="codeline" data-linenumber="643"><td class="num" id="LN643">643</td><td class="line"> <span class='comment'>/* to display labels next to values need twice as many columns */</span></td></tr> +<tr class="codeline" data-linenumber="644"><td class="num" id="LN644">644</td><td class="line"> cols *= 2;</td></tr> +<tr class="codeline" data-linenumber="645"><td class="num" id="LN645">645</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="646"><td class="num" id="LN646">646</td><td class="line"> <span class='comment'>/* to display labels above values, we need twice as many rows as without */</span></td></tr> +<tr class="codeline" data-linenumber="647"><td class="num" id="LN647">647</td><td class="line"> rows *= 2;</td></tr> +<tr class="codeline" data-linenumber="648"><td class="num" id="LN648">648</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="649"><td class="num" id="LN649">649</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="650"><td class="num" id="LN650">650</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="651"><td class="num" id="LN651">651</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->grid == <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="652"><td class="num" id="LN652">652</td><td class="line"> <span class='comment'>/* create grid and add to applet */</span></td></tr> +<tr class="codeline" data-linenumber="653"><td class="num" id="LN653">653</td><td class="line"> sensors_applet->grid = gtk_grid_new();</td></tr> +<tr class="codeline" data-linenumber="654"><td class="num" id="LN654">654</td><td class="line"> gtk_grid_set_column_spacing(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>, <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>);</td></tr> +<tr class="codeline" data-linenumber="655"><td class="num" id="LN655">655</td><td class="line"> gtk_grid_set_row_spacing(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>, <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>);</td></tr> +<tr class="codeline" data-linenumber="656"><td class="num" id="LN656">656</td><td class="line"> gtk_widget_set_halign(sensors_applet->grid, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="657"><td class="num" id="LN657">657</td><td class="line"> gtk_widget_set_valign(sensors_applet->grid, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="658"><td class="num" id="LN658">658</td><td class="line"> gtk_container_add(<span class='macro'>GTK_CONTAINER(sensors_applet->applet)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->applet)))))</span></span>, sensors_applet->grid);</td></tr> +<tr class="codeline" data-linenumber="659"><td class="num" id="LN659">659</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="660"><td class="num" id="LN660">660</td><td class="line"> <span class='comment'>/* remove all children if grid already exists so we can start again */</span></td></tr> +<tr class="codeline" data-linenumber="661"><td class="num" id="LN661">661</td><td class="line"> <span class='comment'>/* save a list of the old children for later */</span></td></tr> +<tr class="codeline" data-linenumber="662"><td class="num" id="LN662">662</td><td class="line"> old_grid_children = gtk_container_get_children(<span class='macro'>GTK_CONTAINER(sensors_applet->grid)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->grid)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="663"><td class="num" id="LN663">663</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="664"><td class="num" id="LN664">664</td><td class="line"> gtk_container_foreach(<span class='macro'>GTK_CONTAINER(sensors_applet->grid)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="665"><td class="num" id="LN665">665</td><td class="line"> sensors_applet_pack_display_empty_grid_cb,</td></tr> +<tr class="codeline" data-linenumber="666"><td class="num" id="LN666">666</td><td class="line"> sensors_applet->grid);</td></tr> +<tr class="codeline" data-linenumber="667"><td class="num" id="LN667">667</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="668"><td class="num" id="LN668">668</td><td class="line"> <span class='comment'>/* pack icons / labels and values into grid */</span></td></tr> +<tr class="codeline" data-linenumber="669"><td class="num" id="LN669">669</td><td class="line"> current_sensor = sensors_applet->active_sensors;</td></tr> +<tr class="codeline" data-linenumber="670"><td class="num" id="LN670">670</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="671"><td class="num" id="LN671">671</td><td class="line"> <span class='comment'>/* if showing labels / icons and values, need to pack labels / icons these first */</span></td></tr> +<tr class="codeline" data-linenumber="672"><td class="num" id="LN672">672</td><td class="line"> <span class='keyword'>if</span> (display_mode == DISPLAY_ICON_WITH_VALUE || display_mode == DISPLAY_LABEL_WITH_VALUE) {</td></tr> +<tr class="codeline" data-linenumber="673"><td class="num" id="LN673">673</td><td class="line"> <span class='comment'>/* loop through columns */</span></td></tr> +<tr class="codeline" data-linenumber="674"><td class="num" id="LN674">674</td><td class="line"> <span class='keyword'>for</span> (i = 0; current_sensor != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> && i < cols; <span class='comment'>/* increments depends on how we lay them out - see below */</span>) {</td></tr> +<tr class="codeline" data-linenumber="675"><td class="num" id="LN675">675</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="676"><td class="num" id="LN676">676</td><td class="line"> <span class='comment'>/* loop through rows in a column */</span></td></tr> +<tr class="codeline" data-linenumber="677"><td class="num" id="LN677">677</td><td class="line"> <span class='keyword'>for</span> (j = 0; current_sensor && j < rows; <span class='comment'>/* see bottom of for loop*/</span>) {</td></tr> +<tr class="codeline" data-linenumber="678"><td class="num" id="LN678">678</td><td class="line"> <span class='comment'>/* attach label / icon at this point */</span></td></tr> +<tr class="codeline" data-linenumber="679"><td class="num" id="LN679">679</td><td class="line"> <span class='keyword'>if</span> (display_mode == DISPLAY_ICON_WITH_VALUE) {</td></tr> +<tr class="codeline" data-linenumber="680"><td class="num" id="LN680">680</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->icon) {</td></tr> +<tr class="codeline" data-linenumber="681"><td class="num" id="LN681">681</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="682"><td class="num" id="LN682">682</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->icon,</td></tr> +<tr class="codeline" data-linenumber="683"><td class="num" id="LN683">683</td><td class="line"> i, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="684"><td class="num" id="LN684">684</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="685"><td class="num" id="LN685">685</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="686"><td class="num" id="LN686">686</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->label) {</td></tr> +<tr class="codeline" data-linenumber="687"><td class="num" id="LN687">687</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="688"><td class="num" id="LN688">688</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->label,</td></tr> +<tr class="codeline" data-linenumber="689"><td class="num" id="LN689">689</td><td class="line"> i, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="690"><td class="num" id="LN690">690</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="691"><td class="num" id="LN691">691</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="692"><td class="num" id="LN692">692</td><td class="line"> <span class='comment'>/* now attach sensor value to either row below or column next to */</span></td></tr> +<tr class="codeline" data-linenumber="693"><td class="num" id="LN693">693</td><td class="line"> <span class='keyword'>if</span> (layout_mode == VALUE_BESIDE_LABEL) {</td></tr> +<tr class="codeline" data-linenumber="694"><td class="num" id="LN694">694</td><td class="line"> <span class='comment'>/* left align labels */</span></td></tr> +<tr class="codeline" data-linenumber="695"><td class="num" id="LN695">695</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->icon) {</td></tr> +<tr class="codeline" data-linenumber="696"><td class="num" id="LN696">696</td><td class="line"> gtk_widget_set_halign (((ActiveSensor *)(current_sensor->data))->icon, GTK_ALIGN_START);</td></tr> +<tr class="codeline" data-linenumber="697"><td class="num" id="LN697">697</td><td class="line"> gtk_widget_set_valign (((ActiveSensor *)(current_sensor->data))->icon, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="698"><td class="num" id="LN698">698</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="699"><td class="num" id="LN699">699</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->label) {</td></tr> +<tr class="codeline" data-linenumber="700"><td class="num" id="LN700">700</td><td class="line"> gtk_label_set_xalign (<span class='macro'>GTK_LABEL(((ActiveSensor *)(current_sensor->data))->label)<span class='macro_popup'>((((GtkLabel*) (void *) ((((ActiveSensor *)(current_sensor-><br>data))->label)))))</span></span>, 0);</td></tr> +<tr class="codeline" data-linenumber="701"><td class="num" id="LN701">701</td><td class="line"> gtk_label_set_yalign (<span class='macro'>GTK_LABEL(((ActiveSensor *)(current_sensor->data))->label)<span class='macro_popup'>((((GtkLabel*) (void *) ((((ActiveSensor *)(current_sensor-><br>data))->label)))))</span></span>, 0.5);</td></tr> +<tr class="codeline" data-linenumber="702"><td class="num" id="LN702">702</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="703"><td class="num" id="LN703">703</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="704"><td class="num" id="LN704">704</td><td class="line"> gtk_widget_set_halign (((ActiveSensor *)(current_sensor->data))->value, GTK_ALIGN_START);</td></tr> +<tr class="codeline" data-linenumber="705"><td class="num" id="LN705">705</td><td class="line"> gtk_widget_set_valign (((ActiveSensor *)(current_sensor->data))->value, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="706"><td class="num" id="LN706">706</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="707"><td class="num" id="LN707">707</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="708"><td class="num" id="LN708">708</td><td class="line"> <span class='comment'>/* place value next to label */</span></td></tr> +<tr class="codeline" data-linenumber="709"><td class="num" id="LN709">709</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="710"><td class="num" id="LN710">710</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="711"><td class="num" id="LN711">711</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->value,</td></tr> +<tr class="codeline" data-linenumber="712"><td class="num" id="LN712">712</td><td class="line"> i + 1, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="713"><td class="num" id="LN713">713</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="714"><td class="num" id="LN714">714</td><td class="line"> j++;</td></tr> +<tr class="codeline" data-linenumber="715"><td class="num" id="LN715">715</td><td class="line"> } <span class='keyword'>else</span> { <span class='comment'>/* place value below label */</span></td></tr> +<tr class="codeline" data-linenumber="716"><td class="num" id="LN716">716</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="717"><td class="num" id="LN717">717</td><td class="line"> <span class='comment'>/* center align labels */</span></td></tr> +<tr class="codeline" data-linenumber="718"><td class="num" id="LN718">718</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->icon) {</td></tr> +<tr class="codeline" data-linenumber="719"><td class="num" id="LN719">719</td><td class="line"> gtk_widget_set_halign (((ActiveSensor *)(current_sensor->data))->icon, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="720"><td class="num" id="LN720">720</td><td class="line"> gtk_widget_set_valign (((ActiveSensor *)(current_sensor->data))->icon, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="721"><td class="num" id="LN721">721</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="722"><td class="num" id="LN722">722</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->label) {</td></tr> +<tr class="codeline" data-linenumber="723"><td class="num" id="LN723">723</td><td class="line"> gtk_label_set_xalign (<span class='macro'>GTK_LABEL(((ActiveSensor *)(current_sensor->data))->label)<span class='macro_popup'>((((GtkLabel*) (void *) ((((ActiveSensor *)(current_sensor-><br>data))->label)))))</span></span>, 0.5);</td></tr> +<tr class="codeline" data-linenumber="724"><td class="num" id="LN724">724</td><td class="line"> gtk_label_set_yalign (<span class='macro'>GTK_LABEL(((ActiveSensor *)(current_sensor->data))->label)<span class='macro_popup'>((((GtkLabel*) (void *) ((((ActiveSensor *)(current_sensor-><br>data))->label)))))</span></span>, 0.5);</td></tr> +<tr class="codeline" data-linenumber="725"><td class="num" id="LN725">725</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="726"><td class="num" id="LN726">726</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="727"><td class="num" id="LN727">727</td><td class="line"> gtk_widget_set_halign (((ActiveSensor *)(current_sensor->data))->value, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="728"><td class="num" id="LN728">728</td><td class="line"> gtk_widget_set_valign (((ActiveSensor *)(current_sensor->data))->value, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="729"><td class="num" id="LN729">729</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="730"><td class="num" id="LN730">730</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="731"><td class="num" id="LN731">731</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="732"><td class="num" id="LN732">732</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="733"><td class="num" id="LN733">733</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->value,</td></tr> +<tr class="codeline" data-linenumber="734"><td class="num" id="LN734">734</td><td class="line"> i, j + 1, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="735"><td class="num" id="LN735">735</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="736"><td class="num" id="LN736">736</td><td class="line"> j += 2;</td></tr> +<tr class="codeline" data-linenumber="737"><td class="num" id="LN737">737</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="738"><td class="num" id="LN738">738</td><td class="line"> current_sensor = <span class='macro'>g_list_next(current_sensor)<span class='macro_popup'>((current_sensor) ? (((GList *)(current_sensor))->next) : (<br>(void*)0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="739"><td class="num" id="LN739">739</td><td class="line"> } <span class='comment'>/* end row loop */</span></td></tr> +<tr class="codeline" data-linenumber="740"><td class="num" id="LN740">740</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="741"><td class="num" id="LN741">741</td><td class="line"> <span class='comment'>/* now increment column index as needed */</span></td></tr> +<tr class="codeline" data-linenumber="742"><td class="num" id="LN742">742</td><td class="line"> <span class='keyword'>if</span> (layout_mode == VALUE_BESIDE_LABEL) { <span class='comment'>/* place value next to label */</span></td></tr> +<tr class="codeline" data-linenumber="743"><td class="num" id="LN743">743</td><td class="line"> i += 2;</td></tr> +<tr class="codeline" data-linenumber="744"><td class="num" id="LN744">744</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="745"><td class="num" id="LN745">745</td><td class="line"> i++;</td></tr> +<tr class="codeline" data-linenumber="746"><td class="num" id="LN746">746</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="747"><td class="num" id="LN747">747</td><td class="line"> } <span class='comment'>/* end column loop */</span></td></tr> +<tr class="codeline" data-linenumber="748"><td class="num" id="LN748">748</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="749"><td class="num" id="LN749">749</td><td class="line"> } <span class='keyword'>else</span> { <span class='comment'>/* not showing labels and icons with values, so just pack either only icons or values */</span></td></tr> +<tr class="codeline" data-linenumber="750"><td class="num" id="LN750">750</td><td class="line"> <span class='keyword'>for</span> (i = 0; current_sensor != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> && i < cols; ++i) {</td></tr> +<tr class="codeline" data-linenumber="751"><td class="num" id="LN751">751</td><td class="line"> <span class='keyword'>for</span> (j = 0; current_sensor!= <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> && j < rows; ++j) {</td></tr> +<tr class="codeline" data-linenumber="752"><td class="num" id="LN752">752</td><td class="line"> <span class='keyword'>if</span> (display_mode == DISPLAY_VALUE) {</td></tr> +<tr class="codeline" data-linenumber="753"><td class="num" id="LN753">753</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="754"><td class="num" id="LN754">754</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="755"><td class="num" id="LN755">755</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->value,</td></tr> +<tr class="codeline" data-linenumber="756"><td class="num" id="LN756">756</td><td class="line"> i, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="757"><td class="num" id="LN757">757</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="758"><td class="num" id="LN758">758</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (display_mode == DISPLAY_ICON) {</td></tr> +<tr class="codeline" data-linenumber="759"><td class="num" id="LN759">759</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="760"><td class="num" id="LN760">760</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="761"><td class="num" id="LN761">761</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->icon,</td></tr> +<tr class="codeline" data-linenumber="762"><td class="num" id="LN762">762</td><td class="line"> i, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="763"><td class="num" id="LN763">763</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="764"><td class="num" id="LN764">764</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (display_mode == DISPLAY_GRAPH) {</td></tr> +<tr class="codeline" data-linenumber="765"><td class="num" id="LN765">765</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->graph) {</td></tr> +<tr class="codeline" data-linenumber="766"><td class="num" id="LN766">766</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="767"><td class="num" id="LN767">767</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->graph_frame,</td></tr> +<tr class="codeline" data-linenumber="768"><td class="num" id="LN768">768</td><td class="line"> i, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="769"><td class="num" id="LN769">769</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="770"><td class="num" id="LN770">770</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="771"><td class="num" id="LN771">771</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="772"><td class="num" id="LN772">772</td><td class="line"> current_sensor = <span class='macro'>g_list_next(current_sensor)<span class='macro_popup'>((current_sensor) ? (((GList *)(current_sensor))->next) : (<br>(void*)0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="773"><td class="num" id="LN773">773</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="774"><td class="num" id="LN774">774</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="775"><td class="num" id="LN775">775</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="776"><td class="num" id="LN776">776</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="777"><td class="num" id="LN777">777</td><td class="line"> <span class='keyword'>if</span> (old_grid_children != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="778"><td class="num" id="LN778">778</td><td class="line"> gtk_container_foreach(<span class='macro'>GTK_CONTAINER(sensors_applet->grid)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="779"><td class="num" id="LN779">779</td><td class="line"> sensors_applet_pack_display_cleanup_refs_cb,</td></tr> +<tr class="codeline" data-linenumber="780"><td class="num" id="LN780">780</td><td class="line"> old_grid_children);</td></tr> +<tr class="codeline" data-linenumber="781"><td class="num" id="LN781">781</td><td class="line"> g_list_free(old_grid_children);</td></tr> +<tr class="codeline" data-linenumber="782"><td class="num" id="LN782">782</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="783"><td class="num" id="LN783">783</td><td class="line"> gtk_widget_show_all(<span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="784"><td class="num" id="LN784">784</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="785"><td class="num" id="LN785">785</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="786"><td class="num" id="LN786">786</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="787"><td class="num" id="LN787">787</td><td class="line"><span class='comment'>/* must unref when done with returned pixbuf */</span></td></tr> +<tr class="codeline" data-linenumber="788"><td class="num" id="LN788">788</td><td class="line">GdkPixbuf *sensors_applet_load_icon(IconType icon_type) {</td></tr> +<tr class="codeline" data-linenumber="789"><td class="num" id="LN789">789</td><td class="line"> GtkIconTheme *icon_theme;</td></tr> +<tr class="codeline" data-linenumber="790"><td class="num" id="LN790">790</td><td class="line"> GdkPixbuf *icon = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="791"><td class="num" id="LN791">791</td><td class="line"> GError *error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="792"><td class="num" id="LN792">792</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="793"><td class="num" id="LN793">793</td><td class="line"> <span class='comment'>/* try to load the icon */</span></td></tr> +<tr class="codeline" data-linenumber="794"><td class="num" id="LN794">794</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="795"><td class="num" id="LN795">795</td><td class="line"> <span class='comment'>/* not allowed to unref or ref icon_theme once we have it */</span></td></tr> +<tr class="codeline" data-linenumber="796"><td class="num" id="LN796">796</td><td class="line"> icon_theme = gtk_icon_theme_get_default();</td></tr> +<tr class="codeline" data-linenumber="797"><td class="num" id="LN797">797</td><td class="line"> icon = gtk_icon_theme_load_icon(icon_theme,</td></tr> +<tr class="codeline" data-linenumber="798"><td class="num" id="LN798">798</td><td class="line"> stock_icons[icon_type],</td></tr> +<tr class="codeline" data-linenumber="799"><td class="num" id="LN799">799</td><td class="line"> <span class='macro'>DEFAULT_ICON_SIZE<span class='macro_popup'>22</span></span>,</td></tr> +<tr class="codeline" data-linenumber="800"><td class="num" id="LN800">800</td><td class="line"> GTK_ICON_LOOKUP_USE_BUILTIN,</td></tr> +<tr class="codeline" data-linenumber="801"><td class="num" id="LN801">801</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="802"><td class="num" id="LN802">802</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="803"><td class="num" id="LN803">803</td><td class="line"> <span class='keyword'>if</span> (error) {</td></tr> +<tr class="codeline" data-linenumber="804"><td class="num" id="LN804">804</td><td class="line"> g_warning (<span class='string_literal'>"Could not load icon: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="805"><td class="num" id="LN805">805</td><td class="line"> g_error_free(error);</td></tr> +<tr class="codeline" data-linenumber="806"><td class="num" id="LN806">806</td><td class="line"> error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="807"><td class="num" id="LN807">807</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="808"><td class="num" id="LN808">808</td><td class="line"> <span class='comment'>/* try again with default icon */</span></td></tr> +<tr class="codeline" data-linenumber="809"><td class="num" id="LN809">809</td><td class="line"> icon = gtk_icon_theme_load_icon(icon_theme,</td></tr> +<tr class="codeline" data-linenumber="810"><td class="num" id="LN810">810</td><td class="line"> <span class='string_literal'>"image-missing"</span>,</td></tr> +<tr class="codeline" data-linenumber="811"><td class="num" id="LN811">811</td><td class="line"> <span class='macro'>DEFAULT_ICON_SIZE<span class='macro_popup'>22</span></span>,</td></tr> +<tr class="codeline" data-linenumber="812"><td class="num" id="LN812">812</td><td class="line"> GTK_ICON_LOOKUP_USE_BUILTIN,</td></tr> +<tr class="codeline" data-linenumber="813"><td class="num" id="LN813">813</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="814"><td class="num" id="LN814">814</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="815"><td class="num" id="LN815">815</td><td class="line"> <span class='keyword'>if</span> (error) {</td></tr> +<tr class="codeline" data-linenumber="816"><td class="num" id="LN816">816</td><td class="line"> <span class='comment'>/* this will quit sensors-applet but it is a pretty major error so may as well */</span></td></tr> +<tr class="codeline" data-linenumber="817"><td class="num" id="LN817">817</td><td class="line"> g_error(<span class='string_literal'>"Could not load GTK_STOCK_MISSING_IMAGE - major error!!!: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="818"><td class="num" id="LN818">818</td><td class="line"> g_error_free(error);</td></tr> +<tr class="codeline" data-linenumber="819"><td class="num" id="LN819">819</td><td class="line"> error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="820"><td class="num" id="LN820">820</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="821"><td class="num" id="LN821">821</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="822"><td class="num" id="LN822">822</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="823"><td class="num" id="LN823">823</td><td class="line"> <span class='keyword'>return</span> icon;</td></tr> +<tr class="codeline" data-linenumber="824"><td class="num" id="LN824">824</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="825"><td class="num" id="LN825">825</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="826"><td class="num" id="LN826">826</td><td class="line"><span class='comment'>// MUST FREE STRINGS AFTER CALLING THIS FUNCTION!!</span></td></tr> +<tr class="codeline" data-linenumber="827"><td class="num" id="LN827">827</td><td class="line">gboolean sensors_applet_add_sensor(SensorsApplet *sensors_applet,</td></tr> +<tr class="codeline" data-linenumber="828"><td class="num" id="LN828">828</td><td class="line"> <span class='keyword'>const</span> gchar *path,</td></tr> +<tr class="codeline" data-linenumber="829"><td class="num" id="LN829">829</td><td class="line"> <span class='keyword'>const</span> gchar *id,</td></tr> +<tr class="codeline" data-linenumber="830"><td class="num" id="LN830">830</td><td class="line"> <span class='keyword'>const</span> gchar *label,</td></tr> +<tr class="codeline" data-linenumber="831"><td class="num" id="LN831">831</td><td class="line"> <span class='keyword'>const</span> gchar *interface,</td></tr> +<tr class="codeline" data-linenumber="832"><td class="num" id="LN832">832</td><td class="line"> SensorType type,</td></tr> +<tr class="codeline" data-linenumber="833"><td class="num" id="LN833">833</td><td class="line"> gboolean enable,</td></tr> +<tr class="codeline" data-linenumber="834"><td class="num" id="LN834">834</td><td class="line"> gdouble low_value,</td></tr> +<tr class="codeline" data-linenumber="835"><td class="num" id="LN835">835</td><td class="line"> gdouble high_value,</td></tr> +<tr class="codeline" data-linenumber="836"><td class="num" id="LN836">836</td><td class="line"> gboolean alarm_enable,</td></tr> +<tr class="codeline" data-linenumber="837"><td class="num" id="LN837">837</td><td class="line"> <span class='keyword'>const</span> gchar *low_alarm_command,</td></tr> +<tr class="codeline" data-linenumber="838"><td class="num" id="LN838">838</td><td class="line"> <span class='keyword'>const</span> gchar *high_alarm_command,</td></tr> +<tr class="codeline" data-linenumber="839"><td class="num" id="LN839">839</td><td class="line"> gint alarm_timeout,</td></tr> +<tr class="codeline" data-linenumber="840"><td class="num" id="LN840">840</td><td class="line"> gdouble multiplier,</td></tr> +<tr class="codeline" data-linenumber="841"><td class="num" id="LN841">841</td><td class="line"> gdouble offset,</td></tr> +<tr class="codeline" data-linenumber="842"><td class="num" id="LN842">842</td><td class="line"> IconType icon_type,</td></tr> +<tr class="codeline" data-linenumber="843"><td class="num" id="LN843">843</td><td class="line"> <span class='keyword'>const</span> gchar *graph_color) {</td></tr> +<tr class="codeline" data-linenumber="844"><td class="num" id="LN844">844</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="845"><td class="num" id="LN845">845</td><td class="line"> GtkTreeIter interfaces_iter, sensors_iter;</td></tr> +<tr class="codeline" data-linenumber="846"><td class="num" id="LN846">846</td><td class="line"> gboolean not_empty_tree;</td></tr> +<tr class="codeline" data-linenumber="847"><td class="num" id="LN847">847</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="848"><td class="num" id="LN848">848</td><td class="line"> gchar *node_interface;</td></tr> +<tr class="codeline" data-linenumber="849"><td class="num" id="LN849">849</td><td class="line"> gboolean not_end_of_interfaces = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>, interface_exists = <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="850"><td class="num" id="LN850">850</td><td class="line"> gboolean not_end_of_sensors = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="851"><td class="num" id="LN851">851</td><td class="line"> gchar *sensor_id;</td></tr> +<tr class="codeline" data-linenumber="852"><td class="num" id="LN852">852</td><td class="line"> gchar *sensor_path;</td></tr> +<tr class="codeline" data-linenumber="853"><td class="num" id="LN853">853</td><td class="line"> SensorType sensor_type;</td></tr> +<tr class="codeline" data-linenumber="854"><td class="num" id="LN854">854</td><td class="line"> GdkPixbuf *icon;</td></tr> +<tr class="codeline" data-linenumber="855"><td class="num" id="LN855">855</td><td class="line"> GtkTreePath *tree_path;</td></tr> +<tr class="codeline" data-linenumber="856"><td class="num" id="LN856">856</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="857"><td class="num" id="LN857">857</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_49<br>; if (sensors_applet) _g_boolean_var_49 = 1; else _g_boolean_var_49<br> = 0; _g_boolean_var_49; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 857, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="858"><td class="num" id="LN858">858</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="859"><td class="num" id="LN859">859</td><td class="line"> <span class='comment'>/* assume tree is not empty */</span></td></tr> +<tr class="codeline" data-linenumber="860"><td class="num" id="LN860">860</td><td class="line"> not_empty_tree = <span class="mrange"><span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span></span>;</td></tr> +<tr><td class="num"></td><td class="line"><div id="EndPath" class="msg msgEvent" style="margin-left:5ex">Value stored to 'not_empty_tree' is never read</div></td></tr> +<tr class="codeline" data-linenumber="861"><td class="num" id="LN861">861</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="862"><td class="num" id="LN862">862</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == sensors_applet->sensors) {</td></tr> +<tr class="codeline" data-linenumber="863"><td class="num" id="LN863">863</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="864"><td class="num" id="LN864">864</td><td class="line"> sensors_applet->sensors = gtk_tree_store_new(N_COLUMNS,</td></tr> +<tr class="codeline" data-linenumber="865"><td class="num" id="LN865">865</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* path */</span></td></tr> +<tr class="codeline" data-linenumber="866"><td class="num" id="LN866">866</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* id */</span></td></tr> +<tr class="codeline" data-linenumber="867"><td class="num" id="LN867">867</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* label */</span></td></tr> +<tr class="codeline" data-linenumber="868"><td class="num" id="LN868">868</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* interface */</span></td></tr> +<tr class="codeline" data-linenumber="869"><td class="num" id="LN869">869</td><td class="line"> <span class='macro'>G_TYPE_UINT<span class='macro_popup'>((GType) ((7) << (2)))</span></span>, <span class='comment'>/* sensor type */</span></td></tr> +<tr class="codeline" data-linenumber="870"><td class="num" id="LN870">870</td><td class="line"> <span class='macro'>G_TYPE_BOOLEAN<span class='macro_popup'>((GType) ((5) << (2)))</span></span>, <span class='comment'>/* enable */</span></td></tr> +<tr class="codeline" data-linenumber="871"><td class="num" id="LN871">871</td><td class="line"> <span class='macro'>G_TYPE_BOOLEAN<span class='macro_popup'>((GType) ((5) << (2)))</span></span>, <span class='comment'>/* visible */</span></td></tr> +<tr class="codeline" data-linenumber="872"><td class="num" id="LN872">872</td><td class="line"> <span class='macro'>G_TYPE_DOUBLE<span class='macro_popup'>((GType) ((15) << (2)))</span></span>, <span class='comment'>/* low value */</span></td></tr> +<tr class="codeline" data-linenumber="873"><td class="num" id="LN873">873</td><td class="line"> <span class='macro'>G_TYPE_DOUBLE<span class='macro_popup'>((GType) ((15) << (2)))</span></span>, <span class='comment'>/* high type */</span></td></tr> +<tr class="codeline" data-linenumber="874"><td class="num" id="LN874">874</td><td class="line"> <span class='macro'>G_TYPE_BOOLEAN<span class='macro_popup'>((GType) ((5) << (2)))</span></span>, <span class='comment'>/* alarm enable */</span></td></tr> +<tr class="codeline" data-linenumber="875"><td class="num" id="LN875">875</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* low alarm command */</span></td></tr> +<tr class="codeline" data-linenumber="876"><td class="num" id="LN876">876</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* high alarm command */</span></td></tr> +<tr class="codeline" data-linenumber="877"><td class="num" id="LN877">877</td><td class="line"> <span class='macro'>G_TYPE_UINT<span class='macro_popup'>((GType) ((7) << (2)))</span></span>, <span class='comment'>/* alarm timeout */</span></td></tr> +<tr class="codeline" data-linenumber="878"><td class="num" id="LN878">878</td><td class="line"> <span class='macro'>G_TYPE_DOUBLE<span class='macro_popup'>((GType) ((15) << (2)))</span></span>, <span class='comment'>/* multiplier */</span></td></tr> +<tr class="codeline" data-linenumber="879"><td class="num" id="LN879">879</td><td class="line"> <span class='macro'>G_TYPE_DOUBLE<span class='macro_popup'>((GType) ((15) << (2)))</span></span>, <span class='comment'>/* offset */</span></td></tr> +<tr class="codeline" data-linenumber="880"><td class="num" id="LN880">880</td><td class="line"> <span class='macro'>G_TYPE_UINT<span class='macro_popup'>((GType) ((7) << (2)))</span></span>, <span class='comment'>/* icon type */</span></td></tr> +<tr class="codeline" data-linenumber="881"><td class="num" id="LN881">881</td><td class="line"> <span class='macro'>GDK_TYPE_PIXBUF<span class='macro_popup'>(gdk_pixbuf_get_type ())</span></span>, <span class='comment'>/* icon pixbuf */</span></td></tr> +<tr class="codeline" data-linenumber="882"><td class="num" id="LN882">882</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>); <span class='comment'>/* graph color */</span></td></tr> +<tr class="codeline" data-linenumber="883"><td class="num" id="LN883">883</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="884"><td class="num" id="LN884">884</td><td class="line"> g_debug(<span class='string_literal'>"Sensor tree created."</span>);</td></tr> +<tr class="codeline" data-linenumber="885"><td class="num" id="LN885">885</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="886"><td class="num" id="LN886">886</td><td class="line"> <span class='comment'>/* we know tree is actually empty since we just created it */</span></td></tr> +<tr class="codeline" data-linenumber="887"><td class="num" id="LN887">887</td><td class="line"> not_empty_tree = <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="888"><td class="num" id="LN888">888</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="889"><td class="num" id="LN889">889</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="890"><td class="num" id="LN890">890</td><td class="line"> <span class='comment'>/* search sensor tree for the parent interface to place this sensor under */</span></td></tr> +<tr class="codeline" data-linenumber="891"><td class="num" id="LN891">891</td><td class="line"> <span class='keyword'>for</span> (not_empty_tree = gtk_tree_model_get_iter_first(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &interfaces_iter);</td></tr> +<tr class="codeline" data-linenumber="892"><td class="num" id="LN892">892</td><td class="line"> not_empty_tree && not_end_of_interfaces && !interface_exists;</td></tr> +<tr class="codeline" data-linenumber="893"><td class="num" id="LN893">893</td><td class="line"> not_end_of_interfaces = gtk_tree_model_iter_next(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &interfaces_iter)) {</td></tr> +<tr class="codeline" data-linenumber="894"><td class="num" id="LN894">894</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="895"><td class="num" id="LN895">895</td><td class="line"> gtk_tree_model_get(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &interfaces_iter, INTERFACE_COLUMN, &node_interface, -1);</td></tr> +<tr class="codeline" data-linenumber="896"><td class="num" id="LN896">896</td><td class="line"> <span class='keyword'>if</span> (g_ascii_strcasecmp(interface, node_interface) == 0) {</td></tr> +<tr class="codeline" data-linenumber="897"><td class="num" id="LN897">897</td><td class="line"> <span class='comment'>/* found interface in tree */</span></td></tr> +<tr class="codeline" data-linenumber="898"><td class="num" id="LN898">898</td><td class="line"> interface_exists = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="899"><td class="num" id="LN899">899</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="900"><td class="num" id="LN900">900</td><td class="line"> <span class='comment'>/* now see if this actual sensor already exists within this interface - don't want to add duplicates */</span></td></tr> +<tr class="codeline" data-linenumber="901"><td class="num" id="LN901">901</td><td class="line"> <span class='comment'>/* see if have children */</span></td></tr> +<tr class="codeline" data-linenumber="902"><td class="num" id="LN902">902</td><td class="line"> <span class='keyword'>for</span> (not_end_of_sensors = gtk_tree_model_iter_children(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter, &interfaces_iter);</td></tr> +<tr class="codeline" data-linenumber="903"><td class="num" id="LN903">903</td><td class="line"> not_end_of_sensors;</td></tr> +<tr class="codeline" data-linenumber="904"><td class="num" id="LN904">904</td><td class="line"> not_end_of_sensors = gtk_tree_model_iter_next(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter)) {</td></tr> +<tr class="codeline" data-linenumber="905"><td class="num" id="LN905">905</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="906"><td class="num" id="LN906">906</td><td class="line"> gtk_tree_model_get(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter,</td></tr> +<tr class="codeline" data-linenumber="907"><td class="num" id="LN907">907</td><td class="line"> PATH_COLUMN, &sensor_path,</td></tr> +<tr class="codeline" data-linenumber="908"><td class="num" id="LN908">908</td><td class="line"> ID_COLUMN, &sensor_id,</td></tr> +<tr class="codeline" data-linenumber="909"><td class="num" id="LN909">909</td><td class="line"> SENSOR_TYPE_COLUMN, &sensor_type,</td></tr> +<tr class="codeline" data-linenumber="910"><td class="num" id="LN910">910</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="911"><td class="num" id="LN911">911</td><td class="line"> <span class='keyword'>if</span> (g_ascii_strcasecmp(sensor_id, id) == 0 && g_ascii_strcasecmp(sensor_path, path) == 0 && sensor_type == type) {</td></tr> +<tr class="codeline" data-linenumber="912"><td class="num" id="LN912">912</td><td class="line"> <span class='comment'>/* sensor already exists so dont add a second time */</span></td></tr> +<tr class="codeline" data-linenumber="913"><td class="num" id="LN913">913</td><td class="line"> g_debug(<span class='string_literal'>"sensor with path: %s, id: %s already exists in tree, not adding a second time"</span>, sensor_path, sensor_id);</td></tr> +<tr class="codeline" data-linenumber="914"><td class="num" id="LN914">914</td><td class="line"> g_free(sensor_id);</td></tr> +<tr class="codeline" data-linenumber="915"><td class="num" id="LN915">915</td><td class="line"> g_free(sensor_path);</td></tr> +<tr class="codeline" data-linenumber="916"><td class="num" id="LN916">916</td><td class="line"> g_free(node_interface);</td></tr> +<tr class="codeline" data-linenumber="917"><td class="num" id="LN917">917</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="918"><td class="num" id="LN918">918</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="919"><td class="num" id="LN919">919</td><td class="line"> g_free(sensor_id);</td></tr> +<tr class="codeline" data-linenumber="920"><td class="num" id="LN920">920</td><td class="line"> g_free(sensor_path);</td></tr> +<tr class="codeline" data-linenumber="921"><td class="num" id="LN921">921</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="922"><td class="num" id="LN922">922</td><td class="line"> g_free(node_interface);</td></tr> +<tr class="codeline" data-linenumber="923"><td class="num" id="LN923">923</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="924"><td class="num" id="LN924">924</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="925"><td class="num" id="LN925">925</td><td class="line"> g_free(node_interface);</td></tr> +<tr class="codeline" data-linenumber="926"><td class="num" id="LN926">926</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="927"><td class="num" id="LN927">927</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="928"><td class="num" id="LN928">928</td><td class="line"> <span class='keyword'>if</span> (!interface_exists) {</td></tr> +<tr class="codeline" data-linenumber="929"><td class="num" id="LN929">929</td><td class="line"> <span class='comment'>/* add to required plugins hash table so we ensure this</span></td></tr> +<tr class="codeline" data-linenumber="930"><td class="num" id="LN930">930</td><td class="line"> <span class='comment'>plugin stays loaded to make sure we have a get sensor</span></td></tr> +<tr class="codeline" data-linenumber="931"><td class="num" id="LN931">931</td><td class="line"> <span class='comment'>value function if possible */</span></td></tr> +<tr class="codeline" data-linenumber="932"><td class="num" id="LN932">932</td><td class="line"> g_hash_table_insert(sensors_applet->required_plugins,</td></tr> +<tr class="codeline" data-linenumber="933"><td class="num" id="LN933">933</td><td class="line"> <span class='macro'>g_strdup(interface)<span class='macro_popup'>g_strdup_inline (interface)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="934"><td class="num" id="LN934">934</td><td class="line"> <span class='macro'>GINT_TO_POINTER(TRUE)<span class='macro_popup'>((gpointer) (glong) ((!(0))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="935"><td class="num" id="LN935">935</td><td class="line"> g_debug(<span class='string_literal'>"added interface %s to required plugins"</span>, interface);</td></tr> +<tr class="codeline" data-linenumber="936"><td class="num" id="LN936">936</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="937"><td class="num" id="LN937">937</td><td class="line"> <span class='comment'>/* wasn't able to find interface root node so create it */</span></td></tr> +<tr class="codeline" data-linenumber="938"><td class="num" id="LN938">938</td><td class="line"> gtk_tree_store_append(sensors_applet->sensors,</td></tr> +<tr class="codeline" data-linenumber="939"><td class="num" id="LN939">939</td><td class="line"> &interfaces_iter,</td></tr> +<tr class="codeline" data-linenumber="940"><td class="num" id="LN940">940</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="941"><td class="num" id="LN941">941</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="942"><td class="num" id="LN942">942</td><td class="line"> gtk_tree_store_set(sensors_applet->sensors,</td></tr> +<tr class="codeline" data-linenumber="943"><td class="num" id="LN943">943</td><td class="line"> &interfaces_iter,</td></tr> +<tr class="codeline" data-linenumber="944"><td class="num" id="LN944">944</td><td class="line"> ID_COLUMN, interface,</td></tr> +<tr class="codeline" data-linenumber="945"><td class="num" id="LN945">945</td><td class="line"> INTERFACE_COLUMN, interface,</td></tr> +<tr class="codeline" data-linenumber="946"><td class="num" id="LN946">946</td><td class="line"> VISIBLE_COLUMN, <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="947"><td class="num" id="LN947">947</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="948"><td class="num" id="LN948">948</td><td class="line"> g_debug(<span class='string_literal'>"Added sensor interface %s to tree"</span>, interface);</td></tr> +<tr class="codeline" data-linenumber="949"><td class="num" id="LN949">949</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="950"><td class="num" id="LN950">950</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="951"><td class="num" id="LN951">951</td><td class="line"> <span class='comment'>/* then add sensor as a child under interface node - ie assume</span></td></tr> +<tr class="codeline" data-linenumber="952"><td class="num" id="LN952">952</td><td class="line"> <span class='comment'>* we either found it or created it - the inteface node that is */</span></td></tr> +<tr class="codeline" data-linenumber="953"><td class="num" id="LN953">953</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="954"><td class="num" id="LN954">954</td><td class="line"> <span class='comment'>/* for now just add sensors all in a single list */</span></td></tr> +<tr class="codeline" data-linenumber="955"><td class="num" id="LN955">955</td><td class="line"> gtk_tree_store_append(sensors_applet->sensors, &sensors_iter, &interfaces_iter);</td></tr> +<tr class="codeline" data-linenumber="956"><td class="num" id="LN956">956</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="957"><td class="num" id="LN957">957</td><td class="line"> <span class='comment'>/* if sensor is already in settings, load values from there */</span></td></tr> +<tr class="codeline" data-linenumber="958"><td class="num" id="LN958">958</td><td class="line"> gchar *applet_path = mate_panel_applet_get_preferences_path (sensors_applet->applet);</td></tr> +<tr class="codeline" data-linenumber="959"><td class="num" id="LN959">959</td><td class="line"> gchar *gsuid = sensors_applet_settings_get_unique_id (interface, id, path);</td></tr> +<tr class="codeline" data-linenumber="960"><td class="num" id="LN960">960</td><td class="line"> gchar *settings_path = g_strdup_printf (<span class='string_literal'>"%s%s/"</span>, applet_path, gsuid);</td></tr> +<tr class="codeline" data-linenumber="961"><td class="num" id="LN961">961</td><td class="line"> GSettings *settings = g_settings_new_with_path (<span class='string_literal'>"org.mate.sensors-applet.sensor"</span>, settings_path);</td></tr> +<tr class="codeline" data-linenumber="962"><td class="num" id="LN962">962</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="963"><td class="num" id="LN963">963</td><td class="line"> <span class='comment'>/* add hash to temp sorting list */</span></td></tr> +<tr class="codeline" data-linenumber="964"><td class="num" id="LN964">964</td><td class="line"> g_variant_builder_add (&gvb_sensors_hash_list, <span class='string_literal'>"s"</span>, gsuid);</td></tr> +<tr class="codeline" data-linenumber="965"><td class="num" id="LN965">965</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="966"><td class="num" id="LN966">966</td><td class="line"> g_free (applet_path);</td></tr> +<tr class="codeline" data-linenumber="967"><td class="num" id="LN967">967</td><td class="line"> g_free (gsuid);</td></tr> +<tr class="codeline" data-linenumber="968"><td class="num" id="LN968">968</td><td class="line"> g_free (settings_path);</td></tr> +<tr class="codeline" data-linenumber="969"><td class="num" id="LN969">969</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="970"><td class="num" id="LN970">970</td><td class="line"> gchar *settings_id = g_settings_get_string (settings, <span class='macro'>ID<span class='macro_popup'>"id"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="971"><td class="num" id="LN971">971</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="972"><td class="num" id="LN972">972</td><td class="line"> <span class='keyword'>if</span> (settings_id != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> && settings_id[0] != '\0') {</td></tr> +<tr class="codeline" data-linenumber="973"><td class="num" id="LN973">973</td><td class="line"> enable = g_settings_get_boolean (settings, <span class='macro'>ENABLED<span class='macro_popup'>"enabled"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="974"><td class="num" id="LN974">974</td><td class="line"> icon = sensors_applet_load_icon(g_settings_get_int (settings, <span class='macro'>ICON_TYPE<span class='macro_popup'>"icon-type"</span></span>));</td></tr> +<tr class="codeline" data-linenumber="975"><td class="num" id="LN975">975</td><td class="line"> gtk_tree_store_set(sensors_applet->sensors,</td></tr> +<tr class="codeline" data-linenumber="976"><td class="num" id="LN976">976</td><td class="line"> &sensors_iter,</td></tr> +<tr class="codeline" data-linenumber="977"><td class="num" id="LN977">977</td><td class="line"> PATH_COLUMN, g_settings_get_string (settings, <span class='macro'>PATH<span class='macro_popup'>"path"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="978"><td class="num" id="LN978">978</td><td class="line"> ID_COLUMN, settings_id,</td></tr> +<tr class="codeline" data-linenumber="979"><td class="num" id="LN979">979</td><td class="line"> LABEL_COLUMN, g_settings_get_string (settings, <span class='macro'>LABEL<span class='macro_popup'>"label"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="980"><td class="num" id="LN980">980</td><td class="line"> INTERFACE_COLUMN, g_settings_get_string (settings, <span class='macro'>INTERFACE<span class='macro_popup'>"interface"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="981"><td class="num" id="LN981">981</td><td class="line"> SENSOR_TYPE_COLUMN, g_settings_get_int (settings, <span class='macro'>SENSOR_TYPE<span class='macro_popup'>"sensor-type"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="982"><td class="num" id="LN982">982</td><td class="line"> ENABLE_COLUMN, enable,</td></tr> +<tr class="codeline" data-linenumber="983"><td class="num" id="LN983">983</td><td class="line"> VISIBLE_COLUMN, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="984"><td class="num" id="LN984">984</td><td class="line"> LOW_VALUE_COLUMN, g_settings_get_double (settings, <span class='macro'>LOW_VALUE<span class='macro_popup'>"low-value"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="985"><td class="num" id="LN985">985</td><td class="line"> HIGH_VALUE_COLUMN, g_settings_get_double (settings, <span class='macro'>HIGH_VALUE<span class='macro_popup'>"high-value"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="986"><td class="num" id="LN986">986</td><td class="line"> ALARM_ENABLE_COLUMN, g_settings_get_boolean (settings, <span class='macro'>ALARM_ENABLED<span class='macro_popup'>"alarm-enabled"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="987"><td class="num" id="LN987">987</td><td class="line"> ALARM_TIMEOUT_COLUMN, g_settings_get_int (settings, <span class='macro'>ALARM_TIMEOUT<span class='macro_popup'>"alarm-timeout"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="988"><td class="num" id="LN988">988</td><td class="line"> LOW_ALARM_COMMAND_COLUMN, g_settings_get_string (settings, <span class='macro'>LOW_ALARM_COMMAND<span class='macro_popup'>"low-alarm-command"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="989"><td class="num" id="LN989">989</td><td class="line"> HIGH_ALARM_COMMAND_COLUMN, g_settings_get_string (settings, <span class='macro'>HIGH_ALARM_COMMAND<span class='macro_popup'>"high-alarm-command"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="990"><td class="num" id="LN990">990</td><td class="line"> MULTIPLIER_COLUMN, g_settings_get_double (settings, <span class='macro'>MULTIPLIER<span class='macro_popup'>"multiplier"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="991"><td class="num" id="LN991">991</td><td class="line"> OFFSET_COLUMN, g_settings_get_double (settings, <span class='macro'>OFFSET<span class='macro_popup'>"offset"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="992"><td class="num" id="LN992">992</td><td class="line"> ICON_TYPE_COLUMN, g_settings_get_int (settings, <span class='macro'>ICON_TYPE<span class='macro_popup'>"icon-type"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="993"><td class="num" id="LN993">993</td><td class="line"> ICON_PIXBUF_COLUMN, icon,</td></tr> +<tr class="codeline" data-linenumber="994"><td class="num" id="LN994">994</td><td class="line"> GRAPH_COLOR_COLUMN, g_settings_get_string (settings, <span class='macro'>GRAPH_COLOR<span class='macro_popup'>"graph-color"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="995"><td class="num" id="LN995">995</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="996"><td class="num" id="LN996">996</td><td class="line"> g_free (settings_id);</td></tr> +<tr class="codeline" data-linenumber="997"><td class="num" id="LN997">997</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="998"><td class="num" id="LN998">998</td><td class="line"> icon = sensors_applet_load_icon(icon_type);</td></tr> +<tr class="codeline" data-linenumber="999"><td class="num" id="LN999">999</td><td class="line"> gtk_tree_store_set(sensors_applet->sensors,</td></tr> +<tr class="codeline" data-linenumber="1000"><td class="num" id="LN1000">1000</td><td class="line"> &sensors_iter,</td></tr> +<tr class="codeline" data-linenumber="1001"><td class="num" id="LN1001">1001</td><td class="line"> PATH_COLUMN, path,</td></tr> +<tr class="codeline" data-linenumber="1002"><td class="num" id="LN1002">1002</td><td class="line"> ID_COLUMN, id,</td></tr> +<tr class="codeline" data-linenumber="1003"><td class="num" id="LN1003">1003</td><td class="line"> LABEL_COLUMN, label,</td></tr> +<tr class="codeline" data-linenumber="1004"><td class="num" id="LN1004">1004</td><td class="line"> INTERFACE_COLUMN, interface,</td></tr> +<tr class="codeline" data-linenumber="1005"><td class="num" id="LN1005">1005</td><td class="line"> SENSOR_TYPE_COLUMN, type,</td></tr> +<tr class="codeline" data-linenumber="1006"><td class="num" id="LN1006">1006</td><td class="line"> ENABLE_COLUMN, enable,</td></tr> +<tr class="codeline" data-linenumber="1007"><td class="num" id="LN1007">1007</td><td class="line"> VISIBLE_COLUMN, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="1008"><td class="num" id="LN1008">1008</td><td class="line"> LOW_VALUE_COLUMN, low_value,</td></tr> +<tr class="codeline" data-linenumber="1009"><td class="num" id="LN1009">1009</td><td class="line"> HIGH_VALUE_COLUMN, high_value,</td></tr> +<tr class="codeline" data-linenumber="1010"><td class="num" id="LN1010">1010</td><td class="line"> ALARM_ENABLE_COLUMN, alarm_enable,</td></tr> +<tr class="codeline" data-linenumber="1011"><td class="num" id="LN1011">1011</td><td class="line"> ALARM_TIMEOUT_COLUMN, alarm_timeout,</td></tr> +<tr class="codeline" data-linenumber="1012"><td class="num" id="LN1012">1012</td><td class="line"> LOW_ALARM_COMMAND_COLUMN, low_alarm_command,</td></tr> +<tr class="codeline" data-linenumber="1013"><td class="num" id="LN1013">1013</td><td class="line"> HIGH_ALARM_COMMAND_COLUMN, high_alarm_command,</td></tr> +<tr class="codeline" data-linenumber="1014"><td class="num" id="LN1014">1014</td><td class="line"> MULTIPLIER_COLUMN, multiplier,</td></tr> +<tr class="codeline" data-linenumber="1015"><td class="num" id="LN1015">1015</td><td class="line"> OFFSET_COLUMN, offset,</td></tr> +<tr class="codeline" data-linenumber="1016"><td class="num" id="LN1016">1016</td><td class="line"> ICON_TYPE_COLUMN, icon_type,</td></tr> +<tr class="codeline" data-linenumber="1017"><td class="num" id="LN1017">1017</td><td class="line"> ICON_PIXBUF_COLUMN, icon,</td></tr> +<tr class="codeline" data-linenumber="1018"><td class="num" id="LN1018">1018</td><td class="line"> GRAPH_COLOR_COLUMN, graph_color,</td></tr> +<tr class="codeline" data-linenumber="1019"><td class="num" id="LN1019">1019</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="1020"><td class="num" id="LN1020">1020</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1021"><td class="num" id="LN1021">1021</td><td class="line"> g_object_unref (settings);</td></tr> +<tr class="codeline" data-linenumber="1022"><td class="num" id="LN1022">1022</td><td class="line"> g_debug(<span class='string_literal'>"added sensor %s to tree"</span>, path);</td></tr> +<tr class="codeline" data-linenumber="1023"><td class="num" id="LN1023">1023</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1024"><td class="num" id="LN1024">1024</td><td class="line"> <span class='comment'>/* remove reference to icon as tree now has ref */</span></td></tr> +<tr class="codeline" data-linenumber="1025"><td class="num" id="LN1025">1025</td><td class="line"> g_object_unref(icon);</td></tr> +<tr class="codeline" data-linenumber="1026"><td class="num" id="LN1026">1026</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1027"><td class="num" id="LN1027">1027</td><td class="line"> <span class='comment'>/* create the active sensor */</span></td></tr> +<tr class="codeline" data-linenumber="1028"><td class="num" id="LN1028">1028</td><td class="line"> <span class='keyword'>if</span> (enable) {</td></tr> +<tr class="codeline" data-linenumber="1029"><td class="num" id="LN1029">1029</td><td class="line"> tree_path = gtk_tree_model_get_path(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter);</td></tr> +<tr class="codeline" data-linenumber="1030"><td class="num" id="LN1030">1030</td><td class="line"> sensors_applet_sensor_enabled(sensors_applet, tree_path);</td></tr> +<tr class="codeline" data-linenumber="1031"><td class="num" id="LN1031">1031</td><td class="line"> gtk_tree_path_free(tree_path);</td></tr> +<tr class="codeline" data-linenumber="1032"><td class="num" id="LN1032">1032</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1033"><td class="num" id="LN1033">1033</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1034"><td class="num" id="LN1034">1034</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1035"><td class="num" id="LN1035">1035</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1036"><td class="num" id="LN1036">1036</td><td class="line"><span class='keyword'>static</span> ActiveSensor *sensors_applet_find_active_sensor(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1037"><td class="num" id="LN1037">1037</td><td class="line"> GtkTreePath *sensor_tree_path;</td></tr> +<tr class="codeline" data-linenumber="1038"><td class="num" id="LN1038">1038</td><td class="line"> GList *current_sensor;</td></tr> +<tr class="codeline" data-linenumber="1039"><td class="num" id="LN1039">1039</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1040"><td class="num" id="LN1040">1040</td><td class="line"> <span class='keyword'>for</span> (current_sensor = sensors_applet->active_sensors; current_sensor != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; current_sensor = <span class='macro'>g_list_next(current_sensor)<span class='macro_popup'>((current_sensor) ? (((GList *)(current_sensor))->next) : (<br>(void*)0))</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="1041"><td class="num" id="LN1041">1041</td><td class="line"> sensor_tree_path = gtk_tree_row_reference_get_path(((ActiveSensor *)(current_sensor->data))->sensor_row);</td></tr> +<tr class="codeline" data-linenumber="1042"><td class="num" id="LN1042">1042</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1043"><td class="num" id="LN1043">1043</td><td class="line"> <span class='keyword'>if</span> (gtk_tree_path_compare(path, sensor_tree_path) == 0) {</td></tr> +<tr class="codeline" data-linenumber="1044"><td class="num" id="LN1044">1044</td><td class="line"> gtk_tree_path_free(sensor_tree_path);</td></tr> +<tr class="codeline" data-linenumber="1045"><td class="num" id="LN1045">1045</td><td class="line"> <span class='keyword'>return</span> ((ActiveSensor *)(current_sensor->data));</td></tr> +<tr class="codeline" data-linenumber="1046"><td class="num" id="LN1046">1046</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1047"><td class="num" id="LN1047">1047</td><td class="line"> gtk_tree_path_free(sensor_tree_path);</td></tr> +<tr class="codeline" data-linenumber="1048"><td class="num" id="LN1048">1048</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1049"><td class="num" id="LN1049">1049</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1050"><td class="num" id="LN1050">1050</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1051"><td class="num" id="LN1051">1051</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1052"><td class="num" id="LN1052">1052</td><td class="line"><span class='comment'>/* path should be the full path to a file representing the sensor (eg</span></td></tr> +<tr class="codeline" data-linenumber="1053"><td class="num" id="LN1053">1053</td><td class="line"> <span class='comment'>* /dev/hda or /sys/devices/platform/i2c-0/0-0290/temp1_input) */</span></td></tr> +<tr class="codeline" data-linenumber="1054"><td class="num" id="LN1054">1054</td><td class="line"><span class='keyword'>void</span> sensors_applet_display_layout_changed(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="1055"><td class="num" id="LN1055">1055</td><td class="line"> <span class='comment'>/* update sensors since will need to update icons / graphs etc</span></td></tr> +<tr class="codeline" data-linenumber="1056"><td class="num" id="LN1056">1056</td><td class="line"> <span class='comment'>* if weren't displayed before */</span></td></tr> +<tr class="codeline" data-linenumber="1057"><td class="num" id="LN1057">1057</td><td class="line"> GList *list = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1058"><td class="num" id="LN1058">1058</td><td class="line"> <span class='keyword'>for</span> (list = sensors_applet->active_sensors; list != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; list = list->next) {</td></tr> +<tr class="codeline" data-linenumber="1059"><td class="num" id="LN1059">1059</td><td class="line"> ActiveSensor *as = (ActiveSensor *)list->data;</td></tr> +<tr class="codeline" data-linenumber="1060"><td class="num" id="LN1060">1060</td><td class="line"> as->updated = <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1061"><td class="num" id="LN1061">1061</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1062"><td class="num" id="LN1062">1062</td><td class="line"> sensors_applet_update_active_sensors(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1063"><td class="num" id="LN1063">1063</td><td class="line"> sensors_applet_pack_display(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1064"><td class="num" id="LN1064">1064</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1065"><td class="num" id="LN1065">1065</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1066"><td class="num" id="LN1066">1066</td><td class="line"><span class='keyword'>void</span> sensors_applet_alarm_off(SensorsApplet *sensors_applet,</td></tr> +<tr class="codeline" data-linenumber="1067"><td class="num" id="LN1067">1067</td><td class="line"> GtkTreePath *path,</td></tr> +<tr class="codeline" data-linenumber="1068"><td class="num" id="LN1068">1068</td><td class="line"> NotifType notif_type) {</td></tr> +<tr class="codeline" data-linenumber="1069"><td class="num" id="LN1069">1069</td><td class="line"> ActiveSensor *active_sensor;</td></tr> +<tr class="codeline" data-linenumber="1070"><td class="num" id="LN1070">1070</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1071"><td class="num" id="LN1071">1071</td><td class="line"> <span class='keyword'>if</span> ((active_sensor = sensors_applet_find_active_sensor(sensors_applet, path)) != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="1072"><td class="num" id="LN1072">1072</td><td class="line"> active_sensor_alarm_off(active_sensor, notif_type);</td></tr> +<tr class="codeline" data-linenumber="1073"><td class="num" id="LN1073">1073</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1074"><td class="num" id="LN1074">1074</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1075"><td class="num" id="LN1075">1075</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1076"><td class="num" id="LN1076">1076</td><td class="line"><span class='keyword'>void</span> sensors_applet_all_alarms_off(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1077"><td class="num" id="LN1077">1077</td><td class="line"> sensors_applet_alarm_off(sensors_applet, path, LOW_ALARM);</td></tr> +<tr class="codeline" data-linenumber="1078"><td class="num" id="LN1078">1078</td><td class="line"> sensors_applet_alarm_off(sensors_applet, path, HIGH_ALARM);</td></tr> +<tr class="codeline" data-linenumber="1079"><td class="num" id="LN1079">1079</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1080"><td class="num" id="LN1080">1080</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1081"><td class="num" id="LN1081">1081</td><td class="line"><span class='keyword'>void</span> sensors_applet_sensor_enabled(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1082"><td class="num" id="LN1082">1082</td><td class="line"> ActiveSensor *active_sensor;</td></tr> +<tr class="codeline" data-linenumber="1083"><td class="num" id="LN1083">1083</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1084"><td class="num" id="LN1084">1084</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_50<br>; if (sensors_applet) _g_boolean_var_50 = 1; else _g_boolean_var_50<br> = 0; _g_boolean_var_50; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1084, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1085"><td class="num" id="LN1085">1085</td><td class="line"> <span class='macro'>g_assert(path)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_51<br>; if (path) _g_boolean_var_51 = 1; else _g_boolean_var_51 = 0<br>; _g_boolean_var_51; }), 1)) ; else g_assertion_message_expr (<br>"sensors-applet", "sensors-applet.c", 1085, ((const char*) (__func__<br>)), "path"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1086"><td class="num" id="LN1086">1086</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1087"><td class="num" id="LN1087">1087</td><td class="line"> active_sensor = active_sensor_new(sensors_applet, gtk_tree_row_reference_new(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, path));</td></tr> +<tr class="codeline" data-linenumber="1088"><td class="num" id="LN1088">1088</td><td class="line"> active_sensor_update(active_sensor, sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1089"><td class="num" id="LN1089">1089</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1090"><td class="num" id="LN1090">1090</td><td class="line"> <span class='comment'>/* keep list sorted */</span></td></tr> +<tr class="codeline" data-linenumber="1091"><td class="num" id="LN1091">1091</td><td class="line"> sensors_applet->active_sensors = g_list_insert_sorted(sensors_applet->active_sensors,</td></tr> +<tr class="codeline" data-linenumber="1092"><td class="num" id="LN1092">1092</td><td class="line"> active_sensor,</td></tr> +<tr class="codeline" data-linenumber="1093"><td class="num" id="LN1093">1093</td><td class="line"> (GCompareFunc)active_sensor_compare);</td></tr> +<tr class="codeline" data-linenumber="1094"><td class="num" id="LN1094">1094</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1095"><td class="num" id="LN1095">1095</td><td class="line"> sensors_applet_pack_display(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1096"><td class="num" id="LN1096">1096</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1097"><td class="num" id="LN1097">1097</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1098"><td class="num" id="LN1098">1098</td><td class="line"><span class='keyword'>void</span> sensors_applet_reorder_sensors(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="1099"><td class="num" id="LN1099">1099</td><td class="line"> sensors_applet->active_sensors = g_list_sort(sensors_applet->active_sensors, (GCompareFunc)active_sensor_compare);</td></tr> +<tr class="codeline" data-linenumber="1100"><td class="num" id="LN1100">1100</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1101"><td class="num" id="LN1101">1101</td><td class="line"> sensors_applet_pack_display(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1102"><td class="num" id="LN1102">1102</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1103"><td class="num" id="LN1103">1103</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1104"><td class="num" id="LN1104">1104</td><td class="line"><span class='keyword'>void</span> sensors_applet_sensor_disabled(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1105"><td class="num" id="LN1105">1105</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1106"><td class="num" id="LN1106">1106</td><td class="line"> ActiveSensor *active_sensor;</td></tr> +<tr class="codeline" data-linenumber="1107"><td class="num" id="LN1107">1107</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1108"><td class="num" id="LN1108">1108</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_52<br>; if (sensors_applet) _g_boolean_var_52 = 1; else _g_boolean_var_52<br> = 0; _g_boolean_var_52; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1108, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1109"><td class="num" id="LN1109">1109</td><td class="line"> <span class='macro'>g_assert(path)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_53<br>; if (path) _g_boolean_var_53 = 1; else _g_boolean_var_53 = 0<br>; _g_boolean_var_53; }), 1)) ; else g_assertion_message_expr (<br>"sensors-applet", "sensors-applet.c", 1109, ((const char*) (__func__<br>)), "path"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1110"><td class="num" id="LN1110">1110</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1111"><td class="num" id="LN1111">1111</td><td class="line"> <span class='keyword'>if</span> ((active_sensor = sensors_applet_find_active_sensor(sensors_applet, path)) != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="1112"><td class="num" id="LN1112">1112</td><td class="line"> g_debug(<span class='string_literal'>"Destroying active sensor..."</span>);</td></tr> +<tr class="codeline" data-linenumber="1113"><td class="num" id="LN1113">1113</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1114"><td class="num" id="LN1114">1114</td><td class="line"> g_debug(<span class='string_literal'>"-- removing from list..."</span>);</td></tr> +<tr class="codeline" data-linenumber="1115"><td class="num" id="LN1115">1115</td><td class="line"> sensors_applet->active_sensors = g_list_remove(sensors_applet->active_sensors, active_sensor);</td></tr> +<tr class="codeline" data-linenumber="1116"><td class="num" id="LN1116">1116</td><td class="line"> g_debug(<span class='string_literal'>"-- repacking display...."</span>);</td></tr> +<tr class="codeline" data-linenumber="1117"><td class="num" id="LN1117">1117</td><td class="line"> sensors_applet_pack_display(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1118"><td class="num" id="LN1118">1118</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1119"><td class="num" id="LN1119">1119</td><td class="line"> active_sensor_destroy(active_sensor);</td></tr> +<tr class="codeline" data-linenumber="1120"><td class="num" id="LN1120">1120</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1121"><td class="num" id="LN1121">1121</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1122"><td class="num" id="LN1122">1122</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1123"><td class="num" id="LN1123">1123</td><td class="line"><span class='keyword'>void</span> sensors_applet_update_sensor(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1124"><td class="num" id="LN1124">1124</td><td class="line"> ActiveSensor *active_sensor;</td></tr> +<tr class="codeline" data-linenumber="1125"><td class="num" id="LN1125">1125</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1126"><td class="num" id="LN1126">1126</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_54<br>; if (sensors_applet) _g_boolean_var_54 = 1; else _g_boolean_var_54<br> = 0; _g_boolean_var_54; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1126, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1127"><td class="num" id="LN1127">1127</td><td class="line"> <span class='macro'>g_assert(path)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_55<br>; if (path) _g_boolean_var_55 = 1; else _g_boolean_var_55 = 0<br>; _g_boolean_var_55; }), 1)) ; else g_assertion_message_expr (<br>"sensors-applet", "sensors-applet.c", 1127, ((const char*) (__func__<br>)), "path"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1128"><td class="num" id="LN1128">1128</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1129"><td class="num" id="LN1129">1129</td><td class="line"> <span class='keyword'>if</span> ((active_sensor = sensors_applet_find_active_sensor(sensors_applet, path)) != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="1130"><td class="num" id="LN1130">1130</td><td class="line"> active_sensor_update(active_sensor, sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1131"><td class="num" id="LN1131">1131</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1132"><td class="num" id="LN1132">1132</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1133"><td class="num" id="LN1133">1133</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1134"><td class="num" id="LN1134">1134</td><td class="line"><span class='keyword'>void</span> sensors_applet_icon_changed(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1135"><td class="num" id="LN1135">1135</td><td class="line"> ActiveSensor *active_sensor;</td></tr> +<tr class="codeline" data-linenumber="1136"><td class="num" id="LN1136">1136</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1137"><td class="num" id="LN1137">1137</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_56<br>; if (sensors_applet) _g_boolean_var_56 = 1; else _g_boolean_var_56<br> = 0; _g_boolean_var_56; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1137, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1138"><td class="num" id="LN1138">1138</td><td class="line"> <span class='macro'>g_assert(path)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_57<br>; if (path) _g_boolean_var_57 = 1; else _g_boolean_var_57 = 0<br>; _g_boolean_var_57; }), 1)) ; else g_assertion_message_expr (<br>"sensors-applet", "sensors-applet.c", 1138, ((const char*) (__func__<br>)), "path"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1139"><td class="num" id="LN1139">1139</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1140"><td class="num" id="LN1140">1140</td><td class="line"> <span class='keyword'>if</span> ((active_sensor = sensors_applet_find_active_sensor(sensors_applet, path)) != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="1141"><td class="num" id="LN1141">1141</td><td class="line"> active_sensor_icon_changed(active_sensor, sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1142"><td class="num" id="LN1142">1142</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1143"><td class="num" id="LN1143">1143</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1144"><td class="num" id="LN1144">1144</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1145"><td class="num" id="LN1145">1145</td><td class="line"><span class='comment'>/* Cycle thru ActiveSensors and update them all */</span></td></tr> +<tr class="codeline" data-linenumber="1146"><td class="num" id="LN1146">1146</td><td class="line">gboolean sensors_applet_update_active_sensors(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="1147"><td class="num" id="LN1147">1147</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_58<br>; if (sensors_applet) _g_boolean_var_58 = 1; else _g_boolean_var_58<br> = 0; _g_boolean_var_58; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1147, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1148"><td class="num" id="LN1148">1148</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1149"><td class="num" id="LN1149">1149</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->active_sensors) {</td></tr> +<tr class="codeline" data-linenumber="1150"><td class="num" id="LN1150">1150</td><td class="line"> g_list_foreach(sensors_applet->active_sensors,</td></tr> +<tr class="codeline" data-linenumber="1151"><td class="num" id="LN1151">1151</td><td class="line"> (GFunc)active_sensor_update,</td></tr> +<tr class="codeline" data-linenumber="1152"><td class="num" id="LN1152">1152</td><td class="line"> sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1153"><td class="num" id="LN1153">1153</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1154"><td class="num" id="LN1154">1154</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1155"><td class="num" id="LN1155">1155</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1156"><td class="num" id="LN1156">1156</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1157"><td class="num" id="LN1157">1157</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1158"><td class="num" id="LN1158">1158</td><td class="line"><span class='comment'>/* Cycle thru ActiveSensors and set new graph dimensions */</span></td></tr> +<tr class="codeline" data-linenumber="1159"><td class="num" id="LN1159">1159</td><td class="line"><span class='keyword'>void</span> sensors_applet_graph_size_changed(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="1160"><td class="num" id="LN1160">1160</td><td class="line"> gint dimensions[2];</td></tr> +<tr class="codeline" data-linenumber="1161"><td class="num" id="LN1161">1161</td><td class="line"> gint graph_size;</td></tr> +<tr class="codeline" data-linenumber="1162"><td class="num" id="LN1162">1162</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_59<br>; if (sensors_applet) _g_boolean_var_59 = 1; else _g_boolean_var_59<br> = 0; _g_boolean_var_59; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1162, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1163"><td class="num" id="LN1163">1163</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1164"><td class="num" id="LN1164">1164</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->active_sensors) {</td></tr> +<tr class="codeline" data-linenumber="1165"><td class="num" id="LN1165">1165</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1166"><td class="num" id="LN1166">1166</td><td class="line"> graph_size = g_settings_get_int (sensors_applet->settings, <span class='macro'>GRAPH_SIZE<span class='macro_popup'>"graph-size"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1167"><td class="num" id="LN1167">1167</td><td class="line"> <span class='keyword'>if</span> (mate_panel_applet_get_orient(sensors_applet->applet) == MATE_PANEL_APPLET_ORIENT_UP ||</td></tr> +<tr class="codeline" data-linenumber="1168"><td class="num" id="LN1168">1168</td><td class="line"> mate_panel_applet_get_orient(sensors_applet->applet) == MATE_PANEL_APPLET_ORIENT_DOWN) {</td></tr> +<tr class="codeline" data-linenumber="1169"><td class="num" id="LN1169">1169</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1170"><td class="num" id="LN1170">1170</td><td class="line"> <span class='comment'>/* is horizontal so set graph_size as width */</span></td></tr> +<tr class="codeline" data-linenumber="1171"><td class="num" id="LN1171">1171</td><td class="line"> dimensions[0] = graph_size;</td></tr> +<tr class="codeline" data-linenumber="1172"><td class="num" id="LN1172">1172</td><td class="line"> dimensions[1] = sensors_applet->size;</td></tr> +<tr class="codeline" data-linenumber="1173"><td class="num" id="LN1173">1173</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="1174"><td class="num" id="LN1174">1174</td><td class="line"> dimensions[0] = sensors_applet->size;</td></tr> +<tr class="codeline" data-linenumber="1175"><td class="num" id="LN1175">1175</td><td class="line"> dimensions[1] = graph_size;</td></tr> +<tr class="codeline" data-linenumber="1176"><td class="num" id="LN1176">1176</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1177"><td class="num" id="LN1177">1177</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1178"><td class="num" id="LN1178">1178</td><td class="line"> g_list_foreach(sensors_applet->active_sensors,</td></tr> +<tr class="codeline" data-linenumber="1179"><td class="num" id="LN1179">1179</td><td class="line"> (GFunc)active_sensor_update_graph_dimensions,</td></tr> +<tr class="codeline" data-linenumber="1180"><td class="num" id="LN1180">1180</td><td class="line"> &dimensions);</td></tr> +<tr class="codeline" data-linenumber="1181"><td class="num" id="LN1181">1181</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1182"><td class="num" id="LN1182">1182</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1183"><td class="num" id="LN1183">1183</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1184"><td class="num" id="LN1184">1184</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1185"><td class="num" id="LN1185">1185</td><td class="line">gdouble sensors_applet_convert_temperature(gdouble value, TemperatureScale old, TemperatureScale new) {</td></tr> +<tr class="codeline" data-linenumber="1186"><td class="num" id="LN1186">1186</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1187"><td class="num" id="LN1187">1187</td><td class="line"> <span class='keyword'>switch</span> (old) {</td></tr> +<tr class="codeline" data-linenumber="1188"><td class="num" id="LN1188">1188</td><td class="line"> <span class='keyword'>case</span> KELVIN:</td></tr> +<tr class="codeline" data-linenumber="1189"><td class="num" id="LN1189">1189</td><td class="line"> <span class='keyword'>switch</span> (new) {</td></tr> +<tr class="codeline" data-linenumber="1190"><td class="num" id="LN1190">1190</td><td class="line"> <span class='keyword'>case</span> CELSIUS:</td></tr> +<tr class="codeline" data-linenumber="1191"><td class="num" id="LN1191">1191</td><td class="line"> value = value - 273.0;</td></tr> +<tr class="codeline" data-linenumber="1192"><td class="num" id="LN1192">1192</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1193"><td class="num" id="LN1193">1193</td><td class="line"> <span class='keyword'>case</span> FAHRENHEIT:</td></tr> +<tr class="codeline" data-linenumber="1194"><td class="num" id="LN1194">1194</td><td class="line"> value = (9.0 * (value - 273) / 5.0) + 32.0;</td></tr> +<tr class="codeline" data-linenumber="1195"><td class="num" id="LN1195">1195</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1196"><td class="num" id="LN1196">1196</td><td class="line"> <span class='keyword'>case</span> KELVIN:</td></tr> +<tr class="codeline" data-linenumber="1197"><td class="num" id="LN1197">1197</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1198"><td class="num" id="LN1198">1198</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1199"><td class="num" id="LN1199">1199</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1200"><td class="num" id="LN1200">1200</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1201"><td class="num" id="LN1201">1201</td><td class="line"> <span class='keyword'>case</span> CELSIUS:</td></tr> +<tr class="codeline" data-linenumber="1202"><td class="num" id="LN1202">1202</td><td class="line"> <span class='keyword'>switch</span> (new) {</td></tr> +<tr class="codeline" data-linenumber="1203"><td class="num" id="LN1203">1203</td><td class="line"> <span class='keyword'>case</span> FAHRENHEIT:</td></tr> +<tr class="codeline" data-linenumber="1204"><td class="num" id="LN1204">1204</td><td class="line"> value = (9.0 * value / 5.0) + 32.0;</td></tr> +<tr class="codeline" data-linenumber="1205"><td class="num" id="LN1205">1205</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1206"><td class="num" id="LN1206">1206</td><td class="line"> <span class='keyword'>case</span> KELVIN:</td></tr> +<tr class="codeline" data-linenumber="1207"><td class="num" id="LN1207">1207</td><td class="line"> value = value + 273.0;</td></tr> +<tr class="codeline" data-linenumber="1208"><td class="num" id="LN1208">1208</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1209"><td class="num" id="LN1209">1209</td><td class="line"> <span class='keyword'>case</span> CELSIUS:</td></tr> +<tr class="codeline" data-linenumber="1210"><td class="num" id="LN1210">1210</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1211"><td class="num" id="LN1211">1211</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1212"><td class="num" id="LN1212">1212</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1213"><td class="num" id="LN1213">1213</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1214"><td class="num" id="LN1214">1214</td><td class="line"> <span class='keyword'>case</span> FAHRENHEIT:</td></tr> +<tr class="codeline" data-linenumber="1215"><td class="num" id="LN1215">1215</td><td class="line"> <span class='keyword'>switch</span> (new) {</td></tr> +<tr class="codeline" data-linenumber="1216"><td class="num" id="LN1216">1216</td><td class="line"> <span class='keyword'>case</span> CELSIUS:</td></tr> +<tr class="codeline" data-linenumber="1217"><td class="num" id="LN1217">1217</td><td class="line"> value = (5.0 * (value - 32.0) / 9.0);</td></tr> +<tr class="codeline" data-linenumber="1218"><td class="num" id="LN1218">1218</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1219"><td class="num" id="LN1219">1219</td><td class="line"> <span class='keyword'>case</span> KELVIN:</td></tr> +<tr class="codeline" data-linenumber="1220"><td class="num" id="LN1220">1220</td><td class="line"> value = (5.0 * (value - 32.0) / 9.0) + 273.0;</td></tr> +<tr class="codeline" data-linenumber="1221"><td class="num" id="LN1221">1221</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1222"><td class="num" id="LN1222">1222</td><td class="line"> <span class='keyword'>case</span> FAHRENHEIT:</td></tr> +<tr class="codeline" data-linenumber="1223"><td class="num" id="LN1223">1223</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1224"><td class="num" id="LN1224">1224</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1225"><td class="num" id="LN1225">1225</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1226"><td class="num" id="LN1226">1226</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1227"><td class="num" id="LN1227">1227</td><td class="line"> <span class='keyword'>return</span> value;</td></tr> +<tr class="codeline" data-linenumber="1228"><td class="num" id="LN1228">1228</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1229"><td class="num" id="LN1229">1229</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1230"><td class="num" id="LN1230">1230</td><td class="line"><span class='keyword'>void</span> sensors_applet_init(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="1231"><td class="num" id="LN1231">1231</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1232"><td class="num" id="LN1232">1232</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_60<br>; if (sensors_applet) _g_boolean_var_60 = 1; else _g_boolean_var_60<br> = 0; _g_boolean_var_60; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1232, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1233"><td class="num" id="LN1233">1233</td><td class="line"> <span class='macro'>g_assert(sensors_applet->applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_61<br>; if (sensors_applet->applet) _g_boolean_var_61 = 1; else _g_boolean_var_61<br> = 0; _g_boolean_var_61; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1233, ((const char*) (<br>__func__)), "sensors_applet->applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1234"><td class="num" id="LN1234">1234</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1235"><td class="num" id="LN1235">1235</td><td class="line"> GtkActionGroup *action_group;</td></tr> +<tr class="codeline" data-linenumber="1236"><td class="num" id="LN1236">1236</td><td class="line"> gchar *ui_path;</td></tr> +<tr class="codeline" data-linenumber="1237"><td class="num" id="LN1237">1237</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1238"><td class="num" id="LN1238">1238</td><td class="line"> <span class='comment'>/* Have our background automatically painted. */</span></td></tr> +<tr class="codeline" data-linenumber="1239"><td class="num" id="LN1239">1239</td><td class="line"> mate_panel_applet_set_background_widget(MATE_PANEL_APPLET(sensors_applet->applet), <span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1240"><td class="num" id="LN1240">1240</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1241"><td class="num" id="LN1241">1241</td><td class="line"> <span class='comment'>/* plugin functions are stored as name -> get_value_function pairs so</span></td></tr> +<tr class="codeline" data-linenumber="1242"><td class="num" id="LN1242">1242</td><td class="line"> <span class='comment'>* use standard string functions on hash table */</span></td></tr> +<tr class="codeline" data-linenumber="1243"><td class="num" id="LN1243">1243</td><td class="line"> sensors_applet->plugins = g_hash_table_new(g_str_hash, g_str_equal);</td></tr> +<tr class="codeline" data-linenumber="1244"><td class="num" id="LN1244">1244</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1245"><td class="num" id="LN1245">1245</td><td class="line"> sensors_applet->required_plugins = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1246"><td class="num" id="LN1246">1246</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1247"><td class="num" id="LN1247">1247</td><td class="line"> <span class='comment'>/* initialise size */</span></td></tr> +<tr class="codeline" data-linenumber="1248"><td class="num" id="LN1248">1248</td><td class="line"> sensors_applet->size = <span class='macro'>DEFAULT_APPLET_SIZE<span class='macro_popup'>24</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1249"><td class="num" id="LN1249">1249</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1250"><td class="num" id="LN1250">1250</td><td class="line"> mate_panel_applet_set_flags(sensors_applet->applet, MATE_PANEL_APPLET_EXPAND_MINOR);</td></tr> +<tr class="codeline" data-linenumber="1251"><td class="num" id="LN1251">1251</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1252"><td class="num" id="LN1252">1252</td><td class="line"> <span class='macro'>g_signal_connect(sensors_applet->applet, <span class='string_literal'>"destroy"</span>,<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("destroy"<br>), (((GCallback) (destroy_cb))), (sensors_applet), ((void*)0)<br>, (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1253"><td class="num" id="LN1253">1253</td><td class="line"> <span class='macro'>G_CALLBACK(destroy_cb),<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("destroy"<br>), (((GCallback) (destroy_cb))), (sensors_applet), ((void*)0)<br>, (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1254"><td class="num" id="LN1254">1254</td><td class="line"> <span class='macro'>sensors_applet)<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("destroy"<br>), (((GCallback) (destroy_cb))), (sensors_applet), ((void*)0)<br>, (GConnectFlags) 0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1255"><td class="num" id="LN1255">1255</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1256"><td class="num" id="LN1256">1256</td><td class="line"> <span class='comment'>/* init gsettings */</span></td></tr> +<tr class="codeline" data-linenumber="1257"><td class="num" id="LN1257">1257</td><td class="line"> sensors_applet->settings = mate_panel_applet_settings_new (sensors_applet->applet, <span class='string_literal'>"org.mate.sensors-applet"</span>);</td></tr> +<tr class="codeline" data-linenumber="1258"><td class="num" id="LN1258">1258</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1259"><td class="num" id="LN1259">1259</td><td class="line"> <span class='comment'>/* set up builder for sorting verification */</span></td></tr> +<tr class="codeline" data-linenumber="1260"><td class="num" id="LN1260">1260</td><td class="line"> g_variant_builder_init (&gvb_sensors_hash_list, <span class='macro'>G_VARIANT_TYPE (<span class='string_literal'>"as"</span>)<span class='macro_popup'>(g_variant_type_checked_ (("as")))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1261"><td class="num" id="LN1261">1261</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1262"><td class="num" id="LN1262">1262</td><td class="line"> <span class='comment'>/* set up / load sensors from the plugins */</span></td></tr> +<tr class="codeline" data-linenumber="1263"><td class="num" id="LN1263">1263</td><td class="line"> sensors_applet_plugins_load_all(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1264"><td class="num" id="LN1264">1264</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1265"><td class="num" id="LN1265">1265</td><td class="line"> <span class='comment'>/* set sorting hash array */</span></td></tr> +<tr class="codeline" data-linenumber="1266"><td class="num" id="LN1266">1266</td><td class="line"> GVariant *gv_temp = g_variant_builder_end (&gvb_sensors_hash_list);</td></tr> +<tr class="codeline" data-linenumber="1267"><td class="num" id="LN1267">1267</td><td class="line"> sensors_applet->sensors_hash_array = g_variant_dup_strv (gv_temp, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1268"><td class="num" id="LN1268">1268</td><td class="line"> g_variant_unref (gv_temp);</td></tr> +<tr class="codeline" data-linenumber="1269"><td class="num" id="LN1269">1269</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1270"><td class="num" id="LN1270">1270</td><td class="line"> <span class='comment'>/* sort sensors based on saved sorting */</span></td></tr> +<tr class="codeline" data-linenumber="1271"><td class="num" id="LN1271">1271</td><td class="line"> sensors_applet_settings_sort_sensors(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1272"><td class="num" id="LN1272">1272</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1273"><td class="num" id="LN1273">1273</td><td class="line"> <span class='comment'>/* free hash array */</span></td></tr> +<tr class="codeline" data-linenumber="1274"><td class="num" id="LN1274">1274</td><td class="line"> g_strfreev (sensors_applet->sensors_hash_array);</td></tr> +<tr class="codeline" data-linenumber="1275"><td class="num" id="LN1275">1275</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1276"><td class="num" id="LN1276">1276</td><td class="line"> <span class='comment'>/* should have created sensors tree above, but if have not was because we couldn't find any sensors */</span></td></tr> +<tr class="codeline" data-linenumber="1277"><td class="num" id="LN1277">1277</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == sensors_applet->sensors) {</td></tr> +<tr class="codeline" data-linenumber="1278"><td class="num" id="LN1278">1278</td><td class="line"> GtkWidget *label;</td></tr> +<tr class="codeline" data-linenumber="1279"><td class="num" id="LN1279">1279</td><td class="line"> label = gtk_label_new(<span class='macro'>_(<span class='string_literal'>"No sensors found!"</span>)<span class='macro_popup'>dcgettext (((void*)0), "No sensors found!", 5)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1280"><td class="num" id="LN1280">1280</td><td class="line"> gtk_container_add(<span class='macro'>GTK_CONTAINER(sensors_applet->applet)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->applet)))))</span></span>, label);</td></tr> +<tr class="codeline" data-linenumber="1281"><td class="num" id="LN1281">1281</td><td class="line"> gtk_widget_show_all(<span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1282"><td class="num" id="LN1282">1282</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="1283"><td class="num" id="LN1283">1283</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1284"><td class="num" id="LN1284">1284</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1285"><td class="num" id="LN1285">1285</td><td class="line"> <span class='comment'>/* only do menu and signal connections if sensors are found */</span></td></tr> +<tr class="codeline" data-linenumber="1286"><td class="num" id="LN1286">1286</td><td class="line"> action_group = gtk_action_group_new (<span class='string_literal'>"Sensors Applet Actions"</span>);</td></tr> +<tr class="codeline" data-linenumber="1287"><td class="num" id="LN1287">1287</td><td class="line"> gtk_action_group_set_translation_domain (action_group, <span class='macro'>GETTEXT_PACKAGE<span class='macro_popup'>"mate-sensors-applet"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1288"><td class="num" id="LN1288">1288</td><td class="line"> gtk_action_group_add_actions (action_group,</td></tr> +<tr class="codeline" data-linenumber="1289"><td class="num" id="LN1289">1289</td><td class="line"> sensors_applet_menu_actions,</td></tr> +<tr class="codeline" data-linenumber="1290"><td class="num" id="LN1290">1290</td><td class="line"> <span class='macro'>G_N_ELEMENTS (sensors_applet_menu_actions)<span class='macro_popup'>(sizeof (sensors_applet_menu_actions) / sizeof ((sensors_applet_menu_actions<br>)[0]))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="1291"><td class="num" id="LN1291">1291</td><td class="line"> sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1292"><td class="num" id="LN1292">1292</td><td class="line"> ui_path = g_build_filename (<span class='macro'>UIDIR<span class='macro_popup'>"/usr/local/share/mate-sensors-applet/ui"</span></span>, <span class='macro'>SENSORS_APPLET_MENU_FILE<span class='macro_popup'>"SensorsApplet.xml"</span></span>, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1293"><td class="num" id="LN1293">1293</td><td class="line"> mate_panel_applet_setup_menu_from_file (sensors_applet->applet, ui_path, action_group);</td></tr> +<tr class="codeline" data-linenumber="1294"><td class="num" id="LN1294">1294</td><td class="line"> g_free (ui_path);</td></tr> +<tr class="codeline" data-linenumber="1295"><td class="num" id="LN1295">1295</td><td class="line"> g_object_unref (action_group);</td></tr> +<tr class="codeline" data-linenumber="1296"><td class="num" id="LN1296">1296</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1297"><td class="num" id="LN1297">1297</td><td class="line"> <span class='macro'>g_signal_connect(sensors_applet->applet, <span class='string_literal'>"style-set"</span>,<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("style-set"<br>), (((GCallback) (style_set_cb))), (sensors_applet), ((void*)<br>0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1298"><td class="num" id="LN1298">1298</td><td class="line"> <span class='macro'>G_CALLBACK(style_set_cb),<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("style-set"<br>), (((GCallback) (style_set_cb))), (sensors_applet), ((void*)<br>0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1299"><td class="num" id="LN1299">1299</td><td class="line"> <span class='macro'>sensors_applet)<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("style-set"<br>), (((GCallback) (style_set_cb))), (sensors_applet), ((void*)<br>0), (GConnectFlags) 0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1300"><td class="num" id="LN1300">1300</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1301"><td class="num" id="LN1301">1301</td><td class="line"> <span class='macro'>g_signal_connect(G_OBJECT(sensors_applet->applet), <span class='string_literal'>"change_orient"</span>,<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("change_orient"), (((GCallback) (change_orient_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1302"><td class="num" id="LN1302">1302</td><td class="line"> <span class='macro'>G_CALLBACK(change_orient_cb),<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("change_orient"), (((GCallback) (change_orient_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1303"><td class="num" id="LN1303">1303</td><td class="line"> <span class='macro'>sensors_applet)<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("change_orient"), (((GCallback) (change_orient_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1304"><td class="num" id="LN1304">1304</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1305"><td class="num" id="LN1305">1305</td><td class="line"> <span class='macro'>g_signal_connect(G_OBJECT(sensors_applet->applet), <span class='string_literal'>"size_allocate"</span>,<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("size_allocate"), (((GCallback) (size_allocate_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1306"><td class="num" id="LN1306">1306</td><td class="line"> <span class='macro'>G_CALLBACK(size_allocate_cb),<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("size_allocate"), (((GCallback) (size_allocate_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1307"><td class="num" id="LN1307">1307</td><td class="line"> <span class='macro'>sensors_applet)<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("size_allocate"), (((GCallback) (size_allocate_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1308"><td class="num" id="LN1308">1308</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1309"><td class="num" id="LN1309">1309</td><td class="line"> <span class='macro'>g_signal_connect(G_OBJECT(sensors_applet->applet), <span class='string_literal'>"leave_notify_event"</span>,<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("leave_notify_event"), (((GCallback) (mouse_leave_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span></td></tr> +<tr class="codeline" data-linenumber="1310"><td class="num" id="LN1310">1310</td><td class="line"> <span class='macro'>G_CALLBACK(mouse_leave_cb),<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("leave_notify_event"), (((GCallback) (mouse_leave_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span></td></tr> +<tr class="codeline" data-linenumber="1311"><td class="num" id="LN1311">1311</td><td class="line"> <span class='macro'>(gpointer)sensors_applet)<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("leave_notify_event"), (((GCallback) (mouse_leave_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1312"><td class="num" id="LN1312">1312</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1313"><td class="num" id="LN1313">1313</td><td class="line"> <span class='macro'>g_signal_connect(G_OBJECT(sensors_applet->applet), <span class='string_literal'>"enter_notify_event"</span>,<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("enter_notify_event"), (((GCallback) (mouse_enter_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span></td></tr> +<tr class="codeline" data-linenumber="1314"><td class="num" id="LN1314">1314</td><td class="line"> <span class='macro'>G_CALLBACK(mouse_enter_cb),<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("enter_notify_event"), (((GCallback) (mouse_enter_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span></td></tr> +<tr class="codeline" data-linenumber="1315"><td class="num" id="LN1315">1315</td><td class="line"> <span class='macro'>(gpointer)sensors_applet)<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("enter_notify_event"), (((GCallback) (mouse_enter_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1316"><td class="num" id="LN1316">1316</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1317"><td class="num" id="LN1317">1317</td><td class="line"> sensors_applet_update_active_sensors(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1318"><td class="num" id="LN1318">1318</td><td class="line"> sensors_applet_pack_display(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1319"><td class="num" id="LN1319">1319</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1320"><td class="num" id="LN1320">1320</td><td class="line"> sensors_applet->timeout_id = g_timeout_add_seconds(g_settings_get_int(sensors_applet->settings, <span class='macro'>TIMEOUT<span class='macro_popup'>"timeout-delay"</span></span>) / 1000,</td></tr> +<tr class="codeline" data-linenumber="1321"><td class="num" id="LN1321">1321</td><td class="line"> (GSourceFunc)sensors_applet_update_active_sensors,</td></tr> +<tr class="codeline" data-linenumber="1322"><td class="num" id="LN1322">1322</td><td class="line"> sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1323"><td class="num" id="LN1323">1323</td><td class="line"> gtk_widget_show_all(<span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1324"><td class="num" id="LN1324">1324</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1325"><td class="num" id="LN1325">1325</td><td class="line"> </td></tr> +</table></body></html> diff --git a/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-699f6d.html b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-699f6d.html new file mode 100644 index 0000000..af95629 --- /dev/null +++ b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-699f6d.html @@ -0,0 +1,2005 @@ +<!doctype html> +<html> +<head> +<title>sensors-applet.c</title> + +<style type="text/css"> +body { color:#000000; background-color:#ffffff } +body { font-family:Helvetica, sans-serif; font-size:10pt } +h1 { font-size:14pt } +.FileName { margin-top: 5px; margin-bottom: 5px; display: inline; } +.FileNav { margin-left: 5px; margin-right: 5px; display: inline; } +.FileNav a { text-decoration:none; font-size: larger; } +.divider { margin-top: 30px; margin-bottom: 30px; height: 15px; } +.divider { background-color: gray; } +.code { border-collapse:collapse; width:100%; } +.code { font-family: "Monospace", monospace; font-size:10pt } +.code { line-height: 1.2em } +.comment { color: green; font-style: oblique } +.keyword { color: blue } +.string_literal { color: red } +.directive { color: darkmagenta } + +/* Macros and variables could have pop-up notes hidden by default. + - Macro pop-up: expansion of the macro + - Variable pop-up: value (table) of the variable */ +.macro_popup, .variable_popup { display: none; } + +/* Pop-up appears on mouse-hover event. */ +.macro:hover .macro_popup, .variable:hover .variable_popup { + display: block; + padding: 2px; + -webkit-border-radius:5px; + -webkit-box-shadow:1px 1px 7px #000; + border-radius:5px; + box-shadow:1px 1px 7px #000; + position: absolute; + top: -1em; + left:10em; + z-index: 1 +} + +.macro_popup { + border: 2px solid red; + background-color:#FFF0F0; + font-weight: normal; +} + +.variable_popup { + border: 2px solid blue; + background-color:#F0F0FF; + font-weight: bold; + font-family: Helvetica, sans-serif; + font-size: 9pt; +} + +/* Pop-up notes needs a relative position as a base where they pops up. */ +.macro, .variable { + background-color: PaleGoldenRod; + position: relative; +} +.macro { color: DarkMagenta; } + +#tooltiphint { + position: fixed; + width: 50em; + margin-left: -25em; + left: 50%; + padding: 10px; + border: 1px solid #b0b0b0; + border-radius: 2px; + box-shadow: 1px 1px 7px black; + background-color: #c0c0c0; + z-index: 2; +} + +.num { width:2.5em; padding-right:2ex; background-color:#eeeeee } +.num { text-align:right; font-size:8pt } +.num { color:#444444 } +.line { padding-left: 1ex; border-left: 3px solid #ccc } +.line { white-space: pre } +.msg { -webkit-box-shadow:1px 1px 7px #000 } +.msg { box-shadow:1px 1px 7px #000 } +.msg { -webkit-border-radius:5px } +.msg { border-radius:5px } +.msg { font-family:Helvetica, sans-serif; font-size:8pt } +.msg { float:left } +.msg { position:relative } +.msg { padding:0.25em 1ex 0.25em 1ex } +.msg { margin-top:10px; margin-bottom:10px } +.msg { font-weight:bold } +.msg { max-width:60em; word-wrap: break-word; white-space: pre-wrap } +.msgT { padding:0x; spacing:0x } +.msgEvent { background-color:#fff8b4; color:#000000 } +.msgControl { background-color:#bbbbbb; color:#000000 } +.msgNote { background-color:#ddeeff; color:#000000 } +.mrange { background-color:#dfddf3 } +.mrange { border-bottom:1px solid #6F9DBE } +.PathIndex { font-weight: bold; padding:0px 5px; margin-right:5px; } +.PathIndex { -webkit-border-radius:8px } +.PathIndex { border-radius:8px } +.PathIndexEvent { background-color:#bfba87 } +.PathIndexControl { background-color:#8c8c8c } +.PathIndexPopUp { background-color: #879abc; } +.PathNav a { text-decoration:none; font-size: larger } +.CodeInsertionHint { font-weight: bold; background-color: #10dd10 } +.CodeRemovalHint { background-color:#de1010 } +.CodeRemovalHint { border-bottom:1px solid #6F9DBE } +.msg.selected{ background-color:orange !important; } + +table.simpletable { + padding: 5px; + font-size:12pt; + margin:20px; + border-collapse: collapse; border-spacing: 0px; +} +td.rowname { + text-align: right; + vertical-align: top; + font-weight: bold; + color:#444444; + padding-right:2ex; +} + +/* Hidden text. */ +input.spoilerhider + label { + cursor: pointer; + text-decoration: underline; + display: block; +} +input.spoilerhider { + display: none; +} +input.spoilerhider ~ .spoiler { + overflow: hidden; + margin: 10px auto 0; + height: 0; + opacity: 0; +} +input.spoilerhider:checked + label + .spoiler{ + height: auto; + opacity: 1; +} +</style> +</head> +<body> +<!-- BUGDESC Value stored to 'not_empty_tree' is never read --> + +<!-- BUGTYPE Dead assignment --> + +<!-- BUGCATEGORY Unused code --> + +<!-- BUGFILE /rootdir/sensors-applet/sensors-applet.c --> + +<!-- FILENAME sensors-applet.c --> + +<!-- FUNCTIONNAME sensors_applet_add_sensor --> + +<!-- ISSUEHASHCONTENTOFLINEINCONTEXT 699f6d8d9b89b2565c93887c21f2f27e --> + +<!-- BUGLINE 887 --> + +<!-- BUGCOLUMN 9 --> + +<!-- BUGPATHLENGTH 1 --> + +<!-- BUGMETAEND --> +<!-- REPORTHEADER --> +<h3>Bug Summary</h3> +<table class="simpletable"> +<tr><td class="rowname">File:</td><td>sensors-applet/sensors-applet.c</td></tr> +<tr><td class="rowname">Warning:</td><td><a href="#EndPath">line 887, column 9</a><br />Value stored to 'not_empty_tree' is never read</td></tr> + +</table> +<!-- REPORTSUMMARYEXTRA --> +<h3>Annotated Source Code</h3> +<p>Press <a href="#" onclick="toggleHelp(); return false;">'?'</a> + to see keyboard shortcuts</p> +<input type="checkbox" class="spoilerhider" id="showinvocation" /> +<label for="showinvocation" >Show analyzer invocation</label> +<div class="spoiler">clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name sensors-applet.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/sensors-applet -resource-dir /usr/lib64/clang/16 -D HAVE_CONFIG_H -I . -D MATELOCALEDIR="/usr/local/share/locale/" -D G_LOG_DOMAIN="sensors-applet" -D PIXMAPS_DIR="/usr/local/share/pixmaps/mate-sensors-applet/" -D DATADIR="/usr/local/share" -D LIBDIR="/usr/local/lib" -D UIDIR="/usr/local/share/mate-sensors-applet/ui" -D SENSORS_APPLET_PLUGIN_DIR="/usr/local/lib/mate-sensors-applet/plugins" -D SYSCONFDIR="/usr/local/etc" -D PREFIX="/usr/local" -I .. -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/mate-panel-4.0/libmate-panel-applet -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/cairo -I /usr/include/libpng16 -I /usr/include/freetype2 -I /usr/include/harfbuzz -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libxml2 -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -D PIC -internal-isystem /usr/lib64/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/sensors-applet -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2023-06-12-021133-6157-1 -x c sensors-applet.c +</div> +<div id='tooltiphint' hidden="true"> + <p>Keyboard shortcuts: </p> + <ul> + <li>Use 'j/k' keys for keyboard navigation</li> + <li>Use 'Shift+S' to show/hide relevant lines</li> + <li>Use '?' to toggle this window</li> + </ul> + <a href="#" onclick="toggleHelp(); return false;">Close</a> +</div> +<script type='text/javascript'> +var relevant_lines = {"1": {"887": 1}}; + +var filterCounterexample = function (hide) { + var tables = document.getElementsByClassName("code"); + for (var t=0; t<tables.length; t++) { + var table = tables[t]; + var file_id = table.getAttribute("data-fileid"); + var lines_in_fid = relevant_lines[file_id]; + if (!lines_in_fid) { + lines_in_fid = {}; + } + var lines = table.getElementsByClassName("codeline"); + for (var i=0; i<lines.length; i++) { + var el = lines[i]; + var lineNo = el.getAttribute("data-linenumber"); + if (!lines_in_fid[lineNo]) { + if (hide) { + el.setAttribute("hidden", ""); + } else { + el.removeAttribute("hidden"); + } + } + } + } +} + +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + // SHIFT + S + if (event.shiftKey && event.keyCode == 83) { + var checked = document.getElementsByName("showCounterexample")[0].checked; + filterCounterexample(!checked); + document.getElementsByName("showCounterexample")[0].click(); + } else { + return; + } + event.preventDefault(); +}, true); + +document.addEventListener("DOMContentLoaded", function() { + document.querySelector('input[name="showCounterexample"]').onchange= + function (event) { + filterCounterexample(this.checked); + }; +}); +</script> + +<form> + <input type="checkbox" name="showCounterexample" id="showCounterexample" /> + <label for="showCounterexample"> + Show only relevant lines + </label> + <input type="checkbox" name="showArrows" + id="showArrows" style="margin-left: 10px" /> + <label for="showArrows"> + Show control flow arrows + </label> +</form> + +<script type='text/javascript'> +// Return range of numbers from a range [lower, upper). +function range(lower, upper) { + var array = []; + for (var i = lower; i <= upper; ++i) { + array.push(i); + } + return array; +} + +var getRelatedArrowIndices = function(pathId) { + // HTML numeration of events is a bit different than it is in the path. + // Everything is rotated one step to the right, so the last element + // (error diagnostic) has index 0. + if (pathId == 0) { + // arrowIndices has at least 2 elements + pathId = arrowIndices.length - 1; + } + + return range(arrowIndices[pathId], arrowIndices[pathId - 1]); +} + +var highlightArrowsForSelectedEvent = function() { + const selectedNum = findNum(); + const arrowIndicesToHighlight = getRelatedArrowIndices(selectedNum); + arrowIndicesToHighlight.forEach((index) => { + var arrow = document.querySelector("#arrow" + index); + if(arrow) { + classListAdd(arrow, "selected") + } + }); +} + +var getAbsoluteBoundingRect = function(element) { + const relative = element.getBoundingClientRect(); + return { + left: relative.left + window.pageXOffset, + right: relative.right + window.pageXOffset, + top: relative.top + window.pageYOffset, + bottom: relative.bottom + window.pageYOffset, + height: relative.height, + width: relative.width + }; +} + +var drawArrow = function(index) { + // This function is based on the great answer from SO: + // https://stackoverflow.com/a/39575674/11582326 + var start = document.querySelector("#start" + index); + var end = document.querySelector("#end" + index); + var arrow = document.querySelector("#arrow" + index); + + var startRect = getAbsoluteBoundingRect(start); + var endRect = getAbsoluteBoundingRect(end); + + // It is an arrow from a token to itself, no need to visualize it. + if (startRect.top == endRect.top && + startRect.left == endRect.left) + return; + + // Each arrow is a very simple Bézier curve, with two nodes and + // two handles. So, we need to calculate four points in the window: + // * start node + var posStart = { x: 0, y: 0 }; + // * end node + var posEnd = { x: 0, y: 0 }; + // * handle for the start node + var startHandle = { x: 0, y: 0 }; + // * handle for the end node + var endHandle = { x: 0, y: 0 }; + // One can visualize it as follows: + // + // start handle + // / + // X"""_.-""""X + // .' \ + // / start node + // | + // | + // | end node + // \ / + // `->X + // X-' + // \ + // end handle + // + // NOTE: (0, 0) is the top left corner of the window. + + // We have 3 similar, but still different scenarios to cover: + // + // 1. Two tokens on different lines. + // -xxx + // / + // \ + // -> xxx + // In this situation, we draw arrow on the left curving to the left. + // 2. Two tokens on the same line, and the destination is on the right. + // ____ + // / \ + // / V + // xxx xxx + // In this situation, we draw arrow above curving upwards. + // 3. Two tokens on the same line, and the destination is on the left. + // xxx xxx + // ^ / + // \____/ + // In this situation, we draw arrow below curving downwards. + const onDifferentLines = startRect.top <= endRect.top - 5 || + startRect.top >= endRect.top + 5; + const leftToRight = startRect.left < endRect.left; + + // NOTE: various magic constants are chosen empirically for + // better positioning and look + if (onDifferentLines) { + // Case #1 + const topToBottom = startRect.top < endRect.top; + posStart.x = startRect.left - 1; + // We don't want to start it at the top left corner of the token, + // it doesn't feel like this is where the arrow comes from. + // For this reason, we start it in the middle of the left side + // of the token. + posStart.y = startRect.top + startRect.height / 2; + + // End node has arrow head and we give it a bit more space. + posEnd.x = endRect.left - 4; + posEnd.y = endRect.top; + + // Utility object with x and y offsets for handles. + var curvature = { + // We want bottom-to-top arrow to curve a bit more, so it doesn't + // overlap much with top-to-bottom curves (much more frequent). + x: topToBottom ? 15 : 25, + y: Math.min((posEnd.y - posStart.y) / 3, 10) + } + + // When destination is on the different line, we can make a + // curvier arrow because we have space for it. + // So, instead of using + // + // startHandle.x = posStart.x - curvature.x + // endHandle.x = posEnd.x - curvature.x + // + // We use the leftmost of these two values for both handles. + startHandle.x = Math.min(posStart.x, posEnd.x) - curvature.x; + endHandle.x = startHandle.x; + + // Curving downwards from the start node... + startHandle.y = posStart.y + curvature.y; + // ... and upwards from the end node. + endHandle.y = posEnd.y - curvature.y; + + } else if (leftToRight) { + // Case #2 + // Starting from the top right corner... + posStart.x = startRect.right - 1; + posStart.y = startRect.top; + + // ...and ending at the top left corner of the end token. + posEnd.x = endRect.left + 1; + posEnd.y = endRect.top - 1; + + // Utility object with x and y offsets for handles. + var curvature = { + x: Math.min((posEnd.x - posStart.x) / 3, 15), + y: 5 + } + + // Curving to the right... + startHandle.x = posStart.x + curvature.x; + // ... and upwards from the start node. + startHandle.y = posStart.y - curvature.y; + + // And to the left... + endHandle.x = posEnd.x - curvature.x; + // ... and upwards from the end node. + endHandle.y = posEnd.y - curvature.y; + + } else { + // Case #3 + // Starting from the bottom right corner... + posStart.x = startRect.right; + posStart.y = startRect.bottom; + + // ...and ending also at the bottom right corner, but of the end token. + posEnd.x = endRect.right - 1; + posEnd.y = endRect.bottom + 1; + + // Utility object with x and y offsets for handles. + var curvature = { + x: Math.min((posStart.x - posEnd.x) / 3, 15), + y: 5 + } + + // Curving to the left... + startHandle.x = posStart.x - curvature.x; + // ... and downwards from the start node. + startHandle.y = posStart.y + curvature.y; + + // And to the right... + endHandle.x = posEnd.x + curvature.x; + // ... and downwards from the end node. + endHandle.y = posEnd.y + curvature.y; + } + + // Put it all together into a path. + // More information on the format: + // https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths + var pathStr = "M" + posStart.x + "," + posStart.y + " " + + "C" + startHandle.x + "," + startHandle.y + " " + + endHandle.x + "," + endHandle.y + " " + + posEnd.x + "," + posEnd.y; + + arrow.setAttribute("d", pathStr); +}; + +var drawArrows = function() { + const numOfArrows = document.querySelectorAll("path[id^=arrow]").length; + for (var i = 0; i < numOfArrows; ++i) { + drawArrow(i); + } +} + +var toggleArrows = function(event) { + const arrows = document.querySelector("#arrows"); + if (event.target.checked) { + arrows.setAttribute("visibility", "visible"); + } else { + arrows.setAttribute("visibility", "hidden"); + } +} + +window.addEventListener("resize", drawArrows); +document.addEventListener("DOMContentLoaded", function() { + // Whenever we show invocation, locations change, i.e. we + // need to redraw arrows. + document + .querySelector('input[id="showinvocation"]') + .addEventListener("click", drawArrows); + // Hiding irrelevant lines also should cause arrow rerender. + document + .querySelector('input[name="showCounterexample"]') + .addEventListener("change", drawArrows); + document + .querySelector('input[name="showArrows"]') + .addEventListener("change", toggleArrows); + drawArrows(); + // Default highlighting for the last event. + highlightArrowsForSelectedEvent(); +}); +</script> + +<script type='text/javascript'> +var digitMatcher = new RegExp("[0-9]+"); + +var querySelectorAllArray = function(selector) { + return Array.prototype.slice.call( + document.querySelectorAll(selector)); +} + +document.addEventListener("DOMContentLoaded", function() { + querySelectorAllArray(".PathNav > a").forEach( + function(currentValue, currentIndex) { + var hrefValue = currentValue.getAttribute("href"); + currentValue.onclick = function() { + scrollTo(document.querySelector(hrefValue)); + return false; + }; + }); +}); + +var findNum = function() { + var s = document.querySelector(".msg.selected"); + if (!s || s.id == "EndPath") { + return 0; + } + var out = parseInt(digitMatcher.exec(s.id)[0]); + return out; +}; + +var classListAdd = function(el, theClass) { + if(!el.className.baseVal) + el.className += " " + theClass; + else + el.className.baseVal += " " + theClass; +}; + +var classListRemove = function(el, theClass) { + var className = (!el.className.baseVal) ? + el.className : el.className.baseVal; + className = className.replace(" " + theClass, ""); + if(!el.className.baseVal) + el.className = className; + else + el.className.baseVal = className; +}; + +var scrollTo = function(el) { + querySelectorAllArray(".selected").forEach(function(s) { + classListRemove(s, "selected"); + }); + classListAdd(el, "selected"); + window.scrollBy(0, el.getBoundingClientRect().top - + (window.innerHeight / 2)); + highlightArrowsForSelectedEvent(); +}; + +var move = function(num, up, numItems) { + if (num == 1 && up || num == numItems - 1 && !up) { + return 0; + } else if (num == 0 && up) { + return numItems - 1; + } else if (num == 0 && !up) { + return 1 % numItems; + } + return up ? num - 1 : num + 1; +} + +var numToId = function(num) { + if (num == 0) { + return document.getElementById("EndPath") + } + return document.getElementById("Path" + num); +}; + +var navigateTo = function(up) { + var numItems = document.querySelectorAll( + ".line > .msgEvent, .line > .msgControl").length; + var currentSelected = findNum(); + var newSelected = move(currentSelected, up, numItems); + var newEl = numToId(newSelected, numItems); + + // Scroll element into center. + scrollTo(newEl); +}; + +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + // key 'j' + if (event.keyCode == 74) { + navigateTo(/*up=*/false); + // key 'k' + } else if (event.keyCode == 75) { + navigateTo(/*up=*/true); + } else { + return; + } + event.preventDefault(); +}, true); +</script> + +<script type='text/javascript'> + +var toggleHelp = function() { + var hint = document.querySelector("#tooltiphint"); + var attributeName = "hidden"; + if (hint.hasAttribute(attributeName)) { + hint.removeAttribute(attributeName); + } else { + hint.setAttribute("hidden", "true"); + } +}; +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + if (event.key == "?") { + toggleHelp(); + } else { + return; + } + event.preventDefault(); +}); +</script> + +<style type="text/css"> + svg { + position:absolute; + top:0; + left:0; + height:100%; + width:100%; + pointer-events: none; + overflow: visible + } + .arrow { + stroke-opacity: 0.2; + stroke-width: 1; + marker-end: url(#arrowhead); + } + + .arrow.selected { + stroke-opacity: 0.6; + stroke-width: 2; + marker-end: url(#arrowheadSelected); + } + + .arrowhead { + orient: auto; + stroke: none; + opacity: 0.6; + fill: blue; + } +</style> +<svg xmlns="http://www.w3.org/2000/svg"> + <defs> + <marker id="arrowheadSelected" class="arrowhead" opacity="0.6" + viewBox="0 0 10 10" refX="3" refY="5" + markerWidth="4" markerHeight="4"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + <marker id="arrowhead" class="arrowhead" opacity="0.2" + viewBox="0 0 10 10" refX="3" refY="5" + markerWidth="4" markerHeight="4"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + </defs> + <g id="arrows" fill="none" stroke="blue" visibility="hidden"> + + </g> +</svg> +<script type='text/javascript'> +const arrowIndices = [ 0,0 ] +</script> +<table class="code" data-fileid="1"> +<tr class="codeline" data-linenumber="1"><td class="num" id="LN1">1</td><td class="line"><span class='comment'>/*</span></td></tr> +<tr class="codeline" data-linenumber="2"><td class="num" id="LN2">2</td><td class="line"> <span class='comment'>* Copyright (C) 2005-2009 Alex Murray <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="3"><td class="num" id="LN3">3</td><td class="line"> <span class='comment'>* Copyright (C) 2012-2021 MATE Developers</span></td></tr> +<tr class="codeline" data-linenumber="4"><td class="num" id="LN4">4</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="5"><td class="num" id="LN5">5</td><td class="line"> <span class='comment'>* This program is free software; you can redistribute it and/or modify</span></td></tr> +<tr class="codeline" data-linenumber="6"><td class="num" id="LN6">6</td><td class="line"> <span class='comment'>* it under the terms of the GNU General Public License as published by</span></td></tr> +<tr class="codeline" data-linenumber="7"><td class="num" id="LN7">7</td><td class="line"> <span class='comment'>* the Free Software Foundation; either version 2 of the License, or</span></td></tr> +<tr class="codeline" data-linenumber="8"><td class="num" id="LN8">8</td><td class="line"> <span class='comment'>* (at your option) any later version.</span></td></tr> +<tr class="codeline" data-linenumber="9"><td class="num" id="LN9">9</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="10"><td class="num" id="LN10">10</td><td class="line"> <span class='comment'>* This program is distributed in the hope that it will be useful,</span></td></tr> +<tr class="codeline" data-linenumber="11"><td class="num" id="LN11">11</td><td class="line"> <span class='comment'>* but WITHOUT ANY WARRANTY; without even the implied warranty of</span></td></tr> +<tr class="codeline" data-linenumber="12"><td class="num" id="LN12">12</td><td class="line"> <span class='comment'>* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></td></tr> +<tr class="codeline" data-linenumber="13"><td class="num" id="LN13">13</td><td class="line"> <span class='comment'>* GNU General Public License for more details.</span></td></tr> +<tr class="codeline" data-linenumber="14"><td class="num" id="LN14">14</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="15"><td class="num" id="LN15">15</td><td class="line"> <span class='comment'>* You should have received a copy of the GNU General Public License</span></td></tr> +<tr class="codeline" data-linenumber="16"><td class="num" id="LN16">16</td><td class="line"> <span class='comment'>* along with this program; if not, write to the Free Software</span></td></tr> +<tr class="codeline" data-linenumber="17"><td class="num" id="LN17">17</td><td class="line"> <span class='comment'>* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</span></td></tr> +<tr class="codeline" data-linenumber="18"><td class="num" id="LN18">18</td><td class="line"> <span class='comment'>*/</span></td></tr> +<tr class="codeline" data-linenumber="19"><td class="num" id="LN19">19</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="20"><td class="num" id="LN20">20</td><td class="line"><span class='comment'>/** Contain the functions for operating on the SensorsApplet structure</span></td></tr> +<tr class="codeline" data-linenumber="21"><td class="num" id="LN21">21</td><td class="line"> <span class='comment'>* (represents the applet itself, and its associated variables.</span></td></tr> +<tr class="codeline" data-linenumber="22"><td class="num" id="LN22">22</td><td class="line"> <span class='comment'>*/</span></td></tr> +<tr class="codeline" data-linenumber="23"><td class="num" id="LN23">23</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="24"><td class="num" id="LN24">24</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_CONFIG_H<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="25"><td class="num" id="LN25">25</td><td class="line"><span class='directive'>#include "config.h"</span></td></tr> +<tr class="codeline" data-linenumber="26"><td class="num" id="LN26">26</td><td class="line"><span class='directive'>#endif /* HAVE_CONFIG_H */</span></td></tr> +<tr class="codeline" data-linenumber="27"><td class="num" id="LN27">27</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="28"><td class="num" id="LN28">28</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_UNISTD_H<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="29"><td class="num" id="LN29">29</td><td class="line"><span class='directive'>#include <unistd.h></span></td></tr> +<tr class="codeline" data-linenumber="30"><td class="num" id="LN30">30</td><td class="line"><span class='directive'>#endif /* HAVE_UNISTD_H */</span></td></tr> +<tr class="codeline" data-linenumber="31"><td class="num" id="LN31">31</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="32"><td class="num" id="LN32">32</td><td class="line"><span class='directive'>#include <glib/gi18n.h></span></td></tr> +<tr class="codeline" data-linenumber="33"><td class="num" id="LN33">33</td><td class="line"><span class='directive'>#include <glib/gprintf.h></span></td></tr> +<tr class="codeline" data-linenumber="34"><td class="num" id="LN34">34</td><td class="line"><span class='directive'>#include <gio/gio.h></span></td></tr> +<tr class="codeline" data-linenumber="35"><td class="num" id="LN35">35</td><td class="line"><span class='directive'>#include "sensors-applet.h"</span></td></tr> +<tr class="codeline" data-linenumber="36"><td class="num" id="LN36">36</td><td class="line"><span class='directive'>#include "active-sensor.h"</span></td></tr> +<tr class="codeline" data-linenumber="37"><td class="num" id="LN37">37</td><td class="line"><span class='directive'>#include "sensors-applet-settings.h"</span></td></tr> +<tr class="codeline" data-linenumber="38"><td class="num" id="LN38">38</td><td class="line"><span class='directive'>#include "sensors-applet-plugins.h"</span></td></tr> +<tr class="codeline" data-linenumber="39"><td class="num" id="LN39">39</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="40"><td class="num" id="LN40">40</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_LIBNOTIFY<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="41"><td class="num" id="LN41">41</td><td class="line"><span class='directive'>#include "active-sensor-libnotify.h"</span></td></tr> +<tr class="codeline" data-linenumber="42"><td class="num" id="LN42">42</td><td class="line"><span class='directive'>#define <span class='macro'>DEFAULT_NOTIFY_TIMEOUT<span class='macro_popup'>3000</span></span> 3000</span></td></tr> +<tr class="codeline" data-linenumber="43"><td class="num" id="LN43">43</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="44"><td class="num" id="LN44">44</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="45"><td class="num" id="LN45">45</td><td class="line"><span class='directive'>#include "prefs-dialog.h"</span></td></tr> +<tr class="codeline" data-linenumber="46"><td class="num" id="LN46">46</td><td class="line"><span class='directive'>#include "about-dialog.h"</span></td></tr> +<tr class="codeline" data-linenumber="47"><td class="num" id="LN47">47</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="48"><td class="num" id="LN48">48</td><td class="line"><span class='directive'>#define <span class='macro'>SENSORS_APPLET_MENU_FILE<span class='macro_popup'>"SensorsApplet.xml"</span></span> "SensorsApplet.xml"</span></td></tr> +<tr class="codeline" data-linenumber="49"><td class="num" id="LN49">49</td><td class="line"><span class='comment'>/* initially set as sensors_applet->size to ensure a real value is stored */</span></td></tr> +<tr class="codeline" data-linenumber="50"><td class="num" id="LN50">50</td><td class="line"><span class='directive'>#define <span class='macro'>DEFAULT_APPLET_SIZE<span class='macro_popup'>24</span></span> 24</span></td></tr> +<tr class="codeline" data-linenumber="51"><td class="num" id="LN51">51</td><td class="line"><span class='directive'>#define <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span> 2</span></td></tr> +<tr class="codeline" data-linenumber="52"><td class="num" id="LN52">52</td><td class="line"><span class='directive'>#define <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span> 1</span></td></tr> +<tr class="codeline" data-linenumber="53"><td class="num" id="LN53">53</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="54"><td class="num" id="LN54">54</td><td class="line"><span class='comment'>/* builder for sensor sorting verification */</span></td></tr> +<tr class="codeline" data-linenumber="55"><td class="num" id="LN55">55</td><td class="line"><span class='keyword'>static</span> GVariantBuilder gvb_sensors_hash_list;</td></tr> +<tr class="codeline" data-linenumber="56"><td class="num" id="LN56">56</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="57"><td class="num" id="LN57">57</td><td class="line"><span class='comment'>/* callbacks for panel menu */</span></td></tr> +<tr class="codeline" data-linenumber="58"><td class="num" id="LN58">58</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> prefs_cb(GtkAction *action, gpointer *data) {</td></tr> +<tr class="codeline" data-linenumber="59"><td class="num" id="LN59">59</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="60"><td class="num" id="LN60">60</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="61"><td class="num" id="LN61">61</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="62"><td class="num" id="LN62">62</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="63"><td class="num" id="LN63">63</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->prefs_dialog) {</td></tr> +<tr class="codeline" data-linenumber="64"><td class="num" id="LN64">64</td><td class="line"> gtk_window_present(<span class='macro'>GTK_WINDOW(sensors_applet->prefs_dialog->dialog)<span class='macro_popup'>((((GtkWindow*) (void *) ((sensors_applet->prefs_dialog-><br>dialog)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="65"><td class="num" id="LN65">65</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="66"><td class="num" id="LN66">66</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="67"><td class="num" id="LN67">67</td><td class="line"> prefs_dialog_open(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="68"><td class="num" id="LN68">68</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="69"><td class="num" id="LN69">69</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="70"><td class="num" id="LN70">70</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> about_cb(GtkAction *action, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="71"><td class="num" id="LN71">71</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="72"><td class="num" id="LN72">72</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="73"><td class="num" id="LN73">73</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="74"><td class="num" id="LN74">74</td><td class="line"> about_dialog_open(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="75"><td class="num" id="LN75">75</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="76"><td class="num" id="LN76">76</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="77"><td class="num" id="LN77">77</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> help_cb(GtkAction *action, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="78"><td class="num" id="LN78">78</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="79"><td class="num" id="LN79">79</td><td class="line"> GError *error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="80"><td class="num" id="LN80">80</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="81"><td class="num" id="LN81">81</td><td class="line"> gtk_show_uri_on_window(<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='string_literal'>"help:mate-sensors-applet"</span>,</td></tr> +<tr class="codeline" data-linenumber="82"><td class="num" id="LN82">82</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="83"><td class="num" id="LN83">83</td><td class="line"> gtk_get_current_event_time(),</td></tr> +<tr class="codeline" data-linenumber="84"><td class="num" id="LN84">84</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="85"><td class="num" id="LN85">85</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="86"><td class="num" id="LN86">86</td><td class="line"> <span class='keyword'>if</span> (error) {</td></tr> +<tr class="codeline" data-linenumber="87"><td class="num" id="LN87">87</td><td class="line"> g_debug(<span class='string_literal'>"Could not open help document: %s "</span>,error->message);</td></tr> +<tr class="codeline" data-linenumber="88"><td class="num" id="LN88">88</td><td class="line"> g_error_free(error);</td></tr> +<tr class="codeline" data-linenumber="89"><td class="num" id="LN89">89</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="90"><td class="num" id="LN90">90</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="91"><td class="num" id="LN91">91</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="92"><td class="num" id="LN92">92</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> destroy_cb(GtkWidget *widget, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="93"><td class="num" id="LN93">93</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="94"><td class="num" id="LN94">94</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="95"><td class="num" id="LN95">95</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="96"><td class="num" id="LN96">96</td><td class="line"> <span class='comment'>/* destroy dialogs, remove timeout and clear sensors tree and finally the applet */</span></td></tr> +<tr class="codeline" data-linenumber="97"><td class="num" id="LN97">97</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->prefs_dialog != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="98"><td class="num" id="LN98">98</td><td class="line"> <span class='comment'>/* destroy's dialog too */</span></td></tr> +<tr class="codeline" data-linenumber="99"><td class="num" id="LN99">99</td><td class="line"> prefs_dialog_close(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="100"><td class="num" id="LN100">100</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="101"><td class="num" id="LN101">101</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="102"><td class="num" id="LN102">102</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->timeout_id) {</td></tr> +<tr class="codeline" data-linenumber="103"><td class="num" id="LN103">103</td><td class="line"> g_source_remove(sensors_applet->timeout_id);</td></tr> +<tr class="codeline" data-linenumber="104"><td class="num" id="LN104">104</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="105"><td class="num" id="LN105">105</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="106"><td class="num" id="LN106">106</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->settings) {</td></tr> +<tr class="codeline" data-linenumber="107"><td class="num" id="LN107">107</td><td class="line"> g_object_unref (sensors_applet->settings);</td></tr> +<tr class="codeline" data-linenumber="108"><td class="num" id="LN108">108</td><td class="line"> sensors_applet->settings = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="109"><td class="num" id="LN109">109</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="110"><td class="num" id="LN110">110</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="111"><td class="num" id="LN111">111</td><td class="line"> <span class='comment'>/* destroy all active sensors */</span></td></tr> +<tr class="codeline" data-linenumber="112"><td class="num" id="LN112">112</td><td class="line"> g_list_foreach(sensors_applet->active_sensors,</td></tr> +<tr class="codeline" data-linenumber="113"><td class="num" id="LN113">113</td><td class="line"> (GFunc)active_sensor_destroy,</td></tr> +<tr class="codeline" data-linenumber="114"><td class="num" id="LN114">114</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="115"><td class="num" id="LN115">115</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="116"><td class="num" id="LN116">116</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->sensors != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="117"><td class="num" id="LN117">117</td><td class="line"> gtk_tree_store_clear(sensors_applet->sensors);</td></tr> +<tr class="codeline" data-linenumber="118"><td class="num" id="LN118">118</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="119"><td class="num" id="LN119">119</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="120"><td class="num" id="LN120">120</td><td class="line"> gtk_widget_destroy(<span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="121"><td class="num" id="LN121">121</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="122"><td class="num" id="LN122">122</td><td class="line"> g_free(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="123"><td class="num" id="LN123">123</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="124"><td class="num" id="LN124">124</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="125"><td class="num" id="LN125">125</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="126"><td class="num" id="LN126">126</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> change_orient_cb (MatePanelApplet *applet,</td></tr> +<tr class="codeline" data-linenumber="127"><td class="num" id="LN127">127</td><td class="line"> MatePanelAppletOrient orient,</td></tr> +<tr class="codeline" data-linenumber="128"><td class="num" id="LN128">128</td><td class="line"> gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="129"><td class="num" id="LN129">129</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="130"><td class="num" id="LN130">130</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="131"><td class="num" id="LN131">131</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="132"><td class="num" id="LN132">132</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="133"><td class="num" id="LN133">133</td><td class="line"> sensors_applet_display_layout_changed(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="134"><td class="num" id="LN134">134</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="135"><td class="num" id="LN135">135</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="136"><td class="num" id="LN136">136</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> size_allocate_cb(MatePanelApplet *applet,</td></tr> +<tr class="codeline" data-linenumber="137"><td class="num" id="LN137">137</td><td class="line"> GtkAllocation *allocation,</td></tr> +<tr class="codeline" data-linenumber="138"><td class="num" id="LN138">138</td><td class="line"> gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="139"><td class="num" id="LN139">139</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="140"><td class="num" id="LN140">140</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="141"><td class="num" id="LN141">141</td><td class="line"> MatePanelAppletOrient orient;</td></tr> +<tr class="codeline" data-linenumber="142"><td class="num" id="LN142">142</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="143"><td class="num" id="LN143">143</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="144"><td class="num" id="LN144">144</td><td class="line"> orient = mate_panel_applet_get_orient(sensors_applet->applet);</td></tr> +<tr class="codeline" data-linenumber="145"><td class="num" id="LN145">145</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="146"><td class="num" id="LN146">146</td><td class="line"> <span class='keyword'>if</span> ((orient == MATE_PANEL_APPLET_ORIENT_LEFT) ||</td></tr> +<tr class="codeline" data-linenumber="147"><td class="num" id="LN147">147</td><td class="line"> (orient == MATE_PANEL_APPLET_ORIENT_RIGHT)) {</td></tr> +<tr class="codeline" data-linenumber="148"><td class="num" id="LN148">148</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="149"><td class="num" id="LN149">149</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->size == allocation->width)</td></tr> +<tr class="codeline" data-linenumber="150"><td class="num" id="LN150">150</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="151"><td class="num" id="LN151">151</td><td class="line"> sensors_applet->size = allocation->width;</td></tr> +<tr class="codeline" data-linenumber="152"><td class="num" id="LN152">152</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="153"><td class="num" id="LN153">153</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->size == allocation->height)</td></tr> +<tr class="codeline" data-linenumber="154"><td class="num" id="LN154">154</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="155"><td class="num" id="LN155">155</td><td class="line"> sensors_applet->size = allocation->height;</td></tr> +<tr class="codeline" data-linenumber="156"><td class="num" id="LN156">156</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="157"><td class="num" id="LN157">157</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="158"><td class="num" id="LN158">158</td><td class="line"> <span class='comment'>/* update if new value */</span></td></tr> +<tr class="codeline" data-linenumber="159"><td class="num" id="LN159">159</td><td class="line"> sensors_applet_graph_size_changed(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="160"><td class="num" id="LN160">160</td><td class="line"> sensors_applet_display_layout_changed(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="161"><td class="num" id="LN161">161</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="162"><td class="num" id="LN162">162</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="163"><td class="num" id="LN163">163</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> style_set_cb(GtkWidget *widget, GtkStyle *old_style, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="164"><td class="num" id="LN164">164</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="165"><td class="num" id="LN165">165</td><td class="line"> <span class='comment'>/* update all icons in the sensors tree and update all active sensors */</span></td></tr> +<tr class="codeline" data-linenumber="166"><td class="num" id="LN166">166</td><td class="line"> GtkTreeIter interfaces_iter, sensors_iter;</td></tr> +<tr class="codeline" data-linenumber="167"><td class="num" id="LN167">167</td><td class="line"> gboolean not_end_of_interfaces = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>, not_end_of_sensors = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="168"><td class="num" id="LN168">168</td><td class="line"> IconType icon_type;</td></tr> +<tr class="codeline" data-linenumber="169"><td class="num" id="LN169">169</td><td class="line"> gboolean enabled;</td></tr> +<tr class="codeline" data-linenumber="170"><td class="num" id="LN170">170</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="171"><td class="num" id="LN171">171</td><td class="line"> DisplayMode display_mode;</td></tr> +<tr class="codeline" data-linenumber="172"><td class="num" id="LN172">172</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="173"><td class="num" id="LN173">173</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="174"><td class="num" id="LN174">174</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="175"><td class="num" id="LN175">175</td><td class="line"> display_mode = g_settings_get_int (sensors_applet->settings, <span class='macro'>DISPLAY_MODE<span class='macro_popup'>"display-mode"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="176"><td class="num" id="LN176">176</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->sensors) {</td></tr> +<tr class="codeline" data-linenumber="177"><td class="num" id="LN177">177</td><td class="line"> <span class='keyword'>for</span> (gtk_tree_model_get_iter_first(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &interfaces_iter);</td></tr> +<tr class="codeline" data-linenumber="178"><td class="num" id="LN178">178</td><td class="line"> not_end_of_interfaces;</td></tr> +<tr class="codeline" data-linenumber="179"><td class="num" id="LN179">179</td><td class="line"> not_end_of_interfaces = gtk_tree_model_iter_next(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &interfaces_iter)) {</td></tr> +<tr class="codeline" data-linenumber="180"><td class="num" id="LN180">180</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="181"><td class="num" id="LN181">181</td><td class="line"> <span class='comment'>/* reset sensors sentinel */</span></td></tr> +<tr class="codeline" data-linenumber="182"><td class="num" id="LN182">182</td><td class="line"> not_end_of_sensors = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="183"><td class="num" id="LN183">183</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="184"><td class="num" id="LN184">184</td><td class="line"> <span class='keyword'>for</span> (gtk_tree_model_iter_children(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter, &interfaces_iter);</td></tr> +<tr class="codeline" data-linenumber="185"><td class="num" id="LN185">185</td><td class="line"> not_end_of_sensors;</td></tr> +<tr class="codeline" data-linenumber="186"><td class="num" id="LN186">186</td><td class="line"> not_end_of_sensors = gtk_tree_model_iter_next(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter)) {</td></tr> +<tr class="codeline" data-linenumber="187"><td class="num" id="LN187">187</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="188"><td class="num" id="LN188">188</td><td class="line"> GdkPixbuf *new_icon;</td></tr> +<tr class="codeline" data-linenumber="189"><td class="num" id="LN189">189</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="190"><td class="num" id="LN190">190</td><td class="line"> gtk_tree_model_get(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="191"><td class="num" id="LN191">191</td><td class="line"> &sensors_iter,</td></tr> +<tr class="codeline" data-linenumber="192"><td class="num" id="LN192">192</td><td class="line"> ENABLE_COLUMN, &enabled,</td></tr> +<tr class="codeline" data-linenumber="193"><td class="num" id="LN193">193</td><td class="line"> ICON_TYPE_COLUMN, &icon_type,</td></tr> +<tr class="codeline" data-linenumber="194"><td class="num" id="LN194">194</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="195"><td class="num" id="LN195">195</td><td class="line"> <span class='comment'>/* update icons */</span></td></tr> +<tr class="codeline" data-linenumber="196"><td class="num" id="LN196">196</td><td class="line"> new_icon = sensors_applet_load_icon(icon_type);</td></tr> +<tr class="codeline" data-linenumber="197"><td class="num" id="LN197">197</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="198"><td class="num" id="LN198">198</td><td class="line"> gtk_tree_store_set(sensors_applet->sensors,</td></tr> +<tr class="codeline" data-linenumber="199"><td class="num" id="LN199">199</td><td class="line"> &sensors_iter,</td></tr> +<tr class="codeline" data-linenumber="200"><td class="num" id="LN200">200</td><td class="line"> ICON_PIXBUF_COLUMN, new_icon,</td></tr> +<tr class="codeline" data-linenumber="201"><td class="num" id="LN201">201</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="202"><td class="num" id="LN202">202</td><td class="line"> g_object_unref(new_icon);</td></tr> +<tr class="codeline" data-linenumber="203"><td class="num" id="LN203">203</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="204"><td class="num" id="LN204">204</td><td class="line"> <span class='comment'>/* update icons only if currently being displayed */</span></td></tr> +<tr class="codeline" data-linenumber="205"><td class="num" id="LN205">205</td><td class="line"> <span class='keyword'>if</span> (enabled &&</td></tr> +<tr class="codeline" data-linenumber="206"><td class="num" id="LN206">206</td><td class="line"> (display_mode == DISPLAY_ICON ||</td></tr> +<tr class="codeline" data-linenumber="207"><td class="num" id="LN207">207</td><td class="line"> display_mode == DISPLAY_ICON_WITH_VALUE)) {</td></tr> +<tr class="codeline" data-linenumber="208"><td class="num" id="LN208">208</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="209"><td class="num" id="LN209">209</td><td class="line"> GtkTreePath *path;</td></tr> +<tr class="codeline" data-linenumber="210"><td class="num" id="LN210">210</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="211"><td class="num" id="LN211">211</td><td class="line"> path = gtk_tree_model_get_path(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter);</td></tr> +<tr class="codeline" data-linenumber="212"><td class="num" id="LN212">212</td><td class="line"> sensors_applet_icon_changed(sensors_applet, path);</td></tr> +<tr class="codeline" data-linenumber="213"><td class="num" id="LN213">213</td><td class="line"> gtk_tree_path_free(path);</td></tr> +<tr class="codeline" data-linenumber="214"><td class="num" id="LN214">214</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="215"><td class="num" id="LN215">215</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="216"><td class="num" id="LN216">216</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="217"><td class="num" id="LN217">217</td><td class="line"> <span class='comment'>/* now update layout as size may have changed */</span></td></tr> +<tr class="codeline" data-linenumber="218"><td class="num" id="LN218">218</td><td class="line"> sensors_applet_display_layout_changed(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="219"><td class="num" id="LN219">219</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="220"><td class="num" id="LN220">220</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="221"><td class="num" id="LN221">221</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="222"><td class="num" id="LN222">222</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="223"><td class="num" id="LN223">223</td><td class="line"><span class='keyword'>static</span> gboolean mouse_enter_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data)</td></tr> +<tr class="codeline" data-linenumber="224"><td class="num" id="LN224">224</td><td class="line">{</td></tr> +<tr class="codeline" data-linenumber="225"><td class="num" id="LN225">225</td><td class="line"> SensorsApplet *sensor_applet = data;</td></tr> +<tr class="codeline" data-linenumber="226"><td class="num" id="LN226">226</td><td class="line"> sensor_applet->show_tooltip = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="227"><td class="num" id="LN227">227</td><td class="line"> sensors_applet_update_active_sensors(sensor_applet);</td></tr> +<tr class="codeline" data-linenumber="228"><td class="num" id="LN228">228</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="229"><td class="num" id="LN229">229</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="230"><td class="num" id="LN230">230</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="231"><td class="num" id="LN231">231</td><td class="line"><span class='keyword'>static</span> gboolean mouse_leave_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data)</td></tr> +<tr class="codeline" data-linenumber="232"><td class="num" id="LN232">232</td><td class="line">{</td></tr> +<tr class="codeline" data-linenumber="233"><td class="num" id="LN233">233</td><td class="line"> SensorsApplet *sensor_applet = data;</td></tr> +<tr class="codeline" data-linenumber="234"><td class="num" id="LN234">234</td><td class="line"> sensor_applet->show_tooltip = <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="235"><td class="num" id="LN235">235</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="236"><td class="num" id="LN236">236</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="237"><td class="num" id="LN237">237</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="238"><td class="num" id="LN238">238</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>const</span> GtkActionEntry sensors_applet_menu_actions[] = {</td></tr> +<tr class="codeline" data-linenumber="239"><td class="num" id="LN239">239</td><td class="line"> { <span class='string_literal'>"Preferences"</span>, <span class='string_literal'>"document-properties"</span>, <span class='macro'>N_(<span class='string_literal'>"_Preferences"</span>)<span class='macro_popup'>("_Preferences")</span></span>,</td></tr> +<tr class="codeline" data-linenumber="240"><td class="num" id="LN240">240</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="241"><td class="num" id="LN241">241</td><td class="line"> <span class='macro'>G_CALLBACK(prefs_cb)<span class='macro_popup'>((GCallback) (prefs_cb))</span></span> },</td></tr> +<tr class="codeline" data-linenumber="242"><td class="num" id="LN242">242</td><td class="line"> { <span class='string_literal'>"Help"</span>, <span class='string_literal'>"help-browser"</span>, <span class='macro'>N_(<span class='string_literal'>"_Help"</span>)<span class='macro_popup'>("_Help")</span></span>,</td></tr> +<tr class="codeline" data-linenumber="243"><td class="num" id="LN243">243</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="244"><td class="num" id="LN244">244</td><td class="line"> <span class='macro'>G_CALLBACK(help_cb)<span class='macro_popup'>((GCallback) (help_cb))</span></span> },</td></tr> +<tr class="codeline" data-linenumber="245"><td class="num" id="LN245">245</td><td class="line"> { <span class='string_literal'>"About"</span>, <span class='string_literal'>"help-about"</span>, <span class='macro'>N_(<span class='string_literal'>"_About"</span>)<span class='macro_popup'>("_About")</span></span>,</td></tr> +<tr class="codeline" data-linenumber="246"><td class="num" id="LN246">246</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="247"><td class="num" id="LN247">247</td><td class="line"> <span class='macro'>G_CALLBACK(about_cb)<span class='macro_popup'>((GCallback) (about_cb))</span></span> }</td></tr> +<tr class="codeline" data-linenumber="248"><td class="num" id="LN248">248</td><td class="line">};</td></tr> +<tr class="codeline" data-linenumber="249"><td class="num" id="LN249">249</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="250"><td class="num" id="LN250">250</td><td class="line"><span class='keyword'>void</span> sensors_applet_notify_active_sensor(ActiveSensor *active_sensor, NotifType notif_type) {</td></tr> +<tr class="codeline" data-linenumber="251"><td class="num" id="LN251">251</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_LIBNOTIFY<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="252"><td class="num" id="LN252">252</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="253"><td class="num" id="LN253">253</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="254"><td class="num" id="LN254">254</td><td class="line"> gchar *summary, *message;</td></tr> +<tr class="codeline" data-linenumber="255"><td class="num" id="LN255">255</td><td class="line"> gint timeout_msecs;</td></tr> +<tr class="codeline" data-linenumber="256"><td class="num" id="LN256">256</td><td class="line"> gchar *sensor_label;</td></tr> +<tr class="codeline" data-linenumber="257"><td class="num" id="LN257">257</td><td class="line"> gchar *sensor_path;</td></tr> +<tr class="codeline" data-linenumber="258"><td class="num" id="LN258">258</td><td class="line"> SensorType sensor_type;</td></tr> +<tr class="codeline" data-linenumber="259"><td class="num" id="LN259">259</td><td class="line"> TemperatureScale temp_scale;</td></tr> +<tr class="codeline" data-linenumber="260"><td class="num" id="LN260">260</td><td class="line"> GtkTreeIter iter;</td></tr> +<tr class="codeline" data-linenumber="261"><td class="num" id="LN261">261</td><td class="line"> GtkTreePath *path;</td></tr> +<tr class="codeline" data-linenumber="262"><td class="num" id="LN262">262</td><td class="line"> <span class='keyword'>const</span> gchar *unit_type = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="263"><td class="num" id="LN263">263</td><td class="line"> <span class='keyword'>const</span> gchar *unit_type_title = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="264"><td class="num" id="LN264">264</td><td class="line"> <span class='keyword'>const</span> gchar *relation = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="265"><td class="num" id="LN265">265</td><td class="line"> <span class='keyword'>const</span> gchar *limit_type = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="266"><td class="num" id="LN266">266</td><td class="line"> <span class='keyword'>const</span> gchar *units = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="267"><td class="num" id="LN267">267</td><td class="line"> gdouble limit_value;</td></tr> +<tr class="codeline" data-linenumber="268"><td class="num" id="LN268">268</td><td class="line"> gdouble seconds;</td></tr> +<tr class="codeline" data-linenumber="269"><td class="num" id="LN269">269</td><td class="line"> gboolean show_notification = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="270"><td class="num" id="LN270">270</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="271"><td class="num" id="LN271">271</td><td class="line"> sensors_applet = active_sensor->sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="272"><td class="num" id="LN272">272</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="273"><td class="num" id="LN273">273</td><td class="line"> <span class='keyword'>if</span> (!g_settings_get_boolean (sensors_applet->settings, <span class='macro'>DISPLAY_NOTIFICATIONS<span class='macro_popup'>"display-notifications"</span></span>)) {</td></tr> +<tr class="codeline" data-linenumber="274"><td class="num" id="LN274">274</td><td class="line"> g_debug(<span class='string_literal'>"Wanted to display notification, but user has disabled them"</span>);</td></tr> +<tr class="codeline" data-linenumber="275"><td class="num" id="LN275">275</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="276"><td class="num" id="LN276">276</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="277"><td class="num" id="LN277">277</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="278"><td class="num" id="LN278">278</td><td class="line"> path = gtk_tree_row_reference_get_path(active_sensor->sensor_row);</td></tr> +<tr class="codeline" data-linenumber="279"><td class="num" id="LN279">279</td><td class="line"> <span class='keyword'>if</span> (gtk_tree_model_get_iter(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &iter, path)) {</td></tr> +<tr class="codeline" data-linenumber="280"><td class="num" id="LN280">280</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="281"><td class="num" id="LN281">281</td><td class="line"> gtk_tree_model_get(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &iter,</td></tr> +<tr class="codeline" data-linenumber="282"><td class="num" id="LN282">282</td><td class="line"> LABEL_COLUMN, &sensor_label,</td></tr> +<tr class="codeline" data-linenumber="283"><td class="num" id="LN283">283</td><td class="line"> PATH_COLUMN, &sensor_path,</td></tr> +<tr class="codeline" data-linenumber="284"><td class="num" id="LN284">284</td><td class="line"> SENSOR_TYPE_COLUMN, &sensor_type,</td></tr> +<tr class="codeline" data-linenumber="285"><td class="num" id="LN285">285</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="286"><td class="num" id="LN286">286</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="287"><td class="num" id="LN287">287</td><td class="line"> g_warning(<span class='string_literal'>"Error getting data from tree for notification..."</span>);</td></tr> +<tr class="codeline" data-linenumber="288"><td class="num" id="LN288">288</td><td class="line"> gtk_tree_path_free(path);</td></tr> +<tr class="codeline" data-linenumber="289"><td class="num" id="LN289">289</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="290"><td class="num" id="LN290">290</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="291"><td class="num" id="LN291">291</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="292"><td class="num" id="LN292">292</td><td class="line"> gtk_tree_path_free(path);</td></tr> +<tr class="codeline" data-linenumber="293"><td class="num" id="LN293">293</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="294"><td class="num" id="LN294">294</td><td class="line"> <span class='comment'>/* do different stuff for different notif types */</span></td></tr> +<tr class="codeline" data-linenumber="295"><td class="num" id="LN295">295</td><td class="line"> <span class='keyword'>switch</span> (notif_type) {</td></tr> +<tr class="codeline" data-linenumber="296"><td class="num" id="LN296">296</td><td class="line"> <span class='keyword'>case</span> LOW_ALARM: <span class='comment'>/* fall thru */</span></td></tr> +<tr class="codeline" data-linenumber="297"><td class="num" id="LN297">297</td><td class="line"> <span class='keyword'>case</span> HIGH_ALARM:</td></tr> +<tr class="codeline" data-linenumber="298"><td class="num" id="LN298">298</td><td class="line"> <span class='keyword'>if</span> (active_sensor->sensor_values[0] <= active_sensor->sensor_low_value && notif_type == LOW_ALARM) {</td></tr> +<tr class="codeline" data-linenumber="299"><td class="num" id="LN299">299</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="300"><td class="num" id="LN300">300</td><td class="line"> relation = <span class='macro'>_(<span class='string_literal'>"is very low"</span>)<span class='macro_popup'>dcgettext (((void*)0), "is very low", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="301"><td class="num" id="LN301">301</td><td class="line"> limit_type = <span class='macro'>_(<span class='string_literal'>"lower limit"</span>)<span class='macro_popup'>dcgettext (((void*)0), "lower limit", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="302"><td class="num" id="LN302">302</td><td class="line"> limit_value = active_sensor->sensor_low_value;</td></tr> +<tr class="codeline" data-linenumber="303"><td class="num" id="LN303">303</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (active_sensor->sensor_values[0] >= active_sensor->sensor_high_value && notif_type == HIGH_ALARM) {</td></tr> +<tr class="codeline" data-linenumber="304"><td class="num" id="LN304">304</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="305"><td class="num" id="LN305">305</td><td class="line"> <span class='comment'>/* assume high alarm condition */</span></td></tr> +<tr class="codeline" data-linenumber="306"><td class="num" id="LN306">306</td><td class="line"> relation = <span class='macro'>_(<span class='string_literal'>"is very high"</span>)<span class='macro_popup'>dcgettext (((void*)0), "is very high", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="307"><td class="num" id="LN307">307</td><td class="line"> limit_type = <span class='macro'>_(<span class='string_literal'>"upper limit"</span>)<span class='macro_popup'>dcgettext (((void*)0), "upper limit", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="308"><td class="num" id="LN308">308</td><td class="line"> limit_value = active_sensor->sensor_high_value;</td></tr> +<tr class="codeline" data-linenumber="309"><td class="num" id="LN309">309</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="310"><td class="num" id="LN310">310</td><td class="line"> g_warning(<span class='string_literal'>"Alarm notify called when no alarm condition!"</span>);</td></tr> +<tr class="codeline" data-linenumber="311"><td class="num" id="LN311">311</td><td class="line"> g_free(sensor_path);</td></tr> +<tr class="codeline" data-linenumber="312"><td class="num" id="LN312">312</td><td class="line"> g_free(sensor_label);</td></tr> +<tr class="codeline" data-linenumber="313"><td class="num" id="LN313">313</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="314"><td class="num" id="LN314">314</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="315"><td class="num" id="LN315">315</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="316"><td class="num" id="LN316">316</td><td class="line"> <span class='keyword'>switch</span> ((SensorType)sensor_type) {</td></tr> +<tr class="codeline" data-linenumber="317"><td class="num" id="LN317">317</td><td class="line"> <span class='keyword'>case</span> TEMP_SENSOR:</td></tr> +<tr class="codeline" data-linenumber="318"><td class="num" id="LN318">318</td><td class="line"> unit_type_title = <span class='macro'>_(<span class='string_literal'>"Temperature"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Temperature", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="319"><td class="num" id="LN319">319</td><td class="line"> unit_type = <span class='macro'>_(<span class='string_literal'>"temperature"</span>)<span class='macro_popup'>dcgettext (((void*)0), "temperature", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="320"><td class="num" id="LN320">320</td><td class="line"> temp_scale = (TemperatureScale) g_settings_get_int (active_sensor->sensors_applet->settings, <span class='macro'>TEMPERATURE_SCALE<span class='macro_popup'>"temperature-scale"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="321"><td class="num" id="LN321">321</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="322"><td class="num" id="LN322">322</td><td class="line"> <span class='keyword'>switch</span> (temp_scale) {</td></tr> +<tr class="codeline" data-linenumber="323"><td class="num" id="LN323">323</td><td class="line"> <span class='keyword'>case</span> CELSIUS:</td></tr> +<tr class="codeline" data-linenumber="324"><td class="num" id="LN324">324</td><td class="line"> units = <span class='macro'>UNITS_CELSIUS<span class='macro_popup'>"\302\260C"</span></span>;</td></tr> +<tr class="codeline" data-linenumber="325"><td class="num" id="LN325">325</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="326"><td class="num" id="LN326">326</td><td class="line"> <span class='keyword'>case</span> FAHRENHEIT:</td></tr> +<tr class="codeline" data-linenumber="327"><td class="num" id="LN327">327</td><td class="line"> units = <span class='macro'>UNITS_FAHRENHEIT<span class='macro_popup'>"\302\260F"</span></span>;</td></tr> +<tr class="codeline" data-linenumber="328"><td class="num" id="LN328">328</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="329"><td class="num" id="LN329">329</td><td class="line"> <span class='keyword'>case</span> KELVIN:</td></tr> +<tr class="codeline" data-linenumber="330"><td class="num" id="LN330">330</td><td class="line"> units = <span class='macro'>UNITS_KELVIN<span class='macro_popup'>""</span></span>;</td></tr> +<tr class="codeline" data-linenumber="331"><td class="num" id="LN331">331</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="332"><td class="num" id="LN332">332</td><td class="line"> <span class='keyword'>default</span>:</td></tr> +<tr class="codeline" data-linenumber="333"><td class="num" id="LN333">333</td><td class="line"> units = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="334"><td class="num" id="LN334">334</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="335"><td class="num" id="LN335">335</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="336"><td class="num" id="LN336">336</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="337"><td class="num" id="LN337">337</td><td class="line"> <span class='keyword'>case</span> VOLTAGE_SENSOR:</td></tr> +<tr class="codeline" data-linenumber="338"><td class="num" id="LN338">338</td><td class="line"> unit_type_title = <span class='macro'>_(<span class='string_literal'>"Voltage"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Voltage", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="339"><td class="num" id="LN339">339</td><td class="line"> unit_type = <span class='macro'>_(<span class='string_literal'>"voltage"</span>)<span class='macro_popup'>dcgettext (((void*)0), "voltage", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="340"><td class="num" id="LN340">340</td><td class="line"> units = <span class='macro'>UNITS_VOLTAGE<span class='macro_popup'>dcgettext (((void*)0), "V", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="341"><td class="num" id="LN341">341</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="342"><td class="num" id="LN342">342</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="343"><td class="num" id="LN343">343</td><td class="line"> <span class='keyword'>case</span> FAN_SENSOR:</td></tr> +<tr class="codeline" data-linenumber="344"><td class="num" id="LN344">344</td><td class="line"> unit_type_title = <span class='macro'>_(<span class='string_literal'>"Fan Speed"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Fan Speed", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="345"><td class="num" id="LN345">345</td><td class="line"> unit_type = <span class='macro'>_(<span class='string_literal'>"fan speed"</span>)<span class='macro_popup'>dcgettext (((void*)0), "fan speed", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="346"><td class="num" id="LN346">346</td><td class="line"> units = <span class='macro'>UNITS_RPM<span class='macro_popup'>dcgettext (((void*)0), "RPM", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="347"><td class="num" id="LN347">347</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="348"><td class="num" id="LN348">348</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="349"><td class="num" id="LN349">349</td><td class="line"> <span class='keyword'>case</span> CURRENT_SENSOR:</td></tr> +<tr class="codeline" data-linenumber="350"><td class="num" id="LN350">350</td><td class="line"> unit_type_title = <span class='macro'>_(<span class='string_literal'>"Current"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Current", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="351"><td class="num" id="LN351">351</td><td class="line"> unit_type = <span class='macro'>_(<span class='string_literal'>"current"</span>)<span class='macro_popup'>dcgettext (((void*)0), "current", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="352"><td class="num" id="LN352">352</td><td class="line"> units = <span class='macro'>UNITS_CURRENT<span class='macro_popup'>dcgettext (((void*)0), "A", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="353"><td class="num" id="LN353">353</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="354"><td class="num" id="LN354">354</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="355"><td class="num" id="LN355">355</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="356"><td class="num" id="LN356">356</td><td class="line"> timeout_msecs = (active_sensor->alarm_timeout ? <span class='macro'>MIN(DEFAULT_NOTIFY_TIMEOUT, (active_sensor->alarm_timeout * 1000))<span class='macro_popup'>(((3000) < ((active_sensor->alarm_timeout * 1000))) ? (<br>3000) : ((active_sensor->alarm_timeout * 1000)))</span></span> : <span class='macro'>DEFAULT_NOTIFY_TIMEOUT<span class='macro_popup'>3000</span></span>);</td></tr> +<tr class="codeline" data-linenumber="357"><td class="num" id="LN357">357</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="358"><td class="num" id="LN358">358</td><td class="line"> summary = g_strdup_printf(<span class='string_literal'>"%s %s %s"</span>, sensor_label, unit_type_title, <span class='macro'>_(<span class='string_literal'>"Alarm"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Alarm", 5)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="359"><td class="num" id="LN359">359</td><td class="line"> message = g_strdup_printf(<span class='string_literal'>"%s %s %s (%s %2.0f%s)"</span>, sensor_label, unit_type, relation, limit_type, limit_value, units);</td></tr> +<tr class="codeline" data-linenumber="360"><td class="num" id="LN360">360</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="361"><td class="num" id="LN361">361</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="362"><td class="num" id="LN362">362</td><td class="line"> <span class='keyword'>case</span> SENSOR_INTERFACE_ERROR:</td></tr> +<tr class="codeline" data-linenumber="363"><td class="num" id="LN363">363</td><td class="line"> <span class='comment'>/* get time since the last error */</span></td></tr> +<tr class="codeline" data-linenumber="364"><td class="num" id="LN364">364</td><td class="line"> seconds = difftime(time(<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>), active_sensor->ierror_ts);</td></tr> +<tr class="codeline" data-linenumber="365"><td class="num" id="LN365">365</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="366"><td class="num" id="LN366">366</td><td class="line"> <span class='comment'>/* if the last error happened less than 10 seconds ago, don't display this one</span></td></tr> +<tr class="codeline" data-linenumber="367"><td class="num" id="LN367">367</td><td class="line"> <span class='comment'>* this should prevent recurring popups for removed sensors, like USB-HDDs */</span></td></tr> +<tr class="codeline" data-linenumber="368"><td class="num" id="LN368">368</td><td class="line"> <span class='keyword'>if</span> (seconds < 11.0) {</td></tr> +<tr class="codeline" data-linenumber="369"><td class="num" id="LN369">369</td><td class="line"> show_notification = <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="370"><td class="num" id="LN370">370</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="371"><td class="num" id="LN371">371</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="372"><td class="num" id="LN372">372</td><td class="line"> summary = g_strdup_printf(<span class='macro'>_(<span class='string_literal'>"Error updating sensor %s"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Error updating sensor %s", 5)</span></span>, sensor_label);</td></tr> +<tr class="codeline" data-linenumber="373"><td class="num" id="LN373">373</td><td class="line"> message = g_strdup_printf(<span class='macro'>_(<span class='string_literal'>"An error occurred while trying to update the value of the sensor %s located at %s."</span>)<span class='macro_popup'>dcgettext (((void*)0), "An error occurred while trying to update the value of the sensor %s located at %s."<br>, 5)</span></span>, sensor_label, sensor_path);</td></tr> +<tr class="codeline" data-linenumber="374"><td class="num" id="LN374">374</td><td class="line"> timeout_msecs = g_settings_get_int (active_sensor->sensors_applet->settings, <span class='macro'>TIMEOUT<span class='macro_popup'>"timeout-delay"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="375"><td class="num" id="LN375">375</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="376"><td class="num" id="LN376">376</td><td class="line"> <span class='comment'>/* update timestamp */</span></td></tr> +<tr class="codeline" data-linenumber="377"><td class="num" id="LN377">377</td><td class="line"> time(&(active_sensor->ierror_ts));</td></tr> +<tr class="codeline" data-linenumber="378"><td class="num" id="LN378">378</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="379"><td class="num" id="LN379">379</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="380"><td class="num" id="LN380">380</td><td class="line"> <span class='keyword'>default</span>:</td></tr> +<tr class="codeline" data-linenumber="381"><td class="num" id="LN381">381</td><td class="line"> <span class='macro'>g_assert_not_reached()<span class='macro_popup'>do { g_assertion_message_expr ("sensors-applet", "sensors-applet.c"<br>, 381, ((const char*) (__func__)), ((void*)0)); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="382"><td class="num" id="LN382">382</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="383"><td class="num" id="LN383">383</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="384"><td class="num" id="LN384">384</td><td class="line"> <span class='keyword'>if</span> (show_notification) {</td></tr> +<tr class="codeline" data-linenumber="385"><td class="num" id="LN385">385</td><td class="line"> active_sensor_libnotify_notify(active_sensor,</td></tr> +<tr class="codeline" data-linenumber="386"><td class="num" id="LN386">386</td><td class="line"> notif_type,</td></tr> +<tr class="codeline" data-linenumber="387"><td class="num" id="LN387">387</td><td class="line"> summary,</td></tr> +<tr class="codeline" data-linenumber="388"><td class="num" id="LN388">388</td><td class="line"> message,</td></tr> +<tr class="codeline" data-linenumber="389"><td class="num" id="LN389">389</td><td class="line"> <span class='string_literal'>"dialog-warning"</span>,</td></tr> +<tr class="codeline" data-linenumber="390"><td class="num" id="LN390">390</td><td class="line"> timeout_msecs);</td></tr> +<tr class="codeline" data-linenumber="391"><td class="num" id="LN391">391</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="392"><td class="num" id="LN392">392</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="393"><td class="num" id="LN393">393</td><td class="line"> g_free(sensor_path);</td></tr> +<tr class="codeline" data-linenumber="394"><td class="num" id="LN394">394</td><td class="line"> g_free(sensor_label);</td></tr> +<tr class="codeline" data-linenumber="395"><td class="num" id="LN395">395</td><td class="line"> g_free(summary);</td></tr> +<tr class="codeline" data-linenumber="396"><td class="num" id="LN396">396</td><td class="line"> g_free(message);</td></tr> +<tr class="codeline" data-linenumber="397"><td class="num" id="LN397">397</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="398"><td class="num" id="LN398">398</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="399"><td class="num" id="LN399">399</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="400"><td class="num" id="LN400">400</td><td class="line"><span class='keyword'>void</span> sensors_applet_notify_end(ActiveSensor *active_sensor, NotifType notif_type) {</td></tr> +<tr class="codeline" data-linenumber="401"><td class="num" id="LN401">401</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_LIBNOTIFY<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="402"><td class="num" id="LN402">402</td><td class="line"> active_sensor_libnotify_notify_end(active_sensor, notif_type);</td></tr> +<tr class="codeline" data-linenumber="403"><td class="num" id="LN403">403</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="404"><td class="num" id="LN404">404</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="405"><td class="num" id="LN405">405</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="406"><td class="num" id="LN406">406</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_LIBNOTIFY<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="407"><td class="num" id="LN407">407</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> sensors_applet_notify_end_all_gfunc(ActiveSensor *active_sensor, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="408"><td class="num" id="LN408">408</td><td class="line"> active_sensor_libnotify_notify_end(active_sensor, LOW_ALARM);</td></tr> +<tr class="codeline" data-linenumber="409"><td class="num" id="LN409">409</td><td class="line"> active_sensor_libnotify_notify_end(active_sensor, HIGH_ALARM);</td></tr> +<tr class="codeline" data-linenumber="410"><td class="num" id="LN410">410</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="411"><td class="num" id="LN411">411</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="412"><td class="num" id="LN412">412</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="413"><td class="num" id="LN413">413</td><td class="line"><span class='keyword'>void</span> sensors_applet_notify_end_all(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="414"><td class="num" id="LN414">414</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_LIBNOTIFY<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="415"><td class="num" id="LN415">415</td><td class="line"> g_list_foreach(sensors_applet->active_sensors, (GFunc)sensors_applet_notify_end_all_gfunc, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="416"><td class="num" id="LN416">416</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="417"><td class="num" id="LN417">417</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="418"><td class="num" id="LN418">418</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="419"><td class="num" id="LN419">419</td><td class="line"><span class='comment'>/* internal helper functions for updating display etc */</span></td></tr> +<tr class="codeline" data-linenumber="420"><td class="num" id="LN420">420</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="421"><td class="num" id="LN421">421</td><td class="line"><span class='comment'>/* should be called as a g_container_foreach at the start of</span></td></tr> +<tr class="codeline" data-linenumber="422"><td class="num" id="LN422">422</td><td class="line"> <span class='comment'>* pack_display if the grid already exists to remove but keep alive</span></td></tr> +<tr class="codeline" data-linenumber="423"><td class="num" id="LN423">423</td><td class="line"> <span class='comment'>* all children of the grid before repacking it */</span></td></tr> +<tr class="codeline" data-linenumber="424"><td class="num" id="LN424">424</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> sensors_applet_pack_display_empty_grid_cb(GtkWidget *widget, gpointer data)</td></tr> +<tr class="codeline" data-linenumber="425"><td class="num" id="LN425">425</td><td class="line">{</td></tr> +<tr class="codeline" data-linenumber="426"><td class="num" id="LN426">426</td><td class="line"> GtkContainer *container;</td></tr> +<tr class="codeline" data-linenumber="427"><td class="num" id="LN427">427</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="428"><td class="num" id="LN428">428</td><td class="line"> container = <span class='macro'>GTK_CONTAINER(data)<span class='macro_popup'>((((GtkContainer*) (void *) ((data)))))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="429"><td class="num" id="LN429">429</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="430"><td class="num" id="LN430">430</td><td class="line"> <span class='comment'>/* ref then remove widget */</span></td></tr> +<tr class="codeline" data-linenumber="431"><td class="num" id="LN431">431</td><td class="line"> <span class='macro'>g_object_ref(widget)<span class='macro_popup'>((__typeof__ (widget)) (g_object_ref) (widget))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="432"><td class="num" id="LN432">432</td><td class="line"> gtk_container_remove(container, widget);</td></tr> +<tr class="codeline" data-linenumber="433"><td class="num" id="LN433">433</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="434"><td class="num" id="LN434">434</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="435"><td class="num" id="LN435">435</td><td class="line"><span class='comment'>/* should be called as a g_container_foreach at the end of</span></td></tr> +<tr class="codeline" data-linenumber="436"><td class="num" id="LN436">436</td><td class="line"> <span class='comment'>* pack_display to unref any of the old children that we have readdded</span></td></tr> +<tr class="codeline" data-linenumber="437"><td class="num" id="LN437">437</td><td class="line"> <span class='comment'>* to the table to stop reference creep from the g_object_ref called</span></td></tr> +<tr class="codeline" data-linenumber="438"><td class="num" id="LN438">438</td><td class="line"> <span class='comment'>* on each child at the start of pack labels */</span></td></tr> +<tr class="codeline" data-linenumber="439"><td class="num" id="LN439">439</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> sensors_applet_pack_display_cleanup_refs_cb(GtkWidget *widget, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="440"><td class="num" id="LN440">440</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="441"><td class="num" id="LN441">441</td><td class="line"> GList *old_children;</td></tr> +<tr class="codeline" data-linenumber="442"><td class="num" id="LN442">442</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="443"><td class="num" id="LN443">443</td><td class="line"> old_children = (GList *)data;</td></tr> +<tr class="codeline" data-linenumber="444"><td class="num" id="LN444">444</td><td class="line"> <span class='keyword'>if</span> (g_list_find(old_children, widget)) {</td></tr> +<tr class="codeline" data-linenumber="445"><td class="num" id="LN445">445</td><td class="line"> g_object_unref(widget);</td></tr> +<tr class="codeline" data-linenumber="446"><td class="num" id="LN446">446</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="447"><td class="num" id="LN447">447</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="448"><td class="num" id="LN448">448</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="449"><td class="num" id="LN449">449</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> sensors_applet_pack_display(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="450"><td class="num" id="LN450">450</td><td class="line"> <span class='comment'>/* note the if () around each widget is to ensure we only</span></td></tr> +<tr class="codeline" data-linenumber="451"><td class="num" id="LN451">451</td><td class="line"> <span class='comment'>* operate on those that actually exist */</span></td></tr> +<tr class="codeline" data-linenumber="452"><td class="num" id="LN452">452</td><td class="line"> GtkLabel *no_sensors_enabled_label = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="453"><td class="num" id="LN453">453</td><td class="line"> gint num_active_sensors = 0, num_sensors_per_group = 0, rows, cols, i, j;</td></tr> +<tr class="codeline" data-linenumber="454"><td class="num" id="LN454">454</td><td class="line"> GList *old_grid_children = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="455"><td class="num" id="LN455">455</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="456"><td class="num" id="LN456">456</td><td class="line"> GList *current_sensor;</td></tr> +<tr class="codeline" data-linenumber="457"><td class="num" id="LN457">457</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="458"><td class="num" id="LN458">458</td><td class="line"> DisplayMode display_mode;</td></tr> +<tr class="codeline" data-linenumber="459"><td class="num" id="LN459">459</td><td class="line"> LayoutMode layout_mode;</td></tr> +<tr class="codeline" data-linenumber="460"><td class="num" id="LN460">460</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="461"><td class="num" id="LN461">461</td><td class="line"> gboolean horizontal;</td></tr> +<tr class="codeline" data-linenumber="462"><td class="num" id="LN462">462</td><td class="line"> gint label_width, icon_width, value_width;</td></tr> +<tr class="codeline" data-linenumber="463"><td class="num" id="LN463">463</td><td class="line"> gint label_height, icon_height, value_height;</td></tr> +<tr class="codeline" data-linenumber="464"><td class="num" id="LN464">464</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="465"><td class="num" id="LN465">465</td><td class="line"> GtkRequisition req;</td></tr> +<tr class="codeline" data-linenumber="466"><td class="num" id="LN466">466</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="467"><td class="num" id="LN467">467</td><td class="line"> ActiveSensor *first_sensor;</td></tr> +<tr class="codeline" data-linenumber="468"><td class="num" id="LN468">468</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="469"><td class="num" id="LN469">469</td><td class="line"> <span class='comment'>/* it is possible that there could be no active sensors so</span></td></tr> +<tr class="codeline" data-linenumber="470"><td class="num" id="LN470">470</td><td class="line"> <span class='comment'>* handle that case first - make sure we dont do a NULL</span></td></tr> +<tr class="codeline" data-linenumber="471"><td class="num" id="LN471">471</td><td class="line"> <span class='comment'>* pointer access first though */</span></td></tr> +<tr class="codeline" data-linenumber="472"><td class="num" id="LN472">472</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->active_sensors == <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> || g_list_length(sensors_applet->active_sensors) == 0) {</td></tr> +<tr class="codeline" data-linenumber="473"><td class="num" id="LN473">473</td><td class="line"> g_debug(<span class='string_literal'>"no active sensors to pack in grid"</span>);</td></tr> +<tr class="codeline" data-linenumber="474"><td class="num" id="LN474">474</td><td class="line"> no_sensors_enabled_label = g_object_new(<span class='macro'>GTK_TYPE_LABEL<span class='macro_popup'>(gtk_label_get_type ())</span></span>, <span class='string_literal'>"label"</span>, <span class='macro'>_(<span class='string_literal'>"No sensors enabled!"</span>)<span class='macro_popup'>dcgettext (((void*)0), "No sensors enabled!", 5)</span></span>, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="475"><td class="num" id="LN475">475</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="476"><td class="num" id="LN476">476</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->grid == <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="477"><td class="num" id="LN477">477</td><td class="line"> <span class='comment'>/* only need 1 row and 1 col */</span></td></tr> +<tr class="codeline" data-linenumber="478"><td class="num" id="LN478">478</td><td class="line"> sensors_applet->grid = gtk_grid_new();</td></tr> +<tr class="codeline" data-linenumber="479"><td class="num" id="LN479">479</td><td class="line"> gtk_grid_set_column_spacing(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>, <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>);</td></tr> +<tr class="codeline" data-linenumber="480"><td class="num" id="LN480">480</td><td class="line"> gtk_grid_set_row_spacing(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>, <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>);</td></tr> +<tr class="codeline" data-linenumber="481"><td class="num" id="LN481">481</td><td class="line"> gtk_widget_set_halign(sensors_applet->grid, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="482"><td class="num" id="LN482">482</td><td class="line"> gtk_widget_set_valign(sensors_applet->grid, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="483"><td class="num" id="LN483">483</td><td class="line"> <span class='comment'>/* add grid to applet */</span></td></tr> +<tr class="codeline" data-linenumber="484"><td class="num" id="LN484">484</td><td class="line"> gtk_container_add(<span class='macro'>GTK_CONTAINER(sensors_applet->applet)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->applet)))))</span></span>, sensors_applet->grid);</td></tr> +<tr class="codeline" data-linenumber="485"><td class="num" id="LN485">485</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="486"><td class="num" id="LN486">486</td><td class="line"> <span class='comment'>/* destroy existing widgets - could be an</span></td></tr> +<tr class="codeline" data-linenumber="487"><td class="num" id="LN487">487</td><td class="line"> <span class='comment'>* existing version of no sensors label - okay</span></td></tr> +<tr class="codeline" data-linenumber="488"><td class="num" id="LN488">488</td><td class="line"> <span class='comment'>* to just add again though if destroy first */</span></td></tr> +<tr class="codeline" data-linenumber="489"><td class="num" id="LN489">489</td><td class="line"> g_debug(<span class='string_literal'>"destroying any existing widgets in container"</span>);</td></tr> +<tr class="codeline" data-linenumber="490"><td class="num" id="LN490">490</td><td class="line"> gtk_container_foreach(<span class='macro'>GTK_CONTAINER(sensors_applet->grid)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->grid)))))</span></span>, (GtkCallback)gtk_widget_destroy, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="491"><td class="num" id="LN491">491</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="492"><td class="num" id="LN492">492</td><td class="line"> g_debug(<span class='string_literal'>"packing no sensors enabled label"</span>);</td></tr> +<tr class="codeline" data-linenumber="493"><td class="num" id="LN493">493</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="494"><td class="num" id="LN494">494</td><td class="line"> <span class='macro'>GTK_WIDGET(no_sensors_enabled_label)<span class='macro_popup'>((((GtkWidget*) (void *) ((no_sensors_enabled_label)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="495"><td class="num" id="LN495">495</td><td class="line"> 0, 0, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="496"><td class="num" id="LN496">496</td><td class="line"> gtk_widget_show_all(<span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="497"><td class="num" id="LN497">497</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="498"><td class="num" id="LN498">498</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="499"><td class="num" id="LN499">499</td><td class="line"> <span class='comment'>/* otherwise can acess active_sensors without any worries */</span></td></tr> +<tr class="codeline" data-linenumber="500"><td class="num" id="LN500">500</td><td class="line"> num_active_sensors = g_list_length(sensors_applet->active_sensors);</td></tr> +<tr class="codeline" data-linenumber="501"><td class="num" id="LN501">501</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="502"><td class="num" id="LN502">502</td><td class="line"> display_mode = (DisplayMode) g_settings_get_int (sensors_applet->settings, <span class='macro'>DISPLAY_MODE<span class='macro_popup'>"display-mode"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="503"><td class="num" id="LN503">503</td><td class="line"> layout_mode = (LayoutMode) g_settings_get_int (sensors_applet->settings, <span class='macro'>LAYOUT_MODE<span class='macro_popup'>"layout-mode"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="504"><td class="num" id="LN504">504</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="505"><td class="num" id="LN505">505</td><td class="line"> horizontal = (((mate_panel_applet_get_orient(sensors_applet->applet) == MATE_PANEL_APPLET_ORIENT_UP) ||</td></tr> +<tr class="codeline" data-linenumber="506"><td class="num" id="LN506">506</td><td class="line"> (mate_panel_applet_get_orient(sensors_applet->applet) == MATE_PANEL_APPLET_ORIENT_DOWN)));</td></tr> +<tr class="codeline" data-linenumber="507"><td class="num" id="LN507">507</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="508"><td class="num" id="LN508">508</td><td class="line"> <span class='comment'>/* figure out num rows / cols by how high / wide sensors</span></td></tr> +<tr class="codeline" data-linenumber="509"><td class="num" id="LN509">509</td><td class="line"> <span class='comment'>* labels / icons are and how much size we have to put them in */</span></td></tr> +<tr class="codeline" data-linenumber="510"><td class="num" id="LN510">510</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="511"><td class="num" id="LN511">511</td><td class="line"> <span class='comment'>/* get the first active sensor */</span></td></tr> +<tr class="codeline" data-linenumber="512"><td class="num" id="LN512">512</td><td class="line"> first_sensor = (ActiveSensor *)sensors_applet->active_sensors->data;</td></tr> +<tr class="codeline" data-linenumber="513"><td class="num" id="LN513">513</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="514"><td class="num" id="LN514">514</td><td class="line"> <span class='keyword'>switch</span> (display_mode) {</td></tr> +<tr class="codeline" data-linenumber="515"><td class="num" id="LN515">515</td><td class="line"> <span class='keyword'>case</span> DISPLAY_VALUE:</td></tr> +<tr class="codeline" data-linenumber="516"><td class="num" id="LN516">516</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->value)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->value)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="517"><td class="num" id="LN517">517</td><td class="line"> value_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="518"><td class="num" id="LN518">518</td><td class="line"> value_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="519"><td class="num" id="LN519">519</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="520"><td class="num" id="LN520">520</td><td class="line"> <span class='comment'>/* make sure all widths and heights are non zero,</span></td></tr> +<tr class="codeline" data-linenumber="521"><td class="num" id="LN521">521</td><td class="line"> <span class='comment'>* otherwise will get a divide by zero exception below</span></td></tr> +<tr class="codeline" data-linenumber="522"><td class="num" id="LN522">522</td><td class="line"> <span class='comment'>* - is a non critical error since can happen when</span></td></tr> +<tr class="codeline" data-linenumber="523"><td class="num" id="LN523">523</td><td class="line"> <span class='comment'>* elements first added to list, so simply return - is</span></td></tr> +<tr class="codeline" data-linenumber="524"><td class="num" id="LN524">524</td><td class="line"> <span class='comment'>* not a programming error */</span></td></tr> +<tr class="codeline" data-linenumber="525"><td class="num" id="LN525">525</td><td class="line"> <span class='keyword'>if</span> (value_width == 0 && value_height == 0) {</td></tr> +<tr class="codeline" data-linenumber="526"><td class="num" id="LN526">526</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="527"><td class="num" id="LN527">527</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="528"><td class="num" id="LN528">528</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="529"><td class="num" id="LN529">529</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? value_height : value_width));</td></tr> +<tr class="codeline" data-linenumber="530"><td class="num" id="LN530">530</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="531"><td class="num" id="LN531">531</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="532"><td class="num" id="LN532">532</td><td class="line"> <span class='keyword'>case</span> DISPLAY_LABEL_WITH_VALUE:</td></tr> +<tr class="codeline" data-linenumber="533"><td class="num" id="LN533">533</td><td class="line"> <span class='comment'>/* even though we end up packing the event boxes into the</span></td></tr> +<tr class="codeline" data-linenumber="534"><td class="num" id="LN534">534</td><td class="line"> <span class='comment'>* panel, these dont give back request sizes, so need to ask</span></td></tr> +<tr class="codeline" data-linenumber="535"><td class="num" id="LN535">535</td><td class="line"> <span class='comment'>* widgets directly */</span></td></tr> +<tr class="codeline" data-linenumber="536"><td class="num" id="LN536">536</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->value)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->value)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="537"><td class="num" id="LN537">537</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="538"><td class="num" id="LN538">538</td><td class="line"> value_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="539"><td class="num" id="LN539">539</td><td class="line"> value_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="540"><td class="num" id="LN540">540</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="541"><td class="num" id="LN541">541</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->label)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->label)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="542"><td class="num" id="LN542">542</td><td class="line"> label_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="543"><td class="num" id="LN543">543</td><td class="line"> label_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="544"><td class="num" id="LN544">544</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="545"><td class="num" id="LN545">545</td><td class="line"> <span class='comment'>/* make sure all widths and heights are non zero, otherwise</span></td></tr> +<tr class="codeline" data-linenumber="546"><td class="num" id="LN546">546</td><td class="line"> <span class='comment'>* will get a divide by zero exception below</span></td></tr> +<tr class="codeline" data-linenumber="547"><td class="num" id="LN547">547</td><td class="line"> <span class='comment'>* - is a non critical error since can happen when</span></td></tr> +<tr class="codeline" data-linenumber="548"><td class="num" id="LN548">548</td><td class="line"> <span class='comment'>* elements first added to list, so simply return - is</span></td></tr> +<tr class="codeline" data-linenumber="549"><td class="num" id="LN549">549</td><td class="line"> <span class='comment'>* not a programming error */</span></td></tr> +<tr class="codeline" data-linenumber="550"><td class="num" id="LN550">550</td><td class="line"> <span class='keyword'>if</span> (!(label_width && label_height && value_width && value_height)) {</td></tr> +<tr class="codeline" data-linenumber="551"><td class="num" id="LN551">551</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="552"><td class="num" id="LN552">552</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="553"><td class="num" id="LN553">553</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="554"><td class="num" id="LN554">554</td><td class="line"> <span class='keyword'>switch</span> (layout_mode) {</td></tr> +<tr class="codeline" data-linenumber="555"><td class="num" id="LN555">555</td><td class="line"> <span class='keyword'>case</span> VALUE_BESIDE_LABEL:</td></tr> +<tr class="codeline" data-linenumber="556"><td class="num" id="LN556">556</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? <span class='macro'>MAX(label_height, value_height)<span class='macro_popup'>(((label_height) > (value_height)) ? (label_height) : (value_height<br>))</span></span> : (label_width + value_width)));</td></tr> +<tr class="codeline" data-linenumber="557"><td class="num" id="LN557">557</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="558"><td class="num" id="LN558">558</td><td class="line"> <span class='keyword'>case</span> VALUE_BELOW_LABEL:</td></tr> +<tr class="codeline" data-linenumber="559"><td class="num" id="LN559">559</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? (label_height + value_height) : <span class='macro'>MAX(label_width, value_width)<span class='macro_popup'>(((label_width) > (value_width)) ? (label_width) : (value_width<br>))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="560"><td class="num" id="LN560">560</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="561"><td class="num" id="LN561">561</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="562"><td class="num" id="LN562">562</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="563"><td class="num" id="LN563">563</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="564"><td class="num" id="LN564">564</td><td class="line"> <span class='keyword'>case</span> DISPLAY_ICON_WITH_VALUE:</td></tr> +<tr class="codeline" data-linenumber="565"><td class="num" id="LN565">565</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->value)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->value)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="566"><td class="num" id="LN566">566</td><td class="line"> value_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="567"><td class="num" id="LN567">567</td><td class="line"> value_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="568"><td class="num" id="LN568">568</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="569"><td class="num" id="LN569">569</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->icon)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->icon)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="570"><td class="num" id="LN570">570</td><td class="line"> icon_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="571"><td class="num" id="LN571">571</td><td class="line"> icon_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="572"><td class="num" id="LN572">572</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="573"><td class="num" id="LN573">573</td><td class="line"> <span class='keyword'>if</span> (!(icon_width && icon_height && value_width && value_height)) {</td></tr> +<tr class="codeline" data-linenumber="574"><td class="num" id="LN574">574</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="575"><td class="num" id="LN575">575</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="576"><td class="num" id="LN576">576</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="577"><td class="num" id="LN577">577</td><td class="line"> <span class='keyword'>switch</span> (layout_mode) {</td></tr> +<tr class="codeline" data-linenumber="578"><td class="num" id="LN578">578</td><td class="line"> <span class='keyword'>case</span> VALUE_BESIDE_LABEL:</td></tr> +<tr class="codeline" data-linenumber="579"><td class="num" id="LN579">579</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? <span class='macro'>MAX(icon_height, value_height)<span class='macro_popup'>(((icon_height) > (value_height)) ? (icon_height) : (value_height<br>))</span></span> : (icon_width + value_width)));</td></tr> +<tr class="codeline" data-linenumber="580"><td class="num" id="LN580">580</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="581"><td class="num" id="LN581">581</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="582"><td class="num" id="LN582">582</td><td class="line"> <span class='keyword'>case</span> VALUE_BELOW_LABEL:</td></tr> +<tr class="codeline" data-linenumber="583"><td class="num" id="LN583">583</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? (icon_height + value_height) : <span class='macro'>MAX(icon_width, value_width)<span class='macro_popup'>(((icon_width) > (value_width)) ? (icon_width) : (value_width<br>))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="584"><td class="num" id="LN584">584</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="585"><td class="num" id="LN585">585</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="586"><td class="num" id="LN586">586</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="587"><td class="num" id="LN587">587</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="588"><td class="num" id="LN588">588</td><td class="line"> <span class='keyword'>case</span> DISPLAY_ICON:</td></tr> +<tr class="codeline" data-linenumber="589"><td class="num" id="LN589">589</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->icon)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->icon)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="590"><td class="num" id="LN590">590</td><td class="line"> icon_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="591"><td class="num" id="LN591">591</td><td class="line"> icon_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="592"><td class="num" id="LN592">592</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="593"><td class="num" id="LN593">593</td><td class="line"> <span class='keyword'>if</span> (!(icon_width && icon_height)) {</td></tr> +<tr class="codeline" data-linenumber="594"><td class="num" id="LN594">594</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="595"><td class="num" id="LN595">595</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="596"><td class="num" id="LN596">596</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="597"><td class="num" id="LN597">597</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? icon_height : icon_width));</td></tr> +<tr class="codeline" data-linenumber="598"><td class="num" id="LN598">598</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="599"><td class="num" id="LN599">599</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="600"><td class="num" id="LN600">600</td><td class="line"> <span class='keyword'>case</span> DISPLAY_GRAPH:</td></tr> +<tr class="codeline" data-linenumber="601"><td class="num" id="LN601">601</td><td class="line"> <span class='comment'>/* only show graphs in a line like System Monitor applet */</span></td></tr> +<tr class="codeline" data-linenumber="602"><td class="num" id="LN602">602</td><td class="line"> num_sensors_per_group = 1;</td></tr> +<tr class="codeline" data-linenumber="603"><td class="num" id="LN603">603</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="604"><td class="num" id="LN604">604</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="605"><td class="num" id="LN605">605</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="606"><td class="num" id="LN606">606</td><td class="line"> <span class='comment'>/* ensure always atleast 1 sensor per group */</span></td></tr> +<tr class="codeline" data-linenumber="607"><td class="num" id="LN607">607</td><td class="line"> <span class='keyword'>if</span> (num_sensors_per_group < 1) {</td></tr> +<tr class="codeline" data-linenumber="608"><td class="num" id="LN608">608</td><td class="line"> <span class='comment'>/* force a better layout */</span></td></tr> +<tr class="codeline" data-linenumber="609"><td class="num" id="LN609">609</td><td class="line"> <span class='keyword'>if</span> (horizontal && layout_mode == VALUE_BELOW_LABEL) {</td></tr> +<tr class="codeline" data-linenumber="610"><td class="num" id="LN610">610</td><td class="line"> layout_mode = VALUE_BESIDE_LABEL;</td></tr> +<tr class="codeline" data-linenumber="611"><td class="num" id="LN611">611</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (!horizontal && layout_mode == VALUE_BESIDE_LABEL) {</td></tr> +<tr class="codeline" data-linenumber="612"><td class="num" id="LN612">612</td><td class="line"> layout_mode = VALUE_BELOW_LABEL;</td></tr> +<tr class="codeline" data-linenumber="613"><td class="num" id="LN613">613</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="614"><td class="num" id="LN614">614</td><td class="line"> num_sensors_per_group = 1;</td></tr> +<tr class="codeline" data-linenumber="615"><td class="num" id="LN615">615</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="616"><td class="num" id="LN616">616</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="617"><td class="num" id="LN617">617</td><td class="line"> <span class='keyword'>if</span> (horizontal) {</td></tr> +<tr class="codeline" data-linenumber="618"><td class="num" id="LN618">618</td><td class="line"> <span class='comment'>/* if oriented horizontally, want as many</span></td></tr> +<tr class="codeline" data-linenumber="619"><td class="num" id="LN619">619</td><td class="line"> <span class='comment'>sensors per column as user has defined, then</span></td></tr> +<tr class="codeline" data-linenumber="620"><td class="num" id="LN620">620</td><td class="line"> <span class='comment'>enough columns to hold all the widgets */</span></td></tr> +<tr class="codeline" data-linenumber="621"><td class="num" id="LN621">621</td><td class="line"> rows = num_sensors_per_group;</td></tr> +<tr class="codeline" data-linenumber="622"><td class="num" id="LN622">622</td><td class="line"> cols = num_active_sensors / num_sensors_per_group;</td></tr> +<tr class="codeline" data-linenumber="623"><td class="num" id="LN623">623</td><td class="line"> <span class='keyword'>while</span> (rows * cols < num_active_sensors || cols == 0) {</td></tr> +<tr class="codeline" data-linenumber="624"><td class="num" id="LN624">624</td><td class="line"> cols++;</td></tr> +<tr class="codeline" data-linenumber="625"><td class="num" id="LN625">625</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="626"><td class="num" id="LN626">626</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="627"><td class="num" id="LN627">627</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="628"><td class="num" id="LN628">628</td><td class="line"> <span class='comment'>/* if oriented vertically, want as many</span></td></tr> +<tr class="codeline" data-linenumber="629"><td class="num" id="LN629">629</td><td class="line"> <span class='comment'>sensors per row as user has defined, then</span></td></tr> +<tr class="codeline" data-linenumber="630"><td class="num" id="LN630">630</td><td class="line"> <span class='comment'>enough rows to hold all the widgets*/</span></td></tr> +<tr class="codeline" data-linenumber="631"><td class="num" id="LN631">631</td><td class="line"> cols = num_sensors_per_group;</td></tr> +<tr class="codeline" data-linenumber="632"><td class="num" id="LN632">632</td><td class="line"> rows = num_active_sensors / num_sensors_per_group;</td></tr> +<tr class="codeline" data-linenumber="633"><td class="num" id="LN633">633</td><td class="line"> <span class='keyword'>while</span> (rows * cols < num_active_sensors || rows == 0) {</td></tr> +<tr class="codeline" data-linenumber="634"><td class="num" id="LN634">634</td><td class="line"> rows++;</td></tr> +<tr class="codeline" data-linenumber="635"><td class="num" id="LN635">635</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="636"><td class="num" id="LN636">636</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="637"><td class="num" id="LN637">637</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="638"><td class="num" id="LN638">638</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="639"><td class="num" id="LN639">639</td><td class="line"> <span class='comment'>/* if displaying labels / icons and values need to modify</span></td></tr> +<tr class="codeline" data-linenumber="640"><td class="num" id="LN640">640</td><td class="line"> <span class='comment'>number of rows / colums to accomodate this */</span></td></tr> +<tr class="codeline" data-linenumber="641"><td class="num" id="LN641">641</td><td class="line"> <span class='keyword'>if</span> (display_mode == DISPLAY_LABEL_WITH_VALUE || display_mode == DISPLAY_ICON_WITH_VALUE) {</td></tr> +<tr class="codeline" data-linenumber="642"><td class="num" id="LN642">642</td><td class="line"> <span class='keyword'>if</span> (layout_mode == VALUE_BESIDE_LABEL) {</td></tr> +<tr class="codeline" data-linenumber="643"><td class="num" id="LN643">643</td><td class="line"> <span class='comment'>/* to display labels next to values need twice as many columns */</span></td></tr> +<tr class="codeline" data-linenumber="644"><td class="num" id="LN644">644</td><td class="line"> cols *= 2;</td></tr> +<tr class="codeline" data-linenumber="645"><td class="num" id="LN645">645</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="646"><td class="num" id="LN646">646</td><td class="line"> <span class='comment'>/* to display labels above values, we need twice as many rows as without */</span></td></tr> +<tr class="codeline" data-linenumber="647"><td class="num" id="LN647">647</td><td class="line"> rows *= 2;</td></tr> +<tr class="codeline" data-linenumber="648"><td class="num" id="LN648">648</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="649"><td class="num" id="LN649">649</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="650"><td class="num" id="LN650">650</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="651"><td class="num" id="LN651">651</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->grid == <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="652"><td class="num" id="LN652">652</td><td class="line"> <span class='comment'>/* create grid and add to applet */</span></td></tr> +<tr class="codeline" data-linenumber="653"><td class="num" id="LN653">653</td><td class="line"> sensors_applet->grid = gtk_grid_new();</td></tr> +<tr class="codeline" data-linenumber="654"><td class="num" id="LN654">654</td><td class="line"> gtk_grid_set_column_spacing(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>, <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>);</td></tr> +<tr class="codeline" data-linenumber="655"><td class="num" id="LN655">655</td><td class="line"> gtk_grid_set_row_spacing(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>, <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>);</td></tr> +<tr class="codeline" data-linenumber="656"><td class="num" id="LN656">656</td><td class="line"> gtk_widget_set_halign(sensors_applet->grid, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="657"><td class="num" id="LN657">657</td><td class="line"> gtk_widget_set_valign(sensors_applet->grid, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="658"><td class="num" id="LN658">658</td><td class="line"> gtk_container_add(<span class='macro'>GTK_CONTAINER(sensors_applet->applet)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->applet)))))</span></span>, sensors_applet->grid);</td></tr> +<tr class="codeline" data-linenumber="659"><td class="num" id="LN659">659</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="660"><td class="num" id="LN660">660</td><td class="line"> <span class='comment'>/* remove all children if grid already exists so we can start again */</span></td></tr> +<tr class="codeline" data-linenumber="661"><td class="num" id="LN661">661</td><td class="line"> <span class='comment'>/* save a list of the old children for later */</span></td></tr> +<tr class="codeline" data-linenumber="662"><td class="num" id="LN662">662</td><td class="line"> old_grid_children = gtk_container_get_children(<span class='macro'>GTK_CONTAINER(sensors_applet->grid)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->grid)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="663"><td class="num" id="LN663">663</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="664"><td class="num" id="LN664">664</td><td class="line"> gtk_container_foreach(<span class='macro'>GTK_CONTAINER(sensors_applet->grid)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="665"><td class="num" id="LN665">665</td><td class="line"> sensors_applet_pack_display_empty_grid_cb,</td></tr> +<tr class="codeline" data-linenumber="666"><td class="num" id="LN666">666</td><td class="line"> sensors_applet->grid);</td></tr> +<tr class="codeline" data-linenumber="667"><td class="num" id="LN667">667</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="668"><td class="num" id="LN668">668</td><td class="line"> <span class='comment'>/* pack icons / labels and values into grid */</span></td></tr> +<tr class="codeline" data-linenumber="669"><td class="num" id="LN669">669</td><td class="line"> current_sensor = sensors_applet->active_sensors;</td></tr> +<tr class="codeline" data-linenumber="670"><td class="num" id="LN670">670</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="671"><td class="num" id="LN671">671</td><td class="line"> <span class='comment'>/* if showing labels / icons and values, need to pack labels / icons these first */</span></td></tr> +<tr class="codeline" data-linenumber="672"><td class="num" id="LN672">672</td><td class="line"> <span class='keyword'>if</span> (display_mode == DISPLAY_ICON_WITH_VALUE || display_mode == DISPLAY_LABEL_WITH_VALUE) {</td></tr> +<tr class="codeline" data-linenumber="673"><td class="num" id="LN673">673</td><td class="line"> <span class='comment'>/* loop through columns */</span></td></tr> +<tr class="codeline" data-linenumber="674"><td class="num" id="LN674">674</td><td class="line"> <span class='keyword'>for</span> (i = 0; current_sensor != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> && i < cols; <span class='comment'>/* increments depends on how we lay them out - see below */</span>) {</td></tr> +<tr class="codeline" data-linenumber="675"><td class="num" id="LN675">675</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="676"><td class="num" id="LN676">676</td><td class="line"> <span class='comment'>/* loop through rows in a column */</span></td></tr> +<tr class="codeline" data-linenumber="677"><td class="num" id="LN677">677</td><td class="line"> <span class='keyword'>for</span> (j = 0; current_sensor && j < rows; <span class='comment'>/* see bottom of for loop*/</span>) {</td></tr> +<tr class="codeline" data-linenumber="678"><td class="num" id="LN678">678</td><td class="line"> <span class='comment'>/* attach label / icon at this point */</span></td></tr> +<tr class="codeline" data-linenumber="679"><td class="num" id="LN679">679</td><td class="line"> <span class='keyword'>if</span> (display_mode == DISPLAY_ICON_WITH_VALUE) {</td></tr> +<tr class="codeline" data-linenumber="680"><td class="num" id="LN680">680</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->icon) {</td></tr> +<tr class="codeline" data-linenumber="681"><td class="num" id="LN681">681</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="682"><td class="num" id="LN682">682</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->icon,</td></tr> +<tr class="codeline" data-linenumber="683"><td class="num" id="LN683">683</td><td class="line"> i, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="684"><td class="num" id="LN684">684</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="685"><td class="num" id="LN685">685</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="686"><td class="num" id="LN686">686</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->label) {</td></tr> +<tr class="codeline" data-linenumber="687"><td class="num" id="LN687">687</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="688"><td class="num" id="LN688">688</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->label,</td></tr> +<tr class="codeline" data-linenumber="689"><td class="num" id="LN689">689</td><td class="line"> i, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="690"><td class="num" id="LN690">690</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="691"><td class="num" id="LN691">691</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="692"><td class="num" id="LN692">692</td><td class="line"> <span class='comment'>/* now attach sensor value to either row below or column next to */</span></td></tr> +<tr class="codeline" data-linenumber="693"><td class="num" id="LN693">693</td><td class="line"> <span class='keyword'>if</span> (layout_mode == VALUE_BESIDE_LABEL) {</td></tr> +<tr class="codeline" data-linenumber="694"><td class="num" id="LN694">694</td><td class="line"> <span class='comment'>/* left align labels */</span></td></tr> +<tr class="codeline" data-linenumber="695"><td class="num" id="LN695">695</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->icon) {</td></tr> +<tr class="codeline" data-linenumber="696"><td class="num" id="LN696">696</td><td class="line"> gtk_widget_set_halign (((ActiveSensor *)(current_sensor->data))->icon, GTK_ALIGN_START);</td></tr> +<tr class="codeline" data-linenumber="697"><td class="num" id="LN697">697</td><td class="line"> gtk_widget_set_valign (((ActiveSensor *)(current_sensor->data))->icon, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="698"><td class="num" id="LN698">698</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="699"><td class="num" id="LN699">699</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->label) {</td></tr> +<tr class="codeline" data-linenumber="700"><td class="num" id="LN700">700</td><td class="line"> gtk_label_set_xalign (<span class='macro'>GTK_LABEL(((ActiveSensor *)(current_sensor->data))->label)<span class='macro_popup'>((((GtkLabel*) (void *) ((((ActiveSensor *)(current_sensor-><br>data))->label)))))</span></span>, 0);</td></tr> +<tr class="codeline" data-linenumber="701"><td class="num" id="LN701">701</td><td class="line"> gtk_label_set_yalign (<span class='macro'>GTK_LABEL(((ActiveSensor *)(current_sensor->data))->label)<span class='macro_popup'>((((GtkLabel*) (void *) ((((ActiveSensor *)(current_sensor-><br>data))->label)))))</span></span>, 0.5);</td></tr> +<tr class="codeline" data-linenumber="702"><td class="num" id="LN702">702</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="703"><td class="num" id="LN703">703</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="704"><td class="num" id="LN704">704</td><td class="line"> gtk_widget_set_halign (((ActiveSensor *)(current_sensor->data))->value, GTK_ALIGN_START);</td></tr> +<tr class="codeline" data-linenumber="705"><td class="num" id="LN705">705</td><td class="line"> gtk_widget_set_valign (((ActiveSensor *)(current_sensor->data))->value, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="706"><td class="num" id="LN706">706</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="707"><td class="num" id="LN707">707</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="708"><td class="num" id="LN708">708</td><td class="line"> <span class='comment'>/* place value next to label */</span></td></tr> +<tr class="codeline" data-linenumber="709"><td class="num" id="LN709">709</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="710"><td class="num" id="LN710">710</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="711"><td class="num" id="LN711">711</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->value,</td></tr> +<tr class="codeline" data-linenumber="712"><td class="num" id="LN712">712</td><td class="line"> i + 1, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="713"><td class="num" id="LN713">713</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="714"><td class="num" id="LN714">714</td><td class="line"> j++;</td></tr> +<tr class="codeline" data-linenumber="715"><td class="num" id="LN715">715</td><td class="line"> } <span class='keyword'>else</span> { <span class='comment'>/* place value below label */</span></td></tr> +<tr class="codeline" data-linenumber="716"><td class="num" id="LN716">716</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="717"><td class="num" id="LN717">717</td><td class="line"> <span class='comment'>/* center align labels */</span></td></tr> +<tr class="codeline" data-linenumber="718"><td class="num" id="LN718">718</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->icon) {</td></tr> +<tr class="codeline" data-linenumber="719"><td class="num" id="LN719">719</td><td class="line"> gtk_widget_set_halign (((ActiveSensor *)(current_sensor->data))->icon, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="720"><td class="num" id="LN720">720</td><td class="line"> gtk_widget_set_valign (((ActiveSensor *)(current_sensor->data))->icon, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="721"><td class="num" id="LN721">721</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="722"><td class="num" id="LN722">722</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->label) {</td></tr> +<tr class="codeline" data-linenumber="723"><td class="num" id="LN723">723</td><td class="line"> gtk_label_set_xalign (<span class='macro'>GTK_LABEL(((ActiveSensor *)(current_sensor->data))->label)<span class='macro_popup'>((((GtkLabel*) (void *) ((((ActiveSensor *)(current_sensor-><br>data))->label)))))</span></span>, 0.5);</td></tr> +<tr class="codeline" data-linenumber="724"><td class="num" id="LN724">724</td><td class="line"> gtk_label_set_yalign (<span class='macro'>GTK_LABEL(((ActiveSensor *)(current_sensor->data))->label)<span class='macro_popup'>((((GtkLabel*) (void *) ((((ActiveSensor *)(current_sensor-><br>data))->label)))))</span></span>, 0.5);</td></tr> +<tr class="codeline" data-linenumber="725"><td class="num" id="LN725">725</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="726"><td class="num" id="LN726">726</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="727"><td class="num" id="LN727">727</td><td class="line"> gtk_widget_set_halign (((ActiveSensor *)(current_sensor->data))->value, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="728"><td class="num" id="LN728">728</td><td class="line"> gtk_widget_set_valign (((ActiveSensor *)(current_sensor->data))->value, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="729"><td class="num" id="LN729">729</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="730"><td class="num" id="LN730">730</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="731"><td class="num" id="LN731">731</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="732"><td class="num" id="LN732">732</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="733"><td class="num" id="LN733">733</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->value,</td></tr> +<tr class="codeline" data-linenumber="734"><td class="num" id="LN734">734</td><td class="line"> i, j + 1, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="735"><td class="num" id="LN735">735</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="736"><td class="num" id="LN736">736</td><td class="line"> j += 2;</td></tr> +<tr class="codeline" data-linenumber="737"><td class="num" id="LN737">737</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="738"><td class="num" id="LN738">738</td><td class="line"> current_sensor = <span class='macro'>g_list_next(current_sensor)<span class='macro_popup'>((current_sensor) ? (((GList *)(current_sensor))->next) : (<br>(void*)0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="739"><td class="num" id="LN739">739</td><td class="line"> } <span class='comment'>/* end row loop */</span></td></tr> +<tr class="codeline" data-linenumber="740"><td class="num" id="LN740">740</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="741"><td class="num" id="LN741">741</td><td class="line"> <span class='comment'>/* now increment column index as needed */</span></td></tr> +<tr class="codeline" data-linenumber="742"><td class="num" id="LN742">742</td><td class="line"> <span class='keyword'>if</span> (layout_mode == VALUE_BESIDE_LABEL) { <span class='comment'>/* place value next to label */</span></td></tr> +<tr class="codeline" data-linenumber="743"><td class="num" id="LN743">743</td><td class="line"> i += 2;</td></tr> +<tr class="codeline" data-linenumber="744"><td class="num" id="LN744">744</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="745"><td class="num" id="LN745">745</td><td class="line"> i++;</td></tr> +<tr class="codeline" data-linenumber="746"><td class="num" id="LN746">746</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="747"><td class="num" id="LN747">747</td><td class="line"> } <span class='comment'>/* end column loop */</span></td></tr> +<tr class="codeline" data-linenumber="748"><td class="num" id="LN748">748</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="749"><td class="num" id="LN749">749</td><td class="line"> } <span class='keyword'>else</span> { <span class='comment'>/* not showing labels and icons with values, so just pack either only icons or values */</span></td></tr> +<tr class="codeline" data-linenumber="750"><td class="num" id="LN750">750</td><td class="line"> <span class='keyword'>for</span> (i = 0; current_sensor != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> && i < cols; ++i) {</td></tr> +<tr class="codeline" data-linenumber="751"><td class="num" id="LN751">751</td><td class="line"> <span class='keyword'>for</span> (j = 0; current_sensor!= <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> && j < rows; ++j) {</td></tr> +<tr class="codeline" data-linenumber="752"><td class="num" id="LN752">752</td><td class="line"> <span class='keyword'>if</span> (display_mode == DISPLAY_VALUE) {</td></tr> +<tr class="codeline" data-linenumber="753"><td class="num" id="LN753">753</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="754"><td class="num" id="LN754">754</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="755"><td class="num" id="LN755">755</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->value,</td></tr> +<tr class="codeline" data-linenumber="756"><td class="num" id="LN756">756</td><td class="line"> i, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="757"><td class="num" id="LN757">757</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="758"><td class="num" id="LN758">758</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (display_mode == DISPLAY_ICON) {</td></tr> +<tr class="codeline" data-linenumber="759"><td class="num" id="LN759">759</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="760"><td class="num" id="LN760">760</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="761"><td class="num" id="LN761">761</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->icon,</td></tr> +<tr class="codeline" data-linenumber="762"><td class="num" id="LN762">762</td><td class="line"> i, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="763"><td class="num" id="LN763">763</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="764"><td class="num" id="LN764">764</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (display_mode == DISPLAY_GRAPH) {</td></tr> +<tr class="codeline" data-linenumber="765"><td class="num" id="LN765">765</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->graph) {</td></tr> +<tr class="codeline" data-linenumber="766"><td class="num" id="LN766">766</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="767"><td class="num" id="LN767">767</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->graph_frame,</td></tr> +<tr class="codeline" data-linenumber="768"><td class="num" id="LN768">768</td><td class="line"> i, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="769"><td class="num" id="LN769">769</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="770"><td class="num" id="LN770">770</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="771"><td class="num" id="LN771">771</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="772"><td class="num" id="LN772">772</td><td class="line"> current_sensor = <span class='macro'>g_list_next(current_sensor)<span class='macro_popup'>((current_sensor) ? (((GList *)(current_sensor))->next) : (<br>(void*)0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="773"><td class="num" id="LN773">773</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="774"><td class="num" id="LN774">774</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="775"><td class="num" id="LN775">775</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="776"><td class="num" id="LN776">776</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="777"><td class="num" id="LN777">777</td><td class="line"> <span class='keyword'>if</span> (old_grid_children != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="778"><td class="num" id="LN778">778</td><td class="line"> gtk_container_foreach(<span class='macro'>GTK_CONTAINER(sensors_applet->grid)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="779"><td class="num" id="LN779">779</td><td class="line"> sensors_applet_pack_display_cleanup_refs_cb,</td></tr> +<tr class="codeline" data-linenumber="780"><td class="num" id="LN780">780</td><td class="line"> old_grid_children);</td></tr> +<tr class="codeline" data-linenumber="781"><td class="num" id="LN781">781</td><td class="line"> g_list_free(old_grid_children);</td></tr> +<tr class="codeline" data-linenumber="782"><td class="num" id="LN782">782</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="783"><td class="num" id="LN783">783</td><td class="line"> gtk_widget_show_all(<span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="784"><td class="num" id="LN784">784</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="785"><td class="num" id="LN785">785</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="786"><td class="num" id="LN786">786</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="787"><td class="num" id="LN787">787</td><td class="line"><span class='comment'>/* must unref when done with returned pixbuf */</span></td></tr> +<tr class="codeline" data-linenumber="788"><td class="num" id="LN788">788</td><td class="line">GdkPixbuf *sensors_applet_load_icon(IconType icon_type) {</td></tr> +<tr class="codeline" data-linenumber="789"><td class="num" id="LN789">789</td><td class="line"> GtkIconTheme *icon_theme;</td></tr> +<tr class="codeline" data-linenumber="790"><td class="num" id="LN790">790</td><td class="line"> GdkPixbuf *icon = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="791"><td class="num" id="LN791">791</td><td class="line"> GError *error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="792"><td class="num" id="LN792">792</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="793"><td class="num" id="LN793">793</td><td class="line"> <span class='comment'>/* try to load the icon */</span></td></tr> +<tr class="codeline" data-linenumber="794"><td class="num" id="LN794">794</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="795"><td class="num" id="LN795">795</td><td class="line"> <span class='comment'>/* not allowed to unref or ref icon_theme once we have it */</span></td></tr> +<tr class="codeline" data-linenumber="796"><td class="num" id="LN796">796</td><td class="line"> icon_theme = gtk_icon_theme_get_default();</td></tr> +<tr class="codeline" data-linenumber="797"><td class="num" id="LN797">797</td><td class="line"> icon = gtk_icon_theme_load_icon(icon_theme,</td></tr> +<tr class="codeline" data-linenumber="798"><td class="num" id="LN798">798</td><td class="line"> stock_icons[icon_type],</td></tr> +<tr class="codeline" data-linenumber="799"><td class="num" id="LN799">799</td><td class="line"> <span class='macro'>DEFAULT_ICON_SIZE<span class='macro_popup'>22</span></span>,</td></tr> +<tr class="codeline" data-linenumber="800"><td class="num" id="LN800">800</td><td class="line"> GTK_ICON_LOOKUP_USE_BUILTIN,</td></tr> +<tr class="codeline" data-linenumber="801"><td class="num" id="LN801">801</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="802"><td class="num" id="LN802">802</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="803"><td class="num" id="LN803">803</td><td class="line"> <span class='keyword'>if</span> (error) {</td></tr> +<tr class="codeline" data-linenumber="804"><td class="num" id="LN804">804</td><td class="line"> g_warning (<span class='string_literal'>"Could not load icon: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="805"><td class="num" id="LN805">805</td><td class="line"> g_error_free(error);</td></tr> +<tr class="codeline" data-linenumber="806"><td class="num" id="LN806">806</td><td class="line"> error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="807"><td class="num" id="LN807">807</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="808"><td class="num" id="LN808">808</td><td class="line"> <span class='comment'>/* try again with default icon */</span></td></tr> +<tr class="codeline" data-linenumber="809"><td class="num" id="LN809">809</td><td class="line"> icon = gtk_icon_theme_load_icon(icon_theme,</td></tr> +<tr class="codeline" data-linenumber="810"><td class="num" id="LN810">810</td><td class="line"> <span class='string_literal'>"image-missing"</span>,</td></tr> +<tr class="codeline" data-linenumber="811"><td class="num" id="LN811">811</td><td class="line"> <span class='macro'>DEFAULT_ICON_SIZE<span class='macro_popup'>22</span></span>,</td></tr> +<tr class="codeline" data-linenumber="812"><td class="num" id="LN812">812</td><td class="line"> GTK_ICON_LOOKUP_USE_BUILTIN,</td></tr> +<tr class="codeline" data-linenumber="813"><td class="num" id="LN813">813</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="814"><td class="num" id="LN814">814</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="815"><td class="num" id="LN815">815</td><td class="line"> <span class='keyword'>if</span> (error) {</td></tr> +<tr class="codeline" data-linenumber="816"><td class="num" id="LN816">816</td><td class="line"> <span class='comment'>/* this will quit sensors-applet but it is a pretty major error so may as well */</span></td></tr> +<tr class="codeline" data-linenumber="817"><td class="num" id="LN817">817</td><td class="line"> g_error(<span class='string_literal'>"Could not load GTK_STOCK_MISSING_IMAGE - major error!!!: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="818"><td class="num" id="LN818">818</td><td class="line"> g_error_free(error);</td></tr> +<tr class="codeline" data-linenumber="819"><td class="num" id="LN819">819</td><td class="line"> error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="820"><td class="num" id="LN820">820</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="821"><td class="num" id="LN821">821</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="822"><td class="num" id="LN822">822</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="823"><td class="num" id="LN823">823</td><td class="line"> <span class='keyword'>return</span> icon;</td></tr> +<tr class="codeline" data-linenumber="824"><td class="num" id="LN824">824</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="825"><td class="num" id="LN825">825</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="826"><td class="num" id="LN826">826</td><td class="line"><span class='comment'>// MUST FREE STRINGS AFTER CALLING THIS FUNCTION!!</span></td></tr> +<tr class="codeline" data-linenumber="827"><td class="num" id="LN827">827</td><td class="line">gboolean sensors_applet_add_sensor(SensorsApplet *sensors_applet,</td></tr> +<tr class="codeline" data-linenumber="828"><td class="num" id="LN828">828</td><td class="line"> <span class='keyword'>const</span> gchar *path,</td></tr> +<tr class="codeline" data-linenumber="829"><td class="num" id="LN829">829</td><td class="line"> <span class='keyword'>const</span> gchar *id,</td></tr> +<tr class="codeline" data-linenumber="830"><td class="num" id="LN830">830</td><td class="line"> <span class='keyword'>const</span> gchar *label,</td></tr> +<tr class="codeline" data-linenumber="831"><td class="num" id="LN831">831</td><td class="line"> <span class='keyword'>const</span> gchar *interface,</td></tr> +<tr class="codeline" data-linenumber="832"><td class="num" id="LN832">832</td><td class="line"> SensorType type,</td></tr> +<tr class="codeline" data-linenumber="833"><td class="num" id="LN833">833</td><td class="line"> gboolean enable,</td></tr> +<tr class="codeline" data-linenumber="834"><td class="num" id="LN834">834</td><td class="line"> gdouble low_value,</td></tr> +<tr class="codeline" data-linenumber="835"><td class="num" id="LN835">835</td><td class="line"> gdouble high_value,</td></tr> +<tr class="codeline" data-linenumber="836"><td class="num" id="LN836">836</td><td class="line"> gboolean alarm_enable,</td></tr> +<tr class="codeline" data-linenumber="837"><td class="num" id="LN837">837</td><td class="line"> <span class='keyword'>const</span> gchar *low_alarm_command,</td></tr> +<tr class="codeline" data-linenumber="838"><td class="num" id="LN838">838</td><td class="line"> <span class='keyword'>const</span> gchar *high_alarm_command,</td></tr> +<tr class="codeline" data-linenumber="839"><td class="num" id="LN839">839</td><td class="line"> gint alarm_timeout,</td></tr> +<tr class="codeline" data-linenumber="840"><td class="num" id="LN840">840</td><td class="line"> gdouble multiplier,</td></tr> +<tr class="codeline" data-linenumber="841"><td class="num" id="LN841">841</td><td class="line"> gdouble offset,</td></tr> +<tr class="codeline" data-linenumber="842"><td class="num" id="LN842">842</td><td class="line"> IconType icon_type,</td></tr> +<tr class="codeline" data-linenumber="843"><td class="num" id="LN843">843</td><td class="line"> <span class='keyword'>const</span> gchar *graph_color) {</td></tr> +<tr class="codeline" data-linenumber="844"><td class="num" id="LN844">844</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="845"><td class="num" id="LN845">845</td><td class="line"> GtkTreeIter interfaces_iter, sensors_iter;</td></tr> +<tr class="codeline" data-linenumber="846"><td class="num" id="LN846">846</td><td class="line"> gboolean not_empty_tree;</td></tr> +<tr class="codeline" data-linenumber="847"><td class="num" id="LN847">847</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="848"><td class="num" id="LN848">848</td><td class="line"> gchar *node_interface;</td></tr> +<tr class="codeline" data-linenumber="849"><td class="num" id="LN849">849</td><td class="line"> gboolean not_end_of_interfaces = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>, interface_exists = <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="850"><td class="num" id="LN850">850</td><td class="line"> gboolean not_end_of_sensors = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="851"><td class="num" id="LN851">851</td><td class="line"> gchar *sensor_id;</td></tr> +<tr class="codeline" data-linenumber="852"><td class="num" id="LN852">852</td><td class="line"> gchar *sensor_path;</td></tr> +<tr class="codeline" data-linenumber="853"><td class="num" id="LN853">853</td><td class="line"> SensorType sensor_type;</td></tr> +<tr class="codeline" data-linenumber="854"><td class="num" id="LN854">854</td><td class="line"> GdkPixbuf *icon;</td></tr> +<tr class="codeline" data-linenumber="855"><td class="num" id="LN855">855</td><td class="line"> GtkTreePath *tree_path;</td></tr> +<tr class="codeline" data-linenumber="856"><td class="num" id="LN856">856</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="857"><td class="num" id="LN857">857</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_62<br>; if (sensors_applet) _g_boolean_var_62 = 1; else _g_boolean_var_62<br> = 0; _g_boolean_var_62; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 857, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="858"><td class="num" id="LN858">858</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="859"><td class="num" id="LN859">859</td><td class="line"> <span class='comment'>/* assume tree is not empty */</span></td></tr> +<tr class="codeline" data-linenumber="860"><td class="num" id="LN860">860</td><td class="line"> not_empty_tree = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="861"><td class="num" id="LN861">861</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="862"><td class="num" id="LN862">862</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == sensors_applet->sensors) {</td></tr> +<tr class="codeline" data-linenumber="863"><td class="num" id="LN863">863</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="864"><td class="num" id="LN864">864</td><td class="line"> sensors_applet->sensors = gtk_tree_store_new(N_COLUMNS,</td></tr> +<tr class="codeline" data-linenumber="865"><td class="num" id="LN865">865</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* path */</span></td></tr> +<tr class="codeline" data-linenumber="866"><td class="num" id="LN866">866</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* id */</span></td></tr> +<tr class="codeline" data-linenumber="867"><td class="num" id="LN867">867</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* label */</span></td></tr> +<tr class="codeline" data-linenumber="868"><td class="num" id="LN868">868</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* interface */</span></td></tr> +<tr class="codeline" data-linenumber="869"><td class="num" id="LN869">869</td><td class="line"> <span class='macro'>G_TYPE_UINT<span class='macro_popup'>((GType) ((7) << (2)))</span></span>, <span class='comment'>/* sensor type */</span></td></tr> +<tr class="codeline" data-linenumber="870"><td class="num" id="LN870">870</td><td class="line"> <span class='macro'>G_TYPE_BOOLEAN<span class='macro_popup'>((GType) ((5) << (2)))</span></span>, <span class='comment'>/* enable */</span></td></tr> +<tr class="codeline" data-linenumber="871"><td class="num" id="LN871">871</td><td class="line"> <span class='macro'>G_TYPE_BOOLEAN<span class='macro_popup'>((GType) ((5) << (2)))</span></span>, <span class='comment'>/* visible */</span></td></tr> +<tr class="codeline" data-linenumber="872"><td class="num" id="LN872">872</td><td class="line"> <span class='macro'>G_TYPE_DOUBLE<span class='macro_popup'>((GType) ((15) << (2)))</span></span>, <span class='comment'>/* low value */</span></td></tr> +<tr class="codeline" data-linenumber="873"><td class="num" id="LN873">873</td><td class="line"> <span class='macro'>G_TYPE_DOUBLE<span class='macro_popup'>((GType) ((15) << (2)))</span></span>, <span class='comment'>/* high type */</span></td></tr> +<tr class="codeline" data-linenumber="874"><td class="num" id="LN874">874</td><td class="line"> <span class='macro'>G_TYPE_BOOLEAN<span class='macro_popup'>((GType) ((5) << (2)))</span></span>, <span class='comment'>/* alarm enable */</span></td></tr> +<tr class="codeline" data-linenumber="875"><td class="num" id="LN875">875</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* low alarm command */</span></td></tr> +<tr class="codeline" data-linenumber="876"><td class="num" id="LN876">876</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* high alarm command */</span></td></tr> +<tr class="codeline" data-linenumber="877"><td class="num" id="LN877">877</td><td class="line"> <span class='macro'>G_TYPE_UINT<span class='macro_popup'>((GType) ((7) << (2)))</span></span>, <span class='comment'>/* alarm timeout */</span></td></tr> +<tr class="codeline" data-linenumber="878"><td class="num" id="LN878">878</td><td class="line"> <span class='macro'>G_TYPE_DOUBLE<span class='macro_popup'>((GType) ((15) << (2)))</span></span>, <span class='comment'>/* multiplier */</span></td></tr> +<tr class="codeline" data-linenumber="879"><td class="num" id="LN879">879</td><td class="line"> <span class='macro'>G_TYPE_DOUBLE<span class='macro_popup'>((GType) ((15) << (2)))</span></span>, <span class='comment'>/* offset */</span></td></tr> +<tr class="codeline" data-linenumber="880"><td class="num" id="LN880">880</td><td class="line"> <span class='macro'>G_TYPE_UINT<span class='macro_popup'>((GType) ((7) << (2)))</span></span>, <span class='comment'>/* icon type */</span></td></tr> +<tr class="codeline" data-linenumber="881"><td class="num" id="LN881">881</td><td class="line"> <span class='macro'>GDK_TYPE_PIXBUF<span class='macro_popup'>(gdk_pixbuf_get_type ())</span></span>, <span class='comment'>/* icon pixbuf */</span></td></tr> +<tr class="codeline" data-linenumber="882"><td class="num" id="LN882">882</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>); <span class='comment'>/* graph color */</span></td></tr> +<tr class="codeline" data-linenumber="883"><td class="num" id="LN883">883</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="884"><td class="num" id="LN884">884</td><td class="line"> g_debug(<span class='string_literal'>"Sensor tree created."</span>);</td></tr> +<tr class="codeline" data-linenumber="885"><td class="num" id="LN885">885</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="886"><td class="num" id="LN886">886</td><td class="line"> <span class='comment'>/* we know tree is actually empty since we just created it */</span></td></tr> +<tr class="codeline" data-linenumber="887"><td class="num" id="LN887">887</td><td class="line"> not_empty_tree = <span class="mrange"><span class='macro'>FALSE<span class='macro_popup'>(0)</span></span></span>;</td></tr> +<tr><td class="num"></td><td class="line"><div id="EndPath" class="msg msgEvent" style="margin-left:9ex">Value stored to 'not_empty_tree' is never read</div></td></tr> +<tr class="codeline" data-linenumber="888"><td class="num" id="LN888">888</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="889"><td class="num" id="LN889">889</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="890"><td class="num" id="LN890">890</td><td class="line"> <span class='comment'>/* search sensor tree for the parent interface to place this sensor under */</span></td></tr> +<tr class="codeline" data-linenumber="891"><td class="num" id="LN891">891</td><td class="line"> <span class='keyword'>for</span> (not_empty_tree = gtk_tree_model_get_iter_first(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &interfaces_iter);</td></tr> +<tr class="codeline" data-linenumber="892"><td class="num" id="LN892">892</td><td class="line"> not_empty_tree && not_end_of_interfaces && !interface_exists;</td></tr> +<tr class="codeline" data-linenumber="893"><td class="num" id="LN893">893</td><td class="line"> not_end_of_interfaces = gtk_tree_model_iter_next(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &interfaces_iter)) {</td></tr> +<tr class="codeline" data-linenumber="894"><td class="num" id="LN894">894</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="895"><td class="num" id="LN895">895</td><td class="line"> gtk_tree_model_get(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &interfaces_iter, INTERFACE_COLUMN, &node_interface, -1);</td></tr> +<tr class="codeline" data-linenumber="896"><td class="num" id="LN896">896</td><td class="line"> <span class='keyword'>if</span> (g_ascii_strcasecmp(interface, node_interface) == 0) {</td></tr> +<tr class="codeline" data-linenumber="897"><td class="num" id="LN897">897</td><td class="line"> <span class='comment'>/* found interface in tree */</span></td></tr> +<tr class="codeline" data-linenumber="898"><td class="num" id="LN898">898</td><td class="line"> interface_exists = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="899"><td class="num" id="LN899">899</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="900"><td class="num" id="LN900">900</td><td class="line"> <span class='comment'>/* now see if this actual sensor already exists within this interface - don't want to add duplicates */</span></td></tr> +<tr class="codeline" data-linenumber="901"><td class="num" id="LN901">901</td><td class="line"> <span class='comment'>/* see if have children */</span></td></tr> +<tr class="codeline" data-linenumber="902"><td class="num" id="LN902">902</td><td class="line"> <span class='keyword'>for</span> (not_end_of_sensors = gtk_tree_model_iter_children(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter, &interfaces_iter);</td></tr> +<tr class="codeline" data-linenumber="903"><td class="num" id="LN903">903</td><td class="line"> not_end_of_sensors;</td></tr> +<tr class="codeline" data-linenumber="904"><td class="num" id="LN904">904</td><td class="line"> not_end_of_sensors = gtk_tree_model_iter_next(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter)) {</td></tr> +<tr class="codeline" data-linenumber="905"><td class="num" id="LN905">905</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="906"><td class="num" id="LN906">906</td><td class="line"> gtk_tree_model_get(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter,</td></tr> +<tr class="codeline" data-linenumber="907"><td class="num" id="LN907">907</td><td class="line"> PATH_COLUMN, &sensor_path,</td></tr> +<tr class="codeline" data-linenumber="908"><td class="num" id="LN908">908</td><td class="line"> ID_COLUMN, &sensor_id,</td></tr> +<tr class="codeline" data-linenumber="909"><td class="num" id="LN909">909</td><td class="line"> SENSOR_TYPE_COLUMN, &sensor_type,</td></tr> +<tr class="codeline" data-linenumber="910"><td class="num" id="LN910">910</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="911"><td class="num" id="LN911">911</td><td class="line"> <span class='keyword'>if</span> (g_ascii_strcasecmp(sensor_id, id) == 0 && g_ascii_strcasecmp(sensor_path, path) == 0 && sensor_type == type) {</td></tr> +<tr class="codeline" data-linenumber="912"><td class="num" id="LN912">912</td><td class="line"> <span class='comment'>/* sensor already exists so dont add a second time */</span></td></tr> +<tr class="codeline" data-linenumber="913"><td class="num" id="LN913">913</td><td class="line"> g_debug(<span class='string_literal'>"sensor with path: %s, id: %s already exists in tree, not adding a second time"</span>, sensor_path, sensor_id);</td></tr> +<tr class="codeline" data-linenumber="914"><td class="num" id="LN914">914</td><td class="line"> g_free(sensor_id);</td></tr> +<tr class="codeline" data-linenumber="915"><td class="num" id="LN915">915</td><td class="line"> g_free(sensor_path);</td></tr> +<tr class="codeline" data-linenumber="916"><td class="num" id="LN916">916</td><td class="line"> g_free(node_interface);</td></tr> +<tr class="codeline" data-linenumber="917"><td class="num" id="LN917">917</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="918"><td class="num" id="LN918">918</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="919"><td class="num" id="LN919">919</td><td class="line"> g_free(sensor_id);</td></tr> +<tr class="codeline" data-linenumber="920"><td class="num" id="LN920">920</td><td class="line"> g_free(sensor_path);</td></tr> +<tr class="codeline" data-linenumber="921"><td class="num" id="LN921">921</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="922"><td class="num" id="LN922">922</td><td class="line"> g_free(node_interface);</td></tr> +<tr class="codeline" data-linenumber="923"><td class="num" id="LN923">923</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="924"><td class="num" id="LN924">924</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="925"><td class="num" id="LN925">925</td><td class="line"> g_free(node_interface);</td></tr> +<tr class="codeline" data-linenumber="926"><td class="num" id="LN926">926</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="927"><td class="num" id="LN927">927</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="928"><td class="num" id="LN928">928</td><td class="line"> <span class='keyword'>if</span> (!interface_exists) {</td></tr> +<tr class="codeline" data-linenumber="929"><td class="num" id="LN929">929</td><td class="line"> <span class='comment'>/* add to required plugins hash table so we ensure this</span></td></tr> +<tr class="codeline" data-linenumber="930"><td class="num" id="LN930">930</td><td class="line"> <span class='comment'>plugin stays loaded to make sure we have a get sensor</span></td></tr> +<tr class="codeline" data-linenumber="931"><td class="num" id="LN931">931</td><td class="line"> <span class='comment'>value function if possible */</span></td></tr> +<tr class="codeline" data-linenumber="932"><td class="num" id="LN932">932</td><td class="line"> g_hash_table_insert(sensors_applet->required_plugins,</td></tr> +<tr class="codeline" data-linenumber="933"><td class="num" id="LN933">933</td><td class="line"> <span class='macro'>g_strdup(interface)<span class='macro_popup'>g_strdup_inline (interface)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="934"><td class="num" id="LN934">934</td><td class="line"> <span class='macro'>GINT_TO_POINTER(TRUE)<span class='macro_popup'>((gpointer) (glong) ((!(0))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="935"><td class="num" id="LN935">935</td><td class="line"> g_debug(<span class='string_literal'>"added interface %s to required plugins"</span>, interface);</td></tr> +<tr class="codeline" data-linenumber="936"><td class="num" id="LN936">936</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="937"><td class="num" id="LN937">937</td><td class="line"> <span class='comment'>/* wasn't able to find interface root node so create it */</span></td></tr> +<tr class="codeline" data-linenumber="938"><td class="num" id="LN938">938</td><td class="line"> gtk_tree_store_append(sensors_applet->sensors,</td></tr> +<tr class="codeline" data-linenumber="939"><td class="num" id="LN939">939</td><td class="line"> &interfaces_iter,</td></tr> +<tr class="codeline" data-linenumber="940"><td class="num" id="LN940">940</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="941"><td class="num" id="LN941">941</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="942"><td class="num" id="LN942">942</td><td class="line"> gtk_tree_store_set(sensors_applet->sensors,</td></tr> +<tr class="codeline" data-linenumber="943"><td class="num" id="LN943">943</td><td class="line"> &interfaces_iter,</td></tr> +<tr class="codeline" data-linenumber="944"><td class="num" id="LN944">944</td><td class="line"> ID_COLUMN, interface,</td></tr> +<tr class="codeline" data-linenumber="945"><td class="num" id="LN945">945</td><td class="line"> INTERFACE_COLUMN, interface,</td></tr> +<tr class="codeline" data-linenumber="946"><td class="num" id="LN946">946</td><td class="line"> VISIBLE_COLUMN, <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="947"><td class="num" id="LN947">947</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="948"><td class="num" id="LN948">948</td><td class="line"> g_debug(<span class='string_literal'>"Added sensor interface %s to tree"</span>, interface);</td></tr> +<tr class="codeline" data-linenumber="949"><td class="num" id="LN949">949</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="950"><td class="num" id="LN950">950</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="951"><td class="num" id="LN951">951</td><td class="line"> <span class='comment'>/* then add sensor as a child under interface node - ie assume</span></td></tr> +<tr class="codeline" data-linenumber="952"><td class="num" id="LN952">952</td><td class="line"> <span class='comment'>* we either found it or created it - the inteface node that is */</span></td></tr> +<tr class="codeline" data-linenumber="953"><td class="num" id="LN953">953</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="954"><td class="num" id="LN954">954</td><td class="line"> <span class='comment'>/* for now just add sensors all in a single list */</span></td></tr> +<tr class="codeline" data-linenumber="955"><td class="num" id="LN955">955</td><td class="line"> gtk_tree_store_append(sensors_applet->sensors, &sensors_iter, &interfaces_iter);</td></tr> +<tr class="codeline" data-linenumber="956"><td class="num" id="LN956">956</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="957"><td class="num" id="LN957">957</td><td class="line"> <span class='comment'>/* if sensor is already in settings, load values from there */</span></td></tr> +<tr class="codeline" data-linenumber="958"><td class="num" id="LN958">958</td><td class="line"> gchar *applet_path = mate_panel_applet_get_preferences_path (sensors_applet->applet);</td></tr> +<tr class="codeline" data-linenumber="959"><td class="num" id="LN959">959</td><td class="line"> gchar *gsuid = sensors_applet_settings_get_unique_id (interface, id, path);</td></tr> +<tr class="codeline" data-linenumber="960"><td class="num" id="LN960">960</td><td class="line"> gchar *settings_path = g_strdup_printf (<span class='string_literal'>"%s%s/"</span>, applet_path, gsuid);</td></tr> +<tr class="codeline" data-linenumber="961"><td class="num" id="LN961">961</td><td class="line"> GSettings *settings = g_settings_new_with_path (<span class='string_literal'>"org.mate.sensors-applet.sensor"</span>, settings_path);</td></tr> +<tr class="codeline" data-linenumber="962"><td class="num" id="LN962">962</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="963"><td class="num" id="LN963">963</td><td class="line"> <span class='comment'>/* add hash to temp sorting list */</span></td></tr> +<tr class="codeline" data-linenumber="964"><td class="num" id="LN964">964</td><td class="line"> g_variant_builder_add (&gvb_sensors_hash_list, <span class='string_literal'>"s"</span>, gsuid);</td></tr> +<tr class="codeline" data-linenumber="965"><td class="num" id="LN965">965</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="966"><td class="num" id="LN966">966</td><td class="line"> g_free (applet_path);</td></tr> +<tr class="codeline" data-linenumber="967"><td class="num" id="LN967">967</td><td class="line"> g_free (gsuid);</td></tr> +<tr class="codeline" data-linenumber="968"><td class="num" id="LN968">968</td><td class="line"> g_free (settings_path);</td></tr> +<tr class="codeline" data-linenumber="969"><td class="num" id="LN969">969</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="970"><td class="num" id="LN970">970</td><td class="line"> gchar *settings_id = g_settings_get_string (settings, <span class='macro'>ID<span class='macro_popup'>"id"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="971"><td class="num" id="LN971">971</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="972"><td class="num" id="LN972">972</td><td class="line"> <span class='keyword'>if</span> (settings_id != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> && settings_id[0] != '\0') {</td></tr> +<tr class="codeline" data-linenumber="973"><td class="num" id="LN973">973</td><td class="line"> enable = g_settings_get_boolean (settings, <span class='macro'>ENABLED<span class='macro_popup'>"enabled"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="974"><td class="num" id="LN974">974</td><td class="line"> icon = sensors_applet_load_icon(g_settings_get_int (settings, <span class='macro'>ICON_TYPE<span class='macro_popup'>"icon-type"</span></span>));</td></tr> +<tr class="codeline" data-linenumber="975"><td class="num" id="LN975">975</td><td class="line"> gtk_tree_store_set(sensors_applet->sensors,</td></tr> +<tr class="codeline" data-linenumber="976"><td class="num" id="LN976">976</td><td class="line"> &sensors_iter,</td></tr> +<tr class="codeline" data-linenumber="977"><td class="num" id="LN977">977</td><td class="line"> PATH_COLUMN, g_settings_get_string (settings, <span class='macro'>PATH<span class='macro_popup'>"path"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="978"><td class="num" id="LN978">978</td><td class="line"> ID_COLUMN, settings_id,</td></tr> +<tr class="codeline" data-linenumber="979"><td class="num" id="LN979">979</td><td class="line"> LABEL_COLUMN, g_settings_get_string (settings, <span class='macro'>LABEL<span class='macro_popup'>"label"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="980"><td class="num" id="LN980">980</td><td class="line"> INTERFACE_COLUMN, g_settings_get_string (settings, <span class='macro'>INTERFACE<span class='macro_popup'>"interface"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="981"><td class="num" id="LN981">981</td><td class="line"> SENSOR_TYPE_COLUMN, g_settings_get_int (settings, <span class='macro'>SENSOR_TYPE<span class='macro_popup'>"sensor-type"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="982"><td class="num" id="LN982">982</td><td class="line"> ENABLE_COLUMN, enable,</td></tr> +<tr class="codeline" data-linenumber="983"><td class="num" id="LN983">983</td><td class="line"> VISIBLE_COLUMN, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="984"><td class="num" id="LN984">984</td><td class="line"> LOW_VALUE_COLUMN, g_settings_get_double (settings, <span class='macro'>LOW_VALUE<span class='macro_popup'>"low-value"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="985"><td class="num" id="LN985">985</td><td class="line"> HIGH_VALUE_COLUMN, g_settings_get_double (settings, <span class='macro'>HIGH_VALUE<span class='macro_popup'>"high-value"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="986"><td class="num" id="LN986">986</td><td class="line"> ALARM_ENABLE_COLUMN, g_settings_get_boolean (settings, <span class='macro'>ALARM_ENABLED<span class='macro_popup'>"alarm-enabled"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="987"><td class="num" id="LN987">987</td><td class="line"> ALARM_TIMEOUT_COLUMN, g_settings_get_int (settings, <span class='macro'>ALARM_TIMEOUT<span class='macro_popup'>"alarm-timeout"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="988"><td class="num" id="LN988">988</td><td class="line"> LOW_ALARM_COMMAND_COLUMN, g_settings_get_string (settings, <span class='macro'>LOW_ALARM_COMMAND<span class='macro_popup'>"low-alarm-command"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="989"><td class="num" id="LN989">989</td><td class="line"> HIGH_ALARM_COMMAND_COLUMN, g_settings_get_string (settings, <span class='macro'>HIGH_ALARM_COMMAND<span class='macro_popup'>"high-alarm-command"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="990"><td class="num" id="LN990">990</td><td class="line"> MULTIPLIER_COLUMN, g_settings_get_double (settings, <span class='macro'>MULTIPLIER<span class='macro_popup'>"multiplier"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="991"><td class="num" id="LN991">991</td><td class="line"> OFFSET_COLUMN, g_settings_get_double (settings, <span class='macro'>OFFSET<span class='macro_popup'>"offset"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="992"><td class="num" id="LN992">992</td><td class="line"> ICON_TYPE_COLUMN, g_settings_get_int (settings, <span class='macro'>ICON_TYPE<span class='macro_popup'>"icon-type"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="993"><td class="num" id="LN993">993</td><td class="line"> ICON_PIXBUF_COLUMN, icon,</td></tr> +<tr class="codeline" data-linenumber="994"><td class="num" id="LN994">994</td><td class="line"> GRAPH_COLOR_COLUMN, g_settings_get_string (settings, <span class='macro'>GRAPH_COLOR<span class='macro_popup'>"graph-color"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="995"><td class="num" id="LN995">995</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="996"><td class="num" id="LN996">996</td><td class="line"> g_free (settings_id);</td></tr> +<tr class="codeline" data-linenumber="997"><td class="num" id="LN997">997</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="998"><td class="num" id="LN998">998</td><td class="line"> icon = sensors_applet_load_icon(icon_type);</td></tr> +<tr class="codeline" data-linenumber="999"><td class="num" id="LN999">999</td><td class="line"> gtk_tree_store_set(sensors_applet->sensors,</td></tr> +<tr class="codeline" data-linenumber="1000"><td class="num" id="LN1000">1000</td><td class="line"> &sensors_iter,</td></tr> +<tr class="codeline" data-linenumber="1001"><td class="num" id="LN1001">1001</td><td class="line"> PATH_COLUMN, path,</td></tr> +<tr class="codeline" data-linenumber="1002"><td class="num" id="LN1002">1002</td><td class="line"> ID_COLUMN, id,</td></tr> +<tr class="codeline" data-linenumber="1003"><td class="num" id="LN1003">1003</td><td class="line"> LABEL_COLUMN, label,</td></tr> +<tr class="codeline" data-linenumber="1004"><td class="num" id="LN1004">1004</td><td class="line"> INTERFACE_COLUMN, interface,</td></tr> +<tr class="codeline" data-linenumber="1005"><td class="num" id="LN1005">1005</td><td class="line"> SENSOR_TYPE_COLUMN, type,</td></tr> +<tr class="codeline" data-linenumber="1006"><td class="num" id="LN1006">1006</td><td class="line"> ENABLE_COLUMN, enable,</td></tr> +<tr class="codeline" data-linenumber="1007"><td class="num" id="LN1007">1007</td><td class="line"> VISIBLE_COLUMN, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="1008"><td class="num" id="LN1008">1008</td><td class="line"> LOW_VALUE_COLUMN, low_value,</td></tr> +<tr class="codeline" data-linenumber="1009"><td class="num" id="LN1009">1009</td><td class="line"> HIGH_VALUE_COLUMN, high_value,</td></tr> +<tr class="codeline" data-linenumber="1010"><td class="num" id="LN1010">1010</td><td class="line"> ALARM_ENABLE_COLUMN, alarm_enable,</td></tr> +<tr class="codeline" data-linenumber="1011"><td class="num" id="LN1011">1011</td><td class="line"> ALARM_TIMEOUT_COLUMN, alarm_timeout,</td></tr> +<tr class="codeline" data-linenumber="1012"><td class="num" id="LN1012">1012</td><td class="line"> LOW_ALARM_COMMAND_COLUMN, low_alarm_command,</td></tr> +<tr class="codeline" data-linenumber="1013"><td class="num" id="LN1013">1013</td><td class="line"> HIGH_ALARM_COMMAND_COLUMN, high_alarm_command,</td></tr> +<tr class="codeline" data-linenumber="1014"><td class="num" id="LN1014">1014</td><td class="line"> MULTIPLIER_COLUMN, multiplier,</td></tr> +<tr class="codeline" data-linenumber="1015"><td class="num" id="LN1015">1015</td><td class="line"> OFFSET_COLUMN, offset,</td></tr> +<tr class="codeline" data-linenumber="1016"><td class="num" id="LN1016">1016</td><td class="line"> ICON_TYPE_COLUMN, icon_type,</td></tr> +<tr class="codeline" data-linenumber="1017"><td class="num" id="LN1017">1017</td><td class="line"> ICON_PIXBUF_COLUMN, icon,</td></tr> +<tr class="codeline" data-linenumber="1018"><td class="num" id="LN1018">1018</td><td class="line"> GRAPH_COLOR_COLUMN, graph_color,</td></tr> +<tr class="codeline" data-linenumber="1019"><td class="num" id="LN1019">1019</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="1020"><td class="num" id="LN1020">1020</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1021"><td class="num" id="LN1021">1021</td><td class="line"> g_object_unref (settings);</td></tr> +<tr class="codeline" data-linenumber="1022"><td class="num" id="LN1022">1022</td><td class="line"> g_debug(<span class='string_literal'>"added sensor %s to tree"</span>, path);</td></tr> +<tr class="codeline" data-linenumber="1023"><td class="num" id="LN1023">1023</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1024"><td class="num" id="LN1024">1024</td><td class="line"> <span class='comment'>/* remove reference to icon as tree now has ref */</span></td></tr> +<tr class="codeline" data-linenumber="1025"><td class="num" id="LN1025">1025</td><td class="line"> g_object_unref(icon);</td></tr> +<tr class="codeline" data-linenumber="1026"><td class="num" id="LN1026">1026</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1027"><td class="num" id="LN1027">1027</td><td class="line"> <span class='comment'>/* create the active sensor */</span></td></tr> +<tr class="codeline" data-linenumber="1028"><td class="num" id="LN1028">1028</td><td class="line"> <span class='keyword'>if</span> (enable) {</td></tr> +<tr class="codeline" data-linenumber="1029"><td class="num" id="LN1029">1029</td><td class="line"> tree_path = gtk_tree_model_get_path(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter);</td></tr> +<tr class="codeline" data-linenumber="1030"><td class="num" id="LN1030">1030</td><td class="line"> sensors_applet_sensor_enabled(sensors_applet, tree_path);</td></tr> +<tr class="codeline" data-linenumber="1031"><td class="num" id="LN1031">1031</td><td class="line"> gtk_tree_path_free(tree_path);</td></tr> +<tr class="codeline" data-linenumber="1032"><td class="num" id="LN1032">1032</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1033"><td class="num" id="LN1033">1033</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1034"><td class="num" id="LN1034">1034</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1035"><td class="num" id="LN1035">1035</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1036"><td class="num" id="LN1036">1036</td><td class="line"><span class='keyword'>static</span> ActiveSensor *sensors_applet_find_active_sensor(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1037"><td class="num" id="LN1037">1037</td><td class="line"> GtkTreePath *sensor_tree_path;</td></tr> +<tr class="codeline" data-linenumber="1038"><td class="num" id="LN1038">1038</td><td class="line"> GList *current_sensor;</td></tr> +<tr class="codeline" data-linenumber="1039"><td class="num" id="LN1039">1039</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1040"><td class="num" id="LN1040">1040</td><td class="line"> <span class='keyword'>for</span> (current_sensor = sensors_applet->active_sensors; current_sensor != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; current_sensor = <span class='macro'>g_list_next(current_sensor)<span class='macro_popup'>((current_sensor) ? (((GList *)(current_sensor))->next) : (<br>(void*)0))</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="1041"><td class="num" id="LN1041">1041</td><td class="line"> sensor_tree_path = gtk_tree_row_reference_get_path(((ActiveSensor *)(current_sensor->data))->sensor_row);</td></tr> +<tr class="codeline" data-linenumber="1042"><td class="num" id="LN1042">1042</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1043"><td class="num" id="LN1043">1043</td><td class="line"> <span class='keyword'>if</span> (gtk_tree_path_compare(path, sensor_tree_path) == 0) {</td></tr> +<tr class="codeline" data-linenumber="1044"><td class="num" id="LN1044">1044</td><td class="line"> gtk_tree_path_free(sensor_tree_path);</td></tr> +<tr class="codeline" data-linenumber="1045"><td class="num" id="LN1045">1045</td><td class="line"> <span class='keyword'>return</span> ((ActiveSensor *)(current_sensor->data));</td></tr> +<tr class="codeline" data-linenumber="1046"><td class="num" id="LN1046">1046</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1047"><td class="num" id="LN1047">1047</td><td class="line"> gtk_tree_path_free(sensor_tree_path);</td></tr> +<tr class="codeline" data-linenumber="1048"><td class="num" id="LN1048">1048</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1049"><td class="num" id="LN1049">1049</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1050"><td class="num" id="LN1050">1050</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1051"><td class="num" id="LN1051">1051</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1052"><td class="num" id="LN1052">1052</td><td class="line"><span class='comment'>/* path should be the full path to a file representing the sensor (eg</span></td></tr> +<tr class="codeline" data-linenumber="1053"><td class="num" id="LN1053">1053</td><td class="line"> <span class='comment'>* /dev/hda or /sys/devices/platform/i2c-0/0-0290/temp1_input) */</span></td></tr> +<tr class="codeline" data-linenumber="1054"><td class="num" id="LN1054">1054</td><td class="line"><span class='keyword'>void</span> sensors_applet_display_layout_changed(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="1055"><td class="num" id="LN1055">1055</td><td class="line"> <span class='comment'>/* update sensors since will need to update icons / graphs etc</span></td></tr> +<tr class="codeline" data-linenumber="1056"><td class="num" id="LN1056">1056</td><td class="line"> <span class='comment'>* if weren't displayed before */</span></td></tr> +<tr class="codeline" data-linenumber="1057"><td class="num" id="LN1057">1057</td><td class="line"> GList *list = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1058"><td class="num" id="LN1058">1058</td><td class="line"> <span class='keyword'>for</span> (list = sensors_applet->active_sensors; list != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; list = list->next) {</td></tr> +<tr class="codeline" data-linenumber="1059"><td class="num" id="LN1059">1059</td><td class="line"> ActiveSensor *as = (ActiveSensor *)list->data;</td></tr> +<tr class="codeline" data-linenumber="1060"><td class="num" id="LN1060">1060</td><td class="line"> as->updated = <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1061"><td class="num" id="LN1061">1061</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1062"><td class="num" id="LN1062">1062</td><td class="line"> sensors_applet_update_active_sensors(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1063"><td class="num" id="LN1063">1063</td><td class="line"> sensors_applet_pack_display(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1064"><td class="num" id="LN1064">1064</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1065"><td class="num" id="LN1065">1065</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1066"><td class="num" id="LN1066">1066</td><td class="line"><span class='keyword'>void</span> sensors_applet_alarm_off(SensorsApplet *sensors_applet,</td></tr> +<tr class="codeline" data-linenumber="1067"><td class="num" id="LN1067">1067</td><td class="line"> GtkTreePath *path,</td></tr> +<tr class="codeline" data-linenumber="1068"><td class="num" id="LN1068">1068</td><td class="line"> NotifType notif_type) {</td></tr> +<tr class="codeline" data-linenumber="1069"><td class="num" id="LN1069">1069</td><td class="line"> ActiveSensor *active_sensor;</td></tr> +<tr class="codeline" data-linenumber="1070"><td class="num" id="LN1070">1070</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1071"><td class="num" id="LN1071">1071</td><td class="line"> <span class='keyword'>if</span> ((active_sensor = sensors_applet_find_active_sensor(sensors_applet, path)) != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="1072"><td class="num" id="LN1072">1072</td><td class="line"> active_sensor_alarm_off(active_sensor, notif_type);</td></tr> +<tr class="codeline" data-linenumber="1073"><td class="num" id="LN1073">1073</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1074"><td class="num" id="LN1074">1074</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1075"><td class="num" id="LN1075">1075</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1076"><td class="num" id="LN1076">1076</td><td class="line"><span class='keyword'>void</span> sensors_applet_all_alarms_off(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1077"><td class="num" id="LN1077">1077</td><td class="line"> sensors_applet_alarm_off(sensors_applet, path, LOW_ALARM);</td></tr> +<tr class="codeline" data-linenumber="1078"><td class="num" id="LN1078">1078</td><td class="line"> sensors_applet_alarm_off(sensors_applet, path, HIGH_ALARM);</td></tr> +<tr class="codeline" data-linenumber="1079"><td class="num" id="LN1079">1079</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1080"><td class="num" id="LN1080">1080</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1081"><td class="num" id="LN1081">1081</td><td class="line"><span class='keyword'>void</span> sensors_applet_sensor_enabled(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1082"><td class="num" id="LN1082">1082</td><td class="line"> ActiveSensor *active_sensor;</td></tr> +<tr class="codeline" data-linenumber="1083"><td class="num" id="LN1083">1083</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1084"><td class="num" id="LN1084">1084</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_63<br>; if (sensors_applet) _g_boolean_var_63 = 1; else _g_boolean_var_63<br> = 0; _g_boolean_var_63; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1084, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1085"><td class="num" id="LN1085">1085</td><td class="line"> <span class='macro'>g_assert(path)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_64<br>; if (path) _g_boolean_var_64 = 1; else _g_boolean_var_64 = 0<br>; _g_boolean_var_64; }), 1)) ; else g_assertion_message_expr (<br>"sensors-applet", "sensors-applet.c", 1085, ((const char*) (__func__<br>)), "path"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1086"><td class="num" id="LN1086">1086</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1087"><td class="num" id="LN1087">1087</td><td class="line"> active_sensor = active_sensor_new(sensors_applet, gtk_tree_row_reference_new(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, path));</td></tr> +<tr class="codeline" data-linenumber="1088"><td class="num" id="LN1088">1088</td><td class="line"> active_sensor_update(active_sensor, sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1089"><td class="num" id="LN1089">1089</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1090"><td class="num" id="LN1090">1090</td><td class="line"> <span class='comment'>/* keep list sorted */</span></td></tr> +<tr class="codeline" data-linenumber="1091"><td class="num" id="LN1091">1091</td><td class="line"> sensors_applet->active_sensors = g_list_insert_sorted(sensors_applet->active_sensors,</td></tr> +<tr class="codeline" data-linenumber="1092"><td class="num" id="LN1092">1092</td><td class="line"> active_sensor,</td></tr> +<tr class="codeline" data-linenumber="1093"><td class="num" id="LN1093">1093</td><td class="line"> (GCompareFunc)active_sensor_compare);</td></tr> +<tr class="codeline" data-linenumber="1094"><td class="num" id="LN1094">1094</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1095"><td class="num" id="LN1095">1095</td><td class="line"> sensors_applet_pack_display(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1096"><td class="num" id="LN1096">1096</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1097"><td class="num" id="LN1097">1097</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1098"><td class="num" id="LN1098">1098</td><td class="line"><span class='keyword'>void</span> sensors_applet_reorder_sensors(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="1099"><td class="num" id="LN1099">1099</td><td class="line"> sensors_applet->active_sensors = g_list_sort(sensors_applet->active_sensors, (GCompareFunc)active_sensor_compare);</td></tr> +<tr class="codeline" data-linenumber="1100"><td class="num" id="LN1100">1100</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1101"><td class="num" id="LN1101">1101</td><td class="line"> sensors_applet_pack_display(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1102"><td class="num" id="LN1102">1102</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1103"><td class="num" id="LN1103">1103</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1104"><td class="num" id="LN1104">1104</td><td class="line"><span class='keyword'>void</span> sensors_applet_sensor_disabled(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1105"><td class="num" id="LN1105">1105</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1106"><td class="num" id="LN1106">1106</td><td class="line"> ActiveSensor *active_sensor;</td></tr> +<tr class="codeline" data-linenumber="1107"><td class="num" id="LN1107">1107</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1108"><td class="num" id="LN1108">1108</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_65<br>; if (sensors_applet) _g_boolean_var_65 = 1; else _g_boolean_var_65<br> = 0; _g_boolean_var_65; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1108, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1109"><td class="num" id="LN1109">1109</td><td class="line"> <span class='macro'>g_assert(path)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_66<br>; if (path) _g_boolean_var_66 = 1; else _g_boolean_var_66 = 0<br>; _g_boolean_var_66; }), 1)) ; else g_assertion_message_expr (<br>"sensors-applet", "sensors-applet.c", 1109, ((const char*) (__func__<br>)), "path"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1110"><td class="num" id="LN1110">1110</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1111"><td class="num" id="LN1111">1111</td><td class="line"> <span class='keyword'>if</span> ((active_sensor = sensors_applet_find_active_sensor(sensors_applet, path)) != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="1112"><td class="num" id="LN1112">1112</td><td class="line"> g_debug(<span class='string_literal'>"Destroying active sensor..."</span>);</td></tr> +<tr class="codeline" data-linenumber="1113"><td class="num" id="LN1113">1113</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1114"><td class="num" id="LN1114">1114</td><td class="line"> g_debug(<span class='string_literal'>"-- removing from list..."</span>);</td></tr> +<tr class="codeline" data-linenumber="1115"><td class="num" id="LN1115">1115</td><td class="line"> sensors_applet->active_sensors = g_list_remove(sensors_applet->active_sensors, active_sensor);</td></tr> +<tr class="codeline" data-linenumber="1116"><td class="num" id="LN1116">1116</td><td class="line"> g_debug(<span class='string_literal'>"-- repacking display...."</span>);</td></tr> +<tr class="codeline" data-linenumber="1117"><td class="num" id="LN1117">1117</td><td class="line"> sensors_applet_pack_display(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1118"><td class="num" id="LN1118">1118</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1119"><td class="num" id="LN1119">1119</td><td class="line"> active_sensor_destroy(active_sensor);</td></tr> +<tr class="codeline" data-linenumber="1120"><td class="num" id="LN1120">1120</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1121"><td class="num" id="LN1121">1121</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1122"><td class="num" id="LN1122">1122</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1123"><td class="num" id="LN1123">1123</td><td class="line"><span class='keyword'>void</span> sensors_applet_update_sensor(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1124"><td class="num" id="LN1124">1124</td><td class="line"> ActiveSensor *active_sensor;</td></tr> +<tr class="codeline" data-linenumber="1125"><td class="num" id="LN1125">1125</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1126"><td class="num" id="LN1126">1126</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_67<br>; if (sensors_applet) _g_boolean_var_67 = 1; else _g_boolean_var_67<br> = 0; _g_boolean_var_67; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1126, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1127"><td class="num" id="LN1127">1127</td><td class="line"> <span class='macro'>g_assert(path)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_68<br>; if (path) _g_boolean_var_68 = 1; else _g_boolean_var_68 = 0<br>; _g_boolean_var_68; }), 1)) ; else g_assertion_message_expr (<br>"sensors-applet", "sensors-applet.c", 1127, ((const char*) (__func__<br>)), "path"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1128"><td class="num" id="LN1128">1128</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1129"><td class="num" id="LN1129">1129</td><td class="line"> <span class='keyword'>if</span> ((active_sensor = sensors_applet_find_active_sensor(sensors_applet, path)) != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="1130"><td class="num" id="LN1130">1130</td><td class="line"> active_sensor_update(active_sensor, sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1131"><td class="num" id="LN1131">1131</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1132"><td class="num" id="LN1132">1132</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1133"><td class="num" id="LN1133">1133</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1134"><td class="num" id="LN1134">1134</td><td class="line"><span class='keyword'>void</span> sensors_applet_icon_changed(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1135"><td class="num" id="LN1135">1135</td><td class="line"> ActiveSensor *active_sensor;</td></tr> +<tr class="codeline" data-linenumber="1136"><td class="num" id="LN1136">1136</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1137"><td class="num" id="LN1137">1137</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_69<br>; if (sensors_applet) _g_boolean_var_69 = 1; else _g_boolean_var_69<br> = 0; _g_boolean_var_69; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1137, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1138"><td class="num" id="LN1138">1138</td><td class="line"> <span class='macro'>g_assert(path)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_70<br>; if (path) _g_boolean_var_70 = 1; else _g_boolean_var_70 = 0<br>; _g_boolean_var_70; }), 1)) ; else g_assertion_message_expr (<br>"sensors-applet", "sensors-applet.c", 1138, ((const char*) (__func__<br>)), "path"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1139"><td class="num" id="LN1139">1139</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1140"><td class="num" id="LN1140">1140</td><td class="line"> <span class='keyword'>if</span> ((active_sensor = sensors_applet_find_active_sensor(sensors_applet, path)) != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="1141"><td class="num" id="LN1141">1141</td><td class="line"> active_sensor_icon_changed(active_sensor, sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1142"><td class="num" id="LN1142">1142</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1143"><td class="num" id="LN1143">1143</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1144"><td class="num" id="LN1144">1144</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1145"><td class="num" id="LN1145">1145</td><td class="line"><span class='comment'>/* Cycle thru ActiveSensors and update them all */</span></td></tr> +<tr class="codeline" data-linenumber="1146"><td class="num" id="LN1146">1146</td><td class="line">gboolean sensors_applet_update_active_sensors(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="1147"><td class="num" id="LN1147">1147</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_71<br>; if (sensors_applet) _g_boolean_var_71 = 1; else _g_boolean_var_71<br> = 0; _g_boolean_var_71; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1147, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1148"><td class="num" id="LN1148">1148</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1149"><td class="num" id="LN1149">1149</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->active_sensors) {</td></tr> +<tr class="codeline" data-linenumber="1150"><td class="num" id="LN1150">1150</td><td class="line"> g_list_foreach(sensors_applet->active_sensors,</td></tr> +<tr class="codeline" data-linenumber="1151"><td class="num" id="LN1151">1151</td><td class="line"> (GFunc)active_sensor_update,</td></tr> +<tr class="codeline" data-linenumber="1152"><td class="num" id="LN1152">1152</td><td class="line"> sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1153"><td class="num" id="LN1153">1153</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1154"><td class="num" id="LN1154">1154</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1155"><td class="num" id="LN1155">1155</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1156"><td class="num" id="LN1156">1156</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1157"><td class="num" id="LN1157">1157</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1158"><td class="num" id="LN1158">1158</td><td class="line"><span class='comment'>/* Cycle thru ActiveSensors and set new graph dimensions */</span></td></tr> +<tr class="codeline" data-linenumber="1159"><td class="num" id="LN1159">1159</td><td class="line"><span class='keyword'>void</span> sensors_applet_graph_size_changed(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="1160"><td class="num" id="LN1160">1160</td><td class="line"> gint dimensions[2];</td></tr> +<tr class="codeline" data-linenumber="1161"><td class="num" id="LN1161">1161</td><td class="line"> gint graph_size;</td></tr> +<tr class="codeline" data-linenumber="1162"><td class="num" id="LN1162">1162</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_72<br>; if (sensors_applet) _g_boolean_var_72 = 1; else _g_boolean_var_72<br> = 0; _g_boolean_var_72; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1162, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1163"><td class="num" id="LN1163">1163</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1164"><td class="num" id="LN1164">1164</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->active_sensors) {</td></tr> +<tr class="codeline" data-linenumber="1165"><td class="num" id="LN1165">1165</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1166"><td class="num" id="LN1166">1166</td><td class="line"> graph_size = g_settings_get_int (sensors_applet->settings, <span class='macro'>GRAPH_SIZE<span class='macro_popup'>"graph-size"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1167"><td class="num" id="LN1167">1167</td><td class="line"> <span class='keyword'>if</span> (mate_panel_applet_get_orient(sensors_applet->applet) == MATE_PANEL_APPLET_ORIENT_UP ||</td></tr> +<tr class="codeline" data-linenumber="1168"><td class="num" id="LN1168">1168</td><td class="line"> mate_panel_applet_get_orient(sensors_applet->applet) == MATE_PANEL_APPLET_ORIENT_DOWN) {</td></tr> +<tr class="codeline" data-linenumber="1169"><td class="num" id="LN1169">1169</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1170"><td class="num" id="LN1170">1170</td><td class="line"> <span class='comment'>/* is horizontal so set graph_size as width */</span></td></tr> +<tr class="codeline" data-linenumber="1171"><td class="num" id="LN1171">1171</td><td class="line"> dimensions[0] = graph_size;</td></tr> +<tr class="codeline" data-linenumber="1172"><td class="num" id="LN1172">1172</td><td class="line"> dimensions[1] = sensors_applet->size;</td></tr> +<tr class="codeline" data-linenumber="1173"><td class="num" id="LN1173">1173</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="1174"><td class="num" id="LN1174">1174</td><td class="line"> dimensions[0] = sensors_applet->size;</td></tr> +<tr class="codeline" data-linenumber="1175"><td class="num" id="LN1175">1175</td><td class="line"> dimensions[1] = graph_size;</td></tr> +<tr class="codeline" data-linenumber="1176"><td class="num" id="LN1176">1176</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1177"><td class="num" id="LN1177">1177</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1178"><td class="num" id="LN1178">1178</td><td class="line"> g_list_foreach(sensors_applet->active_sensors,</td></tr> +<tr class="codeline" data-linenumber="1179"><td class="num" id="LN1179">1179</td><td class="line"> (GFunc)active_sensor_update_graph_dimensions,</td></tr> +<tr class="codeline" data-linenumber="1180"><td class="num" id="LN1180">1180</td><td class="line"> &dimensions);</td></tr> +<tr class="codeline" data-linenumber="1181"><td class="num" id="LN1181">1181</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1182"><td class="num" id="LN1182">1182</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1183"><td class="num" id="LN1183">1183</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1184"><td class="num" id="LN1184">1184</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1185"><td class="num" id="LN1185">1185</td><td class="line">gdouble sensors_applet_convert_temperature(gdouble value, TemperatureScale old, TemperatureScale new) {</td></tr> +<tr class="codeline" data-linenumber="1186"><td class="num" id="LN1186">1186</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1187"><td class="num" id="LN1187">1187</td><td class="line"> <span class='keyword'>switch</span> (old) {</td></tr> +<tr class="codeline" data-linenumber="1188"><td class="num" id="LN1188">1188</td><td class="line"> <span class='keyword'>case</span> KELVIN:</td></tr> +<tr class="codeline" data-linenumber="1189"><td class="num" id="LN1189">1189</td><td class="line"> <span class='keyword'>switch</span> (new) {</td></tr> +<tr class="codeline" data-linenumber="1190"><td class="num" id="LN1190">1190</td><td class="line"> <span class='keyword'>case</span> CELSIUS:</td></tr> +<tr class="codeline" data-linenumber="1191"><td class="num" id="LN1191">1191</td><td class="line"> value = value - 273.0;</td></tr> +<tr class="codeline" data-linenumber="1192"><td class="num" id="LN1192">1192</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1193"><td class="num" id="LN1193">1193</td><td class="line"> <span class='keyword'>case</span> FAHRENHEIT:</td></tr> +<tr class="codeline" data-linenumber="1194"><td class="num" id="LN1194">1194</td><td class="line"> value = (9.0 * (value - 273) / 5.0) + 32.0;</td></tr> +<tr class="codeline" data-linenumber="1195"><td class="num" id="LN1195">1195</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1196"><td class="num" id="LN1196">1196</td><td class="line"> <span class='keyword'>case</span> KELVIN:</td></tr> +<tr class="codeline" data-linenumber="1197"><td class="num" id="LN1197">1197</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1198"><td class="num" id="LN1198">1198</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1199"><td class="num" id="LN1199">1199</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1200"><td class="num" id="LN1200">1200</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1201"><td class="num" id="LN1201">1201</td><td class="line"> <span class='keyword'>case</span> CELSIUS:</td></tr> +<tr class="codeline" data-linenumber="1202"><td class="num" id="LN1202">1202</td><td class="line"> <span class='keyword'>switch</span> (new) {</td></tr> +<tr class="codeline" data-linenumber="1203"><td class="num" id="LN1203">1203</td><td class="line"> <span class='keyword'>case</span> FAHRENHEIT:</td></tr> +<tr class="codeline" data-linenumber="1204"><td class="num" id="LN1204">1204</td><td class="line"> value = (9.0 * value / 5.0) + 32.0;</td></tr> +<tr class="codeline" data-linenumber="1205"><td class="num" id="LN1205">1205</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1206"><td class="num" id="LN1206">1206</td><td class="line"> <span class='keyword'>case</span> KELVIN:</td></tr> +<tr class="codeline" data-linenumber="1207"><td class="num" id="LN1207">1207</td><td class="line"> value = value + 273.0;</td></tr> +<tr class="codeline" data-linenumber="1208"><td class="num" id="LN1208">1208</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1209"><td class="num" id="LN1209">1209</td><td class="line"> <span class='keyword'>case</span> CELSIUS:</td></tr> +<tr class="codeline" data-linenumber="1210"><td class="num" id="LN1210">1210</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1211"><td class="num" id="LN1211">1211</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1212"><td class="num" id="LN1212">1212</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1213"><td class="num" id="LN1213">1213</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1214"><td class="num" id="LN1214">1214</td><td class="line"> <span class='keyword'>case</span> FAHRENHEIT:</td></tr> +<tr class="codeline" data-linenumber="1215"><td class="num" id="LN1215">1215</td><td class="line"> <span class='keyword'>switch</span> (new) {</td></tr> +<tr class="codeline" data-linenumber="1216"><td class="num" id="LN1216">1216</td><td class="line"> <span class='keyword'>case</span> CELSIUS:</td></tr> +<tr class="codeline" data-linenumber="1217"><td class="num" id="LN1217">1217</td><td class="line"> value = (5.0 * (value - 32.0) / 9.0);</td></tr> +<tr class="codeline" data-linenumber="1218"><td class="num" id="LN1218">1218</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1219"><td class="num" id="LN1219">1219</td><td class="line"> <span class='keyword'>case</span> KELVIN:</td></tr> +<tr class="codeline" data-linenumber="1220"><td class="num" id="LN1220">1220</td><td class="line"> value = (5.0 * (value - 32.0) / 9.0) + 273.0;</td></tr> +<tr class="codeline" data-linenumber="1221"><td class="num" id="LN1221">1221</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1222"><td class="num" id="LN1222">1222</td><td class="line"> <span class='keyword'>case</span> FAHRENHEIT:</td></tr> +<tr class="codeline" data-linenumber="1223"><td class="num" id="LN1223">1223</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1224"><td class="num" id="LN1224">1224</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1225"><td class="num" id="LN1225">1225</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1226"><td class="num" id="LN1226">1226</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1227"><td class="num" id="LN1227">1227</td><td class="line"> <span class='keyword'>return</span> value;</td></tr> +<tr class="codeline" data-linenumber="1228"><td class="num" id="LN1228">1228</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1229"><td class="num" id="LN1229">1229</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1230"><td class="num" id="LN1230">1230</td><td class="line"><span class='keyword'>void</span> sensors_applet_init(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="1231"><td class="num" id="LN1231">1231</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1232"><td class="num" id="LN1232">1232</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_73<br>; if (sensors_applet) _g_boolean_var_73 = 1; else _g_boolean_var_73<br> = 0; _g_boolean_var_73; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1232, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1233"><td class="num" id="LN1233">1233</td><td class="line"> <span class='macro'>g_assert(sensors_applet->applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_74<br>; if (sensors_applet->applet) _g_boolean_var_74 = 1; else _g_boolean_var_74<br> = 0; _g_boolean_var_74; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1233, ((const char*) (<br>__func__)), "sensors_applet->applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1234"><td class="num" id="LN1234">1234</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1235"><td class="num" id="LN1235">1235</td><td class="line"> GtkActionGroup *action_group;</td></tr> +<tr class="codeline" data-linenumber="1236"><td class="num" id="LN1236">1236</td><td class="line"> gchar *ui_path;</td></tr> +<tr class="codeline" data-linenumber="1237"><td class="num" id="LN1237">1237</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1238"><td class="num" id="LN1238">1238</td><td class="line"> <span class='comment'>/* Have our background automatically painted. */</span></td></tr> +<tr class="codeline" data-linenumber="1239"><td class="num" id="LN1239">1239</td><td class="line"> mate_panel_applet_set_background_widget(MATE_PANEL_APPLET(sensors_applet->applet), <span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1240"><td class="num" id="LN1240">1240</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1241"><td class="num" id="LN1241">1241</td><td class="line"> <span class='comment'>/* plugin functions are stored as name -> get_value_function pairs so</span></td></tr> +<tr class="codeline" data-linenumber="1242"><td class="num" id="LN1242">1242</td><td class="line"> <span class='comment'>* use standard string functions on hash table */</span></td></tr> +<tr class="codeline" data-linenumber="1243"><td class="num" id="LN1243">1243</td><td class="line"> sensors_applet->plugins = g_hash_table_new(g_str_hash, g_str_equal);</td></tr> +<tr class="codeline" data-linenumber="1244"><td class="num" id="LN1244">1244</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1245"><td class="num" id="LN1245">1245</td><td class="line"> sensors_applet->required_plugins = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1246"><td class="num" id="LN1246">1246</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1247"><td class="num" id="LN1247">1247</td><td class="line"> <span class='comment'>/* initialise size */</span></td></tr> +<tr class="codeline" data-linenumber="1248"><td class="num" id="LN1248">1248</td><td class="line"> sensors_applet->size = <span class='macro'>DEFAULT_APPLET_SIZE<span class='macro_popup'>24</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1249"><td class="num" id="LN1249">1249</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1250"><td class="num" id="LN1250">1250</td><td class="line"> mate_panel_applet_set_flags(sensors_applet->applet, MATE_PANEL_APPLET_EXPAND_MINOR);</td></tr> +<tr class="codeline" data-linenumber="1251"><td class="num" id="LN1251">1251</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1252"><td class="num" id="LN1252">1252</td><td class="line"> <span class='macro'>g_signal_connect(sensors_applet->applet, <span class='string_literal'>"destroy"</span>,<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("destroy"<br>), (((GCallback) (destroy_cb))), (sensors_applet), ((void*)0)<br>, (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1253"><td class="num" id="LN1253">1253</td><td class="line"> <span class='macro'>G_CALLBACK(destroy_cb),<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("destroy"<br>), (((GCallback) (destroy_cb))), (sensors_applet), ((void*)0)<br>, (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1254"><td class="num" id="LN1254">1254</td><td class="line"> <span class='macro'>sensors_applet)<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("destroy"<br>), (((GCallback) (destroy_cb))), (sensors_applet), ((void*)0)<br>, (GConnectFlags) 0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1255"><td class="num" id="LN1255">1255</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1256"><td class="num" id="LN1256">1256</td><td class="line"> <span class='comment'>/* init gsettings */</span></td></tr> +<tr class="codeline" data-linenumber="1257"><td class="num" id="LN1257">1257</td><td class="line"> sensors_applet->settings = mate_panel_applet_settings_new (sensors_applet->applet, <span class='string_literal'>"org.mate.sensors-applet"</span>);</td></tr> +<tr class="codeline" data-linenumber="1258"><td class="num" id="LN1258">1258</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1259"><td class="num" id="LN1259">1259</td><td class="line"> <span class='comment'>/* set up builder for sorting verification */</span></td></tr> +<tr class="codeline" data-linenumber="1260"><td class="num" id="LN1260">1260</td><td class="line"> g_variant_builder_init (&gvb_sensors_hash_list, <span class='macro'>G_VARIANT_TYPE (<span class='string_literal'>"as"</span>)<span class='macro_popup'>(g_variant_type_checked_ (("as")))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1261"><td class="num" id="LN1261">1261</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1262"><td class="num" id="LN1262">1262</td><td class="line"> <span class='comment'>/* set up / load sensors from the plugins */</span></td></tr> +<tr class="codeline" data-linenumber="1263"><td class="num" id="LN1263">1263</td><td class="line"> sensors_applet_plugins_load_all(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1264"><td class="num" id="LN1264">1264</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1265"><td class="num" id="LN1265">1265</td><td class="line"> <span class='comment'>/* set sorting hash array */</span></td></tr> +<tr class="codeline" data-linenumber="1266"><td class="num" id="LN1266">1266</td><td class="line"> GVariant *gv_temp = g_variant_builder_end (&gvb_sensors_hash_list);</td></tr> +<tr class="codeline" data-linenumber="1267"><td class="num" id="LN1267">1267</td><td class="line"> sensors_applet->sensors_hash_array = g_variant_dup_strv (gv_temp, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1268"><td class="num" id="LN1268">1268</td><td class="line"> g_variant_unref (gv_temp);</td></tr> +<tr class="codeline" data-linenumber="1269"><td class="num" id="LN1269">1269</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1270"><td class="num" id="LN1270">1270</td><td class="line"> <span class='comment'>/* sort sensors based on saved sorting */</span></td></tr> +<tr class="codeline" data-linenumber="1271"><td class="num" id="LN1271">1271</td><td class="line"> sensors_applet_settings_sort_sensors(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1272"><td class="num" id="LN1272">1272</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1273"><td class="num" id="LN1273">1273</td><td class="line"> <span class='comment'>/* free hash array */</span></td></tr> +<tr class="codeline" data-linenumber="1274"><td class="num" id="LN1274">1274</td><td class="line"> g_strfreev (sensors_applet->sensors_hash_array);</td></tr> +<tr class="codeline" data-linenumber="1275"><td class="num" id="LN1275">1275</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1276"><td class="num" id="LN1276">1276</td><td class="line"> <span class='comment'>/* should have created sensors tree above, but if have not was because we couldn't find any sensors */</span></td></tr> +<tr class="codeline" data-linenumber="1277"><td class="num" id="LN1277">1277</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == sensors_applet->sensors) {</td></tr> +<tr class="codeline" data-linenumber="1278"><td class="num" id="LN1278">1278</td><td class="line"> GtkWidget *label;</td></tr> +<tr class="codeline" data-linenumber="1279"><td class="num" id="LN1279">1279</td><td class="line"> label = gtk_label_new(<span class='macro'>_(<span class='string_literal'>"No sensors found!"</span>)<span class='macro_popup'>dcgettext (((void*)0), "No sensors found!", 5)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1280"><td class="num" id="LN1280">1280</td><td class="line"> gtk_container_add(<span class='macro'>GTK_CONTAINER(sensors_applet->applet)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->applet)))))</span></span>, label);</td></tr> +<tr class="codeline" data-linenumber="1281"><td class="num" id="LN1281">1281</td><td class="line"> gtk_widget_show_all(<span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1282"><td class="num" id="LN1282">1282</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="1283"><td class="num" id="LN1283">1283</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1284"><td class="num" id="LN1284">1284</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1285"><td class="num" id="LN1285">1285</td><td class="line"> <span class='comment'>/* only do menu and signal connections if sensors are found */</span></td></tr> +<tr class="codeline" data-linenumber="1286"><td class="num" id="LN1286">1286</td><td class="line"> action_group = gtk_action_group_new (<span class='string_literal'>"Sensors Applet Actions"</span>);</td></tr> +<tr class="codeline" data-linenumber="1287"><td class="num" id="LN1287">1287</td><td class="line"> gtk_action_group_set_translation_domain (action_group, <span class='macro'>GETTEXT_PACKAGE<span class='macro_popup'>"mate-sensors-applet"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1288"><td class="num" id="LN1288">1288</td><td class="line"> gtk_action_group_add_actions (action_group,</td></tr> +<tr class="codeline" data-linenumber="1289"><td class="num" id="LN1289">1289</td><td class="line"> sensors_applet_menu_actions,</td></tr> +<tr class="codeline" data-linenumber="1290"><td class="num" id="LN1290">1290</td><td class="line"> <span class='macro'>G_N_ELEMENTS (sensors_applet_menu_actions)<span class='macro_popup'>(sizeof (sensors_applet_menu_actions) / sizeof ((sensors_applet_menu_actions<br>)[0]))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="1291"><td class="num" id="LN1291">1291</td><td class="line"> sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1292"><td class="num" id="LN1292">1292</td><td class="line"> ui_path = g_build_filename (<span class='macro'>UIDIR<span class='macro_popup'>"/usr/local/share/mate-sensors-applet/ui"</span></span>, <span class='macro'>SENSORS_APPLET_MENU_FILE<span class='macro_popup'>"SensorsApplet.xml"</span></span>, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1293"><td class="num" id="LN1293">1293</td><td class="line"> mate_panel_applet_setup_menu_from_file (sensors_applet->applet, ui_path, action_group);</td></tr> +<tr class="codeline" data-linenumber="1294"><td class="num" id="LN1294">1294</td><td class="line"> g_free (ui_path);</td></tr> +<tr class="codeline" data-linenumber="1295"><td class="num" id="LN1295">1295</td><td class="line"> g_object_unref (action_group);</td></tr> +<tr class="codeline" data-linenumber="1296"><td class="num" id="LN1296">1296</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1297"><td class="num" id="LN1297">1297</td><td class="line"> <span class='macro'>g_signal_connect(sensors_applet->applet, <span class='string_literal'>"style-set"</span>,<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("style-set"<br>), (((GCallback) (style_set_cb))), (sensors_applet), ((void*)<br>0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1298"><td class="num" id="LN1298">1298</td><td class="line"> <span class='macro'>G_CALLBACK(style_set_cb),<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("style-set"<br>), (((GCallback) (style_set_cb))), (sensors_applet), ((void*)<br>0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1299"><td class="num" id="LN1299">1299</td><td class="line"> <span class='macro'>sensors_applet)<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("style-set"<br>), (((GCallback) (style_set_cb))), (sensors_applet), ((void*)<br>0), (GConnectFlags) 0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1300"><td class="num" id="LN1300">1300</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1301"><td class="num" id="LN1301">1301</td><td class="line"> <span class='macro'>g_signal_connect(G_OBJECT(sensors_applet->applet), <span class='string_literal'>"change_orient"</span>,<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("change_orient"), (((GCallback) (change_orient_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1302"><td class="num" id="LN1302">1302</td><td class="line"> <span class='macro'>G_CALLBACK(change_orient_cb),<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("change_orient"), (((GCallback) (change_orient_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1303"><td class="num" id="LN1303">1303</td><td class="line"> <span class='macro'>sensors_applet)<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("change_orient"), (((GCallback) (change_orient_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1304"><td class="num" id="LN1304">1304</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1305"><td class="num" id="LN1305">1305</td><td class="line"> <span class='macro'>g_signal_connect(G_OBJECT(sensors_applet->applet), <span class='string_literal'>"size_allocate"</span>,<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("size_allocate"), (((GCallback) (size_allocate_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1306"><td class="num" id="LN1306">1306</td><td class="line"> <span class='macro'>G_CALLBACK(size_allocate_cb),<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("size_allocate"), (((GCallback) (size_allocate_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1307"><td class="num" id="LN1307">1307</td><td class="line"> <span class='macro'>sensors_applet)<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("size_allocate"), (((GCallback) (size_allocate_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1308"><td class="num" id="LN1308">1308</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1309"><td class="num" id="LN1309">1309</td><td class="line"> <span class='macro'>g_signal_connect(G_OBJECT(sensors_applet->applet), <span class='string_literal'>"leave_notify_event"</span>,<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("leave_notify_event"), (((GCallback) (mouse_leave_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span></td></tr> +<tr class="codeline" data-linenumber="1310"><td class="num" id="LN1310">1310</td><td class="line"> <span class='macro'>G_CALLBACK(mouse_leave_cb),<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("leave_notify_event"), (((GCallback) (mouse_leave_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span></td></tr> +<tr class="codeline" data-linenumber="1311"><td class="num" id="LN1311">1311</td><td class="line"> <span class='macro'>(gpointer)sensors_applet)<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("leave_notify_event"), (((GCallback) (mouse_leave_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1312"><td class="num" id="LN1312">1312</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1313"><td class="num" id="LN1313">1313</td><td class="line"> <span class='macro'>g_signal_connect(G_OBJECT(sensors_applet->applet), <span class='string_literal'>"enter_notify_event"</span>,<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("enter_notify_event"), (((GCallback) (mouse_enter_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span></td></tr> +<tr class="codeline" data-linenumber="1314"><td class="num" id="LN1314">1314</td><td class="line"> <span class='macro'>G_CALLBACK(mouse_enter_cb),<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("enter_notify_event"), (((GCallback) (mouse_enter_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span></td></tr> +<tr class="codeline" data-linenumber="1315"><td class="num" id="LN1315">1315</td><td class="line"> <span class='macro'>(gpointer)sensors_applet)<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("enter_notify_event"), (((GCallback) (mouse_enter_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1316"><td class="num" id="LN1316">1316</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1317"><td class="num" id="LN1317">1317</td><td class="line"> sensors_applet_update_active_sensors(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1318"><td class="num" id="LN1318">1318</td><td class="line"> sensors_applet_pack_display(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1319"><td class="num" id="LN1319">1319</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1320"><td class="num" id="LN1320">1320</td><td class="line"> sensors_applet->timeout_id = g_timeout_add_seconds(g_settings_get_int(sensors_applet->settings, <span class='macro'>TIMEOUT<span class='macro_popup'>"timeout-delay"</span></span>) / 1000,</td></tr> +<tr class="codeline" data-linenumber="1321"><td class="num" id="LN1321">1321</td><td class="line"> (GSourceFunc)sensors_applet_update_active_sensors,</td></tr> +<tr class="codeline" data-linenumber="1322"><td class="num" id="LN1322">1322</td><td class="line"> sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1323"><td class="num" id="LN1323">1323</td><td class="line"> gtk_widget_show_all(<span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1324"><td class="num" id="LN1324">1324</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1325"><td class="num" id="LN1325">1325</td><td class="line"> </td></tr> +</table></body></html> diff --git a/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-782a54.html b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-782a54.html new file mode 100644 index 0000000..9da2fdb --- /dev/null +++ b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-782a54.html @@ -0,0 +1,1133 @@ +<!doctype html> +<html> +<head> +<title>udisks2-plugin.c</title> + +<style type="text/css"> +body { color:#000000; background-color:#ffffff } +body { font-family:Helvetica, sans-serif; font-size:10pt } +h1 { font-size:14pt } +.FileName { margin-top: 5px; margin-bottom: 5px; display: inline; } +.FileNav { margin-left: 5px; margin-right: 5px; display: inline; } +.FileNav a { text-decoration:none; font-size: larger; } +.divider { margin-top: 30px; margin-bottom: 30px; height: 15px; } +.divider { background-color: gray; } +.code { border-collapse:collapse; width:100%; } +.code { font-family: "Monospace", monospace; font-size:10pt } +.code { line-height: 1.2em } +.comment { color: green; font-style: oblique } +.keyword { color: blue } +.string_literal { color: red } +.directive { color: darkmagenta } + +/* Macros and variables could have pop-up notes hidden by default. + - Macro pop-up: expansion of the macro + - Variable pop-up: value (table) of the variable */ +.macro_popup, .variable_popup { display: none; } + +/* Pop-up appears on mouse-hover event. */ +.macro:hover .macro_popup, .variable:hover .variable_popup { + display: block; + padding: 2px; + -webkit-border-radius:5px; + -webkit-box-shadow:1px 1px 7px #000; + border-radius:5px; + box-shadow:1px 1px 7px #000; + position: absolute; + top: -1em; + left:10em; + z-index: 1 +} + +.macro_popup { + border: 2px solid red; + background-color:#FFF0F0; + font-weight: normal; +} + +.variable_popup { + border: 2px solid blue; + background-color:#F0F0FF; + font-weight: bold; + font-family: Helvetica, sans-serif; + font-size: 9pt; +} + +/* Pop-up notes needs a relative position as a base where they pops up. */ +.macro, .variable { + background-color: PaleGoldenRod; + position: relative; +} +.macro { color: DarkMagenta; } + +#tooltiphint { + position: fixed; + width: 50em; + margin-left: -25em; + left: 50%; + padding: 10px; + border: 1px solid #b0b0b0; + border-radius: 2px; + box-shadow: 1px 1px 7px black; + background-color: #c0c0c0; + z-index: 2; +} + +.num { width:2.5em; padding-right:2ex; background-color:#eeeeee } +.num { text-align:right; font-size:8pt } +.num { color:#444444 } +.line { padding-left: 1ex; border-left: 3px solid #ccc } +.line { white-space: pre } +.msg { -webkit-box-shadow:1px 1px 7px #000 } +.msg { box-shadow:1px 1px 7px #000 } +.msg { -webkit-border-radius:5px } +.msg { border-radius:5px } +.msg { font-family:Helvetica, sans-serif; font-size:8pt } +.msg { float:left } +.msg { position:relative } +.msg { padding:0.25em 1ex 0.25em 1ex } +.msg { margin-top:10px; margin-bottom:10px } +.msg { font-weight:bold } +.msg { max-width:60em; word-wrap: break-word; white-space: pre-wrap } +.msgT { padding:0x; spacing:0x } +.msgEvent { background-color:#fff8b4; color:#000000 } +.msgControl { background-color:#bbbbbb; color:#000000 } +.msgNote { background-color:#ddeeff; color:#000000 } +.mrange { background-color:#dfddf3 } +.mrange { border-bottom:1px solid #6F9DBE } +.PathIndex { font-weight: bold; padding:0px 5px; margin-right:5px; } +.PathIndex { -webkit-border-radius:8px } +.PathIndex { border-radius:8px } +.PathIndexEvent { background-color:#bfba87 } +.PathIndexControl { background-color:#8c8c8c } +.PathIndexPopUp { background-color: #879abc; } +.PathNav a { text-decoration:none; font-size: larger } +.CodeInsertionHint { font-weight: bold; background-color: #10dd10 } +.CodeRemovalHint { background-color:#de1010 } +.CodeRemovalHint { border-bottom:1px solid #6F9DBE } +.msg.selected{ background-color:orange !important; } + +table.simpletable { + padding: 5px; + font-size:12pt; + margin:20px; + border-collapse: collapse; border-spacing: 0px; +} +td.rowname { + text-align: right; + vertical-align: top; + font-weight: bold; + color:#444444; + padding-right:2ex; +} + +/* Hidden text. */ +input.spoilerhider + label { + cursor: pointer; + text-decoration: underline; + display: block; +} +input.spoilerhider { + display: none; +} +input.spoilerhider ~ .spoiler { + overflow: hidden; + margin: 10px auto 0; + height: 0; + opacity: 0; +} +input.spoilerhider:checked + label + .spoiler{ + height: auto; + opacity: 1; +} +</style> +</head> +<body> +<!-- BUGDESC Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption --> + +<!-- BUGTYPE Cast from non-struct type to struct type --> + +<!-- BUGCATEGORY Logic error --> + +<!-- BUGFILE /rootdir/plugins/udisks2/udisks2-plugin.c --> + +<!-- FILENAME udisks2-plugin.c --> + +<!-- FUNCTIONNAME udisks2_plugin_get_sensors --> + +<!-- ISSUEHASHCONTENTOFLINEINCONTEXT 782a545aa7e94cf596f7d585b41f191d --> + +<!-- BUGLINE 319 --> + +<!-- BUGCOLUMN 97 --> + +<!-- BUGPATHLENGTH 1 --> + +<!-- BUGMETAEND --> +<!-- REPORTHEADER --> +<h3>Bug Summary</h3> +<table class="simpletable"> +<tr><td class="rowname">File:</td><td>plugins/udisks2/udisks2-plugin.c</td></tr> +<tr><td class="rowname">Warning:</td><td><a href="#EndPath">line 319, column 97</a><br />Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption</td></tr> + +</table> +<!-- REPORTSUMMARYEXTRA --> +<h3>Annotated Source Code</h3> +<p>Press <a href="#" onclick="toggleHelp(); return false;">'?'</a> + to see keyboard shortcuts</p> +<input type="checkbox" class="spoilerhider" id="showinvocation" /> +<label for="showinvocation" >Show analyzer invocation</label> +<div class="spoiler">clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name udisks2-plugin.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/plugins/udisks2 -resource-dir /usr/lib64/clang/16 -D HAVE_CONFIG_H -I . -I ../../sensors-applet -D MATELOCALEDIR="/usr/local/share/locale/" -D G_LOG_DOMAIN="sensors-applet" -D PIXMAPS_DIR="/usr/local/share/pixmaps/mate-sensors-applet/" -D DATADIR="/usr/local/share" -D LIBDIR="/usr/local/lib" -D SYSCONFDIR="/usr/local/etc" -D PREFIX="/usr/local" -I ../.. -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -D PIC -internal-isystem /usr/lib64/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/plugins/udisks2 -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2023-06-12-021133-6157-1 -x c udisks2-plugin.c +</div> +<div id='tooltiphint' hidden="true"> + <p>Keyboard shortcuts: </p> + <ul> + <li>Use 'j/k' keys for keyboard navigation</li> + <li>Use 'Shift+S' to show/hide relevant lines</li> + <li>Use '?' to toggle this window</li> + </ul> + <a href="#" onclick="toggleHelp(); return false;">Close</a> +</div> +<script type='text/javascript'> +var relevant_lines = {"1": {"319": 1}}; + +var filterCounterexample = function (hide) { + var tables = document.getElementsByClassName("code"); + for (var t=0; t<tables.length; t++) { + var table = tables[t]; + var file_id = table.getAttribute("data-fileid"); + var lines_in_fid = relevant_lines[file_id]; + if (!lines_in_fid) { + lines_in_fid = {}; + } + var lines = table.getElementsByClassName("codeline"); + for (var i=0; i<lines.length; i++) { + var el = lines[i]; + var lineNo = el.getAttribute("data-linenumber"); + if (!lines_in_fid[lineNo]) { + if (hide) { + el.setAttribute("hidden", ""); + } else { + el.removeAttribute("hidden"); + } + } + } + } +} + +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + // SHIFT + S + if (event.shiftKey && event.keyCode == 83) { + var checked = document.getElementsByName("showCounterexample")[0].checked; + filterCounterexample(!checked); + document.getElementsByName("showCounterexample")[0].click(); + } else { + return; + } + event.preventDefault(); +}, true); + +document.addEventListener("DOMContentLoaded", function() { + document.querySelector('input[name="showCounterexample"]').onchange= + function (event) { + filterCounterexample(this.checked); + }; +}); +</script> + +<form> + <input type="checkbox" name="showCounterexample" id="showCounterexample" /> + <label for="showCounterexample"> + Show only relevant lines + </label> + <input type="checkbox" name="showArrows" + id="showArrows" style="margin-left: 10px" /> + <label for="showArrows"> + Show control flow arrows + </label> +</form> + +<script type='text/javascript'> +// Return range of numbers from a range [lower, upper). +function range(lower, upper) { + var array = []; + for (var i = lower; i <= upper; ++i) { + array.push(i); + } + return array; +} + +var getRelatedArrowIndices = function(pathId) { + // HTML numeration of events is a bit different than it is in the path. + // Everything is rotated one step to the right, so the last element + // (error diagnostic) has index 0. + if (pathId == 0) { + // arrowIndices has at least 2 elements + pathId = arrowIndices.length - 1; + } + + return range(arrowIndices[pathId], arrowIndices[pathId - 1]); +} + +var highlightArrowsForSelectedEvent = function() { + const selectedNum = findNum(); + const arrowIndicesToHighlight = getRelatedArrowIndices(selectedNum); + arrowIndicesToHighlight.forEach((index) => { + var arrow = document.querySelector("#arrow" + index); + if(arrow) { + classListAdd(arrow, "selected") + } + }); +} + +var getAbsoluteBoundingRect = function(element) { + const relative = element.getBoundingClientRect(); + return { + left: relative.left + window.pageXOffset, + right: relative.right + window.pageXOffset, + top: relative.top + window.pageYOffset, + bottom: relative.bottom + window.pageYOffset, + height: relative.height, + width: relative.width + }; +} + +var drawArrow = function(index) { + // This function is based on the great answer from SO: + // https://stackoverflow.com/a/39575674/11582326 + var start = document.querySelector("#start" + index); + var end = document.querySelector("#end" + index); + var arrow = document.querySelector("#arrow" + index); + + var startRect = getAbsoluteBoundingRect(start); + var endRect = getAbsoluteBoundingRect(end); + + // It is an arrow from a token to itself, no need to visualize it. + if (startRect.top == endRect.top && + startRect.left == endRect.left) + return; + + // Each arrow is a very simple Bézier curve, with two nodes and + // two handles. So, we need to calculate four points in the window: + // * start node + var posStart = { x: 0, y: 0 }; + // * end node + var posEnd = { x: 0, y: 0 }; + // * handle for the start node + var startHandle = { x: 0, y: 0 }; + // * handle for the end node + var endHandle = { x: 0, y: 0 }; + // One can visualize it as follows: + // + // start handle + // / + // X"""_.-""""X + // .' \ + // / start node + // | + // | + // | end node + // \ / + // `->X + // X-' + // \ + // end handle + // + // NOTE: (0, 0) is the top left corner of the window. + + // We have 3 similar, but still different scenarios to cover: + // + // 1. Two tokens on different lines. + // -xxx + // / + // \ + // -> xxx + // In this situation, we draw arrow on the left curving to the left. + // 2. Two tokens on the same line, and the destination is on the right. + // ____ + // / \ + // / V + // xxx xxx + // In this situation, we draw arrow above curving upwards. + // 3. Two tokens on the same line, and the destination is on the left. + // xxx xxx + // ^ / + // \____/ + // In this situation, we draw arrow below curving downwards. + const onDifferentLines = startRect.top <= endRect.top - 5 || + startRect.top >= endRect.top + 5; + const leftToRight = startRect.left < endRect.left; + + // NOTE: various magic constants are chosen empirically for + // better positioning and look + if (onDifferentLines) { + // Case #1 + const topToBottom = startRect.top < endRect.top; + posStart.x = startRect.left - 1; + // We don't want to start it at the top left corner of the token, + // it doesn't feel like this is where the arrow comes from. + // For this reason, we start it in the middle of the left side + // of the token. + posStart.y = startRect.top + startRect.height / 2; + + // End node has arrow head and we give it a bit more space. + posEnd.x = endRect.left - 4; + posEnd.y = endRect.top; + + // Utility object with x and y offsets for handles. + var curvature = { + // We want bottom-to-top arrow to curve a bit more, so it doesn't + // overlap much with top-to-bottom curves (much more frequent). + x: topToBottom ? 15 : 25, + y: Math.min((posEnd.y - posStart.y) / 3, 10) + } + + // When destination is on the different line, we can make a + // curvier arrow because we have space for it. + // So, instead of using + // + // startHandle.x = posStart.x - curvature.x + // endHandle.x = posEnd.x - curvature.x + // + // We use the leftmost of these two values for both handles. + startHandle.x = Math.min(posStart.x, posEnd.x) - curvature.x; + endHandle.x = startHandle.x; + + // Curving downwards from the start node... + startHandle.y = posStart.y + curvature.y; + // ... and upwards from the end node. + endHandle.y = posEnd.y - curvature.y; + + } else if (leftToRight) { + // Case #2 + // Starting from the top right corner... + posStart.x = startRect.right - 1; + posStart.y = startRect.top; + + // ...and ending at the top left corner of the end token. + posEnd.x = endRect.left + 1; + posEnd.y = endRect.top - 1; + + // Utility object with x and y offsets for handles. + var curvature = { + x: Math.min((posEnd.x - posStart.x) / 3, 15), + y: 5 + } + + // Curving to the right... + startHandle.x = posStart.x + curvature.x; + // ... and upwards from the start node. + startHandle.y = posStart.y - curvature.y; + + // And to the left... + endHandle.x = posEnd.x - curvature.x; + // ... and upwards from the end node. + endHandle.y = posEnd.y - curvature.y; + + } else { + // Case #3 + // Starting from the bottom right corner... + posStart.x = startRect.right; + posStart.y = startRect.bottom; + + // ...and ending also at the bottom right corner, but of the end token. + posEnd.x = endRect.right - 1; + posEnd.y = endRect.bottom + 1; + + // Utility object with x and y offsets for handles. + var curvature = { + x: Math.min((posStart.x - posEnd.x) / 3, 15), + y: 5 + } + + // Curving to the left... + startHandle.x = posStart.x - curvature.x; + // ... and downwards from the start node. + startHandle.y = posStart.y + curvature.y; + + // And to the right... + endHandle.x = posEnd.x + curvature.x; + // ... and downwards from the end node. + endHandle.y = posEnd.y + curvature.y; + } + + // Put it all together into a path. + // More information on the format: + // https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths + var pathStr = "M" + posStart.x + "," + posStart.y + " " + + "C" + startHandle.x + "," + startHandle.y + " " + + endHandle.x + "," + endHandle.y + " " + + posEnd.x + "," + posEnd.y; + + arrow.setAttribute("d", pathStr); +}; + +var drawArrows = function() { + const numOfArrows = document.querySelectorAll("path[id^=arrow]").length; + for (var i = 0; i < numOfArrows; ++i) { + drawArrow(i); + } +} + +var toggleArrows = function(event) { + const arrows = document.querySelector("#arrows"); + if (event.target.checked) { + arrows.setAttribute("visibility", "visible"); + } else { + arrows.setAttribute("visibility", "hidden"); + } +} + +window.addEventListener("resize", drawArrows); +document.addEventListener("DOMContentLoaded", function() { + // Whenever we show invocation, locations change, i.e. we + // need to redraw arrows. + document + .querySelector('input[id="showinvocation"]') + .addEventListener("click", drawArrows); + // Hiding irrelevant lines also should cause arrow rerender. + document + .querySelector('input[name="showCounterexample"]') + .addEventListener("change", drawArrows); + document + .querySelector('input[name="showArrows"]') + .addEventListener("change", toggleArrows); + drawArrows(); + // Default highlighting for the last event. + highlightArrowsForSelectedEvent(); +}); +</script> + +<script type='text/javascript'> +var digitMatcher = new RegExp("[0-9]+"); + +var querySelectorAllArray = function(selector) { + return Array.prototype.slice.call( + document.querySelectorAll(selector)); +} + +document.addEventListener("DOMContentLoaded", function() { + querySelectorAllArray(".PathNav > a").forEach( + function(currentValue, currentIndex) { + var hrefValue = currentValue.getAttribute("href"); + currentValue.onclick = function() { + scrollTo(document.querySelector(hrefValue)); + return false; + }; + }); +}); + +var findNum = function() { + var s = document.querySelector(".msg.selected"); + if (!s || s.id == "EndPath") { + return 0; + } + var out = parseInt(digitMatcher.exec(s.id)[0]); + return out; +}; + +var classListAdd = function(el, theClass) { + if(!el.className.baseVal) + el.className += " " + theClass; + else + el.className.baseVal += " " + theClass; +}; + +var classListRemove = function(el, theClass) { + var className = (!el.className.baseVal) ? + el.className : el.className.baseVal; + className = className.replace(" " + theClass, ""); + if(!el.className.baseVal) + el.className = className; + else + el.className.baseVal = className; +}; + +var scrollTo = function(el) { + querySelectorAllArray(".selected").forEach(function(s) { + classListRemove(s, "selected"); + }); + classListAdd(el, "selected"); + window.scrollBy(0, el.getBoundingClientRect().top - + (window.innerHeight / 2)); + highlightArrowsForSelectedEvent(); +}; + +var move = function(num, up, numItems) { + if (num == 1 && up || num == numItems - 1 && !up) { + return 0; + } else if (num == 0 && up) { + return numItems - 1; + } else if (num == 0 && !up) { + return 1 % numItems; + } + return up ? num - 1 : num + 1; +} + +var numToId = function(num) { + if (num == 0) { + return document.getElementById("EndPath") + } + return document.getElementById("Path" + num); +}; + +var navigateTo = function(up) { + var numItems = document.querySelectorAll( + ".line > .msgEvent, .line > .msgControl").length; + var currentSelected = findNum(); + var newSelected = move(currentSelected, up, numItems); + var newEl = numToId(newSelected, numItems); + + // Scroll element into center. + scrollTo(newEl); +}; + +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + // key 'j' + if (event.keyCode == 74) { + navigateTo(/*up=*/false); + // key 'k' + } else if (event.keyCode == 75) { + navigateTo(/*up=*/true); + } else { + return; + } + event.preventDefault(); +}, true); +</script> + +<script type='text/javascript'> + +var toggleHelp = function() { + var hint = document.querySelector("#tooltiphint"); + var attributeName = "hidden"; + if (hint.hasAttribute(attributeName)) { + hint.removeAttribute(attributeName); + } else { + hint.setAttribute("hidden", "true"); + } +}; +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + if (event.key == "?") { + toggleHelp(); + } else { + return; + } + event.preventDefault(); +}); +</script> + +<style type="text/css"> + svg { + position:absolute; + top:0; + left:0; + height:100%; + width:100%; + pointer-events: none; + overflow: visible + } + .arrow { + stroke-opacity: 0.2; + stroke-width: 1; + marker-end: url(#arrowhead); + } + + .arrow.selected { + stroke-opacity: 0.6; + stroke-width: 2; + marker-end: url(#arrowheadSelected); + } + + .arrowhead { + orient: auto; + stroke: none; + opacity: 0.6; + fill: blue; + } +</style> +<svg xmlns="http://www.w3.org/2000/svg"> + <defs> + <marker id="arrowheadSelected" class="arrowhead" opacity="0.6" + viewBox="0 0 10 10" refX="3" refY="5" + markerWidth="4" markerHeight="4"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + <marker id="arrowhead" class="arrowhead" opacity="0.2" + viewBox="0 0 10 10" refX="3" refY="5" + markerWidth="4" markerHeight="4"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + </defs> + <g id="arrows" fill="none" stroke="blue" visibility="hidden"> + + </g> +</svg> +<script type='text/javascript'> +const arrowIndices = [ 0,0 ] +</script> +<table class="code" data-fileid="1"> +<tr class="codeline" data-linenumber="1"><td class="num" id="LN1">1</td><td class="line"><span class='comment'>/*</span></td></tr> +<tr class="codeline" data-linenumber="2"><td class="num" id="LN2">2</td><td class="line"> <span class='comment'>* Copyright (C) 2017 info-cppsp <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="3"><td class="num" id="LN3">3</td><td class="line"> <span class='comment'>* Copyright (C) 2005-2009 Alex Murray <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="4"><td class="num" id="LN4">4</td><td class="line"> <span class='comment'>* Copyright (C) 2012-2021 MATE Developers</span></td></tr> +<tr class="codeline" data-linenumber="5"><td class="num" id="LN5">5</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="6"><td class="num" id="LN6">6</td><td class="line"> <span class='comment'>* This program is free software; you can redistribute it and/or modify</span></td></tr> +<tr class="codeline" data-linenumber="7"><td class="num" id="LN7">7</td><td class="line"> <span class='comment'>* it under the terms of the GNU General Public License as published by</span></td></tr> +<tr class="codeline" data-linenumber="8"><td class="num" id="LN8">8</td><td class="line"> <span class='comment'>* the Free Software Foundation; either version 2 of the License, or</span></td></tr> +<tr class="codeline" data-linenumber="9"><td class="num" id="LN9">9</td><td class="line"> <span class='comment'>* (at your option) any later version.</span></td></tr> +<tr class="codeline" data-linenumber="10"><td class="num" id="LN10">10</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="11"><td class="num" id="LN11">11</td><td class="line"> <span class='comment'>* This program is distributed in the hope that it will be useful,</span></td></tr> +<tr class="codeline" data-linenumber="12"><td class="num" id="LN12">12</td><td class="line"> <span class='comment'>* but WITHOUT ANY WARRANTY; without even the implied warranty of</span></td></tr> +<tr class="codeline" data-linenumber="13"><td class="num" id="LN13">13</td><td class="line"> <span class='comment'>* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></td></tr> +<tr class="codeline" data-linenumber="14"><td class="num" id="LN14">14</td><td class="line"> <span class='comment'>* GNU General Public License for more details.</span></td></tr> +<tr class="codeline" data-linenumber="15"><td class="num" id="LN15">15</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="16"><td class="num" id="LN16">16</td><td class="line"> <span class='comment'>* You should have received a copy of the GNU General Public License</span></td></tr> +<tr class="codeline" data-linenumber="17"><td class="num" id="LN17">17</td><td class="line"> <span class='comment'>* along with this program; if not, write to the Free Software</span></td></tr> +<tr class="codeline" data-linenumber="18"><td class="num" id="LN18">18</td><td class="line"> <span class='comment'>* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</span></td></tr> +<tr class="codeline" data-linenumber="19"><td class="num" id="LN19">19</td><td class="line"> <span class='comment'>*/</span></td></tr> +<tr class="codeline" data-linenumber="20"><td class="num" id="LN20">20</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="21"><td class="num" id="LN21">21</td><td class="line"><span class='comment'>/*</span></td></tr> +<tr class="codeline" data-linenumber="22"><td class="num" id="LN22">22</td><td class="line"><span class='comment'>Udisks2 plugin for the mate-sensors-applet</span></td></tr> +<tr class="codeline" data-linenumber="23"><td class="num" id="LN23">23</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="24"><td class="num" id="LN24">24</td><td class="line"><span class='comment'>written using the structure and code of the previous version</span></td></tr> +<tr class="codeline" data-linenumber="25"><td class="num" id="LN25">25</td><td class="line"><span class='comment'>from Pramod Dematagoda <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="26"><td class="num" id="LN26">26</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="27"><td class="num" id="LN27">27</td><td class="line"><span class='comment'>dbus-glib documentation</span></td></tr> +<tr class="codeline" data-linenumber="28"><td class="num" id="LN28">28</td><td class="line"><span class='comment'>https://dbus.freedesktop.org/doc/dbus-glib/</span></td></tr> +<tr class="codeline" data-linenumber="29"><td class="num" id="LN29">29</td><td class="line"><span class='comment'>GDBUS documentation</span></td></tr> +<tr class="codeline" data-linenumber="30"><td class="num" id="LN30">30</td><td class="line"><span class='comment'>https://developer.gnome.org/gio/stable/index.html</span></td></tr> +<tr class="codeline" data-linenumber="31"><td class="num" id="LN31">31</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="32"><td class="num" id="LN32">32</td><td class="line"><span class='comment'>*/</span></td></tr> +<tr class="codeline" data-linenumber="33"><td class="num" id="LN33">33</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="34"><td class="num" id="LN34">34</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_CONFIG_H<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="35"><td class="num" id="LN35">35</td><td class="line"><span class='directive'>#include "config.h"</span></td></tr> +<tr class="codeline" data-linenumber="36"><td class="num" id="LN36">36</td><td class="line"><span class='directive'>#endif /* HAVE_CONFIG_H */</span></td></tr> +<tr class="codeline" data-linenumber="37"><td class="num" id="LN37">37</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="38"><td class="num" id="LN38">38</td><td class="line"><span class='directive'>#include <stdio.h></span></td></tr> +<tr class="codeline" data-linenumber="39"><td class="num" id="LN39">39</td><td class="line"><span class='directive'>#include <gio/gio.h></span></td></tr> +<tr class="codeline" data-linenumber="40"><td class="num" id="LN40">40</td><td class="line"><span class='directive'>#include "udisks2-plugin.h"</span></td></tr> +<tr class="codeline" data-linenumber="41"><td class="num" id="LN41">41</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="42"><td class="num" id="LN42">42</td><td class="line"><span class='comment'>/* remove // from next line for syslog debug */</span></td></tr> +<tr class="codeline" data-linenumber="43"><td class="num" id="LN43">43</td><td class="line"><span class='comment'>//#define UD2PD 1</span></td></tr> +<tr class="codeline" data-linenumber="44"><td class="num" id="LN44">44</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="45"><td class="num" id="LN45">45</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="46"><td class="num" id="LN46">46</td><td class="line"><span class='directive'>#include <syslog.h></span></td></tr> +<tr class="codeline" data-linenumber="47"><td class="num" id="LN47">47</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="48"><td class="num" id="LN48">48</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="49"><td class="num" id="LN49">49</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_BUS_NAME<span class='macro_popup'>"org.freedesktop.UDisks2"</span></span> "org.freedesktop.UDisks2"</span></td></tr> +<tr class="codeline" data-linenumber="50"><td class="num" id="LN50">50</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.DBus.ObjectManager"</span></span> "org.freedesktop.DBus.ObjectManager"</span></td></tr> +<tr class="codeline" data-linenumber="51"><td class="num" id="LN51">51</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_DEVICE_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive"</span></span> "org.freedesktop.UDisks2.Drive"</span></td></tr> +<tr class="codeline" data-linenumber="52"><td class="num" id="LN52">52</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_DEVICE_INTERFACE2_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive.Ata"</span></span> "org.freedesktop.UDisks2.Drive.Ata"</span></td></tr> +<tr class="codeline" data-linenumber="53"><td class="num" id="LN53">53</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="54"><td class="num" id="LN54">54</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_PROPERTIES_INTERFACE<span class='macro_popup'>"org.freedesktop.DBus.Properties"</span></span> "org.freedesktop.DBus.Properties"</span></td></tr> +<tr class="codeline" data-linenumber="55"><td class="num" id="LN55">55</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_OBJECT_PATH<span class='macro_popup'>"/org/freedesktop/UDisks2"</span></span> "/org/freedesktop/UDisks2"</span></td></tr> +<tr class="codeline" data-linenumber="56"><td class="num" id="LN56">56</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="57"><td class="num" id="LN57">57</td><td class="line"><span class='comment'>/* Info about a single sensor */</span></td></tr> +<tr class="codeline" data-linenumber="58"><td class="num" id="LN58">58</td><td class="line"><span class='keyword'>typedef</span> <span class='keyword'>struct</span> _DevInfo {</td></tr> +<tr class="codeline" data-linenumber="59"><td class="num" id="LN59">59</td><td class="line"> gchar *path;</td></tr> +<tr class="codeline" data-linenumber="60"><td class="num" id="LN60">60</td><td class="line"> gchar *id;</td></tr> +<tr class="codeline" data-linenumber="61"><td class="num" id="LN61">61</td><td class="line"> gdouble temp;</td></tr> +<tr class="codeline" data-linenumber="62"><td class="num" id="LN62">62</td><td class="line"> GDBusProxy *sensor_proxy; <span class='comment'>/* dbus object */</span></td></tr> +<tr class="codeline" data-linenumber="63"><td class="num" id="LN63">63</td><td class="line"> GError *error;</td></tr> +<tr class="codeline" data-linenumber="64"><td class="num" id="LN64">64</td><td class="line">} DevInfo;</td></tr> +<tr class="codeline" data-linenumber="65"><td class="num" id="LN65">65</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="66"><td class="num" id="LN66">66</td><td class="line"><span class='keyword'>const</span> gchar *plugin_name = <span class='string_literal'>"udisks2"</span>;</td></tr> +<tr class="codeline" data-linenumber="67"><td class="num" id="LN67">67</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="68"><td class="num" id="LN68">68</td><td class="line"><span class='comment'>/* a container for the devices found to have smart enabled */</span></td></tr> +<tr class="codeline" data-linenumber="69"><td class="num" id="LN69">69</td><td class="line">GHashTable *devices = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="70"><td class="num" id="LN70">70</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="71"><td class="num" id="LN71">71</td><td class="line"><span class='comment'>/* This is a global variable for convenience */</span></td></tr> +<tr class="codeline" data-linenumber="72"><td class="num" id="LN72">72</td><td class="line">GDBusConnection *connection = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="73"><td class="num" id="LN73">73</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="74"><td class="num" id="LN74">74</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> update_device (DevInfo *info) {</td></tr> +<tr class="codeline" data-linenumber="75"><td class="num" id="LN75">75</td><td class="line"> GError *error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="76"><td class="num" id="LN76">76</td><td class="line"> GVariant *tempgvar = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="77"><td class="num" id="LN77">77</td><td class="line"> GVariant *tempgvar2 = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="78"><td class="num" id="LN78">78</td><td class="line"> gdouble temp;</td></tr> +<tr class="codeline" data-linenumber="79"><td class="num" id="LN79">79</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="80"><td class="num" id="LN80">80</td><td class="line"> <span class='comment'>/* check valid input parameter */</span></td></tr> +<tr class="codeline" data-linenumber="81"><td class="num" id="LN81">81</td><td class="line"> <span class='macro'>g_return_if_fail (info != NULL)<span class='macro_popup'>do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_22<br>; if (info != ((void*)0)) _g_boolean_var_22 = 1; else _g_boolean_var_22<br> = 0; _g_boolean_var_22; }), 1))) { } else { g_return_if_fail_warning<br> ("sensors-applet", ((const char*) (__func__)), "info != NULL"<br>); return; } } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="82"><td class="num" id="LN82">82</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="83"><td class="num" id="LN83">83</td><td class="line"> <span class='comment'>/* check connection too */</span></td></tr> +<tr class="codeline" data-linenumber="84"><td class="num" id="LN84">84</td><td class="line"> <span class='macro'>g_return_if_fail (connection != NULL)<span class='macro_popup'>do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_23<br>; if (connection != ((void*)0)) _g_boolean_var_23 = 1; else _g_boolean_var_23<br> = 0; _g_boolean_var_23; }), 1))) { } else { g_return_if_fail_warning<br> ("sensors-applet", ((const char*) (__func__)), "connection != NULL"<br>); return; } } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="85"><td class="num" id="LN85">85</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="86"><td class="num" id="LN86">86</td><td class="line"> g_clear_error (&info->error);</td></tr> +<tr class="codeline" data-linenumber="87"><td class="num" id="LN87">87</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="88"><td class="num" id="LN88">88</td><td class="line"> <span class='comment'>/* check for sensor_proxy, which should exist at this point, make one if necessary and save it into DevInfo</span></td></tr> +<tr class="codeline" data-linenumber="89"><td class="num" id="LN89">89</td><td class="line"> <span class='comment'>* this is used to get the temp value the direct way */</span></td></tr> +<tr class="codeline" data-linenumber="90"><td class="num" id="LN90">90</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == info->sensor_proxy) {</td></tr> +<tr class="codeline" data-linenumber="91"><td class="num" id="LN91">91</td><td class="line"> info->sensor_proxy = g_dbus_proxy_new_sync (connection, G_DBUS_PROXY_FLAGS_NONE, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="92"><td class="num" id="LN92">92</td><td class="line"> <span class='macro'>UDISKS2_BUS_NAME<span class='macro_popup'>"org.freedesktop.UDisks2"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="93"><td class="num" id="LN93">93</td><td class="line"> info->path,</td></tr> +<tr class="codeline" data-linenumber="94"><td class="num" id="LN94">94</td><td class="line"> <span class='macro'>UDISKS2_PROPERTIES_INTERFACE<span class='macro_popup'>"org.freedesktop.DBus.Properties"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="95"><td class="num" id="LN95">95</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, &error);</td></tr> +<tr class="codeline" data-linenumber="96"><td class="num" id="LN96">96</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="97"><td class="num" id="LN97">97</td><td class="line"> <span class='comment'>/* check, just to be sure */</span></td></tr> +<tr class="codeline" data-linenumber="98"><td class="num" id="LN98">98</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == info->sensor_proxy) {</td></tr> +<tr class="codeline" data-linenumber="99"><td class="num" id="LN99">99</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="100"><td class="num" id="LN100">100</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="101"><td class="num" id="LN101">101</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Failed to get drive temperature 1"</span>);</td></tr> +<tr class="codeline" data-linenumber="102"><td class="num" id="LN102">102</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="103"><td class="num" id="LN103">103</td><td class="line"> g_debug (<span class='string_literal'>"Failed to get drive temperature 1: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="104"><td class="num" id="LN104">104</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="105"><td class="num" id="LN105">105</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="106"><td class="num" id="LN106">106</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="107"><td class="num" id="LN107">107</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="108"><td class="num" id="LN108">108</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="109"><td class="num" id="LN109">109</td><td class="line"><span class='comment'>/* note on timing:</span></td></tr> +<tr class="codeline" data-linenumber="110"><td class="num" id="LN110">110</td><td class="line"> <span class='comment'>* it seems to me that smart updates occur automatically every 10 minutes</span></td></tr> +<tr class="codeline" data-linenumber="111"><td class="num" id="LN111">111</td><td class="line"> <span class='comment'>* mate-sensor-applet has a default refresh of 2 seconds...</span></td></tr> +<tr class="codeline" data-linenumber="112"><td class="num" id="LN112">112</td><td class="line"> <span class='comment'>* it is possible to force a smart update with udisks2: SmartUpdate (IN a{sv} options); */</span></td></tr> +<tr class="codeline" data-linenumber="113"><td class="num" id="LN113">113</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="114"><td class="num" id="LN114">114</td><td class="line"> <span class='comment'>/* directly asking the device's DBus object for the temp */</span></td></tr> +<tr class="codeline" data-linenumber="115"><td class="num" id="LN115">115</td><td class="line"> tempgvar = g_dbus_proxy_call_sync (info->sensor_proxy, <span class='string_literal'>"Get"</span>,</td></tr> +<tr class="codeline" data-linenumber="116"><td class="num" id="LN116">116</td><td class="line"> g_variant_new (<span class='string_literal'>"(ss)"</span>,</td></tr> +<tr class="codeline" data-linenumber="117"><td class="num" id="LN117">117</td><td class="line"> <span class='macro'>UDISKS2_DEVICE_INTERFACE2_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive.Ata"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="118"><td class="num" id="LN118">118</td><td class="line"> <span class='string_literal'>"SmartTemperature"</span>), <span class='comment'>/* parameters */</span></td></tr> +<tr class="codeline" data-linenumber="119"><td class="num" id="LN119">119</td><td class="line"> G_DBUS_CALL_FLAGS_NONE, <span class='comment'>/* flags */</span></td></tr> +<tr class="codeline" data-linenumber="120"><td class="num" id="LN120">120</td><td class="line"> -1, <span class='comment'>/* timeout */</span></td></tr> +<tr class="codeline" data-linenumber="121"><td class="num" id="LN121">121</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='comment'>/* cancellable */</span></td></tr> +<tr class="codeline" data-linenumber="122"><td class="num" id="LN122">122</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="123"><td class="num" id="LN123">123</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="124"><td class="num" id="LN124">124</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == tempgvar) {</td></tr> +<tr class="codeline" data-linenumber="125"><td class="num" id="LN125">125</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="126"><td class="num" id="LN126">126</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="127"><td class="num" id="LN127">127</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Failed to get drive temperature 2"</span>);</td></tr> +<tr class="codeline" data-linenumber="128"><td class="num" id="LN128">128</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="129"><td class="num" id="LN129">129</td><td class="line"> g_debug (<span class='string_literal'>"Failed to get drive temperature 2: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="130"><td class="num" id="LN130">130</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="131"><td class="num" id="LN131">131</td><td class="line"> <span class='comment'>/* throw away proxy, maybe next time it will be better */</span></td></tr> +<tr class="codeline" data-linenumber="132"><td class="num" id="LN132">132</td><td class="line"> <span class='macro'>g_clear_object (&info->sensor_proxy)<span class='macro_popup'>do { _Static_assert (sizeof *((&info->sensor_proxy)) ==<br> sizeof (gpointer), "Expression evaluates to false"); __typeof__<br> (((&info->sensor_proxy))) _pp = ((&info->sensor_proxy<br>)); __typeof__ (*((&info->sensor_proxy))) _ptr = *_pp;<br> *_pp = ((void*)0); if (_ptr) (g_object_unref) (_ptr); } while<br> (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="133"><td class="num" id="LN133">133</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="134"><td class="num" id="LN134">134</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="135"><td class="num" id="LN135">135</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="136"><td class="num" id="LN136">136</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="137"><td class="num" id="LN137">137</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="138"><td class="num" id="LN138">138</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"tempgvar value: %s"</span>, g_variant_print(tempgvar, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="139"><td class="num" id="LN139">139</td><td class="line"><span class='comment'>/* leaks memory! */</span></td></tr> +<tr class="codeline" data-linenumber="140"><td class="num" id="LN140">140</td><td class="line"><span class='comment'>//syslog(LOG_ERR, "tempgvar value: %s", g_variant_print(g_variant_get_variant(g_variant_get_child_value(tempgvar, 0)), TRUE));</span></td></tr> +<tr class="codeline" data-linenumber="141"><td class="num" id="LN141">141</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="142"><td class="num" id="LN142">142</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="143"><td class="num" id="LN143">143</td><td class="line"> <span class='comment'>/* tempgvar comes back as something along the lines of array(gvariant(tempasdouble))</span></td></tr> +<tr class="codeline" data-linenumber="144"><td class="num" id="LN144">144</td><td class="line"> <span class='comment'>* hence unpacking</span></td></tr> +<tr class="codeline" data-linenumber="145"><td class="num" id="LN145">145</td><td class="line"> <span class='comment'>* need to free up every param / return value, so can't do it like:</span></td></tr> +<tr class="codeline" data-linenumber="146"><td class="num" id="LN146">146</td><td class="line"> <span class='comment'>* temp = g_variant_get_double(g_variant_get_variant(g_variant_get_child_value(tempgvar, 0))); */</span></td></tr> +<tr class="codeline" data-linenumber="147"><td class="num" id="LN147">147</td><td class="line"> tempgvar2 = g_variant_get_child_value (tempgvar, 0);</td></tr> +<tr class="codeline" data-linenumber="148"><td class="num" id="LN148">148</td><td class="line"> g_variant_unref (tempgvar);</td></tr> +<tr class="codeline" data-linenumber="149"><td class="num" id="LN149">149</td><td class="line"> tempgvar = g_variant_get_variant (tempgvar2);</td></tr> +<tr class="codeline" data-linenumber="150"><td class="num" id="LN150">150</td><td class="line"> g_variant_unref (tempgvar2);</td></tr> +<tr class="codeline" data-linenumber="151"><td class="num" id="LN151">151</td><td class="line"> temp = g_variant_get_double (tempgvar);</td></tr> +<tr class="codeline" data-linenumber="152"><td class="num" id="LN152">152</td><td class="line"> g_variant_unref (tempgvar);</td></tr> +<tr class="codeline" data-linenumber="153"><td class="num" id="LN153">153</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="154"><td class="num" id="LN154">154</td><td class="line"> <span class='comment'>/* temp in K */</span></td></tr> +<tr class="codeline" data-linenumber="155"><td class="num" id="LN155">155</td><td class="line"> info->temp = temp - 273.15;</td></tr> +<tr class="codeline" data-linenumber="156"><td class="num" id="LN156">156</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="157"><td class="num" id="LN157">157</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="158"><td class="num" id="LN158">158</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Refresh udisks2 device temp: '%f'\n"</span>, info->temp);</td></tr> +<tr class="codeline" data-linenumber="159"><td class="num" id="LN159">159</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="160"><td class="num" id="LN160">160</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="161"><td class="num" id="LN161">161</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="162"><td class="num" id="LN162">162</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="163"><td class="num" id="LN163">163</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="164"><td class="num" id="LN164">164</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="165"><td class="num" id="LN165">165</td><td class="line"><span class='comment'>/* in this function we would like to get a list of device (hdd/ssd) paths</span></td></tr> +<tr class="codeline" data-linenumber="166"><td class="num" id="LN166">166</td><td class="line"> <span class='comment'>* then with each path we get the temperature</span></td></tr> +<tr class="codeline" data-linenumber="167"><td class="num" id="LN167">167</td><td class="line"> <span class='comment'>* it is possible with udisks2 to get all the above information in one g_dbus_proxy_call_sync(), so that is how I did it</span></td></tr> +<tr class="codeline" data-linenumber="168"><td class="num" id="LN168">168</td><td class="line"> <span class='comment'>* maybe a better version would be to use GDBusObjectManager Server + Client ?? */</span></td></tr> +<tr class="codeline" data-linenumber="169"><td class="num" id="LN169">169</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> udisks2_plugin_get_sensors (GList **sensors) {</td></tr> +<tr class="codeline" data-linenumber="170"><td class="num" id="LN170">170</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="171"><td class="num" id="LN171">171</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="172"><td class="num" id="LN172">172</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"fstart"</span>);</td></tr> +<tr class="codeline" data-linenumber="173"><td class="num" id="LN173">173</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="174"><td class="num" id="LN174">174</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="175"><td class="num" id="LN175">175</td><td class="line"> GDBusProxy *proxy = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="176"><td class="num" id="LN176">176</td><td class="line"> GError *error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="177"><td class="num" id="LN177">177</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="178"><td class="num" id="LN178">178</td><td class="line"> DevInfo *info;</td></tr> +<tr class="codeline" data-linenumber="179"><td class="num" id="LN179">179</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="180"><td class="num" id="LN180">180</td><td class="line"> <span class='comment'>/* This connection will be used for everything, including the obtaining of sensor data */</span></td></tr> +<tr class="codeline" data-linenumber="181"><td class="num" id="LN181">181</td><td class="line"> connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, &error);</td></tr> +<tr class="codeline" data-linenumber="182"><td class="num" id="LN182">182</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == connection) {</td></tr> +<tr class="codeline" data-linenumber="183"><td class="num" id="LN183">183</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="184"><td class="num" id="LN184">184</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="185"><td class="num" id="LN185">185</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn fail"</span>);</td></tr> +<tr class="codeline" data-linenumber="186"><td class="num" id="LN186">186</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="187"><td class="num" id="LN187">187</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="188"><td class="num" id="LN188">188</td><td class="line"> g_debug (<span class='string_literal'>"Failed to open connection to DBUS: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="189"><td class="num" id="LN189">189</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="190"><td class="num" id="LN190">190</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="191"><td class="num" id="LN191">191</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="192"><td class="num" id="LN192">192</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="193"><td class="num" id="LN193">193</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="194"><td class="num" id="LN194">194</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn success"</span>);</td></tr> +<tr class="codeline" data-linenumber="195"><td class="num" id="LN195">195</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="196"><td class="num" id="LN196">196</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="197"><td class="num" id="LN197">197</td><td class="line"> <span class='comment'>/* I use this proxy to get all info of all devices at once */</span></td></tr> +<tr class="codeline" data-linenumber="198"><td class="num" id="LN198">198</td><td class="line"> proxy = g_dbus_proxy_new_sync (connection, G_DBUS_PROXY_FLAGS_NONE, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="199"><td class="num" id="LN199">199</td><td class="line"> <span class='macro'>UDISKS2_BUS_NAME<span class='macro_popup'>"org.freedesktop.UDisks2"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="200"><td class="num" id="LN200">200</td><td class="line"> <span class='macro'>UDISKS2_OBJECT_PATH<span class='macro_popup'>"/org/freedesktop/UDisks2"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="201"><td class="num" id="LN201">201</td><td class="line"> <span class='macro'>UDISKS2_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.DBus.ObjectManager"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="202"><td class="num" id="LN202">202</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, &error);</td></tr> +<tr class="codeline" data-linenumber="203"><td class="num" id="LN203">203</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="204"><td class="num" id="LN204">204</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == proxy) {</td></tr> +<tr class="codeline" data-linenumber="205"><td class="num" id="LN205">205</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="206"><td class="num" id="LN206">206</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="207"><td class="num" id="LN207">207</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn proxy fail"</span>);</td></tr> +<tr class="codeline" data-linenumber="208"><td class="num" id="LN208">208</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="209"><td class="num" id="LN209">209</td><td class="line"> g_debug (<span class='string_literal'>"dbus conn proxy fail: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="210"><td class="num" id="LN210">210</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="211"><td class="num" id="LN211">211</td><td class="line"> <span class='macro'>g_clear_object (&connection)<span class='macro_popup'>do { _Static_assert (sizeof *((&connection)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&connection<br>))) _pp = ((&connection)); __typeof__ (*((&connection<br>))) _ptr = *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref<br>) (_ptr); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="212"><td class="num" id="LN212">212</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="213"><td class="num" id="LN213">213</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="214"><td class="num" id="LN214">214</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="215"><td class="num" id="LN215">215</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="216"><td class="num" id="LN216">216</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn proxy success"</span>);</td></tr> +<tr class="codeline" data-linenumber="217"><td class="num" id="LN217">217</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="218"><td class="num" id="LN218">218</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="219"><td class="num" id="LN219">219</td><td class="line"> <span class='comment'>/* The object paths of the disks are enumerated and placed in an array of object paths</span></td></tr> +<tr class="codeline" data-linenumber="220"><td class="num" id="LN220">220</td><td class="line"> <span class='comment'>* "GetManagedObjects" returns dict of (objectpath, (dict of (string [ie. if. name], dict of(string [ie. property name], variant [ie. prop. value])))) */</span></td></tr> +<tr class="codeline" data-linenumber="221"><td class="num" id="LN221">221</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="222"><td class="num" id="LN222">222</td><td class="line"> <span class='comment'>/* g_dbus_proxy_call_sync() returns NULL on error, GVariant * otherwise</span></td></tr> +<tr class="codeline" data-linenumber="223"><td class="num" id="LN223">223</td><td class="line"> <span class='comment'>* need second variable to prevent memory leak */</span></td></tr> +<tr class="codeline" data-linenumber="224"><td class="num" id="LN224">224</td><td class="line"> GVariant *managed_objects = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="225"><td class="num" id="LN225">225</td><td class="line"> GVariant *managed_objects2 = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="226"><td class="num" id="LN226">226</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="227"><td class="num" id="LN227">227</td><td class="line"> managed_objects2 = g_dbus_proxy_call_sync (proxy, <span class='string_literal'>"GetManagedObjects"</span>,</td></tr> +<tr class="codeline" data-linenumber="228"><td class="num" id="LN228">228</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='comment'>/* parameters */</span></td></tr> +<tr class="codeline" data-linenumber="229"><td class="num" id="LN229">229</td><td class="line"> G_DBUS_CALL_FLAGS_NONE, <span class='comment'>/* flags */</span></td></tr> +<tr class="codeline" data-linenumber="230"><td class="num" id="LN230">230</td><td class="line"> -1, <span class='comment'>/* timeout */</span></td></tr> +<tr class="codeline" data-linenumber="231"><td class="num" id="LN231">231</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='comment'>/* cancellable */</span></td></tr> +<tr class="codeline" data-linenumber="232"><td class="num" id="LN232">232</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="233"><td class="num" id="LN233">233</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="234"><td class="num" id="LN234">234</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == managed_objects2) {</td></tr> +<tr class="codeline" data-linenumber="235"><td class="num" id="LN235">235</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="236"><td class="num" id="LN236">236</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="237"><td class="num" id="LN237">237</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Failed to enumerate disk devices"</span>);</td></tr> +<tr class="codeline" data-linenumber="238"><td class="num" id="LN238">238</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="239"><td class="num" id="LN239">239</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="240"><td class="num" id="LN240">240</td><td class="line"> g_debug (<span class='string_literal'>"Failed to enumerate disk devices: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="241"><td class="num" id="LN241">241</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="242"><td class="num" id="LN242">242</td><td class="line"> <span class='macro'>g_clear_object (&proxy)<span class='macro_popup'>do { _Static_assert (sizeof *((&proxy)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&proxy<br>))) _pp = ((&proxy)); __typeof__ (*((&proxy))) _ptr =<br> *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref) (_ptr); }<br> while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="243"><td class="num" id="LN243">243</td><td class="line"> <span class='macro'>g_clear_object (&connection)<span class='macro_popup'>do { _Static_assert (sizeof *((&connection)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&connection<br>))) _pp = ((&connection)); __typeof__ (*((&connection<br>))) _ptr = *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref<br>) (_ptr); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="244"><td class="num" id="LN244">244</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="245"><td class="num" id="LN245">245</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="246"><td class="num" id="LN246">246</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="247"><td class="num" id="LN247">247</td><td class="line"> <span class='comment'>/* the result dictionary is enclosed in an array, unpack */</span></td></tr> +<tr class="codeline" data-linenumber="248"><td class="num" id="LN248">248</td><td class="line"> managed_objects = g_variant_get_child_value (managed_objects2, 0);</td></tr> +<tr class="codeline" data-linenumber="249"><td class="num" id="LN249">249</td><td class="line"> g_variant_unref (managed_objects2);</td></tr> +<tr class="codeline" data-linenumber="250"><td class="num" id="LN250">250</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="251"><td class="num" id="LN251">251</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="252"><td class="num" id="LN252">252</td><td class="line"><span class='comment'>//syslog(LOG_ERR, "managed_objects type: %s", g_variant_print(managed_objects, TRUE));</span></td></tr> +<tr class="codeline" data-linenumber="253"><td class="num" id="LN253">253</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"success to enumerate disk devices"</span>);</td></tr> +<tr class="codeline" data-linenumber="254"><td class="num" id="LN254">254</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="255"><td class="num" id="LN255">255</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="256"><td class="num" id="LN256">256</td><td class="line"> <span class='comment'>/* iterator for the result dictionary</span></td></tr> +<tr class="codeline" data-linenumber="257"><td class="num" id="LN257">257</td><td class="line"> <span class='comment'>* iterator code is based on the g_variant_iter_next() documentation</span></td></tr> +<tr class="codeline" data-linenumber="258"><td class="num" id="LN258">258</td><td class="line"> <span class='comment'>* iter is freed if the GVariant is, when using g_variant_iter_init() */</span></td></tr> +<tr class="codeline" data-linenumber="259"><td class="num" id="LN259">259</td><td class="line"> GVariantIter iter;</td></tr> +<tr class="codeline" data-linenumber="260"><td class="num" id="LN260">260</td><td class="line"> gchar *key = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; <span class='comment'>/* object path (like '/org/freedesktop/UDisks2/drives/Samsung_SSD_840_EVO_250GB_*insert drive serial nr.*') */</span></td></tr> +<tr class="codeline" data-linenumber="261"><td class="num" id="LN261">261</td><td class="line"> GVariant *value = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="262"><td class="num" id="LN262">262</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="263"><td class="num" id="LN263">263</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="264"><td class="num" id="LN264">264</td><td class="line"><span class='comment'>/* log collection size */</span></td></tr> +<tr class="codeline" data-linenumber="265"><td class="num" id="LN265">265</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"iter init count: %d"</span>, (<span class='keyword'>int</span>) g_variant_iter_init (&iter, managed_objects));</td></tr> +<tr class="codeline" data-linenumber="266"><td class="num" id="LN266">266</td><td class="line"><span class='directive'>#else</span></td></tr> +<tr class="codeline" data-linenumber="267"><td class="num" id="LN267">267</td><td class="line"> g_variant_iter_init (&iter, managed_objects);</td></tr> +<tr class="codeline" data-linenumber="268"><td class="num" id="LN268">268</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="269"><td class="num" id="LN269">269</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="270"><td class="num" id="LN270">270</td><td class="line"> <span class='comment'>/* "{sv}" is a GVariant format string</span></td></tr> +<tr class="codeline" data-linenumber="271"><td class="num" id="LN271">271</td><td class="line"> <span class='comment'>* {} dictionary of, s string, v GVariant</span></td></tr> +<tr class="codeline" data-linenumber="272"><td class="num" id="LN272">272</td><td class="line"> <span class='comment'>* changed to "{oa{sa{sv}}}" on error message 'the GVariant format string '{sv}' has a type of '{sv}' but the given value has a type of 'a{oa{sa{sv}}}''</span></td></tr> +<tr class="codeline" data-linenumber="273"><td class="num" id="LN273">273</td><td class="line"> <span class='comment'>* a is array, o is object path</span></td></tr> +<tr class="codeline" data-linenumber="274"><td class="num" id="LN274">274</td><td class="line"> <span class='comment'>* NOO!! the right format string is "{o@*}", which means get an object path into the 1st variable (key)</span></td></tr> +<tr class="codeline" data-linenumber="275"><td class="num" id="LN275">275</td><td class="line"> <span class='comment'>* and get 'everything else' (as a GVariant) into the 2nd variable (value)</span></td></tr> +<tr class="codeline" data-linenumber="276"><td class="num" id="LN276">276</td><td class="line"> <span class='comment'>* needs the & before the key and value params! */</span></td></tr> +<tr class="codeline" data-linenumber="277"><td class="num" id="LN277">277</td><td class="line"> <span class='keyword'>while</span> (g_variant_iter_next (&iter, <span class='string_literal'>"{o@*}"</span>, &key, &value)) {</td></tr> +<tr class="codeline" data-linenumber="278"><td class="num" id="LN278">278</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="279"><td class="num" id="LN279">279</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="280"><td class="num" id="LN280">280</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"in iter while loop"</span>);</td></tr> +<tr class="codeline" data-linenumber="281"><td class="num" id="LN281">281</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"key value: %s"</span>, key);</td></tr> +<tr class="codeline" data-linenumber="282"><td class="num" id="LN282">282</td><td class="line"><span class='comment'>//syslog(LOG_ERR, "value type: %s", g_variant_print(value, TRUE));</span></td></tr> +<tr class="codeline" data-linenumber="283"><td class="num" id="LN283">283</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="284"><td class="num" id="LN284">284</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="285"><td class="num" id="LN285">285</td><td class="line"> <span class='comment'>/* level 2</span></td></tr> +<tr class="codeline" data-linenumber="286"><td class="num" id="LN286">286</td><td class="line"> <span class='comment'>* create a dictionary of value</span></td></tr> +<tr class="codeline" data-linenumber="287"><td class="num" id="LN287">287</td><td class="line"> <span class='comment'>* the two interface names that we are searching for are known and defined</span></td></tr> +<tr class="codeline" data-linenumber="288"><td class="num" id="LN288">288</td><td class="line"> <span class='comment'>* can't use GVariantDict, it only supports '{sv}' but the given value has a type of '{sa{sv}}'</span></td></tr> +<tr class="codeline" data-linenumber="289"><td class="num" id="LN289">289</td><td class="line"> <span class='comment'>* using general lookup */</span></td></tr> +<tr class="codeline" data-linenumber="290"><td class="num" id="LN290">290</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="291"><td class="num" id="LN291">291</td><td class="line"> GVariant *propdict = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; <span class='comment'>/* drive data */</span></td></tr> +<tr class="codeline" data-linenumber="292"><td class="num" id="LN292">292</td><td class="line"> GVariant *propdict2 = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; <span class='comment'>/* drive smart data */</span></td></tr> +<tr class="codeline" data-linenumber="293"><td class="num" id="LN293">293</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="294"><td class="num" id="LN294">294</td><td class="line"> <span class='comment'>/* make two dictionaries that contain the properties of the drive interfaces */</span></td></tr> +<tr class="codeline" data-linenumber="295"><td class="num" id="LN295">295</td><td class="line"> propdict = g_variant_lookup_value (value, <span class='macro'>UDISKS2_DEVICE_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive"</span></span>, <span class='macro'>G_VARIANT_TYPE_DICTIONARY<span class='macro_popup'>((const GVariantType *) "a{?*}")</span></span>);</td></tr> +<tr class="codeline" data-linenumber="296"><td class="num" id="LN296">296</td><td class="line"> propdict2 = g_variant_lookup_value (value, <span class='macro'>UDISKS2_DEVICE_INTERFACE2_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive.Ata"</span></span>, <span class='macro'>G_VARIANT_TYPE_DICTIONARY<span class='macro_popup'>((const GVariantType *) "a{?*}")</span></span>);</td></tr> +<tr class="codeline" data-linenumber="297"><td class="num" id="LN297">297</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="298"><td class="num" id="LN298">298</td><td class="line"> <span class='comment'>/* do we have the right ifname keys? */</span></td></tr> +<tr class="codeline" data-linenumber="299"><td class="num" id="LN299">299</td><td class="line"> <span class='keyword'>if</span> ((<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict) && (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict2)) {</td></tr> +<tr class="codeline" data-linenumber="300"><td class="num" id="LN300">300</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="301"><td class="num" id="LN301">301</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="302"><td class="num" id="LN302">302</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"propdict type: %s"</span>, g_variant_print(propdict, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="303"><td class="num" id="LN303">303</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"propdict2 type: %s"</span>, g_variant_print(propdict2, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="304"><td class="num" id="LN304">304</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="305"><td class="num" id="LN305">305</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="306"><td class="num" id="LN306">306</td><td class="line"> <span class='comment'>/* get data */</span></td></tr> +<tr class="codeline" data-linenumber="307"><td class="num" id="LN307">307</td><td class="line"> gchar *id = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="308"><td class="num" id="LN308">308</td><td class="line"> gchar *model = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="309"><td class="num" id="LN309">309</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="310"><td class="num" id="LN310">310</td><td class="line"> gboolean smartenabled;</td></tr> +<tr class="codeline" data-linenumber="311"><td class="num" id="LN311">311</td><td class="line"> gdouble temp;</td></tr> +<tr class="codeline" data-linenumber="312"><td class="num" id="LN312">312</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="313"><td class="num" id="LN313">313</td><td class="line"> <span class='comment'>/* NULL, bc we don't care about the length of the string</span></td></tr> +<tr class="codeline" data-linenumber="314"><td class="num" id="LN314">314</td><td class="line"> <span class='comment'>* typecast bc g_variant_get_string() returns const char* */</span></td></tr> +<tr class="codeline" data-linenumber="315"><td class="num" id="LN315">315</td><td class="line"> id = (gchar *) g_variant_get_string (g_variant_lookup_value (propdict, <span class='string_literal'>"Id"</span>, <span class='macro'>G_VARIANT_TYPE_STRING<span class='macro_popup'>((const GVariantType *) "s")</span></span>), <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="316"><td class="num" id="LN316">316</td><td class="line"> model = (gchar *) g_variant_get_string (g_variant_lookup_value (propdict, <span class='string_literal'>"Model"</span>, <span class='macro'>G_VARIANT_TYPE_STRING<span class='macro_popup'>((const GVariantType *) "s")</span></span>), <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="317"><td class="num" id="LN317">317</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="318"><td class="num" id="LN318">318</td><td class="line"> smartenabled = g_variant_get_boolean (g_variant_lookup_value (propdict2, <span class='string_literal'>"SmartEnabled"</span>, <span class='macro'>G_VARIANT_TYPE_BOOLEAN<span class='macro_popup'>((const GVariantType *) "b")</span></span>));</td></tr> +<tr class="codeline" data-linenumber="319"><td class="num" id="LN319">319</td><td class="line"> temp = g_variant_get_double (g_variant_lookup_value (propdict2, <span class='string_literal'>"SmartTemperature"</span>, <span class="mrange"><span class="mrange"><span class='macro'>G_VARIANT_TYPE_DOUBLE<span class='macro_popup'>((const GVariantType *) "d")</span></span></span></span>));</td></tr> +<tr><td class="num"></td><td class="line"><div id="EndPath" class="msg msgEvent" style="margin-left:97ex; max-width:31em">Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption</div></td></tr> +<tr class="codeline" data-linenumber="320"><td class="num" id="LN320">320</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="321"><td class="num" id="LN321">321</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="322"><td class="num" id="LN322">322</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device id: '%s'\n"</span>, id);</td></tr> +<tr class="codeline" data-linenumber="323"><td class="num" id="LN323">323</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device model: '%s'\n"</span>, model);</td></tr> +<tr class="codeline" data-linenumber="324"><td class="num" id="LN324">324</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device smartenabled: '%d'\n"</span>, smartenabled);</td></tr> +<tr class="codeline" data-linenumber="325"><td class="num" id="LN325">325</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device temp: '%f'\n"</span>, temp);</td></tr> +<tr class="codeline" data-linenumber="326"><td class="num" id="LN326">326</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="327"><td class="num" id="LN327">327</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="328"><td class="num" id="LN328">328</td><td class="line"> <span class='comment'>/* only go on if smart is enabled</span></td></tr> +<tr class="codeline" data-linenumber="329"><td class="num" id="LN329">329</td><td class="line"> <span class='comment'>* save data */</span></td></tr> +<tr class="codeline" data-linenumber="330"><td class="num" id="LN330">330</td><td class="line"> <span class='keyword'>if</span> (smartenabled) {</td></tr> +<tr class="codeline" data-linenumber="331"><td class="num" id="LN331">331</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="332"><td class="num" id="LN332">332</td><td class="line"> info = <span class='macro'>g_new0 (DevInfo, 1)<span class='macro_popup'>(DevInfo *) (__extension__ ({ gsize __n = (gsize) (1); gsize __s<br> = sizeof (DevInfo); gpointer __p; if (__s == 1) __p = g_malloc0<br> (__n); else if (__builtin_constant_p (__n) && (__s ==<br> 0 || __n <= (9223372036854775807L *2UL+1UL) / __s)) __p =<br> g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s); __p<br>; }))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="333"><td class="num" id="LN333">333</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == devices) {</td></tr> +<tr class="codeline" data-linenumber="334"><td class="num" id="LN334">334</td><td class="line"> devices = g_hash_table_new (g_str_hash, g_str_equal);</td></tr> +<tr class="codeline" data-linenumber="335"><td class="num" id="LN335">335</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="336"><td class="num" id="LN336">336</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="337"><td class="num" id="LN337">337</td><td class="line"> info->id = <span class='macro'>g_strdup (id)<span class='macro_popup'>g_strdup_inline (id)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="338"><td class="num" id="LN338">338</td><td class="line"> info->path = <span class='macro'>g_strdup (key)<span class='macro_popup'>g_strdup_inline (key)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="339"><td class="num" id="LN339">339</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="340"><td class="num" id="LN340">340</td><td class="line"> <span class='comment'>/* temp in K</span></td></tr> +<tr class="codeline" data-linenumber="341"><td class="num" id="LN341">341</td><td class="line"> <span class='comment'>* this could be left at 0.0, 2 seconds later it will be refreshed anyway */</span></td></tr> +<tr class="codeline" data-linenumber="342"><td class="num" id="LN342">342</td><td class="line"> info->temp = (gdouble) temp - 273.15;</td></tr> +<tr class="codeline" data-linenumber="343"><td class="num" id="LN343">343</td><td class="line"> g_hash_table_insert (devices, info->id, info);</td></tr> +<tr class="codeline" data-linenumber="344"><td class="num" id="LN344">344</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="345"><td class="num" id="LN345">345</td><td class="line"> <span class='comment'>/* Write the sensor data */</span></td></tr> +<tr class="codeline" data-linenumber="346"><td class="num" id="LN346">346</td><td class="line"> sensors_applet_plugin_add_sensor (sensors,</td></tr> +<tr class="codeline" data-linenumber="347"><td class="num" id="LN347">347</td><td class="line"> id,</td></tr> +<tr class="codeline" data-linenumber="348"><td class="num" id="LN348">348</td><td class="line"> <span class='string_literal'>"Disk Temperature"</span>,</td></tr> +<tr class="codeline" data-linenumber="349"><td class="num" id="LN349">349</td><td class="line"> model,</td></tr> +<tr class="codeline" data-linenumber="350"><td class="num" id="LN350">350</td><td class="line"> TEMP_SENSOR,</td></tr> +<tr class="codeline" data-linenumber="351"><td class="num" id="LN351">351</td><td class="line"> <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="352"><td class="num" id="LN352">352</td><td class="line"> HDD_ICON,</td></tr> +<tr class="codeline" data-linenumber="353"><td class="num" id="LN353">353</td><td class="line"> <span class='macro'>DEFAULT_GRAPH_COLOR<span class='macro_popup'>"#ff0000"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="354"><td class="num" id="LN354">354</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="355"><td class="num" id="LN355">355</td><td class="line"> g_debug (<span class='string_literal'>"Added %s"</span>, id);</td></tr> +<tr class="codeline" data-linenumber="356"><td class="num" id="LN356">356</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="357"><td class="num" id="LN357">357</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="358"><td class="num" id="LN358">358</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Added %s"</span>, id);</td></tr> +<tr class="codeline" data-linenumber="359"><td class="num" id="LN359">359</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="360"><td class="num" id="LN360">360</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="361"><td class="num" id="LN361">361</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="362"><td class="num" id="LN362">362</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="363"><td class="num" id="LN363">363</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="364"><td class="num" id="LN364">364</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"No temp data for device: %s\n"</span>, key);</td></tr> +<tr class="codeline" data-linenumber="365"><td class="num" id="LN365">365</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="366"><td class="num" id="LN366">366</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="367"><td class="num" id="LN367">367</td><td class="line"> g_debug (<span class='string_literal'>"No temp data for device: %s\n"</span>, key);</td></tr> +<tr class="codeline" data-linenumber="368"><td class="num" id="LN368">368</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="369"><td class="num" id="LN369">369</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="370"><td class="num" id="LN370">370</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="371"><td class="num" id="LN371">371</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"b4 free1"</span>);</td></tr> +<tr class="codeline" data-linenumber="372"><td class="num" id="LN372">372</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="373"><td class="num" id="LN373">373</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="374"><td class="num" id="LN374">374</td><td class="line"> g_free (id);</td></tr> +<tr class="codeline" data-linenumber="375"><td class="num" id="LN375">375</td><td class="line"> g_free (model);</td></tr> +<tr class="codeline" data-linenumber="376"><td class="num" id="LN376">376</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="377"><td class="num" id="LN377">377</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="378"><td class="num" id="LN378">378</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="379"><td class="num" id="LN379">379</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="380"><td class="num" id="LN380">380</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"b4 free2"</span>);</td></tr> +<tr class="codeline" data-linenumber="381"><td class="num" id="LN381">381</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="382"><td class="num" id="LN382">382</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="383"><td class="num" id="LN383">383</td><td class="line"> <span class='comment'>/* free propdict, propdict2</span></td></tr> +<tr class="codeline" data-linenumber="384"><td class="num" id="LN384">384</td><td class="line"> <span class='comment'>* g_variant_dict_unref() may not work a few times, gives error</span></td></tr> +<tr class="codeline" data-linenumber="385"><td class="num" id="LN385">385</td><td class="line"> <span class='comment'>* this one seems to do fine */</span></td></tr> +<tr class="codeline" data-linenumber="386"><td class="num" id="LN386">386</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict) {g_variant_unref (propdict);}</td></tr> +<tr class="codeline" data-linenumber="387"><td class="num" id="LN387">387</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict2) {g_variant_unref (propdict2);}</td></tr> +<tr class="codeline" data-linenumber="388"><td class="num" id="LN388">388</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="389"><td class="num" id="LN389">389</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="390"><td class="num" id="LN390">390</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"b4 free3"</span>);</td></tr> +<tr class="codeline" data-linenumber="391"><td class="num" id="LN391">391</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="392"><td class="num" id="LN392">392</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="393"><td class="num" id="LN393">393</td><td class="line"> g_free (key);</td></tr> +<tr class="codeline" data-linenumber="394"><td class="num" id="LN394">394</td><td class="line"> g_variant_unref (value);</td></tr> +<tr class="codeline" data-linenumber="395"><td class="num" id="LN395">395</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="396"><td class="num" id="LN396">396</td><td class="line"> } <span class='comment'>/* end of while loop */</span></td></tr> +<tr class="codeline" data-linenumber="397"><td class="num" id="LN397">397</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="398"><td class="num" id="LN398">398</td><td class="line"> g_variant_unref (managed_objects);</td></tr> +<tr class="codeline" data-linenumber="399"><td class="num" id="LN399">399</td><td class="line"> <span class='macro'>g_clear_object (&proxy)<span class='macro_popup'>do { _Static_assert (sizeof *((&proxy)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&proxy<br>))) _pp = ((&proxy)); __typeof__ (*((&proxy))) _ptr =<br> *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref) (_ptr); }<br> while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="400"><td class="num" id="LN400">400</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == devices) {</td></tr> +<tr class="codeline" data-linenumber="401"><td class="num" id="LN401">401</td><td class="line"> <span class='macro'>g_clear_object (&connection)<span class='macro_popup'>do { _Static_assert (sizeof *((&connection)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&connection<br>))) _pp = ((&connection)); __typeof__ (*((&connection<br>))) _ptr = *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref<br>) (_ptr); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="402"><td class="num" id="LN402">402</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="403"><td class="num" id="LN403">403</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="404"><td class="num" id="LN404">404</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="405"><td class="num" id="LN405">405</td><td class="line"><span class='comment'>/* this function is called every refresh cycle */</span></td></tr> +<tr class="codeline" data-linenumber="406"><td class="num" id="LN406">406</td><td class="line"><span class='keyword'>static</span> gdouble udisks2_plugin_get_sensor_value (<span class='keyword'>const</span> gchar *path,</td></tr> +<tr class="codeline" data-linenumber="407"><td class="num" id="LN407">407</td><td class="line"> <span class='keyword'>const</span> gchar *id,</td></tr> +<tr class="codeline" data-linenumber="408"><td class="num" id="LN408">408</td><td class="line"> SensorType type,</td></tr> +<tr class="codeline" data-linenumber="409"><td class="num" id="LN409">409</td><td class="line"> GError **error) {</td></tr> +<tr class="codeline" data-linenumber="410"><td class="num" id="LN410">410</td><td class="line"> DevInfo *info = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="411"><td class="num" id="LN411">411</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="412"><td class="num" id="LN412">412</td><td class="line"> <span class='comment'>/* get device stuct from data store */</span></td></tr> +<tr class="codeline" data-linenumber="413"><td class="num" id="LN413">413</td><td class="line"> info = (DevInfo *) g_hash_table_lookup (devices, path);</td></tr> +<tr class="codeline" data-linenumber="414"><td class="num" id="LN414">414</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == info) {</td></tr> +<tr class="codeline" data-linenumber="415"><td class="num" id="LN415">415</td><td class="line"> g_set_error (error, <span class='macro'>SENSORS_APPLET_PLUGIN_ERROR<span class='macro_popup'>(sensors_applet_plugin_error_quark())</span></span>, 0, <span class='string_literal'>"Error finding disk with path %s"</span>, path);</td></tr> +<tr class="codeline" data-linenumber="416"><td class="num" id="LN416">416</td><td class="line"> <span class='keyword'>return</span> 0.0;</td></tr> +<tr class="codeline" data-linenumber="417"><td class="num" id="LN417">417</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="418"><td class="num" id="LN418">418</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="419"><td class="num" id="LN419">419</td><td class="line"> <span class='keyword'>if</span> (info->error) {</td></tr> +<tr class="codeline" data-linenumber="420"><td class="num" id="LN420">420</td><td class="line"> *error = info->error;</td></tr> +<tr class="codeline" data-linenumber="421"><td class="num" id="LN421">421</td><td class="line"> info->error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="422"><td class="num" id="LN422">422</td><td class="line"> <span class='keyword'>return</span> 0.0;</td></tr> +<tr class="codeline" data-linenumber="423"><td class="num" id="LN423">423</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="424"><td class="num" id="LN424">424</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="425"><td class="num" id="LN425">425</td><td class="line"> <span class='comment'>/* refresh device temp */</span></td></tr> +<tr class="codeline" data-linenumber="426"><td class="num" id="LN426">426</td><td class="line"> update_device (info);</td></tr> +<tr class="codeline" data-linenumber="427"><td class="num" id="LN427">427</td><td class="line"> <span class='keyword'>return</span> info->temp;</td></tr> +<tr class="codeline" data-linenumber="428"><td class="num" id="LN428">428</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="429"><td class="num" id="LN429">429</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="430"><td class="num" id="LN430">430</td><td class="line"><span class='comment'>/* API functions */</span></td></tr> +<tr class="codeline" data-linenumber="431"><td class="num" id="LN431">431</td><td class="line"><span class='keyword'>const</span> gchar *sensors_applet_plugin_name (<span class='keyword'>void</span>) {</td></tr> +<tr class="codeline" data-linenumber="432"><td class="num" id="LN432">432</td><td class="line"> <span class='keyword'>return</span> plugin_name;</td></tr> +<tr class="codeline" data-linenumber="433"><td class="num" id="LN433">433</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="434"><td class="num" id="LN434">434</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="435"><td class="num" id="LN435">435</td><td class="line"><span class='keyword'>static</span> GList *udisks2_plugin_init (<span class='keyword'>void</span>) {</td></tr> +<tr class="codeline" data-linenumber="436"><td class="num" id="LN436">436</td><td class="line"> GList *sensors = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="437"><td class="num" id="LN437">437</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="438"><td class="num" id="LN438">438</td><td class="line"> udisks2_plugin_get_sensors (&sensors);</td></tr> +<tr class="codeline" data-linenumber="439"><td class="num" id="LN439">439</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="440"><td class="num" id="LN440">440</td><td class="line"> <span class='keyword'>return</span> sensors;</td></tr> +<tr class="codeline" data-linenumber="441"><td class="num" id="LN441">441</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="442"><td class="num" id="LN442">442</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="443"><td class="num" id="LN443">443</td><td class="line">GList *sensors_applet_plugin_init (<span class='keyword'>void</span>) {</td></tr> +<tr class="codeline" data-linenumber="444"><td class="num" id="LN444">444</td><td class="line"> <span class='keyword'>return</span> udisks2_plugin_init ();</td></tr> +<tr class="codeline" data-linenumber="445"><td class="num" id="LN445">445</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="446"><td class="num" id="LN446">446</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="447"><td class="num" id="LN447">447</td><td class="line">gdouble sensors_applet_plugin_get_sensor_value (<span class='keyword'>const</span> gchar *path,</td></tr> +<tr class="codeline" data-linenumber="448"><td class="num" id="LN448">448</td><td class="line"> <span class='keyword'>const</span> gchar *id,</td></tr> +<tr class="codeline" data-linenumber="449"><td class="num" id="LN449">449</td><td class="line"> SensorType type,</td></tr> +<tr class="codeline" data-linenumber="450"><td class="num" id="LN450">450</td><td class="line"> GError **error) {</td></tr> +<tr class="codeline" data-linenumber="451"><td class="num" id="LN451">451</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="452"><td class="num" id="LN452">452</td><td class="line"> <span class='keyword'>return</span> udisks2_plugin_get_sensor_value (path, id, type, error);</td></tr> +<tr class="codeline" data-linenumber="453"><td class="num" id="LN453">453</td><td class="line">}</td></tr> +</table></body></html> diff --git a/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-e082ac.html b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-e082ac.html new file mode 100644 index 0000000..c3a515b --- /dev/null +++ b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-e082ac.html @@ -0,0 +1,1133 @@ +<!doctype html> +<html> +<head> +<title>udisks2-plugin.c</title> + +<style type="text/css"> +body { color:#000000; background-color:#ffffff } +body { font-family:Helvetica, sans-serif; font-size:10pt } +h1 { font-size:14pt } +.FileName { margin-top: 5px; margin-bottom: 5px; display: inline; } +.FileNav { margin-left: 5px; margin-right: 5px; display: inline; } +.FileNav a { text-decoration:none; font-size: larger; } +.divider { margin-top: 30px; margin-bottom: 30px; height: 15px; } +.divider { background-color: gray; } +.code { border-collapse:collapse; width:100%; } +.code { font-family: "Monospace", monospace; font-size:10pt } +.code { line-height: 1.2em } +.comment { color: green; font-style: oblique } +.keyword { color: blue } +.string_literal { color: red } +.directive { color: darkmagenta } + +/* Macros and variables could have pop-up notes hidden by default. + - Macro pop-up: expansion of the macro + - Variable pop-up: value (table) of the variable */ +.macro_popup, .variable_popup { display: none; } + +/* Pop-up appears on mouse-hover event. */ +.macro:hover .macro_popup, .variable:hover .variable_popup { + display: block; + padding: 2px; + -webkit-border-radius:5px; + -webkit-box-shadow:1px 1px 7px #000; + border-radius:5px; + box-shadow:1px 1px 7px #000; + position: absolute; + top: -1em; + left:10em; + z-index: 1 +} + +.macro_popup { + border: 2px solid red; + background-color:#FFF0F0; + font-weight: normal; +} + +.variable_popup { + border: 2px solid blue; + background-color:#F0F0FF; + font-weight: bold; + font-family: Helvetica, sans-serif; + font-size: 9pt; +} + +/* Pop-up notes needs a relative position as a base where they pops up. */ +.macro, .variable { + background-color: PaleGoldenRod; + position: relative; +} +.macro { color: DarkMagenta; } + +#tooltiphint { + position: fixed; + width: 50em; + margin-left: -25em; + left: 50%; + padding: 10px; + border: 1px solid #b0b0b0; + border-radius: 2px; + box-shadow: 1px 1px 7px black; + background-color: #c0c0c0; + z-index: 2; +} + +.num { width:2.5em; padding-right:2ex; background-color:#eeeeee } +.num { text-align:right; font-size:8pt } +.num { color:#444444 } +.line { padding-left: 1ex; border-left: 3px solid #ccc } +.line { white-space: pre } +.msg { -webkit-box-shadow:1px 1px 7px #000 } +.msg { box-shadow:1px 1px 7px #000 } +.msg { -webkit-border-radius:5px } +.msg { border-radius:5px } +.msg { font-family:Helvetica, sans-serif; font-size:8pt } +.msg { float:left } +.msg { position:relative } +.msg { padding:0.25em 1ex 0.25em 1ex } +.msg { margin-top:10px; margin-bottom:10px } +.msg { font-weight:bold } +.msg { max-width:60em; word-wrap: break-word; white-space: pre-wrap } +.msgT { padding:0x; spacing:0x } +.msgEvent { background-color:#fff8b4; color:#000000 } +.msgControl { background-color:#bbbbbb; color:#000000 } +.msgNote { background-color:#ddeeff; color:#000000 } +.mrange { background-color:#dfddf3 } +.mrange { border-bottom:1px solid #6F9DBE } +.PathIndex { font-weight: bold; padding:0px 5px; margin-right:5px; } +.PathIndex { -webkit-border-radius:8px } +.PathIndex { border-radius:8px } +.PathIndexEvent { background-color:#bfba87 } +.PathIndexControl { background-color:#8c8c8c } +.PathIndexPopUp { background-color: #879abc; } +.PathNav a { text-decoration:none; font-size: larger } +.CodeInsertionHint { font-weight: bold; background-color: #10dd10 } +.CodeRemovalHint { background-color:#de1010 } +.CodeRemovalHint { border-bottom:1px solid #6F9DBE } +.msg.selected{ background-color:orange !important; } + +table.simpletable { + padding: 5px; + font-size:12pt; + margin:20px; + border-collapse: collapse; border-spacing: 0px; +} +td.rowname { + text-align: right; + vertical-align: top; + font-weight: bold; + color:#444444; + padding-right:2ex; +} + +/* Hidden text. */ +input.spoilerhider + label { + cursor: pointer; + text-decoration: underline; + display: block; +} +input.spoilerhider { + display: none; +} +input.spoilerhider ~ .spoiler { + overflow: hidden; + margin: 10px auto 0; + height: 0; + opacity: 0; +} +input.spoilerhider:checked + label + .spoiler{ + height: auto; + opacity: 1; +} +</style> +</head> +<body> +<!-- BUGDESC Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption --> + +<!-- BUGTYPE Cast from non-struct type to struct type --> + +<!-- BUGCATEGORY Logic error --> + +<!-- BUGFILE /rootdir/plugins/udisks2/udisks2-plugin.c --> + +<!-- FILENAME udisks2-plugin.c --> + +<!-- FUNCTIONNAME udisks2_plugin_get_sensors --> + +<!-- ISSUEHASHCONTENTOFLINEINCONTEXT e082acd9886d23492e288a04bb5a1986 --> + +<!-- BUGLINE 318 --> + +<!-- BUGCOLUMN 102 --> + +<!-- BUGPATHLENGTH 1 --> + +<!-- BUGMETAEND --> +<!-- REPORTHEADER --> +<h3>Bug Summary</h3> +<table class="simpletable"> +<tr><td class="rowname">File:</td><td>plugins/udisks2/udisks2-plugin.c</td></tr> +<tr><td class="rowname">Warning:</td><td><a href="#EndPath">line 318, column 102</a><br />Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption</td></tr> + +</table> +<!-- REPORTSUMMARYEXTRA --> +<h3>Annotated Source Code</h3> +<p>Press <a href="#" onclick="toggleHelp(); return false;">'?'</a> + to see keyboard shortcuts</p> +<input type="checkbox" class="spoilerhider" id="showinvocation" /> +<label for="showinvocation" >Show analyzer invocation</label> +<div class="spoiler">clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name udisks2-plugin.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/plugins/udisks2 -resource-dir /usr/lib64/clang/16 -D HAVE_CONFIG_H -I . -I ../../sensors-applet -D MATELOCALEDIR="/usr/local/share/locale/" -D G_LOG_DOMAIN="sensors-applet" -D PIXMAPS_DIR="/usr/local/share/pixmaps/mate-sensors-applet/" -D DATADIR="/usr/local/share" -D LIBDIR="/usr/local/lib" -D SYSCONFDIR="/usr/local/etc" -D PREFIX="/usr/local" -I ../.. -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -D PIC -internal-isystem /usr/lib64/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/plugins/udisks2 -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2023-06-12-021133-6157-1 -x c udisks2-plugin.c +</div> +<div id='tooltiphint' hidden="true"> + <p>Keyboard shortcuts: </p> + <ul> + <li>Use 'j/k' keys for keyboard navigation</li> + <li>Use 'Shift+S' to show/hide relevant lines</li> + <li>Use '?' to toggle this window</li> + </ul> + <a href="#" onclick="toggleHelp(); return false;">Close</a> +</div> +<script type='text/javascript'> +var relevant_lines = {"1": {"318": 1}}; + +var filterCounterexample = function (hide) { + var tables = document.getElementsByClassName("code"); + for (var t=0; t<tables.length; t++) { + var table = tables[t]; + var file_id = table.getAttribute("data-fileid"); + var lines_in_fid = relevant_lines[file_id]; + if (!lines_in_fid) { + lines_in_fid = {}; + } + var lines = table.getElementsByClassName("codeline"); + for (var i=0; i<lines.length; i++) { + var el = lines[i]; + var lineNo = el.getAttribute("data-linenumber"); + if (!lines_in_fid[lineNo]) { + if (hide) { + el.setAttribute("hidden", ""); + } else { + el.removeAttribute("hidden"); + } + } + } + } +} + +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + // SHIFT + S + if (event.shiftKey && event.keyCode == 83) { + var checked = document.getElementsByName("showCounterexample")[0].checked; + filterCounterexample(!checked); + document.getElementsByName("showCounterexample")[0].click(); + } else { + return; + } + event.preventDefault(); +}, true); + +document.addEventListener("DOMContentLoaded", function() { + document.querySelector('input[name="showCounterexample"]').onchange= + function (event) { + filterCounterexample(this.checked); + }; +}); +</script> + +<form> + <input type="checkbox" name="showCounterexample" id="showCounterexample" /> + <label for="showCounterexample"> + Show only relevant lines + </label> + <input type="checkbox" name="showArrows" + id="showArrows" style="margin-left: 10px" /> + <label for="showArrows"> + Show control flow arrows + </label> +</form> + +<script type='text/javascript'> +// Return range of numbers from a range [lower, upper). +function range(lower, upper) { + var array = []; + for (var i = lower; i <= upper; ++i) { + array.push(i); + } + return array; +} + +var getRelatedArrowIndices = function(pathId) { + // HTML numeration of events is a bit different than it is in the path. + // Everything is rotated one step to the right, so the last element + // (error diagnostic) has index 0. + if (pathId == 0) { + // arrowIndices has at least 2 elements + pathId = arrowIndices.length - 1; + } + + return range(arrowIndices[pathId], arrowIndices[pathId - 1]); +} + +var highlightArrowsForSelectedEvent = function() { + const selectedNum = findNum(); + const arrowIndicesToHighlight = getRelatedArrowIndices(selectedNum); + arrowIndicesToHighlight.forEach((index) => { + var arrow = document.querySelector("#arrow" + index); + if(arrow) { + classListAdd(arrow, "selected") + } + }); +} + +var getAbsoluteBoundingRect = function(element) { + const relative = element.getBoundingClientRect(); + return { + left: relative.left + window.pageXOffset, + right: relative.right + window.pageXOffset, + top: relative.top + window.pageYOffset, + bottom: relative.bottom + window.pageYOffset, + height: relative.height, + width: relative.width + }; +} + +var drawArrow = function(index) { + // This function is based on the great answer from SO: + // https://stackoverflow.com/a/39575674/11582326 + var start = document.querySelector("#start" + index); + var end = document.querySelector("#end" + index); + var arrow = document.querySelector("#arrow" + index); + + var startRect = getAbsoluteBoundingRect(start); + var endRect = getAbsoluteBoundingRect(end); + + // It is an arrow from a token to itself, no need to visualize it. + if (startRect.top == endRect.top && + startRect.left == endRect.left) + return; + + // Each arrow is a very simple Bézier curve, with two nodes and + // two handles. So, we need to calculate four points in the window: + // * start node + var posStart = { x: 0, y: 0 }; + // * end node + var posEnd = { x: 0, y: 0 }; + // * handle for the start node + var startHandle = { x: 0, y: 0 }; + // * handle for the end node + var endHandle = { x: 0, y: 0 }; + // One can visualize it as follows: + // + // start handle + // / + // X"""_.-""""X + // .' \ + // / start node + // | + // | + // | end node + // \ / + // `->X + // X-' + // \ + // end handle + // + // NOTE: (0, 0) is the top left corner of the window. + + // We have 3 similar, but still different scenarios to cover: + // + // 1. Two tokens on different lines. + // -xxx + // / + // \ + // -> xxx + // In this situation, we draw arrow on the left curving to the left. + // 2. Two tokens on the same line, and the destination is on the right. + // ____ + // / \ + // / V + // xxx xxx + // In this situation, we draw arrow above curving upwards. + // 3. Two tokens on the same line, and the destination is on the left. + // xxx xxx + // ^ / + // \____/ + // In this situation, we draw arrow below curving downwards. + const onDifferentLines = startRect.top <= endRect.top - 5 || + startRect.top >= endRect.top + 5; + const leftToRight = startRect.left < endRect.left; + + // NOTE: various magic constants are chosen empirically for + // better positioning and look + if (onDifferentLines) { + // Case #1 + const topToBottom = startRect.top < endRect.top; + posStart.x = startRect.left - 1; + // We don't want to start it at the top left corner of the token, + // it doesn't feel like this is where the arrow comes from. + // For this reason, we start it in the middle of the left side + // of the token. + posStart.y = startRect.top + startRect.height / 2; + + // End node has arrow head and we give it a bit more space. + posEnd.x = endRect.left - 4; + posEnd.y = endRect.top; + + // Utility object with x and y offsets for handles. + var curvature = { + // We want bottom-to-top arrow to curve a bit more, so it doesn't + // overlap much with top-to-bottom curves (much more frequent). + x: topToBottom ? 15 : 25, + y: Math.min((posEnd.y - posStart.y) / 3, 10) + } + + // When destination is on the different line, we can make a + // curvier arrow because we have space for it. + // So, instead of using + // + // startHandle.x = posStart.x - curvature.x + // endHandle.x = posEnd.x - curvature.x + // + // We use the leftmost of these two values for both handles. + startHandle.x = Math.min(posStart.x, posEnd.x) - curvature.x; + endHandle.x = startHandle.x; + + // Curving downwards from the start node... + startHandle.y = posStart.y + curvature.y; + // ... and upwards from the end node. + endHandle.y = posEnd.y - curvature.y; + + } else if (leftToRight) { + // Case #2 + // Starting from the top right corner... + posStart.x = startRect.right - 1; + posStart.y = startRect.top; + + // ...and ending at the top left corner of the end token. + posEnd.x = endRect.left + 1; + posEnd.y = endRect.top - 1; + + // Utility object with x and y offsets for handles. + var curvature = { + x: Math.min((posEnd.x - posStart.x) / 3, 15), + y: 5 + } + + // Curving to the right... + startHandle.x = posStart.x + curvature.x; + // ... and upwards from the start node. + startHandle.y = posStart.y - curvature.y; + + // And to the left... + endHandle.x = posEnd.x - curvature.x; + // ... and upwards from the end node. + endHandle.y = posEnd.y - curvature.y; + + } else { + // Case #3 + // Starting from the bottom right corner... + posStart.x = startRect.right; + posStart.y = startRect.bottom; + + // ...and ending also at the bottom right corner, but of the end token. + posEnd.x = endRect.right - 1; + posEnd.y = endRect.bottom + 1; + + // Utility object with x and y offsets for handles. + var curvature = { + x: Math.min((posStart.x - posEnd.x) / 3, 15), + y: 5 + } + + // Curving to the left... + startHandle.x = posStart.x - curvature.x; + // ... and downwards from the start node. + startHandle.y = posStart.y + curvature.y; + + // And to the right... + endHandle.x = posEnd.x + curvature.x; + // ... and downwards from the end node. + endHandle.y = posEnd.y + curvature.y; + } + + // Put it all together into a path. + // More information on the format: + // https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths + var pathStr = "M" + posStart.x + "," + posStart.y + " " + + "C" + startHandle.x + "," + startHandle.y + " " + + endHandle.x + "," + endHandle.y + " " + + posEnd.x + "," + posEnd.y; + + arrow.setAttribute("d", pathStr); +}; + +var drawArrows = function() { + const numOfArrows = document.querySelectorAll("path[id^=arrow]").length; + for (var i = 0; i < numOfArrows; ++i) { + drawArrow(i); + } +} + +var toggleArrows = function(event) { + const arrows = document.querySelector("#arrows"); + if (event.target.checked) { + arrows.setAttribute("visibility", "visible"); + } else { + arrows.setAttribute("visibility", "hidden"); + } +} + +window.addEventListener("resize", drawArrows); +document.addEventListener("DOMContentLoaded", function() { + // Whenever we show invocation, locations change, i.e. we + // need to redraw arrows. + document + .querySelector('input[id="showinvocation"]') + .addEventListener("click", drawArrows); + // Hiding irrelevant lines also should cause arrow rerender. + document + .querySelector('input[name="showCounterexample"]') + .addEventListener("change", drawArrows); + document + .querySelector('input[name="showArrows"]') + .addEventListener("change", toggleArrows); + drawArrows(); + // Default highlighting for the last event. + highlightArrowsForSelectedEvent(); +}); +</script> + +<script type='text/javascript'> +var digitMatcher = new RegExp("[0-9]+"); + +var querySelectorAllArray = function(selector) { + return Array.prototype.slice.call( + document.querySelectorAll(selector)); +} + +document.addEventListener("DOMContentLoaded", function() { + querySelectorAllArray(".PathNav > a").forEach( + function(currentValue, currentIndex) { + var hrefValue = currentValue.getAttribute("href"); + currentValue.onclick = function() { + scrollTo(document.querySelector(hrefValue)); + return false; + }; + }); +}); + +var findNum = function() { + var s = document.querySelector(".msg.selected"); + if (!s || s.id == "EndPath") { + return 0; + } + var out = parseInt(digitMatcher.exec(s.id)[0]); + return out; +}; + +var classListAdd = function(el, theClass) { + if(!el.className.baseVal) + el.className += " " + theClass; + else + el.className.baseVal += " " + theClass; +}; + +var classListRemove = function(el, theClass) { + var className = (!el.className.baseVal) ? + el.className : el.className.baseVal; + className = className.replace(" " + theClass, ""); + if(!el.className.baseVal) + el.className = className; + else + el.className.baseVal = className; +}; + +var scrollTo = function(el) { + querySelectorAllArray(".selected").forEach(function(s) { + classListRemove(s, "selected"); + }); + classListAdd(el, "selected"); + window.scrollBy(0, el.getBoundingClientRect().top - + (window.innerHeight / 2)); + highlightArrowsForSelectedEvent(); +}; + +var move = function(num, up, numItems) { + if (num == 1 && up || num == numItems - 1 && !up) { + return 0; + } else if (num == 0 && up) { + return numItems - 1; + } else if (num == 0 && !up) { + return 1 % numItems; + } + return up ? num - 1 : num + 1; +} + +var numToId = function(num) { + if (num == 0) { + return document.getElementById("EndPath") + } + return document.getElementById("Path" + num); +}; + +var navigateTo = function(up) { + var numItems = document.querySelectorAll( + ".line > .msgEvent, .line > .msgControl").length; + var currentSelected = findNum(); + var newSelected = move(currentSelected, up, numItems); + var newEl = numToId(newSelected, numItems); + + // Scroll element into center. + scrollTo(newEl); +}; + +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + // key 'j' + if (event.keyCode == 74) { + navigateTo(/*up=*/false); + // key 'k' + } else if (event.keyCode == 75) { + navigateTo(/*up=*/true); + } else { + return; + } + event.preventDefault(); +}, true); +</script> + +<script type='text/javascript'> + +var toggleHelp = function() { + var hint = document.querySelector("#tooltiphint"); + var attributeName = "hidden"; + if (hint.hasAttribute(attributeName)) { + hint.removeAttribute(attributeName); + } else { + hint.setAttribute("hidden", "true"); + } +}; +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + if (event.key == "?") { + toggleHelp(); + } else { + return; + } + event.preventDefault(); +}); +</script> + +<style type="text/css"> + svg { + position:absolute; + top:0; + left:0; + height:100%; + width:100%; + pointer-events: none; + overflow: visible + } + .arrow { + stroke-opacity: 0.2; + stroke-width: 1; + marker-end: url(#arrowhead); + } + + .arrow.selected { + stroke-opacity: 0.6; + stroke-width: 2; + marker-end: url(#arrowheadSelected); + } + + .arrowhead { + orient: auto; + stroke: none; + opacity: 0.6; + fill: blue; + } +</style> +<svg xmlns="http://www.w3.org/2000/svg"> + <defs> + <marker id="arrowheadSelected" class="arrowhead" opacity="0.6" + viewBox="0 0 10 10" refX="3" refY="5" + markerWidth="4" markerHeight="4"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + <marker id="arrowhead" class="arrowhead" opacity="0.2" + viewBox="0 0 10 10" refX="3" refY="5" + markerWidth="4" markerHeight="4"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + </defs> + <g id="arrows" fill="none" stroke="blue" visibility="hidden"> + + </g> +</svg> +<script type='text/javascript'> +const arrowIndices = [ 0,0 ] +</script> +<table class="code" data-fileid="1"> +<tr class="codeline" data-linenumber="1"><td class="num" id="LN1">1</td><td class="line"><span class='comment'>/*</span></td></tr> +<tr class="codeline" data-linenumber="2"><td class="num" id="LN2">2</td><td class="line"> <span class='comment'>* Copyright (C) 2017 info-cppsp <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="3"><td class="num" id="LN3">3</td><td class="line"> <span class='comment'>* Copyright (C) 2005-2009 Alex Murray <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="4"><td class="num" id="LN4">4</td><td class="line"> <span class='comment'>* Copyright (C) 2012-2021 MATE Developers</span></td></tr> +<tr class="codeline" data-linenumber="5"><td class="num" id="LN5">5</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="6"><td class="num" id="LN6">6</td><td class="line"> <span class='comment'>* This program is free software; you can redistribute it and/or modify</span></td></tr> +<tr class="codeline" data-linenumber="7"><td class="num" id="LN7">7</td><td class="line"> <span class='comment'>* it under the terms of the GNU General Public License as published by</span></td></tr> +<tr class="codeline" data-linenumber="8"><td class="num" id="LN8">8</td><td class="line"> <span class='comment'>* the Free Software Foundation; either version 2 of the License, or</span></td></tr> +<tr class="codeline" data-linenumber="9"><td class="num" id="LN9">9</td><td class="line"> <span class='comment'>* (at your option) any later version.</span></td></tr> +<tr class="codeline" data-linenumber="10"><td class="num" id="LN10">10</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="11"><td class="num" id="LN11">11</td><td class="line"> <span class='comment'>* This program is distributed in the hope that it will be useful,</span></td></tr> +<tr class="codeline" data-linenumber="12"><td class="num" id="LN12">12</td><td class="line"> <span class='comment'>* but WITHOUT ANY WARRANTY; without even the implied warranty of</span></td></tr> +<tr class="codeline" data-linenumber="13"><td class="num" id="LN13">13</td><td class="line"> <span class='comment'>* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></td></tr> +<tr class="codeline" data-linenumber="14"><td class="num" id="LN14">14</td><td class="line"> <span class='comment'>* GNU General Public License for more details.</span></td></tr> +<tr class="codeline" data-linenumber="15"><td class="num" id="LN15">15</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="16"><td class="num" id="LN16">16</td><td class="line"> <span class='comment'>* You should have received a copy of the GNU General Public License</span></td></tr> +<tr class="codeline" data-linenumber="17"><td class="num" id="LN17">17</td><td class="line"> <span class='comment'>* along with this program; if not, write to the Free Software</span></td></tr> +<tr class="codeline" data-linenumber="18"><td class="num" id="LN18">18</td><td class="line"> <span class='comment'>* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</span></td></tr> +<tr class="codeline" data-linenumber="19"><td class="num" id="LN19">19</td><td class="line"> <span class='comment'>*/</span></td></tr> +<tr class="codeline" data-linenumber="20"><td class="num" id="LN20">20</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="21"><td class="num" id="LN21">21</td><td class="line"><span class='comment'>/*</span></td></tr> +<tr class="codeline" data-linenumber="22"><td class="num" id="LN22">22</td><td class="line"><span class='comment'>Udisks2 plugin for the mate-sensors-applet</span></td></tr> +<tr class="codeline" data-linenumber="23"><td class="num" id="LN23">23</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="24"><td class="num" id="LN24">24</td><td class="line"><span class='comment'>written using the structure and code of the previous version</span></td></tr> +<tr class="codeline" data-linenumber="25"><td class="num" id="LN25">25</td><td class="line"><span class='comment'>from Pramod Dematagoda <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="26"><td class="num" id="LN26">26</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="27"><td class="num" id="LN27">27</td><td class="line"><span class='comment'>dbus-glib documentation</span></td></tr> +<tr class="codeline" data-linenumber="28"><td class="num" id="LN28">28</td><td class="line"><span class='comment'>https://dbus.freedesktop.org/doc/dbus-glib/</span></td></tr> +<tr class="codeline" data-linenumber="29"><td class="num" id="LN29">29</td><td class="line"><span class='comment'>GDBUS documentation</span></td></tr> +<tr class="codeline" data-linenumber="30"><td class="num" id="LN30">30</td><td class="line"><span class='comment'>https://developer.gnome.org/gio/stable/index.html</span></td></tr> +<tr class="codeline" data-linenumber="31"><td class="num" id="LN31">31</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="32"><td class="num" id="LN32">32</td><td class="line"><span class='comment'>*/</span></td></tr> +<tr class="codeline" data-linenumber="33"><td class="num" id="LN33">33</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="34"><td class="num" id="LN34">34</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_CONFIG_H<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="35"><td class="num" id="LN35">35</td><td class="line"><span class='directive'>#include "config.h"</span></td></tr> +<tr class="codeline" data-linenumber="36"><td class="num" id="LN36">36</td><td class="line"><span class='directive'>#endif /* HAVE_CONFIG_H */</span></td></tr> +<tr class="codeline" data-linenumber="37"><td class="num" id="LN37">37</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="38"><td class="num" id="LN38">38</td><td class="line"><span class='directive'>#include <stdio.h></span></td></tr> +<tr class="codeline" data-linenumber="39"><td class="num" id="LN39">39</td><td class="line"><span class='directive'>#include <gio/gio.h></span></td></tr> +<tr class="codeline" data-linenumber="40"><td class="num" id="LN40">40</td><td class="line"><span class='directive'>#include "udisks2-plugin.h"</span></td></tr> +<tr class="codeline" data-linenumber="41"><td class="num" id="LN41">41</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="42"><td class="num" id="LN42">42</td><td class="line"><span class='comment'>/* remove // from next line for syslog debug */</span></td></tr> +<tr class="codeline" data-linenumber="43"><td class="num" id="LN43">43</td><td class="line"><span class='comment'>//#define UD2PD 1</span></td></tr> +<tr class="codeline" data-linenumber="44"><td class="num" id="LN44">44</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="45"><td class="num" id="LN45">45</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="46"><td class="num" id="LN46">46</td><td class="line"><span class='directive'>#include <syslog.h></span></td></tr> +<tr class="codeline" data-linenumber="47"><td class="num" id="LN47">47</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="48"><td class="num" id="LN48">48</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="49"><td class="num" id="LN49">49</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_BUS_NAME<span class='macro_popup'>"org.freedesktop.UDisks2"</span></span> "org.freedesktop.UDisks2"</span></td></tr> +<tr class="codeline" data-linenumber="50"><td class="num" id="LN50">50</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.DBus.ObjectManager"</span></span> "org.freedesktop.DBus.ObjectManager"</span></td></tr> +<tr class="codeline" data-linenumber="51"><td class="num" id="LN51">51</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_DEVICE_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive"</span></span> "org.freedesktop.UDisks2.Drive"</span></td></tr> +<tr class="codeline" data-linenumber="52"><td class="num" id="LN52">52</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_DEVICE_INTERFACE2_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive.Ata"</span></span> "org.freedesktop.UDisks2.Drive.Ata"</span></td></tr> +<tr class="codeline" data-linenumber="53"><td class="num" id="LN53">53</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="54"><td class="num" id="LN54">54</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_PROPERTIES_INTERFACE<span class='macro_popup'>"org.freedesktop.DBus.Properties"</span></span> "org.freedesktop.DBus.Properties"</span></td></tr> +<tr class="codeline" data-linenumber="55"><td class="num" id="LN55">55</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_OBJECT_PATH<span class='macro_popup'>"/org/freedesktop/UDisks2"</span></span> "/org/freedesktop/UDisks2"</span></td></tr> +<tr class="codeline" data-linenumber="56"><td class="num" id="LN56">56</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="57"><td class="num" id="LN57">57</td><td class="line"><span class='comment'>/* Info about a single sensor */</span></td></tr> +<tr class="codeline" data-linenumber="58"><td class="num" id="LN58">58</td><td class="line"><span class='keyword'>typedef</span> <span class='keyword'>struct</span> _DevInfo {</td></tr> +<tr class="codeline" data-linenumber="59"><td class="num" id="LN59">59</td><td class="line"> gchar *path;</td></tr> +<tr class="codeline" data-linenumber="60"><td class="num" id="LN60">60</td><td class="line"> gchar *id;</td></tr> +<tr class="codeline" data-linenumber="61"><td class="num" id="LN61">61</td><td class="line"> gdouble temp;</td></tr> +<tr class="codeline" data-linenumber="62"><td class="num" id="LN62">62</td><td class="line"> GDBusProxy *sensor_proxy; <span class='comment'>/* dbus object */</span></td></tr> +<tr class="codeline" data-linenumber="63"><td class="num" id="LN63">63</td><td class="line"> GError *error;</td></tr> +<tr class="codeline" data-linenumber="64"><td class="num" id="LN64">64</td><td class="line">} DevInfo;</td></tr> +<tr class="codeline" data-linenumber="65"><td class="num" id="LN65">65</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="66"><td class="num" id="LN66">66</td><td class="line"><span class='keyword'>const</span> gchar *plugin_name = <span class='string_literal'>"udisks2"</span>;</td></tr> +<tr class="codeline" data-linenumber="67"><td class="num" id="LN67">67</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="68"><td class="num" id="LN68">68</td><td class="line"><span class='comment'>/* a container for the devices found to have smart enabled */</span></td></tr> +<tr class="codeline" data-linenumber="69"><td class="num" id="LN69">69</td><td class="line">GHashTable *devices = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="70"><td class="num" id="LN70">70</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="71"><td class="num" id="LN71">71</td><td class="line"><span class='comment'>/* This is a global variable for convenience */</span></td></tr> +<tr class="codeline" data-linenumber="72"><td class="num" id="LN72">72</td><td class="line">GDBusConnection *connection = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="73"><td class="num" id="LN73">73</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="74"><td class="num" id="LN74">74</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> update_device (DevInfo *info) {</td></tr> +<tr class="codeline" data-linenumber="75"><td class="num" id="LN75">75</td><td class="line"> GError *error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="76"><td class="num" id="LN76">76</td><td class="line"> GVariant *tempgvar = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="77"><td class="num" id="LN77">77</td><td class="line"> GVariant *tempgvar2 = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="78"><td class="num" id="LN78">78</td><td class="line"> gdouble temp;</td></tr> +<tr class="codeline" data-linenumber="79"><td class="num" id="LN79">79</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="80"><td class="num" id="LN80">80</td><td class="line"> <span class='comment'>/* check valid input parameter */</span></td></tr> +<tr class="codeline" data-linenumber="81"><td class="num" id="LN81">81</td><td class="line"> <span class='macro'>g_return_if_fail (info != NULL)<span class='macro_popup'>do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_20<br>; if (info != ((void*)0)) _g_boolean_var_20 = 1; else _g_boolean_var_20<br> = 0; _g_boolean_var_20; }), 1))) { } else { g_return_if_fail_warning<br> ("sensors-applet", ((const char*) (__func__)), "info != NULL"<br>); return; } } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="82"><td class="num" id="LN82">82</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="83"><td class="num" id="LN83">83</td><td class="line"> <span class='comment'>/* check connection too */</span></td></tr> +<tr class="codeline" data-linenumber="84"><td class="num" id="LN84">84</td><td class="line"> <span class='macro'>g_return_if_fail (connection != NULL)<span class='macro_popup'>do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_21<br>; if (connection != ((void*)0)) _g_boolean_var_21 = 1; else _g_boolean_var_21<br> = 0; _g_boolean_var_21; }), 1))) { } else { g_return_if_fail_warning<br> ("sensors-applet", ((const char*) (__func__)), "connection != NULL"<br>); return; } } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="85"><td class="num" id="LN85">85</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="86"><td class="num" id="LN86">86</td><td class="line"> g_clear_error (&info->error);</td></tr> +<tr class="codeline" data-linenumber="87"><td class="num" id="LN87">87</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="88"><td class="num" id="LN88">88</td><td class="line"> <span class='comment'>/* check for sensor_proxy, which should exist at this point, make one if necessary and save it into DevInfo</span></td></tr> +<tr class="codeline" data-linenumber="89"><td class="num" id="LN89">89</td><td class="line"> <span class='comment'>* this is used to get the temp value the direct way */</span></td></tr> +<tr class="codeline" data-linenumber="90"><td class="num" id="LN90">90</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == info->sensor_proxy) {</td></tr> +<tr class="codeline" data-linenumber="91"><td class="num" id="LN91">91</td><td class="line"> info->sensor_proxy = g_dbus_proxy_new_sync (connection, G_DBUS_PROXY_FLAGS_NONE, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="92"><td class="num" id="LN92">92</td><td class="line"> <span class='macro'>UDISKS2_BUS_NAME<span class='macro_popup'>"org.freedesktop.UDisks2"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="93"><td class="num" id="LN93">93</td><td class="line"> info->path,</td></tr> +<tr class="codeline" data-linenumber="94"><td class="num" id="LN94">94</td><td class="line"> <span class='macro'>UDISKS2_PROPERTIES_INTERFACE<span class='macro_popup'>"org.freedesktop.DBus.Properties"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="95"><td class="num" id="LN95">95</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, &error);</td></tr> +<tr class="codeline" data-linenumber="96"><td class="num" id="LN96">96</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="97"><td class="num" id="LN97">97</td><td class="line"> <span class='comment'>/* check, just to be sure */</span></td></tr> +<tr class="codeline" data-linenumber="98"><td class="num" id="LN98">98</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == info->sensor_proxy) {</td></tr> +<tr class="codeline" data-linenumber="99"><td class="num" id="LN99">99</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="100"><td class="num" id="LN100">100</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="101"><td class="num" id="LN101">101</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Failed to get drive temperature 1"</span>);</td></tr> +<tr class="codeline" data-linenumber="102"><td class="num" id="LN102">102</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="103"><td class="num" id="LN103">103</td><td class="line"> g_debug (<span class='string_literal'>"Failed to get drive temperature 1: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="104"><td class="num" id="LN104">104</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="105"><td class="num" id="LN105">105</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="106"><td class="num" id="LN106">106</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="107"><td class="num" id="LN107">107</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="108"><td class="num" id="LN108">108</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="109"><td class="num" id="LN109">109</td><td class="line"><span class='comment'>/* note on timing:</span></td></tr> +<tr class="codeline" data-linenumber="110"><td class="num" id="LN110">110</td><td class="line"> <span class='comment'>* it seems to me that smart updates occur automatically every 10 minutes</span></td></tr> +<tr class="codeline" data-linenumber="111"><td class="num" id="LN111">111</td><td class="line"> <span class='comment'>* mate-sensor-applet has a default refresh of 2 seconds...</span></td></tr> +<tr class="codeline" data-linenumber="112"><td class="num" id="LN112">112</td><td class="line"> <span class='comment'>* it is possible to force a smart update with udisks2: SmartUpdate (IN a{sv} options); */</span></td></tr> +<tr class="codeline" data-linenumber="113"><td class="num" id="LN113">113</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="114"><td class="num" id="LN114">114</td><td class="line"> <span class='comment'>/* directly asking the device's DBus object for the temp */</span></td></tr> +<tr class="codeline" data-linenumber="115"><td class="num" id="LN115">115</td><td class="line"> tempgvar = g_dbus_proxy_call_sync (info->sensor_proxy, <span class='string_literal'>"Get"</span>,</td></tr> +<tr class="codeline" data-linenumber="116"><td class="num" id="LN116">116</td><td class="line"> g_variant_new (<span class='string_literal'>"(ss)"</span>,</td></tr> +<tr class="codeline" data-linenumber="117"><td class="num" id="LN117">117</td><td class="line"> <span class='macro'>UDISKS2_DEVICE_INTERFACE2_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive.Ata"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="118"><td class="num" id="LN118">118</td><td class="line"> <span class='string_literal'>"SmartTemperature"</span>), <span class='comment'>/* parameters */</span></td></tr> +<tr class="codeline" data-linenumber="119"><td class="num" id="LN119">119</td><td class="line"> G_DBUS_CALL_FLAGS_NONE, <span class='comment'>/* flags */</span></td></tr> +<tr class="codeline" data-linenumber="120"><td class="num" id="LN120">120</td><td class="line"> -1, <span class='comment'>/* timeout */</span></td></tr> +<tr class="codeline" data-linenumber="121"><td class="num" id="LN121">121</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='comment'>/* cancellable */</span></td></tr> +<tr class="codeline" data-linenumber="122"><td class="num" id="LN122">122</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="123"><td class="num" id="LN123">123</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="124"><td class="num" id="LN124">124</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == tempgvar) {</td></tr> +<tr class="codeline" data-linenumber="125"><td class="num" id="LN125">125</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="126"><td class="num" id="LN126">126</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="127"><td class="num" id="LN127">127</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Failed to get drive temperature 2"</span>);</td></tr> +<tr class="codeline" data-linenumber="128"><td class="num" id="LN128">128</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="129"><td class="num" id="LN129">129</td><td class="line"> g_debug (<span class='string_literal'>"Failed to get drive temperature 2: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="130"><td class="num" id="LN130">130</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="131"><td class="num" id="LN131">131</td><td class="line"> <span class='comment'>/* throw away proxy, maybe next time it will be better */</span></td></tr> +<tr class="codeline" data-linenumber="132"><td class="num" id="LN132">132</td><td class="line"> <span class='macro'>g_clear_object (&info->sensor_proxy)<span class='macro_popup'>do { _Static_assert (sizeof *((&info->sensor_proxy)) ==<br> sizeof (gpointer), "Expression evaluates to false"); __typeof__<br> (((&info->sensor_proxy))) _pp = ((&info->sensor_proxy<br>)); __typeof__ (*((&info->sensor_proxy))) _ptr = *_pp;<br> *_pp = ((void*)0); if (_ptr) (g_object_unref) (_ptr); } while<br> (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="133"><td class="num" id="LN133">133</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="134"><td class="num" id="LN134">134</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="135"><td class="num" id="LN135">135</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="136"><td class="num" id="LN136">136</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="137"><td class="num" id="LN137">137</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="138"><td class="num" id="LN138">138</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"tempgvar value: %s"</span>, g_variant_print(tempgvar, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="139"><td class="num" id="LN139">139</td><td class="line"><span class='comment'>/* leaks memory! */</span></td></tr> +<tr class="codeline" data-linenumber="140"><td class="num" id="LN140">140</td><td class="line"><span class='comment'>//syslog(LOG_ERR, "tempgvar value: %s", g_variant_print(g_variant_get_variant(g_variant_get_child_value(tempgvar, 0)), TRUE));</span></td></tr> +<tr class="codeline" data-linenumber="141"><td class="num" id="LN141">141</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="142"><td class="num" id="LN142">142</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="143"><td class="num" id="LN143">143</td><td class="line"> <span class='comment'>/* tempgvar comes back as something along the lines of array(gvariant(tempasdouble))</span></td></tr> +<tr class="codeline" data-linenumber="144"><td class="num" id="LN144">144</td><td class="line"> <span class='comment'>* hence unpacking</span></td></tr> +<tr class="codeline" data-linenumber="145"><td class="num" id="LN145">145</td><td class="line"> <span class='comment'>* need to free up every param / return value, so can't do it like:</span></td></tr> +<tr class="codeline" data-linenumber="146"><td class="num" id="LN146">146</td><td class="line"> <span class='comment'>* temp = g_variant_get_double(g_variant_get_variant(g_variant_get_child_value(tempgvar, 0))); */</span></td></tr> +<tr class="codeline" data-linenumber="147"><td class="num" id="LN147">147</td><td class="line"> tempgvar2 = g_variant_get_child_value (tempgvar, 0);</td></tr> +<tr class="codeline" data-linenumber="148"><td class="num" id="LN148">148</td><td class="line"> g_variant_unref (tempgvar);</td></tr> +<tr class="codeline" data-linenumber="149"><td class="num" id="LN149">149</td><td class="line"> tempgvar = g_variant_get_variant (tempgvar2);</td></tr> +<tr class="codeline" data-linenumber="150"><td class="num" id="LN150">150</td><td class="line"> g_variant_unref (tempgvar2);</td></tr> +<tr class="codeline" data-linenumber="151"><td class="num" id="LN151">151</td><td class="line"> temp = g_variant_get_double (tempgvar);</td></tr> +<tr class="codeline" data-linenumber="152"><td class="num" id="LN152">152</td><td class="line"> g_variant_unref (tempgvar);</td></tr> +<tr class="codeline" data-linenumber="153"><td class="num" id="LN153">153</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="154"><td class="num" id="LN154">154</td><td class="line"> <span class='comment'>/* temp in K */</span></td></tr> +<tr class="codeline" data-linenumber="155"><td class="num" id="LN155">155</td><td class="line"> info->temp = temp - 273.15;</td></tr> +<tr class="codeline" data-linenumber="156"><td class="num" id="LN156">156</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="157"><td class="num" id="LN157">157</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="158"><td class="num" id="LN158">158</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Refresh udisks2 device temp: '%f'\n"</span>, info->temp);</td></tr> +<tr class="codeline" data-linenumber="159"><td class="num" id="LN159">159</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="160"><td class="num" id="LN160">160</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="161"><td class="num" id="LN161">161</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="162"><td class="num" id="LN162">162</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="163"><td class="num" id="LN163">163</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="164"><td class="num" id="LN164">164</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="165"><td class="num" id="LN165">165</td><td class="line"><span class='comment'>/* in this function we would like to get a list of device (hdd/ssd) paths</span></td></tr> +<tr class="codeline" data-linenumber="166"><td class="num" id="LN166">166</td><td class="line"> <span class='comment'>* then with each path we get the temperature</span></td></tr> +<tr class="codeline" data-linenumber="167"><td class="num" id="LN167">167</td><td class="line"> <span class='comment'>* it is possible with udisks2 to get all the above information in one g_dbus_proxy_call_sync(), so that is how I did it</span></td></tr> +<tr class="codeline" data-linenumber="168"><td class="num" id="LN168">168</td><td class="line"> <span class='comment'>* maybe a better version would be to use GDBusObjectManager Server + Client ?? */</span></td></tr> +<tr class="codeline" data-linenumber="169"><td class="num" id="LN169">169</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> udisks2_plugin_get_sensors (GList **sensors) {</td></tr> +<tr class="codeline" data-linenumber="170"><td class="num" id="LN170">170</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="171"><td class="num" id="LN171">171</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="172"><td class="num" id="LN172">172</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"fstart"</span>);</td></tr> +<tr class="codeline" data-linenumber="173"><td class="num" id="LN173">173</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="174"><td class="num" id="LN174">174</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="175"><td class="num" id="LN175">175</td><td class="line"> GDBusProxy *proxy = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="176"><td class="num" id="LN176">176</td><td class="line"> GError *error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="177"><td class="num" id="LN177">177</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="178"><td class="num" id="LN178">178</td><td class="line"> DevInfo *info;</td></tr> +<tr class="codeline" data-linenumber="179"><td class="num" id="LN179">179</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="180"><td class="num" id="LN180">180</td><td class="line"> <span class='comment'>/* This connection will be used for everything, including the obtaining of sensor data */</span></td></tr> +<tr class="codeline" data-linenumber="181"><td class="num" id="LN181">181</td><td class="line"> connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, &error);</td></tr> +<tr class="codeline" data-linenumber="182"><td class="num" id="LN182">182</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == connection) {</td></tr> +<tr class="codeline" data-linenumber="183"><td class="num" id="LN183">183</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="184"><td class="num" id="LN184">184</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="185"><td class="num" id="LN185">185</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn fail"</span>);</td></tr> +<tr class="codeline" data-linenumber="186"><td class="num" id="LN186">186</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="187"><td class="num" id="LN187">187</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="188"><td class="num" id="LN188">188</td><td class="line"> g_debug (<span class='string_literal'>"Failed to open connection to DBUS: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="189"><td class="num" id="LN189">189</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="190"><td class="num" id="LN190">190</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="191"><td class="num" id="LN191">191</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="192"><td class="num" id="LN192">192</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="193"><td class="num" id="LN193">193</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="194"><td class="num" id="LN194">194</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn success"</span>);</td></tr> +<tr class="codeline" data-linenumber="195"><td class="num" id="LN195">195</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="196"><td class="num" id="LN196">196</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="197"><td class="num" id="LN197">197</td><td class="line"> <span class='comment'>/* I use this proxy to get all info of all devices at once */</span></td></tr> +<tr class="codeline" data-linenumber="198"><td class="num" id="LN198">198</td><td class="line"> proxy = g_dbus_proxy_new_sync (connection, G_DBUS_PROXY_FLAGS_NONE, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="199"><td class="num" id="LN199">199</td><td class="line"> <span class='macro'>UDISKS2_BUS_NAME<span class='macro_popup'>"org.freedesktop.UDisks2"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="200"><td class="num" id="LN200">200</td><td class="line"> <span class='macro'>UDISKS2_OBJECT_PATH<span class='macro_popup'>"/org/freedesktop/UDisks2"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="201"><td class="num" id="LN201">201</td><td class="line"> <span class='macro'>UDISKS2_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.DBus.ObjectManager"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="202"><td class="num" id="LN202">202</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, &error);</td></tr> +<tr class="codeline" data-linenumber="203"><td class="num" id="LN203">203</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="204"><td class="num" id="LN204">204</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == proxy) {</td></tr> +<tr class="codeline" data-linenumber="205"><td class="num" id="LN205">205</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="206"><td class="num" id="LN206">206</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="207"><td class="num" id="LN207">207</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn proxy fail"</span>);</td></tr> +<tr class="codeline" data-linenumber="208"><td class="num" id="LN208">208</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="209"><td class="num" id="LN209">209</td><td class="line"> g_debug (<span class='string_literal'>"dbus conn proxy fail: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="210"><td class="num" id="LN210">210</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="211"><td class="num" id="LN211">211</td><td class="line"> <span class='macro'>g_clear_object (&connection)<span class='macro_popup'>do { _Static_assert (sizeof *((&connection)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&connection<br>))) _pp = ((&connection)); __typeof__ (*((&connection<br>))) _ptr = *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref<br>) (_ptr); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="212"><td class="num" id="LN212">212</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="213"><td class="num" id="LN213">213</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="214"><td class="num" id="LN214">214</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="215"><td class="num" id="LN215">215</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="216"><td class="num" id="LN216">216</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn proxy success"</span>);</td></tr> +<tr class="codeline" data-linenumber="217"><td class="num" id="LN217">217</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="218"><td class="num" id="LN218">218</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="219"><td class="num" id="LN219">219</td><td class="line"> <span class='comment'>/* The object paths of the disks are enumerated and placed in an array of object paths</span></td></tr> +<tr class="codeline" data-linenumber="220"><td class="num" id="LN220">220</td><td class="line"> <span class='comment'>* "GetManagedObjects" returns dict of (objectpath, (dict of (string [ie. if. name], dict of(string [ie. property name], variant [ie. prop. value])))) */</span></td></tr> +<tr class="codeline" data-linenumber="221"><td class="num" id="LN221">221</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="222"><td class="num" id="LN222">222</td><td class="line"> <span class='comment'>/* g_dbus_proxy_call_sync() returns NULL on error, GVariant * otherwise</span></td></tr> +<tr class="codeline" data-linenumber="223"><td class="num" id="LN223">223</td><td class="line"> <span class='comment'>* need second variable to prevent memory leak */</span></td></tr> +<tr class="codeline" data-linenumber="224"><td class="num" id="LN224">224</td><td class="line"> GVariant *managed_objects = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="225"><td class="num" id="LN225">225</td><td class="line"> GVariant *managed_objects2 = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="226"><td class="num" id="LN226">226</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="227"><td class="num" id="LN227">227</td><td class="line"> managed_objects2 = g_dbus_proxy_call_sync (proxy, <span class='string_literal'>"GetManagedObjects"</span>,</td></tr> +<tr class="codeline" data-linenumber="228"><td class="num" id="LN228">228</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='comment'>/* parameters */</span></td></tr> +<tr class="codeline" data-linenumber="229"><td class="num" id="LN229">229</td><td class="line"> G_DBUS_CALL_FLAGS_NONE, <span class='comment'>/* flags */</span></td></tr> +<tr class="codeline" data-linenumber="230"><td class="num" id="LN230">230</td><td class="line"> -1, <span class='comment'>/* timeout */</span></td></tr> +<tr class="codeline" data-linenumber="231"><td class="num" id="LN231">231</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='comment'>/* cancellable */</span></td></tr> +<tr class="codeline" data-linenumber="232"><td class="num" id="LN232">232</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="233"><td class="num" id="LN233">233</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="234"><td class="num" id="LN234">234</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == managed_objects2) {</td></tr> +<tr class="codeline" data-linenumber="235"><td class="num" id="LN235">235</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="236"><td class="num" id="LN236">236</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="237"><td class="num" id="LN237">237</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Failed to enumerate disk devices"</span>);</td></tr> +<tr class="codeline" data-linenumber="238"><td class="num" id="LN238">238</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="239"><td class="num" id="LN239">239</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="240"><td class="num" id="LN240">240</td><td class="line"> g_debug (<span class='string_literal'>"Failed to enumerate disk devices: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="241"><td class="num" id="LN241">241</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="242"><td class="num" id="LN242">242</td><td class="line"> <span class='macro'>g_clear_object (&proxy)<span class='macro_popup'>do { _Static_assert (sizeof *((&proxy)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&proxy<br>))) _pp = ((&proxy)); __typeof__ (*((&proxy))) _ptr =<br> *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref) (_ptr); }<br> while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="243"><td class="num" id="LN243">243</td><td class="line"> <span class='macro'>g_clear_object (&connection)<span class='macro_popup'>do { _Static_assert (sizeof *((&connection)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&connection<br>))) _pp = ((&connection)); __typeof__ (*((&connection<br>))) _ptr = *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref<br>) (_ptr); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="244"><td class="num" id="LN244">244</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="245"><td class="num" id="LN245">245</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="246"><td class="num" id="LN246">246</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="247"><td class="num" id="LN247">247</td><td class="line"> <span class='comment'>/* the result dictionary is enclosed in an array, unpack */</span></td></tr> +<tr class="codeline" data-linenumber="248"><td class="num" id="LN248">248</td><td class="line"> managed_objects = g_variant_get_child_value (managed_objects2, 0);</td></tr> +<tr class="codeline" data-linenumber="249"><td class="num" id="LN249">249</td><td class="line"> g_variant_unref (managed_objects2);</td></tr> +<tr class="codeline" data-linenumber="250"><td class="num" id="LN250">250</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="251"><td class="num" id="LN251">251</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="252"><td class="num" id="LN252">252</td><td class="line"><span class='comment'>//syslog(LOG_ERR, "managed_objects type: %s", g_variant_print(managed_objects, TRUE));</span></td></tr> +<tr class="codeline" data-linenumber="253"><td class="num" id="LN253">253</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"success to enumerate disk devices"</span>);</td></tr> +<tr class="codeline" data-linenumber="254"><td class="num" id="LN254">254</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="255"><td class="num" id="LN255">255</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="256"><td class="num" id="LN256">256</td><td class="line"> <span class='comment'>/* iterator for the result dictionary</span></td></tr> +<tr class="codeline" data-linenumber="257"><td class="num" id="LN257">257</td><td class="line"> <span class='comment'>* iterator code is based on the g_variant_iter_next() documentation</span></td></tr> +<tr class="codeline" data-linenumber="258"><td class="num" id="LN258">258</td><td class="line"> <span class='comment'>* iter is freed if the GVariant is, when using g_variant_iter_init() */</span></td></tr> +<tr class="codeline" data-linenumber="259"><td class="num" id="LN259">259</td><td class="line"> GVariantIter iter;</td></tr> +<tr class="codeline" data-linenumber="260"><td class="num" id="LN260">260</td><td class="line"> gchar *key = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; <span class='comment'>/* object path (like '/org/freedesktop/UDisks2/drives/Samsung_SSD_840_EVO_250GB_*insert drive serial nr.*') */</span></td></tr> +<tr class="codeline" data-linenumber="261"><td class="num" id="LN261">261</td><td class="line"> GVariant *value = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="262"><td class="num" id="LN262">262</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="263"><td class="num" id="LN263">263</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="264"><td class="num" id="LN264">264</td><td class="line"><span class='comment'>/* log collection size */</span></td></tr> +<tr class="codeline" data-linenumber="265"><td class="num" id="LN265">265</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"iter init count: %d"</span>, (<span class='keyword'>int</span>) g_variant_iter_init (&iter, managed_objects));</td></tr> +<tr class="codeline" data-linenumber="266"><td class="num" id="LN266">266</td><td class="line"><span class='directive'>#else</span></td></tr> +<tr class="codeline" data-linenumber="267"><td class="num" id="LN267">267</td><td class="line"> g_variant_iter_init (&iter, managed_objects);</td></tr> +<tr class="codeline" data-linenumber="268"><td class="num" id="LN268">268</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="269"><td class="num" id="LN269">269</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="270"><td class="num" id="LN270">270</td><td class="line"> <span class='comment'>/* "{sv}" is a GVariant format string</span></td></tr> +<tr class="codeline" data-linenumber="271"><td class="num" id="LN271">271</td><td class="line"> <span class='comment'>* {} dictionary of, s string, v GVariant</span></td></tr> +<tr class="codeline" data-linenumber="272"><td class="num" id="LN272">272</td><td class="line"> <span class='comment'>* changed to "{oa{sa{sv}}}" on error message 'the GVariant format string '{sv}' has a type of '{sv}' but the given value has a type of 'a{oa{sa{sv}}}''</span></td></tr> +<tr class="codeline" data-linenumber="273"><td class="num" id="LN273">273</td><td class="line"> <span class='comment'>* a is array, o is object path</span></td></tr> +<tr class="codeline" data-linenumber="274"><td class="num" id="LN274">274</td><td class="line"> <span class='comment'>* NOO!! the right format string is "{o@*}", which means get an object path into the 1st variable (key)</span></td></tr> +<tr class="codeline" data-linenumber="275"><td class="num" id="LN275">275</td><td class="line"> <span class='comment'>* and get 'everything else' (as a GVariant) into the 2nd variable (value)</span></td></tr> +<tr class="codeline" data-linenumber="276"><td class="num" id="LN276">276</td><td class="line"> <span class='comment'>* needs the & before the key and value params! */</span></td></tr> +<tr class="codeline" data-linenumber="277"><td class="num" id="LN277">277</td><td class="line"> <span class='keyword'>while</span> (g_variant_iter_next (&iter, <span class='string_literal'>"{o@*}"</span>, &key, &value)) {</td></tr> +<tr class="codeline" data-linenumber="278"><td class="num" id="LN278">278</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="279"><td class="num" id="LN279">279</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="280"><td class="num" id="LN280">280</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"in iter while loop"</span>);</td></tr> +<tr class="codeline" data-linenumber="281"><td class="num" id="LN281">281</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"key value: %s"</span>, key);</td></tr> +<tr class="codeline" data-linenumber="282"><td class="num" id="LN282">282</td><td class="line"><span class='comment'>//syslog(LOG_ERR, "value type: %s", g_variant_print(value, TRUE));</span></td></tr> +<tr class="codeline" data-linenumber="283"><td class="num" id="LN283">283</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="284"><td class="num" id="LN284">284</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="285"><td class="num" id="LN285">285</td><td class="line"> <span class='comment'>/* level 2</span></td></tr> +<tr class="codeline" data-linenumber="286"><td class="num" id="LN286">286</td><td class="line"> <span class='comment'>* create a dictionary of value</span></td></tr> +<tr class="codeline" data-linenumber="287"><td class="num" id="LN287">287</td><td class="line"> <span class='comment'>* the two interface names that we are searching for are known and defined</span></td></tr> +<tr class="codeline" data-linenumber="288"><td class="num" id="LN288">288</td><td class="line"> <span class='comment'>* can't use GVariantDict, it only supports '{sv}' but the given value has a type of '{sa{sv}}'</span></td></tr> +<tr class="codeline" data-linenumber="289"><td class="num" id="LN289">289</td><td class="line"> <span class='comment'>* using general lookup */</span></td></tr> +<tr class="codeline" data-linenumber="290"><td class="num" id="LN290">290</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="291"><td class="num" id="LN291">291</td><td class="line"> GVariant *propdict = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; <span class='comment'>/* drive data */</span></td></tr> +<tr class="codeline" data-linenumber="292"><td class="num" id="LN292">292</td><td class="line"> GVariant *propdict2 = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; <span class='comment'>/* drive smart data */</span></td></tr> +<tr class="codeline" data-linenumber="293"><td class="num" id="LN293">293</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="294"><td class="num" id="LN294">294</td><td class="line"> <span class='comment'>/* make two dictionaries that contain the properties of the drive interfaces */</span></td></tr> +<tr class="codeline" data-linenumber="295"><td class="num" id="LN295">295</td><td class="line"> propdict = g_variant_lookup_value (value, <span class='macro'>UDISKS2_DEVICE_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive"</span></span>, <span class='macro'>G_VARIANT_TYPE_DICTIONARY<span class='macro_popup'>((const GVariantType *) "a{?*}")</span></span>);</td></tr> +<tr class="codeline" data-linenumber="296"><td class="num" id="LN296">296</td><td class="line"> propdict2 = g_variant_lookup_value (value, <span class='macro'>UDISKS2_DEVICE_INTERFACE2_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive.Ata"</span></span>, <span class='macro'>G_VARIANT_TYPE_DICTIONARY<span class='macro_popup'>((const GVariantType *) "a{?*}")</span></span>);</td></tr> +<tr class="codeline" data-linenumber="297"><td class="num" id="LN297">297</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="298"><td class="num" id="LN298">298</td><td class="line"> <span class='comment'>/* do we have the right ifname keys? */</span></td></tr> +<tr class="codeline" data-linenumber="299"><td class="num" id="LN299">299</td><td class="line"> <span class='keyword'>if</span> ((<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict) && (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict2)) {</td></tr> +<tr class="codeline" data-linenumber="300"><td class="num" id="LN300">300</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="301"><td class="num" id="LN301">301</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="302"><td class="num" id="LN302">302</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"propdict type: %s"</span>, g_variant_print(propdict, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="303"><td class="num" id="LN303">303</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"propdict2 type: %s"</span>, g_variant_print(propdict2, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="304"><td class="num" id="LN304">304</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="305"><td class="num" id="LN305">305</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="306"><td class="num" id="LN306">306</td><td class="line"> <span class='comment'>/* get data */</span></td></tr> +<tr class="codeline" data-linenumber="307"><td class="num" id="LN307">307</td><td class="line"> gchar *id = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="308"><td class="num" id="LN308">308</td><td class="line"> gchar *model = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="309"><td class="num" id="LN309">309</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="310"><td class="num" id="LN310">310</td><td class="line"> gboolean smartenabled;</td></tr> +<tr class="codeline" data-linenumber="311"><td class="num" id="LN311">311</td><td class="line"> gdouble temp;</td></tr> +<tr class="codeline" data-linenumber="312"><td class="num" id="LN312">312</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="313"><td class="num" id="LN313">313</td><td class="line"> <span class='comment'>/* NULL, bc we don't care about the length of the string</span></td></tr> +<tr class="codeline" data-linenumber="314"><td class="num" id="LN314">314</td><td class="line"> <span class='comment'>* typecast bc g_variant_get_string() returns const char* */</span></td></tr> +<tr class="codeline" data-linenumber="315"><td class="num" id="LN315">315</td><td class="line"> id = (gchar *) g_variant_get_string (g_variant_lookup_value (propdict, <span class='string_literal'>"Id"</span>, <span class='macro'>G_VARIANT_TYPE_STRING<span class='macro_popup'>((const GVariantType *) "s")</span></span>), <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="316"><td class="num" id="LN316">316</td><td class="line"> model = (gchar *) g_variant_get_string (g_variant_lookup_value (propdict, <span class='string_literal'>"Model"</span>, <span class='macro'>G_VARIANT_TYPE_STRING<span class='macro_popup'>((const GVariantType *) "s")</span></span>), <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="317"><td class="num" id="LN317">317</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="318"><td class="num" id="LN318">318</td><td class="line"> smartenabled = g_variant_get_boolean (g_variant_lookup_value (propdict2, <span class='string_literal'>"SmartEnabled"</span>, <span class="mrange"><span class="mrange"><span class='macro'>G_VARIANT_TYPE_BOOLEAN<span class='macro_popup'>((const GVariantType *) "b")</span></span></span></span>));</td></tr> +<tr><td class="num"></td><td class="line"><div id="EndPath" class="msg msgEvent" style="margin-left:102ex; max-width:31em">Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption</div></td></tr> +<tr class="codeline" data-linenumber="319"><td class="num" id="LN319">319</td><td class="line"> temp = g_variant_get_double (g_variant_lookup_value (propdict2, <span class='string_literal'>"SmartTemperature"</span>, <span class='macro'>G_VARIANT_TYPE_DOUBLE<span class='macro_popup'>((const GVariantType *) "d")</span></span>));</td></tr> +<tr class="codeline" data-linenumber="320"><td class="num" id="LN320">320</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="321"><td class="num" id="LN321">321</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="322"><td class="num" id="LN322">322</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device id: '%s'\n"</span>, id);</td></tr> +<tr class="codeline" data-linenumber="323"><td class="num" id="LN323">323</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device model: '%s'\n"</span>, model);</td></tr> +<tr class="codeline" data-linenumber="324"><td class="num" id="LN324">324</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device smartenabled: '%d'\n"</span>, smartenabled);</td></tr> +<tr class="codeline" data-linenumber="325"><td class="num" id="LN325">325</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device temp: '%f'\n"</span>, temp);</td></tr> +<tr class="codeline" data-linenumber="326"><td class="num" id="LN326">326</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="327"><td class="num" id="LN327">327</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="328"><td class="num" id="LN328">328</td><td class="line"> <span class='comment'>/* only go on if smart is enabled</span></td></tr> +<tr class="codeline" data-linenumber="329"><td class="num" id="LN329">329</td><td class="line"> <span class='comment'>* save data */</span></td></tr> +<tr class="codeline" data-linenumber="330"><td class="num" id="LN330">330</td><td class="line"> <span class='keyword'>if</span> (smartenabled) {</td></tr> +<tr class="codeline" data-linenumber="331"><td class="num" id="LN331">331</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="332"><td class="num" id="LN332">332</td><td class="line"> info = <span class='macro'>g_new0 (DevInfo, 1)<span class='macro_popup'>(DevInfo *) (__extension__ ({ gsize __n = (gsize) (1); gsize __s<br> = sizeof (DevInfo); gpointer __p; if (__s == 1) __p = g_malloc0<br> (__n); else if (__builtin_constant_p (__n) && (__s ==<br> 0 || __n <= (9223372036854775807L *2UL+1UL) / __s)) __p =<br> g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s); __p<br>; }))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="333"><td class="num" id="LN333">333</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == devices) {</td></tr> +<tr class="codeline" data-linenumber="334"><td class="num" id="LN334">334</td><td class="line"> devices = g_hash_table_new (g_str_hash, g_str_equal);</td></tr> +<tr class="codeline" data-linenumber="335"><td class="num" id="LN335">335</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="336"><td class="num" id="LN336">336</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="337"><td class="num" id="LN337">337</td><td class="line"> info->id = <span class='macro'>g_strdup (id)<span class='macro_popup'>g_strdup_inline (id)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="338"><td class="num" id="LN338">338</td><td class="line"> info->path = <span class='macro'>g_strdup (key)<span class='macro_popup'>g_strdup_inline (key)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="339"><td class="num" id="LN339">339</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="340"><td class="num" id="LN340">340</td><td class="line"> <span class='comment'>/* temp in K</span></td></tr> +<tr class="codeline" data-linenumber="341"><td class="num" id="LN341">341</td><td class="line"> <span class='comment'>* this could be left at 0.0, 2 seconds later it will be refreshed anyway */</span></td></tr> +<tr class="codeline" data-linenumber="342"><td class="num" id="LN342">342</td><td class="line"> info->temp = (gdouble) temp - 273.15;</td></tr> +<tr class="codeline" data-linenumber="343"><td class="num" id="LN343">343</td><td class="line"> g_hash_table_insert (devices, info->id, info);</td></tr> +<tr class="codeline" data-linenumber="344"><td class="num" id="LN344">344</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="345"><td class="num" id="LN345">345</td><td class="line"> <span class='comment'>/* Write the sensor data */</span></td></tr> +<tr class="codeline" data-linenumber="346"><td class="num" id="LN346">346</td><td class="line"> sensors_applet_plugin_add_sensor (sensors,</td></tr> +<tr class="codeline" data-linenumber="347"><td class="num" id="LN347">347</td><td class="line"> id,</td></tr> +<tr class="codeline" data-linenumber="348"><td class="num" id="LN348">348</td><td class="line"> <span class='string_literal'>"Disk Temperature"</span>,</td></tr> +<tr class="codeline" data-linenumber="349"><td class="num" id="LN349">349</td><td class="line"> model,</td></tr> +<tr class="codeline" data-linenumber="350"><td class="num" id="LN350">350</td><td class="line"> TEMP_SENSOR,</td></tr> +<tr class="codeline" data-linenumber="351"><td class="num" id="LN351">351</td><td class="line"> <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="352"><td class="num" id="LN352">352</td><td class="line"> HDD_ICON,</td></tr> +<tr class="codeline" data-linenumber="353"><td class="num" id="LN353">353</td><td class="line"> <span class='macro'>DEFAULT_GRAPH_COLOR<span class='macro_popup'>"#ff0000"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="354"><td class="num" id="LN354">354</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="355"><td class="num" id="LN355">355</td><td class="line"> g_debug (<span class='string_literal'>"Added %s"</span>, id);</td></tr> +<tr class="codeline" data-linenumber="356"><td class="num" id="LN356">356</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="357"><td class="num" id="LN357">357</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="358"><td class="num" id="LN358">358</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Added %s"</span>, id);</td></tr> +<tr class="codeline" data-linenumber="359"><td class="num" id="LN359">359</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="360"><td class="num" id="LN360">360</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="361"><td class="num" id="LN361">361</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="362"><td class="num" id="LN362">362</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="363"><td class="num" id="LN363">363</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="364"><td class="num" id="LN364">364</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"No temp data for device: %s\n"</span>, key);</td></tr> +<tr class="codeline" data-linenumber="365"><td class="num" id="LN365">365</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="366"><td class="num" id="LN366">366</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="367"><td class="num" id="LN367">367</td><td class="line"> g_debug (<span class='string_literal'>"No temp data for device: %s\n"</span>, key);</td></tr> +<tr class="codeline" data-linenumber="368"><td class="num" id="LN368">368</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="369"><td class="num" id="LN369">369</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="370"><td class="num" id="LN370">370</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="371"><td class="num" id="LN371">371</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"b4 free1"</span>);</td></tr> +<tr class="codeline" data-linenumber="372"><td class="num" id="LN372">372</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="373"><td class="num" id="LN373">373</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="374"><td class="num" id="LN374">374</td><td class="line"> g_free (id);</td></tr> +<tr class="codeline" data-linenumber="375"><td class="num" id="LN375">375</td><td class="line"> g_free (model);</td></tr> +<tr class="codeline" data-linenumber="376"><td class="num" id="LN376">376</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="377"><td class="num" id="LN377">377</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="378"><td class="num" id="LN378">378</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="379"><td class="num" id="LN379">379</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="380"><td class="num" id="LN380">380</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"b4 free2"</span>);</td></tr> +<tr class="codeline" data-linenumber="381"><td class="num" id="LN381">381</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="382"><td class="num" id="LN382">382</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="383"><td class="num" id="LN383">383</td><td class="line"> <span class='comment'>/* free propdict, propdict2</span></td></tr> +<tr class="codeline" data-linenumber="384"><td class="num" id="LN384">384</td><td class="line"> <span class='comment'>* g_variant_dict_unref() may not work a few times, gives error</span></td></tr> +<tr class="codeline" data-linenumber="385"><td class="num" id="LN385">385</td><td class="line"> <span class='comment'>* this one seems to do fine */</span></td></tr> +<tr class="codeline" data-linenumber="386"><td class="num" id="LN386">386</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict) {g_variant_unref (propdict);}</td></tr> +<tr class="codeline" data-linenumber="387"><td class="num" id="LN387">387</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict2) {g_variant_unref (propdict2);}</td></tr> +<tr class="codeline" data-linenumber="388"><td class="num" id="LN388">388</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="389"><td class="num" id="LN389">389</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="390"><td class="num" id="LN390">390</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"b4 free3"</span>);</td></tr> +<tr class="codeline" data-linenumber="391"><td class="num" id="LN391">391</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="392"><td class="num" id="LN392">392</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="393"><td class="num" id="LN393">393</td><td class="line"> g_free (key);</td></tr> +<tr class="codeline" data-linenumber="394"><td class="num" id="LN394">394</td><td class="line"> g_variant_unref (value);</td></tr> +<tr class="codeline" data-linenumber="395"><td class="num" id="LN395">395</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="396"><td class="num" id="LN396">396</td><td class="line"> } <span class='comment'>/* end of while loop */</span></td></tr> +<tr class="codeline" data-linenumber="397"><td class="num" id="LN397">397</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="398"><td class="num" id="LN398">398</td><td class="line"> g_variant_unref (managed_objects);</td></tr> +<tr class="codeline" data-linenumber="399"><td class="num" id="LN399">399</td><td class="line"> <span class='macro'>g_clear_object (&proxy)<span class='macro_popup'>do { _Static_assert (sizeof *((&proxy)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&proxy<br>))) _pp = ((&proxy)); __typeof__ (*((&proxy))) _ptr =<br> *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref) (_ptr); }<br> while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="400"><td class="num" id="LN400">400</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == devices) {</td></tr> +<tr class="codeline" data-linenumber="401"><td class="num" id="LN401">401</td><td class="line"> <span class='macro'>g_clear_object (&connection)<span class='macro_popup'>do { _Static_assert (sizeof *((&connection)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&connection<br>))) _pp = ((&connection)); __typeof__ (*((&connection<br>))) _ptr = *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref<br>) (_ptr); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="402"><td class="num" id="LN402">402</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="403"><td class="num" id="LN403">403</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="404"><td class="num" id="LN404">404</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="405"><td class="num" id="LN405">405</td><td class="line"><span class='comment'>/* this function is called every refresh cycle */</span></td></tr> +<tr class="codeline" data-linenumber="406"><td class="num" id="LN406">406</td><td class="line"><span class='keyword'>static</span> gdouble udisks2_plugin_get_sensor_value (<span class='keyword'>const</span> gchar *path,</td></tr> +<tr class="codeline" data-linenumber="407"><td class="num" id="LN407">407</td><td class="line"> <span class='keyword'>const</span> gchar *id,</td></tr> +<tr class="codeline" data-linenumber="408"><td class="num" id="LN408">408</td><td class="line"> SensorType type,</td></tr> +<tr class="codeline" data-linenumber="409"><td class="num" id="LN409">409</td><td class="line"> GError **error) {</td></tr> +<tr class="codeline" data-linenumber="410"><td class="num" id="LN410">410</td><td class="line"> DevInfo *info = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="411"><td class="num" id="LN411">411</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="412"><td class="num" id="LN412">412</td><td class="line"> <span class='comment'>/* get device stuct from data store */</span></td></tr> +<tr class="codeline" data-linenumber="413"><td class="num" id="LN413">413</td><td class="line"> info = (DevInfo *) g_hash_table_lookup (devices, path);</td></tr> +<tr class="codeline" data-linenumber="414"><td class="num" id="LN414">414</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == info) {</td></tr> +<tr class="codeline" data-linenumber="415"><td class="num" id="LN415">415</td><td class="line"> g_set_error (error, <span class='macro'>SENSORS_APPLET_PLUGIN_ERROR<span class='macro_popup'>(sensors_applet_plugin_error_quark())</span></span>, 0, <span class='string_literal'>"Error finding disk with path %s"</span>, path);</td></tr> +<tr class="codeline" data-linenumber="416"><td class="num" id="LN416">416</td><td class="line"> <span class='keyword'>return</span> 0.0;</td></tr> +<tr class="codeline" data-linenumber="417"><td class="num" id="LN417">417</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="418"><td class="num" id="LN418">418</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="419"><td class="num" id="LN419">419</td><td class="line"> <span class='keyword'>if</span> (info->error) {</td></tr> +<tr class="codeline" data-linenumber="420"><td class="num" id="LN420">420</td><td class="line"> *error = info->error;</td></tr> +<tr class="codeline" data-linenumber="421"><td class="num" id="LN421">421</td><td class="line"> info->error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="422"><td class="num" id="LN422">422</td><td class="line"> <span class='keyword'>return</span> 0.0;</td></tr> +<tr class="codeline" data-linenumber="423"><td class="num" id="LN423">423</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="424"><td class="num" id="LN424">424</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="425"><td class="num" id="LN425">425</td><td class="line"> <span class='comment'>/* refresh device temp */</span></td></tr> +<tr class="codeline" data-linenumber="426"><td class="num" id="LN426">426</td><td class="line"> update_device (info);</td></tr> +<tr class="codeline" data-linenumber="427"><td class="num" id="LN427">427</td><td class="line"> <span class='keyword'>return</span> info->temp;</td></tr> +<tr class="codeline" data-linenumber="428"><td class="num" id="LN428">428</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="429"><td class="num" id="LN429">429</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="430"><td class="num" id="LN430">430</td><td class="line"><span class='comment'>/* API functions */</span></td></tr> +<tr class="codeline" data-linenumber="431"><td class="num" id="LN431">431</td><td class="line"><span class='keyword'>const</span> gchar *sensors_applet_plugin_name (<span class='keyword'>void</span>) {</td></tr> +<tr class="codeline" data-linenumber="432"><td class="num" id="LN432">432</td><td class="line"> <span class='keyword'>return</span> plugin_name;</td></tr> +<tr class="codeline" data-linenumber="433"><td class="num" id="LN433">433</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="434"><td class="num" id="LN434">434</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="435"><td class="num" id="LN435">435</td><td class="line"><span class='keyword'>static</span> GList *udisks2_plugin_init (<span class='keyword'>void</span>) {</td></tr> +<tr class="codeline" data-linenumber="436"><td class="num" id="LN436">436</td><td class="line"> GList *sensors = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="437"><td class="num" id="LN437">437</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="438"><td class="num" id="LN438">438</td><td class="line"> udisks2_plugin_get_sensors (&sensors);</td></tr> +<tr class="codeline" data-linenumber="439"><td class="num" id="LN439">439</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="440"><td class="num" id="LN440">440</td><td class="line"> <span class='keyword'>return</span> sensors;</td></tr> +<tr class="codeline" data-linenumber="441"><td class="num" id="LN441">441</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="442"><td class="num" id="LN442">442</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="443"><td class="num" id="LN443">443</td><td class="line">GList *sensors_applet_plugin_init (<span class='keyword'>void</span>) {</td></tr> +<tr class="codeline" data-linenumber="444"><td class="num" id="LN444">444</td><td class="line"> <span class='keyword'>return</span> udisks2_plugin_init ();</td></tr> +<tr class="codeline" data-linenumber="445"><td class="num" id="LN445">445</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="446"><td class="num" id="LN446">446</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="447"><td class="num" id="LN447">447</td><td class="line">gdouble sensors_applet_plugin_get_sensor_value (<span class='keyword'>const</span> gchar *path,</td></tr> +<tr class="codeline" data-linenumber="448"><td class="num" id="LN448">448</td><td class="line"> <span class='keyword'>const</span> gchar *id,</td></tr> +<tr class="codeline" data-linenumber="449"><td class="num" id="LN449">449</td><td class="line"> SensorType type,</td></tr> +<tr class="codeline" data-linenumber="450"><td class="num" id="LN450">450</td><td class="line"> GError **error) {</td></tr> +<tr class="codeline" data-linenumber="451"><td class="num" id="LN451">451</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="452"><td class="num" id="LN452">452</td><td class="line"> <span class='keyword'>return</span> udisks2_plugin_get_sensor_value (path, id, type, error);</td></tr> +<tr class="codeline" data-linenumber="453"><td class="num" id="LN453">453</td><td class="line">}</td></tr> +</table></body></html> diff --git a/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-f0c410.html b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-f0c410.html new file mode 100644 index 0000000..b0b990d --- /dev/null +++ b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-f0c410.html @@ -0,0 +1,2042 @@ +<!doctype html> +<html> +<head> +<title>sensors-applet.c</title> + +<style type="text/css"> +body { color:#000000; background-color:#ffffff } +body { font-family:Helvetica, sans-serif; font-size:10pt } +h1 { font-size:14pt } +.FileName { margin-top: 5px; margin-bottom: 5px; display: inline; } +.FileNav { margin-left: 5px; margin-right: 5px; display: inline; } +.FileNav a { text-decoration:none; font-size: larger; } +.divider { margin-top: 30px; margin-bottom: 30px; height: 15px; } +.divider { background-color: gray; } +.code { border-collapse:collapse; width:100%; } +.code { font-family: "Monospace", monospace; font-size:10pt } +.code { line-height: 1.2em } +.comment { color: green; font-style: oblique } +.keyword { color: blue } +.string_literal { color: red } +.directive { color: darkmagenta } + +/* Macros and variables could have pop-up notes hidden by default. + - Macro pop-up: expansion of the macro + - Variable pop-up: value (table) of the variable */ +.macro_popup, .variable_popup { display: none; } + +/* Pop-up appears on mouse-hover event. */ +.macro:hover .macro_popup, .variable:hover .variable_popup { + display: block; + padding: 2px; + -webkit-border-radius:5px; + -webkit-box-shadow:1px 1px 7px #000; + border-radius:5px; + box-shadow:1px 1px 7px #000; + position: absolute; + top: -1em; + left:10em; + z-index: 1 +} + +.macro_popup { + border: 2px solid red; + background-color:#FFF0F0; + font-weight: normal; +} + +.variable_popup { + border: 2px solid blue; + background-color:#F0F0FF; + font-weight: bold; + font-family: Helvetica, sans-serif; + font-size: 9pt; +} + +/* Pop-up notes needs a relative position as a base where they pops up. */ +.macro, .variable { + background-color: PaleGoldenRod; + position: relative; +} +.macro { color: DarkMagenta; } + +#tooltiphint { + position: fixed; + width: 50em; + margin-left: -25em; + left: 50%; + padding: 10px; + border: 1px solid #b0b0b0; + border-radius: 2px; + box-shadow: 1px 1px 7px black; + background-color: #c0c0c0; + z-index: 2; +} + +.num { width:2.5em; padding-right:2ex; background-color:#eeeeee } +.num { text-align:right; font-size:8pt } +.num { color:#444444 } +.line { padding-left: 1ex; border-left: 3px solid #ccc } +.line { white-space: pre } +.msg { -webkit-box-shadow:1px 1px 7px #000 } +.msg { box-shadow:1px 1px 7px #000 } +.msg { -webkit-border-radius:5px } +.msg { border-radius:5px } +.msg { font-family:Helvetica, sans-serif; font-size:8pt } +.msg { float:left } +.msg { position:relative } +.msg { padding:0.25em 1ex 0.25em 1ex } +.msg { margin-top:10px; margin-bottom:10px } +.msg { font-weight:bold } +.msg { max-width:60em; word-wrap: break-word; white-space: pre-wrap } +.msgT { padding:0x; spacing:0x } +.msgEvent { background-color:#fff8b4; color:#000000 } +.msgControl { background-color:#bbbbbb; color:#000000 } +.msgNote { background-color:#ddeeff; color:#000000 } +.mrange { background-color:#dfddf3 } +.mrange { border-bottom:1px solid #6F9DBE } +.PathIndex { font-weight: bold; padding:0px 5px; margin-right:5px; } +.PathIndex { -webkit-border-radius:8px } +.PathIndex { border-radius:8px } +.PathIndexEvent { background-color:#bfba87 } +.PathIndexControl { background-color:#8c8c8c } +.PathIndexPopUp { background-color: #879abc; } +.PathNav a { text-decoration:none; font-size: larger } +.CodeInsertionHint { font-weight: bold; background-color: #10dd10 } +.CodeRemovalHint { background-color:#de1010 } +.CodeRemovalHint { border-bottom:1px solid #6F9DBE } +.msg.selected{ background-color:orange !important; } + +table.simpletable { + padding: 5px; + font-size:12pt; + margin:20px; + border-collapse: collapse; border-spacing: 0px; +} +td.rowname { + text-align: right; + vertical-align: top; + font-weight: bold; + color:#444444; + padding-right:2ex; +} + +/* Hidden text. */ +input.spoilerhider + label { + cursor: pointer; + text-decoration: underline; + display: block; +} +input.spoilerhider { + display: none; +} +input.spoilerhider ~ .spoiler { + overflow: hidden; + margin: 10px auto 0; + height: 0; + opacity: 0; +} +input.spoilerhider:checked + label + .spoiler{ + height: auto; + opacity: 1; +} +</style> +</head> +<body> +<!-- BUGDESC Division by zero --> + +<!-- BUGTYPE Division by zero --> + +<!-- BUGCATEGORY Logic error --> + +<!-- BUGFILE /rootdir/sensors-applet/sensors-applet.c --> + +<!-- FILENAME sensors-applet.c --> + +<!-- FUNCTIONNAME sensors_applet_pack_display --> + +<!-- ISSUEHASHCONTENTOFLINEINCONTEXT f0c410cae48a12ba59f6788489b57674 --> + +<!-- BUGLINE 529 --> + +<!-- BUGCOLUMN 59 --> + +<!-- BUGPATHLENGTH 13 --> + +<!-- BUGMETAEND --> +<!-- REPORTHEADER --> +<h3>Bug Summary</h3> +<table class="simpletable"> +<tr><td class="rowname">File:</td><td>sensors-applet/sensors-applet.c</td></tr> +<tr><td class="rowname">Warning:</td><td><a href="#EndPath">line 529, column 59</a><br />Division by zero</td></tr> + +</table> +<!-- REPORTSUMMARYEXTRA --> +<h3>Annotated Source Code</h3> +<p>Press <a href="#" onclick="toggleHelp(); return false;">'?'</a> + to see keyboard shortcuts</p> +<input type="checkbox" class="spoilerhider" id="showinvocation" /> +<label for="showinvocation" >Show analyzer invocation</label> +<div class="spoiler">clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name sensors-applet.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/sensors-applet -resource-dir /usr/lib64/clang/16 -D HAVE_CONFIG_H -I . -D MATELOCALEDIR="/usr/local/share/locale/" -D G_LOG_DOMAIN="sensors-applet" -D PIXMAPS_DIR="/usr/local/share/pixmaps/mate-sensors-applet/" -D DATADIR="/usr/local/share" -D LIBDIR="/usr/local/lib" -D UIDIR="/usr/local/share/mate-sensors-applet/ui" -D SENSORS_APPLET_PLUGIN_DIR="/usr/local/lib/mate-sensors-applet/plugins" -D SYSCONFDIR="/usr/local/etc" -D PREFIX="/usr/local" -I .. -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/mate-panel-4.0/libmate-panel-applet -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/cairo -I /usr/include/libpng16 -I /usr/include/freetype2 -I /usr/include/harfbuzz -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libxml2 -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -D PIC -internal-isystem /usr/lib64/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/sensors-applet -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2023-06-12-021133-6157-1 -x c sensors-applet.c +</div> +<div id='tooltiphint' hidden="true"> + <p>Keyboard shortcuts: </p> + <ul> + <li>Use 'j/k' keys for keyboard navigation</li> + <li>Use 'Shift+S' to show/hide relevant lines</li> + <li>Use '?' to toggle this window</li> + </ul> + <a href="#" onclick="toggleHelp(); return false;">Close</a> +</div> +<script type='text/javascript'> +var relevant_lines = {"1": {"449": 1, "452": 1, "453": 1, "454": 1, "456": 1, "458": 1, "459": 1, "461": 1, "462": 1, "463": 1, "465": 1, "467": 1, "472": 1, "500": 1, "502": 1, "503": 1, "505": 1, "506": 1, "512": 1, "514": 1, "515": 1, "516": 1, "517": 1, "518": 1, "525": 1, "529": 1}}; + +var filterCounterexample = function (hide) { + var tables = document.getElementsByClassName("code"); + for (var t=0; t<tables.length; t++) { + var table = tables[t]; + var file_id = table.getAttribute("data-fileid"); + var lines_in_fid = relevant_lines[file_id]; + if (!lines_in_fid) { + lines_in_fid = {}; + } + var lines = table.getElementsByClassName("codeline"); + for (var i=0; i<lines.length; i++) { + var el = lines[i]; + var lineNo = el.getAttribute("data-linenumber"); + if (!lines_in_fid[lineNo]) { + if (hide) { + el.setAttribute("hidden", ""); + } else { + el.removeAttribute("hidden"); + } + } + } + } +} + +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + // SHIFT + S + if (event.shiftKey && event.keyCode == 83) { + var checked = document.getElementsByName("showCounterexample")[0].checked; + filterCounterexample(!checked); + document.getElementsByName("showCounterexample")[0].click(); + } else { + return; + } + event.preventDefault(); +}, true); + +document.addEventListener("DOMContentLoaded", function() { + document.querySelector('input[name="showCounterexample"]').onchange= + function (event) { + filterCounterexample(this.checked); + }; +}); +</script> + +<form> + <input type="checkbox" name="showCounterexample" id="showCounterexample" /> + <label for="showCounterexample"> + Show only relevant lines + </label> + <input type="checkbox" name="showArrows" + id="showArrows" style="margin-left: 10px" /> + <label for="showArrows"> + Show control flow arrows + </label> +</form> + +<script type='text/javascript'> +// Return range of numbers from a range [lower, upper). +function range(lower, upper) { + var array = []; + for (var i = lower; i <= upper; ++i) { + array.push(i); + } + return array; +} + +var getRelatedArrowIndices = function(pathId) { + // HTML numeration of events is a bit different than it is in the path. + // Everything is rotated one step to the right, so the last element + // (error diagnostic) has index 0. + if (pathId == 0) { + // arrowIndices has at least 2 elements + pathId = arrowIndices.length - 1; + } + + return range(arrowIndices[pathId], arrowIndices[pathId - 1]); +} + +var highlightArrowsForSelectedEvent = function() { + const selectedNum = findNum(); + const arrowIndicesToHighlight = getRelatedArrowIndices(selectedNum); + arrowIndicesToHighlight.forEach((index) => { + var arrow = document.querySelector("#arrow" + index); + if(arrow) { + classListAdd(arrow, "selected") + } + }); +} + +var getAbsoluteBoundingRect = function(element) { + const relative = element.getBoundingClientRect(); + return { + left: relative.left + window.pageXOffset, + right: relative.right + window.pageXOffset, + top: relative.top + window.pageYOffset, + bottom: relative.bottom + window.pageYOffset, + height: relative.height, + width: relative.width + }; +} + +var drawArrow = function(index) { + // This function is based on the great answer from SO: + // https://stackoverflow.com/a/39575674/11582326 + var start = document.querySelector("#start" + index); + var end = document.querySelector("#end" + index); + var arrow = document.querySelector("#arrow" + index); + + var startRect = getAbsoluteBoundingRect(start); + var endRect = getAbsoluteBoundingRect(end); + + // It is an arrow from a token to itself, no need to visualize it. + if (startRect.top == endRect.top && + startRect.left == endRect.left) + return; + + // Each arrow is a very simple Bézier curve, with two nodes and + // two handles. So, we need to calculate four points in the window: + // * start node + var posStart = { x: 0, y: 0 }; + // * end node + var posEnd = { x: 0, y: 0 }; + // * handle for the start node + var startHandle = { x: 0, y: 0 }; + // * handle for the end node + var endHandle = { x: 0, y: 0 }; + // One can visualize it as follows: + // + // start handle + // / + // X"""_.-""""X + // .' \ + // / start node + // | + // | + // | end node + // \ / + // `->X + // X-' + // \ + // end handle + // + // NOTE: (0, 0) is the top left corner of the window. + + // We have 3 similar, but still different scenarios to cover: + // + // 1. Two tokens on different lines. + // -xxx + // / + // \ + // -> xxx + // In this situation, we draw arrow on the left curving to the left. + // 2. Two tokens on the same line, and the destination is on the right. + // ____ + // / \ + // / V + // xxx xxx + // In this situation, we draw arrow above curving upwards. + // 3. Two tokens on the same line, and the destination is on the left. + // xxx xxx + // ^ / + // \____/ + // In this situation, we draw arrow below curving downwards. + const onDifferentLines = startRect.top <= endRect.top - 5 || + startRect.top >= endRect.top + 5; + const leftToRight = startRect.left < endRect.left; + + // NOTE: various magic constants are chosen empirically for + // better positioning and look + if (onDifferentLines) { + // Case #1 + const topToBottom = startRect.top < endRect.top; + posStart.x = startRect.left - 1; + // We don't want to start it at the top left corner of the token, + // it doesn't feel like this is where the arrow comes from. + // For this reason, we start it in the middle of the left side + // of the token. + posStart.y = startRect.top + startRect.height / 2; + + // End node has arrow head and we give it a bit more space. + posEnd.x = endRect.left - 4; + posEnd.y = endRect.top; + + // Utility object with x and y offsets for handles. + var curvature = { + // We want bottom-to-top arrow to curve a bit more, so it doesn't + // overlap much with top-to-bottom curves (much more frequent). + x: topToBottom ? 15 : 25, + y: Math.min((posEnd.y - posStart.y) / 3, 10) + } + + // When destination is on the different line, we can make a + // curvier arrow because we have space for it. + // So, instead of using + // + // startHandle.x = posStart.x - curvature.x + // endHandle.x = posEnd.x - curvature.x + // + // We use the leftmost of these two values for both handles. + startHandle.x = Math.min(posStart.x, posEnd.x) - curvature.x; + endHandle.x = startHandle.x; + + // Curving downwards from the start node... + startHandle.y = posStart.y + curvature.y; + // ... and upwards from the end node. + endHandle.y = posEnd.y - curvature.y; + + } else if (leftToRight) { + // Case #2 + // Starting from the top right corner... + posStart.x = startRect.right - 1; + posStart.y = startRect.top; + + // ...and ending at the top left corner of the end token. + posEnd.x = endRect.left + 1; + posEnd.y = endRect.top - 1; + + // Utility object with x and y offsets for handles. + var curvature = { + x: Math.min((posEnd.x - posStart.x) / 3, 15), + y: 5 + } + + // Curving to the right... + startHandle.x = posStart.x + curvature.x; + // ... and upwards from the start node. + startHandle.y = posStart.y - curvature.y; + + // And to the left... + endHandle.x = posEnd.x - curvature.x; + // ... and upwards from the end node. + endHandle.y = posEnd.y - curvature.y; + + } else { + // Case #3 + // Starting from the bottom right corner... + posStart.x = startRect.right; + posStart.y = startRect.bottom; + + // ...and ending also at the bottom right corner, but of the end token. + posEnd.x = endRect.right - 1; + posEnd.y = endRect.bottom + 1; + + // Utility object with x and y offsets for handles. + var curvature = { + x: Math.min((posStart.x - posEnd.x) / 3, 15), + y: 5 + } + + // Curving to the left... + startHandle.x = posStart.x - curvature.x; + // ... and downwards from the start node. + startHandle.y = posStart.y + curvature.y; + + // And to the right... + endHandle.x = posEnd.x + curvature.x; + // ... and downwards from the end node. + endHandle.y = posEnd.y + curvature.y; + } + + // Put it all together into a path. + // More information on the format: + // https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths + var pathStr = "M" + posStart.x + "," + posStart.y + " " + + "C" + startHandle.x + "," + startHandle.y + " " + + endHandle.x + "," + endHandle.y + " " + + posEnd.x + "," + posEnd.y; + + arrow.setAttribute("d", pathStr); +}; + +var drawArrows = function() { + const numOfArrows = document.querySelectorAll("path[id^=arrow]").length; + for (var i = 0; i < numOfArrows; ++i) { + drawArrow(i); + } +} + +var toggleArrows = function(event) { + const arrows = document.querySelector("#arrows"); + if (event.target.checked) { + arrows.setAttribute("visibility", "visible"); + } else { + arrows.setAttribute("visibility", "hidden"); + } +} + +window.addEventListener("resize", drawArrows); +document.addEventListener("DOMContentLoaded", function() { + // Whenever we show invocation, locations change, i.e. we + // need to redraw arrows. + document + .querySelector('input[id="showinvocation"]') + .addEventListener("click", drawArrows); + // Hiding irrelevant lines also should cause arrow rerender. + document + .querySelector('input[name="showCounterexample"]') + .addEventListener("change", drawArrows); + document + .querySelector('input[name="showArrows"]') + .addEventListener("change", toggleArrows); + drawArrows(); + // Default highlighting for the last event. + highlightArrowsForSelectedEvent(); +}); +</script> + +<script type='text/javascript'> +var digitMatcher = new RegExp("[0-9]+"); + +var querySelectorAllArray = function(selector) { + return Array.prototype.slice.call( + document.querySelectorAll(selector)); +} + +document.addEventListener("DOMContentLoaded", function() { + querySelectorAllArray(".PathNav > a").forEach( + function(currentValue, currentIndex) { + var hrefValue = currentValue.getAttribute("href"); + currentValue.onclick = function() { + scrollTo(document.querySelector(hrefValue)); + return false; + }; + }); +}); + +var findNum = function() { + var s = document.querySelector(".msg.selected"); + if (!s || s.id == "EndPath") { + return 0; + } + var out = parseInt(digitMatcher.exec(s.id)[0]); + return out; +}; + +var classListAdd = function(el, theClass) { + if(!el.className.baseVal) + el.className += " " + theClass; + else + el.className.baseVal += " " + theClass; +}; + +var classListRemove = function(el, theClass) { + var className = (!el.className.baseVal) ? + el.className : el.className.baseVal; + className = className.replace(" " + theClass, ""); + if(!el.className.baseVal) + el.className = className; + else + el.className.baseVal = className; +}; + +var scrollTo = function(el) { + querySelectorAllArray(".selected").forEach(function(s) { + classListRemove(s, "selected"); + }); + classListAdd(el, "selected"); + window.scrollBy(0, el.getBoundingClientRect().top - + (window.innerHeight / 2)); + highlightArrowsForSelectedEvent(); +}; + +var move = function(num, up, numItems) { + if (num == 1 && up || num == numItems - 1 && !up) { + return 0; + } else if (num == 0 && up) { + return numItems - 1; + } else if (num == 0 && !up) { + return 1 % numItems; + } + return up ? num - 1 : num + 1; +} + +var numToId = function(num) { + if (num == 0) { + return document.getElementById("EndPath") + } + return document.getElementById("Path" + num); +}; + +var navigateTo = function(up) { + var numItems = document.querySelectorAll( + ".line > .msgEvent, .line > .msgControl").length; + var currentSelected = findNum(); + var newSelected = move(currentSelected, up, numItems); + var newEl = numToId(newSelected, numItems); + + // Scroll element into center. + scrollTo(newEl); +}; + +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + // key 'j' + if (event.keyCode == 74) { + navigateTo(/*up=*/false); + // key 'k' + } else if (event.keyCode == 75) { + navigateTo(/*up=*/true); + } else { + return; + } + event.preventDefault(); +}, true); +</script> + +<script type='text/javascript'> + +var toggleHelp = function() { + var hint = document.querySelector("#tooltiphint"); + var attributeName = "hidden"; + if (hint.hasAttribute(attributeName)) { + hint.removeAttribute(attributeName); + } else { + hint.setAttribute("hidden", "true"); + } +}; +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + if (event.key == "?") { + toggleHelp(); + } else { + return; + } + event.preventDefault(); +}); +</script> + +<style type="text/css"> + svg { + position:absolute; + top:0; + left:0; + height:100%; + width:100%; + pointer-events: none; + overflow: visible + } + .arrow { + stroke-opacity: 0.2; + stroke-width: 1; + marker-end: url(#arrowhead); + } + + .arrow.selected { + stroke-opacity: 0.6; + stroke-width: 2; + marker-end: url(#arrowheadSelected); + } + + .arrowhead { + orient: auto; + stroke: none; + opacity: 0.6; + fill: blue; + } +</style> +<svg xmlns="http://www.w3.org/2000/svg"> + <defs> + <marker id="arrowheadSelected" class="arrowhead" opacity="0.6" + viewBox="0 0 10 10" refX="3" refY="5" + markerWidth="4" markerHeight="4"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + <marker id="arrowhead" class="arrowhead" opacity="0.2" + viewBox="0 0 10 10" refX="3" refY="5" + markerWidth="4" markerHeight="4"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + </defs> + <g id="arrows" fill="none" stroke="blue" visibility="hidden"> + <path class="arrow" id="arrow0"/> + <path class="arrow" id="arrow1"/> + <path class="arrow" id="arrow2"/> + <path class="arrow" id="arrow3"/> + <path class="arrow" id="arrow4"/> + <path class="arrow" id="arrow5"/> + <path class="arrow" id="arrow6"/> + <path class="arrow" id="arrow7"/> + <path class="arrow" id="arrow8"/> + <path class="arrow" id="arrow9"/> + <path class="arrow" id="arrow10"/> + <path class="arrow" id="arrow11"/> + <path class="arrow" id="arrow12"/> + <path class="arrow" id="arrow13"/> + <path class="arrow" id="arrow14"/> + <path class="arrow" id="arrow15"/> + <path class="arrow" id="arrow16"/> + <path class="arrow" id="arrow17"/> + <path class="arrow" id="arrow18"/> + <path class="arrow" id="arrow19"/> + <path class="arrow" id="arrow20"/> + <path class="arrow" id="arrow21"/> + <path class="arrow" id="arrow22"/> + <path class="arrow" id="arrow23"/> + <path class="arrow" id="arrow24"/> + <path class="arrow" id="arrow25"/> + + </g> +</svg> +<script type='text/javascript'> +const arrowIndices = [ 26,24,23,21,18,17,12,10,8,7,5,1,0 ] +</script> +<table class="code" data-fileid="1"> +<tr class="codeline" data-linenumber="1"><td class="num" id="LN1">1</td><td class="line"><span class='comment'>/*</span></td></tr> +<tr class="codeline" data-linenumber="2"><td class="num" id="LN2">2</td><td class="line"> <span class='comment'>* Copyright (C) 2005-2009 Alex Murray <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="3"><td class="num" id="LN3">3</td><td class="line"> <span class='comment'>* Copyright (C) 2012-2021 MATE Developers</span></td></tr> +<tr class="codeline" data-linenumber="4"><td class="num" id="LN4">4</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="5"><td class="num" id="LN5">5</td><td class="line"> <span class='comment'>* This program is free software; you can redistribute it and/or modify</span></td></tr> +<tr class="codeline" data-linenumber="6"><td class="num" id="LN6">6</td><td class="line"> <span class='comment'>* it under the terms of the GNU General Public License as published by</span></td></tr> +<tr class="codeline" data-linenumber="7"><td class="num" id="LN7">7</td><td class="line"> <span class='comment'>* the Free Software Foundation; either version 2 of the License, or</span></td></tr> +<tr class="codeline" data-linenumber="8"><td class="num" id="LN8">8</td><td class="line"> <span class='comment'>* (at your option) any later version.</span></td></tr> +<tr class="codeline" data-linenumber="9"><td class="num" id="LN9">9</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="10"><td class="num" id="LN10">10</td><td class="line"> <span class='comment'>* This program is distributed in the hope that it will be useful,</span></td></tr> +<tr class="codeline" data-linenumber="11"><td class="num" id="LN11">11</td><td class="line"> <span class='comment'>* but WITHOUT ANY WARRANTY; without even the implied warranty of</span></td></tr> +<tr class="codeline" data-linenumber="12"><td class="num" id="LN12">12</td><td class="line"> <span class='comment'>* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></td></tr> +<tr class="codeline" data-linenumber="13"><td class="num" id="LN13">13</td><td class="line"> <span class='comment'>* GNU General Public License for more details.</span></td></tr> +<tr class="codeline" data-linenumber="14"><td class="num" id="LN14">14</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="15"><td class="num" id="LN15">15</td><td class="line"> <span class='comment'>* You should have received a copy of the GNU General Public License</span></td></tr> +<tr class="codeline" data-linenumber="16"><td class="num" id="LN16">16</td><td class="line"> <span class='comment'>* along with this program; if not, write to the Free Software</span></td></tr> +<tr class="codeline" data-linenumber="17"><td class="num" id="LN17">17</td><td class="line"> <span class='comment'>* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</span></td></tr> +<tr class="codeline" data-linenumber="18"><td class="num" id="LN18">18</td><td class="line"> <span class='comment'>*/</span></td></tr> +<tr class="codeline" data-linenumber="19"><td class="num" id="LN19">19</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="20"><td class="num" id="LN20">20</td><td class="line"><span class='comment'>/** Contain the functions for operating on the SensorsApplet structure</span></td></tr> +<tr class="codeline" data-linenumber="21"><td class="num" id="LN21">21</td><td class="line"> <span class='comment'>* (represents the applet itself, and its associated variables.</span></td></tr> +<tr class="codeline" data-linenumber="22"><td class="num" id="LN22">22</td><td class="line"> <span class='comment'>*/</span></td></tr> +<tr class="codeline" data-linenumber="23"><td class="num" id="LN23">23</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="24"><td class="num" id="LN24">24</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_CONFIG_H<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="25"><td class="num" id="LN25">25</td><td class="line"><span class='directive'>#include "config.h"</span></td></tr> +<tr class="codeline" data-linenumber="26"><td class="num" id="LN26">26</td><td class="line"><span class='directive'>#endif /* HAVE_CONFIG_H */</span></td></tr> +<tr class="codeline" data-linenumber="27"><td class="num" id="LN27">27</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="28"><td class="num" id="LN28">28</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_UNISTD_H<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="29"><td class="num" id="LN29">29</td><td class="line"><span class='directive'>#include <unistd.h></span></td></tr> +<tr class="codeline" data-linenumber="30"><td class="num" id="LN30">30</td><td class="line"><span class='directive'>#endif /* HAVE_UNISTD_H */</span></td></tr> +<tr class="codeline" data-linenumber="31"><td class="num" id="LN31">31</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="32"><td class="num" id="LN32">32</td><td class="line"><span class='directive'>#include <glib/gi18n.h></span></td></tr> +<tr class="codeline" data-linenumber="33"><td class="num" id="LN33">33</td><td class="line"><span class='directive'>#include <glib/gprintf.h></span></td></tr> +<tr class="codeline" data-linenumber="34"><td class="num" id="LN34">34</td><td class="line"><span class='directive'>#include <gio/gio.h></span></td></tr> +<tr class="codeline" data-linenumber="35"><td class="num" id="LN35">35</td><td class="line"><span class='directive'>#include "sensors-applet.h"</span></td></tr> +<tr class="codeline" data-linenumber="36"><td class="num" id="LN36">36</td><td class="line"><span class='directive'>#include "active-sensor.h"</span></td></tr> +<tr class="codeline" data-linenumber="37"><td class="num" id="LN37">37</td><td class="line"><span class='directive'>#include "sensors-applet-settings.h"</span></td></tr> +<tr class="codeline" data-linenumber="38"><td class="num" id="LN38">38</td><td class="line"><span class='directive'>#include "sensors-applet-plugins.h"</span></td></tr> +<tr class="codeline" data-linenumber="39"><td class="num" id="LN39">39</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="40"><td class="num" id="LN40">40</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_LIBNOTIFY<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="41"><td class="num" id="LN41">41</td><td class="line"><span class='directive'>#include "active-sensor-libnotify.h"</span></td></tr> +<tr class="codeline" data-linenumber="42"><td class="num" id="LN42">42</td><td class="line"><span class='directive'>#define <span class='macro'>DEFAULT_NOTIFY_TIMEOUT<span class='macro_popup'>3000</span></span> 3000</span></td></tr> +<tr class="codeline" data-linenumber="43"><td class="num" id="LN43">43</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="44"><td class="num" id="LN44">44</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="45"><td class="num" id="LN45">45</td><td class="line"><span class='directive'>#include "prefs-dialog.h"</span></td></tr> +<tr class="codeline" data-linenumber="46"><td class="num" id="LN46">46</td><td class="line"><span class='directive'>#include "about-dialog.h"</span></td></tr> +<tr class="codeline" data-linenumber="47"><td class="num" id="LN47">47</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="48"><td class="num" id="LN48">48</td><td class="line"><span class='directive'>#define <span class='macro'>SENSORS_APPLET_MENU_FILE<span class='macro_popup'>"SensorsApplet.xml"</span></span> "SensorsApplet.xml"</span></td></tr> +<tr class="codeline" data-linenumber="49"><td class="num" id="LN49">49</td><td class="line"><span class='comment'>/* initially set as sensors_applet->size to ensure a real value is stored */</span></td></tr> +<tr class="codeline" data-linenumber="50"><td class="num" id="LN50">50</td><td class="line"><span class='directive'>#define <span class='macro'>DEFAULT_APPLET_SIZE<span class='macro_popup'>24</span></span> 24</span></td></tr> +<tr class="codeline" data-linenumber="51"><td class="num" id="LN51">51</td><td class="line"><span class='directive'>#define <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span> 2</span></td></tr> +<tr class="codeline" data-linenumber="52"><td class="num" id="LN52">52</td><td class="line"><span class='directive'>#define <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span> 1</span></td></tr> +<tr class="codeline" data-linenumber="53"><td class="num" id="LN53">53</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="54"><td class="num" id="LN54">54</td><td class="line"><span class='comment'>/* builder for sensor sorting verification */</span></td></tr> +<tr class="codeline" data-linenumber="55"><td class="num" id="LN55">55</td><td class="line"><span class='keyword'>static</span> GVariantBuilder gvb_sensors_hash_list;</td></tr> +<tr class="codeline" data-linenumber="56"><td class="num" id="LN56">56</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="57"><td class="num" id="LN57">57</td><td class="line"><span class='comment'>/* callbacks for panel menu */</span></td></tr> +<tr class="codeline" data-linenumber="58"><td class="num" id="LN58">58</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> prefs_cb(GtkAction *action, gpointer *data) {</td></tr> +<tr class="codeline" data-linenumber="59"><td class="num" id="LN59">59</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="60"><td class="num" id="LN60">60</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="61"><td class="num" id="LN61">61</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="62"><td class="num" id="LN62">62</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="63"><td class="num" id="LN63">63</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->prefs_dialog) {</td></tr> +<tr class="codeline" data-linenumber="64"><td class="num" id="LN64">64</td><td class="line"> gtk_window_present(<span class='macro'>GTK_WINDOW(sensors_applet->prefs_dialog->dialog)<span class='macro_popup'>((((GtkWindow*) (void *) ((sensors_applet->prefs_dialog-><br>dialog)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="65"><td class="num" id="LN65">65</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="66"><td class="num" id="LN66">66</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="67"><td class="num" id="LN67">67</td><td class="line"> prefs_dialog_open(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="68"><td class="num" id="LN68">68</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="69"><td class="num" id="LN69">69</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="70"><td class="num" id="LN70">70</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> about_cb(GtkAction *action, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="71"><td class="num" id="LN71">71</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="72"><td class="num" id="LN72">72</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="73"><td class="num" id="LN73">73</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="74"><td class="num" id="LN74">74</td><td class="line"> about_dialog_open(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="75"><td class="num" id="LN75">75</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="76"><td class="num" id="LN76">76</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="77"><td class="num" id="LN77">77</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> help_cb(GtkAction *action, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="78"><td class="num" id="LN78">78</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="79"><td class="num" id="LN79">79</td><td class="line"> GError *error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="80"><td class="num" id="LN80">80</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="81"><td class="num" id="LN81">81</td><td class="line"> gtk_show_uri_on_window(<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='string_literal'>"help:mate-sensors-applet"</span>,</td></tr> +<tr class="codeline" data-linenumber="82"><td class="num" id="LN82">82</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="83"><td class="num" id="LN83">83</td><td class="line"> gtk_get_current_event_time(),</td></tr> +<tr class="codeline" data-linenumber="84"><td class="num" id="LN84">84</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="85"><td class="num" id="LN85">85</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="86"><td class="num" id="LN86">86</td><td class="line"> <span class='keyword'>if</span> (error) {</td></tr> +<tr class="codeline" data-linenumber="87"><td class="num" id="LN87">87</td><td class="line"> g_debug(<span class='string_literal'>"Could not open help document: %s "</span>,error->message);</td></tr> +<tr class="codeline" data-linenumber="88"><td class="num" id="LN88">88</td><td class="line"> g_error_free(error);</td></tr> +<tr class="codeline" data-linenumber="89"><td class="num" id="LN89">89</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="90"><td class="num" id="LN90">90</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="91"><td class="num" id="LN91">91</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="92"><td class="num" id="LN92">92</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> destroy_cb(GtkWidget *widget, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="93"><td class="num" id="LN93">93</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="94"><td class="num" id="LN94">94</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="95"><td class="num" id="LN95">95</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="96"><td class="num" id="LN96">96</td><td class="line"> <span class='comment'>/* destroy dialogs, remove timeout and clear sensors tree and finally the applet */</span></td></tr> +<tr class="codeline" data-linenumber="97"><td class="num" id="LN97">97</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->prefs_dialog != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="98"><td class="num" id="LN98">98</td><td class="line"> <span class='comment'>/* destroy's dialog too */</span></td></tr> +<tr class="codeline" data-linenumber="99"><td class="num" id="LN99">99</td><td class="line"> prefs_dialog_close(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="100"><td class="num" id="LN100">100</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="101"><td class="num" id="LN101">101</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="102"><td class="num" id="LN102">102</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->timeout_id) {</td></tr> +<tr class="codeline" data-linenumber="103"><td class="num" id="LN103">103</td><td class="line"> g_source_remove(sensors_applet->timeout_id);</td></tr> +<tr class="codeline" data-linenumber="104"><td class="num" id="LN104">104</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="105"><td class="num" id="LN105">105</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="106"><td class="num" id="LN106">106</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->settings) {</td></tr> +<tr class="codeline" data-linenumber="107"><td class="num" id="LN107">107</td><td class="line"> g_object_unref (sensors_applet->settings);</td></tr> +<tr class="codeline" data-linenumber="108"><td class="num" id="LN108">108</td><td class="line"> sensors_applet->settings = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="109"><td class="num" id="LN109">109</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="110"><td class="num" id="LN110">110</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="111"><td class="num" id="LN111">111</td><td class="line"> <span class='comment'>/* destroy all active sensors */</span></td></tr> +<tr class="codeline" data-linenumber="112"><td class="num" id="LN112">112</td><td class="line"> g_list_foreach(sensors_applet->active_sensors,</td></tr> +<tr class="codeline" data-linenumber="113"><td class="num" id="LN113">113</td><td class="line"> (GFunc)active_sensor_destroy,</td></tr> +<tr class="codeline" data-linenumber="114"><td class="num" id="LN114">114</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="115"><td class="num" id="LN115">115</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="116"><td class="num" id="LN116">116</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->sensors != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="117"><td class="num" id="LN117">117</td><td class="line"> gtk_tree_store_clear(sensors_applet->sensors);</td></tr> +<tr class="codeline" data-linenumber="118"><td class="num" id="LN118">118</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="119"><td class="num" id="LN119">119</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="120"><td class="num" id="LN120">120</td><td class="line"> gtk_widget_destroy(<span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="121"><td class="num" id="LN121">121</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="122"><td class="num" id="LN122">122</td><td class="line"> g_free(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="123"><td class="num" id="LN123">123</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="124"><td class="num" id="LN124">124</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="125"><td class="num" id="LN125">125</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="126"><td class="num" id="LN126">126</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> change_orient_cb (MatePanelApplet *applet,</td></tr> +<tr class="codeline" data-linenumber="127"><td class="num" id="LN127">127</td><td class="line"> MatePanelAppletOrient orient,</td></tr> +<tr class="codeline" data-linenumber="128"><td class="num" id="LN128">128</td><td class="line"> gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="129"><td class="num" id="LN129">129</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="130"><td class="num" id="LN130">130</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="131"><td class="num" id="LN131">131</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="132"><td class="num" id="LN132">132</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="133"><td class="num" id="LN133">133</td><td class="line"> sensors_applet_display_layout_changed(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="134"><td class="num" id="LN134">134</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="135"><td class="num" id="LN135">135</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="136"><td class="num" id="LN136">136</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> size_allocate_cb(MatePanelApplet *applet,</td></tr> +<tr class="codeline" data-linenumber="137"><td class="num" id="LN137">137</td><td class="line"> GtkAllocation *allocation,</td></tr> +<tr class="codeline" data-linenumber="138"><td class="num" id="LN138">138</td><td class="line"> gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="139"><td class="num" id="LN139">139</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="140"><td class="num" id="LN140">140</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="141"><td class="num" id="LN141">141</td><td class="line"> MatePanelAppletOrient orient;</td></tr> +<tr class="codeline" data-linenumber="142"><td class="num" id="LN142">142</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="143"><td class="num" id="LN143">143</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="144"><td class="num" id="LN144">144</td><td class="line"> orient = mate_panel_applet_get_orient(sensors_applet->applet);</td></tr> +<tr class="codeline" data-linenumber="145"><td class="num" id="LN145">145</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="146"><td class="num" id="LN146">146</td><td class="line"> <span class='keyword'>if</span> ((orient == MATE_PANEL_APPLET_ORIENT_LEFT) ||</td></tr> +<tr class="codeline" data-linenumber="147"><td class="num" id="LN147">147</td><td class="line"> (orient == MATE_PANEL_APPLET_ORIENT_RIGHT)) {</td></tr> +<tr class="codeline" data-linenumber="148"><td class="num" id="LN148">148</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="149"><td class="num" id="LN149">149</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->size == allocation->width)</td></tr> +<tr class="codeline" data-linenumber="150"><td class="num" id="LN150">150</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="151"><td class="num" id="LN151">151</td><td class="line"> sensors_applet->size = allocation->width;</td></tr> +<tr class="codeline" data-linenumber="152"><td class="num" id="LN152">152</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="153"><td class="num" id="LN153">153</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->size == allocation->height)</td></tr> +<tr class="codeline" data-linenumber="154"><td class="num" id="LN154">154</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="155"><td class="num" id="LN155">155</td><td class="line"> sensors_applet->size = allocation->height;</td></tr> +<tr class="codeline" data-linenumber="156"><td class="num" id="LN156">156</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="157"><td class="num" id="LN157">157</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="158"><td class="num" id="LN158">158</td><td class="line"> <span class='comment'>/* update if new value */</span></td></tr> +<tr class="codeline" data-linenumber="159"><td class="num" id="LN159">159</td><td class="line"> sensors_applet_graph_size_changed(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="160"><td class="num" id="LN160">160</td><td class="line"> sensors_applet_display_layout_changed(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="161"><td class="num" id="LN161">161</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="162"><td class="num" id="LN162">162</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="163"><td class="num" id="LN163">163</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> style_set_cb(GtkWidget *widget, GtkStyle *old_style, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="164"><td class="num" id="LN164">164</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="165"><td class="num" id="LN165">165</td><td class="line"> <span class='comment'>/* update all icons in the sensors tree and update all active sensors */</span></td></tr> +<tr class="codeline" data-linenumber="166"><td class="num" id="LN166">166</td><td class="line"> GtkTreeIter interfaces_iter, sensors_iter;</td></tr> +<tr class="codeline" data-linenumber="167"><td class="num" id="LN167">167</td><td class="line"> gboolean not_end_of_interfaces = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>, not_end_of_sensors = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="168"><td class="num" id="LN168">168</td><td class="line"> IconType icon_type;</td></tr> +<tr class="codeline" data-linenumber="169"><td class="num" id="LN169">169</td><td class="line"> gboolean enabled;</td></tr> +<tr class="codeline" data-linenumber="170"><td class="num" id="LN170">170</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="171"><td class="num" id="LN171">171</td><td class="line"> DisplayMode display_mode;</td></tr> +<tr class="codeline" data-linenumber="172"><td class="num" id="LN172">172</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="173"><td class="num" id="LN173">173</td><td class="line"> sensors_applet = (SensorsApplet *)data;</td></tr> +<tr class="codeline" data-linenumber="174"><td class="num" id="LN174">174</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="175"><td class="num" id="LN175">175</td><td class="line"> display_mode = g_settings_get_int (sensors_applet->settings, <span class='macro'>DISPLAY_MODE<span class='macro_popup'>"display-mode"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="176"><td class="num" id="LN176">176</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->sensors) {</td></tr> +<tr class="codeline" data-linenumber="177"><td class="num" id="LN177">177</td><td class="line"> <span class='keyword'>for</span> (gtk_tree_model_get_iter_first(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &interfaces_iter);</td></tr> +<tr class="codeline" data-linenumber="178"><td class="num" id="LN178">178</td><td class="line"> not_end_of_interfaces;</td></tr> +<tr class="codeline" data-linenumber="179"><td class="num" id="LN179">179</td><td class="line"> not_end_of_interfaces = gtk_tree_model_iter_next(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &interfaces_iter)) {</td></tr> +<tr class="codeline" data-linenumber="180"><td class="num" id="LN180">180</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="181"><td class="num" id="LN181">181</td><td class="line"> <span class='comment'>/* reset sensors sentinel */</span></td></tr> +<tr class="codeline" data-linenumber="182"><td class="num" id="LN182">182</td><td class="line"> not_end_of_sensors = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="183"><td class="num" id="LN183">183</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="184"><td class="num" id="LN184">184</td><td class="line"> <span class='keyword'>for</span> (gtk_tree_model_iter_children(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter, &interfaces_iter);</td></tr> +<tr class="codeline" data-linenumber="185"><td class="num" id="LN185">185</td><td class="line"> not_end_of_sensors;</td></tr> +<tr class="codeline" data-linenumber="186"><td class="num" id="LN186">186</td><td class="line"> not_end_of_sensors = gtk_tree_model_iter_next(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter)) {</td></tr> +<tr class="codeline" data-linenumber="187"><td class="num" id="LN187">187</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="188"><td class="num" id="LN188">188</td><td class="line"> GdkPixbuf *new_icon;</td></tr> +<tr class="codeline" data-linenumber="189"><td class="num" id="LN189">189</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="190"><td class="num" id="LN190">190</td><td class="line"> gtk_tree_model_get(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="191"><td class="num" id="LN191">191</td><td class="line"> &sensors_iter,</td></tr> +<tr class="codeline" data-linenumber="192"><td class="num" id="LN192">192</td><td class="line"> ENABLE_COLUMN, &enabled,</td></tr> +<tr class="codeline" data-linenumber="193"><td class="num" id="LN193">193</td><td class="line"> ICON_TYPE_COLUMN, &icon_type,</td></tr> +<tr class="codeline" data-linenumber="194"><td class="num" id="LN194">194</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="195"><td class="num" id="LN195">195</td><td class="line"> <span class='comment'>/* update icons */</span></td></tr> +<tr class="codeline" data-linenumber="196"><td class="num" id="LN196">196</td><td class="line"> new_icon = sensors_applet_load_icon(icon_type);</td></tr> +<tr class="codeline" data-linenumber="197"><td class="num" id="LN197">197</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="198"><td class="num" id="LN198">198</td><td class="line"> gtk_tree_store_set(sensors_applet->sensors,</td></tr> +<tr class="codeline" data-linenumber="199"><td class="num" id="LN199">199</td><td class="line"> &sensors_iter,</td></tr> +<tr class="codeline" data-linenumber="200"><td class="num" id="LN200">200</td><td class="line"> ICON_PIXBUF_COLUMN, new_icon,</td></tr> +<tr class="codeline" data-linenumber="201"><td class="num" id="LN201">201</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="202"><td class="num" id="LN202">202</td><td class="line"> g_object_unref(new_icon);</td></tr> +<tr class="codeline" data-linenumber="203"><td class="num" id="LN203">203</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="204"><td class="num" id="LN204">204</td><td class="line"> <span class='comment'>/* update icons only if currently being displayed */</span></td></tr> +<tr class="codeline" data-linenumber="205"><td class="num" id="LN205">205</td><td class="line"> <span class='keyword'>if</span> (enabled &&</td></tr> +<tr class="codeline" data-linenumber="206"><td class="num" id="LN206">206</td><td class="line"> (display_mode == DISPLAY_ICON ||</td></tr> +<tr class="codeline" data-linenumber="207"><td class="num" id="LN207">207</td><td class="line"> display_mode == DISPLAY_ICON_WITH_VALUE)) {</td></tr> +<tr class="codeline" data-linenumber="208"><td class="num" id="LN208">208</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="209"><td class="num" id="LN209">209</td><td class="line"> GtkTreePath *path;</td></tr> +<tr class="codeline" data-linenumber="210"><td class="num" id="LN210">210</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="211"><td class="num" id="LN211">211</td><td class="line"> path = gtk_tree_model_get_path(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter);</td></tr> +<tr class="codeline" data-linenumber="212"><td class="num" id="LN212">212</td><td class="line"> sensors_applet_icon_changed(sensors_applet, path);</td></tr> +<tr class="codeline" data-linenumber="213"><td class="num" id="LN213">213</td><td class="line"> gtk_tree_path_free(path);</td></tr> +<tr class="codeline" data-linenumber="214"><td class="num" id="LN214">214</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="215"><td class="num" id="LN215">215</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="216"><td class="num" id="LN216">216</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="217"><td class="num" id="LN217">217</td><td class="line"> <span class='comment'>/* now update layout as size may have changed */</span></td></tr> +<tr class="codeline" data-linenumber="218"><td class="num" id="LN218">218</td><td class="line"> sensors_applet_display_layout_changed(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="219"><td class="num" id="LN219">219</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="220"><td class="num" id="LN220">220</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="221"><td class="num" id="LN221">221</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="222"><td class="num" id="LN222">222</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="223"><td class="num" id="LN223">223</td><td class="line"><span class='keyword'>static</span> gboolean mouse_enter_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data)</td></tr> +<tr class="codeline" data-linenumber="224"><td class="num" id="LN224">224</td><td class="line">{</td></tr> +<tr class="codeline" data-linenumber="225"><td class="num" id="LN225">225</td><td class="line"> SensorsApplet *sensor_applet = data;</td></tr> +<tr class="codeline" data-linenumber="226"><td class="num" id="LN226">226</td><td class="line"> sensor_applet->show_tooltip = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="227"><td class="num" id="LN227">227</td><td class="line"> sensors_applet_update_active_sensors(sensor_applet);</td></tr> +<tr class="codeline" data-linenumber="228"><td class="num" id="LN228">228</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="229"><td class="num" id="LN229">229</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="230"><td class="num" id="LN230">230</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="231"><td class="num" id="LN231">231</td><td class="line"><span class='keyword'>static</span> gboolean mouse_leave_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data)</td></tr> +<tr class="codeline" data-linenumber="232"><td class="num" id="LN232">232</td><td class="line">{</td></tr> +<tr class="codeline" data-linenumber="233"><td class="num" id="LN233">233</td><td class="line"> SensorsApplet *sensor_applet = data;</td></tr> +<tr class="codeline" data-linenumber="234"><td class="num" id="LN234">234</td><td class="line"> sensor_applet->show_tooltip = <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="235"><td class="num" id="LN235">235</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="236"><td class="num" id="LN236">236</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="237"><td class="num" id="LN237">237</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="238"><td class="num" id="LN238">238</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>const</span> GtkActionEntry sensors_applet_menu_actions[] = {</td></tr> +<tr class="codeline" data-linenumber="239"><td class="num" id="LN239">239</td><td class="line"> { <span class='string_literal'>"Preferences"</span>, <span class='string_literal'>"document-properties"</span>, <span class='macro'>N_(<span class='string_literal'>"_Preferences"</span>)<span class='macro_popup'>("_Preferences")</span></span>,</td></tr> +<tr class="codeline" data-linenumber="240"><td class="num" id="LN240">240</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="241"><td class="num" id="LN241">241</td><td class="line"> <span class='macro'>G_CALLBACK(prefs_cb)<span class='macro_popup'>((GCallback) (prefs_cb))</span></span> },</td></tr> +<tr class="codeline" data-linenumber="242"><td class="num" id="LN242">242</td><td class="line"> { <span class='string_literal'>"Help"</span>, <span class='string_literal'>"help-browser"</span>, <span class='macro'>N_(<span class='string_literal'>"_Help"</span>)<span class='macro_popup'>("_Help")</span></span>,</td></tr> +<tr class="codeline" data-linenumber="243"><td class="num" id="LN243">243</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="244"><td class="num" id="LN244">244</td><td class="line"> <span class='macro'>G_CALLBACK(help_cb)<span class='macro_popup'>((GCallback) (help_cb))</span></span> },</td></tr> +<tr class="codeline" data-linenumber="245"><td class="num" id="LN245">245</td><td class="line"> { <span class='string_literal'>"About"</span>, <span class='string_literal'>"help-about"</span>, <span class='macro'>N_(<span class='string_literal'>"_About"</span>)<span class='macro_popup'>("_About")</span></span>,</td></tr> +<tr class="codeline" data-linenumber="246"><td class="num" id="LN246">246</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="247"><td class="num" id="LN247">247</td><td class="line"> <span class='macro'>G_CALLBACK(about_cb)<span class='macro_popup'>((GCallback) (about_cb))</span></span> }</td></tr> +<tr class="codeline" data-linenumber="248"><td class="num" id="LN248">248</td><td class="line">};</td></tr> +<tr class="codeline" data-linenumber="249"><td class="num" id="LN249">249</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="250"><td class="num" id="LN250">250</td><td class="line"><span class='keyword'>void</span> sensors_applet_notify_active_sensor(ActiveSensor *active_sensor, NotifType notif_type) {</td></tr> +<tr class="codeline" data-linenumber="251"><td class="num" id="LN251">251</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_LIBNOTIFY<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="252"><td class="num" id="LN252">252</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="253"><td class="num" id="LN253">253</td><td class="line"> SensorsApplet *sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="254"><td class="num" id="LN254">254</td><td class="line"> gchar *summary, *message;</td></tr> +<tr class="codeline" data-linenumber="255"><td class="num" id="LN255">255</td><td class="line"> gint timeout_msecs;</td></tr> +<tr class="codeline" data-linenumber="256"><td class="num" id="LN256">256</td><td class="line"> gchar *sensor_label;</td></tr> +<tr class="codeline" data-linenumber="257"><td class="num" id="LN257">257</td><td class="line"> gchar *sensor_path;</td></tr> +<tr class="codeline" data-linenumber="258"><td class="num" id="LN258">258</td><td class="line"> SensorType sensor_type;</td></tr> +<tr class="codeline" data-linenumber="259"><td class="num" id="LN259">259</td><td class="line"> TemperatureScale temp_scale;</td></tr> +<tr class="codeline" data-linenumber="260"><td class="num" id="LN260">260</td><td class="line"> GtkTreeIter iter;</td></tr> +<tr class="codeline" data-linenumber="261"><td class="num" id="LN261">261</td><td class="line"> GtkTreePath *path;</td></tr> +<tr class="codeline" data-linenumber="262"><td class="num" id="LN262">262</td><td class="line"> <span class='keyword'>const</span> gchar *unit_type = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="263"><td class="num" id="LN263">263</td><td class="line"> <span class='keyword'>const</span> gchar *unit_type_title = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="264"><td class="num" id="LN264">264</td><td class="line"> <span class='keyword'>const</span> gchar *relation = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="265"><td class="num" id="LN265">265</td><td class="line"> <span class='keyword'>const</span> gchar *limit_type = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="266"><td class="num" id="LN266">266</td><td class="line"> <span class='keyword'>const</span> gchar *units = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="267"><td class="num" id="LN267">267</td><td class="line"> gdouble limit_value;</td></tr> +<tr class="codeline" data-linenumber="268"><td class="num" id="LN268">268</td><td class="line"> gdouble seconds;</td></tr> +<tr class="codeline" data-linenumber="269"><td class="num" id="LN269">269</td><td class="line"> gboolean show_notification = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="270"><td class="num" id="LN270">270</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="271"><td class="num" id="LN271">271</td><td class="line"> sensors_applet = active_sensor->sensors_applet;</td></tr> +<tr class="codeline" data-linenumber="272"><td class="num" id="LN272">272</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="273"><td class="num" id="LN273">273</td><td class="line"> <span class='keyword'>if</span> (!g_settings_get_boolean (sensors_applet->settings, <span class='macro'>DISPLAY_NOTIFICATIONS<span class='macro_popup'>"display-notifications"</span></span>)) {</td></tr> +<tr class="codeline" data-linenumber="274"><td class="num" id="LN274">274</td><td class="line"> g_debug(<span class='string_literal'>"Wanted to display notification, but user has disabled them"</span>);</td></tr> +<tr class="codeline" data-linenumber="275"><td class="num" id="LN275">275</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="276"><td class="num" id="LN276">276</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="277"><td class="num" id="LN277">277</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="278"><td class="num" id="LN278">278</td><td class="line"> path = gtk_tree_row_reference_get_path(active_sensor->sensor_row);</td></tr> +<tr class="codeline" data-linenumber="279"><td class="num" id="LN279">279</td><td class="line"> <span class='keyword'>if</span> (gtk_tree_model_get_iter(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &iter, path)) {</td></tr> +<tr class="codeline" data-linenumber="280"><td class="num" id="LN280">280</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="281"><td class="num" id="LN281">281</td><td class="line"> gtk_tree_model_get(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &iter,</td></tr> +<tr class="codeline" data-linenumber="282"><td class="num" id="LN282">282</td><td class="line"> LABEL_COLUMN, &sensor_label,</td></tr> +<tr class="codeline" data-linenumber="283"><td class="num" id="LN283">283</td><td class="line"> PATH_COLUMN, &sensor_path,</td></tr> +<tr class="codeline" data-linenumber="284"><td class="num" id="LN284">284</td><td class="line"> SENSOR_TYPE_COLUMN, &sensor_type,</td></tr> +<tr class="codeline" data-linenumber="285"><td class="num" id="LN285">285</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="286"><td class="num" id="LN286">286</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="287"><td class="num" id="LN287">287</td><td class="line"> g_warning(<span class='string_literal'>"Error getting data from tree for notification..."</span>);</td></tr> +<tr class="codeline" data-linenumber="288"><td class="num" id="LN288">288</td><td class="line"> gtk_tree_path_free(path);</td></tr> +<tr class="codeline" data-linenumber="289"><td class="num" id="LN289">289</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="290"><td class="num" id="LN290">290</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="291"><td class="num" id="LN291">291</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="292"><td class="num" id="LN292">292</td><td class="line"> gtk_tree_path_free(path);</td></tr> +<tr class="codeline" data-linenumber="293"><td class="num" id="LN293">293</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="294"><td class="num" id="LN294">294</td><td class="line"> <span class='comment'>/* do different stuff for different notif types */</span></td></tr> +<tr class="codeline" data-linenumber="295"><td class="num" id="LN295">295</td><td class="line"> <span class='keyword'>switch</span> (notif_type) {</td></tr> +<tr class="codeline" data-linenumber="296"><td class="num" id="LN296">296</td><td class="line"> <span class='keyword'>case</span> LOW_ALARM: <span class='comment'>/* fall thru */</span></td></tr> +<tr class="codeline" data-linenumber="297"><td class="num" id="LN297">297</td><td class="line"> <span class='keyword'>case</span> HIGH_ALARM:</td></tr> +<tr class="codeline" data-linenumber="298"><td class="num" id="LN298">298</td><td class="line"> <span class='keyword'>if</span> (active_sensor->sensor_values[0] <= active_sensor->sensor_low_value && notif_type == LOW_ALARM) {</td></tr> +<tr class="codeline" data-linenumber="299"><td class="num" id="LN299">299</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="300"><td class="num" id="LN300">300</td><td class="line"> relation = <span class='macro'>_(<span class='string_literal'>"is very low"</span>)<span class='macro_popup'>dcgettext (((void*)0), "is very low", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="301"><td class="num" id="LN301">301</td><td class="line"> limit_type = <span class='macro'>_(<span class='string_literal'>"lower limit"</span>)<span class='macro_popup'>dcgettext (((void*)0), "lower limit", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="302"><td class="num" id="LN302">302</td><td class="line"> limit_value = active_sensor->sensor_low_value;</td></tr> +<tr class="codeline" data-linenumber="303"><td class="num" id="LN303">303</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (active_sensor->sensor_values[0] >= active_sensor->sensor_high_value && notif_type == HIGH_ALARM) {</td></tr> +<tr class="codeline" data-linenumber="304"><td class="num" id="LN304">304</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="305"><td class="num" id="LN305">305</td><td class="line"> <span class='comment'>/* assume high alarm condition */</span></td></tr> +<tr class="codeline" data-linenumber="306"><td class="num" id="LN306">306</td><td class="line"> relation = <span class='macro'>_(<span class='string_literal'>"is very high"</span>)<span class='macro_popup'>dcgettext (((void*)0), "is very high", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="307"><td class="num" id="LN307">307</td><td class="line"> limit_type = <span class='macro'>_(<span class='string_literal'>"upper limit"</span>)<span class='macro_popup'>dcgettext (((void*)0), "upper limit", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="308"><td class="num" id="LN308">308</td><td class="line"> limit_value = active_sensor->sensor_high_value;</td></tr> +<tr class="codeline" data-linenumber="309"><td class="num" id="LN309">309</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="310"><td class="num" id="LN310">310</td><td class="line"> g_warning(<span class='string_literal'>"Alarm notify called when no alarm condition!"</span>);</td></tr> +<tr class="codeline" data-linenumber="311"><td class="num" id="LN311">311</td><td class="line"> g_free(sensor_path);</td></tr> +<tr class="codeline" data-linenumber="312"><td class="num" id="LN312">312</td><td class="line"> g_free(sensor_label);</td></tr> +<tr class="codeline" data-linenumber="313"><td class="num" id="LN313">313</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="314"><td class="num" id="LN314">314</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="315"><td class="num" id="LN315">315</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="316"><td class="num" id="LN316">316</td><td class="line"> <span class='keyword'>switch</span> ((SensorType)sensor_type) {</td></tr> +<tr class="codeline" data-linenumber="317"><td class="num" id="LN317">317</td><td class="line"> <span class='keyword'>case</span> TEMP_SENSOR:</td></tr> +<tr class="codeline" data-linenumber="318"><td class="num" id="LN318">318</td><td class="line"> unit_type_title = <span class='macro'>_(<span class='string_literal'>"Temperature"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Temperature", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="319"><td class="num" id="LN319">319</td><td class="line"> unit_type = <span class='macro'>_(<span class='string_literal'>"temperature"</span>)<span class='macro_popup'>dcgettext (((void*)0), "temperature", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="320"><td class="num" id="LN320">320</td><td class="line"> temp_scale = (TemperatureScale) g_settings_get_int (active_sensor->sensors_applet->settings, <span class='macro'>TEMPERATURE_SCALE<span class='macro_popup'>"temperature-scale"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="321"><td class="num" id="LN321">321</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="322"><td class="num" id="LN322">322</td><td class="line"> <span class='keyword'>switch</span> (temp_scale) {</td></tr> +<tr class="codeline" data-linenumber="323"><td class="num" id="LN323">323</td><td class="line"> <span class='keyword'>case</span> CELSIUS:</td></tr> +<tr class="codeline" data-linenumber="324"><td class="num" id="LN324">324</td><td class="line"> units = <span class='macro'>UNITS_CELSIUS<span class='macro_popup'>"\302\260C"</span></span>;</td></tr> +<tr class="codeline" data-linenumber="325"><td class="num" id="LN325">325</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="326"><td class="num" id="LN326">326</td><td class="line"> <span class='keyword'>case</span> FAHRENHEIT:</td></tr> +<tr class="codeline" data-linenumber="327"><td class="num" id="LN327">327</td><td class="line"> units = <span class='macro'>UNITS_FAHRENHEIT<span class='macro_popup'>"\302\260F"</span></span>;</td></tr> +<tr class="codeline" data-linenumber="328"><td class="num" id="LN328">328</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="329"><td class="num" id="LN329">329</td><td class="line"> <span class='keyword'>case</span> KELVIN:</td></tr> +<tr class="codeline" data-linenumber="330"><td class="num" id="LN330">330</td><td class="line"> units = <span class='macro'>UNITS_KELVIN<span class='macro_popup'>""</span></span>;</td></tr> +<tr class="codeline" data-linenumber="331"><td class="num" id="LN331">331</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="332"><td class="num" id="LN332">332</td><td class="line"> <span class='keyword'>default</span>:</td></tr> +<tr class="codeline" data-linenumber="333"><td class="num" id="LN333">333</td><td class="line"> units = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="334"><td class="num" id="LN334">334</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="335"><td class="num" id="LN335">335</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="336"><td class="num" id="LN336">336</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="337"><td class="num" id="LN337">337</td><td class="line"> <span class='keyword'>case</span> VOLTAGE_SENSOR:</td></tr> +<tr class="codeline" data-linenumber="338"><td class="num" id="LN338">338</td><td class="line"> unit_type_title = <span class='macro'>_(<span class='string_literal'>"Voltage"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Voltage", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="339"><td class="num" id="LN339">339</td><td class="line"> unit_type = <span class='macro'>_(<span class='string_literal'>"voltage"</span>)<span class='macro_popup'>dcgettext (((void*)0), "voltage", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="340"><td class="num" id="LN340">340</td><td class="line"> units = <span class='macro'>UNITS_VOLTAGE<span class='macro_popup'>dcgettext (((void*)0), "V", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="341"><td class="num" id="LN341">341</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="342"><td class="num" id="LN342">342</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="343"><td class="num" id="LN343">343</td><td class="line"> <span class='keyword'>case</span> FAN_SENSOR:</td></tr> +<tr class="codeline" data-linenumber="344"><td class="num" id="LN344">344</td><td class="line"> unit_type_title = <span class='macro'>_(<span class='string_literal'>"Fan Speed"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Fan Speed", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="345"><td class="num" id="LN345">345</td><td class="line"> unit_type = <span class='macro'>_(<span class='string_literal'>"fan speed"</span>)<span class='macro_popup'>dcgettext (((void*)0), "fan speed", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="346"><td class="num" id="LN346">346</td><td class="line"> units = <span class='macro'>UNITS_RPM<span class='macro_popup'>dcgettext (((void*)0), "RPM", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="347"><td class="num" id="LN347">347</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="348"><td class="num" id="LN348">348</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="349"><td class="num" id="LN349">349</td><td class="line"> <span class='keyword'>case</span> CURRENT_SENSOR:</td></tr> +<tr class="codeline" data-linenumber="350"><td class="num" id="LN350">350</td><td class="line"> unit_type_title = <span class='macro'>_(<span class='string_literal'>"Current"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Current", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="351"><td class="num" id="LN351">351</td><td class="line"> unit_type = <span class='macro'>_(<span class='string_literal'>"current"</span>)<span class='macro_popup'>dcgettext (((void*)0), "current", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="352"><td class="num" id="LN352">352</td><td class="line"> units = <span class='macro'>UNITS_CURRENT<span class='macro_popup'>dcgettext (((void*)0), "A", 5)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="353"><td class="num" id="LN353">353</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="354"><td class="num" id="LN354">354</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="355"><td class="num" id="LN355">355</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="356"><td class="num" id="LN356">356</td><td class="line"> timeout_msecs = (active_sensor->alarm_timeout ? <span class='macro'>MIN(DEFAULT_NOTIFY_TIMEOUT, (active_sensor->alarm_timeout * 1000))<span class='macro_popup'>(((3000) < ((active_sensor->alarm_timeout * 1000))) ? (<br>3000) : ((active_sensor->alarm_timeout * 1000)))</span></span> : <span class='macro'>DEFAULT_NOTIFY_TIMEOUT<span class='macro_popup'>3000</span></span>);</td></tr> +<tr class="codeline" data-linenumber="357"><td class="num" id="LN357">357</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="358"><td class="num" id="LN358">358</td><td class="line"> summary = g_strdup_printf(<span class='string_literal'>"%s %s %s"</span>, sensor_label, unit_type_title, <span class='macro'>_(<span class='string_literal'>"Alarm"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Alarm", 5)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="359"><td class="num" id="LN359">359</td><td class="line"> message = g_strdup_printf(<span class='string_literal'>"%s %s %s (%s %2.0f%s)"</span>, sensor_label, unit_type, relation, limit_type, limit_value, units);</td></tr> +<tr class="codeline" data-linenumber="360"><td class="num" id="LN360">360</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="361"><td class="num" id="LN361">361</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="362"><td class="num" id="LN362">362</td><td class="line"> <span class='keyword'>case</span> SENSOR_INTERFACE_ERROR:</td></tr> +<tr class="codeline" data-linenumber="363"><td class="num" id="LN363">363</td><td class="line"> <span class='comment'>/* get time since the last error */</span></td></tr> +<tr class="codeline" data-linenumber="364"><td class="num" id="LN364">364</td><td class="line"> seconds = difftime(time(<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>), active_sensor->ierror_ts);</td></tr> +<tr class="codeline" data-linenumber="365"><td class="num" id="LN365">365</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="366"><td class="num" id="LN366">366</td><td class="line"> <span class='comment'>/* if the last error happened less than 10 seconds ago, don't display this one</span></td></tr> +<tr class="codeline" data-linenumber="367"><td class="num" id="LN367">367</td><td class="line"> <span class='comment'>* this should prevent recurring popups for removed sensors, like USB-HDDs */</span></td></tr> +<tr class="codeline" data-linenumber="368"><td class="num" id="LN368">368</td><td class="line"> <span class='keyword'>if</span> (seconds < 11.0) {</td></tr> +<tr class="codeline" data-linenumber="369"><td class="num" id="LN369">369</td><td class="line"> show_notification = <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="370"><td class="num" id="LN370">370</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="371"><td class="num" id="LN371">371</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="372"><td class="num" id="LN372">372</td><td class="line"> summary = g_strdup_printf(<span class='macro'>_(<span class='string_literal'>"Error updating sensor %s"</span>)<span class='macro_popup'>dcgettext (((void*)0), "Error updating sensor %s", 5)</span></span>, sensor_label);</td></tr> +<tr class="codeline" data-linenumber="373"><td class="num" id="LN373">373</td><td class="line"> message = g_strdup_printf(<span class='macro'>_(<span class='string_literal'>"An error occurred while trying to update the value of the sensor %s located at %s."</span>)<span class='macro_popup'>dcgettext (((void*)0), "An error occurred while trying to update the value of the sensor %s located at %s."<br>, 5)</span></span>, sensor_label, sensor_path);</td></tr> +<tr class="codeline" data-linenumber="374"><td class="num" id="LN374">374</td><td class="line"> timeout_msecs = g_settings_get_int (active_sensor->sensors_applet->settings, <span class='macro'>TIMEOUT<span class='macro_popup'>"timeout-delay"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="375"><td class="num" id="LN375">375</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="376"><td class="num" id="LN376">376</td><td class="line"> <span class='comment'>/* update timestamp */</span></td></tr> +<tr class="codeline" data-linenumber="377"><td class="num" id="LN377">377</td><td class="line"> time(&(active_sensor->ierror_ts));</td></tr> +<tr class="codeline" data-linenumber="378"><td class="num" id="LN378">378</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="379"><td class="num" id="LN379">379</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="380"><td class="num" id="LN380">380</td><td class="line"> <span class='keyword'>default</span>:</td></tr> +<tr class="codeline" data-linenumber="381"><td class="num" id="LN381">381</td><td class="line"> <span class='macro'>g_assert_not_reached()<span class='macro_popup'>do { g_assertion_message_expr ("sensors-applet", "sensors-applet.c"<br>, 381, ((const char*) (__func__)), ((void*)0)); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="382"><td class="num" id="LN382">382</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="383"><td class="num" id="LN383">383</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="384"><td class="num" id="LN384">384</td><td class="line"> <span class='keyword'>if</span> (show_notification) {</td></tr> +<tr class="codeline" data-linenumber="385"><td class="num" id="LN385">385</td><td class="line"> active_sensor_libnotify_notify(active_sensor,</td></tr> +<tr class="codeline" data-linenumber="386"><td class="num" id="LN386">386</td><td class="line"> notif_type,</td></tr> +<tr class="codeline" data-linenumber="387"><td class="num" id="LN387">387</td><td class="line"> summary,</td></tr> +<tr class="codeline" data-linenumber="388"><td class="num" id="LN388">388</td><td class="line"> message,</td></tr> +<tr class="codeline" data-linenumber="389"><td class="num" id="LN389">389</td><td class="line"> <span class='string_literal'>"dialog-warning"</span>,</td></tr> +<tr class="codeline" data-linenumber="390"><td class="num" id="LN390">390</td><td class="line"> timeout_msecs);</td></tr> +<tr class="codeline" data-linenumber="391"><td class="num" id="LN391">391</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="392"><td class="num" id="LN392">392</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="393"><td class="num" id="LN393">393</td><td class="line"> g_free(sensor_path);</td></tr> +<tr class="codeline" data-linenumber="394"><td class="num" id="LN394">394</td><td class="line"> g_free(sensor_label);</td></tr> +<tr class="codeline" data-linenumber="395"><td class="num" id="LN395">395</td><td class="line"> g_free(summary);</td></tr> +<tr class="codeline" data-linenumber="396"><td class="num" id="LN396">396</td><td class="line"> g_free(message);</td></tr> +<tr class="codeline" data-linenumber="397"><td class="num" id="LN397">397</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="398"><td class="num" id="LN398">398</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="399"><td class="num" id="LN399">399</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="400"><td class="num" id="LN400">400</td><td class="line"><span class='keyword'>void</span> sensors_applet_notify_end(ActiveSensor *active_sensor, NotifType notif_type) {</td></tr> +<tr class="codeline" data-linenumber="401"><td class="num" id="LN401">401</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_LIBNOTIFY<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="402"><td class="num" id="LN402">402</td><td class="line"> active_sensor_libnotify_notify_end(active_sensor, notif_type);</td></tr> +<tr class="codeline" data-linenumber="403"><td class="num" id="LN403">403</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="404"><td class="num" id="LN404">404</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="405"><td class="num" id="LN405">405</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="406"><td class="num" id="LN406">406</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_LIBNOTIFY<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="407"><td class="num" id="LN407">407</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> sensors_applet_notify_end_all_gfunc(ActiveSensor *active_sensor, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="408"><td class="num" id="LN408">408</td><td class="line"> active_sensor_libnotify_notify_end(active_sensor, LOW_ALARM);</td></tr> +<tr class="codeline" data-linenumber="409"><td class="num" id="LN409">409</td><td class="line"> active_sensor_libnotify_notify_end(active_sensor, HIGH_ALARM);</td></tr> +<tr class="codeline" data-linenumber="410"><td class="num" id="LN410">410</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="411"><td class="num" id="LN411">411</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="412"><td class="num" id="LN412">412</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="413"><td class="num" id="LN413">413</td><td class="line"><span class='keyword'>void</span> sensors_applet_notify_end_all(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="414"><td class="num" id="LN414">414</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_LIBNOTIFY<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="415"><td class="num" id="LN415">415</td><td class="line"> g_list_foreach(sensors_applet->active_sensors, (GFunc)sensors_applet_notify_end_all_gfunc, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="416"><td class="num" id="LN416">416</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="417"><td class="num" id="LN417">417</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="418"><td class="num" id="LN418">418</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="419"><td class="num" id="LN419">419</td><td class="line"><span class='comment'>/* internal helper functions for updating display etc */</span></td></tr> +<tr class="codeline" data-linenumber="420"><td class="num" id="LN420">420</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="421"><td class="num" id="LN421">421</td><td class="line"><span class='comment'>/* should be called as a g_container_foreach at the start of</span></td></tr> +<tr class="codeline" data-linenumber="422"><td class="num" id="LN422">422</td><td class="line"> <span class='comment'>* pack_display if the grid already exists to remove but keep alive</span></td></tr> +<tr class="codeline" data-linenumber="423"><td class="num" id="LN423">423</td><td class="line"> <span class='comment'>* all children of the grid before repacking it */</span></td></tr> +<tr class="codeline" data-linenumber="424"><td class="num" id="LN424">424</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> sensors_applet_pack_display_empty_grid_cb(GtkWidget *widget, gpointer data)</td></tr> +<tr class="codeline" data-linenumber="425"><td class="num" id="LN425">425</td><td class="line">{</td></tr> +<tr class="codeline" data-linenumber="426"><td class="num" id="LN426">426</td><td class="line"> GtkContainer *container;</td></tr> +<tr class="codeline" data-linenumber="427"><td class="num" id="LN427">427</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="428"><td class="num" id="LN428">428</td><td class="line"> container = <span class='macro'>GTK_CONTAINER(data)<span class='macro_popup'>((((GtkContainer*) (void *) ((data)))))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="429"><td class="num" id="LN429">429</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="430"><td class="num" id="LN430">430</td><td class="line"> <span class='comment'>/* ref then remove widget */</span></td></tr> +<tr class="codeline" data-linenumber="431"><td class="num" id="LN431">431</td><td class="line"> <span class='macro'>g_object_ref(widget)<span class='macro_popup'>((__typeof__ (widget)) (g_object_ref) (widget))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="432"><td class="num" id="LN432">432</td><td class="line"> gtk_container_remove(container, widget);</td></tr> +<tr class="codeline" data-linenumber="433"><td class="num" id="LN433">433</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="434"><td class="num" id="LN434">434</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="435"><td class="num" id="LN435">435</td><td class="line"><span class='comment'>/* should be called as a g_container_foreach at the end of</span></td></tr> +<tr class="codeline" data-linenumber="436"><td class="num" id="LN436">436</td><td class="line"> <span class='comment'>* pack_display to unref any of the old children that we have readdded</span></td></tr> +<tr class="codeline" data-linenumber="437"><td class="num" id="LN437">437</td><td class="line"> <span class='comment'>* to the table to stop reference creep from the g_object_ref called</span></td></tr> +<tr class="codeline" data-linenumber="438"><td class="num" id="LN438">438</td><td class="line"> <span class='comment'>* on each child at the start of pack labels */</span></td></tr> +<tr class="codeline" data-linenumber="439"><td class="num" id="LN439">439</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> sensors_applet_pack_display_cleanup_refs_cb(GtkWidget *widget, gpointer data) {</td></tr> +<tr class="codeline" data-linenumber="440"><td class="num" id="LN440">440</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="441"><td class="num" id="LN441">441</td><td class="line"> GList *old_children;</td></tr> +<tr class="codeline" data-linenumber="442"><td class="num" id="LN442">442</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="443"><td class="num" id="LN443">443</td><td class="line"> old_children = (GList *)data;</td></tr> +<tr class="codeline" data-linenumber="444"><td class="num" id="LN444">444</td><td class="line"> <span class='keyword'>if</span> (g_list_find(old_children, widget)) {</td></tr> +<tr class="codeline" data-linenumber="445"><td class="num" id="LN445">445</td><td class="line"> g_object_unref(widget);</td></tr> +<tr class="codeline" data-linenumber="446"><td class="num" id="LN446">446</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="447"><td class="num" id="LN447">447</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="448"><td class="num" id="LN448">448</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="449"><td class="num" id="LN449">449</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> sensors_applet_pack_display(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="450"><td class="num" id="LN450">450</td><td class="line"> <span class='comment'>/* note the if () around each widget is to ensure we only</span></td></tr> +<tr class="codeline" data-linenumber="451"><td class="num" id="LN451">451</td><td class="line"> <span class='comment'>* operate on those that actually exist */</span></td></tr> +<tr class="codeline" data-linenumber="452"><td class="num" id="LN452">452</td><td class="line"> <span id="start25">GtkLabel</span> *no_sensors_enabled_label = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="453"><td class="num" id="LN453">453</td><td class="line"> gint num_active_sensors = 0, num_sensors_per_group = 0, rows, cols, i, j;</td></tr> +<tr class="codeline" data-linenumber="454"><td class="num" id="LN454">454</td><td class="line"> GList *old_grid_children = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="455"><td class="num" id="LN455">455</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="456"><td class="num" id="LN456">456</td><td class="line"> GList *current_sensor;</td></tr> +<tr class="codeline" data-linenumber="457"><td class="num" id="LN457">457</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="458"><td class="num" id="LN458">458</td><td class="line"> DisplayMode display_mode;</td></tr> +<tr class="codeline" data-linenumber="459"><td class="num" id="LN459">459</td><td class="line"> LayoutMode layout_mode;</td></tr> +<tr class="codeline" data-linenumber="460"><td class="num" id="LN460">460</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="461"><td class="num" id="LN461">461</td><td class="line"> gboolean horizontal;</td></tr> +<tr class="codeline" data-linenumber="462"><td class="num" id="LN462">462</td><td class="line"> gint label_width, icon_width, value_width;</td></tr> +<tr class="codeline" data-linenumber="463"><td class="num" id="LN463">463</td><td class="line"> gint label_height, icon_height, value_height;</td></tr> +<tr class="codeline" data-linenumber="464"><td class="num" id="LN464">464</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="465"><td class="num" id="LN465">465</td><td class="line"> GtkRequisition req;</td></tr> +<tr class="codeline" data-linenumber="466"><td class="num" id="LN466">466</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="467"><td class="num" id="LN467">467</td><td class="line"> ActiveSensor *first_sensor;</td></tr> +<tr class="codeline" data-linenumber="468"><td class="num" id="LN468">468</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="469"><td class="num" id="LN469">469</td><td class="line"> <span class='comment'>/* it is possible that there could be no active sensors so</span></td></tr> +<tr class="codeline" data-linenumber="470"><td class="num" id="LN470">470</td><td class="line"> <span class='comment'>* handle that case first - make sure we dont do a NULL</span></td></tr> +<tr class="codeline" data-linenumber="471"><td class="num" id="LN471">471</td><td class="line"> <span class='comment'>* pointer access first though */</span></td></tr> +<tr class="codeline" data-linenumber="472"><td class="num" id="LN472">472</td><td class="line"> <span id="start24"><span id="end25"><span class='keyword'>if</span></span></span> (<span id="start23"><span class="mrange"><span id="end24">sensors_applet</span></span>->active_sensors == <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span></span> || <span id="start22"><span class="mrange"><span id="end23">g_list_length</span></span>(sensors_applet->active_sensors) == 0</span>) {</td></tr> +<tr><td class="num"></td><td class="line"><div id="Path1" class="msg msgEvent" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">1</div></td><td>Assuming field 'active_sensors' is not equal to NULL</td><td><div class="PathNav"><a href="#Path2" title="Next event (2)">→</a></div></td></tr></table></div></td></tr> +<tr><td class="num"></td><td class="line"><div id="Path2" class="msg msgEvent" style="margin-left:51ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">2</div></td><td><div class="PathNav"><a href="#Path1" title="Previous event (1)">←</a></div></td><td>Assuming the condition is false</td><td><div class="PathNav"><a href="#Path3" title="Next event (3)">→</a></div></td></tr></table></div></td></tr> +<tr><td class="num"></td><td class="line"><div id="Path3" class="msg msgControl" style="margin-left:5ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">3</div></td><td><div class="PathNav"><a href="#Path2" title="Previous event (2)">←</a></div></td><td>Taking false branch</td><td><div class="PathNav"><a href="#Path4" title="Next event (4)">→</a></div></td></tr></table></div></td></tr> +<tr class="codeline" data-linenumber="473"><td class="num" id="LN473">473</td><td class="line"> g_debug(<span class='string_literal'>"no active sensors to pack in grid"</span>);</td></tr> +<tr class="codeline" data-linenumber="474"><td class="num" id="LN474">474</td><td class="line"> no_sensors_enabled_label = g_object_new(<span class='macro'>GTK_TYPE_LABEL<span class='macro_popup'>(gtk_label_get_type ())</span></span>, <span class='string_literal'>"label"</span>, <span class='macro'>_(<span class='string_literal'>"No sensors enabled!"</span>)<span class='macro_popup'>dcgettext (((void*)0), "No sensors enabled!", 5)</span></span>, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="475"><td class="num" id="LN475">475</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="476"><td class="num" id="LN476">476</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->grid == <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="477"><td class="num" id="LN477">477</td><td class="line"> <span class='comment'>/* only need 1 row and 1 col */</span></td></tr> +<tr class="codeline" data-linenumber="478"><td class="num" id="LN478">478</td><td class="line"> sensors_applet->grid = gtk_grid_new();</td></tr> +<tr class="codeline" data-linenumber="479"><td class="num" id="LN479">479</td><td class="line"> gtk_grid_set_column_spacing(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>, <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>);</td></tr> +<tr class="codeline" data-linenumber="480"><td class="num" id="LN480">480</td><td class="line"> gtk_grid_set_row_spacing(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>, <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>);</td></tr> +<tr class="codeline" data-linenumber="481"><td class="num" id="LN481">481</td><td class="line"> gtk_widget_set_halign(sensors_applet->grid, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="482"><td class="num" id="LN482">482</td><td class="line"> gtk_widget_set_valign(sensors_applet->grid, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="483"><td class="num" id="LN483">483</td><td class="line"> <span class='comment'>/* add grid to applet */</span></td></tr> +<tr class="codeline" data-linenumber="484"><td class="num" id="LN484">484</td><td class="line"> gtk_container_add(<span class='macro'>GTK_CONTAINER(sensors_applet->applet)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->applet)))))</span></span>, sensors_applet->grid);</td></tr> +<tr class="codeline" data-linenumber="485"><td class="num" id="LN485">485</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="486"><td class="num" id="LN486">486</td><td class="line"> <span class='comment'>/* destroy existing widgets - could be an</span></td></tr> +<tr class="codeline" data-linenumber="487"><td class="num" id="LN487">487</td><td class="line"> <span class='comment'>* existing version of no sensors label - okay</span></td></tr> +<tr class="codeline" data-linenumber="488"><td class="num" id="LN488">488</td><td class="line"> <span class='comment'>* to just add again though if destroy first */</span></td></tr> +<tr class="codeline" data-linenumber="489"><td class="num" id="LN489">489</td><td class="line"> g_debug(<span class='string_literal'>"destroying any existing widgets in container"</span>);</td></tr> +<tr class="codeline" data-linenumber="490"><td class="num" id="LN490">490</td><td class="line"> gtk_container_foreach(<span class='macro'>GTK_CONTAINER(sensors_applet->grid)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->grid)))))</span></span>, (GtkCallback)gtk_widget_destroy, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="491"><td class="num" id="LN491">491</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="492"><td class="num" id="LN492">492</td><td class="line"> g_debug(<span class='string_literal'>"packing no sensors enabled label"</span>);</td></tr> +<tr class="codeline" data-linenumber="493"><td class="num" id="LN493">493</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="494"><td class="num" id="LN494">494</td><td class="line"> <span class='macro'>GTK_WIDGET(no_sensors_enabled_label)<span class='macro_popup'>((((GtkWidget*) (void *) ((no_sensors_enabled_label)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="495"><td class="num" id="LN495">495</td><td class="line"> 0, 0, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="496"><td class="num" id="LN496">496</td><td class="line"> gtk_widget_show_all(<span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="497"><td class="num" id="LN497">497</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="498"><td class="num" id="LN498">498</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="499"><td class="num" id="LN499">499</td><td class="line"> <span class='comment'>/* otherwise can acess active_sensors without any worries */</span></td></tr> +<tr class="codeline" data-linenumber="500"><td class="num" id="LN500">500</td><td class="line"> <span id="start19"><span id="end20"><span id="start21"><span id="end22">num_active_sensors</span></span></span></span> = g_list_length(<span id="start20"><span id="end21">sensors_applet</span></span>->active_sensors);</td></tr> +<tr class="codeline" data-linenumber="501"><td class="num" id="LN501">501</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="502"><td class="num" id="LN502">502</td><td class="line"> display_mode = (DisplayMode) g_settings_get_int (sensors_applet->settings, <span class='macro'>DISPLAY_MODE<span class='macro_popup'>"display-mode"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="503"><td class="num" id="LN503">503</td><td class="line"> layout_mode = (LayoutMode) g_settings_get_int (sensors_applet->settings, <span class='macro'>LAYOUT_MODE<span class='macro_popup'>"layout-mode"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="504"><td class="num" id="LN504">504</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="505"><td class="num" id="LN505">505</td><td class="line"> <span id="start18"><span id="end19">horizontal</span></span> = ((<span id="end18">(</span><span id="start17"><span class="mrange">mate_panel_applet_get_orient</span>(sensors_applet->applet) == MATE_PANEL_APPLET_ORIENT_UP</span>) ||</td></tr> +<tr><td class="num"></td><td class="line"><div id="Path4" class="msg msgEvent" style="margin-left:21ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">4</div></td><td><div class="PathNav"><a href="#Path3" title="Previous event (3)">←</a></div></td><td>Assuming the condition is false</td><td><div class="PathNav"><a href="#Path5" title="Next event (5)">→</a></div></td></tr></table></div></td></tr> +<tr class="codeline" data-linenumber="506"><td class="num" id="LN506">506</td><td class="line"> (<span id="start16"><span class="mrange"><span id="end17">mate_panel_applet_get_orient</span></span>(sensors_applet->applet) == MATE_PANEL_APPLET_ORIENT_DOWN</span>)));</td></tr> +<tr><td class="num"></td><td class="line"><div id="Path5" class="msg msgEvent" style="margin-left:20ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">5</div></td><td><div class="PathNav"><a href="#Path4" title="Previous event (4)">←</a></div></td><td>Assuming the condition is false</td><td><div class="PathNav"><a href="#Path6" title="Next event (6)">→</a></div></td></tr></table></div></td></tr> +<tr class="codeline" data-linenumber="507"><td class="num" id="LN507">507</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="508"><td class="num" id="LN508">508</td><td class="line"> <span class='comment'>/* figure out num rows / cols by how high / wide sensors</span></td></tr> +<tr class="codeline" data-linenumber="509"><td class="num" id="LN509">509</td><td class="line"> <span class='comment'>* labels / icons are and how much size we have to put them in */</span></td></tr> +<tr class="codeline" data-linenumber="510"><td class="num" id="LN510">510</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="511"><td class="num" id="LN511">511</td><td class="line"> <span class='comment'>/* get the first active sensor */</span></td></tr> +<tr class="codeline" data-linenumber="512"><td class="num" id="LN512">512</td><td class="line"> <span id="start15"><span id="end16">first_sensor</span></span> = (ActiveSensor *)sensors_applet->active_sensors->data;</td></tr> +<tr class="codeline" data-linenumber="513"><td class="num" id="LN513">513</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="514"><td class="num" id="LN514">514</td><td class="line"> <span id="start14"><span id="end15"><span class='keyword'>switch</span></span></span> (<span id="start13"><span id="end14">display_mode</span></span>) {</td></tr> +<tr><td class="num"></td><td class="line"><div id="Path6" class="msg msgControl" style="margin-left:5ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">6</div></td><td><div class="PathNav"><a href="#Path5" title="Previous event (5)">←</a></div></td><td>Control jumps to 'case DISPLAY_VALUE:' at line 515</td><td><div class="PathNav"><a href="#Path7" title="Next event (7)">→</a></div></td></tr></table></div></td></tr> +<tr class="codeline" data-linenumber="515"><td class="num" id="LN515">515</td><td class="line"> <span class='keyword'>case</span> DISPLAY_VALUE:</td></tr> +<tr class="codeline" data-linenumber="516"><td class="num" id="LN516">516</td><td class="line"> <span id="start10"><span id="end11"><span id="start12"><span id="end13">gtk_widget_get_preferred_size</span></span></span></span>(<span id="start11"><span id="end12"><span class='macro'>GTK_WIDGET</span></span>(first_sensor->value)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->value)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="517"><td class="num" id="LN517">517</td><td class="line"> <span id="start9"><span class="mrange"><span id="end10">value_width</span></span> = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span></span>;</td></tr> +<tr><td class="num"></td><td class="line"><div id="Path7" class="msg msgEvent" style="margin-left:13ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">7</div></td><td><div class="PathNav"><a href="#Path6" title="Previous event (6)">←</a></div></td><td>Value assigned to 'value_width'</td><td><div class="PathNav"><a href="#Path8" title="Next event (8)">→</a></div></td></tr></table></div></td></tr> +<tr class="codeline" data-linenumber="518"><td class="num" id="LN518">518</td><td class="line"> value_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="519"><td class="num" id="LN519">519</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="520"><td class="num" id="LN520">520</td><td class="line"> <span class='comment'>/* make sure all widths and heights are non zero,</span></td></tr> +<tr class="codeline" data-linenumber="521"><td class="num" id="LN521">521</td><td class="line"> <span class='comment'>* otherwise will get a divide by zero exception below</span></td></tr> +<tr class="codeline" data-linenumber="522"><td class="num" id="LN522">522</td><td class="line"> <span class='comment'>* - is a non critical error since can happen when</span></td></tr> +<tr class="codeline" data-linenumber="523"><td class="num" id="LN523">523</td><td class="line"> <span class='comment'>* elements first added to list, so simply return - is</span></td></tr> +<tr class="codeline" data-linenumber="524"><td class="num" id="LN524">524</td><td class="line"> <span class='comment'>* not a programming error */</span></td></tr> +<tr class="codeline" data-linenumber="525"><td class="num" id="LN525">525</td><td class="line"> <span id="start8"><span id="end9"><span class='keyword'>if</span></span></span> (<span id="start7"><span class="mrange"><span id="end8">value_width</span></span> == 0</span> && <span id="start6"><span class="mrange"><span id="end7">value_height</span></span> == 0</span>) {</td></tr> +<tr><td class="num"></td><td class="line"><div id="Path8" class="msg msgEvent" style="margin-left:17ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">8</div></td><td><div class="PathNav"><a href="#Path7" title="Previous event (7)">←</a></div></td><td>Assuming 'value_width' is equal to 0</td><td><div class="PathNav"><a href="#Path9" title="Next event (9)">→</a></div></td></tr></table></div></td></tr> +<tr><td class="num"></td><td class="line"><div id="Path9" class="msg msgEvent" style="margin-left:37ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">9</div></td><td><div class="PathNav"><a href="#Path8" title="Previous event (8)">←</a></div></td><td>Assuming 'value_height' is not equal to 0</td><td><div class="PathNav"><a href="#Path10" title="Next event (10)">→</a></div></td></tr></table></div></td></tr> +<tr><td class="num"></td><td class="line"><div id="Path10" class="msg msgControl" style="margin-left:13ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">10</div></td><td><div class="PathNav"><a href="#Path9" title="Previous event (9)">←</a></div></td><td>Taking false branch</td><td><div class="PathNav"><a href="#Path11" title="Next event (11)">→</a></div></td></tr></table></div></td></tr> +<tr class="codeline" data-linenumber="526"><td class="num" id="LN526">526</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="527"><td class="num" id="LN527">527</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="528"><td class="num" id="LN528">528</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="529"><td class="num" id="LN529">529</td><td class="line"> <span id="start1"><span id="end2"><span id="start5"><span id="end6">num_sensors_per_group</span></span></span></span> = (<span class="mrange"><span id="start4"><span id="end5">sensors_applet</span></span>->size <span id="end0">/</span> (<span id="end1"><span id="start2"><span id="start3"><span id="end4"><span class='variable'>horizontal<table class='variable_popup'><tbody><tr><td valign='top'><div class='PathIndex PathIndexPopUp'>10.1</div></td><td>'horizontal' is 0</td></tr></tbody></table></span></span></span></span></span> ? value_height : <span id="start0"><span id="end3">value_width</span></span>)</span>);</td></tr> +<tr><td class="num"></td><td class="line"><div id="Path11" class="msg msgControl" style="margin-left:62ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">11</div></td><td><div class="PathNav"><a href="#Path10" title="Previous event (10)">←</a></div></td><td>'?' condition is false</td><td><div class="PathNav"><a href="#EndPath" title="Next event (12)">→</a></div></td></tr></table></div></td></tr> +<tr><td class="num"></td><td class="line"><div id="EndPath" class="msg msgEvent" style="margin-left:59ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">12</div></td><td><div class="PathNav"><a href="#Path11" title="Previous event (11)">←</a></div></td><td>Division by zero</td></tr></table></div></td></tr> +<tr class="codeline" data-linenumber="530"><td class="num" id="LN530">530</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="531"><td class="num" id="LN531">531</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="532"><td class="num" id="LN532">532</td><td class="line"> <span class='keyword'>case</span> DISPLAY_LABEL_WITH_VALUE:</td></tr> +<tr class="codeline" data-linenumber="533"><td class="num" id="LN533">533</td><td class="line"> <span class='comment'>/* even though we end up packing the event boxes into the</span></td></tr> +<tr class="codeline" data-linenumber="534"><td class="num" id="LN534">534</td><td class="line"> <span class='comment'>* panel, these dont give back request sizes, so need to ask</span></td></tr> +<tr class="codeline" data-linenumber="535"><td class="num" id="LN535">535</td><td class="line"> <span class='comment'>* widgets directly */</span></td></tr> +<tr class="codeline" data-linenumber="536"><td class="num" id="LN536">536</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->value)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->value)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="537"><td class="num" id="LN537">537</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="538"><td class="num" id="LN538">538</td><td class="line"> value_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="539"><td class="num" id="LN539">539</td><td class="line"> value_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="540"><td class="num" id="LN540">540</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="541"><td class="num" id="LN541">541</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->label)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->label)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="542"><td class="num" id="LN542">542</td><td class="line"> label_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="543"><td class="num" id="LN543">543</td><td class="line"> label_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="544"><td class="num" id="LN544">544</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="545"><td class="num" id="LN545">545</td><td class="line"> <span class='comment'>/* make sure all widths and heights are non zero, otherwise</span></td></tr> +<tr class="codeline" data-linenumber="546"><td class="num" id="LN546">546</td><td class="line"> <span class='comment'>* will get a divide by zero exception below</span></td></tr> +<tr class="codeline" data-linenumber="547"><td class="num" id="LN547">547</td><td class="line"> <span class='comment'>* - is a non critical error since can happen when</span></td></tr> +<tr class="codeline" data-linenumber="548"><td class="num" id="LN548">548</td><td class="line"> <span class='comment'>* elements first added to list, so simply return - is</span></td></tr> +<tr class="codeline" data-linenumber="549"><td class="num" id="LN549">549</td><td class="line"> <span class='comment'>* not a programming error */</span></td></tr> +<tr class="codeline" data-linenumber="550"><td class="num" id="LN550">550</td><td class="line"> <span class='keyword'>if</span> (!(label_width && label_height && value_width && value_height)) {</td></tr> +<tr class="codeline" data-linenumber="551"><td class="num" id="LN551">551</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="552"><td class="num" id="LN552">552</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="553"><td class="num" id="LN553">553</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="554"><td class="num" id="LN554">554</td><td class="line"> <span class='keyword'>switch</span> (layout_mode) {</td></tr> +<tr class="codeline" data-linenumber="555"><td class="num" id="LN555">555</td><td class="line"> <span class='keyword'>case</span> VALUE_BESIDE_LABEL:</td></tr> +<tr class="codeline" data-linenumber="556"><td class="num" id="LN556">556</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? <span class='macro'>MAX(label_height, value_height)<span class='macro_popup'>(((label_height) > (value_height)) ? (label_height) : (value_height<br>))</span></span> : (label_width + value_width)));</td></tr> +<tr class="codeline" data-linenumber="557"><td class="num" id="LN557">557</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="558"><td class="num" id="LN558">558</td><td class="line"> <span class='keyword'>case</span> VALUE_BELOW_LABEL:</td></tr> +<tr class="codeline" data-linenumber="559"><td class="num" id="LN559">559</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? (label_height + value_height) : <span class='macro'>MAX(label_width, value_width)<span class='macro_popup'>(((label_width) > (value_width)) ? (label_width) : (value_width<br>))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="560"><td class="num" id="LN560">560</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="561"><td class="num" id="LN561">561</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="562"><td class="num" id="LN562">562</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="563"><td class="num" id="LN563">563</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="564"><td class="num" id="LN564">564</td><td class="line"> <span class='keyword'>case</span> DISPLAY_ICON_WITH_VALUE:</td></tr> +<tr class="codeline" data-linenumber="565"><td class="num" id="LN565">565</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->value)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->value)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="566"><td class="num" id="LN566">566</td><td class="line"> value_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="567"><td class="num" id="LN567">567</td><td class="line"> value_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="568"><td class="num" id="LN568">568</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="569"><td class="num" id="LN569">569</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->icon)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->icon)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="570"><td class="num" id="LN570">570</td><td class="line"> icon_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="571"><td class="num" id="LN571">571</td><td class="line"> icon_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="572"><td class="num" id="LN572">572</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="573"><td class="num" id="LN573">573</td><td class="line"> <span class='keyword'>if</span> (!(icon_width && icon_height && value_width && value_height)) {</td></tr> +<tr class="codeline" data-linenumber="574"><td class="num" id="LN574">574</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="575"><td class="num" id="LN575">575</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="576"><td class="num" id="LN576">576</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="577"><td class="num" id="LN577">577</td><td class="line"> <span class='keyword'>switch</span> (layout_mode) {</td></tr> +<tr class="codeline" data-linenumber="578"><td class="num" id="LN578">578</td><td class="line"> <span class='keyword'>case</span> VALUE_BESIDE_LABEL:</td></tr> +<tr class="codeline" data-linenumber="579"><td class="num" id="LN579">579</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? <span class='macro'>MAX(icon_height, value_height)<span class='macro_popup'>(((icon_height) > (value_height)) ? (icon_height) : (value_height<br>))</span></span> : (icon_width + value_width)));</td></tr> +<tr class="codeline" data-linenumber="580"><td class="num" id="LN580">580</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="581"><td class="num" id="LN581">581</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="582"><td class="num" id="LN582">582</td><td class="line"> <span class='keyword'>case</span> VALUE_BELOW_LABEL:</td></tr> +<tr class="codeline" data-linenumber="583"><td class="num" id="LN583">583</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? (icon_height + value_height) : <span class='macro'>MAX(icon_width, value_width)<span class='macro_popup'>(((icon_width) > (value_width)) ? (icon_width) : (value_width<br>))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="584"><td class="num" id="LN584">584</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="585"><td class="num" id="LN585">585</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="586"><td class="num" id="LN586">586</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="587"><td class="num" id="LN587">587</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="588"><td class="num" id="LN588">588</td><td class="line"> <span class='keyword'>case</span> DISPLAY_ICON:</td></tr> +<tr class="codeline" data-linenumber="589"><td class="num" id="LN589">589</td><td class="line"> gtk_widget_get_preferred_size(<span class='macro'>GTK_WIDGET(first_sensor->icon)<span class='macro_popup'>((((GtkWidget*) (void *) ((first_sensor->icon)))))</span></span>, &req, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="590"><td class="num" id="LN590">590</td><td class="line"> icon_width = req.width + <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>;</td></tr> +<tr class="codeline" data-linenumber="591"><td class="num" id="LN591">591</td><td class="line"> icon_height = req.height + <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>;</td></tr> +<tr class="codeline" data-linenumber="592"><td class="num" id="LN592">592</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="593"><td class="num" id="LN593">593</td><td class="line"> <span class='keyword'>if</span> (!(icon_width && icon_height)) {</td></tr> +<tr class="codeline" data-linenumber="594"><td class="num" id="LN594">594</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="595"><td class="num" id="LN595">595</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="596"><td class="num" id="LN596">596</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="597"><td class="num" id="LN597">597</td><td class="line"> num_sensors_per_group = (sensors_applet->size / (horizontal ? icon_height : icon_width));</td></tr> +<tr class="codeline" data-linenumber="598"><td class="num" id="LN598">598</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="599"><td class="num" id="LN599">599</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="600"><td class="num" id="LN600">600</td><td class="line"> <span class='keyword'>case</span> DISPLAY_GRAPH:</td></tr> +<tr class="codeline" data-linenumber="601"><td class="num" id="LN601">601</td><td class="line"> <span class='comment'>/* only show graphs in a line like System Monitor applet */</span></td></tr> +<tr class="codeline" data-linenumber="602"><td class="num" id="LN602">602</td><td class="line"> num_sensors_per_group = 1;</td></tr> +<tr class="codeline" data-linenumber="603"><td class="num" id="LN603">603</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="604"><td class="num" id="LN604">604</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="605"><td class="num" id="LN605">605</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="606"><td class="num" id="LN606">606</td><td class="line"> <span class='comment'>/* ensure always atleast 1 sensor per group */</span></td></tr> +<tr class="codeline" data-linenumber="607"><td class="num" id="LN607">607</td><td class="line"> <span class='keyword'>if</span> (num_sensors_per_group < 1) {</td></tr> +<tr class="codeline" data-linenumber="608"><td class="num" id="LN608">608</td><td class="line"> <span class='comment'>/* force a better layout */</span></td></tr> +<tr class="codeline" data-linenumber="609"><td class="num" id="LN609">609</td><td class="line"> <span class='keyword'>if</span> (horizontal && layout_mode == VALUE_BELOW_LABEL) {</td></tr> +<tr class="codeline" data-linenumber="610"><td class="num" id="LN610">610</td><td class="line"> layout_mode = VALUE_BESIDE_LABEL;</td></tr> +<tr class="codeline" data-linenumber="611"><td class="num" id="LN611">611</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (!horizontal && layout_mode == VALUE_BESIDE_LABEL) {</td></tr> +<tr class="codeline" data-linenumber="612"><td class="num" id="LN612">612</td><td class="line"> layout_mode = VALUE_BELOW_LABEL;</td></tr> +<tr class="codeline" data-linenumber="613"><td class="num" id="LN613">613</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="614"><td class="num" id="LN614">614</td><td class="line"> num_sensors_per_group = 1;</td></tr> +<tr class="codeline" data-linenumber="615"><td class="num" id="LN615">615</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="616"><td class="num" id="LN616">616</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="617"><td class="num" id="LN617">617</td><td class="line"> <span class='keyword'>if</span> (horizontal) {</td></tr> +<tr class="codeline" data-linenumber="618"><td class="num" id="LN618">618</td><td class="line"> <span class='comment'>/* if oriented horizontally, want as many</span></td></tr> +<tr class="codeline" data-linenumber="619"><td class="num" id="LN619">619</td><td class="line"> <span class='comment'>sensors per column as user has defined, then</span></td></tr> +<tr class="codeline" data-linenumber="620"><td class="num" id="LN620">620</td><td class="line"> <span class='comment'>enough columns to hold all the widgets */</span></td></tr> +<tr class="codeline" data-linenumber="621"><td class="num" id="LN621">621</td><td class="line"> rows = num_sensors_per_group;</td></tr> +<tr class="codeline" data-linenumber="622"><td class="num" id="LN622">622</td><td class="line"> cols = num_active_sensors / num_sensors_per_group;</td></tr> +<tr class="codeline" data-linenumber="623"><td class="num" id="LN623">623</td><td class="line"> <span class='keyword'>while</span> (rows * cols < num_active_sensors || cols == 0) {</td></tr> +<tr class="codeline" data-linenumber="624"><td class="num" id="LN624">624</td><td class="line"> cols++;</td></tr> +<tr class="codeline" data-linenumber="625"><td class="num" id="LN625">625</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="626"><td class="num" id="LN626">626</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="627"><td class="num" id="LN627">627</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="628"><td class="num" id="LN628">628</td><td class="line"> <span class='comment'>/* if oriented vertically, want as many</span></td></tr> +<tr class="codeline" data-linenumber="629"><td class="num" id="LN629">629</td><td class="line"> <span class='comment'>sensors per row as user has defined, then</span></td></tr> +<tr class="codeline" data-linenumber="630"><td class="num" id="LN630">630</td><td class="line"> <span class='comment'>enough rows to hold all the widgets*/</span></td></tr> +<tr class="codeline" data-linenumber="631"><td class="num" id="LN631">631</td><td class="line"> cols = num_sensors_per_group;</td></tr> +<tr class="codeline" data-linenumber="632"><td class="num" id="LN632">632</td><td class="line"> rows = num_active_sensors / num_sensors_per_group;</td></tr> +<tr class="codeline" data-linenumber="633"><td class="num" id="LN633">633</td><td class="line"> <span class='keyword'>while</span> (rows * cols < num_active_sensors || rows == 0) {</td></tr> +<tr class="codeline" data-linenumber="634"><td class="num" id="LN634">634</td><td class="line"> rows++;</td></tr> +<tr class="codeline" data-linenumber="635"><td class="num" id="LN635">635</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="636"><td class="num" id="LN636">636</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="637"><td class="num" id="LN637">637</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="638"><td class="num" id="LN638">638</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="639"><td class="num" id="LN639">639</td><td class="line"> <span class='comment'>/* if displaying labels / icons and values need to modify</span></td></tr> +<tr class="codeline" data-linenumber="640"><td class="num" id="LN640">640</td><td class="line"> <span class='comment'>number of rows / colums to accomodate this */</span></td></tr> +<tr class="codeline" data-linenumber="641"><td class="num" id="LN641">641</td><td class="line"> <span class='keyword'>if</span> (display_mode == DISPLAY_LABEL_WITH_VALUE || display_mode == DISPLAY_ICON_WITH_VALUE) {</td></tr> +<tr class="codeline" data-linenumber="642"><td class="num" id="LN642">642</td><td class="line"> <span class='keyword'>if</span> (layout_mode == VALUE_BESIDE_LABEL) {</td></tr> +<tr class="codeline" data-linenumber="643"><td class="num" id="LN643">643</td><td class="line"> <span class='comment'>/* to display labels next to values need twice as many columns */</span></td></tr> +<tr class="codeline" data-linenumber="644"><td class="num" id="LN644">644</td><td class="line"> cols *= 2;</td></tr> +<tr class="codeline" data-linenumber="645"><td class="num" id="LN645">645</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="646"><td class="num" id="LN646">646</td><td class="line"> <span class='comment'>/* to display labels above values, we need twice as many rows as without */</span></td></tr> +<tr class="codeline" data-linenumber="647"><td class="num" id="LN647">647</td><td class="line"> rows *= 2;</td></tr> +<tr class="codeline" data-linenumber="648"><td class="num" id="LN648">648</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="649"><td class="num" id="LN649">649</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="650"><td class="num" id="LN650">650</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="651"><td class="num" id="LN651">651</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->grid == <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="652"><td class="num" id="LN652">652</td><td class="line"> <span class='comment'>/* create grid and add to applet */</span></td></tr> +<tr class="codeline" data-linenumber="653"><td class="num" id="LN653">653</td><td class="line"> sensors_applet->grid = gtk_grid_new();</td></tr> +<tr class="codeline" data-linenumber="654"><td class="num" id="LN654">654</td><td class="line"> gtk_grid_set_column_spacing(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>, <span class='macro'>COLUMN_SPACING<span class='macro_popup'>2</span></span>);</td></tr> +<tr class="codeline" data-linenumber="655"><td class="num" id="LN655">655</td><td class="line"> gtk_grid_set_row_spacing(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>, <span class='macro'>ROW_SPACING<span class='macro_popup'>1</span></span>);</td></tr> +<tr class="codeline" data-linenumber="656"><td class="num" id="LN656">656</td><td class="line"> gtk_widget_set_halign(sensors_applet->grid, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="657"><td class="num" id="LN657">657</td><td class="line"> gtk_widget_set_valign(sensors_applet->grid, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="658"><td class="num" id="LN658">658</td><td class="line"> gtk_container_add(<span class='macro'>GTK_CONTAINER(sensors_applet->applet)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->applet)))))</span></span>, sensors_applet->grid);</td></tr> +<tr class="codeline" data-linenumber="659"><td class="num" id="LN659">659</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="660"><td class="num" id="LN660">660</td><td class="line"> <span class='comment'>/* remove all children if grid already exists so we can start again */</span></td></tr> +<tr class="codeline" data-linenumber="661"><td class="num" id="LN661">661</td><td class="line"> <span class='comment'>/* save a list of the old children for later */</span></td></tr> +<tr class="codeline" data-linenumber="662"><td class="num" id="LN662">662</td><td class="line"> old_grid_children = gtk_container_get_children(<span class='macro'>GTK_CONTAINER(sensors_applet->grid)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->grid)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="663"><td class="num" id="LN663">663</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="664"><td class="num" id="LN664">664</td><td class="line"> gtk_container_foreach(<span class='macro'>GTK_CONTAINER(sensors_applet->grid)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="665"><td class="num" id="LN665">665</td><td class="line"> sensors_applet_pack_display_empty_grid_cb,</td></tr> +<tr class="codeline" data-linenumber="666"><td class="num" id="LN666">666</td><td class="line"> sensors_applet->grid);</td></tr> +<tr class="codeline" data-linenumber="667"><td class="num" id="LN667">667</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="668"><td class="num" id="LN668">668</td><td class="line"> <span class='comment'>/* pack icons / labels and values into grid */</span></td></tr> +<tr class="codeline" data-linenumber="669"><td class="num" id="LN669">669</td><td class="line"> current_sensor = sensors_applet->active_sensors;</td></tr> +<tr class="codeline" data-linenumber="670"><td class="num" id="LN670">670</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="671"><td class="num" id="LN671">671</td><td class="line"> <span class='comment'>/* if showing labels / icons and values, need to pack labels / icons these first */</span></td></tr> +<tr class="codeline" data-linenumber="672"><td class="num" id="LN672">672</td><td class="line"> <span class='keyword'>if</span> (display_mode == DISPLAY_ICON_WITH_VALUE || display_mode == DISPLAY_LABEL_WITH_VALUE) {</td></tr> +<tr class="codeline" data-linenumber="673"><td class="num" id="LN673">673</td><td class="line"> <span class='comment'>/* loop through columns */</span></td></tr> +<tr class="codeline" data-linenumber="674"><td class="num" id="LN674">674</td><td class="line"> <span class='keyword'>for</span> (i = 0; current_sensor != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> && i < cols; <span class='comment'>/* increments depends on how we lay them out - see below */</span>) {</td></tr> +<tr class="codeline" data-linenumber="675"><td class="num" id="LN675">675</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="676"><td class="num" id="LN676">676</td><td class="line"> <span class='comment'>/* loop through rows in a column */</span></td></tr> +<tr class="codeline" data-linenumber="677"><td class="num" id="LN677">677</td><td class="line"> <span class='keyword'>for</span> (j = 0; current_sensor && j < rows; <span class='comment'>/* see bottom of for loop*/</span>) {</td></tr> +<tr class="codeline" data-linenumber="678"><td class="num" id="LN678">678</td><td class="line"> <span class='comment'>/* attach label / icon at this point */</span></td></tr> +<tr class="codeline" data-linenumber="679"><td class="num" id="LN679">679</td><td class="line"> <span class='keyword'>if</span> (display_mode == DISPLAY_ICON_WITH_VALUE) {</td></tr> +<tr class="codeline" data-linenumber="680"><td class="num" id="LN680">680</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->icon) {</td></tr> +<tr class="codeline" data-linenumber="681"><td class="num" id="LN681">681</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="682"><td class="num" id="LN682">682</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->icon,</td></tr> +<tr class="codeline" data-linenumber="683"><td class="num" id="LN683">683</td><td class="line"> i, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="684"><td class="num" id="LN684">684</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="685"><td class="num" id="LN685">685</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="686"><td class="num" id="LN686">686</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->label) {</td></tr> +<tr class="codeline" data-linenumber="687"><td class="num" id="LN687">687</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="688"><td class="num" id="LN688">688</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->label,</td></tr> +<tr class="codeline" data-linenumber="689"><td class="num" id="LN689">689</td><td class="line"> i, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="690"><td class="num" id="LN690">690</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="691"><td class="num" id="LN691">691</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="692"><td class="num" id="LN692">692</td><td class="line"> <span class='comment'>/* now attach sensor value to either row below or column next to */</span></td></tr> +<tr class="codeline" data-linenumber="693"><td class="num" id="LN693">693</td><td class="line"> <span class='keyword'>if</span> (layout_mode == VALUE_BESIDE_LABEL) {</td></tr> +<tr class="codeline" data-linenumber="694"><td class="num" id="LN694">694</td><td class="line"> <span class='comment'>/* left align labels */</span></td></tr> +<tr class="codeline" data-linenumber="695"><td class="num" id="LN695">695</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->icon) {</td></tr> +<tr class="codeline" data-linenumber="696"><td class="num" id="LN696">696</td><td class="line"> gtk_widget_set_halign (((ActiveSensor *)(current_sensor->data))->icon, GTK_ALIGN_START);</td></tr> +<tr class="codeline" data-linenumber="697"><td class="num" id="LN697">697</td><td class="line"> gtk_widget_set_valign (((ActiveSensor *)(current_sensor->data))->icon, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="698"><td class="num" id="LN698">698</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="699"><td class="num" id="LN699">699</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->label) {</td></tr> +<tr class="codeline" data-linenumber="700"><td class="num" id="LN700">700</td><td class="line"> gtk_label_set_xalign (<span class='macro'>GTK_LABEL(((ActiveSensor *)(current_sensor->data))->label)<span class='macro_popup'>((((GtkLabel*) (void *) ((((ActiveSensor *)(current_sensor-><br>data))->label)))))</span></span>, 0);</td></tr> +<tr class="codeline" data-linenumber="701"><td class="num" id="LN701">701</td><td class="line"> gtk_label_set_yalign (<span class='macro'>GTK_LABEL(((ActiveSensor *)(current_sensor->data))->label)<span class='macro_popup'>((((GtkLabel*) (void *) ((((ActiveSensor *)(current_sensor-><br>data))->label)))))</span></span>, 0.5);</td></tr> +<tr class="codeline" data-linenumber="702"><td class="num" id="LN702">702</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="703"><td class="num" id="LN703">703</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="704"><td class="num" id="LN704">704</td><td class="line"> gtk_widget_set_halign (((ActiveSensor *)(current_sensor->data))->value, GTK_ALIGN_START);</td></tr> +<tr class="codeline" data-linenumber="705"><td class="num" id="LN705">705</td><td class="line"> gtk_widget_set_valign (((ActiveSensor *)(current_sensor->data))->value, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="706"><td class="num" id="LN706">706</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="707"><td class="num" id="LN707">707</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="708"><td class="num" id="LN708">708</td><td class="line"> <span class='comment'>/* place value next to label */</span></td></tr> +<tr class="codeline" data-linenumber="709"><td class="num" id="LN709">709</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="710"><td class="num" id="LN710">710</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="711"><td class="num" id="LN711">711</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->value,</td></tr> +<tr class="codeline" data-linenumber="712"><td class="num" id="LN712">712</td><td class="line"> i + 1, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="713"><td class="num" id="LN713">713</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="714"><td class="num" id="LN714">714</td><td class="line"> j++;</td></tr> +<tr class="codeline" data-linenumber="715"><td class="num" id="LN715">715</td><td class="line"> } <span class='keyword'>else</span> { <span class='comment'>/* place value below label */</span></td></tr> +<tr class="codeline" data-linenumber="716"><td class="num" id="LN716">716</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="717"><td class="num" id="LN717">717</td><td class="line"> <span class='comment'>/* center align labels */</span></td></tr> +<tr class="codeline" data-linenumber="718"><td class="num" id="LN718">718</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->icon) {</td></tr> +<tr class="codeline" data-linenumber="719"><td class="num" id="LN719">719</td><td class="line"> gtk_widget_set_halign (((ActiveSensor *)(current_sensor->data))->icon, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="720"><td class="num" id="LN720">720</td><td class="line"> gtk_widget_set_valign (((ActiveSensor *)(current_sensor->data))->icon, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="721"><td class="num" id="LN721">721</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="722"><td class="num" id="LN722">722</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->label) {</td></tr> +<tr class="codeline" data-linenumber="723"><td class="num" id="LN723">723</td><td class="line"> gtk_label_set_xalign (<span class='macro'>GTK_LABEL(((ActiveSensor *)(current_sensor->data))->label)<span class='macro_popup'>((((GtkLabel*) (void *) ((((ActiveSensor *)(current_sensor-><br>data))->label)))))</span></span>, 0.5);</td></tr> +<tr class="codeline" data-linenumber="724"><td class="num" id="LN724">724</td><td class="line"> gtk_label_set_yalign (<span class='macro'>GTK_LABEL(((ActiveSensor *)(current_sensor->data))->label)<span class='macro_popup'>((((GtkLabel*) (void *) ((((ActiveSensor *)(current_sensor-><br>data))->label)))))</span></span>, 0.5);</td></tr> +<tr class="codeline" data-linenumber="725"><td class="num" id="LN725">725</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="726"><td class="num" id="LN726">726</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="727"><td class="num" id="LN727">727</td><td class="line"> gtk_widget_set_halign (((ActiveSensor *)(current_sensor->data))->value, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="728"><td class="num" id="LN728">728</td><td class="line"> gtk_widget_set_valign (((ActiveSensor *)(current_sensor->data))->value, GTK_ALIGN_CENTER);</td></tr> +<tr class="codeline" data-linenumber="729"><td class="num" id="LN729">729</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="730"><td class="num" id="LN730">730</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="731"><td class="num" id="LN731">731</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="732"><td class="num" id="LN732">732</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="733"><td class="num" id="LN733">733</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->value,</td></tr> +<tr class="codeline" data-linenumber="734"><td class="num" id="LN734">734</td><td class="line"> i, j + 1, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="735"><td class="num" id="LN735">735</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="736"><td class="num" id="LN736">736</td><td class="line"> j += 2;</td></tr> +<tr class="codeline" data-linenumber="737"><td class="num" id="LN737">737</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="738"><td class="num" id="LN738">738</td><td class="line"> current_sensor = <span class='macro'>g_list_next(current_sensor)<span class='macro_popup'>((current_sensor) ? (((GList *)(current_sensor))->next) : (<br>(void*)0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="739"><td class="num" id="LN739">739</td><td class="line"> } <span class='comment'>/* end row loop */</span></td></tr> +<tr class="codeline" data-linenumber="740"><td class="num" id="LN740">740</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="741"><td class="num" id="LN741">741</td><td class="line"> <span class='comment'>/* now increment column index as needed */</span></td></tr> +<tr class="codeline" data-linenumber="742"><td class="num" id="LN742">742</td><td class="line"> <span class='keyword'>if</span> (layout_mode == VALUE_BESIDE_LABEL) { <span class='comment'>/* place value next to label */</span></td></tr> +<tr class="codeline" data-linenumber="743"><td class="num" id="LN743">743</td><td class="line"> i += 2;</td></tr> +<tr class="codeline" data-linenumber="744"><td class="num" id="LN744">744</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="745"><td class="num" id="LN745">745</td><td class="line"> i++;</td></tr> +<tr class="codeline" data-linenumber="746"><td class="num" id="LN746">746</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="747"><td class="num" id="LN747">747</td><td class="line"> } <span class='comment'>/* end column loop */</span></td></tr> +<tr class="codeline" data-linenumber="748"><td class="num" id="LN748">748</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="749"><td class="num" id="LN749">749</td><td class="line"> } <span class='keyword'>else</span> { <span class='comment'>/* not showing labels and icons with values, so just pack either only icons or values */</span></td></tr> +<tr class="codeline" data-linenumber="750"><td class="num" id="LN750">750</td><td class="line"> <span class='keyword'>for</span> (i = 0; current_sensor != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> && i < cols; ++i) {</td></tr> +<tr class="codeline" data-linenumber="751"><td class="num" id="LN751">751</td><td class="line"> <span class='keyword'>for</span> (j = 0; current_sensor!= <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> && j < rows; ++j) {</td></tr> +<tr class="codeline" data-linenumber="752"><td class="num" id="LN752">752</td><td class="line"> <span class='keyword'>if</span> (display_mode == DISPLAY_VALUE) {</td></tr> +<tr class="codeline" data-linenumber="753"><td class="num" id="LN753">753</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="754"><td class="num" id="LN754">754</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="755"><td class="num" id="LN755">755</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->value,</td></tr> +<tr class="codeline" data-linenumber="756"><td class="num" id="LN756">756</td><td class="line"> i, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="757"><td class="num" id="LN757">757</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="758"><td class="num" id="LN758">758</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (display_mode == DISPLAY_ICON) {</td></tr> +<tr class="codeline" data-linenumber="759"><td class="num" id="LN759">759</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->value) {</td></tr> +<tr class="codeline" data-linenumber="760"><td class="num" id="LN760">760</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="761"><td class="num" id="LN761">761</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->icon,</td></tr> +<tr class="codeline" data-linenumber="762"><td class="num" id="LN762">762</td><td class="line"> i, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="763"><td class="num" id="LN763">763</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="764"><td class="num" id="LN764">764</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (display_mode == DISPLAY_GRAPH) {</td></tr> +<tr class="codeline" data-linenumber="765"><td class="num" id="LN765">765</td><td class="line"> <span class='keyword'>if</span> (((ActiveSensor *)(current_sensor->data))->graph) {</td></tr> +<tr class="codeline" data-linenumber="766"><td class="num" id="LN766">766</td><td class="line"> gtk_grid_attach(<span class='macro'>GTK_GRID(sensors_applet->grid)<span class='macro_popup'>((((GtkGrid*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="767"><td class="num" id="LN767">767</td><td class="line"> ((ActiveSensor *)(current_sensor->data))->graph_frame,</td></tr> +<tr class="codeline" data-linenumber="768"><td class="num" id="LN768">768</td><td class="line"> i, j, 1, 1);</td></tr> +<tr class="codeline" data-linenumber="769"><td class="num" id="LN769">769</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="770"><td class="num" id="LN770">770</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="771"><td class="num" id="LN771">771</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="772"><td class="num" id="LN772">772</td><td class="line"> current_sensor = <span class='macro'>g_list_next(current_sensor)<span class='macro_popup'>((current_sensor) ? (((GList *)(current_sensor))->next) : (<br>(void*)0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="773"><td class="num" id="LN773">773</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="774"><td class="num" id="LN774">774</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="775"><td class="num" id="LN775">775</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="776"><td class="num" id="LN776">776</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="777"><td class="num" id="LN777">777</td><td class="line"> <span class='keyword'>if</span> (old_grid_children != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="778"><td class="num" id="LN778">778</td><td class="line"> gtk_container_foreach(<span class='macro'>GTK_CONTAINER(sensors_applet->grid)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->grid)))))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="779"><td class="num" id="LN779">779</td><td class="line"> sensors_applet_pack_display_cleanup_refs_cb,</td></tr> +<tr class="codeline" data-linenumber="780"><td class="num" id="LN780">780</td><td class="line"> old_grid_children);</td></tr> +<tr class="codeline" data-linenumber="781"><td class="num" id="LN781">781</td><td class="line"> g_list_free(old_grid_children);</td></tr> +<tr class="codeline" data-linenumber="782"><td class="num" id="LN782">782</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="783"><td class="num" id="LN783">783</td><td class="line"> gtk_widget_show_all(<span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="784"><td class="num" id="LN784">784</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="785"><td class="num" id="LN785">785</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="786"><td class="num" id="LN786">786</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="787"><td class="num" id="LN787">787</td><td class="line"><span class='comment'>/* must unref when done with returned pixbuf */</span></td></tr> +<tr class="codeline" data-linenumber="788"><td class="num" id="LN788">788</td><td class="line">GdkPixbuf *sensors_applet_load_icon(IconType icon_type) {</td></tr> +<tr class="codeline" data-linenumber="789"><td class="num" id="LN789">789</td><td class="line"> GtkIconTheme *icon_theme;</td></tr> +<tr class="codeline" data-linenumber="790"><td class="num" id="LN790">790</td><td class="line"> GdkPixbuf *icon = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="791"><td class="num" id="LN791">791</td><td class="line"> GError *error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="792"><td class="num" id="LN792">792</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="793"><td class="num" id="LN793">793</td><td class="line"> <span class='comment'>/* try to load the icon */</span></td></tr> +<tr class="codeline" data-linenumber="794"><td class="num" id="LN794">794</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="795"><td class="num" id="LN795">795</td><td class="line"> <span class='comment'>/* not allowed to unref or ref icon_theme once we have it */</span></td></tr> +<tr class="codeline" data-linenumber="796"><td class="num" id="LN796">796</td><td class="line"> icon_theme = gtk_icon_theme_get_default();</td></tr> +<tr class="codeline" data-linenumber="797"><td class="num" id="LN797">797</td><td class="line"> icon = gtk_icon_theme_load_icon(icon_theme,</td></tr> +<tr class="codeline" data-linenumber="798"><td class="num" id="LN798">798</td><td class="line"> stock_icons[icon_type],</td></tr> +<tr class="codeline" data-linenumber="799"><td class="num" id="LN799">799</td><td class="line"> <span class='macro'>DEFAULT_ICON_SIZE<span class='macro_popup'>22</span></span>,</td></tr> +<tr class="codeline" data-linenumber="800"><td class="num" id="LN800">800</td><td class="line"> GTK_ICON_LOOKUP_USE_BUILTIN,</td></tr> +<tr class="codeline" data-linenumber="801"><td class="num" id="LN801">801</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="802"><td class="num" id="LN802">802</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="803"><td class="num" id="LN803">803</td><td class="line"> <span class='keyword'>if</span> (error) {</td></tr> +<tr class="codeline" data-linenumber="804"><td class="num" id="LN804">804</td><td class="line"> g_warning (<span class='string_literal'>"Could not load icon: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="805"><td class="num" id="LN805">805</td><td class="line"> g_error_free(error);</td></tr> +<tr class="codeline" data-linenumber="806"><td class="num" id="LN806">806</td><td class="line"> error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="807"><td class="num" id="LN807">807</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="808"><td class="num" id="LN808">808</td><td class="line"> <span class='comment'>/* try again with default icon */</span></td></tr> +<tr class="codeline" data-linenumber="809"><td class="num" id="LN809">809</td><td class="line"> icon = gtk_icon_theme_load_icon(icon_theme,</td></tr> +<tr class="codeline" data-linenumber="810"><td class="num" id="LN810">810</td><td class="line"> <span class='string_literal'>"image-missing"</span>,</td></tr> +<tr class="codeline" data-linenumber="811"><td class="num" id="LN811">811</td><td class="line"> <span class='macro'>DEFAULT_ICON_SIZE<span class='macro_popup'>22</span></span>,</td></tr> +<tr class="codeline" data-linenumber="812"><td class="num" id="LN812">812</td><td class="line"> GTK_ICON_LOOKUP_USE_BUILTIN,</td></tr> +<tr class="codeline" data-linenumber="813"><td class="num" id="LN813">813</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="814"><td class="num" id="LN814">814</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="815"><td class="num" id="LN815">815</td><td class="line"> <span class='keyword'>if</span> (error) {</td></tr> +<tr class="codeline" data-linenumber="816"><td class="num" id="LN816">816</td><td class="line"> <span class='comment'>/* this will quit sensors-applet but it is a pretty major error so may as well */</span></td></tr> +<tr class="codeline" data-linenumber="817"><td class="num" id="LN817">817</td><td class="line"> g_error(<span class='string_literal'>"Could not load GTK_STOCK_MISSING_IMAGE - major error!!!: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="818"><td class="num" id="LN818">818</td><td class="line"> g_error_free(error);</td></tr> +<tr class="codeline" data-linenumber="819"><td class="num" id="LN819">819</td><td class="line"> error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="820"><td class="num" id="LN820">820</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="821"><td class="num" id="LN821">821</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="822"><td class="num" id="LN822">822</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="823"><td class="num" id="LN823">823</td><td class="line"> <span class='keyword'>return</span> icon;</td></tr> +<tr class="codeline" data-linenumber="824"><td class="num" id="LN824">824</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="825"><td class="num" id="LN825">825</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="826"><td class="num" id="LN826">826</td><td class="line"><span class='comment'>// MUST FREE STRINGS AFTER CALLING THIS FUNCTION!!</span></td></tr> +<tr class="codeline" data-linenumber="827"><td class="num" id="LN827">827</td><td class="line">gboolean sensors_applet_add_sensor(SensorsApplet *sensors_applet,</td></tr> +<tr class="codeline" data-linenumber="828"><td class="num" id="LN828">828</td><td class="line"> <span class='keyword'>const</span> gchar *path,</td></tr> +<tr class="codeline" data-linenumber="829"><td class="num" id="LN829">829</td><td class="line"> <span class='keyword'>const</span> gchar *id,</td></tr> +<tr class="codeline" data-linenumber="830"><td class="num" id="LN830">830</td><td class="line"> <span class='keyword'>const</span> gchar *label,</td></tr> +<tr class="codeline" data-linenumber="831"><td class="num" id="LN831">831</td><td class="line"> <span class='keyword'>const</span> gchar *interface,</td></tr> +<tr class="codeline" data-linenumber="832"><td class="num" id="LN832">832</td><td class="line"> SensorType type,</td></tr> +<tr class="codeline" data-linenumber="833"><td class="num" id="LN833">833</td><td class="line"> gboolean enable,</td></tr> +<tr class="codeline" data-linenumber="834"><td class="num" id="LN834">834</td><td class="line"> gdouble low_value,</td></tr> +<tr class="codeline" data-linenumber="835"><td class="num" id="LN835">835</td><td class="line"> gdouble high_value,</td></tr> +<tr class="codeline" data-linenumber="836"><td class="num" id="LN836">836</td><td class="line"> gboolean alarm_enable,</td></tr> +<tr class="codeline" data-linenumber="837"><td class="num" id="LN837">837</td><td class="line"> <span class='keyword'>const</span> gchar *low_alarm_command,</td></tr> +<tr class="codeline" data-linenumber="838"><td class="num" id="LN838">838</td><td class="line"> <span class='keyword'>const</span> gchar *high_alarm_command,</td></tr> +<tr class="codeline" data-linenumber="839"><td class="num" id="LN839">839</td><td class="line"> gint alarm_timeout,</td></tr> +<tr class="codeline" data-linenumber="840"><td class="num" id="LN840">840</td><td class="line"> gdouble multiplier,</td></tr> +<tr class="codeline" data-linenumber="841"><td class="num" id="LN841">841</td><td class="line"> gdouble offset,</td></tr> +<tr class="codeline" data-linenumber="842"><td class="num" id="LN842">842</td><td class="line"> IconType icon_type,</td></tr> +<tr class="codeline" data-linenumber="843"><td class="num" id="LN843">843</td><td class="line"> <span class='keyword'>const</span> gchar *graph_color) {</td></tr> +<tr class="codeline" data-linenumber="844"><td class="num" id="LN844">844</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="845"><td class="num" id="LN845">845</td><td class="line"> GtkTreeIter interfaces_iter, sensors_iter;</td></tr> +<tr class="codeline" data-linenumber="846"><td class="num" id="LN846">846</td><td class="line"> gboolean not_empty_tree;</td></tr> +<tr class="codeline" data-linenumber="847"><td class="num" id="LN847">847</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="848"><td class="num" id="LN848">848</td><td class="line"> gchar *node_interface;</td></tr> +<tr class="codeline" data-linenumber="849"><td class="num" id="LN849">849</td><td class="line"> gboolean not_end_of_interfaces = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>, interface_exists = <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="850"><td class="num" id="LN850">850</td><td class="line"> gboolean not_end_of_sensors = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="851"><td class="num" id="LN851">851</td><td class="line"> gchar *sensor_id;</td></tr> +<tr class="codeline" data-linenumber="852"><td class="num" id="LN852">852</td><td class="line"> gchar *sensor_path;</td></tr> +<tr class="codeline" data-linenumber="853"><td class="num" id="LN853">853</td><td class="line"> SensorType sensor_type;</td></tr> +<tr class="codeline" data-linenumber="854"><td class="num" id="LN854">854</td><td class="line"> GdkPixbuf *icon;</td></tr> +<tr class="codeline" data-linenumber="855"><td class="num" id="LN855">855</td><td class="line"> GtkTreePath *tree_path;</td></tr> +<tr class="codeline" data-linenumber="856"><td class="num" id="LN856">856</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="857"><td class="num" id="LN857">857</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_36<br>; if (sensors_applet) _g_boolean_var_36 = 1; else _g_boolean_var_36<br> = 0; _g_boolean_var_36; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 857, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="858"><td class="num" id="LN858">858</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="859"><td class="num" id="LN859">859</td><td class="line"> <span class='comment'>/* assume tree is not empty */</span></td></tr> +<tr class="codeline" data-linenumber="860"><td class="num" id="LN860">860</td><td class="line"> not_empty_tree = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="861"><td class="num" id="LN861">861</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="862"><td class="num" id="LN862">862</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == sensors_applet->sensors) {</td></tr> +<tr class="codeline" data-linenumber="863"><td class="num" id="LN863">863</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="864"><td class="num" id="LN864">864</td><td class="line"> sensors_applet->sensors = gtk_tree_store_new(N_COLUMNS,</td></tr> +<tr class="codeline" data-linenumber="865"><td class="num" id="LN865">865</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* path */</span></td></tr> +<tr class="codeline" data-linenumber="866"><td class="num" id="LN866">866</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* id */</span></td></tr> +<tr class="codeline" data-linenumber="867"><td class="num" id="LN867">867</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* label */</span></td></tr> +<tr class="codeline" data-linenumber="868"><td class="num" id="LN868">868</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* interface */</span></td></tr> +<tr class="codeline" data-linenumber="869"><td class="num" id="LN869">869</td><td class="line"> <span class='macro'>G_TYPE_UINT<span class='macro_popup'>((GType) ((7) << (2)))</span></span>, <span class='comment'>/* sensor type */</span></td></tr> +<tr class="codeline" data-linenumber="870"><td class="num" id="LN870">870</td><td class="line"> <span class='macro'>G_TYPE_BOOLEAN<span class='macro_popup'>((GType) ((5) << (2)))</span></span>, <span class='comment'>/* enable */</span></td></tr> +<tr class="codeline" data-linenumber="871"><td class="num" id="LN871">871</td><td class="line"> <span class='macro'>G_TYPE_BOOLEAN<span class='macro_popup'>((GType) ((5) << (2)))</span></span>, <span class='comment'>/* visible */</span></td></tr> +<tr class="codeline" data-linenumber="872"><td class="num" id="LN872">872</td><td class="line"> <span class='macro'>G_TYPE_DOUBLE<span class='macro_popup'>((GType) ((15) << (2)))</span></span>, <span class='comment'>/* low value */</span></td></tr> +<tr class="codeline" data-linenumber="873"><td class="num" id="LN873">873</td><td class="line"> <span class='macro'>G_TYPE_DOUBLE<span class='macro_popup'>((GType) ((15) << (2)))</span></span>, <span class='comment'>/* high type */</span></td></tr> +<tr class="codeline" data-linenumber="874"><td class="num" id="LN874">874</td><td class="line"> <span class='macro'>G_TYPE_BOOLEAN<span class='macro_popup'>((GType) ((5) << (2)))</span></span>, <span class='comment'>/* alarm enable */</span></td></tr> +<tr class="codeline" data-linenumber="875"><td class="num" id="LN875">875</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* low alarm command */</span></td></tr> +<tr class="codeline" data-linenumber="876"><td class="num" id="LN876">876</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>, <span class='comment'>/* high alarm command */</span></td></tr> +<tr class="codeline" data-linenumber="877"><td class="num" id="LN877">877</td><td class="line"> <span class='macro'>G_TYPE_UINT<span class='macro_popup'>((GType) ((7) << (2)))</span></span>, <span class='comment'>/* alarm timeout */</span></td></tr> +<tr class="codeline" data-linenumber="878"><td class="num" id="LN878">878</td><td class="line"> <span class='macro'>G_TYPE_DOUBLE<span class='macro_popup'>((GType) ((15) << (2)))</span></span>, <span class='comment'>/* multiplier */</span></td></tr> +<tr class="codeline" data-linenumber="879"><td class="num" id="LN879">879</td><td class="line"> <span class='macro'>G_TYPE_DOUBLE<span class='macro_popup'>((GType) ((15) << (2)))</span></span>, <span class='comment'>/* offset */</span></td></tr> +<tr class="codeline" data-linenumber="880"><td class="num" id="LN880">880</td><td class="line"> <span class='macro'>G_TYPE_UINT<span class='macro_popup'>((GType) ((7) << (2)))</span></span>, <span class='comment'>/* icon type */</span></td></tr> +<tr class="codeline" data-linenumber="881"><td class="num" id="LN881">881</td><td class="line"> <span class='macro'>GDK_TYPE_PIXBUF<span class='macro_popup'>(gdk_pixbuf_get_type ())</span></span>, <span class='comment'>/* icon pixbuf */</span></td></tr> +<tr class="codeline" data-linenumber="882"><td class="num" id="LN882">882</td><td class="line"> <span class='macro'>G_TYPE_STRING<span class='macro_popup'>((GType) ((16) << (2)))</span></span>); <span class='comment'>/* graph color */</span></td></tr> +<tr class="codeline" data-linenumber="883"><td class="num" id="LN883">883</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="884"><td class="num" id="LN884">884</td><td class="line"> g_debug(<span class='string_literal'>"Sensor tree created."</span>);</td></tr> +<tr class="codeline" data-linenumber="885"><td class="num" id="LN885">885</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="886"><td class="num" id="LN886">886</td><td class="line"> <span class='comment'>/* we know tree is actually empty since we just created it */</span></td></tr> +<tr class="codeline" data-linenumber="887"><td class="num" id="LN887">887</td><td class="line"> not_empty_tree = <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="888"><td class="num" id="LN888">888</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="889"><td class="num" id="LN889">889</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="890"><td class="num" id="LN890">890</td><td class="line"> <span class='comment'>/* search sensor tree for the parent interface to place this sensor under */</span></td></tr> +<tr class="codeline" data-linenumber="891"><td class="num" id="LN891">891</td><td class="line"> <span class='keyword'>for</span> (not_empty_tree = gtk_tree_model_get_iter_first(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &interfaces_iter);</td></tr> +<tr class="codeline" data-linenumber="892"><td class="num" id="LN892">892</td><td class="line"> not_empty_tree && not_end_of_interfaces && !interface_exists;</td></tr> +<tr class="codeline" data-linenumber="893"><td class="num" id="LN893">893</td><td class="line"> not_end_of_interfaces = gtk_tree_model_iter_next(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &interfaces_iter)) {</td></tr> +<tr class="codeline" data-linenumber="894"><td class="num" id="LN894">894</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="895"><td class="num" id="LN895">895</td><td class="line"> gtk_tree_model_get(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &interfaces_iter, INTERFACE_COLUMN, &node_interface, -1);</td></tr> +<tr class="codeline" data-linenumber="896"><td class="num" id="LN896">896</td><td class="line"> <span class='keyword'>if</span> (g_ascii_strcasecmp(interface, node_interface) == 0) {</td></tr> +<tr class="codeline" data-linenumber="897"><td class="num" id="LN897">897</td><td class="line"> <span class='comment'>/* found interface in tree */</span></td></tr> +<tr class="codeline" data-linenumber="898"><td class="num" id="LN898">898</td><td class="line"> interface_exists = <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="899"><td class="num" id="LN899">899</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="900"><td class="num" id="LN900">900</td><td class="line"> <span class='comment'>/* now see if this actual sensor already exists within this interface - don't want to add duplicates */</span></td></tr> +<tr class="codeline" data-linenumber="901"><td class="num" id="LN901">901</td><td class="line"> <span class='comment'>/* see if have children */</span></td></tr> +<tr class="codeline" data-linenumber="902"><td class="num" id="LN902">902</td><td class="line"> <span class='keyword'>for</span> (not_end_of_sensors = gtk_tree_model_iter_children(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter, &interfaces_iter);</td></tr> +<tr class="codeline" data-linenumber="903"><td class="num" id="LN903">903</td><td class="line"> not_end_of_sensors;</td></tr> +<tr class="codeline" data-linenumber="904"><td class="num" id="LN904">904</td><td class="line"> not_end_of_sensors = gtk_tree_model_iter_next(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter)) {</td></tr> +<tr class="codeline" data-linenumber="905"><td class="num" id="LN905">905</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="906"><td class="num" id="LN906">906</td><td class="line"> gtk_tree_model_get(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter,</td></tr> +<tr class="codeline" data-linenumber="907"><td class="num" id="LN907">907</td><td class="line"> PATH_COLUMN, &sensor_path,</td></tr> +<tr class="codeline" data-linenumber="908"><td class="num" id="LN908">908</td><td class="line"> ID_COLUMN, &sensor_id,</td></tr> +<tr class="codeline" data-linenumber="909"><td class="num" id="LN909">909</td><td class="line"> SENSOR_TYPE_COLUMN, &sensor_type,</td></tr> +<tr class="codeline" data-linenumber="910"><td class="num" id="LN910">910</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="911"><td class="num" id="LN911">911</td><td class="line"> <span class='keyword'>if</span> (g_ascii_strcasecmp(sensor_id, id) == 0 && g_ascii_strcasecmp(sensor_path, path) == 0 && sensor_type == type) {</td></tr> +<tr class="codeline" data-linenumber="912"><td class="num" id="LN912">912</td><td class="line"> <span class='comment'>/* sensor already exists so dont add a second time */</span></td></tr> +<tr class="codeline" data-linenumber="913"><td class="num" id="LN913">913</td><td class="line"> g_debug(<span class='string_literal'>"sensor with path: %s, id: %s already exists in tree, not adding a second time"</span>, sensor_path, sensor_id);</td></tr> +<tr class="codeline" data-linenumber="914"><td class="num" id="LN914">914</td><td class="line"> g_free(sensor_id);</td></tr> +<tr class="codeline" data-linenumber="915"><td class="num" id="LN915">915</td><td class="line"> g_free(sensor_path);</td></tr> +<tr class="codeline" data-linenumber="916"><td class="num" id="LN916">916</td><td class="line"> g_free(node_interface);</td></tr> +<tr class="codeline" data-linenumber="917"><td class="num" id="LN917">917</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="918"><td class="num" id="LN918">918</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="919"><td class="num" id="LN919">919</td><td class="line"> g_free(sensor_id);</td></tr> +<tr class="codeline" data-linenumber="920"><td class="num" id="LN920">920</td><td class="line"> g_free(sensor_path);</td></tr> +<tr class="codeline" data-linenumber="921"><td class="num" id="LN921">921</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="922"><td class="num" id="LN922">922</td><td class="line"> g_free(node_interface);</td></tr> +<tr class="codeline" data-linenumber="923"><td class="num" id="LN923">923</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="924"><td class="num" id="LN924">924</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="925"><td class="num" id="LN925">925</td><td class="line"> g_free(node_interface);</td></tr> +<tr class="codeline" data-linenumber="926"><td class="num" id="LN926">926</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="927"><td class="num" id="LN927">927</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="928"><td class="num" id="LN928">928</td><td class="line"> <span class='keyword'>if</span> (!interface_exists) {</td></tr> +<tr class="codeline" data-linenumber="929"><td class="num" id="LN929">929</td><td class="line"> <span class='comment'>/* add to required plugins hash table so we ensure this</span></td></tr> +<tr class="codeline" data-linenumber="930"><td class="num" id="LN930">930</td><td class="line"> <span class='comment'>plugin stays loaded to make sure we have a get sensor</span></td></tr> +<tr class="codeline" data-linenumber="931"><td class="num" id="LN931">931</td><td class="line"> <span class='comment'>value function if possible */</span></td></tr> +<tr class="codeline" data-linenumber="932"><td class="num" id="LN932">932</td><td class="line"> g_hash_table_insert(sensors_applet->required_plugins,</td></tr> +<tr class="codeline" data-linenumber="933"><td class="num" id="LN933">933</td><td class="line"> <span class='macro'>g_strdup(interface)<span class='macro_popup'>g_strdup_inline (interface)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="934"><td class="num" id="LN934">934</td><td class="line"> <span class='macro'>GINT_TO_POINTER(TRUE)<span class='macro_popup'>((gpointer) (glong) ((!(0))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="935"><td class="num" id="LN935">935</td><td class="line"> g_debug(<span class='string_literal'>"added interface %s to required plugins"</span>, interface);</td></tr> +<tr class="codeline" data-linenumber="936"><td class="num" id="LN936">936</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="937"><td class="num" id="LN937">937</td><td class="line"> <span class='comment'>/* wasn't able to find interface root node so create it */</span></td></tr> +<tr class="codeline" data-linenumber="938"><td class="num" id="LN938">938</td><td class="line"> gtk_tree_store_append(sensors_applet->sensors,</td></tr> +<tr class="codeline" data-linenumber="939"><td class="num" id="LN939">939</td><td class="line"> &interfaces_iter,</td></tr> +<tr class="codeline" data-linenumber="940"><td class="num" id="LN940">940</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="941"><td class="num" id="LN941">941</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="942"><td class="num" id="LN942">942</td><td class="line"> gtk_tree_store_set(sensors_applet->sensors,</td></tr> +<tr class="codeline" data-linenumber="943"><td class="num" id="LN943">943</td><td class="line"> &interfaces_iter,</td></tr> +<tr class="codeline" data-linenumber="944"><td class="num" id="LN944">944</td><td class="line"> ID_COLUMN, interface,</td></tr> +<tr class="codeline" data-linenumber="945"><td class="num" id="LN945">945</td><td class="line"> INTERFACE_COLUMN, interface,</td></tr> +<tr class="codeline" data-linenumber="946"><td class="num" id="LN946">946</td><td class="line"> VISIBLE_COLUMN, <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="947"><td class="num" id="LN947">947</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="948"><td class="num" id="LN948">948</td><td class="line"> g_debug(<span class='string_literal'>"Added sensor interface %s to tree"</span>, interface);</td></tr> +<tr class="codeline" data-linenumber="949"><td class="num" id="LN949">949</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="950"><td class="num" id="LN950">950</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="951"><td class="num" id="LN951">951</td><td class="line"> <span class='comment'>/* then add sensor as a child under interface node - ie assume</span></td></tr> +<tr class="codeline" data-linenumber="952"><td class="num" id="LN952">952</td><td class="line"> <span class='comment'>* we either found it or created it - the inteface node that is */</span></td></tr> +<tr class="codeline" data-linenumber="953"><td class="num" id="LN953">953</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="954"><td class="num" id="LN954">954</td><td class="line"> <span class='comment'>/* for now just add sensors all in a single list */</span></td></tr> +<tr class="codeline" data-linenumber="955"><td class="num" id="LN955">955</td><td class="line"> gtk_tree_store_append(sensors_applet->sensors, &sensors_iter, &interfaces_iter);</td></tr> +<tr class="codeline" data-linenumber="956"><td class="num" id="LN956">956</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="957"><td class="num" id="LN957">957</td><td class="line"> <span class='comment'>/* if sensor is already in settings, load values from there */</span></td></tr> +<tr class="codeline" data-linenumber="958"><td class="num" id="LN958">958</td><td class="line"> gchar *applet_path = mate_panel_applet_get_preferences_path (sensors_applet->applet);</td></tr> +<tr class="codeline" data-linenumber="959"><td class="num" id="LN959">959</td><td class="line"> gchar *gsuid = sensors_applet_settings_get_unique_id (interface, id, path);</td></tr> +<tr class="codeline" data-linenumber="960"><td class="num" id="LN960">960</td><td class="line"> gchar *settings_path = g_strdup_printf (<span class='string_literal'>"%s%s/"</span>, applet_path, gsuid);</td></tr> +<tr class="codeline" data-linenumber="961"><td class="num" id="LN961">961</td><td class="line"> GSettings *settings = g_settings_new_with_path (<span class='string_literal'>"org.mate.sensors-applet.sensor"</span>, settings_path);</td></tr> +<tr class="codeline" data-linenumber="962"><td class="num" id="LN962">962</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="963"><td class="num" id="LN963">963</td><td class="line"> <span class='comment'>/* add hash to temp sorting list */</span></td></tr> +<tr class="codeline" data-linenumber="964"><td class="num" id="LN964">964</td><td class="line"> g_variant_builder_add (&gvb_sensors_hash_list, <span class='string_literal'>"s"</span>, gsuid);</td></tr> +<tr class="codeline" data-linenumber="965"><td class="num" id="LN965">965</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="966"><td class="num" id="LN966">966</td><td class="line"> g_free (applet_path);</td></tr> +<tr class="codeline" data-linenumber="967"><td class="num" id="LN967">967</td><td class="line"> g_free (gsuid);</td></tr> +<tr class="codeline" data-linenumber="968"><td class="num" id="LN968">968</td><td class="line"> g_free (settings_path);</td></tr> +<tr class="codeline" data-linenumber="969"><td class="num" id="LN969">969</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="970"><td class="num" id="LN970">970</td><td class="line"> gchar *settings_id = g_settings_get_string (settings, <span class='macro'>ID<span class='macro_popup'>"id"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="971"><td class="num" id="LN971">971</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="972"><td class="num" id="LN972">972</td><td class="line"> <span class='keyword'>if</span> (settings_id != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> && settings_id[0] != '\0') {</td></tr> +<tr class="codeline" data-linenumber="973"><td class="num" id="LN973">973</td><td class="line"> enable = g_settings_get_boolean (settings, <span class='macro'>ENABLED<span class='macro_popup'>"enabled"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="974"><td class="num" id="LN974">974</td><td class="line"> icon = sensors_applet_load_icon(g_settings_get_int (settings, <span class='macro'>ICON_TYPE<span class='macro_popup'>"icon-type"</span></span>));</td></tr> +<tr class="codeline" data-linenumber="975"><td class="num" id="LN975">975</td><td class="line"> gtk_tree_store_set(sensors_applet->sensors,</td></tr> +<tr class="codeline" data-linenumber="976"><td class="num" id="LN976">976</td><td class="line"> &sensors_iter,</td></tr> +<tr class="codeline" data-linenumber="977"><td class="num" id="LN977">977</td><td class="line"> PATH_COLUMN, g_settings_get_string (settings, <span class='macro'>PATH<span class='macro_popup'>"path"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="978"><td class="num" id="LN978">978</td><td class="line"> ID_COLUMN, settings_id,</td></tr> +<tr class="codeline" data-linenumber="979"><td class="num" id="LN979">979</td><td class="line"> LABEL_COLUMN, g_settings_get_string (settings, <span class='macro'>LABEL<span class='macro_popup'>"label"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="980"><td class="num" id="LN980">980</td><td class="line"> INTERFACE_COLUMN, g_settings_get_string (settings, <span class='macro'>INTERFACE<span class='macro_popup'>"interface"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="981"><td class="num" id="LN981">981</td><td class="line"> SENSOR_TYPE_COLUMN, g_settings_get_int (settings, <span class='macro'>SENSOR_TYPE<span class='macro_popup'>"sensor-type"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="982"><td class="num" id="LN982">982</td><td class="line"> ENABLE_COLUMN, enable,</td></tr> +<tr class="codeline" data-linenumber="983"><td class="num" id="LN983">983</td><td class="line"> VISIBLE_COLUMN, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="984"><td class="num" id="LN984">984</td><td class="line"> LOW_VALUE_COLUMN, g_settings_get_double (settings, <span class='macro'>LOW_VALUE<span class='macro_popup'>"low-value"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="985"><td class="num" id="LN985">985</td><td class="line"> HIGH_VALUE_COLUMN, g_settings_get_double (settings, <span class='macro'>HIGH_VALUE<span class='macro_popup'>"high-value"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="986"><td class="num" id="LN986">986</td><td class="line"> ALARM_ENABLE_COLUMN, g_settings_get_boolean (settings, <span class='macro'>ALARM_ENABLED<span class='macro_popup'>"alarm-enabled"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="987"><td class="num" id="LN987">987</td><td class="line"> ALARM_TIMEOUT_COLUMN, g_settings_get_int (settings, <span class='macro'>ALARM_TIMEOUT<span class='macro_popup'>"alarm-timeout"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="988"><td class="num" id="LN988">988</td><td class="line"> LOW_ALARM_COMMAND_COLUMN, g_settings_get_string (settings, <span class='macro'>LOW_ALARM_COMMAND<span class='macro_popup'>"low-alarm-command"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="989"><td class="num" id="LN989">989</td><td class="line"> HIGH_ALARM_COMMAND_COLUMN, g_settings_get_string (settings, <span class='macro'>HIGH_ALARM_COMMAND<span class='macro_popup'>"high-alarm-command"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="990"><td class="num" id="LN990">990</td><td class="line"> MULTIPLIER_COLUMN, g_settings_get_double (settings, <span class='macro'>MULTIPLIER<span class='macro_popup'>"multiplier"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="991"><td class="num" id="LN991">991</td><td class="line"> OFFSET_COLUMN, g_settings_get_double (settings, <span class='macro'>OFFSET<span class='macro_popup'>"offset"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="992"><td class="num" id="LN992">992</td><td class="line"> ICON_TYPE_COLUMN, g_settings_get_int (settings, <span class='macro'>ICON_TYPE<span class='macro_popup'>"icon-type"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="993"><td class="num" id="LN993">993</td><td class="line"> ICON_PIXBUF_COLUMN, icon,</td></tr> +<tr class="codeline" data-linenumber="994"><td class="num" id="LN994">994</td><td class="line"> GRAPH_COLOR_COLUMN, g_settings_get_string (settings, <span class='macro'>GRAPH_COLOR<span class='macro_popup'>"graph-color"</span></span>),</td></tr> +<tr class="codeline" data-linenumber="995"><td class="num" id="LN995">995</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="996"><td class="num" id="LN996">996</td><td class="line"> g_free (settings_id);</td></tr> +<tr class="codeline" data-linenumber="997"><td class="num" id="LN997">997</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="998"><td class="num" id="LN998">998</td><td class="line"> icon = sensors_applet_load_icon(icon_type);</td></tr> +<tr class="codeline" data-linenumber="999"><td class="num" id="LN999">999</td><td class="line"> gtk_tree_store_set(sensors_applet->sensors,</td></tr> +<tr class="codeline" data-linenumber="1000"><td class="num" id="LN1000">1000</td><td class="line"> &sensors_iter,</td></tr> +<tr class="codeline" data-linenumber="1001"><td class="num" id="LN1001">1001</td><td class="line"> PATH_COLUMN, path,</td></tr> +<tr class="codeline" data-linenumber="1002"><td class="num" id="LN1002">1002</td><td class="line"> ID_COLUMN, id,</td></tr> +<tr class="codeline" data-linenumber="1003"><td class="num" id="LN1003">1003</td><td class="line"> LABEL_COLUMN, label,</td></tr> +<tr class="codeline" data-linenumber="1004"><td class="num" id="LN1004">1004</td><td class="line"> INTERFACE_COLUMN, interface,</td></tr> +<tr class="codeline" data-linenumber="1005"><td class="num" id="LN1005">1005</td><td class="line"> SENSOR_TYPE_COLUMN, type,</td></tr> +<tr class="codeline" data-linenumber="1006"><td class="num" id="LN1006">1006</td><td class="line"> ENABLE_COLUMN, enable,</td></tr> +<tr class="codeline" data-linenumber="1007"><td class="num" id="LN1007">1007</td><td class="line"> VISIBLE_COLUMN, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="1008"><td class="num" id="LN1008">1008</td><td class="line"> LOW_VALUE_COLUMN, low_value,</td></tr> +<tr class="codeline" data-linenumber="1009"><td class="num" id="LN1009">1009</td><td class="line"> HIGH_VALUE_COLUMN, high_value,</td></tr> +<tr class="codeline" data-linenumber="1010"><td class="num" id="LN1010">1010</td><td class="line"> ALARM_ENABLE_COLUMN, alarm_enable,</td></tr> +<tr class="codeline" data-linenumber="1011"><td class="num" id="LN1011">1011</td><td class="line"> ALARM_TIMEOUT_COLUMN, alarm_timeout,</td></tr> +<tr class="codeline" data-linenumber="1012"><td class="num" id="LN1012">1012</td><td class="line"> LOW_ALARM_COMMAND_COLUMN, low_alarm_command,</td></tr> +<tr class="codeline" data-linenumber="1013"><td class="num" id="LN1013">1013</td><td class="line"> HIGH_ALARM_COMMAND_COLUMN, high_alarm_command,</td></tr> +<tr class="codeline" data-linenumber="1014"><td class="num" id="LN1014">1014</td><td class="line"> MULTIPLIER_COLUMN, multiplier,</td></tr> +<tr class="codeline" data-linenumber="1015"><td class="num" id="LN1015">1015</td><td class="line"> OFFSET_COLUMN, offset,</td></tr> +<tr class="codeline" data-linenumber="1016"><td class="num" id="LN1016">1016</td><td class="line"> ICON_TYPE_COLUMN, icon_type,</td></tr> +<tr class="codeline" data-linenumber="1017"><td class="num" id="LN1017">1017</td><td class="line"> ICON_PIXBUF_COLUMN, icon,</td></tr> +<tr class="codeline" data-linenumber="1018"><td class="num" id="LN1018">1018</td><td class="line"> GRAPH_COLOR_COLUMN, graph_color,</td></tr> +<tr class="codeline" data-linenumber="1019"><td class="num" id="LN1019">1019</td><td class="line"> -1);</td></tr> +<tr class="codeline" data-linenumber="1020"><td class="num" id="LN1020">1020</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1021"><td class="num" id="LN1021">1021</td><td class="line"> g_object_unref (settings);</td></tr> +<tr class="codeline" data-linenumber="1022"><td class="num" id="LN1022">1022</td><td class="line"> g_debug(<span class='string_literal'>"added sensor %s to tree"</span>, path);</td></tr> +<tr class="codeline" data-linenumber="1023"><td class="num" id="LN1023">1023</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1024"><td class="num" id="LN1024">1024</td><td class="line"> <span class='comment'>/* remove reference to icon as tree now has ref */</span></td></tr> +<tr class="codeline" data-linenumber="1025"><td class="num" id="LN1025">1025</td><td class="line"> g_object_unref(icon);</td></tr> +<tr class="codeline" data-linenumber="1026"><td class="num" id="LN1026">1026</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1027"><td class="num" id="LN1027">1027</td><td class="line"> <span class='comment'>/* create the active sensor */</span></td></tr> +<tr class="codeline" data-linenumber="1028"><td class="num" id="LN1028">1028</td><td class="line"> <span class='keyword'>if</span> (enable) {</td></tr> +<tr class="codeline" data-linenumber="1029"><td class="num" id="LN1029">1029</td><td class="line"> tree_path = gtk_tree_model_get_path(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, &sensors_iter);</td></tr> +<tr class="codeline" data-linenumber="1030"><td class="num" id="LN1030">1030</td><td class="line"> sensors_applet_sensor_enabled(sensors_applet, tree_path);</td></tr> +<tr class="codeline" data-linenumber="1031"><td class="num" id="LN1031">1031</td><td class="line"> gtk_tree_path_free(tree_path);</td></tr> +<tr class="codeline" data-linenumber="1032"><td class="num" id="LN1032">1032</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1033"><td class="num" id="LN1033">1033</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1034"><td class="num" id="LN1034">1034</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1035"><td class="num" id="LN1035">1035</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1036"><td class="num" id="LN1036">1036</td><td class="line"><span class='keyword'>static</span> ActiveSensor *sensors_applet_find_active_sensor(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1037"><td class="num" id="LN1037">1037</td><td class="line"> GtkTreePath *sensor_tree_path;</td></tr> +<tr class="codeline" data-linenumber="1038"><td class="num" id="LN1038">1038</td><td class="line"> GList *current_sensor;</td></tr> +<tr class="codeline" data-linenumber="1039"><td class="num" id="LN1039">1039</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1040"><td class="num" id="LN1040">1040</td><td class="line"> <span class='keyword'>for</span> (current_sensor = sensors_applet->active_sensors; current_sensor != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; current_sensor = <span class='macro'>g_list_next(current_sensor)<span class='macro_popup'>((current_sensor) ? (((GList *)(current_sensor))->next) : (<br>(void*)0))</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="1041"><td class="num" id="LN1041">1041</td><td class="line"> sensor_tree_path = gtk_tree_row_reference_get_path(((ActiveSensor *)(current_sensor->data))->sensor_row);</td></tr> +<tr class="codeline" data-linenumber="1042"><td class="num" id="LN1042">1042</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1043"><td class="num" id="LN1043">1043</td><td class="line"> <span class='keyword'>if</span> (gtk_tree_path_compare(path, sensor_tree_path) == 0) {</td></tr> +<tr class="codeline" data-linenumber="1044"><td class="num" id="LN1044">1044</td><td class="line"> gtk_tree_path_free(sensor_tree_path);</td></tr> +<tr class="codeline" data-linenumber="1045"><td class="num" id="LN1045">1045</td><td class="line"> <span class='keyword'>return</span> ((ActiveSensor *)(current_sensor->data));</td></tr> +<tr class="codeline" data-linenumber="1046"><td class="num" id="LN1046">1046</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1047"><td class="num" id="LN1047">1047</td><td class="line"> gtk_tree_path_free(sensor_tree_path);</td></tr> +<tr class="codeline" data-linenumber="1048"><td class="num" id="LN1048">1048</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1049"><td class="num" id="LN1049">1049</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1050"><td class="num" id="LN1050">1050</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1051"><td class="num" id="LN1051">1051</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1052"><td class="num" id="LN1052">1052</td><td class="line"><span class='comment'>/* path should be the full path to a file representing the sensor (eg</span></td></tr> +<tr class="codeline" data-linenumber="1053"><td class="num" id="LN1053">1053</td><td class="line"> <span class='comment'>* /dev/hda or /sys/devices/platform/i2c-0/0-0290/temp1_input) */</span></td></tr> +<tr class="codeline" data-linenumber="1054"><td class="num" id="LN1054">1054</td><td class="line"><span class='keyword'>void</span> sensors_applet_display_layout_changed(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="1055"><td class="num" id="LN1055">1055</td><td class="line"> <span class='comment'>/* update sensors since will need to update icons / graphs etc</span></td></tr> +<tr class="codeline" data-linenumber="1056"><td class="num" id="LN1056">1056</td><td class="line"> <span class='comment'>* if weren't displayed before */</span></td></tr> +<tr class="codeline" data-linenumber="1057"><td class="num" id="LN1057">1057</td><td class="line"> GList *list = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1058"><td class="num" id="LN1058">1058</td><td class="line"> <span class='keyword'>for</span> (list = sensors_applet->active_sensors; list != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; list = list->next) {</td></tr> +<tr class="codeline" data-linenumber="1059"><td class="num" id="LN1059">1059</td><td class="line"> ActiveSensor *as = (ActiveSensor *)list->data;</td></tr> +<tr class="codeline" data-linenumber="1060"><td class="num" id="LN1060">1060</td><td class="line"> as->updated = <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1061"><td class="num" id="LN1061">1061</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1062"><td class="num" id="LN1062">1062</td><td class="line"> sensors_applet_update_active_sensors(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1063"><td class="num" id="LN1063">1063</td><td class="line"> sensors_applet_pack_display(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1064"><td class="num" id="LN1064">1064</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1065"><td class="num" id="LN1065">1065</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1066"><td class="num" id="LN1066">1066</td><td class="line"><span class='keyword'>void</span> sensors_applet_alarm_off(SensorsApplet *sensors_applet,</td></tr> +<tr class="codeline" data-linenumber="1067"><td class="num" id="LN1067">1067</td><td class="line"> GtkTreePath *path,</td></tr> +<tr class="codeline" data-linenumber="1068"><td class="num" id="LN1068">1068</td><td class="line"> NotifType notif_type) {</td></tr> +<tr class="codeline" data-linenumber="1069"><td class="num" id="LN1069">1069</td><td class="line"> ActiveSensor *active_sensor;</td></tr> +<tr class="codeline" data-linenumber="1070"><td class="num" id="LN1070">1070</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1071"><td class="num" id="LN1071">1071</td><td class="line"> <span class='keyword'>if</span> ((active_sensor = sensors_applet_find_active_sensor(sensors_applet, path)) != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="1072"><td class="num" id="LN1072">1072</td><td class="line"> active_sensor_alarm_off(active_sensor, notif_type);</td></tr> +<tr class="codeline" data-linenumber="1073"><td class="num" id="LN1073">1073</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1074"><td class="num" id="LN1074">1074</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1075"><td class="num" id="LN1075">1075</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1076"><td class="num" id="LN1076">1076</td><td class="line"><span class='keyword'>void</span> sensors_applet_all_alarms_off(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1077"><td class="num" id="LN1077">1077</td><td class="line"> sensors_applet_alarm_off(sensors_applet, path, LOW_ALARM);</td></tr> +<tr class="codeline" data-linenumber="1078"><td class="num" id="LN1078">1078</td><td class="line"> sensors_applet_alarm_off(sensors_applet, path, HIGH_ALARM);</td></tr> +<tr class="codeline" data-linenumber="1079"><td class="num" id="LN1079">1079</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1080"><td class="num" id="LN1080">1080</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1081"><td class="num" id="LN1081">1081</td><td class="line"><span class='keyword'>void</span> sensors_applet_sensor_enabled(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1082"><td class="num" id="LN1082">1082</td><td class="line"> ActiveSensor *active_sensor;</td></tr> +<tr class="codeline" data-linenumber="1083"><td class="num" id="LN1083">1083</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1084"><td class="num" id="LN1084">1084</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_37<br>; if (sensors_applet) _g_boolean_var_37 = 1; else _g_boolean_var_37<br> = 0; _g_boolean_var_37; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1084, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1085"><td class="num" id="LN1085">1085</td><td class="line"> <span class='macro'>g_assert(path)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_38<br>; if (path) _g_boolean_var_38 = 1; else _g_boolean_var_38 = 0<br>; _g_boolean_var_38; }), 1)) ; else g_assertion_message_expr (<br>"sensors-applet", "sensors-applet.c", 1085, ((const char*) (__func__<br>)), "path"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1086"><td class="num" id="LN1086">1086</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1087"><td class="num" id="LN1087">1087</td><td class="line"> active_sensor = active_sensor_new(sensors_applet, gtk_tree_row_reference_new(<span class='macro'>GTK_TREE_MODEL(sensors_applet->sensors)<span class='macro_popup'>((((GtkTreeModel*) (void *) ((sensors_applet->sensors)))))</span></span>, path));</td></tr> +<tr class="codeline" data-linenumber="1088"><td class="num" id="LN1088">1088</td><td class="line"> active_sensor_update(active_sensor, sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1089"><td class="num" id="LN1089">1089</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1090"><td class="num" id="LN1090">1090</td><td class="line"> <span class='comment'>/* keep list sorted */</span></td></tr> +<tr class="codeline" data-linenumber="1091"><td class="num" id="LN1091">1091</td><td class="line"> sensors_applet->active_sensors = g_list_insert_sorted(sensors_applet->active_sensors,</td></tr> +<tr class="codeline" data-linenumber="1092"><td class="num" id="LN1092">1092</td><td class="line"> active_sensor,</td></tr> +<tr class="codeline" data-linenumber="1093"><td class="num" id="LN1093">1093</td><td class="line"> (GCompareFunc)active_sensor_compare);</td></tr> +<tr class="codeline" data-linenumber="1094"><td class="num" id="LN1094">1094</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1095"><td class="num" id="LN1095">1095</td><td class="line"> sensors_applet_pack_display(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1096"><td class="num" id="LN1096">1096</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1097"><td class="num" id="LN1097">1097</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1098"><td class="num" id="LN1098">1098</td><td class="line"><span class='keyword'>void</span> sensors_applet_reorder_sensors(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="1099"><td class="num" id="LN1099">1099</td><td class="line"> sensors_applet->active_sensors = g_list_sort(sensors_applet->active_sensors, (GCompareFunc)active_sensor_compare);</td></tr> +<tr class="codeline" data-linenumber="1100"><td class="num" id="LN1100">1100</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1101"><td class="num" id="LN1101">1101</td><td class="line"> sensors_applet_pack_display(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1102"><td class="num" id="LN1102">1102</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1103"><td class="num" id="LN1103">1103</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1104"><td class="num" id="LN1104">1104</td><td class="line"><span class='keyword'>void</span> sensors_applet_sensor_disabled(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1105"><td class="num" id="LN1105">1105</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1106"><td class="num" id="LN1106">1106</td><td class="line"> ActiveSensor *active_sensor;</td></tr> +<tr class="codeline" data-linenumber="1107"><td class="num" id="LN1107">1107</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1108"><td class="num" id="LN1108">1108</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_39<br>; if (sensors_applet) _g_boolean_var_39 = 1; else _g_boolean_var_39<br> = 0; _g_boolean_var_39; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1108, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1109"><td class="num" id="LN1109">1109</td><td class="line"> <span class='macro'>g_assert(path)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_40<br>; if (path) _g_boolean_var_40 = 1; else _g_boolean_var_40 = 0<br>; _g_boolean_var_40; }), 1)) ; else g_assertion_message_expr (<br>"sensors-applet", "sensors-applet.c", 1109, ((const char*) (__func__<br>)), "path"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1110"><td class="num" id="LN1110">1110</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1111"><td class="num" id="LN1111">1111</td><td class="line"> <span class='keyword'>if</span> ((active_sensor = sensors_applet_find_active_sensor(sensors_applet, path)) != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="1112"><td class="num" id="LN1112">1112</td><td class="line"> g_debug(<span class='string_literal'>"Destroying active sensor..."</span>);</td></tr> +<tr class="codeline" data-linenumber="1113"><td class="num" id="LN1113">1113</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1114"><td class="num" id="LN1114">1114</td><td class="line"> g_debug(<span class='string_literal'>"-- removing from list..."</span>);</td></tr> +<tr class="codeline" data-linenumber="1115"><td class="num" id="LN1115">1115</td><td class="line"> sensors_applet->active_sensors = g_list_remove(sensors_applet->active_sensors, active_sensor);</td></tr> +<tr class="codeline" data-linenumber="1116"><td class="num" id="LN1116">1116</td><td class="line"> g_debug(<span class='string_literal'>"-- repacking display...."</span>);</td></tr> +<tr class="codeline" data-linenumber="1117"><td class="num" id="LN1117">1117</td><td class="line"> sensors_applet_pack_display(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1118"><td class="num" id="LN1118">1118</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1119"><td class="num" id="LN1119">1119</td><td class="line"> active_sensor_destroy(active_sensor);</td></tr> +<tr class="codeline" data-linenumber="1120"><td class="num" id="LN1120">1120</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1121"><td class="num" id="LN1121">1121</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1122"><td class="num" id="LN1122">1122</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1123"><td class="num" id="LN1123">1123</td><td class="line"><span class='keyword'>void</span> sensors_applet_update_sensor(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1124"><td class="num" id="LN1124">1124</td><td class="line"> ActiveSensor *active_sensor;</td></tr> +<tr class="codeline" data-linenumber="1125"><td class="num" id="LN1125">1125</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1126"><td class="num" id="LN1126">1126</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_41<br>; if (sensors_applet) _g_boolean_var_41 = 1; else _g_boolean_var_41<br> = 0; _g_boolean_var_41; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1126, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1127"><td class="num" id="LN1127">1127</td><td class="line"> <span class='macro'>g_assert(path)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_42<br>; if (path) _g_boolean_var_42 = 1; else _g_boolean_var_42 = 0<br>; _g_boolean_var_42; }), 1)) ; else g_assertion_message_expr (<br>"sensors-applet", "sensors-applet.c", 1127, ((const char*) (__func__<br>)), "path"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1128"><td class="num" id="LN1128">1128</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1129"><td class="num" id="LN1129">1129</td><td class="line"> <span class='keyword'>if</span> ((active_sensor = sensors_applet_find_active_sensor(sensors_applet, path)) != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="1130"><td class="num" id="LN1130">1130</td><td class="line"> active_sensor_update(active_sensor, sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1131"><td class="num" id="LN1131">1131</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1132"><td class="num" id="LN1132">1132</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1133"><td class="num" id="LN1133">1133</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1134"><td class="num" id="LN1134">1134</td><td class="line"><span class='keyword'>void</span> sensors_applet_icon_changed(SensorsApplet *sensors_applet, GtkTreePath *path) {</td></tr> +<tr class="codeline" data-linenumber="1135"><td class="num" id="LN1135">1135</td><td class="line"> ActiveSensor *active_sensor;</td></tr> +<tr class="codeline" data-linenumber="1136"><td class="num" id="LN1136">1136</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1137"><td class="num" id="LN1137">1137</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_43<br>; if (sensors_applet) _g_boolean_var_43 = 1; else _g_boolean_var_43<br> = 0; _g_boolean_var_43; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1137, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1138"><td class="num" id="LN1138">1138</td><td class="line"> <span class='macro'>g_assert(path)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_44<br>; if (path) _g_boolean_var_44 = 1; else _g_boolean_var_44 = 0<br>; _g_boolean_var_44; }), 1)) ; else g_assertion_message_expr (<br>"sensors-applet", "sensors-applet.c", 1138, ((const char*) (__func__<br>)), "path"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1139"><td class="num" id="LN1139">1139</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1140"><td class="num" id="LN1140">1140</td><td class="line"> <span class='keyword'>if</span> ((active_sensor = sensors_applet_find_active_sensor(sensors_applet, path)) != <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>) {</td></tr> +<tr class="codeline" data-linenumber="1141"><td class="num" id="LN1141">1141</td><td class="line"> active_sensor_icon_changed(active_sensor, sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1142"><td class="num" id="LN1142">1142</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1143"><td class="num" id="LN1143">1143</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1144"><td class="num" id="LN1144">1144</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1145"><td class="num" id="LN1145">1145</td><td class="line"><span class='comment'>/* Cycle thru ActiveSensors and update them all */</span></td></tr> +<tr class="codeline" data-linenumber="1146"><td class="num" id="LN1146">1146</td><td class="line">gboolean sensors_applet_update_active_sensors(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="1147"><td class="num" id="LN1147">1147</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_45<br>; if (sensors_applet) _g_boolean_var_45 = 1; else _g_boolean_var_45<br> = 0; _g_boolean_var_45; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1147, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1148"><td class="num" id="LN1148">1148</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1149"><td class="num" id="LN1149">1149</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->active_sensors) {</td></tr> +<tr class="codeline" data-linenumber="1150"><td class="num" id="LN1150">1150</td><td class="line"> g_list_foreach(sensors_applet->active_sensors,</td></tr> +<tr class="codeline" data-linenumber="1151"><td class="num" id="LN1151">1151</td><td class="line"> (GFunc)active_sensor_update,</td></tr> +<tr class="codeline" data-linenumber="1152"><td class="num" id="LN1152">1152</td><td class="line"> sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1153"><td class="num" id="LN1153">1153</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1154"><td class="num" id="LN1154">1154</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1155"><td class="num" id="LN1155">1155</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1156"><td class="num" id="LN1156">1156</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1157"><td class="num" id="LN1157">1157</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1158"><td class="num" id="LN1158">1158</td><td class="line"><span class='comment'>/* Cycle thru ActiveSensors and set new graph dimensions */</span></td></tr> +<tr class="codeline" data-linenumber="1159"><td class="num" id="LN1159">1159</td><td class="line"><span class='keyword'>void</span> sensors_applet_graph_size_changed(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="1160"><td class="num" id="LN1160">1160</td><td class="line"> gint dimensions[2];</td></tr> +<tr class="codeline" data-linenumber="1161"><td class="num" id="LN1161">1161</td><td class="line"> gint graph_size;</td></tr> +<tr class="codeline" data-linenumber="1162"><td class="num" id="LN1162">1162</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_46<br>; if (sensors_applet) _g_boolean_var_46 = 1; else _g_boolean_var_46<br> = 0; _g_boolean_var_46; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1162, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1163"><td class="num" id="LN1163">1163</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1164"><td class="num" id="LN1164">1164</td><td class="line"> <span class='keyword'>if</span> (sensors_applet->active_sensors) {</td></tr> +<tr class="codeline" data-linenumber="1165"><td class="num" id="LN1165">1165</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1166"><td class="num" id="LN1166">1166</td><td class="line"> graph_size = g_settings_get_int (sensors_applet->settings, <span class='macro'>GRAPH_SIZE<span class='macro_popup'>"graph-size"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1167"><td class="num" id="LN1167">1167</td><td class="line"> <span class='keyword'>if</span> (mate_panel_applet_get_orient(sensors_applet->applet) == MATE_PANEL_APPLET_ORIENT_UP ||</td></tr> +<tr class="codeline" data-linenumber="1168"><td class="num" id="LN1168">1168</td><td class="line"> mate_panel_applet_get_orient(sensors_applet->applet) == MATE_PANEL_APPLET_ORIENT_DOWN) {</td></tr> +<tr class="codeline" data-linenumber="1169"><td class="num" id="LN1169">1169</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1170"><td class="num" id="LN1170">1170</td><td class="line"> <span class='comment'>/* is horizontal so set graph_size as width */</span></td></tr> +<tr class="codeline" data-linenumber="1171"><td class="num" id="LN1171">1171</td><td class="line"> dimensions[0] = graph_size;</td></tr> +<tr class="codeline" data-linenumber="1172"><td class="num" id="LN1172">1172</td><td class="line"> dimensions[1] = sensors_applet->size;</td></tr> +<tr class="codeline" data-linenumber="1173"><td class="num" id="LN1173">1173</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="1174"><td class="num" id="LN1174">1174</td><td class="line"> dimensions[0] = sensors_applet->size;</td></tr> +<tr class="codeline" data-linenumber="1175"><td class="num" id="LN1175">1175</td><td class="line"> dimensions[1] = graph_size;</td></tr> +<tr class="codeline" data-linenumber="1176"><td class="num" id="LN1176">1176</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1177"><td class="num" id="LN1177">1177</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1178"><td class="num" id="LN1178">1178</td><td class="line"> g_list_foreach(sensors_applet->active_sensors,</td></tr> +<tr class="codeline" data-linenumber="1179"><td class="num" id="LN1179">1179</td><td class="line"> (GFunc)active_sensor_update_graph_dimensions,</td></tr> +<tr class="codeline" data-linenumber="1180"><td class="num" id="LN1180">1180</td><td class="line"> &dimensions);</td></tr> +<tr class="codeline" data-linenumber="1181"><td class="num" id="LN1181">1181</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1182"><td class="num" id="LN1182">1182</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1183"><td class="num" id="LN1183">1183</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1184"><td class="num" id="LN1184">1184</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1185"><td class="num" id="LN1185">1185</td><td class="line">gdouble sensors_applet_convert_temperature(gdouble value, TemperatureScale old, TemperatureScale new) {</td></tr> +<tr class="codeline" data-linenumber="1186"><td class="num" id="LN1186">1186</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1187"><td class="num" id="LN1187">1187</td><td class="line"> <span class='keyword'>switch</span> (old) {</td></tr> +<tr class="codeline" data-linenumber="1188"><td class="num" id="LN1188">1188</td><td class="line"> <span class='keyword'>case</span> KELVIN:</td></tr> +<tr class="codeline" data-linenumber="1189"><td class="num" id="LN1189">1189</td><td class="line"> <span class='keyword'>switch</span> (new) {</td></tr> +<tr class="codeline" data-linenumber="1190"><td class="num" id="LN1190">1190</td><td class="line"> <span class='keyword'>case</span> CELSIUS:</td></tr> +<tr class="codeline" data-linenumber="1191"><td class="num" id="LN1191">1191</td><td class="line"> value = value - 273.0;</td></tr> +<tr class="codeline" data-linenumber="1192"><td class="num" id="LN1192">1192</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1193"><td class="num" id="LN1193">1193</td><td class="line"> <span class='keyword'>case</span> FAHRENHEIT:</td></tr> +<tr class="codeline" data-linenumber="1194"><td class="num" id="LN1194">1194</td><td class="line"> value = (9.0 * (value - 273) / 5.0) + 32.0;</td></tr> +<tr class="codeline" data-linenumber="1195"><td class="num" id="LN1195">1195</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1196"><td class="num" id="LN1196">1196</td><td class="line"> <span class='keyword'>case</span> KELVIN:</td></tr> +<tr class="codeline" data-linenumber="1197"><td class="num" id="LN1197">1197</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1198"><td class="num" id="LN1198">1198</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1199"><td class="num" id="LN1199">1199</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1200"><td class="num" id="LN1200">1200</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1201"><td class="num" id="LN1201">1201</td><td class="line"> <span class='keyword'>case</span> CELSIUS:</td></tr> +<tr class="codeline" data-linenumber="1202"><td class="num" id="LN1202">1202</td><td class="line"> <span class='keyword'>switch</span> (new) {</td></tr> +<tr class="codeline" data-linenumber="1203"><td class="num" id="LN1203">1203</td><td class="line"> <span class='keyword'>case</span> FAHRENHEIT:</td></tr> +<tr class="codeline" data-linenumber="1204"><td class="num" id="LN1204">1204</td><td class="line"> value = (9.0 * value / 5.0) + 32.0;</td></tr> +<tr class="codeline" data-linenumber="1205"><td class="num" id="LN1205">1205</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1206"><td class="num" id="LN1206">1206</td><td class="line"> <span class='keyword'>case</span> KELVIN:</td></tr> +<tr class="codeline" data-linenumber="1207"><td class="num" id="LN1207">1207</td><td class="line"> value = value + 273.0;</td></tr> +<tr class="codeline" data-linenumber="1208"><td class="num" id="LN1208">1208</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1209"><td class="num" id="LN1209">1209</td><td class="line"> <span class='keyword'>case</span> CELSIUS:</td></tr> +<tr class="codeline" data-linenumber="1210"><td class="num" id="LN1210">1210</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1211"><td class="num" id="LN1211">1211</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1212"><td class="num" id="LN1212">1212</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1213"><td class="num" id="LN1213">1213</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1214"><td class="num" id="LN1214">1214</td><td class="line"> <span class='keyword'>case</span> FAHRENHEIT:</td></tr> +<tr class="codeline" data-linenumber="1215"><td class="num" id="LN1215">1215</td><td class="line"> <span class='keyword'>switch</span> (new) {</td></tr> +<tr class="codeline" data-linenumber="1216"><td class="num" id="LN1216">1216</td><td class="line"> <span class='keyword'>case</span> CELSIUS:</td></tr> +<tr class="codeline" data-linenumber="1217"><td class="num" id="LN1217">1217</td><td class="line"> value = (5.0 * (value - 32.0) / 9.0);</td></tr> +<tr class="codeline" data-linenumber="1218"><td class="num" id="LN1218">1218</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1219"><td class="num" id="LN1219">1219</td><td class="line"> <span class='keyword'>case</span> KELVIN:</td></tr> +<tr class="codeline" data-linenumber="1220"><td class="num" id="LN1220">1220</td><td class="line"> value = (5.0 * (value - 32.0) / 9.0) + 273.0;</td></tr> +<tr class="codeline" data-linenumber="1221"><td class="num" id="LN1221">1221</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1222"><td class="num" id="LN1222">1222</td><td class="line"> <span class='keyword'>case</span> FAHRENHEIT:</td></tr> +<tr class="codeline" data-linenumber="1223"><td class="num" id="LN1223">1223</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1224"><td class="num" id="LN1224">1224</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1225"><td class="num" id="LN1225">1225</td><td class="line"> <span class='keyword'>break</span>;</td></tr> +<tr class="codeline" data-linenumber="1226"><td class="num" id="LN1226">1226</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1227"><td class="num" id="LN1227">1227</td><td class="line"> <span class='keyword'>return</span> value;</td></tr> +<tr class="codeline" data-linenumber="1228"><td class="num" id="LN1228">1228</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1229"><td class="num" id="LN1229">1229</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1230"><td class="num" id="LN1230">1230</td><td class="line"><span class='keyword'>void</span> sensors_applet_init(SensorsApplet *sensors_applet) {</td></tr> +<tr class="codeline" data-linenumber="1231"><td class="num" id="LN1231">1231</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1232"><td class="num" id="LN1232">1232</td><td class="line"> <span class='macro'>g_assert(sensors_applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_47<br>; if (sensors_applet) _g_boolean_var_47 = 1; else _g_boolean_var_47<br> = 0; _g_boolean_var_47; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1232, ((const char*) (<br>__func__)), "sensors_applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1233"><td class="num" id="LN1233">1233</td><td class="line"> <span class='macro'>g_assert(sensors_applet->applet)<span class='macro_popup'>do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_48<br>; if (sensors_applet->applet) _g_boolean_var_48 = 1; else _g_boolean_var_48<br> = 0; _g_boolean_var_48; }), 1)) ; else g_assertion_message_expr<br> ("sensors-applet", "sensors-applet.c", 1233, ((const char*) (<br>__func__)), "sensors_applet->applet"); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1234"><td class="num" id="LN1234">1234</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1235"><td class="num" id="LN1235">1235</td><td class="line"> GtkActionGroup *action_group;</td></tr> +<tr class="codeline" data-linenumber="1236"><td class="num" id="LN1236">1236</td><td class="line"> gchar *ui_path;</td></tr> +<tr class="codeline" data-linenumber="1237"><td class="num" id="LN1237">1237</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1238"><td class="num" id="LN1238">1238</td><td class="line"> <span class='comment'>/* Have our background automatically painted. */</span></td></tr> +<tr class="codeline" data-linenumber="1239"><td class="num" id="LN1239">1239</td><td class="line"> mate_panel_applet_set_background_widget(MATE_PANEL_APPLET(sensors_applet->applet), <span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1240"><td class="num" id="LN1240">1240</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1241"><td class="num" id="LN1241">1241</td><td class="line"> <span class='comment'>/* plugin functions are stored as name -> get_value_function pairs so</span></td></tr> +<tr class="codeline" data-linenumber="1242"><td class="num" id="LN1242">1242</td><td class="line"> <span class='comment'>* use standard string functions on hash table */</span></td></tr> +<tr class="codeline" data-linenumber="1243"><td class="num" id="LN1243">1243</td><td class="line"> sensors_applet->plugins = g_hash_table_new(g_str_hash, g_str_equal);</td></tr> +<tr class="codeline" data-linenumber="1244"><td class="num" id="LN1244">1244</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1245"><td class="num" id="LN1245">1245</td><td class="line"> sensors_applet->required_plugins = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1246"><td class="num" id="LN1246">1246</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1247"><td class="num" id="LN1247">1247</td><td class="line"> <span class='comment'>/* initialise size */</span></td></tr> +<tr class="codeline" data-linenumber="1248"><td class="num" id="LN1248">1248</td><td class="line"> sensors_applet->size = <span class='macro'>DEFAULT_APPLET_SIZE<span class='macro_popup'>24</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1249"><td class="num" id="LN1249">1249</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1250"><td class="num" id="LN1250">1250</td><td class="line"> mate_panel_applet_set_flags(sensors_applet->applet, MATE_PANEL_APPLET_EXPAND_MINOR);</td></tr> +<tr class="codeline" data-linenumber="1251"><td class="num" id="LN1251">1251</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1252"><td class="num" id="LN1252">1252</td><td class="line"> <span class='macro'>g_signal_connect(sensors_applet->applet, <span class='string_literal'>"destroy"</span>,<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("destroy"<br>), (((GCallback) (destroy_cb))), (sensors_applet), ((void*)0)<br>, (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1253"><td class="num" id="LN1253">1253</td><td class="line"> <span class='macro'>G_CALLBACK(destroy_cb),<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("destroy"<br>), (((GCallback) (destroy_cb))), (sensors_applet), ((void*)0)<br>, (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1254"><td class="num" id="LN1254">1254</td><td class="line"> <span class='macro'>sensors_applet)<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("destroy"<br>), (((GCallback) (destroy_cb))), (sensors_applet), ((void*)0)<br>, (GConnectFlags) 0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1255"><td class="num" id="LN1255">1255</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1256"><td class="num" id="LN1256">1256</td><td class="line"> <span class='comment'>/* init gsettings */</span></td></tr> +<tr class="codeline" data-linenumber="1257"><td class="num" id="LN1257">1257</td><td class="line"> sensors_applet->settings = mate_panel_applet_settings_new (sensors_applet->applet, <span class='string_literal'>"org.mate.sensors-applet"</span>);</td></tr> +<tr class="codeline" data-linenumber="1258"><td class="num" id="LN1258">1258</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1259"><td class="num" id="LN1259">1259</td><td class="line"> <span class='comment'>/* set up builder for sorting verification */</span></td></tr> +<tr class="codeline" data-linenumber="1260"><td class="num" id="LN1260">1260</td><td class="line"> g_variant_builder_init (&gvb_sensors_hash_list, <span class='macro'>G_VARIANT_TYPE (<span class='string_literal'>"as"</span>)<span class='macro_popup'>(g_variant_type_checked_ (("as")))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1261"><td class="num" id="LN1261">1261</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1262"><td class="num" id="LN1262">1262</td><td class="line"> <span class='comment'>/* set up / load sensors from the plugins */</span></td></tr> +<tr class="codeline" data-linenumber="1263"><td class="num" id="LN1263">1263</td><td class="line"> sensors_applet_plugins_load_all(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1264"><td class="num" id="LN1264">1264</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1265"><td class="num" id="LN1265">1265</td><td class="line"> <span class='comment'>/* set sorting hash array */</span></td></tr> +<tr class="codeline" data-linenumber="1266"><td class="num" id="LN1266">1266</td><td class="line"> GVariant *gv_temp = g_variant_builder_end (&gvb_sensors_hash_list);</td></tr> +<tr class="codeline" data-linenumber="1267"><td class="num" id="LN1267">1267</td><td class="line"> sensors_applet->sensors_hash_array = g_variant_dup_strv (gv_temp, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1268"><td class="num" id="LN1268">1268</td><td class="line"> g_variant_unref (gv_temp);</td></tr> +<tr class="codeline" data-linenumber="1269"><td class="num" id="LN1269">1269</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1270"><td class="num" id="LN1270">1270</td><td class="line"> <span class='comment'>/* sort sensors based on saved sorting */</span></td></tr> +<tr class="codeline" data-linenumber="1271"><td class="num" id="LN1271">1271</td><td class="line"> sensors_applet_settings_sort_sensors(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1272"><td class="num" id="LN1272">1272</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1273"><td class="num" id="LN1273">1273</td><td class="line"> <span class='comment'>/* free hash array */</span></td></tr> +<tr class="codeline" data-linenumber="1274"><td class="num" id="LN1274">1274</td><td class="line"> g_strfreev (sensors_applet->sensors_hash_array);</td></tr> +<tr class="codeline" data-linenumber="1275"><td class="num" id="LN1275">1275</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1276"><td class="num" id="LN1276">1276</td><td class="line"> <span class='comment'>/* should have created sensors tree above, but if have not was because we couldn't find any sensors */</span></td></tr> +<tr class="codeline" data-linenumber="1277"><td class="num" id="LN1277">1277</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == sensors_applet->sensors) {</td></tr> +<tr class="codeline" data-linenumber="1278"><td class="num" id="LN1278">1278</td><td class="line"> GtkWidget *label;</td></tr> +<tr class="codeline" data-linenumber="1279"><td class="num" id="LN1279">1279</td><td class="line"> label = gtk_label_new(<span class='macro'>_(<span class='string_literal'>"No sensors found!"</span>)<span class='macro_popup'>dcgettext (((void*)0), "No sensors found!", 5)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1280"><td class="num" id="LN1280">1280</td><td class="line"> gtk_container_add(<span class='macro'>GTK_CONTAINER(sensors_applet->applet)<span class='macro_popup'>((((GtkContainer*) (void *) ((sensors_applet->applet)))))</span></span>, label);</td></tr> +<tr class="codeline" data-linenumber="1281"><td class="num" id="LN1281">1281</td><td class="line"> gtk_widget_show_all(<span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1282"><td class="num" id="LN1282">1282</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="1283"><td class="num" id="LN1283">1283</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="1284"><td class="num" id="LN1284">1284</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1285"><td class="num" id="LN1285">1285</td><td class="line"> <span class='comment'>/* only do menu and signal connections if sensors are found */</span></td></tr> +<tr class="codeline" data-linenumber="1286"><td class="num" id="LN1286">1286</td><td class="line"> action_group = gtk_action_group_new (<span class='string_literal'>"Sensors Applet Actions"</span>);</td></tr> +<tr class="codeline" data-linenumber="1287"><td class="num" id="LN1287">1287</td><td class="line"> gtk_action_group_set_translation_domain (action_group, <span class='macro'>GETTEXT_PACKAGE<span class='macro_popup'>"mate-sensors-applet"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1288"><td class="num" id="LN1288">1288</td><td class="line"> gtk_action_group_add_actions (action_group,</td></tr> +<tr class="codeline" data-linenumber="1289"><td class="num" id="LN1289">1289</td><td class="line"> sensors_applet_menu_actions,</td></tr> +<tr class="codeline" data-linenumber="1290"><td class="num" id="LN1290">1290</td><td class="line"> <span class='macro'>G_N_ELEMENTS (sensors_applet_menu_actions)<span class='macro_popup'>(sizeof (sensors_applet_menu_actions) / sizeof ((sensors_applet_menu_actions<br>)[0]))</span></span>,</td></tr> +<tr class="codeline" data-linenumber="1291"><td class="num" id="LN1291">1291</td><td class="line"> sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1292"><td class="num" id="LN1292">1292</td><td class="line"> ui_path = g_build_filename (<span class='macro'>UIDIR<span class='macro_popup'>"/usr/local/share/mate-sensors-applet/ui"</span></span>, <span class='macro'>SENSORS_APPLET_MENU_FILE<span class='macro_popup'>"SensorsApplet.xml"</span></span>, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1293"><td class="num" id="LN1293">1293</td><td class="line"> mate_panel_applet_setup_menu_from_file (sensors_applet->applet, ui_path, action_group);</td></tr> +<tr class="codeline" data-linenumber="1294"><td class="num" id="LN1294">1294</td><td class="line"> g_free (ui_path);</td></tr> +<tr class="codeline" data-linenumber="1295"><td class="num" id="LN1295">1295</td><td class="line"> g_object_unref (action_group);</td></tr> +<tr class="codeline" data-linenumber="1296"><td class="num" id="LN1296">1296</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1297"><td class="num" id="LN1297">1297</td><td class="line"> <span class='macro'>g_signal_connect(sensors_applet->applet, <span class='string_literal'>"style-set"</span>,<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("style-set"<br>), (((GCallback) (style_set_cb))), (sensors_applet), ((void*)<br>0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1298"><td class="num" id="LN1298">1298</td><td class="line"> <span class='macro'>G_CALLBACK(style_set_cb),<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("style-set"<br>), (((GCallback) (style_set_cb))), (sensors_applet), ((void*)<br>0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1299"><td class="num" id="LN1299">1299</td><td class="line"> <span class='macro'>sensors_applet)<span class='macro_popup'>g_signal_connect_data ((sensors_applet->applet), ("style-set"<br>), (((GCallback) (style_set_cb))), (sensors_applet), ((void*)<br>0), (GConnectFlags) 0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1300"><td class="num" id="LN1300">1300</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1301"><td class="num" id="LN1301">1301</td><td class="line"> <span class='macro'>g_signal_connect(G_OBJECT(sensors_applet->applet), <span class='string_literal'>"change_orient"</span>,<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("change_orient"), (((GCallback) (change_orient_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1302"><td class="num" id="LN1302">1302</td><td class="line"> <span class='macro'>G_CALLBACK(change_orient_cb),<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("change_orient"), (((GCallback) (change_orient_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1303"><td class="num" id="LN1303">1303</td><td class="line"> <span class='macro'>sensors_applet)<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("change_orient"), (((GCallback) (change_orient_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1304"><td class="num" id="LN1304">1304</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1305"><td class="num" id="LN1305">1305</td><td class="line"> <span class='macro'>g_signal_connect(G_OBJECT(sensors_applet->applet), <span class='string_literal'>"size_allocate"</span>,<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("size_allocate"), (((GCallback) (size_allocate_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1306"><td class="num" id="LN1306">1306</td><td class="line"> <span class='macro'>G_CALLBACK(size_allocate_cb),<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("size_allocate"), (((GCallback) (size_allocate_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span></td></tr> +<tr class="codeline" data-linenumber="1307"><td class="num" id="LN1307">1307</td><td class="line"> <span class='macro'>sensors_applet)<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("size_allocate"), (((GCallback) (size_allocate_cb<br>))), (sensors_applet), ((void*)0), (GConnectFlags) 0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1308"><td class="num" id="LN1308">1308</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1309"><td class="num" id="LN1309">1309</td><td class="line"> <span class='macro'>g_signal_connect(G_OBJECT(sensors_applet->applet), <span class='string_literal'>"leave_notify_event"</span>,<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("leave_notify_event"), (((GCallback) (mouse_leave_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span></td></tr> +<tr class="codeline" data-linenumber="1310"><td class="num" id="LN1310">1310</td><td class="line"> <span class='macro'>G_CALLBACK(mouse_leave_cb),<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("leave_notify_event"), (((GCallback) (mouse_leave_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span></td></tr> +<tr class="codeline" data-linenumber="1311"><td class="num" id="LN1311">1311</td><td class="line"> <span class='macro'>(gpointer)sensors_applet)<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("leave_notify_event"), (((GCallback) (mouse_leave_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1312"><td class="num" id="LN1312">1312</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1313"><td class="num" id="LN1313">1313</td><td class="line"> <span class='macro'>g_signal_connect(G_OBJECT(sensors_applet->applet), <span class='string_literal'>"enter_notify_event"</span>,<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("enter_notify_event"), (((GCallback) (mouse_enter_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span></td></tr> +<tr class="codeline" data-linenumber="1314"><td class="num" id="LN1314">1314</td><td class="line"> <span class='macro'>G_CALLBACK(mouse_enter_cb),<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("enter_notify_event"), (((GCallback) (mouse_enter_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span></td></tr> +<tr class="codeline" data-linenumber="1315"><td class="num" id="LN1315">1315</td><td class="line"> <span class='macro'>(gpointer)sensors_applet)<span class='macro_popup'>g_signal_connect_data ((((((GObject*) (void *) ((sensors_applet<br>->applet)))))), ("enter_notify_event"), (((GCallback) (mouse_enter_cb<br>))), ((gpointer)sensors_applet), ((void*)0), (GConnectFlags) 0<br>)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="1316"><td class="num" id="LN1316">1316</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1317"><td class="num" id="LN1317">1317</td><td class="line"> sensors_applet_update_active_sensors(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1318"><td class="num" id="LN1318">1318</td><td class="line"> sensors_applet_pack_display(sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1319"><td class="num" id="LN1319">1319</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="1320"><td class="num" id="LN1320">1320</td><td class="line"> sensors_applet->timeout_id = g_timeout_add_seconds(g_settings_get_int(sensors_applet->settings, <span class='macro'>TIMEOUT<span class='macro_popup'>"timeout-delay"</span></span>) / 1000,</td></tr> +<tr class="codeline" data-linenumber="1321"><td class="num" id="LN1321">1321</td><td class="line"> (GSourceFunc)sensors_applet_update_active_sensors,</td></tr> +<tr class="codeline" data-linenumber="1322"><td class="num" id="LN1322">1322</td><td class="line"> sensors_applet);</td></tr> +<tr class="codeline" data-linenumber="1323"><td class="num" id="LN1323">1323</td><td class="line"> gtk_widget_show_all(<span class='macro'>GTK_WIDGET(sensors_applet->applet)<span class='macro_popup'>((((GtkWidget*) (void *) ((sensors_applet->applet)))))</span></span>);</td></tr> +<tr class="codeline" data-linenumber="1324"><td class="num" id="LN1324">1324</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="1325"><td class="num" id="LN1325">1325</td><td class="line"> </td></tr> +</table></body></html> diff --git a/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-f7fb7e.html b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-f7fb7e.html new file mode 100644 index 0000000..e390ee2 --- /dev/null +++ b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/report-f7fb7e.html @@ -0,0 +1,1133 @@ +<!doctype html> +<html> +<head> +<title>udisks2-plugin.c</title> + +<style type="text/css"> +body { color:#000000; background-color:#ffffff } +body { font-family:Helvetica, sans-serif; font-size:10pt } +h1 { font-size:14pt } +.FileName { margin-top: 5px; margin-bottom: 5px; display: inline; } +.FileNav { margin-left: 5px; margin-right: 5px; display: inline; } +.FileNav a { text-decoration:none; font-size: larger; } +.divider { margin-top: 30px; margin-bottom: 30px; height: 15px; } +.divider { background-color: gray; } +.code { border-collapse:collapse; width:100%; } +.code { font-family: "Monospace", monospace; font-size:10pt } +.code { line-height: 1.2em } +.comment { color: green; font-style: oblique } +.keyword { color: blue } +.string_literal { color: red } +.directive { color: darkmagenta } + +/* Macros and variables could have pop-up notes hidden by default. + - Macro pop-up: expansion of the macro + - Variable pop-up: value (table) of the variable */ +.macro_popup, .variable_popup { display: none; } + +/* Pop-up appears on mouse-hover event. */ +.macro:hover .macro_popup, .variable:hover .variable_popup { + display: block; + padding: 2px; + -webkit-border-radius:5px; + -webkit-box-shadow:1px 1px 7px #000; + border-radius:5px; + box-shadow:1px 1px 7px #000; + position: absolute; + top: -1em; + left:10em; + z-index: 1 +} + +.macro_popup { + border: 2px solid red; + background-color:#FFF0F0; + font-weight: normal; +} + +.variable_popup { + border: 2px solid blue; + background-color:#F0F0FF; + font-weight: bold; + font-family: Helvetica, sans-serif; + font-size: 9pt; +} + +/* Pop-up notes needs a relative position as a base where they pops up. */ +.macro, .variable { + background-color: PaleGoldenRod; + position: relative; +} +.macro { color: DarkMagenta; } + +#tooltiphint { + position: fixed; + width: 50em; + margin-left: -25em; + left: 50%; + padding: 10px; + border: 1px solid #b0b0b0; + border-radius: 2px; + box-shadow: 1px 1px 7px black; + background-color: #c0c0c0; + z-index: 2; +} + +.num { width:2.5em; padding-right:2ex; background-color:#eeeeee } +.num { text-align:right; font-size:8pt } +.num { color:#444444 } +.line { padding-left: 1ex; border-left: 3px solid #ccc } +.line { white-space: pre } +.msg { -webkit-box-shadow:1px 1px 7px #000 } +.msg { box-shadow:1px 1px 7px #000 } +.msg { -webkit-border-radius:5px } +.msg { border-radius:5px } +.msg { font-family:Helvetica, sans-serif; font-size:8pt } +.msg { float:left } +.msg { position:relative } +.msg { padding:0.25em 1ex 0.25em 1ex } +.msg { margin-top:10px; margin-bottom:10px } +.msg { font-weight:bold } +.msg { max-width:60em; word-wrap: break-word; white-space: pre-wrap } +.msgT { padding:0x; spacing:0x } +.msgEvent { background-color:#fff8b4; color:#000000 } +.msgControl { background-color:#bbbbbb; color:#000000 } +.msgNote { background-color:#ddeeff; color:#000000 } +.mrange { background-color:#dfddf3 } +.mrange { border-bottom:1px solid #6F9DBE } +.PathIndex { font-weight: bold; padding:0px 5px; margin-right:5px; } +.PathIndex { -webkit-border-radius:8px } +.PathIndex { border-radius:8px } +.PathIndexEvent { background-color:#bfba87 } +.PathIndexControl { background-color:#8c8c8c } +.PathIndexPopUp { background-color: #879abc; } +.PathNav a { text-decoration:none; font-size: larger } +.CodeInsertionHint { font-weight: bold; background-color: #10dd10 } +.CodeRemovalHint { background-color:#de1010 } +.CodeRemovalHint { border-bottom:1px solid #6F9DBE } +.msg.selected{ background-color:orange !important; } + +table.simpletable { + padding: 5px; + font-size:12pt; + margin:20px; + border-collapse: collapse; border-spacing: 0px; +} +td.rowname { + text-align: right; + vertical-align: top; + font-weight: bold; + color:#444444; + padding-right:2ex; +} + +/* Hidden text. */ +input.spoilerhider + label { + cursor: pointer; + text-decoration: underline; + display: block; +} +input.spoilerhider { + display: none; +} +input.spoilerhider ~ .spoiler { + overflow: hidden; + margin: 10px auto 0; + height: 0; + opacity: 0; +} +input.spoilerhider:checked + label + .spoiler{ + height: auto; + opacity: 1; +} +</style> +</head> +<body> +<!-- BUGDESC Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption --> + +<!-- BUGTYPE Cast from non-struct type to struct type --> + +<!-- BUGCATEGORY Logic error --> + +<!-- BUGFILE /rootdir/plugins/udisks2/udisks2-plugin.c --> + +<!-- FILENAME udisks2-plugin.c --> + +<!-- FUNCTIONNAME udisks2_plugin_get_sensors --> + +<!-- ISSUEHASHCONTENTOFLINEINCONTEXT f7fb7eafaa89c4067ecf670c0d343b28 --> + +<!-- BUGLINE 296 --> + +<!-- BUGCOLUMN 84 --> + +<!-- BUGPATHLENGTH 1 --> + +<!-- BUGMETAEND --> +<!-- REPORTHEADER --> +<h3>Bug Summary</h3> +<table class="simpletable"> +<tr><td class="rowname">File:</td><td>plugins/udisks2/udisks2-plugin.c</td></tr> +<tr><td class="rowname">Warning:</td><td><a href="#EndPath">line 296, column 84</a><br />Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption</td></tr> + +</table> +<!-- REPORTSUMMARYEXTRA --> +<h3>Annotated Source Code</h3> +<p>Press <a href="#" onclick="toggleHelp(); return false;">'?'</a> + to see keyboard shortcuts</p> +<input type="checkbox" class="spoilerhider" id="showinvocation" /> +<label for="showinvocation" >Show analyzer invocation</label> +<div class="spoiler">clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name udisks2-plugin.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/plugins/udisks2 -resource-dir /usr/lib64/clang/16 -D HAVE_CONFIG_H -I . -I ../../sensors-applet -D MATELOCALEDIR="/usr/local/share/locale/" -D G_LOG_DOMAIN="sensors-applet" -D PIXMAPS_DIR="/usr/local/share/pixmaps/mate-sensors-applet/" -D DATADIR="/usr/local/share" -D LIBDIR="/usr/local/lib" -D SYSCONFDIR="/usr/local/etc" -D PREFIX="/usr/local" -I ../.. -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -D PIC -internal-isystem /usr/lib64/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -fdebug-compilation-dir=/rootdir/plugins/udisks2 -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2023-06-12-021133-6157-1 -x c udisks2-plugin.c +</div> +<div id='tooltiphint' hidden="true"> + <p>Keyboard shortcuts: </p> + <ul> + <li>Use 'j/k' keys for keyboard navigation</li> + <li>Use 'Shift+S' to show/hide relevant lines</li> + <li>Use '?' to toggle this window</li> + </ul> + <a href="#" onclick="toggleHelp(); return false;">Close</a> +</div> +<script type='text/javascript'> +var relevant_lines = {"1": {"296": 1}}; + +var filterCounterexample = function (hide) { + var tables = document.getElementsByClassName("code"); + for (var t=0; t<tables.length; t++) { + var table = tables[t]; + var file_id = table.getAttribute("data-fileid"); + var lines_in_fid = relevant_lines[file_id]; + if (!lines_in_fid) { + lines_in_fid = {}; + } + var lines = table.getElementsByClassName("codeline"); + for (var i=0; i<lines.length; i++) { + var el = lines[i]; + var lineNo = el.getAttribute("data-linenumber"); + if (!lines_in_fid[lineNo]) { + if (hide) { + el.setAttribute("hidden", ""); + } else { + el.removeAttribute("hidden"); + } + } + } + } +} + +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + // SHIFT + S + if (event.shiftKey && event.keyCode == 83) { + var checked = document.getElementsByName("showCounterexample")[0].checked; + filterCounterexample(!checked); + document.getElementsByName("showCounterexample")[0].click(); + } else { + return; + } + event.preventDefault(); +}, true); + +document.addEventListener("DOMContentLoaded", function() { + document.querySelector('input[name="showCounterexample"]').onchange= + function (event) { + filterCounterexample(this.checked); + }; +}); +</script> + +<form> + <input type="checkbox" name="showCounterexample" id="showCounterexample" /> + <label for="showCounterexample"> + Show only relevant lines + </label> + <input type="checkbox" name="showArrows" + id="showArrows" style="margin-left: 10px" /> + <label for="showArrows"> + Show control flow arrows + </label> +</form> + +<script type='text/javascript'> +// Return range of numbers from a range [lower, upper). +function range(lower, upper) { + var array = []; + for (var i = lower; i <= upper; ++i) { + array.push(i); + } + return array; +} + +var getRelatedArrowIndices = function(pathId) { + // HTML numeration of events is a bit different than it is in the path. + // Everything is rotated one step to the right, so the last element + // (error diagnostic) has index 0. + if (pathId == 0) { + // arrowIndices has at least 2 elements + pathId = arrowIndices.length - 1; + } + + return range(arrowIndices[pathId], arrowIndices[pathId - 1]); +} + +var highlightArrowsForSelectedEvent = function() { + const selectedNum = findNum(); + const arrowIndicesToHighlight = getRelatedArrowIndices(selectedNum); + arrowIndicesToHighlight.forEach((index) => { + var arrow = document.querySelector("#arrow" + index); + if(arrow) { + classListAdd(arrow, "selected") + } + }); +} + +var getAbsoluteBoundingRect = function(element) { + const relative = element.getBoundingClientRect(); + return { + left: relative.left + window.pageXOffset, + right: relative.right + window.pageXOffset, + top: relative.top + window.pageYOffset, + bottom: relative.bottom + window.pageYOffset, + height: relative.height, + width: relative.width + }; +} + +var drawArrow = function(index) { + // This function is based on the great answer from SO: + // https://stackoverflow.com/a/39575674/11582326 + var start = document.querySelector("#start" + index); + var end = document.querySelector("#end" + index); + var arrow = document.querySelector("#arrow" + index); + + var startRect = getAbsoluteBoundingRect(start); + var endRect = getAbsoluteBoundingRect(end); + + // It is an arrow from a token to itself, no need to visualize it. + if (startRect.top == endRect.top && + startRect.left == endRect.left) + return; + + // Each arrow is a very simple Bézier curve, with two nodes and + // two handles. So, we need to calculate four points in the window: + // * start node + var posStart = { x: 0, y: 0 }; + // * end node + var posEnd = { x: 0, y: 0 }; + // * handle for the start node + var startHandle = { x: 0, y: 0 }; + // * handle for the end node + var endHandle = { x: 0, y: 0 }; + // One can visualize it as follows: + // + // start handle + // / + // X"""_.-""""X + // .' \ + // / start node + // | + // | + // | end node + // \ / + // `->X + // X-' + // \ + // end handle + // + // NOTE: (0, 0) is the top left corner of the window. + + // We have 3 similar, but still different scenarios to cover: + // + // 1. Two tokens on different lines. + // -xxx + // / + // \ + // -> xxx + // In this situation, we draw arrow on the left curving to the left. + // 2. Two tokens on the same line, and the destination is on the right. + // ____ + // / \ + // / V + // xxx xxx + // In this situation, we draw arrow above curving upwards. + // 3. Two tokens on the same line, and the destination is on the left. + // xxx xxx + // ^ / + // \____/ + // In this situation, we draw arrow below curving downwards. + const onDifferentLines = startRect.top <= endRect.top - 5 || + startRect.top >= endRect.top + 5; + const leftToRight = startRect.left < endRect.left; + + // NOTE: various magic constants are chosen empirically for + // better positioning and look + if (onDifferentLines) { + // Case #1 + const topToBottom = startRect.top < endRect.top; + posStart.x = startRect.left - 1; + // We don't want to start it at the top left corner of the token, + // it doesn't feel like this is where the arrow comes from. + // For this reason, we start it in the middle of the left side + // of the token. + posStart.y = startRect.top + startRect.height / 2; + + // End node has arrow head and we give it a bit more space. + posEnd.x = endRect.left - 4; + posEnd.y = endRect.top; + + // Utility object with x and y offsets for handles. + var curvature = { + // We want bottom-to-top arrow to curve a bit more, so it doesn't + // overlap much with top-to-bottom curves (much more frequent). + x: topToBottom ? 15 : 25, + y: Math.min((posEnd.y - posStart.y) / 3, 10) + } + + // When destination is on the different line, we can make a + // curvier arrow because we have space for it. + // So, instead of using + // + // startHandle.x = posStart.x - curvature.x + // endHandle.x = posEnd.x - curvature.x + // + // We use the leftmost of these two values for both handles. + startHandle.x = Math.min(posStart.x, posEnd.x) - curvature.x; + endHandle.x = startHandle.x; + + // Curving downwards from the start node... + startHandle.y = posStart.y + curvature.y; + // ... and upwards from the end node. + endHandle.y = posEnd.y - curvature.y; + + } else if (leftToRight) { + // Case #2 + // Starting from the top right corner... + posStart.x = startRect.right - 1; + posStart.y = startRect.top; + + // ...and ending at the top left corner of the end token. + posEnd.x = endRect.left + 1; + posEnd.y = endRect.top - 1; + + // Utility object with x and y offsets for handles. + var curvature = { + x: Math.min((posEnd.x - posStart.x) / 3, 15), + y: 5 + } + + // Curving to the right... + startHandle.x = posStart.x + curvature.x; + // ... and upwards from the start node. + startHandle.y = posStart.y - curvature.y; + + // And to the left... + endHandle.x = posEnd.x - curvature.x; + // ... and upwards from the end node. + endHandle.y = posEnd.y - curvature.y; + + } else { + // Case #3 + // Starting from the bottom right corner... + posStart.x = startRect.right; + posStart.y = startRect.bottom; + + // ...and ending also at the bottom right corner, but of the end token. + posEnd.x = endRect.right - 1; + posEnd.y = endRect.bottom + 1; + + // Utility object with x and y offsets for handles. + var curvature = { + x: Math.min((posStart.x - posEnd.x) / 3, 15), + y: 5 + } + + // Curving to the left... + startHandle.x = posStart.x - curvature.x; + // ... and downwards from the start node. + startHandle.y = posStart.y + curvature.y; + + // And to the right... + endHandle.x = posEnd.x + curvature.x; + // ... and downwards from the end node. + endHandle.y = posEnd.y + curvature.y; + } + + // Put it all together into a path. + // More information on the format: + // https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths + var pathStr = "M" + posStart.x + "," + posStart.y + " " + + "C" + startHandle.x + "," + startHandle.y + " " + + endHandle.x + "," + endHandle.y + " " + + posEnd.x + "," + posEnd.y; + + arrow.setAttribute("d", pathStr); +}; + +var drawArrows = function() { + const numOfArrows = document.querySelectorAll("path[id^=arrow]").length; + for (var i = 0; i < numOfArrows; ++i) { + drawArrow(i); + } +} + +var toggleArrows = function(event) { + const arrows = document.querySelector("#arrows"); + if (event.target.checked) { + arrows.setAttribute("visibility", "visible"); + } else { + arrows.setAttribute("visibility", "hidden"); + } +} + +window.addEventListener("resize", drawArrows); +document.addEventListener("DOMContentLoaded", function() { + // Whenever we show invocation, locations change, i.e. we + // need to redraw arrows. + document + .querySelector('input[id="showinvocation"]') + .addEventListener("click", drawArrows); + // Hiding irrelevant lines also should cause arrow rerender. + document + .querySelector('input[name="showCounterexample"]') + .addEventListener("change", drawArrows); + document + .querySelector('input[name="showArrows"]') + .addEventListener("change", toggleArrows); + drawArrows(); + // Default highlighting for the last event. + highlightArrowsForSelectedEvent(); +}); +</script> + +<script type='text/javascript'> +var digitMatcher = new RegExp("[0-9]+"); + +var querySelectorAllArray = function(selector) { + return Array.prototype.slice.call( + document.querySelectorAll(selector)); +} + +document.addEventListener("DOMContentLoaded", function() { + querySelectorAllArray(".PathNav > a").forEach( + function(currentValue, currentIndex) { + var hrefValue = currentValue.getAttribute("href"); + currentValue.onclick = function() { + scrollTo(document.querySelector(hrefValue)); + return false; + }; + }); +}); + +var findNum = function() { + var s = document.querySelector(".msg.selected"); + if (!s || s.id == "EndPath") { + return 0; + } + var out = parseInt(digitMatcher.exec(s.id)[0]); + return out; +}; + +var classListAdd = function(el, theClass) { + if(!el.className.baseVal) + el.className += " " + theClass; + else + el.className.baseVal += " " + theClass; +}; + +var classListRemove = function(el, theClass) { + var className = (!el.className.baseVal) ? + el.className : el.className.baseVal; + className = className.replace(" " + theClass, ""); + if(!el.className.baseVal) + el.className = className; + else + el.className.baseVal = className; +}; + +var scrollTo = function(el) { + querySelectorAllArray(".selected").forEach(function(s) { + classListRemove(s, "selected"); + }); + classListAdd(el, "selected"); + window.scrollBy(0, el.getBoundingClientRect().top - + (window.innerHeight / 2)); + highlightArrowsForSelectedEvent(); +}; + +var move = function(num, up, numItems) { + if (num == 1 && up || num == numItems - 1 && !up) { + return 0; + } else if (num == 0 && up) { + return numItems - 1; + } else if (num == 0 && !up) { + return 1 % numItems; + } + return up ? num - 1 : num + 1; +} + +var numToId = function(num) { + if (num == 0) { + return document.getElementById("EndPath") + } + return document.getElementById("Path" + num); +}; + +var navigateTo = function(up) { + var numItems = document.querySelectorAll( + ".line > .msgEvent, .line > .msgControl").length; + var currentSelected = findNum(); + var newSelected = move(currentSelected, up, numItems); + var newEl = numToId(newSelected, numItems); + + // Scroll element into center. + scrollTo(newEl); +}; + +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + // key 'j' + if (event.keyCode == 74) { + navigateTo(/*up=*/false); + // key 'k' + } else if (event.keyCode == 75) { + navigateTo(/*up=*/true); + } else { + return; + } + event.preventDefault(); +}, true); +</script> + +<script type='text/javascript'> + +var toggleHelp = function() { + var hint = document.querySelector("#tooltiphint"); + var attributeName = "hidden"; + if (hint.hasAttribute(attributeName)) { + hint.removeAttribute(attributeName); + } else { + hint.setAttribute("hidden", "true"); + } +}; +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; + } + if (event.key == "?") { + toggleHelp(); + } else { + return; + } + event.preventDefault(); +}); +</script> + +<style type="text/css"> + svg { + position:absolute; + top:0; + left:0; + height:100%; + width:100%; + pointer-events: none; + overflow: visible + } + .arrow { + stroke-opacity: 0.2; + stroke-width: 1; + marker-end: url(#arrowhead); + } + + .arrow.selected { + stroke-opacity: 0.6; + stroke-width: 2; + marker-end: url(#arrowheadSelected); + } + + .arrowhead { + orient: auto; + stroke: none; + opacity: 0.6; + fill: blue; + } +</style> +<svg xmlns="http://www.w3.org/2000/svg"> + <defs> + <marker id="arrowheadSelected" class="arrowhead" opacity="0.6" + viewBox="0 0 10 10" refX="3" refY="5" + markerWidth="4" markerHeight="4"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + <marker id="arrowhead" class="arrowhead" opacity="0.2" + viewBox="0 0 10 10" refX="3" refY="5" + markerWidth="4" markerHeight="4"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + </defs> + <g id="arrows" fill="none" stroke="blue" visibility="hidden"> + + </g> +</svg> +<script type='text/javascript'> +const arrowIndices = [ 0,0 ] +</script> +<table class="code" data-fileid="1"> +<tr class="codeline" data-linenumber="1"><td class="num" id="LN1">1</td><td class="line"><span class='comment'>/*</span></td></tr> +<tr class="codeline" data-linenumber="2"><td class="num" id="LN2">2</td><td class="line"> <span class='comment'>* Copyright (C) 2017 info-cppsp <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="3"><td class="num" id="LN3">3</td><td class="line"> <span class='comment'>* Copyright (C) 2005-2009 Alex Murray <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="4"><td class="num" id="LN4">4</td><td class="line"> <span class='comment'>* Copyright (C) 2012-2021 MATE Developers</span></td></tr> +<tr class="codeline" data-linenumber="5"><td class="num" id="LN5">5</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="6"><td class="num" id="LN6">6</td><td class="line"> <span class='comment'>* This program is free software; you can redistribute it and/or modify</span></td></tr> +<tr class="codeline" data-linenumber="7"><td class="num" id="LN7">7</td><td class="line"> <span class='comment'>* it under the terms of the GNU General Public License as published by</span></td></tr> +<tr class="codeline" data-linenumber="8"><td class="num" id="LN8">8</td><td class="line"> <span class='comment'>* the Free Software Foundation; either version 2 of the License, or</span></td></tr> +<tr class="codeline" data-linenumber="9"><td class="num" id="LN9">9</td><td class="line"> <span class='comment'>* (at your option) any later version.</span></td></tr> +<tr class="codeline" data-linenumber="10"><td class="num" id="LN10">10</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="11"><td class="num" id="LN11">11</td><td class="line"> <span class='comment'>* This program is distributed in the hope that it will be useful,</span></td></tr> +<tr class="codeline" data-linenumber="12"><td class="num" id="LN12">12</td><td class="line"> <span class='comment'>* but WITHOUT ANY WARRANTY; without even the implied warranty of</span></td></tr> +<tr class="codeline" data-linenumber="13"><td class="num" id="LN13">13</td><td class="line"> <span class='comment'>* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></td></tr> +<tr class="codeline" data-linenumber="14"><td class="num" id="LN14">14</td><td class="line"> <span class='comment'>* GNU General Public License for more details.</span></td></tr> +<tr class="codeline" data-linenumber="15"><td class="num" id="LN15">15</td><td class="line"> <span class='comment'>*</span></td></tr> +<tr class="codeline" data-linenumber="16"><td class="num" id="LN16">16</td><td class="line"> <span class='comment'>* You should have received a copy of the GNU General Public License</span></td></tr> +<tr class="codeline" data-linenumber="17"><td class="num" id="LN17">17</td><td class="line"> <span class='comment'>* along with this program; if not, write to the Free Software</span></td></tr> +<tr class="codeline" data-linenumber="18"><td class="num" id="LN18">18</td><td class="line"> <span class='comment'>* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</span></td></tr> +<tr class="codeline" data-linenumber="19"><td class="num" id="LN19">19</td><td class="line"> <span class='comment'>*/</span></td></tr> +<tr class="codeline" data-linenumber="20"><td class="num" id="LN20">20</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="21"><td class="num" id="LN21">21</td><td class="line"><span class='comment'>/*</span></td></tr> +<tr class="codeline" data-linenumber="22"><td class="num" id="LN22">22</td><td class="line"><span class='comment'>Udisks2 plugin for the mate-sensors-applet</span></td></tr> +<tr class="codeline" data-linenumber="23"><td class="num" id="LN23">23</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="24"><td class="num" id="LN24">24</td><td class="line"><span class='comment'>written using the structure and code of the previous version</span></td></tr> +<tr class="codeline" data-linenumber="25"><td class="num" id="LN25">25</td><td class="line"><span class='comment'>from Pramod Dematagoda <[email protected]></span></td></tr> +<tr class="codeline" data-linenumber="26"><td class="num" id="LN26">26</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="27"><td class="num" id="LN27">27</td><td class="line"><span class='comment'>dbus-glib documentation</span></td></tr> +<tr class="codeline" data-linenumber="28"><td class="num" id="LN28">28</td><td class="line"><span class='comment'>https://dbus.freedesktop.org/doc/dbus-glib/</span></td></tr> +<tr class="codeline" data-linenumber="29"><td class="num" id="LN29">29</td><td class="line"><span class='comment'>GDBUS documentation</span></td></tr> +<tr class="codeline" data-linenumber="30"><td class="num" id="LN30">30</td><td class="line"><span class='comment'>https://developer.gnome.org/gio/stable/index.html</span></td></tr> +<tr class="codeline" data-linenumber="31"><td class="num" id="LN31">31</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="32"><td class="num" id="LN32">32</td><td class="line"><span class='comment'>*/</span></td></tr> +<tr class="codeline" data-linenumber="33"><td class="num" id="LN33">33</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="34"><td class="num" id="LN34">34</td><td class="line"><span class='directive'>#ifdef <span class='macro'>HAVE_CONFIG_H<span class='macro_popup'>1</span></span></span></td></tr> +<tr class="codeline" data-linenumber="35"><td class="num" id="LN35">35</td><td class="line"><span class='directive'>#include "config.h"</span></td></tr> +<tr class="codeline" data-linenumber="36"><td class="num" id="LN36">36</td><td class="line"><span class='directive'>#endif /* HAVE_CONFIG_H */</span></td></tr> +<tr class="codeline" data-linenumber="37"><td class="num" id="LN37">37</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="38"><td class="num" id="LN38">38</td><td class="line"><span class='directive'>#include <stdio.h></span></td></tr> +<tr class="codeline" data-linenumber="39"><td class="num" id="LN39">39</td><td class="line"><span class='directive'>#include <gio/gio.h></span></td></tr> +<tr class="codeline" data-linenumber="40"><td class="num" id="LN40">40</td><td class="line"><span class='directive'>#include "udisks2-plugin.h"</span></td></tr> +<tr class="codeline" data-linenumber="41"><td class="num" id="LN41">41</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="42"><td class="num" id="LN42">42</td><td class="line"><span class='comment'>/* remove // from next line for syslog debug */</span></td></tr> +<tr class="codeline" data-linenumber="43"><td class="num" id="LN43">43</td><td class="line"><span class='comment'>//#define UD2PD 1</span></td></tr> +<tr class="codeline" data-linenumber="44"><td class="num" id="LN44">44</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="45"><td class="num" id="LN45">45</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="46"><td class="num" id="LN46">46</td><td class="line"><span class='directive'>#include <syslog.h></span></td></tr> +<tr class="codeline" data-linenumber="47"><td class="num" id="LN47">47</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="48"><td class="num" id="LN48">48</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="49"><td class="num" id="LN49">49</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_BUS_NAME<span class='macro_popup'>"org.freedesktop.UDisks2"</span></span> "org.freedesktop.UDisks2"</span></td></tr> +<tr class="codeline" data-linenumber="50"><td class="num" id="LN50">50</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.DBus.ObjectManager"</span></span> "org.freedesktop.DBus.ObjectManager"</span></td></tr> +<tr class="codeline" data-linenumber="51"><td class="num" id="LN51">51</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_DEVICE_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive"</span></span> "org.freedesktop.UDisks2.Drive"</span></td></tr> +<tr class="codeline" data-linenumber="52"><td class="num" id="LN52">52</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_DEVICE_INTERFACE2_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive.Ata"</span></span> "org.freedesktop.UDisks2.Drive.Ata"</span></td></tr> +<tr class="codeline" data-linenumber="53"><td class="num" id="LN53">53</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="54"><td class="num" id="LN54">54</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_PROPERTIES_INTERFACE<span class='macro_popup'>"org.freedesktop.DBus.Properties"</span></span> "org.freedesktop.DBus.Properties"</span></td></tr> +<tr class="codeline" data-linenumber="55"><td class="num" id="LN55">55</td><td class="line"><span class='directive'>#define <span class='macro'>UDISKS2_OBJECT_PATH<span class='macro_popup'>"/org/freedesktop/UDisks2"</span></span> "/org/freedesktop/UDisks2"</span></td></tr> +<tr class="codeline" data-linenumber="56"><td class="num" id="LN56">56</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="57"><td class="num" id="LN57">57</td><td class="line"><span class='comment'>/* Info about a single sensor */</span></td></tr> +<tr class="codeline" data-linenumber="58"><td class="num" id="LN58">58</td><td class="line"><span class='keyword'>typedef</span> <span class='keyword'>struct</span> _DevInfo {</td></tr> +<tr class="codeline" data-linenumber="59"><td class="num" id="LN59">59</td><td class="line"> gchar *path;</td></tr> +<tr class="codeline" data-linenumber="60"><td class="num" id="LN60">60</td><td class="line"> gchar *id;</td></tr> +<tr class="codeline" data-linenumber="61"><td class="num" id="LN61">61</td><td class="line"> gdouble temp;</td></tr> +<tr class="codeline" data-linenumber="62"><td class="num" id="LN62">62</td><td class="line"> GDBusProxy *sensor_proxy; <span class='comment'>/* dbus object */</span></td></tr> +<tr class="codeline" data-linenumber="63"><td class="num" id="LN63">63</td><td class="line"> GError *error;</td></tr> +<tr class="codeline" data-linenumber="64"><td class="num" id="LN64">64</td><td class="line">} DevInfo;</td></tr> +<tr class="codeline" data-linenumber="65"><td class="num" id="LN65">65</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="66"><td class="num" id="LN66">66</td><td class="line"><span class='keyword'>const</span> gchar *plugin_name = <span class='string_literal'>"udisks2"</span>;</td></tr> +<tr class="codeline" data-linenumber="67"><td class="num" id="LN67">67</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="68"><td class="num" id="LN68">68</td><td class="line"><span class='comment'>/* a container for the devices found to have smart enabled */</span></td></tr> +<tr class="codeline" data-linenumber="69"><td class="num" id="LN69">69</td><td class="line">GHashTable *devices = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="70"><td class="num" id="LN70">70</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="71"><td class="num" id="LN71">71</td><td class="line"><span class='comment'>/* This is a global variable for convenience */</span></td></tr> +<tr class="codeline" data-linenumber="72"><td class="num" id="LN72">72</td><td class="line">GDBusConnection *connection = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="73"><td class="num" id="LN73">73</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="74"><td class="num" id="LN74">74</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> update_device (DevInfo *info) {</td></tr> +<tr class="codeline" data-linenumber="75"><td class="num" id="LN75">75</td><td class="line"> GError *error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="76"><td class="num" id="LN76">76</td><td class="line"> GVariant *tempgvar = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="77"><td class="num" id="LN77">77</td><td class="line"> GVariant *tempgvar2 = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="78"><td class="num" id="LN78">78</td><td class="line"> gdouble temp;</td></tr> +<tr class="codeline" data-linenumber="79"><td class="num" id="LN79">79</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="80"><td class="num" id="LN80">80</td><td class="line"> <span class='comment'>/* check valid input parameter */</span></td></tr> +<tr class="codeline" data-linenumber="81"><td class="num" id="LN81">81</td><td class="line"> <span class='macro'>g_return_if_fail (info != NULL)<span class='macro_popup'>do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_14<br>; if (info != ((void*)0)) _g_boolean_var_14 = 1; else _g_boolean_var_14<br> = 0; _g_boolean_var_14; }), 1))) { } else { g_return_if_fail_warning<br> ("sensors-applet", ((const char*) (__func__)), "info != NULL"<br>); return; } } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="82"><td class="num" id="LN82">82</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="83"><td class="num" id="LN83">83</td><td class="line"> <span class='comment'>/* check connection too */</span></td></tr> +<tr class="codeline" data-linenumber="84"><td class="num" id="LN84">84</td><td class="line"> <span class='macro'>g_return_if_fail (connection != NULL)<span class='macro_popup'>do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_15<br>; if (connection != ((void*)0)) _g_boolean_var_15 = 1; else _g_boolean_var_15<br> = 0; _g_boolean_var_15; }), 1))) { } else { g_return_if_fail_warning<br> ("sensors-applet", ((const char*) (__func__)), "connection != NULL"<br>); return; } } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="85"><td class="num" id="LN85">85</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="86"><td class="num" id="LN86">86</td><td class="line"> g_clear_error (&info->error);</td></tr> +<tr class="codeline" data-linenumber="87"><td class="num" id="LN87">87</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="88"><td class="num" id="LN88">88</td><td class="line"> <span class='comment'>/* check for sensor_proxy, which should exist at this point, make one if necessary and save it into DevInfo</span></td></tr> +<tr class="codeline" data-linenumber="89"><td class="num" id="LN89">89</td><td class="line"> <span class='comment'>* this is used to get the temp value the direct way */</span></td></tr> +<tr class="codeline" data-linenumber="90"><td class="num" id="LN90">90</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == info->sensor_proxy) {</td></tr> +<tr class="codeline" data-linenumber="91"><td class="num" id="LN91">91</td><td class="line"> info->sensor_proxy = g_dbus_proxy_new_sync (connection, G_DBUS_PROXY_FLAGS_NONE, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="92"><td class="num" id="LN92">92</td><td class="line"> <span class='macro'>UDISKS2_BUS_NAME<span class='macro_popup'>"org.freedesktop.UDisks2"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="93"><td class="num" id="LN93">93</td><td class="line"> info->path,</td></tr> +<tr class="codeline" data-linenumber="94"><td class="num" id="LN94">94</td><td class="line"> <span class='macro'>UDISKS2_PROPERTIES_INTERFACE<span class='macro_popup'>"org.freedesktop.DBus.Properties"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="95"><td class="num" id="LN95">95</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, &error);</td></tr> +<tr class="codeline" data-linenumber="96"><td class="num" id="LN96">96</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="97"><td class="num" id="LN97">97</td><td class="line"> <span class='comment'>/* check, just to be sure */</span></td></tr> +<tr class="codeline" data-linenumber="98"><td class="num" id="LN98">98</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == info->sensor_proxy) {</td></tr> +<tr class="codeline" data-linenumber="99"><td class="num" id="LN99">99</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="100"><td class="num" id="LN100">100</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="101"><td class="num" id="LN101">101</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Failed to get drive temperature 1"</span>);</td></tr> +<tr class="codeline" data-linenumber="102"><td class="num" id="LN102">102</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="103"><td class="num" id="LN103">103</td><td class="line"> g_debug (<span class='string_literal'>"Failed to get drive temperature 1: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="104"><td class="num" id="LN104">104</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="105"><td class="num" id="LN105">105</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="106"><td class="num" id="LN106">106</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="107"><td class="num" id="LN107">107</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="108"><td class="num" id="LN108">108</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="109"><td class="num" id="LN109">109</td><td class="line"><span class='comment'>/* note on timing:</span></td></tr> +<tr class="codeline" data-linenumber="110"><td class="num" id="LN110">110</td><td class="line"> <span class='comment'>* it seems to me that smart updates occur automatically every 10 minutes</span></td></tr> +<tr class="codeline" data-linenumber="111"><td class="num" id="LN111">111</td><td class="line"> <span class='comment'>* mate-sensor-applet has a default refresh of 2 seconds...</span></td></tr> +<tr class="codeline" data-linenumber="112"><td class="num" id="LN112">112</td><td class="line"> <span class='comment'>* it is possible to force a smart update with udisks2: SmartUpdate (IN a{sv} options); */</span></td></tr> +<tr class="codeline" data-linenumber="113"><td class="num" id="LN113">113</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="114"><td class="num" id="LN114">114</td><td class="line"> <span class='comment'>/* directly asking the device's DBus object for the temp */</span></td></tr> +<tr class="codeline" data-linenumber="115"><td class="num" id="LN115">115</td><td class="line"> tempgvar = g_dbus_proxy_call_sync (info->sensor_proxy, <span class='string_literal'>"Get"</span>,</td></tr> +<tr class="codeline" data-linenumber="116"><td class="num" id="LN116">116</td><td class="line"> g_variant_new (<span class='string_literal'>"(ss)"</span>,</td></tr> +<tr class="codeline" data-linenumber="117"><td class="num" id="LN117">117</td><td class="line"> <span class='macro'>UDISKS2_DEVICE_INTERFACE2_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive.Ata"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="118"><td class="num" id="LN118">118</td><td class="line"> <span class='string_literal'>"SmartTemperature"</span>), <span class='comment'>/* parameters */</span></td></tr> +<tr class="codeline" data-linenumber="119"><td class="num" id="LN119">119</td><td class="line"> G_DBUS_CALL_FLAGS_NONE, <span class='comment'>/* flags */</span></td></tr> +<tr class="codeline" data-linenumber="120"><td class="num" id="LN120">120</td><td class="line"> -1, <span class='comment'>/* timeout */</span></td></tr> +<tr class="codeline" data-linenumber="121"><td class="num" id="LN121">121</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='comment'>/* cancellable */</span></td></tr> +<tr class="codeline" data-linenumber="122"><td class="num" id="LN122">122</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="123"><td class="num" id="LN123">123</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="124"><td class="num" id="LN124">124</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == tempgvar) {</td></tr> +<tr class="codeline" data-linenumber="125"><td class="num" id="LN125">125</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="126"><td class="num" id="LN126">126</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="127"><td class="num" id="LN127">127</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Failed to get drive temperature 2"</span>);</td></tr> +<tr class="codeline" data-linenumber="128"><td class="num" id="LN128">128</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="129"><td class="num" id="LN129">129</td><td class="line"> g_debug (<span class='string_literal'>"Failed to get drive temperature 2: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="130"><td class="num" id="LN130">130</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="131"><td class="num" id="LN131">131</td><td class="line"> <span class='comment'>/* throw away proxy, maybe next time it will be better */</span></td></tr> +<tr class="codeline" data-linenumber="132"><td class="num" id="LN132">132</td><td class="line"> <span class='macro'>g_clear_object (&info->sensor_proxy)<span class='macro_popup'>do { _Static_assert (sizeof *((&info->sensor_proxy)) ==<br> sizeof (gpointer), "Expression evaluates to false"); __typeof__<br> (((&info->sensor_proxy))) _pp = ((&info->sensor_proxy<br>)); __typeof__ (*((&info->sensor_proxy))) _ptr = *_pp;<br> *_pp = ((void*)0); if (_ptr) (g_object_unref) (_ptr); } while<br> (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="133"><td class="num" id="LN133">133</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="134"><td class="num" id="LN134">134</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="135"><td class="num" id="LN135">135</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="136"><td class="num" id="LN136">136</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="137"><td class="num" id="LN137">137</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="138"><td class="num" id="LN138">138</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"tempgvar value: %s"</span>, g_variant_print(tempgvar, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="139"><td class="num" id="LN139">139</td><td class="line"><span class='comment'>/* leaks memory! */</span></td></tr> +<tr class="codeline" data-linenumber="140"><td class="num" id="LN140">140</td><td class="line"><span class='comment'>//syslog(LOG_ERR, "tempgvar value: %s", g_variant_print(g_variant_get_variant(g_variant_get_child_value(tempgvar, 0)), TRUE));</span></td></tr> +<tr class="codeline" data-linenumber="141"><td class="num" id="LN141">141</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="142"><td class="num" id="LN142">142</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="143"><td class="num" id="LN143">143</td><td class="line"> <span class='comment'>/* tempgvar comes back as something along the lines of array(gvariant(tempasdouble))</span></td></tr> +<tr class="codeline" data-linenumber="144"><td class="num" id="LN144">144</td><td class="line"> <span class='comment'>* hence unpacking</span></td></tr> +<tr class="codeline" data-linenumber="145"><td class="num" id="LN145">145</td><td class="line"> <span class='comment'>* need to free up every param / return value, so can't do it like:</span></td></tr> +<tr class="codeline" data-linenumber="146"><td class="num" id="LN146">146</td><td class="line"> <span class='comment'>* temp = g_variant_get_double(g_variant_get_variant(g_variant_get_child_value(tempgvar, 0))); */</span></td></tr> +<tr class="codeline" data-linenumber="147"><td class="num" id="LN147">147</td><td class="line"> tempgvar2 = g_variant_get_child_value (tempgvar, 0);</td></tr> +<tr class="codeline" data-linenumber="148"><td class="num" id="LN148">148</td><td class="line"> g_variant_unref (tempgvar);</td></tr> +<tr class="codeline" data-linenumber="149"><td class="num" id="LN149">149</td><td class="line"> tempgvar = g_variant_get_variant (tempgvar2);</td></tr> +<tr class="codeline" data-linenumber="150"><td class="num" id="LN150">150</td><td class="line"> g_variant_unref (tempgvar2);</td></tr> +<tr class="codeline" data-linenumber="151"><td class="num" id="LN151">151</td><td class="line"> temp = g_variant_get_double (tempgvar);</td></tr> +<tr class="codeline" data-linenumber="152"><td class="num" id="LN152">152</td><td class="line"> g_variant_unref (tempgvar);</td></tr> +<tr class="codeline" data-linenumber="153"><td class="num" id="LN153">153</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="154"><td class="num" id="LN154">154</td><td class="line"> <span class='comment'>/* temp in K */</span></td></tr> +<tr class="codeline" data-linenumber="155"><td class="num" id="LN155">155</td><td class="line"> info->temp = temp - 273.15;</td></tr> +<tr class="codeline" data-linenumber="156"><td class="num" id="LN156">156</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="157"><td class="num" id="LN157">157</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="158"><td class="num" id="LN158">158</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Refresh udisks2 device temp: '%f'\n"</span>, info->temp);</td></tr> +<tr class="codeline" data-linenumber="159"><td class="num" id="LN159">159</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="160"><td class="num" id="LN160">160</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="161"><td class="num" id="LN161">161</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="162"><td class="num" id="LN162">162</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="163"><td class="num" id="LN163">163</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="164"><td class="num" id="LN164">164</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="165"><td class="num" id="LN165">165</td><td class="line"><span class='comment'>/* in this function we would like to get a list of device (hdd/ssd) paths</span></td></tr> +<tr class="codeline" data-linenumber="166"><td class="num" id="LN166">166</td><td class="line"> <span class='comment'>* then with each path we get the temperature</span></td></tr> +<tr class="codeline" data-linenumber="167"><td class="num" id="LN167">167</td><td class="line"> <span class='comment'>* it is possible with udisks2 to get all the above information in one g_dbus_proxy_call_sync(), so that is how I did it</span></td></tr> +<tr class="codeline" data-linenumber="168"><td class="num" id="LN168">168</td><td class="line"> <span class='comment'>* maybe a better version would be to use GDBusObjectManager Server + Client ?? */</span></td></tr> +<tr class="codeline" data-linenumber="169"><td class="num" id="LN169">169</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span> udisks2_plugin_get_sensors (GList **sensors) {</td></tr> +<tr class="codeline" data-linenumber="170"><td class="num" id="LN170">170</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="171"><td class="num" id="LN171">171</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="172"><td class="num" id="LN172">172</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"fstart"</span>);</td></tr> +<tr class="codeline" data-linenumber="173"><td class="num" id="LN173">173</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="174"><td class="num" id="LN174">174</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="175"><td class="num" id="LN175">175</td><td class="line"> GDBusProxy *proxy = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="176"><td class="num" id="LN176">176</td><td class="line"> GError *error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="177"><td class="num" id="LN177">177</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="178"><td class="num" id="LN178">178</td><td class="line"> DevInfo *info;</td></tr> +<tr class="codeline" data-linenumber="179"><td class="num" id="LN179">179</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="180"><td class="num" id="LN180">180</td><td class="line"> <span class='comment'>/* This connection will be used for everything, including the obtaining of sensor data */</span></td></tr> +<tr class="codeline" data-linenumber="181"><td class="num" id="LN181">181</td><td class="line"> connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, &error);</td></tr> +<tr class="codeline" data-linenumber="182"><td class="num" id="LN182">182</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == connection) {</td></tr> +<tr class="codeline" data-linenumber="183"><td class="num" id="LN183">183</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="184"><td class="num" id="LN184">184</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="185"><td class="num" id="LN185">185</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn fail"</span>);</td></tr> +<tr class="codeline" data-linenumber="186"><td class="num" id="LN186">186</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="187"><td class="num" id="LN187">187</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="188"><td class="num" id="LN188">188</td><td class="line"> g_debug (<span class='string_literal'>"Failed to open connection to DBUS: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="189"><td class="num" id="LN189">189</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="190"><td class="num" id="LN190">190</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="191"><td class="num" id="LN191">191</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="192"><td class="num" id="LN192">192</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="193"><td class="num" id="LN193">193</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="194"><td class="num" id="LN194">194</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn success"</span>);</td></tr> +<tr class="codeline" data-linenumber="195"><td class="num" id="LN195">195</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="196"><td class="num" id="LN196">196</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="197"><td class="num" id="LN197">197</td><td class="line"> <span class='comment'>/* I use this proxy to get all info of all devices at once */</span></td></tr> +<tr class="codeline" data-linenumber="198"><td class="num" id="LN198">198</td><td class="line"> proxy = g_dbus_proxy_new_sync (connection, G_DBUS_PROXY_FLAGS_NONE, <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="199"><td class="num" id="LN199">199</td><td class="line"> <span class='macro'>UDISKS2_BUS_NAME<span class='macro_popup'>"org.freedesktop.UDisks2"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="200"><td class="num" id="LN200">200</td><td class="line"> <span class='macro'>UDISKS2_OBJECT_PATH<span class='macro_popup'>"/org/freedesktop/UDisks2"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="201"><td class="num" id="LN201">201</td><td class="line"> <span class='macro'>UDISKS2_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.DBus.ObjectManager"</span></span>,</td></tr> +<tr class="codeline" data-linenumber="202"><td class="num" id="LN202">202</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, &error);</td></tr> +<tr class="codeline" data-linenumber="203"><td class="num" id="LN203">203</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="204"><td class="num" id="LN204">204</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == proxy) {</td></tr> +<tr class="codeline" data-linenumber="205"><td class="num" id="LN205">205</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="206"><td class="num" id="LN206">206</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="207"><td class="num" id="LN207">207</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn proxy fail"</span>);</td></tr> +<tr class="codeline" data-linenumber="208"><td class="num" id="LN208">208</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="209"><td class="num" id="LN209">209</td><td class="line"> g_debug (<span class='string_literal'>"dbus conn proxy fail: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="210"><td class="num" id="LN210">210</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="211"><td class="num" id="LN211">211</td><td class="line"> <span class='macro'>g_clear_object (&connection)<span class='macro_popup'>do { _Static_assert (sizeof *((&connection)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&connection<br>))) _pp = ((&connection)); __typeof__ (*((&connection<br>))) _ptr = *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref<br>) (_ptr); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="212"><td class="num" id="LN212">212</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="213"><td class="num" id="LN213">213</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="214"><td class="num" id="LN214">214</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="215"><td class="num" id="LN215">215</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="216"><td class="num" id="LN216">216</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"dbus conn proxy success"</span>);</td></tr> +<tr class="codeline" data-linenumber="217"><td class="num" id="LN217">217</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="218"><td class="num" id="LN218">218</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="219"><td class="num" id="LN219">219</td><td class="line"> <span class='comment'>/* The object paths of the disks are enumerated and placed in an array of object paths</span></td></tr> +<tr class="codeline" data-linenumber="220"><td class="num" id="LN220">220</td><td class="line"> <span class='comment'>* "GetManagedObjects" returns dict of (objectpath, (dict of (string [ie. if. name], dict of(string [ie. property name], variant [ie. prop. value])))) */</span></td></tr> +<tr class="codeline" data-linenumber="221"><td class="num" id="LN221">221</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="222"><td class="num" id="LN222">222</td><td class="line"> <span class='comment'>/* g_dbus_proxy_call_sync() returns NULL on error, GVariant * otherwise</span></td></tr> +<tr class="codeline" data-linenumber="223"><td class="num" id="LN223">223</td><td class="line"> <span class='comment'>* need second variable to prevent memory leak */</span></td></tr> +<tr class="codeline" data-linenumber="224"><td class="num" id="LN224">224</td><td class="line"> GVariant *managed_objects = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="225"><td class="num" id="LN225">225</td><td class="line"> GVariant *managed_objects2 = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="226"><td class="num" id="LN226">226</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="227"><td class="num" id="LN227">227</td><td class="line"> managed_objects2 = g_dbus_proxy_call_sync (proxy, <span class='string_literal'>"GetManagedObjects"</span>,</td></tr> +<tr class="codeline" data-linenumber="228"><td class="num" id="LN228">228</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='comment'>/* parameters */</span></td></tr> +<tr class="codeline" data-linenumber="229"><td class="num" id="LN229">229</td><td class="line"> G_DBUS_CALL_FLAGS_NONE, <span class='comment'>/* flags */</span></td></tr> +<tr class="codeline" data-linenumber="230"><td class="num" id="LN230">230</td><td class="line"> -1, <span class='comment'>/* timeout */</span></td></tr> +<tr class="codeline" data-linenumber="231"><td class="num" id="LN231">231</td><td class="line"> <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>, <span class='comment'>/* cancellable */</span></td></tr> +<tr class="codeline" data-linenumber="232"><td class="num" id="LN232">232</td><td class="line"> &error);</td></tr> +<tr class="codeline" data-linenumber="233"><td class="num" id="LN233">233</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="234"><td class="num" id="LN234">234</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == managed_objects2) {</td></tr> +<tr class="codeline" data-linenumber="235"><td class="num" id="LN235">235</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="236"><td class="num" id="LN236">236</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="237"><td class="num" id="LN237">237</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Failed to enumerate disk devices"</span>);</td></tr> +<tr class="codeline" data-linenumber="238"><td class="num" id="LN238">238</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="239"><td class="num" id="LN239">239</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="240"><td class="num" id="LN240">240</td><td class="line"> g_debug (<span class='string_literal'>"Failed to enumerate disk devices: %s"</span>, error->message);</td></tr> +<tr class="codeline" data-linenumber="241"><td class="num" id="LN241">241</td><td class="line"> g_clear_error (&error);</td></tr> +<tr class="codeline" data-linenumber="242"><td class="num" id="LN242">242</td><td class="line"> <span class='macro'>g_clear_object (&proxy)<span class='macro_popup'>do { _Static_assert (sizeof *((&proxy)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&proxy<br>))) _pp = ((&proxy)); __typeof__ (*((&proxy))) _ptr =<br> *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref) (_ptr); }<br> while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="243"><td class="num" id="LN243">243</td><td class="line"> <span class='macro'>g_clear_object (&connection)<span class='macro_popup'>do { _Static_assert (sizeof *((&connection)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&connection<br>))) _pp = ((&connection)); __typeof__ (*((&connection<br>))) _ptr = *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref<br>) (_ptr); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="244"><td class="num" id="LN244">244</td><td class="line"> <span class='keyword'>return</span>;</td></tr> +<tr class="codeline" data-linenumber="245"><td class="num" id="LN245">245</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="246"><td class="num" id="LN246">246</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="247"><td class="num" id="LN247">247</td><td class="line"> <span class='comment'>/* the result dictionary is enclosed in an array, unpack */</span></td></tr> +<tr class="codeline" data-linenumber="248"><td class="num" id="LN248">248</td><td class="line"> managed_objects = g_variant_get_child_value (managed_objects2, 0);</td></tr> +<tr class="codeline" data-linenumber="249"><td class="num" id="LN249">249</td><td class="line"> g_variant_unref (managed_objects2);</td></tr> +<tr class="codeline" data-linenumber="250"><td class="num" id="LN250">250</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="251"><td class="num" id="LN251">251</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="252"><td class="num" id="LN252">252</td><td class="line"><span class='comment'>//syslog(LOG_ERR, "managed_objects type: %s", g_variant_print(managed_objects, TRUE));</span></td></tr> +<tr class="codeline" data-linenumber="253"><td class="num" id="LN253">253</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"success to enumerate disk devices"</span>);</td></tr> +<tr class="codeline" data-linenumber="254"><td class="num" id="LN254">254</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="255"><td class="num" id="LN255">255</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="256"><td class="num" id="LN256">256</td><td class="line"> <span class='comment'>/* iterator for the result dictionary</span></td></tr> +<tr class="codeline" data-linenumber="257"><td class="num" id="LN257">257</td><td class="line"> <span class='comment'>* iterator code is based on the g_variant_iter_next() documentation</span></td></tr> +<tr class="codeline" data-linenumber="258"><td class="num" id="LN258">258</td><td class="line"> <span class='comment'>* iter is freed if the GVariant is, when using g_variant_iter_init() */</span></td></tr> +<tr class="codeline" data-linenumber="259"><td class="num" id="LN259">259</td><td class="line"> GVariantIter iter;</td></tr> +<tr class="codeline" data-linenumber="260"><td class="num" id="LN260">260</td><td class="line"> gchar *key = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; <span class='comment'>/* object path (like '/org/freedesktop/UDisks2/drives/Samsung_SSD_840_EVO_250GB_*insert drive serial nr.*') */</span></td></tr> +<tr class="codeline" data-linenumber="261"><td class="num" id="LN261">261</td><td class="line"> GVariant *value = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="262"><td class="num" id="LN262">262</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="263"><td class="num" id="LN263">263</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="264"><td class="num" id="LN264">264</td><td class="line"><span class='comment'>/* log collection size */</span></td></tr> +<tr class="codeline" data-linenumber="265"><td class="num" id="LN265">265</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"iter init count: %d"</span>, (<span class='keyword'>int</span>) g_variant_iter_init (&iter, managed_objects));</td></tr> +<tr class="codeline" data-linenumber="266"><td class="num" id="LN266">266</td><td class="line"><span class='directive'>#else</span></td></tr> +<tr class="codeline" data-linenumber="267"><td class="num" id="LN267">267</td><td class="line"> g_variant_iter_init (&iter, managed_objects);</td></tr> +<tr class="codeline" data-linenumber="268"><td class="num" id="LN268">268</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="269"><td class="num" id="LN269">269</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="270"><td class="num" id="LN270">270</td><td class="line"> <span class='comment'>/* "{sv}" is a GVariant format string</span></td></tr> +<tr class="codeline" data-linenumber="271"><td class="num" id="LN271">271</td><td class="line"> <span class='comment'>* {} dictionary of, s string, v GVariant</span></td></tr> +<tr class="codeline" data-linenumber="272"><td class="num" id="LN272">272</td><td class="line"> <span class='comment'>* changed to "{oa{sa{sv}}}" on error message 'the GVariant format string '{sv}' has a type of '{sv}' but the given value has a type of 'a{oa{sa{sv}}}''</span></td></tr> +<tr class="codeline" data-linenumber="273"><td class="num" id="LN273">273</td><td class="line"> <span class='comment'>* a is array, o is object path</span></td></tr> +<tr class="codeline" data-linenumber="274"><td class="num" id="LN274">274</td><td class="line"> <span class='comment'>* NOO!! the right format string is "{o@*}", which means get an object path into the 1st variable (key)</span></td></tr> +<tr class="codeline" data-linenumber="275"><td class="num" id="LN275">275</td><td class="line"> <span class='comment'>* and get 'everything else' (as a GVariant) into the 2nd variable (value)</span></td></tr> +<tr class="codeline" data-linenumber="276"><td class="num" id="LN276">276</td><td class="line"> <span class='comment'>* needs the & before the key and value params! */</span></td></tr> +<tr class="codeline" data-linenumber="277"><td class="num" id="LN277">277</td><td class="line"> <span class='keyword'>while</span> (g_variant_iter_next (&iter, <span class='string_literal'>"{o@*}"</span>, &key, &value)) {</td></tr> +<tr class="codeline" data-linenumber="278"><td class="num" id="LN278">278</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="279"><td class="num" id="LN279">279</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="280"><td class="num" id="LN280">280</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"in iter while loop"</span>);</td></tr> +<tr class="codeline" data-linenumber="281"><td class="num" id="LN281">281</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"key value: %s"</span>, key);</td></tr> +<tr class="codeline" data-linenumber="282"><td class="num" id="LN282">282</td><td class="line"><span class='comment'>//syslog(LOG_ERR, "value type: %s", g_variant_print(value, TRUE));</span></td></tr> +<tr class="codeline" data-linenumber="283"><td class="num" id="LN283">283</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="284"><td class="num" id="LN284">284</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="285"><td class="num" id="LN285">285</td><td class="line"> <span class='comment'>/* level 2</span></td></tr> +<tr class="codeline" data-linenumber="286"><td class="num" id="LN286">286</td><td class="line"> <span class='comment'>* create a dictionary of value</span></td></tr> +<tr class="codeline" data-linenumber="287"><td class="num" id="LN287">287</td><td class="line"> <span class='comment'>* the two interface names that we are searching for are known and defined</span></td></tr> +<tr class="codeline" data-linenumber="288"><td class="num" id="LN288">288</td><td class="line"> <span class='comment'>* can't use GVariantDict, it only supports '{sv}' but the given value has a type of '{sa{sv}}'</span></td></tr> +<tr class="codeline" data-linenumber="289"><td class="num" id="LN289">289</td><td class="line"> <span class='comment'>* using general lookup */</span></td></tr> +<tr class="codeline" data-linenumber="290"><td class="num" id="LN290">290</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="291"><td class="num" id="LN291">291</td><td class="line"> GVariant *propdict = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; <span class='comment'>/* drive data */</span></td></tr> +<tr class="codeline" data-linenumber="292"><td class="num" id="LN292">292</td><td class="line"> GVariant *propdict2 = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>; <span class='comment'>/* drive smart data */</span></td></tr> +<tr class="codeline" data-linenumber="293"><td class="num" id="LN293">293</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="294"><td class="num" id="LN294">294</td><td class="line"> <span class='comment'>/* make two dictionaries that contain the properties of the drive interfaces */</span></td></tr> +<tr class="codeline" data-linenumber="295"><td class="num" id="LN295">295</td><td class="line"> propdict = g_variant_lookup_value (value, <span class='macro'>UDISKS2_DEVICE_INTERFACE_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive"</span></span>, <span class='macro'>G_VARIANT_TYPE_DICTIONARY<span class='macro_popup'>((const GVariantType *) "a{?*}")</span></span>);</td></tr> +<tr class="codeline" data-linenumber="296"><td class="num" id="LN296">296</td><td class="line"> propdict2 = g_variant_lookup_value (value, <span class='macro'>UDISKS2_DEVICE_INTERFACE2_NAME<span class='macro_popup'>"org.freedesktop.UDisks2.Drive.Ata"</span></span>, <span class="mrange"><span class="mrange"><span class='macro'>G_VARIANT_TYPE_DICTIONARY<span class='macro_popup'>((const GVariantType *) "a{?*}")</span></span></span></span>);</td></tr> +<tr><td class="num"></td><td class="line"><div id="EndPath" class="msg msgEvent" style="margin-left:84ex; max-width:31em">Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption</div></td></tr> +<tr class="codeline" data-linenumber="297"><td class="num" id="LN297">297</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="298"><td class="num" id="LN298">298</td><td class="line"> <span class='comment'>/* do we have the right ifname keys? */</span></td></tr> +<tr class="codeline" data-linenumber="299"><td class="num" id="LN299">299</td><td class="line"> <span class='keyword'>if</span> ((<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict) && (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict2)) {</td></tr> +<tr class="codeline" data-linenumber="300"><td class="num" id="LN300">300</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="301"><td class="num" id="LN301">301</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="302"><td class="num" id="LN302">302</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"propdict type: %s"</span>, g_variant_print(propdict, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="303"><td class="num" id="LN303">303</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"propdict2 type: %s"</span>, g_variant_print(propdict2, <span class='macro'>TRUE<span class='macro_popup'>(!(0))</span></span>));</td></tr> +<tr class="codeline" data-linenumber="304"><td class="num" id="LN304">304</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="305"><td class="num" id="LN305">305</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="306"><td class="num" id="LN306">306</td><td class="line"> <span class='comment'>/* get data */</span></td></tr> +<tr class="codeline" data-linenumber="307"><td class="num" id="LN307">307</td><td class="line"> gchar *id = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="308"><td class="num" id="LN308">308</td><td class="line"> gchar *model = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="309"><td class="num" id="LN309">309</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="310"><td class="num" id="LN310">310</td><td class="line"> gboolean smartenabled;</td></tr> +<tr class="codeline" data-linenumber="311"><td class="num" id="LN311">311</td><td class="line"> gdouble temp;</td></tr> +<tr class="codeline" data-linenumber="312"><td class="num" id="LN312">312</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="313"><td class="num" id="LN313">313</td><td class="line"> <span class='comment'>/* NULL, bc we don't care about the length of the string</span></td></tr> +<tr class="codeline" data-linenumber="314"><td class="num" id="LN314">314</td><td class="line"> <span class='comment'>* typecast bc g_variant_get_string() returns const char* */</span></td></tr> +<tr class="codeline" data-linenumber="315"><td class="num" id="LN315">315</td><td class="line"> id = (gchar *) g_variant_get_string (g_variant_lookup_value (propdict, <span class='string_literal'>"Id"</span>, <span class='macro'>G_VARIANT_TYPE_STRING<span class='macro_popup'>((const GVariantType *) "s")</span></span>), <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="316"><td class="num" id="LN316">316</td><td class="line"> model = (gchar *) g_variant_get_string (g_variant_lookup_value (propdict, <span class='string_literal'>"Model"</span>, <span class='macro'>G_VARIANT_TYPE_STRING<span class='macro_popup'>((const GVariantType *) "s")</span></span>), <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>);</td></tr> +<tr class="codeline" data-linenumber="317"><td class="num" id="LN317">317</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="318"><td class="num" id="LN318">318</td><td class="line"> smartenabled = g_variant_get_boolean (g_variant_lookup_value (propdict2, <span class='string_literal'>"SmartEnabled"</span>, <span class='macro'>G_VARIANT_TYPE_BOOLEAN<span class='macro_popup'>((const GVariantType *) "b")</span></span>));</td></tr> +<tr class="codeline" data-linenumber="319"><td class="num" id="LN319">319</td><td class="line"> temp = g_variant_get_double (g_variant_lookup_value (propdict2, <span class='string_literal'>"SmartTemperature"</span>, <span class='macro'>G_VARIANT_TYPE_DOUBLE<span class='macro_popup'>((const GVariantType *) "d")</span></span>));</td></tr> +<tr class="codeline" data-linenumber="320"><td class="num" id="LN320">320</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="321"><td class="num" id="LN321">321</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="322"><td class="num" id="LN322">322</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device id: '%s'\n"</span>, id);</td></tr> +<tr class="codeline" data-linenumber="323"><td class="num" id="LN323">323</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device model: '%s'\n"</span>, model);</td></tr> +<tr class="codeline" data-linenumber="324"><td class="num" id="LN324">324</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device smartenabled: '%d'\n"</span>, smartenabled);</td></tr> +<tr class="codeline" data-linenumber="325"><td class="num" id="LN325">325</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Found udisks2 device temp: '%f'\n"</span>, temp);</td></tr> +<tr class="codeline" data-linenumber="326"><td class="num" id="LN326">326</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="327"><td class="num" id="LN327">327</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="328"><td class="num" id="LN328">328</td><td class="line"> <span class='comment'>/* only go on if smart is enabled</span></td></tr> +<tr class="codeline" data-linenumber="329"><td class="num" id="LN329">329</td><td class="line"> <span class='comment'>* save data */</span></td></tr> +<tr class="codeline" data-linenumber="330"><td class="num" id="LN330">330</td><td class="line"> <span class='keyword'>if</span> (smartenabled) {</td></tr> +<tr class="codeline" data-linenumber="331"><td class="num" id="LN331">331</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="332"><td class="num" id="LN332">332</td><td class="line"> info = <span class='macro'>g_new0 (DevInfo, 1)<span class='macro_popup'>(DevInfo *) (__extension__ ({ gsize __n = (gsize) (1); gsize __s<br> = sizeof (DevInfo); gpointer __p; if (__s == 1) __p = g_malloc0<br> (__n); else if (__builtin_constant_p (__n) && (__s ==<br> 0 || __n <= (9223372036854775807L *2UL+1UL) / __s)) __p =<br> g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s); __p<br>; }))</span></span>;</td></tr> +<tr class="codeline" data-linenumber="333"><td class="num" id="LN333">333</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == devices) {</td></tr> +<tr class="codeline" data-linenumber="334"><td class="num" id="LN334">334</td><td class="line"> devices = g_hash_table_new (g_str_hash, g_str_equal);</td></tr> +<tr class="codeline" data-linenumber="335"><td class="num" id="LN335">335</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="336"><td class="num" id="LN336">336</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="337"><td class="num" id="LN337">337</td><td class="line"> info->id = <span class='macro'>g_strdup (id)<span class='macro_popup'>g_strdup_inline (id)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="338"><td class="num" id="LN338">338</td><td class="line"> info->path = <span class='macro'>g_strdup (key)<span class='macro_popup'>g_strdup_inline (key)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="339"><td class="num" id="LN339">339</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="340"><td class="num" id="LN340">340</td><td class="line"> <span class='comment'>/* temp in K</span></td></tr> +<tr class="codeline" data-linenumber="341"><td class="num" id="LN341">341</td><td class="line"> <span class='comment'>* this could be left at 0.0, 2 seconds later it will be refreshed anyway */</span></td></tr> +<tr class="codeline" data-linenumber="342"><td class="num" id="LN342">342</td><td class="line"> info->temp = (gdouble) temp - 273.15;</td></tr> +<tr class="codeline" data-linenumber="343"><td class="num" id="LN343">343</td><td class="line"> g_hash_table_insert (devices, info->id, info);</td></tr> +<tr class="codeline" data-linenumber="344"><td class="num" id="LN344">344</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="345"><td class="num" id="LN345">345</td><td class="line"> <span class='comment'>/* Write the sensor data */</span></td></tr> +<tr class="codeline" data-linenumber="346"><td class="num" id="LN346">346</td><td class="line"> sensors_applet_plugin_add_sensor (sensors,</td></tr> +<tr class="codeline" data-linenumber="347"><td class="num" id="LN347">347</td><td class="line"> id,</td></tr> +<tr class="codeline" data-linenumber="348"><td class="num" id="LN348">348</td><td class="line"> <span class='string_literal'>"Disk Temperature"</span>,</td></tr> +<tr class="codeline" data-linenumber="349"><td class="num" id="LN349">349</td><td class="line"> model,</td></tr> +<tr class="codeline" data-linenumber="350"><td class="num" id="LN350">350</td><td class="line"> TEMP_SENSOR,</td></tr> +<tr class="codeline" data-linenumber="351"><td class="num" id="LN351">351</td><td class="line"> <span class='macro'>FALSE<span class='macro_popup'>(0)</span></span>,</td></tr> +<tr class="codeline" data-linenumber="352"><td class="num" id="LN352">352</td><td class="line"> HDD_ICON,</td></tr> +<tr class="codeline" data-linenumber="353"><td class="num" id="LN353">353</td><td class="line"> <span class='macro'>DEFAULT_GRAPH_COLOR<span class='macro_popup'>"#ff0000"</span></span>);</td></tr> +<tr class="codeline" data-linenumber="354"><td class="num" id="LN354">354</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="355"><td class="num" id="LN355">355</td><td class="line"> g_debug (<span class='string_literal'>"Added %s"</span>, id);</td></tr> +<tr class="codeline" data-linenumber="356"><td class="num" id="LN356">356</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="357"><td class="num" id="LN357">357</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="358"><td class="num" id="LN358">358</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"Added %s"</span>, id);</td></tr> +<tr class="codeline" data-linenumber="359"><td class="num" id="LN359">359</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="360"><td class="num" id="LN360">360</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="361"><td class="num" id="LN361">361</td><td class="line"> } <span class='keyword'>else</span> {</td></tr> +<tr class="codeline" data-linenumber="362"><td class="num" id="LN362">362</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="363"><td class="num" id="LN363">363</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="364"><td class="num" id="LN364">364</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"No temp data for device: %s\n"</span>, key);</td></tr> +<tr class="codeline" data-linenumber="365"><td class="num" id="LN365">365</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="366"><td class="num" id="LN366">366</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="367"><td class="num" id="LN367">367</td><td class="line"> g_debug (<span class='string_literal'>"No temp data for device: %s\n"</span>, key);</td></tr> +<tr class="codeline" data-linenumber="368"><td class="num" id="LN368">368</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="369"><td class="num" id="LN369">369</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="370"><td class="num" id="LN370">370</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="371"><td class="num" id="LN371">371</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"b4 free1"</span>);</td></tr> +<tr class="codeline" data-linenumber="372"><td class="num" id="LN372">372</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="373"><td class="num" id="LN373">373</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="374"><td class="num" id="LN374">374</td><td class="line"> g_free (id);</td></tr> +<tr class="codeline" data-linenumber="375"><td class="num" id="LN375">375</td><td class="line"> g_free (model);</td></tr> +<tr class="codeline" data-linenumber="376"><td class="num" id="LN376">376</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="377"><td class="num" id="LN377">377</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="378"><td class="num" id="LN378">378</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="379"><td class="num" id="LN379">379</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="380"><td class="num" id="LN380">380</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"b4 free2"</span>);</td></tr> +<tr class="codeline" data-linenumber="381"><td class="num" id="LN381">381</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="382"><td class="num" id="LN382">382</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="383"><td class="num" id="LN383">383</td><td class="line"> <span class='comment'>/* free propdict, propdict2</span></td></tr> +<tr class="codeline" data-linenumber="384"><td class="num" id="LN384">384</td><td class="line"> <span class='comment'>* g_variant_dict_unref() may not work a few times, gives error</span></td></tr> +<tr class="codeline" data-linenumber="385"><td class="num" id="LN385">385</td><td class="line"> <span class='comment'>* this one seems to do fine */</span></td></tr> +<tr class="codeline" data-linenumber="386"><td class="num" id="LN386">386</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict) {g_variant_unref (propdict);}</td></tr> +<tr class="codeline" data-linenumber="387"><td class="num" id="LN387">387</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> != propdict2) {g_variant_unref (propdict2);}</td></tr> +<tr class="codeline" data-linenumber="388"><td class="num" id="LN388">388</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="389"><td class="num" id="LN389">389</td><td class="line"><span class='directive'>#ifdef UD2PD</span></td></tr> +<tr class="codeline" data-linenumber="390"><td class="num" id="LN390">390</td><td class="line">syslog(LOG_ERR, <span class='string_literal'>"b4 free3"</span>);</td></tr> +<tr class="codeline" data-linenumber="391"><td class="num" id="LN391">391</td><td class="line"><span class='directive'>#endif</span></td></tr> +<tr class="codeline" data-linenumber="392"><td class="num" id="LN392">392</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="393"><td class="num" id="LN393">393</td><td class="line"> g_free (key);</td></tr> +<tr class="codeline" data-linenumber="394"><td class="num" id="LN394">394</td><td class="line"> g_variant_unref (value);</td></tr> +<tr class="codeline" data-linenumber="395"><td class="num" id="LN395">395</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="396"><td class="num" id="LN396">396</td><td class="line"> } <span class='comment'>/* end of while loop */</span></td></tr> +<tr class="codeline" data-linenumber="397"><td class="num" id="LN397">397</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="398"><td class="num" id="LN398">398</td><td class="line"> g_variant_unref (managed_objects);</td></tr> +<tr class="codeline" data-linenumber="399"><td class="num" id="LN399">399</td><td class="line"> <span class='macro'>g_clear_object (&proxy)<span class='macro_popup'>do { _Static_assert (sizeof *((&proxy)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&proxy<br>))) _pp = ((&proxy)); __typeof__ (*((&proxy))) _ptr =<br> *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref) (_ptr); }<br> while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="400"><td class="num" id="LN400">400</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == devices) {</td></tr> +<tr class="codeline" data-linenumber="401"><td class="num" id="LN401">401</td><td class="line"> <span class='macro'>g_clear_object (&connection)<span class='macro_popup'>do { _Static_assert (sizeof *((&connection)) == sizeof (gpointer<br>), "Expression evaluates to false"); __typeof__ (((&connection<br>))) _pp = ((&connection)); __typeof__ (*((&connection<br>))) _ptr = *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref<br>) (_ptr); } while (0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="402"><td class="num" id="LN402">402</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="403"><td class="num" id="LN403">403</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="404"><td class="num" id="LN404">404</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="405"><td class="num" id="LN405">405</td><td class="line"><span class='comment'>/* this function is called every refresh cycle */</span></td></tr> +<tr class="codeline" data-linenumber="406"><td class="num" id="LN406">406</td><td class="line"><span class='keyword'>static</span> gdouble udisks2_plugin_get_sensor_value (<span class='keyword'>const</span> gchar *path,</td></tr> +<tr class="codeline" data-linenumber="407"><td class="num" id="LN407">407</td><td class="line"> <span class='keyword'>const</span> gchar *id,</td></tr> +<tr class="codeline" data-linenumber="408"><td class="num" id="LN408">408</td><td class="line"> SensorType type,</td></tr> +<tr class="codeline" data-linenumber="409"><td class="num" id="LN409">409</td><td class="line"> GError **error) {</td></tr> +<tr class="codeline" data-linenumber="410"><td class="num" id="LN410">410</td><td class="line"> DevInfo *info = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="411"><td class="num" id="LN411">411</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="412"><td class="num" id="LN412">412</td><td class="line"> <span class='comment'>/* get device stuct from data store */</span></td></tr> +<tr class="codeline" data-linenumber="413"><td class="num" id="LN413">413</td><td class="line"> info = (DevInfo *) g_hash_table_lookup (devices, path);</td></tr> +<tr class="codeline" data-linenumber="414"><td class="num" id="LN414">414</td><td class="line"> <span class='keyword'>if</span> (<span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span> == info) {</td></tr> +<tr class="codeline" data-linenumber="415"><td class="num" id="LN415">415</td><td class="line"> g_set_error (error, <span class='macro'>SENSORS_APPLET_PLUGIN_ERROR<span class='macro_popup'>(sensors_applet_plugin_error_quark())</span></span>, 0, <span class='string_literal'>"Error finding disk with path %s"</span>, path);</td></tr> +<tr class="codeline" data-linenumber="416"><td class="num" id="LN416">416</td><td class="line"> <span class='keyword'>return</span> 0.0;</td></tr> +<tr class="codeline" data-linenumber="417"><td class="num" id="LN417">417</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="418"><td class="num" id="LN418">418</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="419"><td class="num" id="LN419">419</td><td class="line"> <span class='keyword'>if</span> (info->error) {</td></tr> +<tr class="codeline" data-linenumber="420"><td class="num" id="LN420">420</td><td class="line"> *error = info->error;</td></tr> +<tr class="codeline" data-linenumber="421"><td class="num" id="LN421">421</td><td class="line"> info->error = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="422"><td class="num" id="LN422">422</td><td class="line"> <span class='keyword'>return</span> 0.0;</td></tr> +<tr class="codeline" data-linenumber="423"><td class="num" id="LN423">423</td><td class="line"> }</td></tr> +<tr class="codeline" data-linenumber="424"><td class="num" id="LN424">424</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="425"><td class="num" id="LN425">425</td><td class="line"> <span class='comment'>/* refresh device temp */</span></td></tr> +<tr class="codeline" data-linenumber="426"><td class="num" id="LN426">426</td><td class="line"> update_device (info);</td></tr> +<tr class="codeline" data-linenumber="427"><td class="num" id="LN427">427</td><td class="line"> <span class='keyword'>return</span> info->temp;</td></tr> +<tr class="codeline" data-linenumber="428"><td class="num" id="LN428">428</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="429"><td class="num" id="LN429">429</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="430"><td class="num" id="LN430">430</td><td class="line"><span class='comment'>/* API functions */</span></td></tr> +<tr class="codeline" data-linenumber="431"><td class="num" id="LN431">431</td><td class="line"><span class='keyword'>const</span> gchar *sensors_applet_plugin_name (<span class='keyword'>void</span>) {</td></tr> +<tr class="codeline" data-linenumber="432"><td class="num" id="LN432">432</td><td class="line"> <span class='keyword'>return</span> plugin_name;</td></tr> +<tr class="codeline" data-linenumber="433"><td class="num" id="LN433">433</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="434"><td class="num" id="LN434">434</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="435"><td class="num" id="LN435">435</td><td class="line"><span class='keyword'>static</span> GList *udisks2_plugin_init (<span class='keyword'>void</span>) {</td></tr> +<tr class="codeline" data-linenumber="436"><td class="num" id="LN436">436</td><td class="line"> GList *sensors = <span class='macro'>NULL<span class='macro_popup'>((void*)0)</span></span>;</td></tr> +<tr class="codeline" data-linenumber="437"><td class="num" id="LN437">437</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="438"><td class="num" id="LN438">438</td><td class="line"> udisks2_plugin_get_sensors (&sensors);</td></tr> +<tr class="codeline" data-linenumber="439"><td class="num" id="LN439">439</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="440"><td class="num" id="LN440">440</td><td class="line"> <span class='keyword'>return</span> sensors;</td></tr> +<tr class="codeline" data-linenumber="441"><td class="num" id="LN441">441</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="442"><td class="num" id="LN442">442</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="443"><td class="num" id="LN443">443</td><td class="line">GList *sensors_applet_plugin_init (<span class='keyword'>void</span>) {</td></tr> +<tr class="codeline" data-linenumber="444"><td class="num" id="LN444">444</td><td class="line"> <span class='keyword'>return</span> udisks2_plugin_init ();</td></tr> +<tr class="codeline" data-linenumber="445"><td class="num" id="LN445">445</td><td class="line">}</td></tr> +<tr class="codeline" data-linenumber="446"><td class="num" id="LN446">446</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="447"><td class="num" id="LN447">447</td><td class="line">gdouble sensors_applet_plugin_get_sensor_value (<span class='keyword'>const</span> gchar *path,</td></tr> +<tr class="codeline" data-linenumber="448"><td class="num" id="LN448">448</td><td class="line"> <span class='keyword'>const</span> gchar *id,</td></tr> +<tr class="codeline" data-linenumber="449"><td class="num" id="LN449">449</td><td class="line"> SensorType type,</td></tr> +<tr class="codeline" data-linenumber="450"><td class="num" id="LN450">450</td><td class="line"> GError **error) {</td></tr> +<tr class="codeline" data-linenumber="451"><td class="num" id="LN451">451</td><td class="line"> </td></tr> +<tr class="codeline" data-linenumber="452"><td class="num" id="LN452">452</td><td class="line"> <span class='keyword'>return</span> udisks2_plugin_get_sensor_value (path, id, type, error);</td></tr> +<tr class="codeline" data-linenumber="453"><td class="num" id="LN453">453</td><td class="line">}</td></tr> +</table></body></html> diff --git a/2023-06-12-021133-6157-1@0aec03c16de2_in-process/scanview.css b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/scanview.css @@ -0,0 +1,62 @@ +body { color:#000000; background-color:#ffffff } +body { font-family: Helvetica, sans-serif; font-size:9pt } +h1 { font-size: 14pt; } +h2 { font-size: 12pt; } +table { font-size:9pt } +table { border-spacing: 0px; border: 1px solid black } +th, table thead { + background-color:#eee; color:#666666; + font-weight: bold; cursor: default; + text-align:center; + font-weight: bold; font-family: Verdana; + white-space:nowrap; +} +.W { font-size:0px } +th, td { padding:5px; padding-left:8px; text-align:left } +td.SUMM_DESC { padding-left:12px } +td.DESC { white-space:pre } +td.Q { text-align:right } +td { text-align:left } +tbody.scrollContent { overflow:auto } + +table.form_group { + background-color: #ccc; + border: 1px solid #333; + padding: 2px; +} + +table.form_inner_group { + background-color: #ccc; + border: 1px solid #333; + padding: 0px; +} + +table.form { + background-color: #999; + border: 1px solid #333; + padding: 2px; +} + +td.form_label { + text-align: right; + vertical-align: top; +} +/* For one line entires */ +td.form_clabel { + text-align: right; + vertical-align: center; +} +td.form_value { + text-align: left; + vertical-align: top; +} +td.form_submit { + text-align: right; + vertical-align: top; +} + +h1.SubmitFail { + color: #f00; +} +h1.SubmitOk { +} diff --git a/2023-06-12-021133-6157-1@0aec03c16de2_in-process/sorttable.js b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2023-06-12-021133-6157-1@0aec03c16de2_in-process/sorttable.js @@ -0,0 +1,492 @@ +/* + SortTable + version 2 + 7th April 2007 + Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/ + + Instructions: + Download this file + Add <script src="sorttable.js"></script> to your HTML + Add class="sortable" to any table you'd like to make sortable + Click on the headers to sort + + Thanks to many, many people for contributions and suggestions. + Licenced as X11: http://www.kryogenix.org/code/browser/licence.html + This basically means: do what you want with it. +*/ + + +var stIsIE = /*@cc_on!@*/false; + +sorttable = { + init: function() { + // quit if this function has already been called + if (arguments.callee.done) return; + // flag this function so we don't do the same thing twice + arguments.callee.done = true; + // kill the timer + if (_timer) clearInterval(_timer); + + if (!document.createElement || !document.getElementsByTagName) return; + + sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; + + forEach(document.getElementsByTagName('table'), function(table) { + if (table.className.search(/\bsortable\b/) != -1) { + sorttable.makeSortable(table); + } + }); + + }, + + makeSortable: function(table) { + if (table.getElementsByTagName('thead').length == 0) { + // table doesn't have a tHead. Since it should have, create one and + // put the first table row in it. + the = document.createElement('thead'); + the.appendChild(table.rows[0]); + table.insertBefore(the,table.firstChild); + } + // Safari doesn't support table.tHead, sigh + if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; + + if (table.tHead.rows.length != 1) return; // can't cope with two header rows + + // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as + // "total" rows, for example). This is B&R, since what you're supposed + // to do is put them in a tfoot. So, if there are sortbottom rows, + // for backward compatibility, move them to tfoot (creating it if needed). + sortbottomrows = []; + for (var i=0; i<table.rows.length; i++) { + if (table.rows[i].className.search(/\bsortbottom\b/) != -1) { + sortbottomrows[sortbottomrows.length] = table.rows[i]; + } + } + if (sortbottomrows) { + if (table.tFoot == null) { + // table doesn't have a tfoot. Create one. + tfo = document.createElement('tfoot'); + table.appendChild(tfo); + } + for (var i=0; i<sortbottomrows.length; i++) { + tfo.appendChild(sortbottomrows[i]); + } + delete sortbottomrows; + } + + // work through each column and calculate its type + headrow = table.tHead.rows[0].cells; + for (var i=0; i<headrow.length; i++) { + // manually override the type with a sorttable_type attribute + if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip this col + mtch = headrow[i].className.match(/\bsorttable_([a-z0-9]+)\b/); + if (mtch) { override = mtch[1]; } + if (mtch && typeof sorttable["sort_"+override] == 'function') { + headrow[i].sorttable_sortfunction = sorttable["sort_"+override]; + } else { + headrow[i].sorttable_sortfunction = sorttable.guessType(table,i); + } + // make it clickable to sort + headrow[i].sorttable_columnindex = i; + headrow[i].sorttable_tbody = table.tBodies[0]; + dean_addEvent(headrow[i],"click", function(e) { + + if (this.className.search(/\bsorttable_sorted\b/) != -1) { + // if we're already sorted by this column, just + // reverse the table, which is quicker + sorttable.reverse(this.sorttable_tbody); + this.className = this.className.replace('sorttable_sorted', + 'sorttable_sorted_reverse'); + this.removeChild(document.getElementById('sorttable_sortfwdind')); + sortrevind = document.createElement('span'); + sortrevind.id = "sorttable_sortrevind"; + sortrevind.innerHTML = stIsIE ? ' <font face="webdings">5</font>' : ' ▴'; + this.appendChild(sortrevind); + return; + } + if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) { + // if we're already sorted by this column in reverse, just + // re-reverse the table, which is quicker + sorttable.reverse(this.sorttable_tbody); + this.className = this.className.replace('sorttable_sorted_reverse', + 'sorttable_sorted'); + this.removeChild(document.getElementById('sorttable_sortrevind')); + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' <font face="webdings">6</font>' : ' ▾'; + this.appendChild(sortfwdind); + return; + } + + // remove sorttable_sorted classes + theadrow = this.parentNode; + forEach(theadrow.childNodes, function(cell) { + if (cell.nodeType == 1) { // an element + cell.className = cell.className.replace('sorttable_sorted_reverse',''); + cell.className = cell.className.replace('sorttable_sorted',''); + } + }); + sortfwdind = document.getElementById('sorttable_sortfwdind'); + if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); } + sortrevind = document.getElementById('sorttable_sortrevind'); + if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); } + + this.className += ' sorttable_sorted'; + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' <font face="webdings">6</font>' : ' ▾'; + this.appendChild(sortfwdind); + + // build an array to sort. This is a Schwartzian transform thing, + // i.e., we "decorate" each row with the actual sort key, + // sort based on the sort keys, and then put the rows back in order + // which is a lot faster because you only do getInnerText once per row + row_array = []; + col = this.sorttable_columnindex; + rows = this.sorttable_tbody.rows; + for (var j=0; j<rows.length; j++) { + row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]]; + } + /* If you want a stable sort, uncomment the following line */ + sorttable.shaker_sort(row_array, this.sorttable_sortfunction); + /* and comment out this one */ + //row_array.sort(this.sorttable_sortfunction); + + tb = this.sorttable_tbody; + for (var j=0; j<row_array.length; j++) { + tb.appendChild(row_array[j][1]); + } + + delete row_array; + }); + } + } + }, + + guessType: function(table, column) { + // guess the type of a column based on its first non-blank row + sortfn = sorttable.sort_alpha; + for (var i=0; i<table.tBodies[0].rows.length; i++) { + text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]); + if (text != '') { + if (text.match(/^-?[�$�]?[\d,.]+%?$/)) { + return sorttable.sort_numeric; + } + // check for a date: dd/mm/yyyy or dd/mm/yy + // can have / or . or - as separator + // can be mm/dd as well + possdate = text.match(sorttable.DATE_RE) + if (possdate) { + // looks like a date + first = parseInt(possdate[1]); + second = parseInt(possdate[2]); + if (first > 12) { + // definitely dd/mm + return sorttable.sort_ddmm; + } else if (second > 12) { + return sorttable.sort_mmdd; + } else { + // looks like a date, but we can't tell which, so assume + // that it's dd/mm (English imperialism!) and keep looking + sortfn = sorttable.sort_ddmm; + } + } + } + } + return sortfn; + }, + + getInnerText: function(node) { + // gets the text we want to use for sorting for a cell. + // strips leading and trailing whitespace. + // this is *not* a generic getInnerText function; it's special to sorttable. + // for example, you can override the cell text with a customkey attribute. + // it also gets .value for <input> fields. + + hasInputs = (typeof node.getElementsByTagName == 'function') && + node.getElementsByTagName('input').length; + + if (node.getAttribute("sorttable_customkey") != null) { + return node.getAttribute("sorttable_customkey"); + } + else if (typeof node.textContent != 'undefined' && !hasInputs) { + return node.textContent.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.innerText != 'undefined' && !hasInputs) { + return node.innerText.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.text != 'undefined' && !hasInputs) { + return node.text.replace(/^\s+|\s+$/g, ''); + } + else { + switch (node.nodeType) { + case 3: + if (node.nodeName.toLowerCase() == 'input') { + return node.value.replace(/^\s+|\s+$/g, ''); + } + case 4: + return node.nodeValue.replace(/^\s+|\s+$/g, ''); + break; + case 1: + case 11: + var innerText = ''; + for (var i = 0; i < node.childNodes.length; i++) { + innerText += sorttable.getInnerText(node.childNodes[i]); + } + return innerText.replace(/^\s+|\s+$/g, ''); + break; + default: + return ''; + } + } + }, + + reverse: function(tbody) { + // reverse the rows in a tbody + newrows = []; + for (var i=0; i<tbody.rows.length; i++) { + newrows[newrows.length] = tbody.rows[i]; + } + for (var i=newrows.length-1; i>=0; i--) { + tbody.appendChild(newrows[i]); + } + delete newrows; + }, + + /* sort functions + each sort function takes two parameters, a and b + you are comparing a[0] and b[0] */ + sort_numeric: function(a,b) { + aa = parseFloat(a[0].replace(/[^0-9.-]/g,'')); + if (isNaN(aa)) aa = 0; + bb = parseFloat(b[0].replace(/[^0-9.-]/g,'')); + if (isNaN(bb)) bb = 0; + return aa-bb; + }, + sort_alpha: function(a,b) { + if (a[0]==b[0]) return 0; + if (a[0]<b[0]) return -1; + return 1; + }, + sort_ddmm: function(a,b) { + mtch = a[0].match(sorttable.DATE_RE); + y = mtch[3]; m = mtch[2]; d = mtch[1]; + if (m.length == 1) m = '0'+m; + if (d.length == 1) d = '0'+d; + dt1 = y+m+d; + mtch = b[0].match(sorttable.DATE_RE); + y = mtch[3]; m = mtch[2]; d = mtch[1]; + if (m.length == 1) m = '0'+m; + if (d.length == 1) d = '0'+d; + dt2 = y+m+d; + if (dt1==dt2) return 0; + if (dt1<dt2) return -1; + return 1; + }, + sort_mmdd: function(a,b) { + mtch = a[0].match(sorttable.DATE_RE); + y = mtch[3]; d = mtch[2]; m = mtch[1]; + if (m.length == 1) m = '0'+m; + if (d.length == 1) d = '0'+d; + dt1 = y+m+d; + mtch = b[0].match(sorttable.DATE_RE); + y = mtch[3]; d = mtch[2]; m = mtch[1]; + if (m.length == 1) m = '0'+m; + if (d.length == 1) d = '0'+d; + dt2 = y+m+d; + if (dt1==dt2) return 0; + if (dt1<dt2) return -1; + return 1; + }, + + shaker_sort: function(list, comp_func) { + // A stable sort function to allow multi-level sorting of data + // see: http://en.wikipedia.org/wiki/Cocktail_sort + // thanks to Joseph Nahmias + var b = 0; + var t = list.length - 1; + var swap = true; + + while(swap) { + swap = false; + for(var i = b; i < t; ++i) { + if ( comp_func(list[i], list[i+1]) > 0 ) { + var q = list[i]; list[i] = list[i+1]; list[i+1] = q; + swap = true; + } + } // for + t--; + + if (!swap) break; + + for(var i = t; i > b; --i) { + if ( comp_func(list[i], list[i-1]) < 0 ) { + var q = list[i]; list[i] = list[i-1]; list[i-1] = q; + swap = true; + } + } // for + b++; + + } // while(swap) + } +} + +/* ****************************************************************** + Supporting functions: bundled here to avoid depending on a library + ****************************************************************** */ + +// Dean Edwards/Matthias Miller/John Resig + +/* for Mozilla/Opera9 */ +if (document.addEventListener) { + document.addEventListener("DOMContentLoaded", sorttable.init, false); +} + +/* for Internet Explorer */ +/*@cc_on @*/ +/*@if (@_win32) + document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>"); + var script = document.getElementById("__ie_onload"); + script.onreadystatechange = function() { + if (this.readyState == "complete") { + sorttable.init(); // call the onload handler + } + }; +/*@end @*/ + +/* for Safari */ +if (/WebKit/i.test(navigator.userAgent)) { // sniff + var _timer = setInterval(function() { + if (/loaded|complete/.test(document.readyState)) { + sorttable.init(); // call the onload handler + } + }, 10); +} + +/* for other browsers */ +window.onload = sorttable.init; + +// written by Dean Edwards, 2005 +// with input from Tino Zijdel, Matthias Miller, Diego Perini + +// http://dean.edwards.name/weblog/2005/10/add-event/ + +function dean_addEvent(element, type, handler) { + if (element.addEventListener) { + element.addEventListener(type, handler, false); + } else { + // assign each event handler a unique ID + if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++; + // create a hash table of event types for the element + if (!element.events) element.events = {}; + // create a hash table of event handlers for each element/event pair + var handlers = element.events[type]; + if (!handlers) { + handlers = element.events[type] = {}; + // store the existing event handler (if there is one) + if (element["on" + type]) { + handlers[0] = element["on" + type]; + } + } + // store the event handler in the hash table + handlers[handler.$$guid] = handler; + // assign a global event handler to do all the work + element["on" + type] = handleEvent; + } +}; +// a counter used to create unique IDs +dean_addEvent.guid = 1; + +function removeEvent(element, type, handler) { + if (element.removeEventListener) { + element.removeEventListener(type, handler, false); + } else { + // delete the event handler from the hash table + if (element.events && element.events[type]) { + delete element.events[type][handler.$$guid]; + } + } +}; + +function handleEvent(event) { + var returnValue = true; + // grab the event object (IE uses a global event object) + event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event); + // get a reference to the hash table of event handlers + var handlers = this.events[event.type]; + // execute each event handler + for (var i in handlers) { + this.$$handleEvent = handlers[i]; + if (this.$$handleEvent(event) === false) { + returnValue = false; + } + } + return returnValue; +}; + +function fixEvent(event) { + // add W3C standard event methods + event.preventDefault = fixEvent.preventDefault; + event.stopPropagation = fixEvent.stopPropagation; + return event; +}; +fixEvent.preventDefault = function() { + this.returnValue = false; +}; +fixEvent.stopPropagation = function() { + this.cancelBubble = true; +} + +// Dean's forEach: http://dean.edwards.name/base/forEach.js +/* + forEach, version 1.0 + Copyright 2006, Dean Edwards + License: http://www.opensource.org/licenses/mit-license.php +*/ + +// array-like enumeration +if (!Array.forEach) { // mozilla already supports this + Array.forEach = function(array, block, context) { + for (var i = 0; i < array.length; i++) { + block.call(context, array[i], i, array); + } + }; +} + +// generic enumeration +Function.prototype.forEach = function(object, block, context) { + for (var key in object) { + if (typeof this.prototype[key] == "undefined") { + block.call(context, object[key], key, object); + } + } +}; + +// character enumeration +String.forEach = function(string, block, context) { + Array.forEach(string.split(""), function(chr, index) { + block.call(context, chr, index, string); + }); +}; + +// globally resolve forEach enumeration +var forEach = function(object, block, context) { + if (object) { + var resolve = Object; // default + if (object instanceof Function) { + // functions have a "length" property + resolve = Function; + } else if (object.forEach instanceof Function) { + // the object implements a custom forEach method so use that + object.forEach(block, context); + return; + } else if (typeof object == "string") { + // the object is a string + resolve = String; + } else if (typeof object.length == "number") { + // the object is array-like + resolve = Array; + } + resolve.forEach(object, block, context); + } +}; |