diff options
-rw-r--r-- | ChangeLog.adoc | 1 | ||||
-rw-r--r-- | doc/de/autogen/plugin_api/hdata.adoc | 3 | ||||
-rw-r--r-- | doc/en/autogen/plugin_api/hdata.adoc | 3 | ||||
-rw-r--r-- | doc/fr/autogen/plugin_api/hdata.adoc | 3 | ||||
-rw-r--r-- | doc/it/autogen/plugin_api/hdata.adoc | 3 | ||||
-rw-r--r-- | doc/ja/autogen/plugin_api/hdata.adoc | 3 | ||||
-rw-r--r-- | doc/pl/autogen/plugin_api/hdata.adoc | 3 | ||||
-rw-r--r-- | src/gui/gui-bar-window.c | 46 |
8 files changed, 62 insertions, 3 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 68ac5a4f1..2c940d393 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -20,6 +20,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] New features:: + * api: allow update of variables "scroll_x" and "scroll_y" in bar_window with function hdata_update * api: add functions config_option_get_string() and hdata_compare() * buflist: add keys kbd:[F1]/kbd:[F2], kbd:[Alt+F1]/kbd:[Alt+F2] to scroll the buflist bar diff --git a/doc/de/autogen/plugin_api/hdata.adoc b/doc/de/autogen/plugin_api/hdata.adoc index 5653e1b7c..2ff83d495 100644 --- a/doc/de/autogen/plugin_api/hdata.adoc +++ b/doc/de/autogen/plugin_api/hdata.adoc @@ -457,6 +457,9 @@ _gui_objects_ (pointer) + _prev_bar_window_ (pointer, hdata: "bar_window") + _next_bar_window_ (pointer, hdata: "bar_window") + +*Update erlaubt:* + + _scroll_x_ (integer) + + _scroll_y_ (integer) + | weechat | [[hdata_buffer]]<<hdata_buffer,buffer>> diff --git a/doc/en/autogen/plugin_api/hdata.adoc b/doc/en/autogen/plugin_api/hdata.adoc index ec0f24729..f31150142 100644 --- a/doc/en/autogen/plugin_api/hdata.adoc +++ b/doc/en/autogen/plugin_api/hdata.adoc @@ -457,6 +457,9 @@ _gui_objects_ (pointer) + _prev_bar_window_ (pointer, hdata: "bar_window") + _next_bar_window_ (pointer, hdata: "bar_window") + +*Update allowed:* + + _scroll_x_ (integer) + + _scroll_y_ (integer) + | weechat | [[hdata_buffer]]<<hdata_buffer,buffer>> diff --git a/doc/fr/autogen/plugin_api/hdata.adoc b/doc/fr/autogen/plugin_api/hdata.adoc index b402093a8..68c253bd1 100644 --- a/doc/fr/autogen/plugin_api/hdata.adoc +++ b/doc/fr/autogen/plugin_api/hdata.adoc @@ -457,6 +457,9 @@ _gui_objects_ (pointer) + _prev_bar_window_ (pointer, hdata: "bar_window") + _next_bar_window_ (pointer, hdata: "bar_window") + +*Mise à jour autorisée :* + + _scroll_x_ (integer) + + _scroll_y_ (integer) + | weechat | [[hdata_buffer]]<<hdata_buffer,buffer>> diff --git a/doc/it/autogen/plugin_api/hdata.adoc b/doc/it/autogen/plugin_api/hdata.adoc index 25b53fb8c..b97c80caf 100644 --- a/doc/it/autogen/plugin_api/hdata.adoc +++ b/doc/it/autogen/plugin_api/hdata.adoc @@ -457,6 +457,9 @@ _gui_objects_ (pointer) + _prev_bar_window_ (pointer, hdata: "bar_window") + _next_bar_window_ (pointer, hdata: "bar_window") + +*Update allowed:* + + _scroll_x_ (integer) + + _scroll_y_ (integer) + | weechat | [[hdata_buffer]]<<hdata_buffer,buffer>> diff --git a/doc/ja/autogen/plugin_api/hdata.adoc b/doc/ja/autogen/plugin_api/hdata.adoc index 29e0a79c6..604ad7d68 100644 --- a/doc/ja/autogen/plugin_api/hdata.adoc +++ b/doc/ja/autogen/plugin_api/hdata.adoc @@ -457,6 +457,9 @@ _gui_objects_ (pointer) + _prev_bar_window_ (pointer, hdata: "bar_window") + _next_bar_window_ (pointer, hdata: "bar_window") + +*更新可能な変数:* + + _scroll_x_ (integer) + + _scroll_y_ (integer) + | weechat | [[hdata_buffer]]<<hdata_buffer,buffer>> diff --git a/doc/pl/autogen/plugin_api/hdata.adoc b/doc/pl/autogen/plugin_api/hdata.adoc index 6e31e9547..c814b32be 100644 --- a/doc/pl/autogen/plugin_api/hdata.adoc +++ b/doc/pl/autogen/plugin_api/hdata.adoc @@ -457,6 +457,9 @@ _gui_objects_ (pointer) + _prev_bar_window_ (pointer, hdata: "bar_window") + _next_bar_window_ (pointer, hdata: "bar_window") + +*Aktualizacja dozwolona:* + + _scroll_x_ (integer) + + _scroll_y_ (integer) + | weechat | [[hdata_buffer]]<<hdata_buffer,buffer>> diff --git a/src/gui/gui-bar-window.c b/src/gui/gui-bar-window.c index a773a226b..154f1dc27 100644 --- a/src/gui/gui-bar-window.c +++ b/src/gui/gui-bar-window.c @@ -30,6 +30,7 @@ #include "../core/weechat.h" #include "../core/wee-config.h" +#include "../core/wee-hashtable.h" #include "../core/wee-hdata.h" #include "../core/wee-infolist.h" #include "../core/wee-log.h" @@ -1520,6 +1521,45 @@ gui_bar_window_scroll (struct t_gui_bar_window *bar_window, } /* + * Callback for updating data of a bar window. + */ + +int +gui_bar_window_update_cb (void *data, struct t_hdata *hdata, void *pointer, + struct t_hashtable *hashtable) +{ + const char *value; + int rc; + + /* make C compiler happy */ + (void) data; + + rc = 0; + + if (hashtable_has_key (hashtable, "scroll_x")) + { + value = hashtable_get (hashtable, "scroll_x"); + if (value) + { + hdata_set (hdata, pointer, "scroll_x", value); + rc++; + } + } + + if (hashtable_has_key (hashtable, "scroll_y")) + { + value = hashtable_get (hashtable, "scroll_y"); + if (value) + { + hdata_set (hdata, pointer, "scroll_y", value); + rc++; + } + } + + return rc; +} + +/* * Returns hdata for bar window. */ @@ -1534,7 +1574,7 @@ gui_bar_window_hdata_bar_window_cb (const void *pointer, void *data, (void) data; hdata = hdata_new (NULL, hdata_name, "prev_bar_window", "next_bar_window", - 0, 0, NULL, NULL); + 0, 0, &gui_bar_window_update_cb, NULL); if (hdata) { HDATA_VAR(struct t_gui_bar_window, bar, POINTER, 0, NULL, "bar"); @@ -1542,8 +1582,8 @@ gui_bar_window_hdata_bar_window_cb (const void *pointer, void *data, HDATA_VAR(struct t_gui_bar_window, y, INTEGER, 0, NULL, NULL); HDATA_VAR(struct t_gui_bar_window, width, INTEGER, 0, NULL, NULL); HDATA_VAR(struct t_gui_bar_window, height, INTEGER, 0, NULL, NULL); - HDATA_VAR(struct t_gui_bar_window, scroll_x, INTEGER, 0, NULL, NULL); - HDATA_VAR(struct t_gui_bar_window, scroll_y, INTEGER, 0, NULL, NULL); + HDATA_VAR(struct t_gui_bar_window, scroll_x, INTEGER, 1, NULL, NULL); + HDATA_VAR(struct t_gui_bar_window, scroll_y, INTEGER, 1, NULL, NULL); HDATA_VAR(struct t_gui_bar_window, cursor_x, INTEGER, 0, NULL, NULL); HDATA_VAR(struct t_gui_bar_window, cursor_y, INTEGER, 0, NULL, NULL); HDATA_VAR(struct t_gui_bar_window, current_size, INTEGER, 0, NULL, NULL); |