Disable direct access to GTK+ classes data (see GSEAL_ENABLE macro).
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Fri, 25 Jul 2014 20:11:45 +0000 (23:11 +0300)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Fri, 25 Jul 2014 20:11:45 +0000 (23:11 +0300)
12 files changed:
src/bg.c
src/configurator.c
src/gtk-run.c
src/icon-grid.c
src/panel.c
src/plugin.c
src/plugins/batt/batt.c
src/plugins/cpu/cpu.c
src/plugins/monitors/monitors.c
src/plugins/netstat/passwd_gui.c
src/plugins/netstatus/netstatus-icon.c
src/plugins/xkb/xkb-plugin.c

index be670bb..d7de0db 100644 (file)
--- a/src/bg.c
+++ b/src/bg.c
@@ -190,7 +190,7 @@ fb_bg_get_xroot_pix_for_win(FbBg *bg, GtkWidget *widget)
     int  x, y;
 
     ENTER;
-    win =  GDK_WINDOW_XWINDOW(widget->window);
+    win = GDK_WINDOW_XWINDOW(gtk_widget_get_window(widget));
     if (!XGetGeometry(bg->dpy, win, &dummy, &x, &y, &width, &height, &border,
               &depth)) {
         DBG2("XGetGeometry failed\n");
@@ -271,9 +271,11 @@ fb_bg_get_pix_from_file(GtkWidget *widget, const char *filename)
 
     pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
     if (!pixbuf) {
-        RET(widget->style->bg_pixmap[0]);
+        GtkStyle *style = gtk_widget_get_style(widget);
+        RET(style->bg_pixmap[0]);
     }
-    pixmap = gdk_pixmap_new(widget->window, gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf), -1);
+    pixmap = gdk_pixmap_new(gtk_widget_get_window(widget), gdk_pixbuf_get_width(pixbuf),
+                            gdk_pixbuf_get_height(pixbuf), -1);
     cr = gdk_cairo_create(pixmap);
     gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0);
     cairo_paint(cr);
index 62762e2..c89e08a 100644 (file)
@@ -126,7 +126,7 @@ update_panel_geometry( Panel* p )
     {
         calculate_position(p);
         gtk_widget_set_size_request(p->topgwin, p->aw, p->ah);
-        gdk_window_move(p->topgwin->window, p->ax, p->ay);
+        gdk_window_move(gtk_widget_get_window(p->topgwin), p->ax, p->ay);
         panel_update_background(p);
         panel_establish_autohide(p);
         panel_set_wm_strut(p);
@@ -696,8 +696,8 @@ static void on_add_plugin( GtkButton* btn, GtkTreeView* _view )
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
                                    GTK_POLICY_AUTOMATIC,
                                    GTK_POLICY_AUTOMATIC );
-    gtk_box_pack_start( GTK_BOX(GTK_DIALOG(dlg)->vbox), scroll,
-                         TRUE, TRUE, 4 );
+    gtk_box_pack_start( GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dlg))),
+                        scroll, TRUE, TRUE, 4 );
     view = GTK_TREE_VIEW(gtk_tree_view_new());
     gtk_container_add( GTK_CONTAINER(scroll), GTK_WIDGET(view) );
     tree_sel = gtk_tree_view_get_selection( view );
@@ -1373,13 +1373,15 @@ static GtkWidget *_lxpanel_generic_config_dlg(const char *title, Panel *p,
                                                   GTK_STOCK_CLOSE,
                                                   GTK_RESPONSE_CLOSE,
                                                   NULL );
+    GtkBox *dlg_vbox = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dlg)));
+
     panel_apply_icon(GTK_WINDOW(dlg));
 
     if( apply_func )
         g_object_set_data( G_OBJECT(dlg), "apply_func", apply_func );
     g_object_set_data( G_OBJECT(dlg), "apply_func_data", plugin );
 
-    gtk_box_set_spacing( GTK_BOX(GTK_DIALOG(dlg)->vbox), 4 );
+    gtk_box_set_spacing( dlg_vbox, 4 );
 
     while( name )
     {
@@ -1434,13 +1436,13 @@ static GtkWidget *_lxpanel_generic_config_dlg(const char *title, Panel *p,
         if( entry )
         {
             if(( type == CONF_TYPE_BOOL ) || ( type == CONF_TYPE_TRIM ))
-                gtk_box_pack_start( GTK_BOX(GTK_DIALOG(dlg)->vbox), entry, FALSE, FALSE, 2 );
+                gtk_box_pack_start( dlg_vbox, entry, FALSE, FALSE, 2 );
             else
             {
                 GtkWidget* hbox = gtk_hbox_new( FALSE, 2 );
                 gtk_box_pack_start( GTK_BOX(hbox), label, FALSE, FALSE, 2 );
                 gtk_box_pack_start( GTK_BOX(hbox), entry, TRUE, TRUE, 2 );
-                gtk_box_pack_start( GTK_BOX(GTK_DIALOG(dlg)->vbox), hbox, FALSE, FALSE, 2 );
+                gtk_box_pack_start( dlg_vbox, hbox, FALSE, FALSE, 2 );
                 if ((type == CONF_TYPE_FILE_ENTRY) || (type == CONF_TYPE_DIRECTORY_ENTRY))
                 {
                     GtkWidget* browse = gtk_button_new_with_mnemonic(_("_Browse"));
index 0bfdc72..d187798 100644 (file)
@@ -323,7 +323,7 @@ static void activate_window(GtkWindow* toplevel_window)
        if (gdk_x11_screen_supports_net_wm_hint (screen,
                                           gdk_atom_intern_static_string ("_NET_ACTIVE_WINDOW")))
     {
-               GdkWindow* window = widget->window;
+               GdkWindow* window = gtk_widget_get_window(widget);
                GdkDisplay* display = gtk_widget_get_display(widget);
                GdkWindow* root = gdk_screen_get_root_window(screen);
 
@@ -354,7 +354,7 @@ static void activate_window(GtkWindow* toplevel_window)
 
 void gtk_run()
 {
-    GtkWidget *entry, *hbox, *img;
+    GtkWidget *entry, *hbox, *img, *dlg_vbox;
 
     if(!win)
     {
@@ -370,7 +370,8 @@ void gtk_run()
                entry = gtk_entry_new();
 
                gtk_entry_set_activates_default( (GtkEntry*)entry, TRUE );
-               gtk_box_pack_start( (GtkBox*)((GtkDialog*)win)->vbox,
+               dlg_vbox = gtk_dialog_get_content_area((GtkDialog*)win);
+               gtk_box_pack_start( (GtkBox*)dlg_vbox,
                                                         gtk_label_new(_("Enter the command you want to execute:")),
                                                         FALSE, FALSE, 8 );
                hbox = gtk_hbox_new( FALSE, 2 );
@@ -378,7 +379,7 @@ void gtk_run()
                gtk_box_pack_start( (GtkBox*)hbox, img,
                                                         FALSE, FALSE, 4 );
                gtk_box_pack_start( (GtkBox*)hbox, entry, TRUE, TRUE, 4 );
-               gtk_box_pack_start( (GtkBox*)((GtkDialog*)win)->vbox,
+               gtk_box_pack_start( (GtkBox*)dlg_vbox,
                                                         hbox, FALSE, FALSE, 8 );
                g_signal_connect( win, "response", G_CALLBACK(on_response), entry );
                gtk_window_set_position( (GtkWindow*)win, GTK_WIN_POS_CENTER );
index ed627e0..8eb6f7e 100644 (file)
@@ -32,6 +32,8 @@ static void icon_grid_demand_resize(IconGrid * ig);
 /* Establish the widget placement of an icon grid. */
 static gboolean icon_grid_placement(IconGrid * ig)
 {
+    GtkAllocation allocation;
+
     if (ig->widget == NULL)
         return FALSE;
 
@@ -39,13 +41,14 @@ static gboolean icon_grid_placement(IconGrid * ig)
     gtk_widget_show(ig->container);
 
     /* Erase the window. */
-    GdkWindow * window = ig->widget->window;
+    GdkWindow * window = gtk_widget_get_window(ig->widget);
     if (window != NULL)
         panel_determine_background_pixmap(ig->panel, ig->widget, window);
 
     /* Get and save the desired container geometry. */
-    ig->container_width = ig->container->allocation.width;
-    ig->container_height = ig->container->allocation.height;
+    gtk_widget_get_allocation(ig->container, &allocation);
+    ig->container_width = allocation.width;
+    ig->container_height = allocation.height;
     int child_width = ig->child_width;
     int child_height = ig->child_height;
 
@@ -70,7 +73,7 @@ static gboolean icon_grid_placement(IconGrid * ig)
         ?  (ig->rows * (child_height + ig->spacing))
         :  (ig->columns * (child_width + ig->spacing)));
     int x_initial = ((direction == GTK_TEXT_DIR_RTL)
-        ? ig->widget->allocation.width - child_width - ig->border
+        ? allocation.width - child_width - ig->border
         : ig->border);
     int x_delta = child_width + ig->spacing;
     if (direction == GTK_TEXT_DIR_RTL) x_delta = - x_delta;
@@ -86,7 +89,8 @@ static gboolean icon_grid_placement(IconGrid * ig)
         {
             /* Do necessary operations on the child. */
             gtk_widget_show(ige->widget);
-            if (((child_width != ige->widget->allocation.width) || (child_height != ige->widget->allocation.height))
+            gtk_widget_get_allocation(ige->widget, &allocation);
+            if (((child_width != allocation.width) || (child_height != allocation.height))
             && (child_width > 0) && (child_height > 0))
                 {
                 GtkAllocation alloc;
@@ -143,6 +147,8 @@ static void icon_grid_geometry(IconGrid * ig, gboolean layout)
     /* Count visible children. */
     int visible_children = 0;
     IconGridElement * ige;
+    GtkAllocation allocation;
+
     for (ige = ig->child_list; ige != NULL; ige = ige->flink)
         if (ige->visible)
             visible_children += 1;
@@ -150,12 +156,13 @@ static void icon_grid_geometry(IconGrid * ig, gboolean layout)
    int original_rows = ig->rows;
    int original_columns = ig->columns;
    int target_dimension = ig->target_dimension;
+   gtk_widget_get_allocation(ig->container, &allocation);
    if (ig->orientation == GTK_ORIENTATION_HORIZONTAL)
     {
         /* In horizontal orientation, fit as many rows into the available height as possible.
          * Then allocate as many columns as necessary.  Guard against zerodivides. */
-        if (ig->container->allocation.height > 1)
-            target_dimension = ig->container->allocation.height;
+        if (allocation.height > 1)
+            target_dimension = allocation.height;
         ig->rows = 0;
         if ((ig->child_height + ig->spacing) != 0)
             ig->rows = (target_dimension + ig->spacing - ig->border * 2) / (ig->child_height + ig->spacing);
@@ -169,8 +176,8 @@ static void icon_grid_geometry(IconGrid * ig, gboolean layout)
     {
         /* In vertical orientation, fit as many columns into the available width as possible.
          * Then allocate as many rows as necessary.  Guard against zerodivides. */
-        if (ig->container->allocation.width > 1)
-            target_dimension = ig->container->allocation.width;
+        if (allocation.width > 1)
+            target_dimension = allocation.width;
         ig->columns = 0;
         if ((ig->child_width + ig->spacing) != 0)
             ig->columns = (target_dimension + ig->spacing - ig->border * 2) / (ig->child_width + ig->spacing);
@@ -188,8 +195,8 @@ static void icon_grid_geometry(IconGrid * ig, gboolean layout)
     && (( ! ig->actual_dimension)
       || (ig->rows != original_rows)
       || (ig->columns != original_columns)
-      || (ig->container_width != ig->container->allocation.width)
-      || (ig->container_height != ig->container->allocation.height)
+      || (ig->container_width != allocation.width)
+      || (ig->container_height != allocation.height)
       || (ig->children_changed)))
         {
         ig->actual_dimension = TRUE;
index fd1d18f..7cee1f2 100644 (file)
@@ -452,8 +452,8 @@ void panel_update_background(Panel * p)
     GList *plugins, *l;
 
     /* Redraw the top level widget. */
-    panel_determine_background_pixmap(p, p->topgwin, p->topgwin->window);
-    gdk_window_clear(p->topgwin->window);
+    panel_determine_background_pixmap(p, p->topgwin, gtk_widget_get_window(p->topgwin));
+    gdk_window_clear(gtk_widget_get_window(p->topgwin));
     gtk_widget_queue_draw(p->topgwin);
 
     /* Loop over all plugins redrawing each plugin. */
@@ -916,7 +916,7 @@ static void panel_set_visibility(Panel *p, gboolean visible)
     p->visible = visible;
     calculate_position(p);
     gtk_widget_set_size_request(p->topgwin, p->aw, p->ah);
-    gdk_window_move(p->topgwin->window, p->ax, p->ay);
+    gdk_window_move(gtk_widget_get_window(p->topgwin), p->ax, p->ay);
     if (visible) gtk_widget_show(p->box);
     panel_set_wm_strut(p);
 }
@@ -1066,7 +1066,7 @@ panel_start_gui(Panel *p)
     g_signal_connect (G_OBJECT (p->topgwin), "style-set",
           (GCallback)panel_style_set, p);
     gtk_widget_realize(p->topgwin);
-    //gdk_window_set_decorations(p->topgwin->window, 0);
+    //gdk_window_set_decorations(gtk_widget_get_window(p->topgwin), 0);
 
     // main layout manager as a single child of panel
     p->box = p->my_box_new(FALSE, 0);
@@ -1077,7 +1077,7 @@ panel_start_gui(Panel *p)
     if (p->round_corners)
         make_round_corners(p);
 
-    p->topxwin = GDK_WINDOW_XWINDOW(GTK_WIDGET(p->topgwin)->window);
+    p->topxwin = GDK_WINDOW_XWINDOW(gtk_widget_get_window(p->topgwin));
     DBG("topxwin = %x\n", p->topxwin);
 
     /* the settings that should be done before window is mapped */
@@ -1112,7 +1112,7 @@ panel_start_gui(Panel *p)
           32, PropModeReplace, (unsigned char *) state, 3);
 
     calculate_position(p);
-    gdk_window_move_resize(p->topgwin->window, p->ax, p->ay, p->aw, p->ah);
+    gdk_window_move_resize(gtk_widget_get_window(p->topgwin), p->ax, p->ay, p->aw, p->ah);
     panel_set_wm_strut(p);
 
     RET();
index 8e54c3c..baf5207 100644 (file)
@@ -237,8 +237,8 @@ void plugin_widget_set_background(GtkWidget * w, Panel * p)
                 if (GTK_WIDGET_REALIZED(w))
 #endif
                 {
-                    panel_determine_background_pixmap(p, w, w->window);
-                    gdk_window_invalidate_rect(w->window, NULL, TRUE);
+                    panel_determine_background_pixmap(p, w, gtk_widget_get_window(w));
+                    gdk_window_invalidate_rect(gtk_widget_get_window(w), NULL, TRUE);
                 }
             }
             else
@@ -251,8 +251,10 @@ void plugin_widget_set_background(GtkWidget * w, Panel * p)
                 if (GTK_WIDGET_REALIZED(w))
 #endif
                 {
-                    gdk_window_set_back_pixmap(w->window, NULL, TRUE);
-                    gtk_style_set_background(w->style, w->window, GTK_STATE_NORMAL);
+                    gdk_window_set_back_pixmap(gtk_widget_get_window(w), NULL, TRUE);
+                    gtk_style_set_background(gtk_widget_get_style(w),
+                                             gtk_widget_get_window(w),
+                                             GTK_STATE_NORMAL);
                 }
             }
         }
@@ -296,17 +298,20 @@ void lxpanel_plugin_popup_set_position_helper(Panel * p, GtkWidget * near, GtkWi
 {
     /* Get the origin of the requested-near widget in screen coordinates. */
     gint x, y;
-    gdk_window_get_origin(GDK_WINDOW(near->window), &x, &y);
-    if (x != near->allocation.x) x += near->allocation.x;      /* Doesn't seem to be working according to spec; the allocation.x sometimes has the window origin in it */
-    if (y != near->allocation.y) y += near->allocation.y;
+    GtkAllocation allocation;
+
+    gtk_widget_get_allocation(near, &allocation);
+    gdk_window_get_origin(gtk_widget_get_window(near), &x, &y);
+    if (x != allocation.x) x += allocation.x;  /* Doesn't seem to be working according to spec; the allocation.x sometimes has the window origin in it */
+    if (y != allocation.y) y += allocation.y;
 
     /* Dispatch on edge to lay out the popup menu with respect to the button.
      * Also set "push-in" to avoid any case where it might flow off screen. */
     switch (p->edge)
     {
-        case EDGE_TOP:          y += near->allocation.height;         break;
+        case EDGE_TOP:          y += allocation.height;         break;
         case EDGE_BOTTOM:       y -= popup_req->height;                break;
-        case EDGE_LEFT:         x += near->allocation.width;          break;
+        case EDGE_LEFT:         x += allocation.width;          break;
         case EDGE_RIGHT:        x -= popup_req->width;                 break;
     }
     *px = x;
@@ -325,36 +330,42 @@ void lxpanel_plugin_adjust_popup_position(GtkWidget * popup, GtkWidget * parent)
 {
     /* Initialize. */
     Panel * p = PLUGIN_PANEL(parent);
+    GtkAllocation allocation;
 
+    gtk_widget_get_allocation(parent, &allocation);
     /* Get the coordinates of the plugin top level widget. */
-    int x = p->cx + parent->allocation.x;
-    int y = p->cy + parent->allocation.y;
+    int x = p->cx + allocation.x;
+    int y = p->cy + allocation.y;
 
     /* Adjust these coordinates according to the panel edge. */
     switch (p->edge)
     {
         case EDGE_TOP:
-           y += parent->allocation.height;
+            y += allocation.height;
+            gtk_widget_get_allocation(popup, &allocation);
             break;
         case EDGE_BOTTOM:
-            y -= popup->allocation.height;
+            gtk_widget_get_allocation(popup, &allocation);
+            y -= allocation.height;
             break;
         case EDGE_LEFT:
-            x += parent->allocation.width;
+            x += allocation.width;
+            gtk_widget_get_allocation(popup, &allocation);
             break;
         case EDGE_RIGHT:
-            x -= popup->allocation.width;
+            gtk_widget_get_allocation(popup, &allocation);
+            x -= allocation.width;
             break;
     }
 
     /* Clip the coordinates to ensure that the popup remains on screen. */
     int screen_width = gdk_screen_width();
     int screen_height = gdk_screen_height();
-    if ((x + popup->allocation.width) > screen_width) x = screen_width - popup->allocation.width;
-    if ((y + popup->allocation.height) > screen_height) y = screen_height - popup->allocation.height;
+    if ((x + allocation.width) > screen_width) x = screen_width - allocation.width;
+    if ((y + allocation.height) > screen_height) y = screen_height - allocation.height;
 
     /* Move the popup to position. */
-    gdk_window_move(popup->window, x, y);
+    gdk_window_move(gtk_widget_get_window(popup), x, y);
 }
 
 /* for old plugins compatibility */
index 455480b..c8496be 100644 (file)
@@ -348,16 +348,19 @@ static gboolean buttonPressEvent(GtkWidget *p, GdkEventButton *event,
 
 
 static gint configureEvent(GtkWidget *widget, GdkEventConfigure *event,
-        lx_battery *lx_b) {
+        lx_battery *lx_b)
+{
+    GtkAllocation allocation;
 
     ENTER;
 
+    gtk_widget_get_allocation(widget, &allocation);
     if (lx_b->pixmap)
         cairo_surface_destroy(lx_b->pixmap);
 
     /* Update the plugin's dimensions */
-    lx_b->width = widget->allocation.width;
-    lx_b->height = widget->allocation.height;
+    lx_b->width = allocation.width;
+    lx_b->height = allocation.height;
     if (lx_b->orientation == GTK_ORIENTATION_HORIZONTAL) {
         lx_b->length = lx_b->height;
         lx_b->thickness = lx_b->width;
@@ -367,8 +370,8 @@ static gint configureEvent(GtkWidget *widget, GdkEventConfigure *event,
         lx_b->thickness = lx_b->height;
     }
 
-    lx_b->pixmap = cairo_image_surface_create (CAIRO_FORMAT_RGB24, widget->allocation.width,
-          widget->allocation.height);
+    lx_b->pixmap = cairo_image_surface_create (CAIRO_FORMAT_RGB24, allocation.width,
+                                               allocation.height);
     check_cairo_surface_status(&lx_b->pixmap);
 
     /* Perform an update so the bar will look right in its new orientation */
@@ -382,11 +385,13 @@ static gint configureEvent(GtkWidget *widget, GdkEventConfigure *event,
 static gint exposeEvent(GtkWidget *widget, GdkEventExpose *event, lx_battery *lx_b) {
 
     ENTER;
-    cairo_t *cr = gdk_cairo_create(widget->window);
+    cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(widget));
+    GtkStyle *style = gtk_widget_get_style(lx_b->drawingArea);
+
     gdk_cairo_region(cr, event->region);
     cairo_clip(cr);
 
-    gdk_cairo_set_source_color(cr, &lx_b->drawingArea->style->black);
+    gdk_cairo_set_source_color(cr, &style->black);
     cairo_set_source_surface(cr, lx_b->pixmap, 0, 0);
     cairo_paint(cr);
 
index 2f9ba39..393eac5 100644 (file)
@@ -67,10 +67,11 @@ static void cpu_destructor(gpointer user_data);
 static void redraw_pixmap(CPUPlugin * c)
 {
     cairo_t * cr = cairo_create(c->pixmap);
+    GtkStyle * style = gtk_widget_get_style(c->da);
     cairo_set_line_width (cr, 1.0);
     /* Erase pixmap. */
     cairo_rectangle(cr, 0, 0, c->pixmap_width, c->pixmap_height);
-    gdk_cairo_set_source_color(cr, &c->da->style->black);
+    gdk_cairo_set_source_color(cr, &style->black);
     cairo_fill(cr);
 
     /* Recompute pixmap. */
@@ -146,9 +147,12 @@ static gboolean cpu_update(CPUPlugin * c)
 /* Handler for configure_event on drawing area. */
 static gboolean configure_event(GtkWidget * widget, GdkEventConfigure * event, CPUPlugin * c)
 {
+    GtkAllocation allocation;
+
+    gtk_widget_get_allocation(widget, &allocation);
     /* Allocate pixmap and statistics buffer without border pixels. */
-    guint new_pixmap_width = MAX(widget->allocation.width - BORDER_SIZE * 2, 0);
-    guint new_pixmap_height = MAX(widget->allocation.height - BORDER_SIZE * 2, 0);
+    guint new_pixmap_width = MAX(allocation.width - BORDER_SIZE * 2, 0);
+    guint new_pixmap_height = MAX(allocation.height - BORDER_SIZE * 2, 0);
     if ((new_pixmap_width > 0) && (new_pixmap_height > 0))
     {
         /* If statistics buffer does not exist or it changed size, reallocate and preserve existing data. */
@@ -209,10 +213,11 @@ static gboolean expose_event(GtkWidget * widget, GdkEventExpose * event, CPUPlug
      * Translate it in both x and y by the border size. */
     if (c->pixmap != NULL)
     {
-        cairo_t * cr = gdk_cairo_create(widget->window);
+        cairo_t * cr = gdk_cairo_create(gtk_widget_get_window(widget));
+        GtkStyle * style = gtk_widget_get_style(c->da);
         gdk_cairo_region(cr, event->region);
         cairo_clip(cr);
-        gdk_cairo_set_source_color(cr, &c->da->style->black);
+        gdk_cairo_set_source_color(cr, &style->black);
         cairo_set_source_surface(cr, c->pixmap,
               BORDER_SIZE, BORDER_SIZE);
         cairo_paint(cr);
index c5e66c1..b00a6c9 100644 (file)
@@ -382,11 +382,13 @@ static gboolean
 configure_event(GtkWidget* widget, GdkEventConfigure* dummy, gpointer data) 
 {
     (void) dummy;
+    GtkAllocation allocation;
 
     int new_pixmap_width, new_pixmap_height;
 
-    new_pixmap_width = widget->allocation.width - BORDER_SIZE * 2;
-    new_pixmap_height = widget->allocation.height - BORDER_SIZE *2;
+    gtk_widget_get_allocation(widget, &allocation);
+    new_pixmap_width = allocation.width - BORDER_SIZE * 2;
+    new_pixmap_height = allocation.height - BORDER_SIZE *2;
     Monitor *m;
 
     m = (Monitor *) data;
@@ -472,10 +474,11 @@ expose_event(GtkWidget * widget, GdkEventExpose * event, Monitor *m)
      * Translate it in both x and y by the border size. */
     if (m->pixmap != NULL)
     {
-        cairo_t *cr = gdk_cairo_create(widget->window);
+        cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(widget));
+        GtkStyle *style = gtk_widget_get_style(m->da);
         gdk_cairo_region(cr, event->region);
         cairo_clip(cr);
-        gdk_cairo_set_source_color(cr, &m->da->style->black);
+        gdk_cairo_set_source_color(cr, &style->black);
         cairo_set_source_surface(cr, m->pixmap, BORDER_SIZE, BORDER_SIZE);
         cairo_paint(cr);
         check_cairo_status(cr);
@@ -510,10 +513,12 @@ redraw_pixmap (Monitor *m)
 {
     int i;
     cairo_t *cr = cairo_create(m->pixmap);
+    GtkStyle *style = gtk_widget_get_style(m->da);
+
     cairo_set_line_width (cr, 1.0);
 
     /* Erase pixmap */
-    gdk_cairo_set_source_color(cr, &m->da->style->black);
+    gdk_cairo_set_source_color(cr, &style->black);
     cairo_paint(cr);
 
     gdk_cairo_set_source_color(cr, &m->foreground_color);
index 7d9ec26..ad9b87b 100644 (file)
@@ -76,6 +76,7 @@ struct pgui *passwd_gui_new(ap_setting *aps)
 {
     GtkWidget *msg, *inputlabel;
     GtkWidget *inputbox;
+    GtkBox *dialog_vbox;
     struct pgui *pwdgui;
     struct passwd_resp *pr;
 
@@ -93,8 +94,9 @@ struct pgui *passwd_gui_new(ap_setting *aps)
     gtk_window_set_position(GTK_WINDOW(pwdgui->dlg), GTK_WIN_POS_CENTER);
 
     /* messages */
+    dialog_vbox = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(pwdgui->dlg)));
     msg = gtk_label_new(_("This wireless network was encrypted.\nYou must have the encryption key."));
-    gtk_box_pack_start(GTK_BOX(((GtkDialog*)(pwdgui->dlg))->vbox), msg, FALSE, FALSE, 8);
+    gtk_box_pack_start(dialog_vbox, msg, FALSE, FALSE, 8);
 
     /* entry Box */
     inputbox = gtk_hbox_new(FALSE, 0);
@@ -104,7 +106,7 @@ struct pgui *passwd_gui_new(ap_setting *aps)
     gtk_entry_set_visibility(GTK_ENTRY(pwdgui->pentry), FALSE);
     gtk_entry_set_activates_default(GTK_ENTRY(pwdgui->pentry), TRUE);
     gtk_box_pack_start(GTK_BOX(inputbox), pwdgui->pentry, FALSE, FALSE, 4);
-    gtk_box_pack_start(GTK_BOX(((GtkDialog*)(pwdgui->dlg))->vbox), inputbox, FALSE, FALSE, 8);
+    gtk_box_pack_start(dialog_vbox, inputbox, FALSE, FALSE, 8);
 
     /* passwd_resp structure */
     pr->aps = aps;
index faff033..bcc8e0b 100644 (file)
@@ -648,7 +648,10 @@ netstatus_icon_realize (GtkWidget *widget)
 {
   GdkWindowAttr attributes;
   int           attributes_mask;
-  int           border_width;
+  guint         border_width;
+  GtkAllocation allocation;
+  GdkWindow    *window;
+  GtkStyle     *style;
 
 #if GTK_CHECK_VERSION(2, 20, 0)
   gtk_widget_set_realized(widget, TRUE);
@@ -656,12 +659,14 @@ netstatus_icon_realize (GtkWidget *widget)
   GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
 #endif
 
-  border_width = GTK_CONTAINER (widget)->border_width;
+  gtk_widget_get_allocation (widget, &allocation);
 
-  attributes.x = widget->allocation.x + border_width;
-  attributes.y = widget->allocation.y + border_width;
-  attributes.width = widget->allocation.width - 2 * border_width;
-  attributes.height = widget->allocation.height - 2 * border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+
+  attributes.x = allocation.x + border_width;
+  attributes.y = allocation.y + border_width;
+  attributes.width = allocation.width - 2 * border_width;
+  attributes.height = allocation.height - 2 * border_width;
   attributes.window_type = GDK_WINDOW_CHILD;
   attributes.wclass = GDK_INPUT_OUTPUT;
   attributes.visual = gtk_widget_get_visual (widget);
@@ -676,11 +681,13 @@ netstatus_icon_realize (GtkWidget *widget)
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
-  gdk_window_set_user_data (widget->window, widget);
+  window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+  gtk_widget_set_window (widget, window);
+  gdk_window_set_user_data (window, widget);
 
-  widget->style = gtk_style_attach (widget->style, widget->window);
-  gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+  gtk_widget_ensure_style (widget);
+  style = gtk_widget_get_style (widget);
+  gtk_style_set_background (style, window, GTK_STATE_NORMAL);
 }
 
 static gboolean
index 84acd13..21cb6a8 100644 (file)
@@ -594,7 +594,8 @@ static void on_button_kbd_model_clicked(GtkButton *p_button, gpointer *p_data)
     GtkWidget * p_scrolledwindow_kbd_model = gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(p_scrolledwindow_kbd_model),
                                    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(p_dialog)->vbox), p_scrolledwindow_kbd_model, TRUE, TRUE, 2);
+    gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(p_dialog))),
+                       p_scrolledwindow_kbd_model, TRUE, TRUE, 2);
     
     // liststore
     GtkListStore *p_liststore_kbd_model = gtk_list_store_new(NUM_MODEL_COLUMNS, G_TYPE_STRING, G_TYPE_STRING);
@@ -717,7 +718,8 @@ static void on_button_kbd_change_layout_clicked(GtkButton *p_button, gpointer *p
     GtkWidget * p_scrolledwindow_kbd_change = gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(p_scrolledwindow_kbd_change),
                                    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(p_dialog)->vbox), p_scrolledwindow_kbd_change, TRUE, TRUE, 2);
+    gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(p_dialog))),
+                       p_scrolledwindow_kbd_change, TRUE, TRUE, 2);
     
     // liststore
     GtkListStore *p_liststore_kbd_change = gtk_list_store_new(NUM_CHANGE_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INT);
@@ -889,7 +891,8 @@ static void on_button_add_layout_clicked(GtkButton *p_button, gpointer *p_data)
     GtkWidget * p_scrolledwindow_add_layout = gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(p_scrolledwindow_add_layout),
                                    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(p_dialog)->vbox), p_scrolledwindow_add_layout, TRUE, TRUE, 2);
+    gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(p_dialog))),
+                       p_scrolledwindow_add_layout, TRUE, TRUE, 2);
     
     // treestore
     GtkTreeStore *p_treestore_add_layout = gtk_tree_store_new(NUM_ADD_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
@@ -1215,7 +1218,8 @@ static GtkWidget *xkb_configure(Panel *panel, GtkWidget *p, GtkWindow *parent)
     GtkWidget * p_hbox_main = gtk_hbox_new(TRUE, 0);
     GtkWidget * p_vbox_left = gtk_vbox_new(FALSE, 0);
     GtkWidget * p_vbox_right = gtk_vbox_new(FALSE, 0);
-    gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dlg)->vbox), p_hbox_main);
+    gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dlg))),
+                      p_hbox_main);
     gtk_box_pack_start(GTK_BOX(p_hbox_main), p_vbox_left, FALSE, TRUE, 0);
     gtk_box_pack_start(GTK_BOX(p_hbox_main), p_vbox_right, FALSE, TRUE, 0);