~mterry/ubuntu/natty/gnome-shell/wip

« back to all changes in this revision

Viewing changes to src/st/st-border-image.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2009-10-12 22:44:00 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20091012224400-k91p42yvou07i525
Tags: 2.28.0-0ubuntu1
* New upstream version
* debian/control:
  - updated build requirement
* debian/patches/80_git_change_fix_alt_tab_ressource_usage.patch:
  - git change to fix ressources not being freed on alt-tab

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 
2
 
 
3
#include <config.h>
 
4
 
 
5
#include "st-border-image.h"
 
6
 
 
7
struct _StBorderImage {
 
8
  GObject parent;
 
9
 
 
10
  char *filename;
 
11
  int border_top;
 
12
  int border_right;
 
13
  int border_bottom;
 
14
  int border_left;
 
15
};
 
16
 
 
17
struct _StBorderImageClass {
 
18
  GObjectClass parent_class;
 
19
 
 
20
};
 
21
 
 
22
G_DEFINE_TYPE (StBorderImage, st_border_image, G_TYPE_OBJECT)
 
23
 
 
24
static void
 
25
st_border_image_finalize (GObject *object)
 
26
{
 
27
  StBorderImage *image = ST_BORDER_IMAGE (object);
 
28
 
 
29
  g_free (image->filename);
 
30
 
 
31
  G_OBJECT_CLASS (st_border_image_parent_class)->finalize (object);
 
32
}
 
33
 
 
34
static void
 
35
st_border_image_class_init (StBorderImageClass *klass)
 
36
{
 
37
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
38
 
 
39
  object_class->finalize = st_border_image_finalize;
 
40
}
 
41
 
 
42
static void
 
43
st_border_image_init (StBorderImage *image)
 
44
{
 
45
}
 
46
 
 
47
StBorderImage *
 
48
st_border_image_new (const char *filename,
 
49
                       int         border_top,
 
50
                       int         border_right,
 
51
                       int         border_bottom,
 
52
                       int         border_left)
 
53
{
 
54
  StBorderImage *image;
 
55
 
 
56
  image = g_object_new (ST_TYPE_BORDER_IMAGE, NULL);
 
57
 
 
58
  image->filename = g_strdup (filename);
 
59
  image->border_top = border_top;
 
60
  image->border_right = border_right;
 
61
  image->border_bottom = border_bottom;
 
62
  image->border_left = border_left;
 
63
 
 
64
  return image;
 
65
}
 
66
 
 
67
const char *
 
68
st_border_image_get_filename (StBorderImage *image)
 
69
{
 
70
  g_return_val_if_fail (ST_IS_BORDER_IMAGE (image), NULL);
 
71
 
 
72
  return image->filename;
 
73
}
 
74
 
 
75
void
 
76
st_border_image_get_borders (StBorderImage *image,
 
77
                             int           *border_top,
 
78
                             int           *border_right,
 
79
                             int           *border_bottom,
 
80
                             int           *border_left)
 
81
{
 
82
  g_return_if_fail (ST_IS_BORDER_IMAGE (image));
 
83
 
 
84
  if (border_top)
 
85
    *border_top = image->border_top;
 
86
  if (border_right)
 
87
    *border_right = image->border_right;
 
88
  if (border_bottom)
 
89
    *border_bottom = image->border_bottom;
 
90
  if (border_left)
 
91
    *border_left = image->border_left;
 
92
}