/* 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);
}
Example #2
0
static void
gb_gnome_pixmap_reload (GtkWidget *widget)
{
  gchar *filename;
  gboolean scaled;
  gint width, height;

  filename = gtk_object_get_data (GTK_OBJECT (widget), Filename);
  scaled = gtk_object_get_data (GTK_OBJECT (widget), Scaled) != NULL
    ? TRUE : FALSE;
  width = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), Width));
  height = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), Height));

  if (filename)
    {
      if (scaled && width > 0 && height > 0)
	gnome_pixmap_load_file_at_size (GNOME_PIXMAP (widget), filename,
					width, height);
      else
	gnome_pixmap_load_file (GNOME_PIXMAP (widget), filename);
    }
  else
    {
      if (scaled && width > 0 && height > 0)
	gnome_pixmap_load_xpm_d_at_size (GNOME_PIXMAP (widget),
					 (const char**) gnome_pixmap_xpm,
					 width, height);
      else
	gnome_pixmap_load_xpm_d (GNOME_PIXMAP (widget),
				 (const char**) gnome_pixmap_xpm);
    }
}