[glibmm] Fix #568490 – gmmproc: gtk_accel_map_*() not substituted in documentation



commit 054740af0310f4253cceecb882b5693cbe03310b
Author: Johannes Schmid <jhs gnome org>
Date:   Thu Apr 23 11:51:21 2009 +0200

    Fix #568490 â?? gmmproc: gtk_accel_map_*() not substituted in documentation
    
    Fixed by adding some more special cases to the doc generation. Also fixes the same issue for
    most methods where the .defs file do not mention an object.
---
 ChangeLog              |    7 +++++++
 tools/pm/DocsParser.pm |   41 +++++++++++++++++++++++++++++++++++++----
 2 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3d49053..824acdb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-04-23  Johannes Schmid <jschmid openismus com>
+
+	* tools/pm/DocParser.pm:
+	Fix #568490 â?? gmmproc: gtk_accel_map_*() not substituted in documentation
+	by adding some more special cases to the doc generation. Also fixes the same
+	issue for most methods where the .defs file do not mention an object.
+
 2009-03-26  Daniel Elstner  <danielk openismus com>
 
 	* configure.ac: Rename from configure.in.
diff --git a/tools/pm/DocsParser.pm b/tools/pm/DocsParser.pm
index 3437c01..1507e8e 100644
--- a/tools/pm/DocsParser.pm
+++ b/tools/pm/DocsParser.pm
@@ -438,19 +438,52 @@ sub substitute_function($$)
 
       DocsParser::build_method_name($doc_func, $module, $class, \$name);
     }
+    else
+    {
+      print "Translated $name into ";    
+      non_object_method_name($doc_func, \$name);
+      print "$name\n";
+    }
   }
   else
   {
     # Not perfect, but better than nothing.
     $name =~ s/^g_/Glib::/;
-
-    # Hard-code the hack for this because it is not dealt with by other code:
-    $name =~ s/^gtk_accel_map_/Gtk::AccelMap::/;
   }
 
   return $name . "()";
 }
 
+sub non_object_method_name($$)
+{
+  my ($doc_func, $name) = @_;
+  if ($$name =~ "gtk_")
+  {
+    my %gtk_objects = ("gtk_accel_map" => "AccelMap",
+                       "gtk_clipboard" => "Clipboard",
+                       "gtk_file_filter" => "FileFilter",
+                       "gtk_icon_set" => "IconSet",
+                       "gtk_icon_source" => "IconSource",
+                       "gtk_icon_info" => "IconInfo",
+                       "gtk_page_setup" => "PageSetup",
+                       "gtk_recent_info" => "RecentInfo",
+                       "gtk_tooltip" => "Tooltip",
+                       "gtk_text_iter" => "TextIter",
+                       "gtk_target_list" => "TargetList",
+                       "gtk_drag_source" => "DragSource",
+                       "gtk_print_settings" => "PrintSettings",
+                       "gtk_recent_filter" => "RecentFilter");
+    foreach my $key (keys(%gtk_objects))
+    {
+      if ($$name =~ $key)
+      {
+        DocsParser::build_method_name($doc_func, "Gtk", $gtk_objects{$key}, $name);
+        return;
+      }
+    }
+  }
+  print STDERR "Documentation: Class/Namespace for $$name not found\n";
+}   
 
 sub lookup_object_of_method($$)
 {
@@ -478,7 +511,7 @@ sub lookup_object_of_method($$)
 
     pop(@parts);
   }
-
+  
   return undef;
 }
 



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