~muktupavels/metacity/adwaita-icon-theme-lp-1414613

« back to all changes in this revision

Viewing changes to src/ui/themewidget.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2012-08-23 11:12:43 UTC
  • mfrom: (1.3.3)
  • mto: (2.5.2 sid) (1.4.2)
  • mto: This revision was merged to the branch mainline in revision 122.
  • Revision ID: package-import@ubuntu.com-20120823111243-0hjp8cv5xn2jr6jc
ImportĀ upstreamĀ versionĀ 2.34.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
36
36
static GtkMiscClass *parent_class;
37
37
 
38
 
GType
39
 
meta_area_get_type (void)
40
 
{
41
 
  static GType area_type = 0;
42
 
 
43
 
  if (!area_type)
44
 
    {
45
 
      static const GtkTypeInfo area_info =
46
 
      {
47
 
        "MetaArea",
48
 
        sizeof (MetaArea),
49
 
        sizeof (MetaAreaClass),
50
 
        (GtkClassInitFunc) meta_area_class_init,
51
 
        (GtkObjectInitFunc) meta_area_init,
52
 
        /* reserved_1 */ NULL,
53
 
        /* reserved_2 */ NULL,
54
 
        (GtkClassInitFunc) NULL,
55
 
      };
56
 
 
57
 
      area_type = gtk_type_unique (GTK_TYPE_MISC, &area_info);
58
 
    }
59
 
 
60
 
  return area_type;
61
 
}
 
38
G_DEFINE_TYPE (MetaArea, meta_area, GTK_TYPE_MISC);
62
39
 
63
40
static void
64
41
meta_area_class_init (MetaAreaClass *class)
65
42
{
66
43
  GObjectClass *gobject_class = G_OBJECT_CLASS (class);
67
 
  GtkObjectClass *object_class;
68
44
  GtkWidgetClass *widget_class;
69
45
 
70
 
  object_class = (GtkObjectClass*) class;
71
46
  widget_class = (GtkWidgetClass*) class;
72
47
  parent_class = g_type_class_peek (gtk_misc_get_type ());
73
48
 
80
55
static void
81
56
meta_area_init (MetaArea *area)
82
57
{
83
 
  GTK_WIDGET_SET_FLAGS (area, GTK_NO_WINDOW);
 
58
  gtk_widget_set_has_window (GTK_WIDGET (area), FALSE);
84
59
}
85
60
 
86
61
GtkWidget*
88
63
{
89
64
  MetaArea *area;
90
65
  
91
 
  area = gtk_type_new (META_TYPE_AREA);
 
66
  area = g_object_new (META_TYPE_AREA, NULL);
92
67
  
93
68
  return GTK_WIDGET (area);
94
69
}
111
86
                  GdkEventExpose *event)
112
87
{
113
88
  MetaArea *area;
 
89
  GtkAllocation allocation;
 
90
  GtkRequisition requisition;
114
91
  GtkMisc *misc;
115
92
  gint x, y;
116
 
  gfloat xalign;
 
93
  gint xpad, ypad;
 
94
  gfloat xalign, yalign;
117
95
 
118
96
  g_return_val_if_fail (META_IS_AREA (widget), FALSE);
119
97
  g_return_val_if_fail (event != NULL, FALSE);
120
98
 
121
 
  if (GTK_WIDGET_DRAWABLE (widget))
 
99
  if (gtk_widget_is_drawable (widget))
122
100
    {
123
101
      area = META_AREA (widget);
124
102
      misc = GTK_MISC (widget);
125
103
 
126
 
      if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
127
 
        xalign = misc->xalign;
128
 
      else
129
 
        xalign = 1.0 - misc->xalign;
 
104
      gtk_widget_get_allocation (widget, &allocation);
 
105
      gtk_widget_get_requisition (widget, &requisition);
 
106
      gtk_misc_get_alignment (misc, &xalign, &yalign);
 
107
      gtk_misc_get_padding (misc, &xpad, &ypad);
 
108
 
 
109
      if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
 
110
        xalign = 1.0 - xalign;
130
111
  
131
 
      x = floor (widget->allocation.x + misc->xpad
132
 
                 + ((widget->allocation.width - widget->requisition.width) * xalign)
 
112
      x = floor (allocation.x + xpad
 
113
                 + ((allocation.width - requisition.width) * xalign)
133
114
                 + 0.5);
134
 
      y = floor (widget->allocation.y + misc->ypad 
135
 
                 + ((widget->allocation.height - widget->requisition.height) * misc->yalign)
 
115
      y = floor (allocation.y + ypad
 
116
                 + ((allocation.height - requisition.height) * yalign)
136
117
                 + 0.5);
137
118
      
138
119
      if (area->expose_func)