[vte] clipboard: Use smart pointers
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] clipboard: Use smart pointers
- Date: Wed, 2 Dec 2020 15:35:33 +0000 (UTC)
commit 43b7e5235b8f6ae924be9c3705e6ab8ab6de73a4
Author: Christian Persch <chpe src gnome org>
Date: Wed Dec 2 16:35:26 2020 +0100
clipboard: Use smart pointers
src/clipboard-gtk.cc | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/src/clipboard-gtk.cc b/src/clipboard-gtk.cc
index 7be3f9a9..0a998973 100644
--- a/src/clipboard-gtk.cc
+++ b/src/clipboard-gtk.cc
@@ -18,6 +18,7 @@
#include "config.h"
#include "clipboard-gtk.hh"
+#include "gtk-glue.hh"
#include "widget.hh"
#include "vteinternal.hh"
@@ -175,12 +176,11 @@ private:
static int n_text_targets;
if (text_targets == nullptr) {
- auto list = gtk_target_list_new (nullptr, 0);
- gtk_target_list_add_text_targets (list,
- vte::to_integral(ClipboardFormat::TEXT));
+ auto list = vte::take_freeable(gtk_target_list_new(nullptr, 0));
+ gtk_target_list_add_text_targets(list.get(),
+ vte::to_integral(ClipboardFormat::TEXT));
- text_targets = gtk_target_table_new_from_list (list, &n_text_targets);
- gtk_target_list_unref (list);
+ text_targets = gtk_target_table_new_from_list(list.get(), &n_text_targets);
}
return {text_targets, n_text_targets};
@@ -191,16 +191,15 @@ private:
static int n_html_targets;
if (html_targets == nullptr) {
- auto list = gtk_target_list_new (nullptr, 0);
- gtk_target_list_add_text_targets (list,
- vte::to_integral(ClipboardFormat::TEXT));
- gtk_target_list_add (list,
- gdk_atom_intern_static_string("text/html"),
- 0,
- vte::to_integral(ClipboardFormat::HTML));
-
- html_targets = gtk_target_table_new_from_list (list, &n_html_targets);
- gtk_target_list_unref (list);
+ auto list = vte::take_freeable(gtk_target_list_new(nullptr, 0));
+ gtk_target_list_add_text_targets(list.get(),
+ vte::to_integral(ClipboardFormat::TEXT));
+ gtk_target_list_add(list.get(),
+ gdk_atom_intern_static_string("text/html"),
+ 0,
+ vte::to_integral(ClipboardFormat::HTML));
+
+ html_targets = gtk_target_table_new_from_list(list.get(), &n_html_targets);
}
return {html_targets, n_html_targets};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]