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.
This commit is contained in:
Matthias Clasen 2020-04-26 10:19:44 -04:00
parent 8410e6f129
commit 8de774dde1
2 changed files with 12 additions and 4 deletions

View File

@ -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 },

View File

@ -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>