Hello, 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
It also requires to bump the required Gtk+ version to 2.18 -- Mirsal
From 53e95da9a186dcc21cbcaccfee4e506deab65847 Mon Sep 17 00:00:00 2001 From: Mirsal Ennaime <[email protected]> Date: Tue, 13 Apr 2010 15:46:13 +0200 Subject: [PATCH] Fix compilation using -DGSEAL_ENABLE 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 It also requires to bump the required Gtk+ version to 2.18 --- configure.ac | 2 +- src/applet-device-gsm.c | 8 ++++---- src/applet-device-wifi.c | 3 ++- src/applet-device-wired.c | 2 +- src/applet-dialogs.c | 20 +++++++++++++------- src/applet.c | 15 +++++++++------ src/utils/nma-bling-spinner.c | 21 +++++++++------------ src/wireless-dialog.c | 4 ++-- 8 files changed, 41 insertions(+), 34 deletions(-) diff --git a/configure.ac b/configure.ac index a928b6a..97351fa 100644 --- a/configure.ac +++ b/configure.ac @@ -77,7 +77,7 @@ PKG_CHECK_MODULES(NMA, libnm-glib >= 0.8 libnm-util >= 0.8 libnm-glib-vpn >= 0.8 - gtk+-2.0 >= 2.14 + gtk+-2.0 >= 2.18 libglade-2.0 gmodule-export-2.0 gconf-2.0 diff --git a/src/applet-device-gsm.c b/src/applet-device-gsm.c index 939a4a7..a88168c 100644 --- a/src/applet-device-gsm.c +++ b/src/applet-device-gsm.c @@ -723,16 +723,16 @@ ask_for_pin_puk (NMDevice *device, else if (!strcmp (secret_name, NM_SETTING_GSM_PUK)) w = gtk_label_new (_("PUK code is needed for the mobile broadband device")); if (w) - gtk_box_pack_start (GTK_BOX (dialog->vbox), w, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)), w, TRUE, TRUE, 0); dev_str = g_strdup_printf ("<b>%s</b>", utils_get_device_description (device)); w = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (w), dev_str); g_free (dev_str); - gtk_box_pack_start (GTK_BOX (dialog->vbox), w, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)), w, TRUE, TRUE, 0); w = gtk_alignment_new (0.5, 0.5, 0, 1.0); - gtk_box_pack_start (GTK_BOX (dialog->vbox), w, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)), w, TRUE, TRUE, 0); box = GTK_BOX (gtk_hbox_new (FALSE, 6)); gtk_container_set_border_width (GTK_CONTAINER (box), 6); @@ -749,7 +749,7 @@ ask_for_pin_puk (NMDevice *device, g_signal_connect (w, "changed", G_CALLBACK (pin_entry_changed), ok_button); pin_entry_changed (GTK_EDITABLE (w), ok_button); - gtk_widget_show_all (dialog->vbox); + gtk_widget_show_all (gtk_dialog_get_content_area (dialog)); return GTK_WIDGET (dialog); } diff --git a/src/applet-device-wifi.c b/src/applet-device-wifi.c index bc82afd..19c239f 100644 --- a/src/applet-device-wifi.c +++ b/src/applet-device-wifi.c @@ -58,7 +58,8 @@ show_ignore_focus_stealing_prevention (GtkWidget *widget) { gtk_widget_realize (widget); gtk_widget_show (widget); - gtk_window_present_with_time (GTK_WINDOW (widget), gdk_x11_get_server_time (widget->window)); + gtk_window_present_with_time (GTK_WINDOW (widget), + gdk_x11_get_server_time (gtk_widget_get_window (widget))); } static void diff --git a/src/applet-device-wired.c b/src/applet-device-wired.c index 7f10e57..b1649cd 100644 --- a/src/applet-device-wired.c +++ b/src/applet-device-wired.c @@ -569,7 +569,7 @@ pppoe_get_secrets (NMDevice *device, w = gtk_dialog_add_button (GTK_DIALOG (info->dialog), GTK_STOCK_OK, GTK_RESPONSE_OK); info->ok_button = w; - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (info->dialog)->vbox), + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (info->dialog))), glade_xml_get_widget (xml, "DslPage"), TRUE, TRUE, 0); diff --git a/src/applet-dialogs.c b/src/applet-dialogs.c index 5b891d0..b2140c7 100644 --- a/src/applet-dialogs.c +++ b/src/applet-dialogs.c @@ -564,7 +564,8 @@ applet_info_dialog_show (NMApplet *applet) g_signal_connect (dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), dialog); g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_hide), dialog); gtk_widget_realize (dialog); - gtk_window_present_with_time (GTK_WINDOW (dialog), gdk_x11_get_server_time (dialog->window)); + gtk_window_present_with_time (GTK_WINDOW (dialog), + gdk_x11_get_server_time (gtk_widget_get_window (dialog))); } static void @@ -697,7 +698,8 @@ applet_warning_dialog_show (const char *message) gtk_window_set_title (GTK_WINDOW (dialog), _("Missing resources")); gtk_widget_realize (dialog); gtk_widget_show (dialog); - gtk_window_present_with_time (GTK_WINDOW (dialog), gdk_x11_get_server_time (dialog->window)); + gtk_window_present_with_time (GTK_WINDOW (dialog), + gdk_x11_get_server_time (gtk_widget_get_window (dialog))); g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), @@ -732,16 +734,19 @@ applet_mobile_password_dialog_new (NMDevice *device, tmp = g_strdup_printf (_("A password is required to connect to '%s'."), id); w = gtk_label_new (tmp); g_free (tmp); - gtk_box_pack_start (GTK_BOX (dialog->vbox), w, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)), + w, TRUE, TRUE, 0); dev_str = g_strdup_printf ("<b>%s</b>", utils_get_device_description (device)); w = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (w), dev_str); g_free (dev_str); - gtk_box_pack_start (GTK_BOX (dialog->vbox), w, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)), + w, TRUE, TRUE, 0); w = gtk_alignment_new (0.5, 0.5, 0, 1.0); - gtk_box_pack_start (GTK_BOX (dialog->vbox), w, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)), + w, TRUE, TRUE, 0); box = GTK_BOX (gtk_hbox_new (FALSE, 6)); gtk_container_set_border_width (GTK_CONTAINER (box), 6); @@ -754,7 +759,7 @@ applet_mobile_password_dialog_new (NMDevice *device, gtk_entry_set_activates_default (GTK_ENTRY (w), TRUE); gtk_box_pack_start (box, w, FALSE, FALSE, 0); - gtk_widget_show_all (dialog->vbox); + gtk_widget_show_all (gtk_dialog_get_content_area (dialog)); return GTK_WIDGET (dialog); } @@ -914,7 +919,8 @@ applet_mobile_pin_dialog_present (GtkWidget *dialog, gboolean now) /* Show the dialog */ gtk_widget_realize (dialog); if (now) - gtk_window_present_with_time (GTK_WINDOW (dialog), gdk_x11_get_server_time (dialog->window)); + gtk_window_present_with_time (GTK_WINDOW (dialog), + gdk_x11_get_server_time (gtk_widget_get_window (dialog))); else gtk_window_present (GTK_WINDOW (dialog)); } diff --git a/src/applet.c b/src/applet.c index a1b6e24..f97e593 100644 --- a/src/applet.c +++ b/src/applet.c @@ -483,6 +483,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; @@ -497,7 +498,7 @@ menu_title_item_expose (GtkWidget *widget, GdkEventExpose *event) label = gtk_bin_get_child (GTK_BIN (widget)); - cr = gdk_cairo_create (widget->window); + cr = gdk_cairo_create (gtk_widget_get_window (widget)); /* The drawing area we get is the whole menu; clip the drawing to the * event area, which should just be our menu item. @@ -510,7 +511,8 @@ 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. */ - cairo_translate (cr, widget->allocation.x, widget->allocation.y); + gtk_widget_get_allocation (widget, &allocation); + cairo_translate (cr, allocation.x, allocation.y); text = gtk_label_get_text (GTK_LABEL (label)); @@ -2886,9 +2888,10 @@ applet_pre_keyring_callback (gpointer user_data) NMApplet *applet = NM_APPLET (user_data); GdkScreen *screen; GdkDisplay *display; + GdkWindow *window; - if (applet->menu && applet->menu->window) { - screen = gdk_drawable_get_screen (applet->menu->window); + if (applet->menu && (window = gtk_widget_get_window (applet->menu))) { + screen = gdk_drawable_get_screen (window); display = gdk_screen_get_display (screen); g_object_ref (display); @@ -2905,8 +2908,8 @@ applet_pre_keyring_callback (gpointer user_data) g_object_unref (display); } - if (applet->context_menu && applet->context_menu->window) { - screen = gdk_drawable_get_screen (applet->context_menu->window); + if (applet->context_menu && (window = gtk_widget_get_window (applet->context_menu))) { + screen = gdk_drawable_get_screen (window); display = gdk_screen_get_display (screen); g_object_ref (display); diff --git a/src/utils/nma-bling-spinner.c b/src/utils/nma-bling-spinner.c index 5522046..f0de3e9 100644 --- a/src/utils/nma-bling-spinner.c +++ b/src/utils/nma-bling-spinner.c @@ -71,26 +71,23 @@ draw (GtkWidget *widget, cairo_t *cr) double radius; double half; int i; - int width, height; + GtkAllocation allocation; 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) ) + gtk_widget_get_allocation (widget, &allocation); + 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 +151,7 @@ nma_bling_spinner_init (NmaBlingSpinner *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 diff --git a/src/wireless-dialog.c b/src/wireless-dialog.c index 1a1ea2e..901f328 100644 --- a/src/wireless-dialog.c +++ b/src/wireless-dialog.c @@ -1046,7 +1046,7 @@ internal_init (NMAWirelessDialog *self, gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), 2); widget = gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); - gtk_box_set_child_packing (GTK_BOX (GTK_DIALOG (self)->action_area), widget, + gtk_box_set_child_packing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (self))), widget, FALSE, TRUE, 0, GTK_PACK_END); /* Connect/Create button */ @@ -1062,7 +1062,7 @@ internal_init (NMAWirelessDialog *self, } else widget = gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_CONNECT, GTK_RESPONSE_OK); - gtk_box_set_child_packing (GTK_BOX (GTK_DIALOG (self)->action_area), widget, + gtk_box_set_child_packing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (self))), widget, FALSE, TRUE, 0, GTK_PACK_END); g_object_set (G_OBJECT (widget), "can-default", TRUE, NULL); gtk_widget_grab_default (widget); -- 1.7.0
_______________________________________________ networkmanager-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/networkmanager-list
