summaryrefslogtreecommitdiff
path: root/polkitgtkmate
diff options
context:
space:
mode:
authorPerberos <[email protected]>2011-12-01 23:00:56 -0300
committerPerberos <[email protected]>2011-12-01 23:00:56 -0300
commit1c69f467452c8f34d099019d463980ad57811192 (patch)
tree72ab1456032eb3c29f7fe327b5da6ac8e734507a /polkitgtkmate
downloadmate-polkit-1c69f467452c8f34d099019d463980ad57811192.tar.bz2
mate-polkit-1c69f467452c8f34d099019d463980ad57811192.tar.xz
moving from https://github.com/perberos/mate-desktop-environment
Diffstat (limited to 'polkitgtkmate')
-rw-r--r--polkitgtkmate/Makefile.am106
-rw-r--r--polkitgtkmate/Makefile.in838
-rw-r--r--polkitgtkmate/example.c178
-rw-r--r--polkitgtkmate/polkit-gtk-mate-1.pc.in11
-rw-r--r--polkitgtkmate/polkitgtkmate.h32
-rw-r--r--polkitgtkmate/polkitgtkmatetypes.h35
-rw-r--r--polkitgtkmate/polkitlockbutton.c1192
-rw-r--r--polkitgtkmate/polkitlockbutton.h118
8 files changed, 2510 insertions, 0 deletions
diff --git a/polkitgtkmate/Makefile.am b/polkitgtkmate/Makefile.am
new file mode 100644
index 0000000..4d0932f
--- /dev/null
+++ b/polkitgtkmate/Makefile.am
@@ -0,0 +1,106 @@
+
+NULL =
+
+lib_LTLIBRARIES=libpolkit-gtk-mate-1.la
+
+libpolkit_gtk_mate_1includedir=$(includedir)/polkit-gtk-mate-1/polkitgtkmate
+
+libpolkit_gtk_mate_1include_HEADERS = \
+ polkitgtkmate.h \
+ polkitgtkmatetypes.h \
+ polkitlockbutton.h \
+ $(NULL)
+
+libpolkit_gtk_mate_1_la_SOURCES = \
+ polkitgtkmate.h \
+ polkitgtkmatetypes.h \
+ polkitlockbutton.h polkitlockbutton.c \
+ $(NULL)
+
+libpolkit_gtk_mate_1_la_CPPFLAGS = \
+ -I$(top_srcdir) \
+ -I$(top_builddir) \
+ -I$(top_srcdir)/polkitgtkmate \
+ -I$(top_builddir)/polkitgtkmate \
+ -DG_LOG_DOMAIN=\"polkitgtkmate\" \
+ -DMATELOCALEDIR=\""$(datadir)/locale"\" \
+ $(DISABLE_DEPRECATED) \
+ $(AM_CPPFLAGS) \
+ -DPOLKIT_GTK_MATE_COMPILATION \
+ $(NULL)
+
+libpolkit_gtk_mate_1_la_CFLAGS = \
+ $(POLKIT_GOBJECT_CFLAGS) \
+ $(GTK_CFLAGS) \
+ $(WARN_CFLAGS) \
+ $(AM_CFLAGS) \
+ $(NULL)
+
+libpolkit_gtk_mate_1_la_LIBADD = \
+ $(POLKIT_GOBJECT_LIBS) \
+ $(GTK_LIBS) \
+ $(INTLLIBS) \
+ $(NULL)
+
+
+libpolkit_gtk_mate_1_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
+ -export-dynamic -no-undefined -export-symbols-regex '(^polkit_.*)'
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = polkit-gtk-mate-1.pc
+
+noinst_PROGRAMS = example
+
+example_SOURCES = example.c
+example_CFLAGS = \
+ -I$(top_srcdir) \
+ -I$(top_builddir) \
+ $(POLKIT_GOBJECT_CFLAGS) \
+ $(GTK_CFLAGS) \
+ $(WARN_CFLAGS) \
+ $(AM_CFLAGS) \
+ $(NULL)
+
+example_LDADD = \
+ $(POLKIT_GOBJECT_LIBS) \
+ $(GTK_LIBS) \
+ $(INTLLIBS) \
+ libpolkit-gtk-mate-1.la \
+ $(NULL)
+
+if ENABLE_INTROSPECTION
+girdir = $(GIRDIR)
+gir_DATA = PolkitGtkMate-1.0.gir
+
+typelibsdir = $(GIRTYPELIBDIR)
+typelibs_DATA = PolkitGtkMate-1.0.typelib
+
+PolkitGtkMate-1.0.gir: libpolkit-gtk-mate-1.la $(G_IR_SCANNER) Makefile.am
+ $(G_IR_SCANNER) -v \
+ --namespace PolkitGtkMate \
+ --strip-prefix=Polkit \
+ --nsversion=1.0 \
+ --include=Gtk-2.0 \
+ --include=Polkit-1.0 \
+ --library=polkit-gtk-mate-1 \
+ --output $@ \
+ --pkg=polkit-gobject-1 \
+ --pkg=gtk+-2.0 \
+ --libtool=$(top_builddir)/libtool \
+ -I$(top_srcdir) \
+ -DPOLKIT_GTK_MATE_COMPILATION \
+ $(srcdir)/polkitgtkmate.h \
+ $(srcdir)/polkitgtkmatetypes.h \
+ $(srcdir)/polkitlockbutton.h \
+ $(NULL)
+
+PolkitGtkMate-1.0.typelib: PolkitGtkMate-1.0.gir $(G_IR_COMPILER)
+ $(G_IR_COMPILER) $< -o $@
+
+endif # ENABLE_INTROSPECTION
+
+CLEANFILES = $(BUILT_SOURCES) $(pkgconfig_DATA) $(gir_DATA) $(typelibs_DATA)
+
+clean-local :
+ rm -f *~ $(BUILT_SOURCES)
+
diff --git a/polkitgtkmate/Makefile.in b/polkitgtkmate/Makefile.in
new file mode 100644
index 0000000..5113cba
--- /dev/null
+++ b/polkitgtkmate/Makefile.in
@@ -0,0 +1,838 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+noinst_PROGRAMS = example$(EXEEXT)
+subdir = polkitgtkmate
+DIST_COMMON = $(libpolkit_gtk_mate_1include_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/polkit-gtk-mate-1.pc.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES = polkit-gtk-mate-1.pc
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(girdir)" \
+ "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(typelibsdir)" \
+ "$(DESTDIR)$(libpolkit_gtk_mate_1includedir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libpolkit_gtk_mate_1_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am__objects_1 =
+am_libpolkit_gtk_mate_1_la_OBJECTS = \
+ libpolkit_gtk_mate_1_la-polkitlockbutton.lo $(am__objects_1)
+libpolkit_gtk_mate_1_la_OBJECTS = \
+ $(am_libpolkit_gtk_mate_1_la_OBJECTS)
+AM_V_lt = $(am__v_lt_$(V))
+am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+am__v_lt_0 = --silent
+libpolkit_gtk_mate_1_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(libpolkit_gtk_mate_1_la_CFLAGS) $(CFLAGS) \
+ $(libpolkit_gtk_mate_1_la_LDFLAGS) $(LDFLAGS) -o $@
+PROGRAMS = $(noinst_PROGRAMS)
+am_example_OBJECTS = example-example.$(OBJEXT)
+example_OBJECTS = $(am_example_OBJECTS)
+example_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) libpolkit-gtk-mate-1.la \
+ $(am__DEPENDENCIES_1)
+example_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(example_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_$(V))
+am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+am__v_CC_0 = @echo " CC " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_$(V))
+am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+am__v_CCLD_0 = @echo " CCLD " $@;
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+SOURCES = $(libpolkit_gtk_mate_1_la_SOURCES) $(example_SOURCES)
+DIST_SOURCES = $(libpolkit_gtk_mate_1_la_SOURCES) $(example_SOURCES)
+DATA = $(gir_DATA) $(pkgconfig_DATA) $(typelibs_DATA)
+HEADERS = $(libpolkit_gtk_mate_1include_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
+ALL_LINGUAS = @ALL_LINGUAS@
+AMTAR = @AMTAR@
+AM_CFLAGS = @AM_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AM_LDFLAGS = @AM_LDFLAGS@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIRNAME = @DATADIRNAME@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DISABLE_DEPRECATED = @DISABLE_DEPRECATED@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GIRDIR = @GIRDIR@
+GIRTYPELIBDIR = @GIRTYPELIBDIR@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GREP = @GREP@
+GTKDOC_CHECK = @GTKDOC_CHECK@
+GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
+GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
+GTKDOC_MKPDF = @GTKDOC_MKPDF@
+GTKDOC_REBASE = @GTKDOC_REBASE@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+G_IR_COMPILER = @G_IR_COMPILER@
+G_IR_GENERATE = @G_IR_GENERATE@
+G_IR_SCANNER = @G_IR_SCANNER@
+HTML_DIR = @HTML_DIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INSTOBJEXT = @INSTOBJEXT@
+INTLLIBS = @INTLLIBS@
+INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
+INTLTOOL_MERGE = @INTLTOOL_MERGE@
+INTLTOOL_PERL = @INTLTOOL_PERL@
+INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
+INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
+INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_AGE = @LT_AGE@
+LT_CURRENT = @LT_CURRENT@
+LT_REVISION = @LT_REVISION@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+MSGFMT_OPTS = @MSGFMT_OPTS@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+POFILES = @POFILES@
+POLKIT_AGENT_CFLAGS = @POLKIT_AGENT_CFLAGS@
+POLKIT_AGENT_LIBS = @POLKIT_AGENT_LIBS@
+POLKIT_GOBJECT_CFLAGS = @POLKIT_GOBJECT_CFLAGS@
+POLKIT_GOBJECT_LIBS = @POLKIT_GOBJECT_LIBS@
+POSUB = @POSUB@
+PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
+PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+XGETTEXT = @XGETTEXT@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+NULL =
+lib_LTLIBRARIES = libpolkit-gtk-mate-1.la
+libpolkit_gtk_mate_1includedir = $(includedir)/polkit-gtk-mate-1/polkitgtkmate
+libpolkit_gtk_mate_1include_HEADERS = \
+ polkitgtkmate.h \
+ polkitgtkmatetypes.h \
+ polkitlockbutton.h \
+ $(NULL)
+
+libpolkit_gtk_mate_1_la_SOURCES = \
+ polkitgtkmate.h \
+ polkitgtkmatetypes.h \
+ polkitlockbutton.h polkitlockbutton.c \
+ $(NULL)
+
+libpolkit_gtk_mate_1_la_CPPFLAGS = \
+ -I$(top_srcdir) \
+ -I$(top_builddir) \
+ -I$(top_srcdir)/polkitgtkmate \
+ -I$(top_builddir)/polkitgtkmate \
+ -DG_LOG_DOMAIN=\"polkitgtkmate\" \
+ -DMATELOCALEDIR=\""$(datadir)/locale"\" \
+ $(DISABLE_DEPRECATED) \
+ $(AM_CPPFLAGS) \
+ -DPOLKIT_GTK_MATE_COMPILATION \
+ $(NULL)
+
+libpolkit_gtk_mate_1_la_CFLAGS = \
+ $(POLKIT_GOBJECT_CFLAGS) \
+ $(GTK_CFLAGS) \
+ $(WARN_CFLAGS) \
+ $(AM_CFLAGS) \
+ $(NULL)
+
+libpolkit_gtk_mate_1_la_LIBADD = \
+ $(POLKIT_GOBJECT_LIBS) \
+ $(GTK_LIBS) \
+ $(INTLLIBS) \
+ $(NULL)
+
+libpolkit_gtk_mate_1_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
+ -export-dynamic -no-undefined -export-symbols-regex '(^polkit_.*)'
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = polkit-gtk-mate-1.pc
+example_SOURCES = example.c
+example_CFLAGS = \
+ -I$(top_srcdir) \
+ -I$(top_builddir) \
+ $(POLKIT_GOBJECT_CFLAGS) \
+ $(GTK_CFLAGS) \
+ $(WARN_CFLAGS) \
+ $(AM_CFLAGS) \
+ $(NULL)
+
+example_LDADD = \
+ $(POLKIT_GOBJECT_LIBS) \
+ $(GTK_LIBS) \
+ $(INTLLIBS) \
+ libpolkit-gtk-mate-1.la \
+ $(NULL)
+
+@ENABLE_INTROSPECTION_TRUE@girdir = $(GIRDIR)
+@ENABLE_INTROSPECTION_TRUE@gir_DATA = PolkitGtkMate-1.0.gir
+@ENABLE_INTROSPECTION_TRUE@typelibsdir = $(GIRTYPELIBDIR)
+@ENABLE_INTROSPECTION_TRUE@typelibs_DATA = PolkitGtkMate-1.0.typelib
+CLEANFILES = $(BUILT_SOURCES) $(pkgconfig_DATA) $(gir_DATA) $(typelibs_DATA)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign polkitgtkmate/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign polkitgtkmate/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+polkit-gtk-mate-1.pc: $(top_builddir)/config.status $(srcdir)/polkit-gtk-mate-1.pc.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+ }
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libpolkit-gtk-mate-1.la: $(libpolkit_gtk_mate_1_la_OBJECTS) $(libpolkit_gtk_mate_1_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libpolkit_gtk_mate_1_la_LINK) -rpath $(libdir) $(libpolkit_gtk_mate_1_la_OBJECTS) $(libpolkit_gtk_mate_1_la_LIBADD) $(LIBS)
+
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+example$(EXEEXT): $(example_OBJECTS) $(example_DEPENDENCIES)
+ @rm -f example$(EXEEXT)
+ $(AM_V_CCLD)$(example_LINK) $(example_OBJECTS) $(example_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example-example.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpolkit_gtk_mate_1_la-polkitlockbutton.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+libpolkit_gtk_mate_1_la-polkitlockbutton.lo: polkitlockbutton.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpolkit_gtk_mate_1_la_CPPFLAGS) $(CPPFLAGS) $(libpolkit_gtk_mate_1_la_CFLAGS) $(CFLAGS) -MT libpolkit_gtk_mate_1_la-polkitlockbutton.lo -MD -MP -MF $(DEPDIR)/libpolkit_gtk_mate_1_la-polkitlockbutton.Tpo -c -o libpolkit_gtk_mate_1_la-polkitlockbutton.lo `test -f 'polkitlockbutton.c' || echo '$(srcdir)/'`polkitlockbutton.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libpolkit_gtk_mate_1_la-polkitlockbutton.Tpo $(DEPDIR)/libpolkit_gtk_mate_1_la-polkitlockbutton.Plo
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='polkitlockbutton.c' object='libpolkit_gtk_mate_1_la-polkitlockbutton.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpolkit_gtk_mate_1_la_CPPFLAGS) $(CPPFLAGS) $(libpolkit_gtk_mate_1_la_CFLAGS) $(CFLAGS) -c -o libpolkit_gtk_mate_1_la-polkitlockbutton.lo `test -f 'polkitlockbutton.c' || echo '$(srcdir)/'`polkitlockbutton.c
+
+example-example.o: example.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(example_CFLAGS) $(CFLAGS) -MT example-example.o -MD -MP -MF $(DEPDIR)/example-example.Tpo -c -o example-example.o `test -f 'example.c' || echo '$(srcdir)/'`example.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/example-example.Tpo $(DEPDIR)/example-example.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='example.c' object='example-example.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(example_CFLAGS) $(CFLAGS) -c -o example-example.o `test -f 'example.c' || echo '$(srcdir)/'`example.c
+
+example-example.obj: example.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(example_CFLAGS) $(CFLAGS) -MT example-example.obj -MD -MP -MF $(DEPDIR)/example-example.Tpo -c -o example-example.obj `if test -f 'example.c'; then $(CYGPATH_W) 'example.c'; else $(CYGPATH_W) '$(srcdir)/example.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/example-example.Tpo $(DEPDIR)/example-example.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='example.c' object='example-example.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(example_CFLAGS) $(CFLAGS) -c -o example-example.obj `if test -f 'example.c'; then $(CYGPATH_W) 'example.c'; else $(CYGPATH_W) '$(srcdir)/example.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-girDATA: $(gir_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(girdir)" || $(MKDIR_P) "$(DESTDIR)$(girdir)"
+ @list='$(gir_DATA)'; test -n "$(girdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(girdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(girdir)" || exit $$?; \
+ done
+
+uninstall-girDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(gir_DATA)'; test -n "$(girdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(girdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(girdir)" && rm -f $$files
+install-pkgconfigDATA: $(pkgconfig_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
+ @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
+ done
+
+uninstall-pkgconfigDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files
+install-typelibsDATA: $(typelibs_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(typelibsdir)" || $(MKDIR_P) "$(DESTDIR)$(typelibsdir)"
+ @list='$(typelibs_DATA)'; test -n "$(typelibsdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(typelibsdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(typelibsdir)" || exit $$?; \
+ done
+
+uninstall-typelibsDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(typelibs_DATA)'; test -n "$(typelibsdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(typelibsdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(typelibsdir)" && rm -f $$files
+install-libpolkit_gtk_mate_1includeHEADERS: $(libpolkit_gtk_mate_1include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(libpolkit_gtk_mate_1includedir)" || $(MKDIR_P) "$(DESTDIR)$(libpolkit_gtk_mate_1includedir)"
+ @list='$(libpolkit_gtk_mate_1include_HEADERS)'; test -n "$(libpolkit_gtk_mate_1includedir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libpolkit_gtk_mate_1includedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(libpolkit_gtk_mate_1includedir)" || exit $$?; \
+ done
+
+uninstall-libpolkit_gtk_mate_1includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(libpolkit_gtk_mate_1include_HEADERS)'; test -n "$(libpolkit_gtk_mate_1includedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(libpolkit_gtk_mate_1includedir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(libpolkit_gtk_mate_1includedir)" && rm -f $$files
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(girdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(typelibsdir)" "$(DESTDIR)$(libpolkit_gtk_mate_1includedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \
+ clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-girDATA \
+ install-libpolkit_gtk_mate_1includeHEADERS \
+ install-pkgconfigDATA install-typelibsDATA
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-girDATA uninstall-libLTLIBRARIES \
+ uninstall-libpolkit_gtk_mate_1includeHEADERS \
+ uninstall-pkgconfigDATA uninstall-typelibsDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLTLIBRARIES clean-libtool clean-local \
+ clean-noinstPROGRAMS ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-girDATA install-html \
+ install-html-am install-info install-info-am \
+ install-libLTLIBRARIES \
+ install-libpolkit_gtk_mate_1includeHEADERS install-man \
+ install-pdf install-pdf-am install-pkgconfigDATA install-ps \
+ install-ps-am install-strip install-typelibsDATA installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-girDATA \
+ uninstall-libLTLIBRARIES \
+ uninstall-libpolkit_gtk_mate_1includeHEADERS \
+ uninstall-pkgconfigDATA uninstall-typelibsDATA
+
+
+@[email protected]: libpolkit-gtk-mate-1.la $(G_IR_SCANNER) Makefile.am
+@ENABLE_INTROSPECTION_TRUE@ $(G_IR_SCANNER) -v \
+@ENABLE_INTROSPECTION_TRUE@ --namespace PolkitGtkMate \
+@ENABLE_INTROSPECTION_TRUE@ --strip-prefix=Polkit \
+@ENABLE_INTROSPECTION_TRUE@ --nsversion=1.0 \
+@ENABLE_INTROSPECTION_TRUE@ --include=Gtk-2.0 \
+@ENABLE_INTROSPECTION_TRUE@ --include=Polkit-1.0 \
+@ENABLE_INTROSPECTION_TRUE@ --library=polkit-gtk-mate-1 \
+@ENABLE_INTROSPECTION_TRUE@ --output $@ \
+@ENABLE_INTROSPECTION_TRUE@ --pkg=polkit-gobject-1 \
+@ENABLE_INTROSPECTION_TRUE@ --pkg=gtk+-2.0 \
+@ENABLE_INTROSPECTION_TRUE@ --libtool=$(top_builddir)/libtool \
+@ENABLE_INTROSPECTION_TRUE@ -I$(top_srcdir) \
+@ENABLE_INTROSPECTION_TRUE@ -DPOLKIT_GTK_MATE_COMPILATION \
+@ENABLE_INTROSPECTION_TRUE@ $(srcdir)/polkitgtkmate.h \
+@ENABLE_INTROSPECTION_TRUE@ $(srcdir)/polkitgtkmatetypes.h \
+@ENABLE_INTROSPECTION_TRUE@ $(srcdir)/polkitlockbutton.h \
+@ENABLE_INTROSPECTION_TRUE@ $(NULL)
+
+@[email protected]: PolkitGtkMate-1.0.gir $(G_IR_COMPILER)
+@ENABLE_INTROSPECTION_TRUE@ $(G_IR_COMPILER) $< -o $@
+
+clean-local :
+ rm -f *~ $(BUILT_SOURCES)
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/polkitgtkmate/example.c b/polkitgtkmate/example.c
new file mode 100644
index 0000000..4f20f32
--- /dev/null
+++ b/polkitgtkmate/example.c
@@ -0,0 +1,178 @@
+/*
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: David Zeuthen <[email protected]>
+ */
+
+#include <polkitgtkmate/polkitgtkmate.h>
+
+static PolkitAuthority* authority = NULL;
+const gchar* action_id = NULL;
+static PolkitSubject* system_bus_name_subject = NULL;
+static PolkitSubject* unix_process_subject = NULL;
+static GtkWidget* system_bus_name_authorized_label = NULL;
+static GtkWidget* unix_process_authorized_label = NULL;
+
+static void update_one(PolkitSubject* subject, GtkWidget* label)
+{
+ PolkitAuthorizationResult* result;
+ GError* error;
+ GString* s;
+ gchar* subject_str;
+
+ s = g_string_new(NULL);
+ subject_str = polkit_subject_to_string(subject);
+ g_string_append_printf(s, "Result for subject `%s': ", subject_str);
+ g_free(subject_str);
+
+ error = NULL;
+ result = polkit_authority_check_authorization_sync(authority, subject, action_id, NULL, POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE, NULL, &error);
+
+ if (result == NULL)
+ {
+ g_string_append_printf(s, "failed: %s", error->message);
+ g_error_free(error);
+ }
+ else
+ {
+ g_string_append_printf(s, "authorized=%d challenge=%d retains=%d temporary=%d", polkit_authorization_result_get_is_authorized(result), polkit_authorization_result_get_is_challenge(result), polkit_authorization_result_get_retains_authorization(result), polkit_authorization_result_get_temporary_authorization_id(result) != NULL);
+ g_object_unref(result);
+ }
+
+ gtk_label_set_text(GTK_LABEL(label), s->str);
+ g_string_free(s, TRUE);
+}
+
+static void update_labels(void)
+{
+ update_one(system_bus_name_subject, system_bus_name_authorized_label);
+ update_one(unix_process_subject, unix_process_authorized_label);
+}
+
+static void on_authority_changed(PolkitAuthority* authority, gpointer user_data)
+{
+ update_labels();
+}
+
+static void on_close(PolkitLockButton* button, gpointer user_data)
+{
+ gtk_main_quit();
+}
+
+static void on_button_changed(PolkitLockButton* button, gpointer user_data)
+{
+ GtkWidget* entry = GTK_WIDGET(user_data);
+
+ gtk_widget_set_sensitive(entry, polkit_lock_button_get_is_authorized(button));
+}
+
+int main(int argc, char* argv[])
+{
+ GDBusConnection* bus;
+ GtkWidget* window;
+ GtkWidget* label;
+ GtkWidget* button;
+ GtkWidget* entry;
+ GtkWidget* vbox;
+ GError* error;
+ gchar* s;
+
+ gtk_init(&argc, &argv);
+
+ if (argc != 2)
+ {
+ g_printerr("usage: %s <action_id>\n", argv[0]);
+ goto out;
+ }
+
+ action_id = argv[1];
+
+ error = NULL;
+ bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL /* GCancellable* */, &error);
+
+ if (bus == NULL)
+ {
+ g_printerr("Failed connecting to system bus: %s\n", error->message);
+ g_error_free(error);
+ goto out;
+ }
+
+ window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
+
+ vbox = gtk_vbox_new(FALSE, 12);
+ gtk_container_set_border_width(GTK_CONTAINER(window), 12);
+ gtk_container_add(GTK_CONTAINER(window), vbox);
+
+ s = g_strdup_printf("Showing PolkitLockButton for action id: %s", action_id);
+ label = gtk_label_new(s);
+ gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
+ gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
+ g_free(s);
+
+ label = gtk_label_new(NULL);
+ gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
+ gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
+ system_bus_name_authorized_label = label;
+
+ label = gtk_label_new(NULL);
+ gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
+ gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
+ unix_process_authorized_label = label;
+
+ entry = gtk_entry_new();
+ gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
+
+ button = polkit_lock_button_new(action_id);
+ g_signal_connect(button, "changed", G_CALLBACK(on_button_changed), entry);
+ gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
+
+
+ system_bus_name_subject = polkit_system_bus_name_new(g_dbus_connection_get_unique_name(bus));
+ unix_process_subject = polkit_unix_process_new(getpid());
+
+ error = NULL;
+ authority = polkit_authority_get_sync(NULL /* GCancellable* */, &error);
+
+ if (authority == NULL)
+ {
+ g_printerr("Failed getting the authority: %s\n", error->message);
+ g_error_free(error);
+ goto out;
+ }
+
+ g_debug("backend: name=`%s' version=`%s' features=%d", polkit_authority_get_backend_name(authority), polkit_authority_get_backend_version(authority), polkit_authority_get_backend_features(authority));
+ g_signal_connect(authority, "changed", G_CALLBACK(on_authority_changed), NULL);
+
+ update_labels();
+
+ gtk_widget_set_sensitive(entry, polkit_lock_button_get_is_authorized(POLKIT_LOCK_BUTTON(button)));
+
+ gtk_widget_show_all(window);
+ gtk_window_present(GTK_WINDOW(window));
+
+ g_signal_connect(button, "destroy", G_CALLBACK(on_close), NULL);
+
+ gtk_main();
+
+ out:
+ return 0;
+}
diff --git a/polkitgtkmate/polkit-gtk-mate-1.pc.in b/polkitgtkmate/polkit-gtk-mate-1.pc.in
new file mode 100644
index 0000000..152054e
--- /dev/null
+++ b/polkitgtkmate/polkit-gtk-mate-1.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: polkit-gtk-mate-1
+Description: PolicyKit GTK+ widgets
+Version: @VERSION@
+Libs: -L${libdir} -lpolkit-gtk-mate-1
+Cflags: -I${includedir}/polkit-gtk-mate-1
+Requires: polkit-gobject-1
diff --git a/polkitgtkmate/polkitgtkmate.h b/polkitgtkmate/polkitgtkmate.h
new file mode 100644
index 0000000..3a4f585
--- /dev/null
+++ b/polkitgtkmate/polkitgtkmate.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: David Zeuthen <[email protected]>
+ */
+
+#ifndef __POLKIT_GTK_MATE_H
+#define __POLKIT_GTK_MATE_H
+
+#define _POLKIT_GTK_MATE_INSIDE_POLKIT_GTK_MATE_H 1
+
+#include <polkitgtkmate/polkitgtkmatetypes.h>
+#include <polkitgtkmate/polkitlockbutton.h>
+
+#undef _POLKIT_GTK_MATE_INSIDE_POLKIT_GTK_MATE_H
+
+#endif /* __POLKIT_GTK_MATE_H */
diff --git a/polkitgtkmate/polkitgtkmatetypes.h b/polkitgtkmate/polkitgtkmatetypes.h
new file mode 100644
index 0000000..108d498
--- /dev/null
+++ b/polkitgtkmate/polkitgtkmatetypes.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: David Zeuthen <[email protected]>
+ */
+
+#if !defined (_POLKIT_GTK_MATE_INSIDE_POLKIT_GTK_MATE_H) && !defined (POLKIT_GTK_MATE_COMPILATION)
+#error "Only <polkitgtkmate/polkitgtkmate.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef __POLKIT_GTK_MATE_TYPES_H
+#define __POLKIT_GTK_MATE_TYPES_H
+
+#include <gtk/gtk.h>
+#include <polkit/polkit.h>
+
+struct _PolkitLockButton;
+typedef struct _PolkitLockButton PolkitLockButton;
+
+#endif /* __POLKIT_GTK_MATE_TYPES_H */
diff --git a/polkitgtkmate/polkitlockbutton.c b/polkitgtkmate/polkitlockbutton.c
new file mode 100644
index 0000000..2aa334a
--- /dev/null
+++ b/polkitgtkmate/polkitlockbutton.c
@@ -0,0 +1,1192 @@
+/*
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: David Zeuthen <[email protected]>
+ */
+
+#include "config.h"
+
+#include <glib/gi18n-lib.h>
+#include <string.h>
+#include <polkit/polkit.h>
+
+#include "polkitlockbutton.h"
+
+/**
+ * SECTION:polkitlockbutton
+ * @title: PolkitLockButton
+ * @short_description: Widget for obtaining/revoking authorizations
+ * @stability: Stable
+ *
+ * #PolkitLockButton is a widget that can be used in control panels to
+ * allow users to obtain and revoke authorizations needed for the
+ * control panel UI to function.
+ *
+ * If the user lacks the authorization but authorization can be
+ * obtained through authentication, the widget looks like this
+ * <mediaobject id="lock-button-locked">
+ * <imageobject>
+ * <imagedata fileref="polkit-lock-button-locked.png" format="PNG"/>
+ * </imageobject>
+ * </mediaobject>
+ * and the user can click the button to obtain the authorization. This
+ * will pop up an authentication dialog.
+ * Once authorization is obtained, the widget changes to this
+ * <mediaobject id="lock-button-unlocked">
+ * <imageobject>
+ * <imagedata fileref="polkit-lock-button-unlocked.png" format="PNG"/>
+ * </imageobject>
+ * </mediaobject>
+ * and the authorization can be dropped by clicking the button.
+ * If the user is not able to obtain authorization at all, the widget
+ * looks like this
+ * <mediaobject id="lock-button-unlocked-not-authorized">
+ * <imageobject>
+ * <imagedata fileref="polkit-lock-button-not-authorized.png" format="PNG"/>
+ * </imageobject>
+ * </mediaobject>
+ * If the user is authorized (either implicitly via the .policy file
+ * defaults or through e.g. Local Authority configuration) and no
+ * authentication is necessary and the Authority Implementation
+ * supports lock-down, the widget looks like this
+ * <mediaobject id="lock-button-unlocked-lock-down">
+ * <imageobject>
+ * <imagedata fileref="polkit-lock-button-lock-down.png" format="PNG"/>
+ * </imageobject>
+ * </mediaobject>
+ * allowing the user to lock down the action. The lockdown can be
+ * removed by right clicking the button - the user can discover this
+ * through the tooltip. If the Authority implementation does not
+ * support lockdown, the widget will be hidden.
+ *
+ * Finally, if the user is not authorized but authorization can be
+ * obtained and the obtained authorization will be a one-shot
+ * authorization, the widget will be hidden. This means that any
+ * attempt to use the Mechanism that requires authorization for the
+ * specified action will always prompt for authentication. This
+ * condition happens exactly when
+ * (!polkit_lock_button_get_is_authorized() &&
+ * polkit_lock_button_get_can_obtain() &&
+ * !polkit_lock_button_get_is_visible()) is %TRUE.
+ *
+ * Typically #PolkitLockButton is only useful for actions where
+ * authorization is obtained through authentication (and retained) or
+ * where users are implictly authorized (cf. the defaults specified in
+ * the <literal>.policy</literal> file for the action) but note that
+ * this behavior can be overridden by the Authority implementation.
+ *
+ * The typical usage of this widget is like this:
+ * <programlisting>
+ * static void
+ * update_sensitivity_according_to_lock_button (FooBar *bar)
+ * {
+ * gboolean make_sensitive;
+ *
+ * make_sensitive = FALSE;
+ * if (polkit_lock_button_get_is_authorized (POLKIT_LOCK_BUTTON (bar->priv->lock_button)))
+ * {
+ * make_sensitive = TRUE;
+ * }
+ * else
+ * {
+ * /<!-- -->* Catch the case where authorization is one-shot - this means
+ * * an authentication dialog will be shown every time a widget the user
+ * * manipulates calls into the Mechanism.
+ * *<!-- -->/
+ * if (polkit_lock_button_get_can_obtain (POLKIT_LOCK_BUTTON (bar->priv->lock_button)) &&
+ * !polkit_lock_button_get_is_visible (POLKIT_LOCK_BUTTON (bar->priv->lock_button)))
+ * make_sensitive = TRUE;
+ * }
+ *
+ *
+ * /<!-- -->* Make all widgets relying on authorization sensitive according to
+ * * the value of make_sensitive.
+ * *<!-- -->/
+ * }
+ *
+ * static void
+ * on_lock_button_changed (PolkitLockButton *button,
+ * gpointer user_data)
+ * {
+ * FooBar *bar = FOO_BAR (user_data);
+ *
+ * update_sensitivity_according_to_lock_button (bar);
+ * }
+ *
+ * static void
+ * foo_bar_init (FooBar *bar)
+ * {
+ * /<!-- -->* Construct other widgets *<!-- -->/
+ *
+ * bar->priv->lock_button = polkit_lock_button_new ("org.project.mechanism.action-name");
+ * g_signal_connect (bar->priv->lock_button,
+ * "changed",
+ * G_CALLBACK (on_lock_button_changed),
+ * bar);
+ * update_sensitity_according_to_lock_button (bar);
+ *
+ * /<!-- -->* Pack bar->priv->lock_button into widget hierarchy *<!-- -->/
+ * }
+ * </programlisting>
+ */
+
+struct _PolkitLockButtonPrivate {
+ PolkitAuthority* authority;
+ PolkitSubject* subject;
+ gchar* action_id;
+
+ gchar* text_unlock;
+ gchar* text_lock;
+ gchar* text_lock_down;
+ gchar* text_not_authorized;
+
+ gchar* tooltip_unlock;
+ gchar* tooltip_lock;
+ gchar* tooltip_lock_down;
+ gchar* tooltip_not_authorized;
+
+ GtkWidget* button;
+ GtkWidget* label;
+
+ gboolean can_obtain;
+ gboolean retains_after_challenge;
+ gboolean authorized;
+ gboolean hidden;
+
+ /* is non-NULL exactly when we are authorized and have a temporary authorization */
+ gchar* tmp_authz_id;
+
+ /* This is non-NULL exactly when we have a non-interactive check outstanding */
+ GCancellable* check_cancellable;
+
+ /* This is non-NULL exactly when we have an interactive check outstanding */
+ GCancellable* interactive_check_cancellable;
+};
+
+enum{
+ PROP_0,
+ PROP_ACTION_ID,
+ PROP_IS_AUTHORIZED,
+ PROP_IS_VISIBLE,
+ PROP_CAN_OBTAIN,
+ PROP_TEXT_UNLOCK,
+ PROP_TEXT_LOCK,
+ PROP_TEXT_LOCK_DOWN,
+ PROP_TEXT_NOT_AUTHORIZED,
+ PROP_TOOLTIP_UNLOCK,
+ PROP_TOOLTIP_LOCK,
+ PROP_TOOLTIP_LOCK_DOWN,
+ PROP_TOOLTIP_NOT_AUTHORIZED,
+};
+
+enum {
+ CHANGED_SIGNAL,
+ LAST_SIGNAL,
+};
+
+static guint signals[LAST_SIGNAL] = {0, };
+
+static void initiate_check(PolkitLockButton* button);
+static void do_sync_check(PolkitLockButton* button);
+static void update_state(PolkitLockButton* button);
+
+static void on_authority_changed(PolkitAuthority* authority, gpointer user_data);
+
+static void on_clicked(GtkButton* button, gpointer user_data);
+
+G_DEFINE_TYPE(PolkitLockButton, polkit_lock_button, GTK_TYPE_HBOX);
+
+static void polkit_lock_button_finalize(GObject* object)
+{
+ PolkitLockButton *button = POLKIT_LOCK_BUTTON(object);
+
+ g_free(button->priv->action_id);
+ g_free(button->priv->tmp_authz_id);
+ g_object_unref(button->priv->subject);
+
+ if (button->priv->check_cancellable != NULL)
+ {
+ g_cancellable_cancel(button->priv->check_cancellable);
+ g_object_unref(button->priv->check_cancellable);
+ }
+
+ if (button->priv->interactive_check_cancellable != NULL)
+ {
+ g_cancellable_cancel(button->priv->interactive_check_cancellable);
+ g_object_unref(button->priv->interactive_check_cancellable);
+ }
+
+ g_signal_handlers_disconnect_by_func(button->priv->authority, on_authority_changed, button);
+ g_object_unref(button->priv->authority);
+
+ if (G_OBJECT_CLASS(polkit_lock_button_parent_class)->finalize != NULL)
+ {
+ G_OBJECT_CLASS(polkit_lock_button_parent_class)->finalize(object);
+ }
+}
+
+static void
+polkit_lock_button_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ PolkitLockButton *button = POLKIT_LOCK_BUTTON (object);
+
+ switch (property_id)
+ {
+ case PROP_ACTION_ID:
+ g_value_set_string (value, button->priv->action_id);
+ break;
+
+ case PROP_IS_AUTHORIZED:
+ g_value_set_boolean (value, button->priv->authorized);
+ break;
+
+ case PROP_IS_VISIBLE:
+ g_value_set_boolean (value, !button->priv->hidden);
+ break;
+
+ case PROP_CAN_OBTAIN:
+ g_value_set_boolean (value, button->priv->can_obtain);
+ break;
+
+ case PROP_TEXT_UNLOCK:
+ g_value_set_string (value, button->priv->text_unlock);
+ break;
+
+ case PROP_TEXT_LOCK:
+ g_value_set_string (value, button->priv->text_lock);
+ break;
+
+ case PROP_TEXT_LOCK_DOWN:
+ g_value_set_string (value, button->priv->text_lock_down);
+ break;
+
+ case PROP_TEXT_NOT_AUTHORIZED:
+ g_value_set_string (value, button->priv->text_not_authorized);
+ break;
+
+ case PROP_TOOLTIP_UNLOCK:
+ g_value_set_string (value, button->priv->tooltip_unlock);
+ break;
+
+ case PROP_TOOLTIP_LOCK:
+ g_value_set_string (value, button->priv->tooltip_lock);
+ break;
+
+ case PROP_TOOLTIP_LOCK_DOWN:
+ g_value_set_string (value, button->priv->tooltip_lock_down);
+ break;
+
+ case PROP_TOOLTIP_NOT_AUTHORIZED:
+ g_value_set_string (value, button->priv->tooltip_not_authorized);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+polkit_lock_button_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ PolkitLockButton *button = POLKIT_LOCK_BUTTON (object);
+
+ switch (property_id)
+ {
+ case PROP_ACTION_ID:
+ button->priv->action_id = g_value_dup_string (value);
+ break;
+
+ case PROP_TEXT_UNLOCK:
+ polkit_lock_button_set_unlock_text (button, g_value_get_string (value));
+ break;
+
+ case PROP_TEXT_LOCK:
+ polkit_lock_button_set_lock_text (button, g_value_get_string (value));
+ break;
+
+ case PROP_TEXT_LOCK_DOWN:
+ polkit_lock_button_set_lock_down_text (button, g_value_get_string (value));
+ break;
+
+ case PROP_TEXT_NOT_AUTHORIZED:
+ polkit_lock_button_set_not_authorized_text (button, g_value_get_string (value));
+ break;
+
+ case PROP_TOOLTIP_UNLOCK:
+ polkit_lock_button_set_unlock_tooltip (button, g_value_get_string (value));
+ break;
+
+ case PROP_TOOLTIP_LOCK:
+ polkit_lock_button_set_lock_tooltip (button, g_value_get_string (value));
+ break;
+
+ case PROP_TOOLTIP_LOCK_DOWN:
+ polkit_lock_button_set_lock_down_tooltip (button, g_value_get_string (value));
+ break;
+
+ case PROP_TOOLTIP_NOT_AUTHORIZED:
+ polkit_lock_button_set_not_authorized_tooltip (button, g_value_get_string (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+
+static void
+polkit_lock_button_init (PolkitLockButton *button)
+{
+ button->priv = G_TYPE_INSTANCE_GET_PRIVATE (button,
+ POLKIT_TYPE_LOCK_BUTTON,
+ PolkitLockButtonPrivate);
+
+}
+
+static void
+polkit_lock_button_constructed (GObject *object)
+{
+ PolkitLockButton *button = POLKIT_LOCK_BUTTON (object);
+ GError *error;
+
+ gtk_box_set_spacing (GTK_BOX (button), 2);
+
+ /* TODO: should be async+failable (e.g. GAsyncInitable) instead of this */
+ error = NULL;
+ button->priv->authority = polkit_authority_get_sync (NULL /* GCancellable* */, &error);
+ if (button->priv->authority == NULL)
+ {
+ g_critical ("Error getting authority: %s", error->message);
+ g_error_free (error);
+ }
+ g_signal_connect (button->priv->authority,
+ "changed",
+ G_CALLBACK (on_authority_changed),
+ button);
+
+ button->priv->button = gtk_button_new ();
+ gtk_button_set_relief (GTK_BUTTON (button->priv->button), GTK_RELIEF_NONE);
+ /* image is set in update_state() */
+ g_signal_connect (button->priv->button,
+ "clicked",
+ G_CALLBACK (on_clicked),
+ button);
+
+ gtk_box_pack_start (GTK_BOX (button),
+ button->priv->button,
+ FALSE,
+ FALSE,
+ 0);
+
+ button->priv->label = gtk_label_new ("");
+ gtk_box_pack_start (GTK_BOX (button),
+ button->priv->label,
+ FALSE,
+ FALSE,
+ 0);
+
+ /* take control of visibility of child widgets */
+ gtk_widget_set_no_show_all (button->priv->button, TRUE);
+ gtk_widget_set_no_show_all (button->priv->label, TRUE);
+
+ if (button->priv->subject == NULL)
+ {
+ button->priv->subject = polkit_unix_process_new (getpid ());
+ }
+
+ /* synchronously check on construction - TODO: we could implement GAsyncInitable
+ * in the future to avoid this sync check
+ */
+ do_sync_check (button);
+
+ update_state (button);
+
+ if (G_OBJECT_CLASS (polkit_lock_button_parent_class)->constructed != NULL)
+ G_OBJECT_CLASS (polkit_lock_button_parent_class)->constructed (object);
+}
+
+static void
+polkit_lock_button_class_init (PolkitLockButtonClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->finalize = polkit_lock_button_finalize;
+ gobject_class->get_property = polkit_lock_button_get_property;
+ gobject_class->set_property = polkit_lock_button_set_property;
+ gobject_class->constructed = polkit_lock_button_constructed;
+
+ g_type_class_add_private (klass, sizeof (PolkitLockButtonPrivate));
+
+ /**
+ * PolkitLockButton:action-id:
+ *
+ * The action identifier to use for the button.
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_ACTION_ID,
+ g_param_spec_string ("action-id",
+ _("Action Identifier"),
+ _("The action identifier to use for the button"),
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
+
+ /**
+ * PolkitLockButton:is-authorized:
+ *
+ * Whether the process is authorized.
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_IS_AUTHORIZED,
+ g_param_spec_boolean ("is-authorized",
+ _("Is Authorized"),
+ _("Whether the process is authorized"),
+ FALSE,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
+
+ /**
+ * PolkitLockButton:is-visible:
+ *
+ * Whether the widget is visible.
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_IS_VISIBLE,
+ g_param_spec_boolean ("is-visible",
+ _("Is Visible"),
+ _("Whether the widget is visible"),
+ TRUE,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
+
+ /**
+ * PolkitLockButton:can-obtain:
+ *
+ * Whether authorization can be obtained.
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_CAN_OBTAIN,
+ g_param_spec_boolean ("can-obtain",
+ _("Can Obtain"),
+ _("Whether authorization can be obtained"),
+ FALSE,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
+
+ /**
+ * PolkitLockButton:text-unlock:
+ *
+ * The text to display when prompting the user to unlock.
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_TEXT_UNLOCK,
+ g_param_spec_string ("text-unlock",
+ _("Unlock Text"),
+ _("The text to display when prompting the user to unlock."),
+ _("Click to make changes"),
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
+
+ /**
+ * PolkitLockButton:tooltip-unlock:
+ *
+ * The tooltip to display when prompting the user to unlock.
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_TOOLTIP_UNLOCK,
+ g_param_spec_string ("tooltip-unlock",
+ _("Unlock Tooltip"),
+ _("The tooltip to display when prompting the user to unlock."),
+ _("Authentication is needed to make changes."),
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
+
+ /**
+ * PolkitLockButton:text-lock:
+ *
+ * The text to display when prompting the user to lock.
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_TEXT_LOCK,
+ g_param_spec_string ("text-lock",
+ _("Lock Text"),
+ _("The text to display when prompting the user to lock."),
+ _("Click to prevent changes"),
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
+
+ /**
+ * PolkitLockButton:tooltip-lock:
+ *
+ * The tooltip to display when prompting the user to lock.
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_TOOLTIP_LOCK,
+ g_param_spec_string ("tooltip-lock",
+ _("Lock Tooltip"),
+ _("The tooltip to display when prompting the user to lock."),
+ _("To prevent further changes, click the lock."),
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
+
+ /**
+ * PolkitLockButton:text-lock-down:
+ *
+ * The text to display when prompting the user to lock down the action for all users.
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_TEXT_LOCK_DOWN,
+ g_param_spec_string ("text-lock-down",
+ _("Lock Down Text"),
+ _("The text to display when prompting the user to lock down the action for all users."),
+ _("Click to lock down"),
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
+
+ /**
+ * PolkitLockButton:tooltip-lock-down:
+ *
+ * The tooltip to display when prompting the user to lock down the action for all users.
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_TOOLTIP_LOCK_DOWN,
+ g_param_spec_string ("tooltip-lock-down",
+ _("Lock Down Tooltip"),
+ _("The tooltip to display when prompting the user to lock down the action for all users."),
+ _("To prevent users without administrative privileges from making changes, click the lock."),
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
+
+ /**
+ * PolkitLockButton:text-not-authorized:
+ *
+ * The text to display when the user cannot obtain authorization through authentication.
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_TEXT_NOT_AUTHORIZED,
+ g_param_spec_string ("text-not-authorized",
+ _("Unlock Text"),
+ _("The text to display when the user cannot obtain authorization through authentication."),
+ _("Not authorized to make changes"),
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
+
+ /**
+ * PolkitLockButton:tooltip-not-authorized:
+ *
+ * The tooltip to display when the user cannot obtain authorization through authentication.
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_TOOLTIP_NOT_AUTHORIZED,
+ g_param_spec_string ("tooltip-not-authorized",
+ _("Unlock Tooltip"),
+ _("The tooltip to display when the user cannot obtain authorization through authentication."),
+ _("System policy prevents changes. Contact your system administator."),
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
+
+ /**
+ * PolkitLockButton::changed:
+ * @button: A #PolkitLockButton.
+ *
+ * Emitted when something on @button changes.
+ */
+ signals[CHANGED_SIGNAL] = g_signal_new ("changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (PolkitLockButtonClass, changed),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
+}
+
+/**
+ * polkit_lock_button_new:
+ * @action_id: An action identifer.
+ *
+ * Constructs a #PolkitLockButton for @action_id.
+ *
+ * Returns: A #PolkitLockButton.
+ */
+GtkWidget *
+polkit_lock_button_new (const gchar *action_id)
+{
+ g_return_val_if_fail (action_id != NULL, NULL);
+
+ return GTK_WIDGET (g_object_new (POLKIT_TYPE_LOCK_BUTTON,
+ "action-id", action_id,
+ NULL));
+}
+
+static void
+update_state (PolkitLockButton *button)
+{
+ const gchar *text;
+ const gchar *tooltip;
+ gboolean sensitive;
+ gboolean old_hidden;
+ GtkWidget *image;
+
+ old_hidden = button->priv->hidden;
+ button->priv->hidden = FALSE;
+
+ if (button->priv->authorized)
+ {
+ text = button->priv->text_lock;
+ tooltip = button->priv->tooltip_lock;
+ sensitive = TRUE;
+ /* if the authorization isn't temporary => ask if user wants to lock the authorization down the
+ * authority we're using has that capability
+ */
+ if (button->priv->tmp_authz_id == NULL)
+ {
+ //button->priv->hidden = TRUE;
+ }
+ }
+ else
+ {
+ if (button->priv->can_obtain && button->priv->retains_after_challenge)
+ {
+ /* can retain and obtain authorization => show the unlock button */
+ text = button->priv->text_unlock;
+ tooltip = button->priv->tooltip_unlock;
+ g_free (button->priv->tmp_authz_id);
+ button->priv->tmp_authz_id = NULL;
+ sensitive = TRUE;
+ }
+ else
+ {
+ if (button->priv->can_obtain)
+ {
+ /* we can obtain authorization, we just can't retain it => hidden */
+ button->priv->hidden = TRUE;
+ }
+ else
+ {
+ /* cannot even obtain authorization => tell user he can't have a pony */
+ text = button->priv->text_not_authorized;
+ tooltip = button->priv->tooltip_not_authorized;
+ g_free (button->priv->tmp_authz_id);
+ button->priv->tmp_authz_id = NULL;
+ sensitive = FALSE;
+ }
+ }
+ }
+
+ image = gtk_image_new_from_icon_name (button->priv->authorized ? "changes-allow" : "changes-prevent",
+ GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_button_set_image (GTK_BUTTON (button->priv->button), image);
+ gtk_label_set_text (GTK_LABEL (button->priv->label), text);
+ gtk_widget_set_sensitive (button->priv->button, sensitive);
+
+ gtk_widget_set_tooltip_markup (GTK_WIDGET (button->priv->label), tooltip);
+ gtk_widget_set_tooltip_markup (GTK_WIDGET (button->priv->button), tooltip);
+
+ if (button->priv->hidden)
+ {
+ gtk_widget_hide (button->priv->button);
+ gtk_widget_hide (button->priv->label);
+ }
+ else
+ {
+ gtk_widget_show (button->priv->button);
+ gtk_widget_show (button->priv->label);
+ }
+
+ if (old_hidden != button->priv->hidden)
+ g_object_notify (G_OBJECT (button), "is-visible");
+}
+
+static void
+on_authority_changed (PolkitAuthority *authority,
+ gpointer user_data)
+{
+ PolkitLockButton *button = POLKIT_LOCK_BUTTON (user_data);
+ initiate_check (button);
+}
+
+static void
+process_result (PolkitLockButton *button,
+ PolkitAuthorizationResult *result)
+{
+ gboolean old_can_obtain;
+ gboolean old_authorized;
+
+ old_can_obtain = button->priv->can_obtain;
+ old_authorized = button->priv->authorized;
+ button->priv->can_obtain = polkit_authorization_result_get_is_challenge (result);
+ button->priv->authorized = polkit_authorization_result_get_is_authorized (result);
+
+ /* save the temporary authorization id */
+ g_free (button->priv->tmp_authz_id);
+ button->priv->tmp_authz_id = g_strdup (polkit_authorization_result_get_temporary_authorization_id (result));
+ button->priv->retains_after_challenge = polkit_authorization_result_get_retains_authorization (result);
+
+ update_state (button);
+
+ if (old_can_obtain != button->priv->can_obtain ||
+ old_authorized != button->priv->authorized)
+ {
+ g_signal_emit (button,
+ signals[CHANGED_SIGNAL],
+ 0);
+ }
+
+ if (old_can_obtain != button->priv->can_obtain)
+ g_object_notify (G_OBJECT (button), "can-obtain");
+
+ if (old_authorized != button->priv->authorized)
+ g_object_notify (G_OBJECT (button), "is-authorized");
+}
+
+static void
+check_cb (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ PolkitAuthority *authority = POLKIT_AUTHORITY (source_object);
+ PolkitLockButton *button = POLKIT_LOCK_BUTTON (user_data);
+ PolkitAuthorizationResult *result;
+ GError *error;
+
+ error = NULL;
+ result = polkit_authority_check_authorization_finish (authority,
+ res,
+ &error);
+ if (error != NULL)
+ {
+ g_warning ("Error checking authorization for action id `%s': %s",
+ button->priv->action_id,
+ error->message);
+ g_error_free (error);
+ }
+ else
+ {
+ process_result (button, result);
+ }
+
+ if (result != NULL)
+ g_object_unref (result);
+
+ if (button->priv->check_cancellable != NULL)
+ {
+ g_object_unref (button->priv->check_cancellable);
+ button->priv->check_cancellable = NULL;
+ }
+}
+
+static void
+initiate_check (PolkitLockButton *button)
+{
+
+ /* if we have a check pending already, then do nothing */
+ if (button->priv->check_cancellable != NULL)
+ goto out;
+
+ button->priv->check_cancellable = g_cancellable_new ();
+
+ polkit_authority_check_authorization (button->priv->authority,
+ button->priv->subject,
+ button->priv->action_id,
+ NULL, /* PolkitDetails */
+ POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE,
+ button->priv->check_cancellable,
+ check_cb,
+ button);
+
+ out:
+ ;
+}
+
+static void
+do_sync_check (PolkitLockButton *button)
+{
+
+ GError *error;
+ PolkitAuthorizationResult *result;
+
+ error = NULL;
+ result = polkit_authority_check_authorization_sync (button->priv->authority,
+ button->priv->subject,
+ button->priv->action_id,
+ NULL, /* PolkitDetails */
+ POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE,
+ NULL, /* cancellable */
+ &error);
+ if (error != NULL)
+ {
+ g_warning ("Error sync-checking authorization for action id `%s': %s",
+ button->priv->action_id,
+ error->message);
+ g_error_free (error);
+ }
+ else
+ {
+ process_result (button, result);
+ }
+
+ if (result != NULL)
+ g_object_unref (result);
+}
+
+static void
+interactive_check_cb (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+
+ PolkitAuthority *authority = POLKIT_AUTHORITY (source_object);
+ PolkitLockButton *button = POLKIT_LOCK_BUTTON (user_data);
+ PolkitAuthorizationResult *result;
+ PolkitDetails *details;
+ GError *error;
+
+ error = NULL;
+ result = polkit_authority_check_authorization_finish (authority,
+ res,
+ &error);
+ if (error != NULL)
+ {
+ g_warning ("Error obtaining authorization for action id `%s': %s",
+ button->priv->action_id,
+ error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* state is updated in the ::changed signal handler */
+
+ /* save the temporary authorization id */
+ details = polkit_authorization_result_get_details (result);
+ if (details != NULL)
+ {
+ button->priv->tmp_authz_id = g_strdup (polkit_details_lookup (details,
+ "polkit.temporary_authorization_id"));
+ }
+
+ out:
+ if (result != NULL)
+ g_object_unref (result);
+
+ if (button->priv->interactive_check_cancellable != NULL)
+ {
+ g_object_unref (button->priv->interactive_check_cancellable);
+ button->priv->interactive_check_cancellable = NULL;
+ }
+}
+
+
+static void on_clicked(GtkButton* _button, gpointer user_data)
+{
+
+ PolkitLockButton* button = POLKIT_LOCK_BUTTON(user_data);
+
+ if (!button->priv->authorized && button->priv->can_obtain)
+ {
+
+ /* if we already have a pending interactive check, then do nothing */
+ if (button->priv->interactive_check_cancellable != NULL)
+ {
+ goto out;
+ }
+
+ button->priv->interactive_check_cancellable = g_cancellable_new();
+
+ polkit_authority_check_authorization(button->priv->authority, button->priv->subject, button->priv->action_id, NULL, /* PolkitDetails */ POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION, button->priv->interactive_check_cancellable, interactive_check_cb, button);
+ }
+ else if (button->priv->authorized && button->priv->tmp_authz_id != NULL)
+ {
+ polkit_authority_revoke_temporary_authorization_by_id (button->priv->authority, button->priv->tmp_authz_id, /* cancellable */ NULL, /* callback */ NULL, /* user_data */ NULL);
+ }
+
+ out:
+
+ update_state(button);
+}
+
+/**
+ * polkit_lock_button_get_is_authorized:
+ * @button: A #PolkitLockButton.
+ *
+ * Gets whether the process is authorized.
+ *
+ * Returns: %TRUE if authorized.
+ */
+gboolean polkit_lock_button_get_is_authorized(PolkitLockButton* button)
+{
+ g_return_val_if_fail(POLKIT_IS_LOCK_BUTTON(button), FALSE);
+ return button->priv->authorized;
+}
+
+/**
+ * polkit_lock_button_get_can_obtain:
+ * @button: A #PolkitLockButton.
+ *
+ * Gets whether the user can obtain an authorization through
+ * authentication.
+ *
+ * Returns: Whether the authorization is obtainable.
+ */
+gboolean polkit_lock_button_get_can_obtain(PolkitLockButton* button)
+{
+ g_return_val_if_fail(POLKIT_IS_LOCK_BUTTON(button), FALSE);
+ return button->priv->can_obtain;
+}
+
+/**
+ * polkit_lock_button_get_is_visible:
+ * @button: A #PolkitLockButton.
+ *
+ * Gets whether @button is currently being shown.
+ *
+ * Returns: %TRUE if @button has any visible UI elements.
+ */
+gboolean polkit_lock_button_get_is_visible(PolkitLockButton* button)
+{
+ g_return_val_if_fail(POLKIT_IS_LOCK_BUTTON(button), FALSE);
+ return !button->priv->hidden;
+}
+
+/**
+ * polkit_lock_button_set_unlock_text:
+ * @button: A #PolkitLockButton.
+ * @text: The text to set.
+ *
+ * Makes @button display @text when not authorized and clicking the button will obtain the authorization.
+ */
+void polkit_lock_button_set_unlock_text(PolkitLockButton* button, const gchar* text)
+{
+ g_return_if_fail(POLKIT_IS_LOCK_BUTTON(button));
+ g_return_if_fail(text != NULL);
+
+ if (button->priv->text_unlock != NULL)
+ {
+ button->priv->text_unlock = g_strdup(text);
+ update_state(button);
+ }
+ else
+ {
+ button->priv->text_unlock = g_strdup(text);
+ }
+}
+
+/**
+ * polkit_lock_button_set_lock_text:
+ * @button: A #PolkitLockButton.
+ * @text: The text to set.
+ *
+ * Makes @button display @text when authorized and clicking the button will revoke the authorization.
+ */
+void polkit_lock_button_set_lock_text(PolkitLockButton* button, const gchar* text)
+{
+ g_return_if_fail(POLKIT_IS_LOCK_BUTTON(button));
+ g_return_if_fail(text != NULL);
+
+ if (button->priv->text_lock != NULL)
+ {
+ button->priv->text_lock = g_strdup(text);
+ update_state(button);
+ }
+ else
+ {
+ button->priv->text_lock = g_strdup(text);
+ }
+}
+
+/**
+ * polkit_lock_button_set_lock_down_text:
+ * @button: A #PolkitLockButton.
+ * @text: The text to set.
+ *
+ * Makes @button display @text when authorized and it is possible to lock down the action.
+ */
+void polkit_lock_button_set_lock_down_text(PolkitLockButton* button, const gchar* text)
+{
+ g_return_if_fail(POLKIT_IS_LOCK_BUTTON(button));
+ g_return_if_fail(text != NULL);
+
+ if (button->priv->text_lock_down != NULL)
+ {
+ button->priv->text_lock_down = g_strdup(text);
+ update_state(button);
+ }
+ else
+ {
+ button->priv->text_lock_down = g_strdup(text);
+ }
+}
+
+/**
+ * polkit_lock_button_set_not_authorized_text:
+ * @button: A #PolkitLockButton.
+ * @text: The text to set.
+ *
+ * Makes @button display @text when an authorization cannot be obtained.
+ */
+void polkit_lock_button_set_not_authorized_text(PolkitLockButton* button, const gchar* text)
+{
+ g_return_if_fail(POLKIT_IS_LOCK_BUTTON(button));
+ g_return_if_fail(text != NULL);
+
+ if (button->priv->text_not_authorized != NULL)
+ {
+ button->priv->text_not_authorized = g_strdup(text);
+ update_state(button);
+ }
+ else
+ {
+ button->priv->text_not_authorized = g_strdup(text);
+ }
+}
+
+
+/**
+ * polkit_lock_button_set_unlock_tooltip:
+ * @button: A #PolkitLockButton.
+ * @tooltip: The text of the tooltip.
+ *
+ * Makes @button display @tooltip when not authorized and clicking the button will obtain the authorization.
+ */
+void polkit_lock_button_set_unlock_tooltip(PolkitLockButton* button, const gchar* tooltip)
+{
+ g_return_if_fail(POLKIT_IS_LOCK_BUTTON(button));
+ g_return_if_fail(tooltip != NULL);
+
+ if (button->priv->tooltip_unlock != NULL)
+ {
+ button->priv->tooltip_unlock = g_strdup(tooltip);
+ update_state(button);
+ }
+ else
+ {
+ button->priv->tooltip_unlock = g_strdup(tooltip);
+ }
+}
+
+/**
+ * polkit_lock_button_set_lock_tooltip:
+ * @button: A #PolkitLockButton.
+ * @tooltip: The text of the tooltip.
+ *
+ * Makes @button display @tooltip when authorized and clicking the button will revoke the authorization.
+ */
+void polkit_lock_button_set_lock_tooltip(PolkitLockButton* button, const gchar* tooltip)
+{
+ g_return_if_fail(POLKIT_IS_LOCK_BUTTON(button));
+ g_return_if_fail(tooltip != NULL);
+
+ if (button->priv->tooltip_lock != NULL)
+ {
+ button->priv->tooltip_lock = g_strdup(tooltip);
+ update_state (button);
+ }
+ else
+ {
+ button->priv->tooltip_lock = g_strdup(tooltip);
+ }
+}
+
+/**
+ * polkit_lock_button_set_lock_down_tooltip:
+ * @button: A #PolkitLockButton.
+ * @tooltip: The text of the tooltip.
+ *
+ * Makes @button display @tooltip when authorized and it is possible to lock down the action.
+ */
+void polkit_lock_button_set_lock_down_tooltip(PolkitLockButton* button, const gchar* tooltip)
+{
+ g_return_if_fail(POLKIT_IS_LOCK_BUTTON(button));
+ g_return_if_fail(tooltip != NULL);
+
+ if (button->priv->tooltip_lock_down != NULL)
+ {
+ button->priv->tooltip_lock_down = g_strdup(tooltip);
+ update_state(button);
+ }
+ else
+ {
+ button->priv->tooltip_lock_down = g_strdup(tooltip);
+ }
+}
+
+/**
+ * polkit_lock_button_set_not_authorized_tooltip:
+ * @button: A #PolkitLockButton.
+ * @tooltip: The text of the tooltip.
+ *
+ * Makes @button display @tooltip when an authorization cannot be obtained.
+ */
+void polkit_lock_button_set_not_authorized_tooltip(PolkitLockButton* button, const gchar* tooltip)
+{
+ g_return_if_fail(POLKIT_IS_LOCK_BUTTON(button));
+ g_return_if_fail(tooltip != NULL);
+
+ if (button->priv->tooltip_not_authorized != NULL)
+ {
+ button->priv->tooltip_not_authorized = g_strdup(tooltip);
+ update_state(button);
+ }
+ else
+ {
+ button->priv->tooltip_not_authorized = g_strdup(tooltip);
+ }
+}
diff --git a/polkitgtkmate/polkitlockbutton.h b/polkitgtkmate/polkitlockbutton.h
new file mode 100644
index 0000000..016be49
--- /dev/null
+++ b/polkitgtkmate/polkitlockbutton.h
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: David Zeuthen <[email protected]>
+ */
+
+#if !defined(_POLKIT_GTK_MATE_INSIDE_POLKIT_GTK_MATE_H) && !defined(POLKIT_GTK_MATE_COMPILATION)
+ #error "Only <polkitgtkmate/polkitgtkmate.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef POLKIT_LOCK_BUTTON_H
+#define POLKIT_LOCK_BUTTON_H
+
+#include <polkitgtkmate/polkitgtkmatetypes.h>
+
+#define POLKIT_TYPE_LOCK_BUTTON \
+ (polkit_lock_button_get_type())
+
+#define POLKIT_LOCK_BUTTON(o) \
+ (G_TYPE_CHECK_INSTANCE_CAST((o), POLKIT_TYPE_LOCK_BUTTON, PolkitLockButton))
+
+#define POLKIT_LOCK_BUTTON_CLASS(k) \
+ (G_TYPE_CHECK_CLASS_CAST((k), POLKIT_LOCK_BUTTON, PolkitLockButtonClass))
+
+#define POLKIT_IS_LOCK_BUTTON(o) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((o), POLKIT_TYPE_LOCK_BUTTON))
+
+#define POLKIT_IS_LOCK_BUTTON_CLASS(k) \
+ (G_TYPE_CHECK_CLASS_TYPE((k), POLKIT_TYPE_LOCK_BUTTON))
+
+#define POLKIT_LOCK_BUTTON_GET_CLASS(o) \
+ (G_TYPE_INSTANCE_GET_CLASS((o), POLKIT_TYPE_LOCK_BUTTON, PolkitLockButtonClass))
+
+typedef struct _PolkitLockButtonClass PolkitLockButtonClass;
+typedef struct _PolkitLockButtonPrivate PolkitLockButtonPrivate;
+
+/**
+ * PolkitLockButton:
+ * @parent: The parent instance.
+ *
+ * The #PolkitLockButton structure contains only private data and
+ * should be accessed using the provided API.
+ */
+struct _PolkitLockButton {
+ GtkHBox parent;
+
+ /*< private >*/
+ PolkitLockButtonPrivate* priv;
+};
+
+/**
+ * PolkitLockButtonClass:
+ * @parent_class: The parent class structure.
+ * @changed: Signal class handler for the #PolkitLockButton::changed signal.
+ *
+ * Class structure for #PolkitLockButton.
+ */
+struct _PolkitLockButtonClass {
+ GtkHBoxClass parent_class;
+
+ /* Signals */
+ void (*changed)(PolkitLockButton* button);
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_polkit_reserved0)(void);
+ void (*_polkit_reserved1)(void);
+ void (*_polkit_reserved2)(void);
+ void (*_polkit_reserved3)(void);
+ void (*_polkit_reserved4)(void);
+ void (*_polkit_reserved5)(void);
+ void (*_polkit_reserved6)(void);
+ void (*_polkit_reserved7)(void);
+ void (*_polkit_reserved8)(void);
+ void (*_polkit_reserved9)(void);
+ void (*_polkit_reserved10)(void);
+ void (*_polkit_reserved11)(void);
+ void (*_polkit_reserved12)(void);
+ void (*_polkit_reserved13)(void);
+ void (*_polkit_reserved14)(void);
+ void (*_polkit_reserved15)(void);
+};
+
+
+GType polkit_lock_button_get_type(void) G_GNUC_CONST;
+GtkWidget* polkit_lock_button_new(const gchar* action_id);
+gboolean polkit_lock_button_get_is_authorized(PolkitLockButton* button);
+gboolean polkit_lock_button_get_is_visible(PolkitLockButton* button);
+gboolean polkit_lock_button_get_can_obtain(PolkitLockButton* button);
+
+void polkit_lock_button_set_unlock_text(PolkitLockButton* button, const gchar* text);
+void polkit_lock_button_set_unlock_tooltip(PolkitLockButton* button, const gchar* tooltip);
+
+void polkit_lock_button_set_lock_text(PolkitLockButton* button, const gchar* text);
+void polkit_lock_button_set_lock_tooltip(PolkitLockButton* button, const gchar* tooltip);
+
+void polkit_lock_button_set_lock_down_text(PolkitLockButton* button, const gchar* text);
+void polkit_lock_button_set_lock_down_tooltip(PolkitLockButton* button, const gchar* tooltip);
+
+void polkit_lock_button_set_not_authorized_text(PolkitLockButton* button, const gchar* text);
+void polkit_lock_button_set_not_authorized_tooltip(PolkitLockButton* button, const gchar* tooltip);
+
+#endif /* POLKIT_LOCK_BUTTON_H */