Commits

Ikey Doherty committed 8f4c98d Merge

Merged in sfalken/consort-panel (pull request #2)

Fixes/Removals for GTK-3.8 compatibility

Comments (0)

Files changed (116)

applets/clock/calendar-window.c

 #include <gio/gio.h>
 
 #define GNOME_DESKTOP_USE_UNSTABLE_API
-#include <libgnome-desktop/gnome-desktop-utils.h>
 
 #include "calendar-window.h"
 
 	g_setenv ("DISPLAY", display, TRUE);
 }
 
+
+
+/**
+ * gnome_desktop_prepend_terminal_to_vector:
+ * @argc: a pointer to the vector size
+ * @argv: a pointer to the vector
+ *
+ * Description:  Prepends a terminal (either the one configured as default in
+ * the user's GNOME setup, or one of the common xterm emulators) to the passed
+ * in vector, modifying it in the process.  The vector should be allocated with
+ * #g_malloc, as this will #g_free the original vector.  Also all elements must
+ * have been allocated separately.  That is the standard glib/GNOME way of
+ * doing vectors however.  If the integer that @argc points to is negative, the
+ * size will first be computed.  Also note that passing in pointers to a vector
+ * that is empty, will just create a new vector for you.
+ **/
+static void
+gnome_desktop_prepend_terminal_to_vector (int *argc, char ***argv)
+{
+#ifndef G_OS_WIN32
+        char **real_argv;
+        int real_argc;
+        int i, j;
+       char **term_argv = NULL;
+       int term_argc = 0;
+       GSettings *settings;
+
+       gchar *terminal = NULL;
+
+       char **the_argv;
+
+        g_return_if_fail (argc != NULL);
+        g_return_if_fail (argv != NULL);
+
+        // _gnome_desktop_init_i18n ();
+
+       /* sanity */
+        if(*argv == NULL)
+                *argc = 0;
+
+       the_argv = *argv;
+
+       /* compute size if not given */
+       if (*argc < 0) {
+               for (i = 0; the_argv[i] != NULL; i++)
+                       ;
+               *argc = i;
+       }
+
+       settings = g_settings_new ("org.gnome.desktop.default-applications.terminal");
+       terminal = g_settings_get_string (settings, "exec");
+
+       if (terminal) {
+               gchar *command_line;
+               gchar *exec_flag;
+
+               exec_flag = g_settings_get_string (settings, "exec-arg");
+
+               if (exec_flag == NULL)
+                       command_line = g_strdup (terminal);
+               else
+                       command_line = g_strdup_printf ("%s %s", terminal,
+                                                       exec_flag);
+
+               g_shell_parse_argv (command_line,
+                                   &term_argc,
+                                   &term_argv,
+                                   NULL /* error */);
+
+               g_free (command_line);
+               g_free (exec_flag);
+               g_free (terminal);
+       }
+
+       g_object_unref (settings);
+
+       if (term_argv == NULL) {
+               char *check;
+
+               term_argc = 2;
+               term_argv = g_new0 (char *, 3);
+
+               check = g_find_program_in_path ("gnome-terminal");
+               if (check != NULL) {
+                       term_argv[0] = check;
+                       /* Note that gnome-terminal takes -x and
+                        * as -e in gnome-terminal is broken we use that. */
+                       term_argv[1] = g_strdup ("-x");
+               } else {
+                       if (check == NULL)
+                               check = g_find_program_in_path ("nxterm");
+                       if (check == NULL)
+                               check = g_find_program_in_path ("color-xterm");
+                       if (check == NULL)
+                               check = g_find_program_in_path ("rxvt");
+                       if (check == NULL)
+                               check = g_find_program_in_path ("xterm");
+                       if (check == NULL)
+                               check = g_find_program_in_path ("dtterm");
+                       if (check == NULL) {
+                               g_warning (_("Cannot find a terminal, using "
+                                            "xterm, even if it may not work"));
+                               check = g_strdup ("xterm");
+                       }
+                       term_argv[0] = check;
+                       term_argv[1] = g_strdup ("-e");
+               }
+       }
+
+        real_argc = term_argc + *argc;
+        real_argv = g_new (char *, real_argc + 1);
+
+        for (i = 0; i < term_argc; i++)
+                real_argv[i] = term_argv[i];
+
+        for (j = 0; j < *argc; j++, i++)
+                real_argv[i] = (char *)the_argv[j];
+
+       real_argv[i] = NULL;
+
+       g_free (*argv);
+       *argv = real_argv;
+       *argc = real_argc;
+
+       /* we use g_free here as we sucked all the inner strings
+        * out from it into real_argv */
+       g_free (term_argv);
+#else
+       /* FIXME: Implement when needed */
+       g_warning ("gnome_prepend_terminal_to_vector: Not implemented");
+#endif
+}
+
 static void
 clock_launch_calendar_tasks_app (CalendarWindow *calwin,
 				 const char     *schema_program,

applets/clock/clock-marshallers.c

-
-#ifndef ___clock_marshal_MARSHAL_H__
-#define ___clock_marshal_MARSHAL_H__
-
-#include	<glib-object.h>
-
-G_BEGIN_DECLS
-
-#ifdef G_ENABLE_DEBUG
-#define g_marshal_value_peek_boolean(v)  g_value_get_boolean (v)
-#define g_marshal_value_peek_char(v)     g_value_get_schar (v)
-#define g_marshal_value_peek_uchar(v)    g_value_get_uchar (v)
-#define g_marshal_value_peek_int(v)      g_value_get_int (v)
-#define g_marshal_value_peek_uint(v)     g_value_get_uint (v)
-#define g_marshal_value_peek_long(v)     g_value_get_long (v)
-#define g_marshal_value_peek_ulong(v)    g_value_get_ulong (v)
-#define g_marshal_value_peek_int64(v)    g_value_get_int64 (v)
-#define g_marshal_value_peek_uint64(v)   g_value_get_uint64 (v)
-#define g_marshal_value_peek_enum(v)     g_value_get_enum (v)
-#define g_marshal_value_peek_flags(v)    g_value_get_flags (v)
-#define g_marshal_value_peek_float(v)    g_value_get_float (v)
-#define g_marshal_value_peek_double(v)   g_value_get_double (v)
-#define g_marshal_value_peek_string(v)   (char*) g_value_get_string (v)
-#define g_marshal_value_peek_param(v)    g_value_get_param (v)
-#define g_marshal_value_peek_boxed(v)    g_value_get_boxed (v)
-#define g_marshal_value_peek_pointer(v)  g_value_get_pointer (v)
-#define g_marshal_value_peek_object(v)   g_value_get_object (v)
-#define g_marshal_value_peek_variant(v)  g_value_get_variant (v)
-#else /* !G_ENABLE_DEBUG */
-/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
- *          Do not access GValues directly in your code. Instead, use the
- *          g_value_get_*() functions
- */
-#define g_marshal_value_peek_boolean(v)  (v)->data[0].v_int
-#define g_marshal_value_peek_char(v)     (v)->data[0].v_int
-#define g_marshal_value_peek_uchar(v)    (v)->data[0].v_uint
-#define g_marshal_value_peek_int(v)      (v)->data[0].v_int
-#define g_marshal_value_peek_uint(v)     (v)->data[0].v_uint
-#define g_marshal_value_peek_long(v)     (v)->data[0].v_long
-#define g_marshal_value_peek_ulong(v)    (v)->data[0].v_ulong
-#define g_marshal_value_peek_int64(v)    (v)->data[0].v_int64
-#define g_marshal_value_peek_uint64(v)   (v)->data[0].v_uint64
-#define g_marshal_value_peek_enum(v)     (v)->data[0].v_long
-#define g_marshal_value_peek_flags(v)    (v)->data[0].v_ulong
-#define g_marshal_value_peek_float(v)    (v)->data[0].v_float
-#define g_marshal_value_peek_double(v)   (v)->data[0].v_double
-#define g_marshal_value_peek_string(v)   (v)->data[0].v_pointer
-#define g_marshal_value_peek_param(v)    (v)->data[0].v_pointer
-#define g_marshal_value_peek_boxed(v)    (v)->data[0].v_pointer
-#define g_marshal_value_peek_pointer(v)  (v)->data[0].v_pointer
-#define g_marshal_value_peek_object(v)   (v)->data[0].v_pointer
-#define g_marshal_value_peek_variant(v)  (v)->data[0].v_pointer
-#endif /* !G_ENABLE_DEBUG */
-
-
-/* POINTER:VOID (clock-marshallers.list:1) */
-G_GNUC_INTERNAL void _clock_marshal_POINTER__VOID (GClosure     *closure,
-                                                   GValue       *return_value,
-                                                   guint         n_param_values,
-                                                   const GValue *param_values,
-                                                   gpointer      invocation_hint,
-                                                   gpointer      marshal_data);
-void
-_clock_marshal_POINTER__VOID (GClosure     *closure,
-                              GValue       *return_value G_GNUC_UNUSED,
-                              guint         n_param_values,
-                              const GValue *param_values,
-                              gpointer      invocation_hint G_GNUC_UNUSED,
-                              gpointer      marshal_data)
-{
-  typedef gpointer (*GMarshalFunc_POINTER__VOID) (gpointer     data1,
-                                                  gpointer     data2);
-  register GMarshalFunc_POINTER__VOID callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2;
-  gpointer v_return;
-
-  g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 1);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_POINTER__VOID) (marshal_data ? marshal_data : cc->callback);
-
-  v_return = callback (data1,
-                       data2);
-
-  g_value_set_pointer (return_value, v_return);
-}
-
-/* VOID:OBJECT,STRING (clock-marshallers.list:2) */
-G_GNUC_INTERNAL void _clock_marshal_VOID__OBJECT_STRING (GClosure     *closure,
-                                                         GValue       *return_value,
-                                                         guint         n_param_values,
-                                                         const GValue *param_values,
-                                                         gpointer      invocation_hint,
-                                                         gpointer      marshal_data);
-void
-_clock_marshal_VOID__OBJECT_STRING (GClosure     *closure,
-                                    GValue       *return_value G_GNUC_UNUSED,
-                                    guint         n_param_values,
-                                    const GValue *param_values,
-                                    gpointer      invocation_hint G_GNUC_UNUSED,
-                                    gpointer      marshal_data)
-{
-  typedef void (*GMarshalFunc_VOID__OBJECT_STRING) (gpointer     data1,
-                                                    gpointer     arg_1,
-                                                    gpointer     arg_2,
-                                                    gpointer     data2);
-  register GMarshalFunc_VOID__OBJECT_STRING callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2;
-
-  g_return_if_fail (n_param_values == 3);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_VOID__OBJECT_STRING) (marshal_data ? marshal_data : cc->callback);
-
-  callback (data1,
-            g_marshal_value_peek_object (param_values + 1),
-            g_marshal_value_peek_string (param_values + 2),
-            data2);
-}
-
-/* INT:VOID (clock-marshallers.list:3) */
-G_GNUC_INTERNAL void _clock_marshal_INT__VOID (GClosure     *closure,
-                                               GValue       *return_value,
-                                               guint         n_param_values,
-                                               const GValue *param_values,
-                                               gpointer      invocation_hint,
-                                               gpointer      marshal_data);
-void
-_clock_marshal_INT__VOID (GClosure     *closure,
-                          GValue       *return_value G_GNUC_UNUSED,
-                          guint         n_param_values,
-                          const GValue *param_values,
-                          gpointer      invocation_hint G_GNUC_UNUSED,
-                          gpointer      marshal_data)
-{
-  typedef gint (*GMarshalFunc_INT__VOID) (gpointer     data1,
-                                          gpointer     data2);
-  register GMarshalFunc_INT__VOID callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2;
-  gint v_return;
-
-  g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 1);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_INT__VOID) (marshal_data ? marshal_data : cc->callback);
-
-  v_return = callback (data1,
-                       data2);
-
-  g_value_set_int (return_value, v_return);
-}
-
-G_END_DECLS
-
-#endif /* ___clock_marshal_MARSHAL_H__ */
-

applets/clock/clock-marshallers.h

-
-#ifndef ___clock_marshal_MARSHAL_H__
-#define ___clock_marshal_MARSHAL_H__
-
-#include	<glib-object.h>
-
-G_BEGIN_DECLS
-
-/* POINTER:VOID (clock-marshallers.list:1) */
-G_GNUC_INTERNAL void _clock_marshal_POINTER__VOID (GClosure     *closure,
-                                                   GValue       *return_value,
-                                                   guint         n_param_values,
-                                                   const GValue *param_values,
-                                                   gpointer      invocation_hint,
-                                                   gpointer      marshal_data);
-
-/* VOID:OBJECT,STRING (clock-marshallers.list:2) */
-G_GNUC_INTERNAL void _clock_marshal_VOID__OBJECT_STRING (GClosure     *closure,
-                                                         GValue       *return_value,
-                                                         guint         n_param_values,
-                                                         const GValue *param_values,
-                                                         gpointer      invocation_hint,
-                                                         gpointer      marshal_data);
-
-/* INT:VOID (clock-marshallers.list:3) */
-G_GNUC_INTERNAL void _clock_marshal_INT__VOID (GClosure     *closure,
-                                               GValue       *return_value,
-                                               guint         n_param_values,
-                                               const GValue *param_values,
-                                               gpointer      invocation_hint,
-                                               gpointer      marshal_data);
-
-G_END_DECLS
-
-#endif /* ___clock_marshal_MARSHAL_H__ */
-