Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rfkill: Add RFKill support plugin on Linux systems
from GNOME/gnome-settings-daemon@444af32 Signed-off-by: Zhang Xianwei <zhang.xianwei8@zte.com.cn>
- Loading branch information
1 parent
765208e
commit 2b528ed
Showing
18 changed files
with
1,894 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
data/org.mate.SettingsDaemon.plugins.rfkill.gschema.xml.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<schemalist> | ||
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org.mate.SettingsDaemon.plugins.rfkill" path="/org/mate/settings-daemon/plugins/rfkill/"> | ||
<key name="active" type="b"> | ||
<default>true</default> | ||
<summary>Activation of this plugin</summary> | ||
<description>Whether this plugin would be activated by mate-settings-daemon or not</description> | ||
</key> | ||
<key name="priority" type="i"> | ||
<default>0</default> | ||
<summary>Priority to use for this plugin</summary> | ||
<description>Priority to use for this plugin in mate-settings-daemon startup queue</description> | ||
</key> | ||
</schema> | ||
</schemalist> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* -*- 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> | ||
|
||
#include "mate-settings-bus.h" | ||
|
||
char * | ||
mate_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_debug ("Get property '%s': %s", "Chassis", ret); | ||
g_variant_unref (inner); | ||
out: | ||
g_clear_object (&connection); | ||
g_clear_pointer (&variant, g_variant_unref); | ||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* -*- 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 __MATE_SETTINGS_BUS_H | ||
#define __MATE_SETTINGS_BUS_H | ||
|
||
#include <glib-object.h> | ||
|
||
G_BEGIN_DECLS | ||
|
||
char * mate_settings_get_chassis_type (void); | ||
|
||
G_END_DECLS | ||
|
||
#endif /* __MATE_SETTINGS_BUS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Get access to /dev/rfkill for users | ||
# See https://bugzilla.redhat.com/show_bug.cgi?id=514798 | ||
# | ||
# Simplified by Kay Sievers | ||
# https://bugzilla.redhat.com/show_bug.cgi?id=733326 | ||
# See also https://bugzilla.gnome.org/show_bug.cgi?id=711373 | ||
|
||
KERNEL=="rfkill", SUBSYSTEM=="misc", TAG+="uaccess" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
plugin_LTLIBRARIES = librfkill.la | ||
|
||
librfkill_la_SOURCES = \ | ||
msd-rfkill-plugin.c \ | ||
msd-rfkill-manager.h \ | ||
msd-rfkill-manager.c \ | ||
rfkill-glib.c \ | ||
rfkill-glib.h \ | ||
rfkill.h | ||
|
||
librfkill_la_CPPFLAGS = \ | ||
-I$(top_srcdir)/mate-settings-daemon \ | ||
-I$(top_srcdir)/data/ \ | ||
-DMATE_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ | ||
-DLIBEXECDIR=\""$(libexecdir)"\" \ | ||
$(AM_CPPFLAGS) | ||
|
||
librfkill_la_CFLAGS = \ | ||
$(PLUGIN_CFLAGS) \ | ||
$(RFKILL_CFLAGS) \ | ||
$(SETTINGS_PLUGIN_CFLAGS) \ | ||
$(AM_CFLAGS) | ||
|
||
librfkill_la_LDFLAGS = \ | ||
$(MSD_PLUGIN_LDFLAGS) | ||
|
||
librfkill_la_LIBADD = \ | ||
$(RFKILL_LIBS) \ | ||
$(SETTINGS_PLUGIN_LIBS) | ||
|
||
plugin_in_files = rfkill.mate-settings-plugin.in | ||
|
||
plugin_DATA = $(plugin_in_files:.mate-settings-plugin.in=.mate-settings-plugin) | ||
|
||
udevrulesdir = $(prefix)/lib/udev/rules.d | ||
udevrules_DATA = 61-mate-settings-daemon-rfkill.rules | ||
|
||
EXTRA_DIST = $(plugin_in_files) $(udevrules_DATA) | ||
CLEANFILES = $(plugin_DATA) | ||
DISTCLEANFILES = $(plugin_DATA) | ||
|
||
@MSD_INTLTOOL_PLUGIN_RULE@ |
Oops, something went wrong.