Package: gtktrain Version: 0.9b-9.1 Severity: wishlist Tags: patch gtktrain doesn't display the Japanese characters with a modern Gnome desktop.
The attached patch converts the configure.in script to look for the GTK2 libraries, and changes some of the .c files accordingly. This allows gtktrain to work with GTK2, and provides some basic unicode support for the display of characters. -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.16.9 Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8) Versions of packages gtktrain depends on: ii debconf 1.5.0 Debian configuration management sy ii libc6 2.3.6-7 GNU C Library: Shared libraries hi libglib1.2 1.2.10-10 The GLib library of C routines ii libgtk1.2 1.2.10-18 The GIMP Toolkit set of widgets fo ii libtrain1 0.9b-8 The train-routing calculator libra ii libx11-6 2:1.0.0-6 X11 client-side library ii libxext6 1:1.0.0-4 X11 miscellaneous extension librar ii libxi6 1:1.0.0-5 X11 Input extension library gtktrain recommends no packages. -- debconf information excluded
diff -urN -x 'po*' -x '*.m4' -x 'config.*' -x configure -x 'Makefile*' gtktrain-0.9b/configure.in gtktrain-0.9b-modified/configure.in --- gtktrain-0.9b/configure.in 2000-05-08 23:15:39.000000000 +1000 +++ gtktrain-0.9b-modified/configure.in 2006-01-26 18:24:26.000000000 +1100 @@ -36,10 +36,11 @@ AC_SUBST(localedir) dnl GTK stuff -AM_PATH_GTK(1.2.0,, - AC_MSG_ERROR(Test for GTK failed. See the file INSTALL for help)) -X_LIBS=$GTK_LIBS -X_CFLAGS=$GTK_CFLAGS +dnl AM_PATH_GTK(1.2.0,, +PKG_CHECK_MODULES(X, gtk+-2.0) +dnl AC_MSG_ERROR(Test for GTK failed. See the file INSTALL for help)) +dnl X_LIBS=$GTK_LIBS +dnl X_CFLAGS=$GTK_CFLAGS AC_SUBST(X_LIBS) AC_SUBST(X_CFLAGS) diff -urN -x 'po*' -x '*.m4' -x 'config.*' -x configure -x 'Makefile*' gtktrain-0.9b/gtkui/dataopen.c gtktrain-0.9b-modified/gtkui/dataopen.c --- gtktrain-0.9b/gtkui/dataopen.c 2000-05-07 16:46:46.000000000 +1000 +++ gtktrain-0.9b-modified/gtkui/dataopen.c 2006-03-16 21:15:34.000000000 +1100 @@ -34,8 +34,8 @@ void on_DataOpenOK_clicked(GtkButton *button, gpointer user_data) { - GtkFileSelection *filesel = GTK_FILE_SELECTION(gtk_widget_get_toplevel(GTK_WIDGET(button))); - Train_SetDataFile(gtk_file_selection_get_filename(filesel)); + GtkFileChooser *filechooser = GTK_FILE_CHOOSER(gtk_widget_get_toplevel(GTK_WIDGET(button))); + Train_SetDataFile(gtk_file_chooser_get_filename (filechooser)); gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); } @@ -45,4 +45,3 @@ { gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button))); } - diff -urN -x 'po*' -x '*.m4' -x 'config.*' -x configure -x 'Makefile*' gtktrain-0.9b/gtkui/gtktrain.c gtktrain-0.9b-modified/gtkui/gtktrain.c --- gtktrain-0.9b/gtkui/gtktrain.c 2000-05-07 16:46:46.000000000 +1000 +++ gtktrain-0.9b-modified/gtkui/gtktrain.c 2006-05-12 15:57:54.000000000 +1000 @@ -112,8 +112,6 @@ { GtkWidget *DataOpenDialog; DataOpenDialog = create_DataOpenDialog(); - gtk_file_selection_set_filename(GTK_FILE_SELECTION(DataOpenDialog), - Train_GetTrainDir()); gtk_widget_show(DataOpenDialog); gMainWin_StationFilled = FALSE; } @@ -294,16 +292,15 @@ startid = Train_SetStartPoint(start); endid = Train_SetEndPoint(destination); - Train_Search(startid, endid); gtk_clist_clear(GTK_CLIST(clist_result)); for (i = 0; (p = Train_GetResultItem(i)) != NULL; i++){ if (strlen(p) > 0){ gchar *row[1]; - row[0] = p; + row[0] = g_convert (p, strlen(p), "UTF-8", "EUCJP", NULL, NULL, NULL); gtk_clist_append(GTK_CLIST(clist_result), row); - fprintf(stderr, "%4d: %s\n", i, p); + fprintf(stderr, "%4d: %s\n", i, g_convert (p, strlen(p), "UTF-8", "EUCJP", NULL, NULL, NULL)); } } gMainWin_StationFilled = FALSE; @@ -311,6 +308,7 @@ gtk_entry_set_text(GTK_ENTRY(entry_walk), Train_GetWalkText()); gtk_entry_set_text(GTK_ENTRY(entry_wait), Train_GetWaitText()); gtk_entry_set_text(GTK_ENTRY(entry_total), Train_GetTotalText()); + } static void @@ -333,7 +331,7 @@ gchar buf[128], name[128]; sprintf(name, "%s", Train_GetStationName(i)); sprintf(buf, "%s (%s)", name, Train_GetStationNameInRoman(i)); - row[0] = buf; + row[0] = g_convert (buf, strlen(buf), "UTF-8", "EUCJP", NULL, NULL, NULL); gtk_clist_append(GTK_CLIST(clist_result), row); } diff -urN -x 'po*' -x '*.m4' -x 'config.*' -x configure -x 'Makefile*' gtktrain-0.9b/gtkui/interface.c gtktrain-0.9b-modified/gtkui/interface.c --- gtktrain-0.9b/gtkui/interface.c 2000-05-09 10:55:53.000000000 +1000 +++ gtktrain-0.9b-modified/gtkui/interface.c 2006-05-12 15:58:04.000000000 +1000 @@ -96,7 +96,6 @@ gtk_object_set_data_full (GTK_OBJECT (MainWin), "MenuFile_menu", MenuFile_menu, (GtkDestroyNotify) gtk_widget_unref); gtk_menu_item_set_submenu (GTK_MENU_ITEM (MenuFile), MenuFile_menu); - MenuFile_menu_accels = gtk_menu_ensure_uline_accel_group (GTK_MENU (MenuFile_menu)); MenuOpen = gtk_menu_item_new_with_label (_("Open Data ...")); gtk_widget_ref (MenuOpen); @@ -138,7 +137,6 @@ gtk_object_set_data_full (GTK_OBJECT (MainWin), "MenuEdit_menu", MenuEdit_menu, (GtkDestroyNotify) gtk_widget_unref); gtk_menu_item_set_submenu (GTK_MENU_ITEM (MenuEdit), MenuEdit_menu); - MenuEdit_menu_accels = gtk_menu_ensure_uline_accel_group (GTK_MENU (MenuEdit_menu)); MenuTime = gtk_menu_item_new_with_label (_("Time ...")); gtk_widget_ref (MenuTime); @@ -173,7 +171,6 @@ gtk_object_set_data_full (GTK_OBJECT (MainWin), "MenuHelp_menu", MenuHelp_menu, (GtkDestroyNotify) gtk_widget_unref); gtk_menu_item_set_submenu (GTK_MENU_ITEM (MenuHelp), MenuHelp_menu); - MenuHelp_menu_accels = gtk_menu_ensure_uline_accel_group (GTK_MENU (MenuHelp_menu)); MenuAbout = gtk_menu_item_new_with_label (_("About ...")); gtk_widget_ref (MenuAbout); @@ -250,7 +247,7 @@ gtk_widget_show (hbuttonbox1); gtk_box_pack_start (GTK_BOX (vbox4), hbuttonbox1, TRUE, TRUE, 0); - ButtonSearch = gtk_button_new_with_label (_("search")); + ButtonSearch = gtk_button_new_with_label (_("Search")); gtk_widget_ref (ButtonSearch); gtk_object_set_data_full (GTK_OBJECT (MainWin), "ButtonSearch", ButtonSearch, (GtkDestroyNotify) gtk_widget_unref); @@ -411,7 +408,7 @@ return MainWin; } -GtkWidget* +/*GtkWidget* create_NotYetDialog (void) { GtkWidget *NotYetDialog; @@ -420,7 +417,8 @@ GtkWidget *hbuttonbox2; GtkWidget *ButtonOK; - NotYetDialog = gtk_window_new (GTK_WINDOW_DIALOG); + //NotYetDialog = gtk_window_new (GTK_WINDOW_DIALOG); + NotYetDialog = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_object_set_data (GTK_OBJECT (NotYetDialog), "NotYetDialog", NotYetDialog); gtk_container_set_border_width (GTK_CONTAINER (NotYetDialog), 10); gtk_window_set_title (GTK_WINDOW (NotYetDialog), _("not yet")); @@ -461,7 +459,7 @@ NULL); return NotYetDialog; -} +}*/ GtkWidget* create_AboutDialog (void) @@ -472,7 +470,8 @@ GtkWidget *hbuttonbox3; GtkWidget *ButtonOK; - AboutDialog = gtk_window_new (GTK_WINDOW_DIALOG); + //AboutDialog = gtk_window_new (GTK_WINDOW_DIALOG); + AboutDialog = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_object_set_data (GTK_OBJECT (AboutDialog), "AboutDialog", AboutDialog); gtk_container_set_border_width (GTK_CONTAINER (AboutDialog), 10); gtk_window_set_title (GTK_WINDOW (AboutDialog), _("about")); @@ -521,19 +520,26 @@ GtkWidget *ok_button1; GtkWidget *cancel_button1; - DataOpenDialog = gtk_file_selection_new (_("Open Data ...")); + DataOpenDialog = gtk_file_chooser_dialog_new (_("Open Data ..."), + NULL, GTK_FILE_CHOOSER_ACTION_OPEN, + NULL); + +/* DataOpenDialog = gtk_file_selection_new (_("Open Data ..."));*/ gtk_object_set_data (GTK_OBJECT (DataOpenDialog), "DataOpenDialog", DataOpenDialog); gtk_container_set_border_width (GTK_CONTAINER (DataOpenDialog), 10); - GTK_WINDOW (DataOpenDialog)->type = GTK_WINDOW_DIALOG; + //GTK_WINDOW (DataOpenDialog)->type = GTK_WINDOW_DIALOG; + GTK_WINDOW (DataOpenDialog)->type = GTK_WINDOW_TOPLEVEL; gtk_window_set_modal (GTK_WINDOW (DataOpenDialog), TRUE); - gtk_file_selection_hide_fileop_buttons (GTK_FILE_SELECTION (DataOpenDialog)); +/* gtk_file_selection_hide_fileop_buttons (GTK_FILE_SELECTION (DataOpenDialog)); - ok_button1 = GTK_FILE_SELECTION (DataOpenDialog)->ok_button; + ok_button1 = GTK_FILE_SELECTION (DataOpenDialog)->ok_button;*/ + ok_button1 = gtk_button_new_from_stock (GTK_STOCK_OK); gtk_object_set_data (GTK_OBJECT (DataOpenDialog), "ok_button1", ok_button1); gtk_widget_show (ok_button1); GTK_WIDGET_SET_FLAGS (ok_button1, GTK_CAN_DEFAULT); - cancel_button1 = GTK_FILE_SELECTION (DataOpenDialog)->cancel_button; + /*cancel_button1 = GTK_FILE_SELECTION (DataOpenDialog)->cancel_button;*/ + cancel_button1 = gtk_button_new_from_stock (GTK_STOCK_CANCEL); gtk_object_set_data (GTK_OBJECT (DataOpenDialog), "cancel_button1", cancel_button1); gtk_widget_show (cancel_button1); GTK_WIDGET_SET_FLAGS (cancel_button1, GTK_CAN_DEFAULT); @@ -545,6 +551,9 @@ GTK_SIGNAL_FUNC (on_DataOpenCancel_clicked), NULL); + gtk_container_add (GTK_CONTAINER (GTK_DIALOG (DataOpenDialog)->action_area), cancel_button1); + gtk_container_add (GTK_CONTAINER (GTK_DIALOG (DataOpenDialog)->action_area), ok_button1); + return DataOpenDialog; } @@ -576,7 +585,8 @@ TimeDialog = gtk_dialog_new (); gtk_object_set_data (GTK_OBJECT (TimeDialog), "TimeDialog", TimeDialog); gtk_window_set_title (GTK_WINDOW (TimeDialog), _("Time ...")); - GTK_WINDOW (TimeDialog)->type = GTK_WINDOW_DIALOG; + // GTK_WINDOW (TimeDialog)->type = GTK_WINDOW_DIALOG; + GTK_WINDOW (TimeDialog)->type = GTK_WINDOW_TOPLEVEL; gtk_window_set_modal (GTK_WINDOW (TimeDialog), TRUE); gtk_window_set_policy (GTK_WINDOW (TimeDialog), TRUE, TRUE, FALSE); @@ -599,7 +609,7 @@ gtk_container_add (GTK_CONTAINER (alignment1), table2); gtk_container_set_border_width (GTK_CONTAINER (table2), 10); - label2 = gtk_label_new (_("Deptarture")); + label2 = gtk_label_new (_("Departure")); gtk_widget_ref (label2); gtk_object_set_data_full (GTK_OBJECT (TimeDialog), "label2", label2, (GtkDestroyNotify) gtk_widget_unref); @@ -707,15 +717,7 @@ gtk_widget_show (hbuttonbox4); gtk_box_pack_start (GTK_BOX (dialog_action_area1), hbuttonbox4, TRUE, TRUE, 0); - TimeButtonOK = gtk_button_new_with_label (_("OK")); - gtk_widget_ref (TimeButtonOK); - gtk_object_set_data_full (GTK_OBJECT (TimeDialog), "TimeButtonOK", TimeButtonOK, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (TimeButtonOK); - gtk_container_add (GTK_CONTAINER (hbuttonbox4), TimeButtonOK); - GTK_WIDGET_SET_FLAGS (TimeButtonOK, GTK_CAN_DEFAULT); - - TimeButtonCancel = gtk_button_new_with_label (_("Cancel")); + TimeButtonCancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL); gtk_widget_ref (TimeButtonCancel); gtk_object_set_data_full (GTK_OBJECT (TimeDialog), "TimeButtonCancel", TimeButtonCancel, (GtkDestroyNotify) gtk_widget_unref); @@ -723,16 +725,24 @@ gtk_container_add (GTK_CONTAINER (hbuttonbox4), TimeButtonCancel); GTK_WIDGET_SET_FLAGS (TimeButtonCancel, GTK_CAN_DEFAULT); - gtk_signal_connect (GTK_OBJECT (SpinDeptHour), "changed", + TimeButtonOK = gtk_button_new_from_stock (GTK_STOCK_OK); + gtk_widget_ref (TimeButtonOK); + gtk_object_set_data_full (GTK_OBJECT (TimeDialog), "TimeButtonOK", TimeButtonOK, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (TimeButtonOK); + gtk_container_add (GTK_CONTAINER (hbuttonbox4), TimeButtonOK); + GTK_WIDGET_SET_FLAGS (TimeButtonOK, GTK_CAN_DEFAULT); + + gtk_signal_connect (GTK_OBJECT (SpinDeptHour), "value_changed", GTK_SIGNAL_FUNC (on_Time_SpinDeptHour_changed), NULL); - gtk_signal_connect (GTK_OBJECT (SpinArrivHour), "changed", + gtk_signal_connect (GTK_OBJECT (SpinArrivHour), "value_changed", GTK_SIGNAL_FUNC (on_Time_SpinArrivHour_changed), NULL); - gtk_signal_connect (GTK_OBJECT (SpinDeptMin), "changed", + gtk_signal_connect (GTK_OBJECT (SpinDeptMin), "value_changed", GTK_SIGNAL_FUNC (on_Time_SpinDeptMin_changed), NULL); - gtk_signal_connect (GTK_OBJECT (SpinArrivMin), "changed", + gtk_signal_connect (GTK_OBJECT (SpinArrivMin), "value_changed", GTK_SIGNAL_FUNC (on_Time_SpinArrivMin_changed), NULL); gtk_signal_connect (GTK_OBJECT (TimeButtonCurrent), "clicked", @@ -780,7 +790,8 @@ LimitDialog = gtk_dialog_new (); gtk_object_set_data (GTK_OBJECT (LimitDialog), "LimitDialog", LimitDialog); gtk_window_set_title (GTK_WINDOW (LimitDialog), _("Limit ...")); - GTK_WINDOW (LimitDialog)->type = GTK_WINDOW_DIALOG; + //GTK_WINDOW (LimitDialog)->type = GTK_WINDOW_DIALOG; + GTK_WINDOW (LimitDialog)->type = GTK_WINDOW_TOPLEVEL; gtk_window_set_modal (GTK_WINDOW (LimitDialog), TRUE); gtk_window_set_policy (GTK_WINDOW (LimitDialog), TRUE, TRUE, FALSE); @@ -937,15 +948,7 @@ gtk_widget_show (hbuttonbox5); gtk_box_pack_start (GTK_BOX (dialog_action_area2), hbuttonbox5, TRUE, TRUE, 0); - ButtonOK = gtk_button_new_with_label (_("OK")); - gtk_widget_ref (ButtonOK); - gtk_object_set_data_full (GTK_OBJECT (LimitDialog), "ButtonOK", ButtonOK, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (ButtonOK); - gtk_container_add (GTK_CONTAINER (hbuttonbox5), ButtonOK); - GTK_WIDGET_SET_FLAGS (ButtonOK, GTK_CAN_DEFAULT); - - ButtonCancel = gtk_button_new_with_label (_("Cancel")); + ButtonCancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL); gtk_widget_ref (ButtonCancel); gtk_object_set_data_full (GTK_OBJECT (LimitDialog), "ButtonCancel", ButtonCancel, (GtkDestroyNotify) gtk_widget_unref); @@ -953,6 +956,14 @@ gtk_container_add (GTK_CONTAINER (hbuttonbox5), ButtonCancel); GTK_WIDGET_SET_FLAGS (ButtonCancel, GTK_CAN_DEFAULT); + ButtonOK = gtk_button_new_from_stock (GTK_STOCK_OK); + gtk_widget_ref (ButtonOK); + gtk_object_set_data_full (GTK_OBJECT (LimitDialog), "ButtonOK", ButtonOK, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (ButtonOK); + gtk_container_add (GTK_CONTAINER (hbuttonbox5), ButtonOK); + GTK_WIDGET_SET_FLAGS (ButtonOK, GTK_CAN_DEFAULT); + gtk_signal_connect (GTK_OBJECT (ButtonOK), "clicked", GTK_SIGNAL_FUNC (on_Limit_ButtonOK_clicked), NULL); @@ -962,4 +973,3 @@ return LimitDialog; } - diff -urN -x 'po*' -x '*.m4' -x 'config.*' -x configure -x 'Makefile*' gtktrain-0.9b/gtkui/interface.h gtktrain-0.9b-modified/gtkui/interface.h --- gtktrain-0.9b/gtkui/interface.h 2000-05-09 10:55:53.000000000 +1000 +++ gtktrain-0.9b-modified/gtkui/interface.h 2006-03-16 21:15:34.000000000 +1100 @@ -3,7 +3,7 @@ */ GtkWidget* create_MainWin (void); -GtkWidget* create_NotYetDialog (void); +/*GtkWidget* create_NotYetDialog (void);*/ GtkWidget* create_AboutDialog (void); GtkWidget* create_DataOpenDialog (void); GtkWidget* create_TimeDialog (void); diff -urN -x 'po*' -x '*.m4' -x 'config.*' -x configure -x 'Makefile*' gtktrain-0.9b/gtkui/main.c gtktrain-0.9b-modified/gtkui/main.c --- gtktrain-0.9b/gtkui/main.c 2000-05-07 16:46:46.000000000 +1000 +++ gtktrain-0.9b-modified/gtkui/main.c 2006-03-16 21:15:34.000000000 +1100 @@ -38,7 +38,6 @@ */ MainWin = create_MainWin (); gtk_widget_show (MainWin); - NotYetDialog = create_NotYetDialog (); gtk_widget_show (NotYetDialog); AboutDialog = create_AboutDialog (); gtk_widget_show (AboutDialog); @@ -52,4 +51,3 @@ gtk_main (); return 0; } - diff -urN -x 'po*' -x '*.m4' -x 'config.*' -x configure -x 'Makefile*' gtktrain-0.9b/gtkui/timedlg.c gtktrain-0.9b-modified/gtkui/timedlg.c --- gtktrain-0.9b/gtkui/timedlg.c 2000-05-07 16:46:46.000000000 +1000 +++ gtktrain-0.9b-modified/gtkui/timedlg.c 2006-03-16 21:15:34.000000000 +1100 @@ -41,9 +41,9 @@ GtkWidget *dept_min_spin = get_widget(TimeDialog, "SpinDeptMin"); GtkWidget *arriv_hour_spin = get_widget(TimeDialog, "SpinArrivHour"); GtkWidget *arriv_min_spin = get_widget(TimeDialog, "SpinArrivMin"); - + int dept_time, arriv_time; - + dept_time = Train_GetDepartureTime(); arriv_time = dept_time + Train_GetTotalTime(); arriv_time = arriv_time % (24 * 60); @@ -110,7 +110,7 @@ GtkWidget *dept_min_spin = get_widget(TimeDialog, "SpinDeptMin"); GtkWidget *arriv_hour_spin = get_widget(TimeDialog, "SpinArrivHour"); GtkWidget *arriv_min_spin = get_widget(TimeDialog, "SpinArrivMin"); - + int dept_time, arriv_time; dept_time = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(dept_hour_spin)) * 60; @@ -185,4 +185,3 @@ gtk_spin_button_set_value(GTK_SPIN_BUTTON(dept_hour_spin), dept_time/60); gtk_spin_button_set_value(GTK_SPIN_BUTTON(dept_min_spin), dept_time%60); } - diff -urN -x 'po*' -x '*.m4' -x 'config.*' -x configure -x 'Makefile*' gtktrain-0.9b/stamp-h1 gtktrain-0.9b-modified/stamp-h1 --- gtktrain-0.9b/stamp-h1 1970-01-01 10:00:00.000000000 +1000 +++ gtktrain-0.9b-modified/stamp-h1 2006-01-26 18:59:41.000000000 +1100 @@ -0,0 +1 @@ +timestamp for config.h