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

« back to all changes in this revision

Viewing changes to src/ui/preview-widget.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:
40
40
 
41
41
static GtkWidgetClass *parent_class;
42
42
 
43
 
GType
44
 
meta_preview_get_type (void)
45
 
{
46
 
  static GType preview_type = 0;
47
 
 
48
 
  if (!preview_type)
49
 
    {
50
 
      static const GtkTypeInfo preview_info =
51
 
      {
52
 
        "MetaPreview",
53
 
        sizeof (MetaPreview),
54
 
        sizeof (MetaPreviewClass),
55
 
        (GtkClassInitFunc) meta_preview_class_init,
56
 
        (GtkObjectInitFunc) meta_preview_init,
57
 
        /* reserved_1 */ NULL,
58
 
        /* reserved_2 */ NULL,
59
 
        (GtkClassInitFunc) NULL,
60
 
      };
61
 
 
62
 
      preview_type = gtk_type_unique (GTK_TYPE_BIN, &preview_info);
63
 
    }
64
 
 
65
 
  return preview_type;
66
 
}
 
43
G_DEFINE_TYPE (MetaPreview, meta_preview, GTK_TYPE_BIN);
67
44
 
68
45
static void
69
46
meta_preview_class_init (MetaPreviewClass *class)
125
102
{
126
103
  MetaPreview *preview;
127
104
  
128
 
  preview = gtk_type_new (META_TYPE_PREVIEW);
 
105
  preview = g_object_new (META_TYPE_PREVIEW, NULL);
129
106
  
130
107
  return GTK_WIDGET (preview);
131
108
}
316
293
{
317
294
  MetaPreview *preview;
318
295
  int border_width;
319
 
  GtkAllocation child_allocation;
 
296
  GtkAllocation widget_allocation, child_allocation;
320
297
  GtkWidget *child;
321
298
  
322
299
  preview = META_PREVIEW (widget);
323
300
 
324
301
  ensure_info (preview);
325
302
  
326
 
  widget->allocation = *allocation;
 
303
  gtk_widget_set_allocation (widget, allocation);
327
304
 
328
305
  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
329
306
  
331
308
  if (child &&
332
309
      gtk_widget_get_visible (child))
333
310
    {
334
 
      child_allocation.x = widget->allocation.x + border_width + preview->left_width;
335
 
      child_allocation.y = widget->allocation.y + border_width + preview->top_height;
 
311
      gtk_widget_get_allocation (widget, &widget_allocation);
 
312
      child_allocation.x = widget_allocation.x + border_width + preview->left_width;
 
313
      child_allocation.y = widget_allocation.y + border_width + preview->top_height;
336
314
      
337
 
      child_allocation.width = MAX (1, widget->allocation.width - border_width * 2 - preview->left_width - preview->right_width);
338
 
      child_allocation.height = MAX (1, widget->allocation.height - border_width * 2 - preview->top_height - preview->bottom_height);
 
315
      child_allocation.width = MAX (1, widget_allocation.width - border_width * 2 - preview->left_width - preview->right_width);
 
316
      child_allocation.height = MAX (1, widget_allocation.height - border_width * 2 - preview->top_height - preview->bottom_height);
339
317
 
340
318
      gtk_widget_size_allocate (gtk_bin_get_child (GTK_BIN (widget)), &child_allocation);
341
319
    }