2121 */
2222
2323/* Well, actuall'y is the Tray itself, the container for the items. But
24- * NaTray is already taken for the XEMBED part, so for now it's called NaBox ,
24+ * NaTray is already taken for the XEMBED part, so for now it's called NaGrid ,
2525 * don't make a big deal out of it. */
2626
2727#include "config.h"
2828
2929#include <gtk/gtk.h>
3030
31- #include "na-box .h"
31+ #include "na-grid .h"
3232
3333#include "system-tray/na-tray.h"
3434#include "status-notifier/sn-host-v0.h"
3535
3636#define ICON_SPACING 1
37- #define MIN_BOX_SIZE 3
37+ #define MIN_GRID_SIZE 3
3838
39- struct _NaBox
39+ struct _NaGrid
4040{
4141 GtkBox parent ;
4242
5454 PROP_ICON_SIZE
5555};
5656
57- G_DEFINE_TYPE (NaBox , na_box , GTK_TYPE_BOX )
57+ G_DEFINE_TYPE (NaGrid , na_grid , GTK_TYPE_BOX )
5858
5959static gint
6060compare_items (gconstpointer a ,
@@ -88,10 +88,10 @@ static void
8888reorder_items (GtkWidget * widget ,
8989 gpointer user_data )
9090{
91- NaBox * nb ;
91+ NaGrid * nb ;
9292 gint position ;
9393
94- nb = NA_BOX (user_data );
94+ nb = NA_GRID (user_data );
9595
9696 position = g_slist_index (nb -> items , widget );
9797 gtk_box_reorder_child (GTK_BOX (nb ), widget , position );
@@ -100,11 +100,11 @@ reorder_items (GtkWidget *widget,
100100static void
101101item_added_cb (NaHost * host ,
102102 NaItem * item ,
103- NaBox * self )
103+ NaGrid * self )
104104{
105105 g_return_if_fail (NA_IS_HOST (host ));
106106 g_return_if_fail (NA_IS_ITEM (item ));
107- g_return_if_fail (NA_IS_BOX (self ));
107+ g_return_if_fail (NA_IS_GRID (self ));
108108
109109 g_object_bind_property (self , "orientation" ,
110110 item , "orientation" ,
@@ -120,18 +120,18 @@ item_added_cb (NaHost *host,
120120static void
121121item_removed_cb (NaHost * host ,
122122 NaItem * item ,
123- NaBox * self )
123+ NaGrid * self )
124124{
125125 g_return_if_fail (NA_IS_HOST (host ));
126126 g_return_if_fail (NA_IS_ITEM (item ));
127- g_return_if_fail (NA_IS_BOX (self ));
127+ g_return_if_fail (NA_IS_GRID (self ));
128128
129129 gtk_container_remove (GTK_CONTAINER (self ), GTK_WIDGET (item ));
130130 self -> items = g_slist_remove (self -> items , item );
131131}
132132
133133static void
134- update_size_and_orientation (NaBox * self ,
134+ update_size_and_orientation (NaGrid * self ,
135135 GtkOrientation orientation )
136136{
137137 /* FIXME: do we really need that? comes from NaTray */
@@ -141,11 +141,11 @@ update_size_and_orientation (NaBox *self,
141141 switch (orientation )
142142 {
143143 case GTK_ORIENTATION_VERTICAL :
144- /* Give box a min size so the frame doesn't look dumb */
145- gtk_widget_set_size_request (GTK_WIDGET (self ), MIN_BOX_SIZE , -1 );
144+ /* Give grid a min size so the frame doesn't look dumb */
145+ gtk_widget_set_size_request (GTK_WIDGET (self ), MIN_GRID_SIZE , -1 );
146146 break ;
147147 case GTK_ORIENTATION_HORIZONTAL :
148- gtk_widget_set_size_request (GTK_WIDGET (self ), -1 , MIN_BOX_SIZE );
148+ gtk_widget_set_size_request (GTK_WIDGET (self ), -1 , MIN_GRID_SIZE );
149149 break ;
150150 }
151151}
@@ -155,12 +155,12 @@ orientation_notify (GObject *object,
155155 GParamSpec * pspec ,
156156 gpointer data )
157157{
158- update_size_and_orientation (NA_BOX (object ),
158+ update_size_and_orientation (NA_GRID (object ),
159159 gtk_orientable_get_orientation (GTK_ORIENTABLE (object )));
160160}
161161
162162static void
163- na_box_init ( NaBox * self )
163+ na_grid_init ( NaGrid * self )
164164{
165165 GtkOrientation orientation ;
166166
@@ -177,7 +177,7 @@ na_box_init (NaBox *self)
177177}
178178
179179static void
180- add_host (NaBox * self ,
180+ add_host (NaGrid * self ,
181181 NaHost * host )
182182{
183183 self -> hosts = g_slist_prepend (self -> hosts , host );
@@ -194,14 +194,14 @@ add_host (NaBox *self,
194194}
195195
196196static void
197- na_box_style_updated (GtkWidget * widget )
197+ na_grid_style_updated (GtkWidget * widget )
198198{
199- NaBox * self = NA_BOX (widget );
199+ NaGrid * self = NA_GRID (widget );
200200 GtkStyleContext * context ;
201201 GSList * node ;
202202
203- if (GTK_WIDGET_CLASS (na_box_parent_class )-> style_updated )
204- GTK_WIDGET_CLASS (na_box_parent_class )-> style_updated (widget );
203+ if (GTK_WIDGET_CLASS (na_grid_parent_class )-> style_updated )
204+ GTK_WIDGET_CLASS (na_grid_parent_class )-> style_updated (widget );
205205
206206 context = gtk_widget_get_style_context (widget );
207207
@@ -215,20 +215,20 @@ na_box_style_updated (GtkWidget *widget)
215215
216216/* Custom drawing because system-tray items need weird stuff. */
217217static gboolean
218- na_box_draw (GtkWidget * box ,
219- cairo_t * cr )
218+ na_grid_draw (GtkWidget * grid ,
219+ cairo_t * cr )
220220{
221221 GList * child ;
222- GList * children = gtk_container_get_children (GTK_CONTAINER (box ));
222+ GList * children = gtk_container_get_children (GTK_CONTAINER (grid ));
223223
224224 for (child = children ; child ; child = child -> next )
225225 {
226226 if (! NA_IS_ITEM (child -> data ) ||
227- ! na_item_draw_on_parent (child -> data , box , cr ))
227+ ! na_item_draw_on_parent (child -> data , grid , cr ))
228228 {
229229 if (gtk_widget_is_drawable (child -> data ) &&
230230 gtk_cairo_should_draw_window (cr , gtk_widget_get_window (child -> data )))
231- gtk_container_propagate_draw (GTK_CONTAINER (box ), child -> data , cr );
231+ gtk_container_propagate_draw (GTK_CONTAINER (grid ), child -> data , cr );
232232 }
233233 }
234234
@@ -238,14 +238,14 @@ na_box_draw (GtkWidget *box,
238238}
239239
240240static void
241- na_box_realize (GtkWidget * widget )
241+ na_grid_realize (GtkWidget * widget )
242242{
243- NaBox * self = NA_BOX (widget );
243+ NaGrid * self = NA_GRID (widget );
244244 GdkScreen * screen ;
245245 GtkOrientation orientation ;
246246 NaHost * tray_host ;
247247
248- GTK_WIDGET_CLASS (na_box_parent_class )-> realize (widget );
248+ GTK_WIDGET_CLASS (na_grid_parent_class )-> realize (widget );
249249
250250 /* Instantiate the hosts now we have a screen */
251251 screen = gtk_widget_get_screen (GTK_WIDGET (self ));
@@ -260,9 +260,9 @@ na_box_realize (GtkWidget *widget)
260260}
261261
262262static void
263- na_box_unrealize (GtkWidget * widget )
263+ na_grid_unrealize (GtkWidget * widget )
264264{
265- NaBox * self = NA_BOX (widget );
265+ NaGrid * self = NA_GRID (widget );
266266
267267 if (self -> hosts != NULL )
268268 {
@@ -272,16 +272,16 @@ na_box_unrealize (GtkWidget *widget)
272272
273273 g_clear_pointer (& self -> items , g_slist_free );
274274
275- GTK_WIDGET_CLASS (na_box_parent_class )-> unrealize (widget );
275+ GTK_WIDGET_CLASS (na_grid_parent_class )-> unrealize (widget );
276276}
277277
278278static void
279- na_box_get_property (GObject * object ,
280- guint property_id ,
281- GValue * value ,
282- GParamSpec * pspec )
279+ na_grid_get_property (GObject * object ,
280+ guint property_id ,
281+ GValue * value ,
282+ GParamSpec * pspec )
283283{
284- NaBox * self = NA_BOX (object );
284+ NaGrid * self = NA_GRID (object );
285285
286286 switch (property_id )
287287 {
@@ -300,12 +300,12 @@ na_box_get_property (GObject *object,
300300}
301301
302302static void
303- na_box_set_property (GObject * object ,
304- guint property_id ,
305- const GValue * value ,
306- GParamSpec * pspec )
303+ na_grid_set_property (GObject * object ,
304+ guint property_id ,
305+ const GValue * value ,
306+ GParamSpec * pspec )
307307{
308- NaBox * self = NA_BOX (object );
308+ NaGrid * self = NA_GRID (object );
309309
310310 switch (property_id )
311311 {
@@ -324,18 +324,18 @@ na_box_set_property (GObject *object,
324324}
325325
326326static void
327- na_box_class_init ( NaBoxClass * klass )
327+ na_grid_class_init ( NaGridClass * klass )
328328{
329329 GObjectClass * gobject_class = G_OBJECT_CLASS (klass );
330330 GtkWidgetClass * widget_class = GTK_WIDGET_CLASS (klass );
331331
332- gobject_class -> get_property = na_box_get_property ;
333- gobject_class -> set_property = na_box_set_property ;
332+ gobject_class -> get_property = na_grid_get_property ;
333+ gobject_class -> set_property = na_grid_set_property ;
334334
335- widget_class -> draw = na_box_draw ;
336- widget_class -> realize = na_box_realize ;
337- widget_class -> unrealize = na_box_unrealize ;
338- widget_class -> style_updated = na_box_style_updated ;
335+ widget_class -> draw = na_grid_draw ;
336+ widget_class -> realize = na_grid_realize ;
337+ widget_class -> unrealize = na_grid_unrealize ;
338+ widget_class -> style_updated = na_grid_style_updated ;
339339
340340 g_object_class_install_property (gobject_class , PROP_ICON_PADDING ,
341341 g_param_spec_int ("icon-padding" ,
@@ -353,19 +353,19 @@ na_box_class_init (NaBoxClass *klass)
353353}
354354
355355GtkWidget *
356- na_box_new (GtkOrientation orientation )
356+ na_grid_new (GtkOrientation orientation )
357357{
358- return g_object_new (NA_TYPE_BOX ,
358+ return g_object_new (NA_TYPE_GRID ,
359359 "orientation" , orientation ,
360360 "spacing" , ICON_SPACING ,
361361 NULL );
362362}
363363
364364void
365- na_box_force_redraw ( NaBox * box )
365+ na_grid_force_redraw ( NaGrid * grid )
366366{
367367 GSList * node ;
368368
369- for (node = box -> hosts ; node ; node = node -> next )
369+ for (node = grid -> hosts ; node ; node = node -> next )
370370 na_host_force_redraw (node -> data );
371371}
0 commit comments