~ubuntu-branches/ubuntu/oneiric/gnome-panel/oneiric

« back to all changes in this revision

Viewing changes to applets/notification_area/fixedtip.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2011-05-30 11:04:49 UTC
  • mfrom: (1.3.4 upstream)
  • mto: This revision was merged to the branch mainline in revision 204.
  • Revision ID: james.westby@ubuntu.com-20110530110449-ut1tc5t61rpvf9e3
Tags: upstream-3.0.2
ImportĀ upstreamĀ versionĀ 3.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
}
53
53
 
54
54
static gboolean
55
 
expose_handler (GtkWidget *fixedtip)
 
55
na_fixed_tip_draw (GtkWidget *widget, cairo_t *cr)
56
56
{
57
 
  GtkRequisition req;
58
 
 
59
 
  gtk_widget_size_request (fixedtip, &req);
60
 
 
61
 
  gtk_paint_flat_box (gtk_widget_get_style (fixedtip),
62
 
                      gtk_widget_get_window (fixedtip),
63
 
                      GTK_STATE_NORMAL, GTK_SHADOW_OUT, 
64
 
                      NULL, fixedtip, "tooltip",
65
 
                      0, 0, req.width, req.height);
 
57
  GtkStyleContext *context;
 
58
  GtkStateFlags state;
 
59
  int width, height;
 
60
 
 
61
  width = gtk_widget_get_allocated_width (widget);
 
62
  height = gtk_widget_get_allocated_height (widget);
 
63
 
 
64
  state = gtk_widget_get_state_flags (widget);
 
65
  context = gtk_widget_get_style_context (widget);
 
66
  gtk_style_context_save (context);
 
67
  gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOOLTIP);
 
68
  gtk_style_context_set_state (context, state);
 
69
 
 
70
  cairo_save (cr);
 
71
  gtk_render_background (context, cr,
 
72
                         0., 0.,
 
73
                         (gdouble)width,
 
74
                         (gdouble)height);
 
75
  cairo_restore (cr);
 
76
 
 
77
  gtk_style_context_restore (context);
66
78
 
67
79
  return FALSE;
68
80
}
70
82
static void
71
83
na_fixed_tip_class_init (NaFixedTipClass *class)
72
84
{
 
85
  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
 
86
 
 
87
  widget_class->draw = na_fixed_tip_draw;
 
88
 
73
89
  fixedtip_signals[CLICKED] =
74
90
    g_signal_new ("clicked",
75
91
                  G_OBJECT_CLASS_TYPE (class),
106
122
  gtk_container_add (GTK_CONTAINER (fixedtip), label);
107
123
  fixedtip->priv->label = label;
108
124
 
109
 
  g_signal_connect (fixedtip, "expose_event",
110
 
                    G_CALLBACK (expose_handler), NULL);
111
 
 
112
125
  gtk_widget_add_events (GTK_WIDGET (fixedtip), GDK_BUTTON_PRESS_MASK);
113
 
  
 
126
 
114
127
  g_signal_connect (fixedtip, "button_press_event",
115
128
                    G_CALLBACK (button_press_handler), NULL);
116
129
 
135
148
 
136
149
  gtk_window_set_screen (GTK_WINDOW (fixedtip), screen);
137
150
 
138
 
  gtk_widget_size_request (GTK_WIDGET (fixedtip), &req);
 
151
  gtk_widget_get_preferred_size (GTK_WIDGET (fixedtip), &req, NULL);
139
152
 
140
153
  gdk_window_get_origin (parent_window, &root_x, &root_y);
141
 
  gdk_drawable_get_size (GDK_DRAWABLE (parent_window),
142
 
                         &parent_width, &parent_height);
 
154
  parent_width = gdk_window_get_width (parent_window);
 
155
  parent_height = gdk_window_get_height (parent_window);
143
156
 
144
157
  screen_width = gdk_screen_get_width (screen);
145
158
  screen_height = gdk_screen_get_height (screen);