From aa88be1d4a4e545b4141b0065b094d49d3d3a81b Mon Sep 17 00:00:00 2001 From: Brent Hull Date: Sat, 27 Oct 2012 21:17:07 -0400 Subject: Get device capabilities in the preferences capplet, not the daemon (GNOME fix for bug #617529 originally by Richard Hughes) --- src/gpm-prefs-server.c | 138 ------------------------------------------------- 1 file changed, 138 deletions(-) delete mode 100644 src/gpm-prefs-server.c (limited to 'src/gpm-prefs-server.c') diff --git a/src/gpm-prefs-server.c b/src/gpm-prefs-server.c deleted file mode 100644 index 2ced9ff..0000000 --- a/src/gpm-prefs-server.c +++ /dev/null @@ -1,138 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Copyright (C) 2007 Richard Hughes - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include - -#include -#include -#include -#ifdef HAVE_UNISTD_H -#include -#endif /* HAVE_UNISTD_H */ - -#include -#include - -#include "gpm-prefs-server.h" -#include "egg-debug.h" - -#define GPM_PREFS_SERVER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_TYPE_PREFS_SERVER, GpmPrefsServerPrivate)) - -struct GpmPrefsServerPrivate -{ - guint capability; -}; - -enum { - CAPABILITY_CHANGED, - LAST_SIGNAL -}; - -static guint signals [LAST_SIGNAL] = { 0 }; -static gpointer gpm_prefs_server_object = NULL; - -G_DEFINE_TYPE (GpmPrefsServer, gpm_prefs_server, G_TYPE_OBJECT) - -/** - * gpm_prefs_server_get_capability: - **/ -gboolean -gpm_prefs_server_get_capability (GpmPrefsServer *server, - gint *capability) -{ - g_return_val_if_fail (server != NULL, FALSE); - g_return_val_if_fail (GPM_IS_PREFS_SERVER (server), FALSE); - *capability = server->priv->capability; - return TRUE; -} - -/** - * gpm_prefs_server_set_capability: - **/ -gboolean -gpm_prefs_server_set_capability (GpmPrefsServer *server, - gint capability) -{ - g_return_val_if_fail (server != NULL, FALSE); - g_return_val_if_fail (GPM_IS_PREFS_SERVER (server), FALSE); - server->priv->capability = server->priv->capability + capability; - egg_debug ("capability now %i", server->priv->capability); - return TRUE; -} - -/** - * gpm_prefs_server_class_init: - * @klass: This prefs class instance - **/ -static void -gpm_prefs_server_class_init (GpmPrefsServerClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (GpmPrefsServerPrivate)); - signals [CAPABILITY_CHANGED] = - g_signal_new ("capability-changed", - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GpmPrefsServerClass, capability_changed), - NULL, - NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); -} - -/** - * gpm_prefs_server_init: - * @server: This server class instance - * - * initialises the server class. NOTE: We expect prefs_server objects - * to *NOT* be removed or added during the session. - * We only control the first prefs_server object if there are more than one. - **/ -static void -gpm_prefs_server_init (GpmPrefsServer *server) -{ - server->priv = GPM_PREFS_SERVER_GET_PRIVATE (server); - server->priv->capability = 0; -} - -/** - * gpm_prefs_server_new: - * Return value: A new server class instance. - * Can return NULL if no suitable hardware is found. - **/ -GpmPrefsServer * -gpm_prefs_server_new (void) -{ - if (gpm_prefs_server_object != NULL) { - g_object_ref (gpm_prefs_server_object); - } else { - gpm_prefs_server_object = g_object_new (GPM_TYPE_PREFS_SERVER, NULL); - g_object_add_weak_pointer (gpm_prefs_server_object, &gpm_prefs_server_object); - } - return GPM_PREFS_SERVER (gpm_prefs_server_object); -} -- cgit v1.2.1