[gtk/matthiasc/for-master: 21/24] widget-factory: Make print a window action



commit 8de774dde18f4a81b2501cd10f4711e63f1f15b2
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Apr 26 10:19:44 2020 -0400

    widget-factory: Make print a window action
    
    We want to pass the parent window when opening
    a print dialog, so this is naturally a window
    action.

 demos/widget-factory/widget-factory.c  | 10 +++++++++-
 demos/widget-factory/widget-factory.ui |  6 +++---
 2 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c
index 4b728c3a6c..931a72d625 100644
--- a/demos/widget-factory/widget-factory.c
+++ b/demos/widget-factory/widget-factory.c
@@ -323,6 +323,14 @@ activate_inspector (GSimpleAction *action,
   gtk_window_set_interactive_debugging (TRUE);
 }
 
+static void
+activate_print (GSimpleAction *action,
+                GVariant      *parameter,
+                gpointer       user_data)
+{
+  g_print ("Activate action %s\n", g_action_get_name (G_ACTION (action)));
+}
+
 static void
 spin_value_changed (GtkAdjustment *adjustment, GtkWidget *label)
 {
@@ -1714,6 +1722,7 @@ activate (GApplication *app)
     { "open", activate_open, NULL, NULL, NULL },
     { "record", activate_record, NULL, NULL, NULL },
     { "lock", activate_lock, NULL, NULL, NULL },
+    { "print", activate_print, NULL, NULL, NULL },
   };
   struct {
     const gchar *action_and_target;
@@ -2077,7 +2086,6 @@ main (int argc, char *argv[])
     { "water", NULL, NULL, "true", NULL },
     { "dessert", NULL, "s", "'bars'", NULL },
     { "pay", NULL, "s", NULL, NULL },
-    { "print", activate_action, NULL, NULL, NULL },
     { "share", activate_action, NULL, NULL, NULL },
     { "labels", activate_action, NULL, NULL, NULL },
     { "new", activate_action, NULL, NULL, NULL },
diff --git a/demos/widget-factory/widget-factory.ui b/demos/widget-factory/widget-factory.ui
index e0e59b62ec..3c20be450a 100644
--- a/demos/widget-factory/widget-factory.ui
+++ b/demos/widget-factory/widget-factory.ui
@@ -2482,7 +2482,7 @@ microphone-sensitivity-medium-symbolic</property>
                                             <child>
                                               <object class="GtkButton" id="print_button">
                                                 <property name="label">Print</property>
-                                                <property name="action-name">app.print</property>
+                                                <property name="action-name">win.print</property>
                                               </object>
                                             </child>
                                           </object>
@@ -3310,7 +3310,7 @@ bad things might happen.</property>
                           </object>
                         </property>
                         <property name="iconic">1</property>
-                        <property name="action-name">app.print</property>
+                        <property name="action-name">win.print</property>
                         <property name="hexpand">1</property>
                         <property name="halign">center</property>
                         <style>
@@ -3533,7 +3533,7 @@ bad things might happen.</property>
       <attribute name="display-hint">circular-buttons</attribute>
       <item>
         <attribute name="verb-icon">printer-symbolic</attribute>
-        <attribute name="action">app.print</attribute>
+        <attribute name="action">win.print</attribute>
       </item>
       <item>
         <attribute name="verb-icon">emblem-shared-symbolic</attribute>


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