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
8d5a53ed
Commit
8d5a53ed
authored
Apr 17, 2021
by
Victor Ananjevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add --in-place option to text-info dialog
parent
1f54c751
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
0 deletions
+33
-0
yad.1
data/yad.1
+3
-0
ru.po
po/ru.po
+0
-0
uk.po
po/uk.po
+0
-0
option.c
src/option.c
+3
-0
text.c
src/text.c
+23
-0
yad.h
src/yad.h
+4
-0
No files found.
data/yad.1
View file @
8d5a53ed
...
...
@@ -963,6 +963,9 @@ Set color for links. Default is \fIblue\fP.
.B \-\-listen
Listen data from stdin even if filename was specified.
.TP
.B \-\-in-place
Save file on exit instead of print it content on stdout. This option works only if file was specified from command-line.
.TP
Next options works only if yad builds with GtkSourceView.
.TP
.B \-\-lang=\fILANGUAGE\fP
...
...
po/ru.po
View file @
8d5a53ed
This diff is collapsed.
Click to expand it.
po/uk.po
View file @
8d5a53ed
This diff is collapsed.
Click to expand it.
src/option.c
View file @
8d5a53ed
...
...
@@ -650,6 +650,8 @@ static GOptionEntry text_options[] = {
N_
(
"Use specified color for links"
),
N_
(
"COLOR"
)
},
{
"formatted"
,
0
,
0
,
G_OPTION_ARG_NONE
,
&
options
.
text_data
.
formatted
,
N_
(
"Use pango markup"
),
NULL
},
{
"in-place"
,
0
,
0
,
G_OPTION_ARG_NONE
,
&
options
.
text_data
.
in_place
,
N_
(
"Save file instead of print on exit"
),
NULL
},
{
NULL
}
};
...
...
@@ -1839,6 +1841,7 @@ yad_options_init (void)
options
.
text_data
.
uri_color
=
URI_COLOR
;
#endif
options
.
text_data
.
formatted
=
FALSE
;
options
.
text_data
.
in_place
=
FALSE
;
#ifdef HAVE_SOURCEVIEW
/* Initialize sourceview data */
...
...
src/text.c
View file @
8d5a53ed
...
...
@@ -644,6 +644,29 @@ text_print_result (void)
gtk_text_buffer_get_bounds
(
GTK_TEXT_BUFFER
(
text_buffer
),
&
start
,
&
end
);
text
=
gtk_text_buffer_get_text
(
GTK_TEXT_BUFFER
(
text_buffer
),
&
start
,
&
end
,
0
);
if
(
options
.
text_data
.
in_place
&&
options
.
common_data
.
uri
)
{
GStatBuf
st
;
GError
*
err
=
NULL
;
/* g_file_set_contents changes the file permissions. so it must kept and restore after file saving */
if
(
g_stat
(
options
.
common_data
.
uri
,
&
st
)
==
0
)
{
if
(
!
g_file_set_contents
(
options
.
common_data
.
uri
,
text
,
-
1
,
&
err
))
{
g_printerr
(
"Cannot save file %s: %s
\n
"
,
options
.
common_data
.
uri
,
err
->
message
);
g_error_free
(
err
);
}
else
{
/* restore permissions */
g_chmod
(
options
.
common_data
.
uri
,
st
.
st_mode
);
}
}
else
g_printerr
(
"Cannot stat file %s
\n
"
,
options
.
common_data
.
uri
);
}
else
g_print
(
"%s"
,
text
);
g_free
(
text
);
}
src/yad.h
View file @
8d5a53ed
...
...
@@ -23,7 +23,9 @@
#include <config.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ipc.h>
#include <fcntl.h>
#include <gdk/gdkx.h>
...
...
@@ -33,6 +35,7 @@
#include <glib/gi18n.h>
#include <glib/gprintf.h>
#include <glib/gstdio.h>
#ifdef HAVE_HTML
#include <webkit2/webkit2.h>
...
...
@@ -469,6 +472,7 @@ typedef struct {
gboolean
formatted
;
gchar
*
fore
;
gchar
*
back
;
gboolean
in_place
;
}
YadTextData
;
#ifdef HAVE_SOURCEVIEW
...
...
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