[gedit-collaboration] Do not use deprecated methods.



commit 66248e6199d4fa0e3a1c97880661e7c63e49c09d
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Sat Feb 25 10:34:31 2012 +0100

    Do not use deprecated methods.

 src/gedit-collaboration-color-button.c  |    6 +++---
 src/gedit-collaboration-hue-renderer.c  |   10 ++++++----
 src/gedit-collaboration-manager.c       |    2 +-
 src/gedit-collaboration-window-helper.c |    2 +-
 src/gedit-collaboration.c               |   19 ++++++++-----------
 src/gedit-collaboration.h               |    4 ++--
 6 files changed, 21 insertions(+), 22 deletions(-)
---
diff --git a/src/gedit-collaboration-color-button.c b/src/gedit-collaboration-color-button.c
index 2ffea83..a7b087e 100644
--- a/src/gedit-collaboration-color-button.c
+++ b/src/gedit-collaboration-color-button.c
@@ -106,12 +106,12 @@ static void
 set_hue (GeditCollaborationColorButton *button,
          gdouble                        hue)
 {
-	GdkColor color;
+	GdkRGBA rgba;
 
 	button->priv->hue = hue;
 
-	gedit_collaboration_hue_to_color (hue, &color);
-	gtk_color_button_set_color (GTK_COLOR_BUTTON (button), &color);
+	gedit_collaboration_hue_to_rgba (hue, &rgba);
+	gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (button), &rgba);
 }
 
 static void
diff --git a/src/gedit-collaboration-hue-renderer.c b/src/gedit-collaboration-hue-renderer.c
index 2ce1f55..d59ff81 100644
--- a/src/gedit-collaboration-hue-renderer.c
+++ b/src/gedit-collaboration-hue-renderer.c
@@ -124,18 +124,17 @@ gedit_collaboration_hue_renderer_render (GtkCellRenderer      *cell,
                                          GdkRectangle const   *cell_area,
                                          GtkCellRendererState  flags)
 {
+	GtkStyleContext *context;
 	gint xpad;
 	gint ypad;
-	GtkStyle *style;
 	gdouble x;
 	gdouble y;
 	gdouble height;
 	gdouble width;
+	GdkRGBA color;
 
 	gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
 
-	style = gtk_widget_get_style (widget);
-
 	/* Draw a nice little rectangle with the current hue in the
 	   cell_area */
 	x = cell_area->x + xpad + 0.5;
@@ -156,7 +155,10 @@ gedit_collaboration_hue_renderer_render (GtkCellRenderer      *cell,
 
 	cairo_fill_preserve (ctx);
 
-	gdk_cairo_set_source_color (ctx, &style->fg[gtk_widget_get_state (widget)]);
+	context = gtk_widget_get_style_context (widget);
+	gtk_style_context_get_color (context, gtk_widget_get_state_flags (widget),
+	                             &color);
+	gdk_cairo_set_source_rgba (ctx, &color);
 	cairo_stroke (ctx);
 }
 
diff --git a/src/gedit-collaboration-manager.c b/src/gedit-collaboration-manager.c
index 64d2608..41ffc55 100644
--- a/src/gedit-collaboration-manager.c
+++ b/src/gedit-collaboration-manager.c
@@ -400,7 +400,7 @@ create_session_new (InfIo                       *io,
 	                                     GDK_WATCH);
 	gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (view)),
 	                       cursor);
-	gdk_cursor_unref (cursor);
+	g_object_unref (cursor);
 
 	textbuffer = GTK_TEXT_BUFFER (gedit_tab_get_document (tab));
 	user_table = inf_user_table_new ();
diff --git a/src/gedit-collaboration-window-helper.c b/src/gedit-collaboration-window-helper.c
index c5b84b4..3670f6a 100644
--- a/src/gedit-collaboration-window-helper.c
+++ b/src/gedit-collaboration-window-helper.c
@@ -695,7 +695,7 @@ sync_completed (InfSession       *session,
 
 	chat_name = get_chat_name (cdata->helper, connection);
 
-	hpaned = gtk_hpaned_new ();
+	hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
 	gtk_widget_show (hpaned);
 
 	gtk_paned_pack1 (GTK_PANED (hpaned), cdata->chat, TRUE, TRUE);
diff --git a/src/gedit-collaboration.c b/src/gedit-collaboration.c
index e3407b5..c058c57 100644
--- a/src/gedit-collaboration.c
+++ b/src/gedit-collaboration.c
@@ -44,29 +44,26 @@ gedit_collaboration_get_sv (GtkWidget *widget,
 }
 
 void
-gedit_collaboration_hue_to_color (gdouble   hue,
-                                  GdkColor *color)
+gedit_collaboration_hue_to_rgba (gdouble  hue,
+                                 GdkRGBA *rgba)
 {
 	gdouble r, g, b;
 
 	gtk_hsv_to_rgb (hue, 0.5, 0.5, &r, &g, &b);
 
-	color->red = r * 65535;
-	color->green = g * 65535;
-	color->blue = b * 65535;
+	rgba->red = r;
+	rgba->green = g;
+	rgba->blue = b;
+	rgba->alpha = 1.0;
 }
 
 gdouble
-gedit_collaboration_color_to_hue (GdkColor *color)
+gedit_collaboration_rgba_to_hue (GdkRGBA *rgba)
 {
-	gdouble r, g, b;
 	gdouble h, s, v;
 
-	r = color->red / 65535.0;
-	g = color->green / 65535.0;
-	b = color->blue / 65535.0;
+	gtk_rgb_to_hsv (rgba->red, rgba->green, rgba->blue, &h, &s, &v);
 
-	gtk_rgb_to_hsv (r, g, b, &h, &s, &v);
 	return h;
 }
 
diff --git a/src/gedit-collaboration.h b/src/gedit-collaboration.h
index fee2636..cbe0c86 100644
--- a/src/gedit-collaboration.h
+++ b/src/gedit-collaboration.h
@@ -23,8 +23,8 @@ void gedit_collaboration_get_sv (GtkWidget *widget,
                                  gdouble   *sat,
                                  gdouble   *val);
 
-void gedit_collaboration_hue_to_color (gdouble hue, GdkColor *color);
-gdouble gedit_collaboration_color_to_hue (GdkColor *color);
+void gedit_collaboration_hue_to_rgba (gdouble hue, GdkRGBA *rgba);
+gdouble gedit_collaboration_rgba_to_hue (GdkRGBA *rgba);
 
 GtkBuilder *gedit_collaboration_create_builder (const gchar *data_dir,
                                                 const gchar *filename);



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