[libpeas] Allow building peas-gtk with earlier versions of gtk+



commit 05a5d6661b35c8cc773d4bedf4b75cf2b401eae3
Author: Chris Lord <chris linux intel com>
Date:   Mon Aug 9 13:33:31 2010 +0100

    Allow building peas-gtk with earlier versions of gtk+
    
    gtk_window_has_group() is only available in version 2.22 of gtk+, which
    isn't commonly available in distributions. Add a static implementation
    of this function when using earlier gtk+ versions.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=626428

 libpeas-gtk/peas-gtk-plugin-manager.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/libpeas-gtk/peas-gtk-plugin-manager.c b/libpeas-gtk/peas-gtk-plugin-manager.c
index 6ee7aca..1fe9c9c 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager.c
+++ b/libpeas-gtk/peas-gtk-plugin-manager.c
@@ -139,6 +139,25 @@ show_about_cb (GtkWidget            *widget,
   gtk_widget_show (pm->priv->about);
 }
 
+#if !GTK_CHECK_VERSION(2,22,0)
+static gboolean
+gtk_window_has_group (GtkWindow *window)
+{
+  GtkWindowGroup *wg;
+  static GtkWindowGroup *default_wg = NULL;
+
+  if (!default_wg)
+    {
+      GtkWidget *temp_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+      default_wg = gtk_window_get_group (GTK_WINDOW (temp_window));
+      gtk_widget_destroy (temp_window);
+    }
+
+  wg = gtk_window_get_group (window);
+  return wg != NULL && wg != default_wg;
+}
+#endif
+
 static void
 help_button_cb (GtkWidget      *button,
                 PeasPluginInfo *info)



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