feedback-manager: Fix formatting
It was off in several places. Now that there's no outstanding MRs clean it up via uncrustify --replace -c phosh.cfg src/fbd-feedback-manager.c
This commit is contained in:
+40
-39
@@ -42,18 +42,18 @@
|
|||||||
typedef struct _FbdFeedbackManager {
|
typedef struct _FbdFeedbackManager {
|
||||||
LfbGdbusFeedbackSkeleton parent;
|
LfbGdbusFeedbackSkeleton parent;
|
||||||
|
|
||||||
GSettings *settings;
|
GSettings *settings;
|
||||||
FbdFeedbackProfileLevel level;
|
FbdFeedbackProfileLevel level;
|
||||||
FbdFeedbackTheme *theme;
|
FbdFeedbackTheme *theme;
|
||||||
guint next_id;
|
guint next_id;
|
||||||
|
|
||||||
GHashTable *events;
|
GHashTable *events;
|
||||||
|
|
||||||
/* Hardware interaction */
|
/* Hardware interaction */
|
||||||
GUdevClient *client;
|
GUdevClient *client;
|
||||||
FbdDevVibra *vibra;
|
FbdDevVibra *vibra;
|
||||||
FbdDevSound *sound;
|
FbdDevSound *sound;
|
||||||
FbdDevLeds *leds;
|
FbdDevLeds *leds;
|
||||||
} FbdFeedbackManager;
|
} FbdFeedbackManager;
|
||||||
|
|
||||||
static void fbd_feedback_manager_feedback_iface_init (LfbGdbusFeedbackIface *iface);
|
static void fbd_feedback_manager_feedback_iface_init (LfbGdbusFeedbackIface *iface);
|
||||||
@@ -177,7 +177,7 @@ on_event_feedbacks_ended (FbdFeedbackManager *self, FbdEvent *event)
|
|||||||
|
|
||||||
g_return_if_fail (fbd_event_get_feedbacks_ended (event));
|
g_return_if_fail (fbd_event_get_feedbacks_ended (event));
|
||||||
|
|
||||||
lfb_gdbus_feedback_emit_feedback_ended (LFB_GDBUS_FEEDBACK(self), event_id,
|
lfb_gdbus_feedback_emit_feedback_ended (LFB_GDBUS_FEEDBACK (self), event_id,
|
||||||
fbd_event_get_end_reason (event));
|
fbd_event_get_end_reason (event));
|
||||||
|
|
||||||
g_debug ("All feedbacks for event %d finished", event_id);
|
g_debug ("All feedbacks for event %d finished", event_id);
|
||||||
@@ -243,12 +243,12 @@ parse_hints (GVariant *hints, FbdFeedbackProfileLevel *level)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
fbd_feedback_manager_handle_trigger_feedback (LfbGdbusFeedback *object,
|
fbd_feedback_manager_handle_trigger_feedback (LfbGdbusFeedback *object,
|
||||||
GDBusMethodInvocation *invocation,
|
GDBusMethodInvocation *invocation,
|
||||||
const gchar *arg_app_id,
|
const gchar *arg_app_id,
|
||||||
const gchar *arg_event,
|
const gchar *arg_event,
|
||||||
GVariant *arg_hints,
|
GVariant *arg_hints,
|
||||||
gint arg_timeout)
|
gint arg_timeout)
|
||||||
{
|
{
|
||||||
FbdFeedbackManager *self;
|
FbdFeedbackManager *self;
|
||||||
FbdEvent *event;
|
FbdEvent *event;
|
||||||
@@ -302,8 +302,8 @@ fbd_feedback_manager_handle_trigger_feedback (LfbGdbusFeedback *object,
|
|||||||
FbdFeedbackBase *fb = l->data;
|
FbdFeedbackBase *fb = l->data;
|
||||||
|
|
||||||
if (fbd_feedback_is_available (FBD_FEEDBACK_BASE (fb))) {
|
if (fbd_feedback_is_available (FBD_FEEDBACK_BASE (fb))) {
|
||||||
fbd_event_add_feedback (event, fb);
|
fbd_event_add_feedback (event, fb);
|
||||||
found_fb = TRUE;
|
found_fb = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_slist_free_full (feedbacks, g_object_unref);
|
g_slist_free_full (feedbacks, g_object_unref);
|
||||||
@@ -320,7 +320,7 @@ fbd_feedback_manager_handle_trigger_feedback (LfbGdbusFeedback *object,
|
|||||||
fbd_event_run_feedbacks (event);
|
fbd_event_run_feedbacks (event);
|
||||||
} else {
|
} else {
|
||||||
g_hash_table_remove (self->events, GUINT_TO_POINTER (event_id));
|
g_hash_table_remove (self->events, GUINT_TO_POINTER (event_id));
|
||||||
lfb_gdbus_feedback_emit_feedback_ended (LFB_GDBUS_FEEDBACK(self), event_id,
|
lfb_gdbus_feedback_emit_feedback_ended (LFB_GDBUS_FEEDBACK (self), event_id,
|
||||||
FBD_EVENT_END_REASON_NOT_FOUND);
|
FBD_EVENT_END_REASON_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,9 +329,9 @@ fbd_feedback_manager_handle_trigger_feedback (LfbGdbusFeedback *object,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
fbd_feedback_manager_handle_end_feedback (LfbGdbusFeedback *object,
|
fbd_feedback_manager_handle_end_feedback (LfbGdbusFeedback *object,
|
||||||
GDBusMethodInvocation *invocation,
|
GDBusMethodInvocation *invocation,
|
||||||
guint event_id)
|
guint event_id)
|
||||||
{
|
{
|
||||||
FbdFeedbackManager *self;
|
FbdFeedbackManager *self;
|
||||||
FbdEvent *event;
|
FbdEvent *event;
|
||||||
@@ -357,45 +357,46 @@ fbd_feedback_manager_handle_end_feedback (LfbGdbusFeedback *object,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const gchar *
|
static const gchar *
|
||||||
find_themefile (void) {
|
find_themefile (void)
|
||||||
|
{
|
||||||
gint i = 0;
|
gint i = 0;
|
||||||
gsize len;
|
gsize len;
|
||||||
const gchar *comp;
|
const gchar *comp;
|
||||||
g_autoptr(GError) err = NULL;
|
|
||||||
gchar **xdg_data_dirs = (gchar **) g_get_system_data_dirs();
|
g_autoptr (GError) err = NULL;
|
||||||
|
gchar **xdg_data_dirs = (gchar **) g_get_system_data_dirs ();
|
||||||
g_autofree gchar *config_path = NULL;
|
g_autofree gchar *config_path = NULL;
|
||||||
g_autofree gchar *compatibles = NULL;
|
g_autofree gchar *compatibles = NULL;
|
||||||
|
|
||||||
// Try to read the device name
|
// Try to read the device name
|
||||||
if (g_file_test(DEVICE_TREE_PATH, (G_FILE_TEST_EXISTS))) {
|
if (g_file_test (DEVICE_TREE_PATH, (G_FILE_TEST_EXISTS))) {
|
||||||
g_debug("Found device tree device compatible at %s", DEVICE_TREE_PATH);
|
g_debug ("Found device tree device compatible at %s", DEVICE_TREE_PATH);
|
||||||
|
|
||||||
// Check if feedbackd has a proper config available this device
|
// Check if feedbackd has a proper config available this device
|
||||||
if(!g_file_get_contents(DEVICE_TREE_PATH, &compatibles, &len, &err))
|
if (!g_file_get_contents (DEVICE_TREE_PATH, &compatibles, &len, &err))
|
||||||
g_warning ("Unable to read: %s", err->message);
|
g_warning ("Unable to read: %s", err->message);
|
||||||
|
|
||||||
comp = compatibles;
|
comp = compatibles;
|
||||||
while(comp - compatibles < len) {
|
while (comp - compatibles < len) {
|
||||||
|
|
||||||
// Iterate over $XDG_DATA_DIRS
|
// Iterate over $XDG_DATA_DIRS
|
||||||
for (i = 0; i < g_strv_length(xdg_data_dirs); i++) {
|
for (i = 0; i < g_strv_length (xdg_data_dirs); i++) {
|
||||||
config_path = g_strconcat(xdg_data_dirs[i], "feedbackd/themes/", comp, ".json", NULL);
|
config_path = g_strconcat (xdg_data_dirs[i], "feedbackd/themes/", comp, ".json", NULL);
|
||||||
g_debug("Searching for device specific themefile in %s", config_path);
|
g_debug ("Searching for device specific themefile in %s", config_path);
|
||||||
|
|
||||||
// Check if file exist
|
// Check if file exist
|
||||||
if (g_file_test(config_path, (G_FILE_TEST_EXISTS))) {
|
if (g_file_test (config_path, (G_FILE_TEST_EXISTS))) {
|
||||||
g_debug("Found themefile for this device at: %s", config_path);
|
g_debug ("Found themefile for this device at: %s", config_path);
|
||||||
return g_strdup(config_path);
|
return g_strdup (config_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next compatible
|
// Next compatible
|
||||||
comp = strchr(comp, 0);
|
comp = strchr (comp, 0);
|
||||||
comp++;
|
comp++;
|
||||||
}
|
}
|
||||||
}
|
}else {
|
||||||
else {
|
g_debug ("Device tree path does not exist: %s", DEVICE_TREE_PATH);
|
||||||
g_debug("Device tree path does not exist: %s", DEVICE_TREE_PATH);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -411,7 +412,7 @@ fbd_feedback_manager_constructed (GObject *object)
|
|||||||
G_OBJECT_CLASS (fbd_feedback_manager_parent_class)->constructed (object);
|
G_OBJECT_CLASS (fbd_feedback_manager_parent_class)->constructed (object);
|
||||||
|
|
||||||
// Overide themefile with environment variable if requested
|
// Overide themefile with environment variable if requested
|
||||||
themefile = g_getenv(FEEDBACKD_THEME_VAR);
|
themefile = g_getenv (FEEDBACKD_THEME_VAR);
|
||||||
|
|
||||||
// Search for device-specific configuration
|
// Search for device-specific configuration
|
||||||
if (!themefile)
|
if (!themefile)
|
||||||
@@ -420,7 +421,7 @@ fbd_feedback_manager_constructed (GObject *object)
|
|||||||
// Fallback to default configuration if needed
|
// Fallback to default configuration if needed
|
||||||
if (!themefile)
|
if (!themefile)
|
||||||
themefile = FEEDBACKD_THEME_DIR "/default.json";
|
themefile = FEEDBACKD_THEME_DIR "/default.json";
|
||||||
g_info("Using themefile: %s", themefile);
|
g_info ("Using themefile: %s", themefile);
|
||||||
|
|
||||||
self->theme = fbd_feedback_theme_new_from_file (themefile, &err);
|
self->theme = fbd_feedback_theme_new_from_file (themefile, &err);
|
||||||
if (!self->theme) {
|
if (!self->theme) {
|
||||||
|
|||||||
Reference in New Issue
Block a user