[gnome-control-center] Drop some deprecated GTK+ api



commit 4c2e26307f53246d220f1b08b17a608fd274d40d
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jan 25 00:32:10 2011 -0500

    Drop some deprecated GTK+ api

 panels/user-accounts/um-crop-area.c          |   16 ++++++++--------
 panels/user-accounts/um-fingerprint-dialog.c |   11 +++--------
 panels/user-accounts/um-password-dialog.c    |    2 +-
 panels/user-accounts/um-user-panel.c         |   10 ++++++++++
 4 files changed, 22 insertions(+), 17 deletions(-)
---
diff --git a/panels/user-accounts/um-crop-area.c b/panels/user-accounts/um-crop-area.c
index 8991ed4..c5b7da2 100644
--- a/panels/user-accounts/um-crop-area.c
+++ b/panels/user-accounts/um-crop-area.c
@@ -94,15 +94,15 @@ update_pixbufs (UmCropArea *area)
         gint height;
         GtkAllocation allocation;
         gdouble scale;
-        GdkColor *color;
+        GdkRGBA color;
         guint32 pixel;
         gint dest_x, dest_y, dest_width, dest_height;
         GtkWidget *widget;
-        GtkStyle *style;
+        GtkStyleContext *context;
 
         widget = GTK_WIDGET (area);
         gtk_widget_get_allocation (widget, &allocation);
-        style = gtk_widget_get_style (widget);
+        context = gtk_widget_get_style_context (widget);
 
         if (area->priv->pixbuf == NULL ||
             gdk_pixbuf_get_width (area->priv->pixbuf) != allocation.width ||
@@ -114,10 +114,10 @@ update_pixbufs (UmCropArea *area)
                                                      8,
                                                      allocation.width, allocation.height);
 
-                color = &style->bg[gtk_widget_get_state (widget)];
-                pixel = ((color->red & 0xff00) << 16) |
-                        ((color->green & 0xff00) << 8) |
-                         (color->blue & 0xff00);
+                gtk_style_context_get_background_color (context, gtk_style_context_get_state (context), &color);
+                pixel = (((gint)(color.red * 255)) << 16) |
+                        (((gint)(color.green * 255)) << 8) |
+                         ((gint)(color.blue * 255));
                 gdk_pixbuf_fill (area->priv->pixbuf, pixel);
 
                 width = gdk_pixbuf_get_width (area->priv->browse_pixbuf);
@@ -352,7 +352,7 @@ update_cursor (UmCropArea *area,
         if (cursor_type != area->priv->current_cursor) {
                 GdkCursor *cursor = gdk_cursor_new (cursor_type);
                 gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (area)), cursor);
-                gdk_cursor_unref (cursor);
+                g_object_unref (cursor);
                 area->priv->current_cursor = cursor_type;
         }
 }
diff --git a/panels/user-accounts/um-fingerprint-dialog.c b/panels/user-accounts/um-fingerprint-dialog.c
index cfab2ed..8593517 100644
--- a/panels/user-accounts/um-fingerprint-dialog.c
+++ b/panels/user-accounts/um-fingerprint-dialog.c
@@ -511,7 +511,7 @@ align_image (GtkWidget *child, gpointer data)
 
         if (GTK_IS_LABEL (child)) {
                 gtk_label_set_use_markup (GTK_LABEL (child), TRUE);
-                gtk_widget_modify_font (child, NULL);
+                gtk_widget_override_font (child, NULL);
                 gtk_misc_set_padding (GTK_MISC (child), 68, 10);
         }
 }
@@ -532,7 +532,6 @@ enroll_fingerprints (GtkWindow *parent,
         GError *error = NULL;
         GdkPixbuf *pixbuf;
         gchar *title;
-        GtkStyle *style;
 
         device = NULL;
 
@@ -591,11 +590,6 @@ enroll_fingerprints (GtkWindow *parent,
         gtk_window_set_resizable (GTK_WINDOW (ass), FALSE);
         gtk_window_set_type_hint (GTK_WINDOW (ass), GDK_WINDOW_TYPE_HINT_DIALOG);
 
-        gtk_widget_realize (ass);
-        style = gtk_widget_get_style (ass);
-        gtk_widget_modify_fg (ass, GTK_STATE_SELECTED, &style->fg[GTK_STATE_NORMAL]);
-        gtk_widget_modify_bg (ass, GTK_STATE_SELECTED, &style->bg[GTK_STATE_NORMAL]);
-
         g_signal_connect (G_OBJECT (ass), "cancel",
                           G_CALLBACK (assistant_cancelled), data);
         g_signal_connect (G_OBJECT (ass), "close",
@@ -622,7 +616,8 @@ enroll_fingerprints (GtkWindow *parent,
         /* translators:
          * The variable is the name of the device, for example:
          * "To enable fingerprint login, you need to save one of your fingerprints, using the
-         * 'Digital Persona U.are.U 4000/4000B' device." */
+         * 'Digital Persona U.are.U 4000/4000B' device."
+         */
         msg = g_strdup_printf (_("To enable fingerprint login, you need to save one of your fingerprints, using the '%s' device."),
                                data->name);
         gtk_label_set_text (GTK_LABEL (WID("intro-label")), msg);
diff --git a/panels/user-accounts/um-password-dialog.c b/panels/user-accounts/um-password-dialog.c
index feff4d4..b7e0e7d 100644
--- a/panels/user-accounts/um-password-dialog.c
+++ b/panels/user-accounts/um-password-dialog.c
@@ -345,7 +345,7 @@ accept_password_dialog (GtkButton        *button,
                 cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
                 gdk_window_set_cursor (gtk_widget_get_window (um->dialog), cursor);
                 gdk_display_flush (display);
-                gdk_cursor_unref (cursor);
+                g_object_unref (cursor);
         }
         else {
                 um_user_set_password (um->user, mode, password, hint);
diff --git a/panels/user-accounts/um-user-panel.c b/panels/user-accounts/um-user-panel.c
index 37d986c..bd67a1e 100644
--- a/panels/user-accounts/um-user-panel.c
+++ b/panels/user-accounts/um-user-panel.c
@@ -1224,6 +1224,12 @@ setup_main_window (UmUserPanelPrivate *d)
 }
 
 static void
+add_class (GtkStyleContext *context)
+{
+        gtk_style_context_add_class (context, "internal-toolbar");
+}
+
+static void
 um_user_panel_init (UmUserPanel *self)
 {
         UmUserPanelPrivate *d;
@@ -1231,6 +1237,7 @@ um_user_panel_init (UmUserPanel *self)
         volatile GType type;
         const gchar *filename;
         GtkWidget *button;
+        GtkStyleContext *context;
 
         dbus_g_object_register_marshaller (fprintd_marshal_VOID__STRING_BOOLEAN,
                                            G_TYPE_NONE, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID);
@@ -1265,6 +1272,9 @@ um_user_panel_init (UmUserPanel *self)
         d->photo_dialog = um_photo_dialog_new (button);
         d->main_box = get_widget (d, "accounts-vbox");
         gtk_widget_reparent (d->main_box, GTK_WIDGET (self));
+
+        context = gtk_widget_get_style_context (get_widget (d, "add-remove-toolbar"));
+        g_signal_connect (context, "changed", G_CALLBACK (add_class), NULL);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]