← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~charlesk/indicator-datetime/fix-gtk3-ftb into lp:indicator-datetime

 

charles has proposed merging lp:~charlesk/indicator-datetime/fix-gtk3-ftb into lp:indicator-datetime.

Requested reviews:
  Indicator Applet Developers (indicator-applet-developers)

For more details, see:
https://code.launchpad.net/~charlesk/indicator-datetime/fix-gtk3-ftb/+merge/93108

Fixes FTB compile-time errors when compiling against GTK 3 with deprecation warnings enabled.

NB this only fixes build-breaking code. The glade .ui file still has some deprecated uses of vboxes, etc. that are not addressed here; lp:~jbicha/indicator-datetime/replace-deprecated-ui appears to be a work in progress for that.
-- 
https://code.launchpad.net/~charlesk/indicator-datetime/fix-gtk3-ftb/+merge/93108
Your team ayatana-commits is subscribed to branch lp:indicator-datetime.
=== modified file 'libmap/cc-timezone-map.c'
--- libmap/cc-timezone-map.c	2011-06-29 13:10:25 +0000
+++ libmap/cc-timezone-map.c	2012-02-15 00:27:00 +0000
@@ -743,19 +743,25 @@
   GError *err = NULL;
   gdouble pointx, pointy;
   gdouble alpha = 1.0;
-  GtkStyle *style;
   char buf[16];
 
   gtk_widget_get_allocation (widget, &alloc);
 
-  style = gtk_widget_get_style (widget);
-
   /* Check if insensitive */
-  if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE)
+  if (gtk_widget_get_sensitive (widget))
     alpha = 0.5;
 
   /* paint background */
+#if GTK_CHECK_VERSION(3,0,0)
+  GdkRGBA rgba;
+  gtk_style_context_get_background_color (gtk_widget_get_style_context (widget),
+                                          gtk_widget_get_state_flags (widget),
+                                          &rgba);
+  gdk_cairo_set_source_rgba (cr, &rgba);
+#else
+  GtkStyle * style = gtk_widget_get_style (widget);
   gdk_cairo_set_source_color (cr, &style->bg[gtk_widget_get_state (widget)]);
+#endif
   cairo_paint (cr);
   gdk_cairo_set_source_pixbuf (cr, priv->background, 0, 0);
   cairo_paint_with_alpha (cr, alpha);

=== modified file 'src/datetime-service.c'
--- src/datetime-service.c	2012-02-01 03:27:24 +0000
+++ src/datetime-service.c	2012-02-15 00:27:00 +0000
@@ -979,13 +979,19 @@
 		// Draw the correct icon for the appointment type and then tint it using mask fill.
 		// For now we'll create a circle
         if (color_spec != NULL) {
-        	GdkColor color;
-        	gdk_color_parse (color_spec, &color);	
         	g_debug("Creating a cairo surface: size, %d by %d", width, height);         
         	cairo_surface_t *surface = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, width, height ); 
 
-    		cairo_t *cr = cairo_create(surface);
-			gdk_cairo_set_source_color(cr, &color);
+			cairo_t *cr = cairo_create(surface);
+#if GTK_CHECK_VERSION(3,0,0)
+        	GdkRGBA rgba;
+        	if (gdk_rgba_parse (&rgba, color_spec))
+        		gdk_cairo_set_source_rgba (cr, &rgba);
+#else
+			GdkColor color;
+			if (gdk_color_parse (color_spec, &color))
+				gdk_cairo_set_source_color (cr, &color);
+#endif
 			cairo_paint(cr);
     		cairo_set_source_rgba(cr, 0,0,0,0.5);
     		cairo_set_line_width(cr, 1);

=== modified file 'src/indicator-datetime.c'
--- src/indicator-datetime.c	2012-02-01 03:27:24 +0000
+++ src/indicator-datetime.c	2012-02-15 00:27:00 +0000
@@ -1261,7 +1261,11 @@
 
 	mi_data->gmi = gtk_menu_item_new();
 
+#if GTK_CHECK_VERSION(3,0,0)
+	GtkWidget * hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+#else
 	GtkWidget * hbox = gtk_hbox_new(FALSE, 4);
+#endif
 
 	/* Icon, probably someone's face or avatar on an IM */
 	mi_data->icon = gtk_image_new();
@@ -1472,7 +1476,11 @@
 	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mi_data->gmi),
 		dbusmenu_menuitem_property_get_bool(newitem, TIMEZONE_MENUITEM_PROP_RADIO));
 
+#if GTK_CHECK_VERSION(3,0,0)
+	GtkWidget * hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+#else
 	GtkWidget * hbox = gtk_hbox_new(FALSE, 4);
+#endif
 
   	/* Label, probably a username, chat room or mailbox name */
 	mi_data->label = gtk_label_new("");


Follow ups