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
6239dcfd
Commit
6239dcfd
authored
Feb 14, 2019
by
Victor Ananjevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add --icon-size option to icon dialog
parent
5959f512
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
57 additions
and
10 deletions
+57
-10
yad.1
data/yad.1
+3
-0
ru.po
po/ru.po
+0
-0
uk.po
po/uk.po
+0
-0
icons.c
src/icons.c
+46
-7
notification.c
src/notification.c
+3
-2
option.c
src/option.c
+4
-1
yad.h
src/yad.h
+1
-0
No files found.
data/yad.1
View file @
6239dcfd
...
...
@@ -380,6 +380,9 @@ Sending \fIFormFeed\fP character clears iconbox.
.B \-\-item-width
Set items width.
.TP
.B \-\-icon-size
Force using specified icon size. This option doesn't work in compact mode.
.TP
.B \-\-compact
Use compact mode. Icon and name of each item is placed in a single row.
.TP
...
...
po/ru.po
View file @
6239dcfd
This diff is collapsed.
Click to expand it.
po/uk.po
View file @
6239dcfd
This diff is collapsed.
Click to expand it.
src/icons.c
View file @
6239dcfd
...
...
@@ -45,6 +45,33 @@ typedef struct {
gboolean
in_term
;
}
DEntry
;
static
GdkPixbuf
*
scale_pixbuf
(
GdkPixbuf
*
pb
)
{
GdkPixbuf
*
res
;
if
(
!
pb
)
return
NULL
;
if
(
options
.
common_data
.
icon_size
>
0
)
{
guint
width
,
height
;
width
=
gdk_pixbuf_get_width
(
pb
);
height
=
gdk_pixbuf_get_height
(
pb
);
if
(
options
.
common_data
.
icon_size
!=
width
||
options
.
common_data
.
icon_size
!=
height
)
res
=
gdk_pixbuf_scale_simple
(
pb
,
options
.
common_data
.
icon_size
,
options
.
common_data
.
icon_size
,
GDK_INTERP_BILINEAR
);
else
res
=
g_object_ref
(
pb
);
}
else
res
=
g_object_ref
(
pb
);
return
res
;
}
static
void
select_cb
(
GObject
*
obj
,
gpointer
data
)
{
...
...
@@ -148,7 +175,7 @@ handle_stdin (GIOChannel * channel, GIOCondition condition, gpointer data)
do
{
GdkPixbuf
*
pb
;
GdkPixbuf
*
spb
=
NULL
;
gint
status
;
do
...
...
@@ -207,15 +234,22 @@ handle_stdin (GIOChannel * channel, GIOCondition condition, gpointer data)
}
case
COL_PIXBUF
:
if
(
options
.
icons_data
.
compact
)
{
if
(
*
string
->
str
)
pb
=
get_pixbuf
(
string
->
str
,
YAD_SMALL_ICON
);
else
pb
=
NULL
;
spb
=
get_pixbuf
(
string
->
str
,
YAD_SMALL_ICON
);
}
else
pb
=
get_pixbuf
(
string
->
str
,
YAD_BIG_ICON
);
gtk_list_store_set
(
GTK_LIST_STORE
(
model
),
&
iter
,
column_count
,
pb
,
-
1
);
{
GdkPixbuf
*
pb
=
get_pixbuf
(
string
->
str
,
YAD_BIG_ICON
);
if
(
pb
)
{
spb
=
scale_pixbuf
(
pb
);
g_object_unref
(
pb
);
}
}
gtk_list_store_set
(
GTK_LIST_STORE
(
model
),
&
iter
,
column_count
,
spb
,
-
1
);
if
(
spb
)
g_object_unref
(
spb
);
break
;
case
COL_TERM
:
gtk_list_store_set
(
GTK_LIST_STORE
(
model
),
&
iter
,
column_count
,
get_bool_val
(
string
->
str
),
-
1
);
...
...
@@ -324,7 +358,12 @@ parse_desktop_file (gchar * filename)
if
(
options
.
icons_data
.
compact
)
ent
->
pixbuf
=
get_pixbuf
(
icon
,
YAD_SMALL_ICON
);
else
ent
->
pixbuf
=
get_pixbuf
(
icon
,
YAD_BIG_ICON
);
{
GdkPixbuf
*
pb
=
get_pixbuf
(
icon
,
YAD_BIG_ICON
);
ent
->
pixbuf
=
scale_pixbuf
(
pb
);
if
(
pb
)
g_object_unref
(
pb
);
}
g_free
(
icon
);
}
}
...
...
src/notification.c
View file @
6239dcfd
...
...
@@ -111,8 +111,9 @@ set_icon (void)
if
(
g_file_test
(
icon
,
G_FILE_TEST_EXISTS
))
{
pixbuf
=
gdk_pixbuf_new_from_file_at_scale
(
icon
,
options
.
notification_data
.
icon_size
,
options
.
notification_data
.
icon_size
,
TRUE
,
&
err
);
gint
isize
=
(
options
.
common_data
.
icon_size
>
0
)
?
options
.
common_data
.
icon_size
:
16
;
pixbuf
=
gdk_pixbuf_new_from_file_at_scale
(
icon
,
isize
,
isize
,
TRUE
,
&
err
);
if
(
err
)
{
g_printerr
(
_
(
"Could not load notification icon '%s': %s
\n
"
),
icon
,
err
->
message
);
...
...
src/option.c
View file @
6239dcfd
...
...
@@ -380,6 +380,8 @@ static GOptionEntry icons_options[] = {
N_
(
"Use GenericName field instead of Name for icon label"
),
NULL
},
{
"item-width"
,
0
,
0
,
G_OPTION_ARG_INT
,
&
options
.
icons_data
.
width
,
N_
(
"Set the width of dialog items"
),
NULL
},
{
"icon-size"
,
0
,
G_OPTION_FLAG_NOALIAS
,
G_OPTION_ARG_INT
,
&
options
.
common_data
.
icon_size
,
N_
(
"Force using specified icon size"
),
N_
(
"SIZE"
)
},
{
"term"
,
0
,
0
,
G_OPTION_ARG_STRING
,
&
options
.
icons_data
.
term
,
/* xgettext: no-c-format */
N_
(
"Use specified pattern for launch command in terminal (default: xterm -e %s)"
),
N_
(
"PATTERN"
)
},
...
...
@@ -502,7 +504,7 @@ static GOptionEntry notification_options[] = {
N_
(
"Disable exit on middle click"
),
NULL
},
{
"hidden"
,
0
,
0
,
G_OPTION_ARG_NONE
,
&
options
.
notification_data
.
hidden
,
N_
(
"Doesn't show icon at startup"
),
NULL
},
{
"icon-size"
,
0
,
0
,
G_OPTION_ARG_INT
,
&
options
.
notificati
on_data
.
icon_size
,
{
"icon-size"
,
0
,
G_OPTION_FLAG_NOALIAS
,
G_OPTION_ARG_INT
,
&
options
.
comm
on_data
.
icon_size
,
N_
(
"Set icon size for fully specified icons (default - 16)"
),
N_
(
"SIZE"
)
},
{
NULL
}
};
...
...
@@ -1503,6 +1505,7 @@ yad_options_init (void)
options
.
common_data
.
key
=
-
1
;
options
.
common_data
.
bool_fmt
=
YAD_BOOL_FMT_UT
;
options
.
common_data
.
complete
=
YAD_COMPLETE_SIMPLE
;
options
.
common_data
.
icon_size
=
0
;
#if GLIB_CHECK_VERSION(2,30,0)
options
.
common_data
.
size_fmt
=
G_FORMAT_SIZE_DEFAULT
;
#endif
...
...
src/yad.h
View file @
6239dcfd
...
...
@@ -466,6 +466,7 @@ typedef struct {
gboolean
show_hidden
;
gboolean
quoted_output
;
gboolean
num_output
;
gint
icon_size
;
#if GLIB_CHECK_VERSION(2,30,0)
GFormatSizeFlags
size_fmt
;
#endif
...
...
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