Esempio n. 1
0
/* Here we set the type of the message box, i.e. we change the pixmap. */
static void
set_message_box_type (GtkWidget *dialog,
		      GtkWidget *pixmap,
		      gchar *type_name)
{
  gint i, type_index = 0; /* Set to 0 in case we can't find it. */
  gchar *filename;

  /* Find out the index of the type. */
  for (i = 0; GbMessageBoxTypeChoices[i]; i++)
    {
      if (!strcmp (type_name, GbMessageBoxTypeChoices[i])
	  || !strcmp (type_name, GbMessageBoxTypeSymbols[i]))
	{
	  type_index = i;
	  break;
	}
    }

  gtk_object_set_data (GTK_OBJECT (dialog), MessageBoxType,
		       GINT_TO_POINTER (type_index));

  filename = gnome_unconditional_pixmap_file (GbMessageBoxTypePixmapFilenames[type_index]);
  gnome_pixmap_load_file (GNOME_PIXMAP (pixmap), filename);
  g_free (filename);
}
Esempio n. 2
0
static void
load_scenario (char *fname)
{
	char *tmp, *fn;
        GdkColor bgcolor;
        GdkImage *tmpimage;
    
	tmp = g_strconcat ( "same-gnome/", fname, NULL);

	fn = gnome_unconditional_pixmap_file ( tmp );
	g_free( tmp );

	if (!g_file_exists (fn)) {
		printf (_("Could not find the \'%s\' theme for SameGnome\n"), fn);
		exit (1);
	}

	if (scenario)
		g_free (scenario);

	scenario = g_strdup(fname);

	configure_sync (fname);

	if (image)
		gdk_imlib_destroy_image (image);

	image = gdk_imlib_load_image (fn);
	gdk_imlib_render (image, image->rgb_width, image->rgb_height);

	stones = gdk_imlib_move_image (image);
	mask = gdk_imlib_move_mask (image);

        tmpimage = gdk_image_get(stones, 0, 0, 1, 1);
        bgcolor.pixel = gdk_image_get_pixel(tmpimage, 0, 0);
        gdk_window_set_background (draw_area->window, &bgcolor);
        gdk_image_destroy(tmpimage);
  
	g_free( fn );

	nstones = image->rgb_width / STONE_SIZE;
/*	ncolors = image->rgb_height / STONE_SIZE; */
	ncolors = 3;


	gtk_widget_draw (draw_area, NULL);
}
Esempio n. 3
0
static void
fill_menu (GtkWidget *menu)
{
	struct dirent *e;
	char *dname = gnome_unconditional_pixmap_file ("same-gnome");
	DIR *dir;
        int itemno = 0;
	
	dir = opendir (dname);

	if (!dir)
		return;
	
	while ((e = readdir (dir)) != NULL){
		GtkWidget *item;
		char *s = strdup (e->d_name);

		if (!strstr (e->d_name, ".png")) {
			free (s);
			continue;
		}
			
		item = gtk_menu_item_new_with_label (s);
		gtk_widget_show (item);
		gtk_menu_append (GTK_MENU(menu), item);
		gtk_signal_connect (GTK_OBJECT(item), "activate",
				    GTK_SIGNAL_FUNC (set_selection), s);
		gtk_signal_connect (GTK_OBJECT(item), "destroy",
				    GTK_SIGNAL_FUNC (free_str), s);
	  
	        if (!strcmp(scenario, s))
	        {
		  gtk_menu_set_active(GTK_MENU(menu), itemno);
		}
	  
	        itemno++;
	}
	closedir (dir);
}
Esempio n. 4
0
static gboolean gui_message_big_new (const char *from, const char *subject, const char *date, const  char *account, const  char *kbytes) {
  GtkWidget *vbox, *hbox;
  GtkWidget *table;
  GtkWidget *label;
  GtkWidget *hsep;
  GtkStyle *style1;
  GtkStyle *style2;
  char *buf;
  GtkWidget *xpm;

  go = FALSE;
  gbool = TRUE;

  window = gnome_dialog_new (_("Confirm message downloading"),
      			GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO, NULL);
  gtk_window_set_modal (GTK_WINDOW (window), TRUE);
  gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (WMain->window));
  gnome_dialog_set_default (GNOME_DIALOG (window), 0);

  vbox = GNOME_DIALOG (window)->vbox;

  label = gtk_label_new (_("There's a message bigger than what you allowed to automatically download."));
  gtk_widget_show (label);
  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);

  table = gtk_table_new (5, 2, FALSE);
  gtk_widget_show (table);
  gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
  gtk_table_set_row_spacings (GTK_TABLE (table), 2);
  gtk_table_set_col_spacings (GTK_TABLE (table), 2);

  if (from && subject && date) {
    label = gtk_label_new (_("From:"));
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
	(GtkAttachOptions) (GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
    style1 = gtk_widget_get_style (label);
    style2 = gtk_style_copy (style1);
    style2->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1");
    gtk_widget_set_style (label, style2);
    label = gtk_label_new (from);
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1,
	(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
    style1 = gtk_widget_get_style (label);
    style2 = gtk_style_copy (style1);
    style2->font = gdk_font_load ("-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1");
    gtk_widget_set_style (label, style2);
    
    label = gtk_label_new (_("Date:"));
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
	(GtkAttachOptions) (GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
    style1 = gtk_widget_get_style (label);
    style2 = gtk_style_copy (style1);
    style2->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1");
    gtk_widget_set_style (label, style2);
    label = gtk_label_new (date);
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 1, 2, 1, 2,
	(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
    style1 = gtk_widget_get_style (label);
    style2 = gtk_style_copy (style1);
    style2->font = gdk_font_load ("-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1");
    gtk_widget_set_style (label, style2);
  } else {
    label = gtk_label_new (_("Since the server doesn't support advanced POP commands very little information about this message could be extracted."));
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
	(GtkAttachOptions) (GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
  }
  
  label = gtk_label_new (_("Account:"));
  gtk_widget_show (label);
  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
      (GtkAttachOptions) (GTK_FILL),
      (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
  style1 = gtk_widget_get_style (label);
  style2 = gtk_style_copy (style1);
  style2->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1");
  gtk_widget_set_style (label, style2);

  if (from && subject && date) {
    label = gtk_label_new (_("Subject:"));
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5,
	(GtkAttachOptions) (GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
    style1 = gtk_widget_get_style (label);
    style2 = gtk_style_copy (style1);
    style2->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1");
    gtk_widget_set_style (label, style2);
    label = gtk_label_new (subject);
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 1, 2, 4, 5,
	(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
    style1 = gtk_widget_get_style (label);
    style2 = gtk_style_copy (style1);
    style2->font = gdk_font_load ("-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1");
    gtk_widget_set_style (label, style2);
  }
  
  label = gtk_label_new (_("Size:"));
  gtk_widget_show (label);
  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
  style1 = gtk_widget_get_style (label);
  style2 = gtk_style_copy (style1);
  style2->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1");
  gtk_widget_set_style (label, style2);

  buf = g_strdup_printf ("%s (%d Kb)", kbytes, atoi (kbytes)/1024);
  label = gtk_label_new (buf);
  c2_free (buf);
  gtk_widget_show (label);
  gtk_table_attach (GTK_TABLE (table), label, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
  style1 = gtk_widget_get_style (label);
  style2 = gtk_style_copy (style1);
  style2->font = gdk_font_load ("-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1");
  gtk_widget_set_style (label, style2); 

  label= gtk_label_new (account);
  gtk_widget_show (label);
  gtk_table_attach (GTK_TABLE (table), label, 1, 2, 3, 4,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
  style1 = gtk_widget_get_style (label);
  style2 = gtk_style_copy (style1);
  style2->font = gdk_font_load ("-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1");
  gtk_widget_set_style (label, style2); 

  hsep = gtk_hseparator_new ();
  gtk_widget_show (hsep);
  gtk_box_pack_start (GTK_BOX (vbox), hsep, FALSE, TRUE, 0);

  hbox = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
  
  buf = gnome_unconditional_pixmap_file("gnome-question.png");
  if (buf) {
    xpm = gnome_pixmap_new_from_file(buf);
    c2_free(buf);
    gtk_widget_show (xpm);
    gtk_box_pack_start (GTK_BOX (hbox), xpm, FALSE, FALSE, 0);
  }
  
  label = gtk_label_new (_("Do you want to download it?"));
  gtk_widget_show (label);
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);

  gnome_dialog_button_connect (GNOME_DIALOG (window), 0, GTK_SIGNAL_FUNC (cb), (gpointer) "Y");
  gnome_dialog_set_accelerator (GNOME_DIALOG (window), 0, GDK_Y, 0);
  gnome_dialog_button_connect (GNOME_DIALOG (window), 1, GTK_SIGNAL_FUNC (cb), (gpointer) "N");
  gnome_dialog_set_accelerator (GNOME_DIALOG (window), 1, GDK_N, 0);

  gtk_widget_show (window);

  gdk_threads_leave ();
  while (!go) usleep (500);
  gdk_threads_enter ();
  return gbool;
}