Add a GtkPrinterOptionWidget type of INFO to just show informational text from the print backend

This fixes https://bugzilla.gnome.org/show_bug.cgi?id=652103
This commit is contained in:
Richard Hughes 2011-06-08 12:02:39 +01:00
parent a1ce49c30e
commit 93957459d8
2 changed files with 28 additions and 1 deletions

View File

@ -53,7 +53,8 @@ typedef enum {
GTK_PRINTER_OPTION_TYPE_PICKONE_STRING,
GTK_PRINTER_OPTION_TYPE_ALTERNATIVE,
GTK_PRINTER_OPTION_TYPE_STRING,
GTK_PRINTER_OPTION_TYPE_FILESAVE
GTK_PRINTER_OPTION_TYPE_FILESAVE,
GTK_PRINTER_OPTION_TYPE_INFO
} GtkPrinterOptionType;
struct _GtkPrinterOption

View File

@ -60,6 +60,7 @@ struct GtkPrinterOptionWidgetPrivate
GtkWidget *entry;
GtkWidget *image;
GtkWidget *label;
GtkWidget *info_label;
GtkWidget *filechooser;
GtkWidget *box;
};
@ -424,6 +425,11 @@ deconstruct_widgets (GtkPrinterOptionWidget *widget)
gtk_widget_destroy (priv->label);
priv->label = NULL;
}
if (priv->info_label)
{
gtk_widget_destroy (priv->info_label);
priv->info_label = NULL;
}
}
static void
@ -673,6 +679,7 @@ construct_widgets (GtkPrinterOptionWidget *widget)
char *text;
int i;
GSList *group;
GtkWidget *hbox;
source = priv->source;
@ -822,6 +829,22 @@ construct_widgets (GtkPrinterOptionWidget *widget)
g_signal_connect (priv->combo, "selection-changed", G_CALLBACK (filesave_changed_cb), widget);
}
break;
case GTK_PRINTER_OPTION_TYPE_INFO:
priv->info_label = gtk_label_new (NULL);
gtk_label_set_selectable (GTK_LABEL (priv->info_label), TRUE);
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), priv->info_label, FALSE, TRUE, 0);
gtk_widget_show_all (hbox);
gtk_box_pack_start (GTK_BOX (widget), hbox, TRUE, TRUE, 0);
text = g_strdup_printf ("%s:", source->display_text);
priv->label = gtk_label_new_with_mnemonic (text);
g_free (text);
gtk_widget_show (priv->label);
break;
default:
break;
}
@ -886,6 +909,9 @@ update_widgets (GtkPrinterOptionWidget *widget)
gtk_entry_set_text (GTK_ENTRY (priv->entry), source->value);
break;
}
case GTK_PRINTER_OPTION_TYPE_INFO:
gtk_label_set_text (GTK_LABEL (priv->info_label), source->value);
break;
default:
break;
}