summaryrefslogtreecommitdiffstats
path: root/perl-install/bootlook.pm
diff options
context:
space:
mode:
authorJonathan Gotti <jgotti@mandriva.com>2002-09-04 13:09:20 +0000
committerJonathan Gotti <jgotti@mandriva.com>2002-09-04 13:09:20 +0000
commit8ca03b886f5d2bcb0df81cd8852c59e569e6152c (patch)
treea5d15573580bed1dd3f6b15b2f573f316be54b7d /perl-install/bootlook.pm
parent06e091c9c6cc6eaddc3ab55900a2af244eca1f8e (diff)
downloaddrakx-backup-do-not-use-8ca03b886f5d2bcb0df81cd8852c59e569e6152c.tar
drakx-backup-do-not-use-8ca03b886f5d2bcb0df81cd8852c59e569e6152c.tar.gz
drakx-backup-do-not-use-8ca03b886f5d2bcb0df81cd8852c59e569e6152c.tar.bz2
drakx-backup-do-not-use-8ca03b886f5d2bcb0df81cd8852c59e569e6152c.tar.xz
drakx-backup-do-not-use-8ca03b886f5d2bcb0df81cd8852c59e569e6152c.zip
replace convert dependencies by gdk-pixbuf dependencies
Diffstat (limited to 'perl-install/bootlook.pm')
-rw-r--r--perl-install/bootlook.pm25
1 files changed, 16 insertions, 9 deletions
diff --git a/perl-install/bootlook.pm b/perl-install/bootlook.pm
index f5ad0cddc..75c772f60 100644
--- a/perl-install/bootlook.pm
+++ b/perl-install/bootlook.pm
@@ -22,6 +22,7 @@
use MDK::Common;
use Gtk;
+use Gtk::Gdk::Pixbuf;
use Config;
init Gtk;
use POSIX;
@@ -102,7 +103,8 @@ my %themes = ('path'=>'/usr/share/bootsplash/themes/',
'lilo'=>{'file'=>'/lilo/message',
'thumb'=>'/lilo/thumb.png'} ,
'boot'=>{'path'=>'/images/',
- 'thumb'=>'/images/thumb.png',},
+ #'thumb'=>'/images/thumb.png',
+ },
);
my ($cur_res) = cat_('/etc/lilo.conf') =~ /vga=(.*)/;
@@ -137,9 +139,12 @@ foreach (keys (%combo)) {
$combo{'thms'}->set_popdown_strings(@thms);
$combo{'lilo'}->set_popdown_strings(@lilo_thms);
$combo{'boot'}->set_popdown_strings(@boot_thms);
+my $lilo_pixbuf = new_from_file Gtk::Gdk::Pixbuf($themes{'def_thmb'});
+my $lilo_pic = new Gtk::Pixmap($lilo_pixbuf->render_pixmap_and_mask(0),'');#gtkcreate_png($themes{'def_thmb'}));
+
+my $boot_pixbuf = new_from_file Gtk::Gdk::Pixbuf($themes{'def_thmb'});
+my $boot_pic = new Gtk::Pixmap($boot_pixbuf->render_pixmap_and_mask(0),'');#gtkcreate_png($themes{'def_thmb'}));
-my $lilo_pic = new Gtk::Pixmap(gtkcreate_png($themes{'def_thmb'}));
-my $boot_pic = new Gtk::Pixmap(gtkcreate_png($themes{'def_thmb'}));
my $thm_button = new Gtk::Button(_("Install themes"));
my $logo_thm = new Gtk::CheckButton(_("Display theme under console"));
my $B_create = new Gtk::Button(_("Create new theme"));
@@ -160,15 +165,17 @@ $combo{'thms'}->entry->signal_connect(changed => sub {
$combo{'lilo'}->entry->signal_connect(changed => sub {
my $new_file = $themes{'path'} . $combo{'lilo'}->entry->get_text() . $themes{'lilo'}{'thumb'};
- $lilo_pic->set(gtkcreate_png(-r $new_file ? $new_file : $themes{'def_thmb'}));
+ undef($lilo_pixbuf);
+ $lilo_pixbuf = new_from_file Gtk::Gdk::Pixbuf(-r $new_file ? $new_file : $themes{'def_thmb'});
+ $lilo_pic->set($lilo_pixbuf->render_pixmap_and_mask(0),'');
});
$combo{'boot'}->entry->signal_connect( changed => sub {
- my $new_file = $themes{'path'}.$combo{'boot'}->entry->get_text().$themes{'boot'}{'thumb'};
- if (! -f $new_file && -f $themes{'path'}.$combo{'boot'}->entry->get_text().$themes{'boot'}{'path'}."bootsplash-$cur_res.jpg"){
- system("convert -scale 159x119 ".$themes{'path'}.$combo{'boot'}->entry->get_text().$themes{'boot'}{'path'}."bootsplash-$cur_res.jpg $new_file") and $in->ask_warn(_("Error"),_("Can't create Bootsplash preview"));
- }
- $boot_pic->set(gtkcreate_png(-r $new_file ? $new_file : $themes{'def_thmb'}));
+ local $img_file = $themes{'path'}.$combo{'boot'}->entry->get_text().$themes{'boot'}{'path'}."bootsplash-$cur_res.jpg";
+ undef($boot_pixmap);
+ $boot_pixmap = new_from_file Gtk::Gdk::Pixbuf(-r $new_file ? $new_file : $img_file);
+ $boot_pixmap = $boot_pixmap->scale_simple(159,119,0);
+ $boot_pic->set($boot_pixmap->render_pixmap_and_mask(0),'');
});
$combo{'thms'}->entry->set_text($themes{'default'});
href='#n297'>297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966
/* Basic type operations for S-Lang */
/* Copyright (c) 1992, 1996, 2001 John E. Davis
 * This file is part of the S-Lang library.
 *
 * You may distribute under the terms of either the GNU General Public
 * License or the Perl Artistic License.
 */

#include "slinclud.h"

#if SLANG_HAS_FLOAT
# include <math.h>
#endif

#define SL_APP_WANTS_FOREACH	       /* for String_Type */
#include "slang.h"
#include "_slang.h"

int SLpop_string (char **s) /*{{{*/
{
   char *sls;

   *s = NULL;

   if (-1 == SLang_pop_slstring (&sls))
     return -1;

   if (NULL == (*s = SLmake_string (sls)))
     {
	SLang_free_slstring (sls);
	return -1;
     }

   SLang_free_slstring (sls);
   return 0;
}

/*}}}*/

int SLang_pop_slstring (char **s) /*{{{*/
{
   return SLclass_pop_ptr_obj (SLANG_STRING_TYPE, (VOID_STAR *)s);
}

/*}}}*/

/* if *data != 0, string should be freed upon use. */
int SLang_pop_string(char **s, int *data) /*{{{*/
{
   if (SLpop_string (s))
     return -1;

   *data = 1;
   return 0;
}

/*}}}*/

int _SLang_push_slstring (char *s)
{
   if (0 == SLclass_push_ptr_obj (SLANG_STRING_TYPE, (VOID_STAR)s))
     return 0;

   SLang_free_slstring (s);
   return -1;
}

int _SLpush_alloced_slstring (char *s, unsigned int len)
{
   if (NULL == (s = _SLcreate_via_alloced_slstring (s, len)))
     return -1;
   
   return _SLang_push_slstring (s);
}

int SLang_push_string (char *t) /*{{{*/
{
   if (t == NULL)
     return SLang_push_null ();

   if (NULL == (t = SLang_create_slstring (t)))
     return -1;

   return _SLang_push_slstring (t);
}

/*}}}*/

int _SLang_dup_and_push_slstring (char *s)
{
   if (NULL == (s = _SLstring_dup_slstring (s)))
     return SLang_push_null ();

   return _SLang_push_slstring (s);
}


/* This function _always_ frees the malloced string */
int SLang_push_malloced_string (char *c) /*{{{*/
{
   int ret;

   ret = SLang_push_string (c);
   SLfree (c);

   return ret;
}

/*}}}*/

#if 0
static int int_int_power (int a, int b)
{
   int r, s;

   if (a == 0) return 0;
   if (b < 0) return 0;
   if (b == 0) return 1;

   s = 1;
   if (a < 0)
     {
	if ((b % 2) == 1) s = -1;
	a = -a;
     }

   /* FIXME: Priority=low
    * This needs optimized
    */
   r = 1;
   while (b)
     {
	r = r * a;
	b--;
     }
   return r * s;
}
#endif

static int
string_string_bin_op_result (int op, unsigned char a, unsigned char b,
			     unsigned char *c)
{
   (void) a;
   (void) b;
   switch (op)
     {
      default:
	return 0;

      case SLANG_PLUS:
	*c = SLANG_STRING_TYPE;
	break;

      case SLANG_GT:
      case SLANG_GE:
      case SLANG_LT:
      case SLANG_LE:
      case SLANG_EQ:
      case SLANG_NE:
	*c = SLANG_CHAR_TYPE;
	break;
     }
   return 1;
}

static int
string_string_bin_op (int op,
		      unsigned char a_type, VOID_STAR ap, unsigned int na,
		      unsigned char b_type, VOID_STAR bp, unsigned int nb,
		      VOID_STAR cp)
{
   char *ic;
   char **a, **b, **c;
   unsigned int n, n_max;
   unsigned int da, db;

   (void) a_type;
   (void) b_type;

   if (na == 1) da = 0; else da = 1;
   if (nb == 1) db = 0; else db = 1;

   if (na > nb) n_max = na; else n_max = nb;

   a = (char **) ap;
   b = (char **) bp;
   for (n = 0; n < n_max; n++)
     {
	if ((*a == NULL) || (*b == NULL))
	  {
	     SLang_verror (SL_VARIABLE_UNINITIALIZED, "String element[%u] not initialized for binary operation", n);
	     return -1;
	  }
	a += da; b += db;
     }

   a = (char **) ap;
   b = (char **) bp;
   ic = (char *) cp;
   c = NULL;

   switch (op)
     {
      case SLANG_DIVIDE:
      case SLANG_MINUS:
      default:
	return 0;

       case SLANG_PLUS:
	/* Concat */
	c = (char **) cp;
	for (n = 0; n < n_max; n++)
	  {
	     if (NULL == (c[n] = SLang_concat_slstrings (*a, *b)))
	       goto return_error;

	     a += da; b += db;
	  }
	break;

      case SLANG_NE:
	for (n = 0; n < n_max; n++)
	  {
	     ic [n] = (0 != strcmp (*a, *b));
	     a += da;
	     b += db;
	  }
	break;
      case SLANG_GT:
	for (n = 0; n < n_max; n++)
	  {
	     ic [n] = (strcmp (*a, *b) > 0);
	     a += da;
	     b += db;
	  }
	break;
      case SLANG_GE:
	for (n = 0; n < n_max; n++)
	  {
	     ic [n] = (strcmp (*a, *b) >= 0);
	     a += da;
	     b += db;
	  }
	break;
      case SLANG_LT:
	for (n = 0; n < n_max; n++)
	  {
	     ic [n] = (strcmp (*a, *b) < 0);
	     a += da;
	     b += db;
	  }
	break;
      case SLANG_LE:
	for (n = 0; n < n_max; n++)
	  {
	     ic [n] = (strcmp (*a, *b) <= 0);
	     a += da;
	     b += db;
	  }
	break;
      case SLANG_EQ:
	for (n = 0; n < n_max; n++)
	  {
	     ic [n] = (strcmp (*a, *b) == 0);
	     a += da;
	     b += db;
	  }
	break;
     }
   return 1;

   return_error:
   if (c != NULL)
     {
	unsigned int nn;
	for (nn = 0; nn < n; nn++)
	  {
	     SLang_free_slstring (c[nn]);
	     c[nn] = NULL;
	  }
	for (nn = n; nn < n_max; nn++)
	  c[nn] = NULL;
     }
   return -1;
}

static void string_destroy (unsigned char unused, VOID_STAR s)
{
   (void) unused;
   SLang_free_slstring (*(char **) s);
}

static int string_push (unsigned char unused, VOID_STAR sptr)
{
   (void) unused;
   return SLang_push_string (*(char **) sptr);
}

static int string_cmp (unsigned char unused, VOID_STAR ap, VOID_STAR bp, int *c)
{
   char *a, *b;
   (void) unused;
   
   a = *(char **) ap;
   b = *(char **) bp;
   if (a != b)
     {
	if (a == NULL) *c = -1;
	else if (b == NULL) *c = 1;
	else *c = strcmp (a, b);
	return 0;
     }
   *c = 0;
   return 0;
}

static int string_to_int (unsigned char a_type, VOID_STAR ap, unsigned int na,
			  unsigned char b_type, VOID_STAR bp)
{
   char **s;
   unsigned int i;
   int *b;

   (void) a_type;
   (void) b_type;

   s = (char **) ap;
   b = (int *) bp;
   for (i = 0; i < na; i++)
     {
	if (s[i] == NULL) b[i] = 0;
	else b[i] = s[i][0];
     }
   return 1;
}

struct _SLang_Foreach_Context_Type
{
   char *string;
   unsigned int n;
};

static SLang_Foreach_Context_Type *
string_foreach_open (unsigned char type, unsigned int num)
{