[Xfce4-commits] <exo:exo-helper-overhaul> Update python bindings.

Nick Schermer nick at xfce.org
Wed Aug 26 18:44:07 CEST 2009


Updating branch refs/heads/exo-helper-overhaul
         to d28a218994ae1b7ca3553a864a1ab28312141ab2 (commit)
       from e09d4bcc06dcd32a135b98b2ddca98e5d2e4e079 (commit)

commit d28a218994ae1b7ca3553a864a1ab28312141ab2
Author: Nick Schermer <nick at xfce.org>
Date:   Wed Aug 26 18:38:26 2009 +0200

    Update python bindings.

 python/exo.defs     |   25 ------------------
 python/exo.override |   70 ---------------------------------------------------
 python/exomodule.c  |    8 +++--
 3 files changed, 5 insertions(+), 98 deletions(-)

diff --git a/python/exo.defs b/python/exo.defs
index a4446d7..296b090 100644
--- a/python/exo.defs
+++ b/python/exo.defs
@@ -1285,31 +1285,6 @@
 
 
 
-;; From ../exo/exo-url.h
-
-(define-function url_show
-  (c-name "exo_url_show")
-  (return-type "gboolean")
-  (parameters
-    '("const-gchar*" "url")
-    '("gchar**" "envp")
-    '("GError**" "error")
-  )
-)
-
-(define-function url_show_on_screen
-  (c-name "exo_url_show_on_screen")
-  (return-type "gboolean")
-  (parameters
-    '("const-gchar*" "url")
-    '("gchar**" "envp")
-    '("GdkScreen*" "screen")
-    '("GError**" "error")
-  )
-)
-
-
-
 ;; From ../exo/exo-wrap-table.h
 
 (define-function exo_wrap_table_get_type
diff --git a/python/exo.override b/python/exo.override
index 7001ac7..ddb1da9 100644
--- a/python/exo.override
+++ b/python/exo.override
@@ -66,7 +66,6 @@ ignore
   exo_icon_view_selected_foreach
   exo_toolbars_editor_new
   exo_toolbars_view_new
-  exo_url_show_on_screen
 
 %%
 override exo_execute_preferred_application kwargs
@@ -493,72 +492,3 @@ _wrap_exo_xsession_client_set_restart_command (PyGObject *self,
   Py_INCREF (Py_None);
   return Py_None;
 }
-
-%%
-override exo_url_show kwargs
-static PyObject*
-_wrap_exo_url_show (PyObject *self,
-                    PyObject *args,
-                    PyObject *kwargs)
-{
-  static gchar *kwlist[] = { "url", "environment", "screen", NULL };
-  const gchar  *url;
-  GdkScreen    *screen;
-  PyObject     *sequence = Py_None;
-  PyObject     *item = Py_None;
-  GError       *error = NULL;
-  gchar       **envp = NULL;
-  gint          n;
-
-  if (!PyArg_ParseTupleAndKeywords (args, kwargs, "s|OO:show_url",
-                                    kwlist, &url, &sequence, &item))
-    return NULL;
-
-  /* validate parameters */
-  if (sequence != Py_None && !PySequence_Check (sequence))
-    {
-      PyErr_SetString (PyExc_TypeError, "environment must be a sequence or None");
-      return NULL;
-    }
-  else if (item != Py_None && !pygobject_check (item, &PyGdkScreen_Type))
-    {
-      PyErr_SetString (PyExc_TypeError, "screen must be a gtk.gdk.Screen or None");
-      return NULL;
-    }
-
-  /* determine the screen */
-  screen = (item != Py_None) ? GDK_SCREEN (pygobject_get (item)) : gdk_screen_get_default ();
-
-  if (G_UNLIKELY (sequence != Py_None))
-    {
-      envp = g_new0 (gchar *, PySequence_Length (sequence) + 1);
-      for (n = 0; n < PySequence_Length (sequence); ++n)
-        {
-          item = PySequence_GetItem (sequence, n);
-          Py_DECREF (item);
-
-          if (!PyString_Check (item) && !PyUnicode_Check (item))
-            {
-              PyErr_SetString (PyExc_TypeError, "sequence item not a string or unicode object");
-              g_strfreev (envp);
-              return NULL;
-            }
-
-          envp[n] = g_strdup (PyString_AsString (item));
-        }
-    }
-
-  /* try to open the specified URL */
-  exo_url_show_on_screen (url, envp, screen, &error);
-
-  /* release the environment */
-  g_strfreev (envp);
-
-  /* check for errors */
-  if (pyg_error_check (&error))
-    return NULL;
-
-  Py_INCREF (Py_None);
-  return Py_None;
-}
-
diff --git a/python/exomodule.c b/python/exomodule.c
index 37e9369..09a33c3 100644
--- a/python/exomodule.c
+++ b/python/exomodule.c
@@ -143,7 +143,9 @@ init_exo (void)
 
 #undef REGISTER_TYPE
 
-  /* use exo-url for about dialogs by default */
-  gtk_about_dialog_set_email_hook (exo_url_about_dialog_hook, NULL, NULL);
-  gtk_about_dialog_set_url_hook (exo_url_about_dialog_hook, NULL, NULL);
+#if GTK_CHECK_VERSION (2, 18, 0)
+  /* use exo about dialog hook by default */
+  gtk_about_dialog_set_email_hook (exo_gtk_url_about_dialog_hook, NULL, NULL);
+  gtk_about_dialog_set_url_hook (exo_gtk_url_about_dialog_hook, NULL, NULL);
+#endif
 }



More information about the Xfce4-commits mailing list