Merge lp:~ted/indicator-session/new-logout-dialog into lp:indicator-session/0.1

Proposed by Ted Gould
Status: Merged
Merged at revision: not available
Proposed branch: lp:~ted/indicator-session/new-logout-dialog
Merge into: lp:indicator-session/0.1
Diff against target: 1782 lines (+342/-1250)
14 files modified
COPYING.LGPL (+0/-481)
Makefile.am (+1/-1)
configure.ac (+0/-1)
po/POTFILES.in (+3/-4)
src/Makefile.am (+28/-3)
src/dialog.c (+230/-0)
src/dialog.h (+64/-0)
src/gtk-dialog/Makefile.am (+0/-15)
src/gtk-dialog/ck-pk-helper.c (+0/-222)
src/gtk-dialog/ck-pk-helper.h (+0/-32)
src/gtk-dialog/logout-dialog.c (+0/-370)
src/gtk-dialog/logout-dialog.h (+0/-99)
src/gtk-logout-helper.c (+15/-21)
src/session-service.c (+1/-1)
To merge this branch: bzr merge lp:~ted/indicator-session/new-logout-dialog
Reviewer Review Type Date Requested Status
David Barth Approve
Review via email: mp+20614@code.launchpad.net

Description of the change

A branch to rebuild the logout dialogs to not have a timer and be
cleaner overall. Also adding in some auth checks and some restart
required lovin'.

The patch is large, but most of it's deletion.

To post a comment you must log in.
Revision history for this message
David Barth (dbarth) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'COPYING.LGPL'
2--- COPYING.LGPL 2009-08-11 13:26:25 +0000
3+++ COPYING.LGPL 1970-01-01 00:00:00 +0000
4@@ -1,481 +0,0 @@
5- GNU LIBRARY GENERAL PUBLIC LICENSE
6- Version 2, June 1991
7-
8- Copyright (C) 1991 Free Software Foundation, Inc.
9- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
10- Everyone is permitted to copy and distribute verbatim copies
11- of this license document, but changing it is not allowed.
12-
13-[This is the first released version of the library GPL. It is
14- numbered 2 because it goes with version 2 of the ordinary GPL.]
15-
16- Preamble
17-
18- The licenses for most software are designed to take away your
19-freedom to share and change it. By contrast, the GNU General Public
20-Licenses are intended to guarantee your freedom to share and change
21-free software--to make sure the software is free for all its users.
22-
23- This license, the Library General Public License, applies to some
24-specially designated Free Software Foundation software, and to any
25-other libraries whose authors decide to use it. You can use it for
26-your libraries, too.
27-
28- When we speak of free software, we are referring to freedom, not
29-price. Our General Public Licenses are designed to make sure that you
30-have the freedom to distribute copies of free software (and charge for
31-this service if you wish), that you receive source code or can get it
32-if you want it, that you can change the software or use pieces of it
33-in new free programs; and that you know you can do these things.
34-
35- To protect your rights, we need to make restrictions that forbid
36-anyone to deny you these rights or to ask you to surrender the rights.
37-These restrictions translate to certain responsibilities for you if
38-you distribute copies of the library, or if you modify it.
39-
40- For example, if you distribute copies of the library, whether gratis
41-or for a fee, you must give the recipients all the rights that we gave
42-you. You must make sure that they, too, receive or can get the source
43-code. If you link a program with the library, you must provide
44-complete object files to the recipients so that they can relink them
45-with the library, after making changes to the library and recompiling
46-it. And you must show them these terms so they know their rights.
47-
48- Our method of protecting your rights has two steps: (1) copyright
49-the library, and (2) offer you this license which gives you legal
50-permission to copy, distribute and/or modify the library.
51-
52- Also, for each distributor's protection, we want to make certain
53-that everyone understands that there is no warranty for this free
54-library. If the library is modified by someone else and passed on, we
55-want its recipients to know that what they have is not the original
56-version, so that any problems introduced by others will not reflect on
57-the original authors' reputations.
58-
59
60- Finally, any free program is threatened constantly by software
61-patents. We wish to avoid the danger that companies distributing free
62-software will individually obtain patent licenses, thus in effect
63-transforming the program into proprietary software. To prevent this,
64-we have made it clear that any patent must be licensed for everyone's
65-free use or not licensed at all.
66-
67- Most GNU software, including some libraries, is covered by the ordinary
68-GNU General Public License, which was designed for utility programs. This
69-license, the GNU Library General Public License, applies to certain
70-designated libraries. This license is quite different from the ordinary
71-one; be sure to read it in full, and don't assume that anything in it is
72-the same as in the ordinary license.
73-
74- The reason we have a separate public license for some libraries is that
75-they blur the distinction we usually make between modifying or adding to a
76-program and simply using it. Linking a program with a library, without
77-changing the library, is in some sense simply using the library, and is
78-analogous to running a utility program or application program. However, in
79-a textual and legal sense, the linked executable is a combined work, a
80-derivative of the original library, and the ordinary General Public License
81-treats it as such.
82-
83- Because of this blurred distinction, using the ordinary General
84-Public License for libraries did not effectively promote software
85-sharing, because most developers did not use the libraries. We
86-concluded that weaker conditions might promote sharing better.
87-
88- However, unrestricted linking of non-free programs would deprive the
89-users of those programs of all benefit from the free status of the
90-libraries themselves. This Library General Public License is intended to
91-permit developers of non-free programs to use free libraries, while
92-preserving your freedom as a user of such programs to change the free
93-libraries that are incorporated in them. (We have not seen how to achieve
94-this as regards changes in header files, but we have achieved it as regards
95-changes in the actual functions of the Library.) The hope is that this
96-will lead to faster development of free libraries.
97-
98- The precise terms and conditions for copying, distribution and
99-modification follow. Pay close attention to the difference between a
100-"work based on the library" and a "work that uses the library". The
101-former contains code derived from the library, while the latter only
102-works together with the library.
103-
104- Note that it is possible for a library to be covered by the ordinary
105-General Public License rather than by this special one.
106-
107
108- GNU LIBRARY GENERAL PUBLIC LICENSE
109- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
110-
111- 0. This License Agreement applies to any software library which
112-contains a notice placed by the copyright holder or other authorized
113-party saying it may be distributed under the terms of this Library
114-General Public License (also called "this License"). Each licensee is
115-addressed as "you".
116-
117- A "library" means a collection of software functions and/or data
118-prepared so as to be conveniently linked with application programs
119-(which use some of those functions and data) to form executables.
120-
121- The "Library", below, refers to any such software library or work
122-which has been distributed under these terms. A "work based on the
123-Library" means either the Library or any derivative work under
124-copyright law: that is to say, a work containing the Library or a
125-portion of it, either verbatim or with modifications and/or translated
126-straightforwardly into another language. (Hereinafter, translation is
127-included without limitation in the term "modification".)
128-
129- "Source code" for a work means the preferred form of the work for
130-making modifications to it. For a library, complete source code means
131-all the source code for all modules it contains, plus any associated
132-interface definition files, plus the scripts used to control compilation
133-and installation of the library.
134-
135- Activities other than copying, distribution and modification are not
136-covered by this License; they are outside its scope. The act of
137-running a program using the Library is not restricted, and output from
138-such a program is covered only if its contents constitute a work based
139-on the Library (independent of the use of the Library in a tool for
140-writing it). Whether that is true depends on what the Library does
141-and what the program that uses the Library does.
142-
143- 1. You may copy and distribute verbatim copies of the Library's
144-complete source code as you receive it, in any medium, provided that
145-you conspicuously and appropriately publish on each copy an
146-appropriate copyright notice and disclaimer of warranty; keep intact
147-all the notices that refer to this License and to the absence of any
148-warranty; and distribute a copy of this License along with the
149-Library.
150-
151- You may charge a fee for the physical act of transferring a copy,
152-and you may at your option offer warranty protection in exchange for a
153-fee.
154-
155
156- 2. You may modify your copy or copies of the Library or any portion
157-of it, thus forming a work based on the Library, and copy and
158-distribute such modifications or work under the terms of Section 1
159-above, provided that you also meet all of these conditions:
160-
161- a) The modified work must itself be a software library.
162-
163- b) You must cause the files modified to carry prominent notices
164- stating that you changed the files and the date of any change.
165-
166- c) You must cause the whole of the work to be licensed at no
167- charge to all third parties under the terms of this License.
168-
169- d) If a facility in the modified Library refers to a function or a
170- table of data to be supplied by an application program that uses
171- the facility, other than as an argument passed when the facility
172- is invoked, then you must make a good faith effort to ensure that,
173- in the event an application does not supply such function or
174- table, the facility still operates, and performs whatever part of
175- its purpose remains meaningful.
176-
177- (For example, a function in a library to compute square roots has
178- a purpose that is entirely well-defined independent of the
179- application. Therefore, Subsection 2d requires that any
180- application-supplied function or table used by this function must
181- be optional: if the application does not supply it, the square
182- root function must still compute square roots.)
183-
184-These requirements apply to the modified work as a whole. If
185-identifiable sections of that work are not derived from the Library,
186-and can be reasonably considered independent and separate works in
187-themselves, then this License, and its terms, do not apply to those
188-sections when you distribute them as separate works. But when you
189-distribute the same sections as part of a whole which is a work based
190-on the Library, the distribution of the whole must be on the terms of
191-this License, whose permissions for other licensees extend to the
192-entire whole, and thus to each and every part regardless of who wrote
193-it.
194-
195-Thus, it is not the intent of this section to claim rights or contest
196-your rights to work written entirely by you; rather, the intent is to
197-exercise the right to control the distribution of derivative or
198-collective works based on the Library.
199-
200-In addition, mere aggregation of another work not based on the Library
201-with the Library (or with a work based on the Library) on a volume of
202-a storage or distribution medium does not bring the other work under
203-the scope of this License.
204-
205- 3. You may opt to apply the terms of the ordinary GNU General Public
206-License instead of this License to a given copy of the Library. To do
207-this, you must alter all the notices that refer to this License, so
208-that they refer to the ordinary GNU General Public License, version 2,
209-instead of to this License. (If a newer version than version 2 of the
210-ordinary GNU General Public License has appeared, then you can specify
211-that version instead if you wish.) Do not make any other change in
212-these notices.
213-
214
215- Once this change is made in a given copy, it is irreversible for
216-that copy, so the ordinary GNU General Public License applies to all
217-subsequent copies and derivative works made from that copy.
218-
219- This option is useful when you wish to copy part of the code of
220-the Library into a program that is not a library.
221-
222- 4. You may copy and distribute the Library (or a portion or
223-derivative of it, under Section 2) in object code or executable form
224-under the terms of Sections 1 and 2 above provided that you accompany
225-it with the complete corresponding machine-readable source code, which
226-must be distributed under the terms of Sections 1 and 2 above on a
227-medium customarily used for software interchange.
228-
229- If distribution of object code is made by offering access to copy
230-from a designated place, then offering equivalent access to copy the
231-source code from the same place satisfies the requirement to
232-distribute the source code, even though third parties are not
233-compelled to copy the source along with the object code.
234-
235- 5. A program that contains no derivative of any portion of the
236-Library, but is designed to work with the Library by being compiled or
237-linked with it, is called a "work that uses the Library". Such a
238-work, in isolation, is not a derivative work of the Library, and
239-therefore falls outside the scope of this License.
240-
241- However, linking a "work that uses the Library" with the Library
242-creates an executable that is a derivative of the Library (because it
243-contains portions of the Library), rather than a "work that uses the
244-library". The executable is therefore covered by this License.
245-Section 6 states terms for distribution of such executables.
246-
247- When a "work that uses the Library" uses material from a header file
248-that is part of the Library, the object code for the work may be a
249-derivative work of the Library even though the source code is not.
250-Whether this is true is especially significant if the work can be
251-linked without the Library, or if the work is itself a library. The
252-threshold for this to be true is not precisely defined by law.
253-
254- If such an object file uses only numerical parameters, data
255-structure layouts and accessors, and small macros and small inline
256-functions (ten lines or less in length), then the use of the object
257-file is unrestricted, regardless of whether it is legally a derivative
258-work. (Executables containing this object code plus portions of the
259-Library will still fall under Section 6.)
260-
261- Otherwise, if the work is a derivative of the Library, you may
262-distribute the object code for the work under the terms of Section 6.
263-Any executables containing that work also fall under Section 6,
264-whether or not they are linked directly with the Library itself.
265-
266
267- 6. As an exception to the Sections above, you may also compile or
268-link a "work that uses the Library" with the Library to produce a
269-work containing portions of the Library, and distribute that work
270-under terms of your choice, provided that the terms permit
271-modification of the work for the customer's own use and reverse
272-engineering for debugging such modifications.
273-
274- You must give prominent notice with each copy of the work that the
275-Library is used in it and that the Library and its use are covered by
276-this License. You must supply a copy of this License. If the work
277-during execution displays copyright notices, you must include the
278-copyright notice for the Library among them, as well as a reference
279-directing the user to the copy of this License. Also, you must do one
280-of these things:
281-
282- a) Accompany the work with the complete corresponding
283- machine-readable source code for the Library including whatever
284- changes were used in the work (which must be distributed under
285- Sections 1 and 2 above); and, if the work is an executable linked
286- with the Library, with the complete machine-readable "work that
287- uses the Library", as object code and/or source code, so that the
288- user can modify the Library and then relink to produce a modified
289- executable containing the modified Library. (It is understood
290- that the user who changes the contents of definitions files in the
291- Library will not necessarily be able to recompile the application
292- to use the modified definitions.)
293-
294- b) Accompany the work with a written offer, valid for at
295- least three years, to give the same user the materials
296- specified in Subsection 6a, above, for a charge no more
297- than the cost of performing this distribution.
298-
299- c) If distribution of the work is made by offering access to copy
300- from a designated place, offer equivalent access to copy the above
301- specified materials from the same place.
302-
303- d) Verify that the user has already received a copy of these
304- materials or that you have already sent this user a copy.
305-
306- For an executable, the required form of the "work that uses the
307-Library" must include any data and utility programs needed for
308-reproducing the executable from it. However, as a special exception,
309-the source code distributed need not include anything that is normally
310-distributed (in either source or binary form) with the major
311-components (compiler, kernel, and so on) of the operating system on
312-which the executable runs, unless that component itself accompanies
313-the executable.
314-
315- It may happen that this requirement contradicts the license
316-restrictions of other proprietary libraries that do not normally
317-accompany the operating system. Such a contradiction means you cannot
318-use both them and the Library together in an executable that you
319-distribute.
320-
321
322- 7. You may place library facilities that are a work based on the
323-Library side-by-side in a single library together with other library
324-facilities not covered by this License, and distribute such a combined
325-library, provided that the separate distribution of the work based on
326-the Library and of the other library facilities is otherwise
327-permitted, and provided that you do these two things:
328-
329- a) Accompany the combined library with a copy of the same work
330- based on the Library, uncombined with any other library
331- facilities. This must be distributed under the terms of the
332- Sections above.
333-
334- b) Give prominent notice with the combined library of the fact
335- that part of it is a work based on the Library, and explaining
336- where to find the accompanying uncombined form of the same work.
337-
338- 8. You may not copy, modify, sublicense, link with, or distribute
339-the Library except as expressly provided under this License. Any
340-attempt otherwise to copy, modify, sublicense, link with, or
341-distribute the Library is void, and will automatically terminate your
342-rights under this License. However, parties who have received copies,
343-or rights, from you under this License will not have their licenses
344-terminated so long as such parties remain in full compliance.
345-
346- 9. You are not required to accept this License, since you have not
347-signed it. However, nothing else grants you permission to modify or
348-distribute the Library or its derivative works. These actions are
349-prohibited by law if you do not accept this License. Therefore, by
350-modifying or distributing the Library (or any work based on the
351-Library), you indicate your acceptance of this License to do so, and
352-all its terms and conditions for copying, distributing or modifying
353-the Library or works based on it.
354-
355- 10. Each time you redistribute the Library (or any work based on the
356-Library), the recipient automatically receives a license from the
357-original licensor to copy, distribute, link with or modify the Library
358-subject to these terms and conditions. You may not impose any further
359-restrictions on the recipients' exercise of the rights granted herein.
360-You are not responsible for enforcing compliance by third parties to
361-this License.
362-
363
364- 11. If, as a consequence of a court judgment or allegation of patent
365-infringement or for any other reason (not limited to patent issues),
366-conditions are imposed on you (whether by court order, agreement or
367-otherwise) that contradict the conditions of this License, they do not
368-excuse you from the conditions of this License. If you cannot
369-distribute so as to satisfy simultaneously your obligations under this
370-License and any other pertinent obligations, then as a consequence you
371-may not distribute the Library at all. For example, if a patent
372-license would not permit royalty-free redistribution of the Library by
373-all those who receive copies directly or indirectly through you, then
374-the only way you could satisfy both it and this License would be to
375-refrain entirely from distribution of the Library.
376-
377-If any portion of this section is held invalid or unenforceable under any
378-particular circumstance, the balance of the section is intended to apply,
379-and the section as a whole is intended to apply in other circumstances.
380-
381-It is not the purpose of this section to induce you to infringe any
382-patents or other property right claims or to contest validity of any
383-such claims; this section has the sole purpose of protecting the
384-integrity of the free software distribution system which is
385-implemented by public license practices. Many people have made
386-generous contributions to the wide range of software distributed
387-through that system in reliance on consistent application of that
388-system; it is up to the author/donor to decide if he or she is willing
389-to distribute software through any other system and a licensee cannot
390-impose that choice.
391-
392-This section is intended to make thoroughly clear what is believed to
393-be a consequence of the rest of this License.
394-
395- 12. If the distribution and/or use of the Library is restricted in
396-certain countries either by patents or by copyrighted interfaces, the
397-original copyright holder who places the Library under this License may add
398-an explicit geographical distribution limitation excluding those countries,
399-so that distribution is permitted only in or among countries not thus
400-excluded. In such case, this License incorporates the limitation as if
401-written in the body of this License.
402-
403- 13. The Free Software Foundation may publish revised and/or new
404-versions of the Library General Public License from time to time.
405-Such new versions will be similar in spirit to the present version,
406-but may differ in detail to address new problems or concerns.
407-
408-Each version is given a distinguishing version number. If the Library
409-specifies a version number of this License which applies to it and
410-"any later version", you have the option of following the terms and
411-conditions either of that version or of any later version published by
412-the Free Software Foundation. If the Library does not specify a
413-license version number, you may choose any version ever published by
414-the Free Software Foundation.
415-
416
417- 14. If you wish to incorporate parts of the Library into other free
418-programs whose distribution conditions are incompatible with these,
419-write to the author to ask for permission. For software which is
420-copyrighted by the Free Software Foundation, write to the Free
421-Software Foundation; we sometimes make exceptions for this. Our
422-decision will be guided by the two goals of preserving the free status
423-of all derivatives of our free software and of promoting the sharing
424-and reuse of software generally.
425-
426- NO WARRANTY
427-
428- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
429-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
430-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
431-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
432-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
433-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
434-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
435-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
436-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
437-
438- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
439-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
440-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
441-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
442-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
443-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
444-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
445-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
446-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
447-DAMAGES.
448-
449- END OF TERMS AND CONDITIONS
450-
451
452- How to Apply These Terms to Your New Libraries
453-
454- If you develop a new library, and you want it to be of the greatest
455-possible use to the public, we recommend making it free software that
456-everyone can redistribute and change. You can do so by permitting
457-redistribution under these terms (or, alternatively, under the terms of the
458-ordinary General Public License).
459-
460- To apply these terms, attach the following notices to the library. It is
461-safest to attach them to the start of each source file to most effectively
462-convey the exclusion of warranty; and each file should have at least the
463-"copyright" line and a pointer to where the full notice is found.
464-
465- <one line to give the library's name and a brief idea of what it does.>
466- Copyright (C) <year> <name of author>
467-
468- This library is free software; you can redistribute it and/or
469- modify it under the terms of the GNU Library General Public
470- License as published by the Free Software Foundation; either
471- version 2 of the License, or (at your option) any later version.
472-
473- This library is distributed in the hope that it will be useful,
474- but WITHOUT ANY WARRANTY; without even the implied warranty of
475- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
476- Library General Public License for more details.
477-
478- You should have received a copy of the GNU Library General Public
479- License along with this library; if not, write to the Free Software
480- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
481-
482-Also add information on how to contact you by electronic and paper mail.
483-
484-You should also get your employer (if you work as a programmer) or your
485-school, if any, to sign a "copyright disclaimer" for the library, if
486-necessary. Here is a sample; alter the names:
487-
488- Yoyodyne, Inc., hereby disclaims all copyright interest in the
489- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
490-
491- <signature of Ty Coon>, 1 April 1990
492- Ty Coon, President of Vice
493-
494-That's all there is to it!
495
496=== modified file 'Makefile.am'
497--- Makefile.am 2010-02-11 19:43:29 +0000
498+++ Makefile.am 2010-03-04 02:55:20 +0000
499@@ -4,7 +4,7 @@
500 data \
501 po
502
503-EXTRA_DIST = COPYING.LGPL autogen.sh
504+EXTRA_DIST = autogen.sh
505
506 DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall
507
508
509=== modified file 'configure.ac'
510--- configure.ac 2010-02-25 17:54:38 +0000
511+++ configure.ac 2010-03-04 02:55:20 +0000
512@@ -127,7 +127,6 @@
513 AC_OUTPUT([
514 Makefile
515 src/Makefile
516-src/gtk-dialog/Makefile
517 data/Makefile
518 data/icons/Makefile
519 data/icons/16x16/Makefile
520
521=== modified file 'po/POTFILES.in'
522--- po/POTFILES.in 2010-01-06 05:36:48 +0000
523+++ po/POTFILES.in 2010-03-04 02:55:20 +0000
524@@ -1,8 +1,7 @@
525 [encoding: UTF-8]
526 data/indicator-session.schemas.in
527-src/gtk-dialog/ck-pk-helper.c
528-src/gtk-dialog/gconf-helper.c
529-src/gtk-dialog/gtk-logout-helper.c
530-src/gtk-dialog/logout-dialog.c
531+src/gconf-helper.c
532+src/gtk-logout-helper.c
533+src/dialog.c
534 src/indicator-session.c
535 src/session-service.c
536
537=== modified file 'src/Makefile.am'
538--- src/Makefile.am 2010-03-02 03:29:52 +0000
539+++ src/Makefile.am 2010-03-04 02:55:20 +0000
540@@ -1,6 +1,7 @@
541-SUBDIRS = gtk-dialog
542
543-libexec_PROGRAMS = indicator-session-service
544+libexec_PROGRAMS = \
545+ indicator-session-service \
546+ gtk-logout-helper
547
548 ###################
549 # Indicator Stuff
550@@ -50,13 +51,37 @@
551 lock-helper.h \
552 session-service.c \
553 dbusmenu-shared.h \
554- gtk-dialog/gconf-helper.c \
555+ gconf-helper.c \
556 users-service-dbus.h \
557 users-service-dbus.c \
558 users-service-marshal.c
559 indicator_session_service_CFLAGS = $(SESSIONSERVICE_CFLAGS) $(GCONF_CFLAGS) -DLIBEXECDIR=\"$(libexecdir)\" -Wall -Werror
560 indicator_session_service_LDADD = $(SESSIONSERVICE_LIBS) $(GCONF_LIBS)
561
562+#################
563+# GTK Logout Stuff
564+#################
565+
566+gtk_logout_helper_SOURCES = \
567+ gtk-logout-helper.c \
568+ gconf-helper.c \
569+ gconf-helper.h \
570+ dialog.c \
571+ dialog.h
572+
573+gtk_logout_helper_CFLAGS = \
574+ $(SESSIONSERVICE_CFLAGS) \
575+ $(GTKLOGOUTHELPER_CFLAGS) \
576+ $(GCONF_CFLAGS) \
577+ -Wall -Werror \
578+ -DINDICATOR_ICONS_DIR="\"$(INDICATORICONSDIR)\""
579+
580+gtk_logout_helper_LDADD = \
581+ $(SESSIONSERVICE_LIBS) \
582+ $(GTKLOGOUTHELPER_LIBS) \
583+ $(GCONF_LIBS)
584+
585+
586 ###############
587 # Other Stuff
588 ###############
589
590=== added file 'src/dialog.c'
591--- src/dialog.c 1970-01-01 00:00:00 +0000
592+++ src/dialog.c 2010-03-04 02:55:20 +0000
593@@ -0,0 +1,230 @@
594+/*
595+A dialog to ask the user about the various logout options that
596+are available.
597+
598+Copyright 2010 Canonical Ltd.
599+
600+Authors:
601+ Ted Gould <ted@canonical.com>
602+
603+This program is free software: you can redistribute it and/or modify it
604+under the terms of the GNU General Public License version 3, as published
605+by the Free Software Foundation.
606+
607+This program is distributed in the hope that it will be useful, but
608+WITHOUT ANY WARRANTY; without even the implied warranties of
609+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
610+PURPOSE. See the GNU General Public License for more details.
611+
612+You should have received a copy of the GNU General Public License along
613+with this program. If not, see <http://www.gnu.org/licenses/>.
614+*/
615+
616+#ifdef HAVE_CONFIG_H
617+#include "config.h"
618+#endif
619+
620+#include <glib/gi18n.h>
621+
622+#include "consolekit-manager-client.h"
623+#include "dialog.h"
624+
625+/* Strings */
626+
627+static const gchar * title_strings[LOGOUT_DIALOG_TYPE_CNT] = {
628+ /* LOGOUT_DIALOG_LOGOUT, */ NC_("title", "Log Out"),
629+ /* LOGOUT_DIALOG_RESTART, */ NC_("title", "Restart"),
630+ /* LOGOUT_DIALOG_SHUTDOWN, */ NC_("title", "Switch Off")
631+};
632+
633+static const gchar * body_strings[LOGOUT_DIALOG_TYPE_CNT] = {
634+ /* LOGOUT_DIALOG_LOGOUT, */ N_("Are you sure you want to close all programs and log out of the computer?"),
635+ /* LOGOUT_DIALOG_RESTART, */ N_("Are you sure you want to close all programs and restart the computer?"),
636+ /* LOGOUT_DIALOG_SHUTDOWN, */ N_("Are you sure you want to close all programs and shut down the computer?")
637+};
638+
639+static const gchar * button_strings[LOGOUT_DIALOG_TYPE_CNT] = {
640+ /* LOGOUT_DIALOG_LOGOUT, */ NC_("button", "Log Out"),
641+ /* LOGOUT_DIALOG_RESTART, */ NC_("button", "Restart"),
642+ /* LOGOUT_DIALOG_SHUTDOWN, */ NC_("button", "Switch Off")
643+};
644+
645+/* TRANSLATORS: These strings have an ellipsis so that the user knows
646+ they are also going to get a password dialog to do the action. */
647+static const gchar * button_auth_strings[LOGOUT_DIALOG_TYPE_CNT] = {
648+ /* LOGOUT_DIALOG_LOGOUT, */ NC_("button auth", "Log Out"),
649+ /* LOGOUT_DIALOG_RESTART, */ NC_("button auth", "Restart..."),
650+ /* LOGOUT_DIALOG_SHUTDOWN, */ NC_("button auth", "Switch Off...")
651+};
652+
653+/* TRANSLATORS: This button appears on the logout dialog when
654+ there are updates that require restart. It will do a restart
655+ in place of a log out. */
656+static const gchar * restart_updates = N_("Restart Instead");
657+static const gchar * restart_auth = N_("Restart Instead...");
658+static const gchar * body_logout_update = N_("Some software updates won't apply until the computer next restarts.");
659+
660+static const gchar * icon_strings[LOGOUT_DIALOG_TYPE_CNT] = {
661+ /* LOGOUT_DIALOG_LOGOUT, */ "system-log-out",
662+ /* LOGOUT_DIALOG_RESTART, */ "system-restart",
663+ /* LOGOUT_DIALOG_SHUTDOWN, */ "system-shutdown"
664+};
665+
666+
667+
668+typedef struct _LogoutDialogPrivate LogoutDialogPrivate;
669+struct _LogoutDialogPrivate {
670+ guint type;
671+};
672+
673+#define LOGOUT_DIALOG_GET_PRIVATE(o) \
674+(G_TYPE_INSTANCE_GET_PRIVATE ((o), LOGOUT_DIALOG_TYPE, LogoutDialogPrivate))
675+
676+static void logout_dialog_class_init (LogoutDialogClass *klass);
677+static void logout_dialog_init (LogoutDialog *self);
678+static void logout_dialog_dispose (GObject *object);
679+static void logout_dialog_finalize (GObject *object);
680+
681+G_DEFINE_TYPE (LogoutDialog, logout_dialog, GTK_TYPE_MESSAGE_DIALOG);
682+
683+static void
684+logout_dialog_class_init (LogoutDialogClass *klass)
685+{
686+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
687+
688+ g_type_class_add_private (klass, sizeof (LogoutDialogPrivate));
689+
690+ object_class->dispose = logout_dialog_dispose;
691+ object_class->finalize = logout_dialog_finalize;
692+
693+ return;
694+}
695+
696+static void
697+logout_dialog_init (LogoutDialog *self)
698+{
699+
700+ return;
701+}
702+
703+static void
704+logout_dialog_dispose (GObject *object)
705+{
706+
707+
708+ G_OBJECT_CLASS (logout_dialog_parent_class)->dispose (object);
709+ return;
710+}
711+
712+static void
713+logout_dialog_finalize (GObject *object)
714+{
715+
716+
717+ G_OBJECT_CLASS (logout_dialog_parent_class)->finalize (object);
718+ return;
719+}
720+
721+/* Checks for updates that would signal that a restart is
722+ required for them to apply */
723+static gboolean
724+check_restart_required (void)
725+{
726+ return g_file_test("/var/run/reboot-required", G_FILE_TEST_EXISTS);
727+}
728+
729+/* Checks with console kit to see if we can do what we want */
730+static gboolean
731+ck_check_allowed (LogoutDialogType type)
732+{
733+ DBusGConnection * system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL);
734+ g_return_val_if_fail(system_bus != NULL, TRUE);
735+
736+ DBusGProxy * ck_proxy = dbus_g_proxy_new_for_name (system_bus,
737+ "org.freedesktop.ConsoleKit",
738+ "/org/freedesktop/ConsoleKit/Manager",
739+ "org.freedesktop.ConsoleKit.Manager");
740+ g_return_val_if_fail(ck_proxy != NULL, TRUE);
741+
742+ gboolean retval = TRUE;
743+ switch (type) {
744+ case LOGOUT_DIALOG_TYPE_RESTART:
745+ org_freedesktop_ConsoleKit_Manager_can_restart(ck_proxy, &retval, NULL);
746+ break;
747+ case LOGOUT_DIALOG_TYPE_SHUTDOWN:
748+ org_freedesktop_ConsoleKit_Manager_can_stop(ck_proxy, &retval, NULL);
749+ break;
750+ default:
751+ break;
752+ }
753+
754+ g_object_unref(ck_proxy);
755+
756+ return retval;
757+}
758+
759+LogoutDialog *
760+logout_dialog_new (LogoutDialogType type)
761+{
762+ GtkWidget * image = gtk_image_new_from_icon_name(icon_strings[type], GTK_ICON_SIZE_DIALOG);
763+ gtk_widget_show(image);
764+
765+ LogoutDialog * dialog = LOGOUT_DIALOG(g_object_new(LOGOUT_DIALOG_TYPE,
766+ /* Window */
767+ "icon-name", icon_strings[type],
768+ "modal", TRUE,
769+ "resizable", FALSE,
770+ "title", _(title_strings[type]),
771+ "window-position", GTK_WIN_POS_CENTER_ALWAYS,
772+ /* Message Dialog */
773+ "buttons", GTK_BUTTONS_NONE,
774+ "image", image,
775+ "message-type", GTK_MESSAGE_OTHER,
776+ "text", _(body_strings[type]),
777+ NULL));
778+
779+ gboolean allowed = FALSE;
780+ if (type == LOGOUT_DIALOG_TYPE_LOG_OUT) {
781+ allowed = ck_check_allowed(LOGOUT_DIALOG_TYPE_RESTART);
782+ } else {
783+ allowed = ck_check_allowed(type);
784+ }
785+
786+ gboolean restart_required = FALSE;
787+ if (type == LOGOUT_DIALOG_TYPE_LOG_OUT) {
788+ restart_required = check_restart_required();
789+ }
790+
791+ const gchar * button_text;
792+ if (allowed) {
793+ button_text = _(button_strings[type]);
794+ } else {
795+ button_text = _(button_auth_strings[type]);
796+ }
797+
798+ if (restart_required) {
799+ const gchar * restart_req;
800+ if (allowed) {
801+ restart_req = restart_updates;
802+ } else {
803+ restart_req = restart_auth;
804+ }
805+
806+ g_object_set(dialog, "secondary-text", _(body_logout_update), NULL);
807+
808+ gtk_dialog_add_buttons(GTK_DIALOG(dialog),
809+ _(restart_req), GTK_RESPONSE_HELP,
810+ _("Cancel"), GTK_RESPONSE_CANCEL,
811+ button_text, GTK_RESPONSE_OK,
812+ NULL);
813+ } else {
814+ gtk_dialog_add_buttons(GTK_DIALOG(dialog),
815+ _("Cancel"), GTK_RESPONSE_CANCEL,
816+ button_text, GTK_RESPONSE_OK,
817+ NULL);
818+ }
819+
820+ gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
821+
822+ return dialog;
823+}
824
825=== added file 'src/dialog.h'
826--- src/dialog.h 1970-01-01 00:00:00 +0000
827+++ src/dialog.h 2010-03-04 02:55:20 +0000
828@@ -0,0 +1,64 @@
829+/*
830+A dialog to ask the user about the various logout options that
831+are available.
832+
833+Copyright 2010 Canonical Ltd.
834+
835+Authors:
836+ Ted Gould <ted@canonical.com>
837+
838+This program is free software: you can redistribute it and/or modify it
839+under the terms of the GNU General Public License version 3, as published
840+by the Free Software Foundation.
841+
842+This program is distributed in the hope that it will be useful, but
843+WITHOUT ANY WARRANTY; without even the implied warranties of
844+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
845+PURPOSE. See the GNU General Public License for more details.
846+
847+You should have received a copy of the GNU General Public License along
848+with this program. If not, see <http://www.gnu.org/licenses/>.
849+*/
850+
851+#ifndef __LOGOUT_DIALOG_H__
852+#define __LOGOUT_DIALOG_H__
853+
854+#include <glib.h>
855+#include <glib-object.h>
856+
857+#include <gtk/gtk.h>
858+
859+G_BEGIN_DECLS
860+
861+#define LOGOUT_DIALOG_TYPE (logout_dialog_get_type ())
862+#define LOGOUT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LOGOUT_DIALOG_TYPE, LogoutDialog))
863+#define LOGOUT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LOGOUT_DIALOG_TYPE, LogoutDialogClass))
864+#define IS_LOGOUT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LOGOUT_DIALOG_TYPE))
865+#define IS_LOGOUT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LOGOUT_DIALOG_TYPE))
866+#define LOGOUT_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LOGOUT_DIALOG_TYPE, LogoutDialogClass))
867+
868+typedef enum _LogoutDialogType LogoutDialogType;
869+enum _LogoutDialogType {
870+ LOGOUT_DIALOG_TYPE_LOG_OUT,
871+ LOGOUT_DIALOG_TYPE_RESTART,
872+ LOGOUT_DIALOG_TYPE_SHUTDOWN,
873+ LOGOUT_DIALOG_TYPE_CNT
874+};
875+
876+typedef struct _LogoutDialog LogoutDialog;
877+typedef struct _LogoutDialogClass LogoutDialogClass;
878+
879+struct _LogoutDialogClass {
880+ GtkMessageDialogClass parent_class;
881+};
882+
883+struct _LogoutDialog {
884+ GtkMessageDialog parent;
885+};
886+
887+GType logout_dialog_get_type (void);
888+LogoutDialog * logout_dialog_new (LogoutDialogType type);
889+
890+G_END_DECLS
891+
892+#endif
893
894=== renamed file 'src/gtk-dialog/gconf-helper.c' => 'src/gconf-helper.c'
895=== renamed file 'src/gtk-dialog/gconf-helper.h' => 'src/gconf-helper.h'
896=== removed directory 'src/gtk-dialog'
897=== removed file 'src/gtk-dialog/Makefile.am'
898--- src/gtk-dialog/Makefile.am 2009-09-10 22:02:32 +0000
899+++ src/gtk-dialog/Makefile.am 1970-01-01 00:00:00 +0000
900@@ -1,15 +0,0 @@
901-
902-libexec_PROGRAMS = gtk-logout-helper
903-
904-gtk_logout_helper_SOURCES = \
905- gtk-logout-helper.c \
906- ck-pk-helper.c \
907- ck-pk-helper.h \
908- gconf-helper.c \
909- gconf-helper.h \
910- logout-dialog.c \
911- logout-dialog.h
912-
913-gtk_logout_helper_CFLAGS = $(SESSIONSERVICE_CFLAGS) $(GTKLOGOUTHELPER_CFLAGS) $(GCONF_CFLAGS) -Wall -Werror -DINDICATOR_ICONS_DIR="\"$(INDICATORICONSDIR)\""
914-gtk_logout_helper_LDADD = $(SESSIONSERVICE_LIBS) $(GTKLOGOUTHELPER_LIBS) $(GCONF_LIBS)
915-
916
917=== removed file 'src/gtk-dialog/ck-pk-helper.c'
918--- src/gtk-dialog/ck-pk-helper.c 2009-09-22 12:45:17 +0000
919+++ src/gtk-dialog/ck-pk-helper.c 1970-01-01 00:00:00 +0000
920@@ -1,222 +0,0 @@
921-/*
922-A small wrapper utility to load indicators and put them as menu items
923-into the gnome-panel using it's applet interface.
924-
925-Copyright 2009 Canonical Ltd.
926-
927-Authors:
928- Ted Gould <ted@canonical.com>
929-
930-This program is free software: you can redistribute it and/or modify it
931-under the terms of the GNU General Public License version 3, as published
932-by the Free Software Foundation.
933-
934-This program is distributed in the hope that it will be useful, but
935-WITHOUT ANY WARRANTY; without even the implied warranties of
936-MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
937-PURPOSE. See the GNU General Public License for more details.
938-
939-You should have received a copy of the GNU General Public License along
940-with this program. If not, see <http://www.gnu.org/licenses/>.
941-*/
942-
943-
944-#include <unistd.h>
945-#include <glib.h>
946-#include <dbus/dbus-glib.h>
947-#include <polkit/polkit.h>
948-
949-#include "logout-dialog.h"
950-#include "ck-pk-helper.h"
951-
952-static gboolean
953-ck_multiple_users (void)
954-{
955- DBusGConnection * sbus = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL);
956- g_return_val_if_fail(sbus != NULL, TRUE); /* worst case */
957- DBusGProxy * proxy = dbus_g_proxy_new_for_name(sbus, "org.freedesktop.ConsoleKit",
958- "/org/freedesktop/ConsoleKit/Manager",
959- "org.freedesktop.ConsoleKit.Manager");
960-
961- if (proxy == NULL) {
962- return TRUE;
963- }
964-
965- gboolean result;
966- GPtrArray * seats = NULL;
967-
968- result = dbus_g_proxy_call(proxy, "GetSeats", NULL, G_TYPE_INVALID,
969- dbus_g_type_get_collection("GPtrArray", DBUS_TYPE_G_OBJECT_PATH), &seats, G_TYPE_INVALID);
970-
971- if (!result) {
972- g_warning("Unable to get the seats for ConsoleKit");
973- g_object_unref(proxy);
974- return TRUE;
975- }
976-
977- gchar * this_session_id = NULL;
978-
979- result = dbus_g_proxy_call(proxy, "GetCurrentSession", NULL, G_TYPE_INVALID,
980- DBUS_TYPE_G_OBJECT_PATH, &this_session_id, G_TYPE_INVALID);
981-
982- g_object_unref(proxy);
983-
984- if (!result) {
985- g_warning("Unable to get current session from ConsoleKit");
986- return TRUE;
987- }
988-
989- proxy = dbus_g_proxy_new_for_name(sbus, "org.freedesktop.ConsoleKit",
990- this_session_id, "org.freedesktop.ConsoleKit.Session");
991-
992- if (proxy == NULL) {
993- return TRUE;
994- }
995-
996- guint this_session_uid;
997-
998- result = dbus_g_proxy_call(proxy, "GetUnixUser", NULL, G_TYPE_INVALID,
999- G_TYPE_UINT, &this_session_uid, G_TYPE_INVALID);
1000-
1001- if (!result) {
1002- g_warning("Unable to get UID from ConsoleKit");
1003- return TRUE;
1004- }
1005-
1006- guint seat;
1007- gboolean multiple_users = FALSE;
1008- for (seat = 0; seat < seats->len; seat++) {
1009- gchar * seat_id = g_ptr_array_index(seats, seat);
1010- DBusGProxy * seat_proxy = dbus_g_proxy_new_for_name(sbus, "org.freedesktop.ConsoleKit",
1011- seat_id, "org.freedesktop.ConsoleKit.Seat");
1012- g_free(seat_id);
1013-
1014- if (seat_proxy == NULL) {
1015- continue;
1016- }
1017-
1018- GPtrArray * sessions = NULL;
1019-
1020- gboolean result = dbus_g_proxy_call(seat_proxy,
1021- "GetSessions", NULL, G_TYPE_INVALID,
1022- dbus_g_type_get_collection("GPtrArray", DBUS_TYPE_G_OBJECT_PATH), &sessions, G_TYPE_INVALID);
1023-
1024- g_object_unref(seat_proxy);
1025- if (!result) {
1026- continue;
1027- }
1028-
1029- guint session;
1030- for (session = 0; session < sessions->len; session++) {
1031- gchar * session_id = g_ptr_array_index(sessions, session);
1032- if (g_strcmp0(this_session_id, session_id) == 0) {
1033- continue;
1034- }
1035- DBusGProxy * session_proxy = dbus_g_proxy_new_for_name(sbus, "org.freedesktop.ConsoleKit",
1036- session_id, "org.freedesktop.ConsoleKit.Session");
1037- g_free(session_id);
1038-
1039- if (session_proxy == NULL) {
1040- continue;
1041- }
1042-
1043- guint session_uid;
1044- result = dbus_g_proxy_call(session_proxy, "GetUnixUser", NULL, G_TYPE_INVALID,
1045- G_TYPE_UINT, &session_uid, G_TYPE_INVALID);
1046- g_object_unref(session_proxy);
1047-
1048- if (!result) {
1049- continue;
1050- }
1051-
1052- if (session_uid != this_session_uid) {
1053- multiple_users = TRUE;
1054- break;
1055- }
1056- }
1057-
1058- g_ptr_array_free(sessions, TRUE);
1059-
1060- if (multiple_users) {
1061- break;
1062- }
1063- }
1064-
1065- g_ptr_array_free(seats, TRUE);
1066- g_object_unref(proxy);
1067- g_free(this_session_id);
1068-
1069- return multiple_users;
1070-}
1071-
1072-gboolean
1073-pk_require_auth (LogoutDialogAction action) {
1074- if (action == LOGOUT_DIALOG_LOGOUT) {
1075- return FALSE;
1076- }
1077-
1078- gchar * pk_action;
1079- if (ck_multiple_users()) {
1080- if (action == LOGOUT_DIALOG_RESTART) {
1081- pk_action = "org.freedesktop.consolekit.system.restart-multiple-users";
1082- } else {
1083- pk_action = "org.freedesktop.consolekit.system.stop-multiple-users";
1084- }
1085- } else {
1086- if (action == LOGOUT_DIALOG_RESTART) {
1087- pk_action = "org.freedesktop.consolekit.system.restart";
1088- } else {
1089- pk_action = "org.freedesktop.consolekit.system.stop";
1090- }
1091- }
1092-
1093- PolkitAuthorizationResult *polres = NULL;
1094- gboolean ret = FALSE;
1095- if (pk_can_do_action(pk_action, &polres)) {
1096- if (polkit_authorization_result_get_is_challenge (polres)) {
1097- ret = TRUE;
1098- }
1099- g_debug ("pk_require_auth(%s): authorized, is_challenge: %i", pk_action, ret);
1100- } else {
1101- g_debug ("pk_require_auth(%s): not authorized", pk_action);
1102- }
1103- if (polres) {
1104- g_object_unref (polres);
1105- }
1106- return ret;
1107-}
1108-
1109-gboolean
1110-pk_can_do_action (const gchar *action_id, PolkitAuthorizationResult ** pol_result)
1111-{
1112- PolkitAuthority *authority;
1113- PolkitSubject *subject;
1114- PolkitAuthorizationResult *result;
1115- gboolean ret;
1116-
1117- authority = polkit_authority_get();
1118- if (!authority) {
1119- g_warning ("Could not get PolicyKit authority instance");
1120- return FALSE;
1121- }
1122- subject = polkit_unix_process_new (getpid());
1123-
1124- result = polkit_authority_check_authorization_sync (authority, subject, action_id, NULL, 0, NULL, NULL);
1125- g_object_unref (authority);
1126-
1127- ret = FALSE;
1128- if (result) {
1129- ret = polkit_authorization_result_get_is_authorized (result) ||
1130- polkit_authorization_result_get_is_challenge (result);
1131- g_debug ("pk_can_do_action(%s): %i", action_id, ret);
1132- } else {
1133- g_warning ("pk_can_do_action(%s): check_authorization returned NULL", action_id);
1134- }
1135- if (pol_result) {
1136- *pol_result = result;
1137- } else {
1138- g_object_unref (result);
1139- }
1140- return ret;
1141-
1142-}
1143
1144=== removed file 'src/gtk-dialog/ck-pk-helper.h'
1145--- src/gtk-dialog/ck-pk-helper.h 2009-09-22 12:45:17 +0000
1146+++ src/gtk-dialog/ck-pk-helper.h 1970-01-01 00:00:00 +0000
1147@@ -1,32 +0,0 @@
1148-/*
1149-A small wrapper utility to load indicators and put them as menu items
1150-into the gnome-panel using it's applet interface.
1151-
1152-Copyright 2009 Canonical Ltd.
1153-
1154-Authors:
1155- Ted Gould <ted@canonical.com>
1156-
1157-This program is free software: you can redistribute it and/or modify it
1158-under the terms of the GNU General Public License version 3, as published
1159-by the Free Software Foundation.
1160-
1161-This program is distributed in the hope that it will be useful, but
1162-WITHOUT ANY WARRANTY; without even the implied warranties of
1163-MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1164-PURPOSE. See the GNU General Public License for more details.
1165-
1166-You should have received a copy of the GNU General Public License along
1167-with this program. If not, see <http://www.gnu.org/licenses/>.
1168-*/
1169-
1170-
1171-#ifndef __CK_PK_HELPER_H__
1172-#define __CK_PK_HELPER_H__ 1
1173-
1174-#include <polkit/polkit.h>
1175-
1176-gboolean pk_require_auth (LogoutDialogAction action);
1177-gboolean pk_can_do_action (const gchar *action_id, PolkitAuthorizationResult ** pol_result);
1178-
1179-#endif /* __CK_PK_HELPER__ */
1180
1181=== removed file 'src/gtk-dialog/logout-dialog.c'
1182--- src/gtk-dialog/logout-dialog.c 2010-02-25 16:26:23 +0000
1183+++ src/gtk-dialog/logout-dialog.c 1970-01-01 00:00:00 +0000
1184@@ -1,370 +0,0 @@
1185-/*
1186- * libgksuui -- Gtk+ widget and convenience functions for requesting passwords
1187- * Copyright (C) 2004 Gustavo Noronha Silva
1188- *
1189- * This library is free software; you can redistribute it and/or
1190- * modify it under the terms of the GNU Lesser General Public
1191- * License as published by the Free Software Foundation; either
1192- * version 2 of the License, or (at your option) any later version.
1193- *
1194- * This library is distributed in the hope that it will be useful,
1195- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1196- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1197- * Lesser General Public License for more details.
1198- *
1199- * You should have received a copy of the GNU Lesser General Public
1200- * License along with this library; if not, write to the
1201- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
1202- * Boston, MA 02110-1301 USA
1203- */
1204-
1205-#include <string.h>
1206-#include <math.h>
1207-
1208-#include <gtk/gtk.h>
1209-#include <gdk/gdkx.h>
1210-#include <glib/gi18n.h>
1211-#include <X11/XKBlib.h>
1212-
1213-#include "logout-dialog.h"
1214-#include "ck-pk-helper.h"
1215-
1216-enum {
1217- PROP_ZERO,
1218- PROP_ACTION
1219-};
1220-
1221-
1222-static void
1223-logout_dialog_class_init (LogoutDialogClass *klass);
1224-
1225-static void
1226-logout_dialog_init (LogoutDialog *logout_dialog);
1227-
1228-static void
1229-set_property (GObject * object, guint param_id, const GValue * value, GParamSpec *pspec);
1230-
1231-static void
1232-get_property (GObject * object, guint param_id, GValue * value, GParamSpec *pspec);
1233-
1234-static gboolean
1235-timer_cb (gpointer data);
1236-
1237-static void
1238-show_cb (GtkWidget * widget, gpointer data);
1239-
1240-static void
1241-check_restart (LogoutDialog * dialog);
1242-
1243-static gchar*
1244-get_plural_string (LogoutDialog * dialog);
1245-
1246-static const gchar * title_strings[LOGOUT_DIALOG_ACTION_CNT] = {
1247- /* LOGOUT_DIALOG_LOGOUT, */ NC_("title", "Log Out"),
1248- /* LOGOUT_DIALOG_RESTART, */ NC_("title", "Restart"),
1249- /* LOGOUT_DIALOG_SHUTDOWN, */ NC_("title", "Shut Down")
1250-};
1251-
1252-static const gchar * button_strings[LOGOUT_DIALOG_ACTION_CNT] = {
1253- /* LOGOUT_DIALOG_LOGOUT, */ NC_("button", "Log Out"),
1254- /* LOGOUT_DIALOG_RESTART, */ NC_("button", "Restart"),
1255- /* LOGOUT_DIALOG_SHUTDOWN, */ NC_("button", "Shut Down")
1256-};
1257-
1258-static const gchar * restart_auth = N_("Restart...");
1259-
1260-static const gchar * body_logout_update = N_("You recently installed updates which will only take effect after a restart. Restart to apply software updates.");
1261-
1262-static const gchar * icon_strings[LOGOUT_DIALOG_ACTION_CNT] = {
1263- /* LOGOUT_DIALOG_LOGOUT, */ "system-log-out",
1264- /* LOGOUT_DIALOG_RESTART, */ "system-restart",
1265- /* LOGOUT_DIALOG_SHUTDOWN, */ "system-shutdown"
1266-};
1267-
1268-GType
1269-logout_dialog_get_type (void)
1270-{
1271- static GType type = 0;
1272-
1273- if (type == 0)
1274- {
1275- static const GTypeInfo info =
1276- {
1277- sizeof (LogoutDialogClass), /* size of class */
1278- NULL, /* base_init */
1279- NULL, /* base_finalize */
1280- (GClassInitFunc) logout_dialog_class_init,
1281- NULL, /* class_finalize */
1282- NULL, /* class_data */
1283- sizeof (LogoutDialog), /* size of object */
1284- 0, /* n_preallocs */
1285- (GInstanceInitFunc) logout_dialog_init /* instance_init */
1286- };
1287- type = g_type_register_static (gtk_dialog_get_type (),
1288- "LogoutDialogType",
1289- &info, 0);
1290- }
1291-
1292- return type;
1293-}
1294-
1295-static gchar*
1296-get_plural_string (LogoutDialog * dialog)
1297-{
1298- static gchar *plural_string = "";
1299-
1300- switch (dialog->action)
1301- {
1302- case LOGOUT_DIALOG_LOGOUT:
1303- plural_string = ngettext("You will be logged out in %d second.",
1304- "You will be logged out in %d seconds.",
1305- dialog->timeout);
1306- break;
1307- case LOGOUT_DIALOG_RESTART:
1308- plural_string = ngettext("The computer will restart in %d second.",
1309- "The computer will restart in %d seconds.",
1310- dialog->timeout);
1311- break;
1312- case LOGOUT_DIALOG_SHUTDOWN:
1313- plural_string = ngettext("The computer will be shut down in %d second.",
1314- "The computer will be shut down in %d seconds.",
1315- dialog->timeout);
1316- break;
1317- default:
1318- break;
1319- }
1320-
1321- return plural_string;
1322-}
1323-
1324-static void
1325-logout_dialog_class_init (LogoutDialogClass *klass)
1326-{
1327- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
1328-
1329- gobject_class->set_property = set_property;
1330- gobject_class->get_property = get_property;
1331-
1332- g_object_class_install_property(gobject_class, PROP_ACTION,
1333- g_param_spec_int("action", NULL, NULL,
1334- LOGOUT_DIALOG_LOGOUT, LOGOUT_DIALOG_SHUTDOWN,
1335- LOGOUT_DIALOG_LOGOUT, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
1336-
1337- return;
1338-}
1339-
1340-static void
1341-set_property (GObject * object, guint param_id, const GValue * value, GParamSpec *pspec)
1342-{
1343- g_return_if_fail(param_id == PROP_ACTION);
1344-
1345- LogoutDialog * dialog = LOGOUT_DIALOG(object);
1346- dialog->action = (LogoutDialogAction)g_value_get_int(value);
1347-
1348- gtk_image_set_from_icon_name(GTK_IMAGE(dialog->image), icon_strings[dialog->action], GTK_ICON_SIZE_DIALOG);
1349- gtk_window_set_title (GTK_WINDOW(dialog), _(title_strings[dialog->action]));
1350- gtk_window_set_icon_name (GTK_WINDOW(dialog), icon_strings[dialog->action]);
1351- gtk_widget_hide(dialog->message);
1352- gtk_button_set_label(GTK_BUTTON(dialog->ok_button), _(button_strings[dialog->action]));
1353-
1354- gchar * timeouttxt = g_strdup_printf(get_plural_string(dialog), dialog->timeout);
1355- gtk_label_set_text(GTK_LABEL(dialog->timeout_text), timeouttxt);
1356- g_free(timeouttxt);
1357-
1358- check_restart(dialog);
1359-
1360- return;
1361-}
1362-
1363-static void
1364-get_property (GObject * object, guint param_id, GValue * value, GParamSpec *pspec)
1365-{
1366- g_return_if_fail(param_id == PROP_ACTION);
1367- g_value_set_int(value, LOGOUT_DIALOG(object)->action);
1368-}
1369-
1370-static gboolean
1371-timer_cb (gpointer data)
1372-{
1373- LogoutDialog * dialog = LOGOUT_DIALOG(data);
1374-
1375- if (dialog->timeout == 0) {
1376- gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
1377- dialog->timerfunc = 0;
1378- return FALSE;
1379- } else {
1380- dialog->timeout--;
1381-
1382- gchar * timeouttxt = g_strdup_printf(get_plural_string(dialog), dialog->timeout);
1383- gtk_label_set_text(GTK_LABEL(dialog->timeout_text), timeouttxt);
1384- g_free(timeouttxt);
1385- }
1386-
1387- return TRUE;
1388-}
1389-
1390-static void
1391-show_cb (GtkWidget * widget, gpointer data)
1392-{
1393- LogoutDialog * dialog = LOGOUT_DIALOG(widget);
1394-
1395- if (dialog->timerfunc != 0) {
1396- g_source_remove(dialog->timerfunc);
1397- dialog->timerfunc = 0;
1398- }
1399-
1400- dialog->timerfunc = g_timeout_add_seconds(1, timer_cb, dialog);
1401- return;
1402-}
1403-
1404-static void
1405-check_restart (LogoutDialog * dialog)
1406-{
1407- if (dialog->action != LOGOUT_DIALOG_LOGOUT) {
1408- return;
1409- }
1410-
1411- if (g_file_test("/var/run/reboot-required", G_FILE_TEST_EXISTS)) {
1412- if (pk_can_do_action("org.freedesktop.consolekit.system.restart", NULL) ||
1413- pk_can_do_action("org.freedesktop.consolekit.system.restart-multiple-users", NULL)) {
1414-
1415- gtk_label_set_text(GTK_LABEL(dialog->message), _(body_logout_update));
1416- gtk_widget_show(dialog->message);
1417- if (pk_require_auth(LOGOUT_DIALOG_RESTART)) {
1418- gtk_button_set_label(GTK_BUTTON(dialog->restart_button), _(restart_auth));
1419- } else {
1420- gtk_button_set_label(GTK_BUTTON(dialog->restart_button), _(button_strings[LOGOUT_DIALOG_RESTART]));
1421- }
1422- gtk_widget_show(dialog->restart_button);
1423- }
1424- }
1425-
1426- return;
1427-}
1428-
1429-static gboolean
1430-focus_out_cb (GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
1431-{
1432- gtk_window_present (GTK_WINDOW(widget));
1433- return TRUE;
1434-}
1435-
1436-static void
1437-logout_dialog_init (LogoutDialog *logout_dialog)
1438-{
1439- GtkDialog *dialog;
1440- gint border_width = 6;
1441-
1442- logout_dialog->timeout = 60;
1443- logout_dialog->timerfunc = 0;
1444-
1445- /* dialog window */
1446- dialog = GTK_DIALOG(logout_dialog);
1447-
1448- /* make sure that our window will always have the focus */
1449- g_signal_connect (G_OBJECT(dialog), "focus-out-event",
1450- G_CALLBACK(focus_out_cb), NULL);
1451-
1452- logout_dialog->main_vbox = dialog->vbox;
1453-
1454- gtk_window_set_title (GTK_WINDOW(logout_dialog), "");
1455- gtk_dialog_set_has_separator (GTK_DIALOG(logout_dialog), FALSE);
1456- gtk_container_set_border_width (GTK_CONTAINER(logout_dialog), border_width);
1457- gtk_box_set_spacing (GTK_BOX(logout_dialog->main_vbox), 12);
1458- gtk_window_set_resizable (GTK_WINDOW(logout_dialog), FALSE);
1459-
1460- gtk_window_stick(GTK_WINDOW(logout_dialog));
1461- gtk_window_set_keep_above(GTK_WINDOW(logout_dialog), TRUE);
1462- gtk_widget_realize(GTK_WIDGET(logout_dialog));
1463- /* remove superfluous window buttons */
1464- gdk_window_set_functions (GTK_WIDGET(logout_dialog)->window, 0);
1465-
1466- /* center window */
1467- gtk_window_set_position (GTK_WINDOW(logout_dialog), GTK_WIN_POS_CENTER);
1468-
1469- /* the action buttons */
1470- /* the cancel button */
1471- logout_dialog->restart_button = gtk_dialog_add_button (dialog,
1472- GTK_STOCK_HELP,
1473- GTK_RESPONSE_HELP);
1474- gtk_button_set_label(GTK_BUTTON(logout_dialog->restart_button), _(button_strings[LOGOUT_DIALOG_RESTART]));
1475- gtk_widget_hide(logout_dialog->restart_button);
1476-
1477- /* the cancel button */
1478- logout_dialog->cancel_button = gtk_dialog_add_button (dialog,
1479- GTK_STOCK_CANCEL,
1480- GTK_RESPONSE_CANCEL);
1481- /* the ok button */
1482- logout_dialog->ok_button = gtk_dialog_add_button (dialog,
1483- GTK_STOCK_OK,
1484- GTK_RESPONSE_OK);
1485- gtk_widget_grab_default (logout_dialog->ok_button);
1486-
1487- /* Window Title and Icon */
1488- gtk_window_set_title (GTK_WINDOW(logout_dialog), _(title_strings[logout_dialog->action]));
1489- gtk_window_set_icon_name (GTK_WINDOW(logout_dialog), icon_strings[logout_dialog->action]);
1490-
1491- /* hbox */
1492- logout_dialog->hbox = gtk_hbox_new (FALSE, 12);
1493- gtk_container_set_border_width (GTK_CONTAINER(logout_dialog->hbox), 6);
1494- gtk_box_pack_start (GTK_BOX(logout_dialog->main_vbox),
1495- logout_dialog->hbox, FALSE, FALSE, 0);
1496- gtk_widget_show (logout_dialog->hbox);
1497-
1498- /* image */
1499- logout_dialog->image =
1500- gtk_image_new_from_icon_name (icon_strings[logout_dialog->action],
1501- GTK_ICON_SIZE_DIALOG);
1502- gtk_misc_set_alignment (GTK_MISC(logout_dialog->image), 0.5, 0);
1503- gtk_box_pack_start (GTK_BOX(logout_dialog->hbox), logout_dialog->image,
1504- FALSE, FALSE, 0);
1505- gtk_widget_show (logout_dialog->image);
1506-
1507- /* vbox for text */
1508- logout_dialog->vbox_text = gtk_vbox_new(FALSE, 12);
1509- gtk_box_pack_start(GTK_BOX(logout_dialog->hbox), logout_dialog->vbox_text, TRUE, TRUE, 0);
1510- gtk_widget_show(logout_dialog->vbox_text);
1511-
1512- /* Message */
1513- logout_dialog->message = gtk_label_new("");
1514- gtk_label_set_line_wrap(GTK_LABEL(logout_dialog->message), TRUE);
1515- gtk_label_set_single_line_mode(GTK_LABEL(logout_dialog->message), FALSE);
1516- gtk_label_set_selectable(GTK_LABEL(logout_dialog->message), TRUE);
1517- gtk_misc_set_alignment (GTK_MISC(logout_dialog->message), 0.0, 0.0);
1518- gtk_box_pack_start(GTK_BOX(logout_dialog->vbox_text), logout_dialog->message, TRUE, TRUE, 0);
1519- gtk_widget_show(logout_dialog->message);
1520-
1521- /* timeout */
1522- logout_dialog->timeout_text = gtk_label_new("");
1523- gtk_label_set_line_wrap(GTK_LABEL(logout_dialog->timeout_text), TRUE);
1524- gtk_label_set_single_line_mode(GTK_LABEL(logout_dialog->timeout_text), FALSE);
1525- gtk_label_set_selectable(GTK_LABEL(logout_dialog->timeout_text), FALSE);
1526- gtk_misc_set_alignment (GTK_MISC(logout_dialog->timeout_text), 0.0, 0.5);
1527- gtk_box_pack_start(GTK_BOX(logout_dialog->vbox_text), logout_dialog->timeout_text, TRUE, TRUE, 0);
1528- gtk_widget_show(logout_dialog->timeout_text);
1529-
1530- g_signal_connect(G_OBJECT(logout_dialog), "show", G_CALLBACK(show_cb), logout_dialog);
1531-
1532- return;
1533-}
1534-
1535-/**
1536- * logout_dialog_new:
1537- *
1538- * Creates a new #LogoutDialog.
1539- *
1540- * Returns: the new #LogoutDialog
1541- */
1542-GtkWidget*
1543-logout_dialog_new (LogoutDialogAction action)
1544-{
1545- LogoutDialog * dialog = g_object_new (LOGOUT_TYPE_DIALOG, "action", action, NULL);
1546- return GTK_WIDGET(dialog);
1547-}
1548-
1549-LogoutDialogAction
1550-logout_dialog_get_action (LogoutDialog * dialog)
1551-{
1552- return dialog->action;
1553-}
1554-
1555
1556=== removed file 'src/gtk-dialog/logout-dialog.h'
1557--- src/gtk-dialog/logout-dialog.h 2009-08-11 13:25:43 +0000
1558+++ src/gtk-dialog/logout-dialog.h 1970-01-01 00:00:00 +0000
1559@@ -1,99 +0,0 @@
1560-/*
1561- * libgksuui -- Gtk+ widget and convenience functions for requesting passwords
1562- * Copyright (C) 2004 Gustavo Noronha Silva
1563- *
1564- * This library is free software; you can redistribute it and/or
1565- * modify it under the terms of the GNU Lesser General Public
1566- * License as published by the Free Software Foundation; either
1567- * version 2 of the License, or (at your option) any later version.
1568- *
1569- * This library is distributed in the hope that it will be useful,
1570- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1571- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1572- * Lesser General Public License for more details.
1573- *
1574- * You should have received a copy of the GNU Lesser General Public
1575- * License along with this library; if not, write to the
1576- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
1577- * Boston, MA 02110-1301 USA
1578- */
1579-
1580-#ifndef __LOGOUT_DIALOG_H__
1581-#define __LOGOUT_DIALOG_H__
1582-
1583-#include <gtk/gtk.h>
1584-
1585-G_BEGIN_DECLS
1586-
1587-#define LOGOUT_TYPE_DIALOG (logout_dialog_get_type ())
1588-#define LOGOUT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LOGOUT_TYPE_DIALOG, LogoutDialog))
1589-#define LOGOUT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LOGOUT_TYPE_DIALOG, LogoutDialogClass))
1590-#define LOGOUT_IS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LOGOUT_TYPE_DIALOG))
1591-#define LOGOUT_IS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LOGOUT_TYPE_CONTEXT))
1592-#define LOGOUT_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LOGOUT_TYPE_DIALOG, LogoutDialogClass))
1593-
1594-typedef struct _LogoutDialogClass LogoutDialogClass;
1595-typedef struct _LogoutDialog LogoutDialog;
1596-typedef enum _LogoutDialogAction LogoutDialogAction;
1597-
1598-enum _LogoutDialogAction {
1599- LOGOUT_DIALOG_LOGOUT,
1600- LOGOUT_DIALOG_RESTART,
1601- LOGOUT_DIALOG_SHUTDOWN,
1602- LOGOUT_DIALOG_ACTION_CNT
1603-};
1604-
1605-struct _LogoutDialogClass
1606-{
1607- GtkDialogClass parent_class;
1608-};
1609-
1610-/**
1611- * LogoutDialog:
1612- * @dialog: parent widget
1613- * @main_vbox: GtkDialog's vbox
1614- * @hbox: box to separate the image of the right-side widgets
1615- * @image: the authorization image, left-side widget
1616- * @entry_vbox: right-side widgets container
1617- * @label: message describing what is required from the user,
1618- * right-side widget
1619- * @entry: place to type the password in, right-side widget
1620- * @ok_button: OK button of the dialog
1621- * @cancel_button: Cancel button of the dialog
1622- *
1623- * Convenience widget based on #GtkDialog to request a password.
1624- */
1625-struct _LogoutDialog
1626-{
1627- GtkDialog dialog;
1628-
1629- GtkWidget *main_vbox;
1630- GtkWidget *hbox;
1631- GtkWidget *image;
1632- GtkWidget *ok_button;
1633- GtkWidget *cancel_button;
1634- GtkWidget *restart_button;
1635- GtkWidget *vbox_text;
1636- GtkWidget *message;
1637- GtkWidget *timeout_text;
1638-
1639- LogoutDialogAction action;
1640-
1641- /* private */
1642- gchar * timeout_result;
1643- guint timeout;
1644- guint timerfunc;
1645-};
1646-
1647-GType
1648-logout_dialog_get_type (void);
1649-
1650-GtkWidget*
1651-logout_dialog_new (LogoutDialogAction action);
1652-
1653-LogoutDialogAction
1654-logout_dialog_get_action (LogoutDialog * widget);
1655-
1656-G_END_DECLS
1657-
1658-#endif
1659
1660=== renamed file 'src/gtk-dialog/gtk-logout-helper.c' => 'src/gtk-logout-helper.c'
1661--- src/gtk-dialog/gtk-logout-helper.c 2010-02-25 22:42:30 +0000
1662+++ src/gtk-logout-helper.c 2010-03-04 02:55:20 +0000
1663@@ -25,12 +25,11 @@
1664 #include <glib.h>
1665 #include <gtk/gtk.h>
1666 #include <dbus/dbus-glib.h>
1667-#include "logout-dialog.h"
1668-#include "ck-pk-helper.h"
1669+#include "dialog.h"
1670 #include "gconf-helper.h"
1671
1672 static void
1673-consolekit_fallback (LogoutDialogAction action)
1674+consolekit_fallback (LogoutDialogType action)
1675 {
1676 DBusGConnection * sbus = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL);
1677 g_return_if_fail(sbus != NULL); /* worst case */
1678@@ -46,16 +45,16 @@
1679 GError * error = NULL;
1680
1681 switch (action) {
1682- case LOGOUT_DIALOG_LOGOUT:
1683+ case LOGOUT_DIALOG_TYPE_LOG_OUT:
1684 g_warning("Unable to fallback to ConsoleKit for logout as it's a session issue. We need some sort of session handler.");
1685 break;
1686- case LOGOUT_DIALOG_SHUTDOWN:
1687+ case LOGOUT_DIALOG_TYPE_SHUTDOWN:
1688 dbus_g_proxy_call(proxy,
1689 "Stop",
1690 &error,
1691 G_TYPE_INVALID);
1692 break;
1693- case LOGOUT_DIALOG_RESTART:
1694+ case LOGOUT_DIALOG_TYPE_RESTART:
1695 dbus_g_proxy_call(proxy,
1696 "Restart",
1697 &error,
1698@@ -77,7 +76,7 @@
1699 }
1700
1701 static void
1702-session_action (LogoutDialogAction action)
1703+session_action (LogoutDialogType action)
1704 {
1705 DBusGConnection * sbus;
1706 DBusGProxy * sm_proxy;
1707@@ -104,13 +103,13 @@
1708
1709 g_clear_error (&error);
1710
1711- if (action == LOGOUT_DIALOG_LOGOUT) {
1712+ if (action == LOGOUT_DIALOG_TYPE_LOG_OUT) {
1713 res = dbus_g_proxy_call_with_timeout (sm_proxy, "Logout", INT_MAX, &error,
1714 G_TYPE_UINT, 1, G_TYPE_INVALID, G_TYPE_INVALID);
1715- } else if (action == LOGOUT_DIALOG_SHUTDOWN) {
1716+ } else if (action == LOGOUT_DIALOG_TYPE_SHUTDOWN) {
1717 res = dbus_g_proxy_call_with_timeout (sm_proxy, "RequestShutdown", INT_MAX, &error,
1718 G_TYPE_INVALID, G_TYPE_INVALID);
1719- } else if (action == LOGOUT_DIALOG_RESTART) {
1720+ } else if (action == LOGOUT_DIALOG_TYPE_RESTART) {
1721 res = dbus_g_proxy_call_with_timeout (sm_proxy, "RequestReboot", INT_MAX, &error,
1722 G_TYPE_INVALID, G_TYPE_INVALID);
1723 } else {
1724@@ -134,26 +133,26 @@
1725 return;
1726 }
1727
1728-static LogoutDialogAction type = LOGOUT_DIALOG_LOGOUT;
1729+static LogoutDialogType type = LOGOUT_DIALOG_TYPE_LOG_OUT;
1730
1731 static gboolean
1732 option_logout (const gchar * arg, const gchar * value, gpointer data, GError * error)
1733 {
1734- type = LOGOUT_DIALOG_LOGOUT;
1735+ type = LOGOUT_DIALOG_TYPE_LOG_OUT;
1736 return TRUE;
1737 }
1738
1739 static gboolean
1740 option_shutdown (const gchar * arg, const gchar * value, gpointer data, GError * error)
1741 {
1742- type = LOGOUT_DIALOG_SHUTDOWN;
1743+ type = LOGOUT_DIALOG_TYPE_SHUTDOWN;
1744 return TRUE;
1745 }
1746
1747 static gboolean
1748 option_restart (const gchar * arg, const gchar * value, gpointer data, GError * error)
1749 {
1750- type = LOGOUT_DIALOG_RESTART;
1751+ type = LOGOUT_DIALOG_TYPE_RESTART;
1752 return TRUE;
1753 }
1754
1755@@ -193,13 +192,8 @@
1756 INDICATOR_ICONS_DIR);
1757
1758 GtkWidget * dialog = NULL;
1759- /* TODO: We're disabling PolicyKit checking here because there
1760- is a bug in ConsoleKit where the dialog doesn't come up until
1761- the session is entirely closed. Stupid, but it's better than
1762- not getting a dialog at all. */
1763- /* if (!pk_require_auth(type) && !supress_confirmations()) { */
1764 if (!supress_confirmations()) {
1765- dialog = logout_dialog_new(type);
1766+ dialog = GTK_WIDGET(logout_dialog_new(type));
1767 }
1768
1769 if (dialog != NULL) {
1770@@ -207,7 +201,7 @@
1771 gtk_widget_hide(dialog);
1772
1773 if (response == GTK_RESPONSE_HELP) {
1774- type = LOGOUT_DIALOG_RESTART;
1775+ type = LOGOUT_DIALOG_TYPE_RESTART;
1776 response = GTK_RESPONSE_OK;
1777 }
1778
1779
1780=== modified file 'src/session-service.c'
1781--- src/session-service.c 2010-02-23 22:55:45 +0000
1782+++ src/session-service.c 2010-03-04 02:55:20 +0000
1783@@ -40,7 +40,7 @@
1784 #include "dbus-shared-names.h"
1785 #include "dbusmenu-shared.h"
1786
1787-#include "gtk-dialog/gconf-helper.h"
1788+#include "gconf-helper.h"
1789
1790 #include "users-service-dbus.h"
1791 #include "lock-helper.h"

Subscribers

People subscribed via source and target branches