summaryrefslogtreecommitdiffstats
path: root/source/dialogs
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-03-04 19:41:06 +0100
committerDave Davenport <qball@gmpclient.org>2017-03-04 19:41:06 +0100
commit3f4d58ef531a17d6667318a4e8f9390a383ffab6 (patch)
tree29aa6b8bd7c7420a236b3be2fd62404889d8ee53 /source/dialogs
parent8ee37012d1b55e69a66fb88727b14c284b6a367f (diff)
Indent code.
Diffstat (limited to 'source/dialogs')
-rw-r--r--source/dialogs/combi.c8
-rw-r--r--source/dialogs/dmenu.c4
-rw-r--r--source/dialogs/run.c1
-rw-r--r--source/dialogs/script.c4
-rw-r--r--source/dialogs/ssh.c5
-rw-r--r--source/dialogs/window.c13
6 files changed, 16 insertions, 19 deletions
diff --git a/source/dialogs/combi.c b/source/dialogs/combi.c
index 4699f151..3d408712 100644
--- a/source/dialogs/combi.c
+++ b/source/dialogs/combi.c
@@ -69,16 +69,18 @@ static void combi_mode_parse_switchers ( Mode *sw )
sizeof ( CombiMode ) * ( pd->num_switchers + 1 ) );
Mode *mode = rofi_collect_modi_search ( token );
- if ( mode ){
+ if ( mode ) {
pd->switchers[pd->num_switchers].disable = FALSE;
pd->switchers[pd->num_switchers++].mode = mode;
- } else {
+ }
+ else {
// If not build in, use custom switchers.
Mode *sw = script_switcher_parse_setup ( token );
if ( sw != NULL ) {
pd->switchers[pd->num_switchers].disable = FALSE;
pd->switchers[pd->num_switchers++].mode = sw;
- } else {
+ }
+ else {
// Report error, don't continue.
fprintf ( stderr, "Invalid script switcher: %s\n", token );
token = NULL;
diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c
index ea0880a2..85bf850a 100644
--- a/source/dialogs/dmenu.c
+++ b/source/dialogs/dmenu.c
@@ -473,10 +473,10 @@ static int dmenu_token_match ( const Mode *sw, GRegex **tokens, unsigned int ind
static char *dmenu_get_message ( const Mode *sw )
{
DmenuModePrivateData *pd = (DmenuModePrivateData *) mode_get_private_data ( sw );
- if ( pd->message ){
+ if ( pd->message ) {
return g_strdup ( pd->message );
}
- return NULL;
+ return NULL;
}
#include "mode-private.h"
diff --git a/source/dialogs/run.c b/source/dialogs/run.c
index e9ba44c6..96ddd352 100644
--- a/source/dialogs/run.c
+++ b/source/dialogs/run.c
@@ -70,7 +70,6 @@ typedef struct
unsigned int cmd_list_length;
} RunModePrivateData;
-
/**
* @param cmd The cmd to execute
* @param run_in_term Indicate if command should be run in a terminal
diff --git a/source/dialogs/script.c b/source/dialogs/script.c
index 5744f5ac..f653d719 100644
--- a/source/dialogs/script.c
+++ b/source/dialogs/script.c
@@ -76,11 +76,9 @@ static char **get_script_output ( const char *command, unsigned int *length )
static char **execute_executor ( Mode *sw, const char *result, unsigned int *length )
{
- char **retv = NULL;
-
char *arg = g_shell_quote ( result );
char *command = g_strdup_printf ( "%s %s", (const char *) sw->ed, arg );
- retv = get_script_output ( command, length );
+ char **retv = get_script_output ( command, length );
g_free ( command );
g_free ( arg );
return retv;
diff --git a/source/dialogs/ssh.c b/source/dialogs/ssh.c
index d2ffbed9..e8f67cd9 100644
--- a/source/dialogs/ssh.c
+++ b/source/dialogs/ssh.c
@@ -199,7 +199,7 @@ static char **read_hosts_file ( char ** retv, unsigned int *length )
// Reading one line per time.
while ( getline ( &buffer, &buffer_length, fd ) > 0 ) {
// Evaluate one line.
- unsigned int index = 0, ti = 0;
+ unsigned int index = 0, ti = 0;
char *token = buffer;
// Tokenize it.
@@ -284,10 +284,9 @@ static char ** get_ssh ( unsigned int *length )
retv = read_hosts_file ( retv, length );
}
- FILE *fd = NULL;
const char *hd = g_get_home_dir ();
path = g_build_filename ( hd, ".ssh", "config", NULL );
- fd = fopen ( path, "r" );
+ FILE *fd = fopen ( path, "r" );
if ( fd != NULL ) {
char *buffer = NULL;
diff --git a/source/dialogs/window.c b/source/dialogs/window.c
index 2980270e..304b6a11 100644
--- a/source/dialogs/window.c
+++ b/source/dialogs/window.c
@@ -338,7 +338,7 @@ static int window_match ( const Mode *sw, GRegex **tokens, unsigned int index )
// If hack not in place it would not match queries spanning multiple fields.
// e.g. when searching 'title element' and 'class element'
GRegex *ftokens[2] = { tokens[j], NULL };
- if ( !test && c->title != NULL && c->title[0] != '\0' ) {
+ if ( c->title != NULL && c->title[0] != '\0' ) {
test = helper_token_match ( ftokens, c->title );
}
@@ -578,21 +578,20 @@ static ModeMode window_mode_result ( Mode *sw, int mretv, G_GNUC_UNUSED char **i
}
else {
rofi_view_hide ();
- if ( (current_window_manager&(WM_AWESOME|WM_OPENBOX)) != 0 )
- {
+ if ( ( current_window_manager & ( WM_AWESOME | WM_OPENBOX ) ) != 0 ) {
// Get the desktop of the client to switch to
uint32_t wmdesktop = 0;
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *r;
// Get the current desktop.
- unsigned int current_desktop = 0;
- xcb_get_property_cookie_t c = xcb_ewmh_get_current_desktop ( &xcb->ewmh, xcb->screen_nbr );
+ unsigned int current_desktop = 0;
+ xcb_get_property_cookie_t c = xcb_ewmh_get_current_desktop ( &xcb->ewmh, xcb->screen_nbr );
if ( !xcb_ewmh_get_current_desktop_reply ( &xcb->ewmh, c, &current_desktop, NULL ) ) {
current_desktop = 0;
}
cookie = xcb_get_property ( xcb->connection, 0, rmpd->ids->array[selected_line],
- xcb->ewmh._NET_WM_DESKTOP, XCB_ATOM_CARDINAL, 0, 1 );
+ xcb->ewmh._NET_WM_DESKTOP, XCB_ATOM_CARDINAL, 0, 1 );
r = xcb_get_property_reply ( xcb->connection, cookie, NULL );
if ( r && r->type == XCB_ATOM_CARDINAL ) {
wmdesktop = *( (uint32_t *) xcb_get_property_value ( r ) );
@@ -606,7 +605,7 @@ static ModeMode window_mode_result ( Mode *sw, int mretv, G_GNUC_UNUSED char **i
// If we have to switch the desktop, do
if ( wmdesktop != current_desktop ) {
xcb_ewmh_request_change_current_desktop ( &xcb->ewmh,
- xcb->screen_nbr, wmdesktop, XCB_CURRENT_TIME );
+ xcb->screen_nbr, wmdesktop, XCB_CURRENT_TIME );
}
}
// Activate the window