diff options
author | seb128 <seb128@seb128-laptop> | 2009-09-08 18:16:10 +0200 |
---|---|---|
committer | seb128 <seb128@seb128-laptop> | 2009-09-08 18:16:10 +0200 |
commit | ee56ebc0caaf8a8188e8eb01fbe23478a897a967 (patch) | |
tree | 8009e6c1bdce35069608aa21e17f00db35e75130 /src | |
parent | 866bdf8a658e660e613f6943e2b23cea318843b5 (diff) | |
parent | 5360fce331660e7b94a274bffa125ba8233fbeab (diff) | |
download | ayatana-indicator-session-ee56ebc0caaf8a8188e8eb01fbe23478a897a967.tar.gz ayatana-indicator-session-ee56ebc0caaf8a8188e8eb01fbe23478a897a967.tar.bz2 ayatana-indicator-session-ee56ebc0caaf8a8188e8eb01fbe23478a897a967.zip |
releasing version 0.1.2-0ubuntu1
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 6 | ||||
-rw-r--r-- | src/gtk-dialog/Makefile.am | 6 | ||||
-rw-r--r-- | src/gtk-dialog/gconf-helper.c | 32 | ||||
-rw-r--r-- | src/gtk-dialog/gconf-helper.h | 33 | ||||
-rw-r--r-- | src/gtk-dialog/gtk-logout-helper.c | 4 | ||||
-rw-r--r-- | src/indicator-session.c | 2 | ||||
-rw-r--r-- | src/session-service.c | 20 |
7 files changed, 93 insertions, 10 deletions
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/indicator-session.c b/src/indicator-session.c index 43c568f..8a4e298 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -367,7 +367,7 @@ build_users_menu (gpointer userdata) } if (!org_freedesktop_DBus_start_service_by_name (proxy, INDICATOR_USERS_DBUS_NAME, 0, &returnval, &error)) { - g_error("Unable to send message to DBus to start service: %s", error != NULL ? error->message : "(NULL error)" ); + g_error("Unable to send message to DBus to start service"); g_error_free(error); return FALSE; } 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"); |