Пример #1
0
static void
show_vbox_dialog (GbWidgetNewData * data)
{
  GtkWidget *dialog, *vbox, *hbox, *label, *spinbutton;
  GtkObject *adjustment;

  dialog = glade_util_create_dialog (_("New vertical box"), data->parent,
				     on_vbox_dialog_ok, data, &vbox);
  gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
		      GTK_SIGNAL_FUNC (on_vbox_dialog_destroy), data);

  hbox = gtk_hbox_new (FALSE, 5);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 5);
  gtk_container_set_border_width (GTK_CONTAINER (hbox), 10);
  gtk_widget_show (hbox);

  label = gtk_label_new (_("Number of rows:"));
  gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 5);
  gtk_widget_show (label);

  adjustment = gtk_adjustment_new (3, 1, 100, 1, 10, 10);
  spinbutton = glade_util_spin_button_new (GTK_OBJECT (dialog), "rows",
					   GTK_ADJUSTMENT (adjustment), 1, 0);
  gtk_box_pack_start (GTK_BOX (hbox), spinbutton, TRUE, TRUE, 5);
  gtk_widget_set_usize (spinbutton, 50, -1);
  gtk_widget_grab_focus (spinbutton);
  gtk_widget_show (spinbutton);

  gtk_widget_show (dialog);
  gtk_grab_add (dialog);
}
Пример #2
0
static void
show_tclist_dialog (GbWidgetNewData * data)
{
  GtkWidget *dialog, *vbox, *hbox, *label, *spinbutton;
  GtkObject *adjustment;

  dialog = glade_util_create_dialog (_("New tree columned list"), data->parent,
				     on_tclist_dialog_ok, data, &vbox);
  gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
		      GTK_SIGNAL_FUNC (on_tclist_dialog_destroy), data);

  hbox = gtk_hbox_new (FALSE, 5);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 5);
  gtk_container_border_width (GTK_CONTAINER (hbox), 10);
  gtk_widget_show (hbox);

  label = gtk_label_new (_("Number of columns:"));
  gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 5);
  gtk_widget_show (label);

  adjustment = gtk_adjustment_new (3, 1, 100, 1, 10, 10);
  spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 0);
  /* save pointer to spinbutton so we can find it easily in the OK handler */
  gtk_object_set_data (GTK_OBJECT (dialog), "cols", spinbutton);
  gtk_box_pack_start (GTK_BOX (hbox), spinbutton, TRUE, TRUE, 5);
  gtk_widget_set_usize (spinbutton, 50, -1);
  gtk_widget_grab_focus (spinbutton);
  gtk_widget_show (spinbutton);

  gtk_widget_show (dialog);
  gtk_grab_add (dialog);
}
Пример #3
0
static void
show_control_dialog (GbWidgetNewData *data)
{
  GtkWidget *dialog, *vbox, *label, *list, *scroll;
  GtkListStore *store;
  GtkCellRenderer *ren;

  dialog = glade_util_create_dialog (_("New Bonobo Control"), data->parent,
				     GTK_SIGNAL_FUNC (on_control_dialog_ok),
				     data, &vbox);
  g_object_set (G_OBJECT (dialog),
		"resizable", TRUE,
		"default-width", 400,
		"default-height", 300,
		NULL);
  gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
				     GTK_RESPONSE_OK, FALSE);
  g_signal_connect (dialog, "destroy",
		    G_CALLBACK (on_control_dialog_destroy), data);

  label = gtk_label_new (_("Select a Bonobo Control"));  
  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);

  scroll = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
			 "hadjustment",       NULL,
			 "vadjustment",       NULL,
			 "shadow-type",       GTK_SHADOW_ETCHED_IN,
			 "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
			 "hscrollbar-policy", GTK_POLICY_AUTOMATIC,
			 NULL);
  gtk_box_pack_start (GTK_BOX (vbox), scroll, TRUE, TRUE, 0);

  store = do_query ();

  list = g_object_new (GTK_TYPE_TREE_VIEW,
		       "model",           store,
		       "headers-visible", FALSE,
		       NULL);
  g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (list)),
		    "changed",
		    G_CALLBACK (on_list_selection_changed), dialog);

  g_object_unref (store);

  ren = gtk_cell_renderer_text_new ();
  
#if 0
  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (list),
					       -1, _("OAFIID"), ren,
					       "text", COL_OBJID,
					       NULL);
#endif
  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (list),
					       -1, _("Description"), ren,
					       "text", COL_DESC,
					       NULL);

  gtk_container_add (GTK_CONTAINER (scroll), list);

  g_object_set_data (G_OBJECT (dialog), "tree_view", list);

  gtk_widget_show_all (dialog);
  gtk_grab_add (dialog);
}