diff options
author | Charalampos Kardaris <ckardaris@outlook.com> | 2019-12-12 20:10:18 +0200 |
---|---|---|
committer | Charalampos Kardaris <ckardaris@outlook.com> | 2019-12-12 20:10:18 +0200 |
commit | e71588c05533d1ffc3fd3027965a1c1dc65ed05c (patch) | |
tree | 2ac24057005078c891fddeee76581761d399aee1 /mktrayicon.c | |
parent | Fix in escape logic (diff) | |
download | mktrayicon-e71588c05533d1ffc3fd3027965a1c1dc65ed05c.tar.gz mktrayicon-e71588c05533d1ffc3fd3027965a1c1dc65ed05c.tar.bz2 mktrayicon-e71588c05533d1ffc3fd3027965a1c1dc65ed05c.zip |
Add curly boys in single-statement if/for blocks
Diffstat (limited to 'mktrayicon.c')
-rw-r--r-- | mktrayicon.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/mktrayicon.c b/mktrayicon.c index 634bc80..3657297 100644 --- a/mktrayicon.c +++ b/mktrayicon.c @@ -33,8 +33,9 @@ char* strncpy_esc(char *dest, const char *src, size_t n) i++; } } - for ( ; index < n; index++) + for ( ; index < n; index++){ dest[index] = '\0'; + } return dest; } @@ -74,9 +75,11 @@ void tray_icon_on_click(GtkStatusIcon *status_icon, void click_menu_item(GtkMenuItem *menuitem, gpointer user_data) { const char* label = gtk_menu_item_get_label(menuitem); - for (int i = 0; i < menusize; i++) - if(strcmp(label,onmenu[i].name) == 0 && fork() == 0) + for (int i = 0; i < menusize; i++){ + if(strcmp(label,onmenu[i].name) == 0 && fork() == 0){ execl("/bin/sh", "sh", "-c", onmenu[i].action, (char *) NULL); + } + } } void tray_icon_on_menu(GtkStatusIcon *status_icon, guint button, @@ -85,8 +88,9 @@ void tray_icon_on_menu(GtkStatusIcon *status_icon, guint button, #ifdef DEBUG printf("Popup menu\n"); #endif - if (menusize) + if (menusize){ gtk_menu_popup_at_pointer((GtkMenu *)menu, NULL); + } } gboolean set_tooltip(gpointer data) @@ -330,8 +334,9 @@ gpointer watch_fifo(gpointer argv) menusize = 0; - if(!param) + if(!param){ break; + } else if (*param == '\0') { #ifdef DEBUG printf("Removing onmenu handler\n"); @@ -347,8 +352,9 @@ gpointer watch_fifo(gpointer argv) for (int i = 0; i < len; i++){ if (param[i] == ',' && param[i-1] != '\\'){ straight++; - if(straight == 2) + if(straight == 2){ break; + } } else if (param[i] == '|' && param[i-1] != '\\' ){ straight = 0; @@ -411,7 +417,7 @@ gpointer watch_fifo(gpointer argv) break; default: fprintf(stderr, "Unknown command: '%c'\n", *buf); - if (param != NULL) { + if (param != NULL){ free(param); } } |