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_allocate_choices
|
||||
gtk_printer_option_choices_from_array
|
||||
gtk_printer_option_set_activates_default
|
||||
gtk_printer_option_get_activates_default
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
@ -63,6 +63,7 @@ static void
|
||||
gtk_printer_option_init (GtkPrinterOption *option)
|
||||
{
|
||||
option->value = g_strdup ("");
|
||||
option->activates_default = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -215,6 +216,23 @@ gtk_printer_option_has_choice (GtkPrinterOption *option,
|
||||
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__
|
||||
#include "gtkaliasdef.c"
|
||||
|
@ -70,6 +70,8 @@ struct _GtkPrinterOption
|
||||
char **choices;
|
||||
char **choices_display;
|
||||
|
||||
gboolean activates_default;
|
||||
|
||||
gboolean has_conflict;
|
||||
char *group;
|
||||
};
|
||||
@ -92,24 +94,27 @@ struct _GtkPrinterOptionClass
|
||||
|
||||
GType gtk_printer_option_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkPrinterOption *gtk_printer_option_new (const char *name,
|
||||
const char *display_text,
|
||||
GtkPrinterOptionType type);
|
||||
void gtk_printer_option_set (GtkPrinterOption *option,
|
||||
const char *value);
|
||||
void gtk_printer_option_set_has_conflict (GtkPrinterOption *option,
|
||||
gboolean has_conflict);
|
||||
void gtk_printer_option_clear_has_conflict (GtkPrinterOption *option);
|
||||
void gtk_printer_option_set_boolean (GtkPrinterOption *option,
|
||||
gboolean value);
|
||||
void gtk_printer_option_allocate_choices (GtkPrinterOption *option,
|
||||
int num);
|
||||
void gtk_printer_option_choices_from_array (GtkPrinterOption *option,
|
||||
int num_choices,
|
||||
char *choices[],
|
||||
char *choices_display[]);
|
||||
gboolean gtk_printer_option_has_choice (GtkPrinterOption *option,
|
||||
const char *choice);
|
||||
GtkPrinterOption *gtk_printer_option_new (const char *name,
|
||||
const char *display_text,
|
||||
GtkPrinterOptionType type);
|
||||
void gtk_printer_option_set (GtkPrinterOption *option,
|
||||
const char *value);
|
||||
void gtk_printer_option_set_has_conflict (GtkPrinterOption *option,
|
||||
gboolean has_conflict);
|
||||
void gtk_printer_option_clear_has_conflict (GtkPrinterOption *option);
|
||||
void gtk_printer_option_set_boolean (GtkPrinterOption *option,
|
||||
gboolean value);
|
||||
void gtk_printer_option_allocate_choices (GtkPrinterOption *option,
|
||||
int num);
|
||||
void gtk_printer_option_choices_from_array (GtkPrinterOption *option,
|
||||
int num_choices,
|
||||
char *choices[],
|
||||
char *choices_display[]);
|
||||
gboolean gtk_printer_option_has_choice (GtkPrinterOption *option,
|
||||
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
|
||||
|
@ -767,6 +767,8 @@ construct_widgets (GtkPrinterOptionWidget *widget)
|
||||
|
||||
case GTK_PRINTER_OPTION_TYPE_STRING:
|
||||
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_box_pack_start (GTK_BOX (widget), priv->entry, TRUE, TRUE, 0);
|
||||
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);
|
||||
|
||||
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:"));
|
||||
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"),
|
||||
GTK_PRINTER_OPTION_TYPE_FILESAVE);
|
||||
gtk_printer_option_set_activates_default (option, TRUE);
|
||||
gtk_printer_option_set (option, uri);
|
||||
g_free (uri);
|
||||
option->group = g_strdup ("GtkPrintDialogExtension");
|
||||
|
@ -431,6 +431,7 @@ lpr_printer_get_options (GtkPrinter *printer,
|
||||
g_object_unref (option);
|
||||
|
||||
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");
|
||||
if (settings != NULL &&
|
||||
(command = gtk_print_settings_get (settings, "lpr-commandline"))!= NULL)
|
||||
|
Reference in New Issue
Block a user