[gedit] Use gtk_window_has_group



commit c765c2ab7f47a0e1ea82e7d89357a1e32f8253ff
Author: Garrett Regier <alias301 gmail com>
Date:   Sat May 29 08:52:14 2010 -0700

    Use gtk_window_has_group

 gedit/gedit-encodings-combo-box.c |    7 +++++--
 gedit/gedit-plugins-engine.c      |    7 +++++--
 gedit/gedit-view.c                |    6 +++---
 gedit/gseal-gtk-compat.h          |   18 +++++++++---------
 4 files changed, 22 insertions(+), 16 deletions(-)
---
diff --git a/gedit/gedit-encodings-combo-box.c b/gedit/gedit-encodings-combo-box.c
index 23156f4..11fa081 100644
--- a/gedit/gedit-encodings-combo-box.c
+++ b/gedit/gedit-encodings-combo-box.c
@@ -213,8 +213,11 @@ add_or_remove (GeditEncodingsComboBox *menu,
 			gtk_window_set_transient_for (GTK_WINDOW (dialog),
 						      GTK_WINDOW (toplevel));
 
-			wg = gtk_window_get_group (GTK_WINDOW (toplevel));
-			if (wg == NULL)
+			if (gtk_window_has_group (GTK_WINDOW (toplevel)))
+			{
+				wg = gtk_window_get_group (GTK_WINDOW (toplevel));
+			}
+			else
 			{
 				wg = gtk_window_group_new ();
 				gtk_window_group_add_window (wg,
diff --git a/gedit/gedit-plugins-engine.c b/gedit/gedit-plugins-engine.c
index ac3d15e..5704662 100644
--- a/gedit/gedit-plugins-engine.c
+++ b/gedit/gedit-plugins-engine.c
@@ -836,8 +836,11 @@ gedit_plugins_engine_configure_plugin (GeditPluginsEngine *engine,
 	gtk_window_set_transient_for (GTK_WINDOW (conf_dlg),
 				      parent);
 
-	wg = gtk_window_get_group (parent);
-	if (wg == NULL)
+	if (gtk_window_has_group (parent))
+	{
+		wg = gtk_window_get_group (parent);
+	}
+	else
 	{
 		wg = gtk_window_group_new ();
 		gtk_window_group_add_window (wg, parent);
diff --git a/gedit/gedit-view.c b/gedit/gedit-view.c
index a6d5208..8c78c72 100644
--- a/gedit/gedit-view.c
+++ b/gedit/gedit-view.c
@@ -1492,12 +1492,12 @@ ensure_search_window (GeditView *view)
 
 	if (view->priv->search_window != NULL)
 	{
-		if (gtk_window_get_group (GTK_WINDOW (toplevel)))
+		if (gtk_window_has_group (GTK_WINDOW (toplevel)))
 		{
 			gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)),
 						     GTK_WINDOW (view->priv->search_window));
 		}
-		else if (gtk_window_get_group (GTK_WINDOW (view->priv->search_window)))
+		else if (gtk_window_has_group (GTK_WINDOW (view->priv->search_window)))
 		{
 			gtk_window_group_remove_window (gtk_window_get_group (GTK_WINDOW (view->priv->search_window)),
 							GTK_WINDOW (view->priv->search_window));
@@ -1510,7 +1510,7 @@ ensure_search_window (GeditView *view)
    
 	view->priv->search_window = gtk_window_new (GTK_WINDOW_POPUP);
 
-	if (gtk_window_get_group (GTK_WINDOW (toplevel)))
+	if (gtk_window_has_group (GTK_WINDOW (toplevel)))
 	{
 		gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)),
 					     GTK_WINDOW (view->priv->search_window));
diff --git a/gedit/gseal-gtk-compat.h b/gedit/gseal-gtk-compat.h
index 60fce42..e4d674e 100644
--- a/gedit/gseal-gtk-compat.h
+++ b/gedit/gseal-gtk-compat.h
@@ -1,7 +1,7 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
 /*
- *  Copyright © 2009 Thomas H.P. Andersen <phomes gmail com>,
- *              2009 Javier Jardón <jjardon gnome org>
+ *  Copyright (C) 2009 Thomas H.P. Andersen <phomes gmail com>,
+ *                2009 Javier Jardón <jjardon gnome org>
  *
  *  This runtime is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU Lesser General Public License as published by
@@ -11,7 +11,7 @@
  *  This runtime is distributed in the hope runtime it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ *  GNU Lesser General Public License for more details.
  *
  *  You should have received a copy of the GNU Lesser General Public License
  *  along with this runtime; if not, write to the Free Software
@@ -24,14 +24,15 @@
 G_BEGIN_DECLS
 
 #if !GTK_CHECK_VERSION (2, 22, 0)
+#define gtk_window_has_group(window)				((window)->group != NULL)
 #define gtk_text_view_reset_im_context(view) \
-	G_STMT_START \
-		if (GTK_TEXT_VIEW (view)->need_im_reset) \
+	G_STMT_START { \
+		if (view->need_im_reset) \
 		{ \
-			GTK_TEXT_VIEW (view)->need_im_reset = FALSE; \
-			gtk_im_context_reset (GTK_TEXT_VIEW (view)->im_context); \
+			view->need_im_reset = FALSE; \
+			gtk_im_context_reset (view->im_context); \
 		} \
-	G_STMT_END
+	} G_STMT_END
 #endif /* GTK < 2.22.0 */
 
 #if !GTK_CHECK_VERSION (2, 20, 0)
@@ -57,7 +58,6 @@ G_BEGIN_DECLS
 #define gtk_widget_set_window(widget, _window)                  ((widget)->window = _window)
 #endif /* GTK+ < 2.18.0 */
 
-
 G_END_DECLS
 
 #endif /* GSEAL_GTK_COMPAT_H */



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