[network-manager-applet/NMA_0_8] applet: fix compilation with -DGSEAL_ENABLE (bgo #615653)
- From: Dan Williams <dcbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/NMA_0_8] applet: fix compilation with -DGSEAL_ENABLE (bgo #615653)
- Date: Mon, 2 Aug 2010 20:27:41 +0000 (UTC)
commit a55917cad258da5688d23db6fedfc2e24afdc819
Author: Mirsal Ennaime <mirsal ennaime gmail com>
Date: Mon Aug 2 15:28:06 2010 -0700
applet: fix compilation with -DGSEAL_ENABLE (bgo #615653)
This patch substitutes all direct access to Gtk+ object fields
with accessor functions in order to fulfill the UseGseal goal
as described at http://live.gnome.org/GnomeGoals/UseGseal
(GTK 2.14+ compat fixes by dcbw)
src/applet.c | 6 ++++++
src/utils/nma-bling-spinner.c | 30 +++++++++++++++++-------------
2 files changed, 23 insertions(+), 13 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index 2734045..6cb4e8c 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -482,6 +482,7 @@ applet_new_menu_item_helper (NMConnection *connection,
static gboolean
menu_title_item_expose (GtkWidget *widget, GdkEventExpose *event)
{
+ GtkAllocation allocation;
GtkStyle *style;
GtkWidget *label;
PangoFontDescription *desc;
@@ -509,6 +510,11 @@ menu_title_item_expose (GtkWidget *widget, GdkEventExpose *event)
/* We also need to reposition the cairo context so that (0, 0) is the
* top-left of where we're supposed to start drawing.
*/
+#if GTK_CHECK_VERSION(2,18,0)
+ gtk_widget_get_allocation (widget, &allocation);
+#else
+ allocation = widget->allocation;
+#endif
cairo_translate (cr, widget->allocation.x, widget->allocation.y);
text = gtk_label_get_text (GTK_LABEL (label));
diff --git a/src/utils/nma-bling-spinner.c b/src/utils/nma-bling-spinner.c
index 5522046..0587727 100644
--- a/src/utils/nma-bling-spinner.c
+++ b/src/utils/nma-bling-spinner.c
@@ -67,30 +67,30 @@ static GtkDrawingAreaClass *parent_class;
static void
draw (GtkWidget *widget, cairo_t *cr)
{
+ NmaBlingSpinnerPrivate *priv;
+ GtkAllocation allocation;
double x, y;
double radius;
double half;
int i;
- int width, height;
-
- NmaBlingSpinnerPrivate *priv;
priv = NMA_BLING_SPINNER_GET_PRIVATE (widget);
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
- width = widget->allocation.width;
- height = widget->allocation.height;
-
- if ( (width < 12) || (height <12) )
+#if GTK_CHECK_VERSION(2,18,0)
+ gtk_widget_get_allocation (widget, &allocation);
+#else
+ allocation = widget->allocation;
+#endif
+ if ((allocation.width < 12) || (allocation.height < 12))
gtk_widget_set_size_request(widget, 12, 12);
- //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 = allocation.x + allocation.width / 2;
+ //y = allocation.y + allocation.height / 2;
+ x = allocation.width / 2;
+ y = allocation.height / 2;
+ radius = MIN (allocation.width / 2, allocation.height / 2);
half = priv->lines / 2;
/*FIXME: render in B&W for non transparency */
@@ -154,7 +154,11 @@ nma_bling_spinner_init (NmaBlingSpinner *spinner)
priv->current = 0;
priv->timeout = 0;
+#if GTK_CHECK_VERSION(2,18,0)
+ gtk_widget_set_has_window (GTK_WIDGET (spinner), FALSE);
+#else
GTK_WIDGET_SET_FLAGS (GTK_WIDGET (spinner), GTK_NO_WINDOW);
+#endif
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]