summaryrefslogtreecommitdiff
path: root/plugins/smartcard/gsd-smartcard-plugin.c
diff options
context:
space:
mode:
authorhaxar <[email protected]>2012-02-21 20:13:04 -0800
committerhaxar <[email protected]>2012-02-21 20:13:04 -0800
commitddaceb232c8b537a7d29a9708928d3a3671b98e5 (patch)
treed874e557f2999f9550ad2b710f0231ed06f50ba8 /plugins/smartcard/gsd-smartcard-plugin.c
parentecd8a153901507f5d210d6f85103693ef81d49c3 (diff)
downloadmate-settings-daemon-ddaceb232c8b537a7d29a9708928d3a3671b98e5.tar.bz2
mate-settings-daemon-ddaceb232c8b537a7d29a9708928d3a3671b98e5.tar.xz
gsd to msd complete rename patch by NiceandGently; code changes commit
Diffstat (limited to 'plugins/smartcard/gsd-smartcard-plugin.c')
-rw-r--r--plugins/smartcard/gsd-smartcard-plugin.c146
1 files changed, 73 insertions, 73 deletions
diff --git a/plugins/smartcard/gsd-smartcard-plugin.c b/plugins/smartcard/gsd-smartcard-plugin.c
index 9e3b4f2..dc4cb8f 100644
--- a/plugins/smartcard/gsd-smartcard-plugin.c
+++ b/plugins/smartcard/gsd-smartcard-plugin.c
@@ -31,11 +31,11 @@
#include <mateconf/mateconf-client.h>
#include "mate-settings-plugin.h"
-#include "gsd-smartcard-plugin.h"
-#include "gsd-smartcard-manager.h"
+#include "msd-smartcard-plugin.h"
+#include "msd-smartcard-manager.h"
-struct GsdSmartcardPluginPrivate {
- GsdSmartcardManager *manager;
+struct MsdSmartcardPluginPrivate {
+ MsdSmartcardManager *manager;
DBusGConnection *bus_connection;
guint32 is_active : 1;
@@ -43,10 +43,10 @@ struct GsdSmartcardPluginPrivate {
typedef enum
{
- GSD_SMARTCARD_REMOVE_ACTION_NONE,
- GSD_SMARTCARD_REMOVE_ACTION_LOCK_SCREEN,
- GSD_SMARTCARD_REMOVE_ACTION_FORCE_LOGOUT,
-} GsdSmartcardRemoveAction;
+ MSD_SMARTCARD_REMOVE_ACTION_NONE,
+ MSD_SMARTCARD_REMOVE_ACTION_LOCK_SCREEN,
+ MSD_SMARTCARD_REMOVE_ACTION_FORCE_LOGOUT,
+} MsdSmartcardRemoveAction;
#define SCREENSAVER_DBUS_NAME "org.mate.ScreenSaver"
#define SCREENSAVER_DBUS_PATH "/"
@@ -57,19 +57,19 @@ typedef enum
#define SM_DBUS_INTERFACE "org.mate.SessionManager"
#define SM_LOGOUT_MODE_FORCE 2
-#define GSD_SMARTCARD_KEY "/desktop/mate/peripherals/smartcard"
-#define KEY_REMOVE_ACTION GSD_SMARTCARD_KEY "/removal_action"
+#define MSD_SMARTCARD_KEY "/desktop/mate/peripherals/smartcard"
+#define KEY_REMOVE_ACTION MSD_SMARTCARD_KEY "/removal_action"
-#define GSD_SMARTCARD_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_SMARTCARD_PLUGIN, GsdSmartcardPluginPrivate))
+#define MSD_SMARTCARD_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), MSD_TYPE_SMARTCARD_PLUGIN, MsdSmartcardPluginPrivate))
-MATE_SETTINGS_PLUGIN_REGISTER (GsdSmartcardPlugin, gsd_smartcard_plugin);
+MATE_SETTINGS_PLUGIN_REGISTER (MsdSmartcardPlugin, msd_smartcard_plugin);
static void
-simulate_user_activity (GsdSmartcardPlugin *plugin)
+simulate_user_activity (MsdSmartcardPlugin *plugin)
{
DBusGProxy *screensaver_proxy;
- g_debug ("GsdSmartcardPlugin telling screensaver about smart card insertion");
+ g_debug ("MsdSmartcardPlugin telling screensaver about smart card insertion");
screensaver_proxy = dbus_g_proxy_new_for_name (plugin->priv->bus_connection,
SCREENSAVER_DBUS_NAME,
SCREENSAVER_DBUS_PATH,
@@ -83,11 +83,11 @@ simulate_user_activity (GsdSmartcardPlugin *plugin)
}
static void
-lock_screen (GsdSmartcardPlugin *plugin)
+lock_screen (MsdSmartcardPlugin *plugin)
{
DBusGProxy *screensaver_proxy;
- g_debug ("GsdSmartcardPlugin telling screensaver to lock screen");
+ g_debug ("MsdSmartcardPlugin telling screensaver to lock screen");
screensaver_proxy = dbus_g_proxy_new_for_name (plugin->priv->bus_connection,
SCREENSAVER_DBUS_NAME,
SCREENSAVER_DBUS_PATH,
@@ -101,13 +101,13 @@ lock_screen (GsdSmartcardPlugin *plugin)
}
static void
-force_logout (GsdSmartcardPlugin *plugin)
+force_logout (MsdSmartcardPlugin *plugin)
{
DBusGProxy *sm_proxy;
GError *error;
gboolean res;
- g_debug ("GsdSmartcardPlugin telling session manager to force logout");
+ g_debug ("MsdSmartcardPlugin telling session manager to force logout");
sm_proxy = dbus_g_proxy_new_for_name (plugin->priv->bus_connection,
SM_DBUS_NAME,
SM_DBUS_PATH,
@@ -121,7 +121,7 @@ force_logout (GsdSmartcardPlugin *plugin)
G_TYPE_INVALID, G_TYPE_INVALID);
if (! res) {
- g_warning ("GsdSmartcardPlugin Unable to force logout: %s", error->message);
+ g_warning ("MsdSmartcardPlugin Unable to force logout: %s", error->message);
g_error_free (error);
}
@@ -129,26 +129,26 @@ force_logout (GsdSmartcardPlugin *plugin)
}
static void
-gsd_smartcard_plugin_init (GsdSmartcardPlugin *plugin)
+msd_smartcard_plugin_init (MsdSmartcardPlugin *plugin)
{
- plugin->priv = GSD_SMARTCARD_PLUGIN_GET_PRIVATE (plugin);
+ plugin->priv = MSD_SMARTCARD_PLUGIN_GET_PRIVATE (plugin);
- g_debug ("GsdSmartcardPlugin initializing");
+ g_debug ("MsdSmartcardPlugin initializing");
- plugin->priv->manager = gsd_smartcard_manager_new (NULL);
+ plugin->priv->manager = msd_smartcard_manager_new (NULL);
}
static void
-gsd_smartcard_plugin_finalize (GObject *object)
+msd_smartcard_plugin_finalize (GObject *object)
{
- GsdSmartcardPlugin *plugin;
+ MsdSmartcardPlugin *plugin;
g_return_if_fail (object != NULL);
- g_return_if_fail (GSD_IS_SMARTCARD_PLUGIN (object));
+ g_return_if_fail (MSD_IS_SMARTCARD_PLUGIN (object));
- g_debug ("GsdSmartcardPlugin finalizing");
+ g_debug ("MsdSmartcardPlugin finalizing");
- plugin = GSD_SMARTCARD_PLUGIN (object);
+ plugin = MSD_SMARTCARD_PLUGIN (object);
g_return_if_fail (plugin->priv != NULL);
@@ -156,18 +156,18 @@ gsd_smartcard_plugin_finalize (GObject *object)
g_object_unref (plugin->priv->manager);
}
- G_OBJECT_CLASS (gsd_smartcard_plugin_parent_class)->finalize (object);
+ G_OBJECT_CLASS (msd_smartcard_plugin_parent_class)->finalize (object);
}
static void
-smartcard_inserted_cb (GsdSmartcardManager *card_monitor,
- GsdSmartcard *card,
- GsdSmartcardPlugin *plugin)
+smartcard_inserted_cb (MsdSmartcardManager *card_monitor,
+ MsdSmartcard *card,
+ MsdSmartcardPlugin *plugin)
{
char *name;
- name = gsd_smartcard_get_name (card);
- g_debug ("GsdSmartcardPlugin smart card '%s' inserted", name);
+ name = msd_smartcard_get_name (card);
+ g_debug ("MsdSmartcardPlugin smart card '%s' inserted", name);
g_free (name);
simulate_user_activity (plugin);
@@ -179,29 +179,29 @@ user_logged_in_with_smartcard (void)
return g_getenv ("PKCS11_LOGIN_TOKEN_NAME") != NULL;
}
-static GsdSmartcardRemoveAction
-get_configured_remove_action (GsdSmartcardPlugin *plugin)
+static MsdSmartcardRemoveAction
+get_configured_remove_action (MsdSmartcardPlugin *plugin)
{
MateConfClient *client;
char *remove_action_string;
- GsdSmartcardRemoveAction remove_action;
+ MsdSmartcardRemoveAction remove_action;
client = mateconf_client_get_default ();
remove_action_string = mateconf_client_get_string (client,
KEY_REMOVE_ACTION, NULL);
if (remove_action_string == NULL) {
- g_warning ("GsdSmartcardPlugin unable to get smartcard remove action");
- remove_action = GSD_SMARTCARD_REMOVE_ACTION_NONE;
+ g_warning ("MsdSmartcardPlugin unable to get smartcard remove action");
+ remove_action = MSD_SMARTCARD_REMOVE_ACTION_NONE;
} else if (strcmp (remove_action_string, "none") == 0) {
- remove_action = GSD_SMARTCARD_REMOVE_ACTION_NONE;
+ remove_action = MSD_SMARTCARD_REMOVE_ACTION_NONE;
} else if (strcmp (remove_action_string, "lock_screen") == 0) {
- remove_action = GSD_SMARTCARD_REMOVE_ACTION_LOCK_SCREEN;
+ remove_action = MSD_SMARTCARD_REMOVE_ACTION_LOCK_SCREEN;
} else if (strcmp (remove_action_string, "force_logout") == 0) {
- remove_action = GSD_SMARTCARD_REMOVE_ACTION_FORCE_LOGOUT;
+ remove_action = MSD_SMARTCARD_REMOVE_ACTION_FORCE_LOGOUT;
} else {
- g_warning ("GsdSmartcardPlugin unknown smartcard remove action");
- remove_action = GSD_SMARTCARD_REMOVE_ACTION_NONE;
+ g_warning ("MsdSmartcardPlugin unknown smartcard remove action");
+ remove_action = MSD_SMARTCARD_REMOVE_ACTION_NONE;
}
g_object_unref (client);
@@ -210,40 +210,40 @@ get_configured_remove_action (GsdSmartcardPlugin *plugin)
}
static void
-process_smartcard_removal (GsdSmartcardPlugin *plugin)
+process_smartcard_removal (MsdSmartcardPlugin *plugin)
{
- GsdSmartcardRemoveAction remove_action;
+ MsdSmartcardRemoveAction remove_action;
- g_debug ("GsdSmartcardPlugin processing smartcard removal");
+ g_debug ("MsdSmartcardPlugin processing smartcard removal");
remove_action = get_configured_remove_action (plugin);
switch (remove_action)
{
- case GSD_SMARTCARD_REMOVE_ACTION_NONE:
+ case MSD_SMARTCARD_REMOVE_ACTION_NONE:
return;
- case GSD_SMARTCARD_REMOVE_ACTION_LOCK_SCREEN:
+ case MSD_SMARTCARD_REMOVE_ACTION_LOCK_SCREEN:
lock_screen (plugin);
break;
- case GSD_SMARTCARD_REMOVE_ACTION_FORCE_LOGOUT:
+ case MSD_SMARTCARD_REMOVE_ACTION_FORCE_LOGOUT:
force_logout (plugin);
break;
}
}
static void
-smartcard_removed_cb (GsdSmartcardManager *card_monitor,
- GsdSmartcard *card,
- GsdSmartcardPlugin *plugin)
+smartcard_removed_cb (MsdSmartcardManager *card_monitor,
+ MsdSmartcard *card,
+ MsdSmartcardPlugin *plugin)
{
char *name;
- name = gsd_smartcard_get_name (card);
- g_debug ("GsdSmartcardPlugin smart card '%s' removed", name);
+ name = msd_smartcard_get_name (card);
+ g_debug ("MsdSmartcardPlugin smart card '%s' removed", name);
g_free (name);
- if (!gsd_smartcard_is_login_card (card)) {
- g_debug ("GsdSmartcardPlugin removed smart card was not used to login");
+ if (!msd_smartcard_is_login_card (card)) {
+ g_debug ("MsdSmartcardPlugin removed smart card was not used to login");
return;
}
@@ -254,33 +254,33 @@ static void
impl_activate (MateSettingsPlugin *plugin)
{
GError *error;
- GsdSmartcardPlugin *smartcard_plugin = GSD_SMARTCARD_PLUGIN (plugin);
+ MsdSmartcardPlugin *smartcard_plugin = MSD_SMARTCARD_PLUGIN (plugin);
if (smartcard_plugin->priv->is_active) {
- g_debug ("GsdSmartcardPlugin Not activating smartcard plugin, because it's "
+ g_debug ("MsdSmartcardPlugin Not activating smartcard plugin, because it's "
"already active");
return;
}
if (!user_logged_in_with_smartcard ()) {
- g_debug ("GsdSmartcardPlugin Not activating smartcard plugin, because user didn't use "
+ g_debug ("MsdSmartcardPlugin Not activating smartcard plugin, because user didn't use "
" smartcard to log in");
smartcard_plugin->priv->is_active = FALSE;
return;
}
- g_debug ("GsdSmartcardPlugin Activating smartcard plugin");
+ g_debug ("MsdSmartcardPlugin Activating smartcard plugin");
error = NULL;
smartcard_plugin->priv->bus_connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
if (smartcard_plugin->priv->bus_connection == NULL) {
- g_warning ("GsdSmartcardPlugin Unable to connect to session bus: %s", error->message);
+ g_warning ("MsdSmartcardPlugin Unable to connect to session bus: %s", error->message);
return;
}
- if (!gsd_smartcard_manager_start (smartcard_plugin->priv->manager, &error)) {
- g_warning ("GsdSmartcardPlugin Unable to start smartcard manager: %s", error->message);
+ if (!msd_smartcard_manager_start (smartcard_plugin->priv->manager, &error)) {
+ g_warning ("MsdSmartcardPlugin Unable to start smartcard manager: %s", error->message);
g_error_free (error);
}
@@ -292,8 +292,8 @@ impl_activate (MateSettingsPlugin *plugin)
"smartcard-inserted",
G_CALLBACK (smartcard_inserted_cb), smartcard_plugin);
- if (!gsd_smartcard_manager_login_card_is_inserted (smartcard_plugin->priv->manager)) {
- g_debug ("GsdSmartcardPlugin processing smartcard removal immediately user logged in with smartcard "
+ if (!msd_smartcard_manager_login_card_is_inserted (smartcard_plugin->priv->manager)) {
+ g_debug ("MsdSmartcardPlugin processing smartcard removal immediately user logged in with smartcard "
"and it's not inserted");
process_smartcard_removal (smartcard_plugin);
}
@@ -304,17 +304,17 @@ impl_activate (MateSettingsPlugin *plugin)
static void
impl_deactivate (MateSettingsPlugin *plugin)
{
- GsdSmartcardPlugin *smartcard_plugin = GSD_SMARTCARD_PLUGIN (plugin);
+ MsdSmartcardPlugin *smartcard_plugin = MSD_SMARTCARD_PLUGIN (plugin);
if (!smartcard_plugin->priv->is_active) {
- g_debug ("GsdSmartcardPlugin Not deactivating smartcard plugin, "
+ g_debug ("MsdSmartcardPlugin Not deactivating smartcard plugin, "
"because it's already inactive");
return;
}
- g_debug ("GsdSmartcardPlugin Deactivating smartcard plugin");
+ g_debug ("MsdSmartcardPlugin Deactivating smartcard plugin");
- gsd_smartcard_manager_stop (smartcard_plugin->priv->manager);
+ msd_smartcard_manager_stop (smartcard_plugin->priv->manager);
g_signal_handlers_disconnect_by_func (smartcard_plugin->priv->manager,
smartcard_removed_cb, smartcard_plugin);
@@ -326,15 +326,15 @@ impl_deactivate (MateSettingsPlugin *plugin)
}
static void
-gsd_smartcard_plugin_class_init (GsdSmartcardPluginClass *klass)
+msd_smartcard_plugin_class_init (MsdSmartcardPluginClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
MateSettingsPluginClass *plugin_class = MATE_SETTINGS_PLUGIN_CLASS (klass);
- object_class->finalize = gsd_smartcard_plugin_finalize;
+ object_class->finalize = msd_smartcard_plugin_finalize;
plugin_class->activate = impl_activate;
plugin_class->deactivate = impl_deactivate;
- g_type_class_add_private (klass, sizeof (GsdSmartcardPluginPrivate));
+ g_type_class_add_private (klass, sizeof (MsdSmartcardPluginPrivate));
}