<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">Hi Andre,<br>
<br>
Thanks for your reply.<br>
<br>
I'm not at all skilled for GUI yet.<br>
<br>
As I was mostly hacking the history.c I met max-menu-items soon
enough, and it was my bound to keep the behavior of rotating item
it the history. So I reused this limit to set the size of my
indexes too. Remember that I don't save item to disk (which is
still available of course) so I disable it via the visual
settings GUI.<br>
<br>
<blockquote type="cite">max-texts-in-history that I think is about
the number of items not bytes.</blockquote>
Yes max-texts-in-history is in fact the total length of items the
history in memory (items size in bytes doesn't matter), where the
list was truncated in _clipman_history_add_item().<br>
This was including image too, image are counted as part to the
max-texts-in-history.<br>
<br>
I figured this one correctly, and I refactored all that code with
my new data structure (double linked list + indexes).<br>
With my new understanding of history save, I realize now, that the
truncate was to handle resizing (in memory). I did it differently
because of the indexes.<br>
That's why I want to play with the history size value:
max-texts-in-history<br>
<br>
Now that I'm testing to enlarge and shrink my new implementation
of the history in memory, it confuses me because the visual
settings in clipman 1.6 history tab, is all linked to the
"Remember history" switch. Which is not what the code do with most
of the values in the history tab:<br>
<br>
- Reorder history items<br>
- Reverse history order<br>
- Ignore mouses selection<br>
- Size of the history:<br>
<br>
Are all used at runtime with or without saving the history to the
disk, at least in history.c.<br>
<br>
So may be my question becomes:<br>
<br>
How do I break the GUI link of the "Remember history" switch and
the greyed of gtk items on the history tab?<br>
I would like to extract "Size of the history:" from the greyed
behavior.<br>
<br>
I saw that settings-dialog.ui was edited by glade, so I installed
glade + ui related stuff, I opened the .ui file and find the
history tab.<br>
I need to learn glade I think before, because I'm unable to insert
an new gtkblock to just hold "Size of the history:" outside of the
actual bloc.<br>
<br>
<img src="cid:part1.FD3FEBE0.769B178D@opensource-expert.com"
alt="" moz-do-not-send="false" width="425" height="257"
border="1"><br>
<br>
In the mean time in order to test my code on resize I will add an
new dbus method for that, because I handle that part pretty well
now. It wont skill up my GUI knowledge but would be faster to put
in place for me. 😉<br>
<br>
I will also deep into the on disk history saving code to figure
out how its behavior depend of such settings.<br>
<br>
Regards,<br>
Sylvain.<br>
<br>
On 01/10/2021 00:11, <a class="moz-txt-link-abbreviated" href="mailto:andre@andreldm.com">andre@andreldm.com</a> wrote:<br>
</div>
<blockquote type="cite" cite="mid:MkskipT--3-2@andreldm.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div>Hi Sylvain,<br>
</div>
<div dir="auto">As the original author doesn't hang around
anymore, I think Simon is the current maintainer, in any case
the source code is the best reference.<br>
</div>
<div><br>
</div>
<div dir="auto">I think your understanding of max-menu-items is
correct, just to be sure, only max-texts-in-history that I think
is about the number of items not bytes. Also notice in
_clipman_history_add_item that it is used to truncated the
in-memory list of all items, including images. With regards to
writing to disk, yes the items history is persisted/loaded if
"save-on-quit" is enabled.<br>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">Well, I don't know how this impacts your
implementation, but I hope this helps.<br>
</div>
<div dir="auto"><br>
</div>
<div>Cheers,<br>
</div>
<div>Andre Miranda<br>
</div>
<div><br>
</div>
<div>Sep 29, 2021, 03:33 by <a class="moz-txt-link-abbreviated" href="mailto:sylvain@opensource-expert.com">sylvain@opensource-expert.com</a>:<br>
</div>
<blockquote class="tutanota_quote" style="border-left: 1px solid
#93A3B8; padding-left: 10px; margin-left: 5px;">
<div>Hi,<br>
</div>
<div> <br>
</div>
<div> I'm trying to figure out the purpose of max-menu-items vs
the max-texts-in-history?<br>
</div>
<div> <br>
</div>
<div> I'm modifying the code of clipman to handle Secure Item,
this fork <a
href="https://gitlab.xfce.org/Sylvain/xfce4-clipman-plugin"
rel="noopener noreferrer" target="_blank"
moz-do-not-send="true">https://gitlab.xfce.org/Sylvain/xfce4-clipman-plugin</a><br>
</div>
<div> I'm planing to submit a merge request for future version
of clipman, as my use of the PoC is satisfying.<br>
</div>
<div> <br>
</div>
<div> So during my journey in the code, it brings me to
extensively modifying the way items are stored in memory,
still not altering the existing behavior.<br>
</div>
<div> I disabled saving history to disk which is obviously not
compatible with secret non-disclosure.<br>
</div>
<div> <br>
</div>
<div> So the memory data structure in my fork has been changed
to a GList double linked list + I'm crafting a circular
Indexes array to handle my <br>
</div>
<div> newly introduced index / ID on the stored item. So they
can be delete any item from history with an external cli by
index: ./clipman_cli.sh del 12<br>
</div>
<div> <br>
</div>
<div> The goal here was to avoid secret disclosure.<br>
</div>
<div> <br>
</div>
<div> I decided to keep indexes in a circular buffer of the same
size of the history (max-texts-in-history).<br>
</div>
<div> The indexes are kept to low ID values because I use them
in the preview of Secure Item: "🔐 SECURE %2d *********",
item->id<br>
</div>
<div> My history size in memory is generally of 40 or 50 items,
and I generally handle at most 4 or 5 Secure Item in the
history at the same time.<br>
</div>
<div> Some Secure Item are ephemeral so are going out quite
quickly. Keeping ID low also helps human to figure out which
secret is the one hidden in the history.<br>
</div>
<div> <br>
</div>
<div> I'm actually finalizing my circular buffer code and
handling history size change enlarge / shrink the history.<br>
</div>
<div> <br>
</div>
<div> But I'm discovering the distinct behavior or those two max
values: max-texts-in-history / max-menu-items<br>
</div>
<div> <br>
</div>
<div> To what I understand:<br>
</div>
<div> <br>
</div>
<ul>
<li>max-menu-items is a visual limitation in the popup menu<br>
</li>
<li>max-texts-in-history is the actual history size in memory
(may be also on disk, I didn't explore this part, as it was
not involved in my changes)<br>
</li>
</ul>
<div><br>
</div>
<div>in clipman 1.6 the max-texts-in-history is set with this
visual interface:<br>
</div>
<div> <br>
</div>
<div> <img alt="" class=""
src="cid:part2.D480F5A9.FC497D1B@opensource-expert.com"
moz-do-not-send="true"><br>
</div>
<div> <br>
</div>
<div> Which is greyed as I disabled it in my use case.<br>
</div>
<div> <br>
</div>
<div> So what is exactly the purpose of max-texts-in-history? <br>
</div>
<div> Should I use this value for my in memory history size or
should I use a different size matching max-menu-items?<br>
</div>
<div> <br>
</div>
<div> Regards,<br>
</div>
<div> Sylvain.<br>
</div>
</blockquote>
</blockquote>
<pre class="moz-signature" cols="72">--
Sylvain Viart - GNU/Linux Sysadmin/Developer/DevOps - France</pre>
</body>
</html>