104 lines
3.1 KiB
C
104 lines
3.1 KiB
C
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
|
*
|
|
* Copyright (C) 2007 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
#include <gmodule.h>
|
|
#include <glib.h>
|
|
#include <string.h>
|
|
#include <pk-backend.h>
|
|
#include <pk-backend-dbus.h>
|
|
|
|
static PkBackendDbus *dbus;
|
|
|
|
#define PACKAGEKIT_DBUS_INTERFACE "org.freedesktop.PackageKitDbus"
|
|
#define PACKAGEKIT_DBUS_SERVICE "org.freedesktop.PackageKitDbus"
|
|
#define PACKAGEKIT_DBUS_PATH "/org/freedesktop/PackageKitDbus"
|
|
|
|
/**
|
|
* backend_search_name:
|
|
*/
|
|
static void
|
|
backend_search_name (PkBackend *backend, const gchar *filter, const gchar *search)
|
|
{
|
|
g_return_if_fail (backend != NULL);
|
|
pk_backend_set_interruptable (backend, TRUE);
|
|
pk_backend_no_percentage_updates (backend);
|
|
pk_backend_dbus_search_name (dbus, filter, search);
|
|
}
|
|
|
|
/**
|
|
* backend_initalize:
|
|
* This should only be run once per backend load, i.e. not every transaction
|
|
*/
|
|
static void
|
|
backend_initalize (PkBackend *backend)
|
|
{
|
|
g_return_if_fail (backend != NULL);
|
|
pk_debug ("FILTER: initalize");
|
|
dbus = pk_backend_dbus_new ();
|
|
pk_backend_dbus_set_name (dbus, PACKAGEKIT_DBUS_SERVICE,
|
|
PACKAGEKIT_DBUS_INTERFACE, PACKAGEKIT_DBUS_PATH);
|
|
}
|
|
|
|
/**
|
|
* backend_destroy:
|
|
* This should only be run once per backend load, i.e. not every transaction
|
|
*/
|
|
static void
|
|
backend_destroy (PkBackend *backend)
|
|
{
|
|
g_return_if_fail (backend != NULL);
|
|
pk_debug ("FILTER: destroy");
|
|
pk_backend_dbus_kill (dbus);
|
|
g_object_unref (dbus);
|
|
}
|
|
|
|
PK_BACKEND_OPTIONS (
|
|
"Test Dbus", /* description */
|
|
"Richard Hughes <richard@hughsie.com>", /* author */
|
|
backend_initalize, /* initalize */
|
|
backend_destroy, /* destroy */
|
|
NULL, /* get_groups */
|
|
NULL, /* get_filters */
|
|
NULL, /* cancel */
|
|
NULL, /* get_depends */
|
|
NULL, /* get_description */
|
|
NULL, /* get_files */
|
|
NULL, /* get_requires */
|
|
NULL, /* get_update_detail */
|
|
NULL, /* get_updates */
|
|
NULL, /* install_package */
|
|
NULL, /* install_file */
|
|
NULL, /* refresh_cache */
|
|
NULL, /* remove_package */
|
|
NULL, /* resolve */
|
|
NULL, /* rollback */
|
|
NULL, /* search_details */
|
|
NULL, /* search_file */
|
|
NULL, /* search_group */
|
|
backend_search_name, /* search_name */
|
|
NULL, /* update_package */
|
|
NULL, /* update_system */
|
|
NULL, /* get_repo_list */
|
|
NULL, /* repo_enable */
|
|
NULL /* repo_set_data */
|
|
);
|
|
|