~ubuntu-branches/ubuntu/quantal/gnome-panel/quantal

« back to all changes in this revision

Viewing changes to gnome-panel/button-widget.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2012-02-08 00:17:11 UTC
  • mfrom: (1.13.15)
  • Revision ID: package-import@ubuntu.com-20120208001711-npwmthl0c6iy3s9a
Tags: 1:3.3.5-0ubuntu1
* New upstream release.
* debian/control.in:
  - Bump minimum glib to 2.31.14
* debian/patches/13_disable_missing_help.patch:
  Updated patch from bugzilla
* debian/patches/14_revert-timedate-change.patch:
  - Revert switch to systemd timedate protocol until ubuntu-system-
    services supports it

Show diffs side-by-side

added added

removed removed

Lines of Context:
442
442
 
443
443
        parent = gtk_widget_get_parent (widget);
444
444
 
445
 
        if (button_widget->priv->orientation & PANEL_HORIZONTAL_MASK)
446
 
                size = gtk_widget_get_allocated_height (parent);
447
 
        else
 
445
        if (button_widget->priv->orientation & PANEL_HORIZONTAL_MASK) {
 
446
                GtkStyleContext *context;
 
447
                GtkStateFlags    state;
 
448
                GtkBorder        padding;
 
449
 
 
450
                state = gtk_widget_get_state_flags (widget);
 
451
                context = gtk_widget_get_style_context (widget);
 
452
                gtk_style_context_get_padding (context, state, &padding);
 
453
 
 
454
                size = gtk_widget_get_allocated_height (parent) + padding.left + padding.right;
 
455
        } else
448
456
                size = gtk_widget_get_allocated_width (parent);
449
457
 
450
458
        *minimal_width = *natural_width = size;
463
471
 
464
472
        if (button_widget->priv->orientation & PANEL_HORIZONTAL_MASK)
465
473
                size = gtk_widget_get_allocated_height (parent);
466
 
        else
467
 
                size = gtk_widget_get_allocated_width (parent);
 
474
        else {
 
475
                GtkStyleContext *context;
 
476
                GtkStateFlags    state;
 
477
                GtkBorder        padding;
 
478
 
 
479
                state = gtk_widget_get_state_flags (widget);
 
480
                context = gtk_widget_get_style_context (widget);
 
481
                gtk_style_context_get_padding (context, state, &padding);
 
482
 
 
483
                size = gtk_widget_get_allocated_width (parent) + padding.top + padding.bottom;
 
484
        }
 
485
 
468
486
 
469
487
        *minimal_height = *natural_height = size;
470
488
}
580
598
static void
581
599
button_widget_init (ButtonWidget *button)
582
600
{
 
601
        GtkStyleContext *context;
 
602
 
583
603
        button->priv = BUTTON_WIDGET_GET_PRIVATE (button);
584
604
 
585
605
        button->priv->icon_theme = NULL;
589
609
        button->priv->filename   = NULL;
590
610
        
591
611
        button->priv->orientation = PANEL_ORIENTATION_TOP;
 
612
        context = gtk_widget_get_style_context (GTK_WIDGET (button));
 
613
        gtk_style_context_add_class (context, GTK_STYLE_CLASS_HORIZONTAL);
592
614
 
593
615
        button->priv->size = 0;
594
616
        
685
707
                                              "Whether to highlight the button on mouse over",
686
708
                                              TRUE,
687
709
                                              G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
688
 
 
689
710
}
690
711
 
691
712
GtkWidget *
762
783
button_widget_set_orientation (ButtonWidget     *button,
763
784
                               PanelOrientation  orientation)
764
785
{
 
786
        GtkStyleContext *context;
 
787
 
765
788
        g_return_if_fail (BUTTON_IS_WIDGET (button));
766
789
 
767
790
        if (button->priv->orientation == orientation)
769
792
 
770
793
        button->priv->orientation = orientation;
771
794
 
 
795
        /* Use css class "horizontal"/"vertical" for theming */
 
796
        context = gtk_widget_get_style_context (GTK_WIDGET (button));
 
797
        if (orientation & PANEL_HORIZONTAL_MASK) {
 
798
                gtk_style_context_remove_class (context, GTK_STYLE_CLASS_VERTICAL);
 
799
                gtk_style_context_add_class (context, GTK_STYLE_CLASS_HORIZONTAL);
 
800
        } else {
 
801
                gtk_style_context_remove_class (context, GTK_STYLE_CLASS_HORIZONTAL);
 
802
                gtk_style_context_add_class (context, GTK_STYLE_CLASS_VERTICAL);
 
803
        }
 
804
 
772
805
        /* Force a re-scale */
773
806
        button->priv->size = -1;
774
807