spk-gui - GTK3 front-end for the SliTaz spk toolset
================================================================================

spk-gui is the graphical companion of spk-tui. Like the TUI it contains
NO package logic: everything it shows comes from the spk-* tools' --raw
(TSV) output, and every change goes through spk-add, spk-rm or spk-up,
whose --raw milestone stream is displayed live in a dialog.

	$ make gui              # needs gtk+3-dev, gcc, pkg-config
	$ make install-gui      # /usr/bin/spk-gui + data/spk-gui.desktop
	$ spk-gui [search]      # optional argument prefills the search box

Run as root (the .desktop uses `tazbox su spk-gui`) to install, remove
and upgrade. As a plain user the window is read-only: browse, search,
read details, and a "Relaunch as administrator" button re-execs the
program through tazbox su.


Layout
-------------------------------------------------------------------------------

	+-------------------------------------------------------------+
	| [search........]  SliTaz Packages   (refresh) (N updates) (=)|
	| info bar: browsing only ... [Relaunch as administrator]      |
	+-----------+--------------------------------+----------------+
	| Packages  | v  Package    Version  Descr.  | name           |
	|  All      |    gimp       2.8.20   Gnu ... | ver . category |
	|  Installed|                                | [Installed]    |
	|  Available|                                | short desc     |
	|  Updates  |                                | [ Remove ]     |
	| Categories|                                | long desc      |
	|  Base sys.|                                | Web site, Tags |
	|  ...      |                                | Size, Depends  |
	+-----------+--------------------------------+ > Installed files
	| N packages shown                                              |
	+-------------------------------------------------------------+

Keyboard: Ctrl+F search, F5 refresh lists, Ctrl+Q quit.


Modules (one concern per file)
-------------------------------------------------------------------------------

	spk-gui.c   main(): GtkApplication, locale, --version, search arg
	window.c    assembles the panes, header bar, menu and actions;
	            the only module that knows about all the others and
	            the only one that launches spk-add/rm/up/doctor
	catalog.c   data layer: loads spk-ls --mirror/--raw in a thread
	            (via tui/backend.c), merges into one sorted list,
	            categories, long descriptions, file lists, upgradable map
	pkgview.c   GtkTreeView + in-memory filter (text/category/state)
	sidebar.c   GtkListBox with states and categories (+ counts)
	details.c   right pane, Install/Remove/Upgrade button
	apply.c     modal dialog streaming a --raw command (GSubprocess)
	updates.c   spk-up --check --raw -> name -> new version map
	style.c     small CSS on top of the user's GTK theme

	../tui/backend.c is shared with spk-tui (TSV parsing, pkg_t,
	pkg_load_detail). Do not duplicate it.

Data flow: window -> catalog_load_async -> on_loaded -> sidebar_fill +
pkgview_fill -> (root) updates_check_async -> pkgview_fill again.
A mutation: details button -> window on_action -> apply_run(spk-add
--raw pkg) -> on_apply_done -> catalog_load_async (full reload, the
selected package is re-selected by name).


Conventions
-------------------------------------------------------------------------------

* Package names are validated by catalog_name_ok() before being passed
  to any tool run as root (a hostile mirror controls packages.info).
* Commands use absolute paths (/usr/sbin/spk-add ...) like spk-tui.
* A running install/remove is never killed: the apply dialog cannot be
  closed until the tool has finished.
* Strings go through gettext (_ / N_), domain "spk"; `make pot` picks
  them up from gui/*.c.
* Keep modules talking through their small headers and callbacks; no
  global state, no module reaching into another's struct.
* SPK_GUI_DEBUG=1 prints the search filter results and the details
  pane width requests on stderr (layout / performance debugging).
* Test without touching the real desktop:
      Xvfb :7 -screen 0 1400x900x24 &
      DISPLAY=:7 ./gui/spk-gui          # or sudo -E env DISPLAY=:7 ...
      DISPLAY=:7 scrot -o shot.png
