Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yad
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav
yad
Commits
902e5190
You need to sign in or sign up before continuing.
Commit
902e5190
authored
Apr 22, 2020
by
Victor Ananjevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use markup and tooltips in lists column headers
parent
b71b5d3e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
8 deletions
+48
-8
yad.1
data/yad.1
+5
-0
list.c
src/list.c
+37
-6
option.c
src/option.c
+5
-2
yad.h
src/yad.h
+1
-0
No files found.
data/yad.1
View file @
902e5190
...
...
@@ -590,6 +590,8 @@ Size of icons may be set in gtk config file at GTK_ICON_SIZE_MENU position of gt
Special column names \fI@fore@\fP, \fI@back@\fP and \fI@font@\fP sets corresponding rows attributes.
Values of those columns don't show in results.
Column title can be specified in form \fIname!tooltip\fP and Pango markup can be used in \fIname\fP and \fItooltip\fP parts.
.TP
.B \-\-tree
Enbale tree mode. In this mode extra data in form \fIROW_ID[:PARENT_ID]\fP must be passed to yad before each row. See \fBEXAMPLES\fP for details.
...
...
@@ -711,6 +713,9 @@ Sending FormFeed character to list clears it. This symbol may be sent as \fIecho
.TP
.B \-\-simple-tips
Don't use markup in tooltips even if text has a valid markup.
.TP
.B \-\-header-tips
Use header name as a fallback tooltip text.
.SS Notebook options
.TP
...
...
src/list.c
View file @
902e5190
...
...
@@ -313,6 +313,32 @@ size_col_format (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *mo
}
static
void
set_column_title
(
GtkTreeViewColumn
*
col
,
gchar
*
title
)
{
GtkWidget
*
lbl
;
gchar
**
str
;
str
=
g_strsplit
(
title
,
options
.
common_data
.
item_separator
,
2
);
lbl
=
gtk_label_new
(
NULL
);
if
(
options
.
data
.
no_markup
)
{
gtk_label_set_text
(
GTK_LABEL
(
lbl
),
str
[
0
]);
if
(
str
[
1
]
||
options
.
list_data
.
header_tips
)
gtk_widget_set_tooltip_text
(
lbl
,
str
[
1
]
?
str
[
1
]
:
str
[
0
]);
}
else
{
gtk_label_set_markup
(
GTK_LABEL
(
lbl
),
str
[
0
]);
if
(
str
[
1
]
||
options
.
list_data
.
header_tips
)
gtk_widget_set_tooltip_markup
(
lbl
,
str
[
1
]
?
str
[
1
]
:
str
[
0
]);
}
gtk_widget_show
(
lbl
);
gtk_tree_view_column_set_widget
(
col
,
lbl
);
}
static
void
add_columns
()
{
gint
i
;
...
...
@@ -332,7 +358,8 @@ add_columns ()
case
YAD_COLUMN_CHECK
:
case
YAD_COLUMN_RADIO
:
renderer
=
gtk_cell_renderer_toggle_new
();
column
=
gtk_tree_view_column_new_with_attributes
(
col
->
name
,
renderer
,
"active"
,
i
,
NULL
);
column
=
gtk_tree_view_column_new_with_attributes
(
NULL
,
renderer
,
"active"
,
i
,
NULL
);
set_column_title
(
column
,
col
->
name
);
if
(
back_col
!=
-
1
)
gtk_tree_view_column_add_attribute
(
column
,
renderer
,
"cell-background"
,
back_col
);
if
(
col
->
type
==
YAD_COLUMN_RADIO
)
...
...
@@ -345,7 +372,8 @@ add_columns ()
break
;
case
YAD_COLUMN_IMAGE
:
renderer
=
gtk_cell_renderer_pixbuf_new
();
column
=
gtk_tree_view_column_new_with_attributes
(
col
->
name
,
renderer
,
"pixbuf"
,
i
,
NULL
);
column
=
gtk_tree_view_column_new_with_attributes
(
NULL
,
renderer
,
"pixbuf"
,
i
,
NULL
);
set_column_title
(
column
,
col
->
name
);
if
(
back_col
!=
-
1
)
gtk_tree_view_column_add_attribute
(
column
,
renderer
,
"cell-background"
,
back_col
);
break
;
...
...
@@ -358,7 +386,8 @@ add_columns ()
g_object_set
(
G_OBJECT
(
renderer
),
"editable"
,
TRUE
,
NULL
);
g_signal_connect
(
renderer
,
"edited"
,
G_CALLBACK
(
cell_edited_cb
),
NULL
);
}
column
=
gtk_tree_view_column_new_with_attributes
(
col
->
name
,
renderer
,
"text"
,
i
,
NULL
);
column
=
gtk_tree_view_column_new_with_attributes
(
NULL
,
renderer
,
"text"
,
i
,
NULL
);
set_column_title
(
column
,
col
->
name
);
if
(
fore_col
!=
-
1
)
gtk_tree_view_column_add_attribute
(
column
,
renderer
,
"foreground"
,
fore_col
);
if
(
back_col
!=
-
1
)
...
...
@@ -374,7 +403,8 @@ add_columns ()
break
;
case
YAD_COLUMN_BAR
:
renderer
=
gtk_cell_renderer_progress_new
();
column
=
gtk_tree_view_column_new_with_attributes
(
col
->
name
,
renderer
,
"value"
,
i
,
NULL
);
column
=
gtk_tree_view_column_new_with_attributes
(
NULL
,
renderer
,
"value"
,
i
,
NULL
);
set_column_title
(
column
,
col
->
name
);
if
(
back_col
!=
-
1
)
gtk_tree_view_column_add_attribute
(
column
,
renderer
,
"cell-background"
,
back_col
);
gtk_tree_view_column_set_sort_column_id
(
column
,
i
);
...
...
@@ -388,9 +418,10 @@ add_columns ()
g_signal_connect
(
renderer
,
"edited"
,
G_CALLBACK
(
cell_edited_cb
),
NULL
);
}
if
(
options
.
data
.
no_markup
)
column
=
gtk_tree_view_column_new_with_attributes
(
col
->
name
,
renderer
,
"text"
,
i
,
NULL
);
column
=
gtk_tree_view_column_new_with_attributes
(
NULL
,
renderer
,
"text"
,
i
,
NULL
);
else
column
=
gtk_tree_view_column_new_with_attributes
(
col
->
name
,
renderer
,
"markup"
,
i
,
NULL
);
column
=
gtk_tree_view_column_new_with_attributes
(
NULL
,
renderer
,
"markup"
,
i
,
NULL
);
set_column_title
(
column
,
col
->
name
);
if
(
col
->
ellipsize
)
g_object_set
(
G_OBJECT
(
renderer
),
"ellipsize"
,
options
.
list_data
.
ellipsize
,
NULL
);
if
(
col
->
wrap
)
...
...
src/option.c
View file @
902e5190
...
...
@@ -469,7 +469,9 @@ static GOptionEntry list_options[] = {
N_
(
"Add new records on the top of a list"
),
NULL
},
{
"simple-tips"
,
0
,
0
,
G_OPTION_ARG_NONE
,
&
options
.
list_data
.
simple_tips
,
N_
(
"Don't use markup in tooltips"
),
NULL
},
{
NULL
}
{
"header-tips"
,
0
,
0
,
G_OPTION_ARG_NONE
,
&
options
.
list_data
.
header_tips
,
N_
(
"Use column name as a header tooltip"
),
NULL
},
{
NULL
}
};
static
GOptionEntry
notebook_options
[]
=
{
...
...
@@ -1671,6 +1673,7 @@ yad_options_init (void)
options
.
list_data
.
no_selection
=
FALSE
;
options
.
list_data
.
add_on_top
=
FALSE
;
options
.
list_data
.
simple_tips
=
FALSE
;
options
.
list_data
.
header_tips
=
FALSE
;
/* Initialize notebook data */
options
.
notebook_data
.
tabs
=
NULL
;
...
...
@@ -1726,7 +1729,7 @@ yad_options_init (void)
options
.
scale_data
.
buttons
=
FALSE
;
options
.
scale_data
.
marks
=
NULL
;
options
.
scale_data
.
enforce_step
=
FALSE
;
/* Initialize text data */
options
.
text_data
.
wrap
=
FALSE
;
options
.
text_data
.
justify
=
GTK_JUSTIFY_LEFT
;
...
...
src/yad.h
View file @
902e5190
...
...
@@ -371,6 +371,7 @@ typedef struct {
gboolean
no_selection
;
gboolean
add_on_top
;
gboolean
simple_tips
;
gboolean
header_tips
;
}
YadListData
;
typedef
struct
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment