[glade/glade-3-38] GladeUtils: make message dialog text selectable



commit 157b3563f7f65e77d3c1284544149f08fa6ecde6
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Fri Oct 9 17:07:43 2020 -0300

    GladeUtils: make message dialog text selectable
    
    Closes issue #355 "Make notification text selectable"

 gladeui/glade-utils.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/gladeui/glade-utils.c b/gladeui/glade-utils.c
index 6757c594..e8cfecbc 100644
--- a/gladeui/glade-utils.c
+++ b/gladeui/glade-utils.c
@@ -190,6 +190,13 @@ _glade_util_dialog_set_hig (GtkDialog *dialog)
   gtk_box_set_spacing (GTK_BOX (action_area), 6);
 }
 
+static void
+glade_util_ui_message_foreach (GtkWidget *widget, gpointer data)
+{
+  if (GTK_IS_LABEL (widget))
+    gtk_label_set_selectable (GTK_LABEL (widget), TRUE);
+}
+
 /**
  * glade_util_ui_message:
  * @parent: a #GtkWindow cast as a #GtkWidget
@@ -270,7 +277,11 @@ glade_util_ui_message (GtkWidget *parent,
   dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
                                    GTK_DIALOG_DESTROY_WITH_PARENT,
                                    message_type, buttons_type, NULL);
-  
+
+  /* Make labels selectable */
+  gtk_container_forall (GTK_CONTAINER (gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (dialog))),
+                        glade_util_ui_message_foreach, NULL);
+
   gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), string);
 
   if (widget)


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