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

some console patches



Hello,
Two patchs is attached:
- For non-interactive mode with gnome compilation 
(dia-0.93-interactive.patch)
- For correct coding console messages with non UTF-8 locale.
If you like I can do this patch for cvs tree.
Thank you,

-- 
Lav
Vitaly Lipatov
Saint-Petersburg
GNU! ALT Linux Team! LaTeX! LyX!


--- app_procs.c.o	2004-06-20 18:26:52 +0400
+++ app/app_procs.c	2004-06-20 19:24:26 +0400
@@ -215,8 +215,7 @@
   if (ef == NULL) {
     ef = filter_guess_export_filter(outfname);
     if (!ef) {
-      fprintf(stderr,
-	      _("%s error: don't know how to export into %s\n"),
+      g_error(_("%s error: don't know how to export into %s\n"),
 	      argv0,outfname);
       exit(1);
     }
@@ -225,16 +224,14 @@
   dia_is_interactive = FALSE;
 
   if (0==strcmp(infname,outfname)) {
-    fprintf(stderr,
-            _("%s error: input and output file name is identical: %s"),
+    g_error(_("%s error: input and output file name is identical: %s"),
             argv0, infname);
     exit(1);
   }
   
   diagdata = new_diagram_data(&prefs.new_diagram);
   if (!inf->import(infname,diagdata,inf->user_data)) {
-    fprintf(stderr,
-            _("%s error: need valid input file %s\n"),
+    g_error(_("%s error: need valid input file %s\n"),
             argv0,infname);
             exit(1);
   }
@@ -401,9 +398,7 @@
      N_("Display credits list and exit"), NULL },
     {"version", 'v', POPT_ARG_NONE, &version, 0,
      N_("Display version and exit"), NULL },
-#ifndef GNOME
     {"help", 'h', POPT_ARG_NONE, 0, 1, N_("Show this help message") },
-#endif
     {(char *) NULL, '\0', 0, NULL, 0}
   };
 #endif
@@ -420,9 +415,6 @@
   setlocale(LC_NUMERIC, "C");
   
   bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
-#if defined ENABLE_NLS && defined HAVE_BIND_TEXTDOMAIN_CODESET
-  bind_textdomain_codeset(GETTEXT_PACKAGE,"UTF-8");  
-#endif
   textdomain(GETTEXT_PACKAGE);
 
   process_opts(argc, argv, 
@@ -431,6 +423,12 @@
 #endif
                &files,
 	     &export_file_name, &export_file_format, &size);
+
+#if defined ENABLE_NLS && defined HAVE_BIND_TEXTDOMAIN_CODESET
+  bind_textdomain_codeset(GETTEXT_PACKAGE,"UTF-8");  
+#endif
+  textdomain(GETTEXT_PACKAGE);
+
   if (argv && dia_is_interactive) {
 #ifdef GNOME
     GnomeProgram *program =
@@ -524,7 +522,7 @@
   if (object_get_type("Standard - Box") == NULL) {
     message_error(_("Couldn't find standard objects when looking for "
 		  "object-libs, exiting...\n"));
-    fprintf(stderr, _("Couldn't find standard objects when looking for "
+    g_error( _("Couldn't find standard objects when looking for "
 	    "object-libs, exiting...\n"));
     exit(1);
   }
@@ -658,7 +656,7 @@
   gtk_main_quit();
   /* This printf seems to prevent a race condition with unrefs. */
   /* Yuck.  -Lars */
-  printf(_("Thank you for using Dia.\n"));
+  g_print(_("Thank you for using Dia.\n"));
   app_exit_once = TRUE;
 
   return TRUE;
@@ -732,6 +730,7 @@
   return DIA_PLUGIN_INIT_OK;
 }
 
+/* Note: running in locale encoding */
 static void
 process_opts(int argc, char **argv,
 #ifdef HAVE_POPT
@@ -742,13 +741,13 @@
 {
 #ifdef HAVE_POPT
   int rc = 0;
-
+  //char *const buf;
   poptCtx = poptGetContext(PACKAGE, argc, (const char **)argv, options, 0);
+  //poptSetOtherOptionHelp(poptCtx, g_locale_from_utf8(_("[OPTION...] [FILE...]"), -1, NULL, NULL, NULL));
   poptSetOtherOptionHelp(poptCtx, _("[OPTION...] [FILE...]"));
   while (rc >= 0) {
     if((rc = poptGetNextOpt(poptCtx)) < -1) {
-      fprintf(stderr, 
-	      _("Error on option %s: %s.\nRun '%s --help' to see a full list of available command line options.\n"),
+      fprintf(stderr,_("Error on option %s: %s.\nRun '%s --help' to see a full list of available command line options.\n"),
 	      poptBadOption(poptCtx, 0),
 	      poptStrerror(rc),
 	      argv[0]);
@@ -833,24 +832,24 @@
       const gint nauthors = (sizeof(authors) / sizeof(authors[0])) - 1;
       const gint ndocumentors = (sizeof(documentors) / sizeof(documentors[0])) - 1;
 
-      printf("The original author of Dia was:\n\n");
+      g_print(_("The original author of Dia was:\n\n"));
       for (i = 0; i < NUMBER_OF_ORIG_AUTHORS; i++) {
-          printf(authors[i]); printf("\n");
+          g_print(authors[i]); g_print("\n");
       }
 
-      printf("\nThe current maintainers of Dia are:\n\n");
+      g_print(_("\nThe current maintainers of Dia are:\n\n"));
       for (i = NUMBER_OF_ORIG_AUTHORS; i < NUMBER_OF_ORIG_AUTHORS + NUMBER_OF_MAINTAINERS; i++) {
-	  printf(authors[i]); printf("\n");
+	  g_print(authors[i]); g_print("\n");
       }
 
-      printf("\nOther authors are:\n\n");
+      g_print(_("\nOther authors are:\n\n"));
       for (i = NUMBER_OF_ORIG_AUTHORS + NUMBER_OF_MAINTAINERS; i < nauthors; i++) {
-          printf(authors[i]); printf("\n");
+          g_print(authors[i]); g_print("\n");
       }
 
-      printf("\nDia is documented by:\n\n");
+      g_print(_("\nDia is documented by:\n\n"));
       for (i = 0; i < ndocumentors; i++) {
-          printf(documentors[i]); printf("\n");
+          g_print(documentors[i]); g_print("\n");
       }
 
       exit(0);
--- app_procs.c.o	2004-04-13 22:54:13 +0400
+++ app/app_procs.c	2004-06-20 18:11:10 +0400
@@ -431,7 +431,7 @@
 #endif
                &files,
 	     &export_file_name, &export_file_format, &size);
-  if (argv) {
+  if (argv && dia_is_interactive) {
 #ifdef GNOME
     GnomeProgram *program =
       gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE,
@@ -454,12 +454,11 @@
     gnome_window_icon_set_default_from_file (GNOME_ICONDIR"/dia_gnome_icon.png");
 
 #else
-    if (dia_is_interactive)
-      gtk_init(&argc, &argv);
-    else
-      g_type_init();
+    gtk_init(&argc, &argv);
 #endif
   }
+  else
+    g_type_init();
 
 #ifdef HAVE_POPT
   /* done with option parsing, don't leak */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] Mail converted by Mofo Magic and the Flying D

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

GuideSMACK