Print when Enter pressed in certain GtkEntries of the print dialog
Print when Enter pressed in Name entry or Command Line entry in the print dialog (#564695). Add gtk_printer_option_set_activates_default() function and gtk_printer_option_get_activates_default() function to control behaviour of GtkPrinterOptionWidget.
This commit is contained in:
@ -2957,6 +2957,8 @@ gtk_printer_option_clear_has_conflict
|
|||||||
gtk_printer_option_set_boolean
|
gtk_printer_option_set_boolean
|
||||||
gtk_printer_option_allocate_choices
|
gtk_printer_option_allocate_choices
|
||||||
gtk_printer_option_choices_from_array
|
gtk_printer_option_choices_from_array
|
||||||
|
gtk_printer_option_set_activates_default
|
||||||
|
gtk_printer_option_get_activates_default
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -63,6 +63,7 @@ static void
|
|||||||
gtk_printer_option_init (GtkPrinterOption *option)
|
gtk_printer_option_init (GtkPrinterOption *option)
|
||||||
{
|
{
|
||||||
option->value = g_strdup ("");
|
option->value = g_strdup ("");
|
||||||
|
option->activates_default = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -215,6 +216,23 @@ gtk_printer_option_has_choice (GtkPrinterOption *option,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_printer_option_set_activates_default (GtkPrinterOption *option,
|
||||||
|
gboolean activates)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GTK_IS_PRINTER_OPTION (option));
|
||||||
|
|
||||||
|
option->activates_default = activates;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gtk_printer_option_get_activates_default (GtkPrinterOption *option)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GTK_IS_PRINTER_OPTION (option), FALSE);
|
||||||
|
|
||||||
|
return option->activates_default;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#define __GTK_PRINTER_OPTION_C__
|
#define __GTK_PRINTER_OPTION_C__
|
||||||
#include "gtkaliasdef.c"
|
#include "gtkaliasdef.c"
|
||||||
|
@ -70,6 +70,8 @@ struct _GtkPrinterOption
|
|||||||
char **choices;
|
char **choices;
|
||||||
char **choices_display;
|
char **choices_display;
|
||||||
|
|
||||||
|
gboolean activates_default;
|
||||||
|
|
||||||
gboolean has_conflict;
|
gboolean has_conflict;
|
||||||
char *group;
|
char *group;
|
||||||
};
|
};
|
||||||
@ -92,24 +94,27 @@ struct _GtkPrinterOptionClass
|
|||||||
|
|
||||||
GType gtk_printer_option_get_type (void) G_GNUC_CONST;
|
GType gtk_printer_option_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
GtkPrinterOption *gtk_printer_option_new (const char *name,
|
GtkPrinterOption *gtk_printer_option_new (const char *name,
|
||||||
const char *display_text,
|
const char *display_text,
|
||||||
GtkPrinterOptionType type);
|
GtkPrinterOptionType type);
|
||||||
void gtk_printer_option_set (GtkPrinterOption *option,
|
void gtk_printer_option_set (GtkPrinterOption *option,
|
||||||
const char *value);
|
const char *value);
|
||||||
void gtk_printer_option_set_has_conflict (GtkPrinterOption *option,
|
void gtk_printer_option_set_has_conflict (GtkPrinterOption *option,
|
||||||
gboolean has_conflict);
|
gboolean has_conflict);
|
||||||
void gtk_printer_option_clear_has_conflict (GtkPrinterOption *option);
|
void gtk_printer_option_clear_has_conflict (GtkPrinterOption *option);
|
||||||
void gtk_printer_option_set_boolean (GtkPrinterOption *option,
|
void gtk_printer_option_set_boolean (GtkPrinterOption *option,
|
||||||
gboolean value);
|
gboolean value);
|
||||||
void gtk_printer_option_allocate_choices (GtkPrinterOption *option,
|
void gtk_printer_option_allocate_choices (GtkPrinterOption *option,
|
||||||
int num);
|
int num);
|
||||||
void gtk_printer_option_choices_from_array (GtkPrinterOption *option,
|
void gtk_printer_option_choices_from_array (GtkPrinterOption *option,
|
||||||
int num_choices,
|
int num_choices,
|
||||||
char *choices[],
|
char *choices[],
|
||||||
char *choices_display[]);
|
char *choices_display[]);
|
||||||
gboolean gtk_printer_option_has_choice (GtkPrinterOption *option,
|
gboolean gtk_printer_option_has_choice (GtkPrinterOption *option,
|
||||||
const char *choice);
|
const char *choice);
|
||||||
|
void gtk_printer_option_set_activates_default (GtkPrinterOption *option,
|
||||||
|
gboolean activates);
|
||||||
|
gboolean gtk_printer_option_get_activates_default (GtkPrinterOption *option);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -767,6 +767,8 @@ construct_widgets (GtkPrinterOptionWidget *widget)
|
|||||||
|
|
||||||
case GTK_PRINTER_OPTION_TYPE_STRING:
|
case GTK_PRINTER_OPTION_TYPE_STRING:
|
||||||
priv->entry = gtk_entry_new ();
|
priv->entry = gtk_entry_new ();
|
||||||
|
gtk_entry_set_activates_default (GTK_ENTRY (priv->entry),
|
||||||
|
gtk_printer_option_get_activates_default (source));
|
||||||
gtk_widget_show (priv->entry);
|
gtk_widget_show (priv->entry);
|
||||||
gtk_box_pack_start (GTK_BOX (widget), priv->entry, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (widget), priv->entry, TRUE, TRUE, 0);
|
||||||
g_signal_connect (priv->entry, "changed", G_CALLBACK (entry_changed_cb), widget);
|
g_signal_connect (priv->entry, "changed", G_CALLBACK (entry_changed_cb), widget);
|
||||||
@ -792,6 +794,8 @@ construct_widgets (GtkPrinterOptionWidget *widget)
|
|||||||
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
||||||
|
|
||||||
g_object_set (priv->combo, "local-only", FALSE, NULL);
|
g_object_set (priv->combo, "local-only", FALSE, NULL);
|
||||||
|
gtk_entry_set_activates_default (GTK_ENTRY (priv->entry),
|
||||||
|
gtk_printer_option_get_activates_default (source));
|
||||||
|
|
||||||
label = gtk_label_new_with_mnemonic (_("_Name:"));
|
label = gtk_label_new_with_mnemonic (_("_Name:"));
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||||
|
@ -645,6 +645,7 @@ file_printer_get_options (GtkPrinter *printer,
|
|||||||
|
|
||||||
option = gtk_printer_option_new ("gtk-main-page-custom-input", _("File"),
|
option = gtk_printer_option_new ("gtk-main-page-custom-input", _("File"),
|
||||||
GTK_PRINTER_OPTION_TYPE_FILESAVE);
|
GTK_PRINTER_OPTION_TYPE_FILESAVE);
|
||||||
|
gtk_printer_option_set_activates_default (option, TRUE);
|
||||||
gtk_printer_option_set (option, uri);
|
gtk_printer_option_set (option, uri);
|
||||||
g_free (uri);
|
g_free (uri);
|
||||||
option->group = g_strdup ("GtkPrintDialogExtension");
|
option->group = g_strdup ("GtkPrintDialogExtension");
|
||||||
|
@ -431,6 +431,7 @@ lpr_printer_get_options (GtkPrinter *printer,
|
|||||||
g_object_unref (option);
|
g_object_unref (option);
|
||||||
|
|
||||||
option = gtk_printer_option_new ("gtk-main-page-custom-input", _("Command Line"), GTK_PRINTER_OPTION_TYPE_STRING);
|
option = gtk_printer_option_new ("gtk-main-page-custom-input", _("Command Line"), GTK_PRINTER_OPTION_TYPE_STRING);
|
||||||
|
gtk_printer_option_set_activates_default (option, TRUE);
|
||||||
option->group = g_strdup ("GtkPrintDialogExtension");
|
option->group = g_strdup ("GtkPrintDialogExtension");
|
||||||
if (settings != NULL &&
|
if (settings != NULL &&
|
||||||
(command = gtk_print_settings_get (settings, "lpr-commandline"))!= NULL)
|
(command = gtk_print_settings_get (settings, "lpr-commandline"))!= NULL)
|
||||||
|
Reference in New Issue
Block a user