Print target selection

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
Sebastian Ramacher 2014-12-08 00:31:47 +01:00
parent 50ec6192be
commit 5780a99291
2 changed files with 10 additions and 2 deletions

View File

@ -580,9 +580,13 @@ cb_page_widget_text_selected(ZathuraPage* page, const char* text, void* data)
girara_setting_get(zathura->ui.session, "selection-notification", &notification);
if (notification == true) {
char* target = NULL;
girara_setting_get(zathura->ui.session, "selection-clipboard", &target);
char* stripped_text = g_strdelimit(g_strdup(text), "\n\t\r\n", ' ');
char* escaped_text = g_markup_printf_escaped(
_("Copied selected text to clipboard: %s"), stripped_text);
_("Copied selected text to selection %s: %s"), target, stripped_text);
g_free(target);
g_free(stripped_text);
girara_notify(zathura->ui.session, GIRARA_INFO, "%s", escaped_text);

View File

@ -229,11 +229,15 @@ GdkAtom* get_selection(zathura_t* zathura)
{
g_return_val_if_fail(zathura != NULL, NULL);
char* value;
char* value = NULL;
girara_setting_get(zathura->ui.session, "selection-clipboard", &value);
if (value == NULL) {
return NULL;
}
GdkAtom* selection = g_try_malloc(sizeof(GdkAtom));
if (selection == NULL) {
g_free(selection);
return NULL;
}