#include <stdlib.h>
#include <gtk/gtk.h>
#include <locale.h>

int main( int   argc,
          char *argv[] )
{
    GtkWidget *window;
    GtkWidget *label;
    GtkWidget *vbox;
    char *text;
    int i, j, k;

    setlocale (LC_ALL, "");
    gtk_init (&argc, &argv);

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_widget_set_size_request (GTK_WIDGET (window), 50, 500);
    g_signal_connect (G_OBJECT (window), "delete_event",
                      G_CALLBACK (exit), NULL);
 
    vbox = gtk_vbox_new (TRUE, 0);



    for (i = 0; i < 2; i++) {
      text = i ? "در حال باز کردن" : "Some text here too"; // AB C D E F GHJKL QWERTYUIO ZXCVBNM, SDFGHJ QAZWSX EDCRFV TGBYHN UJMIK, PL,OKM IJNUHB  YGVTFC RDXESZ||| ||| 1234567890";
      for (j = 1; j < 4; j++) {
        int jj;
        switch (j) {
	  case 0: jj = GTK_JUSTIFY_FILL; break;
	  case 1: jj = GTK_JUSTIFY_LEFT; break;
	  case 2: jj = GTK_JUSTIFY_CENTER; break;
	  case 3: jj = GTK_JUSTIFY_RIGHT; break;
	}
	for (k = 0; k < 2; k++) {
	  int kk;
	  kk = k ? PANGO_ELLIPSIZE_END : PANGO_ELLIPSIZE_NONE;

	  label = gtk_label_new (text);
	  gtk_container_add (GTK_CONTAINER (vbox), label);
	  gtk_label_set_selectable (GTK_LABEL (label), TRUE);
	  gtk_label_set_justify (GTK_LABEL (label), jj);
	  gtk_label_set_ellipsize (GTK_LABEL (label), kk); 
	  //gtk_label_set_line_wrap (GTK_LABEL (label), k);
	}
      }
    }

    gtk_container_add (GTK_CONTAINER (window), vbox);
    gtk_widget_show_all (window);

    gtk_main ();

    return 0;
}
