From f6f6e09f79d90ecd5d1fc3d7ec4c6d06a006a3f3 Mon Sep 17 00:00:00 2001
From: Mooffie <mooffie@gmail.com>
Date: Thu, 21 Jan 2016 10:04:46 +0200
Subject: [PATCH 2/2] Split MSG_ACTION into MSG_ACTION and MSG_NOTIFY.
---
lib/widget/check.c | 2 +-
lib/widget/listbox.c | 2 +-
lib/widget/radio.c | 4 ++--
lib/widget/widget-common.h | 6 +++---
src/editor/editcmd.c | 2 +-
src/filemanager/boxes.c | 6 +++---
src/filemanager/chmod.c | 8 ++------
src/filemanager/find.c | 2 +-
src/filemanager/hotlist.c | 9 +--------
src/filemanager/layout.c | 2 +-
src/filemanager/panelize.c | 9 +--------
11 files changed, 17 insertions(+), 35 deletions(-)
diff --git a/lib/widget/check.c b/lib/widget/check.c
index 3ad7e05..65771dc 100644
a
|
b
|
check_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d |
76 | 76 | return MSG_NOT_HANDLED; |
77 | 77 | c->state ^= C_BOOL; |
78 | 78 | c->state ^= C_CHANGE; |
79 | | send_message (WIDGET (w)->owner, w, MSG_ACTION, 0, NULL); |
| 79 | send_message (WIDGET (w)->owner, w, MSG_NOTIFY, 0, NULL); |
80 | 80 | send_message (w, sender, MSG_FOCUS, ' ', data); |
81 | 81 | return MSG_HANDLED; |
82 | 82 | |
diff --git a/lib/widget/listbox.c b/lib/widget/listbox.c
index 9d8e965..38e9ac6 100644
a
|
b
|
static void |
391 | 391 | listbox_on_change (WListbox * l) |
392 | 392 | { |
393 | 393 | listbox_draw (l, TRUE); |
394 | | send_message (WIDGET (l)->owner, l, MSG_ACTION, l->pos, NULL); |
| 394 | send_message (WIDGET (l)->owner, l, MSG_NOTIFY, l->pos, NULL); |
395 | 395 | } |
396 | 396 | |
397 | 397 | /* --------------------------------------------------------------------------------------------- */ |
diff --git a/lib/widget/radio.c b/lib/widget/radio.c
index f40570e..b206f50 100644
a
|
b
|
radio_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d |
85 | 85 | { |
86 | 86 | case ' ': |
87 | 87 | r->sel = r->pos; |
88 | | send_message (w->owner, w, MSG_ACTION, 0, NULL); |
| 88 | send_message (w->owner, w, MSG_NOTIFY, 0, NULL); |
89 | 89 | send_message (w, sender, MSG_FOCUS, ' ', data); |
90 | 90 | return MSG_HANDLED; |
91 | 91 | |
… |
… |
radio_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d |
110 | 110 | } |
111 | 111 | |
112 | 112 | case MSG_CURSOR: |
113 | | send_message (w->owner, w, MSG_ACTION, 0, NULL); |
| 113 | send_message (w->owner, w, MSG_NOTIFY, 0, NULL); |
114 | 114 | send_message (w, sender, MSG_FOCUS, ' ', data); |
115 | 115 | widget_move (r, r->pos, 1); |
116 | 116 | return MSG_HANDLED; |
diff --git a/lib/widget/widget-common.h b/lib/widget/widget-common.h
index 0398a1e..57fb984 100644
a
|
b
|
typedef enum |
33 | 33 | MSG_HOTKEY_HANDLED, /* A widget has got the hotkey */ |
34 | 34 | MSG_UNHANDLED_KEY, /* Key that no widget handled */ |
35 | 35 | MSG_POST_KEY, /* The key has been handled */ |
36 | | MSG_ACTION, /* Send to widget to handle command or |
37 | | * state of check- and radiobuttons has changed |
38 | | * and listbox current entry has changed */ |
| 36 | MSG_ACTION, /* Send to widget to handle command */ |
| 37 | MSG_NOTIFY, /* Typically sent to dialog to inform it of state-change |
| 38 | * of listboxes, check- and radiobuttons. */ |
39 | 39 | MSG_CURSOR, /* Sent to widget to position the cursor */ |
40 | 40 | MSG_IDLE, /* The idle state is active */ |
41 | 41 | MSG_RESIZE, /* Screen size has changed */ |
diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c
index 0d2d6e1..0c8dfd6 100644
a
|
b
|
edit_save_mode_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm |
160 | 160 | { |
161 | 161 | switch (msg) |
162 | 162 | { |
163 | | case MSG_ACTION: |
| 163 | case MSG_NOTIFY: |
164 | 164 | if (sender != NULL && sender->id == edit_save_mode_radio_id) |
165 | 165 | { |
166 | 166 | Widget *ww; |
diff --git a/src/filemanager/boxes.c b/src/filemanager/boxes.c
index 1860735..fef947a 100644
a
|
b
|
configure_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, voi |
129 | 129 | { |
130 | 130 | switch (msg) |
131 | 131 | { |
132 | | case MSG_ACTION: |
| 132 | case MSG_NOTIFY: |
133 | 133 | /* message from "Single press" checkbutton */ |
134 | 134 | if (sender != NULL && sender->id == configure_old_esc_mode_id) |
135 | 135 | { |
… |
… |
panel_listing_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, |
306 | 306 | } |
307 | 307 | return MSG_NOT_HANDLED; |
308 | 308 | |
309 | | case MSG_ACTION: |
| 309 | case MSG_NOTIFY: |
310 | 310 | if (sender != NULL && sender->id == panel_listing_types_id) |
311 | 311 | { |
312 | 312 | WCheck *ch; |
… |
… |
confvfs_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void |
427 | 427 | { |
428 | 428 | switch (msg) |
429 | 429 | { |
430 | | case MSG_ACTION: |
| 430 | case MSG_NOTIFY: |
431 | 431 | /* message from "Always use ftp proxy" checkbutton */ |
432 | 432 | if (sender != NULL && sender->id == ftpfs_always_use_proxy_id) |
433 | 433 | { |
diff --git a/src/filemanager/chmod.c b/src/filemanager/chmod.c
index b51ce40..715e457 100644
a
|
b
|
chmod_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d |
220 | 220 | |
221 | 221 | switch (msg) |
222 | 222 | { |
223 | | case MSG_ACTION: |
| 223 | case MSG_NOTIFY: |
224 | 224 | { |
225 | 225 | /* handle checkboxes */ |
226 | 226 | int i; |
227 | 227 | |
228 | | /* close dialog due to SIGINT (ctrl-g) */ |
229 | | if (sender == NULL && parm == CK_Cancel) |
230 | | return MSG_NOT_HANDLED; |
231 | | |
232 | | /* whether action was sent by checkbox? */ |
| 228 | /* whether notification was sent by checkbox? */ |
233 | 229 | for (i = 0; i < check_perm_num; i++) |
234 | 230 | if (sender == WIDGET (check_perm[i].check)) |
235 | 231 | break; |
diff --git a/src/filemanager/find.c b/src/filemanager/find.c
index e0956d0..009f49e 100644
a
|
b
|
find_parm_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, voi |
428 | 428 | |
429 | 429 | switch (msg) |
430 | 430 | { |
431 | | case MSG_ACTION: |
| 431 | case MSG_NOTIFY: |
432 | 432 | if (sender == WIDGET (content_use_cbox)) |
433 | 433 | { |
434 | 434 | gboolean disable = !(content_use_cbox->state & C_BOOL); |
diff --git a/src/filemanager/hotlist.c b/src/filemanager/hotlist.c
index db96ce8..0a7edad 100644
a
|
b
|
hotlist_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void |
577 | 577 | switch (msg) |
578 | 578 | { |
579 | 579 | case MSG_INIT: |
| 580 | case MSG_NOTIFY: /* MSG_NOTIFY is fired by the listbox to tell us the item has changed. */ |
580 | 581 | update_path_name (); |
581 | 582 | return MSG_HANDLED; |
582 | 583 | |
… |
… |
hotlist_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void |
593 | 594 | dlg_set_size (h, LINES - (h == hotlist_dlg ? 2 : 6), COLS - 6); |
594 | 595 | return MSG_HANDLED; |
595 | 596 | |
596 | | case MSG_ACTION: |
597 | | if (sender == NULL) |
598 | | return MSG_NOT_HANDLED; |
599 | | |
600 | | /* The listbox tells us the item has changed. */ |
601 | | update_path_name (); |
602 | | return MSG_HANDLED; |
603 | | |
604 | 597 | default: |
605 | 598 | return dlg_default_callback (w, sender, msg, parm, data); |
606 | 599 | } |
diff --git a/src/filemanager/layout.c b/src/filemanager/layout.c
index cb4e1be..37e6878 100644
a
|
b
|
layout_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void * |
371 | 371 | } |
372 | 372 | return MSG_HANDLED; |
373 | 373 | |
374 | | case MSG_ACTION: |
| 374 | case MSG_NOTIFY: |
375 | 375 | if (sender == WIDGET (radio_widget)) |
376 | 376 | { |
377 | 377 | if (panels_layout.horizontal_split != radio_widget->sel) |
diff --git a/src/filemanager/panelize.c b/src/filemanager/panelize.c
index 8050244..5742fea 100644
a
|
b
|
panelize_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void |
113 | 113 | switch (msg) |
114 | 114 | { |
115 | 115 | case MSG_INIT: |
116 | | update_command (); |
117 | | return MSG_HANDLED; |
118 | | |
119 | | case MSG_ACTION: |
120 | | if (sender == NULL) |
121 | | return MSG_NOT_HANDLED; |
122 | | |
123 | | /* The listbox tells us the item has changed. */ |
| 116 | case MSG_NOTIFY: /* MSG_NOTIFY is fired by the listbox to tell us the item has changed. */ |
124 | 117 | update_command (); |
125 | 118 | return MSG_HANDLED; |
126 | 119 | |