Skip to content

Commit

Permalink
polkitbackendactionpool: rename directory to usr_directory
Browse files Browse the repository at this point in the history
a small refactoring, will make successive patch clearer.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
  • Loading branch information
giuseppe committed Dec 15, 2017
1 parent 29ba7af commit 05a7876
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
40 changes: 20 additions & 20 deletions src/polkitbackend/polkitbackendactionpool.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ static const gchar *_localize (GHashTable *translations,
typedef struct
{
/* directory with .policy files, e.g. /usr/share/polkit-1/actions */
GFile *directory;
GFile *usr_directory;

GFileMonitor *dir_monitor;
GFileMonitor *usr_dir_monitor;

/* maps from action_id to a ParsedAction struct */
GHashTable *parsed_actions;
Expand All @@ -108,7 +108,7 @@ typedef struct
enum
{
PROP_0,
PROP_DIRECTORY,
PROP_USR_DIRECTORY,
};

#define POLKIT_BACKEND_ACTION_POOL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), POLKIT_BACKEND_TYPE_ACTION_POOL, PolkitBackendActionPoolPrivate))
Expand Down Expand Up @@ -150,11 +150,11 @@ polkit_backend_action_pool_finalize (GObject *object)
pool = POLKIT_BACKEND_ACTION_POOL (object);
priv = POLKIT_BACKEND_ACTION_POOL_GET_PRIVATE (pool);

if (priv->directory != NULL)
g_object_unref (priv->directory);
if (priv->usr_directory != NULL)
g_object_unref (priv->usr_directory);

if (priv->dir_monitor != NULL)
g_object_unref (priv->dir_monitor);
if (priv->usr_dir_monitor != NULL)
g_object_unref (priv->usr_dir_monitor);

if (priv->parsed_actions != NULL)
g_hash_table_unref (priv->parsed_actions);
Expand All @@ -179,8 +179,8 @@ polkit_backend_action_pool_get_property (GObject *object,

switch (prop_id)
{
case PROP_DIRECTORY:
g_value_set_object (value, priv->directory);
case PROP_USR_DIRECTORY:
g_value_set_object (value, priv->usr_directory);
break;

default:
Expand Down Expand Up @@ -252,22 +252,22 @@ polkit_backend_action_pool_set_property (GObject *object,

switch (prop_id)
{
case PROP_DIRECTORY:
priv->directory = g_value_dup_object (value);
case PROP_USR_DIRECTORY:
priv->usr_directory = g_value_dup_object (value);

error = NULL;
priv->dir_monitor = g_file_monitor_directory (priv->directory,
G_FILE_MONITOR_NONE,
NULL,
&error);
if (priv->dir_monitor == NULL)
priv->usr_dir_monitor = g_file_monitor_directory (priv->usr_directory,
G_FILE_MONITOR_NONE,
NULL,
&error);
if (priv->usr_dir_monitor == NULL)
{
g_warning ("Error monitoring actions directory: %s", error->message);
g_error_free (error);
}
else
{
g_signal_connect (priv->dir_monitor,
g_signal_connect (priv->usr_dir_monitor,
"changed",
(GCallback) dir_monitor_changed,
pool);
Expand Down Expand Up @@ -297,7 +297,7 @@ polkit_backend_action_pool_class_init (PolkitBackendActionPoolClass *klass)
* The directory to load action description files from.
*/
g_object_class_install_property (gobject_class,
PROP_DIRECTORY,
PROP_USR_DIRECTORY,
g_param_spec_object ("directory",
"Directory",
"Directory to load action description files from",
Expand Down Expand Up @@ -516,7 +516,7 @@ ensure_all_files (PolkitBackendActionPool *pool)
goto out;

error = NULL;
e = g_file_enumerate_children (priv->directory,
e = g_file_enumerate_children (priv->usr_directory,
"standard::name",
G_FILE_QUERY_INFO_NONE,
NULL,
Expand All @@ -537,7 +537,7 @@ ensure_all_files (PolkitBackendActionPool *pool)
{
GFile *file;

file = g_file_get_child (priv->directory, name);
file = g_file_get_child (priv->usr_directory, name);

ensure_file (pool, file);

Expand Down
2 changes: 1 addition & 1 deletion src/polkitbackend/polkitbackendactionpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct _PolkitBackendActionPoolClass
};

GType polkit_backend_action_pool_get_type (void) G_GNUC_CONST;
PolkitBackendActionPool *polkit_backend_action_pool_new (GFile *directory);
PolkitBackendActionPool *polkit_backend_action_pool_new (GFile *usr_directory);
GList *polkit_backend_action_pool_get_all_actions (PolkitBackendActionPool *pool,
const gchar *locale);

Expand Down

0 comments on commit 05a7876

Please sign in to comment.