Revert "core: fix compilation on glib < 2.23.4"

This reverts commit 8a1fe31b31.

This commit was not intended to be pushed, as it's not ready yet
and isn't even my commit (thus attribution is wrong).
This commit is contained in:
Dan Williams
2010-07-12 18:20:09 -07:00
parent 5f647becd6
commit 664ccd4464
8 changed files with 15 additions and 266 deletions

View File

@@ -2447,7 +2447,7 @@ typedef struct GetSecretsInfo {
guint32 idle_id;
char *hint1;
char *hint2;
NMConnection *connection;
char *connection_path;
} GetSecretsInfo;
static void
@@ -2472,7 +2472,7 @@ free_get_secrets_info (gpointer data)
g_free (info->hint1);
g_free (info->hint2);
g_free (info->setting_name);
g_object_unref (info->connection);
g_free (info->connection_path);
memset (info, 0, sizeof (GetSecretsInfo));
g_free (info);
}
@@ -2493,16 +2493,6 @@ provider_cancel_secrets (NMSecretsProviderInterface *provider, gpointer user_dat
}
}
static void
system_connection_update_cb (NMSettingsConnectionInterface *connection,
GError *error,
gpointer user_data)
{
if (error != NULL) {
nm_log_warn (LOGD_SYS_SET, "could not update system connection: %s", error->message);
}
}
static void
user_get_secrets_cb (DBusGProxy *proxy,
DBusGProxyCall *call,
@@ -2527,14 +2517,6 @@ user_get_secrets_cb (DBusGProxy *proxy,
info->caller,
settings,
NULL);
/* If this connection is a system one, we need to update it on our end */
if (nm_connection_get_scope (info->connection) == NM_CONNECTION_SCOPE_SYSTEM) {
nm_settings_connection_interface_update (NM_SETTINGS_CONNECTION_INTERFACE (info->connection),
system_connection_update_cb,
NULL);
}
g_hash_table_destroy (settings);
} else {
nm_secrets_provider_interface_get_secrets_result (info->provider,
@@ -2625,50 +2607,6 @@ system_get_secrets_reply_cb (NMSettingsConnectionInterface *connection,
g_object_unref (provider);
}
static gboolean
system_get_secrets_from_user (GetSecretsInfo *info)
{
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (info->manager);
DBusGConnection *g_connection;
GPtrArray *hints = NULL;
/* Only user settings services that are allowed to control the network
* are allowed to provide new secrets for system connections.
*/
if (priv->user_net_perm != NM_AUTH_CALL_RESULT_YES)
return FALSE;
g_connection = nm_dbus_manager_get_connection (priv->dbus_mgr);
info->proxy = dbus_g_proxy_new_for_name (g_connection,
NM_DBUS_SERVICE_USER_SETTINGS,
NM_DBUS_PATH_SETTINGS,
NM_DBUS_IFACE_SETTINGS_SECRETS);
if (!info->proxy) {
nm_log_warn (LOGD_SYS_SET, "could not create user settings secrets proxy");
system_get_secrets_reply_cb (NULL, NULL, NULL, info); // FIXME pass error
return FALSE;
}
hints = g_ptr_array_sized_new (2);
if (info->hint1)
g_ptr_array_add (hints, (char *) info->hint1);
if (info->hint2)
g_ptr_array_add (hints, (char *) info->hint2);
info->call = dbus_g_proxy_begin_call_with_timeout (info->proxy, "GetSecretsForConnection",
user_get_secrets_cb,
info,
NULL,
G_MAXINT32,
G_TYPE_STRING, NM_DBUS_SERVICE_SYSTEM_SETTINGS,
DBUS_TYPE_G_OBJECT_PATH, nm_connection_get_path (info->connection),
G_TYPE_STRING, info->setting_name,
DBUS_TYPE_G_ARRAY_OF_STRING, hints,
G_TYPE_INVALID);
g_ptr_array_free (hints, TRUE);
return TRUE;
}
static gboolean
system_get_secrets_idle_cb (gpointer user_data)
{
@@ -2676,12 +2614,12 @@ system_get_secrets_idle_cb (gpointer user_data)
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (info->manager);
NMSettingsConnectionInterface *connection;
GError *error = NULL;
gboolean success = FALSE;
const char *hints[3] = { NULL, NULL, NULL };
info->idle_id = 0;
connection = nm_settings_interface_get_connection_by_path (NM_SETTINGS_INTERFACE (priv->sys_settings),
nm_connection_get_path (info->connection));
info->connection_path);
if (!connection) {
error = g_error_new_literal (NM_MANAGER_ERROR,
NM_MANAGER_ERROR_UNKNOWN_CONNECTION,
@@ -2696,29 +2634,14 @@ system_get_secrets_idle_cb (gpointer user_data)
return FALSE;
}
/* If new secrets are requested, try asking the user settings service for
* them since the system settings service can't interact with anything
* to get new secrets.
*/
if (info->request_new)
success = system_get_secrets_from_user (info);
/* If the user wasn't authorized, or we should retry using existing
* secrets, just ask the system settings service.
*/
if (!success) {
const char *hints[3] = { NULL, NULL, NULL };
hints[0] = info->hint1;
hints[1] = info->hint2;
nm_settings_connection_interface_get_secrets (connection,
info->setting_name,
hints,
info->request_new,
system_get_secrets_reply_cb,
info);
}
hints[0] = info->hint1;
hints[1] = info->hint2;
nm_settings_connection_interface_get_secrets (connection,
info->setting_name,
hints,
info->request_new,
system_get_secrets_reply_cb,
info);
return FALSE;
}
@@ -2741,7 +2664,7 @@ system_get_secrets (NMManager *self,
info->setting_name = g_strdup (setting_name);
info->hint1 = hint1 ? g_strdup (hint1) : NULL;
info->hint2 = hint2 ? g_strdup (hint2) : NULL;
info->connection = g_object_ref (connection);
info->connection_path = g_strdup (nm_connection_get_path (connection));
info->request_new = request_new;
g_object_weak_ref (G_OBJECT (provider), (GWeakNotify) free_get_secrets_info, info);
@@ -4011,9 +3934,7 @@ firmware_dir_changed (GFileMonitor *monitor,
switch (event_type) {
case G_FILE_MONITOR_EVENT_CREATED:
case G_FILE_MONITOR_EVENT_CHANGED:
#if GLIB_CHECK_VERSION(2,23,4)
case G_FILE_MONITOR_EVENT_MOVED:
#endif
case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
if (!priv->fw_changed_id) {