Exemplo n.º 1
0
GtkWidget*
create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox1;
  GtkWidget *hbox1;
  GtkWidget *frame1;
  GtkWidget *table2;
  GtkWidget *label4;
  GtkWidget *label5;
  GtkWidget *hscaleBrightness;
  GtkWidget *hscaleSaturation;
  GtkWidget *hscaleContrast;
  GtkWidget *label3;
  GtkWidget *label1;
  GtkWidget *frame2;
  GtkWidget *table3;
  GtkWidget *label6;
  GtkWidget *hscaleGamma;
  GtkWidget *hscaleGammaR;
  GtkWidget *label8;
  GtkWidget *hscaleGammaG;
  GtkWidget *label9;
  GtkWidget *label10;
  GtkWidget *label7;
  GtkWidget *hscaleGammaB;
  GtkWidget *hscaleGammaWeight;
  GtkWidget *label2;
  GtkWidget *hscale1;
  GtkWidget *drawingarea1;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;

  dialog1 = gtk_dialog_new ();
  gtk_container_set_border_width (GTK_CONTAINER (dialog1), 6);
  gtk_window_set_title (GTK_WINDOW (dialog1), QT_TR_NOOP("MPlayer eq2"));
  gtk_window_set_resizable (GTK_WINDOW (dialog1), FALSE);

  dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
  gtk_widget_show (dialog_vbox1);

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

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

  frame1 = gtk_frame_new (NULL);
  gtk_widget_show (frame1);
  gtk_box_pack_start (GTK_BOX (hbox1), frame1, TRUE, TRUE, 0);
  gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_NONE);

  table2 = gtk_table_new (3, 2, FALSE);
  gtk_widget_show (table2);
  gtk_container_add (GTK_CONTAINER (frame1), table2);
  gtk_container_set_border_width (GTK_CONTAINER (table2), 12);
  gtk_table_set_row_spacings (GTK_TABLE (table2), 6);
  gtk_table_set_col_spacings (GTK_TABLE (table2), 12);

  label4 = gtk_label_new_with_mnemonic (QT_TR_NOOP("Brigh_tness:"));
  gtk_widget_show (label4);
  gtk_table_attach (GTK_TABLE (table2), label4, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);

  label5 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Saturation:"));
  gtk_widget_show (label5);
  gtk_table_attach (GTK_TABLE (table2), label5, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5);

  hscaleBrightness = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, -1, 1, 0.05, 1, 0)));
  gtk_widget_show (hscaleBrightness);
  gtk_table_attach (GTK_TABLE (table2), hscaleBrightness, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_widget_set_size_request (hscaleBrightness, 144, 0);
  gtk_scale_set_value_pos (GTK_SCALE (hscaleBrightness), GTK_POS_RIGHT);
  gtk_scale_set_digits (GTK_SCALE (hscaleBrightness), 2);

  hscaleSaturation = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0, 3, 0.05, 1, 0)));
  gtk_widget_show (hscaleSaturation);
  gtk_table_attach (GTK_TABLE (table2), hscaleSaturation, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_widget_set_size_request (hscaleSaturation, 144, 0);
  gtk_scale_set_value_pos (GTK_SCALE (hscaleSaturation), GTK_POS_RIGHT);
  gtk_scale_set_digits (GTK_SCALE (hscaleSaturation), 2);

  hscaleContrast = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, -2, 2, 0.05, 1, 0)));
  gtk_widget_show (hscaleContrast);
  gtk_table_attach (GTK_TABLE (table2), hscaleContrast, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_widget_set_size_request (hscaleContrast, 144, 0);
  gtk_scale_set_value_pos (GTK_SCALE (hscaleContrast), GTK_POS_RIGHT);
  gtk_scale_set_digits (GTK_SCALE (hscaleContrast), 2);

  label3 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Contrast:"));
  gtk_widget_show (label3);
  gtk_table_attach (GTK_TABLE (table2), label3, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5);

  label1 = gtk_label_new ("");
  gtk_widget_show (label1);
  gtk_frame_set_label_widget (GTK_FRAME (frame1), label1);
  gtk_label_set_use_markup (GTK_LABEL (label1), TRUE);
  gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);

  frame2 = gtk_frame_new (NULL);
  gtk_widget_show (frame2);
  gtk_box_pack_start (GTK_BOX (hbox1), frame2, TRUE, TRUE, 0);
  gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_NONE);

  table3 = gtk_table_new (5, 2, FALSE);
  gtk_widget_show (table3);
  gtk_container_add (GTK_CONTAINER (frame2), table3);
  gtk_container_set_border_width (GTK_CONTAINER (table3), 12);
  gtk_table_set_row_spacings (GTK_TABLE (table3), 6);
  gtk_table_set_col_spacings (GTK_TABLE (table3), 12);

  label6 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Initial:"));
  gtk_widget_show (label6);
  gtk_table_attach (GTK_TABLE (table3), label6, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label6), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);

  hscaleGamma = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0.1, 3, 0.05, 1, 0)));
  gtk_widget_show (hscaleGamma);
  gtk_table_attach (GTK_TABLE (table3), hscaleGamma, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_widget_set_size_request (hscaleGamma, 144, 0);
  gtk_scale_set_value_pos (GTK_SCALE (hscaleGamma), GTK_POS_RIGHT);
  gtk_scale_set_digits (GTK_SCALE (hscaleGamma), 2);

  hscaleGammaR = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0.1, 3, 0.05, 1, 0)));
  gtk_widget_show (hscaleGammaR);
  gtk_table_attach (GTK_TABLE (table3), hscaleGammaR, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_widget_set_size_request (hscaleGammaR, 144, 0);
  gtk_scale_set_value_pos (GTK_SCALE (hscaleGammaR), GTK_POS_RIGHT);
  gtk_scale_set_digits (GTK_SCALE (hscaleGammaR), 2);

  label8 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Red:"));
  gtk_widget_show (label8);
  gtk_table_attach (GTK_TABLE (table3), label8, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label8), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label8), 0, 0.5);

  hscaleGammaG = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0.1, 3, 0.05, 1, 0)));
  gtk_widget_show (hscaleGammaG);
  gtk_table_attach (GTK_TABLE (table3), hscaleGammaG, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_widget_set_size_request (hscaleGammaG, 144, 0);
  gtk_scale_set_value_pos (GTK_SCALE (hscaleGammaG), GTK_POS_RIGHT);
  gtk_scale_set_digits (GTK_SCALE (hscaleGammaG), 2);

  label9 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Green:"));
  gtk_widget_show (label9);
  gtk_table_attach (GTK_TABLE (table3), label9, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label9), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label9), 0, 0.5);

  label10 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Blue:"));
  gtk_widget_show (label10);
  gtk_table_attach (GTK_TABLE (table3), label10, 0, 1, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label10), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label10), 0, 0.5);

  label7 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Weight:"));
  gtk_widget_show (label7);
  gtk_table_attach (GTK_TABLE (table3), label7, 0, 1, 4, 5,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label7), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5);

  hscaleGammaB = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0.1, 3, 0.05, 1, 0)));
  gtk_widget_show (hscaleGammaB);
  gtk_table_attach (GTK_TABLE (table3), hscaleGammaB, 1, 2, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_widget_set_size_request (hscaleGammaB, 144, 0);
  gtk_scale_set_value_pos (GTK_SCALE (hscaleGammaB), GTK_POS_RIGHT);
  gtk_scale_set_digits (GTK_SCALE (hscaleGammaB), 2);

  hscaleGammaWeight = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0, 1, 0.05, 1, 0)));
  gtk_widget_show (hscaleGammaWeight);
  gtk_table_attach (GTK_TABLE (table3), hscaleGammaWeight, 1, 2, 4, 5,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_widget_set_size_request (hscaleGammaWeight, 144, 0);
  gtk_scale_set_value_pos (GTK_SCALE (hscaleGammaWeight), GTK_POS_RIGHT);
  gtk_scale_set_digits (GTK_SCALE (hscaleGammaWeight), 2);

  label2 = gtk_label_new (QT_TR_NOOP("<b>Gamma</b>"));
  gtk_widget_show (label2);
  gtk_frame_set_label_widget (GTK_FRAME (frame2), label2);
  gtk_label_set_use_markup (GTK_LABEL (label2), TRUE);
  gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);

  hscale1 = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 1, 1, 0)));
  gtk_widget_show (hscale1);
  gtk_box_pack_start (GTK_BOX (vbox1), hscale1, FALSE, FALSE, 0);

  drawingarea1 = gtk_drawing_area_new ();
  gtk_widget_show (drawingarea1);
  gtk_box_pack_start (GTK_BOX (vbox1), drawingarea1, TRUE, TRUE, 0);

  dialog_action_area1 = GTK_DIALOG (dialog1)->action_area;
  gtk_widget_show (dialog_action_area1);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);

  cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (cancelbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);

  okbutton1 = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (okbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);

  gtk_label_set_mnemonic_widget (GTK_LABEL (label4), hscaleBrightness);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label5), hscaleSaturation);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label3), hscaleContrast);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label6), hscaleGamma);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label8), hscaleGammaR);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label9), hscaleGammaG);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label10), hscaleGammaB);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label7), hscaleGammaWeight);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog1, "dialog1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_vbox1, "dialog_vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, hbox1, "hbox1");
  GLADE_HOOKUP_OBJECT (dialog1, frame1, "frame1");
  GLADE_HOOKUP_OBJECT (dialog1, table2, "table2");
  GLADE_HOOKUP_OBJECT (dialog1, label4, "label4");
  GLADE_HOOKUP_OBJECT (dialog1, label5, "label5");
  GLADE_HOOKUP_OBJECT (dialog1, hscaleBrightness, "hscaleBrightness");
  GLADE_HOOKUP_OBJECT (dialog1, hscaleSaturation, "hscaleSaturation");
  GLADE_HOOKUP_OBJECT (dialog1, hscaleContrast, "hscaleContrast");
  GLADE_HOOKUP_OBJECT (dialog1, label3, "label3");
  GLADE_HOOKUP_OBJECT (dialog1, label1, "label1");
  GLADE_HOOKUP_OBJECT (dialog1, frame2, "frame2");
  GLADE_HOOKUP_OBJECT (dialog1, table3, "table3");
  GLADE_HOOKUP_OBJECT (dialog1, label6, "label6");
  GLADE_HOOKUP_OBJECT (dialog1, hscaleGamma, "hscaleGamma");
  GLADE_HOOKUP_OBJECT (dialog1, hscaleGammaR, "hscaleGammaR");
  GLADE_HOOKUP_OBJECT (dialog1, label8, "label8");
  GLADE_HOOKUP_OBJECT (dialog1, hscaleGammaG, "hscaleGammaG");
  GLADE_HOOKUP_OBJECT (dialog1, label9, "label9");
  GLADE_HOOKUP_OBJECT (dialog1, label10, "label10");
  GLADE_HOOKUP_OBJECT (dialog1, label7, "label7");
  GLADE_HOOKUP_OBJECT (dialog1, hscaleGammaB, "hscaleGammaB");
  GLADE_HOOKUP_OBJECT (dialog1, hscaleGammaWeight, "hscaleGammaWeight");
  GLADE_HOOKUP_OBJECT (dialog1, label2, "label2");
  GLADE_HOOKUP_OBJECT (dialog1, hscale1, "hscale1");
  GLADE_HOOKUP_OBJECT (dialog1, drawingarea1, "drawingarea1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1");
  GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1");

  return dialog1;
}
Exemplo n.º 2
0
/**
 * create the page to create new reconciles
 *
 * \param
 *
 * \return a GtkWidget, the page to the assistant
 * */
static GtkWidget *gsb_assistant_reconcile_config_page_new_reconcile ( void )
{
    GtkWidget *page;
    GtkWidget *label;
    GtkWidget *paddingbox;
    GtkWidget *table;
    GtkWidget *button;
    GtkWidget *hbox;

    page = gtk_box_new ( GTK_ORIENTATION_VERTICAL, 0 );
    gtk_container_set_border_width ( GTK_CONTAINER(page), 12 );

    paddingbox = new_paddingbox_with_title ( page, FALSE,
					     _("Fill the fields and click the button \"Create the new reconciliation\""));

    /* create the table, this is the same as the reconcile config,
     * but here it's to create new ones */
	table = gtk_table_new ( 4, 3, FALSE );
	gtk_table_set_row_spacings ( GTK_TABLE ( table ), 6 );
	gtk_table_set_col_spacings ( GTK_TABLE ( table ), 6 );
	gtk_box_pack_start ( GTK_BOX (paddingbox), table, FALSE, FALSE, 0 );

	/* set the name */
	label = gtk_label_new ( _("Reconciliation reference: ") );
	gtk_misc_set_alignment (GTK_MISC (label), 0, 1);
	gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT );
	gtk_table_attach ( GTK_TABLE ( table ), label, 0, 1, 0, 1,
			GTK_SHRINK | GTK_FILL, 0, 0, 0 );

	reconcile_name_entry = gtk_entry_new ();
	gtk_table_attach ( GTK_TABLE ( table ), reconcile_name_entry, 1, 2, 0, 1,
			GTK_EXPAND | GTK_FILL, 0, 10, 0 );

	/* set the choice of account */
	label = gtk_label_new ( _("Account: ") );
	gtk_misc_set_alignment (GTK_MISC (label), 0, 1);
	gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT );
	gtk_table_attach ( GTK_TABLE ( table ), label, 2, 3, 0, 1,
			GTK_SHRINK | GTK_FILL, 0, 10, 0 );

	reconcile_account_button = gsb_account_create_combo_list ( NULL, NULL, TRUE );
	gtk_combo_box_set_active ( GTK_COMBO_BOX (reconcile_account_button), 0 );
	gtk_table_attach ( GTK_TABLE ( table ), reconcile_account_button, 3, 4, 0, 1,
			GTK_EXPAND | GTK_FILL, 0, 0, 0 );

	/* set the initial date */
	label = gtk_label_new ( _("Initial date: ") );
	gtk_misc_set_alignment (GTK_MISC (label), 0, 1);
	gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT );
	gtk_table_attach ( GTK_TABLE ( table ), label, 0, 1, 1, 2,
			GTK_SHRINK | GTK_FILL, 0, 0, 0 );

	reconcile_init_date_entry = gsb_calendar_entry_new (FALSE);
	gtk_table_attach ( GTK_TABLE ( table ), reconcile_init_date_entry, 1, 2, 1, 2,
			GTK_EXPAND | GTK_FILL, 0, 10, 0 );

	/* set the final date */
	label = gtk_label_new ( _("Final date: ") );
	gtk_misc_set_alignment (GTK_MISC (label), 0, 1);
	gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT );
	gtk_table_attach ( GTK_TABLE ( table ), label, 0, 1, 2, 3,
			GTK_SHRINK | GTK_FILL, 0, 0, 0 );

	reconcile_final_date_entry = gsb_calendar_entry_new (FALSE);
	gtk_table_attach ( GTK_TABLE ( table ), reconcile_final_date_entry, 1, 2, 2, 3,
			GTK_EXPAND | GTK_FILL, 0, 10, 0 );

	/* set the initial balance */
	label = gtk_label_new ( _("Initial balance: ") );
	gtk_misc_set_alignment (GTK_MISC (label), 0, 1);
	gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT );
	gtk_table_attach ( GTK_TABLE ( table ), label, 2, 3, 1, 2,
			GTK_SHRINK | GTK_FILL, 0, 10, 0 );

	reconcile_init_balance_entry = gtk_entry_new ();
	gtk_table_attach ( GTK_TABLE ( table ), reconcile_init_balance_entry, 3, 4, 1, 2,
			GTK_EXPAND | GTK_FILL, 0, 0, 0 );

    /* set the final balance */
	label = gtk_label_new ( _("Final balance: ") );
	gtk_misc_set_alignment (GTK_MISC (label), 0, 1);
	gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT );
	gtk_table_attach ( GTK_TABLE ( table ), label, 2, 3, 2, 3,
			GTK_SHRINK | GTK_FILL, 0, 10, 0 );

	reconcile_final_balance_entry = gtk_entry_new ();
	gtk_table_attach ( GTK_TABLE ( table ), reconcile_final_balance_entry, 3, 4, 2, 3,
			GTK_EXPAND | GTK_FILL, 0, 0, 0 );

    /* create the button */
    hbox = gtk_box_new ( GTK_ORIENTATION_HORIZONTAL, 0 );
    gtk_box_set_homogeneous ( GTK_BOX ( hbox ), TRUE );
    gtk_box_pack_start ( GTK_BOX (page),
			 hbox,
			 FALSE, FALSE,
			 0 );

    button = gtk_button_new_with_label (_("Create the new reconciliation"));
    gtk_box_pack_end ( GTK_BOX (hbox),
		       button,
		       FALSE, FALSE,
		       0 );

    /* create the label */
    label = gtk_label_new (NULL);
    gtk_box_pack_start ( GTK_BOX (page),
			 label,
			 TRUE, TRUE,
			 0 );

    /* if we change anything in the entries, hide the label */
    g_signal_connect ( G_OBJECT (reconcile_name_entry),
		       "changed",
		       G_CALLBACK (gsb_assistant_reconcile_config_hide_label_error),
		       label );
    g_signal_connect ( G_OBJECT (reconcile_init_date_entry),
		       "changed",
		       G_CALLBACK (gsb_assistant_reconcile_config_hide_label_error),
		       label );
    g_signal_connect ( G_OBJECT (reconcile_final_date_entry),
		       "changed",
		       G_CALLBACK (gsb_assistant_reconcile_config_hide_label_error),
		       label );
    g_signal_connect ( G_OBJECT (reconcile_init_balance_entry),
		       "changed",
		       G_CALLBACK (gsb_assistant_reconcile_config_hide_label_error),
		       label );
    g_signal_connect ( G_OBJECT (reconcile_final_balance_entry),
		       "changed",
		       G_CALLBACK (gsb_assistant_reconcile_config_hide_label_error),
		       label );

    /* connect the button and give the message label as param */
    g_signal_connect ( G_OBJECT (button),
		       "clicked",
		       G_CALLBACK (gsb_assistant_reconcile_config_page_add_new_reconcile),
		       label );
    gtk_widget_show_all (page);
    return page;
}
Exemplo n.º 3
0
void
hybrid_confirm_window_create(HybridAccount           *account,
                             guchar                  *pic_data,
                             gint                     pic_len,
                             HybridConfirmOkFunc      ok_func,
                             HybridConfirmCancelFunc  cancel_func,
                             gpointer                 user_data)
{
    HybridConfirmWindow *con;
    GtkWidget           *vbox;
    GtkWidget           *table;
    GtkWidget           *action_area;
    GtkWidget           *button;
    GtkWidget           *label;
    GdkPixbuf           *pixbuf;

    con              = g_new0(HybridConfirmWindow, 1);
    con->account     = account;
    con->ok_func     = ok_func;
    con->cancel_func = cancel_func;
    con->user_data   = user_data;

    con->window = hybrid_create_window(_("Confirm Code"), NULL,
                                       GTK_WIN_POS_CENTER, FALSE);
    gtk_widget_set_size_request(con->window, 300, 200);
    gtk_container_set_border_width(GTK_CONTAINER(con->window), 8);
    g_signal_connect(con->window, "destroy", G_CALLBACK(destroy_cb), con);

    vbox = gtk_vbox_new(FALSE, 0);
    gtk_container_add(GTK_CONTAINER(con->window), vbox);

    table = gtk_table_new(3, 3, FALSE);
    gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 5);

    label = gtk_label_new(NULL);
    gtk_label_set_markup(GTK_LABEL(label),
                         _("<i>Please input the following code in the picture:</i>"));
    gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 2, 0, 1);

    label = gtk_label_new(NULL);
    gtk_label_set_markup(GTK_LABEL(label), _("<i>Code:</i>"));
    gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
    gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2);

    /* show code picture. */
    pixbuf     = hybrid_create_pixbuf(pic_data, pic_len);
    con->image = gtk_image_new_from_pixbuf(pixbuf);
    g_object_unref(pixbuf);

    gtk_table_attach_defaults(GTK_TABLE(table), con->image, 1, 2, 1, 2);

    con->entry = gtk_entry_new();
    g_signal_connect(con->entry, "activate", G_CALLBACK(ok_cb), con);
    gtk_table_attach_defaults(GTK_TABLE(table), con->entry, 0, 2, 2, 3);

    action_area = gtk_hbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(vbox), action_area, FALSE, FALSE, 5);

    button = gtk_button_new_with_label(_("OK"));
    gtk_widget_set_size_request(button, 100, 30);
    gtk_box_pack_end(GTK_BOX(action_area), button, FALSE, FALSE, 5);
    g_signal_connect(button, "clicked", G_CALLBACK(ok_cb), con);

    button = gtk_button_new_with_label(_("Cancel"));
    gtk_widget_set_size_request(button, 100, 30);
    gtk_box_pack_end(GTK_BOX(action_area), button, FALSE, FALSE, 5);
    g_signal_connect(button, "clicked", G_CALLBACK(cancel_cb), con);

    gtk_widget_show_all(con->window);
}
Exemplo n.º 4
0
static void mateweather_pref_create(MateWeatherPref* pref)
{
	GtkWidget* pref_vbox;
	GtkWidget* pref_notebook;
	#ifdef RADARMAP
		GtkWidget* radar_toggle_hbox;
	#endif /* RADARMAP */
	GtkWidget* pref_basic_update_alignment;
	GtkWidget* pref_basic_update_lbl;
	GtkWidget* pref_basic_update_hbox;
	GtkObject* pref_basic_update_spin_adj;
	GtkWidget* pref_basic_update_sec_lbl;
	GtkWidget* pref_basic_note_lbl;
	GtkWidget* pref_loc_hbox;
	GtkWidget* pref_loc_note_lbl;
	GtkWidget* scrolled_window;
	GtkWidget* label;
	GtkWidget* value_hbox;
	GtkWidget* tree_label;
	GtkTreeSelection *selection;
	GtkWidget* pref_basic_vbox;
	GtkWidget* vbox;
	GtkWidget* frame;
	GtkWidget* temp_label;
	GtkWidget* temp_combo;
	GtkWidget* speed_label;
	GtkWidget* speed_combo;
	GtkWidget* pres_label;
	GtkWidget* pres_combo;
	GtkWidget* dist_label;
	GtkWidget* dist_combo;
	GtkWidget* unit_table;
	GtkWidget* pref_find_label;
	GtkWidget* pref_find_hbox;
	GtkWidget* image;


	g_object_set (pref, "destroy-with-parent", TRUE, NULL);
	gtk_window_set_title (GTK_WINDOW (pref), _("Weather Preferences"));
	gtk_dialog_add_buttons (GTK_DIALOG (pref), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, GTK_STOCK_HELP, GTK_RESPONSE_HELP, NULL);
	gtk_dialog_set_default_response (GTK_DIALOG (pref), GTK_RESPONSE_CLOSE);
	gtk_dialog_set_has_separator (GTK_DIALOG (pref), FALSE);
	gtk_container_set_border_width (GTK_CONTAINER (pref), 5);
	gtk_window_set_resizable (GTK_WINDOW (pref), TRUE);
	gtk_window_set_screen (GTK_WINDOW (pref), gtk_widget_get_screen (GTK_WIDGET (pref->priv->applet->applet)));

	pref_vbox = gtk_dialog_get_content_area (GTK_DIALOG (pref));
	gtk_box_set_spacing (GTK_BOX (pref_vbox), 2);
	gtk_widget_show (pref_vbox);

	pref_notebook = gtk_notebook_new ();
	gtk_container_set_border_width (GTK_CONTAINER (pref_notebook), 5);
	gtk_widget_show (pref_notebook);
	gtk_box_pack_start (GTK_BOX (pref_vbox), pref_notebook, TRUE, TRUE, 0);

  /*
   * General settings page.
   */

	pref_basic_vbox = gtk_vbox_new (FALSE, 18);
	gtk_container_set_border_width (GTK_CONTAINER (pref_basic_vbox), 12);
	gtk_container_add (GTK_CONTAINER (pref_notebook), pref_basic_vbox);

	pref_basic_update_alignment = gtk_alignment_new (0, 0.5, 0, 1);
	gtk_widget_show (pref_basic_update_alignment);

	pref->priv->basic_update_btn = gtk_check_button_new_with_mnemonic (_("_Automatically update every:"));
	gtk_widget_show (pref->priv->basic_update_btn);
	gtk_container_add (GTK_CONTAINER (pref_basic_update_alignment), pref->priv->basic_update_btn);
	g_signal_connect (G_OBJECT (pref->priv->basic_update_btn), "toggled", G_CALLBACK (auto_update_toggled), pref);

	if (!g_settings_is_writable (pref->priv->applet->settings, "auto-update"))
	{
		hard_set_sensitive (pref->priv->basic_update_btn, FALSE);
	}

	/*
	 * Units settings page.
	 */

	/* Temperature Unit */
	temp_label = gtk_label_new_with_mnemonic (_("_Temperature unit:"));
	gtk_label_set_use_markup (GTK_LABEL (temp_label), TRUE);
	gtk_label_set_justify (GTK_LABEL (temp_label), GTK_JUSTIFY_LEFT);
	gtk_misc_set_alignment (GTK_MISC (temp_label), 0, 0.5);
	gtk_widget_show (temp_label);

	temp_combo = gtk_combo_box_new_text ();
	pref->priv->basic_temp_combo = temp_combo;
	gtk_label_set_mnemonic_widget (GTK_LABEL (temp_label), temp_combo);
	//gtk_combo_box_append_text (GTK_COMBO_BOX (temp_combo), _("Default"));
	gtk_combo_box_append_text (GTK_COMBO_BOX (temp_combo), _("Kelvin"));
	/* TRANSLATORS: Celsius is sometimes referred Centigrade */
	gtk_combo_box_append_text (GTK_COMBO_BOX (temp_combo), _("Celsius"));
	gtk_combo_box_append_text (GTK_COMBO_BOX (temp_combo), _("Fahrenheit"));
	gtk_widget_show (temp_combo);

	if ( ! g_settings_is_writable (pref->priv->applet->settings, "temperature-unit"))
	{
		hard_set_sensitive (pref->priv->basic_temp_combo, FALSE);
	}

	/* Speed Unit */
	speed_label = gtk_label_new_with_mnemonic (_("_Wind speed unit:"));
	gtk_label_set_use_markup (GTK_LABEL (speed_label), TRUE);
	gtk_label_set_justify (GTK_LABEL (speed_label), GTK_JUSTIFY_LEFT);
	gtk_misc_set_alignment (GTK_MISC (speed_label), 0, 0.5);
	gtk_widget_show (speed_label);

	speed_combo = gtk_combo_box_new_text ();
	pref->priv->basic_speed_combo = speed_combo;
	gtk_label_set_mnemonic_widget (GTK_LABEL (speed_label), speed_combo);
	//gtk_combo_box_append_text (GTK_COMBO_BOX (speed_combo), _("Default"));
	/* TRANSLATOR: The wind speed unit "meters per second" */
	gtk_combo_box_append_text (GTK_COMBO_BOX (speed_combo), _("m/s"));
	/* TRANSLATOR: The wind speed unit "kilometers per hour" */
	gtk_combo_box_append_text (GTK_COMBO_BOX (speed_combo), _("km/h"));
	/* TRANSLATOR: The wind speed unit "miles per hour" */
	gtk_combo_box_append_text (GTK_COMBO_BOX (speed_combo), _("mph"));
	/* TRANSLATOR: The wind speed unit "knots" */
	gtk_combo_box_append_text (GTK_COMBO_BOX (speed_combo), _("knots"));
	gtk_combo_box_append_text (GTK_COMBO_BOX (speed_combo), _("Beaufort scale"));
	gtk_widget_show (speed_combo);

	if (!g_settings_is_writable (pref->priv->applet->settings, "speed-unit"))
	{
		hard_set_sensitive (pref->priv->basic_speed_combo, FALSE);
	}

	/* Pressure Unit */
	pres_label = gtk_label_new_with_mnemonic (_("_Pressure unit:"));
	gtk_label_set_use_markup (GTK_LABEL (pres_label), TRUE);
	gtk_label_set_justify (GTK_LABEL (pres_label), GTK_JUSTIFY_LEFT);
	gtk_misc_set_alignment (GTK_MISC (pres_label), 0, 0.5);
	gtk_widget_show (pres_label);

	pres_combo = gtk_combo_box_new_text ();
	pref->priv->basic_pres_combo = pres_combo;
	gtk_label_set_mnemonic_widget (GTK_LABEL (pres_label), pres_combo);
	//gtk_combo_box_append_text (GTK_COMBO_BOX (pres_combo), _("Default"));
	/* TRANSLATOR: The pressure unit "kiloPascals" */
	gtk_combo_box_append_text (GTK_COMBO_BOX (pres_combo), _("kPa"));
	/* TRANSLATOR: The pressure unit "hectoPascals" */
	gtk_combo_box_append_text (GTK_COMBO_BOX (pres_combo), _("hPa"));
	/* TRANSLATOR: The pressure unit "millibars" */
	gtk_combo_box_append_text (GTK_COMBO_BOX (pres_combo), _("mb"));
	/* TRANSLATOR: The pressure unit "millibars of mercury" */
	gtk_combo_box_append_text (GTK_COMBO_BOX (pres_combo), _("mmHg"));
	/* TRANSLATOR: The pressure unit "inches of mercury" */
	gtk_combo_box_append_text (GTK_COMBO_BOX (pres_combo), _("inHg"));
	/* TRANSLATOR: The pressure unit "atmospheres" */
	gtk_combo_box_append_text (GTK_COMBO_BOX (pres_combo), _("atm"));
	gtk_widget_show (pres_combo);

	if (!g_settings_is_writable(pref->priv->applet->settings, "pressure-unit"))
	{
		hard_set_sensitive(pref->priv->basic_pres_combo, FALSE);
	}

	/* Distance Unit */
	dist_label = gtk_label_new_with_mnemonic (_("_Visibility unit:"));
	gtk_label_set_use_markup (GTK_LABEL (dist_label), TRUE);
	gtk_label_set_justify (GTK_LABEL (dist_label), GTK_JUSTIFY_LEFT);
	gtk_misc_set_alignment (GTK_MISC (dist_label), 0, 0.5);
	gtk_widget_show (dist_label);

	dist_combo = gtk_combo_box_new_text ();
	pref->priv->basic_dist_combo = dist_combo;
	gtk_label_set_mnemonic_widget (GTK_LABEL (dist_label), dist_combo);
	//gtk_combo_box_append_text (GTK_COMBO_BOX (dist_combo), _("Default"));
	/* TRANSLATOR: The distance unit "meters" */
	gtk_combo_box_append_text (GTK_COMBO_BOX (dist_combo), _("meters"));
	/* TRANSLATOR: The distance unit "kilometers" */
	gtk_combo_box_append_text (GTK_COMBO_BOX (dist_combo), _("km"));
	/* TRANSLATOR: The distance unit "miles" */
	gtk_combo_box_append_text (GTK_COMBO_BOX (dist_combo), _("miles"));
	gtk_widget_show (dist_combo);

	if ( ! g_settings_is_writable (pref->priv->applet->settings, "distance-unit"))
		hard_set_sensitive (pref->priv->basic_dist_combo, FALSE);

	unit_table = gtk_table_new(5, 2, FALSE);
	gtk_table_set_row_spacings(GTK_TABLE(unit_table), 6);
	gtk_table_set_col_spacings(GTK_TABLE(unit_table), 12);
	gtk_table_attach(GTK_TABLE(unit_table), temp_label, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
	gtk_table_attach_defaults(GTK_TABLE(unit_table), temp_combo,  1, 2, 0, 1);
	gtk_table_attach(GTK_TABLE(unit_table), speed_label, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
	gtk_table_attach_defaults(GTK_TABLE(unit_table), speed_combo, 1, 2, 1, 2);
	gtk_table_attach(GTK_TABLE(unit_table), pres_label, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
	gtk_table_attach_defaults(GTK_TABLE(unit_table), pres_combo,  1, 2, 2, 3);
	gtk_table_attach(GTK_TABLE(unit_table), dist_label, 0, 1, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
	gtk_table_attach_defaults(GTK_TABLE(unit_table), dist_combo,  1, 2, 3, 4);
	gtk_widget_show(unit_table);

	g_signal_connect (temp_combo, "changed", G_CALLBACK (temp_combo_changed_cb), pref);
	g_signal_connect (speed_combo, "changed", G_CALLBACK (speed_combo_changed_cb), pref);
	g_signal_connect (dist_combo, "changed", G_CALLBACK (dist_combo_changed_cb), pref);
	g_signal_connect (pres_combo, "changed", G_CALLBACK (pres_combo_changed_cb), pref);


	#ifdef RADARMAP
		pref->priv->basic_radar_btn = gtk_check_button_new_with_mnemonic (_("Enable _radar map"));
		gtk_widget_show (pref->priv->basic_radar_btn);
		g_signal_connect (G_OBJECT (pref->priv->basic_radar_btn), "toggled", G_CALLBACK (radar_toggled), pref);

		if (!g_settings_is_writable (pref->priv->applet->settings, "enable-radar-map"))
		{
			hard_set_sensitive(pref->priv->basic_radar_btn, FALSE);
		}

		radar_toggle_hbox = gtk_hbox_new(FALSE, 12);
		gtk_widget_show(radar_toggle_hbox);

		label = gtk_label_new ("    ");
		gtk_widget_show (label);
		gtk_box_pack_start (GTK_BOX (radar_toggle_hbox), label, FALSE, FALSE, 0);

		pref->priv->basic_radar_url_btn = gtk_check_button_new_with_mnemonic (_("Use _custom address for radar map"));
		gtk_widget_show (pref->priv->basic_radar_url_btn);
		gtk_box_pack_start (GTK_BOX (radar_toggle_hbox), pref->priv->basic_radar_url_btn, FALSE, FALSE, 0);

		g_signal_connect (G_OBJECT (pref->priv->basic_radar_url_btn), "toggled", G_CALLBACK (use_radar_url_toggled), pref);

		if ( ! g_settings_is_writable (pref->priv->applet->settings, "use-custom-radar-url"))
		{
			hard_set_sensitive (pref->priv->basic_radar_url_btn, FALSE);
		}

		pref->priv->basic_radar_url_hbox = gtk_hbox_new (FALSE, 12);
		gtk_widget_show (pref->priv->basic_radar_url_hbox);

		label = gtk_label_new ("    ");
		gtk_widget_show (label);
		gtk_box_pack_start (GTK_BOX (pref->priv->basic_radar_url_hbox), label, FALSE, FALSE, 0);

		label = gtk_label_new_with_mnemonic (_("A_ddress:"));
		gtk_widget_show (label);
		gtk_box_pack_start (GTK_BOX (pref->priv->basic_radar_url_hbox), label, FALSE, FALSE, 0);
		pref->priv->basic_radar_url_entry = gtk_entry_new ();
		gtk_widget_show (pref->priv->basic_radar_url_entry);
		gtk_box_pack_start (GTK_BOX (pref->priv->basic_radar_url_hbox), pref->priv->basic_radar_url_entry, TRUE, TRUE, 0);
		g_signal_connect (G_OBJECT (pref->priv->basic_radar_url_entry), "focus_out_event", G_CALLBACK (radar_url_changed), pref);
		if ( ! g_settings_is_writable (pref->priv->applet->settings, "radar"))
		{
			hard_set_sensitive (pref->priv->basic_radar_url_entry, FALSE);
		}
	#endif /* RADARMAP */

    #ifdef HAVE_LIBNOTIFY
		/* setup show-notifications button */
		pref->priv->basic_show_notifications_btn = gtk_check_button_new_with_mnemonic (_("Show _notifications"));

		if (!g_settings_is_writable (pref->priv->applet->settings, "show-notifications"))
		{
			hard_set_sensitive (pref->priv->basic_show_notifications_btn, FALSE);
		}

		g_signal_connect (G_OBJECT (pref->priv->basic_show_notifications_btn), "toggled", G_CALLBACK (show_notifications_toggled), pref);
    #endif

	frame = create_hig_catagory (pref_basic_vbox, _("Update"));

	pref_basic_update_hbox = gtk_hbox_new (FALSE, 12);

	pref_basic_update_lbl = gtk_label_new_with_mnemonic (_("_Automatically update every:"));
	gtk_widget_show (pref_basic_update_lbl);


/*
	gtk_label_set_justify (GTK_LABEL (pref_basic_update_lbl), GTK_JUSTIFY_RIGHT);
	gtk_misc_set_alignment (GTK_MISC (pref_basic_update_lbl), 1, 0.5);
*/

	gtk_widget_show (pref_basic_update_hbox);

	pref_basic_update_spin_adj = gtk_adjustment_new (30, 1, 3600, 5, 25, 1);
	pref->priv->basic_update_spin = gtk_spin_button_new (GTK_ADJUSTMENT (pref_basic_update_spin_adj), 1, 0);
	gtk_widget_show (pref->priv->basic_update_spin);

	gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (pref->priv->basic_update_spin), TRUE);
	gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (pref->priv->basic_update_spin), GTK_UPDATE_IF_VALID);
	g_signal_connect (G_OBJECT (pref->priv->basic_update_spin), "value_changed", G_CALLBACK (update_interval_changed), pref);

	pref_basic_update_sec_lbl = gtk_label_new (_("minutes"));
	gtk_widget_show (pref_basic_update_sec_lbl);

	if ( ! g_settings_is_writable (pref->priv->applet->settings, "auto-update-interval"))
	{
		hard_set_sensitive (pref->priv->basic_update_spin, FALSE);
		hard_set_sensitive (pref_basic_update_sec_lbl, FALSE);
	}

	value_hbox = gtk_hbox_new (FALSE, 6);

	gtk_box_pack_start (GTK_BOX (pref_basic_update_hbox), pref_basic_update_alignment, FALSE, TRUE, 0);
	gtk_box_pack_start (GTK_BOX (pref_basic_update_hbox), value_hbox, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX (value_hbox), pref->priv->basic_update_spin, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX (value_hbox), pref_basic_update_sec_lbl, FALSE, FALSE, 0);

	gtk_container_add (GTK_CONTAINER (frame), pref_basic_update_hbox);

	frame = create_hig_catagory (pref_basic_vbox, _("Display"));

	vbox = gtk_vbox_new (FALSE, 6);

	gtk_box_pack_start (GTK_BOX (vbox), unit_table, TRUE, TRUE, 0);

	#ifdef RADARMAP
		gtk_box_pack_start (GTK_BOX (vbox), pref->priv->basic_radar_btn, TRUE, TRUE, 0);
		gtk_box_pack_start (GTK_BOX (vbox), radar_toggle_hbox, TRUE, TRUE, 0);
		gtk_box_pack_start (GTK_BOX (vbox), pref->priv->basic_radar_url_hbox, TRUE, TRUE, 0);
	#endif /* RADARMAP */
	
	#ifdef HAVE_LIBNOTIFY
		/* add the show-notification toggle button to the vbox of the display section */
		gtk_box_pack_start (GTK_BOX (vbox), pref->priv->basic_show_notifications_btn, TRUE, TRUE, 0);
	#endif

	gtk_container_add (GTK_CONTAINER (frame), vbox);

	pref_basic_note_lbl = gtk_label_new (_("General"));
	gtk_widget_show (pref_basic_note_lbl);
	gtk_notebook_set_tab_label (GTK_NOTEBOOK (pref_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (pref_notebook), 0), pref_basic_note_lbl);

  /*
   * Location page.
   */
	pref_loc_hbox = gtk_vbox_new (FALSE, 6);
	gtk_container_set_border_width (GTK_CONTAINER (pref_loc_hbox), 12);
	gtk_container_add (GTK_CONTAINER (pref_notebook), pref_loc_hbox);

	tree_label = gtk_label_new_with_mnemonic (_("_Select a location:"));
	gtk_misc_set_alignment (GTK_MISC (tree_label), 0.0, 0.5);
	gtk_box_pack_start (GTK_BOX (pref_loc_hbox), tree_label, FALSE, FALSE, 0);

	scrolled_window = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

	pref->priv->tree = gtk_tree_view_new ();
	gtk_label_set_mnemonic_widget (GTK_LABEL (tree_label), GTK_WIDGET (pref->priv->tree));
	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (pref->priv->tree), FALSE);

	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (pref->priv->tree));
	g_signal_connect (G_OBJECT (selection), "changed", G_CALLBACK (row_selected_cb), pref);

	gtk_container_add (GTK_CONTAINER (scrolled_window), pref->priv->tree);
	gtk_widget_show (pref->priv->tree);
	gtk_widget_show (scrolled_window);
	gtk_box_pack_start (GTK_BOX (pref_loc_hbox), scrolled_window, TRUE, TRUE, 0);
	load_locations(pref);

	pref_find_hbox = gtk_hbox_new (FALSE, 6);
	pref_find_label = gtk_label_new (_("_Find:"));
	gtk_label_set_use_underline (GTK_LABEL (pref_find_label), TRUE);

	pref->priv->find_entry = gtk_entry_new ();
	gtk_label_set_mnemonic_widget (GTK_LABEL (pref_find_label), pref->priv->find_entry);

	pref->priv->find_next_btn = gtk_button_new_with_mnemonic (_("Find _Next"));
	gtk_widget_set_sensitive (pref->priv->find_next_btn, FALSE);

	image = gtk_image_new_from_stock (GTK_STOCK_FIND, GTK_ICON_SIZE_BUTTON);
	gtk_button_set_image (GTK_BUTTON (pref->priv->find_next_btn), image);

	g_signal_connect (G_OBJECT (pref->priv->find_next_btn), "clicked", G_CALLBACK (find_next_clicked), pref);
	g_signal_connect (G_OBJECT (pref->priv->find_entry), "changed", G_CALLBACK (find_entry_changed), pref);

	gtk_container_set_border_width (GTK_CONTAINER (pref_find_hbox), 0);
	gtk_box_pack_start (GTK_BOX (pref_find_hbox), pref_find_label, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX (pref_find_hbox), pref->priv->find_entry, TRUE, TRUE, 0);
	gtk_box_pack_start (GTK_BOX (pref_find_hbox), pref->priv->find_next_btn, FALSE, FALSE, 0);

	gtk_box_pack_start (GTK_BOX (pref_loc_hbox), pref_find_hbox, FALSE, FALSE, 0);

	if ( ! g_settings_is_writable (pref->priv->applet->settings, "location0"))
	{
		hard_set_sensitive (scrolled_window, FALSE);
	}

	pref_loc_note_lbl = gtk_label_new (_("Location"));
	gtk_widget_show (pref_loc_note_lbl);
	gtk_notebook_set_tab_label (GTK_NOTEBOOK (pref_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (pref_notebook), 1), pref_loc_note_lbl);


	g_signal_connect (G_OBJECT (pref), "response", G_CALLBACK (response_cb), pref);

	mateweather_pref_set_accessibility (pref);
	gtk_label_set_mnemonic_widget (GTK_LABEL (pref_basic_update_sec_lbl), pref->priv->basic_update_spin);
	gtk_label_set_mnemonic_widget (GTK_LABEL (label), pref->priv->basic_radar_url_entry);
}
Exemplo n.º 5
0
GtkWidget	*create_dialog2 (int mmin, int mmax)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox1;
  GtkWidget *label1;
  GtkObject *spinbutton1_adj;
  GtkWidget *spinbutton1;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;

  dialog1 = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog1), _("dialog1"));

  dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
  gtk_widget_show (dialog_vbox1);

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

  label1 = gtk_label_new (_("label1"));
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (vbox1), label1, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);

  spinbutton1_adj = gtk_adjustment_new (1, mmin, mmax, 1, 10, 10);
  spinbutton1 = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton1_adj), 1, 0);
  gtk_widget_show (spinbutton1);
  gtk_box_pack_start (GTK_BOX (vbox1), spinbutton1, FALSE, FALSE, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton1), TRUE);

  dialog_action_area1 = GTK_DIALOG (dialog1)->action_area;
  gtk_widget_show (dialog_action_area1);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);

  cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (cancelbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);

  okbutton1 = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (okbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog1, "dialog1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_vbox1, "dialog_vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, label1, "label1");
  GLADE_HOOKUP_OBJECT (dialog1, spinbutton1, "spinbutton1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1");
  GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1");

  gtk_widget_grab_focus (okbutton1);
  gtk_widget_grab_default (okbutton1);
  return dialog1;
}
Exemplo n.º 6
0
/* Main program. */
int main(int argc, char * argv[])
{
#ifdef ENABLE_NLS
    setlocale(LC_ALL, "");
    bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
    bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
    textdomain (GETTEXT_PACKAGE);
#endif

    /* Initialize GTK (via g_option_context_parse) and parse command line arguments. */
    GOptionContext * context = g_option_context_new("");
    g_option_context_add_main_entries(context, opt_entries, GETTEXT_PACKAGE);
    g_option_context_add_group(context, gtk_get_option_group(TRUE));
    GError * err = NULL;
    if ( ! g_option_context_parse(context, &argc, &argv, &err))
    {
        g_print(_("Error: %s\n"), err->message);
        g_error_free(err);
        return 1;
    }
    g_option_context_free(context);

    HandlerContext handler_context;
    memset(&handler_context, 0, sizeof(handler_context));

    /* Get the lxsession PID. */
    const char * p = g_getenv("_LXSESSION_PID");
    if (p != NULL) handler_context.lxsession_pid = atoi(p);

    /* Initialize capabilities of the systemd mechanism. */
    if (dbus_systemd_CanPowerOff())
    {
        handler_context.shutdown_available = TRUE;
        handler_context.shutdown_systemd = TRUE;
    }
    if (dbus_systemd_CanReboot())
    {
        handler_context.reboot_available = TRUE;
        handler_context.reboot_systemd = TRUE;
    }
    if (dbus_systemd_CanSuspend())
    {
        handler_context.suspend_available = TRUE;
        handler_context.suspend_systemd = TRUE;
    }
    if (dbus_systemd_CanHibernate())
    {
        handler_context.hibernate_available = TRUE;
        handler_context.hibernate_systemd = TRUE;
    }

    /* Initialize capabilities of the ConsoleKit mechanism. */
    if (!handler_context.shutdown_available && dbus_ConsoleKit_CanStop())
    {
        handler_context.shutdown_available = TRUE;
        handler_context.shutdown_ConsoleKit = TRUE;
    }
    if (!handler_context.reboot_available && dbus_ConsoleKit_CanRestart())
    {
        handler_context.reboot_available = TRUE;
        handler_context.reboot_ConsoleKit = TRUE;
    }

    /* Initialize capabilities of the UPower mechanism. */
    if (!handler_context.suspend_available && dbus_UPower_CanSuspend())
    {
        handler_context.suspend_available = TRUE;
        handler_context.suspend_UPower = TRUE;
    }
    if (!handler_context.hibernate_available && dbus_UPower_CanHibernate())
    {
        handler_context.hibernate_available = TRUE;
        handler_context.hibernate_UPower = TRUE;
    }

    /* If we are under GDM, its "Switch User" is available. */
    if (verify_running("gdm", "gdmflexiserver"))
    {
        handler_context.switch_user_available = TRUE;
        handler_context.switch_user_GDM = TRUE;
    }

    /* If we are under GDM3, its "Switch User" is available. */
    if (verify_running("gdm3", "gdmflexiserver"))
    {
        handler_context.switch_user_available = TRUE;
        handler_context.switch_user_GDM = TRUE;
    }

    /* lightdm also use gdmflexiserver */
    if (verify_running("lightdm", "gdmflexiserver"))
    {
        handler_context.switch_user_available = TRUE;
        handler_context.switch_user_GDM = TRUE;
    }

    /* lightdm also use gdmflexiserver */
    if (verify_running("lightdm", "gdmflexiserver"))
    {
        handler_context.switch_user_available = TRUE;
        handler_context.switch_user_GDM = TRUE;
    }

    /* lightdm can also be find by the env */
    if (g_getenv("XDG_SEAT_PATH"))
    {
        handler_context.switch_user_available = TRUE;
        handler_context.switch_user_LIGHTDM = TRUE;
    }

    /* If we are under KDM, its "Switch User" is available. */
    if (verify_running("kdm", "kdmctl"))
    {
        handler_context.switch_user_available = TRUE;
        handler_context.switch_user_KDM = TRUE;
    }

    if (verify_running("lxdm", "lxdm-binary"))
    {
        handler_context.switch_user_available = TRUE;
        handler_context.switch_user_LXDM = TRUE;
    }

    /* LTSP support */
    if (g_getenv("LTSP_CLIENT"))
    {
        handler_context.ltsp = TRUE;
        handler_context.shutdown_available = TRUE;
        handler_context.reboot_available = TRUE;
    }

    /* Lock screen */
    const gchar* very_lock_screen = determine_lock_screen();
    if (very_lock_screen)
    {
        handler_context.lock_screen = TRUE;
    }

    /* Make the button images accessible. */
    gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), PACKAGE_DATA_DIR "/lxsession/images");

    /* Get the background pixbuf. */
    GdkPixbuf * pixbuf = get_background_pixbuf();

    /* Create the toplevel window. */
    GtkWidget * window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
    gtk_window_fullscreen(GTK_WINDOW(window));
    GdkScreen* screen = gtk_widget_get_screen(window);
    gtk_window_set_default_size(GTK_WINDOW(window), gdk_screen_get_width(screen), gdk_screen_get_height(screen));
    gtk_widget_set_app_paintable(window, TRUE);
    g_signal_connect(G_OBJECT(window), "expose_event", G_CALLBACK(expose_event), pixbuf);

    /* Toplevel container */
    GtkWidget* alignment = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
    gtk_container_add(GTK_CONTAINER(window), alignment);

    GtkWidget* center_area = gtk_event_box_new();
    gtk_container_add(GTK_CONTAINER(alignment), center_area);

    GtkWidget* center_vbox = gtk_vbox_new(FALSE, 6);
    gtk_container_set_border_width(GTK_CONTAINER(center_vbox), 12);
    gtk_container_add(GTK_CONTAINER(center_area), center_vbox);

    GtkWidget* controls = gtk_vbox_new(FALSE, 6);

    /* If specified, apply a user-specified banner image. */
    if (banner_path != NULL)
    {
        GtkWidget * banner_image = gtk_image_new_from_file(banner_path);
        GtkPositionType banner_position = get_banner_position();

        switch (banner_position)
        {
            case GTK_POS_LEFT:
            case GTK_POS_RIGHT:
                {
                /* Create a horizontal box to contain the image and the controls. */
                GtkWidget * box = gtk_hbox_new(FALSE, 2);
                gtk_box_pack_start(GTK_BOX(center_vbox), box, FALSE, FALSE, 0);

                /* Pack the image and a separator. */
                gtk_misc_set_alignment(GTK_MISC(banner_image), 0.5, 0.0);
                if (banner_position == GTK_POS_LEFT)
                {
                    gtk_box_pack_start(GTK_BOX(box), banner_image, FALSE, FALSE, 2);
                    gtk_box_pack_start(GTK_BOX(box), gtk_vseparator_new(), FALSE, FALSE, 2);
                    gtk_box_pack_start(GTK_BOX(box), controls, FALSE, FALSE, 2);
                }
                else
                {
                    gtk_box_pack_start(GTK_BOX(box), controls, FALSE, FALSE, 2);
                    gtk_box_pack_end(GTK_BOX(box), gtk_vseparator_new(), FALSE, FALSE, 2);
                    gtk_box_pack_end(GTK_BOX(box), banner_image, FALSE, FALSE, 2);
                }
                }
                break;

            case GTK_POS_TOP:
                gtk_box_pack_start(GTK_BOX(controls), banner_image, FALSE, FALSE, 2);
                gtk_box_pack_start(GTK_BOX(controls), gtk_hseparator_new(), FALSE, FALSE, 2);
                gtk_box_pack_start(GTK_BOX(center_vbox), controls, FALSE, FALSE, 0);
                break;

            case GTK_POS_BOTTOM:
                gtk_box_pack_end(GTK_BOX(controls), banner_image, FALSE, FALSE, 2);
                gtk_box_pack_end(GTK_BOX(controls), gtk_hseparator_new(), FALSE, FALSE, 2);
                gtk_box_pack_start(GTK_BOX(center_vbox), controls, FALSE, FALSE, 0);
                break;
        }
    }
    else
        gtk_box_pack_start(GTK_BOX(center_vbox), controls, FALSE, FALSE, 0);

    /* Create the label. */
    GtkWidget * label = gtk_label_new("");
    if (prompt == NULL)
    {
        const char * session_name = g_getenv("DESKTOP_SESSION");
        if (session_name == NULL)
            session_name = "LXDE";

        const gchar *command_line = "lsb_release -r -s";
        gchar *output = NULL;
        GError *error;

        if (!g_spawn_command_line_sync( command_line,
                                        &output,
                                        NULL,
                                        NULL,
                                        &error))
        {

            fprintf (stderr, "Error: %s\n", error->message);
            g_error_free (error);

        }

        if (output == NULL)
        {
            output = "";
        }
        else
        {
            output[strlen ( output ) - 1] = '\0';
        }

        prompt = g_strdup_printf(_("<b><big>Logout %s %s session ?</big></b>"), session_name, output);
    }
    gtk_label_set_markup(GTK_LABEL(label), prompt);
    gtk_box_pack_start(GTK_BOX(controls), label, FALSE, FALSE, 4);

    /* Create the Shutdown button. */
    if (handler_context.shutdown_available)
    {
        GtkWidget * shutdown_button = gtk_button_new_with_mnemonic(_("Sh_utdown"));
        GtkWidget * image = gtk_image_new_from_icon_name("system-shutdown", GTK_ICON_SIZE_BUTTON);
        gtk_button_set_image(GTK_BUTTON(shutdown_button), image);
        gtk_button_set_alignment(GTK_BUTTON(shutdown_button), 0.0, 0.5);
        g_signal_connect(G_OBJECT(shutdown_button), "clicked", G_CALLBACK(shutdown_clicked), &handler_context);
        gtk_box_pack_start(GTK_BOX(controls), shutdown_button, FALSE, FALSE, 4);
    }

    /* Create the Reboot button. */
    if (handler_context.reboot_available)
    {
        GtkWidget * reboot_button = gtk_button_new_with_mnemonic(_("_Reboot"));
        GtkWidget * image = gtk_image_new_from_icon_name("gnome-session-reboot", GTK_ICON_SIZE_BUTTON);
        gtk_button_set_image(GTK_BUTTON(reboot_button), image);
        gtk_button_set_alignment(GTK_BUTTON(reboot_button), 0.0, 0.5);
        g_signal_connect(G_OBJECT(reboot_button), "clicked", G_CALLBACK(reboot_clicked), &handler_context);
        gtk_box_pack_start(GTK_BOX(controls), reboot_button, FALSE, FALSE, 4);
    }

    /* Create the Suspend button. */
    if (handler_context.suspend_available && !handler_context.ltsp)
    {
        GtkWidget * suspend_button = gtk_button_new_with_mnemonic(_("_Suspend"));
        GtkWidget * image = gtk_image_new_from_icon_name("gnome-session-suspend", GTK_ICON_SIZE_BUTTON);
        gtk_button_set_image(GTK_BUTTON(suspend_button), image);
        gtk_button_set_alignment(GTK_BUTTON(suspend_button), 0.0, 0.5);
        g_signal_connect(G_OBJECT(suspend_button), "clicked", G_CALLBACK(suspend_clicked), &handler_context);
        gtk_box_pack_start(GTK_BOX(controls), suspend_button, FALSE, FALSE, 4);
    }

    /* Create the Hibernate button. */
    if (handler_context.hibernate_available && !handler_context.ltsp)
    {
        GtkWidget * hibernate_button = gtk_button_new_with_mnemonic(_("_Hibernate"));
        GtkWidget * image = gtk_image_new_from_icon_name("gnome-session-hibernate", GTK_ICON_SIZE_BUTTON);
        gtk_button_set_image(GTK_BUTTON(hibernate_button), image);
        gtk_button_set_alignment(GTK_BUTTON(hibernate_button), 0.0, 0.5);
        g_signal_connect(G_OBJECT(hibernate_button), "clicked", G_CALLBACK(hibernate_clicked), &handler_context);
        gtk_box_pack_start(GTK_BOX(controls), hibernate_button, FALSE, FALSE, 4);
    }

    /* Create the Switch User button. */
    if (handler_context.switch_user_available && !handler_context.ltsp)
    {
        GtkWidget * switch_user_button = gtk_button_new_with_mnemonic(_("S_witch User"));
        GtkWidget * image = gtk_image_new_from_icon_name("gnome-session-switch", GTK_ICON_SIZE_BUTTON);
        gtk_button_set_image(GTK_BUTTON(switch_user_button), image);
        gtk_button_set_alignment(GTK_BUTTON(switch_user_button), 0.0, 0.5);
        g_signal_connect(G_OBJECT(switch_user_button), "clicked", G_CALLBACK(switch_user_clicked), &handler_context);
        gtk_box_pack_start(GTK_BOX(controls), switch_user_button, FALSE, FALSE, 4);
    }

    /* Create the Lock Screen button. */
    if (handler_context.lock_screen && !handler_context.ltsp)
    {
        GtkWidget * lock_screen_button = gtk_button_new_with_mnemonic(_("L_ock Screen"));
        GtkWidget * image = gtk_image_new_from_icon_name("system-lock-screen", GTK_ICON_SIZE_BUTTON);
        gtk_button_set_image(GTK_BUTTON(lock_screen_button), image);
        gtk_button_set_alignment(GTK_BUTTON(lock_screen_button), 0.0, 0.5);
        g_signal_connect(G_OBJECT(lock_screen_button), "clicked", G_CALLBACK(lock_screen_clicked), &handler_context);
        gtk_box_pack_start(GTK_BOX(controls), lock_screen_button, FALSE, FALSE, 4);
    }

    /* Create the Logout button. */
    GtkWidget * logout_button = gtk_button_new_with_mnemonic(_("_Logout"));
    GtkWidget * image = gtk_image_new_from_icon_name("system-log-out", GTK_ICON_SIZE_BUTTON);
    gtk_button_set_image(GTK_BUTTON(logout_button), image);
    gtk_button_set_alignment(GTK_BUTTON(logout_button), 0.0, 0.5);
    g_signal_connect(G_OBJECT(logout_button), "clicked", G_CALLBACK(logout_clicked), &handler_context);
    gtk_box_pack_start(GTK_BOX(controls), logout_button, FALSE, FALSE, 4);

    /* Create the Cancel button. */
    GtkWidget * cancel_button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
    gtk_button_set_alignment(GTK_BUTTON(cancel_button), 0.0, 0.5);
    g_signal_connect(G_OBJECT(cancel_button), "clicked", G_CALLBACK(cancel_clicked), NULL);
    gtk_box_pack_start(GTK_BOX(controls), cancel_button, FALSE, FALSE, 4);

    /* Create the error text. */
    handler_context.error_label = gtk_label_new("");
    gtk_label_set_justify(GTK_LABEL(handler_context.error_label), GTK_JUSTIFY_CENTER);
    gtk_box_pack_start(GTK_BOX(controls), handler_context.error_label, FALSE, FALSE, 4);

    /* Show everything. */
    gtk_widget_show_all(window);

    /* Run the main event loop. */
    gtk_main();

    /* Return. */
    return 0;
}
Exemplo n.º 7
0
void uade_gui_file_info(char *filename, char *gui_player_filename,
			char *modulename, char *playername, char *formatname)
{
    GtkWidget *fileinfo_base_vbox;
    GtkWidget *fileinfo_frame;
    GtkWidget *fileinfo_table;

    GtkWidget *fileinfo_modulename_label;
    GtkWidget *fileinfo_modulename_hbox;
    GtkWidget *fileinfo_hrule1;
    GtkWidget *fileinfo_playername_hbox;
    GtkWidget *fileinfo_playername_label;
    GtkWidget *fileinfo_playerinfo_button;
    GtkWidget *fileinfo_hrule2;
    GtkWidget *fileinfo_subsong_label;
    GtkWidget *fileinfo_minsubsong_label;
    GtkWidget *fileinfo_maxsubsong_label;
    GtkWidget *fileinfo_hrule3;
    GtkWidget *fileinfo_hrule4;

    GtkWidget *fileinfo_button_box;
    GtkWidget *ok_button;
#ifdef __AUDACIOUS_INPUT_PLUGIN_API__
    char * decoded = NULL;

    if (strncmp(filename, "file:/",6) == 0) {
      decoded = g_filename_from_uri((char *) filename, NULL, NULL);
      filename = decoded;
    }
#endif
    strlcpy(module_filename, filename, sizeof module_filename);
    strlcpy(player_filename, gui_player_filename, sizeof player_filename);


    if (fileinfowin == NULL) {
	fileinfo_tooltips = gtk_tooltips_new();
	fileinfowin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(fileinfowin), "UADE file info");
	gtk_window_set_position(GTK_WINDOW(fileinfowin),
				GTK_WIN_POS_MOUSE);
	gtk_container_set_border_width(GTK_CONTAINER(fileinfowin), 10);
	gtk_window_set_policy(GTK_WINDOW(fileinfowin), FALSE, FALSE,
			      FALSE);
	gtk_signal_connect(GTK_OBJECT(fileinfowin), "destroy",
			   GTK_SIGNAL_FUNC(gtk_widget_destroyed),
			   &fileinfowin);
	
	/* Start of Contents Box */
	
	fileinfo_base_vbox = gtk_vbox_new(FALSE, 10);
	
	gtk_container_set_border_width(GTK_CONTAINER
				       (fileinfo_base_vbox), 5);
	gtk_container_add(GTK_CONTAINER(fileinfowin),
			  fileinfo_base_vbox);
	
	/* Start of File info frame, text and option widgets */
	
	fileinfo_frame = gtk_frame_new("File info: ");
	gtk_box_pack_start(GTK_BOX(fileinfo_base_vbox), fileinfo_frame,
			   TRUE, TRUE, 0);
	
	/* Start of Fileinfotable */
	
	fileinfo_table = gtk_table_new(12, 2, FALSE);
	
	gtk_widget_show(fileinfo_table);
	gtk_container_add(GTK_CONTAINER(fileinfo_frame),
			  fileinfo_table);
	gtk_container_set_border_width(GTK_CONTAINER(fileinfo_table), 5);
	
	/* 1x1 */
	
	fileinfo_modulename_label = gtk_label_new("Module: ");
	gtk_misc_set_padding(GTK_MISC(fileinfo_modulename_label), 5,
			     5);
	/* gtk_misc_set_alignment (GTK_MISC (fileinfo_modulename_label), 1, 0); */
	gtk_table_attach(GTK_TABLE(fileinfo_table),
			 fileinfo_modulename_label, 0, 1, 0, 1,
			 (GtkAttachOptions) (GTK_FILL),
			 (GtkAttachOptions) (GTK_FILL), 0, 0);
	
/* 1x2 */
/* 1x3 */
	
	fileinfo_hrule1 = gtk_hseparator_new();
	gtk_table_attach(GTK_TABLE(fileinfo_table), fileinfo_hrule1, 0,
			 1, 2, 3, (GtkAttachOptions) (GTK_FILL),
			 (GtkAttachOptions) (0), 0, 0);
	
/* 1x4 */
	
	fileinfo_playername_label = gtk_label_new("Playerformat: ");
	gtk_misc_set_padding(GTK_MISC(fileinfo_playername_label), 5,
			     5);
	/* gtk_misc_set_alignment (GTK_MISC (fileinfo_playername_label), 1, 0); */
	gtk_table_attach(GTK_TABLE(fileinfo_table),
			 fileinfo_playername_label, 0, 1, 3, 4,
			 (GtkAttachOptions) (GTK_FILL),
			 (GtkAttachOptions) (GTK_FILL), 0, 0);
	
	
	fileinfo_hrule2 = gtk_hseparator_new();
	gtk_table_attach(GTK_TABLE(fileinfo_table), fileinfo_hrule2, 0,
			 1, 6, 7, (GtkAttachOptions) (GTK_FILL),
			 (GtkAttachOptions) (0), 0, 0);
	
/* 1x8*/
	
	fileinfo_subsong_label = gtk_label_new("Curr. subsong: ");
	gtk_misc_set_padding(GTK_MISC(fileinfo_subsong_label), 5, 5);
	/* gtk_misc_set_alignment (GTK_MISC (fileinfo_subsong_label), 1, 0); */
	gtk_table_attach(GTK_TABLE(fileinfo_table),
			 fileinfo_subsong_label, 0, 1, 7, 8,
			 (GtkAttachOptions) (GTK_FILL),
			 (GtkAttachOptions) (GTK_FILL), 0, 0);
	
/* 1x9*/
	
	fileinfo_minsubsong_label = gtk_label_new("Min. subsong: ");
	gtk_misc_set_padding(GTK_MISC(fileinfo_minsubsong_label), 5,
			     5);
	/* gtk_misc_set_alignment (GTK_MISC (fileinfo_minsubsong_label), 1, 0); */
	gtk_table_attach(GTK_TABLE(fileinfo_table),
			 fileinfo_minsubsong_label, 0, 1, 8, 9,
			 (GtkAttachOptions) (GTK_FILL),
			 (GtkAttachOptions) (GTK_FILL), 0, 0);
	
/* 1x10*/
	
	fileinfo_maxsubsong_label = gtk_label_new("Max. subsong: ");
	gtk_misc_set_padding(GTK_MISC(fileinfo_maxsubsong_label), 5,
			     5);
	/* gtk_misc_set_alignment (GTK_MISC (fileinfo_maxsubsong_label), 1, 0); */
	gtk_table_attach(GTK_TABLE(fileinfo_table),
			 fileinfo_maxsubsong_label, 0, 1, 9, 10,
			 (GtkAttachOptions) (GTK_FILL),
			 (GtkAttachOptions) (GTK_FILL), 0, 0);
	
/* 2nd Column */
/* 2x1*/
	fileinfo_modulename_hbox = gtk_hbox_new(FALSE, 10);
	gtk_table_attach(GTK_TABLE(fileinfo_table),
			 fileinfo_modulename_hbox, 1, 2, 0, 1,
			 (GtkAttachOptions) (GTK_FILL),
			 (GtkAttachOptions) (0), 0, 0);
	
	if (modulename[0] == 0) {
	    fileinfo_modulename_txt = gtk_label_new(basename(filename));
	} else {
	    fileinfo_modulename_txt = gtk_label_new(g_strdup_printf("%s\n(%s)",
							    modulename,
							    basename(filename)
							    ));
	}

	gtk_label_set_justify(GTK_LABEL(fileinfo_modulename_txt),
			      GTK_JUSTIFY_LEFT);
	gtk_label_set_line_wrap(GTK_LABEL(fileinfo_modulename_txt),
				TRUE);
	gtk_misc_set_alignment(GTK_MISC(fileinfo_modulename_txt), 0,
			       0.5);
	gtk_misc_set_padding(GTK_MISC(fileinfo_modulename_txt), 5, 5);
	

	fileinfo_hexinfo_button = gtk_button_new_with_label("hex");
	GTK_WIDGET_SET_FLAGS(fileinfo_hexinfo_button,
			     GTK_CAN_DEFAULT);
	gtk_widget_ref(fileinfo_hexinfo_button);
	gtk_object_set_data_full(GTK_OBJECT(fileinfowin),
				 "fileinfo_hexinfo_button",
				 fileinfo_hexinfo_button,
				 (GtkDestroyNotify) gtk_widget_unref);
	gtk_tooltips_set_tip(fileinfo_tooltips,
			     fileinfo_hexinfo_button,
			     g_strdup_printf("%s", filename),
			     NULL);
	
	gtk_signal_connect_object(GTK_OBJECT
				  (fileinfo_hexinfo_button),
				  "clicked",
				  GTK_SIGNAL_FUNC(uade_mod_info_hex), NULL);
	

	fileinfo_moduleinfo_button = gtk_button_new_with_label("Info");
	GTK_WIDGET_SET_FLAGS(fileinfo_moduleinfo_button,
			     GTK_CAN_DEFAULT);
	
	gtk_widget_ref(fileinfo_moduleinfo_button);
	gtk_object_set_data_full(GTK_OBJECT(fileinfowin),
				 "fileinfo_moduleinfo_button",
				 fileinfo_moduleinfo_button,
				 (GtkDestroyNotify) gtk_widget_unref);
	gtk_tooltips_set_tip(fileinfo_tooltips,
			     fileinfo_moduleinfo_button,
			     g_strdup_printf("%s", filename),
			     NULL);
	
	
	gtk_signal_connect_object(GTK_OBJECT
				  (fileinfo_moduleinfo_button),
				  "clicked",
				  GTK_SIGNAL_FUNC(uade_mod_info_module), NULL);

	
	gtk_box_pack_start(GTK_BOX(fileinfo_modulename_hbox),
			   fileinfo_modulename_txt, TRUE, TRUE, 0);
	gtk_box_pack_start_defaults(GTK_BOX(fileinfo_modulename_hbox),
				    fileinfo_hexinfo_button);
	gtk_box_pack_start_defaults(GTK_BOX(fileinfo_modulename_hbox),
				    fileinfo_moduleinfo_button);
	
/* 2x2*/
/* 2x3*/
	fileinfo_hrule3 = gtk_hseparator_new();
	gtk_table_attach(GTK_TABLE(fileinfo_table), fileinfo_hrule3, 1,
			 2, 2, 3, (GtkAttachOptions) (GTK_FILL),
			 (GtkAttachOptions) (0), 0, 0);
	
	
/* 2x4*/
	
	fileinfo_playername_hbox = gtk_hbox_new(FALSE, 10);
	gtk_table_attach(GTK_TABLE(fileinfo_table),
			 fileinfo_playername_hbox, 1, 2, 3, 4,
			 (GtkAttachOptions) (GTK_FILL),
			 (GtkAttachOptions) (0), 0, 0);
	
	
	if (formatname[0] == 0) {
	    fileinfo_playername_txt = gtk_label_new(g_strdup_printf("%s", playername));
	} else {
	    /* memory leaks using g_strdup_printf? */
	    fileinfo_playername_txt = gtk_label_new(g_strdup_printf("%s\n%s", playername, formatname));
	}
	
	/* fileinfo_playername_txt = gtk_label_new (get_playername()); */
	gtk_label_set_justify(GTK_LABEL(fileinfo_playername_txt),
			      GTK_JUSTIFY_LEFT);
	gtk_label_set_line_wrap(GTK_LABEL(fileinfo_playername_txt),
				TRUE);
	gtk_misc_set_alignment(GTK_MISC(fileinfo_playername_txt), 0,
			       0.5);
	gtk_misc_set_padding(GTK_MISC(fileinfo_playername_txt), 5, 5);
	
	fileinfo_playerinfo_button = gtk_button_new_with_label("?");
	GTK_WIDGET_SET_FLAGS(fileinfo_playerinfo_button,
			     GTK_CAN_DEFAULT);
	gtk_signal_connect_object(GTK_OBJECT
				  (fileinfo_playerinfo_button),
				  "clicked",
				  GTK_SIGNAL_FUNC(uade_player_info),
				  NULL);
	
	
	gtk_box_pack_start(GTK_BOX(fileinfo_playername_hbox),
			   fileinfo_playername_txt, TRUE, TRUE, 0);
	gtk_box_pack_start_defaults(GTK_BOX(fileinfo_playername_hbox),
				    fileinfo_playerinfo_button);
	
	
	fileinfo_hrule4 = gtk_hseparator_new();
	gtk_table_attach(GTK_TABLE(fileinfo_table), fileinfo_hrule4, 1,
			 2, 6, 7, (GtkAttachOptions) (GTK_FILL),
			 (GtkAttachOptions) (0), 0, 0);
	
	
	fileinfo_subsong_txt =
	    gtk_label_new(g_strdup_printf("%d", uade_get_cur_subsong(0)));
	
	/* gtk_widget_setusize for this widget is a bit of a cludge to set 
	   a minimal size for the FileinfoWindow. I can't get it to work either with
	   setting the usize for the window or the table... weird */
	
	gtk_widget_set_usize(fileinfo_subsong_txt, 176, -2);
	
	
	gtk_table_attach(GTK_TABLE(fileinfo_table),
			 fileinfo_subsong_txt, 1, 2, 7, 8,
			 (GtkAttachOptions) (GTK_FILL),
			 (GtkAttachOptions) (0), 0, 0);
	gtk_label_set_justify(GTK_LABEL(fileinfo_subsong_txt),
			      GTK_JUSTIFY_LEFT);
	gtk_label_set_line_wrap(GTK_LABEL(fileinfo_subsong_txt), TRUE);
	gtk_misc_set_alignment(GTK_MISC(fileinfo_subsong_txt), 0, 0.5);
	gtk_misc_set_padding(GTK_MISC(fileinfo_subsong_txt), 5, 5);
	
/* 2x9*/
	fileinfo_minsubsong_txt =
	    gtk_label_new(g_strdup_printf("%d", uade_get_min_subsong(0)));
	gtk_table_attach(GTK_TABLE(fileinfo_table),
			 fileinfo_minsubsong_txt, 1, 2, 8, 9,
			 (GtkAttachOptions) (GTK_FILL),
			 (GtkAttachOptions) (0), 0, 0);
	gtk_label_set_justify(GTK_LABEL(fileinfo_minsubsong_txt),
			      GTK_JUSTIFY_LEFT);
	gtk_label_set_line_wrap(GTK_LABEL(fileinfo_subsong_txt), TRUE);
	gtk_misc_set_alignment(GTK_MISC(fileinfo_minsubsong_txt), 0,
			       0.5);
	gtk_misc_set_padding(GTK_MISC(fileinfo_minsubsong_txt), 5, 5);
	
/* 2x10*/
	fileinfo_maxsubsong_txt =
	    gtk_label_new(g_strdup_printf("%d", uade_get_max_subsong(0)));
	gtk_table_attach(GTK_TABLE(fileinfo_table),
			 fileinfo_maxsubsong_txt, 1, 2, 9, 10,
			 (GtkAttachOptions) (GTK_FILL),
			 (GtkAttachOptions) (0), 0, 0);
	gtk_label_set_justify(GTK_LABEL(fileinfo_maxsubsong_txt),
			      GTK_JUSTIFY_LEFT);
	gtk_label_set_line_wrap(GTK_LABEL(fileinfo_maxsubsong_txt),
				TRUE);
	gtk_misc_set_alignment(GTK_MISC(fileinfo_maxsubsong_txt), 0,
			       0.5);
	gtk_misc_set_padding(GTK_MISC(fileinfo_maxsubsong_txt), 5, 5);
	
/* end of frame. */
	
/* Start of Ok and Cancel Button Box */
	
	fileinfo_button_box = gtk_hbutton_box_new();
	
	
	gtk_button_box_set_layout(GTK_BUTTON_BOX(fileinfo_button_box),
				  GTK_BUTTONBOX_END);
	gtk_button_box_set_spacing(GTK_BUTTON_BOX(fileinfo_button_box),
				   5);
	gtk_box_pack_start(GTK_BOX(fileinfo_base_vbox),
			   fileinfo_button_box, FALSE, FALSE, 0);
	
	
	ok_button = gtk_button_new_with_label("Close");
	GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT);
	gtk_signal_connect_object(GTK_OBJECT(ok_button), "clicked",
				  GTK_SIGNAL_FUNC(gtk_widget_destroy),
				  GTK_OBJECT(fileinfowin));
	
	gtk_box_pack_start_defaults(GTK_BOX(fileinfo_button_box),
				    ok_button);
	
/* End of Button Box */
	
	gtk_widget_show_all(fileinfowin);
	
    } else {
	gdk_window_raise(fileinfowin->window);
    }

#ifdef __AUDACIOUS_INPUT_PLUGIN_API__
    if (decoded != NULL)
       free (decoded);
#endif
}
Exemplo n.º 8
0
GtkWidget*
create_step1_dbox (void)
{
  GtkWidget *step1_dbox;
  GtkWidget *dialog_vbox3;
  GtkWidget *vbox1;
  GtkWidget *label10;
  GtkWidget *hseparator1;
  GSList *vbox1_group = NULL;
  GtkWidget *radiobutton1;
  GtkWidget *label14;
  GtkWidget *radiobutton2;
  GtkWidget *label13;
  GtkWidget *radiobutton3;
  GtkWidget *label12;
  GtkWidget *hseparator2;
  GtkWidget *label11;
  GtkWidget *dialog_action_area3;
  GtkWidget *hbuttonbox3;
  GtkWidget *button4;
  GtkWidget *hbox4;
  GtkWidget *pixmap4;
  guint label7_key;
  GtkWidget *label7;
  GtkWidget *button5;
  GtkWidget *hbox5;
  GtkWidget *pixmap5;
  guint label8_key;
  GtkWidget *label8;
  GtkWidget *button6;
  GtkWidget *hbox6;
  GtkWidget *pixmap6;
  guint label9_key;
  GtkWidget *label9;
  GtkAccelGroup *accel_group;

  accel_group = gtk_accel_group_new ();

  step1_dbox = gtk_dialog_new ();
  gtk_widget_set_name (step1_dbox, "step1_dbox");
  gtk_object_set_data (GTK_OBJECT (step1_dbox), "step1_dbox", step1_dbox);
  gtk_window_set_title (GTK_WINDOW (step1_dbox), _("GtkTiEmu startup"));
  gtk_window_set_modal (GTK_WINDOW (step1_dbox), TRUE);
  gtk_window_set_policy (GTK_WINDOW (step1_dbox), TRUE, TRUE, TRUE);

  dialog_vbox3 = GTK_DIALOG (step1_dbox)->vbox;
  gtk_widget_set_name (dialog_vbox3, "dialog_vbox3");
  gtk_object_set_data (GTK_OBJECT (step1_dbox), "dialog_vbox3", dialog_vbox3);
  gtk_widget_show (dialog_vbox3);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_set_name (vbox1, "vbox1");
  gtk_widget_ref (vbox1);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "vbox1", vbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox3), vbox1, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (vbox1), 5);

  label10 = gtk_label_new (_("Welcome to GtkTiEmu. To use it, you must have a ROM image..."));
  gtk_widget_set_name (label10, "label10");
  gtk_widget_ref (label10);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "label10", label10,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label10);
  gtk_box_pack_start (GTK_BOX (vbox1), label10, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label10), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label10), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label10), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label10), 15, 5);

  hseparator1 = gtk_hseparator_new ();
  gtk_widget_set_name (hseparator1, "hseparator1");
  gtk_widget_ref (hseparator1);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "hseparator1", hseparator1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hseparator1);
  gtk_box_pack_start (GTK_BOX (vbox1), hseparator1, TRUE, TRUE, 0);

  radiobutton1 = gtk_radio_button_new (vbox1_group);
  vbox1_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton1));
  gtk_widget_set_name (radiobutton1, "radiobutton1");
  gtk_widget_ref (radiobutton1);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "radiobutton1", radiobutton1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton1);
  gtk_box_pack_start (GTK_BOX (vbox1), radiobutton1, FALSE, FALSE, 0);

  label14 = gtk_label_new (_("You can use TiLP or another dumping program for getting a ROM image of your calculator."));
  gtk_widget_set_name (label14, "label14");
  gtk_widget_ref (label14);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "label14", label14,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label14);
  gtk_container_add (GTK_CONTAINER (radiobutton1), label14);
  gtk_label_set_justify (GTK_LABEL (label14), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label14), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label14), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label14), 5, 0);

  radiobutton2 = gtk_radio_button_new (vbox1_group);
  vbox1_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton2));
  gtk_widget_set_name (radiobutton2, "radiobutton2");
  gtk_widget_ref (radiobutton2);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "radiobutton2", radiobutton2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton2);
  gtk_box_pack_start (GTK_BOX (vbox1), radiobutton2, FALSE, FALSE, 0);

  label13 = gtk_label_new (_("You have downloaded a FLASH upgrade on the TI website and you would like to convert it."));
  gtk_widget_set_name (label13, "label13");
  gtk_widget_ref (label13);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "label13", label13,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label13);
  gtk_container_add (GTK_CONTAINER (radiobutton2), label13);
  gtk_label_set_justify (GTK_LABEL (label13), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label13), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label13), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label13), 5, 0);

  radiobutton3 = gtk_radio_button_new (vbox1_group);
  vbox1_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton3));
  gtk_widget_set_name (radiobutton3, "radiobutton3");
  gtk_widget_ref (radiobutton3);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "radiobutton3", radiobutton3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton3);
  gtk_box_pack_start (GTK_BOX (vbox1), radiobutton3, FALSE, FALSE, 0);

  label12 = gtk_label_new (_("You have already a ROM image and you would like to use it."));
  gtk_widget_set_name (label12, "label12");
  gtk_widget_ref (label12);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "label12", label12,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label12);
  gtk_container_add (GTK_CONTAINER (radiobutton3), label12);
  gtk_label_set_justify (GTK_LABEL (label12), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label12), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label12), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label12), 5, 0);

  hseparator2 = gtk_hseparator_new ();
  gtk_widget_set_name (hseparator2, "hseparator2");
  gtk_widget_ref (hseparator2);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "hseparator2", hseparator2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hseparator2);
  gtk_box_pack_start (GTK_BOX (vbox1), hseparator2, TRUE, TRUE, 0);

  label11 = gtk_label_new (_("Remind you that you should not distribute your ROM images. They are copyrighted by Texas Instruments."));
  gtk_widget_set_name (label11, "label11");
  gtk_widget_ref (label11);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "label11", label11,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label11);
  gtk_box_pack_start (GTK_BOX (vbox1), label11, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label11), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label11), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label11), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label11), 15, 5);

  dialog_action_area3 = GTK_DIALOG (step1_dbox)->action_area;
  gtk_widget_set_name (dialog_action_area3, "dialog_action_area3");
  gtk_object_set_data (GTK_OBJECT (step1_dbox), "dialog_action_area3", dialog_action_area3);
  gtk_widget_show (dialog_action_area3);
  gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area3), 10);

  hbuttonbox3 = gtk_hbutton_box_new ();
  gtk_widget_set_name (hbuttonbox3, "hbuttonbox3");
  gtk_widget_ref (hbuttonbox3);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "hbuttonbox3", hbuttonbox3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbuttonbox3);
  gtk_box_pack_start (GTK_BOX (dialog_action_area3), hbuttonbox3, TRUE, TRUE, 0);

  button4 = gtk_button_new ();
  gtk_widget_set_name (button4, "button4");
  gtk_widget_ref (button4);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "button4", button4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button4);
  gtk_container_add (GTK_CONTAINER (hbuttonbox3), button4);
  GTK_WIDGET_SET_FLAGS (button4, GTK_CAN_DEFAULT);
  gtk_widget_add_accelerator (button4, "clicked", accel_group,
                              GDK_Return, 0,
                              GTK_ACCEL_VISIBLE);

  hbox4 = gtk_hbox_new (FALSE, 0);
  gtk_widget_set_name (hbox4, "hbox4");
  gtk_widget_ref (hbox4);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "hbox4", hbox4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox4);
  gtk_container_add (GTK_CONTAINER (button4), hbox4);

  pixmap4 = create_pixmap (step1_dbox, "yes.xpm");
  gtk_widget_set_name (pixmap4, "pixmap4");
  gtk_widget_ref (pixmap4);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "pixmap4", pixmap4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pixmap4);
  gtk_box_pack_start (GTK_BOX (hbox4), pixmap4, TRUE, FALSE, 0);

  label7 = gtk_label_new ("");
  label7_key = gtk_label_parse_uline (GTK_LABEL (label7),
                                   _("< _Back"));
  gtk_widget_set_name (label7, "label7");
  gtk_widget_ref (label7);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "label7", label7,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label7);
  gtk_box_pack_start (GTK_BOX (hbox4), label7, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label7), 5, 0);

  button5 = gtk_button_new ();
  gtk_widget_set_name (button5, "button5");
  gtk_widget_ref (button5);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "button5", button5,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button5);
  gtk_container_add (GTK_CONTAINER (hbuttonbox3), button5);
  GTK_WIDGET_SET_FLAGS (button5, GTK_CAN_DEFAULT);

  hbox5 = gtk_hbox_new (FALSE, 0);
  gtk_widget_set_name (hbox5, "hbox5");
  gtk_widget_ref (hbox5);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "hbox5", hbox5,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox5);
  gtk_container_add (GTK_CONTAINER (button5), hbox5);

  pixmap5 = create_pixmap (step1_dbox, "yes.xpm");
  gtk_widget_set_name (pixmap5, "pixmap5");
  gtk_widget_ref (pixmap5);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "pixmap5", pixmap5,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pixmap5);
  gtk_box_pack_start (GTK_BOX (hbox5), pixmap5, TRUE, FALSE, 0);

  label8 = gtk_label_new ("");
  label8_key = gtk_label_parse_uline (GTK_LABEL (label8),
                                   _("_Next >"));
  gtk_widget_set_name (label8, "label8");
  gtk_widget_ref (label8);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "label8", label8,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label8);
  gtk_box_pack_start (GTK_BOX (hbox5), label8, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label8), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label8), 5, 0);

  button6 = gtk_button_new ();
  gtk_widget_set_name (button6, "button6");
  gtk_widget_ref (button6);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "button6", button6,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button6);
  gtk_container_add (GTK_CONTAINER (hbuttonbox3), button6);
  GTK_WIDGET_SET_FLAGS (button6, GTK_CAN_DEFAULT);
  gtk_widget_add_accelerator (button6, "clicked", accel_group,
                              GDK_Escape, 0,
                              GTK_ACCEL_VISIBLE);

  hbox6 = gtk_hbox_new (FALSE, 0);
  gtk_widget_set_name (hbox6, "hbox6");
  gtk_widget_ref (hbox6);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "hbox6", hbox6,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox6);
  gtk_container_add (GTK_CONTAINER (button6), hbox6);

  pixmap6 = create_pixmap (step1_dbox, "no.xpm");
  gtk_widget_set_name (pixmap6, "pixmap6");
  gtk_widget_ref (pixmap6);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "pixmap6", pixmap6,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pixmap6);
  gtk_box_pack_start (GTK_BOX (hbox6), pixmap6, TRUE, FALSE, 0);

  label9 = gtk_label_new ("");
  label9_key = gtk_label_parse_uline (GTK_LABEL (label9),
                                   _("_Cancel"));
  gtk_widget_set_name (label9, "label9");
  gtk_widget_ref (label9);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "label9", label9,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label9);
  gtk_box_pack_start (GTK_BOX (hbox6), label9, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label9), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label9), 5, 0);

  gtk_signal_connect (GTK_OBJECT (radiobutton1), "toggled",
                      GTK_SIGNAL_FUNC (step1_on_radiobutton1_toggled),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (radiobutton2), "toggled",
                      GTK_SIGNAL_FUNC (step2_on_radiobutton2_toggled),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (radiobutton3), "toggled",
                      GTK_SIGNAL_FUNC (step3_on_radiobutton3_toggled),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (button4), "clicked",
                      GTK_SIGNAL_FUNC (step1_b1_button_clicked),
                      step1_dbox);
  gtk_signal_connect (GTK_OBJECT (button5), "clicked",
                      GTK_SIGNAL_FUNC (step1_b2_button_clicked),
                      step1_dbox);
  gtk_signal_connect (GTK_OBJECT (button6), "clicked",
                      GTK_SIGNAL_FUNC (step1_b3_button_clicked),
                      step1_dbox);

  gtk_widget_add_accelerator (button4, "clicked", accel_group,
                              label7_key, GDK_MOD1_MASK, (GtkAccelFlags) 0);
  gtk_widget_add_accelerator (button5, "clicked", accel_group,
                              label8_key, GDK_MOD1_MASK, (GtkAccelFlags) 0);
  gtk_widget_add_accelerator (button6, "clicked", accel_group,
                              label9_key, GDK_MOD1_MASK, (GtkAccelFlags) 0);

  gtk_window_add_accel_group (GTK_WINDOW (step1_dbox), accel_group);

  return step1_dbox;
}
Exemplo n.º 9
0
GtkWidget*
create_msg1_dbox (void)
{
  GtkWidget *msg1_dbox;
  GtkWidget *dialog_vbox1;
  GtkWidget *label2;
  GtkWidget *dialog_action_area1;
  GtkWidget *hbuttonbox1;
  GtkWidget *button1;
  GtkWidget *hbox1;
  GtkWidget *pixmap1;
  guint label1_key;
  GtkWidget *label1;
  GtkAccelGroup *accel_group;

  accel_group = gtk_accel_group_new ();

  msg1_dbox = gtk_dialog_new ();
  gtk_widget_set_name (msg1_dbox, "msg1_dbox");
  gtk_object_set_data (GTK_OBJECT (msg1_dbox), "msg1_dbox", msg1_dbox);
  gtk_window_set_title (GTK_WINDOW (msg1_dbox), _("Information"));
  gtk_window_set_modal (GTK_WINDOW (msg1_dbox), TRUE);
  gtk_window_set_policy (GTK_WINDOW (msg1_dbox), TRUE, TRUE, FALSE);

  dialog_vbox1 = GTK_DIALOG (msg1_dbox)->vbox;
  gtk_widget_set_name (dialog_vbox1, "dialog_vbox1");
  gtk_object_set_data (GTK_OBJECT (msg1_dbox), "dialog_vbox1", dialog_vbox1);
  gtk_widget_show (dialog_vbox1);

  label2 = gtk_label_new ("");
  gtk_label_parse_uline (GTK_LABEL (label2),
                         _("If you want get a ROM image with\nTiLP, you have to launch it, (eventually) \nconfigure it, and next, go to the 'Functions2'\nmenu for using the ROM dumper.\nTiLP can be downloaded at:\n<http://lpg.ticalc.org/prj_tilp>"));
  gtk_widget_set_name (label2, "label2");
  gtk_widget_ref (label2);
  gtk_object_set_data_full (GTK_OBJECT (msg1_dbox), "label2", label2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label2);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), label2, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label2), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label2), 5, 5);

  dialog_action_area1 = GTK_DIALOG (msg1_dbox)->action_area;
  gtk_widget_set_name (dialog_action_area1, "dialog_action_area1");
  gtk_object_set_data (GTK_OBJECT (msg1_dbox), "dialog_action_area1", dialog_action_area1);
  gtk_widget_show (dialog_action_area1);
  gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area1), 10);

  hbuttonbox1 = gtk_hbutton_box_new ();
  gtk_widget_set_name (hbuttonbox1, "hbuttonbox1");
  gtk_widget_ref (hbuttonbox1);
  gtk_object_set_data_full (GTK_OBJECT (msg1_dbox), "hbuttonbox1", hbuttonbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbuttonbox1);
  gtk_box_pack_start (GTK_BOX (dialog_action_area1), hbuttonbox1, TRUE, TRUE, 0);

  button1 = gtk_button_new ();
  gtk_widget_set_name (button1, "button1");
  gtk_widget_ref (button1);
  gtk_object_set_data_full (GTK_OBJECT (msg1_dbox), "button1", button1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button1);
  gtk_container_add (GTK_CONTAINER (hbuttonbox1), button1);
  GTK_WIDGET_SET_FLAGS (button1, GTK_CAN_DEFAULT);
  gtk_widget_add_accelerator (button1, "clicked", accel_group,
                              GDK_Return, 0,
                              GTK_ACCEL_VISIBLE);
  gtk_widget_add_accelerator (button1, "clicked", accel_group,
                              GDK_Escape, 0,
                              GTK_ACCEL_VISIBLE);

  hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_set_name (hbox1, "hbox1");
  gtk_widget_ref (hbox1);
  gtk_object_set_data_full (GTK_OBJECT (msg1_dbox), "hbox1", hbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox1);
  gtk_container_add (GTK_CONTAINER (button1), hbox1);

  pixmap1 = create_pixmap (msg1_dbox, "yes.xpm");
  gtk_widget_set_name (pixmap1, "pixmap1");
  gtk_widget_ref (pixmap1);
  gtk_object_set_data_full (GTK_OBJECT (msg1_dbox), "pixmap1", pixmap1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pixmap1);
  gtk_box_pack_start (GTK_BOX (hbox1), pixmap1, TRUE, FALSE, 0);

  label1 = gtk_label_new ("");
  label1_key = gtk_label_parse_uline (GTK_LABEL (label1),
                                   _("_OK"));
  gtk_widget_set_name (label1, "label1");
  gtk_widget_ref (label1);
  gtk_object_set_data_full (GTK_OBJECT (msg1_dbox), "label1", label1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, TRUE, 0);
  gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label1), 5, 0);

  gtk_signal_connect (GTK_OBJECT (button1), "clicked",
                      GTK_SIGNAL_FUNC (msg1_ok_button_clicked),
                      msg1_dbox);

  gtk_widget_add_accelerator (button1, "clicked", accel_group,
                              label1_key, GDK_MOD1_MASK, (GtkAccelFlags) 0);

  gtk_window_add_accel_group (GTK_WINDOW (msg1_dbox), accel_group);

  return msg1_dbox;
}
Exemplo n.º 10
0
static gboolean
show_development_warning (void)
{
	GtkWidget *action_area;
	GtkWidget *content_area;
	GtkWidget *vbox;
	GtkWidget *label;
	GtkWidget *warning_dialog;
	GtkWidget *checkbox;
	GtkWidget *alignment;
	gboolean skip;
	gchar *text;

	warning_dialog = gtk_dialog_new ();
	gtk_window_set_title (
		GTK_WINDOW (warning_dialog), "Evolution " VERSION);
	gtk_window_set_modal (
		GTK_WINDOW (warning_dialog), TRUE);
	gtk_dialog_add_button (
		GTK_DIALOG (warning_dialog),
		_("_OK"), GTK_RESPONSE_OK);

	action_area = gtk_dialog_get_action_area (GTK_DIALOG (warning_dialog));
	content_area = gtk_dialog_get_content_area (GTK_DIALOG (warning_dialog));

	gtk_container_set_border_width (GTK_CONTAINER (action_area), 12);
	gtk_container_set_border_width (GTK_CONTAINER (content_area), 0);

	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
	gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
	gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);

	text = g_strdup_printf (
		/* xgettext:no-c-format */
		/* Preview/Alpha/Beta version warning message */
		_("Hi.  Thanks for taking the time to download this preview release\n"
		"of the Evolution groupware suite.\n"
		"\n"
		"This version of Evolution is not yet complete. It is getting close,\n"
		"but some features are either unfinished or do not work properly.\n"
		"\n"
		"If you want a stable version of Evolution, we urge you to uninstall\n"
		"this version, and install version %s instead.\n"
		"\n"
		"If you find bugs, please report them to us at bugzilla.gnome.org.\n"
		"This product comes with no warranty and is not intended for\n"
		"individuals prone to violent fits of anger.\n"
		"\n"
		"We hope that you enjoy the results of our hard work, and we\n"
		"eagerly await your contributions!\n"),
		STABLE_VERSION);
	label = gtk_label_new (text);
	g_free (text);

	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);

	gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);

	label = gtk_label_new (_("Thanks\nThe Evolution Team\n"));
	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT);
	gtk_misc_set_alignment (GTK_MISC (label), 1, .5);

	gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);

	checkbox = gtk_check_button_new_with_label (_("Do not tell me again"));

	alignment = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);

	gtk_container_add (GTK_CONTAINER (alignment), checkbox);
	gtk_box_pack_start (GTK_BOX (vbox), alignment, TRUE, TRUE, 0);

	gtk_widget_show_all (warning_dialog);

	gtk_dialog_run (GTK_DIALOG (warning_dialog));

	skip = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox));

	gtk_widget_destroy (warning_dialog);

	return skip;
}
Exemplo n.º 11
0
int GBcreatewidget(Gwidget_t * parent, Gwidget_t * widget,
		   int attrn, Gwattr_t * attrp)
{

    PIXsize_t ps;
    char *s;
    int ai;
    GdkColor c;
    int color;
    GtkWidget *label;

    if (!parent) {
	Gerr(POS, G_ERRNOPARENTWIDGET);
	return -1;
    }
    WBU->func = NULL;
    ps.x = ps.y = MINBWSIZE;
    s = NULL;

    for (ai = 0; ai < attrn; ai++) {
	switch (attrp[ai].id) {
	case G_ATTRSIZE:
	    GETSIZE(attrp[ai].u.s, ps, MINBWSIZE);
	    break;
	case G_ATTRBORDERWIDTH:
	    break;
	case G_ATTRTEXT:
	    s = attrp[ai].u.t;
	    label = gtk_label_new(s);
	    gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT);
	    gtk_widget_show(label);
	    break;
	case G_ATTRCOLOR:
	    color = attrp[ai].u.c.index;
	    if (color != 0 && color != 1) {
		Gerr(POS, G_ERRBADCOLORINDEX, color);
		return -1;
	    }
	    c.red = attrp[ai].u.c.r * 257;
	    c.green = attrp[ai].u.c.g * 257;
	    c.blue = attrp[ai].u.c.b * 257;
	    /*  if (XAllocColor (
	       Gdisplay, DefaultColormap (Gdisplay, Gscreenn), &c
	       )) {
	       if (color == 0)
	       ADD2ARGS (XtNbackground, c.pixel);
	       else
	       ADD2ARGS (XtNforeground, c.pixel);
	       }
	     */
	    break;
	case G_ATTRWINDOWID:
	    Gerr(POS, G_ERRCANNOTSETATTR1, "windowid");
	    return -1;
	case G_ATTRBUTTONCB:
	    WBU->func = (Gbuttoncb) attrp[ai].u.func;
	    break;
	case G_ATTRUSERDATA:
	    widget->udata = attrp[ai].u.u;
	    break;
	default:
	    Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
	    return -1;
	}
    }


    widget->w = gtk_button_new();
    gtk_button_set_relief(widget->w, GTK_RELIEF_NONE);
    if (label != NULL)
	gtk_container_add(GTK_CONTAINER(widget->w), label);
    if (GTK_BOX(parent->w)) {
	gtk_box_pack_start(GTK_BOX(parent->w), widget->w, FALSE, TRUE, 0);
    } else {
	gtk_container_add(GTK_CONTAINER(parent->w), widget->w);
    }

    gtk_signal_connect(G_OBJECT(widget->w), "clicked",
		       GTK_SIGNAL_FUNC(bwcallback), widget->udata);
    gtk_widget_show(widget->w);
    return 0;
}
Exemplo n.º 12
0
void
create_plug (void)
{
    GtkWidget *win, *vbox, *text;
    GtkWidget *main_widget = NULL;

    tabs = get_tabs (options.plug, FALSE);
    while (!tabs)
    {
        usleep (1000);
        tabs = get_tabs (options.plug, FALSE);
    }

    win = gtk_plug_new (0);
    /* set window borders */
    if (options.data.borders == -1)
        options.data.borders = (gint) gtk_container_get_border_width (GTK_CONTAINER (win));
    gtk_container_set_border_width (GTK_CONTAINER (win), (guint) options.data.borders);

#if !GTK_CHECK_VERSION(3,0,0)
    vbox = gtk_vbox_new (FALSE, 0);
#else
    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
#endif
    gtk_container_add (GTK_CONTAINER (win), vbox);

    /* add dialog text */
    if (options.data.dialog_text)
    {
        gchar *buf = g_strcompress (options.data.dialog_text);

        text = gtk_label_new (NULL);
        if (!options.data.no_markup)
            gtk_label_set_markup (GTK_LABEL (text), buf);
        else
            gtk_label_set_text (GTK_LABEL (text), buf);
        gtk_widget_set_name (text, "yad-dialog-label");
        gtk_label_set_line_wrap (GTK_LABEL (text), TRUE);
        gtk_label_set_selectable (GTK_LABEL (text), options.data.selectable_labels);
        gtk_label_set_justify (GTK_LABEL (text), options.data.text_align);
        switch (options.data.text_align)
        {
        case GTK_JUSTIFY_LEFT:
        case GTK_JUSTIFY_FILL:
            gtk_misc_set_alignment (GTK_MISC (text), 0.0, 0.5);
            break;
        case GTK_JUSTIFY_CENTER:
            gtk_misc_set_alignment (GTK_MISC (text), 0.5, 0.5);
            break;
        case GTK_JUSTIFY_RIGHT:
            gtk_misc_set_alignment (GTK_MISC (text), 1.0, 0.5);
            break;
        }
        gtk_box_pack_start (GTK_BOX (vbox), text, FALSE, FALSE, 2);
#if !GTK_CHECK_VERSION(3,0,0)
        g_signal_connect (G_OBJECT (text), "size-allocate", G_CALLBACK (text_size_allocate_cb), NULL);
#endif

        g_free (buf);
    }

    /* add main widget */
    switch (options.mode)
    {
    case YAD_MODE_CALENDAR:
        main_widget = calendar_create_widget (win);
        break;
    case YAD_MODE_COLOR:
        main_widget = color_create_widget (win);
        break;
    case YAD_MODE_ENTRY:
        main_widget = entry_create_widget (win);
        break;
    case YAD_MODE_FILE:
        main_widget = file_create_widget (win);
        break;
    case YAD_MODE_FONT:
        main_widget = font_create_widget (win);
        break;
    case YAD_MODE_FORM:
        main_widget = form_create_widget (win);
        break;
#ifdef HAVE_HTML
    case YAD_MODE_HTML:
        main_widget = html_create_widget (win);
        break;
#endif
    case YAD_MODE_ICONS:
        main_widget = icons_create_widget (win);
        break;
    case YAD_MODE_LIST:
        main_widget = list_create_widget (win);
        break;
    case YAD_MODE_MULTI_PROGRESS:
        main_widget = multi_progress_create_widget (win);
        break;
    case YAD_MODE_PROGRESS:
        main_widget = progress_create_widget (win);
        break;
    case YAD_MODE_SCALE:
        main_widget = scale_create_widget (win);
        break;
    case YAD_MODE_TEXTINFO:
        main_widget = text_create_widget (win);
        break;
    default:
        ;
    }
    if (main_widget)
        gtk_box_pack_start (GTK_BOX (vbox), main_widget, TRUE, TRUE, 2);

    gtk_widget_show_all (win);

    /* add plug data */
    tabs[options.tabnum].pid = getpid ();
    tabs[options.tabnum].xid = gtk_plug_get_id (GTK_PLUG (win));
    /* FIXME: may be a race here */
    tabs[0].xid++;
    shmdt (tabs);
}
Exemplo n.º 13
0
GtkWidget *
create_dialog (void)
{
    GtkWidget *dlg;
    GtkWidget *hbox, *vbox, *hbox2, *bbox;
    GtkWidget *image;
    GtkWidget *text;
    GtkWidget *main_widget = NULL;
    GtkWidget *topb = NULL;

    /* create dialog window */
    dlg = gtk_dialog_new ();
    if (options.data.splash)
        gtk_window_set_type_hint (GTK_WINDOW (dlg), GDK_WINDOW_TYPE_HINT_SPLASHSCREEN);
    else
        gtk_window_set_type_hint (GTK_WINDOW (dlg), GDK_WINDOW_TYPE_HINT_NORMAL);
    gtk_window_set_title (GTK_WINDOW (dlg), options.data.dialog_title);
    gtk_widget_set_name (dlg, "yad-dialog-window");

#ifndef  G_OS_WIN32
    if (options.parent)
    {
        gdk_window_set_transient_for (gtk_widget_get_window (dlg),
                                      gdk_x11_window_foreign_new_for_display (gdk_display_get_default (),
                                              options.parent));
    }
#endif

    if (options.data.no_escape)
        g_signal_connect (G_OBJECT (dlg), "close", G_CALLBACK (ignore_close_cb) , NULL);

    /* get buttons container */
    bbox = gtk_dialog_get_action_area (GTK_DIALOG (dlg));

    /* set window icon */
    if (options.data.window_icon)
    {
        if (g_file_test (options.data.window_icon, G_FILE_TEST_EXISTS))
            gtk_window_set_icon_from_file (GTK_WINDOW (dlg), options.data.window_icon, NULL);
        else
            gtk_window_set_icon_name (GTK_WINDOW (dlg), options.data.window_icon);
    }

    /* set window borders */
    if (options.data.borders == -1)
        options.data.borders = (gint) gtk_container_get_border_width (GTK_CONTAINER (dlg));
    gtk_container_set_border_width (GTK_CONTAINER (dlg), (guint) options.data.borders);

    /* set window size and position */
    if (!options.data.geometry && !options.data.maximized && !options.data.fullscreen)
    {
        gtk_window_set_default_size (GTK_WINDOW (dlg), options.data.width, options.data.height);
        if (options.data.center)
            gtk_window_set_position (GTK_WINDOW (dlg), GTK_WIN_POS_CENTER);
        else if (options.data.mouse)
            gtk_window_set_position (GTK_WINDOW (dlg), GTK_WIN_POS_MOUSE);
    }

    /* set window behavior */
    if (options.data.sticky)
        gtk_window_stick (GTK_WINDOW (dlg));
    gtk_window_set_keep_above (GTK_WINDOW (dlg), options.data.ontop);
    gtk_window_set_decorated (GTK_WINDOW (dlg), !options.data.undecorated);
    gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dlg), options.data.skip_taskbar);
    gtk_window_set_skip_pager_hint (GTK_WINDOW (dlg), options.data.skip_taskbar);

    /* create timeout indicator widget */
    if (options.data.timeout)
    {
        if (G_LIKELY (options.data.to_indicator) && g_ascii_strcasecmp (options.data.to_indicator, "none"))
        {
            topb = gtk_progress_bar_new ();
            gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (topb), 1.0);
            gtk_widget_set_name (topb, "yad-timeout-indicator");
        }
    }

    /* add top label widgets */
#if !GTK_CHECK_VERSION(3,0,0)
    hbox = hbox2 = gtk_hbox_new (FALSE, 0);
#else
    hbox = hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
#endif
    gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), hbox, TRUE, TRUE, 5);
#if !GTK_CHECK_VERSION(3,0,0)
    vbox = gtk_vbox_new (FALSE, 0);
#else
    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
#endif

    /* add timeout indicator */
    if (topb)
    {
        if (g_ascii_strcasecmp (options.data.to_indicator, "top") == 0)
        {
#if !GTK_CHECK_VERSION(3,0,0)
            gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (topb), GTK_PROGRESS_LEFT_TO_RIGHT);
#endif
            gtk_box_pack_start (GTK_BOX (vbox), topb, FALSE, FALSE, 2);
        }
        else if (g_ascii_strcasecmp (options.data.to_indicator, "bottom") == 0)
        {
#if !GTK_CHECK_VERSION(3,0,0)
            gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (topb), GTK_PROGRESS_LEFT_TO_RIGHT);
#endif
            gtk_box_pack_end (GTK_BOX (vbox), topb, FALSE, FALSE, 2);
        }
        else if (g_ascii_strcasecmp (options.data.to_indicator, "left") == 0)
        {
#if !GTK_CHECK_VERSION(3,0,0)
            gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (topb), GTK_PROGRESS_BOTTOM_TO_TOP);
#endif
            gtk_box_pack_start (GTK_BOX (hbox), topb, FALSE, FALSE, 2);
        }
        else if (g_ascii_strcasecmp (options.data.to_indicator, "right") == 0)
        {
#if !GTK_CHECK_VERSION(3,0,0)
            gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (topb), GTK_PROGRESS_BOTTOM_TO_TOP);
#endif
            gtk_box_pack_end (GTK_BOX (hbox), topb, FALSE, FALSE, 2);
        }
        if (settings.show_remain)
        {
            gchar *lbl = g_strdup_printf (_("%d sec"), options.data.timeout);
#if GTK_CHECK_VERSION(3,0,0)
            gtk_progress_bar_set_show_text (GTK_PROGRESS_BAR (topb), TRUE);
#endif
            gtk_progress_bar_set_text (GTK_PROGRESS_BAR (topb), lbl);
            g_free (lbl);
        }
    }

    /* must be after indicator! */
    gtk_box_pack_end (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);

    if (options.data.image_on_top)
    {
#if !GTK_CHECK_VERSION(3,0,0)
        hbox2 = gtk_hbox_new (FALSE, 0);
#else
        hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
#endif
        gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
    }

    if (options.data.dialog_image)
    {
        GdkPixbuf *pb = NULL;

        pb = get_pixbuf (options.data.dialog_image, YAD_BIG_ICON);
        image = gtk_image_new_from_pixbuf (pb);
        if (pb)
            g_object_unref (pb);

        gtk_widget_set_name (image, "yad-dialog-image");
        gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
        gtk_box_pack_start (GTK_BOX (hbox2), image, FALSE, FALSE, 2);
    }
    if (options.data.dialog_text)
    {
        /* for dnd's tooltip we don't need text label */
        if (options.mode != YAD_MODE_DND || !options.dnd_data.tooltip)
        {
            gchar *buf = g_strcompress (options.data.dialog_text);

            text = gtk_label_new (NULL);
            if (!options.data.no_markup)
                gtk_label_set_markup (GTK_LABEL (text), buf);
            else
                gtk_label_set_text (GTK_LABEL (text), buf);
            g_free (buf);

            gtk_widget_set_name (text, "yad-dialog-label");
            gtk_label_set_line_wrap (GTK_LABEL (text), TRUE);
            gtk_label_set_selectable (GTK_LABEL (text), options.data.selectable_labels);
            gtk_label_set_justify (GTK_LABEL (text), options.data.text_align);
            switch (options.data.text_align)
            {
            case GTK_JUSTIFY_LEFT:
            case GTK_JUSTIFY_FILL:
                gtk_misc_set_alignment (GTK_MISC (text), 0.0, 0.5);
                break;
            case GTK_JUSTIFY_CENTER:
                gtk_misc_set_alignment (GTK_MISC (text), 0.5, 0.5);
                break;
            case GTK_JUSTIFY_RIGHT:
                gtk_misc_set_alignment (GTK_MISC (text), 1.0, 0.5);
                break;
            }
            if (options.data.image_on_top)
                gtk_box_pack_start (GTK_BOX (hbox2), text, TRUE, TRUE, 2);
            else
                gtk_box_pack_start (GTK_BOX (vbox), text, FALSE, FALSE, 2);
#if !GTK_CHECK_VERSION(3,0,0)
            if (!options.data.fixed)
                g_signal_connect (G_OBJECT (text), "size-allocate", G_CALLBACK (text_size_allocate_cb), NULL);
#endif
        }
    }

    /* add main widget */
    switch (options.mode)
    {
    case YAD_MODE_CALENDAR:
        main_widget = calendar_create_widget (dlg);
        break;
    case YAD_MODE_COLOR:
        main_widget = color_create_widget (dlg);
        break;
    case YAD_MODE_DND:
        dnd_init (dlg);
        break;
    case YAD_MODE_ENTRY:
        main_widget = entry_create_widget (dlg);
        break;
    case YAD_MODE_FILE:
        main_widget = file_create_widget (dlg);
        break;
    case YAD_MODE_FONT:
        main_widget = font_create_widget (dlg);
        break;
    case YAD_MODE_FORM:
        main_widget = form_create_widget (dlg);
        break;
#ifdef HAVE_HTML
    case YAD_MODE_HTML:
        main_widget = html_create_widget (dlg);
        break;
#endif
    case YAD_MODE_ICONS:
        main_widget = icons_create_widget (dlg);
        break;
    case YAD_MODE_LIST:
        main_widget = list_create_widget (dlg);
        break;
    case YAD_MODE_MULTI_PROGRESS:
        main_widget = multi_progress_create_widget (dlg);
        break;
    case YAD_MODE_NOTEBOOK:
        main_widget = notebook_create_widget (dlg);
        break;
    case YAD_MODE_PANED:
        main_widget = paned_create_widget (dlg);
        break;
    case YAD_MODE_PROGRESS:
        main_widget = progress_create_widget (dlg);
        break;
    case YAD_MODE_SCALE:
        main_widget = scale_create_widget (dlg);
        break;
    case YAD_MODE_TEXTINFO:
        main_widget = text_create_widget (dlg);
        break;
    default:
        ;
    }

    if (main_widget)
    {
        if (options.data.expander)
        {
            GtkWidget *exp;

            exp = gtk_expander_new_with_mnemonic (options.data.expander);
            gtk_expander_set_expanded (GTK_EXPANDER (exp), FALSE);
            gtk_container_add (GTK_CONTAINER (exp), main_widget);
            gtk_box_pack_start (GTK_BOX (vbox), exp, TRUE, TRUE, 2);
        }
        else
            gtk_box_pack_start (GTK_BOX (vbox), main_widget, TRUE, TRUE, 2);
    }

    /* add buttons */
    if (!options.data.no_buttons)
    {
        if (options.data.buttons)
        {
            GSList *tmp = options.data.buttons;
            do
            {
                GtkWidget *btn;
                YadButton *b = (YadButton *) tmp->data;

                btn = gtk_button_new ();
                gtk_container_add (GTK_CONTAINER (btn), get_label (b->name, 2));
                gtk_button_set_alignment (GTK_BUTTON (btn), 0.5, 0.5);
                g_object_set_data (G_OBJECT (btn), "resp", GINT_TO_POINTER (b->response));
                g_signal_connect (G_OBJECT (btn), "clicked", G_CALLBACK (btn_cb), b->cmd);
                gtk_box_pack_start (GTK_BOX (bbox), btn, FALSE, FALSE, 0);

                tmp = tmp->next;
            }
            while (tmp != NULL);
        }
        else
        {
            if (options.mode == YAD_MODE_PROGRESS || options.mode == YAD_MODE_MULTI_PROGRESS)
                gtk_dialog_add_buttons (GTK_DIALOG (dlg), GTK_STOCK_CLOSE, YAD_RESPONSE_OK, NULL);
            else
            {
                if (gtk_alternative_dialog_button_order (NULL))
                    gtk_dialog_add_buttons (GTK_DIALOG (dlg),
                                            GTK_STOCK_OK, YAD_RESPONSE_OK, GTK_STOCK_CANCEL, YAD_RESPONSE_CANCEL, NULL);
                else
                    gtk_dialog_add_buttons (GTK_DIALOG (dlg),
                                            GTK_STOCK_CANCEL, YAD_RESPONSE_CANCEL, GTK_STOCK_OK, YAD_RESPONSE_OK, NULL);
            }
            gtk_dialog_set_default_response (GTK_DIALOG (dlg), YAD_RESPONSE_OK);
        }
        gtk_button_box_set_layout (GTK_BUTTON_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dlg))),
                                   options.data.buttons_layout);
    }

    /* show widgets */
    gtk_widget_show_all (gtk_dialog_get_content_area (GTK_DIALOG (dlg)));
    if (options.data.no_buttons)
        gtk_widget_hide (bbox);

    /* parse geometry, if given. must be after showing widget */
    if (options.data.geometry && !options.data.maximized && !options.data.fullscreen)
    {
        gtk_widget_realize (dlg);
        gtk_window_parse_geometry (GTK_WINDOW (dlg), options.data.geometry);
    }
    gtk_widget_show (dlg);

    /* set maximized or fixed size after showing widget */
    if (options.data.maximized)
        gtk_window_maximize (GTK_WINDOW (dlg));
    else if (options.data.fullscreen)
        gtk_window_fullscreen (GTK_WINDOW (dlg));
    else
    {
        gtk_window_set_resizable (GTK_WINDOW (dlg), !options.data.fixed);
        if (options.data.fixed)
            gtk_widget_set_size_request (dlg, options.data.width, options.data.height);
    }
    /* set timeout */
    if (options.data.timeout)
    {
        g_timeout_add_seconds (options.data.timeout, timeout_cb, dlg);
        g_timeout_add_seconds (1, timeout_indicator_cb, topb);
    }

#ifndef G_OS_WIN32
    /* print xid */
    if (options.print_xid)
    {
        fprintf (stderr, "0x%lX", GDK_WINDOW_XID (gtk_widget_get_window (dlg)));
        fflush (stderr);
    }
#endif

    return dlg;
}
Exemplo n.º 14
0
/*
 * Return GtkWidget of the popup that the caller can get more control such as, 
 * connecting some signal handlers to this widget.
 */
static GtkWidget* notify_new(
		const gchar *_caption_text,
		const gchar *body_text, 
		GtkWidget* parent, GCallback click_cb, 
		gpointer click_cb_data)
{
	GtkWidget *win = gtk_window_new(GTK_WINDOW_POPUP);
	GtkWidget *context, *body, *frame;
	gchar *context_text = context_text = g_markup_escape_text(body_text, strlen(body_text));
	gchar *caption_text = g_strdup(_caption_text);
	GtkWidget *imageNotify;
	GtkWidget *labelNotify;
	GtkWidget *labelCaption;
	GtkWidget *button;
	Win *w;

	body = gtk_vbox_new(FALSE, 2);
	context = gtk_hbox_new(FALSE, 0);
		//gtk_table_new(2, 2, TRUE);
	
	/*
	 * load the content
	 */
	labelNotify = gtk_label_new(NULL);
	labelCaption = gtk_label_new(NULL);
	gtk_label_set_markup(GTK_LABEL(labelNotify), context_text);
	gtk_label_set_markup(GTK_LABEL(labelCaption), caption_text);

	if (icon_pixbuf) {
		imageNotify = gtk_image_new_from_pixbuf(icon_pixbuf);
		gtk_box_pack_start(
				GTK_BOX(context), 
				imageNotify,
				FALSE,
				FALSE,
				5);
	}

	gtk_box_pack_start(GTK_BOX(context), labelCaption, TRUE, TRUE, 0);
	gtk_container_add(GTK_CONTAINER(body), context);
	gtk_label_set_line_wrap(GTK_LABEL(labelNotify), TRUE);
	gtk_label_set_justify(GTK_LABEL(labelNotify), GTK_JUSTIFY_LEFT);
	gtk_misc_set_alignment(GTK_MISC(labelNotify), 0.0, 0.5);
	gtk_misc_set_padding(GTK_MISC(labelNotify), 25, 0);
	gtk_box_pack_start(GTK_BOX(body), labelNotify, TRUE, TRUE, 0);

	button = gtk_button_new();
	gtk_container_add(GTK_CONTAINER(win), button);

	frame = gtk_frame_new(NULL);
	gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
	gtk_container_set_border_width(GTK_CONTAINER(frame),0);
	gtk_container_add(GTK_CONTAINER(button), frame);

	gtk_window_set_default_size(GTK_WINDOW(win), win->allocation.width, NHEIGHT);
	gtk_container_add(GTK_CONTAINER(frame), body);

	if (click_cb)
		g_signal_connect(
			G_OBJECT(button), "clicked", 
			click_cb, click_cb_data);

	w = begin_animation(win, body);
	g_free(context_text);

	w->parent = parent;
	w->parent_handler_id = !parent ? 
		0 : 
		g_signal_connect_swapped(
			G_OBJECT(parent), "destroy", 
			G_CALLBACK(gtk_widget_destroy),
			win);
	g_signal_connect(G_OBJECT(win), "destroy", G_CALLBACK(destroy_win), w);

	return win;
}
Exemplo n.º 15
0
void gui_init(dt_lib_module_t *self)
{
  unsigned int i;

  GtkWidget *container = gtk_vbox_new(FALSE, 5);
  GtkWidget *output_row = gtk_hbox_new(FALSE, 2);
  GtkWidget *output_options = gtk_vbox_new(FALSE, 5);
  GtkWidget *picker_subrow = gtk_hbox_new(FALSE, 2);
  GtkWidget *restrict_button;
  GtkWidget *samples_label = dtgtk_label_new(_("live samples"),
                             DARKTABLE_LABEL_TAB
                             | DARKTABLE_LABEL_ALIGN_RIGHT);
  GtkWidget *samples_options_row = gtk_hbox_new(FALSE, 2);

  // Initializing self data structure
  dt_lib_colorpicker_t *data = (dt_lib_colorpicker_t*)calloc(1, sizeof(dt_lib_colorpicker_t));
  self->data = (void*)data;

  // Initializing proxy functions and data
  darktable.lib->proxy.colorpicker.module = self;
  darktable.lib->proxy.colorpicker.size =
    dt_conf_get_int("ui_last/colorpicker_size");
  darktable.lib->proxy.colorpicker.display_samples =
    dt_conf_get_int("ui_last/colorpicker_display_samples");
  darktable.lib->proxy.colorpicker.live_samples = NULL;
  darktable.lib->proxy.colorpicker.picked_color_rgb_mean =
    (uint8_t*)malloc(sizeof(uint8_t) * 3);
  darktable.lib->proxy.colorpicker.picked_color_rgb_min =
    (uint8_t*)malloc(sizeof(uint8_t) * 3);
  darktable.lib->proxy.colorpicker.picked_color_rgb_max =
    (uint8_t*)malloc(sizeof(uint8_t) * 3);
  darktable.lib->proxy.colorpicker.picked_color_lab_mean =
    (float*)malloc(sizeof(float) * 3);
  darktable.lib->proxy.colorpicker.picked_color_lab_min =
    (float*)malloc(sizeof(float) * 3);
  darktable.lib->proxy.colorpicker.picked_color_lab_max =
    (float*)malloc(sizeof(float) * 3);
  for(i = 0; i < 3; i++)
    darktable.lib->proxy.colorpicker.picked_color_rgb_mean[i]
    = darktable.lib->proxy.colorpicker.picked_color_rgb_min[i]
      = darktable.lib->proxy.colorpicker.picked_color_rgb_max[i] = 0;
  for(i = 0; i < 3; i++)
    darktable.lib->proxy.colorpicker.picked_color_lab_mean[i]
    = darktable.lib->proxy.colorpicker.picked_color_lab_min[i]
      = darktable.lib->proxy.colorpicker.picked_color_lab_max[i] = 0;
  darktable.lib->proxy.colorpicker.update_panel =  _update_picker_output;
  darktable.lib->proxy.colorpicker.update_samples = _update_samples_output;
  darktable.lib->proxy.colorpicker.set_sample_area = _set_sample_area;
  darktable.lib->proxy.colorpicker.set_sample_point = _set_sample_point;

  // Setting up the GUI
  self->widget = container;
  gtk_box_pack_start(GTK_BOX(container), output_row, TRUE, TRUE, 0);

  // The output button
  data->output_button = dtgtk_button_new(NULL, CPF_STYLE_BOX);
  gtk_widget_set_size_request(data->output_button, DT_PIXEL_APPLY_DPI(100), DT_PIXEL_APPLY_DPI(100));
  gtk_widget_set_sensitive(data->output_button, FALSE);
  gtk_box_pack_start(GTK_BOX(output_row), data->output_button, FALSE, FALSE, 0);

  // The picker button, output selectors and label
  gtk_box_pack_start(GTK_BOX(output_row), output_options, TRUE, TRUE, 0);

  data->size_selector = gtk_combo_box_text_new();
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->size_selector),
                            _("point"));
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->size_selector),
                            _("area"));
  gtk_combo_box_set_active(GTK_COMBO_BOX(data->size_selector),
                           dt_conf_get_int("ui_last/colorpicker_size"));
  gtk_widget_set_size_request(data->size_selector, DT_PIXEL_APPLY_DPI(30), -1);
  gtk_box_pack_start(GTK_BOX(picker_subrow), data->size_selector,
                     TRUE, TRUE, 0);

  g_signal_connect(G_OBJECT(data->size_selector), "changed",
                   G_CALLBACK(_size_changed), (gpointer)self);

  data->picker_button = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker,
                        CPF_STYLE_BOX);
  gtk_widget_set_size_request(data->picker_button, DT_PIXEL_APPLY_DPI(50), -1);
  gtk_box_pack_start(GTK_BOX(picker_subrow), data->picker_button,
                     FALSE, FALSE, 0);

  g_signal_connect(G_OBJECT(data->picker_button), "toggled",
                   G_CALLBACK(_picker_button_toggled), self);

  gtk_box_pack_start(GTK_BOX(output_options), picker_subrow, TRUE, TRUE, 0);

  data->statistic_selector = gtk_combo_box_text_new();
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->statistic_selector),
                            _("mean"));
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->statistic_selector),
                            _("min"));
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->statistic_selector),
                            _("max"));
  gtk_combo_box_set_active(GTK_COMBO_BOX(data->statistic_selector),
                           dt_conf_get_int("ui_last/colorpicker_mode"));
  gtk_widget_set_sensitive(data->statistic_selector,
                           dt_conf_get_int("ui_last/colorpicker_size"));
  gtk_box_pack_start(GTK_BOX(output_options), data->statistic_selector,
                     TRUE, TRUE, 0);

  g_signal_connect(G_OBJECT(data->statistic_selector), "changed",
                   G_CALLBACK(_statistic_changed), self);

  data->color_mode_selector = gtk_combo_box_text_new();
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->color_mode_selector),
                            _("RGB"));
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->color_mode_selector),
                            _("Lab"));
  gtk_combo_box_set_active(GTK_COMBO_BOX(data->color_mode_selector),
                           dt_conf_get_int("ui_last/colorpicker_model"));
  gtk_box_pack_start(GTK_BOX(output_options), data->color_mode_selector,
                     TRUE, TRUE, 0);

  g_signal_connect(G_OBJECT(data->color_mode_selector), "changed",
                   G_CALLBACK(_color_mode_changed), self);

  data->output_label = gtk_label_new("");
  gtk_label_set_justify(GTK_LABEL(data->output_label), GTK_JUSTIFY_CENTER);
  gtk_widget_set_size_request(data->output_label, DT_PIXEL_APPLY_DPI(80), -1);
  gtk_box_pack_start(GTK_BOX(output_options), data->output_label,
                     FALSE, FALSE, 0);

  restrict_button = gtk_check_button_new_with_label(
                      _("restrict histogram to selection"));
  gtk_toggle_button_set_active(
    GTK_TOGGLE_BUTTON(restrict_button),
    dt_conf_get_int("ui_last/colorpicker_restrict_histogram"));
  darktable.lib->proxy.colorpicker.restrict_histogram =
    dt_conf_get_int("ui_last/colorpicker_restrict_histogram");
  gtk_box_pack_start(GTK_BOX(container), restrict_button, TRUE, TRUE, 0);

  g_signal_connect(G_OBJECT(restrict_button), "toggled",
                   G_CALLBACK(_restrict_histogram_changed), NULL);

  // Adding the live samples section
  gtk_box_pack_start(GTK_BOX(container), samples_label, TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(container), samples_options_row, TRUE, TRUE, 0);

  data->samples_statistic_selector = gtk_combo_box_text_new();
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->samples_statistic_selector),
                            _("mean"));
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->samples_statistic_selector),
                            _("min"));
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->samples_statistic_selector),
                            _("max"));
  gtk_combo_box_set_active(GTK_COMBO_BOX(data->samples_statistic_selector),
                           dt_conf_get_int("ui_last/colorsamples_mode"));
  gtk_box_pack_start(GTK_BOX(samples_options_row),
                     data->samples_statistic_selector,
                     TRUE, TRUE, 0);

  g_signal_connect(G_OBJECT(data->samples_statistic_selector), "changed",
                   G_CALLBACK(_samples_statistic_changed), self);

  data->samples_mode_selector = gtk_combo_box_text_new();
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->samples_mode_selector),
                            _("RGB"));
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->samples_mode_selector),
                            _("Lab"));
  gtk_combo_box_set_active(GTK_COMBO_BOX(data->samples_mode_selector),
                           dt_conf_get_int("ui_last/colorsamples_model"));
  gtk_box_pack_start(GTK_BOX(samples_options_row), data->samples_mode_selector,
                     TRUE, TRUE, 0);

  g_signal_connect(G_OBJECT(data->samples_mode_selector), "changed",
                   G_CALLBACK(_samples_mode_changed), self);

  data->add_sample_button = gtk_button_new_with_label(_("add"));
  gtk_widget_set_sensitive(data->add_sample_button, FALSE);
  gtk_box_pack_start(GTK_BOX(samples_options_row), data->add_sample_button,
                     FALSE, FALSE, 0);

  g_signal_connect(G_OBJECT(data->add_sample_button), "clicked",
                   G_CALLBACK(_add_sample), self);

  data->samples_container = gtk_vbox_new(FALSE, 2);
  gtk_box_pack_start(GTK_BOX(container), data->samples_container,
                     TRUE, TRUE, 0);

  data->display_samples_check_box =
    gtk_check_button_new_with_label(_("display sample areas on image"));
  gtk_toggle_button_set_active(
    GTK_TOGGLE_BUTTON(data->display_samples_check_box),
    dt_conf_get_int("ui_last/colorpicker_display_samples"));
  gtk_box_pack_start(GTK_BOX(container), data->display_samples_check_box,
                     TRUE, TRUE, 0);

  g_signal_connect(G_OBJECT(data->display_samples_check_box), "toggled",
                   G_CALLBACK(_display_samples_changed), NULL);

}
Exemplo n.º 16
0
GtkWidget*
create_step3_dbox (void)
{
  GtkWidget *step3_dbox;
  GtkWidget *dialog_vbox3;
  GtkWidget *vbox1;
  GtkWidget *label10;
  GtkWidget *hseparator1;
  GtkWidget *vbox3;
  GtkWidget *label12;
  GtkWidget *label13;
  GtkWidget *label14;
  GtkWidget *label15;
  GtkWidget *label17;
  GtkWidget *hseparator2;
  GtkWidget *label11;
  GtkWidget *dialog_action_area3;
  GtkWidget *hbuttonbox3;
  GtkWidget *button4;
  GtkWidget *hbox4;
  GtkWidget *pixmap4;
  guint label7_key;
  GtkWidget *label7;
  GtkWidget *button5;
  GtkWidget *hbox5;
  GtkWidget *pixmap5;
  guint label8_key;
  GtkWidget *label8;
  GtkWidget *button6;
  GtkWidget *hbox6;
  GtkWidget *pixmap6;
  guint label9_key;
  GtkWidget *label9;
  GtkAccelGroup *accel_group;

  accel_group = gtk_accel_group_new ();

  step3_dbox = gtk_dialog_new ();
  gtk_widget_set_name (step3_dbox, "step3_dbox");
  gtk_object_set_data (GTK_OBJECT (step3_dbox), "step3_dbox", step3_dbox);
  gtk_window_set_title (GTK_WINDOW (step3_dbox), _("GtkTiEmu startup"));
  gtk_window_set_modal (GTK_WINDOW (step3_dbox), TRUE);
  gtk_window_set_policy (GTK_WINDOW (step3_dbox), TRUE, TRUE, TRUE);

  dialog_vbox3 = GTK_DIALOG (step3_dbox)->vbox;
  gtk_widget_set_name (dialog_vbox3, "dialog_vbox3");
  gtk_object_set_data (GTK_OBJECT (step3_dbox), "dialog_vbox3", dialog_vbox3);
  gtk_widget_show (dialog_vbox3);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_set_name (vbox1, "vbox1");
  gtk_widget_ref (vbox1);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "vbox1", vbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox3), vbox1, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (vbox1), 5);

  label10 = gtk_label_new (_("GtkTiEmu is now set  up and ready for use. Some tips on how to use the emulator:"));
  gtk_widget_set_name (label10, "label10");
  gtk_widget_ref (label10);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "label10", label10,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label10);
  gtk_box_pack_start (GTK_BOX (vbox1), label10, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label10), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label10), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label10), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label10), 15, 5);

  hseparator1 = gtk_hseparator_new ();
  gtk_widget_set_name (hseparator1, "hseparator1");
  gtk_widget_ref (hseparator1);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "hseparator1", hseparator1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hseparator1);
  gtk_box_pack_start (GTK_BOX (vbox1), hseparator1, TRUE, TRUE, 0);

  vbox3 = gtk_vbox_new (FALSE, 0);
  gtk_widget_set_name (vbox3, "vbox3");
  gtk_widget_ref (vbox3);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "vbox3", vbox3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox3);
  gtk_box_pack_start (GTK_BOX (vbox1), vbox3, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (vbox3), 5);

  label12 = gtk_label_new (_("* You have access to a popup menu by right-clicking in the emulator's window."));
  gtk_widget_set_name (label12, "label12");
  gtk_widget_ref (label12);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "label12", label12,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label12);
  gtk_box_pack_start (GTK_BOX (vbox3), label12, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label12), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label12), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label12), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label12), 5, 0);

  label13 = gtk_label_new (_("* To use keys, use mouse or keyboard"));
  gtk_widget_set_name (label13, "label13");
  gtk_widget_ref (label13);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "label13", label13,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label13);
  gtk_box_pack_start (GTK_BOX (vbox3), label13, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label13), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label13), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label13), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label13), 5, 0);

  label14 = gtk_label_new (_("* To change to a different calculator or ROM version, use an item of the ROM menu."));
  gtk_widget_set_name (label14, "label14");
  gtk_widget_ref (label14);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "label14", label14,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label14);
  gtk_box_pack_start (GTK_BOX (vbox3), label14, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label14), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label14), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label14), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label14), 5, 0);

  label15 = gtk_label_new (_("* You can save the emulator state and config."));
  gtk_widget_set_name (label15, "label15");
  gtk_widget_ref (label15);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "label15", label15,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label15);
  gtk_box_pack_start (GTK_BOX (vbox3), label15, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label15), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label15), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label15), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label15), 5, 0);

  label17 = gtk_label_new (_("* If your calculator screen is blank, use 'Ctrl' with '+/-' for adjusting contrast."));
  gtk_widget_set_name (label17, "label17");
  gtk_widget_ref (label17);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "label17", label17,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label17);
  gtk_box_pack_start (GTK_BOX (vbox3), label17, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label17), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label17), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label17), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label17), 5, 0);

  hseparator2 = gtk_hseparator_new ();
  gtk_widget_set_name (hseparator2, "hseparator2");
  gtk_widget_ref (hseparator2);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "hseparator2", hseparator2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hseparator2);
  gtk_box_pack_start (GTK_BOX (vbox1), hseparator2, TRUE, TRUE, 0);

  label11 = gtk_label_new (_("Click the 'Finish' button to start GtkTiEmu."));
  gtk_widget_set_name (label11, "label11");
  gtk_widget_ref (label11);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "label11", label11,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label11);
  gtk_box_pack_start (GTK_BOX (vbox1), label11, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label11), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label11), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label11), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label11), 15, 5);

  dialog_action_area3 = GTK_DIALOG (step3_dbox)->action_area;
  gtk_widget_set_name (dialog_action_area3, "dialog_action_area3");
  gtk_object_set_data (GTK_OBJECT (step3_dbox), "dialog_action_area3", dialog_action_area3);
  gtk_widget_show (dialog_action_area3);
  gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area3), 10);

  hbuttonbox3 = gtk_hbutton_box_new ();
  gtk_widget_set_name (hbuttonbox3, "hbuttonbox3");
  gtk_widget_ref (hbuttonbox3);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "hbuttonbox3", hbuttonbox3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbuttonbox3);
  gtk_box_pack_start (GTK_BOX (dialog_action_area3), hbuttonbox3, TRUE, TRUE, 0);

  button4 = gtk_button_new ();
  gtk_widget_set_name (button4, "button4");
  gtk_widget_ref (button4);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "button4", button4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button4);
  gtk_container_add (GTK_CONTAINER (hbuttonbox3), button4);
  GTK_WIDGET_SET_FLAGS (button4, GTK_CAN_DEFAULT);
  gtk_widget_add_accelerator (button4, "clicked", accel_group,
                              GDK_Return, 0,
                              GTK_ACCEL_VISIBLE);

  hbox4 = gtk_hbox_new (FALSE, 0);
  gtk_widget_set_name (hbox4, "hbox4");
  gtk_widget_ref (hbox4);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "hbox4", hbox4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox4);
  gtk_container_add (GTK_CONTAINER (button4), hbox4);

  pixmap4 = create_pixmap (step3_dbox, "yes.xpm");
  gtk_widget_set_name (pixmap4, "pixmap4");
  gtk_widget_ref (pixmap4);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "pixmap4", pixmap4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pixmap4);
  gtk_box_pack_start (GTK_BOX (hbox4), pixmap4, TRUE, FALSE, 0);

  label7 = gtk_label_new ("");
  label7_key = gtk_label_parse_uline (GTK_LABEL (label7),
                                   _("< _Back"));
  gtk_widget_set_name (label7, "label7");
  gtk_widget_ref (label7);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "label7", label7,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label7);
  gtk_box_pack_start (GTK_BOX (hbox4), label7, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label7), 5, 0);

  button5 = gtk_button_new ();
  gtk_widget_set_name (button5, "button5");
  gtk_widget_ref (button5);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "button5", button5,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button5);
  gtk_container_add (GTK_CONTAINER (hbuttonbox3), button5);
  GTK_WIDGET_SET_FLAGS (button5, GTK_CAN_DEFAULT);

  hbox5 = gtk_hbox_new (FALSE, 0);
  gtk_widget_set_name (hbox5, "hbox5");
  gtk_widget_ref (hbox5);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "hbox5", hbox5,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox5);
  gtk_container_add (GTK_CONTAINER (button5), hbox5);

  pixmap5 = create_pixmap (step3_dbox, "yes.xpm");
  gtk_widget_set_name (pixmap5, "pixmap5");
  gtk_widget_ref (pixmap5);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "pixmap5", pixmap5,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pixmap5);
  gtk_box_pack_start (GTK_BOX (hbox5), pixmap5, TRUE, FALSE, 0);

  label8 = gtk_label_new ("");
  label8_key = gtk_label_parse_uline (GTK_LABEL (label8),
                                   _("_Finish"));
  gtk_widget_set_name (label8, "label8");
  gtk_widget_ref (label8);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "label8", label8,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label8);
  gtk_box_pack_start (GTK_BOX (hbox5), label8, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label8), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label8), 5, 0);

  button6 = gtk_button_new ();
  gtk_widget_set_name (button6, "button6");
  gtk_widget_ref (button6);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "button6", button6,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button6);
  gtk_container_add (GTK_CONTAINER (hbuttonbox3), button6);
  GTK_WIDGET_SET_FLAGS (button6, GTK_CAN_DEFAULT);
  gtk_widget_add_accelerator (button6, "clicked", accel_group,
                              GDK_Escape, 0,
                              GTK_ACCEL_VISIBLE);

  hbox6 = gtk_hbox_new (FALSE, 0);
  gtk_widget_set_name (hbox6, "hbox6");
  gtk_widget_ref (hbox6);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "hbox6", hbox6,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox6);
  gtk_container_add (GTK_CONTAINER (button6), hbox6);

  pixmap6 = create_pixmap (step3_dbox, "no.xpm");
  gtk_widget_set_name (pixmap6, "pixmap6");
  gtk_widget_ref (pixmap6);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "pixmap6", pixmap6,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pixmap6);
  gtk_box_pack_start (GTK_BOX (hbox6), pixmap6, TRUE, FALSE, 0);

  label9 = gtk_label_new ("");
  label9_key = gtk_label_parse_uline (GTK_LABEL (label9),
                                   _("_Cancel"));
  gtk_widget_set_name (label9, "label9");
  gtk_widget_ref (label9);
  gtk_object_set_data_full (GTK_OBJECT (step3_dbox), "label9", label9,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label9);
  gtk_box_pack_start (GTK_BOX (hbox6), label9, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label9), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label9), 5, 0);

  gtk_signal_connect (GTK_OBJECT (button4), "clicked",
                      GTK_SIGNAL_FUNC (step3_b1_button_clicked),
                      step3_dbox);
  gtk_signal_connect (GTK_OBJECT (button5), "clicked",
                      GTK_SIGNAL_FUNC (step3_b2_button_clicked),
                      step3_dbox);
  gtk_signal_connect (GTK_OBJECT (button6), "clicked",
                      GTK_SIGNAL_FUNC (step3_b3_button_clicked),
                      step3_dbox);

  gtk_widget_add_accelerator (button4, "clicked", accel_group,
                              label7_key, GDK_MOD1_MASK, (GtkAccelFlags) 0);
  gtk_widget_add_accelerator (button5, "clicked", accel_group,
                              label8_key, GDK_MOD1_MASK, (GtkAccelFlags) 0);
  gtk_widget_add_accelerator (button6, "clicked", accel_group,
                              label9_key, GDK_MOD1_MASK, (GtkAccelFlags) 0);

  gtk_window_add_accel_group (GTK_WINDOW (step3_dbox), accel_group);

  return step3_dbox;
}
Exemplo n.º 17
0
GtkWidget*
create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *table1;
  GtkWidget *label1;
  GtkWidget *label2;
  GtkWidget *label3;
  GtkWidget *label4;
  GtkWidget *checkbuttonHQ;
  GtkWidget *checkbuttonShowMask;
  GtkObject *spinbuttonThresh_adj;
  GtkWidget *spinbuttonThresh;
  GtkObject *spinbuttonStrength_adj;
  GtkWidget *spinbuttonStrength;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;

  dialog1 = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog1), _("MSmooth settings"));

  dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
  gtk_widget_show (dialog_vbox1);

  table1 = gtk_table_new (4, 2, FALSE);
  gtk_widget_show (table1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), table1, TRUE, TRUE, 0);

  label1 = gtk_label_new (_("High Quality :"));
  gtk_widget_show (label1);
  gtk_table_attach (GTK_TABLE (table1), label1, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);

  label2 = gtk_label_new (_("Show Mask :"));
  gtk_widget_show (label2);
  gtk_table_attach (GTK_TABLE (table1), label2, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);

  label3 = gtk_label_new (_("Threshold :"));
  gtk_widget_show (label3);
  gtk_table_attach (GTK_TABLE (table1), label3, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5);

  label4 = gtk_label_new (_("Filter Strength :"));
  gtk_widget_show (label4);
  gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);

  checkbuttonHQ = gtk_check_button_new_with_mnemonic ("");
  gtk_widget_show (checkbuttonHQ);
  gtk_table_attach (GTK_TABLE (table1), checkbuttonHQ, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  checkbuttonShowMask = gtk_check_button_new_with_mnemonic ("");
  gtk_widget_show (checkbuttonShowMask);
  gtk_table_attach (GTK_TABLE (table1), checkbuttonShowMask, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  spinbuttonThresh_adj = gtk_adjustment_new (1, 0, 100, 1, 10, 10);
  spinbuttonThresh = gtk_spin_button_new (GTK_ADJUSTMENT (spinbuttonThresh_adj), 1, 0);
  gtk_widget_show (spinbuttonThresh);
  gtk_table_attach (GTK_TABLE (table1), spinbuttonThresh, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbuttonThresh), TRUE);

  spinbuttonStrength_adj = gtk_adjustment_new (1, 0, 100, 1, 10, 10);
  spinbuttonStrength = gtk_spin_button_new (GTK_ADJUSTMENT (spinbuttonStrength_adj), 1, 0);
  gtk_widget_show (spinbuttonStrength);
  gtk_table_attach (GTK_TABLE (table1), spinbuttonStrength, 1, 2, 3, 4,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbuttonStrength), TRUE);

  dialog_action_area1 = GTK_DIALOG (dialog1)->action_area;
  gtk_widget_show (dialog_action_area1);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);

  cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (cancelbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);

  okbutton1 = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (okbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog1, "dialog1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_vbox1, "dialog_vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, table1, "table1");
  GLADE_HOOKUP_OBJECT (dialog1, label1, "label1");
  GLADE_HOOKUP_OBJECT (dialog1, label2, "label2");
  GLADE_HOOKUP_OBJECT (dialog1, label3, "label3");
  GLADE_HOOKUP_OBJECT (dialog1, label4, "label4");
  GLADE_HOOKUP_OBJECT (dialog1, checkbuttonHQ, "checkbuttonHQ");
  GLADE_HOOKUP_OBJECT (dialog1, checkbuttonShowMask, "checkbuttonShowMask");
  GLADE_HOOKUP_OBJECT (dialog1, spinbuttonThresh, "spinbuttonThresh");
  GLADE_HOOKUP_OBJECT (dialog1, spinbuttonStrength, "spinbuttonStrength");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1");
  GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1");

  return dialog1;
}
Exemplo n.º 18
0
GtkWidget*
create_wait_dbox (void)
{
  GtkWidget *wait_dbox;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox2;
  GtkWidget *label2;
  GtkWidget *hseparator3;
  GtkWidget *label16;
  GtkWidget *dialog_action_area1;
  GtkWidget *hbuttonbox1;
  GtkWidget *button1;
  GtkWidget *hbox1;
  GtkWidget *pixmap1;
  guint label1_key;
  GtkWidget *label1;
  GtkAccelGroup *accel_group;

  accel_group = gtk_accel_group_new ();

  wait_dbox = gtk_dialog_new ();
  gtk_widget_set_name (wait_dbox, "wait_dbox");
  gtk_object_set_data (GTK_OBJECT (wait_dbox), "wait_dbox", wait_dbox);
  gtk_window_set_title (GTK_WINDOW (wait_dbox), _("Information"));
  gtk_window_set_modal (GTK_WINDOW (wait_dbox), TRUE);
  gtk_window_set_policy (GTK_WINDOW (wait_dbox), TRUE, TRUE, FALSE);

  dialog_vbox1 = GTK_DIALOG (wait_dbox)->vbox;
  gtk_widget_set_name (dialog_vbox1, "dialog_vbox1");
  gtk_object_set_data (GTK_OBJECT (wait_dbox), "dialog_vbox1", dialog_vbox1);
  gtk_widget_show (dialog_vbox1);

  vbox2 = gtk_vbox_new (FALSE, 0);
  gtk_widget_set_name (vbox2, "vbox2");
  gtk_widget_ref (vbox2);
  gtk_object_set_data_full (GTK_OBJECT (wait_dbox), "vbox2", vbox2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox2);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox2, FALSE, FALSE, 0);

  label2 = gtk_label_new (_("The FLASH upgrade you have\nselected is being to be converted\ninto a 2MB ROM image.\nPlease wait..."));
  gtk_widget_set_name (label2, "label2");
  gtk_widget_ref (label2);
  gtk_object_set_data_full (GTK_OBJECT (wait_dbox), "label2", label2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label2);
  gtk_box_pack_start (GTK_BOX (vbox2), label2, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label2), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label2), 5, 5);

  hseparator3 = gtk_hseparator_new ();
  gtk_widget_set_name (hseparator3, "hseparator3");
  gtk_widget_ref (hseparator3);
  gtk_object_set_data_full (GTK_OBJECT (wait_dbox), "hseparator3", hseparator3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hseparator3);
  gtk_box_pack_start (GTK_BOX (vbox2), hseparator3, TRUE, TRUE, 0);

  label16 = gtk_label_new (_("Note also that the converted ROM\nimage will not have a boot block."));
  gtk_widget_set_name (label16, "label16");
  gtk_widget_ref (label16);
  gtk_object_set_data_full (GTK_OBJECT (wait_dbox), "label16", label16,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label16);
  gtk_box_pack_start (GTK_BOX (vbox2), label16, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label16), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label16), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label16), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label16), 5, 5);

  dialog_action_area1 = GTK_DIALOG (wait_dbox)->action_area;
  gtk_widget_set_name (dialog_action_area1, "dialog_action_area1");
  gtk_object_set_data (GTK_OBJECT (wait_dbox), "dialog_action_area1", dialog_action_area1);
  gtk_widget_show (dialog_action_area1);
  gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area1), 10);

  hbuttonbox1 = gtk_hbutton_box_new ();
  gtk_widget_set_name (hbuttonbox1, "hbuttonbox1");
  gtk_widget_ref (hbuttonbox1);
  gtk_object_set_data_full (GTK_OBJECT (wait_dbox), "hbuttonbox1", hbuttonbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbuttonbox1);
  gtk_box_pack_start (GTK_BOX (dialog_action_area1), hbuttonbox1, TRUE, TRUE, 0);

  button1 = gtk_button_new ();
  gtk_widget_set_name (button1, "button1");
  gtk_widget_ref (button1);
  gtk_object_set_data_full (GTK_OBJECT (wait_dbox), "button1", button1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button1);
  gtk_container_add (GTK_CONTAINER (hbuttonbox1), button1);
  GTK_WIDGET_SET_FLAGS (button1, GTK_CAN_DEFAULT);
  gtk_widget_add_accelerator (button1, "clicked", accel_group,
                              GDK_Return, 0,
                              GTK_ACCEL_VISIBLE);
  gtk_widget_add_accelerator (button1, "clicked", accel_group,
                              GDK_Escape, 0,
                              GTK_ACCEL_VISIBLE);

  hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_set_name (hbox1, "hbox1");
  gtk_widget_ref (hbox1);
  gtk_object_set_data_full (GTK_OBJECT (wait_dbox), "hbox1", hbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox1);
  gtk_container_add (GTK_CONTAINER (button1), hbox1);

  pixmap1 = create_pixmap (wait_dbox, "yes.xpm");
  gtk_widget_set_name (pixmap1, "pixmap1");
  gtk_widget_ref (pixmap1);
  gtk_object_set_data_full (GTK_OBJECT (wait_dbox), "pixmap1", pixmap1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pixmap1);
  gtk_box_pack_start (GTK_BOX (hbox1), pixmap1, TRUE, FALSE, 0);

  label1 = gtk_label_new ("");
  label1_key = gtk_label_parse_uline (GTK_LABEL (label1),
                                   _("_OK"));
  gtk_widget_set_name (label1, "label1");
  gtk_widget_ref (label1);
  gtk_object_set_data_full (GTK_OBJECT (wait_dbox), "label1", label1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, TRUE, 0);
  gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label1), 5, 0);

  gtk_signal_connect (GTK_OBJECT (button1), "clicked",
                      GTK_SIGNAL_FUNC (wait_ok_button_clicked),
                      wait_dbox);

  gtk_widget_add_accelerator (button1, "clicked", accel_group,
                              label1_key, GDK_MOD1_MASK, (GtkAccelFlags) 0);

  gtk_window_add_accel_group (GTK_WINDOW (wait_dbox), accel_group);

  return wait_dbox;
}
GtkWidget	*create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox1;
  GtkWidget *label1;
  GtkWidget *optionmenu1;
  GtkWidget *menu2;
 // GtkWidget *_48_khz1;
  GtkWidget *label2;
  GtkWidget *optionmenu2;
  GtkWidget *menu1;
  GtkWidget *stereo1;
  GtkWidget *joint_stereo1;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;

  dialog1 = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog1), _("Audio settings"));

  dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
  gtk_widget_show (dialog_vbox1);

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

  label1 = gtk_label_new (_("Bitrate"));
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (vbox1), label1, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);

  optionmenu1 = gtk_option_menu_new ();
  gtk_widget_show (optionmenu1);
  gtk_box_pack_start (GTK_BOX (vbox1), optionmenu1, FALSE, FALSE, 0);

  menu2 = gtk_menu_new ();
/*
  _48_khz1 = gtk_menu_item_new_with_mnemonic (_("48 khz"));
  gtk_widget_show (_48_khz1);
  gtk_container_add (GTK_CONTAINER (menu2), _48_khz1);
  

*/
	GtkWidget **fq=(GtkWidget **)malloc(sizeof(GtkWidget *)*NB_BITRATE);
	char string[100];
	for(unsigned int i=0;i<NB_BITRATE;i++)
	{
		sprintf(string,"%d kbits",BTR[i]);
		fq[i]=gtk_menu_item_new_with_mnemonic (string);
		gtk_widget_show (fq[i]);
		gtk_container_add (GTK_CONTAINER (menu2), fq[i]);
	}
  gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu1), menu2);
  
  label2 = gtk_label_new (_("Mode (ignored for mono)"));
  gtk_widget_show (label2);
  gtk_box_pack_start (GTK_BOX (vbox1), label2, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);

  optionmenu2 = gtk_option_menu_new ();
  gtk_widget_show (optionmenu2);
  gtk_box_pack_start (GTK_BOX (vbox1), optionmenu2, FALSE, FALSE, 0);

  menu1 = gtk_menu_new ();

  stereo1 = gtk_menu_item_new_with_mnemonic (_("Stereo"));
  gtk_widget_show (stereo1);
  gtk_container_add (GTK_CONTAINER (menu1), stereo1);

  joint_stereo1 = gtk_menu_item_new_with_mnemonic (_("Joint Stereo"));
  gtk_widget_show (joint_stereo1);
  gtk_container_add (GTK_CONTAINER (menu1), joint_stereo1);

  gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu2), menu1);

  dialog_action_area1 = GTK_DIALOG (dialog1)->action_area;
  gtk_widget_show (dialog_action_area1);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);

  cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (cancelbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);

  okbutton1 = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (okbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog1, "dialog1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_vbox1, "dialog_vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, label1, "label1");
  GLADE_HOOKUP_OBJECT (dialog1, optionmenu1, "optionmenu1");
  GLADE_HOOKUP_OBJECT (dialog1, menu2, "menu2");
  //GLADE_HOOKUP_OBJECT (dialog1, _48_khz1, "_48_khz1");
  GLADE_HOOKUP_OBJECT (dialog1, label2, "label2");
  GLADE_HOOKUP_OBJECT (dialog1, optionmenu2, "optionmenu2");
  GLADE_HOOKUP_OBJECT (dialog1, menu1, "menu1");
  GLADE_HOOKUP_OBJECT (dialog1, stereo1, "stereo1");
  GLADE_HOOKUP_OBJECT (dialog1, joint_stereo1, "joint_stereo1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1");
  GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1");

  return dialog1;
}
Exemplo n.º 20
0
void
gimp_tools_restore (Gimp *gimp)
{
  GimpContainer *gimp_list;
  gchar         *filename;
  GList         *list;
  GError        *error = NULL;

  g_return_if_fail (GIMP_IS_GIMP (gimp));

  gimp_list = gimp_list_new (GIMP_TYPE_TOOL_INFO, FALSE);

  filename = gimp_personal_rc_file ("toolrc");

  if (gimp->be_verbose)
    g_print ("Parsing '%s'\n", gimp_filename_to_utf8 (filename));

  if (gimp_config_deserialize_file (GIMP_CONFIG (gimp_list), filename,
                                    NULL, NULL))
    {
      gint n = gimp_container_get_n_children (gimp->tool_info_list);
      gint i;

      gimp_list_reverse (GIMP_LIST (gimp_list));

      for (list = GIMP_LIST (gimp_list)->list, i = 0;
           list;
           list = g_list_next (list), i++)
        {
          const gchar *name;
          GimpObject  *object;

          name = gimp_object_get_name (list->data);

          object = gimp_container_get_child_by_name (gimp->tool_info_list,
                                                     name);

          if (object)
            {
              g_object_set (object,
                            "visible", GIMP_TOOL_INFO (list->data)->visible,
                            NULL);

              gimp_container_reorder (gimp->tool_info_list,
                                      object, MIN (i, n - 1));
            }
        }
    }

  g_free (filename);
  g_object_unref (gimp_list);

  for (list = gimp_get_tool_info_iter (gimp);
       list;
       list = g_list_next (list))
    {
      GimpToolInfo *tool_info = GIMP_TOOL_INFO (list->data);

      /*  get default values from prefs (see bug #120832)  */
      gimp_tool_options_reset (tool_info->tool_options);
    }

  if (! gimp_contexts_load (gimp, &error))
    {
      gimp_message_literal (gimp, NULL, GIMP_MESSAGE_WARNING, error->message);
      g_clear_error (&error);
    }

  for (list = gimp_get_tool_info_iter (gimp);
       list;
       list = g_list_next (list))
    {
      GimpToolInfo           *tool_info = GIMP_TOOL_INFO (list->data);
      GimpToolOptionsGUIFunc  options_gui_func;
      GtkWidget              *options_gui;

      /*  copy all context properties except those the tool actually
       *  uses, because the subsequent deserialize() on the tool
       *  options will only set the properties that were set to
       *  non-default values at the time of saving, and we want to
       *  keep these default values as if they have been saved.
       * (see bug #541586).
       */
      gimp_context_copy_properties (gimp_get_user_context (gimp),
                                    GIMP_CONTEXT (tool_info->tool_options),
                                    GIMP_CONTEXT_ALL_PROPS_MASK &~
                                    (tool_info->context_props |
                                     GIMP_CONTEXT_TOOL_MASK   |
                                     GIMP_CONTEXT_PAINT_INFO_MASK));

      gimp_tool_options_deserialize (tool_info->tool_options, NULL);

      options_gui_func = g_object_get_data (G_OBJECT (tool_info),
                                            "gimp-tool-options-gui-func");

      if (options_gui_func)
        {
          options_gui = (* options_gui_func) (tool_info->tool_options);
        }
      else
        {
          GtkWidget *label;

          options_gui = gimp_tool_options_gui (tool_info->tool_options);

          label = gtk_label_new (_("This tool has\nno options."));
          gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
          gimp_label_set_attributes (GTK_LABEL (label),
                                     PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
                                     -1);
          gtk_box_pack_start (GTK_BOX (options_gui), label, FALSE, FALSE, 6);
          gtk_widget_show (label);
        }

      gimp_tools_set_tool_options_gui (tool_info->tool_options,
                                       g_object_ref_sink (options_gui));
    }
}
/**
 * Show a dialog to set wether we want the rows/columns lines,
 * the background color, the titles...
 *
 * \param operation	GtkPrintOperation responsible of this job.
 * \param null		Not used.
 *
 * \return		A newly allocated widget.
 */
GtkWidget * print_transactions_list_layout_config ( GtkPrintOperation * operation,
						    gpointer null )
{
    GtkWidget *check_button;
    GtkWidget *label;
    GtkWidget *hbox;
    GtkWidget *entry;
    GtkWidget *font_button_transactions;
    GtkWidget *font_button_title;
    gchar *fontname_transactions;
    gchar *fontname_title;
    GtkWidget *init_date_entry;
    GtkWidget *final_date_entry;
    GtkWidget *vbox;
    GtkWidget *paddingbox;
    GtkSizeGroup * size_group;

    size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);

    vbox = gtk_vbox_new ( FALSE, 6 );
    gtk_container_set_border_width ( GTK_CONTAINER(vbox), 12 );
    paddingbox = new_paddingbox_with_title ( vbox, FALSE, _("Layout") );

    /* set up the title and dates, this is never saved, so ask each time */
    /* title line */
    hbox = gtk_hbox_new (FALSE, 10);
    gtk_box_pack_start (GTK_BOX (paddingbox),
			hbox,
			FALSE, FALSE, 0);

    entry = gsb_automem_entry_new (&title_string, NULL, NULL);

    check_button = gsb_autofunc_checkbutton_new (_("Print a title: "),
						 gsb_data_print_config_get_draw_title (),
						 G_CALLBACK (sens_desensitive_pointeur), entry,
						 G_CALLBACK (gsb_data_print_config_set_draw_title), 0);
    gtk_box_pack_start (GTK_BOX (hbox),
			check_button,
			FALSE, FALSE, 0);

    gtk_widget_set_sensitive (entry, gsb_data_print_config_get_draw_title ());
    gtk_box_pack_start (GTK_BOX (hbox),
			entry,
			TRUE, TRUE, 0);

    /* add the dates interval */
    hbox = gtk_hbox_new (FALSE, 10);

    check_button = gsb_autofunc_checkbutton_new (_("Select dates interval: "),
						 gsb_data_print_config_get_draw_interval_dates (),
						 G_CALLBACK (sens_desensitive_pointeur), hbox,
						 G_CALLBACK (gsb_data_print_config_set_draw_interval_dates), 0);
    gtk_box_pack_start (GTK_BOX (paddingbox),
			check_button,
			FALSE, FALSE, 0);


    gtk_box_pack_start (GTK_BOX (paddingbox),
			hbox,
			FALSE, FALSE, 0);

    label = gtk_label_new (_("Initial date : "));
    gtk_box_pack_start (GTK_BOX (hbox),
			label,
			FALSE, FALSE, 0);
    
    init_date_entry = gsb_calendar_entry_new (FALSE);
    if (draw_initial_date)
	gsb_calendar_entry_set_date (init_date_entry, draw_initial_date);
    gtk_box_pack_start (GTK_BOX (hbox),
			init_date_entry,
			FALSE, FALSE, 0);

    label = gtk_label_new (_("Final date : "));
    gtk_box_pack_start (GTK_BOX (hbox),
			label,
			FALSE, FALSE, 0);
    
    final_date_entry = gsb_calendar_entry_new (FALSE);
    if (draw_final_date)
	gsb_calendar_entry_set_date (final_date_entry, draw_final_date);
    gtk_box_pack_start (GTK_BOX (hbox),
			final_date_entry,
			FALSE, FALSE, 0);

    g_object_set_data ( G_OBJECT ( operation ), "init_date_entry", init_date_entry );
    g_object_set_data ( G_OBJECT ( operation ), "final_date_entry", final_date_entry );

    check_button = gsb_autofunc_checkbutton_new (_("Use value date"),
						 gsb_data_print_config_get_draw_dates_are_value_dates (),
						 NULL, NULL,
						 G_CALLBACK (gsb_data_print_config_set_draw_dates_are_value_dates), 0);
    gtk_box_pack_start (GTK_BOX (hbox),
			check_button,
			FALSE, FALSE, 0);

    if (!gsb_data_print_config_get_draw_interval_dates ())
	gtk_widget_set_sensitive (hbox, FALSE);

    /* set up all the checkbuttons */
    check_button = gsb_autofunc_checkbutton_new (_("Draw the lines between transactions"),
						 gsb_data_print_config_get_draw_lines (),
						 NULL, NULL,
						 G_CALLBACK (gsb_data_print_config_set_draw_lines), 0);
    gtk_box_pack_start (GTK_BOX (paddingbox),
			check_button,
			FALSE, FALSE, 0);
    check_button = gsb_autofunc_checkbutton_new (_("Draw the lines between the columns"),
						 gsb_data_print_config_get_draw_column (),
						 NULL, NULL,
						 G_CALLBACK (gsb_data_print_config_set_draw_column), 0);
    gtk_box_pack_start (GTK_BOX (paddingbox),
			check_button,
			FALSE, FALSE, 0);

    check_button = gsb_autofunc_checkbutton_new (_("Fill the background as the transactions list"),
						 gsb_data_print_config_get_draw_background (),
						 NULL, NULL,
						 G_CALLBACK (gsb_data_print_config_set_draw_background), 0);
    gtk_box_pack_start (GTK_BOX (paddingbox),
			check_button,
			FALSE, FALSE, 0);

    check_button = gsb_autofunc_checkbutton_new (_("Print the archives lines"),
						 gsb_data_print_config_get_draw_archives (),
						 NULL, NULL,
						 G_CALLBACK (gsb_data_print_config_set_draw_archives), 0);
    gtk_box_pack_start (GTK_BOX (paddingbox),
			check_button,
			FALSE, FALSE, 0);

    check_button = gsb_autofunc_checkbutton_new (_("Print the names of the columns"),
						 gsb_data_print_config_get_draw_columns_name (),
						 NULL, NULL,
						 G_CALLBACK (gsb_data_print_config_set_draw_columns_name), 0);
    gtk_box_pack_start (GTK_BOX (paddingbox),
			check_button,
			FALSE, FALSE, 0);

    paddingbox = new_paddingbox_with_title ( vbox, FALSE, _("Fonts") );

    /* set up the font of the transactions,
     * by default use the font of the lists */
    hbox = gtk_hbox_new (FALSE, 12);
    gtk_box_pack_start (GTK_BOX (paddingbox),
			hbox,
			FALSE, FALSE, 0);

    label = gtk_label_new (_("Transactions font"));
    gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT );
    gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0.5);
    gtk_size_group_add_widget ( size_group, label );
    gtk_box_pack_start (GTK_BOX (hbox),
			label,
			FALSE, FALSE, 0);

    fontname_transactions = pango_font_description_to_string (gsb_data_print_config_get_font_transactions ());
    font_button_transactions = gtk_font_button_new_with_font ( fontname_transactions );
    gtk_font_button_set_use_font ( GTK_FONT_BUTTON(font_button_transactions), TRUE );
    gtk_font_button_set_use_size ( GTK_FONT_BUTTON(font_button_transactions), TRUE );
    gtk_font_button_set_title ( GTK_FONT_BUTTON(font_button_transactions), _("Choosing font") );
    gtk_box_pack_start (GTK_BOX (hbox),
			font_button_transactions,
			TRUE, TRUE, 0);

    /* set up the font for the title */
    hbox = gtk_hbox_new (FALSE, 12);
    gtk_box_pack_start (GTK_BOX (paddingbox),
			hbox,
			FALSE, FALSE, 0);

    label = gtk_label_new (_("Title font"));
    gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT );
    gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0.5);
    gtk_size_group_add_widget ( size_group, label );
    gtk_box_pack_start (GTK_BOX (hbox),
			label,
			FALSE, FALSE, 0);

    fontname_title = pango_font_description_to_string (gsb_data_print_config_get_font_title ());
    font_button_title =  gtk_font_button_new_with_font ( fontname_title );
    gtk_font_button_set_use_font ( GTK_FONT_BUTTON(font_button_title), TRUE );
    gtk_font_button_set_use_size ( GTK_FONT_BUTTON(font_button_title), TRUE );
    gtk_font_button_set_title ( GTK_FONT_BUTTON(font_button_title), _("Choosing font") );
    gtk_box_pack_start (GTK_BOX (hbox),
			font_button_title,
			TRUE, TRUE, 0);


    /* save what we have done in all cases, so if we cancel and come back, our values
     * come back */
    gsb_data_print_config_set_font_transaction (pango_font_description_from_string (fontname_transactions));
    gsb_data_print_config_set_font_title (pango_font_description_from_string (fontname_title));
    draw_initial_date = gsb_calendar_entry_get_date (init_date_entry);
    draw_final_date = gsb_calendar_entry_get_date (final_date_entry);

    g_object_set_data ( G_OBJECT(operation), "font_transaction_button", font_button_transactions );
    g_object_set_data ( G_OBJECT(operation), "font_title_button", font_button_title );

    gtk_widget_show_all ( vbox );

    return vbox;
}
Exemplo n.º 22
0
GtkWidget *pref_start_grep()
{
	GtkWidget *vbox;
	GtkWidget *hbox;
	GtkWidget *label;
	GtkObject *adj;
	GtkWidget *table;
	GtkAttachOptions xoption=0, yoption=0;

	LOG(LOG_DEBUG, "IN : pref_start_grep()");

	vbox = gtk_vbox_new(FALSE,10);
	gtk_widget_set_size_request(vbox, 300, 200);

	xoption = GTK_SHRINK|GTK_FILL;
	yoption = GTK_SHRINK;

	table = gtk_table_new(3, 4, FALSE);
	gtk_box_pack_start (GTK_BOX(vbox)
			    , table,FALSE, FALSE, 0);


	hbox = gtk_hbox_new(FALSE,10);
	gtk_container_set_border_width(GTK_CONTAINER(hbox), 2);
	gtk_table_attach(GTK_TABLE(table), hbox, 0, 1, 1, 2,
			 xoption, yoption, 10, 10);	

	label = gtk_label_new(_("Additional Lines To Display"));
	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
	gtk_box_pack_start (GTK_BOX(hbox), 
			    label, FALSE, FALSE, 0);

	adj = gtk_adjustment_new( 5, //value
				  0, // lower
				  1000, //upper
                                  1, // step increment
                                  10,// page_increment,
                                  0.0);
	spin_additional_line = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 1.0, 0);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_additional_line), additional_lines);
	gtk_widget_set_size_request(spin_additional_line,60,20);
	gtk_table_attach(GTK_TABLE(table), spin_additional_line, 1, 2, 1, 2,
			 xoption, yoption, 10, 10);	

	gtk_widget_set_tooltip_text(spin_additional_line, 
			     _("In addition to matched line, additional lines will be shown in contents."));

	hbox = gtk_hbox_new(FALSE,10);
	gtk_container_set_border_width(GTK_CONTAINER(hbox), 2);
	gtk_table_attach(GTK_TABLE(table), hbox, 0, 1, 2, 3,
			 xoption, yoption, 10, 10);	

	label = gtk_label_new(_("Additional Chars To Display"));
	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
	gtk_box_pack_start (GTK_BOX(hbox), 
			    label, FALSE, FALSE, 0);
	

	adj = gtk_adjustment_new( 16, //value
				  1, // lower
				  100, //upper
                                  1, // step increment
                                  10,// page_increment,
                                  0.0);
	spin_additional_char = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 1.0, 0);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_additional_char), additional_chars);
	gtk_widget_set_size_request(spin_additional_char,60,20);
	gtk_table_attach(GTK_TABLE(table), spin_additional_char, 1, 2, 2, 3,
			 xoption, yoption, 10, 10);	

	gtk_widget_set_tooltip_text(spin_additional_char, 
			     _("When matched line is too long, several characters around keyword will be shown in heading."));



	LOG(LOG_DEBUG, "OUT : pref_start_grep()");

	return(vbox);

}
Exemplo n.º 23
0
bool wxStaticText::Create(wxWindow *parent,
                          wxWindowID id,
                          const wxString &label,
                          const wxPoint &pos,
                          const wxSize &size,
                          long style,
                          const wxString &name )
{
    m_needParent = TRUE;

    if (!PreCreation( parent, pos, size ) ||
        !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
    {
        wxFAIL_MSG( wxT("wxStaticText creation failed") );
        return FALSE;
    }

    // notice that we call the base class version which will just remove the
    // '&' characters from the string, but not set the label's text to it
    // because the label is not yet created and because SetLabel() has a side
    // effect of changing the control size which might not be desirable
    wxControl::SetLabel(label);
    m_widget = gtk_label_new( wxGTK_CONV( m_label ) );
    
    GtkJustification justify;
    if ( style & wxALIGN_CENTER )
      justify = GTK_JUSTIFY_CENTER;
    else if ( style & wxALIGN_RIGHT )
      justify = GTK_JUSTIFY_RIGHT;
    else // wxALIGN_LEFT is 0
      justify = GTK_JUSTIFY_LEFT;
    gtk_label_set_justify(GTK_LABEL(m_widget), justify);

    // GTK_JUSTIFY_LEFT is 0, RIGHT 1 and CENTER 2
    static const float labelAlignments[] = { 0.0, 1.0, 0.5 };
    gtk_misc_set_alignment(GTK_MISC(m_widget), labelAlignments[justify], 0.0);

        gtk_label_set_line_wrap( GTK_LABEL(m_widget), TRUE );

    m_parent->DoAddChild( this );

    PostCreation(size);
    
    // the bug below only happens with GTK 2
#ifdef __WXGTK20__
    if ( justify != GTK_JUSTIFY_LEFT )
    {
        // if we let GTK call wxgtk_window_size_request_callback the label
        // always shrinks to its minimal size for some reason and so no
        // alignment except the default left doesn't work (in fact it does,
        // but you don't see it)
        gtk_signal_disconnect_by_func
        (
            GTK_OBJECT(m_widget),
            GTK_SIGNAL_FUNC(wxgtk_window_size_request_callback),
            (gpointer) this
        );
    }
#endif // __WXGTK20__

    return TRUE;
}
Exemplo n.º 24
0
/**
 * Creates the "Titles & Addresses" tab.  This tab is mainly composed
 * of text entries and editables.
 *
 * \returns A newly allocated vbox
 */
GtkWidget *onglet_display_addresses ( void )
{
    GtkWidget *hbox, *vbox_pref, *scrolled_window, *label;
    GtkWidget *paddingbox;
    GtkWidget *entry;
    GtkWidget *radio, *radiogroup;

    vbox_pref = new_vbox_with_title_and_icon ( _("Addresses & titles"),
					       "addresses.png" );

    /* Account file title */
    paddingbox = new_paddingbox_with_title ( vbox_pref, FALSE, _("Titles") );

    /* It first creates the entry of title */
    entry = gsb_automem_entry_new ( &titre_fichier,
                        ( GCallback ) update_homepage_title, NULL );

    /* Choice of title type */
    hbox = gtk_hbox_new ( FALSE, 6 );
    gtk_box_pack_start ( GTK_BOX ( paddingbox ), hbox, FALSE, FALSE, 0);

    radiogroup = gtk_radio_button_new_with_label ( NULL, _("Accounts file title") );
    g_object_set_data ( G_OBJECT ( radiogroup ), "display", GINT_TO_POINTER ( GSB_ACCOUNTS_TITLE ) );
    if ( conf.display_grisbi_title == GSB_ACCOUNTS_TITLE )
        gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( radiogroup ), TRUE );
    g_signal_connect ( G_OBJECT ( radiogroup ), 
                        "toggled",
                        G_CALLBACK ( change_grisbi_title_type ), 
                        entry );
    gtk_box_pack_start ( GTK_BOX( hbox ), radiogroup, FALSE, FALSE, 0 );

    radio = gtk_radio_button_new_with_label_from_widget ( 
                        GTK_RADIO_BUTTON ( radiogroup ),
                        _("Account owner name") );
    g_object_set_data ( G_OBJECT ( radio ), "display", GINT_TO_POINTER ( GSB_ACCOUNT_HOLDER ) );
    if ( conf.display_grisbi_title == GSB_ACCOUNT_HOLDER )
            gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( radio ), TRUE );
    g_signal_connect ( G_OBJECT ( radio ), 
                    "toggled",
                    G_CALLBACK ( change_grisbi_title_type ), 
                    entry );
    gtk_box_pack_start ( GTK_BOX( hbox ), radio, FALSE, FALSE, 0 );

    radio = gtk_radio_button_new_with_label_from_widget ( 
                        GTK_RADIO_BUTTON ( radiogroup ),
                        _("Filename") );
    g_object_set_data ( G_OBJECT ( radio ), "display", GINT_TO_POINTER ( GSB_ACCOUNTS_FILE ) );
    if ( conf.display_grisbi_title == GSB_ACCOUNTS_FILE )
        gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( radio ), TRUE );
    g_signal_connect ( G_OBJECT ( radio ), 
                        "toggled",
                        G_CALLBACK ( change_grisbi_title_type ), 
                        entry );
    gtk_box_pack_start ( GTK_BOX( hbox ), radio, FALSE, FALSE, 0 );

    hbox = gtk_hbox_new ( FALSE, 6 );
    gtk_box_pack_start ( GTK_BOX ( paddingbox ), hbox,
			 FALSE, FALSE, 0);

    label = gtk_label_new ( _("Accounts file title: ") );
    gtk_box_pack_start ( GTK_BOX ( hbox ), label,
			 FALSE, FALSE, 0);

    if ( conf.display_grisbi_title == GSB_ACCOUNTS_TITLE )
        gtk_widget_set_sensitive ( entry, TRUE);
    else
        gtk_widget_set_sensitive ( entry, FALSE);
    gtk_box_pack_start ( GTK_BOX ( hbox ), entry,
			 TRUE, TRUE, 0);

    /* Addresses */
    paddingbox = new_paddingbox_with_title ( vbox_pref, FALSE,
					     _("Addresses") );

    /* Common address */
    label = gtk_label_new ( _("Common address: ") );
    gtk_misc_set_alignment (GTK_MISC (label), 0, 1);
    gtk_label_set_justify ( GTK_LABEL(label), GTK_JUSTIFY_RIGHT );
    gtk_box_pack_start ( GTK_BOX ( paddingbox ), label,
			 TRUE, TRUE, 0);
    scrolled_window = gtk_scrolled_window_new ( NULL, NULL );
    gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW ( scrolled_window ),
				     GTK_POLICY_AUTOMATIC,
				     GTK_POLICY_AUTOMATIC );
    gtk_box_pack_start ( GTK_BOX ( paddingbox ), scrolled_window,
			 FALSE, FALSE, 0);
    gtk_scrolled_window_set_shadow_type ( GTK_SCROLLED_WINDOW(scrolled_window),
					  GTK_SHADOW_IN );
    entry = gsb_automem_textview_new ( &adresse_commune, NULL, NULL );
    gtk_container_add ( GTK_CONTAINER ( scrolled_window ),
			entry );

    /* Secondary address */
    /** \note This is not implemented yet */
    label = gtk_label_new ( _("Secondary address: ") );
    gtk_misc_set_alignment (GTK_MISC (label), 0, 1);
    gtk_label_set_justify ( GTK_LABEL(label), GTK_JUSTIFY_RIGHT );
    gtk_box_pack_start ( GTK_BOX ( paddingbox ), label,
			 TRUE, TRUE, 0);
    scrolled_window = gtk_scrolled_window_new ( NULL, NULL );
    gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW ( scrolled_window ),
				     GTK_POLICY_AUTOMATIC,
				     GTK_POLICY_AUTOMATIC );
    gtk_scrolled_window_set_shadow_type ( GTK_SCROLLED_WINDOW(scrolled_window),
					  GTK_SHADOW_IN );
    gtk_box_pack_start ( GTK_BOX ( paddingbox ), scrolled_window,
			 FALSE, FALSE, 0);
    entry = gsb_automem_textview_new ( &adresse_secondaire, NULL, NULL );
    gtk_container_add ( GTK_CONTAINER ( scrolled_window ),
			entry );

    if ( !gsb_data_account_get_accounts_amount () )
	gtk_widget_set_sensitive ( vbox_pref, FALSE );

    return ( vbox_pref );
}
Exemplo n.º 25
0
/* Public VpnPasswordDialog methods */
GtkWidget *
vpn_password_dialog_new (const char *title,
                         const char *message,
                         const char *password)
{
	GtkWidget *dialog;
	VpnPasswordDialogPrivate *priv;
	GtkLabel *message_label;
	GtkWidget *hbox;
	GtkWidget *vbox;
	GtkWidget *main_vbox;
	GtkWidget *dialog_icon;
	GtkBox *content, *action_area;

	dialog = gtk_widget_new (VPN_TYPE_PASSWORD_DIALOG, NULL);
	if (!dialog)
		return NULL;
	priv = VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);

	gtk_window_set_title (GTK_WINDOW (dialog), title);
	gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);

	gtk_dialog_add_buttons (GTK_DIALOG (dialog),
	                        _("_Cancel"), GTK_RESPONSE_CANCEL,
	                        _("_OK"), GTK_RESPONSE_OK,
	                        NULL);
	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);

	content = GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
	action_area = GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog)));

	/* Setup the dialog */
#if !GTK_CHECK_VERSION (2,22,0)
	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
#endif
	gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
	gtk_box_set_spacing (content, 2); /* 2 * 5 + 2 = 12 */
	gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
	gtk_box_set_spacing (action_area, 6);

 	gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
	gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);

	g_signal_connect (dialog, "show",
	                  G_CALLBACK (dialog_show_callback),
	                  dialog);
	g_signal_connect (dialog, "close",
	                  G_CALLBACK (dialog_close_callback),
	                  dialog);

	/* The table that holds the captions */
	priv->table_alignment = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);

	priv->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);

	priv->table = gtk_grid_new ();
	gtk_grid_set_column_spacing (GTK_GRID (priv->table), 12);
	gtk_grid_set_row_spacing (GTK_GRID (priv->table), 6);

	gtk_container_add (GTK_CONTAINER (priv->table_alignment), priv->table);

	priv->password_entry = gtk_entry_new ();
	priv->password_entry_secondary = gtk_entry_new ();

	priv->show_passwords_checkbox = gtk_check_button_new_with_mnemonic (_("Sh_ow passwords"));

	/* We want to hold on to these during the table rearrangement */
	g_object_ref_sink (priv->password_entry);
	g_object_ref_sink (priv->password_entry_secondary);
	g_object_ref_sink (priv->show_passwords_checkbox);
	
	gtk_entry_set_visibility (GTK_ENTRY (priv->password_entry), FALSE);
	gtk_entry_set_visibility (GTK_ENTRY (priv->password_entry_secondary), FALSE);

	g_signal_connect_swapped (priv->password_entry, "activate",
	                          G_CALLBACK (gtk_window_activate_default),
	                          dialog);
	g_signal_connect_swapped (priv->password_entry_secondary, "activate",
	                          G_CALLBACK (gtk_window_activate_default),
	                          dialog);

	g_signal_connect (priv->show_passwords_checkbox, "toggled",
	                  G_CALLBACK (show_passwords_toggled_cb),
	                  dialog);

	add_table_rows (VPN_PASSWORD_DIALOG (dialog));

	/* Adds some eye-candy to the dialog */
#if GTK_CHECK_VERSION (3,1,6)
	hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
#else
	hbox = gtk_hbox_new (FALSE, 12);
#endif
 	gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
	dialog_icon = gtk_image_new_from_icon_name (_("dialog-password"), GTK_ICON_SIZE_DIALOG);
	gtk_misc_set_alignment (GTK_MISC (dialog_icon), 0.5, 0.0);
	gtk_box_pack_start (GTK_BOX (hbox), dialog_icon, FALSE, FALSE, 0);

	/* Fills the vbox */
#if GTK_CHECK_VERSION (3,1,6)
	main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
#else
	main_vbox = gtk_vbox_new (FALSE, 18);
#endif

	if (message) {
		message_label = GTK_LABEL (gtk_label_new (message));
		gtk_label_set_justify (message_label, GTK_JUSTIFY_LEFT);
		gtk_label_set_line_wrap (message_label, TRUE);
		gtk_label_set_max_width_chars (message_label, 35);
		gtk_size_group_add_widget (priv->group, GTK_WIDGET (message_label));
		gtk_box_pack_start (GTK_BOX (main_vbox), GTK_WIDGET (message_label), FALSE, FALSE, 0);
		gtk_size_group_add_widget (priv->group, priv->table_alignment);
	}

#if GTK_CHECK_VERSION (3,1,6)
	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
#else
	vbox = gtk_vbox_new (FALSE, 6);
#endif
	gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX (vbox), priv->table_alignment, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX (hbox), main_vbox, FALSE, FALSE, 0);
	gtk_box_pack_start (content, hbox, FALSE, FALSE, 0);
	gtk_widget_show_all (GTK_WIDGET (content));

	vpn_password_dialog_set_password (VPN_PASSWORD_DIALOG (dialog), password);
	
	return GTK_WIDGET (dialog);
}
Exemplo n.º 26
0
static gboolean
fontsel_directories_dialog (GtkWidget    *parent,
                            const gchar  *message,
			    gchar       **path)
{
  GtkWidget *dialog;
  GtkWidget *path_editor;
  GtkWidget *label;
  gchar     *new_path = NULL;

  dialog = gimp_dialog_new (_("Configure Font Search Path"), "font-path",
                            parent,
                            GTK_DIALOG_DESTROY_WITH_PARENT,
                            gimp_standard_help_func, "plug-in-freetype",

			    GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
			    GTK_STOCK_OK,     GTK_RESPONSE_OK,

			    NULL);

  if (message)
    {
      label = gtk_label_new (message);
      gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
      gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
      gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
      gtk_misc_set_padding (GTK_MISC (label), 12, 12);
      gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
			  label, FALSE, FALSE, 0);
    }

  path_editor = gimp_path_editor_new (_("Choose a folder"), *path);
  gtk_container_set_border_width (GTK_CONTAINER (path_editor), 12);
  gtk_widget_set_usize (GTK_WIDGET (path_editor), -1, 240);
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
		      path_editor, TRUE, TRUE, 0);

  label = gtk_label_new (_("You may specify multiple folders here."));
  gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
  gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label), 12, 12);
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
		      label, FALSE, FALSE, 0);

  gtk_widget_show_all (dialog);

  if (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK)
    new_path = gimp_path_editor_get_path (GIMP_PATH_EDITOR (path_editor));

  gtk_widget_destroy (dialog);

  if (new_path && (!*path ||
                   strcmp (*path, new_path) != 0 ||
                   strcmp (*path, DEFAULT_FONTPATH) == 0))
    {
      g_free (*path);
      *path = new_path;
      gimp_gimprc_set (FONTPATH_TOKEN, *path);

      return TRUE;
    }

  return FALSE;
}
Exemplo n.º 27
0
static GtkWidget *create_dialog(void)
{
    GtkWidget *dialog;
    GtkWidget *header_image;
    GtkWidget *header_label;
    GtkWidget *label_info;
    GtkWidget *codename_label;
    GtkWidget *builddate_label;
    GtkWidget *url_button;
    GtkWidget *cop_label;
    GtkWidget *label;
    GtkWidget *license_textview;
    GtkWidget *notebook;
    GtkWidget *box;
    GtkWidget *credits_scrollwin;
    GtkWidget *table;
    GtkWidget *license_scrollwin;
    GtkWidget *info_box;
    GtkWidget *header_hbox;
    GtkWidget *header_eventbox;
    GdkPixbuf *icon;
    GtkTextBuffer* tb;
    gchar *license_text = NULL;
    gchar buffer[512];
    gchar buffer2[128];
    guint i, row = 0;

    dialog = gtk_dialog_new();

    /* configure dialog */
    gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(main_widgets.window));
    gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ON_PARENT);
    gtk_window_set_title(GTK_WINDOW(dialog), _("About Geany"));
    gtk_widget_set_name(dialog, "GeanyDialog");
    gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
    gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_CLOSE);
    gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
    g_signal_connect(dialog, "key-press-event", G_CALLBACK(gb_on_key_pressed), NULL);

    /* create header */
    header_eventbox = gtk_event_box_new();
    gtk_widget_show(header_eventbox);
    header_hbox = gtk_hbox_new(FALSE, 12);
    gtk_container_set_border_width(GTK_CONTAINER(header_hbox), 4);
    gtk_widget_show(header_hbox);
    gtk_container_add(GTK_CONTAINER(header_eventbox), header_hbox);
    header_image = gtk_image_new();
    gtk_box_pack_start(GTK_BOX(header_hbox), header_image, FALSE, FALSE, 0);
    header_label = gtk_label_new(NULL);
    gtk_label_set_use_markup(GTK_LABEL(header_label), TRUE);
    /* print the subversion revision generated by ./configure if it is available */
    g_snprintf(buffer, sizeof(buffer), HEADER, main_get_version_string());
    gtk_label_set_markup(GTK_LABEL(header_label), buffer);
    gtk_widget_show(header_label);
    gtk_box_pack_start(GTK_BOX(header_hbox), header_label, FALSE, FALSE, 0);
    header_eventbox_style_set(header_eventbox);
    header_label_style_set(header_label);
    g_signal_connect_after(header_eventbox, "style-set", G_CALLBACK(header_eventbox_style_set), NULL);
    g_signal_connect_after(header_label, "style-set", G_CALLBACK(header_label_style_set), NULL);
    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), header_eventbox, FALSE, FALSE, 0);

    /* set image */
    icon = ui_new_pixbuf_from_inline(GEANY_IMAGE_LOGO);
    gtk_image_set_from_pixbuf(GTK_IMAGE(header_image), icon);
    gtk_window_set_icon(GTK_WINDOW(dialog), icon);
    g_object_unref(icon);	/* free our reference */

    /* create notebook */
    notebook = gtk_notebook_new();
    gtk_widget_show(notebook);
    gtk_container_set_border_width(GTK_CONTAINER(notebook), 2);
    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), notebook, TRUE, TRUE, 0);

    /* create "Info" tab */
    info_box = gtk_vbox_new(FALSE, 0);
    gtk_container_set_border_width(GTK_CONTAINER(info_box), 6);
    gtk_widget_show(info_box);

    label_info = gtk_label_new(NULL);
    gtk_label_set_justify(GTK_LABEL(label_info), GTK_JUSTIFY_CENTER);
    gtk_label_set_selectable(GTK_LABEL(label_info), TRUE);
    gtk_label_set_use_markup(GTK_LABEL(label_info), TRUE);
    g_snprintf(buffer, sizeof(buffer), INFO, _("A fast and lightweight IDE"));
    gtk_label_set_markup(GTK_LABEL(label_info), buffer);
    gtk_misc_set_padding(GTK_MISC(label_info), 2, 11);
    gtk_widget_show(label_info);
    gtk_box_pack_start(GTK_BOX(info_box), label_info, FALSE, FALSE, 0);

    /* Codename label */
    codename_label = gtk_label_new(NULL);
    gtk_label_set_justify(GTK_LABEL(codename_label), GTK_JUSTIFY_CENTER);
    gtk_label_set_selectable(GTK_LABEL(codename_label), TRUE);
    gtk_label_set_use_markup(GTK_LABEL(codename_label), TRUE);
    gtk_label_set_markup(GTK_LABEL(codename_label), CODENAME);
    gtk_misc_set_padding(GTK_MISC(codename_label), 2, 8);
    gtk_widget_show(codename_label);
    gtk_box_pack_start(GTK_BOX(info_box), codename_label, FALSE, FALSE, 0);

    /* build date label */
    builddate_label = gtk_label_new(NULL);
    gtk_label_set_justify(GTK_LABEL(builddate_label), GTK_JUSTIFY_CENTER);
    gtk_label_set_selectable(GTK_LABEL(builddate_label), TRUE);
    gtk_label_set_use_markup(GTK_LABEL(builddate_label), TRUE);
    g_snprintf(buffer2, sizeof(buffer2), _("(built on or after %s)"), __DATE__);
    g_snprintf(buffer, sizeof(buffer), BUILDDATE, buffer2);
    gtk_label_set_markup(GTK_LABEL(builddate_label), buffer);
    gtk_misc_set_padding(GTK_MISC(builddate_label), 2, 2);
    gtk_widget_show(builddate_label);
    gtk_box_pack_start(GTK_BOX(info_box), builddate_label, FALSE, FALSE, 0);

    box = gtk_hbutton_box_new();
    url_button = gtk_button_new();
    gtk_button_set_relief(GTK_BUTTON(url_button), GTK_RELIEF_NONE);
    g_signal_connect(url_button, "clicked", G_CALLBACK(homepage_clicked), (gpointer)GEANY_HOMEPAGE);
    label = gtk_label_new(NULL);
    gtk_label_set_text(GTK_LABEL(label), GEANY_HOMEPAGE);
    gtk_widget_show(label);
    gtk_container_add(GTK_CONTAINER(url_button), label);
    gtk_widget_show(url_button);
    gtk_box_pack_start(GTK_BOX(box), url_button, FALSE, FALSE, 0);
    gtk_widget_show(box);
    gtk_box_pack_start(GTK_BOX(info_box), box, FALSE, FALSE, 10);

    /* copyright label */
    cop_label = gtk_label_new(NULL);
    gtk_label_set_justify(GTK_LABEL(cop_label), GTK_JUSTIFY_CENTER);
    gtk_label_set_selectable(GTK_LABEL(cop_label), FALSE);
    gtk_label_set_use_markup(GTK_LABEL(cop_label), TRUE);
    gtk_label_set_markup(GTK_LABEL(cop_label), COPYRIGHT);
    gtk_misc_set_padding(GTK_MISC(cop_label), 2, 10);
    gtk_widget_show(cop_label);
    gtk_box_pack_start(GTK_BOX(info_box), cop_label, FALSE, FALSE, 0);
    /*gtk_container_add(GTK_CONTAINER(info_box), cop_label); */

    label = gtk_label_new(_("Info"));
    gtk_widget_show(label);
    gtk_widget_show_all(info_box);
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), info_box, label);

    /* create "Credits" tab */
    credits_scrollwin = gtk_scrolled_window_new(NULL, NULL);
    gtk_container_set_border_width(GTK_CONTAINER(credits_scrollwin), 10);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(credits_scrollwin),
                                   GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);

    table = gtk_table_new(23 + translators_len + prev_translators_len, 3, FALSE);
    gtk_table_set_col_spacings(GTK_TABLE(table), 10);

    row = 0;
    g_snprintf(buffer, sizeof(buffer),
               "<span size=\"larger\" weight=\"bold\">%s</span>", _("Developers"));
    label = gtk_label_new(buffer);
    gtk_table_attach(GTK_TABLE(table), label, 0, 2, row, row + 1, GTK_FILL, 0, 0, 5);
    gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
    gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
    row++;

    g_snprintf(buffer, sizeof(buffer), "Colomban Wendling - %s", _("maintainer"));
    ROW(buffer, row, 0, 0, 0, 1);
    row++;
    ROW("&lt;[email protected]&gt;", row, 0, 0, 0, 1);
    row++;
    ROW("", row, 0, 0, 0, 0);
    row++;

    g_snprintf(buffer, sizeof(buffer), "Nick Treleaven - %s", _("developer"));
    ROW(buffer, row, 0, 0, 0, 1);
    row++;
    ROW("&lt;[email protected]&gt;", row, 0, 0, 0, 1);
    row++;
    ROW("", row, 0, 0, 0, 0);
    row++;

    g_snprintf(buffer, sizeof(buffer), "Enrico Tröger - %s", _("developer"));
    ROW(buffer, row, 0, 0, 0, 1);
    row++;
    ROW("&lt;[email protected]&gt;", row, 0, 0, 0, 1);
    row++;
    ROW("", row, 0, 0, 0, 0);
    row++;

    g_snprintf(buffer, sizeof(buffer), "Matthew Brush - %s", _("developer"));
    ROW(buffer, row, 0, 0, 0, 1);
    row++;
    ROW("&lt;[email protected]&gt;", row, 0, 0, 0, 1);
    row++;
    ROW("", row, 0, 0, 0, 0);
    row++;

    g_snprintf(buffer, sizeof(buffer), "Frank Lanitz - %s", _("translation maintainer"));
    ROW(buffer, row, 0, 0, 0, 1);
    row++;
    ROW("&lt;[email protected]&gt;", row, 0, 0, 0, 1);
    row++;
    ROW("", row, 0, 0, 0, 0);
    row++;

    g_snprintf(buffer, sizeof(buffer),
               "<span size=\"larger\" weight=\"bold\">%s</span>", _("Translators"));
    label = gtk_label_new(buffer);
    gtk_table_attach(GTK_TABLE(table), label, 0, 2, row, row + 1,
                     (GtkAttachOptions) (GTK_FILL),
                     (GtkAttachOptions) (0), 0, 5);
    gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
    gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
    row++;

    for (i = 0; i < translators_len; i++)
    {
        ROW(translators[i][0], row, 0, 1, 4, 0);
        ROW(translators[i][1], row, 1, 0, 4, 0);
        row++;
    }

    ROW("", row, 0, 0, 0, 0);
    row++;

    g_snprintf(buffer, sizeof(buffer),
               "<span size=\"larger\" weight=\"bold\">%s</span>", _("Previous Translators"));
    label = gtk_label_new(buffer);
    gtk_table_attach(GTK_TABLE(table), label, 0, 2, row, row + 1,
                     (GtkAttachOptions) (GTK_FILL),
                     (GtkAttachOptions) (0), 0, 5);
    gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
    gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
    row++;

    for (i = 0; i < prev_translators_len; i++)
    {
        ROW(prev_translators[i][0], row, 0, 1, 4, 0);
        ROW(prev_translators[i][1], row, 1, 0, 4, 0);
        row++;
    }


    ROW("", row, 0, 0, 0, 0);
    row++;

    g_snprintf(buffer, sizeof(buffer),
               "<span size=\"larger\" weight=\"bold\">%s</span>", _("Contributors"));
    label = gtk_label_new(buffer);
    gtk_table_attach(GTK_TABLE(table), label, 0, 2, row, row + 1,
                     (GtkAttachOptions) (GTK_FILL),
                     (GtkAttachOptions) (0), 0, 5);
    gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
    gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
    row++;

    g_snprintf(buffer, sizeof(buffer),
               _("Some of the many contributors (for a more detailed list, see the file %s):"),
#ifdef G_OS_WIN32
               "Thanks.txt"
#else
               "THANKS"
#endif
              );
    label = geany_wrap_label_new(buffer);
    gtk_table_attach(GTK_TABLE(table), label, 0, 2, row, row + 1,
                     (GtkAttachOptions) (GTK_FILL),
                     (GtkAttachOptions) (0), 0, 5);
    gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
    gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
    row++;

    label = geany_wrap_label_new(contributors);
    gtk_table_attach(GTK_TABLE(table), label, 0, 2, row, row + 1,
                     (GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
                     (GtkAttachOptions) (0), 0, 5);
    gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
    gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
    row++;

    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(credits_scrollwin), table);
    gtk_viewport_set_shadow_type(GTK_VIEWPORT(gtk_widget_get_parent(table)), GTK_SHADOW_NONE);
    gtk_widget_show_all(table);
    label = gtk_label_new(_("Credits"));
    gtk_widget_show(label);
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), credits_scrollwin, label);

    /* create "License" tab */
    license_scrollwin = gtk_scrolled_window_new(NULL, NULL);
    gtk_container_set_border_width(GTK_CONTAINER(license_scrollwin), 6);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(license_scrollwin),
                                   GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
    license_textview = gtk_text_view_new();
    gtk_text_view_set_editable(GTK_TEXT_VIEW(license_textview), FALSE);
    gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(license_textview), FALSE);
    gtk_widget_show(license_textview);
    gtk_container_add(GTK_CONTAINER(license_scrollwin), license_textview);
    label = gtk_label_new(_("License"));
    gtk_widget_show(label);

    g_snprintf(buffer, sizeof(buffer), "%s" G_DIR_SEPARATOR_S "GPL-2", app->datadir);

    g_file_get_contents(buffer, &license_text, NULL, NULL);
    if (license_text == NULL)
    {
        license_text = g_strdup(
                           _("License text could not be found, please visit http://www.gnu.org/licenses/gpl-2.0.txt to view it online."));
    }
    tb = gtk_text_view_get_buffer(GTK_TEXT_VIEW(license_textview));
    gtk_text_buffer_set_text(tb, license_text, -1);

    g_free(license_text);

    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), license_scrollwin, label);

    gtk_widget_show_all(dialog);
    return dialog;
}
Exemplo n.º 28
0
/*
 * Sets the properties of the widget. This is used for both applying the
 * properties changed in the property editor, and also for loading.
 */
void
gb_label_set_standard_properties (GtkWidget * widget,
				  GbWidgetSetArgData * data,
				  const char *label_p,
				  const char *use_underline_p,
				  const char *use_markup_p,
				  const char *justify_p,
				  const char *wrap_p,
				  const char *selectable_p,
				  const char *xalign_p,
				  const char *yalign_p,
				  const char *xpad_p,
				  const char *ypad_p,
				  const char *focus_target_p)
{
  gchar *label, *justify, *accel_target;
  const gchar *label_text;
  gfloat xalign, yalign;
  gint xpad, ypad, i;
  gboolean wrap, selectable, set_alignment = FALSE, set_padding = FALSE;
  gboolean use_underline, use_markup;
  gboolean set_label = FALSE;

  use_underline = gb_widget_input_bool (data, use_underline_p);
  if (data->apply)
    gtk_label_set_use_underline (GTK_LABEL (widget), use_underline);

  use_markup = gb_widget_input_bool (data, use_markup_p);
  if (data->apply)
    {
      set_label = TRUE;
      gtk_object_set_data (GTK_OBJECT (widget), use_markup_p,
			   GINT_TO_POINTER (use_markup));
    }

  label = gb_widget_input_text (data, label_p);
  if (data->apply)
    {
      set_label = TRUE;
      label_text = label;
    }
  else
    {
      label_text = gtk_label_get_label (GTK_LABEL (widget));
    }

  if (set_label)
    {
      gboolean prev_use_markup;

      use_markup = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
							 use_markup_p));

      /* We try to parse the markup here, and if it isn't valid, we will
	 turn use_markup off and show it as plain text. */
      if (use_markup)
	{
	  GError *error = NULL;
	  gunichar accel_marker = 0;
	  PangoAttrList *attrs = NULL;
	  gunichar accel_char = 0;
	  gchar *text = NULL;

	  if (gtk_label_get_use_underline (GTK_LABEL (widget)))
	    accel_marker = '_';

	  /* We check it is valid markup. If it isn't we will set "use_markup"
	     to FALSE. Note that we don't need attrs, text, or accel_char but
	     it seems to crash otherwise. */
	  if (!pango_parse_markup (label_text, -1, accel_marker, &attrs, &text,
				   &accel_char, &error))
	    {
	      use_markup = FALSE;
	      g_error_free (error);
	    }
	  else
	    {
	      if (attrs)
		pango_attr_list_unref (attrs);
	      g_free (text);
	    }
	}

      /* If we are turning use_markup off, we want to do that before setting
	 the text. If we are turning it on, we want to do it after. */
      prev_use_markup = gtk_label_get_use_markup (GTK_LABEL (widget));
      if (!use_markup && prev_use_markup)
	gtk_label_set_use_markup (GTK_LABEL (widget), use_markup);

      gtk_label_set_label (GTK_LABEL (widget), label_text);

      if (use_markup && !prev_use_markup)
	gtk_label_set_use_markup (GTK_LABEL (widget), use_markup);
    }

  if (data->action == GB_APPLYING)
    g_free (label);

  justify = gb_widget_input_choice (data, justify_p);
  if (data->apply)
    {
      for (i = 0; i < sizeof (GbJustifyValues) / sizeof (GbJustifyValues[0]);
	   i++)
	{
	  if (!strcmp (justify, GbJustifyChoices[i])
	      || !strcmp (justify, GbJustifySymbols[i]))
	    {
	      gtk_label_set_justify (GTK_LABEL (widget), GbJustifyValues[i]);
	      break;
	    }
	}
    }

  wrap = gb_widget_input_bool (data, wrap_p);
  if (data->apply)
    gtk_label_set_line_wrap (GTK_LABEL (widget), wrap);

  selectable = gb_widget_input_bool (data, selectable_p);
  if (data->apply)
    gtk_label_set_selectable (GTK_LABEL (widget), selectable);

  xalign = gb_widget_input_float (data, xalign_p);
  if (data->apply)
    set_alignment = TRUE;
  else
    xalign = GTK_MISC (widget)->xalign;

  yalign = gb_widget_input_float (data, yalign_p);
  if (data->apply)
    set_alignment = TRUE;
  else
    yalign = GTK_MISC (widget)->yalign;

  if (set_alignment)
    gtk_misc_set_alignment (GTK_MISC (widget), xalign, yalign);

  xpad = gb_widget_input_int (data, xpad_p);
  if (data->apply)
    set_padding = TRUE;
  else
    xpad = GTK_MISC (widget)->xpad;

  ypad = gb_widget_input_int (data, ypad_p);
  if (data->apply)
    set_padding = TRUE;
  else
    ypad = GTK_MISC (widget)->ypad;

  if (set_padding)
    gtk_misc_set_padding (GTK_MISC (widget), xpad, ypad);

  /* Labels not in buttons may have a focus target widget. */
  accel_target = gb_widget_input_combo (data, focus_target_p);
  if (data->apply)
    {
      if (!gb_label_find_mnemonic_widget (widget))
	{
	  if (!strcmp (accel_target, _("Auto")))
	    accel_target = NULL;

	  gtk_object_set_data_full (GTK_OBJECT (widget), focus_target_p,
				    g_strdup (accel_target),
				    accel_target ? g_free : NULL);
	}
    }
}
Exemplo n.º 29
0
GtkWidget *
create_main_window(void)
{
  GtkWidget *notebook1;
  GtkWidget *frame3;
  GtkWidget *frame4;
  GtkWidget *hbox1;
  GtkWidget *vbox1;
  GtkWidget *scrolledwindow1;
  GtkWidget *node_label1;
  GtkWidget *node_label2;
  GtkWidget *node_label3;
  GtkWidget *node_label4;
  GtkWidget *node_label7;
  GtkWidget *node_label8;
  GtkWidget *node_label9;
  GtkWidget *mid_frame;
  GtkWidget *mpr_frame;
  GtkWidget *hna_frame;
  GtkWidget *mid_scrolledwindow;
  GtkWidget *mpr_scrolledwindow;
  GtkWidget *hna_scrolledwindow;
  GtkWidget *Main;
  GtkWidget *label_routes;
  GtkWidget *hbox2;
  GtkWidget *frame2;
  GtkWidget *scrolledwindow4;
  GtkWidget *label17;
  GtkWidget *label18;
  GtkWidget *label19;
  GtkWidget *scrolledwindow3;
  GtkWidget *label13;
  GtkWidget *label14;
  GtkWidget *label15;
  GtkWidget *label16;
  GtkWidget *label_packets;
  //GtkWidget *empty_notebook_page2;
  GtkWidget *label3;
  GtkWidget *net_vbox;
  GtkWidget *pack_vbox;
  GtkWidget *pack_disp_vbox;
  GtkWidget *disp_frame;
  GtkWidget *route_frame;
  GtkWidget *route_stats_frame;
  GtkWidget *route_scrolledwindow;
  GtkWidget *route_label1;
  GtkWidget *route_label2;
  GtkWidget *route_label3;
  GtkWidget *route_label4;
  GtkWidget *route_hbox1;

  GtkWidget *traffic_label;

  GtkWidget *settings_label;
  GtkWidget *settings_hbox1;

  GtkWidget *about_hbox1;
  GtkWidget *about_label;

  GtkWidget *empty1;

  GdkPixmap *unik_logo_gdk;
  GtkWidget *unik_logo;

  /*
   *The main window
   */

  main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_object_set_data(GTK_OBJECT(main_window), "main_window", main_window);
  gtk_window_set_title(GTK_WINDOW(main_window), (olsrd_version));
  gtk_window_set_default_size(GTK_WINDOW(main_window), 600, 550);
  gtk_signal_connect(GTK_OBJECT(main_window), "destroy", GTK_SIGNAL_FUNC(gui_shutdown),
                     //GTK_SIGNAL_FUNC(gtk_main_quit),
                     NULL);
  gtk_window_set_position(GTK_WINDOW(main_window), GTK_WIN_POS_CENTER); /* Position window in center */
  gtk_window_set_policy(GTK_WINDOW(main_window), FALSE, TRUE, TRUE);    /* No user-resizing */

  /*
   *Initialize the pixmaps
   */
  unik_logo_gdk =
    gdk_pixmap_colormap_create_from_xpm_d(NULL, gtk_widget_get_colormap(main_window), &mask, NULL, (gchar **) logo_xpm);

  unik_logo = gtk_pixmap_new(unik_logo_gdk, mask);

  /*
   *The notebook
   */

  notebook1 = gtk_notebook_new();
  gtk_widget_ref(notebook1);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "notebook1", notebook1, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(notebook1);
  gtk_container_add(GTK_CONTAINER(main_window), notebook1);

  /*
   *The first vbox
   */
  vbox1 = gtk_vbox_new(FALSE, 0);
  gtk_widget_ref(vbox1);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "vbox1", vbox1, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(vbox1);
  //gtk_box_pack_start (GTK_BOX (hbox1), vbox1, TRUE, TRUE, 1);
  gtk_container_add(GTK_CONTAINER(notebook1), vbox1);

  /*
   *The nodes frame
   */
  frame3 = gtk_frame_new("Registered nodes:");
  gtk_widget_ref(frame3);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "frame3", frame3, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(frame3);
  gtk_box_pack_start(GTK_BOX(vbox1), frame3, TRUE, TRUE, 0);
  gtk_widget_set_size_request(frame3, -1, 300);
  gtk_container_set_border_width(GTK_CONTAINER(frame3), 1);

  /*
   *The scrolled window to contain the node list
   */

  scrolledwindow1 = gtk_scrolled_window_new(NULL, NULL);
  gtk_widget_ref(scrolledwindow1);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "scrolledwindow1", scrolledwindow1, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(scrolledwindow1);
  gtk_container_add(GTK_CONTAINER(frame3), scrolledwindow1);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow1), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);

  //gtk_box_pack_start (GTK_BOX (frame3), scrolledwindow1, TRUE, TRUE, 0);
  //gtk_widget_set_usize (scrolledwindow1, -2, 332);

  /*
   *The node list
   */

  node_list = gtk_clist_new(7);
  gtk_widget_ref(node_list);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "node_list", node_list, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(node_list);
  gtk_container_add(GTK_CONTAINER(scrolledwindow1), node_list);
  gtk_clist_set_column_width(GTK_CLIST(node_list), 0, 150);     /* IP */
  //gtk_clist_set_column_justification(GTK_CLIST(node_list), 0, GTK_JUSTIFY_CENTER);
  gtk_clist_set_column_width(GTK_CLIST(node_list), 1, 150);     /* gateway */
  //gtk_clist_set_column_justification(GTK_CLIST(node_list), 1, GTK_JUSTIFY_CENTER);
  gtk_clist_set_column_width(GTK_CLIST(node_list), 2, 50);      /* hopcount */
  gtk_clist_set_column_justification(GTK_CLIST(node_list), 2, GTK_JUSTIFY_CENTER);
  gtk_clist_set_column_width(GTK_CLIST(node_list), 3, 80);      /* dev */
  gtk_clist_set_column_justification(GTK_CLIST(node_list), 3, GTK_JUSTIFY_CENTER);

  gtk_clist_set_column_width(GTK_CLIST(node_list), 4, 70);      /* timer */
  gtk_clist_set_column_justification(GTK_CLIST(node_list), 4, GTK_JUSTIFY_CENTER);
  //gtk_clist_set_column_width (GTK_CLIST (node_list), 7, 100); /* last about */
  //gtk_clist_set_column_justification(GTK_CLIST(node_list), 7, GTK_JUSTIFY_CENTER);

  gtk_clist_set_column_width(GTK_CLIST(node_list), 5, 40);      /* MID */
  gtk_clist_set_column_justification(GTK_CLIST(node_list), 5, GTK_JUSTIFY_CENTER);
  gtk_clist_set_column_width(GTK_CLIST(node_list), 6, 40);      /* HNA */
  gtk_clist_set_column_justification(GTK_CLIST(node_list), 6, GTK_JUSTIFY_CENTER);

  gtk_clist_column_titles_show(GTK_CLIST(node_list));

  /*
   *Row selection callback
   */
  gtk_signal_connect(GTK_OBJECT(node_list), "select_row", GTK_SIGNAL_FUNC(selection_made), NULL);

  /*
   *Column selection callback
   */
  gtk_signal_connect(GTK_OBJECT(node_list), "click_column", GTK_SIGNAL_FUNC(column_clicked_callback), NULL);

  node_label1 = gtk_label_new("Dest");
  gtk_widget_ref(node_label1);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "IP", node_label1, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(node_label1);
  gtk_clist_set_column_widget(GTK_CLIST(node_list), 0, node_label1);

  node_label2 = gtk_label_new("Gateway");
  gtk_widget_ref(node_label2);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "hops", node_label2, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(node_label2);
  gtk_clist_set_column_widget(GTK_CLIST(node_list), 1, node_label2);

  node_label3 = gtk_label_new("Metric");
  gtk_widget_ref(node_label3);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "info", node_label3, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(node_label3);
  gtk_clist_set_column_widget(GTK_CLIST(node_list), 2, node_label3);

  node_label4 = gtk_label_new("Device");
  gtk_widget_ref(node_label4);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "Device", node_label4, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(node_label4);
  gtk_clist_set_column_widget(GTK_CLIST(node_list), 3, node_label4);

  node_label7 = gtk_label_new("Timer");
  gtk_widget_ref(node_label7);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "LMF", node_label7, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(node_label7);
  gtk_clist_set_column_widget(GTK_CLIST(node_list), 4, node_label7);

  /*
     node_label8 = gtk_label_new ("LMA");
     gtk_widget_ref (node_label8);
     gtk_object_set_data_full (GTK_OBJECT (main_window), "LMA", node_label8,
     (GtkDestroyNotify) gtk_widget_unref);
     gtk_widget_show (node_label8);
     gtk_clist_set_column_widget (GTK_CLIST (node_list), 7, node_label8);
   */

  node_label8 = gtk_label_new("MID");
  gtk_widget_ref(node_label8);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "MID", node_label8, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(node_label8);
  gtk_clist_set_column_widget(GTK_CLIST(node_list), 5, node_label8);

  node_label9 = gtk_label_new("HNA");
  gtk_widget_ref(node_label9);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "HNA", node_label9, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(node_label9);
  gtk_clist_set_column_widget(GTK_CLIST(node_list), 6, node_label9);

  gtk_clist_column_titles_active(GTK_CLIST(node_list));

  gtk_widget_show_now(node_list);

  /*
   *Row selection callback
   */
  gtk_signal_connect(GTK_OBJECT(node_list), "select_row", GTK_SIGNAL_FUNC(node_selection), NULL);

  /*
   *The first hbox
   */
  hbox1 = gtk_hbox_new(FALSE, 0);
  gtk_widget_ref(hbox1);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "hbox1", hbox1, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(hbox1);
  gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 0);
  //gtk_container_add (GTK_CONTAINER (notebook1), hbox1);
  gtk_container_set_border_width(GTK_CONTAINER(hbox1), 4);
  gtk_widget_set_size_request(hbox1, -1, 200);

  /*
   *The net-info frame
   */
  frame4 = gtk_frame_new("Info:");
  gtk_widget_ref(frame4);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "frame4", frame4, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(frame4);
  gtk_box_pack_start(GTK_BOX(hbox1), frame4, TRUE, TRUE, 0);
  //gtk_widget_set_size_request(frame4, 200, -1);
  gtk_container_set_border_width(GTK_CONTAINER(frame4), 1);

  /*
   *The net-info hbox
   */
  net_vbox = gtk_vbox_new(FALSE, 0);
  gtk_widget_ref(net_vbox);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "net_vbox", net_vbox, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(net_vbox);
  gtk_container_add(GTK_CONTAINER(frame4), net_vbox);

  /*
   *The net-info label field
   */
  net_label = gtk_label_new(NULL);
  gtk_widget_ref(net_label);
  gtk_misc_set_alignment((GtkMisc *) net_label, 0, 0);
  //gtk_label_set_justify((GtkLabel *)net_label,GTK_JUSTIFY_LEFT);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "net_label", net_label, (GtkDestroyNotify) gtk_widget_unref);

  //set_net_info("Not connected...");
  gtk_widget_show(net_label);
  gtk_box_pack_start(GTK_BOX(net_vbox), net_label, TRUE, TRUE, 0);

  //gtk_container_add (GTK_CONTAINER (frame4), net_label);

  /*
   *The connect button
   */

  connect_button = gtk_button_new_with_label("Connect to host");
  gtk_widget_ref(connect_button);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "connect_button", connect_button, (GtkDestroyNotify) gtk_widget_unref);
  /* Connect the "clicked" signal of the button to our callback */
  gtk_signal_connect(GTK_OBJECT(connect_button), "clicked", GTK_SIGNAL_FUNC(connect_callback), NULL);
  gtk_widget_show(connect_button);
  gtk_box_pack_start(GTK_BOX(net_vbox), connect_button, FALSE, FALSE, 1);
  gtk_container_set_border_width(GTK_CONTAINER(connect_button), 5);

  /*
   *The node MPR info frame
   */
  mpr_frame = gtk_frame_new("MPR:");
  gtk_widget_ref(mpr_frame);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "mpr_frame", mpr_frame, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(mpr_frame);
  gtk_box_pack_start(GTK_BOX(hbox1), mpr_frame, FALSE, FALSE, 0);
  //gtk_widget_set_size_request(mid_frame, 125, -1);
  gtk_container_set_border_width(GTK_CONTAINER(mpr_frame), 1);

  /*
   *The scrolledwindow to contain the MPR node info
   */
  mpr_scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
  gtk_widget_ref(mpr_scrolledwindow);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "mpr_scrolledwindow", mpr_scrolledwindow, (GtkDestroyNotify) gtk_widget_unref);

  gtk_widget_show(mpr_scrolledwindow);
  gtk_container_add(GTK_CONTAINER(mpr_frame), mpr_scrolledwindow);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(mpr_scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
  gtk_container_set_border_width(GTK_CONTAINER(mpr_scrolledwindow), 3);

  /*
   *The node MID info frame
   */
  mid_frame = gtk_frame_new("MID:");
  gtk_widget_ref(mid_frame);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "mid_frame", mid_frame, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(mid_frame);
  gtk_box_pack_start(GTK_BOX(hbox1), mid_frame, FALSE, FALSE, 0);
  //gtk_widget_set_size_request(mid_frame, 125, -1);
  gtk_container_set_border_width(GTK_CONTAINER(mid_frame), 1);

  /*
   *The scrolledwindow to contain the MID node info
   */
  mid_scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
  gtk_widget_ref(mid_scrolledwindow);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "mid_scrolledwindow", mid_scrolledwindow, (GtkDestroyNotify) gtk_widget_unref);

  gtk_widget_show(mid_scrolledwindow);
  gtk_container_add(GTK_CONTAINER(mid_frame), mid_scrolledwindow);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(mid_scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
  gtk_container_set_border_width(GTK_CONTAINER(mid_scrolledwindow), 3);

  /*
   *The MPR list
   */
  mpr_list = gtk_clist_new(1);
  gtk_widget_ref(mpr_list);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "mpr_list", mpr_list, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(mpr_list);
  gtk_container_add(GTK_CONTAINER(mpr_scrolledwindow), mpr_list);
  gtk_clist_set_column_width(GTK_CLIST(mpr_list), 0, 120);      /* IP */
  gtk_clist_column_titles_hide(GTK_CLIST(mpr_list));

  /*
   *The MID list
   */
  mid_list = gtk_clist_new(1);
  gtk_widget_ref(mid_list);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "mid_list", mid_list, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(mid_list);
  gtk_container_add(GTK_CONTAINER(mid_scrolledwindow), mid_list);
  gtk_clist_set_column_width(GTK_CLIST(mid_list), 0, 120);      /* IP */
  gtk_clist_column_titles_hide(GTK_CLIST(mid_list));

  /*
   *The node HNA info frame
   */
  hna_frame = gtk_frame_new("HNA:");
  gtk_widget_ref(hna_frame);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "hna_frame", hna_frame, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(hna_frame);
  gtk_box_pack_start(GTK_BOX(hbox1), hna_frame, FALSE, FALSE, 0);
  //gtk_widget_set_size_request(mid_frame, 125, -1);
  gtk_container_set_border_width(GTK_CONTAINER(hna_frame), 1);

  /*
   *The HNA scrolled window
   */
  hna_scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
  gtk_widget_ref(hna_scrolledwindow);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "hna_scrolledwindow", hna_scrolledwindow, (GtkDestroyNotify) gtk_widget_unref);

  gtk_widget_show(hna_scrolledwindow);
  gtk_container_add(GTK_CONTAINER(hna_frame), hna_scrolledwindow);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(hna_scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
  gtk_container_set_border_width(GTK_CONTAINER(hna_scrolledwindow), 3);

  /*
   *The HNA list
   */
  hna_list = gtk_clist_new(1);
  gtk_widget_ref(hna_list);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "hna_list", hna_list, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(hna_list);
  gtk_container_add(GTK_CONTAINER(hna_scrolledwindow), hna_list);
  gtk_clist_set_column_width(GTK_CLIST(hna_list), 0, 120);      /* IP */
  gtk_clist_column_titles_hide(GTK_CLIST(hna_list));

  /*
   *The "main" notebook page
   */
  Main = gtk_label_new("Main");
  gtk_widget_ref(Main);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "Main", Main, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(Main);
  gtk_notebook_set_tab_label(GTK_NOTEBOOK(notebook1), gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook1), 0), Main);

  /*
   *The main hbox of the Packet page
   */

  hbox2 = gtk_hbox_new(FALSE, 0);
  gtk_widget_ref(hbox2);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "hbox2", hbox2, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(hbox2);
  gtk_container_add(GTK_CONTAINER(notebook1), hbox2);

  /*
   *The packet hbox
   */
  pack_vbox = gtk_vbox_new(FALSE, 0);
  gtk_widget_ref(pack_vbox);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "pack_vbox", pack_vbox, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(pack_vbox);
  gtk_box_pack_start(GTK_BOX(hbox2), pack_vbox, TRUE, TRUE, 0);

  /*
   *The packet frame
   */

  frame2 = gtk_frame_new("Packet");
  gtk_widget_ref(frame2);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "frame2", frame2, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(frame2);
  gtk_box_pack_start(GTK_BOX(pack_vbox), frame2, TRUE, TRUE, 0);        /* Do not expand */

  /*
   *Packet list scrolled window
   */
  scrolledwindow4 = gtk_scrolled_window_new(NULL, NULL);
  gtk_widget_ref(scrolledwindow4);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "scrolledwindow4", scrolledwindow4, (GtkDestroyNotify) gtk_widget_unref);

  gtk_widget_show(scrolledwindow4);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow4), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);

  gtk_container_add(GTK_CONTAINER(frame2), scrolledwindow4);

  /*
   *The packet list
   */

  packet_list = gtk_clist_new(3);
  gtk_widget_ref(packet_list);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "packet_list", packet_list, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(packet_list);
  gtk_container_add(GTK_CONTAINER(scrolledwindow4), packet_list);
  gtk_clist_set_column_width(GTK_CLIST(packet_list), 0, 80);    /* Type */
  gtk_clist_set_column_width(GTK_CLIST(packet_list), 1, 150);   /* Origin IP */
  gtk_clist_set_column_width(GTK_CLIST(packet_list), 2, 20);    /* size */
  gtk_clist_column_titles_show(GTK_CLIST(packet_list));

  label17 = gtk_label_new("Type");
  gtk_widget_ref(label17);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "label17", label17, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(label17);
  gtk_clist_set_column_widget(GTK_CLIST(packet_list), 0, label17);

  label18 = gtk_label_new("Origin");
  gtk_widget_ref(label18);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "label18", label18, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(label18);
  gtk_clist_set_column_widget(GTK_CLIST(packet_list), 1, label18);

  label19 = gtk_label_new("Size");
  gtk_widget_ref(label19);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "label19", label19, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(label19);
  gtk_clist_set_column_widget(GTK_CLIST(packet_list), 2, label19);

  /*
   *Row selection callback
   */
  gtk_signal_connect(GTK_OBJECT(packet_list), "select_row", GTK_SIGNAL_FUNC(packet_selection), NULL);

  /*
   *The packet button
   */

  packet_button = gtk_button_new_with_label("Grab packets");
  gtk_widget_ref(packet_button);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "packet_button", packet_button, (GtkDestroyNotify) gtk_widget_unref);

  /* Connect the "clicked" signal of the button to our callback */
  gtk_signal_connect(GTK_OBJECT(packet_button), "clicked", GTK_SIGNAL_FUNC(packet_callback), NULL);
  gtk_widget_show(packet_button);
  gtk_box_pack_start(GTK_BOX(pack_vbox), packet_button, FALSE, FALSE, 5);

  /*
   *The packet disp hbox
   */
  pack_disp_vbox = gtk_vbox_new(FALSE, 0);
  gtk_widget_ref(pack_disp_vbox);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "pack_disp_vbox", pack_disp_vbox, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(pack_disp_vbox);
  gtk_box_pack_start(GTK_BOX(hbox2), pack_disp_vbox, TRUE, TRUE, 0);

  /*
   *The packet disp frame
   */

  disp_frame = gtk_frame_new("Packet content");
  gtk_widget_ref(disp_frame);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "disp_frame", disp_frame, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(disp_frame);
  gtk_box_pack_start(GTK_BOX(pack_disp_vbox), disp_frame, TRUE, TRUE, 0);       /* Do not expand */

  /*
   *Scrolled window for the packet display
   *list
   */

  scrolledwindow3 = gtk_scrolled_window_new(NULL, NULL);
  gtk_widget_ref(scrolledwindow3);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "scrolledwindow3", scrolledwindow3, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(scrolledwindow3);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow3), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);

  gtk_container_add(GTK_CONTAINER(disp_frame), scrolledwindow3);

  //gtk_box_pack_start (GTK_BOX (disp_frame), scrolledwindow3, TRUE, TRUE, 0);

  /*
   *The packet display list
   */
  packet_content_list = gtk_clist_new(4);
  gtk_widget_ref(packet_content_list);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "packet_content_list", packet_content_list,
                           (GtkDestroyNotify) gtk_widget_unref);

  gtk_widget_show(packet_content_list);
  gtk_container_add(GTK_CONTAINER(scrolledwindow3), packet_content_list);
  gtk_clist_set_column_width(GTK_CLIST(packet_content_list), 0, 70);    /* 0-7 */
  gtk_clist_set_column_justification(GTK_CLIST(packet_content_list), 0, GTK_JUSTIFY_CENTER);
  gtk_clist_set_column_width(GTK_CLIST(packet_content_list), 1, 70);    /* 8-15 */
  gtk_clist_set_column_justification(GTK_CLIST(packet_content_list), 1, GTK_JUSTIFY_CENTER);
  gtk_clist_set_column_width(GTK_CLIST(packet_content_list), 2, 70);    /* 16-23 */
  gtk_clist_set_column_justification(GTK_CLIST(packet_content_list), 2, GTK_JUSTIFY_CENTER);
  gtk_clist_set_column_width(GTK_CLIST(packet_content_list), 3, 70);    /* 24-31 */
  gtk_clist_set_column_justification(GTK_CLIST(packet_content_list), 3, GTK_JUSTIFY_CENTER);
  gtk_clist_column_titles_show(GTK_CLIST(packet_content_list));

  label13 = gtk_label_new("0 - 7");
  gtk_widget_ref(label13);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "label13", label13, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(label13);
  gtk_clist_set_column_widget(GTK_CLIST(packet_content_list), 0, label13);

  label14 = gtk_label_new("8 - 15");
  gtk_widget_ref(label14);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "label14", label14, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(label14);
  gtk_clist_set_column_widget(GTK_CLIST(packet_content_list), 1, label14);

  label15 = gtk_label_new("16 - 23");
  gtk_widget_ref(label15);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "label15", label15, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(label15);
  gtk_clist_set_column_widget(GTK_CLIST(packet_content_list), 2, label15);

  label16 = gtk_label_new("24 - 31");
  gtk_widget_ref(label16);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "label16", label16, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(label16);
  gtk_clist_set_column_widget(GTK_CLIST(packet_content_list), 3, label16);

  //gtk_clist_set_selection_mode(GTK_CLIST (packet_content_list), GTK_SELECTION_NONE); /* no selections */

  /*
   *The packet button
   */

  packet_disp_button = gtk_button_new_with_label("Display hex");
  gtk_widget_ref(packet_disp_button);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "packet_disp_button", packet_disp_button, (GtkDestroyNotify) gtk_widget_unref);

  /* Connect the "clicked" signal of the button to our callback */
  gtk_signal_connect(GTK_OBJECT(packet_disp_button), "clicked", GTK_SIGNAL_FUNC(packet_disp_callback), NULL);
  gtk_widget_show(packet_disp_button);
  gtk_box_pack_start(GTK_BOX(pack_disp_vbox), packet_disp_button, FALSE, FALSE, 5);

  /*
   *The "packets" notebook
   */

  label_packets = gtk_label_new("Packets");
  gtk_widget_ref(label_packets);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "label_packets", label_packets, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(label_packets);
  gtk_notebook_set_tab_label(GTK_NOTEBOOK(notebook1), gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook1), 1), label_packets);

  /*
   *The route hbox
   */
  route_hbox1 = gtk_hbox_new(FALSE, 0);
  gtk_widget_ref(route_hbox1);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "route_hbox1", route_hbox1, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(route_hbox1);
  //gtk_box_pack_start (GTK_BOX (hbox1), vbox1, TRUE, TRUE, 1);
  gtk_container_add(GTK_CONTAINER(notebook1), route_hbox1);

  /*
   *The routes frame
   */

  route_frame = gtk_frame_new("OLSR routes in kernel:");
  gtk_widget_ref(route_frame);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "route_frame", route_frame, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(route_frame);

  //gtk_container_add (GTK_CONTAINER (notebook1), route_frame);
  gtk_widget_set_size_request(route_frame, 200, -1);
  gtk_box_pack_start(GTK_BOX(route_hbox1), route_frame, TRUE, TRUE, 0); /* Do not expand */

  /*
   *Scrolled window for the packet display
   *list
   */

  route_scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
  gtk_widget_ref(route_scrolledwindow);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "route_scrolledwindow", route_scrolledwindow,
                           (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(route_scrolledwindow);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(route_scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);

  gtk_container_add(GTK_CONTAINER(route_frame), route_scrolledwindow);

  //gtk_box_pack_start (GTK_BOX (route_frame), scrolledwindow3, TRUE, TRUE, 0);

  /*
   *The routes display list
   */
  route_list = gtk_clist_new(4);
  gtk_widget_ref(route_list);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "route_list", route_list, (GtkDestroyNotify) gtk_widget_unref);

  gtk_widget_show(route_list);
  gtk_container_add(GTK_CONTAINER(route_scrolledwindow), route_list);
  gtk_clist_set_column_width(GTK_CLIST(route_list), 0, 120);    /* dest */
  //gtk_clist_set_column_justification(GTK_CLIST (route_list), 0, GTK_JUSTIFY_CENTER);
  gtk_clist_set_column_width(GTK_CLIST(route_list), 1, 120);    /* gw */
  //gtk_clist_set_column_justification(GTK_CLIST (route_list), 1, GTK_JUSTIFY_CENTER);
  gtk_clist_set_column_width(GTK_CLIST(route_list), 2, 50);     /* weight */
  gtk_clist_set_column_justification(GTK_CLIST(route_list), 2, GTK_JUSTIFY_CENTER);
  gtk_clist_set_column_width(GTK_CLIST(route_list), 3, 70);     /* interface */
  gtk_clist_set_column_justification(GTK_CLIST(route_list), 3, GTK_JUSTIFY_CENTER);
  gtk_clist_column_titles_show(GTK_CLIST(route_list));

  route_label1 = gtk_label_new("Destination");
  gtk_widget_ref(route_label1);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "route_label1", route_label1, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(route_label1);
  gtk_clist_set_column_widget(GTK_CLIST(route_list), 0, route_label1);

  route_label2 = gtk_label_new("Gateway");
  gtk_widget_ref(route_label2);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "route_label2", route_label2, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(route_label2);
  gtk_clist_set_column_widget(GTK_CLIST(route_list), 1, route_label2);

  route_label3 = gtk_label_new("Weight");
  gtk_widget_ref(route_label3);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "route_label3", route_label3, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(route_label3);
  gtk_clist_set_column_widget(GTK_CLIST(route_list), 2, route_label3);

  route_label4 = gtk_label_new("Interface");
  gtk_widget_ref(route_label4);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "route_label4", route_label4, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(route_label4);
  gtk_clist_set_column_widget(GTK_CLIST(route_list), 3, route_label4);

  //gtk_clist_set_selection_mode(GTK_CLIST (route_list), GTK_SELECTION_NONE); /* no selections */

  /*
   *The routes stats frame
   */

  route_stats_frame = gtk_frame_new("Stats:");
  gtk_widget_ref(route_stats_frame);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "route_stats_frame", route_stats_frame, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(route_stats_frame);

  //gtk_container_add (GTK_CONTAINER (notebook1), route_frame);
  gtk_box_pack_start(GTK_BOX(route_hbox1), route_stats_frame, TRUE, TRUE, 1);

  /*
   *The "routes" notebook
   */
  label_routes = gtk_label_new("Routes");
  gtk_widget_ref(label_routes);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "label_routes", label_routes, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(label_routes);
  gtk_notebook_set_tab_label(GTK_NOTEBOOK(notebook1), gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook1), 2), label_routes);

  empty1 = gtk_vbox_new(FALSE, 0);
  gtk_widget_show(empty1);
  gtk_container_add(GTK_CONTAINER(notebook1), empty1);

  /*
   *The "traffic" notebook
   */
  traffic_label = gtk_label_new("Traffic");
  gtk_widget_ref(traffic_label);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "traffic_label", traffic_label, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(traffic_label);
  gtk_notebook_set_tab_label(GTK_NOTEBOOK(notebook1), gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook1), 3), traffic_label);

  /*
   *The settings hbox
   */
  settings_hbox1 = gtk_hbox_new(FALSE, 0);
  gtk_widget_ref(settings_hbox1);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "settings_hbox1", settings_hbox1, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(settings_hbox1);
  //gtk_box_pack_start (GTK_BOX (hbox1), vbox1, TRUE, TRUE, 1);
  gtk_container_add(GTK_CONTAINER(notebook1), settings_hbox1);

  /*
   *The settings-info label field
   */
  info_label = gtk_label_new(NULL);
  gtk_widget_ref(info_label);
  gtk_misc_set_alignment((GtkMisc *) info_label, 0, 0);
  //gtk_label_set_justify((GtkLabel *)net_label,GTK_JUSTIFY_LEFT);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "info_label", info_label, (GtkDestroyNotify) gtk_widget_unref);

  //set_net_info("Not connected...");
  gtk_widget_show(info_label);
  gtk_box_pack_start(GTK_BOX(settings_hbox1), info_label, TRUE, TRUE, 0);

  /*
   *The "settings" notebook
   */
  settings_label = gtk_label_new("Settings");
  gtk_widget_ref(settings_label);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "settings_label", settings_label, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(settings_label);
  gtk_notebook_set_tab_label(GTK_NOTEBOOK(notebook1), gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook1), 4), settings_label);

  /*
   *The "about" hbox
   */
  about_hbox1 = gtk_hbox_new(FALSE, 0);
  gtk_widget_ref(about_hbox1);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "about_hbox1", about_hbox1, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(about_hbox1);
  //gtk_box_pack_start (GTK_BOX (hbox1), vbox1, TRUE, TRUE, 1);
  gtk_container_add(GTK_CONTAINER(notebook1), about_hbox1);
  gtk_container_set_border_width(GTK_CONTAINER(about_hbox1), 10);

  /*
   *The about label field
   */
  about_label = gtk_label_new(NULL);
  gtk_widget_ref(about_label);
  gtk_misc_set_alignment((GtkMisc *) about_label, 0, 0);
  gtk_label_set_justify((GtkLabel *) about_label, GTK_JUSTIFY_CENTER);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "about_label", about_label, (GtkDestroyNotify) gtk_widget_unref);

  //set_net_info("Not connected...");
  gtk_widget_show(about_label);
  gtk_box_pack_start(GTK_BOX(about_hbox1), unik_logo, TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(about_hbox1), about_label, TRUE, TRUE, 0);
  gtk_widget_show(unik_logo);

  gtk_label_set_text((GtkLabel *) about_label, "OLSRD-GUI by Andreas Tonnesen ([email protected])");

  /*
   *The "about" notebook
   */
  label3 = gtk_label_new("About");
  gtk_widget_ref(label3);
  gtk_object_set_data_full(GTK_OBJECT(main_window), "About", label3, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(label3);
  gtk_notebook_set_tab_label(GTK_NOTEBOOK(notebook1), gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook1), 5), label3);

  return main_window;

}
Exemplo n.º 30
0
int main(int argc, char *argv[])
{
    int has_rc=0;

    GtkWidget *mainWin;
    GtkWidget *table;
    GtkWidget *menu_bar;
    GtkWidget *index_page;
    GtkWidget *button;
    GtkWidget *label, *box, *sbox, *pbox;
    GtkWidget *vseparator;
    GtkWidget *post_process_button;
    GtkStyle *style;

    GtkWidget *gpixmap;
    GdkPixmap *pixmap;
    GdkBitmap *bitmap;
    char title[256];
    char *envhome;

#ifdef ENABLE_NLS
    bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
    textdomain (PACKAGE);
#endif

    signal(SIGSEGV, crash);

#ifdef sun
    __progname = argv[0];
#endif

    Thumbnails.next = NULL;
    Images.next=NULL;

    /* Set the priority (taken from PhotoPC photopc.c) */
#ifdef linux
    if (geteuid() == 0) {
        struct sched_param sp;
        int rc,minp,maxp;

        minp=sched_get_priority_min(SCHED_FIFO);
        maxp=sched_get_priority_max(SCHED_FIFO);
        sp.sched_priority=minp+(maxp-minp)/2;
        if ((rc=sched_setscheduler(0,SCHED_FIFO,&sp)) == -1)
            fprintf(stderr,"failed to set priority\n");
    }
#endif

    filesel_cwd = (char *)malloc(sizeof(char)*1024);
    getcwd(filesel_cwd, 1024);
    strcat(filesel_cwd, "/");

    /* Make sure there's a .gphoto directory in their home ---- */

    envhome = getenv("HOME");
    gphotoDir = (char *)malloc(sizeof(char)*(strlen(envhome)+9));
    memset(gphotoDir, 0, sizeof(char)*(strlen(envhome)+9));
    sprintf(gphotoDir, "%s/.gphoto", envhome);
    (void)mkdir(gphotoDir, 0744);

    /* Command line mode anyone? ----------------------------- */
    if (argc > 1) {
        command_line_mode = 1;
        has_rc = load_config();
        command_line(argc, argv);
    } else
        command_line_mode = 0;


    /* Check for DISPLAY. If not set, exit */
    if (!getenv("DISPLAY")) {
        printf(N_("Error: $DISPLAY variable is not set\n"));
        printf(N_("Please run \"gphoto -h\" for command-line options.\n"));
        _exit(0);
    }

    fprintf(stdout,
            N_("gPhoto %s (%s)\n"),
            VERSION, __DATE__);
    fprintf(stdout,
            N_("Copyright (C) 1998-2000 Scott Fritzinger <*****@*****.**>\n\n"));
    fprintf(stdout,
            N_("Usage: gphoto [-h] [-c] [-n] [-s # filename] [-t # filename]\n"));
    fprintf(stdout, N_("              [-d #] [-p filename] [-l filename]\n"));

    gtk_init(&argc, &argv);
#if 1 /* by fujisawa */
    gdk_imlib_init();
#endif
    gtk_widget_push_visual(gdk_imlib_get_visual());
    gtk_widget_push_colormap(gdk_imlib_get_colormap());

    library_name = gtk_label_new("");

    has_rc = load_config();

    /* set up the main window -------------------------------- */
    mainWin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_container_border_width(GTK_CONTAINER(mainWin), 0);
    sprintf(title, "gPhoto %s", VERSION);
    gtk_window_set_title(GTK_WINDOW(mainWin), title);
    gtk_signal_connect(GTK_OBJECT(mainWin), "delete_event",
                       GTK_SIGNAL_FUNC(delete_event), NULL);
    gtk_widget_set_usize(mainWin, 730, 480);
    gtk_widget_realize(mainWin);

    /* set up the menu --------------------------------------- */
    menu_bar = gtk_vbox_new(FALSE, 0);
    create_menu(menu_bar);
    gtk_widget_show_all(menu_bar);

    /* button bar -------------------------------------------- */
    box = gtk_hbox_new(FALSE, 0);
    create_toolbar(box, mainWin);
    gtk_widget_show(box);
    gtk_container_border_width(GTK_CONTAINER(box), 5);

    /* accelerator keys--------------------------------------- */
    gtk_accel_group_attach(mainag,GTK_OBJECT(mainWin));

    /* Index Page notebook ----------------------------------- */
    index_page = gtk_table_new(1,1,FALSE);
    gtk_widget_show(index_page);
    index_window = gtk_scrolled_window_new(NULL,NULL);
    index_vp=gtk_viewport_new(NULL,NULL);
    gtk_container_add(GTK_CONTAINER(index_window), index_vp);
    gtk_widget_show(index_vp);
    gtk_widget_show(index_window);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(index_window),
                                   GTK_POLICY_AUTOMATIC,
                                   GTK_POLICY_AUTOMATIC);
    gtk_table_attach_defaults(GTK_TABLE(index_page),index_window,0,1,0,1);

    notebook = gtk_notebook_new();
    gtk_widget_show(notebook);
    gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook), TRUE);

    label = gtk_label_new(N_("Image Index"));
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), index_page,
                             label);

    sbox = gtk_hbox_new(FALSE, 5);
    gtk_widget_show(sbox);

    status_bar = gtk_label_new("");
    gtk_widget_show(status_bar);
    gtk_label_set_justify(GTK_LABEL(status_bar), GTK_JUSTIFY_LEFT);
    gtk_box_pack_start(GTK_BOX(sbox), status_bar, FALSE, FALSE, 0);
    update_status("Select \"Camera->Download Index->Thumbnails\" to begin.");
    progress = gtk_progress_bar_new();

    gtk_widget_show(progress);
    gtk_box_pack_end(GTK_BOX(sbox), progress, FALSE, FALSE, 0);

    vseparator = gtk_vseparator_new();
    gtk_widget_show(vseparator);
    gtk_box_pack_end(GTK_BOX(sbox), vseparator, FALSE, FALSE, 0);

    post_process = 0;
    post_process_button = gtk_button_new();
    gtk_widget_show(post_process_button);
    gtk_button_set_relief(GTK_BUTTON(post_process_button),GTK_RELIEF_NONE);
    gtk_signal_connect (GTK_OBJECT(post_process_button), "clicked",
                        GTK_SIGNAL_FUNC(post_process_change), mainWin);
    gtk_box_pack_end(GTK_BOX(sbox), post_process_button, FALSE, FALSE, 0);

    pbox = gtk_hbox_new(FALSE, 3);
    gtk_widget_show(pbox);
    gtk_container_add(GTK_CONTAINER(post_process_button), pbox);

    style = gtk_widget_get_style(mainWin);
    pixmap = gdk_pixmap_create_from_xpm_d(mainWin->window, &bitmap,
                                          &style->bg[GTK_STATE_NORMAL],(gchar **)post_processing_off_xpm);
    post_process_pixmap = gtk_pixmap_new(pixmap, bitmap);
    gtk_widget_show(post_process_pixmap);
    gtk_box_pack_start(GTK_BOX(pbox),post_process_pixmap,FALSE,FALSE,0);

    label = gtk_label_new("Post Process");
    gtk_widget_show(label);
    gtk_box_pack_start(GTK_BOX(pbox),label,FALSE,FALSE,0);

    vseparator = gtk_vseparator_new();
    gtk_widget_show(vseparator);
    gtk_box_pack_end(GTK_BOX(sbox), vseparator, FALSE, FALSE, 0);

    gtk_widget_show(library_name);
    /*	gtk_widget_set_usize(library_name, 200, 16);*/
    gtk_label_set_justify(GTK_LABEL(library_name), GTK_JUSTIFY_LEFT);
    button = gtk_button_new();
    gtk_widget_show(button);
    gtk_button_set_relief(GTK_BUTTON(button),GTK_RELIEF_NONE);
    gtk_signal_connect_object(GTK_OBJECT(button), "clicked",
                              GTK_SIGNAL_FUNC(port_dialog), NULL);
    gtk_container_add(GTK_CONTAINER(button), library_name);
    gtk_box_pack_end(GTK_BOX(sbox), button, FALSE, FALSE, 0);

    pixmap = gdk_pixmap_create_from_xpm_d(mainWin->window, &bitmap,
                                          &style->bg[GTK_STATE_NORMAL],
                                          (gchar **)splash_xpm);
    gpixmap = gtk_pixmap_new(pixmap, bitmap);
    gtk_widget_show(gpixmap);

    /* Main window layout ------------------------------------ */
    table =gtk_table_new(4,1,FALSE);
    gtk_container_add(GTK_CONTAINER(mainWin), table);
    gtk_widget_show(table);
    gtk_table_attach(GTK_TABLE(table),menu_bar, 0, 1, 0, 1,
                     GTK_FILL|GTK_EXPAND, GTK_FILL, 0 , 0);
    gtk_table_attach(GTK_TABLE(table), box, 0, 1, 1, 2,
                     GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0);
    gtk_table_attach_defaults(GTK_TABLE(table),notebook, 0, 1, 2, 3);
    gtk_table_attach(GTK_TABLE(table),sbox, 0, 1, 3, 4,
                     GTK_FILL|GTK_EXPAND, GTK_FILL, 0 , 0);

    index_table = gtk_hbox_new(FALSE, 0);
    gtk_widget_show(index_table);
    gtk_container_add( GTK_CONTAINER(index_vp), index_table);

    gtk_box_pack_start(GTK_BOX(index_table), gpixmap, TRUE, FALSE, 0);

    /* If not command-line mode... --------------------------- */
    gtk_widget_show(mainWin);
    if (!has_rc) {
        /* put anything here to do on the first run */
        developer_dialog_create();
        error_dialog(
            "Could not load config file.\n"
            "Resetting to defaults.\n"
            "Click on \"Select Port-Camera Model\n"
            "in the Configure menu to set your\n"
            "camera model and serial port\n");
    }
    gtk_main();
    return 0;
}