コード例 #1
0
ファイル: bar.c プロジェクト: tomaszg7/geeqie
void bar_add(GtkWidget *bar, GtkWidget *pane)
{
	GtkWidget *expander;
	BarData *bd = g_object_get_data(G_OBJECT(bar), "bar_data");
	PaneData *pd = g_object_get_data(G_OBJECT(pane), "pane_data");

	if (!bd) return;

	pd->lw = bd->lw;
	pd->bar = bar;

	expander = gtk_expander_new(NULL);
	if (pd && pd->title)
		{
		gtk_expander_set_label_widget(GTK_EXPANDER(expander), pd->title);
		gtk_widget_show(pd->title);
		}

	gtk_box_pack_start(GTK_BOX(bd->vbox), expander, FALSE, TRUE, 0);

	g_signal_connect(expander, "button_release_event", G_CALLBACK(bar_menu_cb), bd);
	g_signal_connect(expander, "notify::expanded", G_CALLBACK(bar_expander_cb), pd);

	gtk_container_add(GTK_CONTAINER(expander), pane);

	gtk_expander_set_expanded(GTK_EXPANDER(expander), pd->expanded);

	gtk_widget_show(expander);

	if (bd->fd && pd && pd->pane_set_fd) pd->pane_set_fd(pane, bd->fd);

}
コード例 #2
0
ファイル: contacts-edit-pane.c プロジェクト: GNOME/contacts
/* Helper function to add contacts label/edit widget pairs to a table,
 * with respect for structured field edits.
 */
void
contacts_append_to_edit_table (GtkTable *table, GtkWidget *label,
	GtkWidget *edit, gboolean do_focus)
{
	guint rows, cols;

	g_object_get (table, "n-rows", &rows, NULL);
	g_object_get (table, "n-columns", &cols, NULL);
	
	gtk_widget_show (label);
	gtk_widget_show (edit);
     	if (contacts_get_structured_field (
     	    gtk_widget_get_name (GTK_WIDGET (label)), 0)) {
     		GtkWidget *expander = gtk_expander_new (NULL);
     		GtkWidget *viewport = gtk_viewport_new (NULL, NULL);
     		gtk_expander_set_label_widget (GTK_EXPANDER (expander), label);
     		gtk_container_add (GTK_CONTAINER (viewport), edit);
     		gtk_widget_show (viewport);
     		gtk_container_add (GTK_CONTAINER (expander), viewport);
     		gtk_expander_set_expanded (GTK_EXPANDER (expander),
     					   TRUE);
     		gtk_widget_show (expander);
     		gtk_widget_set_name (expander, gtk_widget_get_name (edit));
     		/* Highlight selected field */
		if (do_focus) {
			expander = contacts_edit_add_focus_events (
				expander, NULL, NULL);
		}
     		gtk_table_attach (table,
     				  GTK_WIDGET (expander), 0, cols,
     				  rows, rows+1, GTK_FILL | GTK_EXPAND,
     				  GTK_FILL, 0, 0);
     	} else {
     		/* Hide the label when the entry is hidden */
		g_signal_connect_swapped (G_OBJECT (edit), "hide", 
					  G_CALLBACK (gtk_widget_hide),
					  label);

     		/* Highlight selected field */
		if (do_focus) {
			GList *l;
			GtkWidget *box = gtk_event_box_new ();
			gtk_container_add (GTK_CONTAINER (box), edit);
			gtk_widget_set_name (box, gtk_widget_get_name (edit));
			gtk_widget_show (box); 
			l = g_list_prepend (NULL, box);
			label = contacts_edit_add_focus_events (
				label, NULL, l);
			g_list_free (l);
			l = g_list_prepend (NULL, label);
			edit = contacts_edit_add_focus_events (edit, box, l);
			g_list_free (l);
		}
		
		gtk_table_attach (table, label,
			0, 1, rows, rows+1, GTK_FILL, GTK_FILL, 0, 0);
		gtk_table_attach (table, edit, 1, cols, rows, rows+1,
			GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
	}
}
コード例 #3
0
static void
gtk_expander_remove (GtkContainer *container,
		     GtkWidget    *widget)
{
  GtkExpander *expander = GTK_EXPANDER (container);

  if (GTK_EXPANDER (expander)->priv->label_widget == widget)
    gtk_expander_set_label_widget (expander, NULL);
  else
    GTK_CONTAINER_CLASS (gtk_expander_parent_class)->remove (container, widget);
}
コード例 #4
0
static void
gtk_expander_buildable_add_child (GtkBuildable  *buildable,
				  GtkBuilder    *builder,
				  GObject       *child,
				  const gchar   *type)
{
  if (!type)
    gtk_container_add (GTK_CONTAINER (buildable), GTK_WIDGET (child));
  else if (strcmp (type, "label") == 0)
    gtk_expander_set_label_widget (GTK_EXPANDER (buildable), GTK_WIDGET (child));
  else
    GTK_BUILDER_WARN_INVALID_CHILD_TYPE (GTK_EXPANDER (buildable), type);
}
コード例 #5
0
/**
 * gtk_expander_set_label:
 * @expander: a #GtkExpander
 * @label: (allow-none): a string
 *
 * Sets the text of the label of the expander to @label.
 *
 * This will also clear any previously set labels.
 *
 * Since: 2.4
 **/
void
gtk_expander_set_label (GtkExpander *expander,
			const gchar *label)
{
  g_return_if_fail (GTK_IS_EXPANDER (expander));

  if (!label)
    {
      gtk_expander_set_label_widget (expander, NULL);
    }
  else
    {
      GtkWidget *child;

      child = gtk_label_new (label);
      gtk_label_set_use_underline (GTK_LABEL (child), expander->priv->use_underline);
      gtk_label_set_use_markup (GTK_LABEL (child), expander->priv->use_markup);
      gtk_widget_show (child);

      gtk_expander_set_label_widget (expander, child);
    }

  g_object_notify (G_OBJECT (expander), "label");
}
コード例 #6
0
static GtkWidget *gebr_gui_program_edit_load_parameter(GebrGuiProgramEdit  *program_edit,
						       GebrGeoXmlParameter *parameter,
						       GSList             **radio_group)
{
	GebrGeoXmlParameterType type;

	type = gebr_geoxml_parameter_get_type(parameter);
	if (type == GEBR_GEOXML_PARAMETER_TYPE_GROUP) {
		GtkWidget *expander;
		GtkWidget *label_widget;
		GtkWidget *label;
		GtkWidget *image_widget;

		GtkWidget *depth_hbox;
		GtkWidget *group_vbox;
		GtkWidget *instanciate_button;
		GtkWidget *deinstanciate_button;

		GebrGeoXmlParameterGroup *parameter_group;
		GebrGeoXmlSequence *instance;
		GebrGeoXmlSequence *param;
		gboolean required;

		parameter_group = GEBR_GEOXML_PARAMETER_GROUP(parameter);

		expander = gtk_expander_new("");
		image_widget = gtk_image_new();
		program_edit->group_warning_widget = image_widget;

		gtk_widget_show(expander);
		gtk_expander_set_expanded(GTK_EXPANDER(expander),
					  gebr_geoxml_parameter_group_get_expand(parameter_group));

		label_widget = gtk_hbox_new(FALSE, 0);
		gtk_widget_show(label_widget);
		gtk_expander_set_label_widget(GTK_EXPANDER(expander), label_widget);
		gebr_gui_gtk_expander_hacked_define(expander, label_widget);

		GebrGeoXmlParameters *template;
コード例 #7
0
static void
gtk_expander_set_property (GObject      *object,
			   guint         prop_id,
			   const GValue *value,
			   GParamSpec   *pspec)
{
  GtkExpander *expander = GTK_EXPANDER (object);
                                                                                                             
  switch (prop_id)
    {
    case PROP_EXPANDED:
      gtk_expander_set_expanded (expander, g_value_get_boolean (value));
      break;
    case PROP_LABEL:
      gtk_expander_set_label (expander, g_value_get_string (value));
      break;
    case PROP_USE_UNDERLINE:
      gtk_expander_set_use_underline (expander, g_value_get_boolean (value));
      break;
    case PROP_USE_MARKUP:
      gtk_expander_set_use_markup (expander, g_value_get_boolean (value));
      break;
    case PROP_SPACING:
      gtk_expander_set_spacing (expander, g_value_get_int (value));
      break;
    case PROP_LABEL_WIDGET:
      gtk_expander_set_label_widget (expander, g_value_get_object (value));
      break;
    case PROP_LABEL_FILL:
      gtk_expander_set_label_fill (expander, g_value_get_boolean (value));
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    }
}
コード例 #8
0
static void
battery_add_overview (GtkWidget     *box,
                      BatteryStatus *bat,
                      GtkSizeGroup  *sg)
{
    GtkWidget   *hbox, *vbox, *label, *image, *expander;
    const gchar *icon, *status, *percentage, *time, *vendor, *technology, *designcap, *path;

    hbox = gtk_hbox_new (FALSE, BORDER);
    gtk_box_pack_start (GTK_BOX (box), hbox, FALSE, FALSE, 0);
    gtk_container_set_border_width (GTK_CONTAINER (hbox), BORDER);
    
    /* Battery Icon */
    icon = battery_icon_name (bat);

    image = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_DIALOG);
    gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, TRUE, 0);
    gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0);
    gtk_misc_set_padding (GTK_MISC (image), 10, 10);

    vbox = gtk_vbox_new (FALSE, 2);
    gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);

    /* Status box */
    status = battery_get_status (bat);
    battery_add_overview_item (vbox, sg, _("<b>Status</b>"), status);
    
    /* Percentage */
    percentage = g_strdup_printf ("%d%%", bat->percentage);
    battery_add_overview_item (vbox, sg, _("<b>Percentage</b>"), percentage);
    
    /* Time remaining */
    if (bat->time > 3600)
        time = g_strdup_printf (_("%d hr %d min"), bat->time / 3600, bat->time / 60 % 60);
    else if (bat->time > 0)
        time = g_strdup_printf (_("%d min"), bat->time / 60);
    else
	time = NULL;
    
    battery_add_overview_item (vbox, sg, _("<b>Time</b>"), time);
    
    expander = gtk_expander_new (NULL);
    gtk_box_pack_start (GTK_BOX (vbox), expander, TRUE, TRUE, 0);
    
    label = gtk_label_new (_("More..."));
    gtk_expander_set_label_widget (GTK_EXPANDER (expander), label);
    
    vbox = gtk_vbox_new (FALSE, 2);
    gtk_container_add (GTK_CONTAINER (expander), vbox);
    
    /* Vendor */
    vendor = battery_get_property_string (bat->udi, "battery.vendor");
    battery_add_overview_item (vbox, sg, _("<b>Vendor</b>"), vendor);
    
    technology = battery_get_property_string (bat->udi, "battery.technology");
    battery_add_overview_item (vbox, sg, _("<b>Technology:</b>"), technology);
    
    if (battery_get_property_int (bat->udi, "battery.reporting.design") &&
	battery_get_property_string (bat->udi, "battery.reporting.unit"))
    {
        designcap = g_strdup_printf ("%d %s",
                                     battery_get_property_int    (bat->udi, "battery.reporting.design"),
                                     battery_get_property_string (bat->udi, "battery.reporting.unit"));
        battery_add_overview_item (vbox, sg, _("<b>Design Capacity:</b>"), designcap);
    }
    
    path = battery_get_property_string (bat->udi, "linux.acpi_path");
    battery_add_overview_item (vbox, sg, _("<b>ACPI Path:</b>"), path);
}
コード例 #9
0
ファイル: interface.c プロジェクト: Nazg-Gul/WebTester
GtkWidget*
create_main_window (void)
{
  GtkWidget *main_window;
  GdkPixbuf *main_window_icon_pixbuf;
  GtkWidget *hbox12;
  GtkWidget *vbox30;
  GtkWidget *expander1;
  GtkWidget *hbox6;
  GtkWidget *label11;
  GtkWidget *vbox5;
  GtkWidget *hbox7;
  GtkWidget *label12;
  GtkWidget *hbox9;
  GtkWidget *server;
  GtkWidget *connect;
  GtkWidget *alignment7;
  GtkWidget *hbox11;
  GtkWidget *image7;
  GtkWidget *label18;
  GtkWidget *login_at_connect;
  GtkWidget *hbox8;
  GtkWidget *label14;
  GtkWidget *table1;
  GtkWidget *label13;
  GtkWidget *label15;
  GtkWidget *login;
  GtkWidget *password;
  GtkWidget *label17;
  GtkWidget *label10;
  GtkWidget *hbox1;
  GtkWidget *frame1;
  GtkWidget *alignment3;
  GtkWidget *console_tabs;
  GtkWidget *alignment4;
  GtkWidget *vbox1;
  GtkWidget *console_scroll;
  GtkWidget *console_view;
  GtkWidget *label4;
  GtkWidget *hbox2;
  GtkWidget *image1;
  GtkWidget *cmd_entry;
  GtkWidget *btn_cmdSend;
  GtkWidget *label6;
  GtkWidget *alignment5;
  GtkWidget *pipe_scroll;
  GtkWidget *pipe_view;
  GtkWidget *label7;
  GtkWidget *label2;
  GtkWidget *vbox2;
  GtkWidget *frame2;
  GtkWidget *alignment2;
  GtkWidget *vbox3;
  GtkWidget *ctrlButton_0;
  GtkWidget *ctrlButton_1;
  GtkWidget *ctrlButton_2;
  GtkWidget *ctrlButton_3;
  GtkWidget *alignment6;
  GtkWidget *hbox3;
  GtkWidget *image2;
  GtkWidget *hbox4;
  GtkWidget *queue_progress;
  GtkWidget *queue_usage;
  GtkWidget *label9;
  GtkWidget *image3;
  GtkWidget *hbox5;
  GtkWidget *belts_progress;
  GtkWidget *belts_usage;
  GtkWidget *ctrlButton_4;
  GtkWidget *ctrlButton_5;
  GtkWidget *ctrlButton_6;
  GtkWidget *label5;
  GtkWidget *label3;
  GtkWidget *label8;
  GtkWidget *image6;

  main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (main_window), _("WebTester Server Console"));
  gtk_window_set_resizable (GTK_WINDOW (main_window), FALSE);
  main_window_icon_pixbuf = create_pixbuf ("wt32.png");
  if (main_window_icon_pixbuf)
    {
      gtk_window_set_icon (GTK_WINDOW (main_window), main_window_icon_pixbuf);
      gdk_pixbuf_unref (main_window_icon_pixbuf);
    }

  hbox12 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox12);
  gtk_container_add (GTK_CONTAINER (main_window), hbox12);

  vbox30 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox30);
  gtk_box_pack_start (GTK_BOX (hbox12), vbox30, TRUE, TRUE, 0);

  expander1 = gtk_expander_new (NULL);
  gtk_widget_show (expander1);
  gtk_box_pack_start (GTK_BOX (vbox30), expander1, FALSE, TRUE, 0);
  gtk_widget_set_size_request (expander1, 640, -1);
  gtk_expander_set_expanded (GTK_EXPANDER (expander1), TRUE);

  hbox6 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox6);
  gtk_container_add (GTK_CONTAINER (expander1), hbox6);

  label11 = gtk_label_new ("");
  gtk_widget_show (label11);
  gtk_box_pack_start (GTK_BOX (hbox6), label11, FALSE, FALSE, 0);
  gtk_widget_set_size_request (label11, 16, -1);

  vbox5 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox5);
  gtk_box_pack_start (GTK_BOX (hbox6), vbox5, FALSE, TRUE, 0);

  hbox7 = gtk_hbox_new (FALSE, 6);
  gtk_widget_show (hbox7);
  gtk_box_pack_start (GTK_BOX (vbox5), hbox7, TRUE, TRUE, 0);

  label12 = gtk_label_new (_("Server:Port"));
  gtk_widget_show (label12);
  gtk_box_pack_start (GTK_BOX (hbox7), label12, FALSE, FALSE, 0);

  hbox9 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox9);
  gtk_box_pack_start (GTK_BOX (hbox7), hbox9, TRUE, TRUE, 0);

  server = gtk_entry_new ();
  gtk_widget_show (server);
  gtk_box_pack_start (GTK_BOX (hbox9), server, TRUE, TRUE, 0);

  connect = gtk_toggle_button_new ();
  gtk_widget_show (connect);
  gtk_box_pack_start (GTK_BOX (hbox9), connect, FALSE, FALSE, 0);

  alignment7 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment7);
  gtk_container_add (GTK_CONTAINER (connect), alignment7);

  hbox11 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox11);
  gtk_container_add (GTK_CONTAINER (alignment7), hbox11);

  image7 = create_pixmap (main_window, "connect.png");
  gtk_widget_show (image7);
  gtk_box_pack_start (GTK_BOX (hbox11), image7, FALSE, FALSE, 0);

  label18 = gtk_label_new (_("Connect"));
  gtk_widget_show (label18);
  gtk_box_pack_start (GTK_BOX (hbox11), label18, FALSE, FALSE, 0);

  login_at_connect = gtk_check_button_new_with_mnemonic (_("Login at connect"));
  gtk_widget_show (login_at_connect);
  gtk_box_pack_start (GTK_BOX (vbox5), login_at_connect, FALSE, FALSE, 0);

  hbox8 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox8);
  gtk_box_pack_start (GTK_BOX (hbox6), hbox8, TRUE, TRUE, 0);

  label14 = gtk_label_new ("");
  gtk_widget_show (label14);
  gtk_box_pack_start (GTK_BOX (hbox8), label14, FALSE, FALSE, 0);
  gtk_widget_set_size_request (label14, 8, -1);

  table1 = gtk_table_new (2, 2, FALSE);
  gtk_widget_show (table1);
  gtk_box_pack_start (GTK_BOX (hbox8), table1, TRUE, TRUE, 0);
  gtk_table_set_col_spacings (GTK_TABLE (table1), 4);

  label13 = gtk_label_new (_("Login"));
  gtk_widget_show (label13);
  gtk_table_attach (GTK_TABLE (table1), label13, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label13), 0, 0.5);

  label15 = gtk_label_new (_("Password"));
  gtk_widget_show (label15);
  gtk_table_attach (GTK_TABLE (table1), label15, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label15), 0, 0.5);

  login = gtk_entry_new ();
  gtk_widget_show (login);
  gtk_table_attach (GTK_TABLE (table1), login, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_widget_set_sensitive (login, FALSE);

  password = gtk_entry_new ();
  gtk_widget_show (password);
  gtk_table_attach (GTK_TABLE (table1), password, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_widget_set_sensitive (password, FALSE);
  gtk_entry_set_visibility (GTK_ENTRY (password), FALSE);

  label17 = gtk_label_new ("");
  gtk_widget_show (label17);
  gtk_box_pack_start (GTK_BOX (hbox8), label17, FALSE, FALSE, 0);
  gtk_widget_set_size_request (label17, 8, -1);

  label10 = gtk_label_new (_("Connection"));
  gtk_widget_show (label10);
  gtk_expander_set_label_widget (GTK_EXPANDER (expander1), label10);

  hbox1 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox1);
  gtk_box_pack_start (GTK_BOX (vbox30), hbox1, TRUE, TRUE, 0);

  frame1 = gtk_frame_new (NULL);
  gtk_widget_show (frame1);
  gtk_box_pack_start (GTK_BOX (hbox1), frame1, TRUE, TRUE, 0);
  gtk_frame_set_label_align (GTK_FRAME (frame1), 0.5, 0.5);

  alignment3 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (alignment3);
  gtk_container_add (GTK_CONTAINER (frame1), alignment3);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment3), 2, 4, 4, 4);

  console_tabs = gtk_notebook_new ();
  gtk_widget_show (console_tabs);
  gtk_container_add (GTK_CONTAINER (alignment3), console_tabs);

  alignment4 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (alignment4);
  gtk_container_add (GTK_CONTAINER (console_tabs), alignment4);
  gtk_notebook_set_tab_label_packing (GTK_NOTEBOOK (console_tabs), alignment4,
                                      TRUE, TRUE, GTK_PACK_START);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment4), 2, 2, 2, 2);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (alignment4), vbox1);

  console_scroll = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_show (console_scroll);
  gtk_box_pack_start (GTK_BOX (vbox1), console_scroll, TRUE, TRUE, 0);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (console_scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (console_scroll), GTK_SHADOW_IN);

  console_view = gtk_text_view_new ();
  gtk_widget_show (console_view);
  gtk_container_add (GTK_CONTAINER (console_scroll), console_view);
  gtk_text_view_set_editable (GTK_TEXT_VIEW (console_view), FALSE);
  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (console_view), GTK_WRAP_CHAR);
  gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (console_view), 4);
  gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (console_view), 4);
  gtk_text_view_set_left_margin (GTK_TEXT_VIEW (console_view), 4);
  gtk_text_view_set_right_margin (GTK_TEXT_VIEW (console_view), 4);

  label4 = gtk_label_new ("");
  gtk_widget_show (label4);
  gtk_box_pack_start (GTK_BOX (vbox1), label4, FALSE, FALSE, 0);
  gtk_widget_set_size_request (label4, 360, 3);

  hbox2 = gtk_hbox_new (FALSE, 4);
  gtk_widget_show (hbox2);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox2, FALSE, TRUE, 0);

  image1 = create_pixmap (main_window, "go.png");
  gtk_widget_show (image1);
  gtk_box_pack_start (GTK_BOX (hbox2), image1, FALSE, TRUE, 0);

  cmd_entry = gtk_entry_new ();
  gtk_widget_show (cmd_entry);
  gtk_box_pack_start (GTK_BOX (hbox2), cmd_entry, TRUE, TRUE, 0);

  btn_cmdSend = gtk_button_new_with_mnemonic (_("Send"));
  gtk_widget_show (btn_cmdSend);
  gtk_box_pack_start (GTK_BOX (hbox2), btn_cmdSend, FALSE, FALSE, 0);

  label6 = gtk_label_new (_("User's console"));
  gtk_widget_show (label6);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (console_tabs), gtk_notebook_get_nth_page (GTK_NOTEBOOK (console_tabs), 0), label6);

  alignment5 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (alignment5);
  gtk_container_add (GTK_CONTAINER (console_tabs), alignment5);
  gtk_notebook_set_tab_label_packing (GTK_NOTEBOOK (console_tabs), alignment5,
                                      TRUE, TRUE, GTK_PACK_START);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment5), 2, 2, 2, 2);

  pipe_scroll = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_show (pipe_scroll);
  gtk_container_add (GTK_CONTAINER (alignment5), pipe_scroll);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (pipe_scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (pipe_scroll), GTK_SHADOW_IN);

  pipe_view = gtk_text_view_new ();
  gtk_widget_show (pipe_view);
  gtk_container_add (GTK_CONTAINER (pipe_scroll), pipe_view);
  gtk_text_view_set_editable (GTK_TEXT_VIEW (pipe_view), FALSE);
  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (pipe_view), GTK_WRAP_CHAR);
  gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (pipe_view), 4);
  gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (pipe_view), 4);
  gtk_text_view_set_left_margin (GTK_TEXT_VIEW (pipe_view), 4);
  gtk_text_view_set_right_margin (GTK_TEXT_VIEW (pipe_view), 4);

  label7 = gtk_label_new (_("Pipe"));
  gtk_widget_show (label7);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (console_tabs), gtk_notebook_get_nth_page (GTK_NOTEBOOK (console_tabs), 1), label7);
  gtk_label_set_line_wrap (GTK_LABEL (label7), TRUE);

  label2 = gtk_label_new (_("<b>WebTester</b> Console"));
  gtk_widget_show (label2);
  gtk_frame_set_label_widget (GTK_FRAME (frame1), label2);
  gtk_label_set_use_markup (GTK_LABEL (label2), TRUE);

  vbox2 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox2);
  gtk_box_pack_start (GTK_BOX (hbox1), vbox2, FALSE, TRUE, 0);

  frame2 = gtk_frame_new (NULL);
  gtk_widget_show (frame2);
  gtk_box_pack_start (GTK_BOX (vbox2), frame2, TRUE, TRUE, 0);
  gtk_frame_set_label_align (GTK_FRAME (frame2), 0.5, 0.5);

  alignment2 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (alignment2);
  gtk_container_add (GTK_CONTAINER (frame2), alignment2);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment2), 2, 4, 4, 4);

  vbox3 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox3);
  gtk_container_add (GTK_CONTAINER (alignment2), vbox3);

  ctrlButton_0 = gtk_button_new_with_mnemonic (_("(Unassigned)"));
  gtk_widget_show (ctrlButton_0);
  gtk_box_pack_start (GTK_BOX (vbox3), ctrlButton_0, FALSE, FALSE, 0);

  ctrlButton_1 = gtk_button_new_with_mnemonic (_("(Unassigned)"));
  gtk_widget_show (ctrlButton_1);
  gtk_box_pack_start (GTK_BOX (vbox3), ctrlButton_1, FALSE, FALSE, 0);

  ctrlButton_2 = gtk_button_new_with_mnemonic (_("(Unassigned)"));
  gtk_widget_show (ctrlButton_2);
  gtk_box_pack_start (GTK_BOX (vbox3), ctrlButton_2, FALSE, FALSE, 0);

  ctrlButton_3 = gtk_button_new_with_mnemonic (_("(Unassigned)"));
  gtk_widget_show (ctrlButton_3);
  gtk_box_pack_start (GTK_BOX (vbox3), ctrlButton_3, FALSE, FALSE, 0);

  alignment6 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (alignment6);
  gtk_box_pack_start (GTK_BOX (vbox3), alignment6, FALSE, FALSE, 0);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment6), 2, 2, 0, 0);

  hbox3 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox3);
  gtk_container_add (GTK_CONTAINER (alignment6), hbox3);

  image2 = create_pixmap (main_window, "queue.png");
  gtk_widget_show (image2);
  gtk_box_pack_start (GTK_BOX (hbox3), image2, FALSE, TRUE, 0);

  hbox4 = gtk_hbox_new (FALSE, 1);
  gtk_widget_show (hbox4);
  gtk_box_pack_start (GTK_BOX (hbox3), hbox4, FALSE, TRUE, 0);

  queue_progress = gtk_progress_bar_new ();
  gtk_widget_show (queue_progress);
  gtk_box_pack_start (GTK_BOX (hbox4), queue_progress, FALSE, FALSE, 0);
  gtk_widget_set_size_request (queue_progress, 10, 48);
  gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (queue_progress), GTK_PROGRESS_BOTTOM_TO_TOP);

  queue_usage = gtk_progress_bar_new ();
  gtk_widget_show (queue_usage);
  gtk_box_pack_start (GTK_BOX (hbox4), queue_usage, FALSE, FALSE, 0);
  gtk_widget_set_size_request (queue_usage, 10, 48);
  gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (queue_usage), GTK_PROGRESS_BOTTOM_TO_TOP);

  label9 = gtk_label_new ("");
  gtk_widget_show (label9);
  gtk_box_pack_start (GTK_BOX (hbox3), label9, FALSE, FALSE, 0);
  gtk_widget_set_size_request (label9, 6, -1);

  image3 = create_pixmap (main_window, "belts.png");
  gtk_widget_show (image3);
  gtk_box_pack_start (GTK_BOX (hbox3), image3, FALSE, FALSE, 0);

  hbox5 = gtk_hbox_new (FALSE, 1);
  gtk_widget_show (hbox5);
  gtk_box_pack_start (GTK_BOX (hbox3), hbox5, FALSE, FALSE, 0);

  belts_progress = gtk_progress_bar_new ();
  gtk_widget_show (belts_progress);
  gtk_box_pack_start (GTK_BOX (hbox5), belts_progress, FALSE, FALSE, 0);
  gtk_widget_set_size_request (belts_progress, 10, 48);
  gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (belts_progress), GTK_PROGRESS_BOTTOM_TO_TOP);

  belts_usage = gtk_progress_bar_new ();
  gtk_widget_show (belts_usage);
  gtk_box_pack_start (GTK_BOX (hbox5), belts_usage, FALSE, FALSE, 0);
  gtk_widget_set_size_request (belts_usage, 10, 48);
  gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (belts_usage), GTK_PROGRESS_BOTTOM_TO_TOP);

  ctrlButton_4 = gtk_button_new_with_mnemonic (_("(Unassigned)"));
  gtk_widget_show (ctrlButton_4);
  gtk_box_pack_start (GTK_BOX (vbox3), ctrlButton_4, FALSE, FALSE, 0);

  ctrlButton_5 = gtk_button_new_with_mnemonic (_("(Unassigned)"));
  gtk_widget_show (ctrlButton_5);
  gtk_box_pack_start (GTK_BOX (vbox3), ctrlButton_5, FALSE, FALSE, 0);

  ctrlButton_6 = gtk_button_new_with_mnemonic (_("(Unassigned)"));
  gtk_widget_show (ctrlButton_6);
  gtk_box_pack_start (GTK_BOX (vbox3), ctrlButton_6, FALSE, FALSE, 0);

  label5 = gtk_label_new ("");
  gtk_widget_show (label5);
  gtk_box_pack_start (GTK_BOX (vbox3), label5, TRUE, FALSE, 0);

  label3 = gtk_label_new (_("Control"));
  gtk_widget_show (label3);
  gtk_frame_set_label_widget (GTK_FRAME (frame2), label3);
  gtk_label_set_use_markup (GTK_LABEL (label3), TRUE);

  label8 = gtk_label_new (_("2007 (c) nazgul"));
  gtk_widget_show (label8);
  gtk_box_pack_start (GTK_BOX (vbox2), label8, FALSE, FALSE, 0);

  image6 = create_pixmap (main_window, "wt.png");
  gtk_widget_show (image6);
  gtk_box_pack_start (GTK_BOX (hbox12), image6, TRUE, TRUE, 0);

  g_signal_connect ((gpointer) main_window, "remove",
                    G_CALLBACK (on_main_window_remove),
                    NULL);
  g_signal_connect ((gpointer) connect, "toggled",
                    G_CALLBACK (on_connect_toggled),
                    NULL);
  g_signal_connect ((gpointer) login_at_connect, "toggled",
                    G_CALLBACK (on_login_at_connect_toggled),
                    NULL);
  g_signal_connect ((gpointer) cmd_entry, "key_press_event",
                    G_CALLBACK (on_cmd_entry_key_press_event),
                    NULL);
  g_signal_connect ((gpointer) btn_cmdSend, "clicked",
                    G_CALLBACK (on_btn_cmdSend_clicked),
                    NULL);
  g_signal_connect ((gpointer) ctrlButton_0, "clicked",
                    G_CALLBACK (on_ctrlButton_clicked),
                    NULL);
  g_signal_connect ((gpointer) ctrlButton_1, "clicked",
                    G_CALLBACK (on_ctrlButton_clicked),
                    NULL);
  g_signal_connect ((gpointer) ctrlButton_2, "clicked",
                    G_CALLBACK (on_ctrlButton_clicked),
                    NULL);
  g_signal_connect ((gpointer) ctrlButton_3, "clicked",
                    G_CALLBACK (on_ctrlButton_clicked),
                    NULL);
  g_signal_connect ((gpointer) ctrlButton_4, "clicked",
                    G_CALLBACK (on_ctrlButton_clicked),
                    NULL);
  g_signal_connect ((gpointer) ctrlButton_5, "clicked",
                    G_CALLBACK (on_ctrlButton_clicked),
                    NULL);
  g_signal_connect ((gpointer) ctrlButton_6, "clicked",
                    G_CALLBACK (on_ctrlButton_clicked),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (main_window, main_window, "main_window");
  GLADE_HOOKUP_OBJECT (main_window, hbox12, "hbox12");
  GLADE_HOOKUP_OBJECT (main_window, vbox30, "vbox30");
  GLADE_HOOKUP_OBJECT (main_window, expander1, "expander1");
  GLADE_HOOKUP_OBJECT (main_window, hbox6, "hbox6");
  GLADE_HOOKUP_OBJECT (main_window, label11, "label11");
  GLADE_HOOKUP_OBJECT (main_window, vbox5, "vbox5");
  GLADE_HOOKUP_OBJECT (main_window, hbox7, "hbox7");
  GLADE_HOOKUP_OBJECT (main_window, label12, "label12");
  GLADE_HOOKUP_OBJECT (main_window, hbox9, "hbox9");
  GLADE_HOOKUP_OBJECT (main_window, server, "server");
  GLADE_HOOKUP_OBJECT (main_window, connect, "connect");
  GLADE_HOOKUP_OBJECT (main_window, alignment7, "alignment7");
  GLADE_HOOKUP_OBJECT (main_window, hbox11, "hbox11");
  GLADE_HOOKUP_OBJECT (main_window, image7, "image7");
  GLADE_HOOKUP_OBJECT (main_window, label18, "label18");
  GLADE_HOOKUP_OBJECT (main_window, login_at_connect, "login_at_connect");
  GLADE_HOOKUP_OBJECT (main_window, hbox8, "hbox8");
  GLADE_HOOKUP_OBJECT (main_window, label14, "label14");
  GLADE_HOOKUP_OBJECT (main_window, table1, "table1");
  GLADE_HOOKUP_OBJECT (main_window, label13, "label13");
  GLADE_HOOKUP_OBJECT (main_window, label15, "label15");
  GLADE_HOOKUP_OBJECT (main_window, login, "login");
  GLADE_HOOKUP_OBJECT (main_window, password, "password");
  GLADE_HOOKUP_OBJECT (main_window, label17, "label17");
  GLADE_HOOKUP_OBJECT (main_window, label10, "label10");
  GLADE_HOOKUP_OBJECT (main_window, hbox1, "hbox1");
  GLADE_HOOKUP_OBJECT (main_window, frame1, "frame1");
  GLADE_HOOKUP_OBJECT (main_window, alignment3, "alignment3");
  GLADE_HOOKUP_OBJECT (main_window, console_tabs, "console_tabs");
  GLADE_HOOKUP_OBJECT (main_window, alignment4, "alignment4");
  GLADE_HOOKUP_OBJECT (main_window, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (main_window, console_scroll, "console_scroll");
  GLADE_HOOKUP_OBJECT (main_window, console_view, "console_view");
  GLADE_HOOKUP_OBJECT (main_window, label4, "label4");
  GLADE_HOOKUP_OBJECT (main_window, hbox2, "hbox2");
  GLADE_HOOKUP_OBJECT (main_window, image1, "image1");
  GLADE_HOOKUP_OBJECT (main_window, cmd_entry, "cmd_entry");
  GLADE_HOOKUP_OBJECT (main_window, btn_cmdSend, "btn_cmdSend");
  GLADE_HOOKUP_OBJECT (main_window, label6, "label6");
  GLADE_HOOKUP_OBJECT (main_window, alignment5, "alignment5");
  GLADE_HOOKUP_OBJECT (main_window, pipe_scroll, "pipe_scroll");
  GLADE_HOOKUP_OBJECT (main_window, pipe_view, "pipe_view");
  GLADE_HOOKUP_OBJECT (main_window, label7, "label7");
  GLADE_HOOKUP_OBJECT (main_window, label2, "label2");
  GLADE_HOOKUP_OBJECT (main_window, vbox2, "vbox2");
  GLADE_HOOKUP_OBJECT (main_window, frame2, "frame2");
  GLADE_HOOKUP_OBJECT (main_window, alignment2, "alignment2");
  GLADE_HOOKUP_OBJECT (main_window, vbox3, "vbox3");
  GLADE_HOOKUP_OBJECT (main_window, ctrlButton_0, "ctrlButton_0");
  GLADE_HOOKUP_OBJECT (main_window, ctrlButton_1, "ctrlButton_1");
  GLADE_HOOKUP_OBJECT (main_window, ctrlButton_2, "ctrlButton_2");
  GLADE_HOOKUP_OBJECT (main_window, ctrlButton_3, "ctrlButton_3");
  GLADE_HOOKUP_OBJECT (main_window, alignment6, "alignment6");
  GLADE_HOOKUP_OBJECT (main_window, hbox3, "hbox3");
  GLADE_HOOKUP_OBJECT (main_window, image2, "image2");
  GLADE_HOOKUP_OBJECT (main_window, hbox4, "hbox4");
  GLADE_HOOKUP_OBJECT (main_window, queue_progress, "queue_progress");
  GLADE_HOOKUP_OBJECT (main_window, queue_usage, "queue_usage");
  GLADE_HOOKUP_OBJECT (main_window, label9, "label9");
  GLADE_HOOKUP_OBJECT (main_window, image3, "image3");
  GLADE_HOOKUP_OBJECT (main_window, hbox5, "hbox5");
  GLADE_HOOKUP_OBJECT (main_window, belts_progress, "belts_progress");
  GLADE_HOOKUP_OBJECT (main_window, belts_usage, "belts_usage");
  GLADE_HOOKUP_OBJECT (main_window, ctrlButton_4, "ctrlButton_4");
  GLADE_HOOKUP_OBJECT (main_window, ctrlButton_5, "ctrlButton_5");
  GLADE_HOOKUP_OBJECT (main_window, ctrlButton_6, "ctrlButton_6");
  GLADE_HOOKUP_OBJECT (main_window, label5, "label5");
  GLADE_HOOKUP_OBJECT (main_window, label3, "label3");
  GLADE_HOOKUP_OBJECT (main_window, label8, "label8");
  GLADE_HOOKUP_OBJECT (main_window, image6, "image6");

  return main_window;
}
コード例 #10
0
PrintProjectDialog::PrintProjectDialog(int dummy)
{
  extern Settings *settings;

  Shortcuts shortcuts(0);

  printprojectdialog = gtk_dialog_new();
  gtk_window_set_title(GTK_WINDOW(printprojectdialog), _("Print project"));
  gtk_window_set_position(GTK_WINDOW(printprojectdialog), GTK_WIN_POS_CENTER_ON_PARENT);
  gtk_window_set_modal(GTK_WINDOW(printprojectdialog), TRUE);
  gtk_window_set_destroy_with_parent(GTK_WINDOW(printprojectdialog), TRUE);
  gtk_window_set_type_hint(GTK_WINDOW(printprojectdialog), GDK_WINDOW_TYPE_HINT_DIALOG);

  dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG(printprojectdialog));
  gtk_widget_show(dialog_vbox1);

  vbox1 = gtk_vbox_new(FALSE, 2);
  gtk_widget_show(vbox1);
  gtk_box_pack_start(GTK_BOX(dialog_vbox1), vbox1, TRUE, TRUE, 0);

  hbox1 = gtk_hbox_new(FALSE, 4);
  gtk_widget_show(hbox1);
  gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);

  label1 = gtk_label_new(_("Portion:"));
  gtk_widget_show(label1);
  gtk_box_pack_start(GTK_BOX(hbox1), label1, FALSE, FALSE, 0);

  label_portion = gtk_label_new("");
  gtk_widget_show(label_portion);
  gtk_box_pack_start(GTK_BOX(hbox1), label_portion, FALSE, FALSE, 0);

  button_portion = gtk_button_new();
  gtk_widget_show(button_portion);
  gtk_box_pack_start(GTK_BOX(hbox1), button_portion, FALSE, FALSE, 0);

  alignment1 = gtk_alignment_new(0.5, 0.5, 0, 0);
  gtk_widget_show(alignment1);
  gtk_container_add(GTK_CONTAINER(button_portion), alignment1);

  hbox2 = gtk_hbox_new(FALSE, 2);
  gtk_widget_show(hbox2);
  gtk_container_add(GTK_CONTAINER(alignment1), hbox2);

  image1 = gtk_image_new_from_stock("gtk-properties", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show(image1);
  gtk_box_pack_start(GTK_BOX(hbox2), image1, FALSE, FALSE, 0);

  label5 = gtk_label_new_with_mnemonic(_("Change"));
  gtk_widget_show(label5);
  gtk_box_pack_start(GTK_BOX(hbox2), label5, FALSE, FALSE, 0);

  shortcuts.label(label5);

  bool expand = false;
  if (settings->session.print_references_in_notes_in_full) {
    expand = true;
  }

  expander1 = gtk_expander_new(NULL);
  gtk_widget_show(expander1);
  gtk_box_pack_start(GTK_BOX(vbox1), expander1, TRUE, TRUE, 0);
  gtk_expander_set_expanded(GTK_EXPANDER(expander1), expand);

  vbox_expander = gtk_vbox_new(FALSE, 5);
  gtk_widget_show(vbox_expander);
  gtk_container_add(GTK_CONTAINER(expander1), vbox_expander);

  checkbutton_full_references = gtk_check_button_new_with_mnemonic(_("Write the references in the notes in full"));
  gtk_widget_show(checkbutton_full_references);
  gtk_box_pack_start(GTK_BOX(vbox_expander), checkbutton_full_references, FALSE, FALSE, 0);

  // TO DO: Add options for 1 column, double spaced here
  
  shortcuts.button(checkbutton_full_references);

  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_full_references), settings->session.print_references_in_notes_in_full);

  label_expander = gtk_label_new(_("Options"));
  gtk_widget_show(label_expander);
  gtk_expander_set_label_widget(GTK_EXPANDER(expander1), label_expander);

  shortcuts.label(label_expander);

  dialog_action_area1 = gtk_dialog_get_action_area (GTK_DIALOG(printprojectdialog));
  gtk_widget_show(dialog_action_area1);
  gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area1), GTK_BUTTONBOX_END);

  new InDialogHelp(printprojectdialog, NULL, &shortcuts, "file/print/project");

  cancelbutton1 = gtk_button_new_from_stock("gtk-cancel");
  gtk_widget_show(cancelbutton1);
  gtk_dialog_add_action_widget(GTK_DIALOG(printprojectdialog), cancelbutton1, GTK_RESPONSE_CANCEL);
  gtk_widget_set_can_default (GTK_WIDGET (cancelbutton1), true);

  okbutton1 = gtk_button_new_from_stock("gtk-ok");
  gtk_widget_show(okbutton1);
  gtk_dialog_add_action_widget(GTK_DIALOG(printprojectdialog), okbutton1, GTK_RESPONSE_OK);
  gtk_widget_set_can_default (GTK_WIDGET (okbutton1), true);

  shortcuts.stockbutton(cancelbutton1);
  shortcuts.stockbutton(okbutton1);
  shortcuts.process();

  g_signal_connect((gpointer) button_portion, "clicked", G_CALLBACK(on_button_portion_clicked), gpointer(this));
  g_signal_connect((gpointer) okbutton1, "clicked", G_CALLBACK(on_okbutton1_clicked), gpointer(this));

  gtk_widget_grab_focus(okbutton1);
  gtk_widget_grab_default(okbutton1);

  // Set gui.
  gui_reorder_include();
}
コード例 #11
0
ファイル: graph_fdfit.c プロジェクト: DavidMercier/gwyddion
static void
fit_dialog(FitArgs *args)
{
    GtkWidget *label, *dialog, *hbox, *hbox2, *table, *align, *expander, *scroll;
    GtkTable *table2;
    GwyGraphModel *gmodel;
    GwyGraphCurveModel *cmodel;
    GwyGraphArea *area;
    GwySelection *selection;
    GwySIUnit *siunit;
    FitControls controls;
    gint response, row;
    GString *report;
    gdouble xmin, xmax;

    controls.args = args;
    controls.in_update = TRUE;
    controls.param = g_array_new(FALSE, TRUE, sizeof(FitParamControl));

    gmodel = gwy_graph_get_model(GWY_GRAPH(args->parent_graph));
    gwy_graph_model_get_x_range(gmodel, &xmin, &xmax);
    g_object_get(gmodel, "si-unit-x", &siunit, NULL);
    args->abscissa_vf
        = gwy_si_unit_get_format_with_digits(siunit,
                                             GWY_SI_UNIT_FORMAT_VFMARKUP,
                                             MAX(fabs(xmin), fabs(xmax)), 4,
                                             NULL);
    g_object_unref(siunit);

    dialog = gtk_dialog_new_with_buttons(_("Fit FD Curve"), NULL, 0, NULL);
    controls.dialog = dialog;
    gtk_dialog_add_action_widget(GTK_DIALOG(dialog),
                                 gwy_stock_like_button_new(gwy_sgettext("verb|_Fit"),
                                                           GTK_STOCK_EXECUTE),
                                 RESPONSE_FIT);
    gtk_dialog_add_button(GTK_DIALOG(dialog),
                          gwy_sgettext("verb|_Estimate"), RESPONSE_ESTIMATE);
    gtk_dialog_add_button(GTK_DIALOG(dialog),
                          _("_Plot Inits"), RESPONSE_PLOT);
    gtk_dialog_add_button(GTK_DIALOG(dialog),
                          GTK_STOCK_SAVE, RESPONSE_SAVE);
    gtk_dialog_add_button(GTK_DIALOG(dialog),
                          GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
    gtk_dialog_add_button(GTK_DIALOG(dialog),
                          GTK_STOCK_OK, GTK_RESPONSE_OK);
    gwy_help_add_to_graph_dialog(GTK_DIALOG(dialog), GWY_HELP_DEFAULT);
    gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);

    hbox = gtk_hbox_new(FALSE, 2);
    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, TRUE, TRUE, 0);

    /* Graph */
    args->graph_model = gwy_graph_model_new_alike(gmodel);
    controls.graph = gwy_graph_new(args->graph_model);
    g_object_unref(args->graph_model);
    gtk_widget_set_size_request(controls.graph, 400, 300);

    gwy_graph_enable_user_input(GWY_GRAPH(controls.graph), FALSE);
    gtk_box_pack_start(GTK_BOX(hbox), controls.graph, TRUE, TRUE, 0);
    gwy_graph_set_status(GWY_GRAPH(controls.graph), GWY_GRAPH_STATUS_XSEL);

    area = GWY_GRAPH_AREA(gwy_graph_get_area(GWY_GRAPH(controls.graph)));
    selection = gwy_graph_area_get_selection(area, GWY_GRAPH_STATUS_XSEL);
    gwy_selection_set_max_objects(selection, 1);
    g_signal_connect(selection, "changed",
                     G_CALLBACK(graph_selected), &controls);

    gwy_graph_model_add_curve(controls.args->graph_model,
                              gwy_graph_model_get_curve(gmodel, args->curve));
    args->fitfunc = NULL;

    /* Controls */
    align = gtk_alignment_new(0.0, 0.0, 0.0, 0.0);
    gtk_box_pack_start(GTK_BOX(hbox), align, FALSE, FALSE, 0);
    g_signal_connect(align, "size-request", G_CALLBACK(grow_width), NULL);

    table = gtk_table_new(7, 2, FALSE);
    gtk_table_set_row_spacings(GTK_TABLE(table), 2);
    gtk_table_set_col_spacings(GTK_TABLE(table), 6);
    gtk_box_pack_start(GTK_BOX(hbox), table, FALSE, FALSE, 0);
    gtk_container_set_border_width(GTK_CONTAINER(table), 4);
    row = 0;

    /* Curve to fit */
    label = gtk_label_new_with_mnemonic(_("_Graph curve:"));
    gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
    gtk_table_attach(GTK_TABLE(table), label,
                     0, 1, row, row+1, GTK_FILL, 0, 0, 0);

    controls.curve = curve_selector_new(gmodel,
                                        G_CALLBACK(curve_changed), &controls,
                                        args->curve);
    gtk_label_set_mnemonic_widget(GTK_LABEL(label), controls.curve);
    gtk_table_attach(GTK_TABLE(table), controls.curve,
                     1, 2, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
    row++;

    /* Fitted function */
    label = gtk_label_new_with_mnemonic(_("F_unction:"));
    gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
    gtk_table_attach(GTK_TABLE(table), label,
                     0, 1, row, row+1, GTK_FILL, 0, 0, 0);

    controls.function = function_selector_new(G_CALLBACK(function_changed),
                                              &controls, args->function_type);
    gtk_label_set_mnemonic_widget(GTK_LABEL(label), controls.function);
    
    gtk_table_attach(GTK_TABLE(table), controls.function,
                     1, 2, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
    row++;

    controls.formula = gtk_label_new("f(x) =");
    gtk_misc_set_alignment(GTK_MISC(controls.formula), 0.0, 0.5);
    gtk_label_set_selectable(GTK_LABEL(controls.formula), TRUE);
    
    scroll = gtk_scrolled_window_new(NULL, NULL);
    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), controls.formula);
    
    gtk_table_attach(GTK_TABLE(table), scroll,
                     0, 2, row, row+1, GTK_FILL, 0, 0, 8);
    row++;

    /* Parameters sought */
    controls.param_table = gtk_table_new(1, 10, FALSE);
    table2 = GTK_TABLE(controls.param_table);
    gtk_table_set_row_spacing(table2, 0, 2);
    gtk_table_set_col_spacings(table2, 2);
    gtk_table_set_col_spacing(table2, 0, 6);
    gtk_table_set_col_spacing(table2, 4, 6);
    gtk_table_set_col_spacing(table2, 5, 6);
    gtk_table_set_col_spacing(table2, 7, 6);
    gtk_table_set_col_spacing(table2, 8, 6);
    gtk_table_attach(GTK_TABLE(table), GTK_WIDGET(table2),
                     0, 2, row, row+1, GTK_FILL, 0, 0, 0);
    gtk_table_set_row_spacing(GTK_TABLE(table), row, 8);
    row++;

    gtk_table_attach(table2, gwy_label_new_header(_("Fix")),
                     0, 1, 0, 1, GTK_FILL, 0, 0, 0);
    gtk_table_attach(table2, gwy_label_new_header(_("Parameter")),
                     1, 5, 0, 1, GTK_FILL, 0, 0, 0);
    gtk_table_attach(table2, gwy_label_new_header(_("Error")),
                     6, 8, 0, 1, GTK_FILL, 0, 0, 0);
    gtk_table_attach(table2, gwy_label_new_header(_("Initial")),
                     9, 10, 0, 1, GTK_FILL, 0, 0, 0);

    /* Make space for 4 parameters */
#if 0
    for (i = 0; i < 4; i++)
        fit_param_row_create(&controls, i, table2, i+1);
#endif

    /* Chi^2 */
    label = gtk_label_new(NULL);
    gtk_label_set_markup(GTK_LABEL(label), _("χ<sup>2</sup> result:"));
    gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
    gtk_table_attach(GTK_TABLE(table), label,
                     0, 1, row, row+1, GTK_FILL, 0, 0, 0);

    controls.chisq = gtk_label_new(NULL);
    gtk_misc_set_alignment(GTK_MISC(controls.chisq), 0.0, 0.5);
    gtk_table_attach(GTK_TABLE(table), controls.chisq,
                     1, 2, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0);

    gtk_table_set_row_spacing(GTK_TABLE(table), row, 8);
    row++;

    /* Correlation matrix */
    expander = gtk_expander_new(NULL);
    gtk_expander_set_label_widget(GTK_EXPANDER(expander),
                                 gwy_label_new_header(_("Correlation Matrix")));
    gtk_table_attach(GTK_TABLE(table), expander,
                     0, 2, row, row+1, GTK_FILL, 0, 0, 0);
    gtk_table_set_row_spacing(GTK_TABLE(table), row, 8);
    row++;

    align = gtk_alignment_new(0.0, 0.5, 0.0, 0.0);
    gtk_container_add(GTK_CONTAINER(expander), align);
    row++;

    controls.covar = g_array_new(FALSE, TRUE, sizeof(GtkWidget*));
    controls.covar_table = gtk_table_new(1, 1, TRUE);
    table2 = GTK_TABLE(controls.covar_table);
    gtk_table_set_col_spacings(table2, 6);
    gtk_table_set_row_spacings(table2, 2);
    gtk_container_add(GTK_CONTAINER(align), GTK_WIDGET(table2));

    /* Fit area */
    hbox2 = gtk_hbox_new(FALSE, 6);
    gtk_table_attach(GTK_TABLE(table), hbox2,
                     0, 2, row, row+1, GTK_FILL, 0, 0, 0);
    row++;

    label = gtk_label_new(_("Range:"));
    gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);

    controls.from = gtk_entry_new();
    g_object_set_data(G_OBJECT(controls.from), "id", (gpointer)"from");
    gtk_entry_set_width_chars(GTK_ENTRY(controls.from), 8);
    gtk_box_pack_start(GTK_BOX(hbox2), controls.from, FALSE, FALSE, 0);
    g_signal_connect(controls.from, "activate",
                     G_CALLBACK(range_changed), &controls);
    gwy_widget_set_activate_on_unfocus(controls.from, TRUE);

    label = gtk_label_new(gwy_sgettext("range|to"));
    gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);

    controls.to = gtk_entry_new();
    g_object_set_data(G_OBJECT(controls.to), "id", (gpointer)"to");
    gtk_entry_set_width_chars(GTK_ENTRY(controls.to), 8);
    gtk_box_pack_start(GTK_BOX(hbox2), controls.to, FALSE, FALSE, 0);
    g_signal_connect(controls.to, "activate",
                     G_CALLBACK(range_changed), &controls);
    gwy_widget_set_activate_on_unfocus(controls.to, TRUE);

    label = gtk_label_new(NULL);
    gtk_label_set_markup(GTK_LABEL(label), args->abscissa_vf->units);
    gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);

    /* Auto-update */
    hbox2 = gtk_hbox_new(FALSE, 6);
    gtk_table_attach(GTK_TABLE(table), hbox2,
                     0, 2, row, row+1, GTK_FILL, 0, 0, 0);
    row++;

    label = gtk_label_new(_("Instant:"));
    gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);

    controls.auto_estimate = gtk_check_button_new_with_mnemonic(_("e_stimate"));
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(controls.auto_estimate),
                                 args->auto_estimate);
    gtk_box_pack_start(GTK_BOX(hbox2), controls.auto_estimate, FALSE, FALSE, 0);
    g_signal_connect(controls.auto_estimate, "toggled",
                     G_CALLBACK(auto_estimate_changed), &controls);

    controls.auto_plot = gtk_check_button_new_with_mnemonic(_("p_lot"));
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(controls.auto_plot),
                                 args->auto_plot);
    gtk_box_pack_start(GTK_BOX(hbox2), controls.auto_plot, FALSE, FALSE, 0);
    g_signal_connect(controls.auto_plot, "toggled",
                     G_CALLBACK(auto_plot_changed), &controls);

    function_changed(GTK_COMBO_BOX(controls.function), &controls);
    graph_selected(selection, -1, &controls);

    controls.in_update = FALSE;
    gtk_widget_show_all(dialog);

    do {
        response = gtk_dialog_run(GTK_DIALOG(dialog));
        fit_fetch_entry(&controls);
        switch (response) {
            case GTK_RESPONSE_CANCEL:
            case GTK_RESPONSE_DELETE_EVENT:
            gtk_widget_destroy(dialog);
            fit_controls_free(&controls);
            return;
            break;

            case GTK_RESPONSE_OK:
            if (args->is_estimated) {
                cmodel = gwy_graph_model_get_curve(args->graph_model, 1);
                gwy_graph_model_add_curve(gmodel, cmodel);
            }
            gtk_widget_destroy(dialog);
            break;

            case RESPONSE_SAVE:
            report = create_fit_report(args);
            gwy_save_auxiliary_data(_("Save Fit Report"), GTK_WINDOW(dialog),
                                    -1, report->str);
            g_string_free(report, TRUE);
            break;

            case RESPONSE_ESTIMATE:
            fit_estimate(&controls);
            break;

            case RESPONSE_PLOT:
            fit_set_state(&controls, FALSE, TRUE);
            fit_plot_curve(args);
            break;

            case RESPONSE_FIT:
            fit_do(&controls);
            break;

            default:
            g_assert_not_reached();
            break;
        }
    } while (response != GTK_RESPONSE_OK);
    fit_controls_free(&controls);
}
コード例 #12
0
/**
 * \brief  Creates new instance of item properties widget
 *
 */
GtkWidget *
sp_item_widget_new (void)
{

    GtkWidget *spw, *vb, *t, *cb, *l, *f, *tf, *pb, *int_expander, *int_label;
    GtkTextBuffer *desc_buffer;

    GtkTooltips *tt = gtk_tooltips_new();

    /* Create container widget */
    spw = sp_widget_new_global (INKSCAPE);
    gtk_signal_connect ( GTK_OBJECT (spw), "modify_selection",
                         GTK_SIGNAL_FUNC (sp_item_widget_modify_selection),
                         spw );
    gtk_signal_connect ( GTK_OBJECT (spw), "change_selection",
                         GTK_SIGNAL_FUNC (sp_item_widget_change_selection),
                         spw );

    vb = gtk_vbox_new (FALSE, 0);
    gtk_container_add (GTK_CONTAINER (spw), vb);

    t = gtk_table_new (3, 4, FALSE);
    gtk_container_set_border_width(GTK_CONTAINER(t), 4);
    gtk_table_set_row_spacings (GTK_TABLE (t), 4);
    gtk_table_set_col_spacings (GTK_TABLE (t), 4);
    gtk_box_pack_start (GTK_BOX (vb), t, TRUE, TRUE, 0);


    /* Create the label for the object id */
    l = gtk_label_new_with_mnemonic (_("_Id"));
    gtk_misc_set_alignment (GTK_MISC (l), 1, 0.5);
    gtk_table_attach ( GTK_TABLE (t), l, 0, 1, 0, 1,
                       (GtkAttachOptions)( GTK_SHRINK | GTK_FILL ),
                       (GtkAttachOptions)0, 0, 0 );
    gtk_object_set_data (GTK_OBJECT (spw), "id_label", l);

    /* Create the entry box for the object id */
    tf = gtk_entry_new ();
    gtk_tooltips_set_tip (tt, tf, _("The id= attribute (only letters, digits, and the characters .-_: allowed)"), NULL);
    gtk_entry_set_max_length (GTK_ENTRY (tf), 64);
    gtk_table_attach ( GTK_TABLE (t), tf, 1, 2, 0, 1,
                       (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                       (GtkAttachOptions)0, 0, 0 );
    gtk_object_set_data (GTK_OBJECT (spw), "id", tf);
    gtk_label_set_mnemonic_widget (GTK_LABEL(l), tf);

    // pressing enter in the id field is the same as clicking Set:
    g_signal_connect ( G_OBJECT (tf), "activate", G_CALLBACK (sp_item_widget_label_changed), spw);
    // focus is in the id field initially:
    gtk_widget_grab_focus (GTK_WIDGET (tf));

    /* Button for setting the object's id, label, title and description. */
    pb = gtk_button_new_with_mnemonic (_("_Set"));
    gtk_table_attach ( GTK_TABLE (t), pb, 2, 3, 0, 1,
                       (GtkAttachOptions)( GTK_SHRINK | GTK_FILL ),
                       (GtkAttachOptions)0, 0, 0 );
    gtk_signal_connect ( GTK_OBJECT (pb), "clicked",
                         GTK_SIGNAL_FUNC (sp_item_widget_label_changed),
                         spw );

    /* Create the label for the object label */
    l = gtk_label_new_with_mnemonic (_("_Label"));
    gtk_misc_set_alignment (GTK_MISC (l), 1, 0.5);
    gtk_table_attach ( GTK_TABLE (t), l, 0, 1, 1, 2,
                       (GtkAttachOptions)( GTK_SHRINK | GTK_FILL ),
                       (GtkAttachOptions)0, 0, 0 );
    gtk_object_set_data (GTK_OBJECT (spw), "label_label", l);

    /* Create the entry box for the object label */
    tf = gtk_entry_new ();
    gtk_tooltips_set_tip (tt, tf, _("A freeform label for the object"), NULL);
    gtk_entry_set_max_length (GTK_ENTRY (tf), 256);
    gtk_table_attach ( GTK_TABLE (t), tf, 1, 2, 1, 2,
                       (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                       (GtkAttachOptions)0, 0, 0 );
    gtk_object_set_data (GTK_OBJECT (spw), "label", tf);
    gtk_label_set_mnemonic_widget (GTK_LABEL(l), tf);

    // pressing enter in the label field is the same as clicking Set:
    g_signal_connect ( G_OBJECT (tf), "activate", G_CALLBACK (sp_item_widget_label_changed), spw);

    /* Create the label for the object title */
    l = gtk_label_new_with_mnemonic (_("_Title"));
    gtk_misc_set_alignment (GTK_MISC (l), 1, 0.5);
    gtk_table_attach ( GTK_TABLE (t), l, 0, 1, 2, 3,
                       (GtkAttachOptions)( GTK_SHRINK | GTK_FILL ),
                       (GtkAttachOptions)0, 0, 0 );
    gtk_object_set_data (GTK_OBJECT (spw), "title_label", l);

    /* Create the entry box for the object title */
    tf = gtk_entry_new ();
    gtk_widget_set_sensitive (GTK_WIDGET (tf), FALSE);
    gtk_entry_set_max_length (GTK_ENTRY (tf), 256);
    gtk_table_attach ( GTK_TABLE (t), tf, 1, 3, 2, 3,
                       (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                       (GtkAttachOptions)0, 0, 0 );
    gtk_object_set_data (GTK_OBJECT (spw), "title", tf);
    gtk_label_set_mnemonic_widget (GTK_LABEL(l), tf);

    /* Create the frame for the object description */
    l = gtk_label_new_with_mnemonic (_("_Description"));
    f = gtk_frame_new (NULL);
    gtk_frame_set_label_widget (GTK_FRAME (f),l);
    gtk_table_attach ( GTK_TABLE (t), f, 0, 3, 3, 4,
                       (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                       (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), 0, 0 );

    /* Create the text view box for the object description */
    GtkWidget *textframe = gtk_frame_new(NULL);
    gtk_container_set_border_width(GTK_CONTAINER(textframe), 4);
    gtk_widget_set_sensitive (GTK_WIDGET (textframe), FALSE);
    gtk_container_add (GTK_CONTAINER (f), textframe);
    gtk_frame_set_shadow_type (GTK_FRAME (textframe), GTK_SHADOW_IN);
    gtk_object_set_data(GTK_OBJECT(spw), "desc_frame", textframe);

    tf = gtk_text_view_new();
    gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(tf), GTK_WRAP_WORD);
    desc_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tf));
    gtk_text_buffer_set_text(desc_buffer, "", -1);
    gtk_container_add (GTK_CONTAINER (textframe), tf);
    gtk_object_set_data (GTK_OBJECT (spw), "desc", tf);
    gtk_label_set_mnemonic_widget (GTK_LABEL (gtk_frame_get_label_widget (GTK_FRAME (f))), tf);

    /* Check boxes */
    GtkWidget *hb_cb = gtk_hbox_new (FALSE, 0);
    gtk_box_pack_start (GTK_BOX (vb), hb_cb, FALSE, FALSE, 0);
    t = gtk_table_new (1, 2, TRUE);
    gtk_container_set_border_width(GTK_CONTAINER(t), 0);
    gtk_box_pack_start (GTK_BOX (hb_cb), t, TRUE, TRUE, 10);

    /* Hide */
    cb = gtk_check_button_new_with_mnemonic (_("_Hide"));
    gtk_tooltips_set_tip (tt, cb, _("Check to make the object invisible"), NULL);
    gtk_table_attach ( GTK_TABLE (t), cb, 0, 1, 0, 1,
                       (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                       (GtkAttachOptions)0, 0, 0 );
    g_signal_connect (G_OBJECT(cb), "toggled", G_CALLBACK(sp_item_widget_hidden_toggled), spw);
    gtk_object_set_data(GTK_OBJECT(spw), "hidden", cb);

    /* Lock */
    // TRANSLATORS: "Lock" is a verb here
    cb = gtk_check_button_new_with_mnemonic (_("L_ock"));
    gtk_tooltips_set_tip (tt, cb, _("Check to make the object insensitive (not selectable by mouse)"), NULL);
    gtk_table_attach ( GTK_TABLE (t), cb, 1, 2, 0, 1,
                       (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                       (GtkAttachOptions)0, 0, 0 );
    gtk_signal_connect ( GTK_OBJECT (cb), "toggled",
                         GTK_SIGNAL_FUNC (sp_item_widget_sensitivity_toggled),
                         spw );
    gtk_object_set_data (GTK_OBJECT (spw), "sensitive", cb);

    /* Create the frame for interactivity options */
    int_label = gtk_label_new_with_mnemonic (_("_Interactivity"));
    int_expander = gtk_expander_new (NULL);
    gtk_expander_set_label_widget (GTK_EXPANDER (int_expander),int_label);
    gtk_object_set_data (GTK_OBJECT (spw), "interactivity", int_expander);

    gtk_box_pack_start (GTK_BOX (vb), int_expander, FALSE, FALSE, 0);

    gtk_widget_show_all (spw);

    sp_item_widget_setup (SP_WIDGET (spw), sp_desktop_selection (SP_ACTIVE_DESKTOP));

    return (GtkWidget *) spw;

} //end of sp_item_widget_new()
コード例 #13
0
NewStylesheetDialog::NewStylesheetDialog(const ustring & worksheet, GtkWindow *transient_parent)
{
  myworksheet = worksheet;

  Shortcuts shortcuts(0);

  newstylesheetdialog = gtk_dialog_new();
  gtk_window_set_transient_for(GTK_WINDOW(newstylesheetdialog), transient_parent);
  if (!worksheet.empty()) {
    gtk_window_set_title(GTK_WINDOW(newstylesheetdialog), _("New style"));
  }
  else {
    gtk_window_set_title(GTK_WINDOW(newstylesheetdialog), _("New stylesheet"));
  }
  //gtk_window_set_position(GTK_WINDOW(newstylesheetdialog), GTK_WIN_POS_CENTER_ON_PARENT);

  dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG (newstylesheetdialog));
  gtk_widget_show(dialog_vbox1);

  hbox2 = gtk_hbox_new(FALSE, 4);
  gtk_widget_show(hbox2);
  gtk_box_pack_start(GTK_BOX(dialog_vbox1), hbox2, TRUE, TRUE, 0);

  vbox1 = gtk_vbox_new(FALSE, 4);
  gtk_widget_show(vbox1);
  gtk_box_pack_start(GTK_BOX(hbox2), vbox1, TRUE, TRUE, 0);

  if (myworksheet.empty()) {
    hbox1 = gtk_hbox_new(FALSE, 4);
    gtk_widget_show(hbox1);
    gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);

    label1 = gtk_label_new(_("Name"));
    gtk_widget_show(label1);
    gtk_box_pack_start(GTK_BOX(hbox1), label1, FALSE, FALSE, 0);

    shortcuts.label(label1);

    entry1 = gtk_entry_new();
    gtk_widget_show(entry1);
    gtk_box_pack_start(GTK_BOX(hbox1), entry1, TRUE, TRUE, 0);
  }

  ustring info;
  if (!myworksheet.empty())
    info = _("Select one or more styles from the list");
  label_info = gtk_label_new(info.c_str());
  gtk_widget_show(label_info);
  gtk_box_pack_start(GTK_BOX(vbox1), label_info, FALSE, FALSE, 0);
  gtk_misc_set_alignment(GTK_MISC(label_info), 0, 0.5);

  GSList *radiobutton_basic_group = NULL;

  radiobutton_basic = gtk_radio_button_new_with_mnemonic(NULL, _("Basic"));
  gtk_widget_show(radiobutton_basic);
  gtk_box_pack_start(GTK_BOX(vbox1), radiobutton_basic, FALSE, FALSE, 0);
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_basic), radiobutton_basic_group);
  radiobutton_basic_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_basic));

  shortcuts.button(radiobutton_basic);

  radiobutton_paragraph = gtk_radio_button_new_with_mnemonic(NULL, _("Basic, paragraph"));
  gtk_widget_show(radiobutton_paragraph);
  gtk_box_pack_start(GTK_BOX(vbox1), radiobutton_paragraph, FALSE, FALSE, 0);
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_paragraph), radiobutton_basic_group);
  radiobutton_basic_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_paragraph));

  shortcuts.button(radiobutton_paragraph);

  radiobutton_word_note = gtk_radio_button_new_with_mnemonic(NULL, _("Basic, paragraph, word, note"));
  gtk_widget_show(radiobutton_word_note);
  gtk_box_pack_start(GTK_BOX(vbox1), radiobutton_word_note, FALSE, FALSE, 0);
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_word_note), radiobutton_basic_group);
  radiobutton_basic_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_word_note));

  shortcuts.button(radiobutton_word_note);

  radiobutton_sbp = gtk_radio_button_new_with_mnemonic(NULL, _("SIL best practice"));
  gtk_widget_show(radiobutton_sbp);
  gtk_box_pack_start(GTK_BOX(vbox1), radiobutton_sbp, FALSE, FALSE, 0);
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_sbp), radiobutton_basic_group);
  radiobutton_basic_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_sbp));

  shortcuts.button(radiobutton_sbp);

  radiobutton_full = gtk_radio_button_new_with_mnemonic(NULL, _("Full"));
  gtk_widget_show(radiobutton_full);
  gtk_box_pack_start(GTK_BOX(vbox1), radiobutton_full, FALSE, FALSE, 0);
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_full), radiobutton_basic_group);
  radiobutton_basic_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_full));

  shortcuts.button(radiobutton_full);

  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radiobutton_full), true);

  if (!myworksheet.empty()) {
    expander1 = gtk_expander_new(NULL);
    gtk_widget_show(expander1);
    gtk_box_pack_start(GTK_BOX(vbox1), expander1, TRUE, TRUE, 0);

    label2 = gtk_label_new(_("Add non-standard style"));
    gtk_widget_show(label2);
    gtk_expander_set_label_widget(GTK_EXPANDER(expander1), label2);

    shortcuts.label(label2);

    hbox1 = gtk_hbox_new(FALSE, 4);
    gtk_widget_show(hbox1);
    gtk_container_add(GTK_CONTAINER(expander1), hbox1);

    label1 = gtk_label_new(_("Name"));
    gtk_widget_show(label1);
    gtk_box_pack_start(GTK_BOX(hbox1), label1, FALSE, FALSE, 0);

    shortcuts.label(label1);

    entry1 = gtk_entry_new();
    gtk_widget_show(entry1);
    gtk_box_pack_start(GTK_BOX(hbox1), entry1, TRUE, TRUE, 0);

    scrolledwindow1 = gtk_scrolled_window_new(NULL, NULL);
    gtk_widget_show(scrolledwindow1);
    gtk_box_pack_start(GTK_BOX(hbox2), scrolledwindow1, TRUE, TRUE, 0);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
    gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow1), GTK_SHADOW_IN);

    treeview1 = gtk_tree_view_new();
    gtk_widget_show(treeview1);
    gtk_container_add(GTK_CONTAINER(scrolledwindow1), treeview1);
    gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview1), FALSE);

    store1 = gtk_list_store_new(1, G_TYPE_STRING);
    gtk_tree_view_set_model(GTK_TREE_VIEW(treeview1), GTK_TREE_MODEL(store1));
    g_object_unref(store1);
    GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
    column1 = gtk_tree_view_column_new_with_attributes("", renderer, "text", 0, NULL);
    gtk_tree_view_append_column(GTK_TREE_VIEW(treeview1), column1);
    select1 = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview1));
    gtk_tree_selection_set_mode(select1, GTK_SELECTION_SINGLE);
  }

  dialog_action_area1 = gtk_dialog_get_action_area (GTK_DIALOG(newstylesheetdialog));
  gtk_widget_show(dialog_action_area1);
  gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area1), GTK_BUTTONBOX_END);

  new InDialogHelp(newstylesheetdialog, NULL, &shortcuts, "file/styles/stylesheet/new");

  cancelbutton1 = gtk_button_new_from_stock("gtk-cancel");
  gtk_widget_show(cancelbutton1);
  gtk_dialog_add_action_widget(GTK_DIALOG(newstylesheetdialog), cancelbutton1, GTK_RESPONSE_CANCEL);
  gtk_widget_set_can_default (GTK_WIDGET (cancelbutton1), true);

  okbutton = gtk_button_new_from_stock("gtk-ok");
  gtk_widget_show(okbutton);
  gtk_dialog_add_action_widget(GTK_DIALOG(newstylesheetdialog), okbutton, GTK_RESPONSE_OK);
  gtk_widget_set_can_default (GTK_WIDGET (okbutton), true);

  shortcuts.stockbutton(cancelbutton1);
  shortcuts.stockbutton(okbutton);
  shortcuts.process();

  g_signal_connect((gpointer) entry1, "changed", G_CALLBACK(on_entry_changed), gpointer(this));
  g_signal_connect((gpointer) radiobutton_basic, "toggled", G_CALLBACK(on_radiobutton_basic_toggled), gpointer(this));
  g_signal_connect((gpointer) radiobutton_paragraph, "toggled", G_CALLBACK(on_radiobutton_paragraph_toggled), gpointer(this));
  g_signal_connect((gpointer) radiobutton_word_note, "toggled", G_CALLBACK(on_radiobutton_word_note_toggled), gpointer(this));
  g_signal_connect((gpointer) radiobutton_sbp, "toggled", G_CALLBACK(on_radiobutton_sbp_toggled), gpointer(this));
  g_signal_connect((gpointer) radiobutton_full, "toggled", G_CALLBACK(on_radiobutton_full_toggled), gpointer(this));
  g_signal_connect((gpointer) okbutton, "clicked", G_CALLBACK(on_okbutton_clicked), gpointer(this));

  gtk_widget_grab_focus(entry1);
  gtk_widget_grab_default(okbutton);

  gtk_label_set_mnemonic_widget(GTK_LABEL(label1), entry1);

  on_entry();
  on_radiobutton();
}
コード例 #14
0
ファイル: engine_oracle.c プロジェクト: antono/gsql
GtkWidget *
engine_logon_widget_create ()
{
	GSQL_TRACE_FUNC;

	GtkWidget *table;
	GtkWidget *database_name;
	GtkWidget *database_name_entry;
	GtkWidget *username;
	GtkWidget *password;
	GtkWidget *label;
	GtkWidget *options_vbox;
	GtkWidget *expander;
	GtkWidget *oracle_option_hbox;
	GtkWidget *connect_as;
	GtkListStore *aliases;
	GtkEntryCompletion *compl;

	table = gtk_table_new (5, 2, FALSE);
	gtk_table_set_row_spacings (GTK_TABLE (table), 2);
	gtk_widget_show (table);
	
	aliases = engine_oracle_get_tns_aliases ();
	
	compl = gtk_entry_completion_new ();
	gtk_entry_completion_set_model (compl, GTK_TREE_MODEL (aliases));
	gtk_entry_completion_set_text_column (compl, 0);
	
	gtk_entry_completion_set_popup_completion (compl, FALSE);
	gtk_entry_completion_set_inline_completion (compl, TRUE);
        
	database_name = gtk_combo_box_entry_new_with_model (GTK_TREE_MODEL (aliases), 0);

	gtk_widget_show (database_name);
	gtk_table_attach (GTK_TABLE (table), database_name, 1, 2, 1, 2,
						(GtkAttachOptions) (GTK_FILL),
						(GtkAttachOptions) (GTK_FILL), 0, 0);
	database_name_entry = gtk_bin_get_child(GTK_BIN(database_name));
	gtk_entry_set_activates_default(GTK_ENTRY (database_name_entry), TRUE);
	gtk_entry_set_completion (GTK_ENTRY (database_name_entry), compl);
        
	label = gtk_label_new (_("Database name"));
	gtk_widget_show (label);
		
	gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
						(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
						(GtkAttachOptions) (0), 0, 0);
	gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
	gtk_misc_set_padding (GTK_MISC (label), 14, 0);
       
	username = gtk_entry_new ();
	gtk_widget_show (username);
	gtk_table_attach (GTK_TABLE (table), username, 1, 2, 2, 3,
						(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
						(GtkAttachOptions) (0), 0, 0);
	gtk_entry_set_max_length (GTK_ENTRY (username), 32);
	gtk_entry_set_invisible_char (GTK_ENTRY (username), 9679);
	gtk_entry_set_activates_default(GTK_ENTRY (username), TRUE);
        
	label = gtk_label_new (_("Username"));
	gtk_widget_show (label);
	gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
						(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
						(GtkAttachOptions) (0), 0, 0);
	gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
	gtk_misc_set_padding (GTK_MISC (label), 14, 0);
        
	password = gtk_entry_new ();
	gtk_widget_show (password);
	gtk_table_attach (GTK_TABLE (table), password, 1, 2, 3, 4,
						(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
						(GtkAttachOptions) (0), 0, 0);
	gtk_entry_set_max_length (GTK_ENTRY (password), 32);
	gtk_entry_set_visibility (GTK_ENTRY (password), FALSE);
	gtk_entry_set_invisible_char (GTK_ENTRY (password), 9679);
	gtk_entry_set_activates_default(GTK_ENTRY (password), TRUE);
        
	label = gtk_label_new (_("Password"));
	gtk_widget_show (label);
	gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
						(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
						(GtkAttachOptions) (0), 0, 0);
	gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
	gtk_misc_set_padding (GTK_MISC (label), 14, 0);
        
	expander = gtk_expander_new (NULL);
	gtk_widget_show (expander);        
	gtk_table_attach (GTK_TABLE (table), expander, 0, 2, 4, 5,
						(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
						(GtkAttachOptions) (0), 0, 0);
        
	options_vbox = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (options_vbox);
	gtk_container_add (GTK_CONTAINER (expander), options_vbox);
        
	oracle_option_hbox = gtk_hbox_new (FALSE, 0);
	gtk_widget_show (oracle_option_hbox);
	gtk_box_pack_start (GTK_BOX (options_vbox), oracle_option_hbox, TRUE, TRUE, 0);
        
	label = gtk_label_new (_("Connect as "));
	gtk_widget_show (label);
	gtk_box_pack_start (GTK_BOX (oracle_option_hbox), label, FALSE, FALSE, 0);
	gtk_misc_set_padding (GTK_MISC (label), 14, 0);
        
	connect_as = gtk_combo_box_new_text ();
	gtk_widget_show (connect_as);
	gtk_box_pack_start (GTK_BOX (oracle_option_hbox), connect_as, TRUE, TRUE, 0);
	GTK_WIDGET_SET_FLAGS (connect_as, GTK_CAN_DEFAULT);
	gtk_combo_box_append_text (GTK_COMBO_BOX (connect_as), "Normal");
	gtk_combo_box_append_text (GTK_COMBO_BOX (connect_as), "SYSDBA");
	gtk_combo_box_append_text (GTK_COMBO_BOX (connect_as), "SYSOPER");
	gtk_combo_box_set_active (GTK_COMBO_BOX (connect_as), 0); 
        
	label = gtk_label_new (_("Options"));
	gtk_widget_show (label);
	gtk_expander_set_label_widget (GTK_EXPANDER (expander), label);        
        
	HOOKUP_OBJECT (table, database_name, "database");  
	HOOKUP_OBJECT (table, username, "username");  
	HOOKUP_OBJECT (table, password, "password");  
	HOOKUP_OBJECT (table, connect_as, "mode");        

	return table;	
}