1 .\" Copyright (c) 2014, 2015 Bert Burgemeister <trebbu@googlemail.com>
3 .\" Permission is hereby granted, free of charge, to any person obtaining
4 .\" a copy of this software and associated documentation files (the
5 .\" "Software"), to deal in the Software without restriction, including
6 .\" without limitation the rights to use, copy, modify, merge, publish,
7 .\" distribute, sublicense, and/or sell copies of the Software, and to
8 .\" permit persons to whom the Software is furnished to do so, subject to
9 .\" the following conditions:
11 .\" The above copyright notice and this permission notice shall be
12 .\" included in all copies or substantial portions of the Software.
14 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 .\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 .\" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 .\" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 .\" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 .\" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 .Nd Pipe-Driven GTK+ Interface
36 .Op Fl u Ar builder-file
39 is a helper program that displays graphical user
40 interfaces for other programs. It renders the GUI definition
41 found in a GtkBuilder XML file (created using the
43 interface designer), and communicates with the main program solely
44 through plain text messages via pipes or fifos. It provides access to
45 a subset of features of a subset of widgets of GTK+ 3. Simple
46 one-shot dialogs as well as more complex, long-running programs can be
54 Prints a help message and exits.
58 if necessary, and uses it for input. It is an error if
60 exists but is not a named pipe. The named pipe
62 is deleted upon successful program termination. Default is
65 .Sx GUI MANIPULATION COMMANDS
66 for a list of commands understood by pipeglade.
70 if necessary, and uses it for output. It is an error if
72 exists but is not a named pipe. The named pipe
74 is deleted upon successful program termination. Default is
77 .Sx GUI FEEDBACK MESSAGES
78 for a description of possible output.
79 .It Fl u Ar builder-file
80 Displays the graphical user interface described in
85 Prints the GTK+ version and exits.
91 .Sh INTERFACE CREATION (USING GLADE)
92 The interface should be created using the
94 user interface designer and saved in GtkBuilder (.ui) format. Widget
95 names should be alphanumeric, including underscores. The main window
100 signal should be connected to
102 Certain signals of the other widgets should be connected to
104 .Sx GUI FEEDBACK MESSAGES
105 for callback names and which signals of which widgets to connect to
107 .Sh GUI MANIPULATION COMMANDS
108 A command is a line of text. Lines whose first non-whitespace
111 are considered comments and ignored.
112 Any occurences of the two-character sequences
116 will be converted into newline or carriage return, respectively.
117 Every other character following a backslash will be left unchanged,
118 but the backslash will be removed.
119 The format of the commands is
128 is the name of the receiving widget.
130 is separated from the rest of the command by whitespace.
132 Invalid commands are reported on
134 and are otherwise ignored.
136 Widgets that can be manipulated programmatically, and the relevant
137 commands, are given below.
144 replaces the label text with
149 .Ic :set_from_icon_name
152 replaces the image with one of the standard icons.
159 replaces the image by the one found at
167 replaces the user-editable text with
175 replaces the user-editable text with
186 .Ic :insert_at_cursor
195 .Ic :place_cursor Brq Fa position | Ic end
197 places the text cursor at
199 or at the end of the text.
203 .Ic :place_cursor_at_line
206 places the text cursor at the beginning of
211 .Ic :scroll_to_cursor
213 scrolls to the cursor position if necessary.
220 replaces the button text with
225 .Ic :set_active Brq Ic 0 | 1
234 .Ic :set_active Brq Ic 0 | 1
236 switches the button off
246 replaces the button text with
251 .Ic :set_active Brq Ic 0 | 1
253 switches the check mark off
263 replaces the button text with
270 switches the button on. All other buttons of the same group will go off
278 replaces the button text with
286 sets the selected value to
294 moves the slider to value
302 moves the progress bar to
313 replaces the text of the progress bar with
325 start and stop the spinner.
340 removes the last entry from the statusbar, revealing the penultimate
356 as a new selectable item.
379 refer to the underlying model (usually a
387 replaces the content at
391 (which should be compatible with the type of
396 .Ic :insert_row Brq Fa position | Ic end
398 inserts a new, empty row at
400 or at the end of the list.
405 .Fa origin Brq Fa destination | Ic end
411 or to the end of the list.
435 preselects the color.
438 .Bl -dash -offset indent -compact
440 a standard X11 color name, like
441 .Qq Li Dark Sea Green ,
443 a hexadecimal value in the form
454 an RGB color in the form
464 an RGBA color in the form
475 The last two are in the format the widget reports; see
476 .Sx GUI FEEDBACK MESSAGES .
484 .Ss GtkFileChooserButton
492 to the extent it exists.
493 .Ss GtkFileChooserDialog
501 to the extent it exists.
505 .Ic :set_current_name
510 the suggested filename, which may not yet exist.
512 should either resemble an absolute path, or the
544 unmarks all days on the calendar.
550 kills the user interface. A non-empty
552 is required but ignored.
559 makes the widget grayed out
571 the widget, or makes it visible
578 initiates the standard callback. The
583 had been activated, but with a different
591 The command doesn't change anything on the GUI.
592 .Sh GUI FEEDBACK MESSAGES
593 A message from the graphical user interface is a line of text. The
600 Message sending is initiated by callbacks. Callbacks are connected to
601 certain signals; this has to be done in
603 as part of the interface design.
605 provides the following callbacks:
606 .Bl -dash -offset indent -compact
608 .Ic cb_0 , cb_1 , cb_2 ,
611 are callbacks for use in various widgets. Their action depends on the
612 particular widget they are called from. The callbacks are identical
615 strings they send; the respective messages look like
639 is a callback that hides the window the originator is in. Its main
640 purpose is hiding of dialog windows. It doesn't report anything.
642 .Ic cb_send_dialog_selection
643 is a callback that sends the item the user has selected in a dialog.
658 is a callback that sends the content of the GtkTextBuffer that is
659 passed as user data. It reports
669 and backslashes are replaced by
672 .Ic cb_send_text_selection
673 is a callback that sends the highlighted part of the GtkTextBuffer
674 that is passed as user data. It reports
684 and backslashes are replaced by
688 The widgets capable of reporting user activity are:
690 There should be a dedicated
692 for sending (parts of) the text.
697 should be connected to either
700 .Ic cb_send_text_selection ,
716 being the name of the
721 signal should be connected to one of
722 .Ic cb_0 , cb_1 , cb_2 ,
735 signal should be connected to one of
736 .Ic cb_0 , cb_1 , cb_2 ,
746 if it is switched on, or
754 .Ss GtkToggleButton, GtkCheckButton, GtkRadioButton
757 signal should be connected to one of
758 .Ic cb_0 , cb_1 , cb_2 ,
768 if they are switched on, or
776 .Ss GtkEntry, GtkComboBoxText, GtkSpinButton
779 signal should be connected to one of
780 .Ic cb_0 , cb_1 , cb_2 ,
792 signal should be connected to one of
793 .Ic cb_0 , cb_1 , cb_2 ,
800 .Fa section floating_point_text
805 signal in the subordinated
807 should be connected to one of
808 .Ic cb_0 , cb_1 , cb_2 ,
816 and, if the set of selected rows has changed,
820 .Fa section row column value
822 one message per row and column in the underlying model.
824 can deal with columns of type
825 .Ic gboolean , gint , guint , glong , gulong , gint64 , guint64 , gfloat , gdouble ,
828 .Ss GtkTreeViewColumn
831 signal should be connected to one of
832 .Ic cb_0 , cb_1 , cb_2 ,
842 .Ss GtkFileChooserDialog (when subordinated to another window)
845 signal should be connected to
848 .Ic GtkFileChooserDialog
861 .Ic GtkFileChooserDialog
863 .Sx GtkMenuItem, GtkImageMenuItem
864 for their setup). The
865 .Ic GtkFileChooserDialog
871 signal connected to both
872 .Ic cb_send_dialog_selection
874 .Ic cb_hide_toplevel .
881 .Ic cb_hide_toplevel .
894 .Ss GtkFileChooserDialog (as the sole window)
899 signal should be connected to
902 .Ic GtkFileChooserDialog
908 signal connected to both
909 .Ic cb_send_dialog_selection
931 .Ss GtkDialog (when subordinated to another window)
934 signal should be connected to
952 .Sx GtkMenuItem, GtkImageMenuItem
953 for their setup). The
961 .Ic cb_hide_toplevel .
962 The widget doesn't report anything.
963 .Ss GtkDialog (as the sole window)
968 signal should be connected to
979 The widget doesn't report anything.
980 .Ss GtkFileChooserButton
983 signal should be connected to one of
984 .Ic cb_0 , cb_1 , cb_2 ,
993 if the user has changed the selection.
997 signal should be connected to one of
998 .Ic cb_0 , cb_1 , cb_2 ,
1032 lie between 0 and 255, and
1038 signal should be connected to one of
1039 .Ic cb_0 , cb_1 , cb_2 ,
1046 .Fa section fontname
1048 .Ss GtkMenuItem, GtkImageMenuItem
1051 signal should be connected to one of
1052 .Ic cb_0 , cb_1 , cb_2 ,
1058 .Ic GtkImageMenuItem
1064 .Ic GtkFileChooserDialog
1068 if it exists. If there isn't any dialog attached to the
1080 .Ic day-selected-doubleclick
1081 signals should be connected to one or two of
1082 .Ic cb_0 , cb_1 , cb_2 ,
1096 .Ss Discovering Pipeglade Interactively
1097 Suppose the interface in
1107 signal is connected to
1114 will be reported on the terminal. Typing
1115 .Dl l1:set_text Button Label
1116 will change the text shown on the label into
1118 .Ss One-Shot File Dialog
1119 Suppose the interface in
1120 .Pa ./simple_open.ui
1122 .Ic GtkFileChooserDialog
1128 signal is connected to both
1129 .Ic cb_send_dialog_selection
1133 .Dl pipeglade -u simple_open.ui
1134 will open the dialog; pressing
1136 will close it after sending the selected filename to
1138 .Ss One-Shot User Notification
1140 .Pa ./simple_dialog.ui
1145 .Dl pipeglade -u simple_dialog.ui <<< \e
1146 .Dl \ \ \ \ \&"label1:set_text NOW READ THIS!\&"
1147 will set the label text accordingly and wait for user input.
1148 .Ss Continuous Input
1149 The following shell command displays a running clock:
1151 .Dl \ \ \ \ echo \&"label1:set_text `date`\&";
1152 .Dl \ \ \ \ sleep 1;
1153 .Dl done | pipeglade -u simple_dialog.ui
1154 .Ss Continuous Input and Output
1155 The following shell script fragment sets up
1157 for continuous communication with another program,
1159 .Dl pipeglade -i in.fifo -o out.fifo &
1160 .Dl # wait for in.fifo and out.fifo to appear
1161 .Dl while test \& ! \e( -e in.fifo -a -e out.fifo \e); do :; done
1162 .Dl main_prog <out.fifo >in.fifo
1165 exits 0 on success, and >0 if an error occurs.
1177 .An Bert Burgemeister Aq trebbu@googlemail.com .