0001-deteplification-the-mega-commit.patch 137 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593
  1. From b190bdb716fc8bb0cd515ee10fb3c51debede5fa Mon Sep 17 00:00:00 2001
  2. From: Zander Brown <zbrown@gnome.org>
  3. Date: Tue, 13 Apr 2021 04:53:21 +0000
  4. Subject: [PATCH] deteplification: the mega commit
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. This commit is a reverse patch of a rebased version of gedit with
  9. commits related to tepl/amtk removed
  10. Sébastien Wilmet has stopped development of these libraries, relevant
  11. commits:
  12. https://gitlab.gnome.org/GNOME/amtk/-/commit/34a1171298808e5d9bd50540ee194b8be35bce9d
  13. https://gitlab.gnome.org/GNOME/tepl/-/commit/457b5c37ebcb2ebb23cae10cd47f1342db45a98e
  14. As a result usage is being dropped in favour simplifing gedit
  15. dependencies, because there are not enough developers, and too many bugs.
  16. Do you prefer a rock-solid text editor? Or a text editor with some shiny
  17. and non-essential dependencies that complicate the build, at the expense
  18. of more bugs?
  19. Tracked at: https://gitlab.gnome.org/Infrastructure/Infrastructure/-/issues/564
  20. Commits Dropped:
  21. cfeb7cb6c build: add Tepl dependency, second try
  22. 872fb4809 Utils: use str truncate functions from Tepl
  23. 9a121d523 Utils: deprecate str_end_truncate()
  24. e0e602799 No longer use gedit_utils_str_end_truncate()
  25. 657ce9f7a Utils: deprecate str_middle_truncate()
  26. 6eefa74c2 No longer use gedit_utils_str_middle_truncate()
  27. 169c1594e main: call tepl_init() and tepl_finalize()
  28. ec31f0c22 snap: Fixed build failures by added tepl part
  29. 76cf5562d Document: remove metadata implementation
  30. 75cdb6a77 Document: second pass to remove metadata implementation
  31. d6b158ca6 App: remove the GeditMetadataManager
  32. 6eccd6672 Remove GeditMetadataManager
  33. 03929157e build: remove enable-gvfs-metadata option
  34. 1dad3bce2 build: remove libxml dependency
  35. 8c0825424 metadata: adapt key names for TeplFileMetadata
  36. c2904aa80 Document: metadata: create an internal TeplFile
  37. 9c8ede1e2 App: setup Tepl metadata manager
  38. 91bc04efc App: remove leftover comment
  39. b39dd0201 Document: use TeplFileMetadata to re-implement set/get_metadata()
  40. 494677bfc Utils: use tepl_utils_replace_home_dir_with_tilde()
  41. aaaa28a87 docs: gtk-doc fixxref: fix the path for gtk and add path for tepl
  42. 8710e89d8 Remove GeditViewCentering
  43. 5e0909c19 ViewFrame: disable overlay scrolling for the GtkScrolledWindow
  44. 7c7296b0e Remove overview map: remove from preferences dialog
  45. 26899e0ba Remove overview map
  46. 27f54a9ae replace-open-button: remove OpenDocumentSelector
  47. 504ced5a9 replace-open-button: Window: remove open document popover
  48. 3a8c5bbc2 replace-open-button: remove open button UI
  49. abab6529f replace-open-button: re-create a simple Open button
  50. 1ee984a41 replace-open-button: re-create simple Open Recent menu button (UI)
  51. f1a58a70b replace-open-button: set Open Recent menu with Amtk
  52. 020e0b340 replace-open-button: re-handle the fullscreen mode
  53. 4dfd2104e Window: remove dead code (#defines)
  54. 0caf371b1 Window: make the code a little clearer wrt fullscreen mode
  55. 584aeb202 Window: rename fullscreen_controls -> fullscreen_revealer
  56. 75705bf1d Window: some code cleanup wrt fullscreen mode
  57. cf0d62617 Window: simplify setting the state of the fullscreen revealer
  58. 8706e5624 Window: fullscreen mode: remove idle function
  59. 6361b281c Window: fullscreen mode: remove no longer needed code
  60. 8d3e6faf2 Window: fullscreen mode: fix headerbar shown/hidden "stuttering"
  61. a437e5245 Window: fullscreen mode: add comment about the "stuttering" fix
  62. d064c5f88 Window: remove useless #include
  63. 15833e5c7 build: list of deps: simplify
  64. 007caff57 build: list of deps: simplify version requirements
  65. 72dc3a477 build: avoid the use of a variable
  66. 4a49c8562 flatpak: update Amtk to 5.0.2
  67. 9ab7b0f0a utils: remove GBOOLEAN_TO_POINTER() and GPOINTER_TO_BOOLEAN()
  68. 55c5f1423 Utils: deprecate gedit_warning()
  69. cbdd3a85d PreferencesDialog: use tepl_utils_show_warning_dialog()
  70. 7a442c766 Utils: deprecate decode_uri(), use the tepl one
  71. bf3d57003 Use tepl_utils_decode_uri()
  72. 2e45bb03f io-error-info-bar: remove useless #include's
  73. 092411115 io-error-info-bar: use TeplInfoBar for the file_already_open_warning
  74. 8ccb4566f io-error-info-bar: file_already_open_warning moved to Tepl
  75. 8bfe0559a io-error-info-bar: use TeplInfoBar for no_backup_saving_error
  76. ca582d2c7 io-error-info-bar: fix fixme in no_backup_saving_error
  77. fa1758081 io-error-info-bar: no_backup_saving_error: show also error->message
  78. 321eccdd7 io-error-info-bar: no_back_saving_error moved to Tepl
  79. 7bb880114 io-error-info-bar: tepl function renamed to have a shorter name
  80. d1a14a063 io-error-info-bar: externally_modified: use TeplInfoBar
  81. bf60cc1af io-error-info-bar: invalid_character: TeplInfoBar + other improvements
  82. 44cff9798 io-error-info-bar: externally_modified: remove unneeded code
  83. 873ed25f1 io-error-info-bar: externally_modified: further simplify the code
  84. a8a4724fc io-error-info-bar: externally_modified: moved to Tepl
  85. ec8d8c717 io-error-info-bar: invalid_character: moved to Tepl
  86. 2aae17c31 flatpak: switch Tepl to Meson
  87. 9caaddeda Window: fix RTL bug for Open buttons in the headerbar
  88. 82d8c507d View: subclass TeplView
  89. e23569c59 View: deprecate lots of functions, use the TeplView ones
  90. 291eb9c8e commands-edit: use TeplView functions
  91. 00f8c5e63 Use tepl_view_scroll_to_cursor()
  92. 5fdeaee22 Document: deprecate goto_line() and goto_line_offset()
  93. d87bf25ba commands-file: use tepl_view_goto_line*()
  94. fd5500d90 Tab: use tepl_view_goto_line_offset()
  95. 3c8a1dcb8 ViewFrame: use tepl_view_goto_line*()
  96. 079f9699e pkg-config file: add Tepl as public dep
  97. cf6281d04 docs: document that gedit is in the process of using more Tepl features
  98. 9ac62a6fd build: require Tepl 5
  99. 3f84484d8 App: port to new Tepl metadata API
  100. 9b9fa6c77 Document: port to new Tepl metadata API
  101. 491280c04 docs: roadmap: link to new Tepl roadmap
  102. 49db2a666 PreferencesDialog: use TeplStyleSchemeChooserWidget to fix several bugs
  103. 94c3b70cb PreferencesDialog: improvements to color scheme management
  104. 53cfa1715 PreferencesDialog: fix some bugs when (un)installing color schemes
  105. da5b9af9f snap: the tepl build is meson only now
  106. 012a07cb7 snap: use the correct option to specify parameters
  107. 325aa857c Factory: class skeleton
  108. 7b8579770 Factory: implement ::create_metadata_manager_file vfunc
  109. d5a43cece Factory: create it in main() and set it as the TeplAbstractFactory
  110. 392545195 App: use tepl_application_handle_metadata()
  111. 8b2fa9092 Keep default buttons orientation for TeplInfoBars
  112. efe48bbe8 flatpak: remove uchardet, Tepl no longer depends on it
  113. 5e588d978 PreferencesDialog: improve code to install extra style scheme
  114. eada68d97 PreferencesDialog: use GtkFileChooserNative, not GeditFileChooserDialog
  115. 55fc5973c FileChooserDialog: remove hide() (now dead code)
  116. 4f5a5681b FileChooserDialog: remove add_pattern_filter() (now dead code)
  117. 105ca1ded File choosers: remove GeditFileChooserFlags
  118. ff1e9c27c Update Romanian translation
  119. b4a52f479 Merge branch 'master' of gitlab.gnome.org:GNOME/gedit
  120. 21d94f23b Remove all the deprecated API
  121. 4b5838b1e docs: update path to Amtk docs for the gtk-doc fixxref_args
  122. a4cf3ac57 Use tepl_pango_font_description_to_css()
  123. 205bfc855 Window: port to TeplLanguageChooserWidget
  124. ffedbc882 commands-view: port to TeplLanguageChooserDialog
  125. 1dc325294 Remove GeditHighlightModeSelector and GeditHighlightModeDialog
  126. e487680b2 Use Tepl 6 (currently 5.99)
  127. ee465ef0c Tab: port to TeplProgressInfoBar
  128. bc992e11e Remove GeditProgressInfoBar, replaced by TeplProgressInfoBar
  129. fa9d6aeaa docs: document the GeditProgressInfoBar removal
  130. bb4ba5543 docs: document that all deprecated APIs have been removed
  131. 325351805 GeditDocument: subclass TeplBuffer
  132. 8b01acace GeditDocument: remove the ::cursor-moved signal
  133. b938c50f8 Use the TeplBuffer::tepl-cursor-moved signal
  134. 6b6a6e595 GeditDocument: bind GtkSourceFile and TeplFile :location properties
  135. f73828fe1 GeditDocument: remove unused instance variable
  136. 01d8a1577 flatpak: build amtk from git master, not from an archive
  137. 6e78a57c9 GeditDocument: use tepl_file_get_short_name()
  138. 49749c38a GeditDocument: remove untitled_number handling
  139. 844f6185a Tab: use TeplFile:short-name property notification
  140. 49c0c814a GeditDocument: remove the :shortname property
  141. a4670d7ce help: "Untitled Document" -> "Untitled File"
  142. 4d4d5d48c Use tepl_buffer_is_untouched()
  143. b0f67d391 GeditDocument: remove is_untouched()
  144. 85b007052 GeditDocument: use the TeplFile location in is_untitled()
  145. 4df850fb6 View: use TeplSignalGroup
  146. ef0d0ca9b View: minor code changes
  147. 284e6c05c View: make set_font() private
  148. 6b1e782d9 View: code refactorings for set_font()
  149. ce790b510 View: use tepl_utils_override_font()
  150. 79b3e3011 GeditSettings: remove no longer needed code
  151. da4b3e61a GeditSettings: minor code change: removed unused function param
  152. 13033affa GeditSettings: rework fonts changes handling, add ::fonts-changed signal
  153. 878ceb988 GeditSettings: minor code change, improve get_system_font()
  154. 1e89921a3 GeditSettings: add get_selected_font()
  155. 9ef4cf7ed View: simplify the code to update the font
  156. 3a3de93bd debug: remove DEBUG_METADATA (dead code)
  157. 43925dac7 recent: use the TeplFile
  158. 2f7c4a691 recent: move some functions to gedit-recent-osx
  159. 87b1f50d4 recent-osx: add TODO comment
  160. Brought to you by GitLens, which honesntly has been very useful
  161. unpicking all this and sticking it back together again
  162. ---
  163. NEWS | 12 +
  164. build-aux/flatpak/org.gnome.gedit.yml | 15 +-
  165. build-aux/snap/snapcraft.yaml | 27 +-
  166. data/org.gnome.gedit.gschema.xml.in | 5 +
  167. docs/gedit-development-getting-started.md | 8 +-
  168. docs/reference/api-breaks.xml | 50 +
  169. docs/reference/gedit-docs.xml | 1 +
  170. docs/reference/gedit-sections.txt | 36 +
  171. docs/reference/meson.build | 6 +-
  172. docs/roadmap-done.md | 56 -
  173. docs/roadmap.md | 19 +-
  174. gedit/Gedit-3.0.metadata | 1 +
  175. gedit/gedit-app-osx.m | 4 +-
  176. gedit/gedit-app-private.h | 3 +
  177. gedit/gedit-app.c | 54 +-
  178. gedit/gedit-commands-edit.c | 28 +-
  179. gedit/gedit-commands-file.c | 26 +-
  180. gedit/gedit-commands-search.c | 7 +-
  181. gedit/gedit-commands-view.c | 42 +-
  182. gedit/gedit-debug.c | 4 +
  183. gedit/gedit-debug.h | 2 +
  184. gedit/gedit-document-private.h | 12 +-
  185. gedit/gedit-document.c | 534 ++++++-
  186. gedit/gedit-document.h | 18 +-
  187. gedit/gedit-documents-panel.c | 3 +-
  188. gedit/gedit-factory.c | 50 -
  189. gedit/gedit-factory.h | 53 -
  190. gedit/gedit-file-chooser-dialog-gtk.c | 72 +-
  191. gedit/gedit-file-chooser-dialog-gtk.h | 9 +-
  192. gedit/gedit-file-chooser-dialog.c | 40 +-
  193. gedit/gedit-file-chooser-dialog.h | 17 +
  194. gedit/gedit-highlight-mode-dialog.c | 102 ++
  195. gedit/gedit-highlight-mode-dialog.h | 41 +
  196. gedit/gedit-highlight-mode-selector.c | 375 +++++
  197. gedit/gedit-highlight-mode-selector.h | 44 +
  198. gedit/gedit-io-error-info-bar.c | 362 ++++-
  199. gedit/gedit-io-error-info-bar.h | 10 +
  200. gedit/gedit-metadata-manager.c | 650 ++++++++
  201. gedit/gedit-metadata-manager.h | 49 +
  202. gedit/gedit-open-document-selector-helper.c | 103 ++
  203. gedit/gedit-open-document-selector-helper.h | 103 ++
  204. gedit/gedit-open-document-selector-store.c | 820 +++++++++++
  205. gedit/gedit-open-document-selector-store.h | 68 +
  206. gedit/gedit-open-document-selector.c | 1304 +++++++++++++++++
  207. gedit/gedit-open-document-selector.h | 44 +
  208. gedit/gedit-pango.c | 230 +++
  209. gedit/gedit-pango.h | 28 +
  210. gedit/gedit-preferences-dialog.c | 447 +++---
  211. gedit/gedit-print-job.c | 4 +-
  212. gedit/gedit-progress-info-bar.c | 177 +++
  213. gedit/gedit-progress-info-bar.h | 53 +
  214. gedit/gedit-recent-osx.c | 249 ----
  215. gedit/gedit-recent-osx.h | 54 -
  216. gedit/gedit-recent.c | 231 ++-
  217. gedit/gedit-recent.h | 23 +-
  218. gedit/gedit-settings.c | 177 ++-
  219. gedit/gedit-settings.h | 7 +-
  220. gedit/gedit-tab.c | 115 +-
  221. gedit/gedit-utils.c | 333 ++++-
  222. gedit/gedit-utils.h | 21 +-
  223. gedit/gedit-view-centering.c | 495 +++++++
  224. gedit/gedit-view-centering.h | 67 +
  225. gedit/gedit-view-frame.c | 37 +-
  226. gedit/gedit-view-frame.h | 4 +
  227. gedit/gedit-view.c | 322 +++-
  228. gedit/gedit-view.h | 24 +-
  229. gedit/gedit-window-private.h | 15 +-
  230. gedit/gedit-window.c | 380 ++---
  231. gedit/gedit.c | 8 +-
  232. gedit/meson.build | 23 +-
  233. gedit/resources/css/gedit-style.css | 12 +
  234. gedit/resources/css/gedit.adwaita.css | 25 +
  235. gedit/resources/gedit.gresource.xml.in | 4 +
  236. .../ui/gedit-highlight-mode-dialog.ui | 87 ++
  237. .../ui/gedit-highlight-mode-selector.ui | 83 ++
  238. .../ui/gedit-open-document-selector.ui | 115 ++
  239. .../resources/ui/gedit-preferences-dialog.ui | 30 +-
  240. gedit/resources/ui/gedit-progress-info-bar.ui | 88 ++
  241. gedit/resources/ui/gedit-view-frame.ui | 27 +-
  242. gedit/resources/ui/gedit-window.ui | 87 +-
  243. help/C/gedit-tab-groups.page | 4 +-
  244. meson.build | 34 +-
  245. meson_options.txt | 7 +
  246. plugins/snippets/snippets/document.py | 10 +-
  247. plugins/spell/gedit-spell-plugin.c | 9 +-
  248. po/POTFILES.in | 8 +-
  249. 86 files changed, 8160 insertions(+), 1283 deletions(-)
  250. delete mode 100644 docs/roadmap-done.md
  251. delete mode 100644 gedit/gedit-factory.c
  252. delete mode 100644 gedit/gedit-factory.h
  253. create mode 100644 gedit/gedit-highlight-mode-dialog.c
  254. create mode 100644 gedit/gedit-highlight-mode-dialog.h
  255. create mode 100644 gedit/gedit-highlight-mode-selector.c
  256. create mode 100644 gedit/gedit-highlight-mode-selector.h
  257. create mode 100644 gedit/gedit-metadata-manager.c
  258. create mode 100644 gedit/gedit-metadata-manager.h
  259. create mode 100644 gedit/gedit-open-document-selector-helper.c
  260. create mode 100644 gedit/gedit-open-document-selector-helper.h
  261. create mode 100644 gedit/gedit-open-document-selector-store.c
  262. create mode 100644 gedit/gedit-open-document-selector-store.h
  263. create mode 100644 gedit/gedit-open-document-selector.c
  264. create mode 100644 gedit/gedit-open-document-selector.h
  265. create mode 100644 gedit/gedit-pango.c
  266. create mode 100644 gedit/gedit-pango.h
  267. create mode 100644 gedit/gedit-progress-info-bar.c
  268. create mode 100644 gedit/gedit-progress-info-bar.h
  269. delete mode 100644 gedit/gedit-recent-osx.c
  270. delete mode 100644 gedit/gedit-recent-osx.h
  271. create mode 100644 gedit/gedit-view-centering.c
  272. create mode 100644 gedit/gedit-view-centering.h
  273. create mode 100644 gedit/resources/ui/gedit-highlight-mode-dialog.ui
  274. create mode 100644 gedit/resources/ui/gedit-highlight-mode-selector.ui
  275. create mode 100644 gedit/resources/ui/gedit-open-document-selector.ui
  276. create mode 100644 gedit/resources/ui/gedit-progress-info-bar.ui
  277. diff --git a/NEWS b/NEWS
  278. index e7f2c81f3..476a367a7 100644
  279. --- a/NEWS
  280. +++ b/NEWS
  281. @@ -1,3 +1,15 @@
  282. +News in [unreleased]
  283. +----------------------------
  284. +* Deteplification:
  285. + - The tepl maintainer has "frozen" the project until further notice
  286. + - Moving things to tepl introduced some breakage, such as translation of the
  287. + default filename
  288. + - gedit didn't use much of the API anyway
  289. + - Used even less of amtk
  290. + - Revert all usage of amtk and tepl
  291. + - Unfortunatly a couple bug fixes may have been lost
  292. + - Plugin API is essentially reverted to 3.36
  293. +
  294. News in 40.1, 2021-04-17
  295. ------------------------
  296. * Use document folder when opening new files
  297. diff --git a/build-aux/flatpak/org.gnome.gedit.yml b/build-aux/flatpak/org.gnome.gedit.yml
  298. index 1438abd07..d3b535176 100644
  299. --- a/build-aux/flatpak/org.gnome.gedit.yml
  300. +++ b/build-aux/flatpak/org.gnome.gedit.yml
  301. @@ -32,56 +32,51 @@ cleanup:
  302. - "/share/aclocal"
  303. - "/man"
  304. - "/share/man"
  305. - "/share/gtk-doc"
  306. - "/share/vala"
  307. - "/share/gir-1.0"
  308. - "*.la"
  309. - "*.a"
  310. modules:
  311. - name: libpeas
  312. buildsystem: meson
  313. config-opts:
  314. - "-Dlua51=false"
  315. - "-Dvapi=true"
  316. - "-Ddemos=false"
  317. - "-Dglade_catalog=false"
  318. sources:
  319. - type: archive
  320. url: https://download.gnome.org/sources/libpeas/1.28/libpeas-1.28.0.tar.xz
  321. sha256: 42d91993b46ed50f16add6d9577ecc22beb8e2dffa7101e2232c2b63733b8b15
  322. - name: gspell
  323. cleanup:
  324. - "/bin"
  325. sources:
  326. - type: archive
  327. url: https://download.gnome.org/sources/gspell/1.9/gspell-1.9.1.tar.xz
  328. sha256: dcbb769dfdde8e3c0a8ed3102ce7e661abbf7ddf85df08b29915e92cd723abdd
  329. - - name: amtk
  330. - buildsystem: meson
  331. + - name: uchardet
  332. + buildsystem: cmake-ninja
  333. sources:
  334. - - type: git
  335. - url: https://gitlab.gnome.org/GNOME/amtk.git
  336. -
  337. - - name: tepl
  338. - buildsystem: meson
  339. - sources:
  340. - - type: git
  341. - url: https://gitlab.gnome.org/GNOME/tepl.git
  342. + - type: archive
  343. + url: https://www.freedesktop.org/software/uchardet/releases/uchardet-0.0.6.tar.xz
  344. + sha256: 8351328cdfbcb2432e63938721dd781eb8c11ebc56e3a89d0f84576b96002c61
  345. - name: gedit
  346. buildsystem: meson
  347. sources:
  348. - type: git
  349. url: https://gitlab.gnome.org/GNOME/gedit.git
  350. # To build a local branch, comment out 'url' and uncomment:
  351. # path: ../../
  352. # branch: wip/misc
  353. - name: gedit-plugins
  354. buildsystem: meson
  355. sources:
  356. - type: git
  357. url: https://gitlab.gnome.org/GNOME/gedit-plugins.git
  358. diff --git a/build-aux/snap/snapcraft.yaml b/build-aux/snap/snapcraft.yaml
  359. index fc49c3949..43db5e027 100644
  360. --- a/build-aux/snap/snapcraft.yaml
  361. +++ b/build-aux/snap/snapcraft.yaml
  362. @@ -14,121 +14,98 @@ layout:
  363. symlink: $SNAP/usr/share/gedit
  364. slots:
  365. # for GtkApplication registration
  366. gedit:
  367. interface: dbus
  368. bus: session
  369. name: org.gnome.gedit
  370. apps:
  371. gedit:
  372. command: usr/bin/gedit
  373. extensions: [gnome-3-28]
  374. plugs:
  375. - avahi-observe
  376. - cups-control
  377. - gsettings
  378. - home
  379. - network
  380. - mount-observe
  381. - removable-media
  382. common-id: org.gnome.gedit.desktop
  383. environment:
  384. GSETTINGS_SCHEMA_DIR: $SNAP/share/glib-2.0/schemas
  385. LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/lib/$SNAPCRAFT_ARCH_TRIPLET/gedit:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET:$SNAP/gnome-platform/usr/lib/$SNAPCRAFT_ARCH_TRIPLET
  386. GI_TYPELIB_PATH: $SNAP/usr/lib/girepository-1.0:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/gedit/girepository-1.0:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/girepository-1.0:$SNAP/gnome-platform/usr/lib/girepository-1.0:$SNAP/gnome-platform/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/girepository-1.0
  387. PYTHONPATH: $SNAP/usr/lib/python3/dist-packages:$SNAP/gnome-platform/usr/lib/python3/dist-packages
  388. GTK_USE_PORTAL: 1
  389. parts:
  390. - amtk:
  391. - source: https://gitlab.gnome.org/GNOME/amtk.git
  392. - source-type: git
  393. - plugin: autotools
  394. - configflags:
  395. - - --prefix=/usr
  396. - - --enable-introspection=no
  397. - organize:
  398. - snap/gedit/current/usr: usr
  399. -
  400. - tepl:
  401. - after: [amtk, gtksourceview]
  402. - source: https://gitlab.gnome.org/GNOME/tepl.git
  403. - source-type: git
  404. - plugin: meson
  405. - meson-parameters:
  406. - - --prefix=/usr
  407. - organize:
  408. - snap/gedit/current/usr: usr
  409. - build-packages:
  410. - - libuchardet-dev
  411. - stage-packages:
  412. - - libuchardet0
  413. -
  414. gtksourceview:
  415. source: https://gitlab.gnome.org/GNOME/gtksourceview.git
  416. source-type: git
  417. plugin: meson
  418. meson-parameters:
  419. - --prefix=/usr
  420. - -Dc_args="-Wno-error=undef"
  421. organize:
  422. snap/gedit/current/usr: usr
  423. build-packages:
  424. - autoconf-archive
  425. - gettext
  426. - gobject-introspection
  427. - gtk-doc-tools
  428. - libfribidi-dev
  429. - libgirepository1.0-dev
  430. - libglib2.0-dev
  431. - libgtk-3-dev
  432. - libpeas-dev
  433. - libxml2-dev
  434. - libxml2-utils
  435. - valac
  436. # meson gir overrides don't work well
  437. override-build: |
  438. snapcraftctl build
  439. cp $SNAPCRAFT_PART_INSTALL/usr/share/gir-1.0/GtkSource* /usr/share/gir-1.0
  440. cp $SNAPCRAFT_PART_INSTALL/usr/share/vala/vapi/gtksource* /usr/share/vala/vapi
  441. gedit:
  442. - after: [gtksourceview, tepl]
  443. + after: [gtksourceview]
  444. source: .
  445. source-type: git
  446. parse-info: [usr/share/metainfo/org.gnome.gedit.appdata.xml]
  447. plugin: meson
  448. meson-parameters:
  449. - --prefix=/usr
  450. - -Dvala_args="--vapidir=$SNAPCRAFT_STAGE/usr/share/vala/vapi"
  451. +
  452. build-environment:
  453. - C_INCLUDE_PATH: $SNAPCRAFT_STAGE/usr/include/gtksourceview-4
  454. override-build: |
  455. sed -i.bak -e 's|Icon=org.gnome.gedit$|Icon=${SNAP}/meta/gui/org.gnome.gedit.svg|g' data/org.gnome.gedit.desktop.in
  456. sed -i.bak -e "s|symlink_media: true|symlink_media: false|g" help/meson.build
  457. snapcraftctl build
  458. mkdir -p $SNAPCRAFT_PART_INSTALL/meta/gui/
  459. cp data/icons/org.gnome.gedit.svg $SNAPCRAFT_PART_INSTALL/meta/gui/
  460. cp ../install/usr/share/applications/org.gnome.gedit.desktop $SNAPCRAFT_PART_INSTALL/meta/gui/
  461. build-packages:
  462. - desktop-file-utils
  463. - gettext
  464. - gsettings-desktop-schemas-dev
  465. - gtk-doc-tools
  466. - itstool
  467. - libsoup2.4-dev
  468. - libgspell-1-dev
  469. - libxml2-dev
  470. - libglib2.0-dev
  471. - libgtk-3-dev
  472. - libpeas-dev
  473. - libx11-dev
  474. - python3
  475. - python-gi-dev
  476. - gobject-introspection
  477. - libgirepository1.0-dev
  478. - valac
  479. stage-packages:
  480. - libfribidi0
  481. diff --git a/data/org.gnome.gedit.gschema.xml.in b/data/org.gnome.gedit.gschema.xml.in
  482. index b797d843c..59325f4ef 100644
  483. --- a/data/org.gnome.gedit.gschema.xml.in
  484. +++ b/data/org.gnome.gedit.gschema.xml.in
  485. @@ -99,60 +99,65 @@
  486. <key name="auto-indent" type="b">
  487. <default>true</default>
  488. <summary>Automatic indent</summary>
  489. <description>Whether gedit should enable automatic indentation.</description>
  490. </key>
  491. <key name="display-line-numbers" type="b">
  492. <default>true</default>
  493. <summary>Display Line Numbers</summary>
  494. <description>Whether gedit should display line numbers in the editing area.</description>
  495. </key>
  496. <key name="highlight-current-line" type="b">
  497. <default>true</default>
  498. <summary>Highlight Current Line</summary>
  499. <description>Whether gedit should highlight the current line.</description>
  500. </key>
  501. <key name="bracket-matching" type="b">
  502. <default>true</default>
  503. <summary>Highlight Matching Brackets</summary>
  504. <description>Whether gedit should highlight matching brackets.</description>
  505. </key>
  506. <key name="display-right-margin" type="b">
  507. <default>false</default>
  508. <summary>Display Right Margin</summary>
  509. <description>Whether gedit should display the right margin in the editing area.</description>
  510. </key>
  511. <key name="right-margin-position" type="u">
  512. <default>80</default>
  513. <summary>Right Margin Position</summary>
  514. <description>Specifies the position of the right margin.</description>
  515. </key>
  516. + <key name="display-overview-map" type="b">
  517. + <default>false</default>
  518. + <summary>Display Overview Map</summary>
  519. + <description>Whether gedit should display the overview map for the document.</description>
  520. + </key>
  521. <key name="background-pattern" enum="org.gnome.gedit.BackgroundPatternType">
  522. <default>'none'</default>
  523. <summary>Document background pattern type</summary>
  524. <description>Whether the document will get a background pattern painted.</description>
  525. </key>
  526. <key name="smart-home-end" enum="org.gnome.gedit.SmartHomeEnd">
  527. <aliases>
  528. <alias value='DISABLED' target='disabled'/>
  529. <alias value='BEFORE' target='before'/>
  530. <alias value='AFTER' target='after'/>
  531. <alias value='ALWAYS' target='always'/>
  532. </aliases>
  533. <default>'after'</default>
  534. <summary>Smart Home End</summary>
  535. <description>Specifies how the cursor moves when the HOME and END keys are pressed. Use “disabled” to always move at the start/end of the line, “after” to move to the start/end of the line the first time the keys are pressed and to the start/end of the text ignoring whitespaces the second time the keys are pressed, “before” to move to the start/end of the text before moving to the start/end of the line and “always” to always move to the start/end of the text instead of the start/end of the line.</description>
  536. </key>
  537. <key name="restore-cursor-position" type="b">
  538. <default>true</default>
  539. <summary>Restore Previous Cursor Position</summary>
  540. <description>Whether gedit should restore the previous cursor position when a file is loaded.</description>
  541. </key>
  542. <key name="syntax-highlighting" type="b">
  543. <default>true</default>
  544. <summary>Enable Syntax Highlighting</summary>
  545. <description>Whether gedit should enable syntax highlighting.</description>
  546. </key>
  547. <key name="search-highlighting" type="b">
  548. <default>true</default>
  549. <summary>Enable Search Highlighting</summary>
  550. <description>Whether gedit should highlight all the occurrences of the searched text.</description>
  551. diff --git a/docs/gedit-development-getting-started.md b/docs/gedit-development-getting-started.md
  552. index 4f930afc7..774bc180f 100644
  553. --- a/docs/gedit-development-getting-started.md
  554. +++ b/docs/gedit-development-getting-started.md
  555. @@ -4,65 +4,63 @@ gedit development - getting started
  556. The following explanations can be improved over time, if you see something
  557. missing, a feedback is welcome.
  558. Programming languages and paradigms
  559. -----------------------------------
  560. gedit is mostly written in C, with some plugins in Python or
  561. [Vala](https://wiki.gnome.org/Projects/Vala/). The build system is in
  562. [Meson](https://mesonbuild.com/).
  563. The code is object-oriented and event-driven. In C, it's thanks to the use of
  564. the GObject library (see next section). If you open some `*.c` or `*.h` files,
  565. you may think “what is this horror?!” but – don't panic – it's just some
  566. C/GObject boilerplate code, and that boilerplate can be generated by a tool. So
  567. once you've learned GObject, you will no longer be afraid ;-)
  568. Libraries used
  569. --------------
  570. As every GNOME application, gedit uses the GLib, GObject and GTK libraries. To
  571. modify the gedit source code, you should be familiar with those libraries. See
  572. the [GTK website](https://www.gtk.org/) and the document
  573. [The GLib/GTK Development Platform – A Getting Started Guide](https://people.gnome.org/~swilmet/glib-gtk-book/).
  574. The main widget used by gedit is GtkTextView, a general-purpose multiline text
  575. editor. To learn that widget API, read the excellent
  576. [GtkTextView tutorial](http://www.bravegnu.org/gtktext/) (a bit old but still
  577. mostly valid). But GtkTextView is not enough for source code edition. gedit
  578. actually uses the
  579. [GtkSourceView](https://wiki.gnome.org/Projects/GtkSourceView) library, which
  580. -contains a subclass of GtkTextView with many features useful for a text editor
  581. -or an IDE. But GtkSourceView is not enough to have a full-blown text editor,
  582. -gedit is actually in the process of using more features from the
  583. -[Tepl](https://wiki.gnome.org/Projects/Tepl) library, and to further develop
  584. -Tepl alongside gedit.
  585. +contains a subclass of GtkTextView with syntax highlighting, a completion
  586. +framework, the search and replace, and many other features useful for a text
  587. +editor or an IDE.
  588. For its plugin system, gedit uses the
  589. [libpeas](https://wiki.gnome.org/Projects/Libpeas) library.
  590. Plugins may have other dependencies, for example the spell-checking plugin uses
  591. [gspell](https://wiki.gnome.org/Projects/gspell).
  592. gedit architecture
  593. ------------------
  594. The [gedit Git repository](https://gitlab.gnome.org/GNOME/gedit) contains the
  595. _gedit core_ plus the default plugins. There is also the
  596. [gedit-plugins Git repository](https://gitlab.gnome.org/GNOME/gedit-plugins)
  597. for additional official plugins. The gedit core source code is in the `gedit/`
  598. directory. The plugins are in … `plugins/`!
  599. gedit core provides:
  600. - A basic text editor.
  601. - The integration of libpeas, with an API for plugins.
  602. There is a class diagram of gedit core in the file
  603. [class-diagram.dia](class-diagram.dia) (but it may be outdated, see the Git log
  604. for that file).
  605. Build/Installation
  606. ------------------
  607. See the file [build.md](build.md).
  608. First contribution
  609. diff --git a/docs/reference/api-breaks.xml b/docs/reference/api-breaks.xml
  610. index f631761a6..f03c35975 100644
  611. --- a/docs/reference/api-breaks.xml
  612. +++ b/docs/reference/api-breaks.xml
  613. @@ -1,53 +1,103 @@
  614. <?xml version="1.0"?>
  615. <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
  616. "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
  617. [
  618. <!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
  619. ]>
  620. <part id="api-breaks">
  621. <title>API Breaks</title>
  622. <para>
  623. gedit is a quite old piece of software (created in 1998, at the beginnings
  624. of the GNOME project), and as every software, the code evolves during its
  625. lifetime. So there are sometimes API breaks for gedit plugins, there are no
  626. API stability guarantees.
  627. </para>
  628. <para>
  629. When it is possible, instead of directly removing an API, that API is first
  630. marked as deprecated, and then removed for the next API break. See the
  631. <link linkend="api-index-deprecated">index of deprecated symbols</link>.
  632. </para>
  633. + <refsect1>
  634. + <title>40 -> 41</title>
  635. + <itemizedlist>
  636. + <listitem>
  637. + <para>
  638. + The <code>GeditProgressInfoBar</code> class has been restored
  639. + </para>
  640. + </listitem>
  641. + <listitem>
  642. + <para>
  643. + <link linkend="GeditDocument">GeditDocument</link> is no longer a subclass
  644. + of <link linkend="TeplBuffer">TeplBuffer</link>.
  645. + </para>
  646. + </listitem>
  647. + <listitem>
  648. + <para>
  649. + The <code>GeditDocument::cursor-moved</code> signal has been restored.
  650. + </para>
  651. + </listitem>
  652. + <listitem>
  653. + <para>
  654. + The <code>GeditDocument:shortname</code> property has been restored.
  655. + </para>
  656. + </listitem>
  657. + <listitem>
  658. + <para>
  659. + The <code>gedit_document_is_untouched()</code> function has been
  660. + restored.
  661. + </para>
  662. + </listitem>
  663. + <listitem>
  664. + <para>
  665. + The <code>gedit_view_set_font()</code> function has been restored.
  666. + </para>
  667. + </listitem>
  668. + <listitem>
  669. + <para>
  670. + <code>DEBUG_METADATA</code> has been restored.
  671. + </para>
  672. + </listitem>
  673. + <listitem>
  674. + <para>
  675. + The <code>GBOOLEAN_TO_POINTER()</code> and
  676. + <code>GPOINTER_TO_BOOLEAN()</code> macros have been restored to
  677. + <code>gedit-utils.h</code>.
  678. + </para>
  679. + </listitem>
  680. + </itemizedlist>
  681. + </refsect1>
  682. +
  683. <refsect1>
  684. <title>3.38 -> 40</title>
  685. <itemizedlist>
  686. <listitem>
  687. <para>
  688. All previously deprecated APIs have been removed.
  689. </para>
  690. </listitem>
  691. <listitem>
  692. <para>
  693. The <code>GeditProgressInfoBar</code> class has been removed, you can
  694. use <link linkend="TeplProgressInfoBar">TeplProgressInfoBar</link>
  695. instead.
  696. </para>
  697. </listitem>
  698. <listitem>
  699. <para>
  700. <link linkend="GeditDocument">GeditDocument</link> is now a subclass
  701. of <link linkend="TeplBuffer">TeplBuffer</link>.
  702. </para>
  703. </listitem>
  704. <listitem>
  705. <para>
  706. The <code>GeditDocument::cursor-moved</code> signal has been removed.
  707. You can use the <link linkend="TeplBuffer">TeplBuffer</link> API
  708. instead.
  709. </para>
  710. </listitem>
  711. <listitem>
  712. <para>
  713. diff --git a/docs/reference/gedit-docs.xml b/docs/reference/gedit-docs.xml
  714. index a0dc624cf..9e32e5469 100644
  715. --- a/docs/reference/gedit-docs.xml
  716. +++ b/docs/reference/gedit-docs.xml
  717. @@ -1,48 +1,49 @@
  718. <?xml version="1.0"?>
  719. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
  720. "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
  721. <book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
  722. <bookinfo>
  723. <title>gedit Reference Manual</title>
  724. </bookinfo>
  725. <part id="api-reference">
  726. <title>API Reference</title>
  727. <xi:include href="xml/gedit-app.xml"/>
  728. <xi:include href="xml/gedit-app-activatable.xml"/>
  729. <xi:include href="xml/gedit-commands.xml"/>
  730. <xi:include href="xml/gedit-document.xml"/>
  731. <xi:include href="xml/gedit-encodings-combo-box.xml"/>
  732. <xi:include href="xml/gedit-menu-extension.xml"/>
  733. <xi:include href="xml/gedit-message-bus.xml"/>
  734. <xi:include href="xml/gedit-message.xml"/>
  735. + <xi:include href="xml/gedit-progress-info-bar.xml"/>
  736. <xi:include href="xml/gedit-statusbar.xml"/>
  737. <xi:include href="xml/gedit-tab.xml"/>
  738. <xi:include href="xml/gedit-view.xml"/>
  739. <xi:include href="xml/gedit-view-activatable.xml"/>
  740. <xi:include href="xml/gedit-window.xml"/>
  741. <xi:include href="xml/gedit-window-activatable.xml"/>
  742. <xi:include href="xml/gedit-debug.xml"/>
  743. <xi:include href="xml/gedit-utils.xml"/>
  744. </part>
  745. <xi:include href="api-breaks.xml"/>
  746. <part id="annexes">
  747. <title>Annexes</title>
  748. <chapter>
  749. <title>Object Hierarchy</title>
  750. <xi:include href="xml/tree_index.sgml"/>
  751. </chapter>
  752. <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
  753. <index>
  754. <title>Index of all symbols</title>
  755. <xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
  756. </index>
  757. <index role="deprecated">
  758. <title>Index of deprecated symbols</title>
  759. <xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
  760. </index>
  761. diff --git a/docs/reference/gedit-sections.txt b/docs/reference/gedit-sections.txt
  762. index cec055fce..a71e00faa 100644
  763. --- a/docs/reference/gedit-sections.txt
  764. +++ b/docs/reference/gedit-sections.txt
  765. @@ -27,61 +27,64 @@ gedit_app_activatable_activate
  766. gedit_app_activatable_deactivate
  767. gedit_app_activatable_extend_menu
  768. <SUBSECTION Standard>
  769. GEDIT_TYPE_APP_ACTIVATABLE
  770. GEDIT_APP_ACTIVATABLE
  771. GEDIT_APP_ACTIVATABLE_IFACE
  772. GEDIT_IS_APP_ACTIVATABLE
  773. GEDIT_APP_ACTIVATABLE_GET_IFACE
  774. gedit_app_activatable_get_type
  775. </SECTION>
  776. <SECTION>
  777. <FILE>gedit-commands</FILE>
  778. <TITLE>GeditCommands</TITLE>
  779. gedit_commands_load_location
  780. gedit_commands_load_locations
  781. gedit_commands_save_document
  782. gedit_commands_save_document_async
  783. gedit_commands_save_document_finish
  784. gedit_commands_save_all_documents
  785. </SECTION>
  786. <SECTION>
  787. <FILE>gedit-document</FILE>
  788. <TITLE>GeditDocument</TITLE>
  789. GeditDocument
  790. gedit_document_new
  791. gedit_document_get_file
  792. gedit_document_get_short_name_for_display
  793. gedit_document_get_mime_type
  794. +gedit_document_is_untouched
  795. gedit_document_is_untitled
  796. +gedit_document_goto_line
  797. +gedit_document_goto_line_offset
  798. gedit_document_set_language
  799. gedit_document_get_content_type
  800. gedit_document_get_metadata
  801. gedit_document_set_metadata
  802. gedit_document_set_search_context
  803. gedit_document_get_search_context
  804. <SUBSECTION Standard>
  805. GEDIT_DOCUMENT
  806. GEDIT_IS_DOCUMENT
  807. GEDIT_TYPE_DOCUMENT
  808. gedit_document_get_type
  809. GEDIT_DOCUMENT_CLASS
  810. GEDIT_IS_DOCUMENT_CLASS
  811. GEDIT_DOCUMENT_GET_CLASS
  812. </SECTION>
  813. <SECTION>
  814. <FILE>gedit-encodings-combo-box</FILE>
  815. <TITLE>GeditEncodingsComboBox</TITLE>
  816. GeditEncodingsComboBox
  817. gedit_encodings_combo_box_new
  818. gedit_encodings_combo_box_get_selected_encoding
  819. gedit_encodings_combo_box_set_selected_encoding
  820. <SUBSECTION Standard>
  821. GEDIT_ENCODINGS_COMBO_BOX
  822. GEDIT_IS_ENCODINGS_COMBO_BOX
  823. GEDIT_TYPE_ENCODINGS_COMBO_BOX
  824. gedit_encodings_combo_box_get_type
  825. GEDIT_ENCODINGS_COMBO_BOX_CLASS
  826. GEDIT_IS_ENCODINGS_COMBO_BOX_CLASS
  827. @@ -121,111 +124,138 @@ GEDIT_TYPE_MESSAGE_BUS
  828. gedit_message_bus_get_type
  829. GEDIT_MESSAGE_BUS_CLASS
  830. GEDIT_IS_MESSAGE_BUS_CLASS
  831. GEDIT_MESSAGE_BUS_GET_CLASS
  832. GeditMessageBusPrivate
  833. </SECTION>
  834. <SECTION>
  835. <FILE>gedit-message</FILE>
  836. <TITLE>GeditMessage</TITLE>
  837. GeditMessage
  838. gedit_message_get_object_path
  839. gedit_message_get_method
  840. gedit_message_type_has
  841. gedit_message_type_check
  842. gedit_message_has
  843. gedit_message_is_valid_object_path
  844. gedit_message_type_identifier
  845. <SUBSECTION Standard>
  846. GEDIT_MESSAGE
  847. GEDIT_MESSAGE_CONST
  848. GEDIT_IS_MESSAGE
  849. GEDIT_TYPE_MESSAGE
  850. gedit_message_get_type
  851. GEDIT_MESSAGE_CLASS
  852. GEDIT_IS_MESSAGE_CLASS
  853. GEDIT_MESSAGE_GET_CLASS
  854. GeditMessagePrivate
  855. </SECTION>
  856. +<SECTION>
  857. +<FILE>gedit-progress-info-bar</FILE>
  858. +<TITLE>GeditProgressInfoBar</TITLE>
  859. +GeditProgressInfoBar
  860. +gedit_progress_info_bar_new
  861. +gedit_progress_info_bar_set_icon_name
  862. +gedit_progress_info_bar_set_markup
  863. +gedit_progress_info_bar_set_text
  864. +gedit_progress_info_bar_set_fraction
  865. +gedit_progress_info_bar_pulse
  866. +<SUBSECTION Standard>
  867. +GEDIT_PROGRESS_INFO_BAR
  868. +GEDIT_IS_PROGRESS_INFO_BAR
  869. +GEDIT_TYPE_PROGRESS_INFO_BAR
  870. +gedit_progress_info_bar_get_type
  871. +GEDIT_PROGRESS_INFO_BAR_CLASS
  872. +GEDIT_IS_PROGRESS_INFO_BAR_CLASS
  873. +GEDIT_PROGRESS_INFO_BAR_GET_CLASS
  874. +</SECTION>
  875. +
  876. <SECTION>
  877. <FILE>gedit-statusbar</FILE>
  878. <TITLE>GeditStatusbar</TITLE>
  879. GeditStatusbar
  880. gedit_statusbar_new
  881. gedit_statusbar_set_window_state
  882. gedit_statusbar_set_overwrite
  883. gedit_statusbar_clear_overwrite
  884. gedit_statusbar_flash_message
  885. <SUBSECTION Standard>
  886. GEDIT_STATUSBAR
  887. GEDIT_IS_STATUSBAR
  888. GEDIT_TYPE_STATUSBAR
  889. gedit_statusbar_get_type
  890. GEDIT_STATUSBAR_CLASS
  891. GEDIT_IS_STATUSBAR_CLASS
  892. GEDIT_STATUSBAR_GET_CLASS
  893. </SECTION>
  894. <SECTION>
  895. <FILE>gedit-tab</FILE>
  896. <TITLE>GeditTab</TITLE>
  897. GeditTab
  898. GeditTabState
  899. gedit_tab_get_view
  900. gedit_tab_get_document
  901. gedit_tab_get_from_document
  902. gedit_tab_get_state
  903. gedit_tab_get_auto_save_enabled
  904. gedit_tab_set_auto_save_enabled
  905. gedit_tab_get_auto_save_interval
  906. gedit_tab_set_auto_save_interval
  907. gedit_tab_set_info_bar
  908. <SUBSECTION Standard>
  909. GEDIT_TAB
  910. GEDIT_IS_TAB
  911. GEDIT_TYPE_TAB
  912. gedit_tab_get_type
  913. GEDIT_TAB_CLASS
  914. GEDIT_IS_TAB_CLASS
  915. GEDIT_TAB_GET_CLASS
  916. GEDIT_TYPE_TAB_STATE
  917. gedit_tab_state_get_type
  918. </SECTION>
  919. <SECTION>
  920. <FILE>gedit-view</FILE>
  921. GeditViewPrivate
  922. <TITLE>GeditView</TITLE>
  923. GeditView
  924. gedit_view_new
  925. +gedit_view_cut_clipboard
  926. +gedit_view_copy_clipboard
  927. +gedit_view_paste_clipboard
  928. +gedit_view_delete_selection
  929. +gedit_view_select_all
  930. +gedit_view_scroll_to_cursor
  931. +gedit_view_set_font
  932. <SUBSECTION Standard>
  933. GEDIT_VIEW
  934. GEDIT_IS_VIEW
  935. GEDIT_TYPE_VIEW
  936. gedit_view_get_type
  937. GEDIT_VIEW_CLASS
  938. GEDIT_IS_VIEW_CLASS
  939. GEDIT_VIEW_GET_CLASS
  940. </SECTION>
  941. <SECTION>
  942. <FILE>gedit-view-activatable</FILE>
  943. <TITLE>GeditViewActivatable</TITLE>
  944. GeditViewActivatable
  945. gedit_view_activatable_activate
  946. gedit_view_activatable_deactivate
  947. <SUBSECTION Standard>
  948. GEDIT_TYPE_VIEW_ACTIVATABLE
  949. GEDIT_VIEW_ACTIVATABLE
  950. GEDIT_VIEW_ACTIVATABLE_IFACE
  951. GEDIT_IS_VIEW_ACTIVATABLE
  952. GEDIT_VIEW_ACTIVATABLE_GET_IFACE
  953. gedit_view_activatable_get_type
  954. </SECTION>
  955. <SECTION>
  956. <FILE>gedit-window</FILE>
  957. <TITLE>GeditWindow</TITLE>
  958. GeditWindow
  959. GeditWindowState
  960. @@ -264,70 +294,76 @@ gedit_window_state_get_type
  961. <SECTION>
  962. <FILE>gedit-window-activatable</FILE>
  963. <TITLE>GeditWindowActivatable</TITLE>
  964. GeditWindowActivatable
  965. gedit_window_activatable_activate
  966. gedit_window_activatable_deactivate
  967. gedit_window_activatable_update_state
  968. <SUBSECTION Standard>
  969. GEDIT_TYPE_WINDOW_ACTIVATABLE
  970. GEDIT_WINDOW_ACTIVATABLE
  971. GEDIT_WINDOW_ACTIVATABLE_IFACE
  972. GEDIT_IS_WINDOW_ACTIVATABLE
  973. GEDIT_WINDOW_ACTIVATABLE_GET_IFACE
  974. gedit_window_activatable_get_type
  975. </SECTION>
  976. <SECTION>
  977. <FILE>gedit-debug</FILE>
  978. GeditDebugSection
  979. DEBUG_VIEW
  980. DEBUG_PREFS
  981. DEBUG_WINDOW
  982. DEBUG_PANEL
  983. DEBUG_PLUGINS
  984. DEBUG_TAB
  985. DEBUG_DOCUMENT
  986. DEBUG_COMMANDS
  987. DEBUG_APP
  988. DEBUG_UTILS
  989. +DEBUG_METADATA
  990. gedit_debug_init
  991. gedit_debug
  992. gedit_debug_message
  993. gedit_debug_plugin_message
  994. <SUBSECTION Standard>
  995. GEDIT_TYPE_DEBUG_SECTION
  996. gedit_debug_section_get_type
  997. </SECTION>
  998. <SECTION>
  999. <FILE>gedit-menu-extension</FILE>
  1000. GeditMenuExtension
  1001. gedit_menu_extension_new
  1002. gedit_menu_extension_append_menu_item
  1003. gedit_menu_extension_prepend_menu_item
  1004. gedit_menu_extension_remove_items
  1005. <SUBSECTION Standard>
  1006. GEDIT_IS_MENU_EXTENSION
  1007. GEDIT_IS_MENU_EXTENSION_CLASS
  1008. GEDIT_MENU_EXTENSION
  1009. GEDIT_MENU_EXTENSION_CLASS
  1010. GEDIT_MENU_EXTENSION_CONST
  1011. GEDIT_MENU_EXTENSION_GET_CLASS
  1012. GEDIT_TYPE_MENU_EXTENSION
  1013. GeditMenuExtensionClass
  1014. gedit_menu_extension_get_type
  1015. </SECTION>
  1016. <SECTION>
  1017. <FILE>gedit-utils</FILE>
  1018. +GBOOLEAN_TO_POINTER
  1019. +GPOINTER_TO_BOOLEAN
  1020. gedit_utils_menu_position_under_tree_view
  1021. gedit_utils_set_atk_name_description
  1022. +gedit_warning
  1023. +gedit_utils_replace_home_dir_with_tilde
  1024. gedit_utils_basename_for_display
  1025. +gedit_utils_decode_uri
  1026. gedit_utils_drop_get_uris
  1027. gedit_utils_get_compression_type_from_content_type
  1028. gedit_utils_is_valid_location
  1029. gedit_utils_location_get_dirname_for_display
  1030. gedit_utils_set_direct_save_filename
  1031. gedit_utils_newline_type_to_string
  1032. </SECTION>
  1033. diff --git a/docs/reference/meson.build b/docs/reference/meson.build
  1034. index 9a9c414dc..ed85f9cec 100644
  1035. --- a/docs/reference/meson.build
  1036. +++ b/docs/reference/meson.build
  1037. @@ -1,42 +1,38 @@
  1038. html_dir = get_option('prefix') / gnome.gtkdoc_html_dir('gedit')
  1039. glib_docpath = dependency('glib-2.0').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/glib'
  1040. gobject_docpath = dependency('gobject-2.0').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/gobject'
  1041. gio_docpath = dependency('gio-2.0').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/gio'
  1042. gdk_docpath = dependency('gdk-3.0').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/gdk3'
  1043. gtk_docpath = dependency('gtk+-3.0').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/gtk3'
  1044. gsv_docpath = dependency('gtksourceview-4').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/gtksourceview-4.0'
  1045. -amtk_docpath = dependency('amtk-5').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/amtk-5'
  1046. -tepl_docpath = dependency('tepl-6').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/tepl-6'
  1047. libpeas_docpath = dependency('libpeas-1.0').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/libpeas'
  1048. gedit_doc_dep = declare_dependency(
  1049. link_with: libgedit_shared_lib,
  1050. include_directories: root_include_dir,
  1051. - dependencies: deps_basic_list,
  1052. + dependencies: deps_basic_list + [libxml_dep],
  1053. )
  1054. gnome.gtkdoc(
  1055. 'gedit',
  1056. main_xml: 'gedit-docs.xml',
  1057. src_dir: include_directories('../../gedit/'),
  1058. dependencies: gedit_doc_dep,
  1059. scan_args: ['--rebuild-types'],
  1060. fixxref_args: [
  1061. '--html-dir=@0@'.format(html_dir),
  1062. '--extra-dir=@0@'.format(glib_docpath),
  1063. '--extra-dir=@0@'.format(gobject_docpath),
  1064. '--extra-dir=@0@'.format(gio_docpath),
  1065. '--extra-dir=@0@'.format(gdk_docpath),
  1066. '--extra-dir=@0@'.format(gtk_docpath),
  1067. '--extra-dir=@0@'.format(gsv_docpath),
  1068. - '--extra-dir=@0@'.format(amtk_docpath),
  1069. - '--extra-dir=@0@'.format(tepl_docpath),
  1070. '--extra-dir=@0@'.format(libpeas_docpath),
  1071. ],
  1072. content_files: [
  1073. 'api-breaks.xml'
  1074. ],
  1075. ignore_headers: libgedit_private_headers,
  1076. install: true,
  1077. )
  1078. diff --git a/docs/roadmap-done.md b/docs/roadmap-done.md
  1079. deleted file mode 100644
  1080. index 7f210e49b..000000000
  1081. --- a/docs/roadmap-done.md
  1082. +++ /dev/null
  1083. @@ -1,56 +0,0 @@
  1084. -gedit roadmap - done tasks
  1085. -==========================
  1086. -
  1087. -Tepl-ification of the gedit core
  1088. ---------------------------------
  1089. -
  1090. -- gedit 3.36:
  1091. - - Start to use the Tepl library.
  1092. - - Use some Tepl utility functions.
  1093. - - Use TeplFileMetadata, remove GeditMetadataManager.
  1094. -- gedit 3.38:
  1095. - - Move some utility functions to the Tepl library.
  1096. - - Refactor and move some I/O error infobars to Tepl.
  1097. - - GeditView now inherits from TeplView.
  1098. - - Port to the new Tepl metadata API.
  1099. - - Use TeplStyleSchemeChooserWidget in the preferences dialog.
  1100. - - Create GeditFactory class, subclass of TeplAbstractFactory.
  1101. -- gedit 40:
  1102. - - Use `tepl_pango_font_description_to_css()`.
  1103. - - Use TeplLanguageChooser's, for choosing a language for the syntax
  1104. - highlighting. Remove GeditHighlightModeSelector and
  1105. - GeditHighlightModeDialog.
  1106. - - Use TeplProgressInfoBar. Remove GeditProgressInfoBar.
  1107. - - GeditDocument now inherits from TeplBuffer, start to use the
  1108. - TeplBuffer and TeplFile APIs.
  1109. -
  1110. -Links:
  1111. -- https://wiki.gnome.org/Projects/Tepl
  1112. -
  1113. -Tepl-ification of the gedit plugins
  1114. ------------------------------------
  1115. -
  1116. -- gedit 40:
  1117. - - Draw Spaces plugin: new implementation based on TeplSpaceDrawerPrefs.
  1118. -
  1119. -Other done tasks in gedit plugins
  1120. ----------------------------------
  1121. -
  1122. -- gedit 40:
  1123. - - Smart Spaces plugin: new implementation based on a GtkSourceView
  1124. - feature.
  1125. -
  1126. -New version of gedit on Windows
  1127. --------------------------------
  1128. -
  1129. -[gedit is now available on the Microsoft Store](https://www.microsoft.com/store/apps/9PL1J21XF0PT).
  1130. -It was done during the GNOME 3.38 development cycle. The integration with
  1131. -Windows is not perfect, but it works. It is planned to improve gedit for
  1132. -Windows over time.
  1133. -
  1134. -Documentation for contributors
  1135. -------------------------------
  1136. -
  1137. -Write a guide to get started with gedit development.
  1138. -
  1139. -Done during the GNOME 3.34 development cycle.
  1140. diff --git a/docs/roadmap.md b/docs/roadmap.md
  1141. index 44a2f00b7..ec9445712 100644
  1142. --- a/docs/roadmap.md
  1143. +++ b/docs/roadmap.md
  1144. @@ -1,57 +1,40 @@
  1145. gedit roadmap
  1146. =============
  1147. This page contains the plans for major code changes we hope to get done in the
  1148. future.
  1149. -See the [roadmap-done.md](roadmap-done.md) file for done tasks.
  1150. +See also the [GtkSourceView](https://wiki.gnome.org/Projects/GtkSourceView/RoadMap).
  1151. See the [NEWS file](../NEWS) for a detailed history.
  1152. -See also the
  1153. -[Tepl roadmap](https://gitlab.gnome.org/GNOME/tepl/blob/master/docs/roadmap.md).
  1154. -
  1155. -Continue to make the gedit source code more re-usable
  1156. ------------------------------------------------------
  1157. -
  1158. -Status: **in progress** (this is an ongoing effort)
  1159. -
  1160. -Next steps:
  1161. -- Use more features from the Tepl library, and develop Tepl alongside gedit.
  1162. - The goal is to reduce the amount of code in gedit, by having re-usable code
  1163. - in Tepl instead.
  1164. -
  1165. -Links:
  1166. -- https://wiki.gnome.org/Apps/Gedit/ReusableCode
  1167. -- https://wiki.gnome.org/Projects/Tepl
  1168. -
  1169. Improve gedit on Windows
  1170. ------------------------
  1171. Status: **in progress**
  1172. [gedit is now available on the Microsoft Store](https://www.microsoft.com/store/apps/9PL1J21XF0PT).
  1173. The integration with Windows is not perfect, but it works. It is planned to
  1174. improve gedit for Windows over time.
  1175. Replace search and replace dialog window by an horizontal bar below the text
  1176. ----------------------------------------------------------------------------
  1177. Status: **todo**
  1178. To not hide the text.
  1179. Be able to quit the application with all documents saved, and restored on next start
  1180. ------------------------------------------------------------------------------------
  1181. Status: **todo**
  1182. Even for unsaved and untitled files, be able to quit gedit, restart it later and
  1183. come back to the state before with all tabs restored.
  1184. Improve the workflow for printing to paper
  1185. ------------------------------------------
  1186. Status: **todo**
  1187. Implement it like in Firefox, show first a preview of the file to print.
  1188. diff --git a/gedit/Gedit-3.0.metadata b/gedit/Gedit-3.0.metadata
  1189. index e36d7cb30..1a5b45a3a 100644
  1190. --- a/gedit/Gedit-3.0.metadata
  1191. +++ b/gedit/Gedit-3.0.metadata
  1192. @@ -1,23 +1,24 @@
  1193. App cheader_filename="gedit/gedit-app.h"
  1194. AppActivatable cheader_filename="gedit/gedit-app-activatable.h"
  1195. DebugSection cheader_filename="gedit/gedit-debug.h"
  1196. Document cheader_filename="gedit/gedit-document.h"
  1197. EncodingsComboBox cheader_filename="gedit/gedit-encodings-combo-box.h"
  1198. MenuExtension cheader_filename="gedit/gedit-menu-extension.h"
  1199. Message cheader_filename="gedit/gedit-message.h"
  1200. MessageBus cheader_filename="gedit/gedit-message-bus.h"
  1201. +ProgressInfoBar cheader_filename="gedit/gedit-progress-info-bar.h"
  1202. Statusbar cheader_filename="gedit/gedit-statusbar.h"
  1203. Tab cheader_filename="gedit/gedit-tab.h"
  1204. TabState cheader_filename="gedit/gedit-tab.h"
  1205. View cheader_filename="gedit/gedit-view.h"
  1206. ViewActivatable cheader_filename="gedit/gedit-view-activatable.h"
  1207. Window cheader_filename="gedit/gedit-window.h"
  1208. WindowActivatable cheader_filename="gedit/gedit-window-activatable.h"
  1209. WindowState cheader_filename="gedit/gedit-window.h"
  1210. commands_* cheader_filename="gedit/gedit-commands.h"
  1211. debug* cheader_filename="gedit/gedit-debug.h"
  1212. utils_* cheader_filename="gedit/gedit-utils.h"
  1213. MessageBusForeach cheader_filename="gedit/gedit-message-bus.h"
  1214. MessageCallback cheader_filename="gedit/gedit-message-bus.h"
  1215. diff --git a/gedit/gedit-app-osx.m b/gedit/gedit-app-osx.m
  1216. index b02e9a28b..5df1b94da 100644
  1217. --- a/gedit/gedit-app-osx.m
  1218. +++ b/gedit/gedit-app-osx.m
  1219. @@ -4,61 +4,61 @@
  1220. *
  1221. * Copyright (C) 2010 - Jesse van den Kieboom
  1222. *
  1223. * gedit is free software; you can redistribute it and/or modify
  1224. * it under the terms of the GNU General Public License as published by
  1225. * the Free Software Foundation; either version 2 of the License, or
  1226. * (at your option) any later version.
  1227. *
  1228. * gedit is distributed in the hope that it will be useful,
  1229. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1230. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1231. * GNU General Public License for more details.
  1232. *
  1233. * You should have received a copy of the GNU General Public License
  1234. * along with gedit; if not, write to the Free Software
  1235. * Foundation, Inc., 51 Franklin St, Fifth Floor,
  1236. * Boston, MA 02110-1301 USA
  1237. */
  1238. #include "gedit-app-osx.h"
  1239. #include <gdk/gdkquartz.h>
  1240. #include <string.h>
  1241. #include <glib/gi18n.h>
  1242. #include "gedit-app-private.h"
  1243. #include "gedit-dirs.h"
  1244. #include "gedit-debug.h"
  1245. #include "gedit-commands.h"
  1246. #include "gedit-commands-private.h"
  1247. -#include "gedit-recent-osx.h"
  1248. +#include "gedit-recent.h"
  1249. #import <AppKit/AppKit.h>
  1250. NSWindow *gdk_quartz_window_get_nswindow(GdkWindow *window);
  1251. NSEvent *gdk_quartz_event_get_nsevent(GdkEvent *event);
  1252. static GeditWindow *
  1253. ensure_window (GeditAppOSX *app,
  1254. gboolean with_empty_document)
  1255. {
  1256. GList *windows;
  1257. GeditWindow *ret = NULL;
  1258. windows = gtk_application_get_windows (GTK_APPLICATION (app));
  1259. while (windows)
  1260. {
  1261. GtkWindow *window;
  1262. GdkWindow *win;
  1263. NSWindow *nswin;
  1264. window = windows->data;
  1265. windows = g_list_next (windows);
  1266. if (!gtk_widget_get_realized (GTK_WIDGET (window)))
  1267. {
  1268. continue;
  1269. }
  1270. if (!GEDIT_IS_WINDOW (window))
  1271. {
  1272. @@ -259,61 +259,61 @@ gedit_app_osx_set_window_title_impl (GeditApp *app,
  1273. }
  1274. native = gdk_quartz_window_get_nswindow (wnd);
  1275. document = gedit_window_get_active_document (window);
  1276. if (document)
  1277. {
  1278. bool ismodified;
  1279. if (gedit_document_is_untitled (document))
  1280. {
  1281. [native setRepresentedURL:nil];
  1282. }
  1283. else
  1284. {
  1285. GtkSourceFile *file;
  1286. GFile *location;
  1287. gchar *uri;
  1288. file = gedit_document_get_file (document);
  1289. location = gtk_source_file_get_location (file);
  1290. uri = g_file_get_uri (location);
  1291. NSURL *nsurl = [NSURL URLWithString:[NSString stringWithUTF8String:uri]];
  1292. [native setRepresentedURL:nsurl];
  1293. g_free (uri);
  1294. }
  1295. - ismodified = !tepl_buffer_is_untouched (TEPL_BUFFER (document));
  1296. + ismodified = !gedit_document_is_untouched (document);
  1297. [native setDocumentEdited:ismodified];
  1298. }
  1299. else
  1300. {
  1301. [native setRepresentedURL:nil];
  1302. [native setDocumentEdited:false];
  1303. }
  1304. GEDIT_APP_CLASS (gedit_app_osx_parent_class)->set_window_title (app, window, title);
  1305. }
  1306. typedef struct
  1307. {
  1308. GeditAppOSX *app;
  1309. GtkRecentInfo *info;
  1310. } RecentFileInfo;
  1311. static void
  1312. recent_file_info_free (gpointer data,
  1313. GClosure *closure)
  1314. {
  1315. RecentFileInfo *info = data;
  1316. g_object_unref (info->app);
  1317. gtk_recent_info_unref (info->info);
  1318. g_slice_free (RecentFileInfo, data);
  1319. }
  1320. static void
  1321. diff --git a/gedit/gedit-app-private.h b/gedit/gedit-app-private.h
  1322. index 6e1278a3b..e9c58cc27 100644
  1323. --- a/gedit/gedit-app-private.h
  1324. +++ b/gedit/gedit-app-private.h
  1325. @@ -1,52 +1,55 @@
  1326. /*
  1327. * gedit-app-private.h
  1328. * This file is part of gedit
  1329. *
  1330. * Copyright (C) 2015 - Sébastien Wilmet <swilmet@gnome.org>
  1331. *
  1332. * This program is free software; you can redistribute it and/or modify
  1333. * it under the terms of the GNU General Public License as published by
  1334. * the Free Software Foundation; either version 2 of the License, or
  1335. * (at your option) any later version.
  1336. *
  1337. * This program is distributed in the hope that it will be useful,
  1338. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1339. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1340. * GNU General Public License for more details.
  1341. *
  1342. * You should have received a copy of the GNU General Public License
  1343. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  1344. */
  1345. #ifndef GEDIT_APP_PRIVATE_H
  1346. #define GEDIT_APP_PRIVATE_H
  1347. #include "gedit-app.h"
  1348. +#include "gedit-metadata-manager.h"
  1349. #include "gedit-menu-extension.h"
  1350. G_BEGIN_DECLS
  1351. /* global print config */
  1352. GtkPageSetup *_gedit_app_get_default_page_setup (GeditApp *app);
  1353. void _gedit_app_set_default_page_setup (GeditApp *app,
  1354. GtkPageSetup *page_setup);
  1355. GtkPrintSettings *_gedit_app_get_default_print_settings (GeditApp *app);
  1356. void _gedit_app_set_default_print_settings (GeditApp *app,
  1357. GtkPrintSettings *settings);
  1358. +GeditMetadataManager *_gedit_app_get_metadata_manager (GeditApp *app);
  1359. +
  1360. GMenuModel *_gedit_app_get_hamburger_menu (GeditApp *app);
  1361. GMenuModel *_gedit_app_get_notebook_menu (GeditApp *app);
  1362. GMenuModel *_gedit_app_get_tab_width_menu (GeditApp *app);
  1363. GMenuModel *_gedit_app_get_line_col_menu (GeditApp *app);
  1364. GeditMenuExtension *_gedit_app_extend_menu (GeditApp *app,
  1365. const gchar *extension_point);
  1366. G_END_DECLS
  1367. #endif /* GEDIT_APP_PRIVATE_H */
  1368. /* ex:set ts=8 noet: */
  1369. diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
  1370. index 5532d5975..27d71a87a 100644
  1371. --- a/gedit/gedit-app.c
  1372. +++ b/gedit/gedit-app.c
  1373. @@ -1,83 +1,92 @@
  1374. /*
  1375. * gedit-app.c
  1376. * This file is part of gedit
  1377. *
  1378. * Copyright (C) 2005-2006 - Paolo Maggi
  1379. *
  1380. * This program is free software; you can redistribute it and/or modify
  1381. * it under the terms of the GNU General Public License as published by
  1382. * the Free Software Foundation; either version 2 of the License, or
  1383. * (at your option) any later version.
  1384. *
  1385. * This program is distributed in the hope that it will be useful,
  1386. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1387. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1388. * GNU General Public License for more details.
  1389. *
  1390. * You should have received a copy of the GNU General Public License
  1391. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  1392. */
  1393. #include "config.h"
  1394. #include "gedit-app.h"
  1395. #include "gedit-app-private.h"
  1396. #include <string.h>
  1397. #include <unistd.h>
  1398. #include <stdlib.h>
  1399. #include <glib/gi18n.h>
  1400. +#include <gio/gio.h>
  1401. #include <libpeas/peas-extension-set.h>
  1402. -#include <tepl/tepl.h>
  1403. +#include <gtksourceview/gtksource.h>
  1404. #include "gedit-commands-private.h"
  1405. #include "gedit-notebook.h"
  1406. #include "gedit-debug.h"
  1407. #include "gedit-utils.h"
  1408. #include "gedit-enum-types.h"
  1409. #include "gedit-dirs.h"
  1410. #include "gedit-settings.h"
  1411. #include "gedit-app-activatable.h"
  1412. #include "gedit-plugins-engine.h"
  1413. #include "gedit-commands.h"
  1414. #include "gedit-preferences-dialog.h"
  1415. #include "gedit-tab.h"
  1416. +#ifndef ENABLE_GVFS_METADATA
  1417. +#include "gedit-metadata-manager.h"
  1418. +#endif
  1419. +
  1420. #define GEDIT_PAGE_SETUP_FILE "gedit-page-setup"
  1421. #define GEDIT_PRINT_SETTINGS_FILE "gedit-print-settings"
  1422. typedef struct
  1423. {
  1424. GeditPluginsEngine *engine;
  1425. +#ifndef ENABLE_GVFS_METADATA
  1426. + GeditMetadataManager *metadata_manager;
  1427. +#endif
  1428. +
  1429. GtkCssProvider *theme_provider;
  1430. GtkPageSetup *page_setup;
  1431. GtkPrintSettings *print_settings;
  1432. GSettings *ui_settings;
  1433. GSettings *window_settings;
  1434. GMenuModel *hamburger_menu;
  1435. GMenuModel *notebook_menu;
  1436. GMenuModel *tab_width_menu;
  1437. GMenuModel *line_col_menu;
  1438. PeasExtensionSet *extensions;
  1439. /* command line parsing */
  1440. gboolean new_window;
  1441. gboolean new_document;
  1442. const GtkSourceEncoding *encoding;
  1443. GInputStream *stdin_stream;
  1444. GSList *file_list;
  1445. gint line_position;
  1446. gint column_position;
  1447. GApplicationCommandLine *command_line;
  1448. } GeditAppPrivate;
  1449. static const GOptionEntry options[] =
  1450. {
  1451. /* Version */
  1452. {
  1453. @@ -118,60 +127,64 @@ static const GOptionEntry options[] =
  1454. "wait", 'w', 0, G_OPTION_ARG_NONE, NULL,
  1455. N_("Open files and block process until files are closed"),
  1456. NULL
  1457. },
  1458. /* New instance */
  1459. {
  1460. "standalone", 's', 0, G_OPTION_ARG_NONE, NULL,
  1461. N_("Run gedit in standalone mode"),
  1462. NULL
  1463. },
  1464. /* collects file arguments */
  1465. {
  1466. G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, NULL, NULL,
  1467. N_("[FILE…] [+LINE[:COLUMN]]")
  1468. },
  1469. {NULL}
  1470. };
  1471. G_DEFINE_TYPE_WITH_PRIVATE (GeditApp, gedit_app, GTK_TYPE_APPLICATION)
  1472. static void
  1473. gedit_app_dispose (GObject *object)
  1474. {
  1475. GeditAppPrivate *priv;
  1476. priv = gedit_app_get_instance_private (GEDIT_APP (object));
  1477. +#ifndef ENABLE_GVFS_METADATA
  1478. + g_clear_object (&priv->metadata_manager);
  1479. +#endif
  1480. +
  1481. g_clear_object (&priv->ui_settings);
  1482. g_clear_object (&priv->window_settings);
  1483. g_clear_object (&priv->page_setup);
  1484. g_clear_object (&priv->print_settings);
  1485. /* Note that unreffing the extensions will automatically remove
  1486. * all extensions which in turn will deactivate the extension
  1487. */
  1488. g_clear_object (&priv->extensions);
  1489. g_clear_object (&priv->engine);
  1490. if (priv->theme_provider != NULL)
  1491. {
  1492. gtk_style_context_remove_provider_for_screen (gdk_screen_get_default (),
  1493. GTK_STYLE_PROVIDER (priv->theme_provider));
  1494. g_clear_object (&priv->theme_provider);
  1495. }
  1496. g_clear_object (&priv->hamburger_menu);
  1497. g_clear_object (&priv->notebook_menu);
  1498. g_clear_object (&priv->tab_width_menu);
  1499. g_clear_object (&priv->line_col_menu);
  1500. G_OBJECT_CLASS (gedit_app_parent_class)->dispose (object);
  1501. }
  1502. static gchar *
  1503. gedit_app_help_link_id_impl (GeditApp *app,
  1504. @@ -616,71 +629,82 @@ add_accelerator (GtkApplication *app,
  1505. const gchar *action_name,
  1506. const gchar *accel)
  1507. {
  1508. const gchar *vaccels[] = {
  1509. accel,
  1510. NULL
  1511. };
  1512. gtk_application_set_accels_for_action (app, action_name, vaccels);
  1513. }
  1514. static gboolean
  1515. show_menubar (void)
  1516. {
  1517. GtkSettings *settings = gtk_settings_get_default ();
  1518. gboolean result;
  1519. g_object_get (settings,
  1520. "gtk-shell-shows-menubar", &result,
  1521. NULL);
  1522. return result;
  1523. }
  1524. static void
  1525. gedit_app_startup (GApplication *application)
  1526. {
  1527. GeditAppPrivate *priv;
  1528. GtkCssProvider *css_provider;
  1529. GtkSourceStyleSchemeManager *manager;
  1530. +#ifndef ENABLE_GVFS_METADATA
  1531. + const gchar *cache_dir;
  1532. + gchar *metadata_filename;
  1533. +#endif
  1534. priv = gedit_app_get_instance_private (GEDIT_APP (application));
  1535. G_APPLICATION_CLASS (gedit_app_parent_class)->startup (application);
  1536. /* Setup debugging */
  1537. gedit_debug_init ();
  1538. gedit_debug_message (DEBUG_APP, "Startup");
  1539. setup_theme_extensions (GEDIT_APP (application));
  1540. +#ifndef ENABLE_GVFS_METADATA
  1541. + cache_dir = gedit_dirs_get_user_cache_dir ();
  1542. + metadata_filename = g_build_filename (cache_dir, "gedit-metadata.xml", NULL);
  1543. + priv->metadata_manager = gedit_metadata_manager_new (metadata_filename);
  1544. + g_free (metadata_filename);
  1545. +#endif
  1546. +
  1547. /* Load/init settings */
  1548. _gedit_settings_get_singleton ();
  1549. priv->ui_settings = g_settings_new ("org.gnome.gedit.preferences.ui");
  1550. priv->window_settings = g_settings_new ("org.gnome.gedit.state.window");
  1551. g_action_map_add_action_entries (G_ACTION_MAP (application),
  1552. app_entries,
  1553. G_N_ELEMENTS (app_entries),
  1554. application);
  1555. /* menus */
  1556. if (!show_menubar ())
  1557. {
  1558. gtk_application_set_menubar (GTK_APPLICATION (application), NULL);
  1559. priv->hamburger_menu = get_menu_model (GEDIT_APP (application),
  1560. "hamburger-menu");
  1561. }
  1562. priv->notebook_menu = get_menu_model (GEDIT_APP (application), "notebook-menu");
  1563. priv->tab_width_menu = get_menu_model (GEDIT_APP (application), "tab-width-menu");
  1564. priv->line_col_menu = get_menu_model (GEDIT_APP (application), "line-col-menu");
  1565. /* Accelerators */
  1566. add_accelerator (GTK_APPLICATION (application), "app.new-window", "<Primary>N");
  1567. add_accelerator (GTK_APPLICATION (application), "app.quit", "<Primary>Q");
  1568. add_accelerator (GTK_APPLICATION (application), "app.help", "F1");
  1569. add_accelerator (GTK_APPLICATION (application), "app.shortcuts", "<Primary>question");
  1570. add_accelerator (GTK_APPLICATION (application), "win.hamburger-menu", "F10");
  1571. add_accelerator (GTK_APPLICATION (application), "win.open", "<Primary>O");
  1572. @@ -1087,60 +1111,64 @@ save_print_settings (GeditApp *app)
  1573. gchar *filename;
  1574. GError *error = NULL;
  1575. filename = get_print_settings_file ();
  1576. gtk_print_settings_to_file (priv->print_settings,
  1577. filename,
  1578. &error);
  1579. if (error)
  1580. {
  1581. g_warning ("%s", error->message);
  1582. g_error_free (error);
  1583. }
  1584. g_free (filename);
  1585. }
  1586. }
  1587. static void
  1588. gedit_app_shutdown (GApplication *app)
  1589. {
  1590. gedit_debug_message (DEBUG_APP, "Quitting\n");
  1591. /* Last window is gone... save some settings and exit */
  1592. ensure_user_config_dir ();
  1593. save_accels ();
  1594. save_page_setup (GEDIT_APP (app));
  1595. save_print_settings (GEDIT_APP (app));
  1596. + /* GTK+ can still hold references to some gedit objects, for example
  1597. + * GeditDocument for the clipboard. So the metadata-manager should be
  1598. + * shutdown after.
  1599. + */
  1600. G_APPLICATION_CLASS (gedit_app_parent_class)->shutdown (app);
  1601. }
  1602. static gboolean
  1603. window_delete_event (GeditWindow *window,
  1604. GdkEvent *event,
  1605. GeditApp *app)
  1606. {
  1607. GeditWindowState ws;
  1608. ws = gedit_window_get_state (window);
  1609. if (ws &
  1610. (GEDIT_WINDOW_STATE_SAVING | GEDIT_WINDOW_STATE_PRINTING))
  1611. {
  1612. return TRUE;
  1613. }
  1614. _gedit_cmd_file_quit (NULL, NULL, window);
  1615. /* Do not destroy the window */
  1616. return TRUE;
  1617. }
  1618. static GeditWindow *
  1619. gedit_app_create_window_impl (GeditApp *app)
  1620. {
  1621. GeditWindow *window;
  1622. window = g_object_new (GEDIT_TYPE_WINDOW, "application", app, NULL);
  1623. @@ -1226,69 +1254,64 @@ load_print_settings (GeditApp *app)
  1624. priv->print_settings = gtk_print_settings_new_from_file (filename, &error);
  1625. if (error != NULL)
  1626. {
  1627. /* - Ignore file not found error.
  1628. * - Ignore empty file error, i.e. group not found. This happens
  1629. * when we click on cancel in the print dialog, when using the
  1630. * printing for the first time in gedit.
  1631. */
  1632. if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT) &&
  1633. !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND))
  1634. {
  1635. g_warning ("Load print settings error: %s", error->message);
  1636. }
  1637. g_error_free (error);
  1638. }
  1639. g_free (filename);
  1640. /* fall back to default settings */
  1641. if (priv->print_settings == NULL)
  1642. {
  1643. priv->print_settings = gtk_print_settings_new ();
  1644. }
  1645. }
  1646. static void
  1647. gedit_app_init (GeditApp *app)
  1648. {
  1649. - TeplApplication *tepl_app;
  1650. -
  1651. g_set_application_name ("gedit");
  1652. gtk_window_set_default_icon_name ("org.gnome.gedit");
  1653. g_application_add_main_option_entries (G_APPLICATION (app), options);
  1654. -
  1655. - tepl_app = tepl_application_get_from_gtk_application (GTK_APPLICATION (app));
  1656. - tepl_application_handle_metadata (tepl_app);
  1657. }
  1658. /**
  1659. * gedit_app_create_window:
  1660. * @app: the #GeditApp
  1661. * @screen: (allow-none):
  1662. *
  1663. * Create a new #GeditWindow part of @app.
  1664. *
  1665. * Return value: (transfer none): the new #GeditWindow
  1666. */
  1667. GeditWindow *
  1668. gedit_app_create_window (GeditApp *app,
  1669. GdkScreen *screen)
  1670. {
  1671. GeditAppPrivate *priv;
  1672. GeditWindow *window;
  1673. GdkWindowState state;
  1674. gint w, h;
  1675. gedit_debug (DEBUG_APP);
  1676. priv = gedit_app_get_instance_private (app);
  1677. window = GEDIT_APP_GET_CLASS (app)->create_window (app);
  1678. if (screen != NULL)
  1679. {
  1680. gtk_window_set_screen (GTK_WINDOW (window), screen);
  1681. }
  1682. @@ -1544,60 +1567,79 @@ _gedit_app_get_default_print_settings (GeditApp *app)
  1683. priv = gedit_app_get_instance_private (app);
  1684. if (priv->print_settings == NULL)
  1685. {
  1686. load_print_settings (app);
  1687. }
  1688. return gtk_print_settings_copy (priv->print_settings);
  1689. }
  1690. void
  1691. _gedit_app_set_default_print_settings (GeditApp *app,
  1692. GtkPrintSettings *settings)
  1693. {
  1694. GeditAppPrivate *priv;
  1695. g_return_if_fail (GEDIT_IS_APP (app));
  1696. g_return_if_fail (GTK_IS_PRINT_SETTINGS (settings));
  1697. priv = gedit_app_get_instance_private (app);
  1698. if (priv->print_settings != NULL)
  1699. {
  1700. g_object_unref (priv->print_settings);
  1701. }
  1702. priv->print_settings = g_object_ref (settings);
  1703. }
  1704. +
  1705. +GeditMetadataManager *
  1706. +_gedit_app_get_metadata_manager (GeditApp *app)
  1707. +{
  1708. +#ifndef ENABLE_GVFS_METADATA
  1709. + GeditAppPrivate *priv;
  1710. +
  1711. + g_return_val_if_fail (GEDIT_IS_APP (app), NULL);
  1712. +
  1713. + priv = gedit_app_get_instance_private (app);
  1714. +
  1715. + return priv->metadata_manager;
  1716. +#else
  1717. + g_assert_not_reached ();
  1718. + return NULL;
  1719. +#endif
  1720. +}
  1721. +
  1722. +
  1723. GMenuModel *
  1724. _gedit_app_get_hamburger_menu (GeditApp *app)
  1725. {
  1726. GeditAppPrivate *priv;
  1727. g_return_val_if_fail (GEDIT_IS_APP (app), NULL);
  1728. priv = gedit_app_get_instance_private (app);
  1729. return priv->hamburger_menu;
  1730. }
  1731. GMenuModel *
  1732. _gedit_app_get_notebook_menu (GeditApp *app)
  1733. {
  1734. GeditAppPrivate *priv;
  1735. g_return_val_if_fail (GEDIT_IS_APP (app), NULL);
  1736. priv = gedit_app_get_instance_private (app);
  1737. return priv->notebook_menu;
  1738. }
  1739. GMenuModel *
  1740. _gedit_app_get_tab_width_menu (GeditApp *app)
  1741. {
  1742. GeditAppPrivate *priv;
  1743. g_return_val_if_fail (GEDIT_IS_APP (app), NULL);
  1744. diff --git a/gedit/gedit-commands-edit.c b/gedit/gedit-commands-edit.c
  1745. index 66ea0174b..978440150 100644
  1746. --- a/gedit/gedit-commands-edit.c
  1747. +++ b/gedit/gedit-commands-edit.c
  1748. @@ -17,180 +17,180 @@
  1749. * GNU General Public License for more details.
  1750. *
  1751. * You should have received a copy of the GNU General Public License
  1752. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  1753. */
  1754. #include "config.h"
  1755. #include "gedit-commands.h"
  1756. #include "gedit-commands-private.h"
  1757. #include <gtk/gtk.h>
  1758. #include "gedit-window.h"
  1759. #include "gedit-debug.h"
  1760. #include "gedit-view.h"
  1761. #include "gedit-preferences-dialog.h"
  1762. void
  1763. _gedit_cmd_edit_undo (GSimpleAction *action,
  1764. GVariant *parameter,
  1765. gpointer user_data)
  1766. {
  1767. GeditWindow *window = GEDIT_WINDOW (user_data);
  1768. GeditView *active_view;
  1769. GtkSourceBuffer *active_document;
  1770. gedit_debug (DEBUG_COMMANDS);
  1771. active_view = gedit_window_get_active_view (window);
  1772. - g_return_if_fail (active_view != NULL);
  1773. + g_return_if_fail (active_view);
  1774. active_document = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (active_view)));
  1775. gtk_source_buffer_undo (active_document);
  1776. - tepl_view_scroll_to_cursor (TEPL_VIEW (active_view));
  1777. + gedit_view_scroll_to_cursor (active_view);
  1778. gtk_widget_grab_focus (GTK_WIDGET (active_view));
  1779. }
  1780. void
  1781. _gedit_cmd_edit_redo (GSimpleAction *action,
  1782. GVariant *parameter,
  1783. gpointer user_data)
  1784. {
  1785. GeditWindow *window = GEDIT_WINDOW (user_data);
  1786. GeditView *active_view;
  1787. GtkSourceBuffer *active_document;
  1788. gedit_debug (DEBUG_COMMANDS);
  1789. active_view = gedit_window_get_active_view (window);
  1790. - g_return_if_fail (active_view != NULL);
  1791. + g_return_if_fail (active_view);
  1792. active_document = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (active_view)));
  1793. gtk_source_buffer_redo (active_document);
  1794. - tepl_view_scroll_to_cursor (TEPL_VIEW (active_view));
  1795. + gedit_view_scroll_to_cursor (active_view);
  1796. gtk_widget_grab_focus (GTK_WIDGET (active_view));
  1797. }
  1798. void
  1799. _gedit_cmd_edit_cut (GSimpleAction *action,
  1800. GVariant *parameter,
  1801. gpointer user_data)
  1802. {
  1803. GeditWindow *window = GEDIT_WINDOW (user_data);
  1804. GeditView *active_view;
  1805. gedit_debug (DEBUG_COMMANDS);
  1806. active_view = gedit_window_get_active_view (window);
  1807. - g_return_if_fail (active_view != NULL);
  1808. + g_return_if_fail (active_view);
  1809. - tepl_view_cut_clipboard (TEPL_VIEW (active_view));
  1810. + gedit_view_cut_clipboard (active_view);
  1811. gtk_widget_grab_focus (GTK_WIDGET (active_view));
  1812. }
  1813. void
  1814. _gedit_cmd_edit_copy (GSimpleAction *action,
  1815. GVariant *parameter,
  1816. gpointer user_data)
  1817. {
  1818. GeditWindow *window = GEDIT_WINDOW (user_data);
  1819. GeditView *active_view;
  1820. gedit_debug (DEBUG_COMMANDS);
  1821. active_view = gedit_window_get_active_view (window);
  1822. - g_return_if_fail (active_view != NULL);
  1823. + g_return_if_fail (active_view);
  1824. - tepl_view_copy_clipboard (TEPL_VIEW (active_view));
  1825. + gedit_view_copy_clipboard (active_view);
  1826. gtk_widget_grab_focus (GTK_WIDGET (active_view));
  1827. }
  1828. void
  1829. _gedit_cmd_edit_paste (GSimpleAction *action,
  1830. GVariant *parameter,
  1831. gpointer user_data)
  1832. {
  1833. GeditWindow *window = GEDIT_WINDOW (user_data);
  1834. GeditView *active_view;
  1835. gedit_debug (DEBUG_COMMANDS);
  1836. active_view = gedit_window_get_active_view (window);
  1837. - g_return_if_fail (active_view != NULL);
  1838. + g_return_if_fail (active_view);
  1839. - tepl_view_paste_clipboard (TEPL_VIEW (active_view));
  1840. + gedit_view_paste_clipboard (active_view);
  1841. gtk_widget_grab_focus (GTK_WIDGET (active_view));
  1842. }
  1843. void
  1844. _gedit_cmd_edit_delete (GSimpleAction *action,
  1845. GVariant *parameter,
  1846. gpointer user_data)
  1847. {
  1848. GeditWindow *window = GEDIT_WINDOW (user_data);
  1849. GeditView *active_view;
  1850. gedit_debug (DEBUG_COMMANDS);
  1851. active_view = gedit_window_get_active_view (window);
  1852. - g_return_if_fail (active_view != NULL);
  1853. + g_return_if_fail (active_view);
  1854. - tepl_view_delete_selection (TEPL_VIEW (active_view));
  1855. + gedit_view_delete_selection (active_view);
  1856. gtk_widget_grab_focus (GTK_WIDGET (active_view));
  1857. }
  1858. void
  1859. _gedit_cmd_edit_select_all (GSimpleAction *action,
  1860. GVariant *parameter,
  1861. gpointer user_data)
  1862. {
  1863. GeditWindow *window = GEDIT_WINDOW (user_data);
  1864. GeditView *active_view;
  1865. gedit_debug (DEBUG_COMMANDS);
  1866. active_view = gedit_window_get_active_view (window);
  1867. - g_return_if_fail (active_view != NULL);
  1868. + g_return_if_fail (active_view);
  1869. - tepl_view_select_all (TEPL_VIEW (active_view));
  1870. + gedit_view_select_all (active_view);
  1871. gtk_widget_grab_focus (GTK_WIDGET (active_view));
  1872. }
  1873. void
  1874. _gedit_cmd_edit_preferences (GSimpleAction *action,
  1875. GVariant *parameter,
  1876. gpointer user_data)
  1877. {
  1878. GeditWindow *window = GEDIT_WINDOW (user_data);
  1879. gedit_debug (DEBUG_COMMANDS);
  1880. gedit_show_preferences_dialog (window);
  1881. }
  1882. void
  1883. _gedit_cmd_edit_overwrite_mode (GSimpleAction *action,
  1884. GVariant *state,
  1885. gpointer user_data)
  1886. {
  1887. GeditWindow *window = GEDIT_WINDOW (user_data);
  1888. GeditView *active_view;
  1889. gboolean overwrite;
  1890. gedit_debug (DEBUG_COMMANDS);
  1891. active_view = gedit_window_get_active_view (window);
  1892. g_return_if_fail (active_view);
  1893. diff --git a/gedit/gedit-commands-file.c b/gedit/gedit-commands-file.c
  1894. index fb64f880d..d1d440a3e 100644
  1895. --- a/gedit/gedit-commands-file.c
  1896. +++ b/gedit/gedit-commands-file.c
  1897. @@ -1,80 +1,75 @@
  1898. /*
  1899. * gedit-commands-file.c
  1900. * This file is part of gedit
  1901. *
  1902. * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
  1903. * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
  1904. * Copyright (C) 2002-2005 Paolo Maggi
  1905. * Copyright (C) 2014 Sébastien Wilmet
  1906. *
  1907. * This program is free software; you can redistribute it and/or modify
  1908. * it under the terms of the GNU General Public License as published by
  1909. * the Free Software Foundation; either version 2 of the License, or
  1910. * (at your option) any later version.
  1911. *
  1912. * This program is distributed in the hope that it will be useful,
  1913. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1914. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1915. * GNU General Public License for more details.
  1916. *
  1917. * You should have received a copy of the GNU General Public License
  1918. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  1919. */
  1920. #include "config.h"
  1921. #include "gedit-commands.h"
  1922. #include "gedit-commands-private.h"
  1923. #include <glib/gi18n.h>
  1924. -#include <tepl/tepl.h>
  1925. #include "gedit-app.h"
  1926. #include "gedit-debug.h"
  1927. #include "gedit-document.h"
  1928. #include "gedit-document-private.h"
  1929. #include "gedit-tab.h"
  1930. #include "gedit-tab-private.h"
  1931. #include "gedit-window.h"
  1932. #include "gedit-window-private.h"
  1933. #include "gedit-notebook.h"
  1934. #include "gedit-statusbar.h"
  1935. #include "gedit-utils.h"
  1936. #include "gedit-file-chooser-dialog.h"
  1937. #include "gedit-file-chooser-open.h"
  1938. #include "gedit-close-confirmation-dialog.h"
  1939. -/* useful macro */
  1940. -#define GBOOLEAN_TO_POINTER(i) (GINT_TO_POINTER ((i) ? 2 : 1))
  1941. -#define GPOINTER_TO_BOOLEAN(i) ((gboolean) ((GPOINTER_TO_INT(i) == 2) ? TRUE : FALSE))
  1942. -
  1943. #define GEDIT_IS_CLOSING_ALL "gedit-is-closing-all"
  1944. #define GEDIT_NOTEBOOK_TO_CLOSE "gedit-notebook-to-close"
  1945. #define GEDIT_IS_QUITTING "gedit-is-quitting"
  1946. #define GEDIT_IS_QUITTING_ALL "gedit-is-quitting-all"
  1947. void
  1948. _gedit_cmd_file_new (GSimpleAction *action,
  1949. GVariant *parameter,
  1950. gpointer user_data)
  1951. {
  1952. GeditWindow *window = GEDIT_WINDOW (user_data);
  1953. gedit_debug (DEBUG_COMMANDS);
  1954. gedit_window_create_tab (window, TRUE);
  1955. }
  1956. static GeditTab *
  1957. get_tab_from_file (GList *docs,
  1958. GFile *file)
  1959. {
  1960. GList *l;
  1961. for (l = docs; l != NULL; l = l->next)
  1962. {
  1963. GeditDocument *doc;
  1964. GtkSourceFile *source_file;
  1965. GFile *location;
  1966. doc = l->data;
  1967. @@ -123,105 +118,107 @@ load_file_list (GeditWindow *window,
  1968. gboolean jump_to = TRUE; /* Whether to jump to the new tab */
  1969. const GSList *l;
  1970. gint num_loaded_files = 0;
  1971. gedit_debug (DEBUG_COMMANDS);
  1972. win_docs = gedit_window_get_documents (window);
  1973. /* Remove the files corresponding to documents already opened in
  1974. * "window" and remove duplicates from the "files" list.
  1975. */
  1976. for (l = files; l != NULL; l = l->next)
  1977. {
  1978. GFile *file = l->data;
  1979. if (is_duplicated_file (files_to_load, file))
  1980. {
  1981. continue;
  1982. }
  1983. tab = get_tab_from_file (win_docs, file);
  1984. if (tab == NULL)
  1985. {
  1986. files_to_load = g_slist_prepend (files_to_load, file);
  1987. }
  1988. else
  1989. {
  1990. if (l == files)
  1991. {
  1992. - TeplView *view;
  1993. + GeditDocument *doc;
  1994. gedit_window_set_active_tab (window, tab);
  1995. jump_to = FALSE;
  1996. - view = TEPL_VIEW (gedit_tab_get_view (tab));
  1997. + doc = gedit_tab_get_document (tab);
  1998. if (line_pos > 0)
  1999. {
  2000. if (column_pos > 0)
  2001. {
  2002. - tepl_view_goto_line_offset (view,
  2003. - line_pos - 1,
  2004. - column_pos - 1);
  2005. + gedit_document_goto_line_offset (doc,
  2006. + line_pos - 1,
  2007. + column_pos - 1);
  2008. }
  2009. else
  2010. {
  2011. - tepl_view_goto_line (view, line_pos - 1);
  2012. + gedit_document_goto_line (doc, line_pos - 1);
  2013. }
  2014. +
  2015. + gedit_view_scroll_to_cursor (gedit_tab_get_view (tab));
  2016. }
  2017. }
  2018. ++num_loaded_files;
  2019. loaded_files = g_slist_prepend (loaded_files,
  2020. gedit_tab_get_document (tab));
  2021. }
  2022. }
  2023. g_list_free (win_docs);
  2024. if (files_to_load == NULL)
  2025. {
  2026. return g_slist_reverse (loaded_files);
  2027. }
  2028. files_to_load = g_slist_reverse (files_to_load);
  2029. l = files_to_load;
  2030. tab = gedit_window_get_active_tab (window);
  2031. if (tab != NULL)
  2032. {
  2033. GeditDocument *doc;
  2034. doc = gedit_tab_get_document (tab);
  2035. - if (tepl_buffer_is_untouched (TEPL_BUFFER (doc)) &&
  2036. + if (gedit_document_is_untouched (doc) &&
  2037. gedit_tab_get_state (tab) == GEDIT_TAB_STATE_NORMAL)
  2038. {
  2039. _gedit_tab_load (tab,
  2040. l->data,
  2041. encoding,
  2042. line_pos,
  2043. column_pos,
  2044. create);
  2045. /* make sure the view has focus */
  2046. gtk_widget_grab_focus (GTK_WIDGET (gedit_tab_get_view (tab)));
  2047. l = g_slist_next (l);
  2048. jump_to = FALSE;
  2049. ++num_loaded_files;
  2050. loaded_files = g_slist_prepend (loaded_files,
  2051. gedit_tab_get_document (tab));
  2052. }
  2053. }
  2054. while (l != NULL)
  2055. {
  2056. g_return_val_if_fail (l->data != NULL, NULL);
  2057. tab = gedit_window_create_tab_from_location (window,
  2058. l->data,
  2059. encoding,
  2060. line_pos,
  2061. column_pos,
  2062. @@ -446,113 +443,113 @@ _gedit_cmd_file_reopen_closed_tab (GSimpleAction *action,
  2063. GFile *file;
  2064. file = _gedit_window_pop_last_closed_doc (window);
  2065. if (file != NULL)
  2066. {
  2067. gedit_commands_load_location (window, file, NULL, 0, 0);
  2068. }
  2069. }
  2070. /* File saving */
  2071. /* FIXME: modify this dialog to be similar to the one provided by gtk+ for
  2072. * already existing files - Paolo (Oct. 11, 2005) */
  2073. static gboolean
  2074. replace_read_only_file (GtkWindow *parent,
  2075. GFile *file)
  2076. {
  2077. GtkWidget *dialog;
  2078. gint ret;
  2079. gchar *parse_name;
  2080. gchar *name_for_display;
  2081. gedit_debug (DEBUG_COMMANDS);
  2082. parse_name = g_file_get_parse_name (file);
  2083. /* Truncate the name so it doesn't get insanely wide. Note that even
  2084. * though the dialog uses wrapped text, if the name doesn't contain
  2085. * white space then the text-wrapping code is too stupid to wrap it.
  2086. */
  2087. - name_for_display = tepl_utils_str_middle_truncate (parse_name, 50);
  2088. + name_for_display = gedit_utils_str_middle_truncate (parse_name, 50);
  2089. g_free (parse_name);
  2090. dialog = gtk_message_dialog_new (parent,
  2091. GTK_DIALOG_DESTROY_WITH_PARENT,
  2092. GTK_MESSAGE_QUESTION,
  2093. GTK_BUTTONS_NONE,
  2094. _("The file “%s” is read-only."),
  2095. name_for_display);
  2096. g_free (name_for_display);
  2097. gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
  2098. _("Do you want to try to replace it "
  2099. "with the one you are saving?"));
  2100. gtk_dialog_add_buttons (GTK_DIALOG (dialog),
  2101. _("_Cancel"), GTK_RESPONSE_CANCEL,
  2102. _("_Replace"), GTK_RESPONSE_YES,
  2103. NULL);
  2104. gtk_dialog_set_default_response (GTK_DIALOG (dialog),
  2105. GTK_RESPONSE_CANCEL);
  2106. gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
  2107. ret = gtk_dialog_run (GTK_DIALOG (dialog));
  2108. gtk_widget_destroy (dialog);
  2109. return ret == GTK_RESPONSE_YES;
  2110. }
  2111. static gboolean
  2112. change_compression (GtkWindow *parent,
  2113. GFile *file,
  2114. gboolean compressed)
  2115. {
  2116. GtkWidget *dialog;
  2117. gint ret;
  2118. gchar *parse_name;
  2119. gchar *name_for_display;
  2120. const gchar *primary_message;
  2121. const gchar *button_label;
  2122. gedit_debug (DEBUG_COMMANDS);
  2123. parse_name = g_file_get_parse_name (file);
  2124. /* Truncate the name so it doesn't get insanely wide. Note that even
  2125. * though the dialog uses wrapped text, if the name doesn't contain
  2126. * white space then the text-wrapping code is too stupid to wrap it.
  2127. */
  2128. - name_for_display = tepl_utils_str_middle_truncate (parse_name, 50);
  2129. + name_for_display = gedit_utils_str_middle_truncate (parse_name, 50);
  2130. g_free (parse_name);
  2131. if (compressed)
  2132. {
  2133. primary_message = _("Save the file using compression?");
  2134. }
  2135. else
  2136. {
  2137. primary_message = _("Save the file as plain text?");
  2138. }
  2139. dialog = gtk_message_dialog_new (parent,
  2140. GTK_DIALOG_DESTROY_WITH_PARENT,
  2141. GTK_MESSAGE_QUESTION,
  2142. GTK_BUTTONS_NONE,
  2143. "%s",
  2144. primary_message);
  2145. if (compressed)
  2146. {
  2147. gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
  2148. _("The file “%s” was previously saved as plain "
  2149. "text and will now be saved using compression."),
  2150. name_for_display);
  2151. button_label = _("_Save Using Compression");
  2152. }
  2153. else
  2154. {
  2155. gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
  2156. @@ -760,60 +757,61 @@ confirm_overwrite_callback (GeditFileChooserDialog *dialog,
  2157. /* Call save_as_tab_finish() in @callback. */
  2158. static void
  2159. save_as_tab_async (GeditTab *tab,
  2160. GeditWindow *window,
  2161. GCancellable *cancellable,
  2162. GAsyncReadyCallback callback,
  2163. gpointer user_data)
  2164. {
  2165. GTask *task;
  2166. GeditFileChooserDialog *save_dialog;
  2167. GtkWindowGroup *window_group;
  2168. GtkWindow *dialog_window;
  2169. GeditDocument *doc;
  2170. GtkSourceFile *file;
  2171. GFile *location;
  2172. const GtkSourceEncoding *encoding;
  2173. GtkSourceNewlineType newline_type;
  2174. g_return_if_fail (GEDIT_IS_TAB (tab));
  2175. g_return_if_fail (GEDIT_IS_WINDOW (window));
  2176. gedit_debug (DEBUG_COMMANDS);
  2177. task = g_task_new (tab, cancellable, callback, user_data);
  2178. g_task_set_task_data (task, g_object_ref (window), g_object_unref);
  2179. /* Translators: "Save As" is the title of the file chooser window. */
  2180. save_dialog = gedit_file_chooser_dialog_create (C_("window title", "Save As"),
  2181. GTK_WINDOW (window),
  2182. + GEDIT_FILE_CHOOSER_FLAG_SAVE,
  2183. _("_Save"),
  2184. _("_Cancel"));
  2185. gedit_file_chooser_dialog_set_do_overwrite_confirmation (save_dialog, TRUE);
  2186. g_signal_connect (save_dialog,
  2187. "confirm-overwrite",
  2188. G_CALLBACK (confirm_overwrite_callback),
  2189. NULL);
  2190. window_group = gedit_window_get_group (window);
  2191. dialog_window = gedit_file_chooser_dialog_get_window (save_dialog);
  2192. if (dialog_window != NULL)
  2193. {
  2194. gtk_window_group_add_window (window_group, dialog_window);
  2195. }
  2196. /* Save As dialog is modal to its main window */
  2197. gedit_file_chooser_dialog_set_modal (save_dialog, TRUE);
  2198. /* Set the suggested file name */
  2199. doc = gedit_tab_get_document (tab);
  2200. file = gedit_document_get_file (doc);
  2201. location = gtk_source_file_get_location (file);
  2202. if (location != NULL)
  2203. {
  2204. gedit_file_chooser_dialog_set_file (save_dialog, location);
  2205. diff --git a/gedit/gedit-commands-search.c b/gedit/gedit-commands-search.c
  2206. index 22703985e..f120b8bad 100644
  2207. --- a/gedit/gedit-commands-search.c
  2208. +++ b/gedit/gedit-commands-search.c
  2209. @@ -2,61 +2,60 @@
  2210. * gedit-commands-search.c
  2211. * This file is part of gedit
  2212. *
  2213. * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
  2214. * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
  2215. * Copyright (C) 2002-2006 Paolo Maggi
  2216. * Copyright (C) 2013 Sébastien Wilmet
  2217. *
  2218. * This program is free software; you can redistribute it and/or modify
  2219. * it under the terms of the GNU General Public License as published by
  2220. * the Free Software Foundation; either version 2 of the License, or
  2221. * (at your option) any later version.
  2222. *
  2223. * This program is distributed in the hope that it will be useful,
  2224. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  2225. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2226. * GNU General Public License for more details.
  2227. *
  2228. * You should have received a copy of the GNU General Public License
  2229. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  2230. */
  2231. #include "config.h"
  2232. #include "gedit-commands.h"
  2233. #include "gedit-commands-private.h"
  2234. #include <string.h>
  2235. #include <glib/gi18n.h>
  2236. #include <gdk/gdkkeysyms.h>
  2237. -#include <tepl/tepl.h>
  2238. #include "gedit-debug.h"
  2239. #include "gedit-statusbar.h"
  2240. #include "gedit-tab.h"
  2241. #include "gedit-tab-private.h"
  2242. #include "gedit-view-frame.h"
  2243. #include "gedit-window.h"
  2244. #include "gedit-window-private.h"
  2245. #include "gedit-utils.h"
  2246. #include "gedit-replace-dialog.h"
  2247. #define GEDIT_REPLACE_DIALOG_KEY "gedit-replace-dialog-key"
  2248. #define GEDIT_LAST_SEARCH_DATA_KEY "gedit-last-search-data-key"
  2249. typedef struct _LastSearchData LastSearchData;
  2250. struct _LastSearchData
  2251. {
  2252. gint x;
  2253. gint y;
  2254. };
  2255. static void
  2256. last_search_data_free (LastSearchData *data)
  2257. {
  2258. g_slice_free (LastSearchData, data);
  2259. }
  2260. static void
  2261. last_search_data_restore_position (GeditReplaceDialog *dlg)
  2262. {
  2263. @@ -105,117 +104,117 @@ text_found (GeditWindow *window,
  2264. window->priv->generic_message_cid,
  2265. ngettext("Found and replaced %d occurrence",
  2266. "Found and replaced %d occurrences",
  2267. occurrences),
  2268. occurrences);
  2269. }
  2270. else if (occurrences == 1)
  2271. {
  2272. gedit_statusbar_flash_message (GEDIT_STATUSBAR (window->priv->statusbar),
  2273. window->priv->generic_message_cid,
  2274. _("Found and replaced one occurrence"));
  2275. }
  2276. else
  2277. {
  2278. gedit_statusbar_flash_message (GEDIT_STATUSBAR (window->priv->statusbar),
  2279. window->priv->generic_message_cid,
  2280. " ");
  2281. }
  2282. }
  2283. #define MAX_MSG_LENGTH 40
  2284. static void
  2285. text_not_found (GeditWindow *window,
  2286. GeditReplaceDialog *replace_dialog)
  2287. {
  2288. const gchar *search_text;
  2289. gchar *truncated_text;
  2290. search_text = gedit_replace_dialog_get_search_text (replace_dialog);
  2291. - truncated_text = tepl_utils_str_end_truncate (search_text, MAX_MSG_LENGTH);
  2292. + truncated_text = gedit_utils_str_end_truncate (search_text, MAX_MSG_LENGTH);
  2293. gedit_statusbar_flash_message (GEDIT_STATUSBAR (window->priv->statusbar),
  2294. window->priv->generic_message_cid,
  2295. /* Translators: %s is replaced by the text
  2296. entered by the user in the search box */
  2297. _("“%s” not found"), truncated_text);
  2298. g_free (truncated_text);
  2299. }
  2300. static void
  2301. finish_search_from_dialog (GeditWindow *window,
  2302. gboolean found)
  2303. {
  2304. GeditReplaceDialog *replace_dialog;
  2305. replace_dialog = g_object_get_data (G_OBJECT (window), GEDIT_REPLACE_DIALOG_KEY);
  2306. g_return_if_fail (replace_dialog != NULL);
  2307. if (found)
  2308. {
  2309. text_found (window, 0);
  2310. }
  2311. else
  2312. {
  2313. text_not_found (window, replace_dialog);
  2314. }
  2315. }
  2316. static gboolean
  2317. forward_search_finished (GtkSourceSearchContext *search_context,
  2318. GAsyncResult *result,
  2319. GeditView *view)
  2320. {
  2321. gboolean found;
  2322. GtkSourceBuffer *buffer;
  2323. GtkTextIter match_start;
  2324. GtkTextIter match_end;
  2325. found = gtk_source_search_context_forward_finish (search_context,
  2326. result,
  2327. &match_start,
  2328. &match_end,
  2329. NULL,
  2330. NULL);
  2331. buffer = gtk_source_search_context_get_buffer (search_context);
  2332. if (found)
  2333. {
  2334. gtk_text_buffer_select_range (GTK_TEXT_BUFFER (buffer),
  2335. &match_start,
  2336. &match_end);
  2337. - tepl_view_scroll_to_cursor (TEPL_VIEW (view));
  2338. + gedit_view_scroll_to_cursor (view);
  2339. }
  2340. else
  2341. {
  2342. GtkTextIter end_selection;
  2343. gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (buffer),
  2344. NULL,
  2345. &end_selection);
  2346. gtk_text_buffer_select_range (GTK_TEXT_BUFFER (buffer),
  2347. &end_selection,
  2348. &end_selection);
  2349. }
  2350. return found;
  2351. }
  2352. static void
  2353. forward_search_from_dialog_finished (GtkSourceSearchContext *search_context,
  2354. GAsyncResult *result,
  2355. GeditWindow *window)
  2356. {
  2357. GeditView *view = gedit_window_get_active_view (window);
  2358. gboolean found;
  2359. if (view == NULL)
  2360. {
  2361. return;
  2362. }
  2363. @@ -267,61 +266,61 @@ run_forward_search (GeditWindow *window,
  2364. (GAsyncReadyCallback)forward_search_finished,
  2365. view);
  2366. }
  2367. }
  2368. static gboolean
  2369. backward_search_finished (GtkSourceSearchContext *search_context,
  2370. GAsyncResult *result,
  2371. GeditView *view)
  2372. {
  2373. gboolean found;
  2374. GtkTextIter match_start;
  2375. GtkTextIter match_end;
  2376. GtkSourceBuffer *buffer;
  2377. found = gtk_source_search_context_backward_finish (search_context,
  2378. result,
  2379. &match_start,
  2380. &match_end,
  2381. NULL,
  2382. NULL);
  2383. buffer = gtk_source_search_context_get_buffer (search_context);
  2384. if (found)
  2385. {
  2386. gtk_text_buffer_select_range (GTK_TEXT_BUFFER (buffer),
  2387. &match_start,
  2388. &match_end);
  2389. - tepl_view_scroll_to_cursor (TEPL_VIEW (view));
  2390. + gedit_view_scroll_to_cursor (view);
  2391. }
  2392. else
  2393. {
  2394. GtkTextIter start_selection;
  2395. gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (buffer),
  2396. &start_selection,
  2397. NULL);
  2398. gtk_text_buffer_select_range (GTK_TEXT_BUFFER (buffer),
  2399. &start_selection,
  2400. &start_selection);
  2401. }
  2402. return found;
  2403. }
  2404. static void
  2405. backward_search_from_dialog_finished (GtkSourceSearchContext *search_context,
  2406. GAsyncResult *result,
  2407. GeditWindow *window)
  2408. {
  2409. GeditView *view = gedit_window_get_active_view (window);
  2410. gboolean found;
  2411. if (view == NULL)
  2412. {
  2413. return;
  2414. }
  2415. diff --git a/gedit/gedit-commands-view.c b/gedit/gedit-commands-view.c
  2416. index 71785b78f..369bc93b0 100644
  2417. --- a/gedit/gedit-commands-view.c
  2418. +++ b/gedit/gedit-commands-view.c
  2419. @@ -1,58 +1,63 @@
  2420. /*
  2421. * gedit-view-commands.c
  2422. * This file is part of gedit
  2423. *
  2424. * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
  2425. * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
  2426. * Copyright (C) 2002-2005 Paolo Maggi
  2427. *
  2428. * This program is free software; you can redistribute it and/or modify
  2429. * it under the terms of the GNU General Public License as published by
  2430. * the Free Software Foundation; either version 2 of the License, or
  2431. * (at your option) any later version.
  2432. *
  2433. * This program is distributed in the hope that it will be useful,
  2434. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  2435. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2436. * GNU General Public License for more details.
  2437. *
  2438. * You should have received a copy of the GNU General Public License
  2439. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  2440. */
  2441. #include "config.h"
  2442. +
  2443. #include "gedit-commands.h"
  2444. #include "gedit-commands-private.h"
  2445. -#include <tepl/tepl.h>
  2446. +
  2447. +#include <gtk/gtk.h>
  2448. +
  2449. #include "gedit-debug.h"
  2450. #include "gedit-window.h"
  2451. +#include "gedit-highlight-mode-dialog.h"
  2452. +#include "gedit-highlight-mode-selector.h"
  2453. void
  2454. _gedit_cmd_view_focus_active (GSimpleAction *action,
  2455. GVariant *state,
  2456. gpointer user_data)
  2457. {
  2458. GeditView *active_view;
  2459. GeditWindow *window = GEDIT_WINDOW (user_data);
  2460. gedit_debug (DEBUG_COMMANDS);
  2461. active_view = gedit_window_get_active_view (window);
  2462. if (active_view)
  2463. {
  2464. gtk_widget_grab_focus (GTK_WIDGET (active_view));
  2465. }
  2466. }
  2467. void
  2468. _gedit_cmd_view_toggle_side_panel (GSimpleAction *action,
  2469. GVariant *state,
  2470. gpointer user_data)
  2471. {
  2472. GeditWindow *window = GEDIT_WINDOW (user_data);
  2473. GtkWidget *panel;
  2474. gboolean visible;
  2475. gedit_debug (DEBUG_COMMANDS);
  2476. @@ -94,88 +99,75 @@ _gedit_cmd_view_toggle_bottom_panel (GSimpleAction *action,
  2477. }
  2478. void
  2479. _gedit_cmd_view_toggle_fullscreen_mode (GSimpleAction *action,
  2480. GVariant *state,
  2481. gpointer user_data)
  2482. {
  2483. GeditWindow *window = GEDIT_WINDOW (user_data);
  2484. gedit_debug (DEBUG_COMMANDS);
  2485. if (g_variant_get_boolean (state))
  2486. {
  2487. _gedit_window_fullscreen (window);
  2488. }
  2489. else
  2490. {
  2491. _gedit_window_unfullscreen (window);
  2492. }
  2493. }
  2494. void
  2495. _gedit_cmd_view_leave_fullscreen_mode (GSimpleAction *action,
  2496. GVariant *parameter,
  2497. gpointer user_data)
  2498. {
  2499. _gedit_window_unfullscreen (GEDIT_WINDOW (user_data));
  2500. }
  2501. static void
  2502. -language_activated_cb (TeplLanguageChooserDialog *dialog,
  2503. - GtkSourceLanguage *language,
  2504. - GeditWindow *window)
  2505. +language_selected_cb (GeditHighlightModeSelector *selector,
  2506. + GtkSourceLanguage *language,
  2507. + GeditWindow *window)
  2508. {
  2509. GeditDocument *active_document;
  2510. active_document = gedit_window_get_active_document (window);
  2511. if (active_document != NULL)
  2512. {
  2513. gedit_document_set_language (active_document, language);
  2514. }
  2515. -
  2516. - gtk_widget_destroy (GTK_WIDGET (dialog));
  2517. -}
  2518. -
  2519. -static void
  2520. -language_chooser_dialog_response_after_cb (TeplLanguageChooserDialog *dialog,
  2521. - gint response_id,
  2522. - gpointer user_data)
  2523. -{
  2524. - gtk_widget_destroy (GTK_WIDGET (dialog));
  2525. }
  2526. void
  2527. _gedit_cmd_view_highlight_mode (GSimpleAction *action,
  2528. GVariant *parameter,
  2529. gpointer user_data)
  2530. {
  2531. GeditWindow *window = GEDIT_WINDOW (user_data);
  2532. - TeplLanguageChooserDialog *dialog;
  2533. + GeditHighlightModeDialog *dialog;
  2534. + GeditHighlightModeSelector *selector;
  2535. GeditDocument *active_document;
  2536. - dialog = tepl_language_chooser_dialog_new (GTK_WINDOW (window));
  2537. + dialog = GEDIT_HIGHLIGHT_MODE_DIALOG (gedit_highlight_mode_dialog_new (GTK_WINDOW (window)));
  2538. + selector = gedit_highlight_mode_dialog_get_selector (dialog);
  2539. active_document = gedit_window_get_active_document (window);
  2540. if (active_document != NULL)
  2541. {
  2542. GtkSourceLanguage *language;
  2543. language = gedit_document_get_language (active_document);
  2544. - tepl_language_chooser_select_language (TEPL_LANGUAGE_CHOOSER (dialog), language);
  2545. + gedit_highlight_mode_selector_select_language (selector, language);
  2546. }
  2547. - g_signal_connect_object (dialog,
  2548. - "language-activated",
  2549. - G_CALLBACK (language_activated_cb),
  2550. + g_signal_connect_object (selector,
  2551. + "language-selected",
  2552. + G_CALLBACK (language_selected_cb),
  2553. window,
  2554. 0);
  2555. - g_signal_connect_after (dialog,
  2556. - "response",
  2557. - G_CALLBACK (language_chooser_dialog_response_after_cb),
  2558. - NULL);
  2559. -
  2560. gtk_widget_show (GTK_WIDGET (dialog));
  2561. }
  2562. /* ex:set ts=8 noet: */
  2563. diff --git a/gedit/gedit-debug.c b/gedit/gedit-debug.c
  2564. index 5aa82fa51..396dc140f 100644
  2565. --- a/gedit/gedit-debug.c
  2566. +++ b/gedit/gedit-debug.c
  2567. @@ -73,60 +73,64 @@ gedit_debug_init (void)
  2568. enabled_sections |= GEDIT_DEBUG_WINDOW;
  2569. }
  2570. if (g_getenv ("GEDIT_DEBUG_PANEL") != NULL)
  2571. {
  2572. enabled_sections |= GEDIT_DEBUG_PANEL;
  2573. }
  2574. if (g_getenv ("GEDIT_DEBUG_PLUGINS") != NULL)
  2575. {
  2576. enabled_sections |= GEDIT_DEBUG_PLUGINS;
  2577. }
  2578. if (g_getenv ("GEDIT_DEBUG_TAB") != NULL)
  2579. {
  2580. enabled_sections |= GEDIT_DEBUG_TAB;
  2581. }
  2582. if (g_getenv ("GEDIT_DEBUG_DOCUMENT") != NULL)
  2583. {
  2584. enabled_sections |= GEDIT_DEBUG_DOCUMENT;
  2585. }
  2586. if (g_getenv ("GEDIT_DEBUG_COMMANDS") != NULL)
  2587. {
  2588. enabled_sections |= GEDIT_DEBUG_COMMANDS;
  2589. }
  2590. if (g_getenv ("GEDIT_DEBUG_APP") != NULL)
  2591. {
  2592. enabled_sections |= GEDIT_DEBUG_APP;
  2593. }
  2594. if (g_getenv ("GEDIT_DEBUG_UTILS") != NULL)
  2595. {
  2596. enabled_sections |= GEDIT_DEBUG_UTILS;
  2597. }
  2598. + if (g_getenv ("GEDIT_DEBUG_METADATA") != NULL)
  2599. + {
  2600. + enabled_sections |= GEDIT_DEBUG_METADATA;
  2601. + }
  2602. out:
  2603. #ifdef ENABLE_PROFILING
  2604. if (enabled_sections != GEDIT_NO_DEBUG)
  2605. {
  2606. timer = g_timer_new ();
  2607. }
  2608. #endif
  2609. }
  2610. /**
  2611. * gedit_debug:
  2612. * @section: debug section.
  2613. * @file: file name.
  2614. * @line: line number.
  2615. * @function: name of the function that is calling gedit_debug().
  2616. *
  2617. * If @section is enabled, then logs the trace information @file, @line, and
  2618. * @function.
  2619. */
  2620. void
  2621. gedit_debug (GeditDebugSection section,
  2622. const gchar *file,
  2623. gint line,
  2624. const gchar *function)
  2625. {
  2626. gedit_debug_message (section, file, line, function, "%s", "");
  2627. }
  2628. diff --git a/gedit/gedit-debug.h b/gedit/gedit-debug.h
  2629. index a9d7caf37..49e5127e1 100644
  2630. --- a/gedit/gedit-debug.h
  2631. +++ b/gedit/gedit-debug.h
  2632. @@ -21,63 +21,65 @@
  2633. */
  2634. #ifndef GEDIT_DEBUG_H
  2635. #define GEDIT_DEBUG_H
  2636. #include <glib.h>
  2637. /**
  2638. * GeditDebugSection:
  2639. *
  2640. * Enumeration of debug sections.
  2641. *
  2642. * Debugging output for a section is enabled by setting an environment variable
  2643. * of the same name. For example, setting the <code>GEDIT_DEBUG_PLUGINS</code>
  2644. * environment variable enables all debugging output for the %GEDIT_DEBUG_PLUGINS
  2645. * section. Setting the special environment variable <code>GEDIT_DEBUG</code>
  2646. * enables output for all sections.
  2647. */
  2648. typedef enum {
  2649. GEDIT_NO_DEBUG = 0,
  2650. GEDIT_DEBUG_VIEW = 1 << 0,
  2651. GEDIT_DEBUG_PREFS = 1 << 1,
  2652. GEDIT_DEBUG_WINDOW = 1 << 2,
  2653. GEDIT_DEBUG_PANEL = 1 << 3,
  2654. GEDIT_DEBUG_PLUGINS = 1 << 4,
  2655. GEDIT_DEBUG_TAB = 1 << 5,
  2656. GEDIT_DEBUG_DOCUMENT = 1 << 6,
  2657. GEDIT_DEBUG_COMMANDS = 1 << 7,
  2658. GEDIT_DEBUG_APP = 1 << 8,
  2659. GEDIT_DEBUG_UTILS = 1 << 9,
  2660. + GEDIT_DEBUG_METADATA = 1 << 10,
  2661. } GeditDebugSection;
  2662. #define DEBUG_VIEW GEDIT_DEBUG_VIEW, __FILE__, __LINE__, G_STRFUNC
  2663. #define DEBUG_PREFS GEDIT_DEBUG_PREFS, __FILE__, __LINE__, G_STRFUNC
  2664. #define DEBUG_WINDOW GEDIT_DEBUG_WINDOW, __FILE__, __LINE__, G_STRFUNC
  2665. #define DEBUG_PANEL GEDIT_DEBUG_PANEL, __FILE__, __LINE__, G_STRFUNC
  2666. #define DEBUG_PLUGINS GEDIT_DEBUG_PLUGINS, __FILE__, __LINE__, G_STRFUNC
  2667. #define DEBUG_TAB GEDIT_DEBUG_TAB, __FILE__, __LINE__, G_STRFUNC
  2668. #define DEBUG_DOCUMENT GEDIT_DEBUG_DOCUMENT,__FILE__, __LINE__, G_STRFUNC
  2669. #define DEBUG_COMMANDS GEDIT_DEBUG_COMMANDS,__FILE__, __LINE__, G_STRFUNC
  2670. #define DEBUG_APP GEDIT_DEBUG_APP, __FILE__, __LINE__, G_STRFUNC
  2671. #define DEBUG_UTILS GEDIT_DEBUG_UTILS, __FILE__, __LINE__, G_STRFUNC
  2672. +#define DEBUG_METADATA GEDIT_DEBUG_METADATA,__FILE__, __LINE__, G_STRFUNC
  2673. void gedit_debug_init (void);
  2674. void gedit_debug (GeditDebugSection section,
  2675. const gchar *file,
  2676. gint line,
  2677. const gchar *function);
  2678. void gedit_debug_message (GeditDebugSection section,
  2679. const gchar *file,
  2680. gint line,
  2681. const gchar *function,
  2682. const gchar *format, ...) G_GNUC_PRINTF(5, 6);
  2683. void gedit_debug_plugin_message (const gchar *file,
  2684. gint line,
  2685. const gchar *function,
  2686. const gchar *message);
  2687. #endif /* GEDIT_DEBUG_H */
  2688. /* ex:set ts=8 noet: */
  2689. diff --git a/gedit/gedit-document-private.h b/gedit/gedit-document-private.h
  2690. index 62444cc76..574c0bb89 100644
  2691. --- a/gedit/gedit-document-private.h
  2692. +++ b/gedit/gedit-document-private.h
  2693. @@ -1,57 +1,63 @@
  2694. /*
  2695. * gedit-document.h
  2696. * This file is part of gedit
  2697. *
  2698. * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
  2699. * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
  2700. * Copyright (C) 2002-2005 Paolo Maggi
  2701. * Copyright (C) 2014, 2020 Sébastien Wilmet
  2702. *
  2703. * This program is free software; you can redistribute it and/or modify
  2704. * it under the terms of the GNU General Public License as published by
  2705. * the Free Software Foundation; either version 2 of the License, or
  2706. * (at your option) any later version.
  2707. *
  2708. * This program is distributed in the hope that it will be useful,
  2709. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  2710. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2711. * GNU General Public License for more details.
  2712. *
  2713. * You should have received a copy of the GNU General Public License
  2714. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  2715. */
  2716. #ifndef GEDIT_DOCUMENT_PRIVATE_H
  2717. #define GEDIT_DOCUMENT_PRIVATE_H
  2718. #include "gedit-document.h"
  2719. G_BEGIN_DECLS
  2720. -#define GEDIT_METADATA_ATTRIBUTE_POSITION "gedit-position"
  2721. -#define GEDIT_METADATA_ATTRIBUTE_ENCODING "gedit-encoding"
  2722. -#define GEDIT_METADATA_ATTRIBUTE_LANGUAGE "gedit-language"
  2723. +#ifdef G_OS_WIN32
  2724. +#define GEDIT_METADATA_ATTRIBUTE_POSITION "position"
  2725. +#define GEDIT_METADATA_ATTRIBUTE_ENCODING "encoding"
  2726. +#define GEDIT_METADATA_ATTRIBUTE_LANGUAGE "language"
  2727. +#else
  2728. +#define GEDIT_METADATA_ATTRIBUTE_POSITION "metadata::gedit-position"
  2729. +#define GEDIT_METADATA_ATTRIBUTE_ENCODING "metadata::gedit-encoding"
  2730. +#define GEDIT_METADATA_ATTRIBUTE_LANGUAGE "metadata::gedit-language"
  2731. +#endif
  2732. G_GNUC_INTERNAL
  2733. glong _gedit_document_get_seconds_since_last_save_or_load (GeditDocument *doc);
  2734. G_GNUC_INTERNAL
  2735. gboolean _gedit_document_needs_saving (GeditDocument *doc);
  2736. G_GNUC_INTERNAL
  2737. gboolean _gedit_document_get_empty_search (GeditDocument *doc);
  2738. G_GNUC_INTERNAL
  2739. void _gedit_document_set_create (GeditDocument *doc,
  2740. gboolean create);
  2741. G_GNUC_INTERNAL
  2742. gboolean _gedit_document_get_create (GeditDocument *doc);
  2743. G_GNUC_INTERNAL
  2744. gchar * _gedit_document_get_uri_for_display (GeditDocument *doc);
  2745. G_END_DECLS
  2746. #endif /* GEDIT_DOCUMENT_PRIVATE_H */
  2747. /* ex:set ts=8 noet: */
  2748. diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
  2749. index 54c11a96c..4cb08ee03 100644
  2750. --- a/gedit/gedit-document.c
  2751. +++ b/gedit/gedit-document.c
  2752. @@ -1,156 +1,177 @@
  2753. /*
  2754. * gedit-document.c
  2755. * This file is part of gedit
  2756. *
  2757. * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
  2758. * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
  2759. * Copyright (C) 2002-2005 Paolo Maggi
  2760. - * Copyright (C) 2014-2020 Sébastien Wilmet
  2761. + * Copyright (C) 2014-2015 Sébastien Wilmet
  2762. *
  2763. * This program is free software; you can redistribute it and/or modify
  2764. * it under the terms of the GNU General Public License as published by
  2765. * the Free Software Foundation; either version 2 of the License, or
  2766. * (at your option) any later version.
  2767. *
  2768. * This program is distributed in the hope that it will be useful,
  2769. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  2770. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2771. * GNU General Public License for more details.
  2772. *
  2773. * You should have received a copy of the GNU General Public License
  2774. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  2775. */
  2776. #include "config.h"
  2777. +
  2778. #include "gedit-document.h"
  2779. #include "gedit-document-private.h"
  2780. +
  2781. #include <string.h>
  2782. #include <glib/gi18n.h>
  2783. +
  2784. +#include "gedit-app.h"
  2785. +#include "gedit-app-private.h"
  2786. #include "gedit-settings.h"
  2787. #include "gedit-debug.h"
  2788. #include "gedit-utils.h"
  2789. +#include "gedit-metadata-manager.h"
  2790. +
  2791. +#define METADATA_QUERY "metadata::*"
  2792. #define NO_LANGUAGE_NAME "_NORMAL_"
  2793. static void gedit_document_loaded_real (GeditDocument *doc);
  2794. static void gedit_document_saved_real (GeditDocument *doc);
  2795. static void set_content_type (GeditDocument *doc,
  2796. const gchar *content_type);
  2797. typedef struct
  2798. {
  2799. GtkSourceFile *file;
  2800. - TeplMetadata *metadata;
  2801. + GSettings *editor_settings;
  2802. +
  2803. + gint untitled_number;
  2804. +
  2805. + GFileInfo *metadata_info;
  2806. gchar *content_type;
  2807. GDateTime *time_of_last_save_or_load;
  2808. /* The search context for the incremental search, or the search and
  2809. * replace. They are mutually exclusive.
  2810. */
  2811. GtkSourceSearchContext *search_context;
  2812. + GeditMetadataManager *metadata_manager;
  2813. +
  2814. + guint user_action;
  2815. +
  2816. guint language_set_by_user : 1;
  2817. + guint use_gvfs_metadata : 1;
  2818. /* The search is empty if there is no search context, or if the
  2819. * search text is empty. It is used for the sensitivity of some menu
  2820. * actions.
  2821. */
  2822. guint empty_search : 1;
  2823. /* Create file if location points to a non existing file (for example
  2824. * when opened from the command line).
  2825. */
  2826. guint create : 1;
  2827. } GeditDocumentPrivate;
  2828. enum
  2829. {
  2830. PROP_0,
  2831. + PROP_SHORTNAME,
  2832. PROP_CONTENT_TYPE,
  2833. PROP_MIME_TYPE,
  2834. PROP_EMPTY_SEARCH,
  2835. + PROP_USE_GVFS_METADATA,
  2836. LAST_PROP
  2837. };
  2838. static GParamSpec *properties[LAST_PROP];
  2839. enum
  2840. {
  2841. + CURSOR_MOVED,
  2842. LOAD,
  2843. LOADED,
  2844. SAVE,
  2845. SAVED,
  2846. LAST_SIGNAL
  2847. };
  2848. static guint document_signals[LAST_SIGNAL];
  2849. -G_DEFINE_TYPE_WITH_PRIVATE (GeditDocument, gedit_document, TEPL_TYPE_BUFFER)
  2850. +static GHashTable *allocated_untitled_numbers = NULL;
  2851. -static void
  2852. -load_metadata_from_metadata_manager (GeditDocument *doc)
  2853. +G_DEFINE_TYPE_WITH_PRIVATE (GeditDocument, gedit_document, GTK_SOURCE_TYPE_BUFFER)
  2854. +
  2855. +static gint
  2856. +get_untitled_number (void)
  2857. {
  2858. - GeditDocumentPrivate *priv = gedit_document_get_instance_private (doc);
  2859. - GFile *location;
  2860. + gint i = 1;
  2861. - location = gtk_source_file_get_location (priv->file);
  2862. + if (allocated_untitled_numbers == NULL)
  2863. + allocated_untitled_numbers = g_hash_table_new (NULL, NULL);
  2864. - if (location != NULL)
  2865. + g_return_val_if_fail (allocated_untitled_numbers != NULL, -1);
  2866. +
  2867. + while (TRUE)
  2868. {
  2869. - TeplMetadataManager *manager;
  2870. + if (g_hash_table_lookup (allocated_untitled_numbers, GINT_TO_POINTER (i)) == NULL)
  2871. + {
  2872. + g_hash_table_insert (allocated_untitled_numbers,
  2873. + GINT_TO_POINTER (i),
  2874. + GINT_TO_POINTER (i));
  2875. - manager = tepl_metadata_manager_get_singleton ();
  2876. - tepl_metadata_manager_copy_from (manager, location, priv->metadata);
  2877. + return i;
  2878. + }
  2879. +
  2880. + ++i;
  2881. }
  2882. }
  2883. static void
  2884. -save_metadata_into_metadata_manager (GeditDocument *doc)
  2885. +release_untitled_number (gint n)
  2886. {
  2887. - GeditDocumentPrivate *priv = gedit_document_get_instance_private (doc);
  2888. - GFile *location;
  2889. -
  2890. - location = gtk_source_file_get_location (priv->file);
  2891. -
  2892. - if (location != NULL)
  2893. - {
  2894. - TeplMetadataManager *manager;
  2895. + g_return_if_fail (allocated_untitled_numbers != NULL);
  2896. - manager = tepl_metadata_manager_get_singleton ();
  2897. - tepl_metadata_manager_merge_into (manager, location, priv->metadata);
  2898. - }
  2899. + g_hash_table_remove (allocated_untitled_numbers, GINT_TO_POINTER (n));
  2900. }
  2901. static void
  2902. update_time_of_last_save_or_load (GeditDocument *doc)
  2903. {
  2904. GeditDocumentPrivate *priv = gedit_document_get_instance_private (doc);
  2905. if (priv->time_of_last_save_or_load != NULL)
  2906. {
  2907. g_date_time_unref (priv->time_of_last_save_or_load);
  2908. }
  2909. priv->time_of_last_save_or_load = g_date_time_new_now_utc ();
  2910. }
  2911. static const gchar *
  2912. get_language_string (GeditDocument *doc)
  2913. {
  2914. GtkSourceLanguage *lang = gedit_document_get_language (doc);
  2915. return lang != NULL ? gtk_source_language_get_id (lang) : NO_LANGUAGE_NAME;
  2916. }
  2917. static void
  2918. save_metadata (GeditDocument *doc)
  2919. {
  2920. GeditDocumentPrivate *priv;
  2921. const gchar *language = NULL;
  2922. GtkTextIter iter;
  2923. gchar *position;
  2924. @@ -168,215 +189,361 @@ save_metadata (GeditDocument *doc)
  2925. position = g_strdup_printf ("%d", gtk_text_iter_get_offset (&iter));
  2926. if (language == NULL)
  2927. {
  2928. gedit_document_set_metadata (doc,
  2929. GEDIT_METADATA_ATTRIBUTE_POSITION, position,
  2930. NULL);
  2931. }
  2932. else
  2933. {
  2934. gedit_document_set_metadata (doc,
  2935. GEDIT_METADATA_ATTRIBUTE_POSITION, position,
  2936. GEDIT_METADATA_ATTRIBUTE_LANGUAGE, language,
  2937. NULL);
  2938. }
  2939. g_free (position);
  2940. }
  2941. static void
  2942. gedit_document_dispose (GObject *object)
  2943. {
  2944. GeditDocument *doc = GEDIT_DOCUMENT (object);
  2945. GeditDocumentPrivate *priv = gedit_document_get_instance_private (doc);
  2946. gedit_debug (DEBUG_DOCUMENT);
  2947. /* Metadata must be saved here and not in finalize because the language
  2948. * is gone by the time finalize runs.
  2949. */
  2950. - if (priv->metadata != NULL)
  2951. + if (priv->file != NULL)
  2952. {
  2953. save_metadata (doc);
  2954. - g_object_unref (priv->metadata);
  2955. - priv->metadata = NULL;
  2956. + g_object_unref (priv->file);
  2957. + priv->file = NULL;
  2958. }
  2959. - g_clear_object (&priv->file);
  2960. + g_clear_object (&priv->metadata_info);
  2961. g_clear_object (&priv->search_context);
  2962. + g_clear_object (&priv->metadata_manager);
  2963. G_OBJECT_CLASS (gedit_document_parent_class)->dispose (object);
  2964. }
  2965. static void
  2966. gedit_document_finalize (GObject *object)
  2967. {
  2968. - GeditDocumentPrivate *priv = gedit_document_get_instance_private (GEDIT_DOCUMENT (object));
  2969. + GeditDocumentPrivate *priv;
  2970. gedit_debug (DEBUG_DOCUMENT);
  2971. + priv = gedit_document_get_instance_private (GEDIT_DOCUMENT (object));
  2972. +
  2973. + if (priv->untitled_number > 0)
  2974. + {
  2975. + release_untitled_number (priv->untitled_number);
  2976. + }
  2977. +
  2978. g_free (priv->content_type);
  2979. if (priv->time_of_last_save_or_load != NULL)
  2980. {
  2981. g_date_time_unref (priv->time_of_last_save_or_load);
  2982. }
  2983. G_OBJECT_CLASS (gedit_document_parent_class)->finalize (object);
  2984. }
  2985. static void
  2986. gedit_document_get_property (GObject *object,
  2987. guint prop_id,
  2988. GValue *value,
  2989. GParamSpec *pspec)
  2990. {
  2991. GeditDocument *doc = GEDIT_DOCUMENT (object);
  2992. GeditDocumentPrivate *priv;
  2993. priv = gedit_document_get_instance_private (doc);
  2994. switch (prop_id)
  2995. {
  2996. + case PROP_SHORTNAME:
  2997. + g_value_take_string (value, gedit_document_get_short_name_for_display (doc));
  2998. + break;
  2999. +
  3000. case PROP_CONTENT_TYPE:
  3001. g_value_take_string (value, gedit_document_get_content_type (doc));
  3002. break;
  3003. case PROP_MIME_TYPE:
  3004. g_value_take_string (value, gedit_document_get_mime_type (doc));
  3005. break;
  3006. case PROP_EMPTY_SEARCH:
  3007. g_value_set_boolean (value, priv->empty_search);
  3008. break;
  3009. + case PROP_USE_GVFS_METADATA:
  3010. + g_value_set_boolean (value, priv->use_gvfs_metadata);
  3011. + break;
  3012. +
  3013. default:
  3014. G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
  3015. break;
  3016. }
  3017. }
  3018. static void
  3019. gedit_document_set_property (GObject *object,
  3020. guint prop_id,
  3021. const GValue *value,
  3022. GParamSpec *pspec)
  3023. {
  3024. GeditDocument *doc = GEDIT_DOCUMENT (object);
  3025. + GeditDocumentPrivate *priv = gedit_document_get_instance_private (doc);
  3026. switch (prop_id)
  3027. {
  3028. case PROP_CONTENT_TYPE:
  3029. set_content_type (doc, g_value_get_string (value));
  3030. break;
  3031. + case PROP_USE_GVFS_METADATA:
  3032. + priv->use_gvfs_metadata = g_value_get_boolean (value);
  3033. + break;
  3034. +
  3035. default:
  3036. G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
  3037. break;
  3038. }
  3039. }
  3040. +static void
  3041. +gedit_document_begin_user_action (GtkTextBuffer *buffer)
  3042. +{
  3043. + GeditDocumentPrivate *priv;
  3044. +
  3045. + priv = gedit_document_get_instance_private (GEDIT_DOCUMENT (buffer));
  3046. +
  3047. + ++priv->user_action;
  3048. +
  3049. + if (GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->begin_user_action != NULL)
  3050. + {
  3051. + GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->begin_user_action (buffer);
  3052. + }
  3053. +}
  3054. +
  3055. +static void
  3056. +gedit_document_end_user_action (GtkTextBuffer *buffer)
  3057. +{
  3058. + GeditDocumentPrivate *priv;
  3059. +
  3060. + priv = gedit_document_get_instance_private (GEDIT_DOCUMENT (buffer));
  3061. +
  3062. + --priv->user_action;
  3063. +
  3064. + if (GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->end_user_action != NULL)
  3065. + {
  3066. + GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->end_user_action (buffer);
  3067. + }
  3068. +}
  3069. +
  3070. +static void
  3071. +gedit_document_mark_set (GtkTextBuffer *buffer,
  3072. + const GtkTextIter *iter,
  3073. + GtkTextMark *mark)
  3074. +{
  3075. + GeditDocument *doc = GEDIT_DOCUMENT (buffer);
  3076. + GeditDocumentPrivate *priv;
  3077. +
  3078. + priv = gedit_document_get_instance_private (doc);
  3079. +
  3080. + if (GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->mark_set != NULL)
  3081. + {
  3082. + GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->mark_set (buffer, iter, mark);
  3083. + }
  3084. +
  3085. + if (mark == gtk_text_buffer_get_insert (buffer) && (priv->user_action == 0))
  3086. + {
  3087. + g_signal_emit (doc, document_signals[CURSOR_MOVED], 0);
  3088. + }
  3089. +}
  3090. +
  3091. +static void
  3092. +gedit_document_changed (GtkTextBuffer *buffer)
  3093. +{
  3094. + g_signal_emit (GEDIT_DOCUMENT (buffer), document_signals[CURSOR_MOVED], 0);
  3095. +
  3096. + GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->changed (buffer);
  3097. +}
  3098. +
  3099. static void
  3100. gedit_document_constructed (GObject *object)
  3101. {
  3102. GeditDocument *doc = GEDIT_DOCUMENT (object);
  3103. + GeditDocumentPrivate *priv;
  3104. GeditSettings *settings;
  3105. GSettings *editor_settings;
  3106. + priv = gedit_document_get_instance_private (doc);
  3107. +
  3108. settings = _gedit_settings_get_singleton ();
  3109. editor_settings = _gedit_settings_peek_editor_settings (settings);
  3110. + if (!priv->use_gvfs_metadata)
  3111. + {
  3112. + GeditMetadataManager *metadata_manager;
  3113. +
  3114. + metadata_manager = _gedit_app_get_metadata_manager (GEDIT_APP (g_application_get_default ()));
  3115. + g_assert (GEDIT_IS_METADATA_MANAGER (metadata_manager));
  3116. + priv->metadata_manager = g_object_ref (metadata_manager);
  3117. + }
  3118. +
  3119. /* Bind construct properties. */
  3120. g_settings_bind (editor_settings, GEDIT_SETTINGS_ENSURE_TRAILING_NEWLINE,
  3121. doc, "implicit-trailing-newline",
  3122. G_SETTINGS_BIND_GET | G_SETTINGS_BIND_NO_SENSITIVITY);
  3123. G_OBJECT_CLASS (gedit_document_parent_class)->constructed (object);
  3124. }
  3125. static void
  3126. gedit_document_class_init (GeditDocumentClass *klass)
  3127. {
  3128. GObjectClass *object_class = G_OBJECT_CLASS (klass);
  3129. + GtkTextBufferClass *buf_class = GTK_TEXT_BUFFER_CLASS (klass);
  3130. object_class->dispose = gedit_document_dispose;
  3131. object_class->finalize = gedit_document_finalize;
  3132. object_class->get_property = gedit_document_get_property;
  3133. object_class->set_property = gedit_document_set_property;
  3134. object_class->constructed = gedit_document_constructed;
  3135. + buf_class->begin_user_action = gedit_document_begin_user_action;
  3136. + buf_class->end_user_action = gedit_document_end_user_action;
  3137. + buf_class->mark_set = gedit_document_mark_set;
  3138. + buf_class->changed = gedit_document_changed;
  3139. +
  3140. klass->loaded = gedit_document_loaded_real;
  3141. klass->saved = gedit_document_saved_real;
  3142. + /**
  3143. + * GeditDocument:shortname:
  3144. + *
  3145. + * The document's short name.
  3146. + */
  3147. + properties[PROP_SHORTNAME] =
  3148. + g_param_spec_string ("shortname",
  3149. + "Short Name",
  3150. + "The document's short name",
  3151. + NULL,
  3152. + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
  3153. +
  3154. /**
  3155. * GeditDocument:content-type:
  3156. *
  3157. * The document's content type.
  3158. */
  3159. properties[PROP_CONTENT_TYPE] =
  3160. g_param_spec_string ("content-type",
  3161. "Content Type",
  3162. "The document's Content Type",
  3163. NULL,
  3164. G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
  3165. /**
  3166. * GeditDocument:mime-type:
  3167. *
  3168. * The document's MIME type.
  3169. */
  3170. properties[PROP_MIME_TYPE] =
  3171. g_param_spec_string ("mime-type",
  3172. "MIME Type",
  3173. "The document's MIME Type",
  3174. "text/plain",
  3175. G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
  3176. /**
  3177. * GeditDocument:empty-search:
  3178. *
  3179. * <warning>
  3180. * The property is used internally by gedit. It must not be used in a
  3181. * gedit plugin. The property can be modified or removed at any time.
  3182. * </warning>
  3183. */
  3184. properties[PROP_EMPTY_SEARCH] =
  3185. g_param_spec_boolean ("empty-search",
  3186. "Empty search",
  3187. "Whether the search is empty",
  3188. TRUE,
  3189. G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
  3190. + /**
  3191. + * GeditDocument:use-gvfs-metadata:
  3192. + *
  3193. + * Whether to use GVFS metadata. If %FALSE, use the gedit metadata
  3194. + * manager that stores the metadata in an XML file in the user cache
  3195. + * directory.
  3196. + *
  3197. + * <warning>
  3198. + * The property is used internally by gedit. It must not be used in a
  3199. + * gedit plugin. The property can be modified or removed at any time.
  3200. + * </warning>
  3201. + */
  3202. + properties[PROP_USE_GVFS_METADATA] =
  3203. + g_param_spec_boolean ("use-gvfs-metadata",
  3204. + "Use GVFS metadata",
  3205. + "",
  3206. + TRUE,
  3207. + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
  3208. +
  3209. g_object_class_install_properties (object_class, LAST_PROP, properties);
  3210. + /* This signal is used to update the cursor position in the statusbar,
  3211. + * it's emitted either when the insert mark is moved explicitely or
  3212. + * when the buffer changes (insert/delete).
  3213. + * FIXME When the replace_all was implemented in gedit, this signal was
  3214. + * not emitted during the replace_all to improve performance. Now the
  3215. + * replace_all is implemented in GtkSourceView, so the signal is
  3216. + * emitted.
  3217. + */
  3218. + document_signals[CURSOR_MOVED] =
  3219. + g_signal_new ("cursor-moved",
  3220. + G_OBJECT_CLASS_TYPE (object_class),
  3221. + G_SIGNAL_RUN_LAST,
  3222. + G_STRUCT_OFFSET (GeditDocumentClass, cursor_moved),
  3223. + NULL, NULL, NULL,
  3224. + G_TYPE_NONE,
  3225. + 0);
  3226. +
  3227. /**
  3228. * GeditDocument::load:
  3229. * @document: the #GeditDocument.
  3230. *
  3231. * The "load" signal is emitted at the beginning of a file loading.
  3232. *
  3233. * Before gedit 3.14 this signal contained parameters to configure the
  3234. * file loading (the location, encoding, etc). Plugins should not need
  3235. * those parameters.
  3236. */
  3237. document_signals[LOAD] =
  3238. g_signal_new ("load",
  3239. G_OBJECT_CLASS_TYPE (object_class),
  3240. G_SIGNAL_RUN_LAST,
  3241. G_STRUCT_OFFSET (GeditDocumentClass, load),
  3242. NULL, NULL, NULL,
  3243. G_TYPE_NONE, 0);
  3244. /**
  3245. * GeditDocument::loaded:
  3246. * @document: the #GeditDocument.
  3247. *
  3248. * The "loaded" signal is emitted at the end of a successful file
  3249. * loading.
  3250. *
  3251. * Before gedit 3.14 this signal contained a #GError parameter, and the
  3252. * signal was also emitted if an error occurred. Plugins should not need
  3253. * the error parameter.
  3254. */
  3255. document_signals[LOADED] =
  3256. @@ -605,128 +772,188 @@ static void
  3257. on_content_type_changed (GeditDocument *doc,
  3258. GParamSpec *pspec,
  3259. gpointer useless)
  3260. {
  3261. GeditDocumentPrivate *priv;
  3262. priv = gedit_document_get_instance_private (doc);
  3263. if (!priv->language_set_by_user)
  3264. {
  3265. GtkSourceLanguage *language = guess_language (doc);
  3266. gedit_debug_message (DEBUG_DOCUMENT, "Language: %s",
  3267. language != NULL ? gtk_source_language_get_name (language) : "None");
  3268. set_language (doc, language, FALSE);
  3269. }
  3270. }
  3271. static gchar *
  3272. get_default_content_type (void)
  3273. {
  3274. return g_content_type_from_mime_type ("text/plain");
  3275. }
  3276. static void
  3277. on_location_changed (GtkSourceFile *file,
  3278. GParamSpec *pspec,
  3279. GeditDocument *doc)
  3280. {
  3281. + GeditDocumentPrivate *priv;
  3282. + GFile *location;
  3283. +
  3284. gedit_debug (DEBUG_DOCUMENT);
  3285. - load_metadata_from_metadata_manager (doc);
  3286. +
  3287. + priv = gedit_document_get_instance_private (doc);
  3288. +
  3289. + location = gtk_source_file_get_location (file);
  3290. +
  3291. + if (location != NULL && priv->untitled_number > 0)
  3292. + {
  3293. + release_untitled_number (priv->untitled_number);
  3294. + priv->untitled_number = 0;
  3295. + }
  3296. +
  3297. + g_object_notify_by_pspec (G_OBJECT (doc), properties[PROP_SHORTNAME]);
  3298. +
  3299. + /* Load metadata for this location: we load sync since metadata is
  3300. + * always local so it should be fast and we need the information
  3301. + * right after the location was set.
  3302. + * TODO: do async I/O for the metadata.
  3303. + */
  3304. + if (priv->use_gvfs_metadata && location != NULL)
  3305. + {
  3306. + GError *error = NULL;
  3307. +
  3308. + if (priv->metadata_info != NULL)
  3309. + {
  3310. + g_object_unref (priv->metadata_info);
  3311. + }
  3312. +
  3313. + priv->metadata_info = g_file_query_info (location,
  3314. + METADATA_QUERY,
  3315. + G_FILE_QUERY_INFO_NONE,
  3316. + NULL,
  3317. + &error);
  3318. +
  3319. + if (error != NULL)
  3320. + {
  3321. + /* Do not complain about metadata if we are opening a
  3322. + * non existing file.
  3323. + */
  3324. + if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_ISDIR) &&
  3325. + !g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOTDIR) &&
  3326. + !g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT) &&
  3327. + !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
  3328. + {
  3329. + g_warning ("%s", error->message);
  3330. + }
  3331. +
  3332. + g_error_free (error);
  3333. + }
  3334. +
  3335. + if (priv->metadata_info == NULL)
  3336. + {
  3337. + priv->metadata_info = g_file_info_new ();
  3338. + }
  3339. + }
  3340. }
  3341. static void
  3342. gedit_document_init (GeditDocument *doc)
  3343. {
  3344. GeditDocumentPrivate *priv = gedit_document_get_instance_private (doc);
  3345. - TeplFile *tepl_file;
  3346. GeditSettings *settings;
  3347. GSettings *editor_settings;
  3348. gedit_debug (DEBUG_DOCUMENT);
  3349. + settings = _gedit_settings_get_singleton ();
  3350. + editor_settings = _gedit_settings_peek_editor_settings (settings);
  3351. +
  3352. + priv->untitled_number = get_untitled_number ();
  3353. priv->content_type = get_default_content_type ();
  3354. priv->language_set_by_user = FALSE;
  3355. priv->empty_search = TRUE;
  3356. update_time_of_last_save_or_load (doc);
  3357. priv->file = gtk_source_file_new ();
  3358. - tepl_file = tepl_buffer_get_file (TEPL_BUFFER (doc));
  3359. -
  3360. - g_object_bind_property (priv->file, "location",
  3361. - tepl_file, "location",
  3362. - G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
  3363. -
  3364. - priv->metadata = tepl_metadata_new ();
  3365. + priv->metadata_info = g_file_info_new ();
  3366. g_signal_connect_object (priv->file,
  3367. "notify::location",
  3368. G_CALLBACK (on_location_changed),
  3369. doc,
  3370. 0);
  3371. - settings = _gedit_settings_get_singleton ();
  3372. - editor_settings = _gedit_settings_peek_editor_settings (settings);
  3373. -
  3374. g_settings_bind (editor_settings, GEDIT_SETTINGS_MAX_UNDO_ACTIONS,
  3375. doc, "max-undo-levels",
  3376. G_SETTINGS_BIND_GET | G_SETTINGS_BIND_NO_SENSITIVITY);
  3377. g_settings_bind (editor_settings, GEDIT_SETTINGS_SYNTAX_HIGHLIGHTING,
  3378. doc, "highlight-syntax",
  3379. G_SETTINGS_BIND_GET | G_SETTINGS_BIND_NO_SENSITIVITY);
  3380. g_settings_bind (editor_settings, GEDIT_SETTINGS_BRACKET_MATCHING,
  3381. doc, "highlight-matching-brackets",
  3382. G_SETTINGS_BIND_GET | G_SETTINGS_BIND_NO_SENSITIVITY);
  3383. g_signal_connect_object (editor_settings,
  3384. "changed::" GEDIT_SETTINGS_SCHEME,
  3385. G_CALLBACK (editor_settings_scheme_changed_cb),
  3386. doc,
  3387. 0);
  3388. update_style_scheme (doc);
  3389. g_signal_connect (doc,
  3390. "notify::content-type",
  3391. G_CALLBACK (on_content_type_changed),
  3392. NULL);
  3393. }
  3394. GeditDocument *
  3395. gedit_document_new (void)
  3396. {
  3397. - return g_object_new (GEDIT_TYPE_DOCUMENT, NULL);
  3398. + gboolean use_gvfs_metadata;
  3399. +
  3400. +#ifdef ENABLE_GVFS_METADATA
  3401. + use_gvfs_metadata = TRUE;
  3402. +#else
  3403. + use_gvfs_metadata = FALSE;
  3404. +#endif
  3405. +
  3406. + return g_object_new (GEDIT_TYPE_DOCUMENT,
  3407. + "use-gvfs-metadata", use_gvfs_metadata,
  3408. + NULL);
  3409. }
  3410. static gchar *
  3411. get_content_type_from_content (GeditDocument *doc)
  3412. {
  3413. gchar *content_type;
  3414. gchar *data;
  3415. GtkTextBuffer *buffer;
  3416. GtkTextIter start;
  3417. GtkTextIter end;
  3418. buffer = GTK_TEXT_BUFFER (doc);
  3419. gtk_text_buffer_get_start_iter (buffer, &start);
  3420. end = start;
  3421. gtk_text_iter_forward_chars (&end, 255);
  3422. data = gtk_text_buffer_get_text (buffer, &start, &end, TRUE);
  3423. content_type = g_content_type_guess (NULL,
  3424. (const guchar *)data,
  3425. strlen (data),
  3426. NULL);
  3427. g_free (data);
  3428. return content_type;
  3429. }
  3430. static void
  3431. @@ -787,93 +1014,107 @@ set_content_type (GeditDocument *doc,
  3432. if (content_type == NULL)
  3433. {
  3434. GFile *location;
  3435. gchar *guessed_type = NULL;
  3436. /* If content type is null, we guess from the filename */
  3437. location = gtk_source_file_get_location (priv->file);
  3438. if (location != NULL)
  3439. {
  3440. gchar *basename;
  3441. basename = g_file_get_basename (location);
  3442. guessed_type = g_content_type_guess (basename, NULL, 0, NULL);
  3443. g_free (basename);
  3444. }
  3445. set_content_type_no_guess (doc, guessed_type);
  3446. g_free (guessed_type);
  3447. }
  3448. else
  3449. {
  3450. set_content_type_no_guess (doc, content_type);
  3451. }
  3452. }
  3453. /* Note: this never returns %NULL. */
  3454. gchar *
  3455. _gedit_document_get_uri_for_display (GeditDocument *doc)
  3456. {
  3457. - TeplFile *file;
  3458. + GeditDocumentPrivate *priv;
  3459. GFile *location;
  3460. g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), g_strdup (""));
  3461. - file = tepl_buffer_get_file (TEPL_BUFFER (doc));
  3462. - location = tepl_file_get_location (file);
  3463. + priv = gedit_document_get_instance_private (doc);
  3464. +
  3465. + location = gtk_source_file_get_location (priv->file);
  3466. if (location == NULL)
  3467. {
  3468. - return tepl_file_get_short_name (file);
  3469. + return g_strdup_printf (_("Untitled Document %d"),
  3470. + priv->untitled_number);
  3471. }
  3472. else
  3473. {
  3474. return g_file_get_parse_name (location);
  3475. }
  3476. }
  3477. /**
  3478. * gedit_document_get_short_name_for_display:
  3479. * @doc: a #GeditDocument.
  3480. *
  3481. * Note: this never returns %NULL.
  3482. **/
  3483. gchar *
  3484. gedit_document_get_short_name_for_display (GeditDocument *doc)
  3485. {
  3486. - TeplFile *file;
  3487. + GeditDocumentPrivate *priv;
  3488. + GFile *location;
  3489. g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), g_strdup (""));
  3490. - file = tepl_buffer_get_file (TEPL_BUFFER (doc));
  3491. - return tepl_file_get_short_name (file);
  3492. + priv = gedit_document_get_instance_private (doc);
  3493. +
  3494. + location = gtk_source_file_get_location (priv->file);
  3495. +
  3496. + if (location == NULL)
  3497. + {
  3498. + return g_strdup_printf (_("Untitled Document %d"),
  3499. + priv->untitled_number);
  3500. + }
  3501. + else
  3502. + {
  3503. + return gedit_utils_basename_for_display (location);
  3504. + }
  3505. }
  3506. gchar *
  3507. gedit_document_get_content_type (GeditDocument *doc)
  3508. {
  3509. GeditDocumentPrivate *priv;
  3510. g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), NULL);
  3511. priv = gedit_document_get_instance_private (doc);
  3512. return g_strdup (priv->content_type);
  3513. }
  3514. /**
  3515. * gedit_document_get_mime_type:
  3516. * @doc: a #GeditDocument.
  3517. *
  3518. * Note: this never returns %NULL.
  3519. **/
  3520. gchar *
  3521. gedit_document_get_mime_type (GeditDocument *doc)
  3522. {
  3523. GeditDocumentPrivate *priv;
  3524. g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), g_strdup ("text/plain"));
  3525. priv = gedit_document_get_instance_private (doc);
  3526. if (priv->content_type != NULL &&
  3527. @@ -1005,225 +1246,398 @@ saved_query_info_cb (GFile *location,
  3528. priv->create = FALSE;
  3529. save_encoding_metadata (doc);
  3530. /* Async operation finished. */
  3531. g_object_unref (doc);
  3532. }
  3533. static void
  3534. gedit_document_saved_real (GeditDocument *doc)
  3535. {
  3536. GeditDocumentPrivate *priv;
  3537. GFile *location;
  3538. priv = gedit_document_get_instance_private (doc);
  3539. location = gtk_source_file_get_location (priv->file);
  3540. /* Keep the doc alive during the async operation. */
  3541. g_object_ref (doc);
  3542. g_file_query_info_async (location,
  3543. G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
  3544. G_FILE_QUERY_INFO_NONE,
  3545. G_PRIORITY_DEFAULT,
  3546. NULL,
  3547. (GAsyncReadyCallback) saved_query_info_cb,
  3548. doc);
  3549. }
  3550. +gboolean
  3551. +gedit_document_is_untouched (GeditDocument *doc)
  3552. +{
  3553. + GeditDocumentPrivate *priv;
  3554. + GFile *location;
  3555. +
  3556. + g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), TRUE);
  3557. +
  3558. + priv = gedit_document_get_instance_private (doc);
  3559. +
  3560. + location = gtk_source_file_get_location (priv->file);
  3561. +
  3562. + return location == NULL && !gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc));
  3563. +}
  3564. +
  3565. gboolean
  3566. gedit_document_is_untitled (GeditDocument *doc)
  3567. {
  3568. - TeplFile *file;
  3569. + GeditDocumentPrivate *priv;
  3570. g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), TRUE);
  3571. - file = tepl_buffer_get_file (TEPL_BUFFER (doc));
  3572. - return tepl_file_get_location (file) == NULL;
  3573. + priv = gedit_document_get_instance_private (doc);
  3574. +
  3575. + return gtk_source_file_get_location (priv->file) == NULL;
  3576. }
  3577. /*
  3578. * Deletion and external modification is only checked for local files.
  3579. */
  3580. gboolean
  3581. _gedit_document_needs_saving (GeditDocument *doc)
  3582. {
  3583. GeditDocumentPrivate *priv;
  3584. gboolean externally_modified = FALSE;
  3585. gboolean deleted = FALSE;
  3586. g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
  3587. priv = gedit_document_get_instance_private (doc);
  3588. if (gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc)))
  3589. {
  3590. return TRUE;
  3591. }
  3592. if (gtk_source_file_is_local (priv->file))
  3593. {
  3594. gtk_source_file_check_file_on_disk (priv->file);
  3595. externally_modified = gtk_source_file_is_externally_modified (priv->file);
  3596. deleted = gtk_source_file_is_deleted (priv->file);
  3597. }
  3598. return (externally_modified || deleted) && !priv->create;
  3599. }
  3600. +/* If @line is bigger than the lines of the document, the cursor is moved
  3601. + * to the last line and FALSE is returned.
  3602. + */
  3603. +gboolean
  3604. +gedit_document_goto_line (GeditDocument *doc,
  3605. + gint line)
  3606. +{
  3607. + GtkTextIter iter;
  3608. +
  3609. + gedit_debug (DEBUG_DOCUMENT);
  3610. +
  3611. + g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
  3612. + g_return_val_if_fail (line >= -1, FALSE);
  3613. +
  3614. + gtk_text_buffer_get_iter_at_line (GTK_TEXT_BUFFER (doc),
  3615. + &iter,
  3616. + line);
  3617. +
  3618. + gtk_text_buffer_place_cursor (GTK_TEXT_BUFFER (doc), &iter);
  3619. +
  3620. + return gtk_text_iter_get_line (&iter) == line;
  3621. +}
  3622. +
  3623. +gboolean
  3624. +gedit_document_goto_line_offset (GeditDocument *doc,
  3625. + gint line,
  3626. + gint line_offset)
  3627. +{
  3628. + GtkTextIter iter;
  3629. +
  3630. + g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
  3631. + g_return_val_if_fail (line >= -1, FALSE);
  3632. + g_return_val_if_fail (line_offset >= -1, FALSE);
  3633. +
  3634. + gtk_text_buffer_get_iter_at_line_offset (GTK_TEXT_BUFFER (doc),
  3635. + &iter,
  3636. + line,
  3637. + line_offset);
  3638. +
  3639. + gtk_text_buffer_place_cursor (GTK_TEXT_BUFFER (doc), &iter);
  3640. +
  3641. + return (gtk_text_iter_get_line (&iter) == line &&
  3642. + gtk_text_iter_get_line_offset (&iter) == line_offset);
  3643. +}
  3644. +
  3645. /**
  3646. * gedit_document_set_language:
  3647. * @doc:
  3648. * @lang: (allow-none):
  3649. **/
  3650. void
  3651. gedit_document_set_language (GeditDocument *doc,
  3652. GtkSourceLanguage *lang)
  3653. {
  3654. g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
  3655. set_language (doc, lang, TRUE);
  3656. }
  3657. /**
  3658. * gedit_document_get_language:
  3659. * @doc:
  3660. *
  3661. * Return value: (transfer none):
  3662. */
  3663. GtkSourceLanguage *
  3664. gedit_document_get_language (GeditDocument *doc)
  3665. {
  3666. g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), NULL);
  3667. return gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (doc));
  3668. }
  3669. glong
  3670. _gedit_document_get_seconds_since_last_save_or_load (GeditDocument *doc)
  3671. {
  3672. GeditDocumentPrivate *priv;
  3673. GDateTime *now;
  3674. GTimeSpan n_microseconds;
  3675. gedit_debug (DEBUG_DOCUMENT);
  3676. g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), -1);
  3677. priv = gedit_document_get_instance_private (doc);
  3678. if (priv->time_of_last_save_or_load == NULL)
  3679. {
  3680. return -1;
  3681. }
  3682. now = g_date_time_new_now_utc ();
  3683. if (now == NULL)
  3684. {
  3685. return -1;
  3686. }
  3687. n_microseconds = g_date_time_difference (now, priv->time_of_last_save_or_load);
  3688. g_date_time_unref (now);
  3689. return n_microseconds / (1000 * 1000);
  3690. }
  3691. +static gchar *
  3692. +get_metadata_from_metadata_manager (GeditDocument *doc,
  3693. + const gchar *key)
  3694. +{
  3695. + GeditDocumentPrivate *priv;
  3696. + GFile *location;
  3697. +
  3698. + priv = gedit_document_get_instance_private (doc);
  3699. +
  3700. + location = gtk_source_file_get_location (priv->file);
  3701. +
  3702. + if (location != NULL)
  3703. + {
  3704. + return gedit_metadata_manager_get (priv->metadata_manager, location, key);
  3705. + }
  3706. +
  3707. + return NULL;
  3708. +}
  3709. +
  3710. +static gchar *
  3711. +get_metadata_from_gvfs (GeditDocument *doc,
  3712. + const gchar *key)
  3713. +{
  3714. + GeditDocumentPrivate *priv;
  3715. +
  3716. + priv = gedit_document_get_instance_private (doc);
  3717. +
  3718. + if (priv->metadata_info != NULL &&
  3719. + g_file_info_has_attribute (priv->metadata_info, key) &&
  3720. + g_file_info_get_attribute_type (priv->metadata_info, key) == G_FILE_ATTRIBUTE_TYPE_STRING)
  3721. + {
  3722. + return g_strdup (g_file_info_get_attribute_string (priv->metadata_info, key));
  3723. + }
  3724. +
  3725. + return NULL;
  3726. +}
  3727. +
  3728. +static void
  3729. +set_gvfs_metadata (GFileInfo *info,
  3730. + const gchar *key,
  3731. + const gchar *value)
  3732. +{
  3733. + g_return_if_fail (G_IS_FILE_INFO (info));
  3734. +
  3735. + if (value != NULL)
  3736. + {
  3737. + g_file_info_set_attribute_string (info, key, value);
  3738. + }
  3739. + else
  3740. + {
  3741. + /* Unset the key */
  3742. + g_file_info_set_attribute (info,
  3743. + key,
  3744. + G_FILE_ATTRIBUTE_TYPE_INVALID,
  3745. + NULL);
  3746. + }
  3747. +}
  3748. +
  3749. /**
  3750. * gedit_document_get_metadata:
  3751. * @doc: a #GeditDocument
  3752. * @key: name of the key
  3753. *
  3754. * Gets the metadata assigned to @key.
  3755. *
  3756. * Returns: the value assigned to @key. Free with g_free().
  3757. */
  3758. gchar *
  3759. gedit_document_get_metadata (GeditDocument *doc,
  3760. const gchar *key)
  3761. {
  3762. GeditDocumentPrivate *priv;
  3763. g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), NULL);
  3764. g_return_val_if_fail (key != NULL, NULL);
  3765. priv = gedit_document_get_instance_private (doc);
  3766. - if (priv->metadata == NULL)
  3767. + if (priv->use_gvfs_metadata)
  3768. {
  3769. - return NULL;
  3770. + return get_metadata_from_gvfs (doc, key);
  3771. }
  3772. - return tepl_metadata_get (priv->metadata, key);
  3773. + return get_metadata_from_metadata_manager (doc, key);
  3774. }
  3775. /**
  3776. * gedit_document_set_metadata:
  3777. * @doc: a #GeditDocument
  3778. * @first_key: name of the first key to set
  3779. * @...: (allow-none): value for the first key, followed optionally by more key/value pairs,
  3780. * followed by %NULL.
  3781. *
  3782. * Sets metadata on a document.
  3783. */
  3784. void
  3785. gedit_document_set_metadata (GeditDocument *doc,
  3786. const gchar *first_key,
  3787. ...)
  3788. {
  3789. GeditDocumentPrivate *priv;
  3790. - va_list var_args;
  3791. + GFile *location;
  3792. const gchar *key;
  3793. + va_list var_args;
  3794. + GFileInfo *info = NULL;
  3795. g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
  3796. g_return_if_fail (first_key != NULL);
  3797. priv = gedit_document_get_instance_private (doc);
  3798. - if (priv->metadata == NULL)
  3799. + location = gtk_source_file_get_location (priv->file);
  3800. +
  3801. + /* With the metadata manager, can't set metadata for untitled documents.
  3802. + * With GVFS metadata, if the location is NULL the metadata is stored in
  3803. + * priv->metadata_info, so that it can be saved later if the document is
  3804. + * saved.
  3805. + */
  3806. + if (!priv->use_gvfs_metadata && location == NULL)
  3807. {
  3808. return;
  3809. }
  3810. + if (priv->use_gvfs_metadata)
  3811. + {
  3812. + info = g_file_info_new ();
  3813. + }
  3814. +
  3815. va_start (var_args, first_key);
  3816. - for (key = first_key; key != NULL; key = va_arg (var_args, const gchar *))
  3817. + for (key = first_key; key; key = va_arg (var_args, const gchar *))
  3818. {
  3819. const gchar *value = va_arg (var_args, const gchar *);
  3820. - tepl_metadata_set (priv->metadata, key, value);
  3821. +
  3822. + if (priv->use_gvfs_metadata)
  3823. + {
  3824. + set_gvfs_metadata (info, key, value);
  3825. + set_gvfs_metadata (priv->metadata_info, key, value);
  3826. + }
  3827. + else
  3828. + {
  3829. + gedit_metadata_manager_set (priv->metadata_manager, location, key, value);
  3830. + }
  3831. }
  3832. va_end (var_args);
  3833. - save_metadata_into_metadata_manager (doc);
  3834. + if (priv->use_gvfs_metadata && location != NULL)
  3835. + {
  3836. + GError *error = NULL;
  3837. +
  3838. + /* We save synchronously since metadata is always local so it
  3839. + * should be fast. Moreover this function can be called on
  3840. + * application shutdown, when the main loop has already exited,
  3841. + * so an async operation would not terminate.
  3842. + * https://bugzilla.gnome.org/show_bug.cgi?id=736591
  3843. + */
  3844. + g_file_set_attributes_from_info (location,
  3845. + info,
  3846. + G_FILE_QUERY_INFO_NONE,
  3847. + NULL,
  3848. + &error);
  3849. +
  3850. + if (error != NULL)
  3851. + {
  3852. + /* Do not complain about metadata if we are closing a
  3853. + * document for a non existing file.
  3854. + */
  3855. + if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT) &&
  3856. + !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
  3857. + {
  3858. + g_warning ("Set document metadata failed: %s", error->message);
  3859. + }
  3860. +
  3861. + g_error_free (error);
  3862. + }
  3863. + }
  3864. +
  3865. + g_clear_object (&info);
  3866. }
  3867. static void
  3868. update_empty_search (GeditDocument *doc)
  3869. {
  3870. GeditDocumentPrivate *priv;
  3871. gboolean new_value;
  3872. priv = gedit_document_get_instance_private (doc);
  3873. if (priv->search_context == NULL)
  3874. {
  3875. new_value = TRUE;
  3876. }
  3877. else
  3878. {
  3879. GtkSourceSearchSettings *search_settings;
  3880. search_settings = gtk_source_search_context_get_settings (priv->search_context);
  3881. new_value = gtk_source_search_settings_get_search_text (search_settings) == NULL;
  3882. }
  3883. if (priv->empty_search != new_value)
  3884. {
  3885. priv->empty_search = new_value;
  3886. g_object_notify_by_pspec (G_OBJECT (doc), properties[PROP_EMPTY_SEARCH]);
  3887. }
  3888. }
  3889. diff --git a/gedit/gedit-document.h b/gedit/gedit-document.h
  3890. index 901d02dc0..ed52a42fb 100644
  3891. --- a/gedit/gedit-document.h
  3892. +++ b/gedit/gedit-document.h
  3893. @@ -1,83 +1,93 @@
  3894. /*
  3895. * gedit-document.h
  3896. * This file is part of gedit
  3897. *
  3898. * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
  3899. * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
  3900. * Copyright (C) 2002-2005 Paolo Maggi
  3901. - * Copyright (C) 2014-2020 Sébastien Wilmet
  3902. + * Copyright (C) 2014 Sébastien Wilmet
  3903. *
  3904. * This program is free software; you can redistribute it and/or modify
  3905. * it under the terms of the GNU General Public License as published by
  3906. * the Free Software Foundation; either version 2 of the License, or
  3907. * (at your option) any later version.
  3908. *
  3909. * This program is distributed in the hope that it will be useful,
  3910. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  3911. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  3912. * GNU General Public License for more details.
  3913. *
  3914. * You should have received a copy of the GNU General Public License
  3915. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  3916. */
  3917. #ifndef GEDIT_DOCUMENT_H
  3918. #define GEDIT_DOCUMENT_H
  3919. -#include <tepl/tepl.h>
  3920. +#include <gtksourceview/gtksource.h>
  3921. G_BEGIN_DECLS
  3922. #define GEDIT_TYPE_DOCUMENT (gedit_document_get_type())
  3923. -G_DECLARE_DERIVABLE_TYPE (GeditDocument, gedit_document, GEDIT, DOCUMENT, TeplBuffer)
  3924. +G_DECLARE_DERIVABLE_TYPE (GeditDocument, gedit_document, GEDIT, DOCUMENT, GtkSourceBuffer)
  3925. struct _GeditDocumentClass
  3926. {
  3927. - TeplBufferClass parent_class;
  3928. + GtkSourceBufferClass parent_class;
  3929. /* Signals */
  3930. + void (* cursor_moved) (GeditDocument *document);
  3931. void (* load) (GeditDocument *document);
  3932. void (* loaded) (GeditDocument *document);
  3933. void (* save) (GeditDocument *document);
  3934. void (* saved) (GeditDocument *document);
  3935. };
  3936. GeditDocument *gedit_document_new (void);
  3937. GtkSourceFile *gedit_document_get_file (GeditDocument *doc);
  3938. gchar *gedit_document_get_short_name_for_display (GeditDocument *doc);
  3939. gchar *gedit_document_get_content_type (GeditDocument *doc);
  3940. gchar *gedit_document_get_mime_type (GeditDocument *doc);
  3941. +gboolean gedit_document_is_untouched (GeditDocument *doc);
  3942. +
  3943. gboolean gedit_document_is_untitled (GeditDocument *doc);
  3944. +gboolean gedit_document_goto_line (GeditDocument *doc,
  3945. + gint line);
  3946. +
  3947. +gboolean gedit_document_goto_line_offset (GeditDocument *doc,
  3948. + gint line,
  3949. + gint line_offset);
  3950. +
  3951. void gedit_document_set_language (GeditDocument *doc,
  3952. GtkSourceLanguage *lang);
  3953. GtkSourceLanguage
  3954. *gedit_document_get_language (GeditDocument *doc);
  3955. gchar *gedit_document_get_metadata (GeditDocument *doc,
  3956. const gchar *key);
  3957. void gedit_document_set_metadata (GeditDocument *doc,
  3958. const gchar *first_key,
  3959. ...);
  3960. void gedit_document_set_search_context (GeditDocument *doc,
  3961. GtkSourceSearchContext *search_context);
  3962. GtkSourceSearchContext *
  3963. gedit_document_get_search_context (GeditDocument *doc);
  3964. G_END_DECLS
  3965. #endif /* GEDIT_DOCUMENT_H */
  3966. /* ex:set ts=8 noet: */
  3967. diff --git a/gedit/gedit-documents-panel.c b/gedit/gedit-documents-panel.c
  3968. index 98d84a98f..8033f944e 100644
  3969. --- a/gedit/gedit-documents-panel.c
  3970. +++ b/gedit/gedit-documents-panel.c
  3971. @@ -1,56 +1,55 @@
  3972. /*
  3973. * gedit-documents-panel.c
  3974. * This file is part of gedit
  3975. *
  3976. * Copyright (C) 2014 - Sébastien Lafargue <slafargue@gnome.org>
  3977. *
  3978. * This program is free software; you can redistribute it and/or modify
  3979. * it under the terms of the GNU General Public License as published by
  3980. * the Free Software Foundation; either version 2 of the License, or
  3981. * (at your option) any later version.
  3982. *
  3983. * This program is distributed in the hope that it will be useful,
  3984. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  3985. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  3986. * GNU General Public License for more details.
  3987. *
  3988. * You should have received a copy of the GNU General Public License
  3989. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  3990. */
  3991. #include "config.h"
  3992. #include "gedit-documents-panel.h"
  3993. #include <glib/gi18n.h>
  3994. -#include <tepl/tepl.h>
  3995. #include "gedit-debug.h"
  3996. #include "gedit-document.h"
  3997. #include "gedit-multi-notebook.h"
  3998. #include "gedit-notebook.h"
  3999. #include "gedit-notebook-popup-menu.h"
  4000. #include "gedit-tab.h"
  4001. #include "gedit-tab-private.h"
  4002. #include "gedit-utils.h"
  4003. #include "gedit-commands-private.h"
  4004. typedef struct _GeditDocumentsGenericRow GeditDocumentsGenericRow;
  4005. typedef struct _GeditDocumentsGenericRow GeditDocumentsGroupRo