Skip to content

Commit

Permalink
account: use vendor file for alternative faces directory
Browse files Browse the repository at this point in the history
Instead of a custom build option.
  • Loading branch information
cosimoc committed Nov 5, 2018
1 parent 436ad28 commit f13afa4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
25 changes: 21 additions & 4 deletions gnome-initial-setup/pages/account/um-photo-dialog.c
Expand Up @@ -37,8 +37,13 @@
#include "um-photo-dialog.h"
#include "um-utils.h"

#include "gnome-initial-setup.h"

#define ROW_SPAN 6

#define VENDOR_ACCOUNT_GROUP "Account"
#define VENDOR_ACCOUNT_FACESDIR_KEY "Faces"

struct _UmPhotoDialog {
GtkWidget *photo_popup;
GtkWidget *popup_button;
Expand Down Expand Up @@ -176,17 +181,29 @@ get_facesdirs (void)
const gchar * const * data_dirs;
int i;
const char *facesdir_env;
GisDriver *driver;

facesdir_env = g_getenv ("GIS_ACCOUNT_PAGE_FACESDIR");
if (facesdir_env != NULL && g_strcmp0 (facesdir_env, "") != 0) {
facesdirs = g_slist_prepend (facesdirs,
g_strdup (facesdir_env));
}

if (g_strcmp0 (ACCOUNT_PAGE_FACESDIR, "") != 0) {
facesdirs = g_slist_prepend (facesdirs,
g_strdup (ACCOUNT_PAGE_FACESDIR));
}
/* This code will look for options under the "Account" group, and
* supports the following keys:
* - Faces: directory to scan for avatar faces.
*
* This is how this file would look on a vendor image:
*
* [Account]
* Faces=/path/to/faces/dir
*/
driver = GIS_DRIVER (g_application_get_default ());
char *path = gis_driver_conf_get_string (driver,
VENDOR_ACCOUNT_GROUP,
VENDOR_ACCOUNT_FACESDIR_KEY);
if (path)
facesdirs = g_slist_prepend (facesdirs, path);

data_dirs = g_get_system_data_dirs ();
for (i = 0; data_dirs[i] != NULL; i++) {
Expand Down
1 change: 0 additions & 1 deletion meson.build
Expand Up @@ -32,7 +32,6 @@ conf.set('ENABLE_REGION_PAGE', get_option('region-page'))
conf.set_quoted('LIBEXECDIR', join_paths(prefix, get_option('libexecdir')))
conf.set_quoted('LOCALSTATEDIR', local_state_dir)
conf.set_quoted('DEMOVIDEODATADIR', join_paths(data_dir, 'eos-demo-mode'))
conf.set_quoted('ACCOUNT_PAGE_FACESDIR', get_option('account-page-faces-dir'))
conf.set('SECRET_API_SUBJECT_TO_CHANGE', true)

# Needed for the 'account' page
Expand Down
5 changes: 0 additions & 5 deletions meson_options.txt
Expand Up @@ -31,8 +31,3 @@ option('systemd-system-unit-dir',
description: 'the directory to install systemd system units',
type: 'string'
)

option('account-page-faces-dir',
description: 'an alternative directory to look for user images',
type: 'string'
)

0 comments on commit f13afa4

Please sign in to comment.