diff options
author | Ali Abdallah <ali.slackware@gmail.com> | 2009-06-27 09:18:09 +0000 |
---|---|---|
committer | Ali Abdallah <ali.slackware@gmail.com> | 2009-06-27 09:18:09 +0000 |
commit | 52173d145eaa86f3fe581509d61d93e2b2bfaf7e (patch) | |
tree | ac3af1ce81a1e67f55fd2492d6a2139ba64e15a7 | |
parent | 8b51054ab1594e9d40c27b7c304e7d3fef5027cb (diff) | |
download | ixfce4-power-manager-52173d145eaa86f3fe581509d61d93e2b2bfaf7e.tar.gz |
* Use "/xfce4-power-manager" as a prefix for properties name to avoid
incompatibile installation with old versions.
* src/xfpm-brightness-widget.c: get rid of a GTimer and use the id of
the timeout function+Make the color of the popup better.
(Old svn revision: 7630)
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | data/icons/scalable/status/xfpm-brightness-lcd.svg | 63 | ||||
-rw-r--r-- | settings/xfpm-settings.c | 98 | ||||
-rw-r--r-- | src/xfpm-brightness-widget.c | 45 | ||||
-rw-r--r-- | src/xfpm-config.h | 6 | ||||
-rw-r--r-- | src/xfpm-xfconf.c | 5 |
6 files changed, 131 insertions, 92 deletions
@@ -1,3 +1,9 @@ +2009-06-27: 11:15 Ali aliov@xfce.org + * Use "/xfce4-power-manager" as a prefix for properties name to avoid + incompatibile installation with old versions. + * src/xfpm-brightness-widget.c: get rid of a GTimer and use the id of + the timeout function+Make the color of the popup better. + 2009-06-26: 12:00 Ali aliov@xfce.org * Change the style of the brightness popup indicator. diff --git a/data/icons/scalable/status/xfpm-brightness-lcd.svg b/data/icons/scalable/status/xfpm-brightness-lcd.svg index e54b787f..4bf7bbf7 100644 --- a/data/icons/scalable/status/xfpm-brightness-lcd.svg +++ b/data/icons/scalable/status/xfpm-brightness-lcd.svg @@ -1,15 +1,61 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- Created with Inkscape (http://www.inkscape.org/) --> <svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.0" width="48" height="48" - id="svg11300"> + id="svg11300" + sodipodi:version="0.32" + inkscape:version="0.46" + sodipodi:docname="xfpm-brightness-lcd.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape"> + <metadata + id="metadata21"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <sodipodi:namedview + inkscape:window-height="721" + inkscape:window-width="1280" + inkscape:pageshadow="2" + inkscape:pageopacity="0.0" + guidetolerance="10.0" + gridtolerance="10.0" + objecttolerance="10.0" + borderopacity="1.0" + bordercolor="#666666" + pagecolor="#ffffff" + id="base" + showgrid="false" + inkscape:zoom="10.791667" + inkscape:cx="24" + inkscape:cy="24" + inkscape:window-x="0" + inkscape:window-y="25" + inkscape:current-layer="svg11300" /> <defs id="defs3"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 24 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="48 : 24 : 1" + inkscape:persp3d-origin="24 : 16 : 1" + id="perspective23" /> <linearGradient id="linearGradient5170"> <stop @@ -73,19 +119,20 @@ gradientTransform="matrix(1,0,0,0.352941,0,26.36765)" /> </defs> <g - id="layer1"> + id="layer1" + transform="translate(-1.1660231,-0.6486486)"> <path - d="M 43.375 40.75 A 18.0625 6.375 0 1 1 7.25,40.75 A 18.0625 6.375 0 1 1 43.375 40.75 z" + d="M 43.375,40.75 C 43.375,44.270815 35.288143,47.125 25.3125,47.125 C 15.336857,47.125 7.25,44.270815 7.25,40.75 C 7.25,37.229185 15.336857,34.375 25.3125,34.375 C 35.288143,34.375 43.375,37.229185 43.375,40.75 z" transform="matrix(1.138408,0,0,1.138408,-3.50346,-7.640138)" - style="opacity:0.23595503;color:#000000;fill:url(#radialGradient5176);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" + style="opacity:0.23595503;fill:url(#radialGradient5176);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" id="path5168" /> <path - d="M 23.5625,5.53125 L 23.5625,10.65625 C 20.993604,11.013501 18.646191,12.073753 16.71875,13.625 L 13,9.90625 C 11.095031,8.0012812 9.0459565,10.139706 10.90625,12 L 14.625,15.71875 C 13.067023,17.637172 12.020502,19.969868 11.65625,22.53125 L 6.53125,22.53125 C 3.7855147,22.53125 4.0547984,25.5 6.53125,25.5 L 11.5625,25.5 C 11.755706,28.205867 12.703674,30.683551 14.21875,32.75 L 10.90625,36.0625 C 9.09375,37.875 11.318297,39.837953 13,38.15625 L 16.1875,34.96875 C 18.204948,36.76564 20.755546,37.956654 23.5625,38.34375 L 23.5625,42.53125 C 23.5625,45.184373 26.53125,45.188786 26.53125,42.53125 L 26.53125,38.46875 C 29.46022,38.255502 32.127787,37.117213 34.28125,35.375 L 37.0625,38.15625 C 38.565102,39.835629 40.924017,37.741879 39.15625,36.0625 L 36.375,33.28125 C 38.125006,31.116256 39.228658,28.44297 39.4375,25.5 L 43.53125,25.5 C 45.566103,25.5 45.836136,22.53125 43.53125,22.53125 L 39.34375,22.53125 C 38.952144,19.73621 37.759213,17.197731 35.96875,15.1875 L 39.15625,12 C 40.74724,10.232233 38.65349,8.4036481 37.0625,9.90625 L 33.75,13.21875 C 31.691357,11.709397 29.225223,10.760857 26.53125,10.5625 L 26.53125,5.53125 C 26.53125,3.1431283 23.5625,3.3215413 23.5625,5.53125 z " - style="opacity:1;color:#000000;fill:url(#radialGradient5166);fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:1.01015258;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" + d="M 23.5625,5.53125 L 23.5625,10.65625 C 20.993604,11.013501 18.646191,12.073753 16.71875,13.625 L 13,9.90625 C 11.095031,8.0012812 9.0459565,10.139706 10.90625,12 L 14.625,15.71875 C 13.067023,17.637172 12.020502,19.969868 11.65625,22.53125 L 6.53125,22.53125 C 3.7855147,22.53125 4.0547984,25.5 6.53125,25.5 L 11.5625,25.5 C 11.755706,28.205867 12.703674,30.683551 14.21875,32.75 L 10.90625,36.0625 C 9.09375,37.875 11.318297,39.837953 13,38.15625 L 16.1875,34.96875 C 18.204948,36.76564 20.755546,37.956654 23.5625,38.34375 L 23.5625,42.53125 C 23.5625,45.184373 26.53125,45.188786 26.53125,42.53125 L 26.53125,38.46875 C 29.46022,38.255502 32.127787,37.117213 34.28125,35.375 L 37.0625,38.15625 C 38.565102,39.835629 40.924017,37.741879 39.15625,36.0625 L 36.375,33.28125 C 38.125006,31.116256 39.228658,28.44297 39.4375,25.5 L 43.53125,25.5 C 45.566103,25.5 45.836136,22.53125 43.53125,22.53125 L 39.34375,22.53125 C 38.952144,19.73621 37.759213,17.197731 35.96875,15.1875 L 39.15625,12 C 40.74724,10.232233 38.65349,8.4036481 37.0625,9.90625 L 33.75,13.21875 C 31.691357,11.709397 29.225223,10.760857 26.53125,10.5625 L 26.53125,5.53125 C 26.53125,3.1431283 23.5625,3.3215413 23.5625,5.53125 z" + style="opacity:1;fill:url(#radialGradient5166);fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:1.01015258;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" id="path4263" /> <path - d="M 25.09375,4.6875 C 24.802565,4.6962497 24.4375,4.830562 24.4375,5.53125 L 24.4375,10.65625 C 24.438113,11.093192 24.119395,11.465029 23.6875,11.53125 C 21.282157,11.865756 19.088867,12.85769 17.28125,14.3125 C 16.928459,14.600807 16.414327,14.573748 16.09375,14.25 L 12.375,10.53125 C 11.651494,9.8077446 11.33476,10.005814 11.1875,10.15625 C 11.04024,10.306686 10.835581,10.679331 11.53125,11.375 L 15.25,15.09375 C 15.573748,15.414327 15.600807,15.928459 15.3125,16.28125 C 13.853456,18.077851 12.872809,20.254443 12.53125,22.65625 C 12.465029,23.088145 12.093192,23.406863 11.65625,23.40625 L 6.53125,23.40625 C 6.0040952,23.40625 5.7220217,23.54544 5.59375,23.65625 C 5.4654783,23.76706 5.4636361,23.855992 5.46875,23.96875 C 5.4789779,24.194267 5.6462216,24.625 6.53125,24.625 L 11.5625,24.625 C 12.020654,24.628151 12.400467,24.980835 12.4375,25.4375 C 12.618808,27.976731 13.517676,30.282217 14.9375,32.21875 C 15.198879,32.573641 15.158888,33.066854 14.84375,33.375 L 11.53125,36.6875 C 11.198455,37.020295 11.132722,37.278629 11.125,37.4375 C 11.117278,37.596371 11.159115,37.695871 11.25,37.78125 C 11.431769,37.952008 11.793527,38.112723 12.375,37.53125 L 15.5625,34.34375 C 15.895436,34.010044 16.43165,33.996295 16.78125,34.3125 C 18.667254,35.992316 21.051823,37.105274 23.6875,37.46875 C 24.119395,37.534971 24.438113,37.906808 24.4375,38.34375 L 24.4375,42.53125 C 24.4375,43.528133 24.847358,43.62484 25.0625,43.625 C 25.277642,43.62516 25.65625,43.530887 25.65625,42.53125 L 25.65625,38.46875 C 25.659401,38.010596 26.012085,37.630783 26.46875,37.59375 C 29.20929,37.394221 31.696414,36.323628 33.71875,34.6875 C 34.071541,34.399193 34.585673,34.426252 34.90625,34.75 L 37.6875,37.53125 C 37.698175,37.541405 37.708595,37.551825 37.71875,37.5625 C 38.195082,38.094871 38.491333,37.932624 38.71875,37.71875 C 38.832458,37.611813 38.907672,37.489364 38.90625,37.34375 C 38.904828,37.198136 38.866787,37.007822 38.5625,36.71875 C 38.551825,36.708595 38.541405,36.698175 38.53125,36.6875 L 35.75,33.90625 C 35.426252,33.585673 35.399193,33.071541 35.6875,32.71875 C 37.328102,30.689104 38.366546,28.198849 38.5625,25.4375 C 38.599533,24.980835 38.979346,24.628151 39.4375,24.625 L 43.53125,24.625 C 44.118829,24.625 44.267023,24.281581 44.28125,23.96875 C 44.288364,23.812334 44.242164,23.683302 44.15625,23.59375 C 44.070336,23.504198 43.917728,23.40625 43.53125,23.40625 L 39.34375,23.40625 C 38.906808,23.406863 38.534971,23.088145 38.46875,22.65625 C 38.101164,20.032652 36.98685,17.661116 35.3125,15.78125 C 34.996295,15.43165 35.010044,14.895436 35.34375,14.5625 L 38.5,11.40625 C 38.515299,11.389252 38.517035,11.391435 38.53125,11.375 C 39.042145,10.784319 38.864072,10.540391 38.6875,10.375 C 38.506015,10.205007 38.180911,10.066987 37.65625,10.5625 L 34.375,13.84375 C 34.066854,14.158888 33.573641,14.198879 33.21875,13.9375 C 31.289159,12.522765 28.99632,11.623605 26.46875,11.4375 C 26.012085,11.400467 25.659401,11.020654 25.65625,10.5625 L 25.65625,5.53125 C 25.65625,5.1134947 25.532627,4.9419285 25.4375,4.84375 C 25.342373,4.7455715 25.239343,4.6831252 25.09375,4.6875 z " - style="opacity:0.64606742;color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient5158);stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" + d="M 25.09375,4.6875 C 24.802565,4.6962497 24.4375,4.830562 24.4375,5.53125 L 24.4375,10.65625 C 24.438113,11.093192 24.119395,11.465029 23.6875,11.53125 C 21.282157,11.865756 19.088867,12.85769 17.28125,14.3125 C 16.928459,14.600807 16.414327,14.573748 16.09375,14.25 L 12.375,10.53125 C 11.651494,9.8077446 11.33476,10.005814 11.1875,10.15625 C 11.04024,10.306686 10.835581,10.679331 11.53125,11.375 L 15.25,15.09375 C 15.573748,15.414327 15.600807,15.928459 15.3125,16.28125 C 13.853456,18.077851 12.872809,20.254443 12.53125,22.65625 C 12.465029,23.088145 12.093192,23.406863 11.65625,23.40625 L 6.53125,23.40625 C 6.0040952,23.40625 5.7220217,23.54544 5.59375,23.65625 C 5.4654783,23.76706 5.4636361,23.855992 5.46875,23.96875 C 5.4789779,24.194267 5.6462216,24.625 6.53125,24.625 L 11.5625,24.625 C 12.020654,24.628151 12.400467,24.980835 12.4375,25.4375 C 12.618808,27.976731 13.517676,30.282217 14.9375,32.21875 C 15.198879,32.573641 15.158888,33.066854 14.84375,33.375 L 11.53125,36.6875 C 11.198455,37.020295 11.132722,37.278629 11.125,37.4375 C 11.117278,37.596371 11.159115,37.695871 11.25,37.78125 C 11.431769,37.952008 11.793527,38.112723 12.375,37.53125 L 15.5625,34.34375 C 15.895436,34.010044 16.43165,33.996295 16.78125,34.3125 C 18.667254,35.992316 21.051823,37.105274 23.6875,37.46875 C 24.119395,37.534971 24.438113,37.906808 24.4375,38.34375 L 24.4375,42.53125 C 24.4375,43.528133 24.847358,43.62484 25.0625,43.625 C 25.277642,43.62516 25.65625,43.530887 25.65625,42.53125 L 25.65625,38.46875 C 25.659401,38.010596 26.012085,37.630783 26.46875,37.59375 C 29.20929,37.394221 31.696414,36.323628 33.71875,34.6875 C 34.071541,34.399193 34.585673,34.426252 34.90625,34.75 L 37.6875,37.53125 C 37.698175,37.541405 37.708595,37.551825 37.71875,37.5625 C 38.195082,38.094871 38.491333,37.932624 38.71875,37.71875 C 38.832458,37.611813 38.907672,37.489364 38.90625,37.34375 C 38.904828,37.198136 38.866787,37.007822 38.5625,36.71875 C 38.551825,36.708595 38.541405,36.698175 38.53125,36.6875 L 35.75,33.90625 C 35.426252,33.585673 35.399193,33.071541 35.6875,32.71875 C 37.328102,30.689104 38.366546,28.198849 38.5625,25.4375 C 38.599533,24.980835 38.979346,24.628151 39.4375,24.625 L 43.53125,24.625 C 44.118829,24.625 44.267023,24.281581 44.28125,23.96875 C 44.288364,23.812334 44.242164,23.683302 44.15625,23.59375 C 44.070336,23.504198 43.917728,23.40625 43.53125,23.40625 L 39.34375,23.40625 C 38.906808,23.406863 38.534971,23.088145 38.46875,22.65625 C 38.101164,20.032652 36.98685,17.661116 35.3125,15.78125 C 34.996295,15.43165 35.010044,14.895436 35.34375,14.5625 L 38.5,11.40625 C 38.515299,11.389252 38.517035,11.391435 38.53125,11.375 C 39.042145,10.784319 38.864072,10.540391 38.6875,10.375 C 38.506015,10.205007 38.180911,10.066987 37.65625,10.5625 L 34.375,13.84375 C 34.066854,14.158888 33.573641,14.198879 33.21875,13.9375 C 31.289159,12.522765 28.99632,11.623605 26.46875,11.4375 C 26.012085,11.400467 25.659401,11.020654 25.65625,10.5625 L 25.65625,5.53125 C 25.65625,5.1134947 25.532627,4.9419285 25.4375,4.84375 C 25.342373,4.7455715 25.239343,4.6831252 25.09375,4.6875 z" + style="opacity:0.64606742;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient5158);stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" id="path5150" /> </g> </svg> diff --git a/settings/xfpm-settings.c b/settings/xfpm-settings.c index 2a9a8554..37605b9b 100644 --- a/settings/xfpm-settings.c +++ b/settings/xfpm-settings.c @@ -168,7 +168,7 @@ battery_critical_changed_cb (GtkWidget *w, XfconfChannel *channel) &value, -1); - if (!xfconf_channel_set_uint (channel, "/" CRITICAL_BATT_ACTION_CFG, value) ) + if (!xfconf_channel_set_uint (channel, PROPERTIES_PREFIX CRITICAL_BATT_ACTION_CFG, value) ) { g_critical ("Cannot set value for property %s\n", CRITICAL_BATT_ACTION_CFG); } @@ -192,7 +192,7 @@ set_show_tray_icon_cb (GtkWidget *w, XfconfChannel *channel) &value, -1); - if (!xfconf_channel_set_uint (channel, "/" SHOW_TRAY_ICON_CFG, value) ) + if (!xfconf_channel_set_uint (channel, PROPERTIES_PREFIX SHOW_TRAY_ICON_CFG, value) ) { g_critical ("Cannot set value for property %s\n", SHOW_TRAY_ICON_CFG); } @@ -203,7 +203,7 @@ inactivity_on_ac_value_changed_cb (GtkWidget *widget, XfconfChannel *channel) { gint value = (gint)gtk_range_get_value (GTK_RANGE (widget)); - if (!xfconf_channel_set_uint (channel, "/" ON_AC_INACTIVITY_TIMEOUT, value)) + if (!xfconf_channel_set_uint (channel, PROPERTIES_PREFIX ON_AC_INACTIVITY_TIMEOUT, value)) { g_critical ("Cannot set value for property %s\n", ON_AC_INACTIVITY_TIMEOUT); } @@ -214,7 +214,7 @@ inactivity_on_battery_value_changed_cb (GtkWidget *widget, XfconfChannel *channe { gint value = (gint)gtk_range_get_value (GTK_RANGE (widget)); - if (!xfconf_channel_set_uint (channel, "/" ON_BATTERY_INACTIVITY_TIMEOUT, value)) + if (!xfconf_channel_set_uint (channel, PROPERTIES_PREFIX ON_BATTERY_INACTIVITY_TIMEOUT, value)) { g_critical ("Cannot set value for property %s\n", ON_BATTERY_INACTIVITY_TIMEOUT); } @@ -238,7 +238,7 @@ button_sleep_changed_cb (GtkWidget *w, XfconfChannel *channel) &value, -1); - if (!xfconf_channel_set_uint (channel, "/" SLEEP_SWITCH_CFG, value ) ) + if (!xfconf_channel_set_uint (channel, PROPERTIES_PREFIX SLEEP_SWITCH_CFG, value ) ) { g_critical ("Cannot set value for property %s\n", SLEEP_SWITCH_CFG); } @@ -262,7 +262,7 @@ button_power_changed_cb (GtkWidget *w, XfconfChannel *channel) &value, -1); - if (!xfconf_channel_set_uint (channel, "/" POWER_SWITCH_CFG, value) ) + if (!xfconf_channel_set_uint (channel, PROPERTIES_PREFIX POWER_SWITCH_CFG, value) ) { g_critical ("Cannot set value for property %s\n", POWER_SWITCH_CFG); } @@ -286,7 +286,7 @@ button_hibernate_changed_cb (GtkWidget *w, XfconfChannel *channel) &value, -1); - if (!xfconf_channel_set_uint (channel, "/" HIBERNATE_SWITCH_CFG, value ) ) + if (!xfconf_channel_set_uint (channel, PROPERTIES_PREFIX HIBERNATE_SWITCH_CFG, value ) ) { g_critical ("Cannot set value for property %s\n", HIBERNATE_SWITCH_CFG); } @@ -297,7 +297,7 @@ power_save_toggled_cb (GtkWidget *w, XfconfChannel *channel) { gboolean val = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(w)); - if (!xfconf_channel_set_bool (channel, "/" POWER_SAVE_ON_BATTERY, val) ) + if (!xfconf_channel_set_bool (channel, PROPERTIES_PREFIX POWER_SAVE_ON_BATTERY, val) ) { g_critical ("Cannot set value for property %s\n", POWER_SAVE_ON_BATTERY); } @@ -308,7 +308,7 @@ notify_toggled_cb (GtkWidget *w, XfconfChannel *channel) { gboolean val = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(w)); - if (!xfconf_channel_set_bool (channel, "/" GENERAL_NOTIFICATION_CFG, val) ) + if (!xfconf_channel_set_bool (channel, PROPERTIES_PREFIX GENERAL_NOTIFICATION_CFG, val) ) { g_critical ("Cannot set value for property %s\n", GENERAL_NOTIFICATION_CFG); } @@ -323,7 +323,7 @@ set_hibernate_inactivity (GtkWidget *w, XfconfChannel *channel) if ( active ) { - if (!xfconf_channel_set_string (channel, "/" INACTIVITY_SLEEP_MODE, "Hibernate") ) + if (!xfconf_channel_set_string (channel, PROPERTIES_PREFIX INACTIVITY_SLEEP_MODE, "Hibernate") ) { g_critical ("Cannot set value hibernate for property %s", INACTIVITY_SLEEP_MODE); } @@ -338,7 +338,7 @@ set_suspend_inactivity (GtkWidget *w, XfconfChannel *channel) active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)); if ( active ) { - if (!xfconf_channel_set_string (channel, "/" INACTIVITY_SLEEP_MODE, "Suspend") ) + if (!xfconf_channel_set_string (channel, PROPERTIES_PREFIX INACTIVITY_SLEEP_MODE, "Suspend") ) { g_critical ("Cannot set value suspend for property %s", INACTIVITY_SLEEP_MODE); } @@ -355,7 +355,7 @@ set_dpms_standby_mode (GtkWidget *w, XfconfChannel *channel) if ( active ) { - if (!xfconf_channel_set_string (channel, "/" DPMS_SLEEP_MODE, "standby") ) + if (!xfconf_channel_set_string (channel, PROPERTIES_PREFIX DPMS_SLEEP_MODE, "standby") ) { g_critical ("Cannot set value sleep for property %s\n", DPMS_SLEEP_MODE); } @@ -372,7 +372,7 @@ set_dpms_suspend_mode (GtkWidget *w, XfconfChannel *channel) active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)); if ( active ) { - if (!xfconf_channel_set_string (channel, "/" DPMS_SLEEP_MODE, "suspend") ) + if (!xfconf_channel_set_string (channel, PROPERTIES_PREFIX DPMS_SLEEP_MODE, "suspend") ) { g_critical ("Cannot set value sleep for property %s\n", DPMS_SLEEP_MODE); } @@ -386,7 +386,7 @@ dpms_toggled_cb (GtkWidget *w, XfconfChannel *channel) #ifdef HAVE_DPMS gboolean val = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(w)); - xfconf_channel_set_bool (channel, "/" DPMS_ENABLED_CFG, val); + xfconf_channel_set_bool (channel, PROPERTIES_PREFIX DPMS_ENABLED_CFG, val); gtk_widget_set_sensitive (on_ac_dpms_off, val); gtk_widget_set_sensitive (on_ac_dpms_sleep, val); @@ -414,7 +414,7 @@ sleep_on_battery_value_changed_cb (GtkWidget *w, XfconfChannel *channel) } } - if (!xfconf_channel_set_uint (channel, "/" ON_BATT_DPMS_SLEEP, sleep_value)) + if (!xfconf_channel_set_uint (channel, PROPERTIES_PREFIX ON_BATT_DPMS_SLEEP, sleep_value)) { g_critical ("Cannot set value for property %s\n", ON_BATT_DPMS_SLEEP); } @@ -436,7 +436,7 @@ off_on_battery_value_changed_cb (GtkWidget *w, XfconfChannel *channel) } } - if (!xfconf_channel_set_uint (channel, "/" ON_BATT_DPMS_OFF, off_value)) + if (!xfconf_channel_set_uint (channel, PROPERTIES_PREFIX ON_BATT_DPMS_OFF, off_value)) { g_critical ("Cannot set value for property %s\n", ON_BATT_DPMS_OFF); } @@ -461,7 +461,7 @@ sleep_on_ac_value_changed_cb (GtkWidget *w, XfconfChannel *channel) } } - if (!xfconf_channel_set_uint (channel, "/" ON_AC_DPMS_SLEEP, sleep_value)) + if (!xfconf_channel_set_uint (channel, PROPERTIES_PREFIX ON_AC_DPMS_SLEEP, sleep_value)) { g_critical ("Cannot set value for property %s\n", ON_AC_DPMS_SLEEP); } @@ -486,7 +486,7 @@ off_on_ac_value_changed_cb (GtkWidget *w, XfconfChannel *channel) } } - if (!xfconf_channel_set_uint (channel, "/" ON_AC_DPMS_OFF, off_value)) + if (!xfconf_channel_set_uint (channel, PROPERTIES_PREFIX ON_AC_DPMS_OFF, off_value)) { g_critical ("Cannot set value for property %s\n", ON_AC_DPMS_OFF); } @@ -552,7 +552,7 @@ brightness_on_battery_value_changed_cb (GtkWidget *w, XfconfChannel *channel) { gint value = (gint)gtk_range_get_value (GTK_RANGE(w)); - if (!xfconf_channel_set_uint (channel, "/" BRIGHTNESS_ON_BATTERY, value)) + if (!xfconf_channel_set_uint (channel, PROPERTIES_PREFIX BRIGHTNESS_ON_BATTERY, value)) { g_critical ("Cannot set value for property %s\n", BRIGHTNESS_ON_BATTERY); } @@ -563,7 +563,7 @@ brightness_on_ac_value_changed_cb (GtkWidget *w, XfconfChannel *channel) { gint value = (gint)gtk_range_get_value (GTK_RANGE(w)); - if (!xfconf_channel_set_uint (channel, "/" BRIGHTNESS_ON_AC, value)) + if (!xfconf_channel_set_uint (channel, PROPERTIES_PREFIX BRIGHTNESS_ON_AC, value)) { g_critical ("Cannot set value for property %s\n", BRIGHTNESS_ON_AC); } @@ -599,7 +599,7 @@ on_battery_lid_changed_cb (GtkWidget *w, XfconfChannel *channel) &value, -1); - if (!xfconf_channel_set_uint (channel, "/" LID_SWITCH_ON_BATTERY_CFG, value) ) + if (!xfconf_channel_set_uint (channel, PROPERTIES_PREFIX LID_SWITCH_ON_BATTERY_CFG, value) ) { g_critical ("Cannot set value for property %s\n", LID_SWITCH_ON_BATTERY_CFG); } @@ -623,7 +623,7 @@ on_ac_lid_changed_cb (GtkWidget *w, XfconfChannel *channel) &value, -1); - if (!xfconf_channel_set_uint (channel, "/" LID_SWITCH_ON_AC_CFG, value) ) + if (!xfconf_channel_set_uint (channel, PROPERTIES_PREFIX LID_SWITCH_ON_AC_CFG, value) ) { g_critical ("Cannot set value for property %s\n", LID_SWITCH_ON_AC_CFG); } @@ -634,7 +634,7 @@ critical_level_value_changed_cb (GtkSpinButton *w, XfconfChannel *channel) { guint val = (guint) gtk_spin_button_get_value (w); - if (!xfconf_channel_set_uint (channel, "/" CRITICAL_POWER_LEVEL, val) ) + if (!xfconf_channel_set_uint (channel, PROPERTIES_PREFIX CRITICAL_POWER_LEVEL, val) ) { g_critical ("Unable to set value %d for property %s\n", val, CRITICAL_POWER_LEVEL); } @@ -645,7 +645,7 @@ lock_screen_toggled_cb (GtkWidget *w, XfconfChannel *channel) { gboolean val = (gint) gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(w)); - if ( !xfconf_channel_set_bool (channel, "/" LOCK_SCREEN_ON_SLEEP, val) ) + if ( !xfconf_channel_set_bool (channel, PROPERTIES_PREFIX LOCK_SCREEN_ON_SLEEP, val) ) { g_critical ("Unable to set value for property %s\n", LOCK_SCREEN_ON_SLEEP); } @@ -657,7 +657,7 @@ cpu_freq_control_changed_cb (GtkWidget *w, XfconfChannel *channel) #ifdef SYSTEM_IS_LINUX gboolean val = (gint) gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(w)); - if ( !xfconf_channel_set_bool (channel, "/" CPU_FREQ_CONTROL, val) ) + if ( !xfconf_channel_set_bool (channel, PROPERTIES_PREFIX CPU_FREQ_CONTROL, val) ) { g_critical ("Unable to set value for property %s\n", CPU_FREQ_CONTROL); } @@ -696,7 +696,7 @@ xfpm_settings_on_battery (XfconfChannel *channel, gboolean user_privilege, gbool gtk_widget_set_tooltip_text (inact, _("Hibernate and suspend operations not permitted")); } - val = xfconf_channel_get_uint (channel, "/" ON_BATTERY_INACTIVITY_TIMEOUT, 30); + val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX ON_BATTERY_INACTIVITY_TIMEOUT, 30); gtk_range_set_value (GTK_RANGE (inact), val); @@ -731,7 +731,7 @@ xfpm_settings_on_battery (XfconfChannel *channel, gboolean user_privilege, gbool gtk_list_store_append(list_store, &iter); gtk_list_store_set (list_store, &iter, 0, _("Ask"), 1, XFPM_ASK, -1); - val = xfconf_channel_get_uint (channel, "/" CRITICAL_BATT_ACTION_CFG, XFPM_DO_NOTHING); + val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX CRITICAL_BATT_ACTION_CFG, XFPM_DO_NOTHING); for ( valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store), &iter); valid; @@ -747,7 +747,7 @@ xfpm_settings_on_battery (XfconfChannel *channel, gboolean user_privilege, gbool } power_save = GTK_WIDGET (gtk_builder_get_object (xml, "power-save")); - save_power = xfconf_channel_get_bool (channel, "/" POWER_SAVE_ON_BATTERY, TRUE); + save_power = xfconf_channel_get_bool (channel, PROPERTIES_PREFIX POWER_SAVE_ON_BATTERY, TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(power_save), save_power); @@ -758,10 +758,10 @@ xfpm_settings_on_battery (XfconfChannel *channel, gboolean user_privilege, gbool dpms_frame_on_battery = GTK_WIDGET (gtk_builder_get_object (xml, "dpms-on-battery-frame")); gtk_widget_show (GTK_WIDGET(dpms_frame_on_battery)); - val = xfconf_channel_get_uint (channel, "/" ON_BATT_DPMS_SLEEP, 5); + val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX ON_BATT_DPMS_SLEEP, 5); gtk_range_set_value (GTK_RANGE(on_battery_dpms_sleep), val); - val = xfconf_channel_get_uint (channel, "/" ON_BATT_DPMS_OFF, 10); + val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX ON_BATT_DPMS_OFF, 10); gtk_range_set_value (GTK_RANGE(on_battery_dpms_off), val); #endif @@ -799,7 +799,7 @@ xfpm_settings_on_battery (XfconfChannel *channel, gboolean user_privilege, gbool gtk_list_store_append(list_store, &iter); gtk_list_store_set (list_store, &iter, 0, _("Lock screen"), 1, LID_TRIGGER_LOCK_SCREEN, -1); - val = xfconf_channel_get_uint (channel, "/" LID_SWITCH_ON_BATTERY_CFG, LID_TRIGGER_LOCK_SCREEN); + val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX LID_SWITCH_ON_BATTERY_CFG, LID_TRIGGER_LOCK_SCREEN); for ( valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store), &iter); valid; @@ -828,7 +828,7 @@ xfpm_settings_on_battery (XfconfChannel *channel, gboolean user_privilege, gbool brg = GTK_WIDGET (gtk_builder_get_object (xml ,"brg-on-battery")); if ( has_lcd_brightness ) { - val = xfconf_channel_get_uint (channel, "/" BRIGHTNESS_ON_BATTERY, 120); + val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX BRIGHTNESS_ON_BATTERY, 120); gtk_range_set_value (GTK_RANGE(brg), val); @@ -872,7 +872,7 @@ xfpm_settings_on_ac (XfconfChannel *channel, gboolean user_privilege, gboolean c gtk_widget_set_tooltip_text (inact, _("Hibernate and suspend operations not permitted")); } - val = xfconf_channel_get_uint (channel, "/" ON_AC_INACTIVITY_TIMEOUT, 30); + val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX ON_AC_INACTIVITY_TIMEOUT, 30); gtk_range_set_value (GTK_RANGE (inact), val); #ifdef HAVE_DPMS @@ -882,10 +882,10 @@ xfpm_settings_on_ac (XfconfChannel *channel, gboolean user_privilege, gboolean c dpms_frame_on_ac = GTK_WIDGET (gtk_builder_get_object (xml, "dpms-on-ac-frame")); gtk_widget_show (GTK_WIDGET(dpms_frame_on_ac)); - val = xfconf_channel_get_uint (channel, "/" ON_AC_DPMS_SLEEP, 10); + val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX ON_AC_DPMS_SLEEP, 10); gtk_range_set_value (GTK_RANGE (on_ac_dpms_sleep), val); - val = xfconf_channel_get_uint (channel, "/" ON_AC_DPMS_OFF, 15); + val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX ON_AC_DPMS_OFF, 15); gtk_range_set_value (GTK_RANGE(on_ac_dpms_off), val); #endif @@ -923,7 +923,7 @@ xfpm_settings_on_ac (XfconfChannel *channel, gboolean user_privilege, gboolean c gtk_list_store_append(list_store, &iter); gtk_list_store_set (list_store, &iter, 0, _("Lock screen"), 1, LID_TRIGGER_LOCK_SCREEN, -1); - val = xfconf_channel_get_uint (channel, "/" LID_SWITCH_ON_AC_CFG, LID_TRIGGER_LOCK_SCREEN); + val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX LID_SWITCH_ON_AC_CFG, LID_TRIGGER_LOCK_SCREEN); for ( valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store), &iter); valid; valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (list_store), &iter) ) @@ -950,7 +950,7 @@ xfpm_settings_on_ac (XfconfChannel *channel, gboolean user_privilege, gboolean c brg = GTK_WIDGET (gtk_builder_get_object (xml ,"brg-on-ac")); if ( has_lcd_brightness ) { - val = xfconf_channel_get_uint (channel, "/" BRIGHTNESS_ON_AC, 9); + val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX BRIGHTNESS_ON_AC, 9); gtk_range_set_value (GTK_RANGE(brg), val); @@ -1010,7 +1010,7 @@ xfpm_settings_general (XfconfChannel *channel, gboolean user_privilege, gtk_list_store_append(list_store, &iter); gtk_list_store_set (list_store, &iter, 0, _("When battery is charging or discharging"), 1, SHOW_ICON_WHEN_BATTERY_CHARGING_DISCHARGING, -1); - value = xfconf_channel_get_uint (channel, "/" SHOW_TRAY_ICON_CFG, SHOW_ICON_WHEN_BATTERY_PRESENT); + value = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX SHOW_TRAY_ICON_CFG, SHOW_ICON_WHEN_BATTERY_PRESENT); for ( valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store), &iter); valid; @@ -1031,7 +1031,7 @@ xfpm_settings_general (XfconfChannel *channel, gboolean user_privilege, * Global dpms settings (enable/disable) */ - val = xfconf_channel_get_bool (channel, "/" DPMS_ENABLED_CFG, TRUE); + val = xfconf_channel_get_bool (channel, PROPERTIES_PREFIX DPMS_ENABLED_CFG, TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(dpms), val); gtk_widget_set_tooltip_text (dpms, _("Disable Display Power Management Signaling (DPMS), "\ @@ -1078,7 +1078,7 @@ xfpm_settings_general (XfconfChannel *channel, gboolean user_privilege, gtk_list_store_append (list_store, &iter); gtk_list_store_set (list_store, &iter, 0, _("Ask"), 1, XFPM_ASK, -1); - value = xfconf_channel_get_uint (channel, "/" POWER_SWITCH_CFG, XFPM_DO_NOTHING); + value = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX POWER_SWITCH_CFG, XFPM_DO_NOTHING); for ( valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store), &iter); valid; valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (list_store), &iter) ) @@ -1133,7 +1133,7 @@ xfpm_settings_general (XfconfChannel *channel, gboolean user_privilege, gtk_list_store_append (list_store, &iter); gtk_list_store_set (list_store, &iter, 0, _("Ask"), 1, XFPM_ASK, -1); - value = xfconf_channel_get_uint (channel, "/" HIBERNATE_SWITCH_CFG, XFPM_DO_NOTHING); + value = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX HIBERNATE_SWITCH_CFG, XFPM_DO_NOTHING); for ( valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store), &iter); valid; valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (list_store), &iter) ) @@ -1188,7 +1188,7 @@ xfpm_settings_general (XfconfChannel *channel, gboolean user_privilege, gtk_list_store_append (list_store, &iter); gtk_list_store_set (list_store, &iter, 0, _("Ask"), 1, XFPM_ASK, -1); - value = xfconf_channel_get_uint (channel, "/" SLEEP_SWITCH_CFG, XFPM_DO_NOTHING); + value = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX SLEEP_SWITCH_CFG, XFPM_DO_NOTHING); for ( valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store), &iter); valid; valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (list_store), &iter) ) @@ -1212,7 +1212,7 @@ xfpm_settings_general (XfconfChannel *channel, gboolean user_privilege, */ notify = GTK_WIDGET (gtk_builder_get_object (xml, "notification")); - val = xfconf_channel_get_bool (channel, "/" GENERAL_NOTIFICATION_CFG, TRUE); + val = xfconf_channel_get_bool (channel, PROPERTIES_PREFIX GENERAL_NOTIFICATION_CFG, TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(notify), val); @@ -1246,7 +1246,7 @@ xfpm_settings_advanced (XfconfChannel *channel, gboolean system_laptop, gboolean gtk_widget_set_tooltip_text (inact_hibernate, _("Hibernate operation not permitted")); } - str = xfconf_channel_get_string (channel, "/" INACTIVITY_SLEEP_MODE, "Suspend"); + str = xfconf_channel_get_string (channel, PROPERTIES_PREFIX INACTIVITY_SLEEP_MODE, "Suspend"); if ( xfpm_strequal (str, "Suspend") ) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (inact_suspend), TRUE); else if ( xfpm_strequal (str, "Hibernate")) @@ -1263,7 +1263,7 @@ xfpm_settings_advanced (XfconfChannel *channel, gboolean system_laptop, gboolean suspend_dpms_mode = GTK_WIDGET (gtk_builder_get_object (xml, "suspend-dpms-mode")); #ifdef HAVE_DPMS - str = xfconf_channel_get_string (channel, "/" DPMS_SLEEP_MODE, "standby"); + str = xfconf_channel_get_string (channel, PROPERTIES_PREFIX DPMS_SLEEP_MODE, "standby"); if ( xfpm_strequal (str, "standby" ) ) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sleep_dpms_mode), TRUE); @@ -1271,7 +1271,7 @@ xfpm_settings_advanced (XfconfChannel *channel, gboolean system_laptop, gboolean gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (suspend_dpms_mode), TRUE); else { - g_critical ("Invalid value %s for property %s\n", str, "/" DPMS_SLEEP_MODE ); + g_critical ("Invalid value %s for property %s\n", str, PROPERTIES_PREFIX DPMS_SLEEP_MODE ); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sleep_dpms_mode), TRUE); } @@ -1292,7 +1292,7 @@ xfpm_settings_advanced (XfconfChannel *channel, gboolean system_laptop, gboolean gtk_widget_set_tooltip_text (critical_level, _("When all the power sources of the computer reach this charge level")); - val = xfconf_channel_get_uint (channel, "/" CRITICAL_POWER_LEVEL, 10 ); + val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX CRITICAL_POWER_LEVEL, 10 ); if ( val > 20 ) { @@ -1320,7 +1320,7 @@ xfpm_settings_advanced (XfconfChannel *channel, gboolean system_laptop, gboolean gtk_widget_set_tooltip_text (lock, _("Hibernate and suspend operations not permitted")); } - val = xfconf_channel_get_bool (channel, "/" LOCK_SCREEN_ON_SLEEP, TRUE); + val = xfconf_channel_get_bool (channel, PROPERTIES_PREFIX LOCK_SCREEN_ON_SLEEP, TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(lock), val); cpu = GTK_WIDGET (gtk_builder_get_object (xml, "cpu-freq")); @@ -1328,7 +1328,7 @@ xfpm_settings_advanced (XfconfChannel *channel, gboolean system_laptop, gboolean #ifdef SYSTEM_IS_LINUX if ( system_laptop ) { - val = xfconf_channel_get_bool (channel, "/" CPU_FREQ_CONTROL, TRUE); + val = xfconf_channel_get_bool (channel, PROPERTIES_PREFIX CPU_FREQ_CONTROL, TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(cpu), val); } else diff --git a/src/xfpm-brightness-widget.c b/src/xfpm-brightness-widget.c index 31a6d76a..a312c803 100644 --- a/src/xfpm-brightness-widget.c +++ b/src/xfpm-brightness-widget.c @@ -43,18 +43,16 @@ static void xfpm_brightness_widget_finalize (GObject *object); #define XFPM_BRIGHTNESS_WIDGET_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), XFPM_TYPE_BRIGHTNESS_WIDGET, XfpmBrightnessWidgetPrivate)) -#define WINDOW_HIDE_TIMEOUT 1.0f #define BRIGHTNESS_POPUP_SIZE 180 struct XfpmBrightnessWidgetPrivate { GtkWidget *window; - GTimer *timer; GdkPixbuf *pix; guint level; guint max_level; - gboolean timeout_added; + gulong timeout_id; }; G_DEFINE_TYPE (XfpmBrightnessWidget, xfpm_brightness_widget, G_TYPE_OBJECT) @@ -62,13 +60,8 @@ G_DEFINE_TYPE (XfpmBrightnessWidget, xfpm_brightness_widget, G_TYPE_OBJECT) static gboolean xfpm_brightness_widget_timeout (XfpmBrightnessWidget *widget) { - if ( g_timer_elapsed (widget->priv->timer, NULL) > WINDOW_HIDE_TIMEOUT ) - { - gtk_widget_hide (widget->priv->window); - widget->priv->timeout_added = FALSE; - return FALSE; - } - return TRUE; + gtk_widget_hide (widget->priv->window); + return FALSE; } static gboolean @@ -98,24 +91,13 @@ xfpm_brightness_widget_expose_event (GtkWidget *w, GdkEventExpose *ev, XfpmBrigh { if ( i >= widget->priv->level ) { - cairo_set_source_rgb (cr, 0.3, 0.3, 0.4); - } - else - { - cairo_set_source_rgb (cr, 0.6, 1.0, 0.4); - } - cairo_rectangle (cr, (gdouble)i*width, 140, width - padding , 10); - cairo_fill (cr); - - if ( i >= widget->priv->level ) - { - cairo_set_source_rgb (cr, 0.3, 0.3, 0.3); + cairo_set_source_rgb (cr, 0., 0., 0.); } else { - cairo_set_source_rgb (cr, 0.6, 1.0, 0.); + cairo_set_source_rgb (cr, 1., 1.0, 0.0); } - cairo_rectangle (cr, (gdouble)i*width, 150, width - padding , 10); + cairo_rectangle (cr, (gdouble)i*width, 130, width - padding , 20); cairo_fill (cr); } @@ -163,6 +145,7 @@ xfpm_brightness_widget_init (XfpmBrightnessWidget *widget) widget->priv->level = 0; widget->priv->max_level = 0; + widget->priv->timeout_id = 0; gtk_widget_set_size_request (GTK_WIDGET (widget->priv->window), BRIGHTNESS_POPUP_SIZE, BRIGHTNESS_POPUP_SIZE); @@ -170,8 +153,6 @@ xfpm_brightness_widget_init (XfpmBrightnessWidget *widget) xfpm_brightness_widget_set_colormap (GTK_WIDGET (widget->priv->window)); - widget->priv->timer = g_timer_new (); - g_signal_connect (widget->priv->window, "expose_event", G_CALLBACK (xfpm_brightness_widget_expose_event), widget); } @@ -183,7 +164,6 @@ xfpm_brightness_widget_finalize (GObject *object) widget = XFPM_BRIGHTNESS_WIDGET (object); - g_timer_destroy (widget->priv->timer); if ( widget->priv->pix ) gdk_pixbuf_unref (widget->priv->pix); @@ -213,13 +193,10 @@ void xfpm_brightness_widget_set_level (XfpmBrightnessWidget *widget, guint level widget->priv->level = level; gtk_window_present (GTK_WINDOW (widget->priv->window)); - gtk_widget_queue_draw (widget->priv->window); - if ( widget->priv->timeout_added == FALSE ) - { - g_timeout_add (100, (GSourceFunc) xfpm_brightness_widget_timeout, widget); - widget->priv->timeout_added = TRUE; - } + if ( widget->priv->timeout_id != 0 ) + g_source_remove (widget->priv->timeout_id); - g_timer_reset (widget->priv->timer); + widget->priv->timeout_id = + g_timeout_add (900, (GSourceFunc) xfpm_brightness_widget_timeout, widget); } diff --git a/src/xfpm-config.h b/src/xfpm-config.h index 9967cdac..44d497a4 100644 --- a/src/xfpm-config.h +++ b/src/xfpm-config.h @@ -36,6 +36,12 @@ G_BEGIN_DECLS #define XFPM_CHANNEL_CFG "xfce4-power-manager" +/* + * Backward compatibility with old version. + */ +#define PROPERTIES_PREFIX "/xfce4-power-manager/" + + #define POWER_SAVE_ON_BATTERY "power-save-on-battery" #define CPU_FREQ_CONTROL "enable-cpu-freq-control" #define LOCK_SCREEN_ON_SLEEP "lock-screen-suspend-hibernate" diff --git a/src/xfpm-xfconf.c b/src/xfpm-xfconf.c index c64a0dc4..4e30c1d0 100644 --- a/src/xfpm-xfconf.c +++ b/src/xfpm-xfconf.c @@ -175,9 +175,12 @@ xfpm_xfconf_property_changed_cb (XfconfChannel *channel, gchar *property, if ( G_VALUE_TYPE(value) == G_TYPE_INVALID ) return; + if ( !g_str_has_prefix (property, PROPERTIES_PREFIX) ) + return; + TRACE("Property modified: %s\n", property); - g_object_set_property (G_OBJECT (conf), strchr (property, '/') + 1, value); + g_object_set_property (G_OBJECT (conf), property + strlen (PROPERTIES_PREFIX), value); } static void |