diff options
author | Stefano Karapetsas <[email protected]> | 2011-11-22 00:52:25 +0100 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2011-11-22 00:52:25 +0100 |
commit | 12b9dff0bfd11456987edf4cadbc34d1367d4499 (patch) | |
tree | 87235655b3988aac336d33c8aeedf87a9b9b99ed | |
parent | a509013b9b4a80a13bfb4adb365dee38fb2b81d7 (diff) | |
download | mate-sensors-applet-12b9dff0bfd11456987edf4cadbc34d1367d4499.tar.bz2 mate-sensors-applet-12b9dff0bfd11456987edf4cadbc34d1367d4499.tar.xz |
deleted gnome files
-rw-r--r-- | gnome-doc-utils.make | 655 | ||||
-rw-r--r-- | sensors-applet/active-sensor-libnotify.c | 113 | ||||
-rw-r--r-- | sensors-applet/active-sensor-libnotify.h | 35 | ||||
-rw-r--r-- | sensors-applet/sensors-applet-gconf.c | 492 | ||||
-rw-r--r-- | sensors-applet/sensors-applet-gconf.h | 91 |
5 files changed, 0 insertions, 1386 deletions
diff --git a/gnome-doc-utils.make b/gnome-doc-utils.make deleted file mode 100644 index 97fd549..0000000 --- a/gnome-doc-utils.make +++ /dev/null @@ -1,655 +0,0 @@ -# gnome-doc-utils.make - make magic for building documentation -# Copyright (C) 2004-2005 Shaun McCance <[email protected]> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY 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, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -################################################################################ -## @@ Generating Header Files - -## @ DOC_H_FILE -## The name of the header file to generate -DOC_H_FILE ?= - -## @ DOC_H_DOCS -## The input DocBook files for generating the header file -DOC_H_DOCS ?= - -$(DOC_H_FILE): $(DOC_H_DOCS); - @rm -f [email protected]; touch [email protected]; - echo 'const gchar* documentation_credits[] = {' >> [email protected] - list='$(DOC_H_DOCS)'; for doc in $$list; do \ - xmlpath="`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`:$(srcdir)/`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`"; \ - if ! test -f "$$doc"; then doc="$(srcdir)/$$doc"; fi; \ - xsltproc --path "$$xmlpath" $(_credits) $$doc; \ - done | sort | uniq \ - | awk 'BEGIN{s=""}{n=split($$0,w,"<");if(s!=""&&s!=substr(w[1],1,length(w[1])-1)){print s};if(n>1){print $$0;s=""}else{s=$$0}};END{if(s!=""){print s}}' \ - | sed -e 's/\\/\\\\/' -e 's/"/\\"/' -e 's/\(.*\)/\t"\1",/' >> [email protected] - echo ' NULL' >> [email protected] - echo '};' >> [email protected] - echo >> [email protected] - list='$(DOC_H_DOCS)'; for doc in $$list; do \ - xmlpath="`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`:$(srcdir)/`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`"; \ - if ! test -f "$$doc"; then doc="$(srcdir)/$$doc"; fi; \ - docid=`echo "$$doc" | sed -e 's/.*\/\([^/]*\)\.xml/\1/' \ - | sed -e 's/[^a-zA-Z_]/_/g' | tr 'a-z' 'A-Z'`; \ - echo $$xmlpath; \ - ids=`xsltproc --xinclude --path "$$xmlpath" $(_ids) $$doc`; \ - for id in $$ids; do \ - echo '#define HELP_'`echo $$docid`'_'`echo $$id \ - | sed -e 's/[^a-zA-Z_]/_/g' | tr 'a-z' 'A-Z'`' "'$$id'"' >> [email protected]; \ - done; \ - echo >> [email protected]; \ - done; - cp [email protected] $@ && rm -f [email protected] - -dist-check-gdu: -if !HAVE_GNOME_DOC_UTILS - @echo "*** GNOME Doc Utils must be installed in order to make dist" - @false -endif - -.PHONY: dist-doc-header -dist-doc-header: $(DOC_H_FILE) - @if test -f "$(DOC_H_FILE)"; then d=; else d="$(srcdir)/"; fi; \ - echo "$(INSTALL_DATA) $${d}$(DOC_H_FILE) $(distdir)/$(DOC_H_FILE)"; \ - $(INSTALL_DATA) "$${d}$(DOC_H_FILE)" "$(distdir)/$(DOC_H_FILE)"; - -doc-dist-hook: dist-check-gdu $(if $(DOC_H_FILE),dist-doc-header) - -.PHONY: clean-doc-header -_clean_doc_header = $(if $(DOC_H_FILE),clean-doc-header) -clean-local: $(_clean_doc_header) -distclean-local: $(_clean_doc_header) -mostlyclean-local: $(_clean_doc_header) -maintainer-clean-local: $(_clean_doc_header) -clean-doc-header: - rm -f $(DOC_H_FILE) - -all: $(DOC_H_FILE) - - -################################################################################ -## @@ Generating Documentation Files - -## @ DOC_MODULE -## The name of the document being built -DOC_MODULE ?= - -## @ DOC_ID -## The unique identifier for a Mallard document -DOC_ID ?= - -## @ DOC_PAGES -## Page files in a Mallard document -DOC_PAGES ?= - -## @ DOC_ENTITIES -## Files included with a SYSTEM entity -DOC_ENTITIES ?= - -## @ DOC_INCLUDES -## Files included with XInclude -DOC_INCLUDES ?= - -## @ DOC_FIGURES -## Figures and other external data -DOC_FIGURES ?= - -## @ DOC_FORMATS -## The default formats to be built and installed -DOC_FORMATS ?= docbook -_DOC_REAL_FORMATS = $(if $(DOC_USER_FORMATS),$(DOC_USER_FORMATS),$(DOC_FORMATS)) - -## @ DOC_LINGUAS -## The languages this document is translated into -DOC_LINGUAS ?= -_DOC_REAL_LINGUAS = $(if $(filter environment,$(origin LINGUAS)), \ - $(filter $(LINGUAS),$(DOC_LINGUAS)), \ - $(DOC_LINGUAS)) - -_DOC_ABS_SRCDIR = @abs_srcdir@ - - -################################################################################ -## Variables for Bootstrapping - -_xml2po ?= `which xml2po` -_xml2po_mode = $(if $(DOC_ID),mallard,docbook) - -_db2html ?= `$(PKG_CONFIG) --variable db2html gnome-doc-utils` -_db2omf ?= `$(PKG_CONFIG) --variable db2omf gnome-doc-utils` -_malrng ?= `$(PKG_CONFIG) --variable malrng gnome-doc-utils` -_chunks ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/chunks.xsl -_credits ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/credits.xsl -_ids ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/ids.xsl - -if ENABLE_SK -_ENABLE_SK = true -_skpkgdatadir ?= `scrollkeeper-config --pkgdatadir` -_sklocalstatedir ?= `scrollkeeper-config --pkglocalstatedir` -_skcontentslist ?= $(_skpkgdatadir)/Templates/C/scrollkeeper_cl.xml -endif - - -################################################################################ -## @@ Rules for OMF Files - -db2omf_args = \ - --stringparam db2omf.basename $(DOC_MODULE) \ - --stringparam db2omf.format $(3) \ - --stringparam db2omf.dtd \ - $(shell xmllint --format $(2) | grep -h PUBLIC | head -n 1 \ - | sed -e 's/.*PUBLIC \(\"[^\"]*\"\).*/\1/') \ - --stringparam db2omf.lang $(notdir $(patsubst %/$(notdir $(2)),%,$(2))) \ - --stringparam db2omf.omf_dir "$(OMF_DIR)" \ - --stringparam db2omf.help_dir "$(HELP_DIR)" \ - --stringparam db2omf.omf_in "$(_DOC_OMF_IN)" \ - $(if $(_ENABLE_SK), \ - --stringparam db2omf.scrollkeeper_cl "$(_skcontentslist)") \ - $(_db2omf) $(2) - -## @ _DOC_OMF_IN -## The OMF input file -_DOC_OMF_IN = $(if $(DOC_MODULE),$(wildcard $(_DOC_ABS_SRCDIR)/$(DOC_MODULE).omf.in)) - -## @ _DOC_OMF_DB -## The OMF files for DocBook output -_DOC_OMF_DB = $(if $(_DOC_OMF_IN), \ - $(foreach lc,C $(_DOC_REAL_LINGUAS),$(DOC_MODULE)-$(lc).omf)) - -$(_DOC_OMF_DB) : $(_DOC_OMF_IN) -$(_DOC_OMF_DB) : $(DOC_MODULE)-%.omf : %/$(DOC_MODULE).xml - @test "x$(_ENABLE_SK)" != "xtrue" -o -f "$(_skcontentslist)" || { \ - echo "The file '$(_skcontentslist)' does not exist." >&2; \ - echo "Please check your ScrollKeeper installation." >&2; \ - exit 1; } - xsltproc -o $@ $(call db2omf_args,$@,$<,'docbook') || { rm -f "$@"; exit 1; } - -## @ _DOC_OMF_HTML -## The OMF files for HTML output -_DOC_OMF_HTML = $(if $(_DOC_OMF_IN), \ - $(foreach lc,C $(_DOC_REAL_LINGUAS),$(DOC_MODULE)-html-$(lc).omf)) - -$(_DOC_OMF_HTML) : $(_DOC_OMF_IN) -$(_DOC_OMF_HTML) : $(DOC_MODULE)-html-%.omf : %/$(DOC_MODULE).xml -if ENABLE_SK - @test "x$(_ENABLE_SK)" != "xtrue" -o -f "$(_skcontentslist)" || { \ - echo "The file '$(_skcontentslist)' does not exist" >&2; \ - echo "Please check your ScrollKeeper installation." >&2; \ - exit 1; } -endif - xsltproc -o $@ $(call db2omf_args,$@,$<,'xhtml') || { rm -f "$@"; exit 1; } - -## @ _DOC_OMF_ALL -## All OMF output files to be built -# FIXME -_DOC_OMF_ALL = \ - $(if $(filter docbook,$(_DOC_REAL_FORMATS)),$(_DOC_OMF_DB)) \ - $(if $(filter html HTML,$(_DOC_REAL_FORMATS)),$(_DOC_OMF_HTML)) - -.PHONY: omf -omf: $(_DOC_OMF_ALL) - - -################################################################################ -## @@ C Locale Documents - -## @ _DOC_C_MODULE -## The top-level documentation file in the C locale -_DOC_C_MODULE = $(if $(DOC_MODULE),C/$(DOC_MODULE).xml) - -## @ _DOC_C_PAGES -## Page files in a Mallard document in the C locale -_DOC_C_PAGES = $(foreach page,$(DOC_PAGES),C/$(page)) - -## @ _DOC_C_ENTITIES -## Files included with a SYSTEM entity in the C locale -_DOC_C_ENTITIES = $(foreach ent,$(DOC_ENTITIES),C/$(ent)) - -## @ _DOC_C_XINCLUDES -## Files included with XInclude in the C locale -_DOC_C_INCLUDES = $(foreach inc,$(DOC_INCLUDES),C/$(inc)) - -## @ _DOC_C_DOCS -## All documentation files in the C locale -_DOC_C_DOCS = \ - $(_DOC_C_ENTITIES) $(_DOC_C_INCLUDES) \ - $(_DOC_C_PAGES) $(_DOC_C_MODULE) - -## @ _DOC_C_DOCS_NOENT -## All documentation files in the C locale, -## except files included with a SYSTEM entity -_DOC_C_DOCS_NOENT = \ - $(_DOC_C_MODULE) $(_DOC_C_INCLUDES) \ - $(_DOC_C_PAGES) - -## @ _DOC_C_FIGURES -## All figures and other external data in the C locale -_DOC_C_FIGURES = $(if $(DOC_FIGURES), \ - $(foreach fig,$(DOC_FIGURES),C/$(fig)), \ - $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/C/figures/*.png))) - -## @ _DOC_C_HTML -## All HTML documentation in the C locale -# FIXME: probably have to shell escape to determine the file names -_DOC_C_HTML = $(foreach f, \ - $(shell xsltproc --xinclude \ - --stringparam db.chunk.basename "$(DOC_MODULE)" \ - $(_chunks) "C/$(DOC_MODULE).xml"), \ - C/$(f).xhtml) - -############################################################################### -## @@ Other Locale Documentation - -## @ _DOC_POFILES -## The .po files used for translating the document -_DOC_POFILES = $(if $(DOC_MODULE)$(DOC_ID), \ - $(foreach lc,$(_DOC_REAL_LINGUAS),$(lc)/$(lc).po)) - -.PHONY: po -po: $(_DOC_POFILES) - -## @ _DOC_MOFILES -## The .mo files used for translating the document -_DOC_MOFILES = $(patsubst %.po,%.mo,$(_DOC_POFILES)) - -.PHONY: mo -mo: $(_DOC_MOFILES) - -## @ _DOC_LC_MODULES -## The top-level documentation files in all other locales -_DOC_LC_MODULES = $(if $(DOC_MODULE), \ - $(foreach lc,$(_DOC_REAL_LINGUAS),$(lc)/$(DOC_MODULE).xml)) - -## @ _DOC_LC_PAGES -## Page files in a Mallard document in all other locales -_DOC_LC_PAGES = \ - $(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach page,$(_DOC_C_PAGES), \ - $(lc)/$(notdir $(page)) )) - -## @ _DOC_LC_XINCLUDES -## Files included with XInclude in all other locales -_DOC_LC_INCLUDES = \ - $(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach inc,$(_DOC_C_INCLUDES), \ - $(lc)/$(notdir $(inc)) )) - -## @ _DOC_LC_HTML -## All HTML documentation in all other locales -# FIXME: probably have to shell escape to determine the file names -_DOC_LC_HTML = \ - $(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach doc,$(_DOC_C_HTML), \ - $(lc)/$(notdir $(doc)) )) - -## @ _DOC_LC_DOCS -## All documentation files in all other locales -_DOC_LC_DOCS = \ - $(_DOC_LC_MODULES) $(_DOC_LC_INCLUDES) $(_DOC_LC_PAGES) \ - $(if $(filter html HTML,$(_DOC_REAL_FORMATS)),$(_DOC_LC_HTML)) - -## @ _DOC_LC_FIGURES -## All figures and other external data in all other locales -_DOC_LC_FIGURES = $(foreach lc,$(_DOC_REAL_LINGUAS), \ - $(patsubst C/%,$(lc)/%,$(_DOC_C_FIGURES)) ) - -_DOC_SRC_FIGURES = \ - $(foreach fig,$(_DOC_C_FIGURES), $(foreach lc,C $(_DOC_REAL_LINGUAS), \ - $(wildcard $(srcdir)/$(lc)/$(patsubst C/%,%,$(fig))) )) - -$(_DOC_POFILES): - @if ! test -d $(dir $@); then \ - echo "mkdir $(dir $@)"; \ - mkdir "$(dir $@)"; \ - fi - @if test ! -f $@ -a -f $(srcdir)/$@; then \ - echo "cp $(srcdir)/$@ $@"; \ - cp "$(srcdir)/$@" "$@"; \ - fi; - @docs=; \ - list='$(_DOC_C_DOCS_NOENT)'; for doc in $$list; do \ - docs="$$docs $(_DOC_ABS_SRCDIR)/$$doc"; \ - done; \ - if ! test -f $@; then \ - echo "(cd $(dir $@) && \ - $(_xml2po) -m $(_xml2po_mode) -e $$docs > $(notdir $@).tmp && \ - cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)"; \ - (cd $(dir $@) && \ - $(_xml2po) -m $(_xml2po_mode) -e $$docs > $(notdir $@).tmp && \ - cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp); \ - else \ - echo "(cd $(dir $@) && \ - $(_xml2po) -m $(_xml2po_mode) -e -u $(notdir $@) $$docs)"; \ - (cd $(dir $@) && \ - $(_xml2po) -m $(_xml2po_mode) -e -u $(notdir $@) $$docs); \ - fi - -$(_DOC_MOFILES): %.mo: %.po - @if ! test -d $(dir $@); then \ - echo "mkdir $(dir $@)"; \ - mkdir "$(dir $@)"; \ - fi - msgfmt -o $@ $< - -# FIXME: fix the dependancy -# FIXME: hook xml2po up -$(_DOC_LC_DOCS) : $(_DOC_MOFILES) -$(_DOC_LC_DOCS) : $(_DOC_C_DOCS) - if ! test -d $(dir $@); then mkdir $(dir $@); fi - if [ -f "C/$(notdir $@)" ]; then d="../"; else d="$(_DOC_ABS_SRCDIR)/"; fi; \ - mo="$(dir $@)$(patsubst %/$(notdir $@),%,$@).mo"; \ - if [ -f "$${mo}" ]; then mo="../$${mo}"; else mo="$(_DOC_ABS_SRCDIR)/$${mo}"; fi; \ - (cd $(dir $@) && \ - $(_xml2po) -m $(_xml2po_mode) -e -t "$${mo}" \ - "$${d}C/$(notdir $@)" > $(notdir $@).tmp && \ - cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp) - -## @ _DOC_POT -## A pot file -_DOC_POT = $(if $(DOC_MODULE),$(DOC_MODULE).pot) -.PHONY: pot -pot: $(_DOC_POT) -$(_DOC_POT): $(_DOC_C_DOCS_NOENT) - $(_xml2po) -m $(_xml2po_mode) -e -o $@ $^ - - -################################################################################ -## @@ All Documentation - -## @ _DOC_HTML_ALL -## All HTML documentation, only if it's built -_DOC_HTML_ALL = $(if $(filter html HTML,$(_DOC_REAL_FORMATS)), \ - $(_DOC_C_HTML) $(_DOC_LC_HTML)) - -_DOC_HTML_TOPS = $(foreach lc,C $(_DOC_REAL_LINGUAS),$(lc)/$(DOC_MODULE).xhtml) - -$(_DOC_HTML_TOPS): $(_DOC_C_DOCS) $(_DOC_LC_DOCS) - xsltproc -o $@ --xinclude --param db.chunk.chunk_top "false()" --stringparam db.chunk.basename "$(DOC_MODULE)" --stringparam db.chunk.extension ".xhtml" $(_db2html) $(patsubst %.xhtml,%.xml,$@) - - -################################################################################ -## All - -all: \ - $(_DOC_C_DOCS) $(_DOC_LC_DOCS) \ - $(_DOC_OMF_ALL) $(_DOC_DSK_ALL) \ - $(_DOC_HTML_ALL) $(_DOC_POFILES) - - -################################################################################ -## Clean - -.PHONY: clean-doc-omf clean-doc-dsk clean-doc-lc clean-doc-dir - -clean-doc-omf: ; rm -f $(_DOC_OMF_DB) $(_DOC_OMF_HTML) -clean-doc-dsk: ; rm -f $(_DOC_DSK_DB) $(_DOC_DSK_HTML) -clean-doc-lc: - rm -f $(_DOC_LC_DOCS) - rm -f $(_DOC_MOFILES) - @list='$(_DOC_POFILES)'; for po in $$list; do \ - if ! test "$$po" -ef "$(srcdir)/$$po"; then \ - echo "rm -f $$po"; \ - rm -f "$$po"; \ - fi; \ - done -# .xml2.po.mo cleaning is obsolete as of 0.18.1 and could be removed in 0.20.x - @for lc in C $(_DOC_REAL_LINGUAS); do \ - if test -f "$$lc/.xml2po.mo"; then \ - echo "rm -f $$lc/.xml2po.mo"; \ - rm -f "$$lc/.xml2po.mo"; \ - fi; \ - done -clean-doc-dir: clean-doc-lc - @for lc in C $(_DOC_REAL_LINGUAS); do \ - for dir in `find $$lc -depth -type d`; do \ - if ! test $$dir -ef $(srcdir)/$$dir; then \ - echo "rmdir $$dir"; \ - rmdir "$$dir"; \ - fi; \ - done; \ - done - -_clean_omf = $(if $(_DOC_OMF_IN),clean-doc-omf) -_clean_dsk = $(if $(_DOC_DSK_IN),clean-doc-dsk) -_clean_lc = $(if $(_DOC_REAL_LINGUAS),clean-doc-lc) -_clean_dir = $(if $(DOC_MODULE)$(DOC_ID),clean-doc-dir) - -clean-local: \ - $(_clean_omf) $(_clean_dsk) \ - $(_clean_lc) $(_clean_dir) -distclean-local: \ - $(_clean_omf) $(_clean_dsk) \ - $(_clean_lc) $(_clean_dir) -mostlyclean-local: \ - $(_clean_omf) $(_clean_dsk) \ - $(_clean_lc) $(_clean_dir) -maintainer-clean-local: \ - $(_clean_omf) $(_clean_dsk) \ - $(_clean_lc) $(_clean_dir) - - - -################################################################################ -## Dist - -.PHONY: dist-doc-docs dist-doc-pages dist-doc-figs dist-doc-omf dist-doc-dsk -doc-dist-hook: \ - $(if $(DOC_MODULE)$(DOC_ID),dist-doc-docs) \ - $(if $(_DOC_C_FIGURES),dist-doc-figs) \ - $(if $(_DOC_OMF_IN),dist-doc-omf) -# $(if $(_DOC_DSK_IN),dist-doc-dsk) - -dist-doc-docs: $(_DOC_C_DOCS) $(_DOC_LC_DOCS) $(_DOC_POFILES) - @for lc in C $(_DOC_REAL_LINGUAS); do \ - echo " $(mkinstalldirs) $(distdir)/$$lc"; \ - $(mkinstalldirs) "$(distdir)/$$lc"; \ - done - @list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS) $(_DOC_POFILES)'; \ - for doc in $$list; do \ - if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \ - docdir=`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \ - if ! test -d "$(distdir)/$$docdir"; then \ - echo "$(mkinstalldirs) $(distdir)/$$docdir"; \ - $(mkinstalldirs) "$(distdir)/$$docdir"; \ - fi; \ - echo "$(INSTALL_DATA) $$d$$doc $(distdir)/$$doc"; \ - $(INSTALL_DATA) "$$d$$doc" "$(distdir)/$$doc"; \ - done - -dist-doc-figs: $(_DOC_SRC_FIGURES) - @list='$(_DOC_C_FIGURES) $(_DOC_LC_FIGURES)'; \ - for fig in $$list; do \ - if test -f "$$fig"; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$fig"; then \ - figdir=`echo $$fig | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \ - if ! test -d "$(distdir)/$$figdir"; then \ - echo "$(mkinstalldirs) $(distdir)/$$figdir"; \ - $(mkinstalldirs) "$(distdir)/$$figdir"; \ - fi; \ - echo "$(INSTALL_DATA) $$d$$fig $(distdir)/$$fig"; \ - $(INSTALL_DATA) "$$d$$fig" "$(distdir)/$$fig"; \ - fi; \ - done; - -dist-doc-omf: - @if test -f "$(_DOC_OMF_IN)"; then d=; else d="$(srcdir)/"; fi; \ - echo "$(INSTALL_DATA) $$d$(_DOC_OMF_IN) $(distdir)/$(notdir $(_DOC_OMF_IN))"; \ - $(INSTALL_DATA) "$$d$(_DOC_OMF_IN)" "$(distdir)/$(notdir $(_DOC_OMF_IN))" - -dist-doc-dsk: - @if test -f "$(_DOC_DSK_IN)"; then d=; else d="$(srcdir)/"; fi; \ - echo "$(INSTALL_DATA) $$d$(_DOC_DSK_IN) $(distdir)/$(notdir $(_DOC_DSK_IN))"; \ - $(INSTALL_DATA) "$$d$(_DOC_DSK_IN)" "$(distdir)/$(notdir $(_DOC_DSK_IN))" - - - -################################################################################ -## Check - -.PHONY: check-doc-docs check-doc-omf -check: \ - $(if $(DOC_MODULE),check-doc-docs) \ - $(if $(DOC_ID),check-doc-pages) \ - $(if $(_DOC_OMF_IN),check-doc-omf) - -check-doc-docs: $(_DOC_C_DOCS) $(_DOC_LC_DOCS) - @for lc in C $(_DOC_REAL_LINGUAS); do \ - if test -f "$$lc"; \ - then d=; \ - xmlpath="$$lc"; \ - else \ - d="$(srcdir)/"; \ - xmlpath="$$lc:$(srcdir)/$$lc"; \ - fi; \ - echo "xmllint --noout --noent --path $$xmlpath --xinclude --postvalid $$d$$lc/$(DOC_MODULE).xml"; \ - xmllint --noout --noent --path "$$xmlpath" --xinclude --postvalid "$$d$$lc/$(DOC_MODULE).xml"; \ - done - -check-doc-pages: $(_DOC_C_PAGES) $(_DOC_LC_PAGES) - for lc in C $(_DOC_REAL_LINGUAS); do \ - if test -f "$$lc"; \ - then d=; \ - xmlpath="$$lc"; \ - else \ - d="$(srcdir)/"; \ - xmlpath="$$lc:$(srcdir)/$$lc"; \ - fi; \ - for page in $(DOC_PAGES); do \ - echo "xmllint --noout --noent --path $$xmlpath --xinclude --relaxng $(_malrng) $$d$$lc/$$page"; \ - xmllint --noout --noent --path "$$xmlpath" --xinclude --relaxng "$(_malrng)" "$$d$$lc/$$page"; \ - done; \ - done - -check-doc-omf: $(_DOC_OMF_ALL) - @list='$(_DOC_OMF_ALL)'; for omf in $$list; do \ - echo "xmllint --noout --xinclude --dtdvalid 'http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd' $$omf"; \ - xmllint --noout --xinclude --dtdvalid 'http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd' $$omf; \ - done - - - -################################################################################ -## Install - -.PHONY: install-doc-docs install-doc-html install-doc-figs install-doc-omf install-doc-dsk - -_doc_install_dir = $(if $(DOC_ID),$(DOC_ID),$(DOC_MODULE)) - -install-data-local: \ - $(if $(DOC_MODULE)$(DOC_ID),install-doc-docs) \ - $(if $(_DOC_HTML_ALL),install-doc-html) \ - $(if $(_DOC_C_FIGURES),install-doc-figs) \ - $(if $(_DOC_OMF_IN),install-doc-omf) -# $(if $(_DOC_DSK_IN),install-doc-dsk) - -install-doc-docs: - @for lc in C $(_DOC_REAL_LINGUAS); do \ - echo "$(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$lc"; \ - $(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$lc; \ - done - @list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS)'; for doc in $$list; do \ - if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \ - docdir="$$lc/"`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \ - docdir="$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$docdir"; \ - if ! test -d "$$docdir"; then \ - echo "$(mkinstalldirs) $$docdir"; \ - $(mkinstalldirs) "$$docdir"; \ - fi; \ - echo "$(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \ - $(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc; \ - done - -install-doc-figs: - @list='$(patsubst C/%,%,$(_DOC_C_FIGURES))'; for fig in $$list; do \ - for lc in C $(_DOC_REAL_LINGUAS); do \ - figsymlink=false; \ - if test -f "$$lc/$$fig"; then \ - figfile="$$lc/$$fig"; \ - elif test -f "$(srcdir)/$$lc/$$fig"; then \ - figfile="$(srcdir)/$$lc/$$fig"; \ - else \ - figsymlink=true; \ - fi; \ - figdir="$$lc/"`echo $$fig | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \ - figdir="$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$figdir"; \ - if ! test -d "$$figdir"; then \ - echo "$(mkinstalldirs) $$figdir"; \ - $(mkinstalldirs) "$$figdir"; \ - fi; \ - figbase=`echo $$fig | sed -e 's/^.*\///'`; \ - if $$figsymlink; then \ - echo "cd $$figdir && $(LN_S) -f ../../C/$$fig $$figbase"; \ - ( cd "$$figdir" && $(LN_S) -f "../../C/$$fig" "$$figbase" ); \ - else \ - echo "$(INSTALL_DATA) $$figfile $$figdir$$figbase"; \ - $(INSTALL_DATA) "$$figfile" "$$figdir$$figbase"; \ - fi; \ - done; \ - done - -install-doc-html: - echo install-html - -install-doc-omf: - $(mkinstalldirs) $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir) - @list='$(_DOC_OMF_ALL)'; for omf in $$list; do \ - echo "$(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \ - $(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf; \ - done - @if test "x$(_ENABLE_SK)" = "xtrue"; then \ - echo "scrollkeeper-update -p $(DESTDIR)$(_sklocalstatedir) -o $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)"; \ - scrollkeeper-update -p "$(DESTDIR)$(_sklocalstatedir)" -o "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)"; \ - fi; - -install-doc-dsk: - echo install-dsk - - - -################################################################################ -## Uninstall - -.PHONY: uninstall-doc-docs uninstall-doc-html uninstall-doc-figs uninstall-doc-omf uninstall-doc-dsk -uninstall-local: \ - $(if $(DOC_MODULE)$(DOC_ID),uninstall-doc-docs) \ - $(if $(_DOC_HTML_ALL),uninstall-doc-html) \ - $(if $(_DOC_C_FIGURES),uninstall-doc-figs) \ - $(if $(_DOC_OMF_IN),uninstall-doc-omf) -# $(if $(_DOC_DSK_IN),uninstall-doc-dsk) - -uninstall-doc-docs: - @list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS)'; for doc in $$list; do \ - echo " rm -f $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \ - rm -f "$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \ - done - -uninstall-doc-figs: - @list='$(_DOC_C_FIGURES) $(_DOC_LC_FIGURES)'; for fig in $$list; do \ - echo "rm -f $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$fig"; \ - rm -f "$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$fig"; \ - done; - -uninstall-doc-omf: - @list='$(_DOC_OMF_ALL)'; for omf in $$list; do \ - if test "x$(_ENABLE_SK)" = "xtrue"; then \ - echo "scrollkeeper-uninstall -p $(_sklocalstatedir) $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \ - scrollkeeper-uninstall -p "$(_sklocalstatedir)" "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \ - fi; \ - echo "rm -f $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \ - rm -f "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \ - done diff --git a/sensors-applet/active-sensor-libnotify.c b/sensors-applet/active-sensor-libnotify.c deleted file mode 100644 index e69b005..0000000 --- a/sensors-applet/active-sensor-libnotify.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2005-2009 Alex Murray <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - -#ifdef HAVE_LIBNOTIFY -#include <libnotify/notify.h> -#endif - -#include "active-sensor-libnotify.h" - -static void notif_closed_cb(NotifyNotification *notification, - ActiveSensor *active_sensor) -{ - g_assert(notification != NULL && active_sensor != NULL); - - int i; - - g_debug("Notification was closed.. setting reference to NULL so we can show again if needed."); - - // set notif reference to NULL - for (i = 0; i < NUM_NOTIFS; i++) { - if (active_sensor->notification[i] == notification) { - active_sensor->notification[i] = NULL; - break; - } - } -} - - -void active_sensor_libnotify_notify_end(ActiveSensor *active_sensor, - NotifType notif_type) { - GError *error = NULL; - if (active_sensor->notification[notif_type]) { - g_debug("Closing notification"); - if(!notify_notification_close(active_sensor->notification[notif_type], - &error)) { - g_warning("Error closing notification: %s", error->message); - g_error_free(error); - } - g_object_unref(active_sensor->notification[notif_type]); - active_sensor->notification[notif_type] = NULL; - } -} - -void active_sensor_libnotify_notify(ActiveSensor *active_sensor, - NotifType notif_type, - const gchar *summary, - const gchar *message, - const gchar *icon_filename, - gint timeout_msecs, - GtkWidget *attach) { - GError *error = NULL; - - if (!notify_is_initted()) { - if (!notify_init(PACKAGE)) { - return; - } - } - g_debug("Doing notification %s: %s: %s", (notif_type == SENSOR_INTERFACE_ERROR ? "interface-error" : "other") ,summary, message); - - /* leave any existing notification since most likely hasn't changed */ - if (active_sensor->notification[notif_type] != NULL) { - return; -/* active_sensor_libnotify_notify_end(active_sensor, notif_type); */ - } - - /* now create a new one */ - g_debug("Creating new notification"); - active_sensor->notification[notif_type] = notify_notification_new(summary, - message, - icon_filename, - attach); - g_signal_connect(active_sensor->notification[notif_type], "closed", - G_CALLBACK(notif_closed_cb), - active_sensor); - - notify_notification_set_urgency(active_sensor->notification[notif_type], - NOTIFY_URGENCY_CRITICAL); - - - /* timeout may have changed so update it */ - notify_notification_set_timeout(active_sensor->notification[notif_type], - timeout_msecs); - - - g_debug("showing notification"); - if (!notify_notification_show(active_sensor->notification[notif_type], &error)) { - g_debug("Error showing notification: %s", error->message); - g_error_free(error); - } - - - -} - diff --git a/sensors-applet/active-sensor-libnotify.h b/sensors-applet/active-sensor-libnotify.h deleted file mode 100644 index 3c81c88..0000000 --- a/sensors-applet/active-sensor-libnotify.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2005-2009 Alex Murray <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef ACTIVE_SESNOR_LIBNOTIFY_H -#define ACTIVE_SENSOR_LIBNOTIFY_H - -#include "sensors-applet.h" -#include "active-sensor.h" - -void active_sensor_libnotify_notify(ActiveSensor *active_sensor, - NotifType notif_type, - const gchar *summary, - const gchar *message, - const gchar *icon_filename, - gint timeout_msecs, - GtkWidget *attach); -void active_sensor_libnotify_notify_end(ActiveSensor *active_sensor, - NotifType notif_type); - -#endif /* SENSORS_APPLET_LIBNOTIFY_H */ diff --git a/sensors-applet/sensors-applet-gconf.c b/sensors-applet/sensors-applet-gconf.c deleted file mode 100644 index 852a3fc..0000000 --- a/sensors-applet/sensors-applet-gconf.c +++ /dev/null @@ -1,492 +0,0 @@ -/* - * Copyright (C) 2005-2009 Alex Murray <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - -#include "sensors-applet.h" -#include "sensors-applet-gconf.h" - -#define DEFAULT_TIMEOUT 2000 -#define DEFAULT_GRAPH_SIZE 42 - -static const gchar * const compatible_versions[] = { - PACKAGE_VERSION, /* always list current version */ - "2.2.6", - "2.2.5", - "2.2.4", - "2.2.3", - "2.2.2", -}; - -#define NUM_COMPATIBLE_VERSIONS G_N_ELEMENTS(compatible_versions) - -typedef enum { - SENSORS_APPLET_GCONF_ERROR = 0, - SENSORS_APPLET_VERSION_ERROR, -} SensorsAppletGConfError; - -static const gchar * const error_titles[] = { - N_("An error occurred loading the stored sensors data"), - N_("Incompatible sensors configuration found") -}; - -static const gchar * const error_messages[] = { - N_("An error has occurred when loading the stored sensors data. " - "The default values will be used to recover from this error."), - - N_("Unfortunately the previous configuration for GNOME Sensors Applet " - "is not compatible with this version. The existing sensors data " - "will be overwritten with the default values for this new version.") -}; - -/* function to be called if an error occurs - when loading values from gconf */ -static void sensors_applet_gconf_error_occurred(SensorsAppletGConfError error) { - GtkWidget *dialog; - gchar *markup; - - g_debug("Error occurred: %s", error_titles[error]); - markup = g_markup_printf_escaped("<span size=\"large\" weight=\"bold\">%s</span>\n\n%s", _(error_titles[error]), _(error_messages[error])); - - dialog = gtk_message_dialog_new_with_markup(NULL, /* no parent window */ - GTK_DIALOG_MODAL, - GTK_MESSAGE_WARNING, - GTK_BUTTONS_OK, - "%s", markup); - - g_free(markup); - - /* runs dialog as modal and doesn't return until user clicks - * button */ - gtk_dialog_run(GTK_DIALOG(dialog)); - gtk_widget_destroy(GTK_WIDGET(dialog)); -} - - -static void sensors_applet_gconf_set_defaults(SensorsApplet *sensors_applet) { - panel_applet_gconf_set_int(sensors_applet->applet, DISPLAY_MODE, DISPLAY_ICON_WITH_VALUE, NULL); - panel_applet_gconf_set_int(sensors_applet->applet, LAYOUT_MODE, VALUE_BESIDE_LABEL, NULL); - panel_applet_gconf_set_int(sensors_applet->applet, TEMPERATURE_SCALE, CELSIUS, NULL); - panel_applet_gconf_set_int(sensors_applet->applet, TIMEOUT, DEFAULT_TIMEOUT, NULL); - panel_applet_gconf_set_int(sensors_applet->applet, GRAPH_SIZE, DEFAULT_GRAPH_SIZE, NULL); -#ifdef HAVE_LIBNOTIFY - panel_applet_gconf_set_bool(sensors_applet->applet, DISPLAY_NOTIFICATIONS, TRUE, NULL); -#endif - panel_applet_gconf_set_bool(sensors_applet->applet, IS_SETUP, FALSE, NULL); - -} - -/** - * Returns TRUE is old_version is one of the compatible versions - */ -static gboolean sensors_applet_gconf_is_compatible(const gchar *old_version) { - guint i; - for (i = 0; i < NUM_COMPATIBLE_VERSIONS; i++) { - if (g_ascii_strcasecmp(old_version, compatible_versions[i]) == 0) { - return TRUE; - } - } - return FALSE; -} - - -void sensors_applet_gconf_setup(SensorsApplet *sensors_applet) { - gboolean setup = FALSE; - gchar *old_version; - GError *error = NULL; - - /* need to convert old num_samples value to new GRAPH_SIZE - * parameter */ - gint num_samples; - if ((num_samples = panel_applet_gconf_get_int(sensors_applet->applet, - "num_samples", - NULL))) { - g_debug("Convering old num_samples value %d into graph_size", num_samples); - panel_applet_gconf_set_int(sensors_applet->applet, - GRAPH_SIZE, - (num_samples + GRAPH_FRAME_EXTRA_WIDTH), - NULL); - /* reset num_samples to zero */ - panel_applet_gconf_set_int(sensors_applet->applet, - "num_samples", - 0, - NULL); - - } - - /* convert old alarm_commands to high and low if exist */ - GSList *alarm_commands; - if ((alarm_commands = panel_applet_gconf_get_list(sensors_applet->applet, - "alarm_commands", - GCONF_VALUE_STRING, - NULL))) { - - g_debug("Converting old alarm commands to new high and low commands"); - - panel_applet_gconf_set_list(sensors_applet->applet, - LOW_ALARM_COMMANDS, - GCONF_VALUE_STRING, - alarm_commands, - NULL); - panel_applet_gconf_set_list(sensors_applet->applet, - HIGH_ALARM_COMMANDS, - GCONF_VALUE_STRING, - alarm_commands, - NULL); - /* reset old list to null */ - panel_applet_gconf_set_list(sensors_applet->applet, - "alarm_commands", - GCONF_VALUE_STRING, - NULL, - NULL); - g_slist_foreach(alarm_commands, (GFunc)g_free, NULL); - g_slist_free(alarm_commands); - - } - - setup = panel_applet_gconf_get_bool(sensors_applet->applet, - IS_SETUP, &error); - if (error) { - g_debug("Previous configuration not found: %s, setting up manually", error->message); - g_error_free(error); - error = NULL; - setup = FALSE; - } - - - if (setup) { - /* see if setup version matches */ - old_version = panel_applet_gconf_get_string(sensors_applet->applet, - SENSORS_APPLET_VERSION, - &error); - /* if versions don't match or there is no saved - * version string then need to overwrite old config */ - if (error) { - g_debug("Error getting old version string: %s", error->message); - g_error_free(error); - error = NULL; - old_version = NULL; - } - - if (old_version) { - if (sensors_applet_gconf_is_compatible(old_version)) { - /* previously setup and versions match so use - * old values */ - g_debug("GConf data is compatible. Trying to set up sensors from gconf data"); - if (sensors_applet_gconf_setup_sensors(sensors_applet)) { - g_debug("done setting up from gconf"); - } else { - g_debug("Setting gconf defaults only"); - sensors_applet_gconf_set_defaults(sensors_applet); - } - g_free(old_version); - - return; - - - } - g_free(old_version); - - } - sensors_applet_notify(sensors_applet, GCONF_READ_ERROR); - - - sensors_applet_gconf_error_occurred(SENSORS_APPLET_VERSION_ERROR); - } - - /* use defaults */ - g_debug("Setting gconf defaults only"); - sensors_applet_gconf_set_defaults(sensors_applet); -} - -enum { - PATHS_INDEX = 0, - IDS_INDEX, - LABELS_INDEX, - INTERFACES_INDEX, - SENSOR_TYPES_INDEX, - ENABLES_INDEX, - LOW_VALUES_INDEX, - HIGH_VALUES_INDEX, - ALARM_ENABLES_INDEX, - LOW_ALARM_COMMANDS_INDEX, - HIGH_ALARM_COMMANDS_INDEX, - ALARM_TIMEOUTS_INDEX, - MULTIPLIERS_INDEX, - OFFSETS_INDEX, - ICON_TYPES_INDEX, - GRAPH_COLORS_INDEX, - NUM_KEYS -}; - -const gchar * const keys[NUM_KEYS] = { - PATHS, - IDS, - LABELS, - INTERFACES, - SENSOR_TYPES, - ENABLES, - LOW_VALUES, - HIGH_VALUES, - ALARM_ENABLES, - LOW_ALARM_COMMANDS, - HIGH_ALARM_COMMANDS, - ALARM_TIMEOUTS, - MULTIPLIERS, - OFFSETS, - ICON_TYPES, - GRAPH_COLORS, -}; - -/* MUST CORRESPOND TO ABOVE KEYS */ -const GConfValueType key_types[NUM_KEYS] = { - GCONF_VALUE_STRING, /* PATHS */ - GCONF_VALUE_STRING, /* IDS, */ - GCONF_VALUE_STRING, /* LABELS */ - GCONF_VALUE_STRING, /* INTERFACES, */ - GCONF_VALUE_INT, /* SENSOR_TYPES, */ - GCONF_VALUE_BOOL, /* ENABLES, */ - GCONF_VALUE_INT, /* LOW_VALUES, */ - GCONF_VALUE_INT, /* HIGH_VALUES, */ - GCONF_VALUE_BOOL, /* ALARM_ENABLES, */ - GCONF_VALUE_STRING, /* LOW_ALARM_COMMANDS, */ - GCONF_VALUE_STRING, /* HIGH_ALARM_COMMANDS, */ - GCONF_VALUE_INT, /* ALARM_TIMEOUTS, */ - GCONF_VALUE_INT, /* MULTIPLIERS, */ - GCONF_VALUE_INT, /* OFFSETS, */ - GCONF_VALUE_INT, /* ICON_TYPES, */ - GCONF_VALUE_STRING /* GRAPH_COLORS, */ -}; - -void sensors_applet_gconf_set_current_to_lists(GSList *current[], - GSList *lists[], - int len) { - for (len--; len >= 0; len--) { - current[len] = lists[len]; - } -} - -int sensors_applet_gconf_current_not_null(GSList *current[], - int len) { - for (len--; len >= 0; len--) { - if (NULL == current[len]) { - return FALSE; - } - } - return TRUE; -} -void sensors_applet_gconf_current_get_next(GSList *current[], - int len) { - for (len--; len >= 0; len--) { - current[len] = g_slist_next(current[len]); - } -} - -void sensors_applet_gconf_free_lists(GSList *lists[], - int len) { - for (len--; len >= 0; len--) { - if (key_types[len] == GCONF_VALUE_STRING) { - g_slist_foreach(lists[len], (GFunc)g_free, NULL); - } - g_slist_free(lists[len]); - } - -} - -/* gets called if are already setup so we don't have to manually go - through and find sensors etc again */ -gboolean sensors_applet_gconf_setup_sensors(SensorsApplet *sensors_applet) { - /* everything gets stored except alarm timeout indexes, which - we set to -1, and visible which we set to false for all - parent nodes and true for all child nodes */ - int i; - GSList *lists[NUM_KEYS] = {NULL}; - - GSList *current[NUM_KEYS] = {NULL}; - - GError *error = NULL; - - for (i = 0; i < NUM_KEYS; i++) { - lists[i] = panel_applet_gconf_get_list(sensors_applet->applet, - keys[i], - key_types[i], - &error); - if (error || NULL == lists[i]) { - sensors_applet_notify(sensors_applet, GCONF_READ_ERROR); - - sensors_applet_gconf_error_occurred(SENSORS_APPLET_GCONF_ERROR); - if (error) { - g_error_free(error); - } - return FALSE; - } - } - - for (sensors_applet_gconf_set_current_to_lists(current, - lists, - NUM_KEYS); - sensors_applet_gconf_current_not_null(current, - NUM_KEYS); - sensors_applet_gconf_current_get_next(current, - NUM_KEYS)) { - - - g_debug("trying to add sensor from gconf data: %s\n", (gchar *)(current[IDS_INDEX]->data)); - /* need to ensure correct order */ - sensors_applet_add_sensor(sensors_applet, - (gchar *)(current[PATHS_INDEX]->data), - (gchar *)(current[IDS_INDEX]->data), - (gchar *)(current[LABELS_INDEX]->data), - (gchar *)(current[INTERFACES_INDEX]->data), - GPOINTER_TO_UINT(current[SENSOR_TYPES_INDEX]->data), - GPOINTER_TO_INT(current[ENABLES_INDEX]->data), - (gdouble)(GPOINTER_TO_INT(current[LOW_VALUES_INDEX]->data) / 1000.0), - (gdouble)(GPOINTER_TO_INT(current[HIGH_VALUES_INDEX]->data) / 1000.0), - GPOINTER_TO_INT(current[ALARM_ENABLES_INDEX]->data), - (gchar *)(current[LOW_ALARM_COMMANDS_INDEX]->data), - (gchar *)(current[HIGH_ALARM_COMMANDS_INDEX]->data), - GPOINTER_TO_INT(current[ALARM_TIMEOUTS_INDEX]->data), - (gdouble)(GPOINTER_TO_INT(current[MULTIPLIERS_INDEX]->data) / 1000.0), - (gdouble)(GPOINTER_TO_INT(current[OFFSETS_INDEX]->data) / 1000.0), - (SensorType)GPOINTER_TO_UINT(current[ICON_TYPES_INDEX]->data), - (gchar *)(current[GRAPH_COLORS_INDEX]->data) - - ); - - } - sensors_applet_gconf_free_lists(lists, - NUM_KEYS); - - return TRUE; -} - - -gboolean sensors_applet_gconf_save_sensors(SensorsApplet *sensors_applet) { - /* write everything to gconf except VISIBLE and - ALARM_TIMEOUT_INDEX */ - /* for stepping through GtkTreeStore data structure */ - GtkTreeIter interfaces_iter, sensors_iter; - gboolean not_end_of_interfaces = TRUE, not_end_of_sensors = TRUE; - - /* make sure all are initialized to null - since list of - * intializers is horter than number of element, rest get set - * to 0 (ie NULL) */ - GSList *lists[NUM_KEYS] = {NULL}; - int i; - gchar *current_path, *current_id, *current_label, *current_interface, - *current_low_alarm_command, *current_high_alarm_command, - *current_graph_color; - gboolean current_enable, current_alarm_enable; - gdouble current_low_value, current_high_value, current_multiplier, - current_offset; - guint current_alarm_timeout, current_sensor_type, - current_icon_type; - - GError *error = NULL; - - /* now step through the GtkTreeStore sensors to - find which sensors are enabled */ - for (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(sensors_applet->sensors), &interfaces_iter); not_end_of_interfaces; not_end_of_interfaces = gtk_tree_model_iter_next(GTK_TREE_MODEL(sensors_applet->sensors), &interfaces_iter)) { - // store a gconf key for this interface - gtk_tree_model_get(GTK_TREE_MODEL(sensors_applet->sensors), - &interfaces_iter, - ID_COLUMN, ¤t_id, - -1); - - panel_applet_gconf_set_bool(sensors_applet->applet, current_id, TRUE, NULL); - g_free(current_id); - - /* reset sensors sentinel */ - not_end_of_sensors = TRUE; - - for (gtk_tree_model_iter_children(GTK_TREE_MODEL(sensors_applet->sensors), &sensors_iter, &interfaces_iter); not_end_of_sensors; not_end_of_sensors = gtk_tree_model_iter_next(GTK_TREE_MODEL(sensors_applet->sensors), &sensors_iter)) { - gtk_tree_model_get(GTK_TREE_MODEL(sensors_applet->sensors), - &sensors_iter, - PATH_COLUMN, ¤t_path, - ID_COLUMN, ¤t_id, - LABEL_COLUMN, ¤t_label, - INTERFACE_COLUMN, ¤t_interface, - SENSOR_TYPE_COLUMN, ¤t_sensor_type, - ENABLE_COLUMN, ¤t_enable, - LOW_VALUE_COLUMN, ¤t_low_value, - HIGH_VALUE_COLUMN, ¤t_high_value, - ALARM_ENABLE_COLUMN, ¤t_alarm_enable, - LOW_ALARM_COMMAND_COLUMN, ¤t_low_alarm_command, - HIGH_ALARM_COMMAND_COLUMN, ¤t_high_alarm_command, - ALARM_TIMEOUT_COLUMN, ¤t_alarm_timeout, - MULTIPLIER_COLUMN, ¤t_multiplier, - OFFSET_COLUMN, ¤t_offset, - ICON_TYPE_COLUMN, ¤t_icon_type, - GRAPH_COLOR_COLUMN, ¤t_graph_color, - -1); - - /* prepend values as this is faster then just - reverse list when finished */ - lists[PATHS_INDEX] = g_slist_prepend(lists[PATHS_INDEX], current_path); - lists[IDS_INDEX] = g_slist_prepend(lists[IDS_INDEX], current_id); - lists[LABELS_INDEX] = g_slist_prepend(lists[LABELS_INDEX], current_label); - lists[INTERFACES_INDEX] = g_slist_prepend(lists[INTERFACES_INDEX], current_interface); - lists[ENABLES_INDEX] = g_slist_prepend(lists[ENABLES_INDEX], GINT_TO_POINTER(current_enable)); - lists[LOW_VALUES_INDEX] = g_slist_prepend(lists[LOW_VALUES_INDEX], GINT_TO_POINTER((gint)(current_low_value * 1000))); - lists[HIGH_VALUES_INDEX] = g_slist_prepend(lists[HIGH_VALUES_INDEX], GINT_TO_POINTER((gint)(current_high_value * 1000))); - lists[ALARM_ENABLES_INDEX] = g_slist_prepend(lists[ALARM_ENABLES_INDEX], GINT_TO_POINTER(current_alarm_enable)); - lists[LOW_ALARM_COMMANDS_INDEX] = g_slist_prepend(lists[LOW_ALARM_COMMANDS_INDEX], current_low_alarm_command); - lists[HIGH_ALARM_COMMANDS_INDEX] = g_slist_prepend(lists[HIGH_ALARM_COMMANDS_INDEX], current_high_alarm_command); - lists[ALARM_TIMEOUTS_INDEX] = g_slist_prepend(lists[ALARM_TIMEOUTS_INDEX], GINT_TO_POINTER(current_alarm_timeout)); - lists[SENSOR_TYPES_INDEX] = g_slist_prepend(lists[SENSOR_TYPES_INDEX], GUINT_TO_POINTER(current_sensor_type)); - lists[MULTIPLIERS_INDEX] = g_slist_prepend(lists[MULTIPLIERS_INDEX], GINT_TO_POINTER((gint)(current_multiplier * 1000))); - lists[OFFSETS_INDEX] = g_slist_prepend(lists[OFFSETS_INDEX], GINT_TO_POINTER((gint)(current_offset * 1000))); - lists[ICON_TYPES_INDEX] = g_slist_prepend(lists[ICON_TYPES_INDEX], GUINT_TO_POINTER(current_icon_type)); - lists[GRAPH_COLORS_INDEX] = g_slist_prepend(lists[GRAPH_COLORS_INDEX], current_graph_color); - } - } - - /* keep lists in original order */ - for (i = 0; i < NUM_KEYS; i++) { - if (lists[i] != NULL) { - lists[i] = g_slist_reverse(lists[i]); - - panel_applet_gconf_set_list(sensors_applet->applet, - keys[i], - key_types[i], - lists[i], &error); - if (error) { - sensors_applet_notify(sensors_applet, GCONF_WRITE_ERROR); - - g_error_free(error); - return FALSE; - } - } else { - g_debug("list %s is NULL", keys[i]); - } - - } - - sensors_applet_gconf_free_lists(lists, - NUM_KEYS); - - /* store current version to identify config data */ - panel_applet_gconf_set_string(sensors_applet->applet, - SENSORS_APPLET_VERSION, - PACKAGE_VERSION, &error); - - return TRUE; -} - diff --git a/sensors-applet/sensors-applet-gconf.h b/sensors-applet/sensors-applet-gconf.h deleted file mode 100644 index 527e364..0000000 --- a/sensors-applet/sensors-applet-gconf.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2005-2009 Alex Murray <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef SENSORS_APPLET_GCONF_H -#define SENSORS_APPLET_GCONF_H - -#include "sensors-applet.h" -#include <panel-applet-gconf.h> - -#define FONT_SIZE "font-size" /* hidden gconf option specifying font - * size in points */ - -#define HIDE_UNITS "hide-units" /* hidden gconf option specifying not to - * show sensor units */ - -#define IS_SETUP "setup" /* have we actually set up this instance of - * the applet (gets set to true after - * closing prefences dialog) */ - -#define DISPLAY_MODE "display_mode" /* display icons or text labels?*/ - -#define LAYOUT_MODE "layout_mode" /* value beside or below label */ -#define TEMPERATURE_SCALE "temperature_scale" /* Kelvin, - Celsius or - Fahrenheit */ -#define DISPLAY_NOTIFICATIONS "display_notifications" /* whether to - * display - * notifications */ -#define TIMEOUT "timeout_delay" /* delay (in ms) between refreshes */ -#define GRAPH_SIZE "graph_size" /* the size of the graph in pixels - - * either width if horizontal, or - * height if vertical */ -#define PATHS "paths" /* full paths to filenames */ -#define IDS "ids" /* a list of the sensor device ids */ -#define INTERFACES "interfaces" /* a list of the sensor device - * interface for each sensor */ -#define LABELS "labels" /* user defined labels for each sensor */ -#define ENABLES "sensor_enables" /* list of booleans corresponding to - * the filenames of whether a sensor - * is enabled or not */ -#define LOW_VALUES "low_values" /* stored as ints (1000 * double - * value) for accuracy, since can - * only do ints easily */ -#define HIGH_VALUES "high_values" /* stored as ints (1000 * double - * value) for accuracy, since can - * only do ints easily */ -#define ALARM_ENABLES "alarm_enables" /* list of whether each sensor - * has its alarm enabled */ -#define LOW_ALARM_COMMANDS "low_alarm_commands" /* list of commands to execute - * when each alarm is - * activated */ -#define HIGH_ALARM_COMMANDS "high_alarm_commands" /* list of commands to execute - * when each alarm is - * activated */ - -#define ALARM_TIMEOUTS "alarm_timeouts" /* list of how often each - alarm should be sounded (in - seconds) */ - -#define SENSOR_TYPES "sensor_types" /* used to identify a sensor in a - list */ - -#define MULTIPLIERS "multipliers" -#define OFFSETS "offsets" -#define ICON_TYPES "icon_types" -#define GRAPH_COLORS "graph_colors" - -#define SENSORS_APPLET_VERSION "sensors_applet_version" /* version of - * config - * data */ - -gboolean sensors_applet_gconf_save_sensors(SensorsApplet *sensors_applet); -gboolean sensors_applet_gconf_setup_sensors(SensorsApplet *sensors_applet); -void sensors_applet_gconf_setup(SensorsApplet *sensors_applet); - -#endif /* SENSORS_APPLET_GCONF_H*/ |