Merge lp:~gordallott/libunity-misc/port-to-gdk3-gtk3 into lp:libunity-misc

Proposed by Gord Allott on 2011-06-16
Status: Merged
Merge reported by: Neil J. Patel
Merged at revision: not available
Proposed branch: lp:~gordallott/libunity-misc/port-to-gdk3-gtk3
Merge into: lp:libunity-misc
Diff against target: 1303 lines (+438/-262)
10 files modified
configure.ac (+3/-3)
examples/Makefile.am (+4/-4)
gtk-doc.make (+39/-20)
unity-misc/fixedtip.c (+30/-17)
unity-misc/na-tray-child.c (+39/-48)
unity-misc/na-tray-child.h (+1/-1)
unity-misc/na-tray-manager.c (+218/-87)
unity-misc/na-tray-manager.h (+17/-0)
unity-misc/na-tray.c (+76/-72)
unity-misc/na-tray.h (+11/-10)
To merge this branch: bzr merge lp:~gordallott/libunity-misc/port-to-gdk3-gtk3
Reviewer Review Type Date Requested Status
Neil J. Patel (community) 2011-06-16 Approve on 2011-06-17
Review via email: mp+64820@code.launchpad.net

Description of the change

imports from the gnome-panel notification applet for the tray stuff to push us up to gtk/gdk3

To post a comment you must log in.
Neil J. Patel (njpatel) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2011-02-17 17:42:41 +0000
3+++ configure.ac 2011-06-16 13:19:23 +0000
4@@ -68,9 +68,9 @@
5 PKG_CHECK_MODULES(UNITY_MISC,
6 glib-2.0 >= 2.22
7 gobject-2.0 >= 2.22
8- gdk-x11-2.0 >= 2.18
9- gtk+-2.0 >= 2.18
10- gtk+-x11-2.0 >= 2.18
11+ gdk-x11-3.0 >= 3.0
12+ gtk+-3.0 >= 3.0
13+ gtk+-x11-3.0 >= 3.0
14 )
15 AC_SUBST(UNITY_MISC_CFLAGS)
16 AC_SUBST(UNITY_MISC_LIBS)
17
18=== modified file 'examples/Makefile.am'
19--- examples/Makefile.am 2011-02-13 16:15:41 +0000
20+++ examples/Makefile.am 2011-06-16 13:19:23 +0000
21@@ -1,5 +1,5 @@
22-noinst_PROGRAMS = \
23- systray
24+#noinst_PROGRAMS = \
25+# systray
26
27 AM_CPPFLAGS = \
28 -I$(top_srcdir) \
29@@ -8,5 +8,5 @@
30 $(UNITY_MISC_CFLAGS) \
31 $(MAINTAINER_CFLAGS)
32
33-systray_SOURCES = systray.c
34-systray_LDADD = $(top_builddir)/unity-misc/libunity-misc.la $(UNITY_MISC_LIBS)
35+#systray_SOURCES = systray.c
36+#systray_LDADD = $(top_builddir)/unity-misc/libunity-misc.la $(UNITY_MISC_LIBS)
37
38=== modified file 'gtk-doc.make'
39--- gtk-doc.make 2011-02-13 16:15:41 +0000
40+++ gtk-doc.make 2011-06-16 13:19:23 +0000
41@@ -23,13 +23,15 @@
42
43 TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
44
45-EXTRA_DIST = \
46+SETUP_FILES = \
47 $(content_files) \
48- $(HTML_IMAGES) \
49 $(DOC_MAIN_SGML_FILE) \
50 $(DOC_MODULE)-sections.txt \
51 $(DOC_MODULE)-overrides.txt
52
53+EXTRA_DIST = \
54+ $(SETUP_FILES)
55+
56 DOC_STAMPS=setup-build.stamp scan-build.stamp tmpl-build.stamp sgml-build.stamp \
57 html-build.stamp pdf-build.stamp \
58 setup.stamp tmpl.stamp sgml.stamp html.stamp pdf.stamp
59@@ -71,17 +73,20 @@
60
61 #### setup ####
62
63-setup-build.stamp::
64+setup-build.stamp:
65 -@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
66- cp -a $(abs_srcdir)/$(DOC_MAIN_SGML_FILE) $(abs_builddir)/; \
67- cp -a $(abs_srcdir)/$(DOC_MODULE)* $(abs_builddir)/; \
68- if test "x$(content_files)" != "x" ; then \
69- for file in $(content_files) ; do \
70- test -f $(abs_srcdir)/$$file || \
71- cp -a $(abs_srcdir)/$$file $(abs_builddir)/; \
72+ echo 'gtk-doc: Preparing build'; \
73+ files=`echo $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types`; \
74+ if test "x$$files" != "x" ; then \
75+ for file in $$files ; do \
76+ test -f $(abs_srcdir)/$$file && \
77+ cp -p $(abs_srcdir)/$$file $(abs_builddir)/; \
78 done \
79- fi \
80+ fi; \
81+ test -f $(abs_srcdir)/tmpl && \
82+ cp -rp $(abs_srcdir)/tmpl $(abs_builddir)/; \
83 fi
84+ @touch setup-build.stamp
85
86
87 setup.stamp: setup-build.stamp
88@@ -92,7 +97,7 @@
89
90 scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
91 @echo 'gtk-doc: Scanning header files'
92- @_source_dir='' ;
93+ @_source_dir='' ; \
94 for i in $(DOC_SOURCE_DIR) ; do \
95 _source_dir="$${_source_dir} --source-dir=$$i" ; \
96 done ; \
97@@ -111,9 +116,14 @@
98
99 #### templates ####
100
101-tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
102+tmpl-build.stamp: setup.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
103 @echo 'gtk-doc: Rebuilding template files'
104 @gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS)
105+ @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
106+ if test -w $(abs_srcdir) ; then \
107+ cp -rp $(abs_builddir)/tmpl $(abs_srcdir)/; \
108+ fi \
109+ fi
110 @touch tmpl-build.stamp
111
112 tmpl.stamp: tmpl-build.stamp
113@@ -149,7 +159,15 @@
114 mkhtml_options=--path="$(abs_srcdir)"; \
115 fi; \
116 cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
117- @test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) $(abs_builddir)/html )
118+ -@test "x$(HTML_IMAGES)" = "x" || \
119+ for file in $(HTML_IMAGES) ; do \
120+ if test -f $(abs_srcdir)/$$file ; then \
121+ cp $(abs_srcdir)/$$file $(abs_builddir)/html; \
122+ fi; \
123+ if test -f $(abs_builddir)/$$file ; then \
124+ cp $(abs_builddir)/$$file $(abs_builddir)/html; \
125+ fi; \
126+ done;
127 @echo 'gtk-doc: Fixing cross-references'
128 @gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
129 @touch html-build.stamp
130@@ -179,10 +197,11 @@
131 rm -rf .libs
132
133 distclean-local:
134- rm -rf xml $(REPORT_FILES) $(DOC_MODULE).pdf \
135+ rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \
136 $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
137 if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
138- rm -f $(DOC_MAIN_SGML_FILE) $(DOC_MODULE)*; \
139+ rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \
140+ rm -rf tmpl; \
141 fi
142
143 maintainer-clean-local: clean
144@@ -234,11 +253,11 @@
145 dist-hook: dist-check-gtkdoc dist-hook-local
146 mkdir $(distdir)/tmpl
147 mkdir $(distdir)/html
148- -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
149- cp $(srcdir)/html/* $(distdir)/html
150- -cp $(srcdir)/$(DOC_MODULE).pdf $(distdir)/
151- -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
152- -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
153+ -cp $(build)/tmpl/*.sgml $(distdir)/tmpl
154+ cp $(builddir)/html/* $(distdir)/html
155+ -cp $(builddir)/$(DOC_MODULE).pdf $(distdir)/
156+ -cp $(build)/$(DOC_MODULE).types $(distdir)/
157+ -cp $(build)/$(DOC_MODULE)-sections.txt $(distdir)/
158 cd $(distdir) && rm -f $(DISTCLEANFILES)
159 $(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html
160
161
162=== modified file 'unity-misc/fixedtip.c'
163--- unity-misc/fixedtip.c 2011-02-14 10:15:57 +0000
164+++ unity-misc/fixedtip.c 2011-06-16 13:19:23 +0000
165@@ -52,17 +52,29 @@
166 }
167
168 static gboolean
169-expose_handler (GtkWidget *fixedtip)
170+na_fixed_tip_draw (GtkWidget *widget, cairo_t *cr)
171 {
172- GtkRequisition req;
173-
174- gtk_widget_size_request (fixedtip, &req);
175-
176- gtk_paint_flat_box (gtk_widget_get_style (fixedtip),
177- gtk_widget_get_window (fixedtip),
178- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
179- NULL, fixedtip, "tooltip",
180- 0, 0, req.width, req.height);
181+ GtkStyleContext *context;
182+ GtkStateFlags state;
183+ int width, height;
184+
185+ width = gtk_widget_get_allocated_width (widget);
186+ height = gtk_widget_get_allocated_height (widget);
187+
188+ state = gtk_widget_get_state_flags (widget);
189+ context = gtk_widget_get_style_context (widget);
190+ gtk_style_context_save (context);
191+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOOLTIP);
192+ gtk_style_context_set_state (context, state);
193+
194+ cairo_save (cr);
195+ gtk_render_background (context, cr,
196+ 0., 0.,
197+ (gdouble)width,
198+ (gdouble)height);
199+ cairo_restore (cr);
200+
201+ gtk_style_context_restore (context);
202
203 return FALSE;
204 }
205@@ -70,6 +82,10 @@
206 static void
207 na_fixed_tip_class_init (NaFixedTipClass *class)
208 {
209+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
210+
211+ widget_class->draw = na_fixed_tip_draw;
212+
213 fixedtip_signals[CLICKED] =
214 g_signal_new ("clicked",
215 G_OBJECT_CLASS_TYPE (class),
216@@ -106,11 +122,8 @@
217 gtk_container_add (GTK_CONTAINER (fixedtip), label);
218 fixedtip->priv->label = label;
219
220- g_signal_connect (fixedtip, "expose_event",
221- G_CALLBACK (expose_handler), NULL);
222-
223 gtk_widget_add_events (GTK_WIDGET (fixedtip), GDK_BUTTON_PRESS_MASK);
224-
225+
226 g_signal_connect (fixedtip, "button_press_event",
227 G_CALLBACK (button_press_handler), NULL);
228
229@@ -135,11 +148,11 @@
230
231 gtk_window_set_screen (GTK_WINDOW (fixedtip), screen);
232
233- gtk_widget_size_request (GTK_WIDGET (fixedtip), &req);
234+ gtk_widget_get_preferred_size (GTK_WIDGET (fixedtip), &req, NULL);
235
236 gdk_window_get_origin (parent_window, &root_x, &root_y);
237- gdk_drawable_get_size (GDK_DRAWABLE (parent_window),
238- &parent_width, &parent_height);
239+ parent_width = gdk_window_get_width (parent_window);
240+ parent_height = gdk_window_get_height (parent_window);
241
242 screen_width = gdk_screen_get_width (screen);
243 screen_height = gdk_screen_get_height (screen);
244
245=== modified file 'unity-misc/na-tray-child.c'
246--- unity-misc/na-tray-child.c 2011-02-14 10:15:57 +0000
247+++ unity-misc/na-tray-child.c 2011-06-16 13:19:23 +0000
248@@ -24,7 +24,6 @@
249
250 #include "na-tray-child.h"
251
252-#include <glib/gi18n.h>
253 #include <gdk/gdk.h>
254 #include <gdk/gdkx.h>
255 #include <X11/Xatom.h>
256@@ -54,17 +53,18 @@
257 * extension. */
258
259 /* Set a transparent background */
260- GdkColor transparent = { 0, 0, 0, 0 }; /* only pixel=0 matters */
261- gdk_window_set_background (window, &transparent);
262+ cairo_pattern_t *transparent = cairo_pattern_create_rgba (0, 0, 0, 0);
263+ gdk_window_set_background_pattern (window, transparent);
264 gdk_window_set_composited (window, TRUE);
265+ cairo_pattern_destroy (transparent);
266
267 child->parent_relative_bg = FALSE;
268 }
269- else if (visual == gdk_drawable_get_visual (GDK_DRAWABLE (gdk_window_get_parent (window))))
270+ else if (visual == gdk_window_get_visual (gdk_window_get_parent (window)))
271 {
272 /* Otherwise, if the visual matches the visual of the parent window, we
273 * can use a parent-relative background and fake transparency. */
274- gdk_window_set_back_pixmap (window, NULL, TRUE);
275+ gdk_window_set_background_pattern (window, NULL);
276
277 child->parent_relative_bg = TRUE;
278 }
279@@ -172,32 +172,46 @@
280 }
281
282 /* The plug window should completely occupy the area of the child, so we won't
283- * get an expose event. But in case we do (the plug unmaps itself, say), this
284- * expose handler draws with real or fake transparency.
285+ * get a draw event. But in case we do (the plug unmaps itself, say), this
286+ * draw handler draws with real or fake transparency.
287 */
288 static gboolean
289-na_tray_child_expose_event (GtkWidget *widget,
290- GdkEventExpose *event)
291+na_tray_child_draw (GtkWidget *widget,
292+ cairo_t *cr)
293 {
294 NaTrayChild *child = NA_TRAY_CHILD (widget);
295- GdkWindow *window = gtk_widget_get_window (widget);
296
297 if (na_tray_child_has_alpha (child))
298 {
299 /* Clear to transparent */
300- cairo_t *cr = gdk_cairo_create (window);
301 cairo_set_source_rgba (cr, 0, 0, 0, 0);
302 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
303- gdk_cairo_region (cr, event->region);
304- cairo_fill (cr);
305- cairo_destroy (cr);
306+ cairo_paint (cr);
307 }
308 else if (child->parent_relative_bg)
309 {
310- /* Clear to parent-relative pixmap */
311- gdk_window_clear_area (window,
312- event->area.x, event->area.y,
313- event->area.width, event->area.height);
314+ GdkWindow *window;
315+ cairo_surface_t *target;
316+ GdkRectangle clip_rect;
317+
318+ window = gtk_widget_get_window (widget);
319+ target = cairo_get_group_target (cr);
320+
321+ gdk_cairo_get_clip_rectangle (cr, &clip_rect);
322+
323+ /* Clear to parent-relative pixmap
324+ * We need to use direct X access here because GDK doesn't know about
325+ * the parent relative pixmap. */
326+ cairo_surface_flush (target);
327+
328+ XClearArea (GDK_WINDOW_XDISPLAY (window),
329+ GDK_WINDOW_XID (window),
330+ clip_rect.x, clip_rect.y,
331+ clip_rect.width, clip_rect.height,
332+ False);
333+ cairo_surface_mark_dirty_rectangle (target,
334+ clip_rect.x, clip_rect.y,
335+ clip_rect.width, clip_rect.height);
336 }
337
338 return FALSE;
339@@ -221,7 +235,7 @@
340 widget_class->style_set = na_tray_child_style_set;
341 widget_class->realize = na_tray_child_realize;
342 widget_class->size_allocate = na_tray_child_size_allocate;
343- widget_class->expose_event = na_tray_child_expose_event;
344+ widget_class->draw = na_tray_child_draw;
345 }
346
347 GtkWidget *
348@@ -233,8 +247,6 @@
349 NaTrayChild *child;
350 GdkVisual *visual;
351 gboolean visual_has_alpha;
352- GdkColormap *colormap;
353- gboolean new_colormap;
354 int red_prec, green_prec, blue_prec, depth;
355 int result;
356
357@@ -250,7 +262,7 @@
358 gdk_error_trap_push ();
359 result = XGetWindowAttributes (xdisplay, icon_window,
360 &window_attributes);
361- gdk_error_trap_pop ();
362+ gdk_error_trap_pop_ignored ();
363
364 if (!result) /* Window already gone */
365 return NULL;
366@@ -260,24 +272,10 @@
367 if (!visual) /* Icon window is on another screen? */
368 return NULL;
369
370- new_colormap = FALSE;
371-
372- if (visual == gdk_screen_get_rgb_visual (screen))
373- colormap = gdk_screen_get_rgb_colormap (screen);
374- else if (visual == gdk_screen_get_rgba_visual (screen))
375- colormap = gdk_screen_get_rgba_colormap (screen);
376- else if (visual == gdk_screen_get_system_visual (screen))
377- colormap = gdk_screen_get_system_colormap (screen);
378- else
379- {
380- colormap = gdk_colormap_new (visual, FALSE);
381- new_colormap = TRUE;
382- }
383-
384 child = g_object_new (NA_TYPE_TRAY_CHILD, NULL);
385 child->icon_window = icon_window;
386
387- gtk_widget_set_colormap (GTK_WIDGET (child), colormap);
388+ gtk_widget_set_visual (GTK_WIDGET (child), visual);
389
390 /* We have alpha if the visual has something other than red, green,
391 * and blue */
392@@ -292,9 +290,6 @@
393
394 child->composited = child->has_alpha;
395
396- if (new_colormap)
397- g_object_unref (colormap);
398-
399 return GTK_WIDGET (child);
400 }
401
402@@ -422,7 +417,7 @@
403 gtk_widget_get_allocation (widget, &allocation);
404
405 xev.xexpose.type = Expose;
406- xev.xexpose.window = GDK_WINDOW_XWINDOW (plug_window);
407+ xev.xexpose.window = GDK_WINDOW_XID (plug_window);
408 xev.xexpose.x = 0;
409 xev.xexpose.y = 0;
410 xev.xexpose.width = allocation.width;
411@@ -430,15 +425,11 @@
412 xev.xexpose.count = 0;
413
414 gdk_error_trap_push ();
415- XSendEvent (GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (widget)),
416+ XSendEvent (xdisplay,
417 xev.xexpose.window,
418 False, ExposureMask,
419 &xev);
420- /* We have to sync to reliably catch errors from the XSendEvent(),
421- * since that is asynchronous.
422- */
423- XSync (xdisplay, False);
424- gdk_error_trap_pop ();
425+ gdk_error_trap_pop_ignored ();
426 #else
427 /* Hiding and showing is the safe way to do it, but can result in more
428 * flickering.
429@@ -482,7 +473,7 @@
430
431 gdk_error_trap_push ();
432 XGetClassHint (xdisplay, xwindow, &ch);
433- gdk_error_trap_pop ();
434+ gdk_error_trap_pop_ignored ();
435
436 if (res_class)
437 *res_class = NULL;
438
439=== modified file 'unity-misc/na-tray-child.h'
440--- unity-misc/na-tray-child.h 2011-02-14 10:15:57 +0000
441+++ unity-misc/na-tray-child.h 2011-06-16 13:19:23 +0000
442@@ -24,7 +24,7 @@
443 #define __NA_TRAY_CHILD_H__
444
445 #include <gtk/gtk.h>
446-#include <gdk/gdkx.h>
447+#include <gtk/gtkx.h>
448
449 G_BEGIN_DECLS
450
451
452=== modified file 'unity-misc/na-tray-manager.c'
453--- unity-misc/na-tray-manager.c 2011-02-14 10:15:57 +0000
454+++ unity-misc/na-tray-manager.c 2011-06-16 13:19:23 +0000
455@@ -26,8 +26,6 @@
456
457 #include "na-tray-manager.h"
458
459-#include <gdkconfig.h>
460-#include <glib/gi18n.h>
461 #if defined (GDK_WINDOWING_X11)
462 #include <gdk/gdkx.h>
463 #include <X11/Xatom.h>
464@@ -98,6 +96,25 @@
465 {
466 manager->invisible = NULL;
467 manager->socket_table = g_hash_table_new (NULL, NULL);
468+
469+ manager->padding = 0;
470+ manager->icon_size = 0;
471+
472+ manager->fg.red = 0;
473+ manager->fg.green = 0;
474+ manager->fg.blue = 0;
475+
476+ manager->error.red = 0xffff;
477+ manager->error.green = 0;
478+ manager->error.blue = 0;
479+
480+ manager->warning.red = 0xffff;
481+ manager->warning.green = 0xffff;
482+ manager->warning.blue = 0;
483+
484+ manager->success.red = 0;
485+ manager->success.green = 0xffff;
486+ manager->success.blue = 0;
487 }
488
489 static void
490@@ -299,8 +316,8 @@
491 if (!gtk_socket_get_plug_window (GTK_SOCKET (child)))
492 {
493 /* Embedding failed, we won't get a plug-removed signal */
494+ /* This signal destroys the socket */
495 g_signal_emit (manager, manager_signals[TRAY_ICON_REMOVED], 0, child);
496- gtk_widget_destroy (child);
497 return;
498 }
499
500@@ -316,19 +333,13 @@
501 g_free (message);
502 }
503
504-static GdkFilterReturn
505-na_tray_manager_handle_client_message_message_data (GdkXEvent *xev,
506- GdkEvent *event,
507- gpointer data)
508+static void
509+na_tray_manager_handle_message_data (NaTrayManager *manager,
510+ XClientMessageEvent *xevent)
511 {
512- XClientMessageEvent *xevent;
513- NaTrayManager *manager;
514- GList *p;
515- int len;
516+ GList *p;
517+ int len;
518
519- xevent = (XClientMessageEvent *) xev;
520- manager = data;
521-
522 /* Try to see if we can find the pending message in the list */
523 for (p = manager->messages; p; p = p->next)
524 {
525@@ -362,8 +373,6 @@
526 break;
527 }
528 }
529-
530- return GDK_FILTER_REMOVE;
531 }
532
533 static void
534@@ -383,13 +392,17 @@
535 if (!socket)
536 return;
537
538+ timeout = xevent->data.l[2];
539+ len = xevent->data.l[3];
540+ id = xevent->data.l[4];
541+
542 /* Check if the same message is already in the queue and remove it if so */
543 for (p = manager->messages; p; p = p->next)
544 {
545 PendingMessage *pmsg = p->data;
546
547 if (xevent->window == pmsg->window &&
548- xevent->data.l[4] == pmsg->id)
549+ id == pmsg->id)
550 {
551 /* Hmm, we found it, now remove it */
552 pending_message_free (pmsg);
553@@ -399,10 +412,6 @@
554 }
555 }
556
557- timeout = xevent->data.l[2];
558- len = xevent->data.l[3];
559- id = xevent->data.l[4];
560-
561 if (len == 0)
562 {
563 g_signal_emit (manager, manager_signals[MESSAGE_SENT], 0,
564@@ -429,6 +438,9 @@
565 {
566 GList *p;
567 GtkSocket *socket;
568+ long id;
569+
570+ id = xevent->data.l[2];
571
572 /* Check if the message is in the queue and remove it if so */
573 for (p = manager->messages; p; p = p->next)
574@@ -436,7 +448,7 @@
575 PendingMessage *msg = p->data;
576
577 if (xevent->window == msg->window &&
578- xevent->data.l[4] == msg->id)
579+ id == msg->id)
580 {
581 pending_message_free (msg);
582 manager->messages = g_list_remove_link (manager->messages, p);
583@@ -456,39 +468,6 @@
584 }
585
586 static GdkFilterReturn
587-na_tray_manager_handle_client_message_opcode (GdkXEvent *xev,
588- GdkEvent *event,
589- gpointer data)
590-{
591- XClientMessageEvent *xevent;
592- NaTrayManager *manager;
593-
594- xevent = (XClientMessageEvent *) xev;
595- manager = data;
596-
597- switch (xevent->data.l[1])
598- {
599- case SYSTEM_TRAY_REQUEST_DOCK:
600- /* Ignore this one since we don't know on which window this was received
601- * and so we can't know for which screen this is. It will be handled
602- * in na_tray_manager_window_filter() since we also receive it there */
603- break;
604-
605- case SYSTEM_TRAY_BEGIN_MESSAGE:
606- na_tray_manager_handle_begin_message (manager, xevent);
607- return GDK_FILTER_REMOVE;
608-
609- case SYSTEM_TRAY_CANCEL_MESSAGE:
610- na_tray_manager_handle_cancel_message (manager, xevent);
611- return GDK_FILTER_REMOVE;
612- default:
613- break;
614- }
615-
616- return GDK_FILTER_CONTINUE;
617-}
618-
619-static GdkFilterReturn
620 na_tray_manager_window_filter (GdkXEvent *xev,
621 GdkEvent *event,
622 gpointer data)
623@@ -498,8 +477,7 @@
624
625 if (xevent->type == ClientMessage)
626 {
627- /* We handle this client message here. See comment in
628- * na_tray_manager_handle_client_message_opcode() for details */
629+ /* _NET_SYSTEM_TRAY_OPCODE: SYSTEM_TRAY_REQUEST_DOCK */
630 if (xevent->xclient.message_type == manager->opcode_atom &&
631 xevent->xclient.data.l[1] == SYSTEM_TRAY_REQUEST_DOCK)
632 {
633@@ -507,6 +485,29 @@
634 (XClientMessageEvent *) xevent);
635 return GDK_FILTER_REMOVE;
636 }
637+ /* _NET_SYSTEM_TRAY_OPCODE: SYSTEM_TRAY_BEGIN_MESSAGE */
638+ else if (xevent->xclient.message_type == manager->opcode_atom &&
639+ xevent->xclient.data.l[1] == SYSTEM_TRAY_BEGIN_MESSAGE)
640+ {
641+ na_tray_manager_handle_begin_message (manager,
642+ (XClientMessageEvent *) event);
643+ return GDK_FILTER_REMOVE;
644+ }
645+ /* _NET_SYSTEM_TRAY_OPCODE: SYSTEM_TRAY_CANCEL_MESSAGE */
646+ else if (xevent->xclient.message_type == manager->opcode_atom &&
647+ xevent->xclient.data.l[1] == SYSTEM_TRAY_CANCEL_MESSAGE)
648+ {
649+ na_tray_manager_handle_cancel_message (manager,
650+ (XClientMessageEvent *) event);
651+ return GDK_FILTER_REMOVE;
652+ }
653+ /* _NET_SYSTEM_TRAY_MESSAGE_DATA */
654+ else if (xevent->xclient.message_type == manager->message_data_atom)
655+ {
656+ na_tray_manager_handle_message_data (manager,
657+ (XClientMessageEvent *) event);
658+ return GDK_FILTER_REMOVE;
659+ }
660 }
661 else if (xevent->type == SelectionClear)
662 {
663@@ -564,9 +565,6 @@
664 TRUE);
665 }
666
667- //FIXME: we should also use gdk_remove_client_message_filter when it's
668- //available
669- // See bug #351254
670 gdk_window_remove_filter (window,
671 na_tray_manager_window_filter, manager);
672
673@@ -585,11 +583,9 @@
674 Atom orientation_atom;
675 gulong data[1];
676
677- if (!manager->invisible)
678- return;
679+ g_return_if_fail (manager->invisible != NULL);
680 window = gtk_widget_get_window (manager->invisible);
681- if (!window)
682- return;
683+ g_return_if_fail (window != NULL);
684
685 display = gtk_widget_get_display (manager->invisible);
686 orientation_atom = gdk_x11_get_xatom_by_name_for_display (display,
687@@ -600,7 +596,7 @@
688 SYSTEM_TRAY_ORIENTATION_VERT;
689
690 XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
691- GDK_WINDOW_XWINDOW (window),
692+ GDK_WINDOW_XID (window),
693 orientation_atom,
694 XA_CARDINAL, 32,
695 PropModeReplace,
696@@ -618,11 +614,9 @@
697 Atom visual_atom;
698 gulong data[1];
699
700- if (!manager->invisible)
701- return;
702+ g_return_if_fail (manager->invisible != NULL);
703 window = gtk_widget_get_window (manager->invisible);
704- if (!window)
705- return;
706+ g_return_if_fail (window != NULL);
707
708 /* The visual property is a hint to the tray icons as to what visual they
709 * should use for their windows. If the X server has RGBA colormaps, then
710@@ -638,25 +632,20 @@
711
712 if (gdk_screen_get_rgba_visual (manager->screen) != NULL &&
713 gdk_display_supports_composite (display))
714- {
715- xvisual = GDK_VISUAL_XVISUAL (gdk_screen_get_rgba_visual (manager->screen));
716- }
717+ xvisual = GDK_VISUAL_XVISUAL (gdk_screen_get_rgba_visual (manager->screen));
718 else
719 {
720 /* We actually want the visual of the tray where the icons will
721 * be embedded. In almost all cases, this will be the same as the visual
722 * of the screen.
723 */
724- GdkColormap *colormap;
725-
726- colormap = gdk_screen_get_default_colormap (manager->screen);
727- xvisual = GDK_VISUAL_XVISUAL (gdk_colormap_get_visual (colormap));
728+ xvisual = GDK_VISUAL_XVISUAL (gdk_screen_get_system_visual (manager->screen));
729 }
730
731 data[0] = XVisualIDFromVisual (xvisual);
732
733 XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
734- GDK_WINDOW_XWINDOW (window),
735+ GDK_WINDOW_XID (window),
736 visual_atom,
737 XA_VISUALID, 32,
738 PropModeReplace,
739@@ -664,6 +653,101 @@
740 #endif
741 }
742
743+static void
744+na_tray_manager_set_padding_property (NaTrayManager *manager)
745+{
746+#ifdef GDK_WINDOWING_X11
747+ GdkWindow *window;
748+ GdkDisplay *display;
749+ Atom atom;
750+ gulong data[1];
751+
752+ g_return_if_fail (manager->invisible != NULL);
753+ window = gtk_widget_get_window (manager->invisible);
754+ g_return_if_fail (window != NULL);
755+
756+ display = gtk_widget_get_display (manager->invisible);
757+ atom = gdk_x11_get_xatom_by_name_for_display (display,
758+ "_NET_SYSTEM_TRAY_PADDING");
759+
760+ data[0] = manager->padding;
761+
762+ XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
763+ GDK_WINDOW_XID (window),
764+ atom,
765+ XA_CARDINAL, 32,
766+ PropModeReplace,
767+ (guchar *) &data, 1);
768+#endif
769+}
770+
771+static void
772+na_tray_manager_set_icon_size_property (NaTrayManager *manager)
773+{
774+#ifdef GDK_WINDOWING_X11
775+ GdkWindow *window;
776+ GdkDisplay *display;
777+ Atom atom;
778+ gulong data[1];
779+
780+ g_return_if_fail (manager->invisible != NULL);
781+ window = gtk_widget_get_window (manager->invisible);
782+ g_return_if_fail (window != NULL);
783+
784+ display = gtk_widget_get_display (manager->invisible);
785+ atom = gdk_x11_get_xatom_by_name_for_display (display,
786+ "_NET_SYSTEM_TRAY_ICON_SIZE");
787+
788+ data[0] = manager->icon_size;
789+
790+ XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
791+ GDK_WINDOW_XID (window),
792+ atom,
793+ XA_CARDINAL, 32,
794+ PropModeReplace,
795+ (guchar *) &data, 1);
796+#endif
797+}
798+
799+static void
800+na_tray_manager_set_colors_property (NaTrayManager *manager)
801+{
802+#ifdef GDK_WINDOWING_X11
803+ GdkWindow *window;
804+ GdkDisplay *display;
805+ Atom atom;
806+ gulong data[12];
807+
808+ g_return_if_fail (manager->invisible != NULL);
809+ window = gtk_widget_get_window (manager->invisible);
810+ g_return_if_fail (window != NULL);
811+
812+ display = gtk_widget_get_display (manager->invisible);
813+ atom = gdk_x11_get_xatom_by_name_for_display (display,
814+ "_NET_SYSTEM_TRAY_COLORS");
815+
816+ data[0] = manager->fg.red;
817+ data[1] = manager->fg.green;
818+ data[2] = manager->fg.blue;
819+ data[3] = manager->error.red;
820+ data[4] = manager->error.green;
821+ data[5] = manager->error.blue;
822+ data[6] = manager->warning.red;
823+ data[7] = manager->warning.green;
824+ data[8] = manager->warning.blue;
825+ data[9] = manager->success.red;
826+ data[10] = manager->success.green;
827+ data[11] = manager->success.blue;
828+
829+ XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
830+ GDK_WINDOW_XID (window),
831+ atom,
832+ XA_CARDINAL, 32,
833+ PropModeReplace,
834+ (guchar *) &data, 12);
835+#endif
836+}
837+
838 #ifdef GDK_WINDOWING_X11
839
840 static gboolean
841@@ -709,6 +793,9 @@
842
843 na_tray_manager_set_orientation_property (manager);
844 na_tray_manager_set_visual_property (manager);
845+ na_tray_manager_set_padding_property (manager);
846+ na_tray_manager_set_icon_size_property (manager);
847+ na_tray_manager_set_colors_property (manager);
848
849 window = gtk_widget_get_window (invisible);
850
851@@ -734,7 +821,7 @@
852 xev.data.l[0] = timestamp;
853 xev.data.l[1] = gdk_x11_atom_to_xatom_for_display (display,
854 manager->selection_atom);
855- xev.data.l[2] = GDK_WINDOW_XWINDOW (window);
856+ xev.data.l[2] = GDK_WINDOW_XID (window);
857 xev.data.l[3] = 0; /* manager specific data */
858 xev.data.l[4] = 0; /* manager specific data */
859
860@@ -748,6 +835,8 @@
861
862 message_data_atom = gdk_atom_intern ("_NET_SYSTEM_TRAY_MESSAGE_DATA",
863 FALSE);
864+ manager->message_data_atom = gdk_x11_atom_to_xatom_for_display (display,
865+ message_data_atom);
866
867 /* Add a window filter */
868 #if 0
869@@ -756,17 +845,8 @@
870 G_CALLBACK (na_tray_manager_selection_clear_event),
871 manager);
872 #endif
873- /* This is for SYSTEM_TRAY_REQUEST_DOCK and SelectionClear */
874 gdk_window_add_filter (window,
875 na_tray_manager_window_filter, manager);
876- /* This is for SYSTEM_TRAY_BEGIN_MESSAGE and SYSTEM_TRAY_CANCEL_MESSAGE */
877- gdk_display_add_client_message_filter (display, opcode_atom,
878- na_tray_manager_handle_client_message_opcode,
879- manager);
880- /* This is for _NET_SYSTEM_TRAY_MESSAGE_DATA */
881- gdk_display_add_client_message_filter (display, message_data_atom,
882- na_tray_manager_handle_client_message_message_data,
883- manager);
884 return TRUE;
885 }
886 else
887@@ -850,6 +930,57 @@
888 }
889 }
890
891+void
892+na_tray_manager_set_padding (NaTrayManager *manager,
893+ gint padding)
894+{
895+ g_return_if_fail (NA_IS_TRAY_MANAGER (manager));
896+
897+ if (manager->padding != padding)
898+ {
899+ manager->padding = padding;
900+
901+ na_tray_manager_set_padding_property (manager);
902+ }
903+}
904+
905+void
906+na_tray_manager_set_icon_size (NaTrayManager *manager,
907+ gint icon_size)
908+{
909+ g_return_if_fail (NA_IS_TRAY_MANAGER (manager));
910+
911+ if (manager->icon_size != icon_size)
912+ {
913+ manager->icon_size = icon_size;
914+
915+ na_tray_manager_set_icon_size_property (manager);
916+ }
917+}
918+
919+void
920+na_tray_manager_set_colors (NaTrayManager *manager,
921+ GdkColor *fg,
922+ GdkColor *error,
923+ GdkColor *warning,
924+ GdkColor *success)
925+{
926+ g_return_if_fail (NA_IS_TRAY_MANAGER (manager));
927+
928+ if (!gdk_color_equal (&manager->fg, fg) ||
929+ !gdk_color_equal (&manager->error, error) ||
930+ !gdk_color_equal (&manager->warning, warning) ||
931+ !gdk_color_equal (&manager->success, success))
932+ {
933+ manager->fg = *fg;
934+ manager->error = *error;
935+ manager->warning = *warning;
936+ manager->success = *success;
937+
938+ na_tray_manager_set_colors_property (manager);
939+ }
940+}
941+
942 GtkOrientation
943 na_tray_manager_get_orientation (NaTrayManager *manager)
944 {
945
946=== modified file 'unity-misc/na-tray-manager.h'
947--- unity-misc/na-tray-manager.h 2010-01-12 11:34:41 +0000
948+++ unity-misc/na-tray-manager.h 2011-06-16 13:19:23 +0000
949@@ -50,11 +50,18 @@
950 #ifdef GDK_WINDOWING_X11
951 GdkAtom selection_atom;
952 Atom opcode_atom;
953+ Atom message_data_atom;
954 #endif
955
956 GtkWidget *invisible;
957 GdkScreen *screen;
958 GtkOrientation orientation;
959+ gint padding;
960+ gint icon_size;
961+ GdkColor fg;
962+ GdkColor error;
963+ GdkColor warning;
964+ GdkColor success;
965
966 GList *messages;
967 GHashTable *socket_table;
968@@ -91,6 +98,16 @@
969 void na_tray_manager_set_orientation (NaTrayManager *manager,
970 GtkOrientation orientation);
971 GtkOrientation na_tray_manager_get_orientation (NaTrayManager *manager);
972+void na_tray_manager_set_padding (NaTrayManager *manager,
973+ gint padding);
974+void na_tray_manager_set_icon_size (NaTrayManager *manager,
975+ gint padding);
976+void na_tray_manager_set_colors (NaTrayManager *manager,
977+ GdkColor *fg,
978+ GdkColor *error,
979+ GdkColor *warning,
980+ GdkColor *success);
981+
982
983 G_END_DECLS
984
985
986=== modified file 'unity-misc/na-tray.c'
987--- unity-misc/na-tray.c 2011-02-14 20:01:14 +0000
988+++ unity-misc/na-tray.c 2011-06-16 13:19:23 +0000
989@@ -29,7 +29,7 @@
990
991 #include "na-tray.h"
992
993-#define ICON_SPACING 3
994+#define ICON_SPACING 1
995 #define MIN_BOX_SIZE 3
996
997 typedef struct
998@@ -51,9 +51,6 @@
999 guint idle_redraw_id;
1000
1001 GtkOrientation orientation;
1002-
1003- NaTrayFilterCallback cb;
1004- gpointer data;
1005 };
1006
1007 typedef struct
1008@@ -85,25 +82,6 @@
1009
1010 static void icon_tip_show_next (IconTip *icontip);
1011
1012-/* NaBox, an instantiable GtkBox */
1013-
1014-typedef GtkBox NaBox;
1015-typedef GtkBoxClass NaBoxClass;
1016-
1017-static GType na_box_get_type (void);
1018-
1019-G_DEFINE_TYPE (NaBox, na_box, GTK_TYPE_BOX)
1020-
1021-static void
1022-na_box_init (NaBox *box)
1023-{
1024-}
1025-
1026-static void
1027-na_box_class_init (NaBoxClass *klass)
1028-{
1029-}
1030-
1031 /* NaTray */
1032
1033 G_DEFINE_TYPE (NaTray, na_tray, GTK_TYPE_BIN)
1034@@ -233,11 +211,6 @@
1035
1036 g_assert (priv->trays_screen == trays_screen);
1037
1038- if (priv->cb && !priv->cb (tray, icon, priv->data))
1039- {
1040- return;
1041- }
1042-
1043 g_hash_table_insert (trays_screen->icon_table, icon, tray);
1044
1045 position = find_icon_position (tray, icon);
1046@@ -253,13 +226,18 @@
1047 TraysScreen *trays_screen)
1048 {
1049 NaTray *tray;
1050+ NaTrayPrivate *priv;
1051
1052 tray = g_hash_table_lookup (trays_screen->icon_table, icon);
1053 if (tray == NULL)
1054 return;
1055
1056+ priv = tray->priv;
1057+
1058 g_assert (tray->priv->trays_screen == trays_screen);
1059
1060+ gtk_container_remove (GTK_CONTAINER (priv->box), icon);
1061+
1062 g_hash_table_remove (trays_screen->icon_table, icon);
1063 /* this will also destroy the tip associated to this icon */
1064 g_hash_table_remove (trays_screen->tip_table, icon);
1065@@ -533,10 +511,10 @@
1066 * gdk_window_set_composited(). We need to paint these children ourselves.
1067 */
1068 static void
1069-na_tray_expose_icon (GtkWidget *widget,
1070- gpointer data)
1071+na_tray_draw_icon (GtkWidget *widget,
1072+ gpointer data)
1073 {
1074- cairo_t *cr = data;
1075+ cairo_t *cr = (cairo_t *) data;
1076
1077 if (na_tray_child_has_alpha (NA_TRAY_CHILD (widget)))
1078 {
1079@@ -544,26 +522,23 @@
1080
1081 gtk_widget_get_allocation (widget, &allocation);
1082
1083- gdk_cairo_set_source_pixmap (cr,
1084+ cairo_save (cr);
1085+ gdk_cairo_set_source_window (cr,
1086 gtk_widget_get_window (widget),
1087 allocation.x,
1088 allocation.y);
1089+ cairo_rectangle (cr, allocation.x, allocation.y, allocation.width, allocation.height);
1090+ cairo_clip (cr);
1091 cairo_paint (cr);
1092+ cairo_restore (cr);
1093 }
1094 }
1095
1096 static void
1097-na_tray_expose_box (GtkWidget *box,
1098- GdkEventExpose *event)
1099+na_tray_draw_box (GtkWidget *box,
1100+ cairo_t *cr)
1101 {
1102- cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (box));
1103-
1104- gdk_cairo_region (cr, event->region);
1105- cairo_clip (cr);
1106-
1107- gtk_container_foreach (GTK_CONTAINER (box), na_tray_expose_icon, cr);
1108-
1109- cairo_destroy (cr);
1110+ gtk_container_foreach (GTK_CONTAINER (box), na_tray_draw_icon, cr);
1111 }
1112
1113 static void
1114@@ -580,10 +555,9 @@
1115 gtk_container_add (GTK_CONTAINER (tray), priv->frame);
1116 gtk_widget_show (priv->frame);
1117
1118- priv->box = g_object_new (na_box_get_type (), NULL);
1119- g_signal_connect (priv->box, "expose-event",
1120- G_CALLBACK (na_tray_expose_box), tray);
1121- gtk_box_set_spacing (GTK_BOX (priv->box), ICON_SPACING);
1122+ priv->box = gtk_box_new (priv->orientation, ICON_SPACING);
1123+ g_signal_connect (priv->box, "draw",
1124+ G_CALLBACK (na_tray_draw_box), NULL);
1125 gtk_container_add (GTK_CONTAINER (priv->frame), priv->box);
1126 gtk_widget_show (priv->box);
1127 }
1128@@ -736,10 +710,23 @@
1129 }
1130
1131 static void
1132-na_tray_size_request (GtkWidget *widget,
1133- GtkRequisition *requisition)
1134-{
1135- gtk_widget_size_request (gtk_bin_get_child (GTK_BIN (widget)), requisition);
1136+na_tray_get_preferred_width (GtkWidget *widget,
1137+ gint *minimal_width,
1138+ gint *natural_width)
1139+{
1140+ gtk_widget_get_preferred_width (gtk_bin_get_child (GTK_BIN (widget)),
1141+ minimal_width,
1142+ natural_width);
1143+}
1144+
1145+static void
1146+na_tray_get_preferred_height (GtkWidget *widget,
1147+ gint *minimal_height,
1148+ gint *natural_height)
1149+{
1150+ gtk_widget_get_preferred_height (gtk_bin_get_child (GTK_BIN (widget)),
1151+ minimal_height,
1152+ natural_height);
1153 }
1154
1155 static void
1156@@ -747,6 +734,7 @@
1157 GtkAllocation *allocation)
1158 {
1159 gtk_widget_size_allocate (gtk_bin_get_child (GTK_BIN (widget)), allocation);
1160+ gtk_widget_set_allocation (widget, allocation);
1161 }
1162
1163 static void
1164@@ -758,8 +746,8 @@
1165 gobject_class->constructor = na_tray_constructor;
1166 gobject_class->set_property = na_tray_set_property;
1167 gobject_class->dispose = na_tray_dispose;
1168-
1169- widget_class->size_request = na_tray_size_request;
1170+ widget_class->get_preferred_width = na_tray_get_preferred_width;
1171+ widget_class->get_preferred_height = na_tray_get_preferred_height;
1172 widget_class->size_allocate = na_tray_size_allocate;
1173
1174 g_object_class_install_property
1175@@ -789,22 +777,13 @@
1176 }
1177
1178 NaTray *
1179-na_tray_new_for_screen (GdkScreen *screen,
1180- GtkOrientation orientation,
1181- NaTrayFilterCallback cb,
1182- gpointer data)
1183+na_tray_new_for_screen (GdkScreen *screen,
1184+ GtkOrientation orientation)
1185 {
1186- NaTray *tray;
1187-
1188- tray = g_object_new (NA_TYPE_TRAY,
1189+ return g_object_new (NA_TYPE_TRAY,
1190 "screen", screen,
1191 "orientation", orientation,
1192 NULL);
1193-
1194- tray->priv->cb = cb;
1195- tray->priv->data = data;
1196-
1197- return tray;
1198 }
1199
1200 void
1201@@ -840,6 +819,39 @@
1202 }
1203
1204 void
1205+na_tray_set_padding (NaTray *tray,
1206+ gint padding)
1207+{
1208+ NaTrayPrivate *priv = tray->priv;
1209+
1210+ if (get_tray (priv->trays_screen) == tray)
1211+ na_tray_manager_set_padding (priv->trays_screen->tray_manager, padding);
1212+}
1213+
1214+void
1215+na_tray_set_icon_size (NaTray *tray,
1216+ gint size)
1217+{
1218+ NaTrayPrivate *priv = tray->priv;
1219+
1220+ if (get_tray (priv->trays_screen) == tray)
1221+ na_tray_manager_set_icon_size (priv->trays_screen->tray_manager, size);
1222+}
1223+
1224+void
1225+na_tray_set_colors (NaTray *tray,
1226+ GdkColor *fg,
1227+ GdkColor *error,
1228+ GdkColor *warning,
1229+ GdkColor *success)
1230+{
1231+ NaTrayPrivate *priv = tray->priv;
1232+
1233+ if (get_tray (priv->trays_screen) == tray)
1234+ na_tray_manager_set_colors (priv->trays_screen->tray_manager, fg, error, warning, success);
1235+}
1236+
1237+void
1238 na_tray_force_redraw (NaTray *tray)
1239 {
1240 NaTrayPrivate *priv = tray->priv;
1241@@ -849,11 +861,3 @@
1242 if (priv->idle_redraw_id == 0)
1243 priv->idle_redraw_id = g_idle_add ((GSourceFunc) idle_redraw_cb, tray);
1244 }
1245-
1246-NaTrayManager *
1247-na_tray_get_manager (NaTray *tray)
1248-{
1249- g_return_val_if_fail (NA_IS_TRAY (tray), NULL);
1250-
1251- return tray->priv->trays_screen->tray_manager;
1252-}
1253
1254=== modified file 'unity-misc/na-tray.h'
1255--- unity-misc/na-tray.h 2011-02-14 20:01:14 +0000
1256+++ unity-misc/na-tray.h 2011-06-16 13:19:23 +0000
1257@@ -29,8 +29,6 @@
1258 #endif
1259 #include <gtk/gtk.h>
1260
1261-#include <unity-misc/na-tray-manager.h>
1262-
1263 G_BEGIN_DECLS
1264
1265 #define NA_TYPE_TRAY (na_tray_get_type ())
1266@@ -44,8 +42,6 @@
1267 typedef struct _NaTrayPrivate NaTrayPrivate;
1268 typedef struct _NaTrayClass NaTrayClass;
1269
1270-typedef gboolean (*NaTrayFilterCallback) (NaTray *tray, GtkWidget *icon, gpointer data);
1271-
1272 struct _NaTray
1273 {
1274 GtkBin parent_instance;
1275@@ -59,17 +55,22 @@
1276 };
1277
1278 GType na_tray_get_type (void);
1279-NaTray *na_tray_new_for_screen (GdkScreen *screen,
1280- GtkOrientation orientation,
1281- NaTrayFilterCallback cb,
1282- gpointer data);
1283+NaTray *na_tray_new_for_screen (GdkScreen *screen,
1284+ GtkOrientation orientation);
1285 void na_tray_set_orientation (NaTray *tray,
1286 GtkOrientation orientation);
1287 GtkOrientation na_tray_get_orientation (NaTray *tray);
1288+void na_tray_set_padding (NaTray *tray,
1289+ gint padding);
1290+void na_tray_set_icon_size (NaTray *tray,
1291+ gint icon_size);
1292+void na_tray_set_colors (NaTray *tray,
1293+ GdkColor *fg,
1294+ GdkColor *error,
1295+ GdkColor *warning,
1296+ GdkColor *success);
1297 void na_tray_force_redraw (NaTray *tray);
1298
1299-NaTrayManager * na_tray_get_manager (NaTray *tray);
1300-
1301 G_END_DECLS
1302
1303 #endif /* __NA_TRAY_H__ */

Subscribers

People subscribed via source and target branches

to all changes: