diff options
Diffstat (limited to 'gnome-settings-daemon')
-rw-r--r-- | gnome-settings-daemon/codegen.py | 31 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-bus.c | 194 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-bus.h | 40 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-module.c | 164 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-module.h | 45 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-plugin-info.c | 471 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-plugin-info.h | 69 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-profile.c | 64 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-profile.h | 52 | ||||
-rw-r--r-- | gnome-settings-daemon/meson.build | 65 | ||||
-rw-r--r-- | gnome-settings-daemon/org.gnome.ScreenSaver.xml | 43 | ||||
-rw-r--r-- | gnome-settings-daemon/org.gnome.SessionManager.xml | 451 | ||||
-rw-r--r-- | gnome-settings-daemon/org.gnome.Shell.xml | 34 |
13 files changed, 1723 insertions, 0 deletions
diff --git a/gnome-settings-daemon/codegen.py b/gnome-settings-daemon/codegen.py new file mode 100644 index 0000000..eb0b0ce --- /dev/null +++ b/gnome-settings-daemon/codegen.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 + +''' +FIXME + +This script is used only to call gdbus-codegen and simulate the +generation of the source code and header as different targets. + +Both are generated implicitly, so meson is not able to know how +many files are generated, so it does generate only one opaque +target that represents the two files. + +Please see: + https://bugzilla.gnome.org/show_bug.cgi?id=791015 + https://github.com/mesonbuild/meson/pull/2930 +''' + +import subprocess +import sys + +name = 'org.gnome.' + sys.argv[1] + +subprocess.call([ + 'gdbus-codegen', + '--interface-prefix=' + name + '.', + '--generate-c-code=' + sys.argv[2], + '--c-namespace=Gsd', + '--annotate', name, 'org.gtk.GDBus.C.Name', sys.argv[1], + '--output-directory=' + sys.argv[3], + sys.argv[4] +]) diff --git a/gnome-settings-daemon/gnome-settings-bus.c b/gnome-settings-daemon/gnome-settings-bus.c new file mode 100644 index 0000000..63e3290 --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-bus.c @@ -0,0 +1,194 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2006-2011 Richard Hughes <richard@hughsie.com> + * + * Licensed under the GNU General Public License Version 2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" + +#include <string.h> +#include <unistd.h> +#include <stdio.h> +#include <glib.h> +#include <gio/gio.h> + +#if HAVE_WAYLAND +#include <wayland-client.h> +#endif + +#include "gnome-settings-bus.h" + +#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_OBJECT "/org/gnome/SessionManager" + +#define GNOME_SCREENSAVER_DBUS_NAME "org.gnome.ScreenSaver" +#define GNOME_SCREENSAVER_DBUS_OBJECT "/org/gnome/ScreenSaver" + +#define GNOME_SHELL_DBUS_NAME "org.gnome.Shell" +#define GNOME_SHELL_DBUS_OBJECT "/org/gnome/Shell" + +GsdSessionManager * +gnome_settings_bus_get_session_proxy (void) +{ + static GsdSessionManager *session_proxy; + GError *error = NULL; + + if (session_proxy != NULL) { + g_object_ref (session_proxy); + } else { + session_proxy = gsd_session_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_NONE, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_OBJECT, + NULL, + &error); + if (error) { + g_warning ("Failed to connect to the session manager: %s", error->message); + g_error_free (error); + } else { + g_object_add_weak_pointer (G_OBJECT (session_proxy), (gpointer*)&session_proxy); + } + } + + return session_proxy; +} + +GsdScreenSaver * +gnome_settings_bus_get_screen_saver_proxy (void) +{ + static GsdScreenSaver *screen_saver_proxy; + GError *error = NULL; + + if (screen_saver_proxy != NULL) { + g_object_ref (screen_saver_proxy); + } else { + screen_saver_proxy = gsd_screen_saver_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + GNOME_SCREENSAVER_DBUS_NAME, + GNOME_SCREENSAVER_DBUS_OBJECT, + NULL, + &error); + if (error) { + g_warning ("Failed to connect to the screen saver: %s", error->message); + g_error_free (error); + } else { + g_object_add_weak_pointer (G_OBJECT (screen_saver_proxy), (gpointer*)&screen_saver_proxy); + } + } + + return screen_saver_proxy; +} + +GsdShell * +gnome_settings_bus_get_shell_proxy (void) +{ + static GsdShell *shell_proxy = NULL; + GError *error = NULL; + + if (shell_proxy != NULL) { + g_object_ref (shell_proxy); + } else { + shell_proxy = gsd_shell_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | + G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, + GNOME_SHELL_DBUS_NAME, + GNOME_SHELL_DBUS_OBJECT, + NULL, + &error); + if (error) { + g_warning ("Failed to connect to the shell: %s", error->message); + g_error_free (error); + } else { + g_object_add_weak_pointer (G_OBJECT (shell_proxy), (gpointer*)&shell_proxy); + } + } + + return shell_proxy; +} + +char * +gnome_settings_get_chassis_type (void) +{ + char *ret = NULL; + GError *error = NULL; + GVariant *inner; + GVariant *variant = NULL; + GDBusConnection *connection; + + connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, + NULL, + &error); + if (connection == NULL) { + g_warning ("system bus not available: %s", error->message); + g_error_free (error); + goto out; + } + + variant = g_dbus_connection_call_sync (connection, + "org.freedesktop.hostname1", + "/org/freedesktop/hostname1", + "org.freedesktop.DBus.Properties", + "Get", + g_variant_new ("(ss)", + "org.freedesktop.hostname1", + "Chassis"), + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (variant == NULL) { + g_debug ("Failed to get property '%s': %s", "Chassis", error->message); + g_error_free (error); + goto out; + } + + g_variant_get (variant, "(v)", &inner); + ret = g_variant_dup_string (inner, NULL); + g_variant_unref (inner); +out: + g_clear_object (&connection); + g_clear_pointer (&variant, g_variant_unref); + return ret; +} + +static gpointer +is_wayland_session (gpointer user_data) +{ +#if HAVE_WAYLAND + struct wl_display *display; + + display = wl_display_connect (NULL); + if (!display) + return GUINT_TO_POINTER(FALSE); + wl_display_disconnect (display); + return GUINT_TO_POINTER(TRUE); +#else + return GUINT_TO_POINTER(FALSE); +#endif +} + +gboolean +gnome_settings_is_wayland (void) +{ + static GOnce wayland_once = G_ONCE_INIT; + + g_once (&wayland_once, is_wayland_session, NULL); + + return GPOINTER_TO_UINT(wayland_once.retval); +} diff --git a/gnome-settings-daemon/gnome-settings-bus.h b/gnome-settings-daemon/gnome-settings-bus.h new file mode 100644 index 0000000..1d14980 --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-bus.h @@ -0,0 +1,40 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2010-2011 Richard Hughes <richard@hughsie.com> + * + * Licensed under the GNU General Public License Version 2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __GNOME_SETTINGS_BUS_H +#define __GNOME_SETTINGS_BUS_H + +#include <glib-object.h> +#include "gsd-session-manager-glue.h" +#include "gsd-screen-saver-glue.h" +#include "gsd-shell-glue.h" + +G_BEGIN_DECLS + +GsdSessionManager *gnome_settings_bus_get_session_proxy (void); +GsdScreenSaver *gnome_settings_bus_get_screen_saver_proxy (void); +GsdShell *gnome_settings_bus_get_shell_proxy (void); +gboolean gnome_settings_is_wayland (void); +char * gnome_settings_get_chassis_type (void); + +G_END_DECLS + +#endif /* __GNOME_SETTINGS_BUS_H */ diff --git a/gnome-settings-daemon/gnome-settings-module.c b/gnome-settings-daemon/gnome-settings-module.c new file mode 100644 index 0000000..6dd0288 --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-module.c @@ -0,0 +1,164 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2005 - Paolo Maggi + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU 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 "config.h" + +#include "gnome-settings-module.h" + +#include <gmodule.h> + +typedef struct _GnomeSettingsModuleClass GnomeSettingsModuleClass; + +struct _GnomeSettingsModuleClass +{ + GTypeModuleClass parent_class; +}; + +struct _GnomeSettingsModule +{ + GTypeModule parent_instance; + + GModule *library; + + char *path; + GType type; +}; + +typedef GType (*GnomeSettingsModuleRegisterFunc) (GTypeModule *); + +G_DEFINE_TYPE (GnomeSettingsModule, gnome_settings_module, G_TYPE_TYPE_MODULE) + +static gboolean +gnome_settings_module_load (GTypeModule *gmodule) +{ + GnomeSettingsModule *module; + GnomeSettingsModuleRegisterFunc register_func; + gboolean res; + + module = GNOME_SETTINGS_MODULE (gmodule); + + g_debug ("Loading %s", module->path); + + module->library = g_module_open (module->path, 0); + + if (module->library == NULL) { + g_warning ("%s", g_module_error ()); + + return FALSE; + } + + /* extract symbols from the lib */ + res = g_module_symbol (module->library, "register_gnome_settings_plugin", (void *) ®ister_func); + if (! res) { + g_warning ("%s", g_module_error ()); + g_module_close (module->library); + + return FALSE; + } + + g_assert (register_func); + + module->type = register_func (gmodule); + + if (module->type == 0) { + g_warning ("Invalid gnome settings plugin in module %s", module->path); + return FALSE; + } + + return TRUE; +} + +static void +gnome_settings_module_unload (GTypeModule *gmodule) +{ + GnomeSettingsModule *module = GNOME_SETTINGS_MODULE (gmodule); + + g_debug ("Unloading %s", module->path); + + g_module_close (module->library); + + module->library = NULL; + module->type = 0; +} + +const gchar * +gnome_settings_module_get_path (GnomeSettingsModule *module) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_MODULE (module), NULL); + + return module->path; +} + +GObject * +gnome_settings_module_new_object (GnomeSettingsModule *module) +{ + g_debug ("Creating object of type %s", g_type_name (module->type)); + + if (module->type == 0) { + return NULL; + } + + return g_object_new (module->type, NULL); +} + +static void +gnome_settings_module_init (GnomeSettingsModule *module) +{ + g_debug ("GnomeSettingsModule %p initialising", module); +} + +static void +gnome_settings_module_finalize (GObject *object) +{ + GnomeSettingsModule *module = GNOME_SETTINGS_MODULE (object); + + g_debug ("GnomeSettingsModule %p finalizing", module); + + g_free (module->path); + + G_OBJECT_CLASS (gnome_settings_module_parent_class)->finalize (object); +} + +static void +gnome_settings_module_class_init (GnomeSettingsModuleClass *class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (class); + GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (class); + + object_class->finalize = gnome_settings_module_finalize; + + module_class->load = gnome_settings_module_load; + module_class->unload = gnome_settings_module_unload; +} + +GnomeSettingsModule * +gnome_settings_module_new (const char *path) +{ + GnomeSettingsModule *result; + + if (path == NULL || path[0] == '\0') { + return NULL; + } + + result = g_object_new (GNOME_TYPE_SETTINGS_MODULE, NULL); + + g_type_module_set_name (G_TYPE_MODULE (result), path); + result->path = g_strdup (path); + + return result; +} diff --git a/gnome-settings-daemon/gnome-settings-module.h b/gnome-settings-daemon/gnome-settings-module.h new file mode 100644 index 0000000..735096c --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-module.h @@ -0,0 +1,45 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2005 - Paolo Maggi + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU 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 GNOME_SETTINGS_MODULE_H +#define GNOME_SETTINGS_MODULE_H + +#include <glib-object.h> + +G_BEGIN_DECLS + +#define GNOME_TYPE_SETTINGS_MODULE (gnome_settings_module_get_type ()) +#define GNOME_SETTINGS_MODULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_SETTINGS_MODULE, GnomeSettingsModule)) +#define GNOME_SETTINGS_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_SETTINGS_MODULE, GnomeSettingsModuleClass)) +#define GNOME_IS_SETTINGS_MODULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_SETTINGS_MODULE)) +#define GNOME_IS_SETTINGS_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), GNOME_TYPE_SETTINGS_MODULE)) +#define GNOME_SETTINGS_MODULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNOME_TYPE_SETTINGS_MODULE, GnomeSettingsModuleClass)) + +typedef struct _GnomeSettingsModule GnomeSettingsModule; + +GType gnome_settings_module_get_type (void) G_GNUC_CONST; + +GnomeSettingsModule *gnome_settings_module_new (const gchar *path); + +const char *gnome_settings_module_get_path (GnomeSettingsModule *module); + +GObject *gnome_settings_module_new_object (GnomeSettingsModule *module); + +G_END_DECLS + +#endif diff --git a/gnome-settings-daemon/gnome-settings-plugin-info.c b/gnome-settings-daemon/gnome-settings-plugin-info.c new file mode 100644 index 0000000..7618806 --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-plugin-info.c @@ -0,0 +1,471 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU 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 "config.h" + +#include <string.h> + +#include <glib.h> +#include <glib/gi18n.h> +#include <gmodule.h> +#include <gio/gio.h> + +#include "gnome-settings-plugin-info.h" +#include "gnome-settings-module.h" +#include "gnome-settings-plugin.h" +#include "gnome-settings-profile.h" + +#define PLUGIN_GROUP "GNOME Settings Plugin" + +#define PLUGIN_PRIORITY_MAX 1 +#define PLUGIN_PRIORITY_DEFAULT 100 + +struct GnomeSettingsPluginInfoPrivate +{ + char *file; + GSettings *settings; + + char *location; + GTypeModule *module; + + char *name; + char *desc; + char **authors; + char *copyright; + char *website; + + GnomeSettingsPlugin *plugin; + + int active : 1; + + /* A plugin is unavailable if it is not possible to activate it + due to an error loading the plugin module (e.g. for Python plugins + when the interpreter has not been correctly initializated) */ + int available : 1; + + /* Priority determines the order in which plugins are started and + * stopped. A lower number means higher priority. */ + guint priority; +}; + + +enum { + ACTIVATED, + DEACTIVATED, + LAST_SIGNAL +}; + +static guint signals [LAST_SIGNAL] = { 0, }; + +G_DEFINE_TYPE_WITH_PRIVATE (GnomeSettingsPluginInfo, gnome_settings_plugin_info, G_TYPE_OBJECT) + +static void +gnome_settings_plugin_info_finalize (GObject *object) +{ + GnomeSettingsPluginInfo *info; + + g_return_if_fail (object != NULL); + g_return_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (object)); + + info = GNOME_SETTINGS_PLUGIN_INFO (object); + + g_return_if_fail (info->priv != NULL); + + if (info->priv->plugin != NULL) { + g_debug ("Unref plugin %s", info->priv->name); + + g_object_unref (info->priv->plugin); + + /* info->priv->module must not be unref since it is not possible to finalize + * a type module */ + } + + g_free (info->priv->file); + g_free (info->priv->location); + g_free (info->priv->name); + g_free (info->priv->desc); + g_free (info->priv->website); + g_free (info->priv->copyright); + g_strfreev (info->priv->authors); + + if (info->priv->settings != NULL) { + g_object_unref (info->priv->settings); + } + + G_OBJECT_CLASS (gnome_settings_plugin_info_parent_class)->finalize (object); +} + +static void +gnome_settings_plugin_info_class_init (GnomeSettingsPluginInfoClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = gnome_settings_plugin_info_finalize; + + signals [ACTIVATED] = + g_signal_new ("activated", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GnomeSettingsPluginInfoClass, activated), + NULL, + NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + signals [DEACTIVATED] = + g_signal_new ("deactivated", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GnomeSettingsPluginInfoClass, deactivated), + NULL, + NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, + 0); +} + +static void +gnome_settings_plugin_info_init (GnomeSettingsPluginInfo *info) +{ + info->priv = gnome_settings_plugin_info_get_instance_private (info); +} + +static void +debug_info (GnomeSettingsPluginInfo *info) +{ + g_debug ("GnomeSettingsPluginInfo: name='%s' file='%s' location='%s'", + info->priv->name, + info->priv->file, + info->priv->location); +} + +static gboolean +gnome_settings_plugin_info_fill_from_file (GnomeSettingsPluginInfo *info, + const char *filename) +{ + GKeyFile *plugin_file = NULL; + char *str; + int priority; + gboolean ret; + + gnome_settings_profile_start ("%s", filename); + + ret = FALSE; + + info->priv->file = g_strdup (filename); + + plugin_file = g_key_file_new (); + if (! g_key_file_load_from_file (plugin_file, filename, G_KEY_FILE_NONE, NULL)) { + g_warning ("Bad plugin file: %s", filename); + goto out; + } + + if (! g_key_file_has_key (plugin_file, PLUGIN_GROUP, "IAge", NULL)) { + g_debug ("IAge key does not exist in file: %s", filename); + goto out; + } + + /* Check IAge=2 */ + if (g_key_file_get_integer (plugin_file, PLUGIN_GROUP, "IAge", NULL) != 0) { + g_debug ("Wrong IAge in file: %s", filename); + goto out; + } + + /* Get Location */ + str = g_key_file_get_string (plugin_file, PLUGIN_GROUP, "Module", NULL); + + if ((str != NULL) && (*str != '\0')) { + info->priv->location = str; + } else { + g_free (str); + g_warning ("Could not find 'Module' in %s", filename); + goto out; + } + + /* Get Name */ + str = g_key_file_get_locale_string (plugin_file, PLUGIN_GROUP, "Name", NULL, NULL); + if (str != NULL) { + info->priv->name = str; + } else { + g_warning ("Could not find 'Name' in %s", filename); + goto out; + } + + /* Get Description */ + str = g_key_file_get_locale_string (plugin_file, PLUGIN_GROUP, "Description", NULL, NULL); + if (str != NULL) { + info->priv->desc = str; + } else { + g_debug ("Could not find 'Description' in %s", filename); + } + + /* Get Authors */ + info->priv->authors = g_key_file_get_string_list (plugin_file, PLUGIN_GROUP, "Authors", NULL, NULL); + if (info->priv->authors == NULL) { + g_debug ("Could not find 'Authors' in %s", filename); + } + + /* Get Copyright */ + str = g_key_file_get_string (plugin_file, PLUGIN_GROUP, "Copyright", NULL); + if (str != NULL) { + info->priv->copyright = str; + } else { + g_debug ("Could not find 'Copyright' in %s", filename); + } + + /* Get Website */ + str = g_key_file_get_string (plugin_file, PLUGIN_GROUP, "Website", NULL); + if (str != NULL) { + info->priv->website = str; + } else { + g_debug ("Could not find 'Website' in %s", filename); + } + + /* Get Priority */ + priority = g_key_file_get_integer (plugin_file, PLUGIN_GROUP, "Priority", NULL); + if (priority >= PLUGIN_PRIORITY_MAX) { + info->priv->priority = priority; + } else { + info->priv->priority = PLUGIN_PRIORITY_DEFAULT; + } + + g_key_file_free (plugin_file); + + debug_info (info); + + /* If we know nothing about the availability of the plugin, + set it as available */ + info->priv->available = TRUE; + + ret = TRUE; + out: + gnome_settings_profile_end ("%s", filename); + + return ret; +} + +GnomeSettingsPluginInfo * +gnome_settings_plugin_info_new_from_file (const char *filename) +{ + GnomeSettingsPluginInfo *info; + gboolean res; + + info = g_object_new (GNOME_TYPE_SETTINGS_PLUGIN_INFO, NULL); + + res = gnome_settings_plugin_info_fill_from_file (info, filename); + if (! res) { + g_object_unref (info); + info = NULL; + } + + return info; +} + +static void +_deactivate_plugin (GnomeSettingsPluginInfo *info) +{ + gnome_settings_plugin_deactivate (info->priv->plugin); + g_signal_emit (info, signals [DEACTIVATED], 0); +} + +gboolean +gnome_settings_plugin_info_deactivate (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), FALSE); + + if (!info->priv->active || !info->priv->available) { + return TRUE; + } + + _deactivate_plugin (info); + + /* Update plugin state */ + info->priv->active = FALSE; + + return TRUE; +} + + +static gboolean +load_plugin_module (GnomeSettingsPluginInfo *info) +{ + char *path; + char *dirname; + gboolean ret; + + ret = FALSE; + + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), FALSE); + g_return_val_if_fail (info->priv->file != NULL, FALSE); + g_return_val_if_fail (info->priv->location != NULL, FALSE); + g_return_val_if_fail (info->priv->plugin == NULL, FALSE); + g_return_val_if_fail (info->priv->available, FALSE); + + gnome_settings_profile_start ("%s", info->priv->location); + + dirname = g_path_get_dirname (info->priv->file); + g_return_val_if_fail (dirname != NULL, FALSE); + + path = g_module_build_path (dirname, info->priv->location); + g_free (dirname); + g_return_val_if_fail (path != NULL, FALSE); + + info->priv->module = G_TYPE_MODULE (gnome_settings_module_new (path)); + g_free (path); + + if (!g_type_module_use (info->priv->module)) { + g_warning ("Cannot load plugin '%s' since file '%s' cannot be read.", + info->priv->name, + gnome_settings_module_get_path (GNOME_SETTINGS_MODULE (info->priv->module))); + + g_object_unref (G_OBJECT (info->priv->module)); + info->priv->module = NULL; + + /* Mark plugin as unavailable and fails */ + info->priv->available = FALSE; + + goto out; + } + + info->priv->plugin = GNOME_SETTINGS_PLUGIN (gnome_settings_module_new_object (GNOME_SETTINGS_MODULE (info->priv->module))); + + g_type_module_unuse (info->priv->module); + ret = TRUE; + out: + gnome_settings_profile_end ("%s", info->priv->location); + return ret; +} + +static gboolean +_activate_plugin (GnomeSettingsPluginInfo *info) +{ + gboolean res = TRUE; + + if (!info->priv->available) { + /* Plugin is not available, don't try to activate/load it */ + return FALSE; + } + + if (info->priv->plugin == NULL) { + res = load_plugin_module (info); + } + + if (res) { + gnome_settings_plugin_activate (info->priv->plugin); + g_signal_emit (info, signals [ACTIVATED], 0); + } else { + g_warning ("Error activating plugin '%s'", info->priv->name); + } + + return res; +} + +gboolean +gnome_settings_plugin_info_activate (GnomeSettingsPluginInfo *info) +{ + + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), FALSE); + + if (! info->priv->available) { + return FALSE; + } + + if (info->priv->active) { + return TRUE; + } + + if (_activate_plugin (info)) { + info->priv->active = TRUE; + return TRUE; + } + + return FALSE; +} + +gboolean +gnome_settings_plugin_info_is_active (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), FALSE); + + return (info->priv->available && info->priv->active); +} + +gboolean +gnome_settings_plugin_info_is_available (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), FALSE); + + return (info->priv->available != FALSE); +} + +const char * +gnome_settings_plugin_info_get_name (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), NULL); + + return info->priv->name; +} + +const char * +gnome_settings_plugin_info_get_description (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), NULL); + + return info->priv->desc; +} + +const char ** +gnome_settings_plugin_info_get_authors (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), (const char **)NULL); + + return (const char **)info->priv->authors; +} + +const char * +gnome_settings_plugin_info_get_website (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), NULL); + + return info->priv->website; +} + +const char * +gnome_settings_plugin_info_get_copyright (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), NULL); + + return info->priv->copyright; +} + + +const char * +gnome_settings_plugin_info_get_location (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), NULL); + + return info->priv->location; +} + +int +gnome_settings_plugin_info_get_priority (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), PLUGIN_PRIORITY_DEFAULT); + + return info->priv->priority; +} diff --git a/gnome-settings-daemon/gnome-settings-plugin-info.h b/gnome-settings-daemon/gnome-settings-plugin-info.h new file mode 100644 index 0000000..a093373 --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-plugin-info.h @@ -0,0 +1,69 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU 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 __GNOME_SETTINGS_PLUGIN_INFO_H__ +#define __GNOME_SETTINGS_PLUGIN_INFO_H__ + +#include <glib-object.h> +#include <gmodule.h> + +G_BEGIN_DECLS +#define GNOME_TYPE_SETTINGS_PLUGIN_INFO (gnome_settings_plugin_info_get_type()) +#define GNOME_SETTINGS_PLUGIN_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNOME_TYPE_SETTINGS_PLUGIN_INFO, GnomeSettingsPluginInfo)) +#define GNOME_SETTINGS_PLUGIN_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNOME_TYPE_SETTINGS_PLUGIN_INFO, GnomeSettingsPluginInfoClass)) +#define GNOME_IS_SETTINGS_PLUGIN_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNOME_TYPE_SETTINGS_PLUGIN_INFO)) +#define GNOME_IS_SETTINGS_PLUGIN_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_SETTINGS_PLUGIN_INFO)) +#define GNOME_SETTINGS_PLUGIN_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNOME_TYPE_SETTINGS_PLUGIN_INFO, GnomeSettingsPluginInfoClass)) + +typedef struct GnomeSettingsPluginInfoPrivate GnomeSettingsPluginInfoPrivate; + +typedef struct +{ + GObject parent; + GnomeSettingsPluginInfoPrivate *priv; +} GnomeSettingsPluginInfo; + +typedef struct +{ + GObjectClass parent_class; + + void (* activated) (GnomeSettingsPluginInfo *info); + void (* deactivated) (GnomeSettingsPluginInfo *info); +} GnomeSettingsPluginInfoClass; + +GType gnome_settings_plugin_info_get_type (void) G_GNUC_CONST; + +GnomeSettingsPluginInfo *gnome_settings_plugin_info_new_from_file (const char *filename); + +gboolean gnome_settings_plugin_info_activate (GnomeSettingsPluginInfo *info); +gboolean gnome_settings_plugin_info_deactivate (GnomeSettingsPluginInfo *info); + +gboolean gnome_settings_plugin_info_is_active (GnomeSettingsPluginInfo *info); +gboolean gnome_settings_plugin_info_is_available (GnomeSettingsPluginInfo *info); + +const char *gnome_settings_plugin_info_get_name (GnomeSettingsPluginInfo *info); +const char *gnome_settings_plugin_info_get_description (GnomeSettingsPluginInfo *info); +const char **gnome_settings_plugin_info_get_authors (GnomeSettingsPluginInfo *info); +const char *gnome_settings_plugin_info_get_website (GnomeSettingsPluginInfo *info); +const char *gnome_settings_plugin_info_get_copyright (GnomeSettingsPluginInfo *info); +const char *gnome_settings_plugin_info_get_location (GnomeSettingsPluginInfo *info); +int gnome_settings_plugin_info_get_priority (GnomeSettingsPluginInfo *info); + +G_END_DECLS + +#endif /* __GNOME_SETTINGS_PLUGIN_INFO_H__ */ diff --git a/gnome-settings-daemon/gnome-settings-profile.c b/gnome-settings-daemon/gnome-settings-profile.c new file mode 100644 index 0000000..2b38d20 --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-profile.c @@ -0,0 +1,64 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2005 William Jon McCann <mccann@jhu.edu> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU 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/>. + * + * Authors: William Jon McCann <mccann@jhu.edu> + * + */ + +#include "config.h" + +#include <stdio.h> +#include <string.h> +#include <stdarg.h> +#include <signal.h> +#include <time.h> +#include <unistd.h> + +#include <glib.h> +#include <glib/gstdio.h> + +#include "gnome-settings-profile.h" + +void +_gnome_settings_profile_log (const char *func, + const char *note, + const char *format, + ...) +{ + va_list args; + char *str; + char *formatted; + + if (format == NULL) { + formatted = g_strdup (""); + } else { + va_start (args, format); + formatted = g_strdup_vprintf (format, args); + va_end (args); + } + + if (func != NULL) { + str = g_strdup_printf ("MARK: %s %s: %s %s", g_get_prgname(), func, note ? note : "", formatted); + } else { + str = g_strdup_printf ("MARK: %s: %s %s", g_get_prgname(), note ? note : "", formatted); + } + + g_free (formatted); + + g_access (str, F_OK); + g_free (str); +} diff --git a/gnome-settings-daemon/gnome-settings-profile.h b/gnome-settings-daemon/gnome-settings-profile.h new file mode 100644 index 0000000..8aba56e --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-profile.h @@ -0,0 +1,52 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2005 William Jon McCann <mccann@jhu.edu> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU 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/>. + * + * Authors: William Jon McCann <mccann@jhu.edu> + * + */ + +#ifndef __GNOME_SETTINGS_PROFILE_H +#define __GNOME_SETTINGS_PROFILE_H + +#include <glib.h> + +G_BEGIN_DECLS + +#ifdef ENABLE_PROFILING +#ifdef G_HAVE_ISO_VARARGS +#define gnome_settings_profile_start(...) _gnome_settings_profile_log (G_STRFUNC, "start", __VA_ARGS__) +#define gnome_settings_profile_end(...) _gnome_settings_profile_log (G_STRFUNC, "end", __VA_ARGS__) +#define gnome_settings_profile_msg(...) _gnome_settings_profile_log (NULL, NULL, __VA_ARGS__) +#elif defined(G_HAVE_GNUC_VARARGS) +#define gnome_settings_profile_start(format...) _gnome_settings_profile_log (G_STRFUNC, "start", format) +#define gnome_settings_profile_end(format...) _gnome_settings_profile_log (G_STRFUNC, "end", format) +#define gnome_settings_profile_msg(format...) _gnome_settings_profile_log (NULL, NULL, format) +#endif +#else +#define gnome_settings_profile_start(...) +#define gnome_settings_profile_end(...) +#define gnome_settings_profile_msg(...) +#endif + +void _gnome_settings_profile_log (const char *func, + const char *note, + const char *format, + ...) G_GNUC_PRINTF (3, 4); + +G_END_DECLS + +#endif /* __GNOME_SETTINGS_PROFILE_H */ diff --git a/gnome-settings-daemon/meson.build b/gnome-settings-daemon/meson.build new file mode 100644 index 0000000..6c17900 --- /dev/null +++ b/gnome-settings-daemon/meson.build @@ -0,0 +1,65 @@ +sources = files( + 'gnome-settings-bus.c', + 'gnome-settings-profile.c' +) + +dbus_ifaces = [ + ['SessionManager', 'gsd-session-manager-glue'], + ['ScreenSaver', 'gsd-screen-saver-glue'], + ['Shell', 'gsd-shell-glue'] +] + +dbus_headers = [] + +codegen = find_program('codegen.py') + +foreach iface: dbus_ifaces + name = 'org.gnome.' + iface[0] + + # FIXME: Opaque target return from gdbus_codegen + # Please see: + # https://bugzilla.gnome.org/show_bug.cgi?id=791015 + # https://github.com/mesonbuild/meson/pull/2930 + ''' + dbus_sources += gnome.gdbus_codegen( + iface[1], + name + '.xml', + interface_prefix: name + '.', + namespace: 'Gsd', + annotations: [name, 'org.gtk.GDBus.C.Name', iface[0]] + ) + ''' + + # FIXME: Ugly workaround that simulates the generation of + # two different targets. + dbus_sources = custom_target( + iface[1], + input: name + '.xml', + output: [iface[1] + '.h', iface[1] + '.c'], + command: [codegen, iface[0], iface[1], meson.current_build_dir(), '@INPUT@', '@OUTPUT@'] + ) + + dbus_headers += dbus_sources[0] + sources += dbus_sources[1] +endforeach + +deps = [gio_unix_dep] + +if enable_wayland + deps += wayland_client_dep +endif + +libgsd = shared_library( + 'gsd', + sources: sources + dbus_headers, + include_directories: top_inc, + dependencies: deps, + install: true, + install_dir: gsd_pkglibdir +) + +libgsd_dep = declare_dependency( + sources: dbus_headers, + include_directories: include_directories('.'), + link_with: libgsd +) diff --git a/gnome-settings-daemon/org.gnome.ScreenSaver.xml b/gnome-settings-daemon/org.gnome.ScreenSaver.xml new file mode 100644 index 0000000..875aa6d --- /dev/null +++ b/gnome-settings-daemon/org.gnome.ScreenSaver.xml @@ -0,0 +1,43 @@ +<!DOCTYPE node PUBLIC + "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> + +<!-- + Copyright (C) 2013 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General + Public License along with this library; if not, see <http://www.gnu.org/licenses/>. +--> + +<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd"> + <!-- + org.gnome.ScreenSaver: + + An interface used for managing the lock screen. + --> + <interface name="org.gnome.ScreenSaver"> + <method name="Lock" /> + <method name="GetActive"> + <arg name="active" direction="out" type="b" /> + </method> + <method name="SetActive"> + <arg name="value" direction="in" type="b" /> + </method> + <method name="GetActiveTime"> + <arg name="value" direction="out" type="u" /> + </method> + <signal name="ActiveChanged"> + <arg name="new_value" type="b" /> + </signal> + </interface> +</node> diff --git a/gnome-settings-daemon/org.gnome.SessionManager.xml b/gnome-settings-daemon/org.gnome.SessionManager.xml new file mode 100644 index 0000000..eb69180 --- /dev/null +++ b/gnome-settings-daemon/org.gnome.SessionManager.xml @@ -0,0 +1,451 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> +<node xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd"> + <interface name="org.gnome.SessionManager"> + + <!-- Initialization phase interfaces --> + + <method name="Setenv"> + <arg name="variable" type="s" direction="in"> + <doc:doc> + <doc:summary>The variable name</doc:summary> + </doc:doc> + </arg> + <arg name="value" type="s" direction="in"> + <doc:doc> + <doc:summary>The value</doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:description> + <doc:para>Adds the variable name to the application launch environment with the specified value. May only be used during the Session Manager initialization phase.</doc:para> + </doc:description> + </doc:doc> + </method> + + <method name="GetLocale"> + <arg name="category" type="i" direction="in"> + <doc:doc> + <doc:summary>The locale category</doc:summary> + </doc:doc> + </arg> + <arg name="value" type="s" direction="out"> + <doc:doc> + <doc:summary>The value</doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:description> + <doc:para>Reads the current state of the specific locale category.</doc:para> + </doc:description> + </doc:doc> + </method> + + <method name="InitializationError"> + <arg name="message" type="s" direction="in"> + <doc:doc> + <doc:summary>The error message</doc:summary> + </doc:doc> + </arg> + <arg name="fatal" type="b" direction="in"> + <doc:doc> + <doc:summary>Whether the error should be treated as fatal</doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:description> + <doc:para>May be used by applications launched during the Session Manager initialization phase to indicate there was a problem.</doc:para> + </doc:description> + </doc:doc> + </method> + + <!-- Running phase interfaces --> + + <method name="RegisterClient"> + <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> + <arg type="s" name="app_id" direction="in"> + <doc:doc> + <doc:summary>The application identifier</doc:summary> + </doc:doc> + </arg> + <arg type="s" name="client_startup_id" direction="in"> + <doc:doc> + <doc:summary>Client startup identifier</doc:summary> + </doc:doc> + </arg> + <arg type="o" name="client_id" direction="out"> + <doc:doc> + <doc:summary>The object path of the newly registered client</doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:description> + <doc:para>Register the caller as a Session Management client.</doc:para> + </doc:description> + </doc:doc> + </method> + + <method name="UnregisterClient"> + <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> + <arg type="o" name="client_id" direction="in"> + <doc:doc> + <doc:summary>The object path of the client</doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:description> + <doc:para>Unregister the specified client from Session Management.</doc:para> + </doc:description> + </doc:doc> + </method> + + <method name="Inhibit"> + <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> + <arg type="s" name="app_id" direction="in"> + <doc:doc> + <doc:summary>The application identifier</doc:summary> + </doc:doc> + </arg> + <arg type="u" name="toplevel_xid" direction="in"> + <doc:doc> + <doc:summary>The toplevel X window identifier</doc:summary> + </doc:doc> + </arg> + <arg type="s" name="reason" direction="in"> + <doc:doc> + <doc:summary>The reason for the inhibit</doc:summary> + </doc:doc> + </arg> + <arg type="u" name="flags" direction="in"> + <doc:doc> + <doc:summary>Flags that specify what should be inhibited</doc:summary> + </doc:doc> + </arg> + <arg type="u" name="inhibit_cookie" direction="out"> + <doc:doc> + <doc:summary>The cookie</doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:summary> + Proactively indicates that the calling application is performing an action that should not be interrupted and sets a reason to be displayed to the user when an interruption is about to take placea. + </doc:summary> + <doc:description> + <doc:para>Applications should invoke this method when they begin an operation that + should not be interrupted, such as creating a CD or DVD. The types of actions + that may be blocked are specified by the flags parameter. When the application + completes the operation it should call <doc:ref type="method" to="org.gnome.SessionManager.Uninhibit">Uninhibit()</doc:ref> + or disconnect from the session bus. + </doc:para> + <doc:para> + Applications should not expect that they will always be able to block the + action. In most cases, users will be given the option to force the action + to take place. + </doc:para> + <doc:para> + Reasons should be short and to the point. + </doc:para> + <doc:para> + The flags parameter must include at least one of the following: + <doc:list> + <doc:item> + <doc:term>1</doc:term> + <doc:definition>Inhibit logging out</doc:definition> + </doc:item> + <doc:item> + <doc:term>2</doc:term> + <doc:definition>Inhibit user switching</doc:definition> + </doc:item> + <doc:item> + <doc:term>4</doc:term> + <doc:definition>Inhibit suspending the session or computer</doc:definition> + </doc:item> + <doc:item> + <doc:term>8</doc:term> + <doc:definition>Inhibit the session being marked as idle</doc:definition> + </doc:item> + <doc:item> + <doc:term>16</doc:term> + <doc:definition>Inhibit auto-mounting removable media for the session</doc:definition> + </doc:item> + </doc:list> + Values for flags may be bitwise or'ed together. + </doc:para> + <doc:para> + The returned cookie is used to uniquely identify this request. It should be used + as an argument to <doc:ref type="method" to="org.gnome.SessionManager.Uninhibit">Uninhibit()</doc:ref> in + order to remove the request. + </doc:para> + </doc:description> + </doc:doc> + </method> + + <method name="Uninhibit"> + <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> + <arg type="u" name="inhibit_cookie" direction="in"> + <doc:doc> + <doc:summary>The cookie</doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:description> + <doc:para>Cancel a previous call to <doc:ref type="method" to="org.gnome.SessionManager.Inhibit">Inhibit()</doc:ref> identified by the cookie.</doc:para> + </doc:description> + </doc:doc> + </method> + + <method name="IsInhibited"> + <arg type="u" name="flags" direction="in"> + <doc:doc> + <doc:summary>Flags that spefify what should be inhibited</doc:summary> + </doc:doc> + </arg> + <arg type="b" name="is_inhibited" direction="out"> + <doc:doc> + <doc:summary>Returns TRUE if any of the operations in the bitfield flags are inhibited</doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:description> + <doc:para>Determine if operation(s) specified by the flags + are currently inhibited. Flags are same as those accepted + by the + <doc:ref type="method" to="org.gnome.SessionManager.Inhibit">Inhibit()</doc:ref> + method.</doc:para> + </doc:description> + </doc:doc> + </method> + + <method name="GetClients"> + <arg name="clients" direction="out" type="ao"> + <doc:doc> + <doc:summary>an array of client IDs</doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:description> + <doc:para>This gets a list of all the <doc:ref type="interface" to="org.gnome.SessionManager.Client">Clients</doc:ref> + that are currently known to the session manager.</doc:para> + <doc:para>Each Client ID is an D-Bus object path for the object that implements the + <doc:ref type="interface" to="org.gnome.SessionManager.Client">Client</doc:ref> interface.</doc:para> + </doc:description> + <doc:seealso><doc:ref type="interface" to="org.gnome.SessionManager.Client">org.gnome.SessionManager.Client</doc:ref></doc:seealso> + </doc:doc> + </method> + + <method name="GetInhibitors"> + <arg name="inhibitors" direction="out" type="ao"> + <doc:doc> + <doc:summary>an array of inhibitor IDs</doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:description> + <doc:para>This gets a list of all the <doc:ref type="interface" to="org.gnome.SessionManager.Inhibitor">Inhibitors</doc:ref> + that are currently known to the session manager.</doc:para> + <doc:para>Each Inhibitor ID is an D-Bus object path for the object that implements the + <doc:ref type="interface" to="org.gnome.SessionManager.Inhibitor">Inhibitor</doc:ref> interface.</doc:para> + </doc:description> + <doc:seealso><doc:ref type="interface" to="org.gnome.SessionManager.Inhibitor">org.gnome.SessionManager.Inhibitor</doc:ref></doc:seealso> + </doc:doc> + </method> + + + <method name="IsAutostartConditionHandled"> + <arg name="condition" direction="in" type="s"> + <doc:doc> + <doc:summary>The autostart condition string</doc:summary> + </doc:doc> + </arg> + <arg name="handled" direction="out" type="b"> + <doc:doc> + <doc:summary>True if condition is handled, false otherwise</doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:description> + <doc:para>Allows the caller to determine whether the session manager is + handling changes to the specified autostart condition.</doc:para> + </doc:description> + </doc:doc> + </method> + + <method name="Shutdown"> + <doc:doc> + <doc:description> + <doc:para>Request a shutdown dialog.</doc:para> + </doc:description> + </doc:doc> + </method> + + <method name="Reboot"> + <doc:doc> + <doc:description> + <doc:para>Request a reboot dialog.</doc:para> + </doc:description> + </doc:doc> + </method> + + <method name="CanShutdown"> + <arg name="is_available" direction="out" type="b"> + <doc:doc> + <doc:summary>True if shutdown is available to the user, false otherwise</doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:description> + <doc:para>Allows the caller to determine whether or not it's okay to show + a shutdown option in the UI</doc:para> + </doc:description> + </doc:doc> + </method> + + <method name="Logout"> + <arg name="mode" type="u" direction="in"> + <doc:doc> + <doc:summary>The type of logout that is being requested</doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:description> + <doc:para>Request a logout dialog</doc:para> + <doc:para> + Allowed values for the mode parameter are: + <doc:list> + <doc:item> + <doc:term>0</doc:term> + <doc:definition>Normal.</doc:definition> + </doc:item> + <doc:item> + <doc:term>1</doc:term> + <doc:definition>No confirmation inferface should be shown.</doc:definition> + </doc:item> + <doc:item> + <doc:term>2</doc:term> + <doc:definition>Forcefully logout. No confirmation will be shown and any inhibitors will be ignored.</doc:definition> + </doc:item> + </doc:list> + Values for flags may be bitwise or'ed together. + </doc:para> + </doc:description> + </doc:doc> + </method> + + <method name="IsSessionRunning"> + <arg name="running" direction="out" type="b"> + <doc:doc> + <doc:summary>True if the session has entered the Running phase, false otherwise</doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:description> + <doc:para>Allows the caller to determine whether the session manager + has entered the Running phase, in case the client missed the + SessionRunning signal.</doc:para> + </doc:description> + </doc:doc> + </method> + + <!-- Signals --> + + <signal name="ClientAdded"> + <arg name="id" type="o"> + <doc:doc> + <doc:summary>The object path for the added client</doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:description> + <doc:para>Emitted when a client has been added to the session manager. + </doc:para> + </doc:description> + </doc:doc> + </signal> + <signal name="ClientRemoved"> + <arg name="id" type="o"> + <doc:doc> + <doc:summary>The object path for the removed client</doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:description> + <doc:para>Emitted when a client has been removed from the session manager. + </doc:para> + </doc:description> + </doc:doc> + </signal> + + <signal name="InhibitorAdded"> + <arg name="id" type="o"> + <doc:doc> + <doc:summary>The object path for the added inhibitor</doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:description> + <doc:para>Emitted when an inhibitor has been added to the session manager. + </doc:para> + </doc:description> + </doc:doc> + </signal> + <signal name="InhibitorRemoved"> + <arg name="id" type="o"> + <doc:doc> + <doc:summary>The object path for the removed inhibitor</doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:description> + <doc:para>Emitted when an inhibitor has been removed from the session manager. + </doc:para> + </doc:description> + </doc:doc> + </signal> + + <signal name="SessionRunning"> + <doc:doc> + <doc:description> + <doc:para>Indicates the session has entered the Running phase.</doc:para> + </doc:description> + </doc:doc> + </signal> + + <signal name="SessionOver"> + <doc:doc> + <doc:description> + <doc:para>Indicates the session is about to end.</doc:para> + </doc:description> + </doc:doc> + </signal> + + <!-- Properties --> + + <property name="SessionName" type="s" access="read"> + <doc:doc> + <doc:description> + <doc:para>The name of the session that has been loaded.</doc:para> + </doc:description> + </doc:doc> + </property> + + <property name="SessionIsActive" type="b" access="read"> + <doc:doc> + <doc:description> + <doc:para>If true, the session is currently in the + foreground and available for user input.</doc:para> + </doc:description> + </doc:doc> + </property> + + <property name="InhibitedActions" type="u" access="read"> + <doc:doc> + <doc:description> + <doc:para>A bitmask of flags to indicate which actions + are inhibited. See the Inhibit() function's description + for a list of possible values.</doc:para> + </doc:description> + </doc:doc> + </property> + + </interface> +</node> diff --git a/gnome-settings-daemon/org.gnome.Shell.xml b/gnome-settings-daemon/org.gnome.Shell.xml new file mode 100644 index 0000000..1845dde --- /dev/null +++ b/gnome-settings-daemon/org.gnome.Shell.xml @@ -0,0 +1,34 @@ +<!DOCTYPE node PUBLIC + "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> + +<!-- + Copyright (C) 2013 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General + Public License along with this library; if not, see <http://www.gnu.org/licenses/>. +--> + +<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd"> + <!-- + org.gnome.Shell: + + An interface used to request shell features. + --> + <interface name="org.gnome.Shell"> + <method name="FocusSearch"/> + <method name="ShowOSD"> + <arg type="a{sv}" direction="in" name="params"/> + </method> + </interface> +</node> |