Пример #1
0
//??DONE
void
create_fdriverchooser (HWND hwnd, TFDRIVERCHOOSER *choose_t)
{
  GdkPixmap *pixmap;
  GdkBitmap *mask;
  GtkStyle *style;

  GtkWidget *fdriverchooser;
  GtkWidget *dialog_vbox3;
  GtkWidget *notebook2;
  GtkWidget *hbox26;
  GtkWidget *frame38;
  GtkWidget *alignment30;
  GtkWidget *pixmap1;
  GtkWidget *vbox21;
  GtkWidget *frame39;
  GtkWidget *alignment31;
  GtkWidget *scrolledwindow11;
  GtkWidget *clist2;
  GtkWidget *l_name;
  GtkWidget *l_file;
  GtkWidget *l_date;
  GtkWidget *l_size;
  GtkWidget *label70;
  GtkWidget *hbox27;
  GtkWidget *frame40;
  GtkWidget *alignment32;
  GtkWidget *b_advanced;
  GtkWidget *label67;
  GtkWidget *hbox28;
  GtkWidget *frame41;
  GtkWidget *alignment33;
  GtkWidget *pixmap2;
  GtkWidget *vbox22;
  GtkWidget *frame42;
  GtkWidget *alignment34;
  GtkWidget *label79;
  GtkWidget *frame43;
  GtkWidget *alignment35;
  GtkWidget *hbox30;
  GtkWidget *fdsn_entry;
  GtkWidget *b_browse;
  GtkWidget *frame47;
  GtkWidget *alignment39;
  GtkWidget *label68;
  GtkWidget *hbox29;
  GtkWidget *frame44;
  GtkWidget *alignment36;
  GtkWidget *pixmap3;
  GtkWidget *vbox23;
  GtkWidget *frame45;
  GtkWidget *alignment37;
  GtkWidget *label80;
  GtkWidget *frame46;
  GtkWidget *alignment38;
  GtkWidget *scrolledwindow13;
  GtkWidget *result_text;
  GtkWidget *label69;
  GtkWidget *dialog_action_area3;
  GtkWidget *b_cancel;
  GtkWidget *b_back;
  GtkWidget *b_continue;

  if (hwnd == NULL || !GTK_IS_WIDGET (hwnd))
    return;

  fdriverchooser = gtk_dialog_new ();
  gtk_widget_set_name (fdriverchooser, "fdriverchooser");
  gtk_widget_set_size_request (fdriverchooser, 512, 384);
  gtk_window_set_title (GTK_WINDOW (fdriverchooser), _("Create New File Data Source"));
  gtk_window_set_modal (GTK_WINDOW (fdriverchooser), TRUE);
  gtk_window_set_default_size (GTK_WINDOW (fdriverchooser), 600, 450);
  gtk_window_set_position (GTK_WINDOW (fdriverchooser), GTK_WIN_POS_CENTER);
  gtk_window_set_type_hint (GTK_WINDOW (fdriverchooser), GDK_WINDOW_TYPE_HINT_DIALOG);

#if GTK_CHECK_VERSION(2,0,0)
  gtk_widget_show (fdriverchooser);
#endif

  dialog_vbox3 = GTK_DIALOG (fdriverchooser)->vbox;
  gtk_widget_set_name (dialog_vbox3, "dialog_vbox3");
  gtk_widget_show (dialog_vbox3);

  notebook2 = gtk_notebook_new ();
  gtk_widget_set_name (notebook2, "notebook2");
  gtk_widget_show (notebook2);
  gtk_box_pack_start (GTK_BOX (dialog_vbox3), notebook2, TRUE, TRUE, 0);

  hbox26 = gtk_hbox_new (FALSE, 0);
  gtk_widget_set_name (hbox26, "hbox26");
  gtk_widget_show (hbox26);
  gtk_container_add (GTK_CONTAINER (notebook2), hbox26);

  frame38 = gtk_frame_new (NULL);
  gtk_widget_set_name (frame38, "frame38");
  gtk_widget_show (frame38);
  gtk_box_pack_start (GTK_BOX (hbox26), frame38, FALSE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame38), 10);
  gtk_frame_set_shadow_type (GTK_FRAME (frame38), GTK_SHADOW_NONE);

  alignment30 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_set_name (alignment30, "alignment30");
  gtk_widget_show (alignment30);
  gtk_container_add (GTK_CONTAINER (frame38), alignment30);
  gtk_widget_set_size_request (alignment30, 140, -1);

#if GTK_CHECK_VERSION(2,0,0)
  style = gtk_widget_get_style (fdriverchooser);
  pixmap =
      gdk_pixmap_create_from_xpm_d (fdriverchooser->window, &mask,
      &style->bg[GTK_STATE_NORMAL], (gchar **) img_xpm);
#else
  style = gtk_widget_get_style (GTK_WIDGET (hwnd));
  pixmap =
      gdk_pixmap_create_from_xpm_d (GTK_WIDGET (hwnd)->window, &mask,
      &style->bg[GTK_STATE_NORMAL], (gchar **) img_xpm);
#endif

  pixmap1 = gtk_pixmap_new (pixmap, mask);
  gtk_widget_set_name (pixmap1, "pixmap1");
  gtk_widget_show (pixmap1);
  gtk_container_add (GTK_CONTAINER (alignment30), pixmap1);

  vbox21 = gtk_vbox_new (FALSE, 0);
  gtk_widget_set_name (vbox21, "vbox21");
  gtk_widget_show (vbox21);
  gtk_box_pack_start (GTK_BOX (hbox26), vbox21, TRUE, TRUE, 0);

  frame39 = gtk_frame_new (NULL);
  gtk_widget_set_name (frame39, "frame39");
  gtk_widget_show (frame39);
  gtk_box_pack_start (GTK_BOX (vbox21), frame39, TRUE, TRUE, 0);
  gtk_widget_set_size_request (frame39, -1, 270);
  gtk_frame_set_shadow_type (GTK_FRAME (frame39), GTK_SHADOW_NONE);

  alignment31 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_set_name (alignment31, "alignment31");
  gtk_widget_show (alignment31);
  gtk_container_add (GTK_CONTAINER (frame39), alignment31);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment31), 0, 0, 4, 0);

  scrolledwindow11 = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_set_name (scrolledwindow11, "scrolledwindow11");
  gtk_widget_show (scrolledwindow11);
  gtk_container_add (GTK_CONTAINER (alignment31), scrolledwindow11);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow11), GTK_SHADOW_IN);

  clist2 = gtk_clist_new (4);
  gtk_widget_set_name (clist2, "clist2");
  gtk_widget_show (clist2);
  gtk_container_add (GTK_CONTAINER (scrolledwindow11), clist2);
  gtk_clist_set_column_width (GTK_CLIST (clist2), 0, 165);
  gtk_clist_set_column_width (GTK_CLIST (clist2), 1, 118);
  gtk_clist_set_column_width (GTK_CLIST (clist2), 2, 80);
  gtk_clist_set_column_width (GTK_CLIST (clist2), 3, 80);
  gtk_clist_column_titles_show (GTK_CLIST (clist2));

  l_name = gtk_label_new (_("Name"));
  gtk_widget_set_name (l_name, "l_name");
  gtk_widget_show (l_name);
  gtk_clist_set_column_widget (GTK_CLIST (clist2), 0, l_name);
  gtk_widget_set_size_request (l_name, 165, -1);

  l_file = gtk_label_new (_("File"));
  gtk_widget_set_name (l_file, "l_file");
  gtk_widget_show (l_file);
  gtk_clist_set_column_widget (GTK_CLIST (clist2), 1, l_file);
  gtk_widget_set_size_request (l_file, 118, -1);

  l_date = gtk_label_new (_("Date"));
  gtk_widget_set_name (l_date, "l_date");
  gtk_widget_show (l_date);
  gtk_clist_set_column_widget (GTK_CLIST (clist2), 2, l_date);
  gtk_widget_set_size_request (l_date, 80, -1);

  l_size = gtk_label_new (_("Size"));
  gtk_widget_set_name (l_size, "l_size");
  gtk_widget_show (l_size);
  gtk_clist_set_column_widget (GTK_CLIST (clist2), 3, l_size);
  gtk_widget_set_size_request (l_size, 80, -1);

  label70 = gtk_label_new (_("Select a driver for which you want to setup a data source"));
  gtk_widget_set_name (label70, "label70");
  gtk_widget_show (label70);
  gtk_frame_set_label_widget (GTK_FRAME (frame39), label70);
  gtk_label_set_use_markup (GTK_LABEL (label70), TRUE);

  hbox27 = gtk_hbox_new (FALSE, 0);
  gtk_widget_set_name (hbox27, "hbox27");
  gtk_widget_show (hbox27);
  gtk_box_pack_start (GTK_BOX (vbox21), hbox27, FALSE, TRUE, 0);

  frame40 = gtk_frame_new (NULL);
  gtk_widget_set_name (frame40, "frame40");
  gtk_widget_show (frame40);
  gtk_box_pack_start (GTK_BOX (hbox27), frame40, TRUE, TRUE, 0);
  gtk_frame_set_shadow_type (GTK_FRAME (frame40), GTK_SHADOW_NONE);

  alignment32 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_set_name (alignment32, "alignment32");
  gtk_widget_show (alignment32);
  gtk_container_add (GTK_CONTAINER (frame40), alignment32);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment32), 0, 10, 0, 0);

  b_advanced = gtk_button_new_with_mnemonic (_("_Advanced..."));
  gtk_widget_set_name (b_advanced, "b_advanced");
  gtk_widget_show (b_advanced);
  gtk_box_pack_start (GTK_BOX (hbox27), b_advanced, FALSE, TRUE, 0);
  gtk_widget_set_size_request (b_advanced, -1, 45);
  gtk_container_set_border_width (GTK_CONTAINER (b_advanced), 8);

  label67 = gtk_label_new (_("   Drivers   "));
  gtk_widget_set_name (label67, "label67");
  gtk_widget_show (label67);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 0), label67);

  hbox28 = gtk_hbox_new (FALSE, 0);
  gtk_widget_set_name (hbox28, "hbox28");
  gtk_widget_show (hbox28);
  gtk_container_add (GTK_CONTAINER (notebook2), hbox28);

  frame41 = gtk_frame_new (NULL);
  gtk_widget_set_name (frame41, "frame41");
  gtk_widget_show (frame41);
  gtk_box_pack_start (GTK_BOX (hbox28), frame41, FALSE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame41), 10);
  gtk_frame_set_shadow_type (GTK_FRAME (frame41), GTK_SHADOW_NONE);

  alignment33 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_set_name (alignment33, "alignment33");
  gtk_widget_show (alignment33);
  gtk_container_add (GTK_CONTAINER (frame41), alignment33);
  gtk_widget_set_size_request (alignment33, 140, -1);

  pixmap2 = gtk_pixmap_new (pixmap, mask);
  gtk_widget_set_name (pixmap2, "pixmap2");
  gtk_widget_show (pixmap2);
  gtk_container_add (GTK_CONTAINER (alignment33), pixmap2);

  vbox22 = gtk_vbox_new (FALSE, 0);
  gtk_widget_set_name (vbox22, "vbox22");
  gtk_widget_show (vbox22);
  gtk_box_pack_start (GTK_BOX (hbox28), vbox22, TRUE, TRUE, 0);

  frame42 = gtk_frame_new (NULL);
  gtk_widget_set_name (frame42, "frame42");
  gtk_widget_show (frame42);
  gtk_box_pack_start (GTK_BOX (vbox22), frame42, FALSE, TRUE, 0);
  gtk_frame_set_shadow_type (GTK_FRAME (frame42), GTK_SHADOW_NONE);

  alignment34 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_set_name (alignment34, "alignment34");
  gtk_widget_show (alignment34);
  gtk_container_add (GTK_CONTAINER (frame42), alignment34);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment34), 0, 0, 4, 0);

  label79 = gtk_label_new (_("Type the name of the data source you want to\nsave this connection to. Or, find the location to\nsave to by clicking Browse."));
  gtk_widget_set_name (label79, "label79");
  gtk_widget_show (label79);
  gtk_container_add (GTK_CONTAINER (alignment34), label79);

  frame43 = gtk_frame_new (NULL);
  gtk_widget_set_name (frame43, "frame43");
  gtk_widget_show (frame43);
  gtk_box_pack_start (GTK_BOX (vbox22), frame43, FALSE, TRUE, 0);
  gtk_frame_set_shadow_type (GTK_FRAME (frame43), GTK_SHADOW_NONE);

  alignment35 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_set_name (alignment35, "alignment35");
  gtk_widget_show (alignment35);
  gtk_container_add (GTK_CONTAINER (frame43), alignment35);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment35), 0, 0, 12, 0);

  hbox30 = gtk_hbox_new (FALSE, 0);
  gtk_widget_set_name (hbox30, "hbox30");
  gtk_widget_show (hbox30);
  gtk_container_add (GTK_CONTAINER (alignment35), hbox30);

  fdsn_entry = gtk_entry_new ();
  gtk_widget_set_name (fdsn_entry, "fdsn_entry");
  gtk_widget_show (fdsn_entry);
  gtk_box_pack_start (GTK_BOX (hbox30), fdsn_entry, TRUE, TRUE, 0);

  b_browse = gtk_button_new_with_mnemonic (_("   Browse   "));
  gtk_widget_set_name (b_browse, "b_browse");
  gtk_widget_show (b_browse);
  gtk_box_pack_start (GTK_BOX (hbox30), b_browse, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (b_browse), 10);

  frame47 = gtk_frame_new (NULL);
  gtk_widget_set_name (frame47, "frame47");
  gtk_widget_show (frame47);
  gtk_box_pack_start (GTK_BOX (vbox22), frame47, TRUE, TRUE, 0);
  gtk_widget_set_size_request (frame47, -1, 200);
  gtk_frame_set_shadow_type (GTK_FRAME (frame47), GTK_SHADOW_NONE);

  alignment39 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_set_name (alignment39, "alignment39");
  gtk_widget_show (alignment39);
  gtk_container_add (GTK_CONTAINER (frame47), alignment39);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment39), 0, 0, 12, 0);

  label68 = gtk_label_new (_("   FileDSN Name   "));
  gtk_widget_set_name (label68, "label68");
  gtk_widget_show (label68);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 1), label68);

  hbox29 = gtk_hbox_new (FALSE, 0);
  gtk_widget_set_name (hbox29, "hbox29");
  gtk_widget_show (hbox29);
  gtk_container_add (GTK_CONTAINER (notebook2), hbox29);

  frame44 = gtk_frame_new (NULL);
  gtk_widget_set_name (frame44, "frame44");
  gtk_widget_show (frame44);
  gtk_box_pack_start (GTK_BOX (hbox29), frame44, FALSE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame44), 10);
  gtk_frame_set_shadow_type (GTK_FRAME (frame44), GTK_SHADOW_NONE);

  alignment36 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_set_name (alignment36, "alignment36");
  gtk_widget_show (alignment36);
  gtk_container_add (GTK_CONTAINER (frame44), alignment36);
  gtk_widget_set_size_request (alignment36, 140, -1);

  pixmap3 = gtk_pixmap_new (pixmap, mask);
  gtk_widget_set_name (pixmap3, "pixmap3");
  gtk_widget_show (pixmap3);
  gtk_container_add (GTK_CONTAINER (alignment36), pixmap3);

  vbox23 = gtk_vbox_new (FALSE, 0);
  gtk_widget_set_name (vbox23, "vbox23");
  gtk_widget_show (vbox23);
  gtk_box_pack_start (GTK_BOX (hbox29), vbox23, TRUE, TRUE, 0);

  frame45 = gtk_frame_new (NULL);
  gtk_widget_set_name (frame45, "frame45");
  gtk_widget_show (frame45);
  gtk_box_pack_start (GTK_BOX (vbox23), frame45, FALSE, TRUE, 0);
  gtk_frame_set_shadow_type (GTK_FRAME (frame45), GTK_SHADOW_NONE);

  alignment37 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_set_name (alignment37, "alignment37");
  gtk_widget_show (alignment37);
  gtk_container_add (GTK_CONTAINER (frame45), alignment37);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment37), 0, 0, 4, 0);

  label80 = gtk_label_new (_("When you click Finish, you will create the data\nsource which you have just configured. The driver\nmay prompt you more information."));
  gtk_widget_set_name (label80, "label80");
  gtk_widget_show (label80);
  gtk_container_add (GTK_CONTAINER (alignment37), label80);

  frame46 = gtk_frame_new (NULL);
  gtk_widget_set_name (frame46, "frame46");
  gtk_widget_show (frame46);
  gtk_box_pack_start (GTK_BOX (vbox23), frame46, TRUE, TRUE, 0);
  gtk_widget_set_size_request (frame46, -1, 250);
  gtk_frame_set_shadow_type (GTK_FRAME (frame46), GTK_SHADOW_NONE);

  alignment38 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_set_name (alignment38, "alignment38");
  gtk_widget_show (alignment38);
  gtk_container_add (GTK_CONTAINER (frame46), alignment38);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment38), 0, 10, 0, 0);

  scrolledwindow13 = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_set_name (scrolledwindow13, "scrolledwindow13");
  gtk_widget_show (scrolledwindow13);
  gtk_container_add (GTK_CONTAINER (alignment38), scrolledwindow13);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow13), GTK_SHADOW_IN);

#if GTK_CHECK_VERSION(2,0,0)
  result_text = gtk_text_view_new ();
#else
  result_text = gtk_text_new (NULL, NULL);
#endif
  gtk_widget_set_name (result_text, "result_text");
  gtk_widget_show (result_text);
  gtk_container_add (GTK_CONTAINER (scrolledwindow13), result_text);
  gtk_text_view_set_editable (GTK_TEXT_VIEW (result_text), FALSE);
  gtk_text_view_set_overwrite (GTK_TEXT_VIEW (result_text), TRUE);

  label69 = gtk_label_new (_("   Results   "));
  gtk_widget_set_name (label69, "label69");
  gtk_widget_show (label69);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 2), label69);

  dialog_action_area3 = GTK_DIALOG (fdriverchooser)->action_area;
  gtk_widget_set_name (dialog_action_area3, "dialog_action_area3");
  gtk_widget_show (dialog_action_area3);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area3), GTK_BUTTONBOX_END);

  b_cancel = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_set_name (b_cancel, "b_cancel");
  gtk_widget_show (b_cancel);
  gtk_dialog_add_action_widget (GTK_DIALOG (fdriverchooser), b_cancel, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (b_cancel, GTK_CAN_DEFAULT);

  b_back = gtk_button_new_from_stock ("gtk-go-back");
  gtk_widget_set_name (b_back, "b_back");
  gtk_widget_show (b_back);
  gtk_dialog_add_action_widget (GTK_DIALOG (fdriverchooser), b_back, 0);
  gtk_widget_set_sensitive (b_back, FALSE);
  GTK_WIDGET_SET_FLAGS (b_back, GTK_CAN_DEFAULT);

  b_continue = gtk_button_new_with_mnemonic (_("Co_ntinue"));
  gtk_widget_set_name (b_continue, "b_continue");
  gtk_widget_show (b_continue);
  gtk_dialog_add_action_widget (GTK_DIALOG (fdriverchooser), b_continue, 0);
  GTK_WIDGET_SET_FLAGS (b_continue, GTK_CAN_DEFAULT);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (fdriverchooser, fdriverchooser, "fdriverchooser");
  GLADE_HOOKUP_OBJECT_NO_REF (fdriverchooser, dialog_vbox3, "dialog_vbox3");
  GLADE_HOOKUP_OBJECT (fdriverchooser, notebook2, "notebook2");
  GLADE_HOOKUP_OBJECT (fdriverchooser, hbox26, "hbox26");
  GLADE_HOOKUP_OBJECT (fdriverchooser, frame38, "frame38");
  GLADE_HOOKUP_OBJECT (fdriverchooser, alignment30, "alignment30");
  GLADE_HOOKUP_OBJECT (fdriverchooser, pixmap1, "pixmap1");
  GLADE_HOOKUP_OBJECT (fdriverchooser, vbox21, "vbox21");
  GLADE_HOOKUP_OBJECT (fdriverchooser, frame39, "frame39");
  GLADE_HOOKUP_OBJECT (fdriverchooser, alignment31, "alignment31");
  GLADE_HOOKUP_OBJECT (fdriverchooser, scrolledwindow11, "scrolledwindow11");
  GLADE_HOOKUP_OBJECT (fdriverchooser, clist2, "clist2");
  GLADE_HOOKUP_OBJECT (fdriverchooser, l_name, "l_name");
  GLADE_HOOKUP_OBJECT (fdriverchooser, l_file, "l_file");
  GLADE_HOOKUP_OBJECT (fdriverchooser, l_date, "l_date");
  GLADE_HOOKUP_OBJECT (fdriverchooser, l_size, "l_size");
  GLADE_HOOKUP_OBJECT (fdriverchooser, label70, "label70");
  GLADE_HOOKUP_OBJECT (fdriverchooser, hbox27, "hbox27");
  GLADE_HOOKUP_OBJECT (fdriverchooser, frame40, "frame40");
  GLADE_HOOKUP_OBJECT (fdriverchooser, alignment32, "alignment32");
  GLADE_HOOKUP_OBJECT (fdriverchooser, b_advanced, "b_advanced");
  GLADE_HOOKUP_OBJECT (fdriverchooser, label67, "label67");
  GLADE_HOOKUP_OBJECT (fdriverchooser, hbox28, "hbox28");
  GLADE_HOOKUP_OBJECT (fdriverchooser, frame41, "frame41");
  GLADE_HOOKUP_OBJECT (fdriverchooser, alignment33, "alignment33");
  GLADE_HOOKUP_OBJECT (fdriverchooser, pixmap2, "pixmap2");
  GLADE_HOOKUP_OBJECT (fdriverchooser, vbox22, "vbox22");
  GLADE_HOOKUP_OBJECT (fdriverchooser, frame42, "frame42");
  GLADE_HOOKUP_OBJECT (fdriverchooser, alignment34, "alignment34");
  GLADE_HOOKUP_OBJECT (fdriverchooser, label79, "label79");
  GLADE_HOOKUP_OBJECT (fdriverchooser, frame43, "frame43");
  GLADE_HOOKUP_OBJECT (fdriverchooser, alignment35, "alignment35");
  GLADE_HOOKUP_OBJECT (fdriverchooser, hbox30, "hbox30");
  GLADE_HOOKUP_OBJECT (fdriverchooser, fdsn_entry, "fdsn_entry");
  GLADE_HOOKUP_OBJECT (fdriverchooser, b_browse, "b_browse");
  GLADE_HOOKUP_OBJECT (fdriverchooser, frame47, "frame47");
  GLADE_HOOKUP_OBJECT (fdriverchooser, alignment39, "alignment39");
  GLADE_HOOKUP_OBJECT (fdriverchooser, label68, "label68");
  GLADE_HOOKUP_OBJECT (fdriverchooser, hbox29, "hbox29");
  GLADE_HOOKUP_OBJECT (fdriverchooser, frame44, "frame44");
  GLADE_HOOKUP_OBJECT (fdriverchooser, alignment36, "alignment36");
  GLADE_HOOKUP_OBJECT (fdriverchooser, pixmap3, "pixmap3");
  GLADE_HOOKUP_OBJECT (fdriverchooser, vbox23, "vbox23");
  GLADE_HOOKUP_OBJECT (fdriverchooser, frame45, "frame45");
  GLADE_HOOKUP_OBJECT (fdriverchooser, alignment37, "alignment37");
  GLADE_HOOKUP_OBJECT (fdriverchooser, label80, "label80");
  GLADE_HOOKUP_OBJECT (fdriverchooser, frame46, "frame46");
  GLADE_HOOKUP_OBJECT (fdriverchooser, alignment38, "alignment38");
  GLADE_HOOKUP_OBJECT (fdriverchooser, scrolledwindow13, "scrolledwindow13");
  GLADE_HOOKUP_OBJECT (fdriverchooser, result_text, "result_text");
  GLADE_HOOKUP_OBJECT (fdriverchooser, label69, "label69");
  GLADE_HOOKUP_OBJECT_NO_REF (fdriverchooser, dialog_action_area3, "dialog_action_area3");
  GLADE_HOOKUP_OBJECT (fdriverchooser, b_cancel, "b_cancel");
  GLADE_HOOKUP_OBJECT (fdriverchooser, b_back, "b_back");
  GLADE_HOOKUP_OBJECT (fdriverchooser, b_continue, "b_continue");

  /* Notebook events */
  gtk_signal_connect_after (GTK_OBJECT (notebook2), "switch_page",
      GTK_SIGNAL_FUNC (fdriverchooser_switch_page), choose_t);
  /* Cancel button events */
  gtk_signal_connect (GTK_OBJECT (b_cancel), "clicked",
      GTK_SIGNAL_FUNC (fdriverchooser_cancel_clicked), choose_t);
  /* Continue button events */
  gtk_signal_connect (GTK_OBJECT (b_continue), "clicked",
      GTK_SIGNAL_FUNC (fdriverchooser_next_clicked), choose_t);
  /* Back button events */
  gtk_signal_connect (GTK_OBJECT (b_back), "clicked",
      GTK_SIGNAL_FUNC (fdriverchooser_prev_clicked), choose_t);
  /* Browse button events */
  gtk_signal_connect (GTK_OBJECT (b_browse), "clicked",
      GTK_SIGNAL_FUNC (fdriverchooser_browse_clicked), choose_t);
  /* Advanced button events */
  gtk_signal_connect (GTK_OBJECT (b_advanced), "clicked",
      GTK_SIGNAL_FUNC (fdriverchooser_advanced_clicked), choose_t);
  /* Driver list events */
  gtk_signal_connect (GTK_OBJECT (clist2), "select_row",
      GTK_SIGNAL_FUNC (fdriver_list_select), choose_t);
  /* Close window button events */
  gtk_signal_connect (GTK_OBJECT (fdriverchooser), "delete_event",
      GTK_SIGNAL_FUNC (fdelete_event), choose_t);
  gtk_signal_connect (GTK_OBJECT (fdriverchooser), "destroy",
      GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
  
  gtk_widget_grab_default (b_continue);

  adddrivers_to_list (clist2, fdriverchooser);

  choose_t->driverlist = clist2;
  choose_t->driver = NULL;
  choose_t->mainwnd = fdriverchooser;
  choose_t->b_continue = b_continue;
  choose_t->b_back = b_back;
  choose_t->tab_panel = notebook2;
  choose_t->dsn_entry = fdsn_entry;
  choose_t->mess_entry = result_text;

  gtk_widget_show_all (fdriverchooser);
  gtk_main ();

}
Пример #2
0
void
create_driverchooser (HWND hwnd, TDRIVERCHOOSER * choose_t)
{
  EventTypeSpec controlSpec = { kEventClassControl, kEventControlHit };
  RgnHandle cursorRgn = NULL;
  WindowRef wdrvchooser;
  ControlID controlID;
  EventRecord event;
  IBNibRef nibRef;
  OSStatus err;

  if (hwnd == NULL)
    return;

  /* Search the bundle for a .nib file named 'odbcadmin'. */
  err =
      CreateNibReferenceWithCFBundle (CFBundleGetBundleWithIdentifier (CFSTR
	("org.iodbc.adm")), CFSTR ("odbcdriver"), &nibRef);
  if (err == noErr)
    {
      /* Nib found ... so create the window */
      CreateWindowFromNib (nibRef, CFSTR ("Dialog"), &wdrvchooser);
      DisposeNibReference (nibRef);
      /* Set the control into the structure */
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, DCLIST_CNTL, wdrvchooser,
	  choose_t->driverlist);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, DCFINISH_CNTL, wdrvchooser,
	  choose_t->b_add);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, DCCANCEL_CNTL, wdrvchooser,
          choose_t->b_remove);
      choose_t->driver = NULL;
      choose_t->mainwnd = wdrvchooser;
      /* Install handlers for the finish button, the cancel */
      InstallEventHandler (GetControlEventTarget (choose_t->b_add),
	  NewEventHandlerUPP (driverchooser_ok_clicked), 1, &controlSpec,
	  choose_t, NULL);
      InstallEventHandler (GetControlEventTarget (choose_t->b_remove),
	  NewEventHandlerUPP (driverchooser_cancel_clicked), 1, &controlSpec,
	  choose_t, NULL);
      Drivers_nrows = 0;
      adddrivers_to_list (choose_t->driverlist, choose_t->mainwnd, TRUE);

      /* Show the window and run the loop */
      choose_t->b_configure = NULL;
      DRIVERCHOOSER = choose_t;
      DeactivateControl (DRIVERCHOOSER->b_add);
      ShowWindow (wdrvchooser);

      /* The main loop */
      while (choose_t->mainwnd)
	WaitNextEvent (everyEvent, &event, 60L, cursorRgn);
    }
  else
    goto error;

  return;

error:
  choose_t->driver = NULL;
  fprintf (stderr, "Can't load Window. Err: %d\n", (int) err);
  return;
}
Пример #3
0
void
create_driverchooser (HWND hwnd, TDRIVERCHOOSER *choose_t)
{
  GdkPixmap *pixmap;
  GdkBitmap *mask;
  GtkStyle *style;

  GtkWidget *driverchooser;
  GtkWidget *dialog_vbox2;
  GtkWidget *hbox25;
  GtkWidget *frame37;
  GtkWidget *alignment29;
  GtkWidget *pixmap1;
  GtkWidget *frame36;
  GtkWidget *alignment28;
  GtkWidget *scrolledwindow10;
  GtkWidget *clist1;
  GtkWidget *l_name;
  GtkWidget *l_file;
  GtkWidget *l_date;
  GtkWidget *l_size;
  GtkWidget *l_diz;
  GtkWidget *dialog_action_area2;
  GtkWidget *b_finish;
  GtkWidget *b_cancel;

  if (hwnd == NULL || !GTK_IS_WIDGET (hwnd))
    return;

  driverchooser = gtk_dialog_new ();
  gtk_widget_set_name (driverchooser, "driverchooser");
  gtk_widget_set_size_request (driverchooser, 515, 335);
  gtk_window_set_title (GTK_WINDOW (driverchooser), _("Choose an ODBC Driver"));
  gtk_window_set_position (GTK_WINDOW (driverchooser), GTK_WIN_POS_CENTER);
  gtk_window_set_modal (GTK_WINDOW (driverchooser), TRUE);
  gtk_window_set_default_size (GTK_WINDOW (driverchooser), 600, 450);
  gtk_window_set_type_hint (GTK_WINDOW (driverchooser), GDK_WINDOW_TYPE_HINT_DIALOG);

#if GTK_CHECK_VERSION(2,0,0)
  gtk_widget_show (driverchooser);
#endif

  dialog_vbox2 = GTK_DIALOG (driverchooser)->vbox;
  gtk_widget_set_name (dialog_vbox2, "dialog_vbox2");
  gtk_widget_show (dialog_vbox2);

  hbox25 = gtk_hbox_new (FALSE, 0);
  gtk_widget_set_name (hbox25, "hbox25");
  gtk_widget_show (hbox25);
  gtk_box_pack_start (GTK_BOX (dialog_vbox2), hbox25, TRUE, TRUE, 0);

  frame37 = gtk_frame_new (NULL);
  gtk_widget_set_name (frame37, "frame37");
  gtk_widget_show (frame37);
  gtk_box_pack_start (GTK_BOX (hbox25), frame37, FALSE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame37), 10);
  gtk_frame_set_shadow_type (GTK_FRAME (frame37), GTK_SHADOW_NONE);

  alignment29 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_set_name (alignment29, "alignment29");
  gtk_widget_show (alignment29);
  gtk_container_add (GTK_CONTAINER (frame37), alignment29);
  gtk_widget_set_size_request (alignment29, 140, -1);

#if GTK_CHECK_VERSION(2,0,0)
  style = gtk_widget_get_style (driverchooser);
  pixmap =
      gdk_pixmap_create_from_xpm_d (driverchooser->window, &mask,
      &style->bg[GTK_STATE_NORMAL], (gchar **) img_xpm);
#else
  style = gtk_widget_get_style (GTK_WIDGET (hwnd));
  pixmap =
      gdk_pixmap_create_from_xpm_d (GTK_WIDGET (hwnd)->window, &mask,
      &style->bg[GTK_STATE_NORMAL], (gchar **) img_xpm);
#endif

  pixmap1 = gtk_pixmap_new (pixmap, mask);
  gtk_widget_set_name (pixmap1, "pixmap1");
  gtk_widget_show (pixmap1);
  gtk_container_add (GTK_CONTAINER (alignment29), pixmap1);

  frame36 = gtk_frame_new (NULL);
  gtk_widget_set_name (frame36, "frame36");
  gtk_widget_show (frame36);
  gtk_box_pack_start (GTK_BOX (hbox25), frame36, TRUE, TRUE, 0);
  gtk_frame_set_shadow_type (GTK_FRAME (frame36), GTK_SHADOW_NONE);

  alignment28 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_set_name (alignment28, "alignment28");
  gtk_widget_show (alignment28);
  gtk_container_add (GTK_CONTAINER (frame36), alignment28);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment28), 0, 10, 0, 0);

  scrolledwindow10 = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_set_name (scrolledwindow10, "scrolledwindow10");
  gtk_widget_show (scrolledwindow10);
  gtk_container_add (GTK_CONTAINER (alignment28), scrolledwindow10);

  clist1 = gtk_clist_new (4);
  gtk_widget_set_name (clist1, "clist1");
  gtk_widget_show (clist1);
  gtk_container_add (GTK_CONTAINER (scrolledwindow10), clist1);
  gtk_clist_set_column_width (GTK_CLIST (clist1), 0, 165);
  gtk_clist_set_column_width (GTK_CLIST (clist1), 1, 118);
  gtk_clist_set_column_width (GTK_CLIST (clist1), 2, 80);
  gtk_clist_set_column_width (GTK_CLIST (clist1), 3, 80);
  gtk_clist_column_titles_show (GTK_CLIST (clist1));

  l_name = gtk_label_new (_("Name"));
  gtk_widget_set_name (l_name, "l_name");
  gtk_widget_show (l_name);
  gtk_clist_set_column_widget (GTK_CLIST (clist1), 0, l_name);
  gtk_widget_set_size_request (l_name, 165, -1);

  l_file = gtk_label_new (_("File"));
  gtk_widget_set_name (l_file, "l_file");
  gtk_widget_show (l_file);
  gtk_clist_set_column_widget (GTK_CLIST (clist1), 1, l_file);
  gtk_widget_set_size_request (l_file, 118, -1);

  l_date = gtk_label_new (_("Date"));
  gtk_widget_set_name (l_date, "l_date");
  gtk_widget_show (l_date);
  gtk_clist_set_column_widget (GTK_CLIST (clist1), 2, l_date);
  gtk_widget_set_size_request (l_date, 80, -1);

  l_size = gtk_label_new (_("Size"));
  gtk_widget_set_name (l_size, "l_size");
  gtk_widget_show (l_size);
  gtk_clist_set_column_widget (GTK_CLIST (clist1), 3, l_size);
  gtk_widget_set_size_request (l_size, 80, -1);

  l_diz = gtk_label_new (_("Select a driver for which you want to setup a data source"));
  gtk_widget_set_name (l_diz, "l_diz");
  gtk_widget_show (l_diz);
  gtk_frame_set_label_widget (GTK_FRAME (frame36), l_diz);
  gtk_label_set_use_markup (GTK_LABEL (l_diz), TRUE);

  dialog_action_area2 = GTK_DIALOG (driverchooser)->action_area;
  gtk_widget_set_name (dialog_action_area2, "dialog_action_area2");
  gtk_widget_show (dialog_action_area2);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area2), GTK_BUTTONBOX_END);

  b_finish = gtk_button_new_with_mnemonic (_("_Finish"));
  gtk_widget_set_name (b_finish, "b_finish");
  gtk_widget_show (b_finish);
  gtk_dialog_add_action_widget (GTK_DIALOG (driverchooser), b_finish, 0);
  GTK_WIDGET_SET_FLAGS (b_finish, GTK_CAN_DEFAULT);

  b_cancel = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_set_name (b_cancel, "b_cancel");
  gtk_widget_show (b_cancel);
  gtk_dialog_add_action_widget (GTK_DIALOG (driverchooser), b_cancel, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (b_cancel, GTK_CAN_DEFAULT);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (driverchooser, driverchooser, "driverchooser");
  GLADE_HOOKUP_OBJECT_NO_REF (driverchooser, dialog_vbox2, "dialog_vbox2");
  GLADE_HOOKUP_OBJECT (driverchooser, hbox25, "hbox25");
  GLADE_HOOKUP_OBJECT (driverchooser, frame37, "frame37");
  GLADE_HOOKUP_OBJECT (driverchooser, alignment29, "alignment29");
  GLADE_HOOKUP_OBJECT (driverchooser, pixmap1, "pixmap1");
  GLADE_HOOKUP_OBJECT (driverchooser, frame36, "frame36");
  GLADE_HOOKUP_OBJECT (driverchooser, alignment28, "alignment28");
  GLADE_HOOKUP_OBJECT (driverchooser, scrolledwindow10, "scrolledwindow10");
  GLADE_HOOKUP_OBJECT (driverchooser, clist1, "clist1");
  GLADE_HOOKUP_OBJECT (driverchooser, l_name, "l_name");
  GLADE_HOOKUP_OBJECT (driverchooser, l_file, "l_file");
  GLADE_HOOKUP_OBJECT (driverchooser, l_date, "l_date");
  GLADE_HOOKUP_OBJECT (driverchooser, l_size, "l_size");
  GLADE_HOOKUP_OBJECT (driverchooser, l_diz, "l_diz");
  GLADE_HOOKUP_OBJECT_NO_REF (driverchooser, dialog_action_area2, "dialog_action_area2");
  GLADE_HOOKUP_OBJECT (driverchooser, b_finish, "b_finish");
  GLADE_HOOKUP_OBJECT (driverchooser, b_cancel, "b_cancel");

  /* Ok button events */
  gtk_signal_connect (GTK_OBJECT (b_finish), "clicked",
      GTK_SIGNAL_FUNC (driverchooser_ok_clicked), choose_t);
  /* Cancel button events */
  gtk_signal_connect (GTK_OBJECT (b_cancel), "clicked",
      GTK_SIGNAL_FUNC (driverchooser_cancel_clicked), choose_t);
  /* Close window button events */
  gtk_signal_connect (GTK_OBJECT (driverchooser), "delete_event",
      GTK_SIGNAL_FUNC (delete_event), choose_t);
  gtk_signal_connect (GTK_OBJECT (driverchooser), "destroy",
      GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
  /* Driver list events */
  gtk_signal_connect (GTK_OBJECT (clist1), "select_row",
      GTK_SIGNAL_FUNC (driver_list_select), choose_t);

  adddrivers_to_list (clist1, driverchooser);

  choose_t->driverlist = clist1;
  choose_t->driver = NULL;
  choose_t->mainwnd = driverchooser;
  choose_t->b_finish = b_finish;

  gtk_widget_show_all (driverchooser);
  gtk_main ();
}