├── .gitignore ├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── LICENSE ├── Makefile.am ├── NEWS ├── README ├── README.md ├── configure.ac ├── meson.build ├── src ├── .gitignore ├── Makefile.am ├── xfce-polkit-listener.c ├── xfce-polkit-listener.h └── xfce-polkit.c └── xfce-polkit.desktop.in /.gitignore: -------------------------------------------------------------------------------- 1 | # http://www.gnu.org/software/automake 2 | 3 | Makefile.in 4 | Makefile 5 | 6 | # http://www.gnu.org/software/autoconf 7 | 8 | /autom4te.cache 9 | /aclocal.m4 10 | /compile 11 | /configure 12 | /depcomp 13 | /install-sh 14 | /missing 15 | config.* 16 | .deps 17 | 18 | *.desktop 19 | *.po 20 | *.o 21 | core 22 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Natanael Copa 2 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | LICENSE -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ncopa/xfce-polkit/820497b731f95b420b4b1ced1f70e551ef5fd611/ChangeLog -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Installation Instructions 2 | ************************* 3 | 4 | Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software 5 | Foundation, Inc. 6 | 7 | Copying and distribution of this file, with or without modification, 8 | are permitted in any medium without royalty provided the copyright 9 | notice and this notice are preserved. This file is offered as-is, 10 | without warranty of any kind. 11 | 12 | Basic Installation 13 | ================== 14 | 15 | Briefly, the shell command './configure && make && make install' 16 | should configure, build, and install this package. The following 17 | more-detailed instructions are generic; see the 'README' file for 18 | instructions specific to this package. Some packages provide this 19 | 'INSTALL' file but do not implement all of the features documented 20 | below. The lack of an optional feature in a given package is not 21 | necessarily a bug. More recommendations for GNU packages can be found 22 | in *note Makefile Conventions: (standards)Makefile Conventions. 23 | 24 | The 'configure' shell script attempts to guess correct values for 25 | various system-dependent variables used during compilation. It uses 26 | those values to create a 'Makefile' in each directory of the package. 27 | It may also create one or more '.h' files containing system-dependent 28 | definitions. Finally, it creates a shell script 'config.status' that 29 | you can run in the future to recreate the current configuration, and a 30 | file 'config.log' containing compiler output (useful mainly for 31 | debugging 'configure'). 32 | 33 | It can also use an optional file (typically called 'config.cache' and 34 | enabled with '--cache-file=config.cache' or simply '-C') that saves the 35 | results of its tests to speed up reconfiguring. Caching is disabled by 36 | default to prevent problems with accidental use of stale cache files. 37 | 38 | If you need to do unusual things to compile the package, please try 39 | to figure out how 'configure' could check whether to do them, and mail 40 | diffs or instructions to the address given in the 'README' so they can 41 | be considered for the next release. If you are using the cache, and at 42 | some point 'config.cache' contains results you don't want to keep, you 43 | may remove or edit it. 44 | 45 | The file 'configure.ac' (or 'configure.in') is used to create 46 | 'configure' by a program called 'autoconf'. You need 'configure.ac' if 47 | you want to change it or regenerate 'configure' using a newer version of 48 | 'autoconf'. 49 | 50 | The simplest way to compile this package is: 51 | 52 | 1. 'cd' to the directory containing the package's source code and type 53 | './configure' to configure the package for your system. 54 | 55 | Running 'configure' might take a while. While running, it prints 56 | some messages telling which features it is checking for. 57 | 58 | 2. Type 'make' to compile the package. 59 | 60 | 3. Optionally, type 'make check' to run any self-tests that come with 61 | the package, generally using the just-built uninstalled binaries. 62 | 63 | 4. Type 'make install' to install the programs and any data files and 64 | documentation. When installing into a prefix owned by root, it is 65 | recommended that the package be configured and built as a regular 66 | user, and only the 'make install' phase executed with root 67 | privileges. 68 | 69 | 5. Optionally, type 'make installcheck' to repeat any self-tests, but 70 | this time using the binaries in their final installed location. 71 | This target does not install anything. Running this target as a 72 | regular user, particularly if the prior 'make install' required 73 | root privileges, verifies that the installation completed 74 | correctly. 75 | 76 | 6. You can remove the program binaries and object files from the 77 | source code directory by typing 'make clean'. To also remove the 78 | files that 'configure' created (so you can compile the package for 79 | a different kind of computer), type 'make distclean'. There is 80 | also a 'make maintainer-clean' target, but that is intended mainly 81 | for the package's developers. If you use it, you may have to get 82 | all sorts of other programs in order to regenerate files that came 83 | with the distribution. 84 | 85 | 7. Often, you can also type 'make uninstall' to remove the installed 86 | files again. In practice, not all packages have tested that 87 | uninstallation works correctly, even though it is required by the 88 | GNU Coding Standards. 89 | 90 | 8. Some packages, particularly those that use Automake, provide 'make 91 | distcheck', which can by used by developers to test that all other 92 | targets like 'make install' and 'make uninstall' work correctly. 93 | This target is generally not run by end users. 94 | 95 | Compilers and Options 96 | ===================== 97 | 98 | Some systems require unusual options for compilation or linking that 99 | the 'configure' script does not know about. Run './configure --help' 100 | for details on some of the pertinent environment variables. 101 | 102 | You can give 'configure' initial values for configuration parameters 103 | by setting variables in the command line or in the environment. Here is 104 | an example: 105 | 106 | ./configure CC=c99 CFLAGS=-g LIBS=-lposix 107 | 108 | *Note Defining Variables::, for more details. 109 | 110 | Compiling For Multiple Architectures 111 | ==================================== 112 | 113 | You can compile the package for more than one kind of computer at the 114 | same time, by placing the object files for each architecture in their 115 | own directory. To do this, you can use GNU 'make'. 'cd' to the 116 | directory where you want the object files and executables to go and run 117 | the 'configure' script. 'configure' automatically checks for the source 118 | code in the directory that 'configure' is in and in '..'. This is known 119 | as a "VPATH" build. 120 | 121 | With a non-GNU 'make', it is safer to compile the package for one 122 | architecture at a time in the source code directory. After you have 123 | installed the package for one architecture, use 'make distclean' before 124 | reconfiguring for another architecture. 125 | 126 | On MacOS X 10.5 and later systems, you can create libraries and 127 | executables that work on multiple system types--known as "fat" or 128 | "universal" binaries--by specifying multiple '-arch' options to the 129 | compiler but only a single '-arch' option to the preprocessor. Like 130 | this: 131 | 132 | ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ 133 | CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ 134 | CPP="gcc -E" CXXCPP="g++ -E" 135 | 136 | This is not guaranteed to produce working output in all cases, you 137 | may have to build one architecture at a time and combine the results 138 | using the 'lipo' tool if you have problems. 139 | 140 | Installation Names 141 | ================== 142 | 143 | By default, 'make install' installs the package's commands under 144 | '/usr/local/bin', include files under '/usr/local/include', etc. You 145 | can specify an installation prefix other than '/usr/local' by giving 146 | 'configure' the option '--prefix=PREFIX', where PREFIX must be an 147 | absolute file name. 148 | 149 | You can specify separate installation prefixes for 150 | architecture-specific files and architecture-independent files. If you 151 | pass the option '--exec-prefix=PREFIX' to 'configure', the package uses 152 | PREFIX as the prefix for installing programs and libraries. 153 | Documentation and other data files still use the regular prefix. 154 | 155 | In addition, if you use an unusual directory layout you can give 156 | options like '--bindir=DIR' to specify different values for particular 157 | kinds of files. Run 'configure --help' for a list of the directories 158 | you can set and what kinds of files go in them. In general, the default 159 | for these options is expressed in terms of '${prefix}', so that 160 | specifying just '--prefix' will affect all of the other directory 161 | specifications that were not explicitly provided. 162 | 163 | The most portable way to affect installation locations is to pass the 164 | correct locations to 'configure'; however, many packages provide one or 165 | both of the following shortcuts of passing variable assignments to the 166 | 'make install' command line to change installation locations without 167 | having to reconfigure or recompile. 168 | 169 | The first method involves providing an override variable for each 170 | affected directory. For example, 'make install 171 | prefix=/alternate/directory' will choose an alternate location for all 172 | directory configuration variables that were expressed in terms of 173 | '${prefix}'. Any directories that were specified during 'configure', 174 | but not in terms of '${prefix}', must each be overridden at install time 175 | for the entire installation to be relocated. The approach of makefile 176 | variable overrides for each directory variable is required by the GNU 177 | Coding Standards, and ideally causes no recompilation. However, some 178 | platforms have known limitations with the semantics of shared libraries 179 | that end up requiring recompilation when using this method, particularly 180 | noticeable in packages that use GNU Libtool. 181 | 182 | The second method involves providing the 'DESTDIR' variable. For 183 | example, 'make install DESTDIR=/alternate/directory' will prepend 184 | '/alternate/directory' before all installation names. The approach of 185 | 'DESTDIR' overrides is not required by the GNU Coding Standards, and 186 | does not work on platforms that have drive letters. On the other hand, 187 | it does better at avoiding recompilation issues, and works well even 188 | when some directory options were not specified in terms of '${prefix}' 189 | at 'configure' time. 190 | 191 | Optional Features 192 | ================= 193 | 194 | If the package supports it, you can cause programs to be installed 195 | with an extra prefix or suffix on their names by giving 'configure' the 196 | option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'. 197 | 198 | Some packages pay attention to '--enable-FEATURE' options to 199 | 'configure', where FEATURE indicates an optional part of the package. 200 | They may also pay attention to '--with-PACKAGE' options, where PACKAGE 201 | is something like 'gnu-as' or 'x' (for the X Window System). The 202 | 'README' should mention any '--enable-' and '--with-' options that the 203 | package recognizes. 204 | 205 | For packages that use the X Window System, 'configure' can usually 206 | find the X include and library files automatically, but if it doesn't, 207 | you can use the 'configure' options '--x-includes=DIR' and 208 | '--x-libraries=DIR' to specify their locations. 209 | 210 | Some packages offer the ability to configure how verbose the 211 | execution of 'make' will be. For these packages, running './configure 212 | --enable-silent-rules' sets the default to minimal output, which can be 213 | overridden with 'make V=1'; while running './configure 214 | --disable-silent-rules' sets the default to verbose, which can be 215 | overridden with 'make V=0'. 216 | 217 | Particular systems 218 | ================== 219 | 220 | On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC 221 | is not installed, it is recommended to use the following options in 222 | order to use an ANSI C compiler: 223 | 224 | ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" 225 | 226 | and if that doesn't work, install pre-built binaries of GCC for HP-UX. 227 | 228 | HP-UX 'make' updates targets which have the same time stamps as their 229 | prerequisites, which makes it generally unusable when shipped generated 230 | files such as 'configure' are involved. Use GNU 'make' instead. 231 | 232 | On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot 233 | parse its '' header file. The option '-nodtk' can be used as a 234 | workaround. If GNU CC is not installed, it is therefore recommended to 235 | try 236 | 237 | ./configure CC="cc" 238 | 239 | and if that doesn't work, try 240 | 241 | ./configure CC="cc -nodtk" 242 | 243 | On Solaris, don't put '/usr/ucb' early in your 'PATH'. This 244 | directory contains several dysfunctional programs; working variants of 245 | these programs are available in '/usr/bin'. So, if you need '/usr/ucb' 246 | in your 'PATH', put it _after_ '/usr/bin'. 247 | 248 | On Haiku, software installed for all users goes in '/boot/common', 249 | not '/usr/local'. It is recommended to use the following options: 250 | 251 | ./configure --prefix=/boot/common 252 | 253 | Specifying the System Type 254 | ========================== 255 | 256 | There may be some features 'configure' cannot figure out 257 | automatically, but needs to determine by the type of machine the package 258 | will run on. Usually, assuming the package is built to be run on the 259 | _same_ architectures, 'configure' can figure that out, but if it prints 260 | a message saying it cannot guess the machine type, give it the 261 | '--build=TYPE' option. TYPE can either be a short name for the system 262 | type, such as 'sun4', or a canonical name which has the form: 263 | 264 | CPU-COMPANY-SYSTEM 265 | 266 | where SYSTEM can have one of these forms: 267 | 268 | OS 269 | KERNEL-OS 270 | 271 | See the file 'config.sub' for the possible values of each field. If 272 | 'config.sub' isn't included in this package, then this package doesn't 273 | need to know the machine type. 274 | 275 | If you are _building_ compiler tools for cross-compiling, you should 276 | use the option '--target=TYPE' to select the type of system they will 277 | produce code for. 278 | 279 | If you want to _use_ a cross compiler, that generates code for a 280 | platform different from the build platform, you should specify the 281 | "host" platform (i.e., that on which the generated programs will 282 | eventually be run) with '--host=TYPE'. 283 | 284 | Sharing Defaults 285 | ================ 286 | 287 | If you want to set default values for 'configure' scripts to share, 288 | you can create a site shell script called 'config.site' that gives 289 | default values for variables like 'CC', 'cache_file', and 'prefix'. 290 | 'configure' looks for 'PREFIX/share/config.site' if it exists, then 291 | 'PREFIX/etc/config.site' if it exists. Or, you can set the 292 | 'CONFIG_SITE' environment variable to the location of the site script. 293 | A warning: not all 'configure' scripts look for a site script. 294 | 295 | Defining Variables 296 | ================== 297 | 298 | Variables not defined in a site shell script can be set in the 299 | environment passed to 'configure'. However, some packages may run 300 | configure again during the build, and the customized values of these 301 | variables may be lost. In order to avoid this problem, you should set 302 | them in the 'configure' command line, using 'VAR=value'. For example: 303 | 304 | ./configure CC=/usr/local2/bin/gcc 305 | 306 | causes the specified 'gcc' to be used as the C compiler (unless it is 307 | overridden in the site shell script). 308 | 309 | Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an 310 | Autoconf limitation. Until the limitation is lifted, you can use this 311 | workaround: 312 | 313 | CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash 314 | 315 | 'configure' Invocation 316 | ====================== 317 | 318 | 'configure' recognizes the following options to control how it 319 | operates. 320 | 321 | '--help' 322 | '-h' 323 | Print a summary of all of the options to 'configure', and exit. 324 | 325 | '--help=short' 326 | '--help=recursive' 327 | Print a summary of the options unique to this package's 328 | 'configure', and exit. The 'short' variant lists options used only 329 | in the top level, while the 'recursive' variant lists options also 330 | present in any nested packages. 331 | 332 | '--version' 333 | '-V' 334 | Print the version of Autoconf used to generate the 'configure' 335 | script, and exit. 336 | 337 | '--cache-file=FILE' 338 | Enable the cache: use and save the results of the tests in FILE, 339 | traditionally 'config.cache'. FILE defaults to '/dev/null' to 340 | disable caching. 341 | 342 | '--config-cache' 343 | '-C' 344 | Alias for '--cache-file=config.cache'. 345 | 346 | '--quiet' 347 | '--silent' 348 | '-q' 349 | Do not print messages saying which checks are being made. To 350 | suppress all normal output, redirect it to '/dev/null' (any error 351 | messages will still be shown). 352 | 353 | '--srcdir=DIR' 354 | Look for the package's source code in directory DIR. Usually 355 | 'configure' can determine that directory automatically. 356 | 357 | '--prefix=DIR' 358 | Use DIR as the installation prefix. *note Installation Names:: for 359 | more details, including other options available for fine-tuning the 360 | installation locations. 361 | 362 | '--no-create' 363 | '-n' 364 | Run the configure checks, but stop before creating any output 365 | files. 366 | 367 | 'configure' also accepts some other, not widely useful, options. Run 368 | 'configure --help' for more details. 369 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | A simple PolicyKit authentication agent for XFCE 294 | Copyright (C) 2013 ncopa 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = src 2 | 3 | NULL= 4 | 5 | desktopdir=$(sysconfdir)/xdg/autostart 6 | desktop_in_files = \ 7 | xfce-polkit.desktop.in \ 8 | $(NULL) 9 | 10 | desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) 11 | 12 | EXTRA_DIST = \ 13 | $(desktop_in_files) \ 14 | $(NULL) 15 | 16 | xfce-polkit.desktop: xfce-polkit.desktop.in 17 | sed -e 's,@xfce_polkit_libexecdir@,$(libexecdir),' $< > $@ 18 | 19 | clean-local: 20 | -rm -f xfce-polkit.desktop 21 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ncopa/xfce-polkit/820497b731f95b420b4b1ced1f70e551ef5fd611/NEWS -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | README.md -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | xfce-polkit 2 | =========== 3 | 4 | A simple PolicyKit authentication agent for XFCE 5 | 6 | # Required packages 7 | 8 | xfce-polkit depends on the following packages: 9 | 10 | - glib 11 | - libxfce4ui 12 | - polkit 13 | 14 | # Installation 15 | 16 | Run the following commands at the root of the repository: 17 | ``` 18 | mkdir build 19 | cd build 20 | meson --prefix=/usr .. 21 | ninja 22 | ``` 23 | to compile, then run 24 | ``` 25 | ninja install 26 | ``` 27 | as root to install. 28 | 29 | # Usage 30 | Make sure there's no other PolicyKit authentication agent running (if there is, `kill` them.) 31 | If you wish to use this by default, make sure `xfce-polkit` is the only authentication agent that is run at boot. 32 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | AC_INIT([xfce-polkit], [0.3]) 2 | AM_INIT_AUTOMAKE 3 | AC_PROG_CC 4 | 5 | PKG_CHECK_MODULES([GLIB], [glib-2.0]) 6 | PKG_CHECK_MODULES([LIBXFCE4UI], [libxfce4ui-2]) 7 | PKG_CHECK_MODULES([POLKIT_AGENT], [polkit-agent-1]) 8 | 9 | AC_CONFIG_FILES([ 10 | Makefile 11 | src/Makefile 12 | ]) 13 | 14 | AC_OUTPUT 15 | -------------------------------------------------------------------------------- /meson.build: -------------------------------------------------------------------------------- 1 | project('xfce-polkit', 'c', version : '0.3.0') 2 | 3 | prefix = get_option('prefix') 4 | libexecdir = join_paths(prefix, get_option('libexecdir')) 5 | sysconfdir = join_paths(prefix, get_option('sysconfdir')) 6 | autostartdir = join_paths(sysconfdir, 'xdg', 'autostart') 7 | 8 | deps = [ 9 | dependency('glib-2.0'), 10 | dependency('libxfce4ui-2'), 11 | dependency('polkit-agent-1'), 12 | ] 13 | 14 | sources = files([ 15 | 'src/xfce-polkit.c', 16 | 'src/xfce-polkit-listener.c', 17 | ]) 18 | 19 | executable('xfce-polkit', sources, 20 | dependencies: deps, 21 | install: true, 22 | install_dir: libexecdir 23 | ) 24 | 25 | desktopconf = configuration_data() 26 | desktopconf.set('xfce_polkit_libexecdir', libexecdir) 27 | configure_file( 28 | input: 'xfce-polkit.desktop.in', 29 | output: 'xfce-polkit.desktop', 30 | configuration: desktopconf, 31 | install_dir: autostartdir 32 | ) 33 | -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | xfce-polkit 2 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | NULL= 3 | 4 | libexec_PROGRAMS = xfce-polkit 5 | xfce_polkit_SOURCES = \ 6 | xfce-polkit.c \ 7 | xfce-polkit-listener.c \ 8 | xfce-polkit-listener.h \ 9 | $(NULL) 10 | 11 | xfce_polkit_CFLAGS = @GLIB_CFLAGS@ \ 12 | @LIBXFCE4UI_CFLAGS@ \ 13 | @POLKIT_AGENT_CFLAGS@ 14 | 15 | 16 | xfce_polkit_LDADD = @GLIB_LIBS@ \ 17 | @LIBXFCE4UI_LIBS@ \ 18 | @POLKIT_AGENT_LIBS@ 19 | 20 | 21 | #xfce-polkit-listener.o: xfce-polkit-listener.h 22 | 23 | -------------------------------------------------------------------------------- /src/xfce-polkit-listener.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | 6 | #include "xfce-polkit-listener.h" 7 | 8 | G_DEFINE_TYPE(XfcePolkitListener, xfce_polkit_listener, POLKIT_AGENT_TYPE_LISTENER); 9 | 10 | typedef struct _AuthDlgData AuthDlgData; 11 | struct _AuthDlgData { 12 | PolkitAgentSession *session; 13 | gchar *action_id; 14 | gchar *cookie; 15 | GCancellable* cancellable; 16 | GTask* task; 17 | GtkWidget *auth_dlg; 18 | GtkWidget *entry_label; 19 | GtkWidget *entry; 20 | GtkWidget *id_combo; 21 | GtkWidget *status; 22 | }; 23 | 24 | static void on_cancelled(GCancellable* cancellable, AuthDlgData* d); 25 | static void on_id_combo_user_changed(GtkComboBox *box, AuthDlgData *d); 26 | 27 | static void auth_dlg_data_free(AuthDlgData *d) 28 | { 29 | gtk_widget_destroy(d->auth_dlg); 30 | g_signal_handlers_disconnect_by_func(d->cancellable, on_cancelled, d); 31 | 32 | g_object_unref(d->task); 33 | g_object_unref(d->session); 34 | g_free(d->action_id); 35 | g_free(d->cookie); 36 | g_slice_free(AuthDlgData, d); 37 | } 38 | 39 | static void on_cancelled(GCancellable *cancellable, AuthDlgData *d) 40 | { 41 | if (d->session) 42 | polkit_agent_session_cancel(d->session); 43 | else 44 | auth_dlg_data_free(d); 45 | } 46 | 47 | static void on_auth_dlg_response(GtkDialog *dlg, int response, AuthDlgData *d) 48 | { 49 | if (response == GTK_RESPONSE_OK) { 50 | const char *txt = gtk_entry_get_text(GTK_ENTRY(d->entry)); 51 | polkit_agent_session_response(d->session, txt); 52 | gtk_widget_set_sensitive(d->auth_dlg, FALSE); 53 | } else 54 | g_cancellable_cancel(d->cancellable); 55 | } 56 | 57 | static void on_session_completed(PolkitAgentSession* session, 58 | gboolean authorized, AuthDlgData* d) 59 | { 60 | gtk_widget_set_sensitive(d->auth_dlg, TRUE); 61 | if (authorized || g_cancellable_is_cancelled(d->cancellable)) { 62 | gtk_label_set_text(GTK_LABEL(d->status), NULL); 63 | g_task_return_pointer(d->task, NULL, NULL); 64 | auth_dlg_data_free(d); 65 | return; 66 | } 67 | gtk_label_set_text(GTK_LABEL(d->status), "Failed. Wrong password?"); 68 | g_object_unref(d->session); 69 | d->session = NULL; 70 | gtk_entry_set_text(GTK_ENTRY(d->entry), ""); 71 | gtk_widget_grab_focus(d->entry); 72 | on_id_combo_user_changed(GTK_COMBO_BOX(d->id_combo), d); 73 | } 74 | 75 | static void on_session_request(PolkitAgentSession* session, gchar *req, 76 | gboolean visibility, AuthDlgData *d) 77 | { 78 | g_debug("Request: %s\nVisibility: %i\n", req, visibility); 79 | gtk_label_set_text(GTK_LABEL(d->entry_label), req); 80 | gtk_entry_set_visibility(GTK_ENTRY(d->entry), visibility); 81 | } 82 | 83 | static void on_session_show_error(PolkitAgentSession *session, gchar *text, 84 | AuthDlgData *d) 85 | { 86 | xfce_dialog_show_warning(GTK_WINDOW(d->auth_dlg), text, 87 | "XFCE PolicyKit Agent"); 88 | } 89 | 90 | static void on_session_show_info(PolkitAgentSession *session, gchar *text, 91 | AuthDlgData *d) 92 | { 93 | xfce_dialog_show_info(GTK_WINDOW(d->auth_dlg), text, 94 | "XFCE PolicyKit Agent"); 95 | } 96 | 97 | static void on_id_combo_user_changed(GtkComboBox *combo, AuthDlgData *d) 98 | { 99 | GtkTreeIter iter; 100 | GtkTreeModel *model = gtk_combo_box_get_model(combo); 101 | PolkitIdentity *id; 102 | 103 | if (!gtk_combo_box_get_active_iter(combo, &iter)) 104 | return; 105 | 106 | gtk_tree_model_get(model, &iter, 1, &id, -1); 107 | if (d->session) { 108 | g_signal_handlers_disconnect_matched(d->session, 109 | G_SIGNAL_MATCH_DATA, 110 | 0, 0, NULL, NULL, d); 111 | polkit_agent_session_cancel(d->session); 112 | g_object_unref(d->session); 113 | } 114 | 115 | d->session = polkit_agent_session_new(id, d->cookie); 116 | g_object_unref(id); 117 | g_signal_connect(d->session, "completed", 118 | G_CALLBACK(on_session_completed), d); 119 | g_signal_connect(d->session, "request", 120 | G_CALLBACK(on_session_request), d); 121 | g_signal_connect(d->session, "show-error", 122 | G_CALLBACK(on_session_show_error), d); 123 | g_signal_connect(d->session, "show-info", 124 | G_CALLBACK(on_session_show_info), d); 125 | polkit_agent_session_initiate(d->session); 126 | } 127 | 128 | static void on_entry_activate(GtkWidget *entry, AuthDlgData *d) 129 | { 130 | gtk_dialog_response(GTK_DIALOG(d->auth_dlg), GTK_RESPONSE_OK); 131 | } 132 | 133 | static void add_identities(GtkComboBox *combo, GList *identities) 134 | { 135 | GList *p; 136 | GtkCellRenderer *column; 137 | GtkListStore *store; 138 | 139 | store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_OBJECT); 140 | for (p = identities; p != NULL; p = p->next) { 141 | gchar *str = NULL; 142 | PolkitIdentity *id = (PolkitIdentity *)p->data; 143 | if(POLKIT_IS_UNIX_USER(id)) { 144 | uid_t uid = polkit_unix_user_get_uid(POLKIT_UNIX_USER(id)); 145 | struct passwd *pwd = getpwuid(uid); 146 | str = g_strdup(pwd->pw_name); 147 | } else if(POLKIT_IS_UNIX_GROUP(id)) { 148 | gid_t gid = polkit_unix_group_get_gid(POLKIT_UNIX_GROUP(id)); 149 | struct group *grp = getgrgid(gid); 150 | str = g_strdup_printf(_("Group: %s"), grp->gr_name); 151 | } else { 152 | str = polkit_identity_to_string(id); 153 | } 154 | gtk_list_store_insert_with_values(store, NULL, -1, 155 | 0, str, 156 | 1, id, 157 | -1); 158 | g_free(str); 159 | } 160 | gtk_combo_box_set_model(combo, GTK_TREE_MODEL(store)); 161 | g_object_unref(store); 162 | 163 | column = gtk_cell_renderer_text_new(); 164 | gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), column, TRUE); 165 | gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), column, 166 | "text", 0, NULL); 167 | } 168 | 169 | static GtkWidget *grid2x2(GtkWidget *top_left, GtkWidget *top_right, 170 | GtkWidget *bottom_left, GtkWidget *bottom_right) 171 | { 172 | GtkWidget *grid = gtk_grid_new(); 173 | gtk_grid_set_column_spacing(GTK_GRID(grid), 12); 174 | gtk_grid_set_row_spacing(GTK_GRID(grid), 6); 175 | gtk_container_set_border_width(GTK_CONTAINER(grid), 12); 176 | 177 | gtk_grid_attach(GTK_GRID(grid), top_left, 0, 0, 1, 1); 178 | gtk_grid_attach(GTK_GRID(grid), top_right, 1, 0, 1, 1); 179 | gtk_grid_attach(GTK_GRID(grid), bottom_left, 0, 1, 1, 1); 180 | gtk_grid_attach(GTK_GRID(grid), bottom_right, 1, 1, 1, 1); 181 | gtk_widget_show(grid); 182 | return grid; 183 | } 184 | 185 | static void initiate_authentication(PolkitAgentListener *listener, 186 | const gchar *action_id, 187 | const gchar *message, 188 | const gchar *icon_name, 189 | PolkitDetails *details, 190 | const gchar *cookie, 191 | GList *identities, 192 | GCancellable *cancellable, 193 | GAsyncReadyCallback callback, 194 | gpointer user_data) 195 | { 196 | GtkWidget *content; 197 | GtkWidget *combo_label; 198 | GtkWidget *grid; 199 | AuthDlgData *d = g_slice_new0(AuthDlgData); 200 | 201 | char** p; 202 | 203 | for(p = polkit_details_get_keys(details); *p; ++p) 204 | g_debug("initiate_authentication: %s: %s", *p, polkit_details_lookup(details, *p)); 205 | 206 | d->task = g_task_new(listener, cancellable, callback, user_data); 207 | d->cancellable = cancellable; 208 | d->action_id = g_strdup(action_id); 209 | d->cookie = g_strdup(cookie); 210 | d->auth_dlg = xfce_titled_dialog_new_with_buttons( 211 | "Authentication required", 212 | NULL, GTK_DIALOG_DESTROY_WITH_PARENT, 213 | "_Deny", GTK_RESPONSE_CANCEL, 214 | "_Allow", GTK_RESPONSE_OK, 215 | NULL); 216 | xfce_titled_dialog_set_subtitle(XFCE_TITLED_DIALOG(d->auth_dlg), message); 217 | gtk_window_set_icon_name(GTK_WINDOW(d->auth_dlg), "dialog-password"); 218 | gtk_window_set_position(GTK_WINDOW(d->auth_dlg), GTK_WIN_POS_CENTER_ALWAYS); 219 | 220 | content = gtk_dialog_get_content_area(GTK_DIALOG(d->auth_dlg)); 221 | 222 | combo_label = gtk_label_new("Identity:"); 223 | gtk_widget_set_halign(combo_label, GTK_ALIGN_END); 224 | gtk_widget_show(combo_label); 225 | 226 | d->id_combo = gtk_combo_box_new(); 227 | add_identities(GTK_COMBO_BOX(d->id_combo), identities); 228 | g_signal_connect(d->id_combo, "changed", 229 | G_CALLBACK(on_id_combo_user_changed), d); 230 | gtk_combo_box_set_active(GTK_COMBO_BOX(d->id_combo), 0); 231 | gtk_widget_set_hexpand(d->id_combo, TRUE); 232 | gtk_widget_show(d->id_combo); 233 | 234 | d->entry_label = gtk_label_new(NULL); 235 | gtk_widget_set_halign(d->entry_label, GTK_ALIGN_END); 236 | gtk_widget_show(d->entry_label); 237 | 238 | d->entry = gtk_entry_new(); 239 | gtk_entry_set_visibility(GTK_ENTRY(d->entry), FALSE); 240 | gtk_widget_set_hexpand(d->entry, TRUE); 241 | gtk_widget_show(d->entry); 242 | g_signal_connect (d->entry, "activate", G_CALLBACK(on_entry_activate), d); 243 | 244 | grid = grid2x2(combo_label, d->id_combo, d->entry_label, d->entry); 245 | gtk_box_pack_start(GTK_BOX(content), grid, TRUE, TRUE, 0); 246 | 247 | d->status = gtk_label_new(NULL); 248 | gtk_box_pack_start(GTK_BOX(content), d->status, TRUE, TRUE, 0); 249 | gtk_widget_show(d->status); 250 | 251 | g_signal_connect(cancellable, "cancelled", G_CALLBACK(on_cancelled), d); 252 | g_signal_connect(d->auth_dlg, "response", 253 | G_CALLBACK(on_auth_dlg_response), d); 254 | 255 | gtk_widget_grab_focus(d->entry); 256 | gtk_window_present(GTK_WINDOW(d->auth_dlg)); 257 | } 258 | 259 | static gboolean initiate_authentication_finish(PolkitAgentListener *listener, 260 | GAsyncResult *res, GError **error) 261 | { 262 | g_debug("initiate_authentication_finish"); 263 | return !g_task_propagate_boolean(G_TASK(res), error); 264 | } 265 | 266 | static void xfce_polkit_listener_finalize(GObject *object) 267 | { 268 | g_return_if_fail(object != NULL); 269 | g_return_if_fail(XFCE_IS_POLKIT_LISTENER(object)); 270 | G_OBJECT_CLASS(xfce_polkit_listener_parent_class)->finalize(object); 271 | } 272 | 273 | static void xfce_polkit_listener_class_init(XfcePolkitListenerClass *klass) 274 | { 275 | GObjectClass *g_object_class; 276 | PolkitAgentListenerClass* pkal_class; 277 | g_object_class = G_OBJECT_CLASS(klass); 278 | g_object_class->finalize = xfce_polkit_listener_finalize; 279 | 280 | pkal_class = POLKIT_AGENT_LISTENER_CLASS(klass); 281 | pkal_class->initiate_authentication = initiate_authentication; 282 | pkal_class->initiate_authentication_finish = initiate_authentication_finish; 283 | } 284 | 285 | static void xfce_polkit_listener_init(XfcePolkitListener *self) 286 | { 287 | } 288 | 289 | PolkitAgentListener* xfce_polkit_listener_new(void) 290 | { 291 | return g_object_new(XFCE_TYPE_POLKIT_LISTENER, NULL); 292 | } 293 | 294 | 295 | -------------------------------------------------------------------------------- /src/xfce-polkit-listener.h: -------------------------------------------------------------------------------- 1 | #ifndef __XFCE_POLKIT_LISTENER_H__ 2 | 3 | #define POLKIT_AGENT_I_KNOW_API_IS_SUBJECT_TO_CHANGE 4 | #include 5 | #include 6 | 7 | G_BEGIN_DECLS 8 | 9 | #define XFCE_TYPE_POLKIT_LISTENER (xfce_polkit_listener_get_type()) 10 | #define XFCE_POLKIT_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XFCE_TYPE_POLKIT_LISTENER, XfcePolkitListener)) 11 | #define XFCE_POLKIT_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), XFCE_TYPE_POLKIT_LISTENER, XfcePolkitListenerClass)) 12 | #define XFCE_IS_POLKIT_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), XFCE_TYPE_POLKIT_LISTENER)) 13 | #define XFCE_IS_POLKIT_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), XFCE_TYPE_POLKIT_LISTENER)) 14 | #define XFCE_POLKIT_LISTENER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), XFCE_TYPE_POLKIT_LISTENER, XfcePolkitListenerClass)) 15 | 16 | 17 | typedef struct _XfcePolkitListener XfcePolkitListener; 18 | typedef struct _XfcePolkitListenerClass XfcePolkitListenerClass; 19 | 20 | struct _XfcePolkitListener { 21 | PolkitAgentListener parent; 22 | }; 23 | 24 | struct _XfcePolkitListenerClass { 25 | PolkitAgentListenerClass parent_class; 26 | }; 27 | 28 | GType xfce_polkit_listener_get_type(void); 29 | PolkitAgentListener* xfce_polkit_listener_new(void); 30 | 31 | G_END_DECLS 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /src/xfce-polkit.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "xfce-polkit-listener.h" 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | PolkitAgentListener *listener; 7 | PolkitSubject* session; 8 | GError* err = NULL; 9 | int rc = 0; 10 | 11 | gtk_init(&argc, &argv); 12 | 13 | listener = xfce_polkit_listener_new(); 14 | session = polkit_unix_session_new_for_process_sync(getpid(), NULL, NULL); 15 | 16 | if(!polkit_agent_listener_register(listener, 17 | POLKIT_AGENT_REGISTER_FLAGS_NONE, 18 | session, NULL, NULL, &err)) { 19 | xfce_dialog_show_error(NULL, err, "XFCE PolicyKit Agent"); 20 | rc = 1; 21 | } else { 22 | gtk_main(); 23 | } 24 | 25 | g_object_unref(listener); 26 | g_object_unref(session); 27 | return rc; 28 | } 29 | -------------------------------------------------------------------------------- /xfce-polkit.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Name=XFCE PolKit 4 | Comment=Policykit Authentication Agent 5 | Exec=@xfce_polkit_libexecdir@/xfce-polkit 6 | Icon=gtk-dialog-authentication 7 | NotShowIn=GNOME;KDE; 8 | OnlyShowIn=XFCE; 9 | --------------------------------------------------------------------------------