Exemplo n.º 1
0
void
gconf_defaults_unset_mandatory (GConfDefaults          *mechanism,
                                const char            **includes,
                                const char            **excludes,
                                DBusGMethodInvocation  *context)
{
	const char *annotation_key;
	const char *default_action;
	int i;
	const char *action;
	GError *error;
	GError *error2;

	stop_killtimer ();

	annotation_key = "org.gnome.gconf.defaults.set-mandatory.prefix"; 
	default_action = "org.gnome.gconf.defaults.set-mandatory";

	for (i = 0; includes[i]; i++) {
		action = polkit_action_for_gconf_path (mechanism, annotation_key, includes[i]);
		if (action == NULL) 
			action = default_action;

		if (!check_polkit_for_action (mechanism, context, action)) 
			goto out;
	}

	error = NULL;
	unset_in_db (mechanism, "xml:merged:" SYSGCONFDIR "/gconf.xml.mandatory", 
		     includes, excludes, &error);

	if (error) {
		error2 = g_error_new_literal (GCONF_DEFAULTS_ERROR,
					      GCONF_DEFAULTS_ERROR_GENERAL,
					      error->message);
		g_error_free (error);

		dbus_g_method_return_error (context, error2);
		g_error_free (error2);
	}
	else
        	dbus_g_method_return (context);
out:
	start_killtimer();
}
Exemplo n.º 2
0
static void
do_unset_authorized (GConfDefaults          *mechanism,
                     DBusGMethodInvocation  *context,
		     gpointer 		     user_data)
{
        UnsetData *data = user_data;
	GError *error;

	error = NULL;
	unset_in_db (mechanism, "xml:merged:" SYSGCONFDIR "/gconf.xml.mandatory", 
		     (const gchar **)data->includes,
		     (const gchar **)data->excludes, &error);

	if (error) {
		throw_error (data->context,
			     GCONF_DEFAULTS_ERROR,
			     GCONF_DEFAULTS_ERROR_GENERAL,
			     "%s", error->message);
		g_error_free (error);
	}
	else
        	dbus_g_method_return (data->context);
}