master #38

Merged
asmeron merged 40 commits from YanTheKaller/libublsettingsui-gtk3:master into master 8 months ago

@ -6,6 +6,8 @@
<file>libublsettingsui-gtk3-documentation.glade</file>
<file>libublsettingsui-gtk3-saving.glade</file>
<file>libublsettingsui-gtk3-debugger.glade</file>
<file>libublsettingsui-gtk3-filechooser.glade</file>
<file>libublsettingsui-gtk3-config-window.glade</file>
</gresource>
<gresource prefix="/com/ublinux/css">
<file>libublsettingsui-gtk3.css</file>

@ -5,8 +5,8 @@
version="1.1"
viewBox="0 0 24 24"
id="svg25"
sodipodi:docname="checked.svg"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)"
sodipodi:docname="com.ublinux.libublsettingsui-gtk3.checked.svg"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
@ -21,14 +21,16 @@
inkscape:pagecheckerboard="0"
showgrid="false"
inkscape:zoom="14.8125"
inkscape:cx="-4.6919831"
inkscape:cx="-4.6582278"
inkscape:cy="9.9578059"
inkscape:window-width="1920"
inkscape:window-height="1027"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg25" />
inkscape:window-width="1631"
inkscape:window-height="1047"
inkscape:window-x="1966"
inkscape:window-y="17"
inkscape:window-maximized="0"
inkscape:current-layer="svg25"
inkscape:showpageshadow="2"
inkscape:deskcolor="#d1d1d1" />
<defs
id="defs19">
<style
@ -322,6 +324,6 @@
</defs>
<path
id="path21"
d="M 12 1 C 5.906 1 1 5.906 1 12 C 1 18.094 5.906 23 12 23 C 18.094 23 23 18.094 23 12 C 23 5.906 18.094 1 12 1 z M 15.480469 8.9042969 C 16.392469 8.8782969 16.860031 9.9850937 16.207031 10.621094 L 11 15.828125 L 8.09375 12.921875 C 7.11175 11.979875 8.5648125 10.525813 9.5078125 11.507812 L 11 13 L 14.792969 9.2070312 A 1 1 0 0 1 15.480469 8.9042969 z "
style="fill:#4d4d4d;fill-opacity:1" />
d="M 11.999999,0 C 5.352,0 0,5.3519999 0,11.999999 0,18.648 5.352,24 11.999999,24 18.648,24 24,18.648 24,11.999999 24,5.3519999 18.648,0 11.999999,0 Z m 3.796875,8.6228693 c 0.994911,-0.028364 1.504978,1.1790511 0.792614,1.8728697 L 10.909093,16.176136 7.7386363,13.005681 C 6.6673637,11.978045 8.2525227,10.391796 9.2812501,11.463067 l 1.6278429,1.627842 4.137781,-4.1377841 a 1.0909093,1.0909091 0 0 1 0.75,-0.3302556 z"
style="fill:#4d4d4d;fill-opacity:1;stroke-width:1.09092" />
</svg>

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

@ -1 +1,37 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"/></svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
viewBox="0 0 512 512"
version="1.1"
id="svg1"
sodipodi:docname="com.ublinux.libublsettingsui-gtk3.important-symbolic.svg"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs1" />
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="1.6191406"
inkscape:cx="256.30881"
inkscape:cy="256"
inkscape:window-width="1631"
inkscape:window-height="1047"
inkscape:window-x="2128"
inkscape:window-y="27"
inkscape:window-maximized="0"
inkscape:current-layer="svg1" />
<!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. -->
<path
d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"
id="path1"
style="fill:#4d4d4d;fill-opacity:1" />
</svg>

Before

Width:  |  Height:  |  Size: 543 B

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -3,8 +3,8 @@
viewBox="0 0 24 24"
id="svg2"
version="1.1"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)"
sodipodi:docname="warning.svg"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)"
sodipodi:docname="com.ublinux.libublsettingsui-gtk3.warning.svg"
width="24"
height="24"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
@ -37,19 +37,21 @@
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1027"
inkscape:window-height="1056"
id="namedview8"
showgrid="false"
inkscape:zoom="18.96875"
inkscape:cx="5.4827018"
inkscape:cy="9.3047776"
inkscape:cx="5.509061"
inkscape:cy="9.3311367"
inkscape:current-layer="svg2"
inkscape:pagecheckerboard="0"
inkscape:window-x="0"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1" />
inkscape:window-maximized="1"
inkscape:showpageshadow="2"
inkscape:deskcolor="#d1d1d1" />
<path
id="path4136-2"
style="opacity:1;fill:#4d4d4d;fill-opacity:1"
d="M 11.292969 1.0234375 A 11 11.000002 86.311656 0 0 1.0234375 12.707031 A 11 11.000002 86.311656 0 0 12.707031 22.976562 A 11 11.000002 86.311656 0 0 22.976562 11.292969 A 11 11.000002 86.311656 0 0 11.292969 1.0234375 z M 11.996094 6 L 12.003906 6 C 12.556173 6 13 6.4439 13 6.9960938 L 13 14.003906 C 13 14.556325 12.556173 15 12.003906 15 L 11.996094 15 C 11.443827 15 11 14.556325 11 14.003906 L 11 6.9960938 C 11 6.4439 11.443827 6 11.996094 6 z M 12 17 C 12.554 17 13 17.446 13 18 C 13 18.554 12.554 19 12 19 C 11.446 19 11 18.554 11 18 C 11 17.446 11.446 17 12 17 z " />
style="opacity:1;fill:#4d4d4d;fill-opacity:1;stroke-width:1.09098"
d="M 11.228642,0.02476996 A 12.0008,12.000802 85.725865 0 0 0.02477012,12.771358 12.0008,12.000802 85.725865 0 0 12.771358,23.97523 12.0008,12.000802 85.725865 0 0 23.97523,11.228642 12.0008,12.000802 85.725865 0 0 11.228642,0.02476996 Z m 0.767097,5.42933924 h 0.0085 c 0.602513,0 1.08672,0.4842868 1.08672,1.0867202 v 7.6453956 c 1.3e-5,0.602679 -0.484194,1.086721 -1.086707,1.086721 h -0.0085 c -0.602526,0 -1.086734,-0.484042 -1.086734,-1.086721 V 6.5408294 c 0,-0.6024334 0.484208,-1.0867202 1.086721,-1.0867202 z m 0.0043,12.0007998 c 0.604404,0 1.090982,0.486578 1.090982,1.090982 0,0.604404 -0.486578,1.090982 -1.090982,1.090982 -0.604404,0 -1.090982,-0.486578 -1.090982,-1.090982 0,-0.604404 0.486578,-1.090982 1.090982,-1.090982 z" />
</svg>

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface domain="libublsettingsui-gtk3">
<requires lib="gtk+" version="3.24"/>
<!-- interface-css-provider-path libublsettingsui-gtk3.css -->
<object class="GtkWindow" id="Window">
<property name="width-request">450</property>
<property name="height-request">200</property>
<property name="can-focus">False</property>
<property name="icon-name">com.ublinux.libublsettingsui-gtk3</property>
<property name="type-hint">dialog</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkBox" id="StatusBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-bottom">5</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkBox" id="WorkZoneBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="show-close-button">True</property>
<child type="title">
<object class="GtkLabel" id="HeaderTopic">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Application settigs</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
<child>
<object class="GtkImage" id="HeaderImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">32</property>
<property name="icon-name">com.ublinux.libublsettingsui-gtk3</property>
</object>
</child>
<style>
<class name="toolbar"/>
</style>
</object>
</child>
</object>
<object class="GtkListStore" id="liststore1">
<columns>
<!-- column-name Active -->
<column type="gboolean"/>
<!-- column-name Parameter -->
<column type="gchararray"/>
<!-- column-name OldValue -->
<column type="gchararray"/>
<!-- column-name NewValue -->
<column type="gchararray"/>
<!-- column-name CompareString -->
<column type="gchararray"/>
<!-- column-name Color -->
<column type="gchararray"/>
<!-- column-name Show -->
<column type="gboolean"/>
<!-- column-name Section -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="liststore1fwe">
<columns>
<!-- column-name Active -->
<column type="gboolean"/>
<!-- column-name Parameter -->
<column type="gchararray"/>
<!-- column-name OldValue -->
<column type="gchararray"/>
<!-- column-name NewValue -->
<column type="gchararray"/>
<!-- column-name CompareString -->
<column type="gchararray"/>
<!-- column-name Color -->
<column type="gchararray"/>
<!-- column-name Show -->
<column type="gboolean"/>
<!-- column-name SaveCommand -->
<column type="gchararray"/>
</columns>
</object>
</interface>

@ -2,6 +2,22 @@
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">com.ublinux.libublsettingsui-gtk3.cancel-symbolic</property>
<style>
<class name="marginright"/>
</style>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">com.ublinux.libublsettingsui-gtk3.accept-symbolic</property>
<style>
<class name="marginright"/>
</style>
</object>
<object class="GtkWindow" id="Window">
<property name="width-request">450</property>
<property name="height-request">500</property>
@ -14,7 +30,6 @@
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkBox" id="StatusBox">
<property name="visible">True</property>
@ -34,15 +49,10 @@
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-bottom">5</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkFileChooserWidget">
<object class="GtkFileChooserWidget" id="MainFileChooser">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="create-folders">False</property>
@ -54,6 +64,22 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="ChooseFolderCheck">
<property name="label" translatable="yes">Choose directory instead of file</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="halign">end</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack-type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
@ -67,7 +93,6 @@
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="show-close-button">True</property>
<child type="title">
<object class="GtkLabel" id="HeaderTopic">
<property name="visible">True</property>
@ -103,7 +128,7 @@
</child>
<child>
<object class="GtkButton" id="SaveButton">
<property name="label" translatable="yes">Save</property>
<property name="label" translatable="yes">Load</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
@ -123,20 +148,4 @@
</object>
</child>
</object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">com.ublinux.libublsettingsui-gtk3.cancel-symbolic</property>
<style>
<class name="marginright"/>
</style>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">com.ublinux.libublsettingsui-gtk3.accept-symbolic</property>
<style>
<class name="marginright"/>
</style>
</object>
</interface>

@ -228,10 +228,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
</object>
<object class="GtkWindow" id="MainWindow">
<property name="width-request">640</property>
<property name="height-request">440</property>
<property name="can-focus">False</property>
<property name="default-width">1024</property>
<property name="default-height">720</property>
<property name="default-width">800</property>
<property name="default-height">500</property>
<property name="icon-name">com.ublinux.libublsettingsui-gtk3</property>
<child>
<object class="GtkBox">

@ -17,248 +17,280 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: source/libublsettingsui-gtk3.h:34
#: source/libublsettingsui-gtk3.h:299
msgid "Version:"
msgstr ""
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid " version:"
msgstr ""
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "Usage:"
msgstr ""
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "[OPTIONS]"
msgstr ""
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "Options:"
msgstr ""
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "Show this help"
msgstr ""
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "Show package version"
msgstr ""
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "Lock this help menu"
msgstr ""
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "Lock configuration saving"
msgstr ""
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "Lock local configration saving"
msgstr ""
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "Lock global configration saving"
msgstr ""
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "Lock global configration loading"
msgstr ""
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "Reset application settings"
msgstr ""
#: source/libublsettingsui-gtk3.h:40
#: source/libublsettingsui-gtk3.h:305
msgid "Operation succeeded"
msgstr ""
#: source/libublsettingsui-gtk3.h:41
#: source/libublsettingsui-gtk3.h:306
msgid ""
"Warning! Application was launched without root - root-dependent actions are "
"locked"
msgstr ""
#: source/libublsettingsui-gtk3.h:43
#: source/libublsettingsui-gtk3.h:308
msgid "Default"
msgstr ""
#: source/libublsettingsui-gtk3.h:309
msgid "About"
msgstr ""
#: source/libublsettingsui-gtk3.h:44
#: source/libublsettingsui-gtk3.h:310
msgid "Documentation"
msgstr ""
#: source/libublsettingsui-gtk3.h:46
#: source/libublsettingsui-gtk3.h:312
msgid "Save to specific file"
msgstr ""
#: source/libublsettingsui-gtk3.h:47
#: source/libublsettingsui-gtk3.h:313
msgid "Save to local configuration"
msgstr ""
#: source/libublsettingsui-gtk3.h:48
#: source/libublsettingsui-gtk3.h:314
msgid "Save to global configuration"
msgstr ""
#: source/libublsettingsui-gtk3.h:49
#: source/libublsettingsui-gtk3.h:315
msgid "Save configuration"
msgstr ""
#: source/libublsettingsui-gtk3.h:50
#: source/libublsettingsui-gtk3.h:316
msgid "Save"
msgstr ""
#: source/libublsettingsui-gtk3.h:51
#: source/libublsettingsui-gtk3.h:317
msgid "Saving..."
msgstr ""
#: source/libublsettingsui-gtk3.h:53
#: source/libublsettingsui-gtk3.h:319
msgid "Load from specific file"
msgstr ""
#: source/libublsettingsui-gtk3.h:54
#: source/libublsettingsui-gtk3.h:320
msgid "Load local configuration"
msgstr ""
#: source/libublsettingsui-gtk3.h:55
#: source/libublsettingsui-gtk3.h:321
msgid "Load global configuration"
msgstr ""
#: source/libublsettingsui-gtk3.h:56
#: source/libublsettingsui-gtk3.h:322
msgid "Load"
msgstr ""
#: source/libublsettingsui-gtk3.h:58
#: source/libublsettingsui-gtk3.h:324
msgid "Cancel"
msgstr ""
#: source/libublsettingsui-gtk3.h:59
#: source/libublsettingsui-gtk3.h:325
msgid "Accept"
msgstr ""
#: source/libublsettingsui-gtk3.h:60
#: source/libublsettingsui-gtk3.h:326
msgid "Open"
msgstr ""
#: source/libublsettingsui-gtk3.h:62
#: source/libublsettingsui-gtk3.h:328
msgid "Would you like to read documentation in the Web?"
msgstr ""
#: source/libublsettingsui-gtk3.h:63
#: source/libublsettingsui-gtk3.h:329
msgid ""
"You will be redirected to documentation website where documentation is\n"
"translated and supported by community."
msgstr ""
#: source/libublsettingsui-gtk3.h:64
#: source/libublsettingsui-gtk3.h:330
msgid "Always redirect to online documentation"
msgstr ""
#: source/libublsettingsui-gtk3.h:65
#: source/libublsettingsui-gtk3.h:331
msgid "Open documentation"
msgstr ""
#: source/libublsettingsui-gtk3.h:66
#: source/libublsettingsui-gtk3.h:332
msgid "Project Home Page"
msgstr ""
#: source/libublsettingsui-gtk3.h:67
#: source/libublsettingsui-gtk3.h:333
msgid "Nothing were chosen"
msgstr ""
#: source/libublsettingsui-gtk3.h:68
#: source/libublsettingsui-gtk3.h:334
msgid "Copyright © 2022 - 2023, UBSoft LLC"
msgstr ""
#: source/libublsettingsui-gtk3.h:71
#: source/libublsettingsui-gtk3.h:337
msgid "Global configuration loading succeeded."
msgstr ""
#: source/libublsettingsui-gtk3.h:72
#: source/libublsettingsui-gtk3.h:338
msgid "Local configuration loading succeeded."
msgstr ""
#: source/libublsettingsui-gtk3.h:73
#: source/libublsettingsui-gtk3.h:339
msgid "Config loading failed"
msgstr ""
#: source/libublsettingsui-gtk3.h:75
#: source/libublsettingsui-gtk3.h:341
msgid "Local and global configuration saving succeeded."
msgstr ""
#: source/libublsettingsui-gtk3.h:76
#: source/libublsettingsui-gtk3.h:342
msgid "Global configuration saving succeeded."
msgstr ""
#: source/libublsettingsui-gtk3.h:77
#: source/libublsettingsui-gtk3.h:343
msgid "Local configuration saving succeeded."
msgstr ""
#: source/libublsettingsui-gtk3.h:79
#: source/libublsettingsui-gtk3.h:344
msgid "Configuration saving succeeded."
msgstr ""
#: source/libublsettingsui-gtk3.h:346
msgid "Parameter"
msgstr ""
#: source/libublsettingsui-gtk3.h:80
#: source/libublsettingsui-gtk3.h:347
msgid "Old value"
msgstr ""
#: source/libublsettingsui-gtk3.h:81
#: source/libublsettingsui-gtk3.h:348
msgid "New value"
msgstr ""
#: source/libublsettingsui-gtk3.h:82
#: source/libublsettingsui-gtk3.h:349
msgid ""
"Value\n"
"(Old/New)"
msgstr ""
#: source/libublsettingsui-gtk3.h:84
#: source/libublsettingsui-gtk3.h:351
msgid "Nothing to save"
msgstr ""
#: source/libublsettingsui-gtk3.h:85
#: source/libublsettingsui-gtk3.h:352
msgid "Saving into local configuration"
msgstr ""
#: source/libublsettingsui-gtk3.h:86
#: source/libublsettingsui-gtk3.h:353
msgid "Saving into global configuration"
msgstr ""
#: source/libublsettingsui-gtk3.h:87
#: source/libublsettingsui-gtk3.h:354
msgid "Saving into global and local configuration"
msgstr ""
#: source/libublsettingsui-gtk3.h:88
#: source/libublsettingsui-gtk3.h:355
msgid "Saving into custom configuration at"
msgstr ""
#: source/libublsettingsui-gtk3.h:93
#: source/libublsettingsui-gtk3.h:360
msgid "Full saving mode"
msgstr ""
#: source/libublsettingsui-gtk3.h:94
#: source/libublsettingsui-gtk3.h:361
msgid "Saving into module"
msgstr ""
#: source/libublsettingsui-gtk3.h:95
#: source/libublsettingsui-gtk3.h:362
msgid "Sandbox mode"
msgstr ""
#: source/libublsettingsui-gtk3.h:96
#: source/libublsettingsui-gtk3.h:363
msgid "Sandbox with profile saving"
msgstr ""
#: source/libublsettingsui-gtk3.h:97
#: source/libublsettingsui-gtk3.h:364
msgid "HDD sandbox"
msgstr ""
#: source/libublsettingsui-gtk3.h:98
#: source/libublsettingsui-gtk3.h:365
msgid "HDD sandbox with profile saving"
msgstr ""
#: source/libublsettingsui-gtk3.h:99
#: source/libublsettingsui-gtk3.h:366
msgid "New configuration file creation failed"
msgstr ""
#: source/libublsettingsui-gtk3.h:100
#: source/libublsettingsui-gtk3.h:367
msgid "Upgrade to root"
msgstr ""
#: source/libublsettingsui-gtk3.h:368
msgid "Settings"
msgstr ""
#: source/libublsettingsui-gtk3.h:370
msgid "Application settigs"
msgstr ""
#: source/libublsettingsui-gtk3.h:372
msgid "Invalid email adress"
msgstr ""
#: source/libublsettingsui-gtk3.h:373
msgid "Invalid path"
msgstr ""
#: source/libublsettingsui-gtk3.h:375
msgid "Choose path"
msgstr ""
#: source/libublsettingsui-gtk3.h:377
msgid "Choose directory instead of file"
msgstr ""

@ -17,63 +17,63 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: source/libublsettingsui-gtk3.h:34
#: source/libublsettingsui-gtk3.h:299
msgid "Version:"
msgstr "Версия:"
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid " version:"
msgstr " версия:"
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "Usage:"
msgstr "Использование:"
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "[OPTIONS]"
msgstr "[АРГУМЕНТЫ]"
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "Options:"
msgstr "Аргументы:"
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "Show this help"
msgstr "Показать эту подсказку"
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "Show package version"
msgstr "Показать версию пакета"
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "Lock this help menu"
msgstr "Заблокировать это меню помощи"
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "Lock configuration saving"
msgstr "Успешно записана локальная конфигурация"
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "Lock local configration saving"
msgstr "Заблокировать сохранение локальной конфигурации"
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "Lock global configration saving"
msgstr "Заблокировать сохранение глобальной конфигурации"
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "Lock global configration loading"
msgstr "Заблокировать загрузку глобальную конфигурацию"
#: source/libublsettingsui-gtk3.h:35
#: source/libublsettingsui-gtk3.h:300
msgid "Reset application settings"
msgstr "Сбросить настройки программы"
#: source/libublsettingsui-gtk3.h:40
#: source/libublsettingsui-gtk3.h:305
msgid "Operation succeeded"
msgstr "Операция завершена"
#: source/libublsettingsui-gtk3.h:41
#: source/libublsettingsui-gtk3.h:306
msgid ""
"Warning! Application was launched without root - root-dependent actions are "
"locked"
@ -81,71 +81,75 @@ msgstr ""
"Внимание! Приложение было запущено без прав суперпользователя - действия, "
"требующие их наличия заблокированы"
#: source/libublsettingsui-gtk3.h:43
#: source/libublsettingsui-gtk3.h:308
msgid "Default"
msgstr "По умолчанию"
#: source/libublsettingsui-gtk3.h:309
msgid "About"
msgstr "О программе"
#: source/libublsettingsui-gtk3.h:44
#: source/libublsettingsui-gtk3.h:310
msgid "Documentation"
msgstr "Справка"
#: source/libublsettingsui-gtk3.h:46
#: source/libublsettingsui-gtk3.h:312
msgid "Save to specific file"
msgstr "Сохранить в файл"
#: source/libublsettingsui-gtk3.h:47
#: source/libublsettingsui-gtk3.h:313
msgid "Save to local configuration"
msgstr "Сохранить в локальную конфигурацию"
#: source/libublsettingsui-gtk3.h:48
#: source/libublsettingsui-gtk3.h:314
msgid "Save to global configuration"
msgstr "Сохранить в глобальную конфигурацию"
#: source/libublsettingsui-gtk3.h:49
#: source/libublsettingsui-gtk3.h:315
msgid "Save configuration"
msgstr "Сохранить конфигурацию"
#: source/libublsettingsui-gtk3.h:50
#: source/libublsettingsui-gtk3.h:316
msgid "Save"
msgstr "Сохранить"
#: source/libublsettingsui-gtk3.h:51
#: source/libublsettingsui-gtk3.h:317
msgid "Saving..."
msgstr "Сохранение..."
#: source/libublsettingsui-gtk3.h:53
#: source/libublsettingsui-gtk3.h:319
msgid "Load from specific file"
msgstr "Загрузить из файла"
#: source/libublsettingsui-gtk3.h:54
#: source/libublsettingsui-gtk3.h:320
msgid "Load local configuration"
msgstr "Загрузить локальную конфигурацию"
#: source/libublsettingsui-gtk3.h:55
#: source/libublsettingsui-gtk3.h:321
msgid "Load global configuration"
msgstr "Загрузить глобальную конфигурацию"
#: source/libublsettingsui-gtk3.h:56
#: source/libublsettingsui-gtk3.h:322
msgid "Load"
msgstr "Загрузить"
#: source/libublsettingsui-gtk3.h:58
#: source/libublsettingsui-gtk3.h:324
msgid "Cancel"
msgstr "Отмена"
#: source/libublsettingsui-gtk3.h:59
#: source/libublsettingsui-gtk3.h:325
msgid "Accept"
msgstr "Принять"
#: source/libublsettingsui-gtk3.h:60
#: source/libublsettingsui-gtk3.h:326
msgid "Open"
msgstr "Открыть"
#: source/libublsettingsui-gtk3.h:62
#: source/libublsettingsui-gtk3.h:328
msgid "Would you like to read documentation in the Web?"
msgstr "Вы хотите прочитать справку в Сети?"
#: source/libublsettingsui-gtk3.h:63
#: source/libublsettingsui-gtk3.h:329
msgid ""
"You will be redirected to documentation website where documentation is\n"
"translated and supported by community."
@ -153,63 +157,67 @@ msgstr ""
"Вы будете перенаправлены на сайт с документацией, где страницы помощи\n"
"переводятся и поддерживаются сообществом."
#: source/libublsettingsui-gtk3.h:64
#: source/libublsettingsui-gtk3.h:330
msgid "Always redirect to online documentation"
msgstr "Всегда перенаправлять"
#: source/libublsettingsui-gtk3.h:65
#: source/libublsettingsui-gtk3.h:331
msgid "Open documentation"
msgstr "Прочитать справку"
#: source/libublsettingsui-gtk3.h:66
#: source/libublsettingsui-gtk3.h:332
msgid "Project Home Page"
msgstr "Домашняя страница проекта"
#: source/libublsettingsui-gtk3.h:67
#: source/libublsettingsui-gtk3.h:333
msgid "Nothing were chosen"
msgstr "Ничего не было выбрано"
#: source/libublsettingsui-gtk3.h:68
#: source/libublsettingsui-gtk3.h:334
msgid "Copyright © 2022 - 2023, UBSoft LLC"
msgstr "Copyright © 2022 - 2023, ООО «Юбисофт»"
#: source/libublsettingsui-gtk3.h:71
#: source/libublsettingsui-gtk3.h:337
msgid "Global configuration loading succeeded."
msgstr "Успешно загружена глобальная конфигурация"
#: source/libublsettingsui-gtk3.h:72
#: source/libublsettingsui-gtk3.h:338
msgid "Local configuration loading succeeded."
msgstr "Успешно загружена локальная конфигурация"
#: source/libublsettingsui-gtk3.h:73
#: source/libublsettingsui-gtk3.h:339
msgid "Config loading failed"
msgstr "Ошибка загрузки конфига"
#: source/libublsettingsui-gtk3.h:75
#: source/libublsettingsui-gtk3.h:341
msgid "Local and global configuration saving succeeded."
msgstr "Успешно записаны локальная и глобальная конфигурация"
#: source/libublsettingsui-gtk3.h:76
#: source/libublsettingsui-gtk3.h:342
msgid "Global configuration saving succeeded."
msgstr "Успешно записана глобальная конфигурация"
#: source/libublsettingsui-gtk3.h:77
#: source/libublsettingsui-gtk3.h:343
msgid "Local configuration saving succeeded."
msgstr "Успешно записана локальная конфигурация"
#: source/libublsettingsui-gtk3.h:79
#: source/libublsettingsui-gtk3.h:344
msgid "Configuration saving succeeded."
msgstr "Успешно записана конфигурация"
#: source/libublsettingsui-gtk3.h:346
msgid "Parameter"
msgstr "Параметр"
#: source/libublsettingsui-gtk3.h:80
#: source/libublsettingsui-gtk3.h:347
msgid "Old value"
msgstr "Старое значение"
#: source/libublsettingsui-gtk3.h:81
#: source/libublsettingsui-gtk3.h:348
msgid "New value"
msgstr "Новое значение"
#: source/libublsettingsui-gtk3.h:82
#: source/libublsettingsui-gtk3.h:349
msgid ""
"Value\n"
"(Old/New)"
@ -217,54 +225,78 @@ msgstr ""
"Значение\n"
"(Старое/Новое)"
#: source/libublsettingsui-gtk3.h:84
#: source/libublsettingsui-gtk3.h:351
msgid "Nothing to save"
msgstr "Нечего сохранять"
#: source/libublsettingsui-gtk3.h:85
#: source/libublsettingsui-gtk3.h:352
msgid "Saving into local configuration"
msgstr "Сохранение в локальный конфигурационный файл"
#: source/libublsettingsui-gtk3.h:86
#: source/libublsettingsui-gtk3.h:353
msgid "Saving into global configuration"
msgstr "Сохранение в глобальный конфигурационный файл"
#: source/libublsettingsui-gtk3.h:87
#: source/libublsettingsui-gtk3.h:354
msgid "Saving into global and local configuration"
msgstr "Сохранение в глобальный и локальный конфигурационный файл"
#: source/libublsettingsui-gtk3.h:88
#: source/libublsettingsui-gtk3.h:355
msgid "Saving into custom configuration at"
msgstr "Сохранение в конфигурационный файл по пути"
#: source/libublsettingsui-gtk3.h:93
#: source/libublsettingsui-gtk3.h:360
msgid "Full saving mode"
msgstr "Полное сохранение"
#: source/libublsettingsui-gtk3.h:94
#: source/libublsettingsui-gtk3.h:361
msgid "Saving into module"
msgstr "Сохранение в модуль"
#: source/libublsettingsui-gtk3.h:95
#: source/libublsettingsui-gtk3.h:362
msgid "Sandbox mode"
msgstr "Полная песочница в ОЗУ"
#: source/libublsettingsui-gtk3.h:96
#: source/libublsettingsui-gtk3.h:363
msgid "Sandbox with profile saving"
msgstr "Песочница с сохранением профиля пользователя"
#: source/libublsettingsui-gtk3.h:97
#: source/libublsettingsui-gtk3.h:364
msgid "HDD sandbox"
msgstr "Полная песочница на HDD"
#: source/libublsettingsui-gtk3.h:98
#: source/libublsettingsui-gtk3.h:365
msgid "HDD sandbox with profile saving"
msgstr "Полная песочница на HDD с сохранением профиля пользователя"
#: source/libublsettingsui-gtk3.h:99
#: source/libublsettingsui-gtk3.h:366
msgid "New configuration file creation failed"
msgstr "Ошибка создания нового файла конфигурации"
#: source/libublsettingsui-gtk3.h:100
#: source/libublsettingsui-gtk3.h:367
msgid "Upgrade to root"
msgstr "Повысить права до root"
#: source/libublsettingsui-gtk3.h:368
msgid "Settings"
msgstr ""
#: source/libublsettingsui-gtk3.h:370
msgid "Application settigs"
msgstr "Настройки"
#: source/libublsettingsui-gtk3.h:372
msgid "Invalid email adress"
msgstr "Неверный email-адрес"
#: source/libublsettingsui-gtk3.h:373
msgid "Invalid path"
msgstr "Неправильный путь"
#: source/libublsettingsui-gtk3.h:375
msgid "Choose path"
msgstr "Выбор пути"
#: source/libublsettingsui-gtk3.h:377
msgid "Choose directory instead of file"
msgstr "Выбрать папку вместо вайла"

@ -41,7 +41,9 @@ set(DEPENDFILES
../libublsettingsui-gtk3-about.glade
../libublsettingsui-gtk3-documentation.glade
../libublsettingsui-gtk3-saving.glade
../libublsettingsui-gtk3-filechooser.glade
../libublsettingsui-gtk3-debugger.glade
../libublsettingsui-gtk3-config-window.glade
../gresource.xml
../libublsettingsui-gtk3-banner.png
../libublsettingsui-gtk3.css
@ -77,6 +79,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissin
add_library(${PROJECT_NAME} SHARED
libublsettingsui-gtk3.c
libublsettingsui-gtk3-save.c
libublsettingsui-gtk3-config-window.c
libublsettingsui-gtk3-filechooser.c
libublsettingsui-gtk3.h
${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C})

@ -0,0 +1,266 @@
#include "libublsettingsui-gtk3.h"
void on_confuguration_combo_box_changed(GtkComboBox *self, char *id);
void __yon_on_boolean_parameter_toggled(GtkToggleButton *self ,char *id);
typedef struct {
char *id;
GtkWidget *Box;
GtkWidget *CheckButton;
} yon_configuration_boolean_parameter;
typedef struct {
char *id;
GtkWidget *Box;
GtkWidget *Label;
GtkWidget *Entry;
} yon_configuration_entry_parameter;
typedef struct {
char *id;
GtkWidget *Box;
GtkWidget *Label;
GtkWidget *ComboBox;
} yon_configuration_combo_parameter;
// typedef struct {
// char *id;
// GtkWidget *Label;
// GtkWidget *GtkTreeView;
// GtkListStore *list;
// } yon_configuration_list_parameter;
typedef struct yon_configuration_parameters {
dictionary_fields(yon_configuration_parameters);
char *label;
char *value;
GCallback func;
enum CONFIGURATION_PARAMETER_TYPE type;
} yon_configuration_parameters;
yon_configuration_entry_parameter *yon_configuration_entry_parameter_new(char *id, char *label_text){
yon_configuration_entry_parameter *parameter = malloc(sizeof(yon_configuration_entry_parameter));
parameter->Box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
parameter->Label = gtk_label_new(label_text);
parameter->Entry = gtk_entry_new();
parameter->id = yon_char_new(id);
gtk_box_pack_start(GTK_BOX(parameter->Box),parameter->Label,1,1,0);
gtk_box_pack_start(GTK_BOX(parameter->Box),parameter->Entry,1,1,0);
gtk_widget_show_all(parameter->Box);
return parameter;
}
yon_configuration_parameters *__yon_settings_parameters = NULL;
yon_configuration_combo_parameter *yon_configuration_combo_box_parameter_new(char *id, char *label_text, config_str parameters){
yon_configuration_combo_parameter *parameter = malloc(sizeof(yon_configuration_combo_parameter));
parameter->Box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
parameter->Label = gtk_label_new(label_text);
parameter->ComboBox = gtk_combo_box_text_new();
parameter->id = yon_char_new(id);
gtk_box_pack_start(GTK_BOX(parameter->Box),parameter->Label,0,0,0);
gtk_box_pack_start(GTK_BOX(parameter->Box),parameter->ComboBox,0,0,0);
for (int i=0;parameters[i]&&parameters[i+1];i+=2){
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(parameter->ComboBox),parameters[i],parameters[i+1]);
}
char *value = NULL;
yon_window_config_get_parameter("settings",id,&value,YON_TYPE_STRING);
if (!yon_char_is_empty(value)){
gtk_combo_box_set_active_id(GTK_COMBO_BOX(parameter->ComboBox),value);
} else {
gtk_combo_box_set_active(GTK_COMBO_BOX(parameter->ComboBox),0);
}
g_signal_connect(G_OBJECT(parameter->ComboBox),"changed",G_CALLBACK(on_confuguration_combo_box_changed),id);
yon_configuration_parameters *target = (yon_configuration_parameters*)yon_dictionary_get((dictionary**)&__yon_settings_parameters,id);
if (target){
if (target->func){
g_signal_connect(G_OBJECT(parameter->ComboBox),"changed",G_CALLBACK(target->func),target->value);
}
}
gtk_widget_show_all(parameter->Box);
return parameter;
}
ubl_settings_window *yon_ubl_settings_window_new(){
ubl_settings_window *window = malloc(sizeof(ubl_settings_window));
GtkBuilder *builder = gtk_builder_new_from_resource("/com/ublinux/ui/libublsettingsui-gtk3-config-window.glade");
window->window = yon_gtk_builder_get_widget(builder,"Window");
window->WorkZoneBox = yon_gtk_builder_get_widget(builder,"WorkZoneBox");
window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton");
window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
return window;
}
yon_configuration_boolean_parameter *__yon_configuration_boolean_parameter_new(char *id, char *label_text){
yon_configuration_boolean_parameter *parameter = malloc(sizeof(yon_configuration_boolean_parameter));
parameter->Box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
parameter->CheckButton = gtk_check_button_new_with_label(label_text);
parameter->id = yon_char_new(id);
g_signal_connect(G_OBJECT(parameter->CheckButton),"toggled",G_CALLBACK(__yon_on_boolean_parameter_toggled),parameter->id);
gtk_box_pack_start(GTK_BOX(parameter->Box),parameter->CheckButton,0,0,0);
return parameter;
}
//parameter section
yon_configuration_parameters *yon_configuration_parameter_new()
{
yon_configuration_parameters *dict = malloc(sizeof(yon_configuration_parameters));
dict->data = NULL;
dict->key = NULL;
dict->next = NULL;
dict->prev = NULL;
dict->data = NULL;
dict->value = NULL;
dict->func = NULL;
dict->first = (struct yon_configuration_parameters*)dict;
dict->data_type = DICTIONARY_OTHER_TYPE;
return dict;
}
yon_configuration_parameters *yon_configuration_parameter_append(yon_configuration_parameters *targetdict)
{
targetdict = (yon_configuration_parameters*)yon_dictionary_get_last((dictionary*)targetdict);
targetdict->next = (struct yon_configuration_parameters*)yon_configuration_parameter_new();
targetdict->next->prev = (struct yon_configuration_parameters*)targetdict;
targetdict->next->first = targetdict->first;
targetdict->next->data_type = DICTIONARY_OTHER_TYPE;
targetdict->next->data = NULL;
targetdict->next->value = NULL;
targetdict->next->func = NULL;
return targetdict->next;
}
yon_configuration_parameters *yon_configuration_parameter_new_with_label(char *key, void *data)
{
yon_configuration_parameters *dct = yon_configuration_parameter_new();
dct->key = yon_char_new(key);
dct->label = data;
dct->data_type = DICTIONARY_OTHER_TYPE;
return dct;
}
yon_configuration_parameters *yon_configuration_parameter_append_with_label(yon_configuration_parameters *dict, char *key, void *data)
{
yon_configuration_parameters *dct = yon_configuration_parameter_append(dict);
dct->key = yon_char_new(key);
dct->label = data;
dct->data_type = DICTIONARY_OTHER_TYPE;
return dct;
}
#define yon_configuration_parameter_add_or_create_if_exists_with_data(dict,key,data) {if (!dict) dict=yon_configuration_parameter_new_with_label(key,data); \
else dict=yon_configuration_parameter_append_with_label(dict,key,data);}
void yon_configuration_window_add_boolean_parameter(enum CONFIGURATION_PARAMETER_TYPE type, char *id, char *label){
yon_configuration_parameter_add_or_create_if_exists_with_data(__yon_settings_parameters,id,label);
yon_configuration_parameters *parameter = (yon_configuration_parameters*)yon_dictionary_get_last((dictionary*)__yon_settings_parameters);
if (parameter){
parameter->type = CONFIGURATION_PARAMETER_BOOL;
}
}
char *yon_settings_configuration_get(char *id){
char *return_val = NULL;
yon_window_config_get_parameter("settings",id,&return_val,YON_TYPE_STRING);
return return_val;
}
//signnals section
void __yon_on_ubl_settings_window_open(){
if (!__yon_settings_parameters) return;
ubl_settings_window *window = yon_ubl_settings_window_new();
dictionary *current = NULL;
for_dictionaries(current,(dictionary*)__yon_settings_parameters){
switch(((yon_configuration_parameters*)current)->type){
case CONFIGURATION_PARAMETER_BOOL:{
yon_configuration_boolean_parameter *cur = __yon_configuration_boolean_parameter_new(((yon_configuration_parameters*)current)->key,((yon_configuration_parameters*)current)->label);
gtk_box_pack_start(GTK_BOX(window->WorkZoneBox),cur->Box,0,0,0);
gtk_widget_show_all(window->WorkZoneBox);
} break;
case CONFIGURATION_PARAMETER_ENTRY:{
// yon_configuration_entry_parameter *cur = __yon_configuration_entry_parameter_new(current->key,current->label);
// gtk_box_pack_start(GTK_BOX(window->WorkZoneBox),cur->Box,0,0,0);
} break;
case CONFIGURATION_PARAMETER_COMBO_BOX:{
yon_configuration_combo_parameter *cur = yon_configuration_combo_box_parameter_new(((yon_configuration_parameters*)current)->key,((yon_configuration_parameters*)current)->label,(config_str)((yon_configuration_parameters*)current)->data);
gtk_box_pack_start(GTK_BOX(window->WorkZoneBox),cur->Box,0,0,0);
gtk_widget_show_all(window->WorkZoneBox);
} break;
case CONFIGURATION_PARAMETER_LIST_MULTIPLE:{
} break;
}
}
gtk_widget_show(window->window);
}
void __yon_on_boolean_parameter_toggled(GtkToggleButton *self ,char *id){
yon_configuration_parameters *current = (yon_configuration_parameters*)yon_dictionary_get((dictionary**)&__yon_settings_parameters,id);
if (current){
current->data= gtk_toggle_button_get_active(self)?(void*)1:(void*)0;
}
}
void on_confuguration_combo_box_changed(GtkComboBox *self, char *id){
yon_configuration_parameters *cur = (yon_configuration_parameters*)yon_dictionary_get((dictionary**)&__yon_settings_parameters,id);
if (cur){
char *cur_value = yon_char_new((char*)gtk_combo_box_get_active_id(self));
if (yon_window_config_check_init()){
yon_window_config_add_instant_parameter(id,"settings",cur_value,YON_TYPE_STRING);
}
}
}
//init section
void yon_configuration_window_add_combo_box_parameter(enum CONFIGURATION_PARAMETER_TYPE type, char *id, char *label, GCallback func, gpointer data,...){
yon_configuration_parameter_add_or_create_if_exists_with_data(__yon_settings_parameters,id,label);
va_list args;
va_start(args,data);
char *cur=NULL;
int size=0;
config_str variants = NULL;
while ((cur=va_arg(args,char*))){
yon_char_parsed_add_or_create_if_exists(variants,&size,cur);
}
{
char *target=NULL;
yon_window_config_get_parameter("settings",id,&target,YON_TYPE_STRING);
if (yon_char_is_empty(target)){
yon_window_config_add_instant_parameter(id,"settings",variants[0],YON_TYPE_STRING);
}
}
yon_char_parsed_add_or_create_if_exists(variants,&size,NULL);
yon_configuration_parameters *parameter = (yon_configuration_parameters*)yon_dictionary_get_last((dictionary*)__yon_settings_parameters);
if (parameter){
parameter->data = (void*)variants;
parameter->type = CONFIGURATION_PARAMETER_COMBO_BOX;
parameter->func = func;
parameter->value = data;
}
}
void yon_ubl_settings_window_init(GtkMenu *menu){
GtkWidget *menu_item = gtk_menu_item_new();
GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0);
textdomain(template_ui_LocaleName);
GtkWidget *label = gtk_label_new(CONFIG_WINDOW_MENU_LABEL);
textdomain(template_app_information.app_locale);
gtk_style_context_add_class(gtk_widget_get_style_context(menu_item),"menuitemtop");
GtkWidget *image = gtk_image_new_from_icon_name("com.ublinux.libublsettingsui-gtk3.settings-symbolic",GTK_ICON_SIZE_BUTTON);
gtk_menu_shell_prepend(GTK_MENU_SHELL(menu),menu_item);
gtk_container_add(GTK_CONTAINER(menu_item),box);
gtk_box_pack_start(GTK_BOX(box),image,0,0,5);
gtk_box_pack_start(GTK_BOX(box),label,0,0,5);
gtk_widget_show_all(menu_item);
g_signal_connect(G_OBJECT(menu_item),"activate",G_CALLBACK(__yon_on_ubl_settings_window_open),NULL);
}

@ -0,0 +1,120 @@
#include "libublsettingsui-gtk3.h"
void on_file_chooser_accept(GtkWidget *, filechooser_window *window){
switch (gtk_file_chooser_get_action(GTK_FILE_CHOOSER(window->MainFileChooser))){
case GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER:
case GTK_FILE_CHOOSER_ACTION_SAVE:
window->responce=GTK_RESPONSE_APPLY;
break;
case GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER:
case GTK_FILE_CHOOSER_ACTION_OPEN:
window->responce = GTK_RESPONSE_ACCEPT;
break;
}
gtk_widget_destroy(window->Window);
gtk_main_quit();
}
void on_file_chooser_cancel(GtkWidget *, filechooser_window *window){
window->responce=GTK_RESPONSE_CANCEL;
gtk_widget_destroy(window->Window);
gtk_main_quit();
}
void on_file_chooser_selected(GtkWidget *self, filechooser_window *window){
if (window->last_any_selection) free(window->last_any_selection);
if (window->last_success_selection) free(window->last_success_selection);
GSList *list = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(window->MainFileChooser));
config_str paths_all = NULL;
config_str paths_success = NULL;
int all_size=0;
int success_size=0;
GtkFileChooserAction action = gtk_file_chooser_get_action(GTK_FILE_CHOOSER(window->MainFileChooser));
for (int i=0;i<g_slist_length(list);i++){
char *data = (char*)g_slist_nth_data(list,i);
if ((action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER&&success_size==0) ||
(action == GTK_FILE_CHOOSER_ACTION_OPEN&&gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->ChooseFolderCheck))&&yon_file_is_directory(data)) ||
(action == GTK_FILE_CHOOSER_ACTION_OPEN&&!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->ChooseFolderCheck))&&!yon_file_is_directory(data)) ||
(action == GTK_FILE_CHOOSER_ACTION_SAVE&&!yon_file_is_directory(data)) ||
(action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER&&yon_file_is_directory(data))
){
yon_char_parsed_add_or_create_if_exists(paths_success,&success_size,data);
}
yon_char_parsed_add_or_create_if_exists(paths_all,&all_size,data);
}
char *full_success = yon_char_parsed_to_string(paths_success,success_size,",");
char *full_all = yon_char_parsed_to_string(paths_all,all_size,",");
window->last_any_selection = yon_char_is_empty(full_all)?NULL:full_all;
window->last_success_selection = yon_char_is_empty(full_success)?NULL:full_success;
if (all_size) yon_char_parsed_free(paths_all,all_size);
if (success_size) yon_char_parsed_free(paths_success,success_size);
}
filechooser_window *__yon_filechooser_window = NULL;
void yon_file_chooser_set_button_label(char *label){
if (__yon_filechooser_window){
gtk_button_set_label(GTK_BUTTON(__yon_filechooser_window->SaveButton),label);
}
}
void on_file_chooser_exit(GtkWidget *, filechooser_window *){
__yon_filechooser_window = NULL;
}
filechooser_window *yon_file_chooser_window_new(GtkFileChooserAction action){
if (!__yon_filechooser_window){
filechooser_window *window = malloc(sizeof(filechooser_window));
__yon_filechooser_window = window;
GtkBuilder *builder = gtk_builder_new_from_resource(ui_glade_path_filechooser);
window->Window = yon_gtk_builder_get_widget(builder,"Window");
window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox");
window->HeaderTopic = yon_gtk_builder_get_widget(builder,"HeaderTopic");
window->MainFileChooser = yon_gtk_builder_get_widget(builder,"MainFileChooser");
window->SaveButton = yon_gtk_builder_get_widget(builder,"SaveButton");
window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
window->ChooseFolderCheck = yon_gtk_builder_get_widget(builder,"ChooseFolderCheck");
window->last_any_selection=NULL;
window->last_success_selection=NULL;
g_signal_connect(G_OBJECT(window->MainFileChooser),"selection-changed",G_CALLBACK(on_file_chooser_selected),window);
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_file_chooser_cancel),window);
g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_file_chooser_accept),window);
g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_file_chooser_exit),window);
gtk_file_chooser_set_action(GTK_FILE_CHOOSER(window->MainFileChooser),action);
switch(action){
case GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER:
gtk_widget_hide(window->ChooseFolderCheck);
gtk_button_set_label(GTK_BUTTON(window->SaveButton),yon_char_get_localised_from_lib(CREATE_FOLDER_LABEL));
break;
case GTK_FILE_CHOOSER_ACTION_OPEN:
break;
case GTK_FILE_CHOOSER_ACTION_SAVE:
gtk_widget_hide(window->ChooseFolderCheck);
gtk_button_set_label(GTK_BUTTON(window->SaveButton),yon_char_get_localised_from_lib(SAVE_LABEL));
break;
case GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER:
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->ChooseFolderCheck),1);
gtk_widget_hide(window->ChooseFolderCheck);
gtk_button_set_label(GTK_BUTTON(window->SaveButton),yon_char_get_localised_from_lib(SELECT_FOLDER_LABEL));
break;
}
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
return window;
} else {
return __yon_filechooser_window;
}
}
GtkResponseType yon_file_chooser_start(filechooser_window *window){
gtk_widget_show(window->Window);
gtk_main();
return window->responce;
}

@ -1,79 +1,11 @@
#include "libublsettingsui-gtk3.h"
#include "libublsettingsui-gtk3-save.h"
struct loaded_config {
dictionary_fields(loaded_config);
char *section;
};
template_saving_window *yon_saving_window_new();
struct loaded_config *yon_config_convert_parameter(config_str parsed, int size);
/**function and argument, which called after successful config saving.
* Example:
* void on_save_done(main_window *widgets, config_str output, int size)
/*
==============
saving section
==============
*/
void (*save_success_function)(void*,config_str,int)=NULL;
void *save_success_argument=NULL;
void (*save_failure_function)(void*,config_str,int)=NULL;
void *save_failure_argument=NULL;
void yon_save_window_set_postsave_function(void *function, void *data){
save_success_function=function;
save_success_argument=data;
}
void yon_save_window_set_postsave_failure_function(void *function, void *data){
save_failure_function=function;
save_failure_argument=data;
}
void on_save_window_parameter_switched(GtkCellRendererToggle *self, gchar *path, template_saving_window *window){
GtkTreeIter iter,itar;
if (path){
if (gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->list),&itar,path)){
gboolean is_active;
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&itar,0,&is_active,-1);
gtk_list_store_set(window->list,&itar,0,!is_active,-1);
}
}
int once_active=0;
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter);
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&iter)){
int is_active;
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&is_active,-1);
if (is_active){
once_active=1;
break;
}
}
if (!once_active) gtk_widget_set_sensitive(window->SaveButton,0);
else gtk_widget_set_sensitive(window->SaveButton,1);
}
template_debug_window *template_debugger_window_new(){
template_debug_window *window = malloc(sizeof(template_debug_window));
GtkBuilder *builder = gtk_builder_new_from_resource(ui_glade_path_debug);
window->Window=yon_gtk_builder_get_widget(builder,"Window");
window->HeaderTopic=yon_gtk_builder_get_widget(builder,"HeaderTopic");
window->HeaderImage=yon_gtk_builder_get_widget(builder,"HeaderImage");
window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox");
window->Vte=yon_gtk_builder_get_widget(builder,"DebuggerTerminal");
gtk_window_set_title(GTK_WINDOW(window->Window),template_app_information.app_title);
gtk_label_set_text(GTK_LABEL(window->HeaderTopic),template_app_information.app_title);
gtk_window_set_icon_name(GTK_WINDOW(window->Window),yon_char_append("com.ublinux.",template_app_information.app_tech_name));
gtk_image_set_from_pixbuf(GTK_IMAGE(window->HeaderImage),gtk_icon_theme_load_icon_for_scale(gtk_icon_theme_get_default(),yon_char_append("com.ublinux.",template_app_information.app_tech_name),32,1,GTK_ICON_LOOKUP_FORCE_SIZE,NULL));
yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"DebugWindow");
return window;
}
struct save_return {
void *save_success_argument;
config_str file_return;
int file_save;
};
gboolean _yon_postsave_function_start(struct save_return *data){
save_success_function(data->save_success_argument,data->file_return,data->file_save);
@ -134,70 +66,276 @@ struct loaded_config *yon_save_window_get_saved_parameters(template_saving_windo
config_str yon_loaded_config_convert_to_save_command(struct loaded_config *target, int *size,char *path){
(*size)=0;
dictionary *sections = NULL;
config_str final_commands = NULL;
{
struct yon_temp_command_sections {
dictionary_fields(yon_temp_command_sections);
int status;
};
struct yon_temp_command_sections *sections = NULL;
struct loaded_config *current;
for_dictionaries(current,target){
dictionary *cur_section=NULL;
if (sections&&(cur_section=yon_dictionary_get(&sections,current->section))){
char *temp = yon_char_unite((char*)cur_section->data," ", current->key,"=\'",(char*)current->data,"\'",NULL);
struct yon_temp_command_sections *cur_section=NULL, *found = NULL;
if (sections){
for_dictionaries(cur_section,sections){
if (!strcmp(current->section,cur_section->key)){
int status = yon_config_get_status(current->key);
if ((status==-1&&cur_section->status==-1)||(status>-1)&&cur_section->status>-1){
found = cur_section;
}
}
}
cur_section = found;
}
if (cur_section){
char *parameters_for_current_command = NULL;
if (yon_config_get_status(current->key)==-1){
parameters_for_current_command = yon_char_unite((char*)cur_section->data," ", current->key,NULL);
} else {
parameters_for_current_command = yon_char_unite((char*)cur_section->data," ", current->key,"=\'",(char*)current->data,"\'",NULL);
}
free(current->data);
cur_section->data = temp;
cur_section->data = parameters_for_current_command;
} else {
char *parameters = yon_char_unite(current->key,"=\'",(char*)current->data,"\'",NULL);
yon_dictionary_add_or_create_if_exists_with_data(sections,current->section,parameters);
char *parameters_for_current_command = NULL;
if (yon_config_get_status(current->key)==-1){
parameters_for_current_command = current->key;
} else {
parameters_for_current_command = yon_char_unite(current->key,"=\'",(char*)current->data,"\'",NULL);
}
dictionary *sections_dict = (dictionary*)sections;
yon_dictionary_add_or_create_if_exists_with_data(sections_dict,current->section,parameters_for_current_command);
sections = realloc(sections_dict,sizeof(struct yon_temp_command_sections));
sections->status=yon_config_get_status(current->key);
}
}
config_str commands = NULL;
{
dictionary *current;
struct yon_temp_command_sections *current;
for_dictionaries(current,sections){
char *dull_command = ubconfig_set_command_full(path,current->key,(char*)current->data);
char *command = yon_config_parameter_prepare_command(dull_command,NULL,current->key,NULL);
yon_char_parsed_add_or_create_if_exists(commands,size,command);
free(command);
char *dull_command = NULL;
if (current->status>=0){
dull_command = ubconfig_set_command_full(path,current->key,(char*)current->data);
} else {
dull_command = ubconfig_remove_command_full(path,current->key,(char*)current->data);
}
yon_char_parsed_add_or_create_if_exists(commands,size,dull_command);
free(dull_command);
}
}
return commands;
}
}
int yon_config_parameter_prepare_elements(struct loaded_config *target){
int success = 0;
struct loaded_config *current = NULL;
for_dictionaries(current,target){
char *parameter = current->key;
if (strstr(parameter,"[")){
char *param = yon_char_divide_search(parameter,"[",-1);
char *param_key = yon_char_divide_search(parameter,"]",-1);
free(parameter);
parameter = yon_char_unite(param,"[\"",param_key,"\"]",NULL);
current->key = parameter;
success=1;
}
void yon_save_window_set_postsave_function(void *function, void *data){
save_success_function=function;
save_success_argument=data;
}
void yon_save_window_set_postsave_failure_function(void *function, void *data){
save_failure_function=function;
save_failure_argument=data;
}
/*
==============
window section
==============
*/
void yon_save_window_set_status(template_saving_window *window,char *path,YON_CONFIG_TYPE type){
textdomain(template_ui_LocaleName);
window->type=type;
window->custom_save_path=path;
if (type==YON_CONFIG_BOTH){
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"savingTarget",SAVING_GLOBAL_LOCAL_STATE_LABEL,BACKGROUND_IMAGE_INFO_TYPE);
} else if (type==YON_CONFIG_GLOBAL){
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"savingTarget",SAVING_GLOBAL_STATE_LABEL,BACKGROUND_IMAGE_INFO_TYPE);
} else if (type==YON_CONFIG_LOCAL){
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"savingTarget",SAVING_LOCAL_STATE_LABEL,BACKGROUND_IMAGE_INFO_TYPE);
} else if (type==YON_CONFIG_CUSTOM){
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"savingTarget",SAVING_CUSTOM_STATE_LABEL(path),BACKGROUND_IMAGE_INFO_TYPE);
}
return success;
textdomain(template_app_information.app_locale);
}
void on_save_parameters(GtkWidget *self, template_saving_window *window){
gboolean yon_save_window_destroy_if_empty(template_saving_window *window){
GtkTreeIter iter;
if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter)){
gtk_widget_destroy(window->Window);
textdomain(template_ui_LocaleName);
yon_ubl_status_box_render(SAVE_PROCESS_LABEL,BACKGROUND_IMAGE_INFO_TYPE);
yon_ubl_status_box_render(NOTHING_TO_SAVE_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
textdomain(template_app_information.app_locale);
if (save_failure_function){
int saved_size;
struct loaded_config *saved_parameters = yon_save_window_get_saved_parameters(window);
yon_config_parameter_prepare_elements(saved_parameters);
struct save_return *data = malloc(sizeof(struct save_return));
data->save_success_argument = save_failure_argument;
data->file_return = NULL;
data->file_save = 0;
gdk_threads_add_idle((GSourceFunc)_yon_postsave_failure_function_start,data);
}
return 0;
}
return 1;
}
int size=0;
config_str commands = yon_loaded_config_convert_to_save_command(saved_parameters,&size,window->type!=YON_CONFIG_CUSTOM? yon_config_get_type_path(window->type):window->custom_save_path);
void on_save_window_parameter_switched(GtkCellRendererToggle *self, gchar *path, template_saving_window *window){
GtkTreeIter iter,itar;
if (path){
if (gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->list),&itar,path)){
gboolean is_active;
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&itar,0,&is_active,-1);
gtk_list_store_set(window->list,&itar,0,!is_active,-1);
}
}
int once_active=0;
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter);
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&iter)){
int is_active;
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&is_active,-1);
if (is_active){
once_active=1;
break;
}
}
if (!once_active) gtk_widget_set_sensitive(window->SaveButton,0);
else gtk_widget_set_sensitive(window->SaveButton,1);
char *final_command = yon_char_parsed_to_string(commands,size,";");
pthread_t thread_id;
pthread_create(&thread_id, NULL, (void *)_yon_saving_threaded,final_command);
}
yon_window_config_custom_window_set(GTK_WINDOW(window->Window),"SaveWindow");
on_subwindow_close(self);
template_saving_window *yon_saving_window_new(){
GtkBuilder *builder = gtk_builder_new_from_resource(ui_glade_path_saving);
template_saving_window *window = malloc(sizeof(template_saving_window));
window->Window = yon_gtk_builder_get_widget(builder,"Window");
window->HeaderImage = yon_gtk_builder_get_widget(builder,"HeaderImage");
window->HeaderTopic = yon_gtk_builder_get_widget(builder,"HeaderTopic");
window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox");
window->ParametersTree = yon_gtk_builder_get_widget(builder,"ParametersTree");
window->SaveButton = yon_gtk_builder_get_widget(builder,"SaveButton");
window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
window->ToggleCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"ToggleCell"));
window->list = GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1"));
window->OldValueColumn = GTK_TREE_VIEW_COLUMN(gtk_builder_get_object(builder,"OldValueColumn"));
window->OldValueCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"OldValueCell"));
window->NewValueColumn = GTK_TREE_VIEW_COLUMN(gtk_builder_get_object(builder,"NewValueColumn"));
window->NewValueCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"NewValueCell"));
window->filteredModel = GTK_TREE_MODEL(gtk_builder_get_object(builder,"listfilter1"));
yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"SaveWindow");
char *icon_name = yon_char_append("com.ublinux.",template_app_information.app_tech_name);
gtk_window_set_icon_name(GTK_WINDOW(window->Window),icon_name);
gtk_window_set_title(GTK_WINDOW(window->Window),template_app_information.app_title);
gtk_label_set_text(GTK_LABEL(window->HeaderTopic),template_app_information.app_title);
gtk_image_set_from_pixbuf(GTK_IMAGE(window->HeaderImage),gtk_icon_theme_load_icon_for_scale(gtk_icon_theme_get_default(),yon_char_append("com.ublinux.",template_app_information.app_tech_name),32,1,GTK_ICON_LOOKUP_FORCE_SIZE,NULL));
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
g_signal_connect(G_OBJECT(window->SaveButton),"clicked", G_CALLBACK(on_save_parameters),window);
g_signal_connect(G_OBJECT(window->ToggleCell),"toggled", G_CALLBACK(on_save_window_parameter_switched),window);
return window;
}
/*
======================
config getting section
======================
*/
char *yon_get_compare_config_command(va_list args,char *path,YON_CONFIG_TYPE type){
char *cur_command;
char *compare_command="";
while ((cur_command=va_arg(args,char*))){
char *temp=cur_command;
cur_command = yon_config_parameter_prepare_command(cur_command,type!=YON_CONFIG_CUSTOM?yon_config_get_type_path(type):path,NULL,NULL);
char *temp_command = yon_char_unite(compare_command,!yon_char_is_empty(compare_command)?";":"",cur_command,NULL);
if (!yon_char_is_empty(compare_command)) free(compare_command);
compare_command = temp_command;
}
return yon_char_is_empty(compare_command)?NULL:compare_command;
}
void yon_save_window_loaded_config_init(template_saving_window *window, struct loaded_config *current_loaded, struct loaded_config *config_compare){
if (current_loaded){
struct loaded_config *current = NULL;
for_dictionaries(current,current_loaded){
if (!yon_config_check_ignore(current->key)){
dictionary *dict = NULL;
if (!yon_config_compare_ignore_get(current->key)){
dict = yon_dictionary_get((dictionary**)&config_compare,current->key); // get old parameter value
}
gboolean status=0;
status = yon_config_get_status(current->key);
if (dict&&!yon_char_is_empty((char*)dict->data)&&status!=-2){
if (strcmp((char*)dict->data,(char*)current->data)){
GtkTreeIter iter;
if (status==0||status==-2) status = 0;
else status=1;
char *old_val = yon_char_new(current->data);
char *new_val = yon_char_new(dict->data);
if (strstr(old_val,"&")) {old_val = yon_char_replace(old_val,"&","\003");old_val = yon_char_replace(old_val,"\003","&amp;");}
if (strstr(old_val,">")) old_val = yon_char_replace(old_val,">","&lt;");
if (strstr(old_val,"<")) old_val = yon_char_replace(old_val,"<","&gt;");
if (strstr(new_val,"&")) {int sz = 0; config_str new_val_parsed = yon_char_parse(new_val,&sz,"&");new_val = yon_char_parsed_to_string(new_val_parsed,sz,"&amp;"); yon_char_parsed_free(new_val_parsed,sz);}
if (strstr(new_val,">")) new_val = yon_char_replace(new_val,">","&lt;");
if (strstr(new_val,"<")) new_val = yon_char_replace(new_val,"<","&gt;");
char *compare_string = yon_char_unite("<s>",(char*)new_val,"</s>\n",(char*)old_val,NULL);
gtk_list_store_append(window->list,&iter);
gtk_list_store_set(window->list,&iter,0,status,1,current->key,2,(char*)dict->data,3,(char*)current->data,4,compare_string,6,1,7,yon_config_get_section_for_key(current->key),-1);
free(compare_string);
}
} else if ((strcmp((char*)current->data,""))&&status!=-2){
GtkTreeIter iter;
if (status==0||status==-2) status = 0;
else status=1;
char *old_val = yon_char_new(current->data);
if (strstr(old_val,"&")) {int sz = 0; config_str old_val_parsed = yon_char_parse(old_val,&sz,"&");old_val = yon_char_parsed_to_string(old_val_parsed,sz,"&amp;"); yon_char_parsed_free(old_val_parsed,sz);}
if (strstr(old_val,">")) old_val = yon_char_replace(old_val,">","&lt;");
if (strstr(old_val,"<")) old_val = yon_char_replace(old_val,"<","&gt;");
char *compare_string = yon_char_unite("\n",(char*)old_val,NULL);
gtk_list_store_append(window->list,&iter);
gtk_list_store_set(window->list,&iter,0,status,1,current->key,3,(char*)current->data,4,compare_string,6,1,7,yon_config_get_section_for_key(current->key),-1);
free(compare_string);
}
}
}
}
}
void yon_save_window_compared_config_init_unfound(template_saving_window *window, struct loaded_config *current_loaded, struct loaded_config *config_compare){
if (config_compare){
struct loaded_config *current = NULL;
for_dictionaries(current,config_compare){
if (!yon_config_check_ignore(current->key)){
GtkTreeIter iter;
dictionary *dict = yon_dictionary_get((dictionary**)&current_loaded,current->key);
if (!dict){
GdkRGBA rgba;
rgba.alpha=0.8;
rgba.red=1;
rgba.blue=0.3;
rgba.green=0.65;
char *rgba_string = gdk_rgba_to_string(&rgba);
int status=0;
char *compare_string = yon_char_unite((char*)current->data,"\n",NULL);
gtk_list_store_append(window->list,&iter);
gtk_list_store_set(window->list,&iter,0,0,1,current->key,2,(char*)current->data,4,compare_string,5,rgba_string,6,1,7,current->section,-1);
free(compare_string);
}
}
}
}
}
int yon_config_parameter_prepare_elements(config_str target, int *size){
int success = 0;
for (int i=0;i<(*size);i++){
char *start_bracket_replaced_string = yon_char_replace(target[i],"[","[\"");
char *end_bracket_replaced_string = yon_char_replace(start_bracket_replaced_string,"]","\"]");
target[i] = end_bracket_replaced_string;
}
return success;
}
struct loaded_config *yon_config_convert_parameter(config_str parsed, int size){
@ -316,20 +454,23 @@ struct loaded_config *yon_config_get_compared(char *command){
}
char *yon_custom_config_init(){
textdomain(template_ui_LocaleName);
GtkWidget *dialog = gtk_file_chooser_dialog_new(template_app_information.app_title,NULL,GTK_FILE_CHOOSER_ACTION_SAVE,CANCEL_LABEL,GTK_RESPONSE_CANCEL,SAVE_LABEL,GTK_RESPONSE_ACCEPT,NULL);
textdomain(template_app_information.app_locale);
char *yon_custom_config_init(GtkFileChooserAction type){
filechooser_window *dialog = yon_file_chooser_window_new(type);
gtk_widget_hide(dialog->ChooseFolderCheck);
yon_gtk_window_setup(GTK_WINDOW(dialog->Window),NULL,template_app_information.app_title,yon_char_unite("com.ublinux.",template_app_information.app_tech_name,NULL),"ConfigFilechooserWindow");
gtk_label_set_text(GTK_LABEL(dialog->HeaderTopic),template_app_information.app_title);
GtkFileFilter *filter = gtk_file_filter_new();
gtk_window_set_icon_name(GTK_WINDOW(dialog),yon_char_append("com.ublinux.",template_app_information.app_tech_name));
gtk_file_filter_add_pattern(filter,"*.ini");
gtk_file_filter_set_name(filter, "*.ini");
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),filter);
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog->MainFileChooser),filter);
if (type==GTK_FILE_CHOOSER_ACTION_SAVE){
yon_file_chooser_set_button_label(yon_char_get_localised_from_lib(LOAD_CONFIG_LABEL));
}
if (yon_file_chooser_start(dialog)==GTK_RESPONSE_ACCEPT){
int response = gtk_dialog_run(GTK_DIALOG(dialog));
if (response == GTK_RESPONSE_ACCEPT){
char *file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
char *file = dialog->last_success_selection;
if (!yon_char_is_empty(file)){
if (!strstr(file,".ini")) file = yon_char_append(file,".ini");
if (access(file,0)!=F_OK){
@ -342,123 +483,56 @@ char *yon_custom_config_init(){
}
}
}
char *path = yon_char_unite("'",file,"'",NULL);
free(file);
gtk_widget_destroy(dialog);
gtk_widget_destroy(dialog->Window);
return path;
} else {
gtk_widget_destroy(dialog);
}
return NULL;
}
char *yon_get_compare_config_command(va_list args,char *path,YON_CONFIG_TYPE type){
char *cur_command;
char *compare_command="";
while ((cur_command=va_arg(args,char*))){
char *temp=cur_command;
cur_command = yon_config_parameter_prepare_command(cur_command,type!=YON_CONFIG_CUSTOM?yon_config_get_type_path(type):path,NULL,NULL);
char *temp_command = yon_char_unite(compare_command,!yon_char_is_empty(compare_command)?";":"",cur_command,NULL);
if (!yon_char_is_empty(compare_command)) free(compare_command);
compare_command = temp_command;
}
return yon_char_is_empty(compare_command)?NULL:compare_command;
}
void yon_save_window_loaded_config_init(template_saving_window *window, struct loaded_config *current_loaded, struct loaded_config *config_compare){
if (current_loaded){
struct loaded_config *current = NULL;
for_dictionaries(current,current_loaded){
if (!yon_config_check_ignore(current->key)){
dictionary *dict = yon_dictionary_get((dictionary**)&config_compare,current->key); // get old parameter value
gboolean status=0;
status = yon_config_get_status(current->key);
if (dict&&!yon_char_is_empty((char*)dict->data)&&status!=-2){
if (strcmp((char*)dict->data,(char*)current->data)){
GtkTreeIter iter;
if (status==0||status==-2) status = 0;
else status=1;
char *compare_string = yon_char_unite("<s>",(char*)dict->data,"</s>\n",(char*)current->data,NULL);
gtk_list_store_append(window->list,&iter);
gtk_list_store_set(window->list,&iter,0,status,1,current->key,2,(char*)dict->data,3,(char*)current->data,4,compare_string,6,1,7,yon_config_get_section_for_key(current->key),-1);
free(compare_string);
}
} else if ((strcmp((char*)current->data,""))&&status!=-2){
GtkTreeIter iter;
if (status==0||status==-2) status = 0;
else status=1;
char *compare_string = yon_char_unite("\n",(char*)current->data,NULL);
gtk_list_store_append(window->list,&iter);
gtk_list_store_set(window->list,&iter,0,status,1,current->key,3,(char*)current->data,4,compare_string,6,1,7,yon_config_get_section_for_key(current->key),-1);
free(compare_string);
}
}
}
}
return NULL;
}
void yon_save_window_compared_config_init_unfound(template_saving_window *window, struct loaded_config *current_loaded, struct loaded_config *config_compare){
if (config_compare){
struct loaded_config *current = NULL;
for_dictionaries(current,config_compare){
if (!yon_config_check_ignore(current->key)){
GtkTreeIter iter;
dictionary *dict = yon_dictionary_get((dictionary**)&current_loaded,current->key);
if (!dict){
GdkRGBA rgba;
rgba.alpha=0.8;
rgba.red=1;
rgba.blue=0.3;
rgba.green=0.65;
char *rgba_string = gdk_rgba_to_string(&rgba);
int status=0;
char *compare_string = yon_char_unite((char*)current->data,"\n",NULL);
gtk_list_store_append(window->list,&iter);
gtk_list_store_set(window->list,&iter,0,0,1,current->key,2,(char*)current->data,4,compare_string,5,rgba_string,6,1,7,current->section,-1);
free(compare_string);
}
}
}
}
}
/*
============
init section
============
*/
gboolean yon_save_window_destroy_if_empty(template_saving_window *window){
GtkTreeIter iter;
if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter)){
gtk_widget_destroy(window->Window);
void on_save_parameters(GtkWidget *self, template_saving_window *window){
textdomain(template_ui_LocaleName);
yon_ubl_status_box_render(NOTHING_TO_SAVE_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
yon_ubl_status_box_render(SAVE_PROCESS_LABEL,BACKGROUND_IMAGE_INFO_TYPE);
textdomain(template_app_information.app_locale);
if (save_failure_function){
struct save_return *data = malloc(sizeof(struct save_return));
data->save_success_argument = save_failure_argument;
data->file_return = NULL;
data->file_save = 0;
gdk_threads_add_idle((GSourceFunc)_yon_postsave_failure_function_start,data);
}
return 0;
}
return 1;
int saved_size;
struct loaded_config *saved_parameters = yon_save_window_get_saved_parameters(window);
int size=0;
config_str commands = yon_loaded_config_convert_to_save_command(saved_parameters,&size,window->type!=YON_CONFIG_CUSTOM? yon_config_get_type_path(window->type):window->custom_save_path);
yon_config_parameter_prepare_elements(commands,&size);
char *final_command = yon_char_parsed_to_string(commands,size,";");
pthread_t thread_id;
pthread_create(&thread_id, NULL, (void *)_yon_saving_threaded,final_command);
yon_window_config_custom_window_set(GTK_WINDOW(window->Window),"SaveWindow");
on_subwindow_close(self);
}
void yon_save_window_set_status(template_saving_window *window,char *path,YON_CONFIG_TYPE type){
textdomain(template_ui_LocaleName);
window->type=type;
window->custom_save_path=path;
if (type==YON_CONFIG_BOTH){
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"savingTarget",SAVING_GLOBAL_LOCAL_STATE_LABEL,BACKGROUND_IMAGE_INFO_TYPE);
} else if (type==YON_CONFIG_GLOBAL){
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"savingTarget",SAVING_GLOBAL_STATE_LABEL,BACKGROUND_IMAGE_INFO_TYPE);
template_debug_window *template_debugger_window_new(){
template_debug_window *window = malloc(sizeof(template_debug_window));
GtkBuilder *builder = gtk_builder_new_from_resource(ui_glade_path_debug);
window->Window=yon_gtk_builder_get_widget(builder,"Window");
window->HeaderTopic=yon_gtk_builder_get_widget(builder,"HeaderTopic");
window->HeaderImage=yon_gtk_builder_get_widget(builder,"HeaderImage");
window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox");
window->Vte=yon_gtk_builder_get_widget(builder,"DebuggerTerminal");
gtk_window_set_title(GTK_WINDOW(window->Window),template_app_information.app_title);
gtk_label_set_text(GTK_LABEL(window->HeaderTopic),template_app_information.app_title);
gtk_window_set_icon_name(GTK_WINDOW(window->Window),yon_char_append("com.ublinux.",template_app_information.app_tech_name));
gtk_image_set_from_pixbuf(GTK_IMAGE(window->HeaderImage),gtk_icon_theme_load_icon_for_scale(gtk_icon_theme_get_default(),yon_char_append("com.ublinux.",template_app_information.app_tech_name),32,1,GTK_ICON_LOOKUP_FORCE_SIZE,NULL));
} else if (type==YON_CONFIG_LOCAL){
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"savingTarget",SAVING_LOCAL_STATE_LABEL,BACKGROUND_IMAGE_INFO_TYPE);
} else if (type==YON_CONFIG_CUSTOM){
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"savingTarget",SAVING_CUSTOM_STATE_LABEL(path),BACKGROUND_IMAGE_INFO_TYPE);
}
textdomain(template_app_information.app_locale);
yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"DebugWindow");
return window;
}
template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
@ -467,7 +541,8 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
config_to_save = yon_config_get_type_path(type);
if (!path&&type == YON_CONFIG_CUSTOM){
path = yon_custom_config_init();
path = yon_custom_config_init(GTK_FILE_CHOOSER_ACTION_SAVE);
if (!path) return NULL;
}
va_list args;
@ -496,32 +571,3 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
on_save_window_parameter_switched(NULL,NULL,window);
return window;
}
template_saving_window *yon_saving_window_new(){
GtkBuilder *builder = gtk_builder_new_from_resource(ui_glade_path_saving);
template_saving_window *window = malloc(sizeof(template_saving_window));
window->Window = yon_gtk_builder_get_widget(builder,"Window");
window->HeaderImage = yon_gtk_builder_get_widget(builder,"HeaderImage");
window->HeaderTopic = yon_gtk_builder_get_widget(builder,"HeaderTopic");
window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox");
window->ParametersTree = yon_gtk_builder_get_widget(builder,"ParametersTree");
window->SaveButton = yon_gtk_builder_get_widget(builder,"SaveButton");
window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
window->ToggleCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"ToggleCell"));
window->list = GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1"));
window->OldValueColumn = GTK_TREE_VIEW_COLUMN(gtk_builder_get_object(builder,"OldValueColumn"));
window->OldValueCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"OldValueCell"));
window->NewValueColumn = GTK_TREE_VIEW_COLUMN(gtk_builder_get_object(builder,"NewValueColumn"));
window->NewValueCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"NewValueCell"));
window->filteredModel = GTK_TREE_MODEL(gtk_builder_get_object(builder,"listfilter1"));
yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"SaveWindow");
char *icon_name = yon_char_append("com.ublinux.",template_app_information.app_tech_name);
gtk_window_set_icon_name(GTK_WINDOW(window->Window),icon_name);
gtk_window_set_title(GTK_WINDOW(window->Window),template_app_information.app_title);
gtk_label_set_text(GTK_LABEL(window->HeaderTopic),template_app_information.app_title);
gtk_image_set_from_pixbuf(GTK_IMAGE(window->HeaderImage),gtk_icon_theme_load_icon_for_scale(gtk_icon_theme_get_default(),yon_char_append("com.ublinux.",template_app_information.app_tech_name),32,1,GTK_ICON_LOOKUP_FORCE_SIZE,NULL));
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
g_signal_connect(G_OBJECT(window->SaveButton),"clicked", G_CALLBACK(on_save_parameters),window);
g_signal_connect(G_OBJECT(window->ToggleCell),"toggled", G_CALLBACK(on_save_window_parameter_switched),window);
return window;
}

@ -0,0 +1,27 @@
struct loaded_config {
dictionary_fields(loaded_config);
char *section;
};
template_saving_window *yon_saving_window_new();
struct loaded_config *yon_config_convert_parameter(config_str parsed, int size);
struct save_return {
void *save_success_argument;
config_str file_return;
int file_save;
};
/**function and argument, which called after successful config saving.
* Example:
* void on_save_done(main_window *widgets, config_str output, int size)
*/
void (*save_success_function)(void*,config_str,int)=NULL;
void *save_success_argument=NULL;
void (*save_failure_function)(void*,config_str,int)=NULL;
void *save_failure_argument=NULL;
#define default_config_command(target, data) yon_char_unite("ubconfig --source default --raw get ",target," ",data,NULL)
void on_save_parameters(GtkWidget *self, template_saving_window *window);

@ -1,7 +1,17 @@
#include "libublsettingsui-gtk3.h"
_template_config *template_config = NULL;
template_app_info template_app_information;
static char *__yon_config_mode=NULL;
char *yon_char_get_localised_from_lib(char *string){
textdomain(template_ui_LocaleName);
char *ret = _(string);
textdomain(template_app_information.app_locale);
return ret;
}
char *yon_ubl_save_mode_get_icon_name(SAVE_MODE_TYPE type){
switch (type){
case SAVE_MODE_FULL:
@ -64,6 +74,8 @@ void on_open_documentation_confirmation(GtkWidget *self, char *link){
window->HeaderLabel = yon_gtk_builder_get_widget(builder,"webHeaderNameLabel");
window->AlwaysOpenCheck = yon_gtk_builder_get_widget(builder,"AlwaysOpenDocumentationCheckbox");
gtk_label_set_text(GTK_LABEL(window->HeaderLabel),template_app_information.app_title);
gtk_window_set_title(GTK_WINDOW(window->Window),template_app_information.app_title);
gtk_window_set_icon_name(GTK_WINDOW(window->Window),yon_char_append("com.ublinux.",template_app_information.app_tech_name));
gtk_widget_show_all(window->Window);
g_signal_connect(G_OBJECT(window->CloseButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(yon_open_browser),yon_char_new(link));
@ -103,6 +115,7 @@ void on_about(GtkWidget *self, char *version_application){
gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window),template_app_information.app_title);
gtk_about_dialog_set_logo_icon_name(GTK_ABOUT_DIALOG(window),yon_char_append("com.ublinux.",template_app_information.app_tech_name));
gtk_window_set_icon_name(GTK_WINDOW(window),yon_char_append("com.ublinux.",template_app_information.app_tech_name));
gtk_window_set_title(GTK_WINDOW(window),template_app_information.app_title);
gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(window),template_app_information.app_tech_name);
gtk_label_set_text(GTK_LABEL(title),template_app_information.app_title);
g_signal_connect(G_OBJECT(window),"activate-link",G_CALLBACK(on_link),NULL);
@ -184,6 +197,19 @@ char* yon_debug_output(char *pattern,char*text){
// standard functions
char *yon_get_default_label_with_parameter(char *command){
int size;
config_str parsed = yon_config_load(command,&size);
if (strcmp(parsed[0],"(null)\n")){
if (parsed){
yon_char_remove_last_symbol(parsed[0],'\n');
char *default_string = yon_char_unite(DEFAULT_LABEL," ","(",parsed[0],")",NULL);
return default_string;
}
}
return DEFAULT_LABEL;
}
int yon_ubl_connect_config(_template_config *config){
int replaces;
if(!template_config)
@ -505,3 +531,117 @@ template_main_window *yon_ubl_window_setup(){
return widgets;
}
void yon_on_email_check(GtkEntry *self,GdkEventFocus *event,GtkContainer *status){
char *text = (char*)gtk_entry_get_text(self);
if (!strstr(text,"@")){
yon_ubl_status_box_spawn_infinite(status,"invalid_email",EMAIL_INVALID_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
} else {
yon_ubl_status_box_despawn_infinite(status);
}
}
void yon_on_space_first_changed(GtkEntry *editable){
const char *text = gtk_entry_get_text(editable);
gchar *new_text = yon_char_new(text);
if (new_text[0]==' ') free(yon_char_divide(new_text,0));
if (strlen(new_text) < strlen(text)) {
g_signal_handlers_block_by_func(editable, G_CALLBACK(yon_on_space_first_changed), NULL);
gtk_entry_set_text(editable, new_text);
g_signal_handlers_unblock_by_func(editable, G_CALLBACK(yon_on_space_first_changed), NULL);
g_signal_stop_emission_by_name(editable, "changed");
}
g_free(new_text);
}
void yon_on_digit_only_changed(GtkEditable *editable, const gchar *text, gint length, gint *position){
gchar *new_text = g_new(gchar, length + 1);
gint i, j = 0;
for (i = 0; i < length; i++) {
if (text[i]>'0'&&text[i]<'9') {
new_text[j] = text[i];
j++;
}
}
if (j < length) {
g_signal_handlers_block_by_func(editable, G_CALLBACK(yon_on_digit_only_changed), NULL);
gtk_editable_insert_text(editable, new_text, j, position);
g_signal_handlers_unblock_by_func(editable, G_CALLBACK(yon_on_digit_only_changed), NULL);
g_signal_stop_emission_by_name(editable, "insert-text");
}
g_free(new_text);
}
void yon_on_path_check(GtkEntry *self,GdkEventFocus *event,GtkContainer *status){
char *text = (char*)gtk_entry_get_text(self);
if (text[0]=='~'){
text = yon_char_new(text);
free(yon_char_divide(text,0));
char *new_text = yon_char_unite(yon_ubl_user_get_home_directory(),"/",text,NULL);
free(text);
gtk_entry_set_text(GTK_ENTRY(self),new_text);
text = new_text;
}
if (!strstr(text,"/")){
yon_ubl_status_box_spawn_infinite(status,"invalid_path",PATH_INVALID_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
} else {
yon_ubl_status_box_despawn_infinite(status);
}
}
char *yon_gtk_entry_check_restricted(GtkEntry *target){
GtkInputPurpose purpose = gtk_entry_get_input_purpose(target);
const char *text = gtk_entry_get_text(target);
char *error=NULL;
if (!yon_char_is_empty(text)){
switch(purpose){
case GTK_INPUT_PURPOSE_EMAIL:{
char *temp = NULL;
if (!((temp = strstr(text,"@"))&&
strstr(temp,".")&&
strlen(temp)!=strlen(text)&&
temp[1]!='.'&&
strstr(temp,".")[1]!='\0')){
error = yon_char_get_localised_from_lib(EMAIL_INVALID_LABEL);
}
}
break;
case GTK_INPUT_PURPOSE_URL:{
if (!strstr(text,"/")){
error = yon_char_get_localised_from_lib(PATH_INVALID_LABEL);
}
}
break;
default: break;
}
}
return error;
}
void yon_entry_set_entry_type(GtkEntry *target,GtkBox *status){
GtkInputPurpose purpose = gtk_entry_get_input_purpose(target);
g_signal_connect(G_OBJECT(target),"changed",G_CALLBACK(yon_on_space_first_changed),NULL);
switch(purpose){
case GTK_INPUT_PURPOSE_DIGITS:
g_signal_connect(G_OBJECT(target),"insert-text",G_CALLBACK(yon_on_digit_only_changed),NULL);
break;
case GTK_INPUT_PURPOSE_EMAIL:
yon_gtk_entry_block_symbols(target,"/'\"\\+=)(*&>?<^%$#!:;?,)");
yon_gtk_entry_block_languages(target);
break;
case GTK_INPUT_PURPOSE_NAME:
case GTK_INPUT_PURPOSE_URL:
yon_gtk_entry_block_restricted_symbols(target);
break;
default: break;
}
}

@ -23,6 +23,7 @@
#define ui_glade_path_documentation "/com/ublinux/ui/libublsettingsui-gtk3-documentation.glade"
#define ui_glade_path_about "/com/ublinux/ui/libublsettingsui-gtk3-about.glade"
#define ui_glade_path_saving "/com/ublinux/ui/libublsettingsui-gtk3-saving.glade"
#define ui_glade_path_filechooser "/com/ublinux/ui/libublsettingsui-gtk3-filechooser.glade"
#define ui_glade_path_debug "/com/ublinux/ui/libublsettingsui-gtk3-debugger.glade"
#define ui_banner_path "/com/ublinux/images/libublsettingsui-gtk3-banner.png"
#define ui_CssPath "/com/ublinux/css/libublsettingsui-gtk3.css"
@ -46,6 +47,8 @@ typedef enum SAVE_MODE_TYPE {
SAVE_MODE_HDD_HOME,
} SAVE_MODE_TYPE;
char *yon_char_get_localised_from_lib(char *string);
char *yon_ubl_save_mode_get_icon_name(SAVE_MODE_TYPE type);
SAVE_MODE_TYPE yon_ubl_save_mode_get_type(char *type);
@ -66,7 +69,7 @@ typedef struct {
gboolean always_open_documentation;
} template_app_info;
static template_app_info template_app_information;
extern template_app_info template_app_information;
#define template_config_fields\
@ -89,8 +92,9 @@ static template_app_info template_app_information;
typedef struct {
template_config_fields
} _template_config;
[[maybe_unused]]
static _template_config *template_config;
extern _template_config *template_config;
#define template_window_fields\
GtkWidget *Window;\
@ -152,6 +156,22 @@ typedef struct {
char *action_text;
} dialog_confirmation_data;
typedef struct {
GtkWidget *Window;
GtkWidget *StatusBox;
GtkWidget *HeaderTopic;
GtkWidget *MainFileChooser;
GtkWidget *SaveButton;
GtkWidget *CancelButton;
GtkWidget *ChooseFolderCheck;
char *last_success_selection;
char *last_any_selection;
GtkResponseType responce;
} filechooser_window;
filechooser_window *yon_file_chooser_window_new(GtkFileChooserAction action);
GtkResponseType yon_file_chooser_start(filechooser_window *window);
void yon_file_chooser_set_button_label(char *label);
int yon_confirmation_dialog_call(GtkWidget *self,dialog_confirmation_data *data);
/**yon_open_browser(GtkWidget *self, char *link)
@ -214,6 +234,8 @@ void on_about(GtkWidget *self, char *version_application);
*/
void on_open_documentation_confirmation(GtkWidget *self, char *link);
void yon_entry_set_entry_type(GtkEntry *target,GtkBox *status);
int yon_ubl_setup_arguments(int argc, char *argv[],config_str *unfound_arguments, int *arguments_size, char *additional_options_output);
void yon_gtk_scrolled_window_set_horizontal_at_desired_size(GtkWidget *window, GtkScrolledWindow *target);
@ -245,11 +267,50 @@ void yon_save_window_set_postsave_function(void *function, void *data);
void yon_save_window_set_postsave_failure_function(void *function, void *data);
char *yon_get_default_label_with_parameter(char *command);
template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...);
void yon_on_space_first_changed(GtkEntry *editable);
enum CONFIGURATION_PARAMETER_TYPE{
CONFIGURATION_PARAMETER_BOOL,
CONFIGURATION_PARAMETER_ENTRY,
CONFIGURATION_PARAMETER_COMBO_BOX,
CONFIGURATION_PARAMETER_LIST_MULTIPLE
};
void yon_ubl_settings_window_init(GtkMenu *menu);
void *yon_ubl_settings_window_get(char *id);
void yon_configuration_window_add_boolean_parameter(enum CONFIGURATION_PARAMETER_TYPE type, char *id, char *label);
void yon_configuration_window_add_combo_box_parameter(enum CONFIGURATION_PARAMETER_TYPE type, char *id, char *label, GCallback func, gpointer data, ...);
char *yon_gtk_entry_check_restricted(GtkEntry *target);
typedef struct {
GtkWidget *window;
GtkWidget *WorkZoneBox;
GtkWidget *AcceptButton;
GtkWidget *CancelButton;
} ubl_settings_window;
char *yon_settings_configuration_get(char *id);
char *yon_custom_config_init();
#define VERSION_LABEL yon_char_unite(_("Version:")," ",!yon_char_is_empty(template_app_information.app_version)?template_app_information.app_version:"","\n",NULL)
#define HELP_LABEL(rest) yon_char_unite(template_app_information.app_tech_name,_(" version:")," ", !yon_char_is_empty(template_app_information.app_version)?template_app_information.app_version:"","\n",template_app_information.app_title,"\n",_("Usage:"), " ",template_app_information.app_tech_name," ",_("[OPTIONS]"),"\n",_("Options:"),"\n\t--help, -h\t\t\t",_("Show this help"),"\n\t--version, -V\t\t\t",_("Show package version"),"\n\t--lock-help\t\t\t",_("Lock this help menu"),"\n\t--lock-save\t\t\t",_("Lock configuration saving"),"\n\t--lock-save-local\t\t",_("Lock local configration saving"),"\n\t--lock-save-global\t\t",_("Lock global configration saving"),"\n\t--lock-load-global\t\t",_("Lock global configration loading"),"\n\t--clear-config\t\t\t",_("Reset application settings"),"\n",!yon_char_is_empty(rest)?rest:NULL,NULL)
#define HELP_LABEL(rest) yon_char_unite(template_app_information.app_tech_name,_(" version:")," ", !yon_char_is_empty(template_app_information.app_version)?template_app_information.app_version:"","\n",\
template_app_information.app_title,"\n",_("Usage:"), " ",template_app_information.app_tech_name," ",_("[OPTIONS]"),"\n",\
_("Options:"),"\n",\
" --help, -h ",_("Show this help"),"\n",\
" --version, -V ",_("Show package version"),"\n",\
" --lock-help ",_("Lock this help menu"),"\n",\
" --lock-save ",_("Lock configuration saving"),"\n",\
" --lock-save-local ",_("Lock local configration saving"),"\n",\
" --lock-save-global ",_("Lock global configration saving"),"\n",\
" --lock-load-global ",_("Lock global configration loading"),"\n",\
" --clear-config, -c ",_("Reset application settings"),"\n",\
!yon_char_is_empty(rest)?rest:NULL,NULL)
#define template_ui_LocalePath "/usr/share/locale"
#define template_ui_LocaleName "libublsettingsui-gtk3"
@ -257,6 +318,8 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...);
#define SUCCESS_LABEL _("Operation succeeded")
#define ROOT_WARNING_LABEL _("Warning! Application was launched without root - root-dependent actions are locked")
#define DEFAULT_LABEL _("Default")
#define DEFAULT_CUSTOM_LABEL(target) yon_char_unite(_("Default")," (",target,")",NULL)
#define ABOUT_LABEL _("About")
#define DOCUMENTATION_LABEL _("Documentation")
@ -271,10 +334,13 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...);
#define LOAD_LOCAL_LABEL _("Load local configuration")
#define LOAD_GLOBAL_LABEL _("Load global configuration")
#define LOAD_LABEL _("Load")
#define LOAD_CONFIG_LABEL _("Load file")
#define CANCEL_LABEL _("Cancel")
#define ACCEPT_LABEL _("Accept")
#define OPEN_LABEL _("Open")
#define CREATE_FOLDER_LABEL _("Create directory")
#define SELECT_FOLDER_LABEL _("Select directory")
#define HELP_TITLE_LABEL _("Would you like to read documentation in the Web?")
#define HELP_INFO_LABEL _("You will be redirected to documentation website where documentation is\ntranslated and supported by community.")
@ -292,6 +358,7 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...);
#define GLOBAL_LOCAL_SAVE_SUCCESS_LABEL _("Local and global configuration saving succeeded.")
#define GLOBAL_SAVE_SUCCESS_LABEL _("Global configuration saving succeeded.")
#define LOCAL_SAVE_SUCCESS_LABEL _("Local configuration saving succeeded.")
#define SAVE_SUCCESS_LABEL _("Configuration saving succeeded.")
#define PARAMETER_LABEL _("Parameter")
#define OLD_VALUE_LABEL _("Old value")
@ -316,4 +383,15 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...);
#define CUSTOM_CONFIG_CREATION_ERROR_LABEL _("New configuration file creation failed")
#define ROOT_CHECK_LABEL _("Upgrade to root")
#define SETTINGS_TITLE_LABEL _("Settings")
#define CONFIG_WINDOW_MENU_LABEL _("Application settigs")
#define EMAIL_INVALID_LABEL _("Invalid email adress")
#define PATH_INVALID_LABEL _("Invalid path")
#define CHOOSE_FILE_LABEL _("Choose path")
#define FILE_CHOOSER_CHOOSE_FILDER_LABEL _("Choose directory instead of file")
#endif
Loading…
Cancel
Save