~ubuntu-branches/ubuntu/lucid/tomboy/lucid-proposed

« back to all changes in this revision

Viewing changes to libtomboy/eggtrayicon.c

Tags: upstream-0.3.9+dfsg
ImportĀ upstreamĀ versionĀ 0.3.9+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
static void egg_tray_icon_realize   (GtkWidget *widget);
63
63
static void egg_tray_icon_unrealize (GtkWidget *widget);
64
64
 
 
65
static void egg_tray_icon_add (GtkContainer *container,
 
66
                               GtkWidget    *widget);
 
67
 
65
68
static void egg_tray_icon_update_manager_window (EggTrayIcon *icon);
66
69
 
67
70
GType
104
107
{
105
108
  GObjectClass *gobject_class = (GObjectClass *)klass;
106
109
  GtkWidgetClass *widget_class = (GtkWidgetClass *)klass;
 
110
  GtkContainerClass *container_class = (GtkContainerClass *)klass;
107
111
 
108
112
  parent_class = g_type_class_peek_parent (klass);
109
113
 
112
116
  widget_class->realize   = egg_tray_icon_realize;
113
117
  widget_class->unrealize = egg_tray_icon_unrealize;
114
118
 
 
119
  container_class->add = egg_tray_icon_add;
 
120
 
115
121
  g_object_class_install_property (gobject_class,
116
122
                                   PROP_ORIENTATION,
117
123
                                   g_param_spec_enum ("orientation",
330
336
    }
331
337
}
332
338
 
 
339
static gboolean
 
340
transparent_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
 
341
{
 
342
  gdk_window_clear_area (widget->window, event->area.x, event->area.y,
 
343
                         event->area.width, event->area.height);
 
344
  return FALSE;
 
345
}
 
346
 
 
347
static void
 
348
make_transparent_again (GtkWidget *widget, GtkStyle *previous_style,
 
349
                        gpointer user_data)
 
350
{
 
351
  gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
 
352
}
 
353
 
 
354
static void
 
355
make_transparent (GtkWidget *widget, gpointer user_data)
 
356
{
 
357
  if (GTK_WIDGET_NO_WINDOW (widget) || GTK_WIDGET_APP_PAINTABLE (widget))
 
358
    return;
 
359
 
 
360
  gtk_widget_set_app_paintable (widget, TRUE);
 
361
  gtk_widget_set_double_buffered (widget, FALSE);
 
362
  gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
 
363
  g_signal_connect (widget, "expose_event",
 
364
                    G_CALLBACK (transparent_expose_event), NULL);
 
365
  g_signal_connect_after (widget, "style_set",
 
366
                          G_CALLBACK (make_transparent_again), NULL);
 
367
}       
 
368
 
333
369
static void
334
370
egg_tray_icon_realize (GtkWidget *widget)
335
371
{
343
379
  if (GTK_WIDGET_CLASS (parent_class)->realize)
344
380
    GTK_WIDGET_CLASS (parent_class)->realize (widget);
345
381
 
 
382
  make_transparent (widget, NULL);
 
383
 
346
384
  screen = gtk_widget_get_screen (widget);
347
385
  display = gdk_screen_get_display (screen);
348
386
  xdisplay = gdk_x11_display_get_xdisplay (display);
373
411
                         egg_tray_icon_manager_filter, icon);
374
412
}
375
413
 
 
414
static void
 
415
egg_tray_icon_add (GtkContainer *container, GtkWidget *widget)
 
416
{
 
417
  g_signal_connect (widget, "realize",
 
418
                    G_CALLBACK (make_transparent), NULL);
 
419
  GTK_CONTAINER_CLASS (parent_class)->add (container, widget);
 
420
}
 
421
 
376
422
EggTrayIcon *
377
423
egg_tray_icon_new_for_xscreen (Screen *xscreen, const char *name)
378
424
{