Added --no-actions
This commit is contained in:
parent
f00b615f11
commit
d6bac0e7bb
16
src/main.c
16
src/main.c
@ -73,6 +73,7 @@ static void print_usage(char** argv) {
|
|||||||
printf("--parse-search\t-q\tParses the search text removing image escapes and pango\n");
|
printf("--parse-search\t-q\tParses the search text removing image escapes and pango\n");
|
||||||
printf("--version\t-v\tPrints the version and then exits\n");
|
printf("--version\t-v\tPrints the version and then exits\n");
|
||||||
printf("--location\t-l\tSets the location\n");
|
printf("--location\t-l\tSets the location\n");
|
||||||
|
printf("--no-actions\t-a\tDisables multiple actions for modes that support it\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,6 +333,12 @@ int main(int argc, char** argv) {
|
|||||||
.flag = NULL,
|
.flag = NULL,
|
||||||
.val = 'l'
|
.val = 'l'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.name = "no-actions",
|
||||||
|
.has_arg = required_argument,
|
||||||
|
.flag = NULL,
|
||||||
|
.val = 'a'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.name = NULL,
|
.name = NULL,
|
||||||
.has_arg = 0,
|
.has_arg = 0,
|
||||||
@ -361,8 +368,9 @@ int main(int argc, char** argv) {
|
|||||||
char* insensitive = NULL;
|
char* insensitive = NULL;
|
||||||
char* parse_search = NULL;
|
char* parse_search = NULL;
|
||||||
char* location = NULL;
|
char* location = NULL;
|
||||||
|
char* no_actions = NULL;
|
||||||
int opt;
|
int opt;
|
||||||
while((opt = getopt_long(argc, argv, "hfc:s:C:dS:W:H:p:x:y:nImk:t:P::ebM:iqvl:", opts, NULL)) != -1) {
|
while((opt = getopt_long(argc, argv, "hfc:s:C:dS:W:H:p:x:y:nImk:t:P::ebM:iqvl:a", opts, NULL)) != -1) {
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
case 'h':
|
case 'h':
|
||||||
print_usage(argv);
|
print_usage(argv);
|
||||||
@ -445,6 +453,9 @@ int main(int argc, char** argv) {
|
|||||||
case 'l':
|
case 'l':
|
||||||
location = optarg;
|
location = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'a':
|
||||||
|
no_actions = "true";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -593,6 +604,9 @@ int main(int argc, char** argv) {
|
|||||||
if(location != NULL) {
|
if(location != NULL) {
|
||||||
map_put(config, "location", location);
|
map_put(config, "location", location);
|
||||||
}
|
}
|
||||||
|
if(no_actions != NULL) {
|
||||||
|
map_put(config, "no_actions", no_actions);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
gtk_init(&argc, &argv);
|
gtk_init(&argc, &argv);
|
||||||
|
@ -60,6 +60,7 @@ static bool parse_search;
|
|||||||
static GtkAlign content_halign;
|
static GtkAlign content_halign;
|
||||||
static struct map* config;
|
static struct map* config;
|
||||||
static enum locations location;
|
static enum locations location;
|
||||||
|
static bool no_actions;
|
||||||
|
|
||||||
struct node {
|
struct node {
|
||||||
size_t action_count;
|
size_t action_count;
|
||||||
@ -356,7 +357,7 @@ static void expand(GtkExpander* expander, gpointer data) {
|
|||||||
static gboolean _insert_widget(gpointer data) {
|
static gboolean _insert_widget(gpointer data) {
|
||||||
struct node* node = data;
|
struct node* node = data;
|
||||||
GtkWidget* parent;
|
GtkWidget* parent;
|
||||||
if(node->action_count > 1) {
|
if(node->action_count > 1 && !no_actions) {
|
||||||
parent = gtk_expander_new("");
|
parent = gtk_expander_new("");
|
||||||
g_signal_connect(parent, "activate", G_CALLBACK(expand), NULL);
|
g_signal_connect(parent, "activate", G_CALLBACK(expand), NULL);
|
||||||
GtkWidget* box = create_label(node->mode, node->text[0], node->search_text, node->actions[0]);
|
GtkWidget* box = create_label(node->mode, node->text[0], node->search_text, node->actions[0]);
|
||||||
@ -842,6 +843,7 @@ void wofi_init(struct map* _config) {
|
|||||||
location = config_get_mnemonic(config, "location", "center", 18,
|
location = config_get_mnemonic(config, "location", "center", 18,
|
||||||
"center", "top_left", "top", "top_right", "right", "bottom_right", "bottom", "bottom_left", "left",
|
"center", "top_left", "top", "top_right", "right", "bottom_right", "bottom", "bottom_left", "left",
|
||||||
"0", "1", "2", "3", "4", "5", "6", "7", "8");
|
"0", "1", "2", "3", "4", "5", "6", "7", "8");
|
||||||
|
no_actions = strcmp(config_get(config, "no_actions", "false"), "true") == 0;
|
||||||
modes = map_init_void();
|
modes = map_init_void();
|
||||||
|
|
||||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
|
Loading…
Reference in New Issue
Block a user