コード例 #1
0
void
pp_ppd_selection_dialog_set_ppd_list (PpPPDSelectionDialog *dialog,
                                      PPDList              *list)
{
  dialog->list = list;
  fill_ppds_list (dialog);
}
コード例 #2
0
static void
populate_dialog (PpPPDSelectionDialog *dialog)
{
  GtkTreeViewColumn *column;
  GtkCellRenderer   *renderer;
  GtkTreeView       *manufacturers_treeview;
  GtkTreeView       *models_treeview;
  GtkWidget         *widget;

  manufacturers_treeview = (GtkTreeView*)
    gtk_builder_get_object (dialog->builder, "ppd-selection-manufacturers-treeview");

  renderer = gtk_cell_renderer_text_new ();

  /* Translators: Name of column showing printer manufacturers */
  column = gtk_tree_view_column_new_with_attributes (_("Manufacturers"), renderer,
                                                     "text", PPD_MANUFACTURERS_DISPLAY_NAMES_COLUMN, NULL);
  gtk_tree_view_column_set_expand (column, TRUE);
  gtk_tree_view_append_column (manufacturers_treeview, column);


  models_treeview = (GtkTreeView*)
    gtk_builder_get_object (dialog->builder, "ppd-selection-models-treeview");

  renderer = gtk_cell_renderer_text_new ();

  /* Translators: Name of column showing printer drivers */
  column = gtk_tree_view_column_new_with_attributes (_("Drivers"), renderer,
                                                     "text", PPD_DISPLAY_NAMES_COLUMN, NULL);
  gtk_tree_view_column_set_expand (column, TRUE);
  gtk_tree_view_append_column (models_treeview, column);


  g_signal_connect (gtk_tree_view_get_selection (models_treeview),
                    "changed", G_CALLBACK (model_selection_changed_cb), dialog);

  g_signal_connect (gtk_tree_view_get_selection (manufacturers_treeview),
                    "changed", G_CALLBACK (manufacturer_selection_changed_cb), dialog);

  gtk_widget_show_all (dialog->dialog);

  if (!dialog->list)
    {
      widget = (GtkWidget*)
        gtk_builder_get_object (dialog->builder, "ppd-spinner");
      gtk_widget_show (widget);
      gtk_spinner_start (GTK_SPINNER (widget));

      widget = (GtkWidget*)
        gtk_builder_get_object (dialog->builder, "progress-label");
      gtk_widget_show (widget);
    }
  else
    {
      fill_ppds_list (dialog);
    }
}