printers: Authenticate samba server also on double-click

The "Add Printer" dialog should be smart enough to know whether
an item listed in the dialog is a samba server or just a printer.
If it is a samba server, it should go for the authentication page
instead of emitting a GTK_RESPONSE_*.

https://bugzilla.gnome.org/show_bug.cgi?id=778277
This commit is contained in:
Felipe Borges 2017-02-07 13:11:52 +01:00
parent 1504a4d576
commit fc073f2185

View file

@ -1974,8 +1974,30 @@ row_activated_cb (GtkTreeView *tree_view,
{
PpNewPrinterDialog *dialog = (PpNewPrinterDialog *) user_data;
PpNewPrinterDialogPrivate *priv = dialog->priv;
GtkTreeModel *model;
GtkTreeIter iter;
GtkWidget *widget;
gboolean authentication_needed;
gboolean selected;
gtk_dialog_response (GTK_DIALOG (priv->dialog), GTK_RESPONSE_OK);
selected = gtk_tree_selection_get_selected (gtk_tree_view_get_selection (priv->treeview),
&model,
&iter);
if (selected)
{
gtk_tree_model_get (model, &iter, SERVER_NEEDS_AUTHENTICATION_COLUMN, &authentication_needed, -1);
if (authentication_needed)
{
widget = WID ("unlock-button");
authenticate_samba_server (GTK_BUTTON (widget), dialog);
}
else
{
gtk_dialog_response (GTK_DIALOG (priv->dialog), GTK_RESPONSE_OK);
}
}
}
static void