~ubuntu-branches/ubuntu/oneiric/gnome-panel/oneiric

« back to all changes in this revision

Viewing changes to gnome-panel/menu.c

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2009-06-22 22:26:26 UTC
  • mfrom: (1.3.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 147.
  • Revision ID: james.westby@ubuntu.com-20090622222626-lfdc32sakbz19yuu
ImportĀ upstreamĀ versionĀ 2.26.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
typedef struct {
62
62
        GtkWidget   *image;
63
63
        const char  *stock_id;
 
64
        GIcon       *gicon;
64
65
        GdkPixbuf   *pixbuf;
65
66
        GtkIconSize  icon_size;
66
67
} IconToAdd;
519
520
 
520
521
                icons_to_add = g_list_delete_link (icons_to_add, icons_to_add);
521
522
 
522
 
                if (icon_to_add->stock_id)
 
523
                if (icon_to_add->stock_id) {
523
524
                        gtk_image_set_from_stock (
524
525
                                GTK_IMAGE (icon_to_add->image),
525
526
                                icon_to_add->stock_id,
526
527
                                icon_to_add->icon_size);
527
 
                else {
 
528
                } else if (icon_to_add->gicon) {
 
529
                        gtk_image_set_from_gicon (
 
530
                                GTK_IMAGE (icon_to_add->image),
 
531
                                icon_to_add->gicon,
 
532
                                icon_to_add->icon_size);
 
533
                } else {
528
534
                        g_assert (icon_to_add->pixbuf);
529
535
 
530
536
                        gtk_image_set_from_pixbuf (
538
544
                        g_object_unref (icon_to_add->pixbuf);
539
545
                }
540
546
 
 
547
                if (icon_to_add->gicon)
 
548
                        g_object_unref (icon_to_add->gicon);
541
549
                g_object_unref (icon_to_add->image);
542
550
                g_free (icon_to_add);
543
551
        }
571
579
                goto load_icons_handler_again;
572
580
        }
573
581
 
574
 
        if (icon->stock_id) {
 
582
        if (icon->stock_id || icon->gicon) {
575
583
                IconToAdd *icon_to_add;
576
584
 
577
585
                icon_to_add            = g_new (IconToAdd, 1);
579
587
                icon_to_add->stock_id  = icon->stock_id;
580
588
                icon_to_add->pixbuf    = NULL;
581
589
                icon_to_add->icon_size = icon->icon_size;
582
 
 
583
 
                icons_to_add = g_list_prepend (icons_to_add, icon_to_add);
584
 
        } else if (icon->gicon) {
585
 
                IconToAdd *icon_to_add;
586
 
                char      *icon_name;
587
 
                GdkPixbuf *pb;
588
 
                int        icon_height = PANEL_DEFAULT_MENU_ICON_SIZE;
589
 
 
590
 
                gtk_icon_size_lookup (icon->icon_size, NULL, &icon_height);
591
 
 
592
 
                icon_name = panel_util_get_icon_name_from_g_icon (icon->gicon);
593
 
 
594
 
                if (icon_name) {
595
 
                        pb = panel_make_menu_icon (icon->icon_theme,
596
 
                                                   icon_name,
597
 
                                                   icon->fallback_image,
598
 
                                                   icon_height,
599
 
                                                   &long_operation);
600
 
                        g_free (icon_name);
601
 
                } else {
602
 
                        pb = panel_util_get_pixbuf_from_g_loadable_icon (icon->gicon, icon_height);
603
 
                        if (!pb && icon->fallback_image) {
604
 
                                pb = panel_make_menu_icon (icon->icon_theme,
605
 
                                                           NULL,
606
 
                                                           icon->fallback_image,
607
 
                                                           icon_height,
608
 
                                                           &long_operation);
609
 
                        }
610
 
                }
611
 
 
612
 
                if (!pb) {
613
 
                        icon_to_load_free (icon);
614
 
                        if (long_operation)
615
 
                                /* this may have been a long operation so jump
616
 
                                 * back to the main loop for a while */
617
 
                                return TRUE;
618
 
                        else
619
 
                                /* we didn't do anything long/hard, so just do
620
 
                                 * this again, this is fun, don't go back to
621
 
                                 * main loop */
622
 
                                goto load_icons_handler_again;
623
 
                }
624
 
 
625
 
                icon_to_add            = g_new (IconToAdd, 1);
626
 
                icon_to_add->image     = g_object_ref (icon->pixmap);
627
 
                icon_to_add->stock_id  = NULL;
628
 
                icon_to_add->pixbuf    = pb;
629
 
                icon_to_add->icon_size = icon->icon_size;
 
590
                if (icon->gicon)
 
591
                        icon_to_add->gicon = g_object_ref (icon->gicon);
 
592
                else
 
593
                        icon_to_add->gicon = NULL;
630
594
 
631
595
                icons_to_add = g_list_prepend (icons_to_add, icon_to_add);
632
596
        } else {
656
620
                icon_to_add            = g_new (IconToAdd, 1);
657
621
                icon_to_add->image     = g_object_ref (icon->pixmap);
658
622
                icon_to_add->stock_id  = NULL;
 
623
                icon_to_add->gicon     = NULL;
659
624
                icon_to_add->pixbuf    = pb;
660
625
                icon_to_add->icon_size = icon->icon_size;
661
626