gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-anastasis-gtk] branch master updated: copy payto uri to clipboard


From: gnunet
Subject: [taler-anastasis-gtk] branch master updated: copy payto uri to clipboard
Date: Tue, 16 Mar 2021 18:19:11 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository anastasis-gtk.

The following commit(s) were added to refs/heads/master by this push:
     new 6f8287c  copy payto uri to clipboard
6f8287c is described below

commit 6f8287cbc1a9593c3002cf45e49bf58d988f9aa8
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Tue Mar 16 18:19:07 2021 +0100

    copy payto uri to clipboard
---
 contrib/anastasis_gtk_main_window.glade            | 24 ++++----
 src/anastasis/Makefile.am                          |  1 +
 .../anastasis-gtk_handle-payqr-selection-changed.c | 69 ++++++++++++++++++++++
 src/anastasis/anastasis-gtk_helper.c               |  2 +
 4 files changed, 85 insertions(+), 11 deletions(-)

diff --git a/contrib/anastasis_gtk_main_window.glade 
b/contrib/anastasis_gtk_main_window.glade
index c184453..03b97d8 100644
--- a/contrib/anastasis_gtk_main_window.glade
+++ b/contrib/anastasis_gtk_main_window.glade
@@ -93,6 +93,16 @@ Author: Christian Grothoff, Dennis Neufeld
     <property name="stock">gtk-go-down</property>
     <property name="icon_size">6</property>
   </object>
+  <object class="GtkListStore" id="unpaid_qrcodes_liststore">
+    <columns>
+      <!-- column-name qr -->
+      <column type="GdkPixbuf"/>
+      <!-- column-name url -->
+      <column type="gchararray"/>
+      <!-- column-name provider -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
   <object class="GtkWindow" id="anastasis_gtk_main_window">
     <property name="can-focus">False</property>
     <property name="events">GDK_BUTTON_PRESS_MASK | 
GDK_STRUCTURE_MASK</property>
@@ -1388,7 +1398,9 @@ Author: Christian Grothoff, Dennis Neufeld
                                                     <property 
name="enable-search">False</property>
                                                     <property 
name="search-column">1</property>
                                                     <child 
internal-child="selection">
-                                                      <object 
class="GtkTreeSelection"/>
+                                                      <object 
class="GtkTreeSelection" id="unpaid_qr_tree_selection">
+                                                        <signal name="changed" 
handler="unpaid_qr_tree_selection_changed_cb" swapped="no"/>
+                                                      </object>
                                                     </child>
                                                     <child>
                                                       <object 
class="GtkTreeViewColumn">
@@ -1912,14 +1924,4 @@ Author: Christian Grothoff, Dennis Neufeld
       </object>
     </child>
   </object>
-  <object class="GtkListStore" id="unpaid_qrcodes_liststore">
-    <columns>
-      <!-- column-name qr -->
-      <column type="GdkPixbuf"/>
-      <!-- column-name url -->
-      <column type="gchararray"/>
-      <!-- column-name provider -->
-      <column type="gchararray"/>
-    </columns>
-  </object>
 </interface>
diff --git a/src/anastasis/Makefile.am b/src/anastasis/Makefile.am
index 2fa19a4..03e3b10 100644
--- a/src/anastasis/Makefile.am
+++ b/src/anastasis/Makefile.am
@@ -38,6 +38,7 @@ anastasis_gtk_SOURCES = \
   anastasis-gtk_handle-method-post.c \
   anastasis-gtk_handle-method-question.c \
   anastasis-gtk_handle-method-sms.c \
+  anastasis-gtk_handle-payqr-selection-changed.c \
   anastasis-gtk_helper.c  anastasis-gtk_helper.h \
   os_installation.c
 
diff --git a/src/anastasis/anastasis-gtk_handle-payqr-selection-changed.c 
b/src/anastasis/anastasis-gtk_handle-payqr-selection-changed.c
new file mode 100644
index 0000000..1a9cd17
--- /dev/null
+++ b/src/anastasis/anastasis-gtk_handle-payqr-selection-changed.c
@@ -0,0 +1,69 @@
+/*
+     This file is part of anastasis-gtk.
+     Copyright (C) 2020 Anastasis SARL
+
+     Anastasis is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published
+     by the Free Software Foundation; either version 3, or (at your
+     option) any later version.
+
+     Anastasis is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with Anastasis; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
+*/
+/**
+ * @file src/anastasis/anastasis-gtk_handle-payqr-selection-changed.c
+ * @brief
+ * @author Christian Grothoff
+ */
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_util_lib.h>
+#include "anastasis-gtk_action.h"
+#include "anastasis-gtk_helper.h"
+#include <jansson.h>
+
+
+/**
+ * Callback invoked if the QR code selection changed.
+ *
+ * @param selection A GtkTreeSelection.
+ * @param user_data user data set when the signal handler was connected.
+ */
+void
+unpaid_qr_tree_selection_changed_cb (GtkTreeSelection *selection,
+                                    gpointer user_data)
+{
+  GtkTreeModel *model;
+  GtkTreeIter iter;
+  GtkClipboard *cb;
+
+  cb = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
+  GNUNET_assert (NULL != cb);
+  if (gtk_tree_selection_get_selected (selection,
+                                       &model,
+                                       &iter))
+  {
+    char *uri;
+
+    gtk_tree_model_get (model,
+                       &iter,
+                       AG_UQRMC_URL, &uri,
+                       -1);
+    gtk_clipboard_set_text (cb,
+                           uri,
+                           strlen (uri));
+    g_free (uri);    
+  }
+  else
+  {
+    gtk_clipboard_set_text (cb,
+                           "",
+                           0);
+  }
+}
diff --git a/src/anastasis/anastasis-gtk_helper.c 
b/src/anastasis/anastasis-gtk_helper.c
index 4360e6b..70a3bf1 100644
--- a/src/anastasis/anastasis-gtk_helper.c
+++ b/src/anastasis/anastasis-gtk_helper.c
@@ -33,6 +33,7 @@
 void
 AG_thaw ()
 {
+  AG_sensitive ("anastasis_gtk_main_window");
   GNUNET_assert (NULL == ra);
 }
 
@@ -40,6 +41,7 @@ AG_thaw ()
 void
 AG_freeze ()
 {
+  AG_insensitive ("anastasis_gtk_main_window");
   GNUNET_assert (NULL == ra);
 }
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]