[Glade-devel] win32 patch for glade-2.5.1 cvs



This is a multi-part message in MIME format.
--------------030003030208090208060407
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi,
    I've recently spent some getting gtk+ 2.4 working win32 for me.  The 
one last thing I'd like to get working is glade.  Everything for me is 
working
except for the save functionality.   Attached is the set of patches I 
made to the source to get the properties dialog box to open as well as a 
fix for a invalid
write for both linux and win32 that I found using valgrind.

On my build save is crashing in save.c in the function 
save_project_file_internal when it hits the fprintf, which for me is on 
line 179.

I was hoping to get some feed back on some ideas about why it might be 
crashing on the fprintf, because if i replace the fprintf with an fwrite
the call works and the file I can see is written to just fine.  It feels 
like some how the call stack is getting corrupted.  In my patch there is 
a fix
for a win32 #define that sets a pointer to memory on the stack and then 
in other platforms allocates memory for the pointer on the stack but for
all platforms frees that memory.  So, i'm worried that the call stack 
might be getting corrupted because of other areas that are like this.

The other related bug fix for the file open dialog box is a fix in glib, 
which i reported here in bugzilla: 
http://bugzilla.gnome.org/show_bug.cgi?id=139423
I'd really like to get glade 2.5.x working in win32, and think that I'm 
really close with this patch but would like some more help in figuring 
out why the save
function is dieing on fprintf.  I hope this patch can be helpful

-todd

--------------030003030208090208060407
Content-Type: text/x-patch;
 name="mypatches.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="mypatches.patch"

? fogb.h
? fogbframe.c
? foogbwindow.c
? mypatches.patch
? win32fix.patch
Index: glade/glade_menu_editor.c
===================================================================
RCS file: /cvs/gnome/glade/glade/glade_menu_editor.c,v
retrieving revision 1.22
diff -u -r1.22 glade_menu_editor.c
--- glade/glade_menu_editor.c   5 Apr 2004 23:18:08 -0000       1.22
+++ glade/glade_menu_editor.c   12 Apr 2004 01:23:04 -0000
@@ -25,6 +25,7 @@
 #include <string.h>
 #include <time.h>
 
+#include <gtk/gtkmain.h>
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtkarrow.h>
 #include <gtk/gtkaccellabel.h>
Index: glade/glade_project_options.c
===================================================================
RCS file: /cvs/gnome/glade/glade/glade_project_options.c,v
retrieving revision 1.24
diff -u -r1.24 glade_project_options.c
--- glade/glade_project_options.c       5 Apr 2004 23:18:08 -0000       1.24
+++ glade/glade_project_options.c       12 Apr 2004 01:23:04 -0000
@@ -19,6 +19,7 @@
 #include <ctype.h>
 #include <string.h>
 
+#include <gtk/gtkmain.h>
 #include <gtk/gtkalignment.h>
 #include <gtk/gtkentry.h>
 #include <gtk/gtkeventbox.h>
Index: glade/glade_project_window.c
===================================================================
RCS file: /cvs/gnome/glade/glade/glade_project_window.c,v
retrieving revision 1.27
diff -u -r1.27 glade_project_window.c
--- glade/glade_project_window.c        23 Mar 2004 17:41:29 -0000      1.27
+++ glade/glade_project_window.c        12 Apr 2004 01:23:06 -0000
@@ -1408,7 +1408,7 @@
   glade_project_window_update_title (project_window);
   glade_project_window_setup_interface (project_window);
 
-  gtk_widget_destroy (GTK_WIDGET (options));
+  gtk_widget_hide (GTK_WIDGET (options));
 
   switch (action)
     {
@@ -1424,6 +1424,7 @@
        glade_project_window_real_write_source (project_window);
       break;
     }
+    gtk_widget_destroy (GTK_WIDGET (options));
 }
 
 
Index: glade/main.c
===================================================================
RCS file: /cvs/gnome/glade/glade/main.c,v
retrieving revision 1.15
diff -u -r1.15 main.c
--- glade/main.c        25 Mar 2004 14:57:21 -0000      1.15
+++ glade/main.c        12 Apr 2004 01:23:06 -0000
@@ -23,7 +23,9 @@
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifdef G_OS_UNIX
 #include <unistd.h>
+#endif
 
 #include <gtk/gtkmain.h>
 #include <gtk/gtkrc.h>
@@ -105,7 +107,7 @@
 int
 main (int argc, char *argv[])
 {
-  gchar *home_dir, *rc_path, *modules, *modules_needed, *new_modules;
+  gchar *home_dir = 0, *rc_path = 0, *modules = 0, *modules_needed = 0, *new_modules = 0;
 #ifdef USE_GNOME
   GnomeProgram *program;
   char *icon;
@@ -195,6 +197,8 @@
 #else
   gtk_main ();
 #endif
+
+  g_free( new_modules );
   return 0;
 }
 
Index: glade/property.c
===================================================================
RCS file: /cvs/gnome/glade/glade/property.c,v
retrieving revision 1.35
diff -u -r1.35 property.c
--- glade/property.c    23 Mar 2004 17:41:30 -0000      1.35
+++ glade/property.c    12 Apr 2004 01:23:09 -0000
@@ -988,59 +988,63 @@
     lang_specific_properties[i] = NULL;
 
   /* Create table for C-specific properties. */
-  table = gtk_table_new (3, 3, FALSE);
-  gtk_table_set_row_spacings (GTK_TABLE (table), 1);
-  if (property_language == GLADE_LANGUAGE_C)
-    gtk_widget_show (table);
-  lang_specific_properties[GLADE_LANGUAGE_C] = table;
-  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
-
-  property_set_table_position (table, 0);
-  property_add_filename (GbCSourceFile, _("Source File:"),
-                        _("The file to write source code into"));
-  property_add_bool (GbCPublic, _("Public:"),
-                    _("If the widget is added to the component's data structure"));
-
-  /* Create table for C++-specific properties. */
-  table = gtk_table_new (3, 3, FALSE);
-  gtk_table_set_row_spacings (GTK_TABLE (table), 1);
-  if (property_language == GLADE_LANGUAGE_CPP)
-    gtk_widget_show (table);
-  lang_specific_properties[GLADE_LANGUAGE_CPP] = table;
-  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
-
-  property_set_table_position (table, 0);
-  property_add_bool (GbCxxSeparateClass, _("Separate Class:"),
-                    _("Put this widget's subtree in a separate class"));
-  property_add_bool (GbCxxSeparateFile, _("Separate File:"),
-                    _("Put this widget in a separate source file"));
-  property_add_choice (GbCxxVisibility, _("Visibility:"),
-                      _("Visibility of widgets. Public widgets are exported to a global map."),
-                      GbCxxVisibilityChoices);
-
-  /* Create table for Ada95-specific properties. */
-  table = gtk_table_new (3, 3, FALSE);
-  gtk_table_set_row_spacings (GTK_TABLE (table), 1);
-  if (property_language == GLADE_LANGUAGE_ADA95)
-    gtk_widget_show (table);
-  lang_specific_properties[GLADE_LANGUAGE_ADA95] = table;
-  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
-
-  property_set_table_position (table, 0);
-  /* No properties yet. */
-
-
-  /* Create table for Perl-specific properties. */
-  table = gtk_table_new (3, 3, FALSE);
-  gtk_table_set_row_spacings (GTK_TABLE (table), 1);
-  if (property_language == GLADE_LANGUAGE_PERL)
-    gtk_widget_show (table);
-  lang_specific_properties[GLADE_LANGUAGE_PERL] = table;
-  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
-
-  property_set_table_position (table, 0);
-  /* No properties yet. */
-
+  if( GLADE_LANGUAGE_C < GladeNumLanguages ){
+    table = gtk_table_new (3, 3, FALSE);
+    gtk_table_set_row_spacings (GTK_TABLE (table), 1);
+    if (property_language == GLADE_LANGUAGE_C)
+      gtk_widget_show (table);
+    lang_specific_properties[GLADE_LANGUAGE_C] = table;
+    gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
+
+    property_set_table_position (table, 0);
+    property_add_filename (GbCSourceFile, _("Source File:"),
+                        _("The file to write source code into"));
+    property_add_bool (GbCPublic, _("Public:"),
+                    _("If the widget is added to the component's data structure"));
+  }
+  if( GLADE_LANGUAGE_CPP < GladeNumLanguages ){
+       /* Create table for C++-specific properties. */
+       table = gtk_table_new (3, 3, FALSE);
+       gtk_table_set_row_spacings (GTK_TABLE (table), 1);
+       if (property_language == GLADE_LANGUAGE_CPP)
+       gtk_widget_show (table);
+       lang_specific_properties[GLADE_LANGUAGE_CPP] = table;
+       gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
+
+       property_set_table_position (table, 0);
+       property_add_bool (GbCxxSeparateClass, _("Separate Class:"),
+                       _("Put this widget's subtree in a separate class"));
+       property_add_bool (GbCxxSeparateFile, _("Separate File:"),
+                       _("Put this widget in a separate source file"));
+       property_add_choice (GbCxxVisibility, _("Visibility:"),
+                       _("Visibility of widgets. Public widgets are exported to a global map."),
+                       GbCxxVisibilityChoices);
+  }
+  if( GLADE_LANGUAGE_ADA95 < GladeNumLanguages ){
+       /* Create table for Ada95-specific properties. */
+       table = gtk_table_new (3, 3, FALSE);
+       gtk_table_set_row_spacings (GTK_TABLE (table), 1);
+       if (property_language == GLADE_LANGUAGE_ADA95)
+       gtk_widget_show (table);
+       lang_specific_properties[GLADE_LANGUAGE_ADA95] = table;
+       gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
+
+       property_set_table_position (table, 0);
+       /* No properties yet. */
+
+  }
+  if( GLADE_LANGUAGE_PERL < GladeNumLanguages ){
+       /* Create table for Perl-specific properties. */
+       table = gtk_table_new (3, 3, FALSE);
+       gtk_table_set_row_spacings (GTK_TABLE (table), 1);
+       if (property_language == GLADE_LANGUAGE_PERL)
+       gtk_widget_show (table);
+       lang_specific_properties[GLADE_LANGUAGE_PERL] = table;
+       gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
+
+       property_set_table_position (table, 0);
+       /* No properties yet. */
+  }
 }
 
 
Index: glade/utils.c
===================================================================
RCS file: /cvs/gnome/glade/glade/utils.c,v
retrieving revision 1.30
diff -u -r1.30 utils.c
--- glade/utils.c       23 Mar 2004 17:41:30 -0000      1.30
+++ glade/utils.c       12 Apr 2004 01:23:11 -0000
@@ -21,7 +21,9 @@
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifdef G_OS_UNIX
 #include <unistd.h>
+#endif
 #include <dirent.h>
 #include <errno.h>
 
@@ -1331,7 +1333,10 @@
   if (dir_pos > root_pos)
     dir_pos++;
   len = dir_pos + 1 + (strlen (file) - file_pos) + 1;
-  path = g_malloc (len); 
+  path = g_try_malloc (len);
+  if( path == NULL ){
+    return NULL;
+  }
   strncpy (path, dir, dir_pos);
   path[dir_pos] = G_DIR_SEPARATOR;
   strcpy (path + dir_pos + 1, file + file_pos);
@@ -1602,11 +1607,13 @@
   gint project_num, max_project_num, project_string_len;
   gint num_matched, chars_matched;
 
-#ifdef _WIN32
-  projects_dir = "C:\\Projects";
-#else
+
   projects_dir = glade_util_make_absolute_path (g_get_home_dir (),
                                                _("Projects"));
+#ifdef _WIN32
+  if( projects_dir == NULL ){
+    projects_dir = g_strdup( "C:\\Projects" );
+  }
 #endif
 
   /* Step through the 'Projects' directory, if it exists, to find

--------------030003030208090208060407
Content-Type: text/x-vcard; charset=utf8;
 name="taf2.vcf"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="taf2.vcf"

begin:vcard
fn:Todd Fisher
n:Fisher;Todd
email;internet:taf2 lehigh edu
x-mozilla-html:FALSE
url:http://severna.homeip.net
version:2.1
end:vcard


--------------030003030208090208060407--




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