コード例 #1
0
ファイル: gbvbox.c プロジェクト: cooljeanius/glade0-0.6.4
static void
on_vbox_dialog_ok (GtkWidget * widget, GbWidgetNewData * data)
{
  GtkWidget *new_widget, *spinbutton, *window, *placeholder;
  gint rows, i;

  window = gtk_widget_get_toplevel (widget);

  /* Only call callback if placeholder/fixed widget is still there */
  if (gb_widget_can_finish_new (data))
    {
      spinbutton = gtk_object_get_data (GTK_OBJECT (window), "rows");
      g_return_if_fail (spinbutton != NULL);
      rows = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spinbutton));

      new_widget = gtk_vbox_new (FALSE, 0);
      for (i = 0; i < rows; i++)
	{
	  placeholder = editor_new_placeholder ();
	  /*gtk_widget_set_usize(placeholder, 80, 60); */
	  gtk_box_pack_start (GTK_BOX (new_widget), placeholder, TRUE, TRUE, 0);
	}
      gb_widget_initialize (new_widget, data);
      (*data->callback) (new_widget, data);
    }
  gtk_widget_destroy (window);
}
コード例 #2
0
ファイル: gbvbuttonbox.c プロジェクト: AriaAsuka/deadbeef
static void
on_vbbox_dialog_ok (GtkWidget * widget, GbWidgetNewData * data)
{
  GtkWidget *new_widget, *spinbutton, *window, *new_child;
  gint rows, i;

  window = gtk_widget_get_toplevel (widget);

  /* Only call callback if placeholder/fixed widget is still there */
  if (gb_widget_can_finish_new (data))
    {
      spinbutton = gtk_object_get_data (GTK_OBJECT (window), "rows");
      g_return_if_fail (spinbutton != NULL);
      rows = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spinbutton));

      new_widget = gtk_vbutton_box_new ();
      for (i = 0; i < rows; i++)
	{
	  new_child = gb_widget_new ("GtkButton", new_widget);
	  GTK_WIDGET_SET_FLAGS (new_child, GTK_CAN_DEFAULT);
	  gtk_container_add (GTK_CONTAINER (new_widget), new_child);
	}
      gb_widget_initialize (new_widget, data);
      (*data->callback) (new_widget, data);
    }
  gtk_widget_destroy (window);
}
コード例 #3
0
ファイル: gbtclist.c プロジェクト: BackupTheBerlios/manuproc
static void
on_tclist_dialog_ok (GtkWidget * widget, GbWidgetNewData * data)
{
  GtkWidget *new_widget, *spinbutton, *dialog, *label;
#ifndef GTK_HAVE_FEATURES_1_1_4
  GtkAdjustment *adjustment;
#endif
  gint cols, i;

  dialog = gtk_widget_get_toplevel (widget);

  /* Only call callback if placeholder/fixed widget is still there */
  if (gb_widget_can_finish_new (data))
    {
      spinbutton = gtk_object_get_data (GTK_OBJECT (dialog), "cols");
      g_return_if_fail (spinbutton != NULL);
      cols = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spinbutton));

      new_widget = tclist_new (cols);
      gtk_clist_column_titles_show (GTK_CLIST (new_widget));
      for (i = 0; i < cols; i++)
	{
	  label = new_label (new_widget);
	  gtk_clist_set_column_widget (GTK_CLIST (new_widget), i,
				       label);
	  gtk_clist_set_column_width (GTK_CLIST (new_widget), i, 80);
	}

      /* Connect signals for redrawing. */
      /* The CList doesn't have scrollbars in 1.1.4+. We'll have to do this
	 another way at some point. */
#ifndef GTK_HAVE_FEATURES_1_1_4
      adjustment = gtk_range_get_adjustment (GTK_RANGE (GTK_CLIST (new_widget)->hscrollbar));
      gtk_signal_connect_after (GTK_OBJECT (adjustment), "value_changed",
				(GtkSignalFunc) hadjustment_value_changed,
				new_widget);
      adjustment = gtk_range_get_adjustment (GTK_RANGE (GTK_CLIST (new_widget)->vscrollbar));
      gtk_signal_connect_after (GTK_OBJECT (adjustment), "value_changed",
				(GtkSignalFunc) vadjustment_value_changed,
				new_widget);
#endif

      gb_widget_initialize (new_widget, data);
      (*data->callback) (new_widget, data);
    }
  gtk_widget_destroy (dialog);
}
コード例 #4
0
ファイル: gnomedruid.c プロジェクト: jubalh/deadbeef
static void
on_druid_dialog_ok (GtkWidget * widget, GbWidgetNewData * data)
{
  GtkWidget *new_widget, *spinbutton, *window, *page;
  gint pages, i;

  window = gtk_widget_get_toplevel (widget);

  /* Only call callback if placeholder/fixed widget is still there */
  if (gb_widget_can_finish_new (data))
    {
      spinbutton = gtk_object_get_data (GTK_OBJECT (window), "pages");
      g_return_if_fail (spinbutton != NULL);
      pages = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spinbutton));

      new_widget = gnome_druid_new ();
      page = gnome_druid_page_edge_new_aa (GNOME_EDGE_START);
      gb_widget_create_from (page, "GnomeDruidPageStart");
      gnome_druid_append_page (GNOME_DRUID (new_widget),
			       GNOME_DRUID_PAGE (page));
      gnome_druid_set_page (GNOME_DRUID (new_widget), GNOME_DRUID_PAGE (page));

      for (i = 0; i < pages - 2; i++)
	{
	  page = gb_widget_new ("GnomeDruidPageStandard", new_widget);
	  gnome_druid_append_page (GNOME_DRUID (new_widget),
				   GNOME_DRUID_PAGE (page));
	}

      if (pages >= 2)
	{
	  page = gnome_druid_page_edge_new_aa (GNOME_EDGE_FINISH);
	  gb_widget_create_from (page, "GnomeDruidPageFinish");
	  gnome_druid_append_page (GNOME_DRUID (new_widget),
				   GNOME_DRUID_PAGE (page));
	}

      gtk_widget_show_all (new_widget);
      gb_widget_initialize (new_widget, data);
      (*data->callback) (new_widget, data);
    }
  gtk_widget_destroy (window);
}