[gnome-disk-utility] Use accessor functions instead direct access
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility] Use accessor functions instead direct access
- Date: Sun, 20 Jun 2010 03:34:28 +0000 (UTC)
commit c5fa9573899fb53f8165d3e778377b0a00c0f098
Author: Salomon Sickert <sickert in tum de>
Date: Sun Jun 13 20:37:23 2010 +0200
Use accessor functions instead direct access
This makes gdu GTK+3 compilant.
Signed-off-by: Javier Jardón <jjardon gnome org>
configure.ac | 2 +-
src/gdu-gtk/gdu-ata-smart-dialog.c | 14 +++++++---
src/gdu-gtk/gdu-create-linux-md-dialog.c | 11 +++++---
src/gdu-gtk/gdu-drive-benchmark-dialog.c | 14 ++++++---
src/gdu-gtk/gdu-edit-linux-lvm2-dialog.c | 8 +++--
src/gdu-gtk/gdu-edit-linux-md-dialog.c | 8 +++--
src/gdu-gtk/gdu-format-dialog.c | 11 +++++---
src/gdu-gtk/gdu-gtk.c | 39 +++++++++++++++++---------
src/gdu-gtk/gdu-partition-dialog.c | 11 +++++---
src/gdu-gtk/gdu-spinner.c | 27 +++++++++++-------
src/gdu-gtk/gdu-volume-grid.c | 44 +++++++++++++++++------------
11 files changed, 119 insertions(+), 70 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 01be5f0..7313999 100644
--- a/configure.ac
+++ b/configure.ac
@@ -126,7 +126,7 @@ GOBJECT2_REQUIRED=2.16
GIO2_REQUIRED=2.22
DBUS_GLIB_REQUIRED=0.74
GNOME_KEYRING_REQUIRED=2.22
-GTK2_REQUIRED=2.17.2
+GTK2_REQUIRED=2.20.0
UNIQUE_REQUIRED=1.0
LIBNOTIFY_REQUIRED=0.3.0
NAUTILUS_REQUIRED=2.24.0
diff --git a/src/gdu-gtk/gdu-ata-smart-dialog.c b/src/gdu-gtk/gdu-ata-smart-dialog.c
index 9cb77f3..3b2b81e 100644
--- a/src/gdu-gtk/gdu-ata-smart-dialog.c
+++ b/src/gdu-gtk/gdu-ata-smart-dialog.c
@@ -1090,6 +1090,8 @@ on_self_test_button_clicked (GduButtonElement *button_element,
{
GduAtaSmartDialog *dialog = GDU_ATA_SMART_DIALOG (user_data);
GtkWidget *test_dialog;
+ GtkWidget *content_area;
+ GtkWidget *action_area;
GtkWidget *hbox;
GtkWidget *image;
GtkWidget *main_vbox;
@@ -1112,15 +1114,19 @@ on_self_test_button_clicked (GduButtonElement *button_element,
NULL);
gtk_window_set_title (GTK_WINDOW (test_dialog), "");
+
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (test_dialog));
+ action_area = gtk_dialog_get_action_area (GTK_DIALOG (test_dialog));
+
gtk_container_set_border_width (GTK_CONTAINER (test_dialog), 6);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (test_dialog)->vbox), 2);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (test_dialog)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (test_dialog)->action_area), 6);
+ gtk_box_set_spacing (GTK_BOX (content_area), 2);
+ gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
+ gtk_box_set_spacing (GTK_BOX (action_area), 6);
gtk_window_set_resizable (GTK_WINDOW (test_dialog), FALSE);
hbox = gtk_hbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (test_dialog)->vbox), hbox, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 0);
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
diff --git a/src/gdu-gtk/gdu-create-linux-md-dialog.c b/src/gdu-gtk/gdu-create-linux-md-dialog.c
index 5fb67e2..3ffdefb 100644
--- a/src/gdu-gtk/gdu-create-linux-md-dialog.c
+++ b/src/gdu-gtk/gdu-create-linux-md-dialog.c
@@ -486,6 +486,7 @@ gdu_create_linux_md_dialog_constructed (GObject *object)
{
GduCreateLinuxMdDialog *dialog = GDU_CREATE_LINUX_MD_DIALOG (object);
GtkWidget *content_area;
+ GtkWidget *action_area;
GtkWidget *button;
GtkWidget *label;
GtkWidget *hbox;
@@ -505,11 +506,14 @@ gdu_create_linux_md_dialog_constructed (GObject *object)
ret = FALSE;
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
+
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 6);
+ gtk_box_set_spacing (GTK_BOX (content_area), 0);
+ gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
+ gtk_box_set_spacing (GTK_BOX (action_area), 6);
gtk_window_set_title (GTK_WINDOW (dialog), _("Create RAID Array"));
gtk_window_set_icon_name (GTK_WINDOW (dialog), "gdu-raid-array");
@@ -520,7 +524,6 @@ gdu_create_linux_md_dialog_constructed (GObject *object)
GTK_RESPONSE_OK);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
- content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
gtk_container_set_border_width (GTK_CONTAINER (content_area), 10);
vbox = content_area;
diff --git a/src/gdu-gtk/gdu-drive-benchmark-dialog.c b/src/gdu-gtk/gdu-drive-benchmark-dialog.c
index a426df8..dc080ce 100644
--- a/src/gdu-gtk/gdu-drive-benchmark-dialog.c
+++ b/src/gdu-gtk/gdu-drive-benchmark-dialog.c
@@ -517,6 +517,7 @@ benchmark_cb (GduDevice *device,
{
GduDriveBenchmarkDialog *dialog = GDU_DRIVE_BENCHMARK_DIALOG (user_data);
GError *local_error;
+ GtkAllocation allocation;
if (error != NULL) {
if (!(error->domain == GDU_ERROR && error->code == GDU_ERROR_CANCELLED)) {
@@ -556,11 +557,12 @@ benchmark_cb (GduDevice *device,
out:
if (!dialog->priv->deleted) {
update_dialog (dialog);
+ gtk_widget_get_allocation (dialog->priv->drawing_area, &allocation);
gtk_widget_queue_draw_area (dialog->priv->drawing_area,
0,
0,
- dialog->priv->drawing_area->allocation.width,
- dialog->priv->drawing_area->allocation.height);
+ allocation.width,
+ allocation.height);
}
g_object_unref (dialog);
}
@@ -869,6 +871,7 @@ on_drawing_area_expose_event (GtkWidget *widget,
gpointer user_data)
{
GduDriveBenchmarkDialog *dialog = GDU_DRIVE_BENCHMARK_DIALOG (user_data);
+ GtkAllocation allocation;
cairo_t *cr;
gdouble width, height;
gdouble gx, gy, gw, gh;
@@ -963,10 +966,11 @@ on_drawing_area_expose_event (GtkWidget *widget,
size = gdu_device_get_size (gdu_dialog_get_device (GDU_DIALOG (dialog)));
- width = widget->allocation.width;
- height = widget->allocation.height;
+ gtk_widget_get_allocation (widget, &allocation);
+ width = allocation.width;
+ height = allocation.height;
- cr = gdk_cairo_create (widget->window);
+ cr = gdk_cairo_create (gtk_widget_get_window (widget));
cairo_select_font_face (cr, "sans",
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
diff --git a/src/gdu-gtk/gdu-edit-linux-lvm2-dialog.c b/src/gdu-gtk/gdu-edit-linux-lvm2-dialog.c
index dc028d5..25ebd02 100644
--- a/src/gdu-gtk/gdu-edit-linux-lvm2-dialog.c
+++ b/src/gdu-gtk/gdu-edit-linux-lvm2-dialog.c
@@ -283,6 +283,7 @@ gdu_edit_linux_lvm2_dialog_constructed (GObject *object)
GduEditLinuxLvm2Dialog *dialog = GDU_EDIT_LINUX_LVM2_DIALOG (object);
GduLinuxLvm2VolumeGroup *vg;
GtkWidget *content_area;
+ GtkWidget *action_area;
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *hbox;
@@ -320,11 +321,12 @@ gdu_edit_linux_lvm2_dialog_constructed (GObject *object)
vbox = gtk_vbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
+ action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 6);
+ gtk_box_set_spacing (GTK_BOX (content_area), 0);
+ gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
+ gtk_box_set_spacing (GTK_BOX (action_area), 6);
name = gdu_presentable_get_name (GDU_PRESENTABLE (vg));
vpd_name = gdu_presentable_get_vpd_name (GDU_PRESENTABLE (vg));
diff --git a/src/gdu-gtk/gdu-edit-linux-md-dialog.c b/src/gdu-gtk/gdu-edit-linux-md-dialog.c
index e331cd9..1c3112a 100644
--- a/src/gdu-gtk/gdu-edit-linux-md-dialog.c
+++ b/src/gdu-gtk/gdu-edit-linux-md-dialog.c
@@ -321,6 +321,7 @@ gdu_edit_linux_md_dialog_constructed (GObject *object)
GduEditLinuxMdDialog *dialog = GDU_EDIT_LINUX_MD_DIALOG (object);
GduLinuxMdDrive *linux_md_drive;
GtkWidget *content_area;
+ GtkWidget *action_area;
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *hbox;
@@ -358,11 +359,12 @@ gdu_edit_linux_md_dialog_constructed (GObject *object)
vbox = gtk_vbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
+ action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 6);
+ gtk_box_set_spacing (GTK_BOX (content_area), 0);
+ gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
+ gtk_box_set_spacing (GTK_BOX (action_area), 6);
name = gdu_presentable_get_name (GDU_PRESENTABLE (linux_md_drive));
vpd_name = gdu_presentable_get_vpd_name (GDU_PRESENTABLE (linux_md_drive));
diff --git a/src/gdu-gtk/gdu-format-dialog.c b/src/gdu-gtk/gdu-format-dialog.c
index 5071021..f1351ac 100644
--- a/src/gdu-gtk/gdu-format-dialog.c
+++ b/src/gdu-gtk/gdu-format-dialog.c
@@ -464,6 +464,7 @@ gdu_format_dialog_constructed (GObject *object)
{
GduFormatDialog *dialog = GDU_FORMAT_DIALOG (object);
GtkWidget *content_area;
+ GtkWidget *action_area;
GtkWidget *button;
GtkWidget *icon;
GtkWidget *label;
@@ -486,11 +487,14 @@ gdu_format_dialog_constructed (GObject *object)
pixbuf = gdu_util_get_pixbuf_for_presentable (gdu_dialog_get_presentable (GDU_DIALOG (dialog)),
GTK_ICON_SIZE_DIALOG);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
+
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 6);
+ gtk_box_set_spacing (GTK_BOX (content_area), 0);
+ gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
+ gtk_box_set_spacing (GTK_BOX (action_area), 6);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
@@ -518,7 +522,6 @@ gdu_format_dialog_constructed (GObject *object)
}
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
- content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
gtk_container_set_border_width (GTK_CONTAINER (content_area), 10);
/* icon and text labels */
diff --git a/src/gdu-gtk/gdu-gtk.c b/src/gdu-gtk/gdu-gtk.c
index 95eabd2..39f335c 100644
--- a/src/gdu-gtk/gdu-gtk.c
+++ b/src/gdu-gtk/gdu-gtk.c
@@ -290,6 +290,8 @@ gdu_util_dialog_show_filesystem_busy (GtkWidget *parent_window,
char *window_title;
GIcon *window_icon;
GtkWidget *dialog;
+ GtkWidget *content_area;
+ GtkWidget *action_area;
GtkWidget *hbox;
GtkWidget *main_vbox;
GtkWidget *label;
@@ -345,18 +347,20 @@ gdu_util_dialog_show_filesystem_busy (GtkWidget *parent_window,
GTK_WINDOW (parent_window),
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_NO_SEPARATOR,
NULL);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 6);
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+ gtk_box_set_spacing (GTK_BOX (content_area), 2);
+ gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
+ gtk_box_set_spacing (GTK_BOX (action_area), 6);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
// TODO: no support for GIcon in GtkWindow
//gtk_window_set_icon_name (GTK_WINDOW (dialog), window_icon);
hbox = gtk_hbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 0);
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
@@ -551,6 +555,8 @@ gdu_util_dialog_secret_internal (GtkWidget *parent_window,
int response;
char *secret;
GtkWidget *dialog;
+ GtkWidget *content_area;
+ GtkWidget *action_area;
GtkWidget *image;
GtkWidget *hbox;
GtkWidget *main_vbox;
@@ -589,10 +595,13 @@ gdu_util_dialog_secret_internal (GtkWidget *parent_window,
}
gtk_dialog_set_default_response (GTK_DIALOG (dialog), 0);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
+
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 6);
+ gtk_box_set_spacing (GTK_BOX (content_area), 2);
+ gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
+ gtk_box_set_spacing (GTK_BOX (action_area), 6);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
// TODO: no support for GIcon in GtkWindow
//if (window_icon != NULL)
@@ -602,7 +611,7 @@ gdu_util_dialog_secret_internal (GtkWidget *parent_window,
hbox = gtk_hbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 0);
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
@@ -1141,6 +1150,8 @@ gdu_util_delete_confirmation_dialog (GtkWidget *parent_window,
gboolean ret;
gint response;
GtkWidget *dialog;
+ GtkWidget *content_area;
+ GtkWidget *action_area;
GtkWidget *hbox;
GtkWidget *image;
GtkWidget *main_vbox;
@@ -1152,16 +1163,18 @@ gdu_util_delete_confirmation_dialog (GtkWidget *parent_window,
GTK_WINDOW (parent_window),
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_NO_SEPARATOR,
NULL);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 6);
+ gtk_box_set_spacing (GTK_BOX (content_area), 2);
+ gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
+ gtk_box_set_spacing (GTK_BOX (action_area), 6);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
hbox = gtk_hbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 0);
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
diff --git a/src/gdu-gtk/gdu-partition-dialog.c b/src/gdu-gtk/gdu-partition-dialog.c
index 7c28892..10a47a6 100644
--- a/src/gdu-gtk/gdu-partition-dialog.c
+++ b/src/gdu-gtk/gdu-partition-dialog.c
@@ -177,6 +177,7 @@ gdu_partition_dialog_constructed (GObject *object)
{
GduPartitionDialog *dialog = GDU_PARTITION_DIALOG (object);
GtkWidget *content_area;
+ GtkWidget *action_area;
GtkWidget *label;
GtkWidget *hbox;
GtkWidget *image;
@@ -195,11 +196,14 @@ gdu_partition_dialog_constructed (GObject *object)
pixbuf = gdu_util_get_pixbuf_for_presentable (gdu_dialog_get_presentable (GDU_DIALOG (dialog)),
GTK_ICON_SIZE_DIALOG);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
+
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 6);
+ gtk_box_set_spacing (GTK_BOX (content_area), 0);
+ gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
+ gtk_box_set_spacing (GTK_BOX (action_area), 6);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
@@ -216,7 +220,6 @@ gdu_partition_dialog_constructed (GObject *object)
_("_Format"),
GTK_RESPONSE_OK);
- content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
gtk_container_set_border_width (GTK_CONTAINER (content_area), 10);
/* icon and text labels */
diff --git a/src/gdu-gtk/gdu-spinner.c b/src/gdu-gtk/gdu-spinner.c
index 82da74c..248ea8a 100644
--- a/src/gdu-gtk/gdu-spinner.c
+++ b/src/gdu-gtk/gdu-spinner.c
@@ -125,6 +125,7 @@ static GtkDrawingAreaClass *parent_class;
static void
draw (GtkWidget *widget, cairo_t *cr)
{
+ GtkAllocation allocation;
double x, y;
double radius;
double half;
@@ -137,18 +138,22 @@ draw (GtkWidget *widget, cairo_t *cr)
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
- width = widget->allocation.width;
- height = widget->allocation.height;
+ gtk_widget_get_allocation (widget, &allocation);
+ width = allocation.width;
+ height = allocation.height;
- if ( (width < 12) || (height <12) )
+ if ( (width < 12) || (height <12) ) {
gtk_widget_set_size_request(widget, 12, 12);
+ gtk_widget_get_allocation (widget, &allocation);
+ width = allocation.width;
+ height = allocation.height;
+ }
- //x = widget->allocation.x + widget->allocation.width / 2;
- //y = widget->allocation.y + widget->allocation.height / 2;
- x = widget->allocation.width / 2;
- y = widget->allocation.height / 2;
- radius = MIN (widget->allocation.width / 2,
- widget->allocation.height / 2);
+ /* x = widget->allocation.x + widget->allocation.width / 2;
+ * y = widget->allocation.y + widget->allocation.height / 2; */
+ x = width / 2;
+ y = height / 2;
+ radius = MIN (width / 2, height / 2);
half = priv->lines / 2;
/*FIXME: render in B&W for non transparency */
@@ -217,7 +222,7 @@ gdu_spinner_init (GduSpinner *spinner)
priv->current = 0;
priv->timeout = 0;
- GTK_WIDGET_SET_FLAGS (GTK_WIDGET (spinner), GTK_NO_WINDOW);
+ gtk_widget_set_has_window (GTK_WIDGET (spinner), FALSE);
}
static gboolean
@@ -226,7 +231,7 @@ gdu_spinner_expose (GtkWidget *widget, GdkEventExpose *event)
cairo_t *cr;
/* get cairo context */
- cr = gdk_cairo_create (widget->window);
+ cr = gdk_cairo_create (gtk_widget_get_window (widget));
/* set a clip region for the expose event */
cairo_rectangle (cr,
diff --git a/src/gdu-gtk/gdu-volume-grid.c b/src/gdu-gtk/gdu-volume-grid.c
index afaaeec..c21415e 100644
--- a/src/gdu-gtk/gdu-volume-grid.c
+++ b/src/gdu-gtk/gdu-volume-grid.c
@@ -407,15 +407,18 @@ static void
gdu_volume_grid_realize (GtkWidget *widget)
{
GduVolumeGrid *grid = GDU_VOLUME_GRID (widget);
+ GdkWindow *window;
GdkWindowAttr attributes;
gint attributes_mask;
+ GtkAllocation allocation;
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+ gtk_widget_set_realized (widget, TRUE);
+ gtk_widget_get_allocation (widget, &allocation);
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
+ attributes.x = allocation.x;
+ attributes.y = allocation.y;
+ attributes.width = allocation.width;
+ attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.event_mask = gtk_widget_get_events (widget) |
@@ -430,17 +433,20 @@ gdu_volume_grid_realize (GtkWidget *widget)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gtk_widget_get_parent_window (widget);
- g_object_ref (widget->window);
+ window = gtk_widget_get_parent_window (widget);
+ gtk_widget_set_window (widget, window);
+ g_object_ref (window);
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes,
- attributes_mask);
- gdk_window_set_user_data (widget->window, grid);
+ 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, grid);
- widget->style = gtk_style_attach (widget->style, widget->window);
-
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+ gtk_widget_style_attach (widget);
+ gtk_style_set_background (gtk_widget_get_style (widget),
+ window,
+ GTK_STATE_NORMAL);
}
static guint
@@ -518,7 +524,7 @@ gdu_volume_grid_init (GduVolumeGrid *grid)
{
grid->priv = G_TYPE_INSTANCE_GET_PRIVATE (grid, GDU_TYPE_VOLUME_GRID, GduVolumeGridPrivate);
- GTK_WIDGET_SET_FLAGS (grid, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (GTK_WIDGET (grid), TRUE);
}
GtkWidget *
@@ -1474,19 +1480,21 @@ gdu_volume_grid_expose_event (GtkWidget *widget,
GdkEventExpose *event)
{
GduVolumeGrid *grid = GDU_VOLUME_GRID (widget);
+ GtkAllocation allocation;
cairo_t *cr;
gdouble width;
gdouble height;
gboolean need_animation_timeout;
- width = widget->allocation.width;
- height = widget->allocation.height;
+ gtk_widget_get_allocation (widget, &allocation);
+ width = allocation.width;
+ height = allocation.height;
recompute_size (grid,
width - 1,
height -1);
- cr = gdk_cairo_create (widget->window);
+ cr = gdk_cairo_create (gtk_widget_get_window (widget));
cairo_rectangle (cr,
event->area.x, event->area.y,
event->area.width, event->area.height);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]