aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Korn <c_korn@gmx.de>2009-09-08 10:09:45 -0500
committerTed Gould <ted@canonical.com>2009-09-08 10:09:45 -0500
commit85799abbe897e0f1e08b8d594716ab34b543d9fd (patch)
tree193e939ef6385ec5bdf59ba578e1ffd3c7b83375
parenta5b8008742a719b77a7f3a13f81c2af02f6e4550 (diff)
parent1f47c9e8827165634149f6e21a4588fe577479d8 (diff)
downloadayatana-indicator-session-85799abbe897e0f1e08b8d594716ab34b543d9fd.tar.gz
ayatana-indicator-session-85799abbe897e0f1e08b8d594716ab34b543d9fd.tar.bz2
ayatana-indicator-session-85799abbe897e0f1e08b8d594716ab34b543d9fd.zip
Adding a GConf key to suppress confirmation dialogs
-rw-r--r--Makefile.am3
-rw-r--r--configure.ac40
-rw-r--r--data/Makefile.am32
-rw-r--r--data/indicator-session.schemas.in17
-rw-r--r--po/POTFILES.in14
-rw-r--r--src/Makefile.am6
-rw-r--r--src/gtk-dialog/Makefile.am6
-rw-r--r--src/gtk-dialog/gconf-helper.c32
-rw-r--r--src/gtk-dialog/gconf-helper.h33
-rw-r--r--src/gtk-dialog/gtk-logout-helper.c4
-rw-r--r--src/session-service.c20
11 files changed, 195 insertions, 12 deletions
diff --git a/Makefile.am b/Makefile.am
index f63afb4..0233fbf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,8 @@
SUBDIRS = \
src \
- data
+ data \
+ po
EXTRA_DIST = COPYING.LGPL
diff --git a/configure.ac b/configure.ac
index c2623d1..1d42cb0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,6 +8,8 @@ AM_INIT_AUTOMAKE(indicator-session, 0.1.1)
AM_MAINTAINER_MODE
+IT_PROG_INTLTOOL([0.35.0])
+
AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_C_O
@@ -56,6 +58,16 @@ PKG_CHECK_MODULES(GTKLOGOUTHELPER, gtk+-2.0 >= $GTK_REQUIRED_VERSION
AC_SUBST(GTKLOGOUTHELPER_CFLAGS)
AC_SUBST(GTKLOGOUTHELPER_LIBS)
+AC_PATH_PROG(GCONFTOOL, gconftool-2)
+dnl Specify the gconf configuration source,
+dnl default to xml::$(sysconfdir)/gconf/gconf.xml.defaults
+
+AM_GCONF_SOURCE_2
+
+PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.0)
+AC_SUBST(GCONF_CFLAGS)
+AC_SUBST(GCONF_LIBS)
+
###########################
# Check to see if we're local
###########################
@@ -88,6 +100,33 @@ else
fi
AC_SUBST(DBUSSERVICEDIR)
+##############################
+# Custom Junk
+##############################
+
+AC_DEFUN([AC_DEFINE_PATH], [
+ test "x$prefix" = xNONE && prefix="$ac_default_prefix"
+ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+ ac_define_path=`eval echo [$]$2`
+ ac_define_path=`eval echo [$]ac_define_path`
+ $1="$ac_define_path"
+ AC_SUBST($1)
+ ifelse($3, ,
+ AC_DEFINE_UNQUOTED($1, "$ac_define_path"),
+ AC_DEFINE_UNQUOTED($1, "$ac_define_path", $3))
+])
+
+###########################
+# Internationalization
+###########################
+
+GETTEXT_PACKAGE=indicator-session
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of the default get text domain])
+AC_DEFINE_PATH(GNOMELOCALEDIR, "${datadir}/locale", [locale directory])
+
+AM_GLIB_GNU_GETTEXT
+
###########################
# Files
###########################
@@ -115,6 +154,7 @@ data/icons/48x48/status/Makefile
data/icons/scalable/Makefile
data/icons/scalable/status/Makefile
data/icons/scalable/actions/Makefile
+po/Makefile.in
])
###########################
diff --git a/data/Makefile.am b/data/Makefile.am
index 434e7d6..9ba0d97 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -9,9 +9,37 @@ dbus_services_DATA = $(service_in_files:.service.in=.service)
%.service: %.service.in
sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
+##############################
+# GConf Schema
+##############################
+
+schemadir = \
+ $(GCONF_SCHEMA_FILE_DIR)
+
+schema_in_files = \
+ indicator-session.schemas.in
+
+schema_DATA = \
+ $(schema_in_files:.schemas.in=.schemas)
+
+@INTLTOOL_SCHEMAS_RULE@
+
+
#$(dbus_services_DATA): $(service_in_files) Makefile
# sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
-EXTRA_DIST = $(service_in_files)
+EXTRA_DIST = \
+ $(service_in_files) \
+ $(schema_in_files)
+
+CLEANFILES = \
+ $(dbus_services_DATA) \
+ $(schema_DATA)
-CLEANFILES = $(dbus_services_DATA)
+if GCONF_SCHEMAS_INSTALL
+install-data-local:
+ GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \
+ gconftool-2 --makefile-install-rule $(schema_DATA)
+else
+install-data-local:
+endif
diff --git a/data/indicator-session.schemas.in b/data/indicator-session.schemas.in
new file mode 100644
index 0000000..1db9226
--- /dev/null
+++ b/data/indicator-session.schemas.in
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<gconfschemafile>
+ <schemalist>
+ <schema>
+ <key>/schemas/apps/indicator-session/suppress_logout_restart_shutdown</key>
+ <applyto>/apps/indicator-session/suppress_logout_restart_shutdown</applyto>
+ <owner>indicator-session</owner>
+ <type>bool</type>
+ <default>FALSE</default>
+ <locale name="C">
+ <short>Suppress the dialog to confirm logout, restart and shutdown action</short>
+ <long>Whether or not to show confirmation dialogs for logout,
+ restart and shutdown actions.</long>
+ </locale>
+ </schema>
+ </schemalist>
+</gconfschemafile>
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644
index 0000000..e3d4a5e
--- /dev/null
+++ b/po/POTFILES.in
@@ -0,0 +1,14 @@
+[encoding: UTF-8]
+data/indicator-session.schemas.in
+src/gtk-dialog/ck-pk-helper.c
+src/gtk-dialog/gconf-helper.c
+src/gtk-dialog/gtk-logout-helper.c
+src/gtk-dialog/logout-dialog.c
+src/indicator-session.c
+src/session-service.c
+src/status-provider.c
+src/status-provider-pidgin.c
+src/status-provider-telepathy.c
+src/status-service.c
+src/status-service-dbus.c
+src/users-service.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 599b70a..e2f0008 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -84,9 +84,9 @@ indicator_users_service_LDADD = $(USERSSERVICE_LIBS)
# Session Stuff
#################
-indicator_session_service_SOURCES = session-service.c
-indicator_session_service_CFLAGS = $(SESSIONSERVICE_CFLAGS) -DLIBEXECDIR=\"$(libexecdir)\" -Wall -Werror
-indicator_session_service_LDADD = $(SESSIONSERVICE_LIBS)
+indicator_session_service_SOURCES = session-service.c gtk-dialog/gconf-helper.c
+indicator_session_service_CFLAGS = $(SESSIONSERVICE_CFLAGS) $(GCONF_CFLAGS) -DLIBEXECDIR=\"$(libexecdir)\" -Wall -Werror
+indicator_session_service_LDADD = $(SESSIONSERVICE_LIBS) $(GCONF_LIBS)
###############
# Other Stuff
diff --git a/src/gtk-dialog/Makefile.am b/src/gtk-dialog/Makefile.am
index 9aa0097..90a6209 100644
--- a/src/gtk-dialog/Makefile.am
+++ b/src/gtk-dialog/Makefile.am
@@ -5,9 +5,11 @@ gtk_logout_helper_SOURCES = \
gtk-logout-helper.c \
ck-pk-helper.c \
ck-pk-helper.h \
+ gconf-helper.c \
+ gconf-helper.h \
logout-dialog.c \
logout-dialog.h
-gtk_logout_helper_CFLAGS = $(GTKLOGOUTHELPER_CFLAGS) -Wall -Werror
-gtk_logout_helper_LDADD = $(GTKLOGOUTHELPER_LIBS)
+gtk_logout_helper_CFLAGS = $(GTKLOGOUTHELPER_CFLAGS) $(GCONF_CFLAGS) -Wall -Werror
+gtk_logout_helper_LDADD = $(GTKLOGOUTHELPER_LIBS) $(GCONF_LIBS)
diff --git a/src/gtk-dialog/gconf-helper.c b/src/gtk-dialog/gconf-helper.c
new file mode 100644
index 0000000..0bd21ad
--- /dev/null
+++ b/src/gtk-dialog/gconf-helper.c
@@ -0,0 +1,32 @@
+/*
+A small wrapper utility to load indicators and put them as menu items
+into the gnome-panel using it's applet interface.
+
+Copyright 2009 Canonical Ltd.
+
+Authors:
+ Christoph Korn <c_korn@gmx.de>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <gconf/gconf-client.h>
+
+#include "gconf-helper.h"
+
+gboolean
+supress_confirmations (void) {
+ GConfClient *client = gconf_client_get_default ();
+ return gconf_client_get_bool (client, SUPPRESS_KEY, NULL) ;
+}
diff --git a/src/gtk-dialog/gconf-helper.h b/src/gtk-dialog/gconf-helper.h
new file mode 100644
index 0000000..1d78fd8
--- /dev/null
+++ b/src/gtk-dialog/gconf-helper.h
@@ -0,0 +1,33 @@
+/*
+A small wrapper utility to load indicators and put them as menu items
+into the gnome-panel using it's applet interface.
+
+Copyright 2009 Canonical Ltd.
+
+Authors:
+ Christoph Korn <c_korn@gmx.de>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef __GCONF_HELPER_H__
+#define __GCONF_HELPER_H__ 1
+
+#include <gconf/gconf-client.h>
+
+#define SUPPRESS_KEY "/apps/indicator-session/suppress_logout_restart_shutdown"
+
+gboolean supress_confirmations (void);
+
+#endif /* __GCONF_HELPER__ */
diff --git a/src/gtk-dialog/gtk-logout-helper.c b/src/gtk-dialog/gtk-logout-helper.c
index 5d87148..13991ca 100644
--- a/src/gtk-dialog/gtk-logout-helper.c
+++ b/src/gtk-dialog/gtk-logout-helper.c
@@ -6,6 +6,7 @@ Copyright 2009 Canonical Ltd.
Authors:
Ted Gould <ted@canonical.com>
+ Christoph Korn <c_korn@gmx.de>
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License version 3, as published
@@ -26,6 +27,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <dbus/dbus-glib.h>
#include "logout-dialog.h"
#include "ck-pk-helper.h"
+#include "gconf-helper.h"
static void
session_action (LogoutDialogAction action)
@@ -132,7 +134,7 @@ main (int argc, char * argv[])
}
GtkWidget * dialog = NULL;
- if (!pk_require_auth(type)) {
+ if (!pk_require_auth(type) && !supress_confirmations()) {
dialog = logout_dialog_new(type);
}
diff --git a/src/session-service.c b/src/session-service.c
index bea26ba..9e5cbb2 100644
--- a/src/session-service.c
+++ b/src/session-service.c
@@ -31,6 +31,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include "dbus-shared-names.h"
+#include "gtk-dialog/gconf-helper.h"
+
#define DKP_ADDRESS "org.freedesktop.DeviceKit.Power"
#define DKP_OBJECT "/org/freedesktop/DeviceKit/Power"
#define DKP_INTERFACE "org.freedesktop.DeviceKit.Power"
@@ -223,7 +225,11 @@ create_items (DbusmenuMenuitem * root) {
DbusmenuMenuitem * mi = NULL;
mi = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Log Out"));
+ if (supress_confirmations()) {
+ dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Log Out"));
+ } else {
+ dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Log Out ..."));
+ }
dbusmenu_menuitem_child_append(root, mi);
g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(show_dialog), "logout");
@@ -240,12 +246,20 @@ create_items (DbusmenuMenuitem * root) {
g_signal_connect(G_OBJECT(hibernate_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(sleep), "Hibernate");
mi = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Restart"));
+ if (supress_confirmations()) {
+ dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Restart"));
+ } else {
+ dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Restart ..."));
+ }
dbusmenu_menuitem_child_append(root, mi);
g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(show_dialog), "restart");
mi = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Shutdown"));
+ if (supress_confirmations()) {
+ dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Shutdown"));
+ } else {
+ dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Shutdown ..."));
+ }
dbusmenu_menuitem_child_append(root, mi);
g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(show_dialog), "shutdown");