/pidgin/main: bfee243ed8b1: cross-win32: fix gtk3 build

Tomasz Wasilczyk twasilczyk at pidgin.im
Thu Apr 24 10:12:13 EDT 2014


Changeset: bfee243ed8b13b3fbfe4a3f9355412f1f2bbc583
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-04-24 16:12 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/bfee243ed8b1

Description:

cross-win32: fix gtk3 build

diffstat:

 pidgin/plugins/win32/transparency/win2ktrans.c |  34 +++++++++++++-------------
 pidgin/plugins/win32/winprefs/gtkappbar.c      |  34 +++++++++++++++----------
 pidgin/plugins/win32/winprefs/winprefs.c       |   2 +-
 3 files changed, 38 insertions(+), 32 deletions(-)

diffs (231 lines):

diff --git a/pidgin/plugins/win32/transparency/win2ktrans.c b/pidgin/plugins/win32/transparency/win2ktrans.c
--- a/pidgin/plugins/win32/transparency/win2ktrans.c
+++ b/pidgin/plugins/win32/transparency/win2ktrans.c
@@ -79,7 +79,7 @@ static GSList *window_list = NULL;
 static void set_wintrans(GtkWidget *window, int alpha, gboolean enabled,
 		gboolean always_on_top) {
 
-	HWND hWnd = GDK_WINDOW_HWND(window->window);
+	HWND hWnd = GDK_WINDOW_HWND(gtk_widget_get_window(window));
 	LONG style = GetWindowLong(hWnd, GWL_EXSTYLE);
 	if (enabled) {
 		style |= WS_EX_LAYERED;
@@ -175,10 +175,10 @@ static GtkWidget *wintrans_slider(GtkWid
 
 	slider = gtk_hscale_new_with_range(50, 255, 1);
 	gtk_range_set_value(GTK_RANGE(slider), imalpha);
-	gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
+	gtk_widget_set_size_request(GTK_WIDGET(slider), 200, -1);
 
 	/* On slider val change, update window's transparency level */
-	g_signal_connect(GTK_OBJECT(slider), "value-changed",
+	g_signal_connect(G_OBJECT(slider), "value-changed",
 		G_CALLBACK(change_alpha), win);
 
 	gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
@@ -256,7 +256,7 @@ static void add_slider(GtkWidget *win) {
 					GTK_CONTAINER(win));
 				wl != NULL;
 				wl = wl->next) {
-			if (GTK_IS_VBOX(GTK_OBJECT(wl->data)))
+			if (GTK_IS_VBOX(G_OBJECT(wl->data)))
 				vbox = GTK_WIDGET(wl->data);
 			else {
 				purple_debug_error(WINTRANS_PLUGIN_ID,
@@ -551,7 +551,7 @@ static GtkWidget *get_config_frame(Purpl
 	imtransbox = pidgin_make_frame(ret, _("IM Conversation Windows"));
 	button = pidgin_prefs_checkbox(_("_IM window transparency"),
 		OPT_WINTRANS_IM_ENABLED, imtransbox);
-	g_signal_connect(GTK_OBJECT(button), "clicked",
+	g_signal_connect(G_OBJECT(button), "clicked",
 		G_CALLBACK(update_convs_wintrans),
 		(gpointer) OPT_WINTRANS_IM_ENABLED);
 
@@ -560,12 +560,12 @@ static GtkWidget *get_config_frame(Purpl
 		gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE);
 	gtk_widget_show(trans_box);
 
-	g_signal_connect(GTK_OBJECT(button), "clicked",
+	g_signal_connect(G_OBJECT(button), "clicked",
 		G_CALLBACK(pidgin_toggle_sensitive), trans_box);
 
 	button = pidgin_prefs_checkbox(_("_Show slider bar in IM window"),
 		OPT_WINTRANS_IM_SLIDER, trans_box);
-	g_signal_connect(GTK_OBJECT(button), "clicked",
+	g_signal_connect(G_OBJECT(button), "clicked",
 		G_CALLBACK(update_convs_wintrans),
 		(gpointer) OPT_WINTRANS_IM_SLIDER);
 
@@ -575,7 +575,7 @@ static GtkWidget *get_config_frame(Purpl
 
 	button = pidgin_prefs_checkbox(_("Always on top"), OPT_WINTRANS_IM_ONTOP,
 		trans_box);
-	g_signal_connect(GTK_OBJECT(button), "clicked",
+	g_signal_connect(G_OBJECT(button), "clicked",
 		G_CALLBACK(update_convs_wintrans),
 		(gpointer) OPT_WINTRANS_IM_ONTOP);
 
@@ -590,11 +590,11 @@ static GtkWidget *get_config_frame(Purpl
 	slider = gtk_hscale_new_with_range(50, 255, 1);
 	gtk_range_set_value(GTK_RANGE(slider),
 		purple_prefs_get_int(OPT_WINTRANS_IM_ALPHA));
-	gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
+	gtk_widget_set_size_request(GTK_WIDGET(slider), 200, -1);
 
-	g_signal_connect(GTK_OBJECT(slider), "value-changed",
+	g_signal_connect(G_OBJECT(slider), "value-changed",
 		G_CALLBACK(alpha_change), NULL);
-	g_signal_connect(GTK_OBJECT(slider), "focus-out-event",
+	g_signal_connect(G_OBJECT(slider), "focus-out-event",
 		G_CALLBACK(alpha_pref_set_int),
 		(gpointer) OPT_WINTRANS_IM_ALPHA);
 
@@ -608,7 +608,7 @@ static GtkWidget *get_config_frame(Purpl
 	bltransbox = pidgin_make_frame (ret, _("Buddy List Window"));
 	button = pidgin_prefs_checkbox(_("_Buddy List window transparency"),
 		OPT_WINTRANS_BL_ENABLED, bltransbox);
-	g_signal_connect(GTK_OBJECT(button), "clicked",
+	g_signal_connect(G_OBJECT(button), "clicked",
 		G_CALLBACK(set_blist_trans),
 		(gpointer) OPT_WINTRANS_BL_ENABLED);
 
@@ -616,14 +616,14 @@ static GtkWidget *get_config_frame(Purpl
 	if (!purple_prefs_get_bool(OPT_WINTRANS_BL_ENABLED))
 		gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE);
 	gtk_widget_show(trans_box);
-	g_signal_connect(GTK_OBJECT(button), "clicked",
+	g_signal_connect(G_OBJECT(button), "clicked",
 		G_CALLBACK(pidgin_toggle_sensitive), trans_box);
 	button = pidgin_prefs_checkbox(
 		_("Remove Buddy List window transparency on focus"),
 		OPT_WINTRANS_BL_ONFOCUS, trans_box);
 	button = pidgin_prefs_checkbox(_("Always on top"), OPT_WINTRANS_BL_ONTOP,
 		trans_box);
-	g_signal_connect(GTK_OBJECT(button), "clicked",
+	g_signal_connect(G_OBJECT(button), "clicked",
 		G_CALLBACK(set_blist_trans),
 		(gpointer) OPT_WINTRANS_BL_ONTOP);
 	gtk_box_pack_start(GTK_BOX(bltransbox), trans_box, FALSE, FALSE, 5);
@@ -638,11 +638,11 @@ static GtkWidget *get_config_frame(Purpl
 	gtk_range_set_value(GTK_RANGE(slider),
 		purple_prefs_get_int(OPT_WINTRANS_BL_ALPHA));
 
-	gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
+	gtk_widget_set_size_request(GTK_WIDGET(slider), 200, -1);
 
-	g_signal_connect(GTK_OBJECT(slider), "value-changed",
+	g_signal_connect(G_OBJECT(slider), "value-changed",
 		G_CALLBACK(bl_alpha_change), NULL);
-	g_signal_connect(GTK_OBJECT(slider), "focus-out-event",
+	g_signal_connect(G_OBJECT(slider), "focus-out-event",
 		G_CALLBACK(alpha_pref_set_int),
 		(gpointer) OPT_WINTRANS_BL_ALPHA);
 
diff --git a/pidgin/plugins/win32/winprefs/gtkappbar.c b/pidgin/plugins/win32/winprefs/gtkappbar.c
--- a/pidgin/plugins/win32/winprefs/gtkappbar.c
+++ b/pidgin/plugins/win32/winprefs/gtkappbar.c
@@ -43,6 +43,12 @@ typedef BOOL WINAPI purple_GetMonitorInf
 
 static void gtk_appbar_do_dock(GtkAppBar *ab, UINT side);
 
+static inline HWND
+appbar_get_handle(GtkAppBar *ab)
+{
+	return GDK_WINDOW_HWND(gtk_widget_get_window(ab->win));
+}
+
 /* Retrieve the rectangular display area from the specified monitor
  * Return TRUE if successful, otherwise FALSE
  */
@@ -358,7 +364,7 @@ static void show_hide(GtkAppBar *ab, gbo
 
 	if (hide) {
 		purple_debug_info("gtkappbar", "hidden\n");
-		gtk_appbar_unregister(ab, GDK_WINDOW_HWND(ab->win->window));
+		gtk_appbar_unregister(ab, appbar_get_handle(ab));
 		ab->docked = TRUE;
 		ab->iconized = TRUE;
 	} else {
@@ -457,7 +463,7 @@ static GdkFilterReturn wnd_size(GtkAppBa
         if(msg->wParam == SIZE_MINIMIZED) {
                 purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "Minimize\n");
                 if(ab->docked) {
-                        gtk_appbar_unregister(ab, GDK_WINDOW_HWND(ab->win->window));
+			gtk_appbar_unregister(ab, appbar_get_handle(ab));
                         ab->docked = TRUE;
                 }
         }
@@ -600,21 +606,21 @@ static void gtk_appbar_do_dock(GtkAppBar
 
         purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "gtk_appbar_do_dock\n");
 
-        if(!ab || !IsWindow(GDK_WINDOW_HWND(ab->win->window)))
-                return;
+	if (!ab || !IsWindow(appbar_get_handle(ab)))
+		return;
 
         ab->side = side;
-        get_window_normal_rc(GDK_WINDOW_HWND(ab->win->window), &(ab->docked_rect));
+	get_window_normal_rc(appbar_get_handle(ab), &(ab->docked_rect));
         CopyRect(&orig, &(ab->docked_rect));
-	get_rect_of_window(GDK_WINDOW_HWND(ab->win->window), &windowRect);
-	gtk_appbar_querypos(ab, GDK_WINDOW_HWND(ab->win->window), windowRect);
+	get_rect_of_window(appbar_get_handle(ab), &windowRect);
+	gtk_appbar_querypos(ab, appbar_get_handle(ab), windowRect);
         if(EqualRect(&orig, &(ab->docked_rect)) == 0)
-                MoveWindow(GDK_WINDOW_HWND(ab->win->window),
+		MoveWindow(appbar_get_handle(ab),
                            ab->docked_rect.left,
                            ab->docked_rect.top,
                            ab->docked_rect.right - ab->docked_rect.left,
                            ab->docked_rect.bottom - ab->docked_rect.top, TRUE);
-        gtk_appbar_setpos(ab, GDK_WINDOW_HWND(ab->win->window));
+	gtk_appbar_setpos(ab, appbar_get_handle(ab));
         ab->docked = TRUE;
 }
 
@@ -623,7 +629,7 @@ void gtk_appbar_dock(GtkAppBar *ab, UINT
 
 	g_return_if_fail(ab != NULL);
 
-	hwnd = GDK_WINDOW_HWND(ab->win->window);
+	hwnd = appbar_get_handle(ab);
 
 	g_return_if_fail(IsWindow(hwnd));
 
@@ -654,10 +660,10 @@ GtkAppBar *gtk_appbar_add(GtkWidget *win
         ab->win = win;
 
         /* init docking coords */
-        get_window_normal_rc(GDK_WINDOW_HWND(win->window), &(ab->docked_rect));
+	get_window_normal_rc(appbar_get_handle(ab), &(ab->docked_rect));
 
         /* Add main window filter */
-	gdk_window_add_filter(win->window,
+	gdk_window_add_filter(gtk_widget_get_window(win),
                               gtk_appbar_event_filter,
                               ab);
         return ab;
@@ -670,8 +676,8 @@ void gtk_appbar_remove(GtkAppBar *ab) {
         if(!ab)
                 return;
 
-	hwnd = GDK_WINDOW_HWND(ab->win->window);
-        gdk_window_remove_filter(ab->win->window,
+	hwnd = appbar_get_handle(ab);
+	gdk_window_remove_filter(gtk_widget_get_window(ab->win),
                                  gtk_appbar_event_filter,
                                  ab);
         if(ab->docked) {
diff --git a/pidgin/plugins/win32/winprefs/winprefs.c b/pidgin/plugins/win32/winprefs/winprefs.c
--- a/pidgin/plugins/win32/winprefs/winprefs.c
+++ b/pidgin/plugins/win32/winprefs/winprefs.c
@@ -165,7 +165,7 @@ static void blist_create_cb(PurpleBuddyL
 		blist_set_dockable(TRUE);
 		if(purple_prefs_get_bool(PREF_DBLIST_DOCKED)) {
 			blist_ab->undocked_height = purple_prefs_get_int(PREF_DBLIST_HEIGHT);
-			if(!(gdk_window_get_state(blist->window)
+			if(!(gdk_window_get_state(gtk_widget_get_window(blist))
 					& GDK_WINDOW_STATE_WITHDRAWN)) {
 				gtk_appbar_dock(blist_ab,
 					purple_prefs_get_int(PREF_DBLIST_SIDE));



More information about the Commits mailing list