File: glade-2.10.0-simplegladepython.2.patch

package info (click to toggle)
tepache 1.1-5
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 120 kB
  • ctags: 53
  • sloc: python: 618; makefile: 30
file content (95 lines) | stat: -rw-r--r-- 3,766 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
diff -urN glade-2.10.0.orig/glade/glade_project.c glade-2.10.0/glade/glade_project.c
--- glade-2.10.0.orig/glade/glade_project.c	2005-06-29 11:56:04.000000000 -0500
+++ glade-2.10.0/glade/glade_project.c	2005-06-29 12:01:24.000000000 -0500
@@ -46,9 +46,9 @@
 
 
 /* The order must match the GladeLanguageType enum in glade_project.h. */
-gchar *GladeLanguages[] = { "C", "C++" , "Ada 95", "Perl", "Eiffel" };
+gchar *GladeLanguages[] = { "C", "C++" , "Ada 95", "SimpleGladePython", "Perl", "Eiffel" };
 #if 1
-gint GladeNumLanguages = 3; /* Only C, C++ and Ada ported to GTK+ 2. */
+gint GladeNumLanguages = 4; /* Only C, C++, Ada ported to GTK+ 2 and SimpleGladePython. */
 #else
 gint GladeNumLanguages = sizeof (GladeLanguages) / sizeof (GladeLanguages[0]);
 #endif
@@ -60,6 +60,7 @@
 static GladeError* glade_project_write_c_source (GladeProject *project);
 static GladeError* glade_project_write_cxx_source (GladeProject *project);
 static GladeError* glade_project_write_ada95_source (GladeProject *project);
+static GladeError* glade_project_write_simple_glade_python_source (GladeProject *project);
 static GladeError* glade_project_write_perl_source (GladeProject *project);
 static GladeError* glade_project_write_eiffel_source (GladeProject *project);
 
@@ -425,6 +426,8 @@
       return glade_project_write_cxx_source (project);
     case GLADE_LANGUAGE_ADA95:
       return glade_project_write_ada95_source (project);
+    case GLADE_LANGUAGE_SIMPLE_GLADE_PYTHON:
+      return glade_project_write_simple_glade_python_source (project);
     case GLADE_LANGUAGE_PERL:
       return glade_project_write_perl_source (project);
     case GLADE_LANGUAGE_EIFFEL:
@@ -553,6 +556,51 @@
   return NULL;
 }
 
+/* Use  g_spawn_command_line_sync() to run gate on the XML file to generate SimpleGladePyhon source code. */
+static GladeError*
+glade_project_write_simple_glade_python_source (GladeProject *project)
+{
+  gchar *command_buffer;
+  gint exit_status;
+  gchar *standard_output = NULL;
+  gchar *standard_error = NULL;
+  GError *error = NULL;
+  GladeError *glade_error = NULL;
+ 
+  command_buffer = g_strdup_printf ("tepache %s", project->xml_filename);
+
+  g_spawn_command_line_sync (command_buffer,
+                             &standard_output, &standard_error,
+                             &exit_status, &error);
+
+  g_free (command_buffer);
+
+  if (exit_status != 0)
+    {
+      if(standard_error == NULL)
+      {
+        glade_error = glade_error_new_general (GLADE_STATUS_ERROR,
+                        _("Error running tepache to generate the Python source code.\n"
+                       "Check that you have tepache installed and that it is in your PATH.\n"
+                       "Then try running 'tepache <project_file.glade>' in a terminal."));
+      }
+      else
+      {
+       glade_error = glade_error_new_general (GLADE_STATUS_ERROR,
+                        _("Error running tepache\n\nOutput was: %s\n\nError was: %s"),
+                        standard_error,standard_output);
+      }
+    }
+    
+  if (standard_output)
+    g_free (standard_output);
+  if (standard_error)
+    g_free (standard_error);
+  if (error)
+    g_error_free (error);
+  return glade_error;
+}
+
 
 /* Use system() to run gate on the XML file to generate Ada95 source code. */
 static GladeError*
diff -urN glade-2.10.0.orig/glade/glade_project.h glade-2.10.0/glade/glade_project.h
--- glade-2.10.0.orig/glade/glade_project.h	2005-06-29 11:56:04.000000000 -0500
+++ glade-2.10.0/glade/glade_project.h	2005-06-29 11:56:41.000000000 -0500
@@ -40,6 +40,7 @@
   GLADE_LANGUAGE_C,
   GLADE_LANGUAGE_CPP,
   GLADE_LANGUAGE_ADA95,
+  GLADE_LANGUAGE_SIMPLE_GLADE_PYTHON,
   GLADE_LANGUAGE_PERL,
   GLADE_LANGUAGE_EIFFEL
 } GladeLanguageType;