/pidgin/main: 2c802bb77720: Fix most of warnings for gtk 3.4

Tomasz Wasilczyk twasilczyk at pidgin.im
Tue Feb 11 11:34:29 EST 2014


Changeset: 2c802bb7772060dfd17a4ed71d83e0850c13f0b3
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-02-11 17:34 +0100
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/2c802bb77720

Description:

Fix most of warnings for gtk 3.4

diffstat:

 pidgin/gtk3compat.h    |  13 +++++++++++++
 pidgin/gtkmenutray.c   |   5 +++++
 pidgin/gtkprefs.c      |   6 ++++--
 pidgin/gtkstatusbox.c  |   4 ++--
 pidgin/gtkutils.c      |   2 +-
 pidgin/pidgintooltip.c |  13 ++++++++++++-
 6 files changed, 37 insertions(+), 6 deletions(-)

diffs (111 lines):

diff --git a/pidgin/gtk3compat.h b/pidgin/gtk3compat.h
--- a/pidgin/gtk3compat.h
+++ b/pidgin/gtk3compat.h
@@ -106,6 +106,19 @@ gtk_paned_new(GtkOrientation orientation
 		return gtk_vpaned_new();
 }
 
+static inline GtkWidget *
+gtk_scale_new_with_range(GtkOrientation orientation, gdouble min, gdouble max,
+	gdouble step)
+{
+	g_return_val_if_fail(orientation == GTK_ORIENTATION_HORIZONTAL ||
+		orientation == GTK_ORIENTATION_VERTICAL, NULL);
+
+	if (orientation == GTK_ORIENTATION_HORIZONTAL)
+		return gtk_hscale_new_with_range(min, max, step);
+	else /* GTK_ORIENTATION_VERTICAL */
+		return gtk_vscale_new_with_range(min, max, step);
+}
+
 #if !GTK_CHECK_VERSION(2,24,0)
 
 #define gdk_x11_set_sm_client_id gdk_set_sm_client_id
diff --git a/pidgin/gtkmenutray.c b/pidgin/gtkmenutray.c
--- a/pidgin/gtkmenutray.c
+++ b/pidgin/gtkmenutray.c
@@ -155,7 +155,12 @@ pidgin_menu_tray_init(PidginMenuTray *me
 	GtkSettings *settings;
 	gint height = -1;
 
+#if GTK_CHECK_VERSION(3,0,0)
+	gtk_widget_set_hexpand(widget, TRUE);
+	gtk_widget_set_halign(widget, GTK_ALIGN_END);
+#else
 	gtk_menu_item_set_right_justified(GTK_MENU_ITEM(menu_tray), TRUE);
+#endif
 
 	if(!GTK_IS_WIDGET(menu_tray->tray))
 		menu_tray->tray = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c
--- a/pidgin/gtkprefs.c
+++ b/pidgin/gtkprefs.c
@@ -3224,7 +3224,8 @@ sound_page(void)
 				NULL);
 
 #ifdef USE_GSTREAMER
-	sw = gtk_hscale_new_with_range(0.0, 100.0, 5.0);
+	sw = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,
+		0.0, 100.0, 5.0);
 	gtk_range_set_increments(GTK_RANGE(sw), 5.0, 25.0);
 	gtk_range_set_value(GTK_RANGE(sw), purple_prefs_get_int(PIDGIN_PREFS_ROOT "/sound/volume"));
 	g_signal_connect (G_OBJECT (sw), "format-value",
@@ -3897,7 +3898,8 @@ make_voice_test(GtkWidget *vbox)
 	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
 	gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
 	g_free(tmp);
-	threshold = gtk_hscale_new_with_range(0, 100, 1);
+	threshold = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,
+		0, 100, 1);
 	gtk_box_pack_start(GTK_BOX(vbox), threshold, FALSE, FALSE, 0);
 	gtk_range_set_value(GTK_RANGE(threshold),
 			purple_prefs_get_int("/purple/media/audio/silence_threshold"));
diff --git a/pidgin/gtkstatusbox.c b/pidgin/gtkstatusbox.c
--- a/pidgin/gtkstatusbox.c
+++ b/pidgin/gtkstatusbox.c
@@ -455,8 +455,8 @@ destroy_icon_box(PidginStatusBox *status
 		return;
 
 	gtk_widget_destroy(statusbox->icon_box);
-	gdk_cursor_unref(statusbox->hand_cursor);
-	gdk_cursor_unref(statusbox->arrow_cursor);
+	g_object_unref(statusbox->hand_cursor);
+	g_object_unref(statusbox->arrow_cursor);
 
 	purple_imgstore_unref(statusbox->buddy_icon_img);
 
diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c
--- a/pidgin/gtkutils.c
+++ b/pidgin/gtkutils.c
@@ -2118,7 +2118,7 @@ void pidgin_set_cursor(GtkWidget *widget
 
 	cursor = gdk_cursor_new(cursor_type);
 	gdk_window_set_cursor(gtk_widget_get_window(widget), cursor);
-	gdk_cursor_unref(cursor);
+	g_object_unref(cursor);
 
 	gdk_display_flush(gdk_window_get_display(gtk_widget_get_window(widget)));
 }
diff --git a/pidgin/pidgintooltip.c b/pidgin/pidgintooltip.c
--- a/pidgin/pidgintooltip.c
+++ b/pidgin/pidgintooltip.c
@@ -149,7 +149,18 @@ setup_tooltip_window_position(gpointer d
 	GdkRectangle mon_size;
 	GtkWidget *tipwindow = pidgin_tooltip.tipwindow;
 
-	gdk_display_get_pointer(gdk_display_get_default(), &screen, &x, &y, NULL);
+#if GTK_CHECK_VERSION(3,0,0)
+	GdkDeviceManager *devmgr;
+	GdkDevice *dev;
+
+	devmgr = gdk_display_get_device_manager(gdk_display_get_default());
+	dev = gdk_device_manager_get_client_pointer(devmgr);
+	gdk_device_get_position(dev, &screen, &x, &y);
+#else
+	gdk_display_get_pointer(gdk_display_get_default(),
+		&screen, &x, &y, NULL);
+#endif
+
 	mon_num = gdk_screen_get_monitor_at_point(screen, x, y);
 	gdk_screen_get_monitor_geometry(screen, mon_num, &mon_size);
 



More information about the Commits mailing list