diff options
author | Ted Gould <ted@gould.cx> | 2010-01-02 23:51:04 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-01-02 23:51:04 -0600 |
commit | d61447937953e0e39add836cc6cfad261dc7a1df (patch) | |
tree | 705cd0d64fd527bf5770a09e943da9d996ace143 | |
parent | a718efc9b3340801882f7c7550320d01f9b0635e (diff) | |
parent | fbdb4d5d1e0e51fc1b20ec4d526dfd96dea909c9 (diff) | |
download | ayatana-indicator-session-d61447937953e0e39add836cc6cfad261dc7a1df.tar.gz ayatana-indicator-session-d61447937953e0e39add836cc6cfad261dc7a1df.tar.bz2 ayatana-indicator-session-d61447937953e0e39add836cc6cfad261dc7a1df.zip |
releasing version 0.2.0~dev-0ubuntu1~ppa4~nostatus1
65 files changed, 33 insertions, 3240 deletions
diff --git a/configure.ac b/configure.ac index 1a41ab1..a358f24 100644 --- a/configure.ac +++ b/configure.ac @@ -142,21 +142,14 @@ src/gtk-dialog/Makefile data/Makefile data/icons/Makefile data/icons/16x16/Makefile -data/icons/16x16/status/Makefile data/icons/16x16/actions/Makefile data/icons/22x22/Makefile -data/icons/22x22/status/Makefile data/icons/22x22/actions/Makefile data/icons/24x24/Makefile -data/icons/24x24/status/Makefile data/icons/24x24/actions/Makefile data/icons/32x32/Makefile -data/icons/32x32/status/Makefile data/icons/32x32/actions/Makefile -data/icons/48x48/Makefile -data/icons/48x48/status/Makefile data/icons/scalable/Makefile -data/icons/scalable/status/Makefile data/icons/scalable/actions/Makefile po/Makefile.in ]) diff --git a/data/Makefile.am b/data/Makefile.am index 9ba0d97..70ea880 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,8 +1,7 @@ SUBDIRS = icons dbus_servicesdir = $(DBUSSERVICEDIR) -service_in_files = indicator-status.service.in \ - indicator-users.service.in \ +service_in_files = indicator-users.service.in \ indicator-session.service.in dbus_services_DATA = $(service_in_files:.service.in=.service) diff --git a/data/icons/16x16/Makefile.am b/data/icons/16x16/Makefile.am index 4810a68..0224d45 100644 --- a/data/icons/16x16/Makefile.am +++ b/data/icons/16x16/Makefile.am @@ -1 +1 @@ -SUBDIRS = status actions +SUBDIRS = actions diff --git a/data/icons/16x16/status/Makefile.am b/data/icons/16x16/status/Makefile.am deleted file mode 100644 index fa874bf..0000000 --- a/data/icons/16x16/status/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ - -iconsdir = $(INDICATORICONSDIR)/hicolor/16x16/status - -icons_DATA = \ - user-available.png \ - user-offline.png \ - user-away.png \ - user-busy.png \ - user-invisible.png - -EXTRA_DIST = $(icons_DATA) diff --git a/data/icons/16x16/status/user-available.png b/data/icons/16x16/status/user-available.png Binary files differdeleted file mode 100644 index 5435e02..0000000 --- a/data/icons/16x16/status/user-available.png +++ /dev/null diff --git a/data/icons/16x16/status/user-away.png b/data/icons/16x16/status/user-away.png Binary files differdeleted file mode 100644 index 7576a61..0000000 --- a/data/icons/16x16/status/user-away.png +++ /dev/null diff --git a/data/icons/16x16/status/user-busy.png b/data/icons/16x16/status/user-busy.png Binary files differdeleted file mode 100644 index 90eab60..0000000 --- a/data/icons/16x16/status/user-busy.png +++ /dev/null diff --git a/data/icons/16x16/status/user-invisible.png b/data/icons/16x16/status/user-invisible.png Binary files differdeleted file mode 100755 index ba094d3..0000000 --- a/data/icons/16x16/status/user-invisible.png +++ /dev/null diff --git a/data/icons/16x16/status/user-offline.png b/data/icons/16x16/status/user-offline.png Binary files differdeleted file mode 100644 index 637be12..0000000 --- a/data/icons/16x16/status/user-offline.png +++ /dev/null diff --git a/data/icons/22x22/Makefile.am b/data/icons/22x22/Makefile.am index 4810a68..0224d45 100644 --- a/data/icons/22x22/Makefile.am +++ b/data/icons/22x22/Makefile.am @@ -1 +1 @@ -SUBDIRS = status actions +SUBDIRS = actions diff --git a/data/icons/22x22/status/Makefile.am b/data/icons/22x22/status/Makefile.am deleted file mode 100644 index 0171b82..0000000 --- a/data/icons/22x22/status/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ - -iconsdir = $(INDICATORICONSDIR)/hicolor/22x22/status - -icons_DATA = \ - user-available.png \ - user-offline.png \ - user-away.png \ - user-busy.png \ - user-invisible.png - -EXTRA_DIST = $(icons_DATA) diff --git a/data/icons/22x22/status/user-available.png b/data/icons/22x22/status/user-available.png Binary files differdeleted file mode 100644 index ec8c452..0000000 --- a/data/icons/22x22/status/user-available.png +++ /dev/null diff --git a/data/icons/22x22/status/user-away.png b/data/icons/22x22/status/user-away.png Binary files differdeleted file mode 100644 index 6c068f2..0000000 --- a/data/icons/22x22/status/user-away.png +++ /dev/null diff --git a/data/icons/22x22/status/user-busy.png b/data/icons/22x22/status/user-busy.png Binary files differdeleted file mode 100644 index 0fe61fd..0000000 --- a/data/icons/22x22/status/user-busy.png +++ /dev/null diff --git a/data/icons/22x22/status/user-invisible.png b/data/icons/22x22/status/user-invisible.png Binary files differdeleted file mode 100755 index af3393b..0000000 --- a/data/icons/22x22/status/user-invisible.png +++ /dev/null diff --git a/data/icons/22x22/status/user-offline.png b/data/icons/22x22/status/user-offline.png Binary files differdeleted file mode 100644 index fe5de82..0000000 --- a/data/icons/22x22/status/user-offline.png +++ /dev/null diff --git a/data/icons/24x24/Makefile.am b/data/icons/24x24/Makefile.am index 4810a68..0224d45 100644 --- a/data/icons/24x24/Makefile.am +++ b/data/icons/24x24/Makefile.am @@ -1 +1 @@ -SUBDIRS = status actions +SUBDIRS = actions diff --git a/data/icons/24x24/status/Makefile.am b/data/icons/24x24/status/Makefile.am deleted file mode 100644 index f92e8f1..0000000 --- a/data/icons/24x24/status/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ - -iconsdir = $(INDICATORICONSDIR)/hicolor/24x24/status - -icons_DATA = \ - user-available.png \ - user-offline.png \ - user-away.png \ - user-busy.png \ - user-invisible.png - -EXTRA_DIST = $(icons_DATA) diff --git a/data/icons/24x24/status/user-available.png b/data/icons/24x24/status/user-available.png Binary files differdeleted file mode 100644 index 95f2534..0000000 --- a/data/icons/24x24/status/user-available.png +++ /dev/null diff --git a/data/icons/24x24/status/user-away.png b/data/icons/24x24/status/user-away.png Binary files differdeleted file mode 100644 index 3a7e01f..0000000 --- a/data/icons/24x24/status/user-away.png +++ /dev/null diff --git a/data/icons/24x24/status/user-busy.png b/data/icons/24x24/status/user-busy.png Binary files differdeleted file mode 100644 index 7e5dced..0000000 --- a/data/icons/24x24/status/user-busy.png +++ /dev/null diff --git a/data/icons/24x24/status/user-invisible.png b/data/icons/24x24/status/user-invisible.png Binary files differdeleted file mode 100755 index cb5bc94..0000000 --- a/data/icons/24x24/status/user-invisible.png +++ /dev/null diff --git a/data/icons/24x24/status/user-offline.png b/data/icons/24x24/status/user-offline.png Binary files differdeleted file mode 100644 index bdfc885..0000000 --- a/data/icons/24x24/status/user-offline.png +++ /dev/null diff --git a/data/icons/32x32/Makefile.am b/data/icons/32x32/Makefile.am index 4810a68..0224d45 100644 --- a/data/icons/32x32/Makefile.am +++ b/data/icons/32x32/Makefile.am @@ -1 +1 @@ -SUBDIRS = status actions +SUBDIRS = actions diff --git a/data/icons/32x32/status/Makefile.am b/data/icons/32x32/status/Makefile.am deleted file mode 100644 index 92f55f4..0000000 --- a/data/icons/32x32/status/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ - -iconsdir = $(INDICATORICONSDIR)/hicolor/32x32/status - -icons_DATA = \ - user-available.png \ - user-offline.png \ - user-away.png \ - user-busy.png \ - user-invisible.png - -EXTRA_DIST = $(icons_DATA) diff --git a/data/icons/32x32/status/user-available.png b/data/icons/32x32/status/user-available.png Binary files differdeleted file mode 100644 index 5d04e0a..0000000 --- a/data/icons/32x32/status/user-available.png +++ /dev/null diff --git a/data/icons/32x32/status/user-away.png b/data/icons/32x32/status/user-away.png Binary files differdeleted file mode 100644 index 712f68a..0000000 --- a/data/icons/32x32/status/user-away.png +++ /dev/null diff --git a/data/icons/32x32/status/user-busy.png b/data/icons/32x32/status/user-busy.png Binary files differdeleted file mode 100644 index be1280e..0000000 --- a/data/icons/32x32/status/user-busy.png +++ /dev/null diff --git a/data/icons/32x32/status/user-invisible.png b/data/icons/32x32/status/user-invisible.png Binary files differdeleted file mode 100755 index 39633fc..0000000 --- a/data/icons/32x32/status/user-invisible.png +++ /dev/null diff --git a/data/icons/32x32/status/user-offline.png b/data/icons/32x32/status/user-offline.png Binary files differdeleted file mode 100644 index 3c4d664..0000000 --- a/data/icons/32x32/status/user-offline.png +++ /dev/null diff --git a/data/icons/48x48/Makefile.am b/data/icons/48x48/Makefile.am deleted file mode 100644 index d52da2b..0000000 --- a/data/icons/48x48/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = status diff --git a/data/icons/48x48/status/Makefile.am b/data/icons/48x48/status/Makefile.am deleted file mode 100644 index a0f2d82..0000000 --- a/data/icons/48x48/status/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ - -iconsdir = $(INDICATORICONSDIR)/hicolor/48x48/status - -icons_DATA = \ - user-available.png \ - user-offline.png \ - user-away.png \ - user-busy.png \ - user-invisible.png - -EXTRA_DIST = $(icons_DATA) diff --git a/data/icons/48x48/status/user-available.png b/data/icons/48x48/status/user-available.png Binary files differdeleted file mode 100644 index 5bcae55..0000000 --- a/data/icons/48x48/status/user-available.png +++ /dev/null diff --git a/data/icons/48x48/status/user-away.png b/data/icons/48x48/status/user-away.png Binary files differdeleted file mode 100644 index f9d7aee..0000000 --- a/data/icons/48x48/status/user-away.png +++ /dev/null diff --git a/data/icons/48x48/status/user-busy.png b/data/icons/48x48/status/user-busy.png Binary files differdeleted file mode 100644 index b6c60c9..0000000 --- a/data/icons/48x48/status/user-busy.png +++ /dev/null diff --git a/data/icons/48x48/status/user-invisible.png b/data/icons/48x48/status/user-invisible.png Binary files differdeleted file mode 100755 index 9a49d17..0000000 --- a/data/icons/48x48/status/user-invisible.png +++ /dev/null diff --git a/data/icons/48x48/status/user-offline.png b/data/icons/48x48/status/user-offline.png Binary files differdeleted file mode 100644 index b65080b..0000000 --- a/data/icons/48x48/status/user-offline.png +++ /dev/null diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am index 7c42753..7394c73 100644 --- a/data/icons/Makefile.am +++ b/data/icons/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = scalable 16x16 22x22 24x24 32x32 48x48 +SUBDIRS = scalable 16x16 22x22 24x24 32x32 gtk_update_icon_cache = gtk-update-icon-cache -f -t $(INDICATORICONSDIR)/hicolor diff --git a/data/icons/scalable/Makefile.am b/data/icons/scalable/Makefile.am index 4810a68..0224d45 100644 --- a/data/icons/scalable/Makefile.am +++ b/data/icons/scalable/Makefile.am @@ -1 +1 @@ -SUBDIRS = status actions +SUBDIRS = actions diff --git a/data/icons/scalable/status/Makefile.am b/data/icons/scalable/status/Makefile.am deleted file mode 100644 index 479ef2c..0000000 --- a/data/icons/scalable/status/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ - -iconsdir = $(INDICATORICONSDIR)/hicolor/scalable/status - -icons_DATA = \ - user-available.svg \ - user-offline.svg \ - user-away.svg \ - user-busy.svg \ - user-invisible.svg - -EXTRA_DIST = $(icons_DATA) diff --git a/data/icons/scalable/status/user-available.svg b/data/icons/scalable/status/user-available.svg deleted file mode 100644 index 8d4cc58..0000000 --- a/data/icons/scalable/status/user-available.svg +++ /dev/null @@ -1,104 +0,0 @@ -<?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://web.resource.org/cc/" - 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" - width="16px" - height="16px" - id="svg4908" - sodipodi:version="0.32" - inkscape:version="0.44+devel" - sodipodi:docbase="/home/andreas/project/gossip/16x16" - sodipodi:docname="status-avaible.svg" - inkscape:output_extension="org.inkscape.output.svg.inkscape" - inkscape:export-filename="/home/andreas/project/gossip/16x16/status-avaible.png" - inkscape:export-xdpi="90" - inkscape:export-ydpi="90" - sodipodi:modified="true"> - <defs - id="defs4910"> - <linearGradient - inkscape:collect="always" - id="linearGradient5899"> - <stop - style="stop-color:#7fe719;stop-opacity:1" - offset="0" - id="stop5901" /> - <stop - style="stop-color:#67bc13;stop-opacity:1" - offset="1" - id="stop5903" /> - </linearGradient> - <radialGradient - inkscape:collect="always" - xlink:href="#linearGradient5899" - id="radialGradient5905" - cx="9.466115" - cy="8.9839392" - fx="9.466115" - fy="8.9839392" - r="6.7474474" - gradientTransform="matrix(1.1671849,-3.2679277e-3,2.7524467e-3,1.0150183,-1.6222549,-0.2024225)" - gradientUnits="userSpaceOnUse" /> - </defs> - <sodipodi:namedview - id="base" - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1.0" - inkscape:pageopacity="0.0" - inkscape:pageshadow="2" - inkscape:zoom="22.197802" - inkscape:cx="14.452639" - inkscape:cy="6.4458104" - inkscape:current-layer="layer1" - showgrid="false" - inkscape:grid-bbox="true" - inkscape:document-units="px" - inkscape:window-width="1674" - inkscape:window-height="969" - inkscape:window-x="0" - inkscape:window-y="26" /> - <metadata - id="metadata4913"> - <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> - <g - id="layer1" - inkscape:label="Layer 1" - inkscape:groupmode="layer"> - <path - sodipodi:type="arc" - style="opacity:1;fill:url(#radialGradient5905);fill-opacity:1;stroke:#376e01;stroke-width:0.97113216;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - id="path4926" - sodipodi:cx="7.9737625" - sodipodi:cy="7.7221532" - sodipodi:rx="6.2618814" - sodipodi:ry="6.3632426" - d="M 14.235644 7.7221532 A 6.2618814 6.3632426 0 1 1 1.7118812,7.7221532 A 6.2618814 6.3632426 0 1 1 14.235644 7.7221532 z" - transform="matrix(1.0380267,0,0,1.0214918,-0.2769783,0.1118841)" /> - <path - sodipodi:type="arc" - style="opacity:0.4;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1.14770162;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - id="path5897" - sodipodi:cx="7.9737625" - sodipodi:cy="7.7221532" - sodipodi:rx="6.2618814" - sodipodi:ry="6.3632426" - d="M 14.235644 7.7221532 A 6.2618814 6.3632426 0 1 1 1.7118812,7.7221532 A 6.2618814 6.3632426 0 1 1 14.235644 7.7221532 z" - transform="matrix(0.8783303,0,0,0.8643392,0.996403,1.3254404)" /> - </g> -</svg> diff --git a/data/icons/scalable/status/user-away.svg b/data/icons/scalable/status/user-away.svg deleted file mode 100644 index 7e7b0ed..0000000 --- a/data/icons/scalable/status/user-away.svg +++ /dev/null @@ -1,93 +0,0 @@ -<?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://web.resource.org/cc/" - 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" - width="16px" - height="16px" - id="svg4908" - sodipodi:version="0.32" - inkscape:version="0.44+devel" - sodipodi:docbase="/home/andreas/project/gossip/16x16" - sodipodi:docname="status-away.svg" - inkscape:output_extension="org.inkscape.output.svg.inkscape" - inkscape:export-filename="/home/andreas/project/gossip/16x16/status-away.png" - inkscape:export-xdpi="90" - inkscape:export-ydpi="90" - sodipodi:modified="true"> - <defs - id="defs4910"> - <linearGradient - inkscape:collect="always" - id="linearGradient5917"> - <stop - style="stop-color:#f80000;stop-opacity:1" - offset="0" - id="stop5919" /> - <stop - style="stop-color:#e70000;stop-opacity:1" - offset="1" - id="stop5921" /> - </linearGradient> - <linearGradient - inkscape:collect="always" - xlink:href="#linearGradient5917" - id="linearGradient5923" - x1="6.5096536" - y1="8.5893564" - x2="9.9108915" - y2="11.540099" - gradientUnits="userSpaceOnUse" - gradientTransform="matrix(1,0,0,0.9925682,6.043956e-8,1.1147803e-2)" /> - </defs> - <sodipodi:namedview - id="base" - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1.0" - inkscape:pageopacity="0.0" - inkscape:pageshadow="2" - inkscape:zoom="22.627417" - inkscape:cx="13.206814" - inkscape:cy="4.0564985" - inkscape:current-layer="layer1" - showgrid="false" - inkscape:grid-bbox="true" - inkscape:document-units="px" - inkscape:window-width="1674" - inkscape:window-height="969" - inkscape:window-x="0" - inkscape:window-y="26" /> - <metadata - id="metadata4913"> - <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> - <g - id="layer1" - inkscape:label="Layer 1" - inkscape:groupmode="layer"> - <path - style="fill:url(#linearGradient5923);fill-opacity:1;fill-rule:evenodd;stroke:#8a0000;stroke-width:0.99999988px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" - d="M 1.5,13.5 L 14.499999,13.5 L 7.9789933,1.4999999 L 1.5,13.5 z " - id="path4944" - sodipodi:nodetypes="cccc" /> - <path - style="opacity:0.3;fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - d="M 3.2186016,12.488535 L 12.832121,12.488535 L 8.0098272,3.5671249 L 3.2186016,12.488535 z " - id="path4946" - sodipodi:nodetypes="cccc" /> - </g> -</svg> diff --git a/data/icons/scalable/status/user-busy.svg b/data/icons/scalable/status/user-busy.svg deleted file mode 100644 index 66fc709..0000000 --- a/data/icons/scalable/status/user-busy.svg +++ /dev/null @@ -1,140 +0,0 @@ -<?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://web.resource.org/cc/" - 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" - width="16px" - height="16px" - id="svg6941" - sodipodi:version="0.32" - inkscape:version="0.44+devel" - sodipodi:docbase="/home/andreas/project/gossip/16x16" - sodipodi:docname="status-busy.svg" - inkscape:output_extension="org.inkscape.output.svg.inkscape" - inkscape:export-filename="/home/andreas/project/gossip/16x16/status-busy.png" - inkscape:export-xdpi="90" - inkscape:export-ydpi="90" - sodipodi:modified="true"> - <defs - id="defs6943"> - <linearGradient - inkscape:collect="always" - id="linearGradient5899"> - <stop - style="stop-color:#fce94f;stop-opacity:1" - offset="0" - id="stop5901" /> - <stop - style="stop-color:#edd400;stop-opacity:1" - offset="1" - id="stop5903" /> - </linearGradient> - <radialGradient - inkscape:collect="always" - xlink:href="#linearGradient5899" - id="radialGradient5905" - cx="9.466115" - cy="8.9839392" - fx="9.466115" - fy="8.9839392" - r="6.7474474" - gradientTransform="matrix(1.1671849,-3.2679277e-3,2.7524467e-3,1.0150183,-1.6222549,-0.2024225)" - gradientUnits="userSpaceOnUse" /> - </defs> - <sodipodi:namedview - id="base" - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1.0" - inkscape:pageopacity="0.0" - inkscape:pageshadow="2" - inkscape:zoom="15.696217" - inkscape:cx="17.665904" - inkscape:cy="9.7718474" - inkscape:current-layer="layer1" - showgrid="false" - inkscape:grid-bbox="true" - inkscape:document-units="px" - inkscape:window-width="1674" - inkscape:window-height="969" - inkscape:window-x="0" - inkscape:window-y="26" /> - <metadata - id="metadata6946"> - <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> - <g - id="layer1" - inkscape:label="Layer 1" - inkscape:groupmode="layer"> - <path - sodipodi:type="arc" - style="opacity:1;fill:url(#radialGradient5905);fill-opacity:1;stroke:#8d7300;stroke-width:0.97113222;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - id="path4926" - sodipodi:cx="7.9737625" - sodipodi:cy="7.7221532" - sodipodi:rx="6.2618814" - sodipodi:ry="6.3632426" - d="M 14.235644 7.7221532 A 6.2618814 6.3632426 0 1 1 1.7118812,7.7221532 A 6.2618814 6.3632426 0 1 1 14.235644 7.7221532 z" - transform="matrix(1.0380267,0,0,1.0214918,-0.2769782,0.1118841)" /> - <path - sodipodi:type="arc" - style="opacity:0.6;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1.14770162;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - id="path5897" - sodipodi:cx="7.9737625" - sodipodi:cy="7.7221532" - sodipodi:rx="6.2618814" - sodipodi:ry="6.3632426" - d="M 14.235644 7.7221532 A 6.2618814 6.3632426 0 1 1 1.7118812,7.7221532 A 6.2618814 6.3632426 0 1 1 14.235644 7.7221532 z" - transform="matrix(0.8783303,0,0,0.8643392,0.996403,1.3254404)" /> - <rect - style="opacity:1;fill:#eeeeec;fill-opacity:1;stroke:#888a85;stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - id="rect5886" - width="9.000001" - height="9" - x="5.5" - y="5.5" - rx="0" - ry="0" /> - <rect - style="opacity:1;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - id="rect5969" - width="7" - height="7" - x="6.5" - y="6.5" - rx="0" - ry="0" /> - <path - sodipodi:type="arc" - style="opacity:1;fill:#8d7300;fill-opacity:1;stroke:none;stroke-width:1.46393549;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - id="path5888" - sodipodi:cx="10.676733" - sodipodi:cy="7.8460393" - sodipodi:rx="1.4415842" - sodipodi:ry="1.4866337" - d="M 12.118317 7.8460393 A 1.4415842 1.4866337 0 1 1 9.2351488,7.8460393 A 1.4415842 1.4866337 0 1 1 12.118317 7.8460393 z" - transform="matrix(0.6936814,0,0,0.6726606,2.5937487,2.7222784)" /> - <path - style="fill:none;fill-rule:evenodd;stroke:#888a85;stroke-width:0.99999994px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" - d="M 7.4772272,10.5 L 11.522773,10.5" - id="path5883" /> - <path - style="fill:none;fill-rule:evenodd;stroke:#888a85;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" - d="M 7.4872926,12.5 L 11.524094,12.5" - id="path5885" /> - </g> -</svg> diff --git a/data/icons/scalable/status/user-invisible.svg b/data/icons/scalable/status/user-invisible.svg deleted file mode 100644 index 1775d92..0000000 --- a/data/icons/scalable/status/user-invisible.svg +++ /dev/null @@ -1,78 +0,0 @@ -<?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:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="16px" - height="16px" - id="svg4908" - sodipodi:version="0.32" - inkscape:version="0.46" - sodipodi:docbase="/home/andreas/project/gossip/16x16" - sodipodi:docname="user-invisible.svg" - inkscape:output_extension="org.inkscape.output.svg.inkscape" - inkscape:export-filename="/Users/kwwii/Desktop/user-invisible.png" - inkscape:export-xdpi="270" - inkscape:export-ydpi="270" - sodipodi:modified="true"> - <defs - id="defs4910" /> - <sodipodi:namedview - id="base" - pagecolor="#efebe7" - bordercolor="#666666" - borderopacity="1.0" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:zoom="49.332695" - inkscape:cx="8.0156251" - inkscape:cy="8.0034278" - inkscape:current-layer="layer1" - showgrid="false" - inkscape:grid-bbox="true" - inkscape:document-units="px" - inkscape:window-width="1343" - inkscape:window-height="894" - inkscape:window-x="18" - inkscape:window-y="36" - gridtolerance="10000"> - <inkscape:grid - type="xygrid" - id="grid2386" - visible="true" - enabled="true" /> - </sodipodi:namedview> - <metadata - id="metadata4913"> - <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> - <g - id="layer1" - inkscape:label="Layer 1" - inkscape:groupmode="layer"> - <path - style="opacity:0.6;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" - d="M 8,2 L 2,7 L 4,14 L 12,14 L 14,7 L 8,2 z M 8.03125,3.28125 L 12.875,7.34375 L 11.28125,13 L 4.75,13 L 3.15625,7.34375 L 8.03125,3.28125 z" - id="path3169" /> - <path - style="fill:#555753;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;stroke-miterlimit:4;stroke-dasharray:1, 24;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" - d="M 7.90625 1 C 7.7115832 1.0193883 7.5268771 1.0954437 7.375 1.21875 L 1.375 6.21875 C 1.0663414 6.4776493 0.94315913 6.8964687 1.0625 7.28125 L 3.0625 14.28125 C 3.1850026 14.699518 3.5642702 14.99029 4 15 L 12 15 C 12.447322 15.004039 12.842922 14.710529 12.96875 14.28125 L 14.96875 7.28125 C 15.088091 6.8964689 14.964909 6.4776491 14.65625 6.21875 L 8.65625 1.21875 C 8.4462475 1.047164 8.1755683 0.96821579 7.90625 1 z M 8 2 L 14 7 L 12 14 L 4 14 L 2 7 L 8 2 z " - id="path2388" /> - <path - style="opacity:0.38251367;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" - d="M 8,2 L 14,7 L 12,14 L 4,14 L 2,7 L 8,2 z" - id="path3182" /> - </g> -</svg> diff --git a/data/icons/scalable/status/user-offline.svg b/data/icons/scalable/status/user-offline.svg deleted file mode 100644 index 975f7dc..0000000 --- a/data/icons/scalable/status/user-offline.svg +++ /dev/null @@ -1,101 +0,0 @@ -<?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://web.resource.org/cc/" - 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" - width="16px" - height="16px" - id="svg6941" - sodipodi:version="0.32" - inkscape:version="0.44+devel" - sodipodi:docbase="/home/andreas/project/gossip/16x16" - sodipodi:docname="status-offline.svg" - inkscape:output_extension="org.inkscape.output.svg.inkscape" - inkscape:export-filename="/home/andreas/project/gossip/16x16/status-offline.png" - inkscape:export-xdpi="90" - inkscape:export-ydpi="90" - sodipodi:modified="true"> - <defs - id="defs6943"> - <linearGradient - inkscape:collect="always" - id="linearGradient7922"> - <stop - style="stop-color:#e8e8e6;stop-opacity:1" - offset="0" - id="stop7924" /> - <stop - style="stop-color:#babdb6;stop-opacity:1" - offset="1" - id="stop7926" /> - </linearGradient> - <linearGradient - inkscape:collect="always" - xlink:href="#linearGradient7922" - id="linearGradient7928" - x1="0.67574239" - y1="0.81831664" - x2="9.8658419" - y2="10.594059" - gradientUnits="userSpaceOnUse" - gradientTransform="matrix(0.8666667,0,0,0.8666667,1.0666667,1.0666666)" /> - </defs> - <sodipodi:namedview - id="base" - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1.0" - inkscape:pageopacity="0.0" - inkscape:pageshadow="2" - inkscape:zoom="22.197802" - inkscape:cx="15.038145" - inkscape:cy="7.8865336" - inkscape:current-layer="layer1" - showgrid="false" - inkscape:grid-bbox="true" - inkscape:document-units="px" - inkscape:window-width="1674" - inkscape:window-height="969" - inkscape:window-x="0" - inkscape:window-y="26" /> - <metadata - id="metadata6946"> - <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> - <g - id="layer1" - inkscape:label="Layer 1" - inkscape:groupmode="layer"> - <rect - style="opacity:1;fill:url(#linearGradient7928);fill-opacity:1;stroke:#555753;stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - id="rect6949" - width="13" - height="13" - x="1.5" - y="1.4999999" - rx="1.4641089" - ry="1.4641089" /> - <rect - style="opacity:0.4;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - id="rect7920" - width="11" - height="11" - x="2.5" - y="2.5" - rx="0.45049509" - ry="0.45049506" /> - </g> -</svg> diff --git a/data/indicator-status.service.in b/data/indicator-status.service.in deleted file mode 100644 index e920bf2..0000000 --- a/data/indicator-status.service.in +++ /dev/null @@ -1,3 +0,0 @@ -[D-BUS Service] -Name=org.ayatana.indicator.status -Exec=@libexecdir@/indicator-status-service diff --git a/debian/changelog b/debian/changelog index 5e3f005..59c50fc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +indicator-session (0.2.0~dev-0ubuntu1~ppa4~nostatus1) karmic; urgency=low + + * Removing status support + + -- Ted Gould <ted@ubuntu.com> Sat, 02 Jan 2010 23:51:01 -0600 + indicator-session (0.2.0~dev-0ubuntu1~ppa3) karmic; urgency=low * Updating to use dbusmenu 0.2.0 diff --git a/src/Makefile.am b/src/Makefile.am index 6a5fc44..daaaf61 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS = gtk-dialog -libexec_PROGRAMS = indicator-status-service indicator-users-service indicator-session-service +libexec_PROGRAMS = indicator-users-service indicator-session-service ################### # Indicator Stuff @@ -11,41 +11,11 @@ sessionlib_LTLIBRARIES = libsession.la libsession_la_SOURCES = \ indicator-session.c \ dbus-shared-names.h \ - status-service-client.h \ users-service-client.h libsession_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror libsession_la_LIBADD = $(APPLET_LIBS) libsession_la_LDFLAGS = -module -avoid-version -################ -# Status Stuff -################ - -indicator_status_service_SOURCES = \ - status-service.c \ - status-service-dbus.h \ - status-service-dbus.c \ - status-service-server.h \ - users-service-dbus.h \ - users-service-dbus.c \ - users-service-marshal.c \ - users-service-marshal.h \ - status-provider.h \ - status-provider.c \ - status-provider-mc5.h \ - status-provider-mc5.c \ - status-provider-mc5-marshal.h \ - status-provider-mc5-marshal.c \ - status-provider-pidgin.h \ - status-provider-pidgin.c \ - status-provider-pidgin-marshal.h \ - status-provider-pidgin-marshal.c \ - status-provider-telepathy.h \ - status-provider-telepathy.c \ - status-provider-telepathy-marshal.h \ - status-provider-telepathy-marshal.c -indicator_status_service_CFLAGS = $(STATUSSERVICE_CFLAGS) -Wall -Werror -indicator_status_service_LDADD = $(STATUSSERVICE_LIBS) users-service-client.h: $(srcdir)/users-service.xml dbus-binding-tool \ @@ -54,20 +24,6 @@ users-service-client.h: $(srcdir)/users-service.xml --output=users-service-client.h \ $(srcdir)/users-service.xml -status-service-client.h: $(srcdir)/status-service.xml - dbus-binding-tool \ - --prefix=_status_service_client \ - --mode=glib-client \ - --output=status-service-client.h \ - $(srcdir)/status-service.xml - -status-service-server.h: $(srcdir)/status-service.xml - dbus-binding-tool \ - --prefix=_status_service_server \ - --mode=glib-server \ - --output=status-service-server.h \ - $(srcdir)/status-service.xml - users-service-marshal.h: $(srcdir)/users-service.list glib-genmarshal --header \ --prefix=_users_service_marshal $(srcdir)/users-service.list \ @@ -78,36 +34,6 @@ users-service-marshal.c: $(srcdir)/users-service.list --prefix=_users_service_marshal $(srcdir)/users-service.list \ > users-service-marshal.c -status-provider-pidgin-marshal.h: $(srcdir)/status-provider-pidgin.list - glib-genmarshal --header \ - --prefix=_status_provider_pidgin_marshal $(srcdir)/status-provider-pidgin.list \ - > status-provider-pidgin-marshal.h - -status-provider-pidgin-marshal.c: $(srcdir)/status-provider-pidgin.list - glib-genmarshal --body \ - --prefix=_status_provider_pidgin_marshal $(srcdir)/status-provider-pidgin.list \ - > status-provider-pidgin-marshal.c - -status-provider-telepathy-marshal.h: $(srcdir)/status-provider-telepathy.list - glib-genmarshal --header \ - --prefix=_status_provider_telepathy_marshal $(srcdir)/status-provider-telepathy.list \ - > status-provider-telepathy-marshal.h - -status-provider-telepathy-marshal.c: $(srcdir)/status-provider-telepathy.list - glib-genmarshal --body \ - --prefix=_status_provider_telepathy_marshal $(srcdir)/status-provider-telepathy.list \ - > status-provider-telepathy-marshal.c - -status-provider-mc5-marshal.h: $(srcdir)/status-provider-mc5.list - glib-genmarshal --header \ - --prefix=_status_provider_mc5_marshal $(srcdir)/status-provider-mc5.list \ - > status-provider-mc5-marshal.h - -status-provider-mc5-marshal.c: $(srcdir)/status-provider-mc5.list - glib-genmarshal --body \ - --prefix=_status_provider_mc5_marshal $(srcdir)/status-provider-mc5.list \ - > status-provider-mc5-marshal.c - ############### # Users Stuff ############### @@ -139,22 +65,10 @@ indicator_session_service_LDADD = $(SESSIONSERVICE_LIBS) $(GCONF_LIBS) BUILT_SOURCES = \ users-service-client.h \ - status-service-client.h \ - status-service-server.h \ - status-provider-mc5-marshal.h \ - status-provider-mc5-marshal.c \ users-service-marshal.h \ - users-service-marshal.c \ - status-provider-pidgin-marshal.h \ - status-provider-pidgin-marshal.c \ - status-provider-telepathy-marshal.h \ - status-provider-telepathy-marshal.c + users-service-marshal.c EXTRA_DIST = \ - status-service.xml \ - status-provider-mc5.list \ - status-provider-pidgin.list \ - status-provider-telepathy.list \ users-service.xml \ users-service.list diff --git a/src/dbus-shared-names.h b/src/dbus-shared-names.h index 7e7d456..1fd256f 100644 --- a/src/dbus-shared-names.h +++ b/src/dbus-shared-names.h @@ -36,5 +36,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #define INDICATOR_SESSION_DBUS_NAME "org.ayatana.indicator.session" #define INDICATOR_SESSION_DBUS_OBJECT "/org/ayatana/indicator/session/menu" +#define INDICATOR_SESSION_DBUS_VERSION 0 #endif /* __DBUS_SHARED_NAMES_H__ */ diff --git a/src/indicator-session.c b/src/indicator-session.c index 410ad12..dda8c76 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -23,16 +23,16 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <glib.h> #include <glib-object.h> #include <gtk/gtk.h> -#include <libdbusmenu-gtk/client.h> +#include <libdbusmenu-gtk/menu.h> #include <dbus/dbus-glib.h> #include <dbus/dbus-glib-bindings.h> #include <libindicator/indicator.h> #include <libindicator/indicator-object.h> +#include <libindicator/indicator-service-manager.h> #include "dbus-shared-names.h" -#include "status-service-client.h" #define INDICATOR_SESSION_TYPE (indicator_session_get_type ()) #define INDICATOR_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_SESSION_TYPE, IndicatorSession)) @@ -50,6 +50,7 @@ struct _IndicatorSessionClass { struct _IndicatorSession { IndicatorObject parent; + IndicatorServiceManager * service; }; GType indicator_session_get_type (void); @@ -58,38 +59,7 @@ GType indicator_session_get_type (void); INDICATOR_SET_VERSION INDICATOR_SET_TYPE(INDICATOR_SESSION_TYPE) -/* Globals */ -static DbusmenuGtkClient * status_client = NULL; -static DbusmenuGtkClient * users_client = NULL; -static DbusmenuGtkClient * session_client = NULL; - -static GtkMenu * main_menu = NULL; -static GtkImage * status_image = NULL; - -static GtkWidget * status_separator = NULL; -static GtkWidget * users_separator = NULL; -#define SEPARATOR_SHOWN(sep) (sep != NULL && GTK_WIDGET_VISIBLE(sep)) -static GtkWidget * loading_item = NULL; - -static DBusGConnection * connection = NULL; -static DBusGProxy * proxy = NULL; -static DBusGProxy * status_proxy = NULL; - -typedef enum { - STATUS_SECTION, - USERS_SECTION, - SESSION_SECTION, - END_OF_SECTIONS -} section_t; - /* Prototypes */ -static void child_added (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint position, gpointer section); -static guint status_menu_pos_offset (void); -static guint users_menu_pos_offset (void); -static guint session_menu_pos_offset (void); -static void child_realized (DbusmenuMenuitem * child, gpointer userdata); -static gboolean start_service (gpointer userdata); -static void start_service_phase2 (DBusGProxy * proxy, guint status, GError * error, gpointer data); static GtkLabel * get_label (IndicatorObject * io); static GtkImage * get_icon (IndicatorObject * io); static GtkMenu * get_menu (IndicatorObject * io); @@ -120,6 +90,11 @@ indicator_session_class_init (IndicatorSessionClass *klass) static void indicator_session_init (IndicatorSession *self) { + /* Set good defaults */ + self->service = NULL; + + /* Now let's fire these guys up. */ + self->service = indicator_service_manager_new_version(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_VERSION); return; } @@ -127,6 +102,12 @@ indicator_session_init (IndicatorSession *self) static void indicator_session_dispose (GObject *object) { + IndicatorSession * self = INDICATOR_SESSION(object); + + if (self->service != NULL) { + g_object_unref(G_OBJECT(self->service)); + self->service = NULL; + } G_OBJECT_CLASS (indicator_session_parent_class)->dispose (object); return; @@ -143,500 +124,24 @@ indicator_session_finalize (GObject *object) static GtkLabel * get_label (IndicatorObject * io) { - GtkLabel * returnval = GTK_LABEL(gtk_label_new(g_get_user_name())); - gtk_widget_show(GTK_WIDGET(returnval)); - return returnval; + return NULL; } static GtkImage * get_icon (IndicatorObject * io) { - g_debug("Changing status icon: '%s'", "system-shutdown-panel"); - status_image = GTK_IMAGE(gtk_image_new_from_icon_name("system-shutdown-panel", GTK_ICON_SIZE_MENU)); + GtkImage * status_image = GTK_IMAGE(gtk_image_new_from_icon_name("system-shutdown-panel", GTK_ICON_SIZE_MENU)); gtk_widget_show(GTK_WIDGET(status_image)); return status_image; } -typedef struct _realized_data_t realized_data_t; -struct _realized_data_t { - section_t section; -}; - -static void -resort_menu (void) -{ - guint location = 0; - guint clientnum; - - for (clientnum = 0; clientnum < 3; clientnum++) { - DbusmenuGtkClient * client = NULL; - if (clientnum == 0) client = status_client; - if (clientnum == 1) client = users_client; - if (clientnum == 2) client = session_client; - - if (client == NULL) continue; - - DbusmenuMenuitem * root = dbusmenu_client_get_root(DBUSMENU_CLIENT(client)); - - GList * children = dbusmenu_menuitem_get_children(root); - if (children == NULL) { - continue; - } - - GList * child; - for (child = children; child != NULL; child = g_list_next(child)) { - GtkMenuItem * widget = dbusmenu_gtkclient_menuitem_get(client, DBUSMENU_MENUITEM(child->data)); - if (widget != NULL) { - gtk_menu_reorder_child(main_menu, GTK_WIDGET(widget), location); - location++; - } - } - - if (clientnum == 0) { - gtk_menu_reorder_child(main_menu, status_separator, location); - location++; - } - if (clientnum == 1) { - gtk_menu_reorder_child(main_menu, users_separator, location); - location++; - } - } - - return; -} - -static void -child_added (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint position, gpointer section) -{ - realized_data_t * data = g_new0(realized_data_t, 1); - if (data == NULL) { - g_warning("Unable to allocate data for realization of item"); - return; - } - - data->section = GPOINTER_TO_UINT(section); - - g_signal_connect(G_OBJECT(child), DBUSMENU_MENUITEM_SIGNAL_REALIZED, G_CALLBACK(child_realized), data); - return; -} - -static void -child_realized (DbusmenuMenuitem * child, gpointer userdata) -{ - g_return_if_fail(userdata != NULL); - g_return_if_fail(DBUSMENU_IS_MENUITEM(child)); - - realized_data_t * data = (realized_data_t *)userdata; - section_t section = data->section; - g_free(data); - - DbusmenuGtkClient * client = NULL; - gchar * errorstr = NULL; - guint (*posfunc) (void) = NULL; - - switch (section) { - case STATUS_SECTION: - client = status_client; - errorstr = "Status"; - posfunc = status_menu_pos_offset; - break; - case USERS_SECTION: - client = users_client; - errorstr = "Users"; - posfunc = users_menu_pos_offset; - break; - case SESSION_SECTION: - client = session_client; - errorstr = "Session"; - posfunc = session_menu_pos_offset; - break; - default: - g_warning("Child Added called with an unknown position function!"); - return; - } - - if (client == NULL) { - g_warning("Child realized for a menu we don't have? Section: %s", errorstr); - return; - } - - GtkMenuItem * widget = dbusmenu_gtkclient_menuitem_get(client, child); - - if (widget == NULL) { - g_warning("Had a menu item added to the %s menu, but yet it didn't have a GtkWidget with it. Can't add that to a menu now can we? You need to figure this @#$# out!", errorstr); - return; - } - - gtk_menu_append(main_menu, GTK_WIDGET(widget)); - gtk_widget_show(GTK_WIDGET(widget)); - - resort_menu(); - - gtk_widget_hide(loading_item); - - return; -} - -static void -child_moved (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint newpos, guint oldpos, guint (*posfunc) (void)) -{ - - -} - - -/* Status Menu */ -static guint -status_menu_pos_offset (void) -{ - return 0; -} - -static void -status_menu_added (DbusmenuMenuitem * root, DbusmenuMenuitem * child, guint position, gpointer user_data) -{ - gtk_widget_show(GTK_WIDGET(status_separator)); - return; -} - -static void -status_menu_removed (DbusmenuMenuitem * root, DbusmenuMenuitem * child, gpointer user_data) -{ - if (g_list_length(dbusmenu_menuitem_get_children(root)) == 0) { - gtk_widget_hide(GTK_WIDGET(status_separator)); - } - - return; -} - -static void -status_menu_root_changed(DbusmenuGtkClient * client, DbusmenuMenuitem * newroot, GtkMenu * main) -{ - if (newroot == NULL) { - gtk_widget_hide(GTK_WIDGET(status_separator)); - return; - } - - g_signal_connect(G_OBJECT(newroot), DBUSMENU_MENUITEM_SIGNAL_CHILD_ADDED, G_CALLBACK(child_added), GUINT_TO_POINTER(STATUS_SECTION)); - g_signal_connect(G_OBJECT(newroot), DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED, G_CALLBACK(status_menu_added), NULL); - g_signal_connect(G_OBJECT(newroot), DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED, G_CALLBACK(status_menu_removed), NULL); - g_signal_connect(G_OBJECT(newroot), DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED, G_CALLBACK(child_moved), GUINT_TO_POINTER(STATUS_SECTION)); - - GList * child = NULL; - guint count = 0; - for (child = dbusmenu_menuitem_get_children(newroot); child != NULL; child = g_list_next(child), count++) { - child_added(newroot, DBUSMENU_MENUITEM(child->data), count, GUINT_TO_POINTER(STATUS_SECTION)); - } - - if (count > 0) { - gtk_widget_show(GTK_WIDGET(status_separator)); - } - - return; -} - -static void -status_icon_cb (DBusGProxy * proxy, char * icons, GError *error, gpointer userdata) -{ - g_return_if_fail(status_image != NULL); - g_return_if_fail(icons != NULL); - g_return_if_fail(icons[0] != '\0'); - - g_debug("Changing status icon: '%s'", icons); - gtk_image_set_from_icon_name(status_image, icons, GTK_ICON_SIZE_MENU); - - return; -} - -static void -status_icon_changed (DBusGProxy * proxy, gchar * icon, gpointer userdata) -{ - return status_icon_cb(proxy, icon, NULL, NULL); -} - - -static gboolean -connect_to_status (gpointer userdata) -{ - if (status_proxy == NULL) { - GError * error = NULL; - - DBusGConnection * sbus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - - status_proxy = dbus_g_proxy_new_for_name_owner(sbus, - INDICATOR_STATUS_DBUS_NAME, - INDICATOR_STATUS_SERVICE_DBUS_OBJECT, - INDICATOR_STATUS_SERVICE_DBUS_INTERFACE, - &error); - - if (error != NULL) { - g_warning("Unable to get status proxy: %s", error->message); - g_error_free(error); - return FALSE; - } - - dbus_g_proxy_add_signal(status_proxy, "StatusIconsChanged", G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(status_proxy, "StatusIconsChanged", G_CALLBACK(status_icon_changed), NULL, NULL); - } - - org_ayatana_indicator_status_service_status_icons_async(status_proxy, status_icon_cb, NULL); - - return FALSE; -} - -/* Follow up the service being started by connecting - up the DBus Menu Client and creating our separator. - Also creates an idle func to connect to the service for - getting the icon that we should be using on the panel. */ -static void -status_followup (void) -{ - status_client = dbusmenu_gtkclient_new(INDICATOR_STATUS_DBUS_NAME, INDICATOR_STATUS_DBUS_OBJECT); - g_signal_connect(G_OBJECT(status_client), DBUSMENU_GTKCLIENT_SIGNAL_ROOT_CHANGED, G_CALLBACK(status_menu_root_changed), main_menu); - - status_separator = gtk_separator_menu_item_new(); - gtk_menu_shell_append(GTK_MENU_SHELL(main_menu), status_separator); - gtk_widget_hide(status_separator); /* Should be default, I'm just being explicit. $(%*#$ hide already! */ - - g_idle_add(connect_to_status, NULL); - - return; -} - -/* Users menu */ - -static guint -users_menu_pos_offset (void) -{ - guint position = 0; - if (SEPARATOR_SHOWN(status_separator)) { - GList * location = g_list_find(GTK_MENU_SHELL(main_menu)->children, status_separator); - position = g_list_position(GTK_MENU_SHELL(main_menu)->children, location) + 1; - } - - return position; -} - -static void -users_menu_added (DbusmenuMenuitem * root, DbusmenuMenuitem * child, guint position, gpointer user_data) -{ - gtk_widget_show(GTK_WIDGET(users_separator)); - return; -} - -static void -users_menu_removed (DbusmenuMenuitem * root, DbusmenuMenuitem * child, gpointer user_data) -{ - if (g_list_length(dbusmenu_menuitem_get_children(root)) == 0) { - gtk_widget_hide(GTK_WIDGET(users_separator)); - } - - return; -} - -static void -users_menu_root_changed(DbusmenuGtkClient * client, DbusmenuMenuitem * newroot, GtkMenu * main) -{ - if (newroot == NULL) { - gtk_widget_hide(GTK_WIDGET(users_separator)); - return; - } - - g_signal_connect(G_OBJECT(newroot), DBUSMENU_MENUITEM_SIGNAL_CHILD_ADDED, G_CALLBACK(child_added), GUINT_TO_POINTER(USERS_SECTION)); - g_signal_connect(G_OBJECT(newroot), DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED, G_CALLBACK(users_menu_added), NULL); - g_signal_connect(G_OBJECT(newroot), DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED, G_CALLBACK(users_menu_removed), NULL); - g_signal_connect(G_OBJECT(newroot), DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED, G_CALLBACK(child_moved), GUINT_TO_POINTER(USERS_SECTION)); - - GList * child = NULL; - guint count = 0; - for (child = dbusmenu_menuitem_get_children(newroot); child != NULL; child = g_list_next(child), count++) { - child_added(newroot, DBUSMENU_MENUITEM(child->data), count, GUINT_TO_POINTER(USERS_SECTION)); - } - - if (count > 0) { - gtk_widget_show(GTK_WIDGET(users_separator)); - } - - return; -} - -/* Follow up the service being started by connecting - up the DBus Menu Client and creating our separator. */ -static void -users_followup (void) -{ - users_client = dbusmenu_gtkclient_new(INDICATOR_USERS_DBUS_NAME, INDICATOR_USERS_DBUS_OBJECT); - g_signal_connect(G_OBJECT(users_client), DBUSMENU_GTKCLIENT_SIGNAL_ROOT_CHANGED, G_CALLBACK(users_menu_root_changed), main_menu); - - users_separator = gtk_separator_menu_item_new(); - gtk_menu_shell_append(GTK_MENU_SHELL(main_menu), users_separator); - gtk_widget_hide(users_separator); /* Should be default, I'm just being explicit. $(%*#$ hide already! */ - - return; -} - -/* Session Menu Stuff */ - -static guint -session_menu_pos_offset (void) -{ - guint position = 0; - if (SEPARATOR_SHOWN(users_separator)) { - GList * location = g_list_find(GTK_MENU_SHELL(main_menu)->children, users_separator); - position = g_list_position(GTK_MENU_SHELL(main_menu)->children, location) + 1; - } else if (SEPARATOR_SHOWN(status_separator)) { - GList * location = g_list_find(GTK_MENU_SHELL(main_menu)->children, status_separator); - position = g_list_position(GTK_MENU_SHELL(main_menu)->children, location) + 1; - } - - return position; -} - -static void -session_menu_removed (DbusmenuMenuitem * root, DbusmenuMenuitem * child, gpointer user_data) -{ - return; -} - -static void -session_menu_root_changed(DbusmenuGtkClient * client, DbusmenuMenuitem * newroot, GtkMenu * main) -{ - if (newroot == NULL) { - /* We're assuming this'll crash the least so it doesn't - hide a separator. May be a bad choice. */ - return; - } - - g_signal_connect(G_OBJECT(newroot), DBUSMENU_MENUITEM_SIGNAL_CHILD_ADDED, G_CALLBACK(child_added), GUINT_TO_POINTER(SESSION_SECTION)); - g_signal_connect(G_OBJECT(newroot), DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED, G_CALLBACK(session_menu_removed), NULL); - g_signal_connect(G_OBJECT(newroot), DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED, G_CALLBACK(child_moved), GUINT_TO_POINTER(SESSION_SECTION)); - - GList * child = NULL; - guint count = 0; - for (child = dbusmenu_menuitem_get_children(newroot); child != NULL; child = g_list_next(child), count++) { - child_added(newroot, DBUSMENU_MENUITEM(child->data), count, GUINT_TO_POINTER(SESSION_SECTION)); - } - - return; -} - -/* Follow up the service being started by connecting - up the DBus Menu Client. */ -static void -session_followup (void) -{ - session_client = dbusmenu_gtkclient_new(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_OBJECT); - g_signal_connect(G_OBJECT(session_client), DBUSMENU_GTKCLIENT_SIGNAL_ROOT_CHANGED, G_CALLBACK(session_menu_root_changed), main_menu); - - return; -} - -/* Base menu stuff */ - -/* This takes the response to the service starting up. - It checks to see if it's started and if so, continues - with the follow function for the particular area that - it's working in. */ -static void -start_service_phase2 (DBusGProxy * proxy, guint status, GError * error, gpointer data) -{ - /* If we've got an error respond to it */ - if (error != NULL) { - g_critical("Starting service has resulted in error."); - g_error_free(error); - /* Try it all again, we need to get this started! */ - g_idle_add(start_service, data); - return; - } - - /* If it's not running or we started it, try again */ - if (status != DBUS_START_REPLY_SUCCESS && status != DBUS_START_REPLY_ALREADY_RUNNING) { - g_critical("Return value isn't indicative of success: %d", status); - /* Try it all again, we need to get this started! */ - g_idle_add(start_service, data); - return; - } - - /* Check which part of the menu we're in and do the - appropriate follow up from the service being started. */ - switch (GPOINTER_TO_INT(data)) { - case STATUS_SECTION: - status_followup(); - break; - case USERS_SECTION: - users_followup(); - break; - case SESSION_SECTION: - session_followup(); - break; - default: - g_critical("Oh, how can we get a value that we don't know!"); - break; - } - - return; -} - -/* Our idle service starter. It looks at the section that - we're doing and then asks async for that service to be - started by dbus. Probably not really useful to be in - the idle loop as it's so quick, but why not. */ -static gboolean -start_service (gpointer userdata) -{ - g_debug("Starting a service"); - - if (proxy == NULL) { - /* If we don't have DBus, let's stay in the idle loop */ - return TRUE; - } - - const gchar * service = NULL; - switch (GPOINTER_TO_INT(userdata)) { - case STATUS_SECTION: - service = INDICATOR_STATUS_DBUS_NAME; - break; - case USERS_SECTION: - service = INDICATOR_USERS_DBUS_NAME; - break; - case SESSION_SECTION: - service = INDICATOR_SESSION_DBUS_NAME; - break; - default: - g_critical("Oh, how can we get a value that we don't know!"); - return FALSE; - } - - org_freedesktop_DBus_start_service_by_name_async (proxy, service, 0 /* Flags */, start_service_phase2, userdata); - - return FALSE; -} - /* Indicator based function to get the menu for the whole applet. This starts up asking for the parts of the menu from the various services. */ static GtkMenu * get_menu (IndicatorObject * io) { - connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - if (proxy == NULL) { - g_warning("Unable to get proxy for DBus itself. Seriously."); - } - - /* Startup in the idle loop */ - g_idle_add(start_service, GINT_TO_POINTER(STATUS_SECTION)); - g_idle_add(start_service, GINT_TO_POINTER(USERS_SECTION)); - g_idle_add(start_service, GINT_TO_POINTER(SESSION_SECTION)); - - /* Build a temp menu incase someone can ask for it - before the services start. Fast user! */ - main_menu = GTK_MENU(gtk_menu_new()); - loading_item = gtk_menu_item_new_with_label("Loading..."); - gtk_menu_shell_append(GTK_MENU_SHELL(main_menu), loading_item); - gtk_widget_show(GTK_WIDGET(loading_item)); - - return main_menu; + return GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_OBJECT)); } diff --git a/src/status-provider-mc5.c b/src/status-provider-mc5.c deleted file mode 100644 index d65a482..0000000 --- a/src/status-provider-mc5.c +++ /dev/null @@ -1,322 +0,0 @@ -/* -A small wrapper utility to load indicators and put them as menu items -into the gnome-panel using it's applet interface. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <telepathy-glib/account-manager.h> - -#include "status-provider.h" -#include "status-provider-mc5.h" -#include "status-provider-mc5-marshal.h" - -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-bindings.h> - -static gchar * sp_to_mc_map[STATUS_PROVIDER_STATUS_LAST] = { - /* STATUS_PROVIDER_STATUS_ONLINE, */ "available", - /* STATUS_PROVIDER_STATUS_AWAY, */ "away", - /* STATUS_PROVIDER_STATUS_DND */ "busy", - /* STATUS_PROVIDER_STATUS_INVISIBLE*/ "hidden", - /* STATUS_PROVIDER_STATUS_OFFLINE */ "offline", - /* STATUS_PROVIDER_STATUS_DISCONNECTED*/NULL -}; - -static TpConnectionPresenceType sp_to_tp_map[STATUS_PROVIDER_STATUS_LAST] = { - /* STATUS_PROVIDER_STATUS_ONLINE, */ TP_CONNECTION_PRESENCE_TYPE_AVAILABLE, - /* STATUS_PROVIDER_STATUS_AWAY, */ TP_CONNECTION_PRESENCE_TYPE_AWAY, - /* STATUS_PROVIDER_STATUS_DND */ TP_CONNECTION_PRESENCE_TYPE_BUSY, - /* STATUS_PROVIDER_STATUS_INVISIBLE*/ TP_CONNECTION_PRESENCE_TYPE_HIDDEN, - /* STATUS_PROVIDER_STATUS_OFFLINE */ TP_CONNECTION_PRESENCE_TYPE_OFFLINE, - /* STATUS_PROVIDER_STATUS_DISCONNECTED*/ TP_CONNECTION_PRESENCE_TYPE_UNSET -}; - -static StatusProviderStatus tp_to_sp_map[TP_CONNECTION_PRESENCE_TYPE_ERROR + 1] = { - /* TP_CONNECTION_PRESENCE_TYPE_UNSET */ STATUS_PROVIDER_STATUS_DISCONNECTED, - /* TP_CONNECTION_PRESENCE_TYPE_OFFLINE */ STATUS_PROVIDER_STATUS_OFFLINE, - /* TP_CONNECTION_PRESENCE_TYPE_AVAILABLE */ STATUS_PROVIDER_STATUS_ONLINE, - /* TP_CONNECTION_PRESENCE_TYPE_AWAY */ STATUS_PROVIDER_STATUS_AWAY, - /* TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY */ STATUS_PROVIDER_STATUS_AWAY, - /* TP_CONNECTION_PRESENCE_TYPE_HIDDEN */ STATUS_PROVIDER_STATUS_INVISIBLE, - /* TP_CONNECTION_PRESENCE_TYPE_BUSY */ STATUS_PROVIDER_STATUS_DND, - /* TP_CONNECTION_PRESENCE_TYPE_UNKNOWN */ STATUS_PROVIDER_STATUS_DISCONNECTED, - /* TP_CONNECTION_PRESENCE_TYPE_ERROR */ STATUS_PROVIDER_STATUS_DISCONNECTED -}; - -typedef struct _StatusProviderMC5Private StatusProviderMC5Private; -struct _StatusProviderMC5Private { - TpAccountManager * manager; - StatusProviderStatus status; - DBusGProxy * dbus_proxy; -}; - -#define STATUS_PROVIDER_MC5_GET_PRIVATE(o) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((o), STATUS_PROVIDER_MC5_TYPE, StatusProviderMC5Private)) -#define MC5_WELL_KNOWN_NAME "org.freedesktop.Telepathy.MissionControl5" - -/* Prototypes */ -/* GObject stuff */ -static void status_provider_mc5_class_init (StatusProviderMC5Class *klass); -static void status_provider_mc5_init (StatusProviderMC5 *self); -static void status_provider_mc5_dispose (GObject *object); -static void status_provider_mc5_finalize (GObject *object); -/* Internal Funcs */ -static void set_status (StatusProvider * sp, StatusProviderStatus status); -static StatusProviderStatus get_status (StatusProvider * sp); -static void presence_changed (TpAccountManager * eam, guint type, const gchar * type_str, const gchar * message, StatusProviderMC5 * sp); -static void dbus_namechange (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, StatusProviderMC5 * self); -static void mc5_exists_cb (DBusGProxy * proxy, gboolean exists, GError * error, gpointer userdata); - -G_DEFINE_TYPE (StatusProviderMC5, status_provider_mc5, STATUS_PROVIDER_TYPE); - -/* Create the class. We over ride a few functions but nothing - really shocking. Most interesting is the set and get status. */ -static void -status_provider_mc5_class_init (StatusProviderMC5Class *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - g_type_class_add_private (klass, sizeof (StatusProviderMC5Private)); - - object_class->dispose = status_provider_mc5_dispose; - object_class->finalize = status_provider_mc5_finalize; - - StatusProviderClass * spclass = STATUS_PROVIDER_CLASS(klass); - - spclass->set_status = set_status; - spclass->get_status = get_status; - - return; -} - -/* Build our telepathy account manager instance if we don't - have one. */ -static void -build_eam (StatusProviderMC5 * self) -{ - StatusProviderMC5Private * priv = STATUS_PROVIDER_MC5_GET_PRIVATE(self); - static TpDBusDaemon *daemon = NULL; - GError *error = NULL; - - if (priv->manager != NULL) { - return; - } - /* the daemon is used to communicate via DBus */ - daemon = tp_dbus_daemon_dup(&error); - - if (daemon == NULL) - { - g_debug("Cannot create DBus daemon: %s\n", error->message); - g_error_free(error); - return; - } - - priv->manager = TP_ACCOUNT_MANAGER (g_object_new (TP_TYPE_ACCOUNT_MANAGER, - "dbus-daemon", daemon, - "dbus-connection", ((TpProxy *) daemon)->dbus_connection, - "bus-name", "org.freedesktop.Telepathy.MissionControl5", - "object-path", "/org/freedesktop/Telepathy/AccountManager", - NULL)); - g_signal_connect(G_OBJECT(priv->manager), "most-available-presence-changed", G_CALLBACK(presence_changed), self); - - return; -} - -/* Creating an instance of the status provider. We set the variables - and create an TpAccountManager object. It does all the hard - work in this module of tracking MissionControl and enumerating the - accounts and all that jazz. */ -static void -status_provider_mc5_init (StatusProviderMC5 *self) -{ - StatusProviderMC5Private * priv = STATUS_PROVIDER_MC5_GET_PRIVATE(self); - - priv->status = STATUS_PROVIDER_STATUS_DISCONNECTED; - priv->manager = NULL; - - DBusGConnection * bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - g_return_if_fail(bus != NULL); /* Can't do anymore DBus stuff without this, - all non-DBus stuff should be done */ - - GError * error = NULL; - - /* Set up the dbus Proxy */ - priv->dbus_proxy = dbus_g_proxy_new_for_name_owner (bus, - DBUS_SERVICE_DBUS, - DBUS_PATH_DBUS, - DBUS_INTERFACE_DBUS, - &error); - if (error != NULL) { - g_warning("Unable to connect to DBus events: %s", error->message); - g_error_free(error); - return; - } - - /* Configure the name owner changing */ - dbus_g_proxy_add_signal(priv->dbus_proxy, "NameOwnerChanged", - G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_INVALID); - dbus_g_proxy_connect_signal(priv->dbus_proxy, "NameOwnerChanged", - G_CALLBACK(dbus_namechange), - self, NULL); - - org_freedesktop_DBus_name_has_owner_async(priv->dbus_proxy, MC5_WELL_KNOWN_NAME, mc5_exists_cb, self); - - return; -} - -/* Unref the account manager and move on. Sadly, we're - leaving the show. */ -static void -status_provider_mc5_dispose (GObject *object) -{ - StatusProviderMC5Private * priv = STATUS_PROVIDER_MC5_GET_PRIVATE(object); - - if (priv->manager != NULL) { - g_object_unref(priv->manager); - priv->manager = NULL; - } - - if (priv->dbus_proxy != NULL) { - g_object_unref(priv->dbus_proxy); - priv->dbus_proxy = NULL; - } - - G_OBJECT_CLASS (status_provider_mc5_parent_class)->dispose (object); - return; -} - -/* Pass to superclass */ -static void -status_provider_mc5_finalize (GObject *object) -{ - - G_OBJECT_CLASS (status_provider_mc5_parent_class)->finalize (object); - return; -} - -/* Watch for MC5 Coming on and off the bus. */ -static void -dbus_namechange (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, StatusProviderMC5 * self) -{ - /* g_debug("DBUS NAMECHANGE: %s %s %s", name, prev, new); */ - - if (prev[0] == '\0' && g_strcmp0(name, MC5_WELL_KNOWN_NAME) == 0) { - g_debug("MC5 Coming online"); - build_eam(self); - } - if (new[0] == '\0' && g_strcmp0(name, MC5_WELL_KNOWN_NAME) == 0) { - g_debug("MC5 going offline"); - StatusProviderMC5Private * priv = STATUS_PROVIDER_MC5_GET_PRIVATE(self); - if (priv->manager != NULL) { - g_object_unref(priv->manager); - priv->manager = NULL; - } - - priv->status = STATUS_PROVIDER_STATUS_DISCONNECTED; - g_signal_emit(G_OBJECT(self), STATUS_PROVIDER_SIGNAL_STATUS_CHANGED_ID, 0, priv->status, TRUE); - } - - return; -} - -/* Callback for the Dbus command to do HasOwner on - the MC5 service. If it exists, we want to have an - account manager. */ -static void -mc5_exists_cb (DBusGProxy * proxy, gboolean exists, GError * error, gpointer userdata) -{ - if (error) { - g_warning("Unable to check if MC5 is running: %s", error->message); - return; - } - - if (exists) { - build_eam(STATUS_PROVIDER_MC5(userdata)); - } - - return; -} - -/** - status_provider_mc5_new: - - Creates a new #StatusProviderMC5 object. No parameters or anything - like that. Just a convience function. - - Return value: A new instance of #StatusProviderMC5 -*/ -StatusProvider * -status_provider_mc5_new (void) -{ - return STATUS_PROVIDER(g_object_new(STATUS_PROVIDER_MC5_TYPE, NULL)); -} - -/* Setting the status in the empathy account manager. We're - basically requesting a global status. This may or may not - get applied to all accounts. It's really the best we can - hope to do. */ -static void -set_status (StatusProvider * sp, StatusProviderStatus status) -{ - StatusProviderMC5Private * priv = STATUS_PROVIDER_MC5_GET_PRIVATE(sp); - - build_eam(STATUS_PROVIDER_MC5(sp)); - tp_account_manager_set_all_requested_presences(priv->manager, sp_to_tp_map[status], sp_to_mc_map[status], ""); - - return; -} - -/* Gets the status, uses the cached value that we have. Asking - would just be painful. */ -static StatusProviderStatus -get_status (StatusProvider * sp) -{ - g_return_val_if_fail(IS_STATUS_PROVIDER_MC5(sp), STATUS_PROVIDER_STATUS_DISCONNECTED); - StatusProviderMC5Private * priv = STATUS_PROVIDER_MC5_GET_PRIVATE(sp); - - if (priv->manager == NULL) { - return STATUS_PROVIDER_STATUS_DISCONNECTED; - } - - return priv->status; -} - -/* A signal handler for when the TpAccountManager believes - that the global status has changed. It roughly calculates this - by finding the most available of all accounts that are active. */ -static void -presence_changed (TpAccountManager * eam, guint type, const gchar * type_str, const gchar * message, StatusProviderMC5 * sp) -{ - StatusProviderMC5Private * priv = STATUS_PROVIDER_MC5_GET_PRIVATE(sp); - - g_debug("MC5 Status changed: %d %s %s", type, type_str, message); - - if (priv->status != tp_to_sp_map[type]) { - priv->status = tp_to_sp_map[type]; - g_signal_emit(G_OBJECT(sp), STATUS_PROVIDER_SIGNAL_STATUS_CHANGED_ID, 0, priv->status, TRUE); - } - - return; -} - diff --git a/src/status-provider-mc5.h b/src/status-provider-mc5.h deleted file mode 100644 index 4d5659d..0000000 --- a/src/status-provider-mc5.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -A small wrapper utility to load indicators and put them as menu items -into the gnome-panel using it's applet interface. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __STATUS_PROVIDER_MC5_H__ -#define __STATUS_PROVIDER_MC5_H__ - -#include <glib.h> -#include <glib-object.h> - -#include "status-provider.h" - -G_BEGIN_DECLS - -#define STATUS_PROVIDER_MC5_TYPE (status_provider_mc5_get_type ()) -#define STATUS_PROVIDER_MC5(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STATUS_PROVIDER_MC5_TYPE, StatusProviderMC5)) -#define STATUS_PROVIDER_MC5_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STATUS_PROVIDER_MC5_TYPE, StatusProviderMC5Class)) -#define IS_STATUS_PROVIDER_MC5(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STATUS_PROVIDER_MC5_TYPE)) -#define IS_STATUS_PROVIDER_MC5_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), STATUS_PROVIDER_MC5_TYPE)) -#define STATUS_PROVIDER_MC5_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STATUS_PROVIDER_MC5_TYPE, StatusProviderMC5Class)) - - -typedef struct _StatusProviderMC5Class StatusProviderMC5Class; -struct _StatusProviderMC5Class { - StatusProviderClass parent_class; -}; - -typedef struct _StatusProviderMC5 StatusProviderMC5; -struct _StatusProviderMC5 { - StatusProvider parent; -}; - -GType status_provider_mc5_get_type (void); -StatusProvider * status_provider_mc5_new (void); - -G_END_DECLS - -#endif diff --git a/src/status-provider-mc5.list b/src/status-provider-mc5.list deleted file mode 100644 index 5ab45bf..0000000 --- a/src/status-provider-mc5.list +++ /dev/null @@ -1 +0,0 @@ -VOID:UINT,STRING diff --git a/src/status-provider-pidgin.c b/src/status-provider-pidgin.c deleted file mode 100644 index 3c0ca15..0000000 --- a/src/status-provider-pidgin.c +++ /dev/null @@ -1,431 +0,0 @@ -/* -A small wrapper utility to load indicators and put them as menu items -into the gnome-panel using it's applet interface. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "status-provider.h" -#include "status-provider-pidgin.h" -#include "status-provider-pidgin-marshal.h" - -#include <dbus/dbus-glib.h> - -typedef enum { - PG_STATUS_UNKNOWN, - PG_STATUS_OFFLINE, - PG_STATUS_AVAILABLE, - PG_STATUS_UNAVAILABLE, - PG_STATUS_INVISIBLE, - PG_STATUS_AWAY, - PG_STATUS_EXTENDEND_AWAY, - PG_STATUS_MOBILE, - PG_STATUS_TUNE -} pg_status_t; - -static const StatusProviderStatus pg_to_sp_map[] = { - /* PG_STATUS_UNKNOWN, */ STATUS_PROVIDER_STATUS_OFFLINE, - /* PG_STATUS_OFFLINE, */ STATUS_PROVIDER_STATUS_OFFLINE, - /* PG_STATUS_AVAILABLE, */ STATUS_PROVIDER_STATUS_ONLINE, - /* PG_STATUS_UNAVAILABLE, */ STATUS_PROVIDER_STATUS_DND, - /* PG_STATUS_INVISIBLE, */ STATUS_PROVIDER_STATUS_INVISIBLE, - /* PG_STATUS_AWAY, */ STATUS_PROVIDER_STATUS_AWAY, - /* PG_STATUS_EXTENDEND_AWAY, */ STATUS_PROVIDER_STATUS_AWAY, - /* PG_STATUS_MOBILE, */ STATUS_PROVIDER_STATUS_OFFLINE, - /* PG_STATUS_TUNE */ STATUS_PROVIDER_STATUS_OFFLINE -}; - -static const pg_status_t sp_to_pg_map[STATUS_PROVIDER_STATUS_LAST] = { - /* STATUS_PROVIDER_STATUS_ONLINE, */ PG_STATUS_AVAILABLE, - /* STATUS_PROVIDER_STATUS_AWAY, */ PG_STATUS_AWAY, - /* STATUS_PROVIDER_STATUS_DND */ PG_STATUS_UNAVAILABLE, - /* STATUS_PROVIDER_STATUS_INVISIBLE*/ PG_STATUS_INVISIBLE, - /* STATUS_PROVIDER_STATUS_OFFLINE */ PG_STATUS_OFFLINE, - /* STATUS_PROVIDER_STATUS_DISCONNECTED*/ PG_STATUS_OFFLINE -}; - -typedef struct _StatusProviderPidginPrivate StatusProviderPidginPrivate; -struct _StatusProviderPidginPrivate { - DBusGProxy * proxy; - DBusGProxy * dbus_proxy; - pg_status_t pg_status; -}; - -#define STATUS_PROVIDER_PIDGIN_GET_PRIVATE(o) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((o), STATUS_PROVIDER_PIDGIN_TYPE, StatusProviderPidginPrivate)) - -/* Prototypes */ -/* GObject stuff */ -static void status_provider_pidgin_class_init (StatusProviderPidginClass *klass); -static void status_provider_pidgin_init (StatusProviderPidgin *self); -static void status_provider_pidgin_dispose (GObject *object); -static void status_provider_pidgin_finalize (GObject *object); -/* Internal Funcs */ -static void set_status (StatusProvider * sp, StatusProviderStatus status); -static StatusProviderStatus get_status (StatusProvider * sp); -static void setup_pidgin_proxy (StatusProviderPidgin * self); -static void dbus_namechange (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, StatusProviderPidgin * self); - -G_DEFINE_TYPE (StatusProviderPidgin, status_provider_pidgin, STATUS_PROVIDER_TYPE); - -static void -status_provider_pidgin_class_init (StatusProviderPidginClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - g_type_class_add_private (klass, sizeof (StatusProviderPidginPrivate)); - - object_class->dispose = status_provider_pidgin_dispose; - object_class->finalize = status_provider_pidgin_finalize; - - StatusProviderClass * spclass = STATUS_PROVIDER_CLASS(klass); - - spclass->set_status = set_status; - spclass->get_status = get_status; - - return; -} - -static void -type_cb (DBusGProxy * proxy, DBusGProxyCall * call, gpointer userdata) -{ - GError * error = NULL; - gint status = 0; - if (!dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_INT, &status, G_TYPE_INVALID)) { - g_warning("Unable to get type from Pidgin: %s", error->message); - g_error_free(error); - return; - } - - StatusProviderPidginPrivate * priv = STATUS_PROVIDER_PIDGIN_GET_PRIVATE(userdata); - if (status != priv->pg_status) { - priv->pg_status = status; - - g_signal_emit(G_OBJECT(userdata), STATUS_PROVIDER_SIGNAL_STATUS_CHANGED_ID, 0, pg_to_sp_map[priv->pg_status], TRUE); - } - - return; -} - -static void -saved_status_to_type (StatusProviderPidgin * spp, gint savedstatus) -{ - StatusProviderPidginPrivate * priv = STATUS_PROVIDER_PIDGIN_GET_PRIVATE(spp); - - g_debug("Pidgin figuring out type for %d", savedstatus); - dbus_g_proxy_begin_call(priv->proxy, - "PurpleSavedstatusGetType", type_cb, spp, NULL, - G_TYPE_INT, savedstatus, G_TYPE_INVALID); - - return; -} - -static void -savedstatus_cb (DBusGProxy * proxy, DBusGProxyCall * call, gpointer userdata) -{ - GError * error = NULL; - gint status = 0; - if (!dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_INT, &status, G_TYPE_INVALID)) { - g_warning("Unable to get saved status from Pidgin: %s", error->message); - g_error_free(error); - return; - } - - saved_status_to_type(STATUS_PROVIDER_PIDGIN(userdata), status); - return; -} - - -static void -changed_status (DBusGProxy * proxy, gint savedstatus, GError ** error, StatusProviderPidgin * spp) -{ - saved_status_to_type(spp, savedstatus); - return; -} - -static void -proxy_destroy (DBusGProxy * proxy, StatusProviderPidgin * spp) -{ - StatusProviderPidginPrivate * priv = STATUS_PROVIDER_PIDGIN_GET_PRIVATE(spp); - - priv->proxy = NULL; - priv->pg_status = PG_STATUS_OFFLINE; - - g_signal_emit(G_OBJECT(spp), STATUS_PROVIDER_SIGNAL_STATUS_CHANGED_ID, 0, pg_to_sp_map[priv->pg_status], TRUE); - return; -} - -static void -status_provider_pidgin_init (StatusProviderPidgin *self) -{ - StatusProviderPidginPrivate * priv = STATUS_PROVIDER_PIDGIN_GET_PRIVATE(self); - - priv->proxy = NULL; - priv->pg_status = PG_STATUS_OFFLINE; - - DBusGConnection * bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - g_return_if_fail(bus != NULL); /* Can't do anymore DBus stuff without this, - all non-DBus stuff should be done */ - - GError * error = NULL; - - /* Set up the dbus Proxy */ - priv->dbus_proxy = dbus_g_proxy_new_for_name_owner (bus, - DBUS_SERVICE_DBUS, - DBUS_PATH_DBUS, - DBUS_INTERFACE_DBUS, - &error); - if (error != NULL) { - g_warning("Unable to connect to DBus events: %s", error->message); - g_error_free(error); - return; - } - - /* Configure the name owner changing */ - dbus_g_proxy_add_signal(priv->dbus_proxy, "NameOwnerChanged", - G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_INVALID); - dbus_g_proxy_connect_signal(priv->dbus_proxy, "NameOwnerChanged", - G_CALLBACK(dbus_namechange), - self, NULL); - - setup_pidgin_proxy(self); - - return; -} - -/* Watch to see if the Pidgin comes up on Dbus */ -static void -dbus_namechange (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, StatusProviderPidgin * self) -{ - g_return_if_fail(name != NULL); - g_return_if_fail(new != NULL); - - if (g_strcmp0(name, "im.pidgin.purple.PurpleService") == 0) { - setup_pidgin_proxy(self); - } - return; -} - -/* Setup the Pidgin proxy so that we can talk to it - and get signals from it. */ -static void -setup_pidgin_proxy (StatusProviderPidgin * self) -{ - StatusProviderPidginPrivate * priv = STATUS_PROVIDER_PIDGIN_GET_PRIVATE(self); - - if (priv->proxy != NULL) { - g_debug("Odd, we were asked to set up a Pidgin proxy when we already had one."); - return; - } - - DBusGConnection * bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - g_return_if_fail(bus != NULL); /* Can't do anymore DBus stuff without this, - all non-DBus stuff should be done */ - - GError * error = NULL; - - /* Set up the Pidgin Proxy */ - priv->proxy = dbus_g_proxy_new_for_name_owner (bus, - "im.pidgin.purple.PurpleService", - "/im/pidgin/purple/PurpleObject", - "im.pidgin.purple.PurpleInterface", - &error); - /* Report any errors */ - if (error != NULL) { - g_debug("Unable to get Pidgin proxy: %s", error->message); - g_error_free(error); - } - - /* If we have a proxy, let's start using it */ - if (priv->proxy != NULL) { - /* Set the proxy to NULL if it's destroyed */ - g_object_add_weak_pointer (G_OBJECT(priv->proxy), (gpointer *)&priv->proxy); - /* If it's destroyed, let's clean up as well */ - g_signal_connect(G_OBJECT(priv->proxy), "destroy", - G_CALLBACK(proxy_destroy), self); - - /* Watching for the status change coming from the - Pidgin side of things. */ - g_debug("Adding Pidgin Signals"); - dbus_g_object_register_marshaller(_status_provider_pidgin_marshal_VOID__INT_INT, - G_TYPE_NONE, - G_TYPE_INT, - G_TYPE_INT, - G_TYPE_INVALID); - dbus_g_proxy_add_signal (priv->proxy, - "SavedstatusChanged", - G_TYPE_INT, - G_TYPE_INT, - G_TYPE_INVALID); - dbus_g_proxy_connect_signal(priv->proxy, - "SavedstatusChanged", - G_CALLBACK(changed_status), - (void *)self, - NULL); - - /* Get the current status to update our cached - value of the status. */ - dbus_g_proxy_begin_call(priv->proxy, - "PurpleSavedstatusGetCurrent", - savedstatus_cb, - self, - NULL, - G_TYPE_INVALID); - } - - return; -} - -static void -status_provider_pidgin_dispose (GObject *object) -{ - StatusProviderPidginPrivate * priv = STATUS_PROVIDER_PIDGIN_GET_PRIVATE(object); - - if (priv->proxy != NULL) { - g_object_unref(priv->proxy); - priv->proxy = NULL; - } - - G_OBJECT_CLASS (status_provider_pidgin_parent_class)->dispose (object); - return; -} - -static void -status_provider_pidgin_finalize (GObject *object) -{ - - G_OBJECT_CLASS (status_provider_pidgin_parent_class)->finalize (object); - return; -} - -/** - status_provider_pidgin_new: - - Creates a new #StatusProviderPidgin object. No parameters or anything - like that. Just a convience function. - - Return value: A new instance of #StatusProviderPidgin -*/ -StatusProvider * -status_provider_pidgin_new (void) -{ - return STATUS_PROVIDER(g_object_new(STATUS_PROVIDER_PIDGIN_TYPE, NULL)); -} - -/* Takes the status provided generically for Status providers - and turns it into a Pidgin status and sends it to Pidgin. */ -static void -set_status (StatusProvider * sp, StatusProviderStatus status) -{ - gchar * message = ""; - - g_return_if_fail(IS_STATUS_PROVIDER_PIDGIN(sp)); - StatusProviderPidginPrivate * priv = STATUS_PROVIDER_PIDGIN_GET_PRIVATE(sp); - - g_debug("\tPidgin set status to %d", status); - if (priv->proxy == NULL) { - return; - } - - priv->pg_status = sp_to_pg_map[status]; - gint status_val = 0; - gboolean ret = FALSE; - GError * error = NULL; - - ret = dbus_g_proxy_call(priv->proxy, - "PurpleSavedstatusFindTransientByTypeAndMessage", &error, - G_TYPE_INT, priv->pg_status, - G_TYPE_STRING, message, - G_TYPE_INVALID, - G_TYPE_INT, &status_val, - G_TYPE_INVALID); - - if (!ret) { - if (error != NULL) { - g_error_free(error); - } - error = NULL; - status_val = 0; - g_debug("No Pidgin saved status to apply"); - } - - if (status_val == 0) { - ret = dbus_g_proxy_call(priv->proxy, - "PurpleSavedstatusNew", &error, - G_TYPE_STRING, message, - G_TYPE_INT, priv->pg_status, - G_TYPE_INVALID, - G_TYPE_INT, &status_val, - G_TYPE_INVALID); - - if (!ret) { - status_val = 0; - if (error != NULL) { - g_warning("Unable to create Pidgin status for %d: %s", status, error->message); - g_error_free(error); - } else { - g_warning("Unable to create Pidgin status for %d", status); - } - error = NULL; - } - } - - if (status_val == 0) { - return; - } - - ret = dbus_g_proxy_call(priv->proxy, - "PurpleSavedstatusActivate", &error, - G_TYPE_INT, status_val, - G_TYPE_INVALID, - G_TYPE_INVALID); - - if (!ret) { - if (error != NULL) { - g_warning("Pidgin unable to change to status: %s", error->message); - g_error_free(error); - } else { - g_warning("Pidgin unable to change to status"); - } - error = NULL; - } - - g_signal_emit(G_OBJECT(sp), STATUS_PROVIDER_SIGNAL_STATUS_CHANGED_ID, 0, pg_to_sp_map[priv->pg_status], TRUE); - return; -} - -/* Takes the cached Pidgin status and makes it into the generic - Status provider status. If there is no Pidgin proxy then it - returns the disconnected state. */ -static StatusProviderStatus -get_status (StatusProvider * sp) -{ - g_return_val_if_fail(IS_STATUS_PROVIDER_PIDGIN(sp), STATUS_PROVIDER_STATUS_DISCONNECTED); - StatusProviderPidginPrivate * priv = STATUS_PROVIDER_PIDGIN_GET_PRIVATE(sp); - - if (priv->proxy == NULL) { - return STATUS_PROVIDER_STATUS_DISCONNECTED; - } - - return pg_to_sp_map[priv->pg_status]; -} diff --git a/src/status-provider-pidgin.h b/src/status-provider-pidgin.h deleted file mode 100644 index 54b1718..0000000 --- a/src/status-provider-pidgin.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -A small wrapper utility to load indicators and put them as menu items -into the gnome-panel using it's applet interface. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __STATUS_PROVIDER_PIDGIN_H__ -#define __STATUS_PROVIDER_PIDGIN_H__ - -#include <glib.h> -#include <glib-object.h> - -#include "status-provider.h" - -G_BEGIN_DECLS - -#define STATUS_PROVIDER_PIDGIN_TYPE (status_provider_pidgin_get_type ()) -#define STATUS_PROVIDER_PIDGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STATUS_PROVIDER_PIDGIN_TYPE, StatusProviderPidgin)) -#define STATUS_PROVIDER_PIDGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STATUS_PROVIDER_PIDGIN_TYPE, StatusProviderPidginClass)) -#define IS_STATUS_PROVIDER_PIDGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STATUS_PROVIDER_PIDGIN_TYPE)) -#define IS_STATUS_PROVIDER_PIDGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), STATUS_PROVIDER_PIDGIN_TYPE)) -#define STATUS_PROVIDER_PIDGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STATUS_PROVIDER_PIDGIN_TYPE, StatusProviderPidginClass)) - - -typedef struct _StatusProviderPidginClass StatusProviderPidginClass; -struct _StatusProviderPidginClass { - StatusProviderClass parent_class; -}; - -typedef struct _StatusProviderPidgin StatusProviderPidgin; -struct _StatusProviderPidgin { - StatusProvider parent; -}; - -GType status_provider_pidgin_get_type (void); -StatusProvider * status_provider_pidgin_new (void); - -G_END_DECLS - -#endif diff --git a/src/status-provider-pidgin.list b/src/status-provider-pidgin.list deleted file mode 100644 index 1f953dd..0000000 --- a/src/status-provider-pidgin.list +++ /dev/null @@ -1 +0,0 @@ -VOID:INT,INT diff --git a/src/status-provider-telepathy.c b/src/status-provider-telepathy.c deleted file mode 100644 index f2815fb..0000000 --- a/src/status-provider-telepathy.c +++ /dev/null @@ -1,383 +0,0 @@ -/* -A small wrapper utility to load indicators and put them as menu items -into the gnome-panel using it's applet interface. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "status-provider.h" -#include "status-provider-telepathy.h" -#include "status-provider-telepathy-marshal.h" - -#include <dbus/dbus-glib.h> - -typedef enum { - MC_STATUS_UNSET, - MC_STATUS_OFFLINE, - MC_STATUS_AVAILABLE, - MC_STATUS_AWAY, - MC_STATUS_EXTENDED_AWAY, - MC_STATUS_HIDDEN, - MC_STATUS_DND -} mc_status_t; - -static StatusProviderStatus mc_to_sp_map[] = { - /* MC_STATUS_UNSET, */ STATUS_PROVIDER_STATUS_OFFLINE, - /* MC_STATUS_OFFLINE, */ STATUS_PROVIDER_STATUS_OFFLINE, - /* MC_STATUS_AVAILABLE, */ STATUS_PROVIDER_STATUS_ONLINE, - /* MC_STATUS_AWAY, */ STATUS_PROVIDER_STATUS_AWAY, - /* MC_STATUS_EXTENDED_AWAY, */ STATUS_PROVIDER_STATUS_AWAY, - /* MC_STATUS_HIDDEN, */ STATUS_PROVIDER_STATUS_INVISIBLE, - /* MC_STATUS_DND */ STATUS_PROVIDER_STATUS_DND -}; - -static mc_status_t sp_to_mc_map[] = { - /* STATUS_PROVIDER_STATUS_ONLINE, */ MC_STATUS_AVAILABLE, - /* STATUS_PROVIDER_STATUS_AWAY, */ MC_STATUS_AWAY, - /* STATUS_PROVIDER_STATUS_DND */ MC_STATUS_DND, - /* STATUS_PROVIDER_STATUS_INVISIBLE*/ MC_STATUS_HIDDEN, - /* STATUS_PROVIDER_STATUS_OFFLINE */ MC_STATUS_OFFLINE, - /* STATUS_PROVIDER_STATUS_DISCONNECTED*/MC_STATUS_OFFLINE -}; - -typedef struct _StatusProviderTelepathyPrivate StatusProviderTelepathyPrivate; -struct _StatusProviderTelepathyPrivate { - DBusGProxy * proxy; - DBusGProxy * dbus_proxy; - mc_status_t mc_status; -}; - -#define STATUS_PROVIDER_TELEPATHY_GET_PRIVATE(o) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((o), STATUS_PROVIDER_TELEPATHY_TYPE, StatusProviderTelepathyPrivate)) - -/* Prototypes */ -/* GObject stuff */ -static void status_provider_telepathy_class_init (StatusProviderTelepathyClass *klass); -static void status_provider_telepathy_init (StatusProviderTelepathy *self); -static void status_provider_telepathy_dispose (GObject *object); -static void status_provider_telepathy_finalize (GObject *object); -/* Internal Funcs */ -static void build_telepathy_proxy (StatusProviderTelepathy * self); -static void dbus_namechange (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, StatusProviderTelepathy * self); -static void set_status (StatusProvider * sp, StatusProviderStatus status); -static StatusProviderStatus get_status (StatusProvider * sp); -static void changed_status (DBusGProxy * proxy, guint status, gchar * message, StatusProvider * sp); -static void proxy_destroy (DBusGProxy * proxy, StatusProvider * sp); -static void get_status_async (DBusGProxy * proxy, DBusGProxyCall * call, gpointer userdata); - -G_DEFINE_TYPE (StatusProviderTelepathy, status_provider_telepathy, STATUS_PROVIDER_TYPE); - -static void -status_provider_telepathy_class_init (StatusProviderTelepathyClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - g_type_class_add_private (klass, sizeof (StatusProviderTelepathyPrivate)); - - object_class->dispose = status_provider_telepathy_dispose; - object_class->finalize = status_provider_telepathy_finalize; - - StatusProviderClass * spclass = STATUS_PROVIDER_CLASS(klass); - - spclass->set_status = set_status; - spclass->get_status = get_status; - - return; -} - - -static void -status_provider_telepathy_init (StatusProviderTelepathy *self) -{ - StatusProviderTelepathyPrivate * priv = STATUS_PROVIDER_TELEPATHY_GET_PRIVATE(self); - - priv->proxy = NULL; - priv->dbus_proxy = NULL; - priv->mc_status = MC_STATUS_OFFLINE; - - GError * error = NULL; - - /* Grabbing the session bus */ - DBusGConnection * bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); - if (bus == NULL) { - g_warning("Unable to connect to Session Bus: %s", error == NULL ? "No message" : error->message); - g_error_free(error); - return; - } - - /* Set up the dbus Proxy */ - priv->dbus_proxy = dbus_g_proxy_new_for_name_owner (bus, - DBUS_SERVICE_DBUS, - DBUS_PATH_DBUS, - DBUS_INTERFACE_DBUS, - &error); - if (error != NULL) { - g_warning("Unable to connect to DBus events: %s", error->message); - g_error_free(error); - return; - } - - /* Configure the name owner changing */ - dbus_g_proxy_add_signal(priv->dbus_proxy, "NameOwnerChanged", - G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_INVALID); - dbus_g_proxy_connect_signal(priv->dbus_proxy, "NameOwnerChanged", - G_CALLBACK(dbus_namechange), - self, NULL); - - build_telepathy_proxy(self); - - return; -} - -/* Builds up the proxy to Mission Control and configures all of the - signals for getting info from the proxy. Also does a call to get - the inital value of the status. */ -static void -build_telepathy_proxy (StatusProviderTelepathy * self) -{ - g_debug("Building Telepathy Proxy"); - StatusProviderTelepathyPrivate * priv = STATUS_PROVIDER_TELEPATHY_GET_PRIVATE(self); - - if (priv->proxy != NULL) { - g_debug("Hmm, being asked to build a proxy we alredy have."); - return; - } - - GError * error = NULL; - - /* Grabbing the session bus */ - DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); - if (session_bus == NULL) { - g_warning("Unable to connect to Session Bus: %s", error == NULL ? "No message" : error->message); - g_error_free(error); - return; - } - - /* Get the proxy to Mission Control */ - priv->proxy = dbus_g_proxy_new_for_name_owner(session_bus, - "org.freedesktop.Telepathy.MissionControl", - "/org/freedesktop/Telepathy/MissionControl", - "org.freedesktop.Telepathy.MissionControl", - &error); - - if (priv->proxy != NULL) { - /* If it goes, we set the proxy to NULL */ - g_object_add_weak_pointer (G_OBJECT(priv->proxy), (gpointer *)&priv->proxy); - /* And we clean up other variables associated */ - g_signal_connect(G_OBJECT(priv->proxy), "destroy", - G_CALLBACK(proxy_destroy), self); - - /* Set up the signal handler for watching when status changes. */ - dbus_g_object_register_marshaller(_status_provider_telepathy_marshal_VOID__UINT_STRING, - G_TYPE_NONE, - G_TYPE_UINT, - G_TYPE_STRING, - G_TYPE_INVALID); - dbus_g_proxy_add_signal (priv->proxy, - "PresenceChanged", - G_TYPE_UINT, - G_TYPE_STRING, - G_TYPE_INVALID); - dbus_g_proxy_connect_signal(priv->proxy, - "PresenceChanged", - G_CALLBACK(changed_status), - (void *)self, - NULL); - - /* Do a get here, to init the status */ - dbus_g_proxy_begin_call(priv->proxy, - "GetStatus", - get_status_async, - self, - NULL, - G_TYPE_INVALID); - } else { - g_warning("Unable to connect to Mission Control"); - if (error != NULL) { - g_error_free(error); - } - } - - return; -} - -/* Watch to see if the Mission Control comes up on Dbus */ -static void -dbus_namechange (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, StatusProviderTelepathy * self) -{ - g_return_if_fail(name != NULL); - g_return_if_fail(new != NULL); - - if (g_strcmp0(name, "org.freedesktop.Telepathy.MissionControl") == 0) { - build_telepathy_proxy(self); - } - return; -} - -static void -status_provider_telepathy_dispose (GObject *object) -{ - StatusProviderTelepathyPrivate * priv = STATUS_PROVIDER_TELEPATHY_GET_PRIVATE(object); - - if (priv->proxy != NULL) { - g_object_unref(priv->proxy); - priv->proxy = NULL; - } - - G_OBJECT_CLASS (status_provider_telepathy_parent_class)->dispose (object); - return; -} - -static void -status_provider_telepathy_finalize (GObject *object) -{ - - G_OBJECT_CLASS (status_provider_telepathy_parent_class)->finalize (object); - return; -} - -/** - status_provider_telepathy_new: - - Creates a new #StatusProviderTelepathy object. No parameters or anything - like that. Just a convience function. - - Return value: A new instance of #StatusProviderTelepathy -*/ -StatusProvider * -status_provider_telepathy_new (void) -{ - return STATUS_PROVIDER(g_object_new(STATUS_PROVIDER_TELEPATHY_TYPE, NULL)); -} - -static void -set_status (StatusProvider * sp, StatusProviderStatus status) -{ - StatusProviderTelepathyPrivate * priv = STATUS_PROVIDER_TELEPATHY_GET_PRIVATE(sp); - if (priv->proxy == NULL) { - priv->mc_status = MC_STATUS_OFFLINE; - return; - } - - priv->mc_status = sp_to_mc_map[status]; - - guint mcstatus = MC_STATUS_UNSET; - gboolean ret = FALSE; - GError * error = NULL; - - ret = dbus_g_proxy_call(priv->proxy, - "GetPresence", &error, - G_TYPE_INVALID, - G_TYPE_UINT, &priv->mc_status, - G_TYPE_INVALID); - - /* If we can't get the get call to work, let's not set */ - if (!ret) { - if (error != NULL) { - g_error_free(error); - } - return; - } - - /* If the get call doesn't return a status, that means that there - are no clients connected. We don't want to connect them by telling - MC that we're going online -- we'd like to be more passive than that. */ - if (mcstatus == MC_STATUS_UNSET) { - return; - } - - ret = dbus_g_proxy_call(priv->proxy, - "SetPresence", &error, - G_TYPE_UINT, priv->mc_status, - G_TYPE_STRING, "", - G_TYPE_INVALID, - G_TYPE_INVALID); - - if (!ret) { - if (error != NULL) { - g_warning("Unable to set Mission Control Presence: %s", error->message); - g_error_free(error); - } else { - g_warning("Unable to set Mission Control Presence"); - } - return; - } - - return; -} - -static StatusProviderStatus -get_status (StatusProvider * sp) -{ - g_return_val_if_fail(IS_STATUS_PROVIDER_TELEPATHY(sp), STATUS_PROVIDER_STATUS_DISCONNECTED); - StatusProviderTelepathyPrivate * priv = STATUS_PROVIDER_TELEPATHY_GET_PRIVATE(sp); - - if (priv->proxy == NULL) { - return STATUS_PROVIDER_STATUS_DISCONNECTED; - } - - return mc_to_sp_map[priv->mc_status]; -} - -static void -changed_status (DBusGProxy * proxy, guint status, gchar * message, StatusProvider * sp) -{ - StatusProviderTelepathyPrivate * priv = STATUS_PROVIDER_TELEPATHY_GET_PRIVATE(sp); - priv->mc_status = status; - g_signal_emit(G_OBJECT(sp), STATUS_PROVIDER_SIGNAL_STATUS_CHANGED_ID, 0, mc_to_sp_map[priv->mc_status], TRUE); -} - -static void -proxy_destroy (DBusGProxy * proxy, StatusProvider * sp) -{ - g_debug("Signal: Mission Control proxy destroyed"); - g_signal_emit(G_OBJECT(sp), STATUS_PROVIDER_SIGNAL_STATUS_CHANGED_ID, 0, STATUS_PROVIDER_STATUS_OFFLINE, TRUE); - return; -} - -static void -get_status_async (DBusGProxy * proxy, DBusGProxyCall * call, gpointer userdata) -{ - GError * error = NULL; - guint status = 0; - if (!dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_UINT, &status, G_TYPE_INVALID)) { - g_warning("Unable to get type from Mission Control: %s", error->message); - g_error_free(error); - return; - } - - StatusProviderTelepathyPrivate * priv = STATUS_PROVIDER_TELEPATHY_GET_PRIVATE(userdata); - - gboolean changed = FALSE; - if (status != priv->mc_status) { - changed = TRUE; - } - - priv->mc_status = status; - - if (changed) { - g_signal_emit(G_OBJECT(userdata), STATUS_PROVIDER_SIGNAL_STATUS_CHANGED_ID, 0, mc_to_sp_map[priv->mc_status], TRUE); - } - - return; -} diff --git a/src/status-provider-telepathy.h b/src/status-provider-telepathy.h deleted file mode 100644 index a67ee40..0000000 --- a/src/status-provider-telepathy.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -A small wrapper utility to load indicators and put them as menu items -into the gnome-panel using it's applet interface. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __STATUS_PROVIDER_TELEPATHY_H__ -#define __STATUS_PROVIDER_TELEPATHY_H__ - -#include <glib.h> -#include <glib-object.h> - -#include "status-provider.h" - -G_BEGIN_DECLS - -#define STATUS_PROVIDER_TELEPATHY_TYPE (status_provider_telepathy_get_type ()) -#define STATUS_PROVIDER_TELEPATHY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STATUS_PROVIDER_TELEPATHY_TYPE, StatusProviderTelepathy)) -#define STATUS_PROVIDER_TELEPATHY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STATUS_PROVIDER_TELEPATHY_TYPE, StatusProviderTelepathyClass)) -#define IS_STATUS_PROVIDER_TELEPATHY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STATUS_PROVIDER_TELEPATHY_TYPE)) -#define IS_STATUS_PROVIDER_TELEPATHY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), STATUS_PROVIDER_TELEPATHY_TYPE)) -#define STATUS_PROVIDER_TELEPATHY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STATUS_PROVIDER_TELEPATHY_TYPE, StatusProviderTelepathyClass)) - - -typedef struct _StatusProviderTelepathyClass StatusProviderTelepathyClass; -struct _StatusProviderTelepathyClass { - StatusProviderClass parent_class; -}; - -typedef struct _StatusProviderTelepathy StatusProviderTelepathy; -struct _StatusProviderTelepathy { - StatusProvider parent; -}; - -GType status_provider_telepathy_get_type (void); -StatusProvider * status_provider_telepathy_new (void); - -G_END_DECLS - -#endif diff --git a/src/status-provider-telepathy.list b/src/status-provider-telepathy.list deleted file mode 100644 index 5ab45bf..0000000 --- a/src/status-provider-telepathy.list +++ /dev/null @@ -1 +0,0 @@ -VOID:UINT,STRING diff --git a/src/status-provider.c b/src/status-provider.c deleted file mode 100644 index 1139e54..0000000 --- a/src/status-provider.c +++ /dev/null @@ -1,101 +0,0 @@ -/* -A small wrapper utility to load indicators and put them as menu items -into the gnome-panel using it's applet interface. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "status-provider.h" - -/* Signals */ -enum { - STATUS_CHANGED, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - -/* GObject Boilerplate */ -static void status_provider_class_init (StatusProviderClass *klass); -static void status_provider_init (StatusProvider *self); - -G_DEFINE_TYPE (StatusProvider, status_provider, G_TYPE_OBJECT); - -static void -status_provider_class_init (StatusProviderClass *klass) -{ - // GObjectClass *object_class = G_OBJECT_CLASS (klass); - - klass->status_changed = NULL; - - klass->set_status = NULL; - klass->get_status = NULL; - - /** - StatusProvider::status-changed: - @arg0: The #StatusProvider object. - @arg1: The new status #StatusProviderStatus - - Should be emitted by subclasses everytime that the status - changes externally to us. - */ - signals[STATUS_CHANGED] = g_signal_new(STATUS_PROVIDER_SIGNAL_STATUS_CHANGED, - G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(StatusProviderClass, status_changed), - NULL, NULL, - g_cclosure_marshal_VOID__UINT, - G_TYPE_NONE, 1, G_TYPE_UINT); - - return; -} - -static void -status_provider_init (StatusProvider *self) -{ - - return; -} - -void -status_provider_set_status (StatusProvider * sp, StatusProviderStatus status) -{ - g_return_if_fail(IS_STATUS_PROVIDER(sp)); - - StatusProviderClass * class = STATUS_PROVIDER_GET_CLASS(sp); - g_return_if_fail(class != NULL); - g_return_if_fail(class->set_status != NULL); - - return class->set_status(sp, status); -} - -StatusProviderStatus -status_provider_get_status (StatusProvider * sp) -{ - g_return_val_if_fail(IS_STATUS_PROVIDER(sp), STATUS_PROVIDER_STATUS_OFFLINE); - - StatusProviderClass * class = STATUS_PROVIDER_GET_CLASS(sp); - g_return_val_if_fail(class->get_status != NULL, STATUS_PROVIDER_STATUS_OFFLINE); - - return class->get_status(sp); -} - diff --git a/src/status-provider.h b/src/status-provider.h deleted file mode 100644 index a0e1c55..0000000 --- a/src/status-provider.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -A small wrapper utility to load indicators and put them as menu items -into the gnome-panel using it's applet interface. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __STATUS_PROVIDER_H__ -#define __STATUS_PROVIDER_H__ - -#include <glib.h> -#include <glib-object.h> - -G_BEGIN_DECLS - -#define STATUS_PROVIDER_TYPE (status_provider_get_type ()) -#define STATUS_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STATUS_PROVIDER_TYPE, StatusProvider)) -#define STATUS_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STATUS_PROVIDER_TYPE, StatusProviderClass)) -#define IS_STATUS_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STATUS_PROVIDER_TYPE)) -#define IS_STATUS_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), STATUS_PROVIDER_TYPE)) -#define STATUS_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STATUS_PROVIDER_TYPE, StatusProviderClass)) - -typedef enum -{ - STATUS_PROVIDER_STATUS_ONLINE, - STATUS_PROVIDER_STATUS_AWAY, - STATUS_PROVIDER_STATUS_DND, - STATUS_PROVIDER_STATUS_INVISIBLE, - STATUS_PROVIDER_STATUS_OFFLINE, - STATUS_PROVIDER_STATUS_DISCONNECTED, - /* Leave as last */ - STATUS_PROVIDER_STATUS_LAST -} -StatusProviderStatus; - -#define STATUS_PROVIDER_SIGNAL_STATUS_CHANGED "status-changed" -#define STATUS_PROVIDER_SIGNAL_STATUS_CHANGED_ID (g_signal_lookup(STATUS_PROVIDER_SIGNAL_STATUS_CHANGED, STATUS_PROVIDER_TYPE)) - -typedef struct _StatusProvider StatusProvider; -struct _StatusProvider { - GObject parent; -}; - -typedef struct _StatusProviderClass StatusProviderClass; -struct _StatusProviderClass { - GObjectClass parent_class; - - /* Signals */ - void (*status_changed) (StatusProviderStatus newstatus); - - /* Virtual Functions */ - void (*set_status) (StatusProvider * sp, StatusProviderStatus newstatus); - StatusProviderStatus (*get_status) (StatusProvider * sp); -}; - -GType status_provider_get_type (void); - -void status_provider_set_status (StatusProvider * sp, StatusProviderStatus status); -StatusProviderStatus status_provider_get_status (StatusProvider * sp); - -G_END_DECLS - -#endif diff --git a/src/status-service-dbus.c b/src/status-service-dbus.c deleted file mode 100644 index 65de499..0000000 --- a/src/status-service-dbus.c +++ /dev/null @@ -1,205 +0,0 @@ -/* -A small wrapper utility to load indicators and put them as menu items -into the gnome-panel using it's applet interface. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <dbus/dbus-glib.h> - -#include "dbus-shared-names.h" -#include "status-service-dbus.h" - -static void status_service_dbus_class_init (StatusServiceDbusClass *klass); -static void status_service_dbus_init (StatusServiceDbus *self); -static void status_service_dbus_dispose (GObject *object); -static void status_service_dbus_finalize (GObject *object); -static gboolean _status_service_server_watch (StatusServiceDbus * service, GError ** error); -static gboolean _status_service_server_status_icons (StatusServiceDbus * service, gchar ** icon, GError ** error); -static gboolean _status_service_server_pretty_user_name (StatusServiceDbus * service, gchar ** username, GError ** error); - -#include "status-service-server.h" - -/* Private */ -typedef struct _StatusServiceDbusPrivate StatusServiceDbusPrivate; -struct _StatusServiceDbusPrivate -{ - gchar * name; - gchar * icon; -}; - -#define STATUS_SERVICE_DBUS_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), STATUS_SERVICE_DBUS_TYPE, StatusServiceDbusPrivate)) - -/* Signals */ -enum { - USER_CHANGED, - STATUS_ICONS_CHANGED, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - -/* GObject Boilerplate */ -G_DEFINE_TYPE (StatusServiceDbus, status_service_dbus, G_TYPE_OBJECT); - -static void -status_service_dbus_class_init (StatusServiceDbusClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - g_type_class_add_private (object_class, sizeof(StatusServiceDbusPrivate)); - - object_class->dispose = status_service_dbus_dispose; - object_class->finalize = status_service_dbus_finalize; - - /** - StatusServiceDbus::user-changed: - @arg0: The #StatusServiceDbus object. - @arg1: The place to put the new user name - - Signals that the user name has changed and gives the - new user name. - */ - signals[USER_CHANGED] = g_signal_new("user-changed", - G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(StatusServiceDbusClass, user_changed), - NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, G_TYPE_POINTER); - - /** - StatusServiceDbus::status-icons-changed: - @arg0: The #StatusServiceDbus object. - @arg1: The list of icon names representing the statuses in - the order they should be displayed. Left to right. - - Signals that the user status set has changed and that - new icons may need to be loaded. The list of icons will - always be complete. - */ - signals[STATUS_ICONS_CHANGED] = g_signal_new("status-icons-changed", - G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(StatusServiceDbusClass, status_icons_changed), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, G_TYPE_STRING); - - dbus_g_object_type_install_info(STATUS_SERVICE_DBUS_TYPE, &dbus_glib__status_service_server_object_info); - - return; -} - -static void -status_service_dbus_init (StatusServiceDbus *self) -{ - - DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - dbus_g_connection_register_g_object(connection, - INDICATOR_STATUS_SERVICE_DBUS_OBJECT, - G_OBJECT(self)); - - StatusServiceDbusPrivate * priv = STATUS_SERVICE_DBUS_GET_PRIVATE(self); - priv->name = NULL; - priv->icon = NULL; - - return; -} - -static void -status_service_dbus_dispose (GObject *object) -{ - - G_OBJECT_CLASS (status_service_dbus_parent_class)->dispose (object); - return; -} - -static void -status_service_dbus_finalize (GObject *object) -{ - - G_OBJECT_CLASS (status_service_dbus_parent_class)->finalize (object); - return; -} - -static gboolean -_status_service_server_watch (StatusServiceDbus * service, GError ** error) -{ - - return TRUE; -} - -static gboolean -_status_service_server_status_icons (StatusServiceDbus * service, gchar ** icon, GError ** error) -{ - if (!IS_STATUS_SERVICE_DBUS(service)) { - g_warning("NO BAD EVIL!"); - return FALSE; - } - - StatusServiceDbusPrivate * priv = STATUS_SERVICE_DBUS_GET_PRIVATE(service); - if (priv->icon == NULL) { - *icon = g_strdup(""); - } else { - *icon = g_strdup(priv->icon); - } - - return TRUE; -} - -static gboolean -_status_service_server_pretty_user_name (StatusServiceDbus * service, gchar ** username, GError ** error) -{ - if (!IS_STATUS_SERVICE_DBUS(service)) { - g_warning("NO BAD EVIL!"); - return FALSE; - } - - StatusServiceDbusPrivate * priv = STATUS_SERVICE_DBUS_GET_PRIVATE(service); - if (priv->name == NULL) { - *username = g_strdup(""); - } else { - *username = g_strdup(priv->name); - } - - return TRUE; -} - -void -status_service_dbus_set_status (StatusServiceDbus * self, const gchar * icon) -{ - g_return_if_fail(IS_STATUS_SERVICE_DBUS(self)); - - g_debug("Setting icon to: %s", icon); - - StatusServiceDbusPrivate * priv = STATUS_SERVICE_DBUS_GET_PRIVATE(self); - - if (priv->icon != NULL) { - g_free(priv->icon); - } - priv->icon = g_strdup(icon); - - g_signal_emit(G_OBJECT(self), signals[STATUS_ICONS_CHANGED], 0, priv->icon, TRUE); - return; -} diff --git a/src/status-service-dbus.h b/src/status-service-dbus.h deleted file mode 100644 index 34a9c3c..0000000 --- a/src/status-service-dbus.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -A small wrapper utility to load indicators and put them as menu items -into the gnome-panel using it's applet interface. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __STATUS_SERVICE_DBUS_H__ -#define __STATUS_SERVICE_DBUS_H__ - -#include <glib.h> -#include <glib-object.h> - -G_BEGIN_DECLS - -#define STATUS_SERVICE_DBUS_TYPE (status_service_dbus_get_type ()) -#define STATUS_SERVICE_DBUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STATUS_SERVICE_DBUS_TYPE, StatusServiceDbus)) -#define STATUS_SERVICE_DBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STATUS_SERVICE_DBUS_TYPE, StatusServiceDbusClass)) -#define IS_STATUS_SERVICE_DBUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STATUS_SERVICE_DBUS_TYPE)) -#define IS_STATUS_SERVICE_DBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), STATUS_SERVICE_DBUS_TYPE)) -#define STATUS_SERVICE_DBUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STATUS_SERVICE_DBUS_TYPE, StatusServiceDbusClass)) - -typedef struct _StatusServiceDbus StatusServiceDbus; -typedef struct _StatusServiceDbusClass StatusServiceDbusClass; - -struct _StatusServiceDbusClass { - GObjectClass parent_class; - - /* Signals */ - gboolean (*user_changed) (StatusServiceDbus * self, gchar ** name, gpointer user_data); - gboolean (*status_icons_changed) (StatusServiceDbus * self, GArray ** icons, gpointer user_data); - -}; - -struct _StatusServiceDbus { - GObject parent; -}; - -GType status_service_dbus_get_type (void); -void status_service_dbus_set_status (StatusServiceDbus * self, const gchar * icon); - -G_END_DECLS - -#endif diff --git a/src/status-service.c b/src/status-service.c deleted file mode 100644 index c07b875..0000000 --- a/src/status-service.c +++ /dev/null @@ -1,264 +0,0 @@ -/* -A small wrapper utility to load indicators and put them as menu items -into the gnome-panel using it's applet interface. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include <config.h> - -#include <sys/types.h> -#include <pwd.h> -#include <unistd.h> - -#include <glib/gi18n.h> - -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-bindings.h> - -#include <libdbusmenu-glib/client.h> -#include <libdbusmenu-glib/server.h> -#include <libdbusmenu-glib/menuitem.h> - -#include "dbus-shared-names.h" - -#include "status-service-dbus.h" - -#include "status-provider.h" -#include "status-provider-mc5.h" -#include "status-provider-pidgin.h" -#include "status-provider-telepathy.h" - -typedef StatusProvider * (*newfunc) (void); -#define STATUS_PROVIDER_CNT 3 -static newfunc status_provider_newfuncs[STATUS_PROVIDER_CNT] = { - status_provider_mc5_new, - status_provider_pidgin_new, - status_provider_telepathy_new -}; -static StatusProvider * status_providers[STATUS_PROVIDER_CNT] = { 0 }; - -static const gchar * status_strings [STATUS_PROVIDER_STATUS_LAST] = { - /* STATUS_PROVIDER_STATUS_ONLINE, */ N_("Available"), - /* STATUS_PROVIDER_STATUS_AWAY, */ N_("Away"), - /* STATUS_PROVIDER_STATUS_DND */ N_("Busy"), - /* STATUS_PROVIDER_STATUS_INVISIBLE */ N_("Invisible"), - /* STATUS_PROVIDER_STATUS_OFFLINE, */ N_("Offline"), - /* STATUS_PROVIDER_STATUS_DISCONNECTED*/ N_("Offline") -}; - -static const gchar * status_icons[STATUS_PROVIDER_STATUS_LAST] = { - /* STATUS_PROVIDER_STATUS_ONLINE, */ "user-available", - /* STATUS_PROVIDER_STATUS_AWAY, */ "user-away", - /* STATUS_PROVIDER_STATUS_DND, */ "user-busy", - /* STATUS_PROVIDER_STATUS_INVISIBLE, */ "user-invisible", - /* STATUS_PROVIDER_STATUS_OFFLINE */ "user-offline", - /* STATUS_PROVIDER_STATUS_DISCONNECTED */"system-shutdown-panel" -}; - - -static DbusmenuMenuitem * root_menuitem = NULL; -static DbusmenuMenuitem * status_menuitem = NULL; -static DbusmenuMenuitem * status_menuitems[STATUS_PROVIDER_STATUS_LAST] = {0}; -static GMainLoop * mainloop = NULL; -static StatusServiceDbus * dbus_interface = NULL; -static StatusProviderStatus global_status = STATUS_PROVIDER_STATUS_DISCONNECTED; - -static void -status_update (void) { - StatusProviderStatus oldglobal = global_status; - global_status = STATUS_PROVIDER_STATUS_DISCONNECTED; - - /* Ask everyone what they think the status should be, if - they're more connected, up the global level */ - int i; - for (i = 0; i < STATUS_PROVIDER_CNT; i++) { - StatusProviderStatus localstatus = status_provider_get_status(status_providers[i]); - if (localstatus < global_status) { - global_status = localstatus; - } - } - - /* If changed */ - if (global_status != oldglobal) { - g_debug("Global status changed to: %s", _(status_strings[global_status])); - - /* Configure the icon on the panel */ - status_service_dbus_set_status(dbus_interface, status_icons[global_status]); - - /* If we're now disconnected, make setting the statuses - insensitive. */ - if (global_status == STATUS_PROVIDER_STATUS_DISCONNECTED) { - StatusProviderStatus i; - for (i = STATUS_PROVIDER_STATUS_ONLINE; i < STATUS_PROVIDER_STATUS_LAST; i++) { - if (status_menuitems[i] == NULL) continue; - dbusmenu_menuitem_property_set_bool(status_menuitems[i], DBUSMENU_MENUITEM_PROP_SENSITIVE, FALSE); - } - } - - /* If we're now back to a state where we have an IM client - connected then we need to resensitize the items. */ - if (oldglobal == STATUS_PROVIDER_STATUS_DISCONNECTED) { - StatusProviderStatus i; - for (i = STATUS_PROVIDER_STATUS_ONLINE; i < STATUS_PROVIDER_STATUS_LAST; i++) { - if (status_menuitems[i] == NULL) continue; - dbusmenu_menuitem_property_set_bool(status_menuitems[i], DBUSMENU_MENUITEM_PROP_SENSITIVE, TRUE); - } - } - } - - return; -} - -static void -status_menu_click (DbusmenuMenuitem * mi, gpointer data) -{ - StatusProviderStatus status = (StatusProviderStatus)GPOINTER_TO_INT(data); - g_debug("Setting status: %d", status); - int i; - for (i = 0; i < STATUS_PROVIDER_CNT; i++) { - status_provider_set_status(status_providers[i], status); - } - - return; -} - -static gboolean -build_providers (gpointer data) -{ - int i; - for (i = 0; i < STATUS_PROVIDER_CNT; i++) { - status_providers[i] = status_provider_newfuncs[i](); - - if (status_providers[i] != NULL) { - g_signal_connect(G_OBJECT(status_providers[i]), STATUS_PROVIDER_SIGNAL_STATUS_CHANGED, G_CALLBACK(status_update), NULL); - } - } - - status_update(); - - return FALSE; -} - -static void -build_user_item (DbusmenuMenuitem * root) -{ - struct passwd * pwd = NULL; - - pwd = getpwuid(getuid()); - - if (pwd != NULL && pwd->pw_gecos != NULL) { - gchar * name = g_strdup(pwd->pw_gecos); - gchar * walker = name; - while (*walker != '\0' && *walker != ',') { walker++; } - *walker = '\0'; - - if (name[0] != '\0') { - DbusmenuMenuitem * useritem = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(useritem, DBUSMENU_MENUITEM_PROP_LABEL, name); - dbusmenu_menuitem_property_set_bool(useritem, DBUSMENU_MENUITEM_PROP_SENSITIVE, FALSE); - dbusmenu_menuitem_child_append(root, useritem); - } - - g_free(name); - } else { - g_debug("PWD: %s", (pwd == NULL ? "(pwd null)" : (pwd->pw_gecos == NULL ? "(gecos null)" : pwd->pw_gecos))); - } - - return; -} - -static gboolean -build_menu (gpointer data) -{ - DbusmenuMenuitem * root = DBUSMENU_MENUITEM(data); - g_return_val_if_fail(root != NULL, FALSE); - - build_user_item(root); - - status_menuitem = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(status_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, _("Set Status")); - dbusmenu_menuitem_child_append(root, status_menuitem); - - StatusProviderStatus i; - for (i = STATUS_PROVIDER_STATUS_ONLINE; i < STATUS_PROVIDER_STATUS_LAST; i++) { - if (i == STATUS_PROVIDER_STATUS_DISCONNECTED) { - /* We don't want an item for the disconnected status. Users - can't set that value through the menu :) */ - continue; - } - - status_menuitems[i] = dbusmenu_menuitem_new(); - - dbusmenu_menuitem_property_set(status_menuitems[i], DBUSMENU_MENUITEM_PROP_LABEL, _(status_strings[i])); - dbusmenu_menuitem_property_set(status_menuitems[i], DBUSMENU_MENUITEM_PROP_ICON, status_icons[i]); - if (global_status == STATUS_PROVIDER_STATUS_DISCONNECTED) { - dbusmenu_menuitem_property_set_bool(status_menuitems[i], DBUSMENU_MENUITEM_PROP_SENSITIVE, FALSE); - } - g_signal_connect(G_OBJECT(status_menuitems[i]), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(status_menu_click), GINT_TO_POINTER(i)); - - dbusmenu_menuitem_child_append(status_menuitem, status_menuitems[i]); - - g_debug("Built %s", status_strings[i]); - } - - return FALSE; -} - -int -main (int argc, char ** argv) -{ - g_type_init(); - - /* Setting up i18n and gettext. Apparently, we need - all of these. */ - setlocale (LC_ALL, ""); - bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); - textdomain (GETTEXT_PACKAGE); - - DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - GError * error = NULL; - guint nameret = 0; - - if (!org_freedesktop_DBus_request_name(bus_proxy, INDICATOR_STATUS_DBUS_NAME, 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } - - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } - - g_idle_add(build_providers, NULL); - - root_menuitem = dbusmenu_menuitem_new(); - DbusmenuServer * server = dbusmenu_server_new(INDICATOR_STATUS_DBUS_OBJECT); - dbusmenu_server_set_root(server, root_menuitem); - - g_idle_add(build_menu, root_menuitem); - - dbus_interface = g_object_new(STATUS_SERVICE_DBUS_TYPE, NULL); - - mainloop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(mainloop); - - return 0; -} - diff --git a/src/status-service.xml b/src/status-service.xml deleted file mode 100644 index 977b338..0000000 --- a/src/status-service.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<node name="/"> - <interface name="org.ayatana.indicator.status.service"> - -<!-- Methods --> - <method name="Watch"> - <annotation name="org.freedesktop.DBus.GLib.Async" value="true" /> - </method> - <method name="StatusIcons"> - <arg type="s" name="icons" direction="out" /> - </method> - <method name="PrettyUserName"> - <arg type="s" name="name" direction="out" /> - </method> - -<!-- Signals --> - <signal name="UserChanged"> - <arg type="s" name="name" direction="out" /> - </signal> - <signal name="StatusIconsChanged"> - <arg type="s" name="icons" direction="out" /> - </signal> - - </interface> -</node> |