~ubuntu-branches/ubuntu/natty/avant-window-navigator/natty

« back to all changes in this revision

Viewing changes to applets/taskmanager/labelled-separator.c

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne
  • Date: 2010-12-17 13:48:28 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20101217134828-l394fb03wdkxc3mq
Tags: 0.4.1~bzr803-0ubuntu1
* New upstream snapshot.
 - Fix a crash with signal 5 in _XError (LP: #612144)
 - Re-add "move to another workspace" to launcher (LP: #568555)
* debian/patches:
 - 02-ftbfs-python-2.6.patch: Refresh.
 - 03-python-import.patch: Refresh.
 - 04-lda-requierement.patch: New patch, lower desktop-agnostic requierement,
   the version in Natty is enough.
 - Drop all others patches, merged upstream.
* debian/copyright:
 - Update copyright years and upstream authors.
* debian/control:
 - Build-depends on valac-0.10 (>= 0.9.1), to force stable version of Vala.
* debian/libawn1.symbols:
 - Update with new symbols. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* labelled-separator.c generated by valac 0.10.0, the Vala compiler
 
2
 * generated from labelled-separator.vala, do not modify */
 
3
 
 
4
 
 
5
#include <glib.h>
 
6
#include <glib-object.h>
 
7
#include <gtk/gtk.h>
 
8
#include <stdlib.h>
 
9
#include <string.h>
 
10
#include <gdk/gdk.h>
 
11
 
 
12
 
 
13
#define TASK_MANAGER_TYPE_LABELLED_SEPARATOR (task_manager_labelled_separator_get_type ())
 
14
#define TASK_MANAGER_LABELLED_SEPARATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TASK_MANAGER_TYPE_LABELLED_SEPARATOR, TaskManagerLabelledSeparator))
 
15
#define TASK_MANAGER_LABELLED_SEPARATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TASK_MANAGER_TYPE_LABELLED_SEPARATOR, TaskManagerLabelledSeparatorClass))
 
16
#define TASK_MANAGER_IS_LABELLED_SEPARATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TASK_MANAGER_TYPE_LABELLED_SEPARATOR))
 
17
#define TASK_MANAGER_IS_LABELLED_SEPARATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TASK_MANAGER_TYPE_LABELLED_SEPARATOR))
 
18
#define TASK_MANAGER_LABELLED_SEPARATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TASK_MANAGER_TYPE_LABELLED_SEPARATOR, TaskManagerLabelledSeparatorClass))
 
19
 
 
20
typedef struct _TaskManagerLabelledSeparator TaskManagerLabelledSeparator;
 
21
typedef struct _TaskManagerLabelledSeparatorClass TaskManagerLabelledSeparatorClass;
 
22
typedef struct _TaskManagerLabelledSeparatorPrivate TaskManagerLabelledSeparatorPrivate;
 
23
 
 
24
struct _TaskManagerLabelledSeparator {
 
25
        GtkSeparatorMenuItem parent_instance;
 
26
        TaskManagerLabelledSeparatorPrivate * priv;
 
27
};
 
28
 
 
29
struct _TaskManagerLabelledSeparatorClass {
 
30
        GtkSeparatorMenuItemClass parent_class;
 
31
};
 
32
 
 
33
struct _TaskManagerLabelledSeparatorPrivate {
 
34
        GtkLabel* label_widget;
 
35
};
 
36
 
 
37
 
 
38
static gpointer task_manager_labelled_separator_parent_class = NULL;
 
39
 
 
40
GType task_manager_labelled_separator_get_type (void) G_GNUC_CONST;
 
41
#define TASK_MANAGER_LABELLED_SEPARATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TASK_MANAGER_TYPE_LABELLED_SEPARATOR, TaskManagerLabelledSeparatorPrivate))
 
42
enum  {
 
43
        TASK_MANAGER_LABELLED_SEPARATOR_DUMMY_PROPERTY
 
44
};
 
45
TaskManagerLabelledSeparator* task_manager_labelled_separator_new (const char* text);
 
46
TaskManagerLabelledSeparator* task_manager_labelled_separator_construct (GType object_type, const char* text);
 
47
static GType task_manager_labelled_separator_real_child_type (GtkContainer* base);
 
48
static gboolean task_manager_labelled_separator_real_expose_event (GtkWidget* base, GdkEventExpose* event);
 
49
static void task_manager_labelled_separator_finalize (GObject* obj);
 
50
 
 
51
 
 
52
 
 
53
TaskManagerLabelledSeparator* task_manager_labelled_separator_construct (GType object_type, const char* text) {
 
54
        TaskManagerLabelledSeparator * self;
 
55
        GtkWidget* _tmp0_;
 
56
        g_return_val_if_fail (text != NULL, NULL);
 
57
        self = (TaskManagerLabelledSeparator*) g_object_new (object_type, "label", text, NULL);
 
58
        self->priv->label_widget = (_tmp0_ = gtk_bin_get_child ((GtkBin*) self), GTK_IS_LABEL (_tmp0_) ? ((GtkLabel*) _tmp0_) : NULL);
 
59
        gtk_misc_set_alignment ((GtkMisc*) self->priv->label_widget, 0.5f, 0.5f);
 
60
        return self;
 
61
}
 
62
 
 
63
 
 
64
TaskManagerLabelledSeparator* task_manager_labelled_separator_new (const char* text) {
 
65
        return task_manager_labelled_separator_construct (TASK_MANAGER_TYPE_LABELLED_SEPARATOR, text);
 
66
}
 
67
 
 
68
 
 
69
static GType task_manager_labelled_separator_real_child_type (GtkContainer* base) {
 
70
        TaskManagerLabelledSeparator * self;
 
71
        GType result = 0UL;
 
72
        self = (TaskManagerLabelledSeparator*) base;
 
73
        result = GTK_TYPE_WIDGET;
 
74
        return result;
 
75
}
 
76
 
 
77
 
 
78
static gboolean task_manager_labelled_separator_real_expose_event (GtkWidget* base, GdkEventExpose* event) {
 
79
        TaskManagerLabelledSeparator * self;
 
80
        gboolean result = FALSE;
 
81
        gboolean wide_separators = FALSE;
 
82
        gint separator_height = 0;
 
83
        gint horizontal_padding = 0;
 
84
        GtkAllocation alloc = {0};
 
85
        gint xthickness;
 
86
        gint ythickness;
 
87
        self = (TaskManagerLabelledSeparator*) base;
 
88
        gtk_widget_get_allocation ((GtkWidget*) self, &alloc);
 
89
        gtk_widget_style_get ((GtkWidget*) self, "wide-separators", &wide_separators, "separator-height", &separator_height, "horizontal-padding", &horizontal_padding, NULL, NULL);
 
90
        xthickness = gtk_widget_get_style ((GtkWidget*) self)->xthickness;
 
91
        ythickness = gtk_widget_get_style ((GtkWidget*) self)->ythickness;
 
92
        if (wide_separators) {
 
93
                gtk_paint_box (gtk_widget_get_style ((GtkWidget*) self), gtk_widget_get_window ((GtkWidget*) self), GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT, &(*event).area, (GtkWidget*) self, "hseparator", (alloc.x + horizontal_padding) + xthickness, alloc.y + (((alloc.height - separator_height) - ythickness) / 2), alloc.width - (2 * (horizontal_padding + xthickness)), separator_height);
 
94
        } else {
 
95
                gtk_paint_hline (gtk_widget_get_style ((GtkWidget*) self), gtk_widget_get_window ((GtkWidget*) self), GTK_STATE_NORMAL, &(*event).area, (GtkWidget*) self, "menuitem", (alloc.x + horizontal_padding) + xthickness, (((alloc.x + alloc.width) - horizontal_padding) - xthickness) - 1, alloc.y + ((alloc.height - ythickness) / 2));
 
96
        }
 
97
        gtk_container_propagate_expose ((GtkContainer*) self, gtk_bin_get_child ((GtkBin*) self), event);
 
98
        result = TRUE;
 
99
        return result;
 
100
}
 
101
 
 
102
 
 
103
static void task_manager_labelled_separator_class_init (TaskManagerLabelledSeparatorClass * klass) {
 
104
        task_manager_labelled_separator_parent_class = g_type_class_peek_parent (klass);
 
105
        g_type_class_add_private (klass, sizeof (TaskManagerLabelledSeparatorPrivate));
 
106
        GTK_CONTAINER_CLASS (klass)->child_type = task_manager_labelled_separator_real_child_type;
 
107
        GTK_WIDGET_CLASS (klass)->expose_event = task_manager_labelled_separator_real_expose_event;
 
108
        G_OBJECT_CLASS (klass)->finalize = task_manager_labelled_separator_finalize;
 
109
}
 
110
 
 
111
 
 
112
static void task_manager_labelled_separator_instance_init (TaskManagerLabelledSeparator * self) {
 
113
        self->priv = TASK_MANAGER_LABELLED_SEPARATOR_GET_PRIVATE (self);
 
114
}
 
115
 
 
116
 
 
117
static void task_manager_labelled_separator_finalize (GObject* obj) {
 
118
        TaskManagerLabelledSeparator * self;
 
119
        self = TASK_MANAGER_LABELLED_SEPARATOR (obj);
 
120
        G_OBJECT_CLASS (task_manager_labelled_separator_parent_class)->finalize (obj);
 
121
}
 
122
 
 
123
 
 
124
GType task_manager_labelled_separator_get_type (void) {
 
125
        static volatile gsize task_manager_labelled_separator_type_id__volatile = 0;
 
126
        if (g_once_init_enter (&task_manager_labelled_separator_type_id__volatile)) {
 
127
                static const GTypeInfo g_define_type_info = { sizeof (TaskManagerLabelledSeparatorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) task_manager_labelled_separator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TaskManagerLabelledSeparator), 0, (GInstanceInitFunc) task_manager_labelled_separator_instance_init, NULL };
 
128
                GType task_manager_labelled_separator_type_id;
 
129
                task_manager_labelled_separator_type_id = g_type_register_static (GTK_TYPE_SEPARATOR_MENU_ITEM, "TaskManagerLabelledSeparator", &g_define_type_info, 0);
 
130
                g_once_init_leave (&task_manager_labelled_separator_type_id__volatile, task_manager_labelled_separator_type_id);
 
131
        }
 
132
        return task_manager_labelled_separator_type_id__volatile;
 
133
}
 
134
 
 
135
 
 
136
 
 
137