diff --git a/Make.common.in b/Make.common.in index cff9bf73b..b57b053f7 100644 --- a/Make.common.in +++ b/Make.common.in @@ -27,6 +27,7 @@ tidir = $(libdir)/term extfsdir = $(libdir)/extfs datadir = @datadir@ icondir = $(datadir)/pixmaps/mc +gnomeicondir = @gnomeicondir@ localedir = $(datadir)/locale mandir = @mandir@ man1dir = $(mandir)/man1 diff --git a/configure.in b/configure.in index 228199ead..2e63480bb 100644 --- a/configure.in +++ b/configure.in @@ -5,7 +5,7 @@ AC_INIT(create_vcs) AC_CONFIG_HEADER(config.h) PACKAGE=mc -VERSION=4.5.11 +VERSION=4.5.13 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") AC_DEFINE_UNQUOTED(VERSION, "$VERSION") AC_SUBST(VERSION) @@ -489,6 +489,7 @@ dnl mx="" gmcdep="" libgtkedit="" + AC_SUBST(insticons) GNOME_INIT_HOOK([ mx=mx @@ -500,7 +501,9 @@ GNOME_INIT_HOOK([ else xvers="Gnome+$xvers" fi + gnomeicondir=`gnome-config --prefix`/share/pixmaps ]) +AC_SUBST(gnomeicondir) AC_SUBST(mx) AC_SUBST(gmcdep) AC_SUBST(libgtkedit) diff --git a/gnome/ChangeLog b/gnome/ChangeLog index 476169df1..78d542722 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -1,3 +1,10 @@ +1999-02-10 Miguel de Icaza + + * gaction.c (gmc_open_filename): Add support for running .desktop + files. + Made const correct. + (gmc_view): Made const correct. + 1999-02-10 Federico Mena Quintero * Makefile.in (ICONS): Added i-fifo.png to the list of icons. diff --git a/gnome/Makefile.in b/gnome/Makefile.in index afb387799..2b9d6d696 100644 --- a/gnome/Makefile.in +++ b/gnome/Makefile.in @@ -212,7 +212,9 @@ corba-gmc: @LIBVFS@ $(OBJS) $(CORBAOBJS) libgtkedit.a $(CC) -o corba-gmc $(CORBAOBJS) $(OBJS) $(EXTRALIBS) $(CORBA_LDFLAGS) $(LIBS) mc.keys: mc.keys.in Makefile - sed -e 's^\@icondir\@^$(icondir)^g' < mc.keys.in > mc.keys.tmp \ + sed -e 's^\@icondir\@^$(icondir)^g' \ + -e 's^\@gnomeicondir\@^$(gnomeicondir)^g' \ + < mc.keys.in > mc.keys.tmp \ && mv mc.keys.tmp mc.keys mc.keys.in: mc.keys.in.in Makefile.in ../config.status diff --git a/gnome/gaction.c b/gnome/gaction.c index 1b585c5f1..58f554e07 100644 --- a/gnome/gaction.c +++ b/gnome/gaction.c @@ -26,7 +26,8 @@ gmc_execute (char *fname, char *buf) int gmc_open_filename (char *fname, GList *args) { - char *mime_type, *cmd; + const char *mime_type; + const char *cmd; char *buf; int size; @@ -59,6 +60,17 @@ gmc_open_filename (char *fname, GList *args) gmc_execute (fname, cmd); return 1; } + + if (strcmp (mime_type, "application/x-gnome-app-info") == 0){ + GnomeDesktopEntry *entry; + + entry = gnome_desktop_entry_load (fname); + if (entry){ + gnome_desktop_entry_launch (entry); + gnome_desktop_entry_free (entry); + } + } + return 0; } @@ -77,7 +89,7 @@ gmc_run_view (char *filename, char *buf) int gmc_view (char *filename, int start_line) { - char *mime_type, *cmd; + const char *mime_type, *cmd; char *buf; int size; diff --git a/gnome/mc.keys.in.in b/gnome/mc.keys.in.in index 5cfd95cee..14ef14544 100644 --- a/gnome/mc.keys.in.in +++ b/gnome/mc.keys.in.in @@ -131,7 +131,7 @@ text/html: open.netscape.View this file with Netscape=gnome-moz-remote %f application/vcard: - icon-filename=@icondir@/calendar.xpm + icon-filename=@gnomeicons@/gnome-calendar.png x-url/http: icon-filename=@icondir@/gnome-text-url.png diff --git a/icons/Makefile.in b/icons/Makefile.in index eb747b135..1f3d23677 100644 --- a/icons/Makefile.in +++ b/icons/Makefile.in @@ -34,8 +34,8 @@ ALLICONS = a.xpm application.xpm binary.xpm bitmap.xpm blackhole.xpm \ # are obtained # DECENTICONS = \ - c.xpm h.xpm calendar.xpm compressed.xpm html.xpm o.xpm \ - sound.xpm makefile.xpm word.xpm tex.xpm cc.xpm man.xpm \ + compressed.xpm o.xpm \ + sound.xpm makefile.xpm word.xpm tex.xpm man.xpm \ postscript.xpm tex.xpm text.xpm trash.xpm all: diff --git a/po/mc.pot b/po/mc.pot index bd23f7397..a79596296 100644 --- a/po/mc.pot +++ b/po/mc.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 1999-02-08 17:07-0600\n" +"POT-Creation-Date: 1999-02-10 18:27-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -55,113 +55,113 @@ msgstr "" msgid " Do you really want to quit the Midnight Commander? " msgstr "" -#: gnome/gcmd.c:108 gtkedit/editcmd.c:2235 src/cmd.c:251 src/file.c:1791 -#: src/file.c:2171 src/filegui.c:573 src/hotlist.c:1035 src/main.c:820 +#: gnome/gcmd.c:108 gtkedit/editcmd.c:2235 src/cmd.c:251 src/file.c:1809 +#: src/file.c:2189 src/filegui.c:573 src/hotlist.c:1035 src/main.c:820 #: src/screen.c:2050 src/subshell.c:701 src/subshell.c:727 src/tree.c:755 #: src/view.c:404 msgid "&Yes" msgstr "" -#: gnome/gcmd.c:108 gtkedit/editcmd.c:2235 src/cmd.c:251 src/file.c:1791 -#: src/file.c:2171 src/filegui.c:572 src/hotlist.c:1035 src/main.c:820 +#: gnome/gcmd.c:108 gtkedit/editcmd.c:2235 src/cmd.c:251 src/file.c:1809 +#: src/file.c:2189 src/filegui.c:572 src/hotlist.c:1035 src/main.c:820 #: src/screen.c:2050 src/subshell.c:701 src/subshell.c:727 src/tree.c:755 #: src/view.c:404 msgid "&No" msgstr "" -#: gnome/gcmd.c:206 +#: gnome/gcmd.c:205 msgid "Sort By" msgstr "" #. we define this up here so we can pass it in to our callback -#: gnome/gcmd.c:211 +#: gnome/gcmd.c:210 msgid "Ignore case sensitivity." msgstr "" -#: gnome/gcmd.c:219 src/chmod.c:150 src/screen.c:425 +#: gnome/gcmd.c:218 src/chmod.c:150 src/screen.c:425 msgid "Name" msgstr "" -#: gnome/gcmd.c:226 +#: gnome/gcmd.c:225 msgid "File Type" msgstr "" -#: gnome/gcmd.c:232 src/screen.c:426 src/screen.c:427 +#: gnome/gcmd.c:231 src/screen.c:426 src/screen.c:427 msgid "Size" msgstr "" -#: gnome/gcmd.c:238 +#: gnome/gcmd.c:237 msgid "Time Last Accessed" msgstr "" -#: gnome/gcmd.c:244 +#: gnome/gcmd.c:243 msgid "Time Last Modified" msgstr "" -#: gnome/gcmd.c:250 +#: gnome/gcmd.c:249 msgid "Time Last Changed" msgstr "" -#: gnome/gcmd.c:264 +#: gnome/gcmd.c:263 msgid "Reverse the order." msgstr "" -#: gnome/gcmd.c:326 +#: gnome/gcmd.c:325 msgid "Enter name." msgstr "" -#: gnome/gcmd.c:332 +#: gnome/gcmd.c:331 msgid "Enter label for command:" msgstr "" -#: gnome/gcmd.c:427 +#: gnome/gcmd.c:426 msgid "Find all core files" msgstr "" -#: gnome/gcmd.c:430 src/panelize.c:350 +#: gnome/gcmd.c:429 src/panelize.c:350 msgid "Find rejects after patching" msgstr "" -#: gnome/gcmd.c:472 +#: gnome/gcmd.c:471 msgid "Run Command" msgstr "" #. Frame 1 -#: gnome/gcmd.c:477 +#: gnome/gcmd.c:476 msgid "Preset Commands" msgstr "" -#: gnome/gcmd.c:494 +#: gnome/gcmd.c:493 msgid "Add" msgstr "" -#: gnome/gcmd.c:498 +#: gnome/gcmd.c:497 msgid "Remove" msgstr "" #. Frame 2 -#: gnome/gcmd.c:506 +#: gnome/gcmd.c:505 msgid "Run this Command" msgstr "" -#: gnome/gcmd.c:513 +#: gnome/gcmd.c:512 msgid "Command: " msgstr "" -#: gnome/gcmd.c:574 +#: gnome/gcmd.c:573 msgid "Set Filter" msgstr "" -#: gnome/gcmd.c:579 gnome/gcmd.c:620 gnome/gcmd.c:625 gnome/gcmd.c:629 -#: gnome/gscreen.c:2484 +#: gnome/gcmd.c:578 gnome/gcmd.c:619 gnome/gcmd.c:624 gnome/gcmd.c:628 +#: gnome/gscreen.c:2570 msgid "Show all files" msgstr "" -#: gnome/gcmd.c:586 +#: gnome/gcmd.c:585 msgid "." msgstr "" -#: gnome/gcmd.c:602 +#: gnome/gcmd.c:601 msgid "" "Enter a filter here for files in the panel view.\n" "\n" @@ -169,19 +169,19 @@ msgid "" "*.gif will show just gif images" msgstr "" -#: gnome/gcmd.c:604 +#: gnome/gcmd.c:603 msgid "Enter a Regular Expression to filter files in the panel view." msgstr "" -#: gnome/gcmd.c:661 gnome/gpopup.c:49 +#: gnome/gcmd.c:660 gnome/gpopup.c:49 msgid " Open with..." msgstr "" -#: gnome/gcmd.c:662 gnome/gpopup.c:50 +#: gnome/gcmd.c:661 gnome/gpopup.c:50 msgid "Enter extra arguments:" msgstr "" -#: gnome/gdesktop.c:350 gnome/gdesktop.c:1553 +#: gnome/gdesktop.c:350 gnome/gdesktop.c:1566 msgid "Warning" msgstr "" @@ -190,16 +190,16 @@ msgstr "" msgid "Could not open %s; will not have desktop icons" msgstr "" -#: gnome/gdesktop.c:1519 +#: gnome/gdesktop.c:1532 msgid "Trashcan" msgstr "" #. Create the link to the user's home directory so that he will have an icon -#: gnome/gdesktop.c:1549 +#: gnome/gdesktop.c:1562 msgid "Home directory" msgstr "" -#: gnome/gdesktop.c:1554 +#: gnome/gdesktop.c:1567 #, c-format msgid "Could not symlink %s to %s; will not have initial desktop icons." msgstr "" @@ -263,8 +263,8 @@ msgstr "" msgid "Replace it?" msgstr "" -#: gnome/gdialogs.c:532 gtkedit/editwidget.c:1064 src/file.c:784 -#: src/screen.c:2288 src/screen.c:2318 src/tree.c:1024 +#: gnome/gdialogs.c:532 gtkedit/editwidget.c:1064 src/file.c:789 +#: src/screen.c:2289 src/screen.c:2319 src/tree.c:1024 msgid "Copy" msgstr "" @@ -366,11 +366,11 @@ msgid "" "%s" msgstr "" -#: gnome/gicon.c:83 gnome/gtools.c:50 +#: gnome/gicon.c:86 gnome/gtools.c:50 msgid "Error" msgstr "" -#: gnome/gicon.c:83 +#: gnome/gicon.c:86 msgid "Default set of icons not found, check your installation" msgstr "" @@ -541,7 +541,7 @@ msgstr "" msgid "_Commands" msgstr "" -#: gnome/glayout.c:471 +#: gnome/glayout.c:472 msgid "File/New/Directory..." msgstr "" @@ -557,7 +557,7 @@ msgstr "" msgid "Open with" msgstr "" -#: gnome/gpopup.c:228 src/screen.c:2286 src/screen.c:2316 +#: gnome/gpopup.c:228 src/screen.c:2287 src/screen.c:2317 msgid "View" msgstr "" @@ -565,7 +565,7 @@ msgstr "" msgid "View unfiltered" msgstr "" -#: gnome/gpopup.c:230 src/screen.c:2287 src/screen.c:2317 src/view.c:1968 +#: gnome/gpopup.c:230 src/screen.c:2288 src/screen.c:2318 src/view.c:1996 msgid "Edit" msgstr "" @@ -590,7 +590,7 @@ msgid "Copy..." msgstr "" #: gnome/gpopup.c:243 gnome/gpopup.c:255 gtkedit/editwidget.c:1067 -#: src/screen.c:2291 src/screen.c:2321 +#: src/screen.c:2292 src/screen.c:2322 msgid "Delete" msgstr "" @@ -763,7 +763,7 @@ msgstr "" msgid "Title" msgstr "" -#: gnome/gprop.c:521 gnome/gscreen.c:2271 +#: gnome/gprop.c:521 gnome/gscreen.c:2340 msgid "Icon" msgstr "" @@ -771,158 +771,158 @@ msgstr "" msgid "Select icon" msgstr "" -#: gnome/gscreen.c:1569 +#: gnome/gscreen.c:1612 msgid "All files" msgstr "" -#: gnome/gscreen.c:1571 +#: gnome/gscreen.c:1614 msgid "Archives and compressed files" msgstr "" -#: gnome/gscreen.c:1573 +#: gnome/gscreen.c:1616 msgid "RPM/DEB files" msgstr "" -#: gnome/gscreen.c:1575 +#: gnome/gscreen.c:1618 msgid "Text/Document files" msgstr "" -#: gnome/gscreen.c:1577 +#: gnome/gscreen.c:1620 msgid "HTML and SGML files" msgstr "" -#: gnome/gscreen.c:1579 +#: gnome/gscreen.c:1622 msgid "Postscript and PDF files" msgstr "" -#: gnome/gscreen.c:1581 +#: gnome/gscreen.c:1624 msgid "Spreadsheet files" msgstr "" -#: gnome/gscreen.c:1583 +#: gnome/gscreen.c:1626 msgid "Image files" msgstr "" -#: gnome/gscreen.c:1586 +#: gnome/gscreen.c:1629 msgid "Video/animation files" msgstr "" -#: gnome/gscreen.c:1588 +#: gnome/gscreen.c:1631 msgid "Audio files" msgstr "" -#: gnome/gscreen.c:1590 +#: gnome/gscreen.c:1633 msgid "C program files" msgstr "" -#: gnome/gscreen.c:1592 +#: gnome/gscreen.c:1635 msgid "C++ program files" msgstr "" -#: gnome/gscreen.c:1594 +#: gnome/gscreen.c:1637 msgid "Objective-C program files" msgstr "" -#: gnome/gscreen.c:1596 +#: gnome/gscreen.c:1639 msgid "Scheme program files" msgstr "" -#: gnome/gscreen.c:1598 +#: gnome/gscreen.c:1641 msgid "Assembler program files" msgstr "" -#: gnome/gscreen.c:1600 +#: gnome/gscreen.c:1643 msgid "Misc. program files" msgstr "" -#: gnome/gscreen.c:1602 +#: gnome/gscreen.c:1645 msgid "Font files" msgstr "" -#: gnome/gscreen.c:1729 +#: gnome/gscreen.c:1772 #, c-format msgid "Search: %s" msgstr "" -#: gnome/gscreen.c:1739 +#: gnome/gscreen.c:1782 #, c-format msgid "%s bytes in %d file" msgstr "" -#: gnome/gscreen.c:1739 +#: gnome/gscreen.c:1782 #, c-format msgid "%s bytes in %d files" msgstr "" -#: gnome/gscreen.c:1765 src/screen.c:677 +#: gnome/gscreen.c:1808 src/screen.c:677 msgid "" msgstr "" -#: gnome/gscreen.c:1819 +#: gnome/gscreen.c:1862 msgid "Filter" msgstr "" -#: gnome/gscreen.c:2271 +#: gnome/gscreen.c:2340 msgid "Switch view to an Icon view" msgstr "" -#: gnome/gscreen.c:2273 +#: gnome/gscreen.c:2342 msgid "Brief" msgstr "" -#: gnome/gscreen.c:2273 +#: gnome/gscreen.c:2342 msgid "Switch view to show just file name and type" msgstr "" -#: gnome/gscreen.c:2275 +#: gnome/gscreen.c:2344 msgid "Detailed" msgstr "" -#: gnome/gscreen.c:2275 +#: gnome/gscreen.c:2344 msgid "Switch view to show detailed file statistics" msgstr "" -#: gnome/gscreen.c:2277 +#: gnome/gscreen.c:2346 msgid "Custom" msgstr "" -#: gnome/gscreen.c:2277 +#: gnome/gscreen.c:2346 msgid "Switch view to show custom determined statistics." msgstr "" -#: gnome/gscreen.c:2282 +#: gnome/gscreen.c:2351 msgid "Back" msgstr "" -#: gnome/gscreen.c:2282 +#: gnome/gscreen.c:2351 msgid "Go to the previously visited directory" msgstr "" -#: gnome/gscreen.c:2284 +#: gnome/gscreen.c:2353 msgid "Up" msgstr "" -#: gnome/gscreen.c:2284 +#: gnome/gscreen.c:2353 msgid "Go up a level in the directory heirarchy" msgstr "" -#: gnome/gscreen.c:2286 +#: gnome/gscreen.c:2355 msgid "Forward" msgstr "" -#: gnome/gscreen.c:2286 +#: gnome/gscreen.c:2355 msgid "Go to the next directory" msgstr "" -#: gnome/gscreen.c:2289 +#: gnome/gscreen.c:2358 msgid "Home" msgstr "" -#: gnome/gscreen.c:2289 +#: gnome/gscreen.c:2358 msgid "Go to your home directory" msgstr "" -#: gnome/gscreen.c:2429 +#: gnome/gscreen.c:2515 msgid "Location:" msgstr "" @@ -1009,11 +1009,11 @@ msgstr "" msgid "help" msgstr "" -#: gnome/gwidget.c:96 src/file.c:2190 +#: gnome/gwidget.c:96 src/file.c:2208 msgid "yes" msgstr "" -#: gnome/gwidget.c:98 src/file.c:2188 +#: gnome/gwidget.c:98 src/file.c:2206 msgid "no" msgstr "" @@ -1028,8 +1028,8 @@ msgstr "" #. The file-name is printed after the ':' #: gtkedit/edit.c:129 gtkedit/edit.c:224 gtkedit/edit.c:231 gtkedit/edit.c:238 #: gtkedit/edit.c:245 gtkedit/edit.c:251 gtkedit/edit.c:308 gtkedit/edit.c:344 -#: gtkedit/editcmd.c:1932 gtkedit/editwidget.c:947 src/dir.c:375 -#: src/screen.c:2306 src/tree.c:692 src/tree.c:698 src/wtools.c:222 +#: gtkedit/editcmd.c:1932 gtkedit/editwidget.c:947 src/dir.c:383 +#: src/screen.c:2307 src/tree.c:692 src/tree.c:698 src/wtools.c:222 #: vfs/fish.c:224 msgid " Error " msgstr "" @@ -1153,7 +1153,7 @@ msgstr "" msgid " Save file " msgstr "" -#: gtkedit/editcmd.c:774 gtkedit/editwidget.c:1061 src/view.c:1964 +#: gtkedit/editcmd.c:774 gtkedit/editwidget.c:1061 src/view.c:1992 msgid "Save" msgstr "" @@ -1202,8 +1202,8 @@ msgstr "" #. Heads the 'Search' dialog box #: gtkedit/editcmd.c:1285 gtkedit/editcmd.c:1461 gtkedit/editcmd.c:2196 -#: src/view.c:1446 src/view.c:1536 src/view.c:1658 src/view.c:1857 -#: src/view.c:1889 +#: src/view.c:1465 src/view.c:1564 src/view.c:1686 src/view.c:1885 +#: src/view.c:1917 msgid " Search " msgstr "" @@ -1360,7 +1360,7 @@ msgid " Cut to clipboard " msgstr "" #: gtkedit/editcmd.c:2544 gtkedit/editcmd.c:2548 gtkedit/editcmd.c:2553 -#: gtkedit/editcmd.c:2556 src/view.c:1829 +#: gtkedit/editcmd.c:2556 src/view.c:1857 msgid " Goto line " msgstr "" @@ -1459,8 +1459,8 @@ msgstr "" msgid "Error initialising editor.\n" msgstr "" -#: gtkedit/editwidget.c:1060 src/help.c:806 src/main.c:1668 src/screen.c:2284 -#: src/screen.c:2314 src/tree.c:1018 src/view.c:1959 +#: gtkedit/editwidget.c:1060 src/help.c:806 src/main.c:1668 src/screen.c:2285 +#: src/screen.c:2315 src/tree.c:1018 src/view.c:1987 msgid "Help" msgstr "" @@ -1472,7 +1472,7 @@ msgstr "" msgid "Replac" msgstr "" -#: gtkedit/editwidget.c:1066 src/view.c:1972 +#: gtkedit/editwidget.c:1066 src/view.c:2000 msgid "Search" msgstr "" @@ -1480,8 +1480,8 @@ msgstr "" msgid "PullDn" msgstr "" -#: gtkedit/editwidget.c:1070 src/help.c:818 src/main.c:1671 src/view.c:1961 -#: src/view.c:1981 +#: gtkedit/editwidget.c:1070 src/help.c:818 src/main.c:1671 src/view.c:1989 +#: src/view.c:2009 msgid "Quit" msgstr "" @@ -1623,7 +1623,7 @@ msgstr "" msgid "Background process:" msgstr "" -#: src/background.c:284 src/file.c:2113 +#: src/background.c:284 src/file.c:2131 msgid " Background process error " msgstr "" @@ -2101,7 +2101,7 @@ msgstr "" msgid " Link " msgstr "" -#: src/cmd.c:1032 src/cmd.c:1137 src/file.c:1621 +#: src/cmd.c:1032 src/cmd.c:1137 src/file.c:1639 msgid " to:" msgstr "" @@ -2217,69 +2217,69 @@ msgid "" "\n" msgstr "" -#: src/dir.c:53 +#: src/dir.c:61 msgid "&Unsorted" msgstr "" -#: src/dir.c:54 +#: src/dir.c:62 msgid "&Name" msgstr "" -#: src/dir.c:55 +#: src/dir.c:63 msgid "&Extension" msgstr "" -#: src/dir.c:56 +#: src/dir.c:64 msgid "&Modify time" msgstr "" -#: src/dir.c:57 +#: src/dir.c:65 msgid "&Access time" msgstr "" -#: src/dir.c:58 +#: src/dir.c:66 msgid "&Change time" msgstr "" -#: src/dir.c:59 +#: src/dir.c:67 msgid "&Size" msgstr "" -#: src/dir.c:60 +#: src/dir.c:68 msgid "&Inode" msgstr "" #. New sort orders -#: src/dir.c:63 +#: src/dir.c:71 msgid "&Type" msgstr "" -#: src/dir.c:64 +#: src/dir.c:72 msgid "&Links" msgstr "" -#: src/dir.c:65 +#: src/dir.c:73 msgid "N&GID" msgstr "" -#: src/dir.c:66 +#: src/dir.c:74 msgid "N&UID" msgstr "" -#: src/dir.c:67 +#: src/dir.c:75 msgid "&Owner" msgstr "" -#: src/dir.c:68 +#: src/dir.c:76 msgid "&Group" msgstr "" -#: src/dir.c:375 +#: src/dir.c:383 #, c-format msgid "File exists but can not be stat-ed: %s %s" msgstr "" -#: src/dir.c:633 +#: src/dir.c:643 msgid "Unknown" msgstr "" @@ -2398,14 +2398,14 @@ msgid "" " %s " msgstr "" -#: src/file.c:574 src/file.c:794 +#: src/file.c:574 src/file.c:799 #, c-format msgid "" " Cannot chown target file \"%s\" \n" " %s " msgstr "" -#: src/file.c:583 src/file.c:809 +#: src/file.c:583 src/file.c:817 #, c-format msgid "" " Cannot chmod target file \"%s\" \n" @@ -2430,72 +2430,72 @@ msgid "" " %s " msgstr "" -#: src/file.c:633 +#: src/file.c:638 #, c-format msgid "" " Cannot create target file \"%s\" \n" " %s " msgstr "" -#: src/file.c:647 +#: src/file.c:652 #, c-format msgid "" " Cannot fstat target file \"%s\" \n" " %s " msgstr "" -#: src/file.c:678 +#: src/file.c:683 #, c-format msgid "" " Cannot read source file \"%s\" \n" " %s " msgstr "" -#: src/file.c:708 +#: src/file.c:713 #, c-format msgid "" " Cannot write target file \"%s\" \n" " %s " msgstr "" -#: src/file.c:727 +#: src/file.c:732 msgid "(stalled)" msgstr "" -#: src/file.c:765 +#: src/file.c:770 #, c-format msgid "" " Cannot close source file \"%s\" \n" " %s " msgstr "" -#: src/file.c:774 +#: src/file.c:779 #, c-format msgid "" " Cannot close target file \"%s\" \n" " %s " msgstr "" -#: src/file.c:784 +#: src/file.c:789 msgid "Incomplete file was retrieved. Keep it?" msgstr "" -#: src/file.c:785 +#: src/file.c:790 msgid "&Delete" msgstr "" -#: src/file.c:785 src/hotlist.c:1443 +#: src/file.c:790 src/hotlist.c:1443 msgid "&Keep" msgstr "" -#: src/file.c:854 +#: src/file.c:862 #, c-format msgid "" " Cannot stat source directory \"%s\" \n" " %s " msgstr "" -#: src/file.c:877 +#: src/file.c:885 #, c-format msgid "" " Source directory \"%s\" is not a directory \n" @@ -2503,21 +2503,21 @@ msgid "" msgstr "" #. we found a cyclic symbolic link -#: src/file.c:885 +#: src/file.c:893 #, c-format msgid "" " Cannot copy cyclic symbolic link \n" " `%s' " msgstr "" -#: src/file.c:938 +#: src/file.c:946 #, c-format msgid "" " Cannot create target directory \"%s\" \n" " %s " msgstr "" -#: src/file.c:956 +#: src/file.c:964 #, c-format msgid "" " Cannot chown target directory \"%s\" \n" @@ -2525,69 +2525,69 @@ msgid "" msgstr "" #. Source doesn't exist -#: src/file.c:1066 +#: src/file.c:1074 #, c-format msgid "" " Cannot stat file \"%s\" \n" " %s " msgstr "" -#: src/file.c:1088 +#: src/file.c:1096 #, c-format msgid " `%s' and `%s' are the same file " msgstr "" -#: src/file.c:1095 +#: src/file.c:1103 #, c-format msgid " Cannot overwrite directory `%s' " msgstr "" -#: src/file.c:1128 +#: src/file.c:1140 #, c-format msgid "" " Cannot move file \"%s\" to \"%s\" \n" " %s " msgstr "" -#: src/file.c:1148 +#: src/file.c:1160 #, c-format msgid "" " Cannot remove file \"%s\" \n" " %s " msgstr "" -#: src/file.c:1198 +#: src/file.c:1213 #, c-format msgid " Cannot overwrite directory \"%s\" %s " msgstr "" -#: src/file.c:1200 +#: src/file.c:1215 #, c-format msgid " Cannot overwrite file \"%s\" %s " msgstr "" -#: src/file.c:1223 +#: src/file.c:1238 #, c-format msgid "" " Cannot move directory \"%s\" to \"%s\" \n" " %s " msgstr "" -#: src/file.c:1286 +#: src/file.c:1301 #, c-format msgid "" " Cannot delete file \"%s\" \n" " %s " msgstr "" -#: src/file.c:1344 src/file.c:1411 src/file.c:1440 +#: src/file.c:1362 src/file.c:1429 src/file.c:1458 #, c-format msgid "" " Cannot remove directory \"%s\" \n" " %s " msgstr "" -#: src/file.c:1476 +#: src/file.c:1494 msgid " Internal error: get_file \n" msgstr "" @@ -2600,144 +2600,144 @@ msgstr "" #. * (I don't use spaces around the words, because someday they could be #. * dropped, when widgets get smarter) #. -#: src/file.c:1597 +#: src/file.c:1615 msgid "1Copy" msgstr "" -#: src/file.c:1597 +#: src/file.c:1615 msgid "1Move" msgstr "" -#: src/file.c:1597 +#: src/file.c:1615 msgid "1Delete" msgstr "" -#: src/file.c:1612 +#: src/file.c:1630 #, c-format msgid "%o %f \"%s\"%m" msgstr "" -#: src/file.c:1613 +#: src/file.c:1631 #, c-format msgid "%o %d %f%m" msgstr "" -#: src/file.c:1615 +#: src/file.c:1633 #, c-format msgid "%o %f \"%s\"%e" msgstr "" -#: src/file.c:1616 +#: src/file.c:1634 #, c-format msgid "%o %d %f%e" msgstr "" -#: src/file.c:1620 +#: src/file.c:1638 msgid "file" msgstr "" -#: src/file.c:1620 +#: src/file.c:1638 msgid "files" msgstr "" -#: src/file.c:1620 +#: src/file.c:1638 msgid "directory" msgstr "" -#: src/file.c:1620 +#: src/file.c:1638 msgid "directories" msgstr "" -#: src/file.c:1621 +#: src/file.c:1639 msgid "files/directories" msgstr "" -#: src/file.c:1621 +#: src/file.c:1639 msgid " with source mask:" msgstr "" -#: src/file.c:1769 +#: src/file.c:1787 msgid " Can't operate on \"..\"! " msgstr "" -#: src/file.c:1788 +#: src/file.c:1806 msgid "Yes" msgstr "" -#: src/file.c:1788 +#: src/file.c:1806 msgid "No" msgstr "" -#: src/file.c:1841 +#: src/file.c:1859 msgid " Sorry, I could not put the job in background " msgstr "" -#: src/file.c:1924 src/file.c:2029 +#: src/file.c:1942 src/file.c:2047 msgid " Internal failure " msgstr "" -#: src/file.c:1924 src/file.c:2029 +#: src/file.c:1942 src/file.c:2047 msgid " Unknown file operation " msgstr "" -#: src/file.c:1943 +#: src/file.c:1961 #, c-format msgid "" " Destination \"%s\" must be a directory \n" " %s " msgstr "" -#: src/file.c:2114 src/filegui.c:263 +#: src/file.c:2132 src/filegui.c:263 msgid "&Skip" msgstr "" -#: src/file.c:2114 +#: src/file.c:2132 msgid "&Retry" msgstr "" -#: src/file.c:2114 src/file.c:2173 src/filegui.c:260 src/filegui.c:562 +#: src/file.c:2132 src/file.c:2191 src/filegui.c:260 src/filegui.c:562 msgid "&Abort" msgstr "" -#: src/file.c:2164 +#: src/file.c:2182 msgid "" "\n" " Directory not empty. \n" " Delete it recursively? " msgstr "" -#: src/file.c:2165 +#: src/file.c:2183 msgid "" "\n" " Background process: Directory not empty \n" " Delete it recursively? " msgstr "" -#: src/file.c:2166 +#: src/file.c:2184 msgid " Delete: " msgstr "" -#: src/file.c:2172 +#: src/file.c:2190 msgid "a&ll" msgstr "" -#: src/file.c:2172 src/filegui.c:565 +#: src/file.c:2190 src/filegui.c:565 msgid "non&E" msgstr "" -#: src/file.c:2182 +#: src/file.c:2200 msgid " Type 'yes' if you REALLY want to delete " msgstr "" -#: src/file.c:2184 +#: src/file.c:2202 msgid "all the directories " msgstr "" -#: src/file.c:2186 +#: src/file.c:2204 msgid " Recursive Delete " msgstr "" -#: src/file.c:2187 +#: src/file.c:2205 msgid " Background process: Recursive Delete " msgstr "" @@ -2924,7 +2924,7 @@ msgstr "" msgid "Finished" msgstr "" -#: src/find.c:539 src/view.c:1446 +#: src/find.c:539 src/view.c:1465 #, c-format msgid "Searching %s" msgstr "" @@ -3669,7 +3669,7 @@ msgid "" " the details. " msgstr "" -#: src/main.c:1669 src/screen.c:2285 src/screen.c:2315 +#: src/main.c:1669 src/screen.c:2286 src/screen.c:2316 msgid "Menu" msgstr "" @@ -3947,15 +3947,15 @@ msgstr "" msgid " No action taken " msgstr "" -#: src/screen.c:2289 src/screen.c:2319 src/tree.c:1026 +#: src/screen.c:2290 src/screen.c:2320 src/tree.c:1026 msgid "RenMov" msgstr "" -#: src/screen.c:2290 src/screen.c:2320 src/tree.c:1030 +#: src/screen.c:2291 src/screen.c:2321 src/tree.c:1030 msgid "Mkdir" msgstr "" -#: src/screen.c:2306 +#: src/screen.c:2307 #, c-format msgid "" " Can't chdir to %s \n" @@ -4157,78 +4157,83 @@ msgstr "" msgid " [grow]" msgstr "" -#: src/view.c:1536 src/view.c:1658 +#: src/view.c:1457 +#, c-format +msgid "Searching for `%s'" +msgstr "" + +#: src/view.c:1564 src/view.c:1686 msgid " Search string not found " msgstr "" -#: src/view.c:1697 +#: src/view.c:1725 msgid " Invalid regular expression " msgstr "" -#: src/view.c:1827 +#: src/view.c:1855 #, c-format msgid "" " The current line number is %d.\n" " Enter the new line number:" msgstr "" -#: src/view.c:1857 +#: src/view.c:1885 msgid " Enter regexp:" msgstr "" -#: src/view.c:1889 +#: src/view.c:1917 msgid " Enter search string:" msgstr "" -#: src/view.c:1962 +#: src/view.c:1990 msgid "Ascii" msgstr "" -#: src/view.c:1962 +#: src/view.c:1990 msgid "Hex" msgstr "" -#: src/view.c:1963 +#: src/view.c:1991 msgid "Line" msgstr "" -#: src/view.c:1964 +#: src/view.c:1992 msgid "RxSrch" msgstr "" -#: src/view.c:1967 +#: src/view.c:1995 msgid "EdText" msgstr "" -#: src/view.c:1967 +#: src/view.c:1995 msgid "EdHex" msgstr "" -#: src/view.c:1969 +#: src/view.c:1997 msgid "UnWrap" msgstr "" -#: src/view.c:1969 +#: src/view.c:1997 msgid "Wrap" msgstr "" -#: src/view.c:1972 +#: src/view.c:2000 msgid "HxSrch" msgstr "" -#: src/view.c:1975 +#: src/view.c:2003 msgid "Raw" msgstr "" -#: src/view.c:1975 +#: src/view.c:2003 msgid "Parse" msgstr "" -#: src/view.c:1979 +#: src/view.c:2007 msgid "Unform" msgstr "" -#: src/view.c:1979 +#: src/view.c:2007 msgid "Format" msgstr "" diff --git a/src/find.c b/src/find.c index ef179417c..a556b1777 100644 --- a/src/find.c +++ b/src/find.c @@ -80,14 +80,10 @@ enum { /* A list of directories to be ignores, separated with ':' */ char *find_ignore_dirs = 0; -static Dlg_head *find_dlg; /* The dialog */ static WInput *in_start; /* Start path */ static WInput *in_name; /* Pattern to search */ static WInput *in_with; /* text inside filename */ -static WListbox *find_list; /* Listbox with the file list */ static int running = 0; /* nice flag */ -static WButton *stop_button; /* pointer to the stop button */ -static WLabel *status_label; /* Finished, Searching etc. */ static char *find_pattern; /* Pattern to search */ static char *content_pattern; /* pattern to search inside files */ static int count; /* Number of files displayed */ @@ -96,6 +92,24 @@ static int is_start; /* Status of the start/stop toggle button */ int max_loops_in_idle = 10; static char *old_dir; +static Dlg_head *find_dlg; /* The dialog */ + +#ifdef HAVE_GNOME +static GtkWidget *g_find_dlg; +static GtkWidget *g_status_label; +static GtkWidget *g_clist; +static GtkWidget *g_start_stop; +static GtkWidget *g_start_stop_label; +static GtkWidget *g_view, *g_edit; +static int current_row; +static int idle_tag; +static int stop; +#else +static WButton *stop_button; /* pointer to the stop button */ +static WLabel *status_label; /* Finished, Searching etc. */ +static WListbox *find_list; /* Listbox with the file list */ +#endif + /* For nice updating */ static char *rotating_dash = "|/-\\"; @@ -122,6 +136,11 @@ static struct { { N_("&Edit - F4"), 13, 38 } }; +static char *add_to_list (char *text, void *closure); +static void stop_idle (void *data); +static void status_update (char *text); +static void get_list_info (char **file, char **dir); + /* * find_parameters: gets information from the user * @@ -321,15 +340,15 @@ insert_file (char *dir, char *file) if (strcmp (old_dir, dir)){ g_free (old_dir); old_dir = g_strdup (dir); - dirname = listbox_add_item (find_list, 0, 0, dir, 0); + dirname = add_to_list (dir, NULL); } } else { old_dir = g_strdup (dir); - dirname = listbox_add_item (find_list, 0, 0, dir, 0); + dirname = add_to_list (dir, NULL); } tmp_name = g_strconcat (" ", file, NULL); - listbox_add_item (find_list, 0, 0, tmp_name, dirname); + add_to_list (tmp_name, dirname); g_free (tmp_name); } @@ -339,12 +358,14 @@ find_add_match (Dlg_head *h, char *dir, char *file) int p = ++matches & 7; insert_file (dir, file); - + +#ifndef HAVE_GNOME /* Scroll nicely */ if (!p) listbox_select_last (find_list, 1); else listbox_select_last (find_list, 0); +#endif #ifndef HAVE_X /* Updates the current listing */ @@ -429,7 +450,7 @@ search_content (Dlg_head *h, char *directory, char *filename) g_snprintf (buffer, sizeof (buffer), _("Grepping in %s"), name_trunc (filename, FIND2_X_USE)); - label_set_text (status_label, buffer); + status_update (buffer); mc_refresh (); p = buffer; ignoring = 0; @@ -471,7 +492,7 @@ search_content (Dlg_head *h, char *directory, char *filename) mc_close (file_fd); } -static void +static int do_search (struct Dlg_head *h) { static struct dirent *dp = 0; @@ -490,7 +511,7 @@ do_search (struct Dlg_head *h) dirp = 0; } dp = 0; - return; + return 1; } #ifndef HAVE_X do_search_begin: @@ -512,9 +533,9 @@ do_search (struct Dlg_head *h) tmp = pop_directory (); if (!tmp){ running = 0; - label_set_text (status_label, _("Finished")); - set_idle_proc (h, 0); - return; + status_update (_("Finished")); + stop_idle (h); + return 0; } if (find_ignore_dirs){ int found; @@ -537,7 +558,7 @@ do_search (struct Dlg_head *h) char buffer [BUF_SMALL]; g_snprintf (buffer, sizeof (buffer), _("Searching %s"), name_trunc (directory, FIND2_X_USE)); - label_set_text (status_label, buffer); + status_update (buffer); } dirp = mc_opendir (directory); mc_stat (directory, &tmp_stat); @@ -553,7 +574,7 @@ do_search (struct Dlg_head *h) if (strcmp (dp->d_name, ".") == 0 || strcmp (dp->d_name, "..") == 0){ dp = mc_readdir (dirp); - return; + return 1; } tmp_name = concat_dir_and_file (directory, dp->d_name); @@ -594,28 +615,37 @@ do_search (struct Dlg_head *h) } #endif x_flush_events (); + return 1; } -static int -view_edit_currently_selected_file (int unparsed_view, int edit) +static void +init_find_vars (void) { - WLEntry *entry = find_list->current; - char *dir, *fullname, *filename; + char *dir; + + if (old_dir){ + g_free (old_dir); + old_dir = 0; + } + count = 0; + matches = 0; + + /* Remove all the items in the stack */ + while ((dir = pop_directory ()) != NULL) + g_free (dir); +} + +static void +find_do_view_edit (int unparsed_view, int edit, char *dir, char *file) +{ + char *fullname, *filename; int line; - - if (!entry) - return MSG_NOT_HANDLED; - - dir = entry->data; - - if (!entry->text || !dir) - return MSG_NOT_HANDLED; - + if (content_pattern){ - filename = strchr (entry->text + 4, ':') + 1; - line = atoi (entry->text + 4); + filename = strchr (file + 4, ':') + 1; + line = atoi (file + 4); } else { - filename = entry->text + 4; + filename = file + 4; line = 0; } if (dir [0] == '.' && dir [1] == 0) @@ -630,6 +660,248 @@ view_edit_currently_selected_file (int unparsed_view, int edit) else view_file_at_line (fullname, unparsed_view, use_internal_view, line); g_free (fullname); +} + +#ifdef HAVE_GNOME +static void +select_row (GtkCList *clist, gint row, gint column, GdkEvent *event) +{ + gtk_widget_set_sensitive (g_edit, TRUE); + gtk_widget_set_sensitive (g_view, TRUE); + current_row = row; +} + +static void +find_do_chdir (void) +{ + gtk_idle_remove (idle_tag); + idle_tag = 0; + stop = B_ENTER; + gtk_main_quit (); +} + +static void +find_do_again (void) +{ + gtk_idle_remove (idle_tag); + idle_tag = 0; + stop = B_AGAIN; + gtk_main_quit (); +} + +static void +find_start_stop (void) +{ + + if (is_start){ + idle_tag = gtk_idle_add ((GtkFunction)do_search, g_find_dlg); + } else { + gtk_idle_remove (idle_tag); + idle_tag = 0; + } + + gtk_label_set_text (GTK_LABEL (g_start_stop_label), + is_start ? _("Suspend") : _("Restart")); + is_start = !is_start; + status_update (is_start ? _("Stopped") : _("Searching")); +} + + +static void +find_do_view (void) +{ + char *file, *dir; + + get_list_info (&file, &dir); + + find_do_view_edit (0, 0, dir, file); +} + +static void +find_do_edit (void) +{ + char *file, *dir; + + get_list_info (&file, &dir); + + find_do_view_edit (0, 1, dir, file); +} + +static void +setup_gui (void) +{ + GtkWidget *sw, *b1, *b2, *b3; + GtkWidget *box, *box2; + + g_find_dlg = gnome_dialog_new ( + _("Find file"), + GNOME_STOCK_BUTTON_OK, + NULL); + + /* The buttons */ + b1 = gtk_button_new_with_label (_("Change to this directory")); + b2 = gtk_button_new_with_label (_("Search again")); + g_start_stop_label = gtk_label_new (_("Suspend")); + g_start_stop = gtk_button_new (); + gtk_container_add (GTK_CONTAINER (g_start_stop), g_start_stop_label); + + g_view = gtk_button_new_with_label (_("View this file")); + g_edit = gtk_button_new_with_label (_("Edit this file")); + + box = gtk_hbox_new (TRUE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (box), b1, 0, 1, 0); + gtk_box_pack_start (GTK_BOX (box), b2, 0, 1, 0); + gtk_box_pack_start (GTK_BOX (box), g_start_stop, 0, 1, 0); + +/* RECOONECT _("Panelize contents"), */ +/* _("View"), + _("Edit"), */ + + sw = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + g_clist = gtk_clist_new (1); + gtk_clist_set_selection_mode (GTK_CLIST (g_clist), GTK_SELECTION_SINGLE); + gtk_widget_set_usize (g_clist, -1, 200); + gtk_container_add (GTK_CONTAINER (sw), g_clist); + gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (g_find_dlg)->vbox), + sw, TRUE, TRUE, GNOME_PAD_SMALL); + + current_row = -1; + stop = 0; + gtk_signal_connect (GTK_OBJECT (g_clist), "select_row", + GTK_SIGNAL_FUNC (select_row), NULL); + + /* + * Connect the buttons + */ + gtk_signal_connect ( + GTK_OBJECT (b1), "clicked", GTK_SIGNAL_FUNC (find_do_chdir), NULL); + gtk_signal_connect ( + GTK_OBJECT (b2), "clicked", GTK_SIGNAL_FUNC (find_do_again), NULL); + gtk_signal_connect ( + GTK_OBJECT (g_start_stop), "clicked", GTK_SIGNAL_FUNC (find_start_stop), NULL); + + /* + * View/edit buttons + */ + gtk_signal_connect ( + GTK_OBJECT (g_view), "clicked", GTK_SIGNAL_FUNC (find_do_view), NULL); + gtk_signal_connect ( + GTK_OBJECT (g_edit), "clicked", GTK_SIGNAL_FUNC (find_do_edit), NULL); + + gtk_widget_set_sensitive (g_view, FALSE); + gtk_widget_set_sensitive (g_edit, FALSE); + box2 = gtk_hbox_new (1, GNOME_PAD + GNOME_PAD); + gtk_box_pack_start (GTK_BOX (box2), g_view, 0, 0, 0); + gtk_box_pack_start (GTK_BOX (box2), g_edit, 0, 0, 0); + + gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (g_find_dlg)->vbox), + box, TRUE, TRUE, GNOME_PAD_SMALL); + gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (g_find_dlg)->vbox), + box2, TRUE, TRUE, GNOME_PAD_SMALL); + + g_status_label = gtk_label_new (_("Searching")); + gtk_misc_set_alignment (GTK_MISC (g_status_label), 0.0, 0.5); + gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (g_find_dlg)->vbox), + g_status_label, TRUE, TRUE, GNOME_PAD_SMALL); + + gtk_widget_show_all (g_find_dlg); + gtk_widget_hide (box2); +} + +static int +run_process () +{ + idle_tag = gtk_idle_add ((GtkFunction)do_search, g_find_dlg); + + gnome_dialog_run (GNOME_DIALOG (g_find_dlg)); + g_start_stop = NULL; + + return stop; +} + +static void +kill_gui () +{ + gtk_object_destroy (GTK_OBJECT (g_find_dlg)); +} + +static void +stop_idle (void *data) +{ + if (g_start_stop) + gtk_widget_set_sensitive (GTK_WIDGET (g_start_stop), FALSE); +} + +static void +status_update (char *text) +{ + gtk_label_set_text (GTK_LABEL (g_status_label), text); + x_flush_events (); +} + +static char * +add_to_list (char *text, void *data) +{ + int row; + char *texts [1]; + + texts [0] = text; + + row = gtk_clist_append (GTK_CLIST (g_clist), texts); + gtk_clist_set_row_data (GTK_CLIST (g_clist), row, data); +#if 1 + if (gtk_clist_row_is_visible (GTK_CLIST (g_clist), row) != GTK_VISIBILITY_FULL) + gtk_clist_moveto (GTK_CLIST (g_clist), row, 0, 0.5, 0.0); +#endif + return text; +} + +static void +get_list_info (char **file, char **dir) +{ + if (current_row == -1) + *file = *dir = NULL; + gtk_clist_get_text (GTK_CLIST (g_clist), current_row, 0, file); + *dir = gtk_clist_get_row_data (GTK_CLIST (g_clist), current_row); +} +#else + +static void +get_list_info (char **file, char **dir) +{ + listbox_get_current (find_list, file, dir); +} + +static char * +add_to_list (char *text, void *data) +{ + return listbox_add_item (find_list, 0, 0, text, 0); +} + +static void +stop_idle (void *data) +{ + set_idle_proc (data, 0); +} + +static int +view_edit_currently_selected_file (int unparsed_view, int edit) +{ + WLEntry *entry = find_list->current; + char *dir; + + if (!entry) + return MSG_NOT_HANDLED; + + dir = entry->data; + + if (!entry->text || !dir) + return MSG_NOT_HANDLED; + + find_do_view_edit (unparsed_view, edit, dir, entry->text); return MSG_HANDLED; } @@ -668,7 +940,7 @@ start_stop (int button, void *extra) set_idle_proc (find_dlg, running); is_start = !is_start; - label_set_text (status_label, is_start ? _("Stopped") : _("Searching")); + status_update (is_start ? _("Stopped") : _("Searching")); button_set_text (stop_button, fbuts [is_start].text); return 0; @@ -691,29 +963,8 @@ find_do_edit_file (int button, void *extra) } static void -init_find_vars (void) +setup_gui (void) { - char *dir; - - if (old_dir){ - g_free (old_dir); - old_dir = 0; - } - count = 0; - matches = 0; - - /* Remove all the items in the stack */ - while ((dir = pop_directory ()) != NULL) - g_free (dir); -} - -static int -find_file (char *start_dir, char *pattern, char *content, char **dirname, char **filename) -{ - int return_value = 0; - char *dir; - char *dir_tmp, *file_tmp; - #ifdef ENABLE_NLS static int i18n_flag = 0; if (!i18n_flag) @@ -790,29 +1041,60 @@ find_file (char *start_dir, char *pattern, char *content, char **dirname, char find_list = listbox_new (2, 2, FIND2_X-4, FIND2_Y-9, listbox_finish, 0, "listbox"); add_widgetl (find_dlg, find_list, XV_WLAY_EXTENDWIDTH); +} +static int +run_process (void) +{ + set_idle_proc (find_dlg, 1); + run_dlg (find_dlg); + return find_dlg->ret_value; +} + +static void +status_update (char *text) +{ + label_set_text (status_label, text); +} + +static void +kill_gui (void) +{ + set_idle_proc (find_dlg, 0); + destroy_dlg (find_dlg); +} +#endif + +static int +find_file (char *start_dir, char *pattern, char *content, char **dirname, char **filename) +{ + int return_value = 0; + char *dir; + char *dir_tmp, *file_tmp; + + setup_gui (); + /* FIXME: Need to cleanup this, this ought to be passed non-globaly */ find_pattern = pattern; content_pattern = content; - set_idle_proc (find_dlg, 1); init_find_vars (); push_directory (start_dir); - run_dlg (find_dlg); - - return_value = find_dlg->ret_value; + return_value = run_process (); /* Remove all the items in the stack */ while ((dir = pop_directory ()) != NULL) g_free (dir); - - listbox_get_current (find_list, &file_tmp, &dir_tmp); + + get_list_info (&file_tmp, &dir_tmp); if (dir_tmp) *dirname = g_strdup (dir_tmp); if (file_tmp) *filename = g_strdup (file_tmp); + +#ifndef HAVE_GNOME if (return_value == B_PANELIZE && *filename){ int status, link_to_dir, stalled_link; int next_free = 0; @@ -886,9 +1168,9 @@ find_file (char *start_dir, char *pattern, char *content, char **dirname, char } } } +#endif - set_idle_proc (find_dlg, 0); - destroy_dlg (find_dlg); + kill_gui (); do_search (0); /* force do_search to release resources */ if (old_dir){ g_free (old_dir);