123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593 |
- From b190bdb716fc8bb0cd515ee10fb3c51debede5fa Mon Sep 17 00:00:00 2001
- From: Zander Brown <zbrown@gnome.org>
- Date: Tue, 13 Apr 2021 04:53:21 +0000
- Subject: [PATCH] deteplification: the mega commit
- MIME-Version: 1.0
- Content-Type: text/plain; charset=UTF-8
- Content-Transfer-Encoding: 8bit
- This commit is a reverse patch of a rebased version of gedit with
- commits related to tepl/amtk removed
- Sébastien Wilmet has stopped development of these libraries, relevant
- commits:
- https://gitlab.gnome.org/GNOME/amtk/-/commit/34a1171298808e5d9bd50540ee194b8be35bce9d
- https://gitlab.gnome.org/GNOME/tepl/-/commit/457b5c37ebcb2ebb23cae10cd47f1342db45a98e
- As a result usage is being dropped in favour simplifing gedit
- dependencies, because there are not enough developers, and too many bugs.
- Do you prefer a rock-solid text editor? Or a text editor with some shiny
- and non-essential dependencies that complicate the build, at the expense
- of more bugs?
- Tracked at: https://gitlab.gnome.org/Infrastructure/Infrastructure/-/issues/564
- Commits Dropped:
- cfeb7cb6c build: add Tepl dependency, second try
- 872fb4809 Utils: use str truncate functions from Tepl
- 9a121d523 Utils: deprecate str_end_truncate()
- e0e602799 No longer use gedit_utils_str_end_truncate()
- 657ce9f7a Utils: deprecate str_middle_truncate()
- 6eefa74c2 No longer use gedit_utils_str_middle_truncate()
- 169c1594e main: call tepl_init() and tepl_finalize()
- ec31f0c22 snap: Fixed build failures by added tepl part
- 76cf5562d Document: remove metadata implementation
- 75cdb6a77 Document: second pass to remove metadata implementation
- d6b158ca6 App: remove the GeditMetadataManager
- 6eccd6672 Remove GeditMetadataManager
- 03929157e build: remove enable-gvfs-metadata option
- 1dad3bce2 build: remove libxml dependency
- 8c0825424 metadata: adapt key names for TeplFileMetadata
- c2904aa80 Document: metadata: create an internal TeplFile
- 9c8ede1e2 App: setup Tepl metadata manager
- 91bc04efc App: remove leftover comment
- b39dd0201 Document: use TeplFileMetadata to re-implement set/get_metadata()
- 494677bfc Utils: use tepl_utils_replace_home_dir_with_tilde()
- aaaa28a87 docs: gtk-doc fixxref: fix the path for gtk and add path for tepl
- 8710e89d8 Remove GeditViewCentering
- 5e0909c19 ViewFrame: disable overlay scrolling for the GtkScrolledWindow
- 7c7296b0e Remove overview map: remove from preferences dialog
- 26899e0ba Remove overview map
- 27f54a9ae replace-open-button: remove OpenDocumentSelector
- 504ced5a9 replace-open-button: Window: remove open document popover
- 3a8c5bbc2 replace-open-button: remove open button UI
- abab6529f replace-open-button: re-create a simple Open button
- 1ee984a41 replace-open-button: re-create simple Open Recent menu button (UI)
- f1a58a70b replace-open-button: set Open Recent menu with Amtk
- 020e0b340 replace-open-button: re-handle the fullscreen mode
- 4dfd2104e Window: remove dead code (#defines)
- 0caf371b1 Window: make the code a little clearer wrt fullscreen mode
- 584aeb202 Window: rename fullscreen_controls -> fullscreen_revealer
- 75705bf1d Window: some code cleanup wrt fullscreen mode
- cf0d62617 Window: simplify setting the state of the fullscreen revealer
- 8706e5624 Window: fullscreen mode: remove idle function
- 6361b281c Window: fullscreen mode: remove no longer needed code
- 8d3e6faf2 Window: fullscreen mode: fix headerbar shown/hidden "stuttering"
- a437e5245 Window: fullscreen mode: add comment about the "stuttering" fix
- d064c5f88 Window: remove useless #include
- 15833e5c7 build: list of deps: simplify
- 007caff57 build: list of deps: simplify version requirements
- 72dc3a477 build: avoid the use of a variable
- 4a49c8562 flatpak: update Amtk to 5.0.2
- 9ab7b0f0a utils: remove GBOOLEAN_TO_POINTER() and GPOINTER_TO_BOOLEAN()
- 55c5f1423 Utils: deprecate gedit_warning()
- cbdd3a85d PreferencesDialog: use tepl_utils_show_warning_dialog()
- 7a442c766 Utils: deprecate decode_uri(), use the tepl one
- bf3d57003 Use tepl_utils_decode_uri()
- 2e45bb03f io-error-info-bar: remove useless #include's
- 092411115 io-error-info-bar: use TeplInfoBar for the file_already_open_warning
- 8ccb4566f io-error-info-bar: file_already_open_warning moved to Tepl
- 8bfe0559a io-error-info-bar: use TeplInfoBar for no_backup_saving_error
- ca582d2c7 io-error-info-bar: fix fixme in no_backup_saving_error
- fa1758081 io-error-info-bar: no_backup_saving_error: show also error->message
- 321eccdd7 io-error-info-bar: no_back_saving_error moved to Tepl
- 7bb880114 io-error-info-bar: tepl function renamed to have a shorter name
- d1a14a063 io-error-info-bar: externally_modified: use TeplInfoBar
- bf60cc1af io-error-info-bar: invalid_character: TeplInfoBar + other improvements
- 44cff9798 io-error-info-bar: externally_modified: remove unneeded code
- 873ed25f1 io-error-info-bar: externally_modified: further simplify the code
- a8a4724fc io-error-info-bar: externally_modified: moved to Tepl
- ec8d8c717 io-error-info-bar: invalid_character: moved to Tepl
- 2aae17c31 flatpak: switch Tepl to Meson
- 9caaddeda Window: fix RTL bug for Open buttons in the headerbar
- 82d8c507d View: subclass TeplView
- e23569c59 View: deprecate lots of functions, use the TeplView ones
- 291eb9c8e commands-edit: use TeplView functions
- 00f8c5e63 Use tepl_view_scroll_to_cursor()
- 5fdeaee22 Document: deprecate goto_line() and goto_line_offset()
- d87bf25ba commands-file: use tepl_view_goto_line*()
- fd5500d90 Tab: use tepl_view_goto_line_offset()
- 3c8a1dcb8 ViewFrame: use tepl_view_goto_line*()
- 079f9699e pkg-config file: add Tepl as public dep
- cf6281d04 docs: document that gedit is in the process of using more Tepl features
- 9ac62a6fd build: require Tepl 5
- 3f84484d8 App: port to new Tepl metadata API
- 9b9fa6c77 Document: port to new Tepl metadata API
- 491280c04 docs: roadmap: link to new Tepl roadmap
- 49db2a666 PreferencesDialog: use TeplStyleSchemeChooserWidget to fix several bugs
- 94c3b70cb PreferencesDialog: improvements to color scheme management
- 53cfa1715 PreferencesDialog: fix some bugs when (un)installing color schemes
- da5b9af9f snap: the tepl build is meson only now
- 012a07cb7 snap: use the correct option to specify parameters
- 325aa857c Factory: class skeleton
- 7b8579770 Factory: implement ::create_metadata_manager_file vfunc
- d5a43cece Factory: create it in main() and set it as the TeplAbstractFactory
- 392545195 App: use tepl_application_handle_metadata()
- 8b2fa9092 Keep default buttons orientation for TeplInfoBars
- efe48bbe8 flatpak: remove uchardet, Tepl no longer depends on it
- 5e588d978 PreferencesDialog: improve code to install extra style scheme
- eada68d97 PreferencesDialog: use GtkFileChooserNative, not GeditFileChooserDialog
- 55fc5973c FileChooserDialog: remove hide() (now dead code)
- 4f5a5681b FileChooserDialog: remove add_pattern_filter() (now dead code)
- 105ca1ded File choosers: remove GeditFileChooserFlags
- ff1e9c27c Update Romanian translation
- b4a52f479 Merge branch 'master' of gitlab.gnome.org:GNOME/gedit
- 21d94f23b Remove all the deprecated API
- 4b5838b1e docs: update path to Amtk docs for the gtk-doc fixxref_args
- a4cf3ac57 Use tepl_pango_font_description_to_css()
- 205bfc855 Window: port to TeplLanguageChooserWidget
- ffedbc882 commands-view: port to TeplLanguageChooserDialog
- 1dc325294 Remove GeditHighlightModeSelector and GeditHighlightModeDialog
- e487680b2 Use Tepl 6 (currently 5.99)
- ee465ef0c Tab: port to TeplProgressInfoBar
- bc992e11e Remove GeditProgressInfoBar, replaced by TeplProgressInfoBar
- fa9d6aeaa docs: document the GeditProgressInfoBar removal
- bb4ba5543 docs: document that all deprecated APIs have been removed
- 325351805 GeditDocument: subclass TeplBuffer
- 8b01acace GeditDocument: remove the ::cursor-moved signal
- b938c50f8 Use the TeplBuffer::tepl-cursor-moved signal
- 6b6a6e595 GeditDocument: bind GtkSourceFile and TeplFile :location properties
- f73828fe1 GeditDocument: remove unused instance variable
- 01d8a1577 flatpak: build amtk from git master, not from an archive
- 6e78a57c9 GeditDocument: use tepl_file_get_short_name()
- 49749c38a GeditDocument: remove untitled_number handling
- 844f6185a Tab: use TeplFile:short-name property notification
- 49c0c814a GeditDocument: remove the :shortname property
- a4670d7ce help: "Untitled Document" -> "Untitled File"
- 4d4d5d48c Use tepl_buffer_is_untouched()
- b0f67d391 GeditDocument: remove is_untouched()
- 85b007052 GeditDocument: use the TeplFile location in is_untitled()
- 4df850fb6 View: use TeplSignalGroup
- ef0d0ca9b View: minor code changes
- 284e6c05c View: make set_font() private
- 6b1e782d9 View: code refactorings for set_font()
- ce790b510 View: use tepl_utils_override_font()
- 79b3e3011 GeditSettings: remove no longer needed code
- da4b3e61a GeditSettings: minor code change: removed unused function param
- 13033affa GeditSettings: rework fonts changes handling, add ::fonts-changed signal
- 878ceb988 GeditSettings: minor code change, improve get_system_font()
- 1e89921a3 GeditSettings: add get_selected_font()
- 9ef4cf7ed View: simplify the code to update the font
- 3a3de93bd debug: remove DEBUG_METADATA (dead code)
- 43925dac7 recent: use the TeplFile
- 2f7c4a691 recent: move some functions to gedit-recent-osx
- 87b1f50d4 recent-osx: add TODO comment
- Brought to you by GitLens, which honesntly has been very useful
- unpicking all this and sticking it back together again
- ---
- NEWS | 12 +
- build-aux/flatpak/org.gnome.gedit.yml | 15 +-
- build-aux/snap/snapcraft.yaml | 27 +-
- data/org.gnome.gedit.gschema.xml.in | 5 +
- docs/gedit-development-getting-started.md | 8 +-
- docs/reference/api-breaks.xml | 50 +
- docs/reference/gedit-docs.xml | 1 +
- docs/reference/gedit-sections.txt | 36 +
- docs/reference/meson.build | 6 +-
- docs/roadmap-done.md | 56 -
- docs/roadmap.md | 19 +-
- gedit/Gedit-3.0.metadata | 1 +
- gedit/gedit-app-osx.m | 4 +-
- gedit/gedit-app-private.h | 3 +
- gedit/gedit-app.c | 54 +-
- gedit/gedit-commands-edit.c | 28 +-
- gedit/gedit-commands-file.c | 26 +-
- gedit/gedit-commands-search.c | 7 +-
- gedit/gedit-commands-view.c | 42 +-
- gedit/gedit-debug.c | 4 +
- gedit/gedit-debug.h | 2 +
- gedit/gedit-document-private.h | 12 +-
- gedit/gedit-document.c | 534 ++++++-
- gedit/gedit-document.h | 18 +-
- gedit/gedit-documents-panel.c | 3 +-
- gedit/gedit-factory.c | 50 -
- gedit/gedit-factory.h | 53 -
- gedit/gedit-file-chooser-dialog-gtk.c | 72 +-
- gedit/gedit-file-chooser-dialog-gtk.h | 9 +-
- gedit/gedit-file-chooser-dialog.c | 40 +-
- gedit/gedit-file-chooser-dialog.h | 17 +
- gedit/gedit-highlight-mode-dialog.c | 102 ++
- gedit/gedit-highlight-mode-dialog.h | 41 +
- gedit/gedit-highlight-mode-selector.c | 375 +++++
- gedit/gedit-highlight-mode-selector.h | 44 +
- gedit/gedit-io-error-info-bar.c | 362 ++++-
- gedit/gedit-io-error-info-bar.h | 10 +
- gedit/gedit-metadata-manager.c | 650 ++++++++
- gedit/gedit-metadata-manager.h | 49 +
- gedit/gedit-open-document-selector-helper.c | 103 ++
- gedit/gedit-open-document-selector-helper.h | 103 ++
- gedit/gedit-open-document-selector-store.c | 820 +++++++++++
- gedit/gedit-open-document-selector-store.h | 68 +
- gedit/gedit-open-document-selector.c | 1304 +++++++++++++++++
- gedit/gedit-open-document-selector.h | 44 +
- gedit/gedit-pango.c | 230 +++
- gedit/gedit-pango.h | 28 +
- gedit/gedit-preferences-dialog.c | 447 +++---
- gedit/gedit-print-job.c | 4 +-
- gedit/gedit-progress-info-bar.c | 177 +++
- gedit/gedit-progress-info-bar.h | 53 +
- gedit/gedit-recent-osx.c | 249 ----
- gedit/gedit-recent-osx.h | 54 -
- gedit/gedit-recent.c | 231 ++-
- gedit/gedit-recent.h | 23 +-
- gedit/gedit-settings.c | 177 ++-
- gedit/gedit-settings.h | 7 +-
- gedit/gedit-tab.c | 115 +-
- gedit/gedit-utils.c | 333 ++++-
- gedit/gedit-utils.h | 21 +-
- gedit/gedit-view-centering.c | 495 +++++++
- gedit/gedit-view-centering.h | 67 +
- gedit/gedit-view-frame.c | 37 +-
- gedit/gedit-view-frame.h | 4 +
- gedit/gedit-view.c | 322 +++-
- gedit/gedit-view.h | 24 +-
- gedit/gedit-window-private.h | 15 +-
- gedit/gedit-window.c | 380 ++---
- gedit/gedit.c | 8 +-
- gedit/meson.build | 23 +-
- gedit/resources/css/gedit-style.css | 12 +
- gedit/resources/css/gedit.adwaita.css | 25 +
- gedit/resources/gedit.gresource.xml.in | 4 +
- .../ui/gedit-highlight-mode-dialog.ui | 87 ++
- .../ui/gedit-highlight-mode-selector.ui | 83 ++
- .../ui/gedit-open-document-selector.ui | 115 ++
- .../resources/ui/gedit-preferences-dialog.ui | 30 +-
- gedit/resources/ui/gedit-progress-info-bar.ui | 88 ++
- gedit/resources/ui/gedit-view-frame.ui | 27 +-
- gedit/resources/ui/gedit-window.ui | 87 +-
- help/C/gedit-tab-groups.page | 4 +-
- meson.build | 34 +-
- meson_options.txt | 7 +
- plugins/snippets/snippets/document.py | 10 +-
- plugins/spell/gedit-spell-plugin.c | 9 +-
- po/POTFILES.in | 8 +-
- 86 files changed, 8160 insertions(+), 1283 deletions(-)
- delete mode 100644 docs/roadmap-done.md
- delete mode 100644 gedit/gedit-factory.c
- delete mode 100644 gedit/gedit-factory.h
- create mode 100644 gedit/gedit-highlight-mode-dialog.c
- create mode 100644 gedit/gedit-highlight-mode-dialog.h
- create mode 100644 gedit/gedit-highlight-mode-selector.c
- create mode 100644 gedit/gedit-highlight-mode-selector.h
- create mode 100644 gedit/gedit-metadata-manager.c
- create mode 100644 gedit/gedit-metadata-manager.h
- create mode 100644 gedit/gedit-open-document-selector-helper.c
- create mode 100644 gedit/gedit-open-document-selector-helper.h
- create mode 100644 gedit/gedit-open-document-selector-store.c
- create mode 100644 gedit/gedit-open-document-selector-store.h
- create mode 100644 gedit/gedit-open-document-selector.c
- create mode 100644 gedit/gedit-open-document-selector.h
- create mode 100644 gedit/gedit-pango.c
- create mode 100644 gedit/gedit-pango.h
- create mode 100644 gedit/gedit-progress-info-bar.c
- create mode 100644 gedit/gedit-progress-info-bar.h
- delete mode 100644 gedit/gedit-recent-osx.c
- delete mode 100644 gedit/gedit-recent-osx.h
- create mode 100644 gedit/gedit-view-centering.c
- create mode 100644 gedit/gedit-view-centering.h
- create mode 100644 gedit/resources/ui/gedit-highlight-mode-dialog.ui
- create mode 100644 gedit/resources/ui/gedit-highlight-mode-selector.ui
- create mode 100644 gedit/resources/ui/gedit-open-document-selector.ui
- create mode 100644 gedit/resources/ui/gedit-progress-info-bar.ui
- diff --git a/NEWS b/NEWS
- index e7f2c81f3..476a367a7 100644
- --- a/NEWS
- +++ b/NEWS
- @@ -1,3 +1,15 @@
- +News in [unreleased]
- +----------------------------
- +* Deteplification:
- + - The tepl maintainer has "frozen" the project until further notice
- + - Moving things to tepl introduced some breakage, such as translation of the
- + default filename
- + - gedit didn't use much of the API anyway
- + - Used even less of amtk
- + - Revert all usage of amtk and tepl
- + - Unfortunatly a couple bug fixes may have been lost
- + - Plugin API is essentially reverted to 3.36
- +
- News in 40.1, 2021-04-17
- ------------------------
- * Use document folder when opening new files
- diff --git a/build-aux/flatpak/org.gnome.gedit.yml b/build-aux/flatpak/org.gnome.gedit.yml
- index 1438abd07..d3b535176 100644
- --- a/build-aux/flatpak/org.gnome.gedit.yml
- +++ b/build-aux/flatpak/org.gnome.gedit.yml
- @@ -32,56 +32,51 @@ cleanup:
- - "/share/aclocal"
- - "/man"
- - "/share/man"
- - "/share/gtk-doc"
- - "/share/vala"
- - "/share/gir-1.0"
- - "*.la"
- - "*.a"
-
- modules:
- - name: libpeas
- buildsystem: meson
- config-opts:
- - "-Dlua51=false"
- - "-Dvapi=true"
- - "-Ddemos=false"
- - "-Dglade_catalog=false"
- sources:
- - type: archive
- url: https://download.gnome.org/sources/libpeas/1.28/libpeas-1.28.0.tar.xz
- sha256: 42d91993b46ed50f16add6d9577ecc22beb8e2dffa7101e2232c2b63733b8b15
-
- - name: gspell
- cleanup:
- - "/bin"
- sources:
- - type: archive
- url: https://download.gnome.org/sources/gspell/1.9/gspell-1.9.1.tar.xz
- sha256: dcbb769dfdde8e3c0a8ed3102ce7e661abbf7ddf85df08b29915e92cd723abdd
-
- - - name: amtk
- - buildsystem: meson
- + - name: uchardet
- + buildsystem: cmake-ninja
- sources:
- - - type: git
- - url: https://gitlab.gnome.org/GNOME/amtk.git
- -
- - - name: tepl
- - buildsystem: meson
- - sources:
- - - type: git
- - url: https://gitlab.gnome.org/GNOME/tepl.git
- + - type: archive
- + url: https://www.freedesktop.org/software/uchardet/releases/uchardet-0.0.6.tar.xz
- + sha256: 8351328cdfbcb2432e63938721dd781eb8c11ebc56e3a89d0f84576b96002c61
-
- - name: gedit
- buildsystem: meson
- sources:
- - type: git
- url: https://gitlab.gnome.org/GNOME/gedit.git
- # To build a local branch, comment out 'url' and uncomment:
- # path: ../../
- # branch: wip/misc
-
- - name: gedit-plugins
- buildsystem: meson
- sources:
- - type: git
- url: https://gitlab.gnome.org/GNOME/gedit-plugins.git
- diff --git a/build-aux/snap/snapcraft.yaml b/build-aux/snap/snapcraft.yaml
- index fc49c3949..43db5e027 100644
- --- a/build-aux/snap/snapcraft.yaml
- +++ b/build-aux/snap/snapcraft.yaml
- @@ -14,121 +14,98 @@ layout:
- symlink: $SNAP/usr/share/gedit
-
- slots:
- # for GtkApplication registration
- gedit:
- interface: dbus
- bus: session
- name: org.gnome.gedit
-
- apps:
- gedit:
- command: usr/bin/gedit
- extensions: [gnome-3-28]
- plugs:
- - avahi-observe
- - cups-control
- - gsettings
- - home
- - network
- - mount-observe
- - removable-media
- common-id: org.gnome.gedit.desktop
- environment:
- GSETTINGS_SCHEMA_DIR: $SNAP/share/glib-2.0/schemas
- 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
- 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
- PYTHONPATH: $SNAP/usr/lib/python3/dist-packages:$SNAP/gnome-platform/usr/lib/python3/dist-packages
- GTK_USE_PORTAL: 1
-
- parts:
- - amtk:
- - source: https://gitlab.gnome.org/GNOME/amtk.git
- - source-type: git
- - plugin: autotools
- - configflags:
- - - --prefix=/usr
- - - --enable-introspection=no
- - organize:
- - snap/gedit/current/usr: usr
- -
- - tepl:
- - after: [amtk, gtksourceview]
- - source: https://gitlab.gnome.org/GNOME/tepl.git
- - source-type: git
- - plugin: meson
- - meson-parameters:
- - - --prefix=/usr
- - organize:
- - snap/gedit/current/usr: usr
- - build-packages:
- - - libuchardet-dev
- - stage-packages:
- - - libuchardet0
- -
- gtksourceview:
- source: https://gitlab.gnome.org/GNOME/gtksourceview.git
- source-type: git
- plugin: meson
- meson-parameters:
- - --prefix=/usr
- - -Dc_args="-Wno-error=undef"
- organize:
- snap/gedit/current/usr: usr
- build-packages:
- - autoconf-archive
- - gettext
- - gobject-introspection
- - gtk-doc-tools
- - libfribidi-dev
- - libgirepository1.0-dev
- - libglib2.0-dev
- - libgtk-3-dev
- - libpeas-dev
- - libxml2-dev
- - libxml2-utils
- - valac
- # meson gir overrides don't work well
- override-build: |
- snapcraftctl build
- cp $SNAPCRAFT_PART_INSTALL/usr/share/gir-1.0/GtkSource* /usr/share/gir-1.0
- cp $SNAPCRAFT_PART_INSTALL/usr/share/vala/vapi/gtksource* /usr/share/vala/vapi
-
- gedit:
- - after: [gtksourceview, tepl]
- + after: [gtksourceview]
- source: .
- source-type: git
- parse-info: [usr/share/metainfo/org.gnome.gedit.appdata.xml]
- plugin: meson
- meson-parameters:
- - --prefix=/usr
- - -Dvala_args="--vapidir=$SNAPCRAFT_STAGE/usr/share/vala/vapi"
- +
- build-environment:
- - C_INCLUDE_PATH: $SNAPCRAFT_STAGE/usr/include/gtksourceview-4
- override-build: |
- sed -i.bak -e 's|Icon=org.gnome.gedit$|Icon=${SNAP}/meta/gui/org.gnome.gedit.svg|g' data/org.gnome.gedit.desktop.in
- sed -i.bak -e "s|symlink_media: true|symlink_media: false|g" help/meson.build
- snapcraftctl build
- mkdir -p $SNAPCRAFT_PART_INSTALL/meta/gui/
- cp data/icons/org.gnome.gedit.svg $SNAPCRAFT_PART_INSTALL/meta/gui/
- cp ../install/usr/share/applications/org.gnome.gedit.desktop $SNAPCRAFT_PART_INSTALL/meta/gui/
- build-packages:
- - desktop-file-utils
- - gettext
- - gsettings-desktop-schemas-dev
- - gtk-doc-tools
- - itstool
- - libsoup2.4-dev
- - libgspell-1-dev
- - libxml2-dev
- - libglib2.0-dev
- - libgtk-3-dev
- - libpeas-dev
- - libx11-dev
- - python3
- - python-gi-dev
- - gobject-introspection
- - libgirepository1.0-dev
- - valac
- stage-packages:
- - libfribidi0
-
- diff --git a/data/org.gnome.gedit.gschema.xml.in b/data/org.gnome.gedit.gschema.xml.in
- index b797d843c..59325f4ef 100644
- --- a/data/org.gnome.gedit.gschema.xml.in
- +++ b/data/org.gnome.gedit.gschema.xml.in
- @@ -99,60 +99,65 @@
- <key name="auto-indent" type="b">
- <default>true</default>
- <summary>Automatic indent</summary>
- <description>Whether gedit should enable automatic indentation.</description>
- </key>
- <key name="display-line-numbers" type="b">
- <default>true</default>
- <summary>Display Line Numbers</summary>
- <description>Whether gedit should display line numbers in the editing area.</description>
- </key>
- <key name="highlight-current-line" type="b">
- <default>true</default>
- <summary>Highlight Current Line</summary>
- <description>Whether gedit should highlight the current line.</description>
- </key>
- <key name="bracket-matching" type="b">
- <default>true</default>
- <summary>Highlight Matching Brackets</summary>
- <description>Whether gedit should highlight matching brackets.</description>
- </key>
- <key name="display-right-margin" type="b">
- <default>false</default>
- <summary>Display Right Margin</summary>
- <description>Whether gedit should display the right margin in the editing area.</description>
- </key>
- <key name="right-margin-position" type="u">
- <default>80</default>
- <summary>Right Margin Position</summary>
- <description>Specifies the position of the right margin.</description>
- </key>
- + <key name="display-overview-map" type="b">
- + <default>false</default>
- + <summary>Display Overview Map</summary>
- + <description>Whether gedit should display the overview map for the document.</description>
- + </key>
- <key name="background-pattern" enum="org.gnome.gedit.BackgroundPatternType">
- <default>'none'</default>
- <summary>Document background pattern type</summary>
- <description>Whether the document will get a background pattern painted.</description>
- </key>
- <key name="smart-home-end" enum="org.gnome.gedit.SmartHomeEnd">
- <aliases>
- <alias value='DISABLED' target='disabled'/>
- <alias value='BEFORE' target='before'/>
- <alias value='AFTER' target='after'/>
- <alias value='ALWAYS' target='always'/>
- </aliases>
- <default>'after'</default>
- <summary>Smart Home End</summary>
- <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>
- </key>
- <key name="restore-cursor-position" type="b">
- <default>true</default>
- <summary>Restore Previous Cursor Position</summary>
- <description>Whether gedit should restore the previous cursor position when a file is loaded.</description>
- </key>
- <key name="syntax-highlighting" type="b">
- <default>true</default>
- <summary>Enable Syntax Highlighting</summary>
- <description>Whether gedit should enable syntax highlighting.</description>
- </key>
- <key name="search-highlighting" type="b">
- <default>true</default>
- <summary>Enable Search Highlighting</summary>
- <description>Whether gedit should highlight all the occurrences of the searched text.</description>
- diff --git a/docs/gedit-development-getting-started.md b/docs/gedit-development-getting-started.md
- index 4f930afc7..774bc180f 100644
- --- a/docs/gedit-development-getting-started.md
- +++ b/docs/gedit-development-getting-started.md
- @@ -4,65 +4,63 @@ gedit development - getting started
- The following explanations can be improved over time, if you see something
- missing, a feedback is welcome.
-
- Programming languages and paradigms
- -----------------------------------
-
- gedit is mostly written in C, with some plugins in Python or
- [Vala](https://wiki.gnome.org/Projects/Vala/). The build system is in
- [Meson](https://mesonbuild.com/).
-
- The code is object-oriented and event-driven. In C, it's thanks to the use of
- the GObject library (see next section). If you open some `*.c` or `*.h` files,
- you may think “what is this horror?!” but – don't panic – it's just some
- C/GObject boilerplate code, and that boilerplate can be generated by a tool. So
- once you've learned GObject, you will no longer be afraid ;-)
-
- Libraries used
- --------------
-
- As every GNOME application, gedit uses the GLib, GObject and GTK libraries. To
- modify the gedit source code, you should be familiar with those libraries. See
- the [GTK website](https://www.gtk.org/) and the document
- [The GLib/GTK Development Platform – A Getting Started Guide](https://people.gnome.org/~swilmet/glib-gtk-book/).
-
- The main widget used by gedit is GtkTextView, a general-purpose multiline text
- editor. To learn that widget API, read the excellent
- [GtkTextView tutorial](http://www.bravegnu.org/gtktext/) (a bit old but still
- mostly valid). But GtkTextView is not enough for source code edition. gedit
- actually uses the
- [GtkSourceView](https://wiki.gnome.org/Projects/GtkSourceView) library, which
- -contains a subclass of GtkTextView with many features useful for a text editor
- -or an IDE. But GtkSourceView is not enough to have a full-blown text editor,
- -gedit is actually in the process of using more features from the
- -[Tepl](https://wiki.gnome.org/Projects/Tepl) library, and to further develop
- -Tepl alongside gedit.
- +contains a subclass of GtkTextView with syntax highlighting, a completion
- +framework, the search and replace, and many other features useful for a text
- +editor or an IDE.
-
- For its plugin system, gedit uses the
- [libpeas](https://wiki.gnome.org/Projects/Libpeas) library.
-
- Plugins may have other dependencies, for example the spell-checking plugin uses
- [gspell](https://wiki.gnome.org/Projects/gspell).
-
- gedit architecture
- ------------------
-
- The [gedit Git repository](https://gitlab.gnome.org/GNOME/gedit) contains the
- _gedit core_ plus the default plugins. There is also the
- [gedit-plugins Git repository](https://gitlab.gnome.org/GNOME/gedit-plugins)
- for additional official plugins. The gedit core source code is in the `gedit/`
- directory. The plugins are in … `plugins/`!
-
- gedit core provides:
- - A basic text editor.
- - The integration of libpeas, with an API for plugins.
-
- There is a class diagram of gedit core in the file
- [class-diagram.dia](class-diagram.dia) (but it may be outdated, see the Git log
- for that file).
-
- Build/Installation
- ------------------
-
- See the file [build.md](build.md).
-
- First contribution
- diff --git a/docs/reference/api-breaks.xml b/docs/reference/api-breaks.xml
- index f631761a6..f03c35975 100644
- --- a/docs/reference/api-breaks.xml
- +++ b/docs/reference/api-breaks.xml
- @@ -1,53 +1,103 @@
- <?xml version="1.0"?>
- <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
- [
- <!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
- ]>
-
- <part id="api-breaks">
- <title>API Breaks</title>
-
- <para>
- gedit is a quite old piece of software (created in 1998, at the beginnings
- of the GNOME project), and as every software, the code evolves during its
- lifetime. So there are sometimes API breaks for gedit plugins, there are no
- API stability guarantees.
- </para>
-
- <para>
- When it is possible, instead of directly removing an API, that API is first
- marked as deprecated, and then removed for the next API break. See the
- <link linkend="api-index-deprecated">index of deprecated symbols</link>.
- </para>
-
- + <refsect1>
- + <title>40 -> 41</title>
- + <itemizedlist>
- + <listitem>
- + <para>
- + The <code>GeditProgressInfoBar</code> class has been restored
- + </para>
- + </listitem>
- + <listitem>
- + <para>
- + <link linkend="GeditDocument">GeditDocument</link> is no longer a subclass
- + of <link linkend="TeplBuffer">TeplBuffer</link>.
- + </para>
- + </listitem>
- + <listitem>
- + <para>
- + The <code>GeditDocument::cursor-moved</code> signal has been restored.
- + </para>
- + </listitem>
- + <listitem>
- + <para>
- + The <code>GeditDocument:shortname</code> property has been restored.
- + </para>
- + </listitem>
- + <listitem>
- + <para>
- + The <code>gedit_document_is_untouched()</code> function has been
- + restored.
- + </para>
- + </listitem>
- + <listitem>
- + <para>
- + The <code>gedit_view_set_font()</code> function has been restored.
- + </para>
- + </listitem>
- + <listitem>
- + <para>
- + <code>DEBUG_METADATA</code> has been restored.
- + </para>
- + </listitem>
- + <listitem>
- + <para>
- + The <code>GBOOLEAN_TO_POINTER()</code> and
- + <code>GPOINTER_TO_BOOLEAN()</code> macros have been restored to
- + <code>gedit-utils.h</code>.
- + </para>
- + </listitem>
- + </itemizedlist>
- + </refsect1>
- +
- <refsect1>
- <title>3.38 -> 40</title>
- <itemizedlist>
- <listitem>
- <para>
- All previously deprecated APIs have been removed.
- </para>
- </listitem>
- <listitem>
- <para>
- The <code>GeditProgressInfoBar</code> class has been removed, you can
- use <link linkend="TeplProgressInfoBar">TeplProgressInfoBar</link>
- instead.
- </para>
- </listitem>
- <listitem>
- <para>
- <link linkend="GeditDocument">GeditDocument</link> is now a subclass
- of <link linkend="TeplBuffer">TeplBuffer</link>.
- </para>
- </listitem>
- <listitem>
- <para>
- The <code>GeditDocument::cursor-moved</code> signal has been removed.
- You can use the <link linkend="TeplBuffer">TeplBuffer</link> API
- instead.
- </para>
- </listitem>
- <listitem>
- <para>
- diff --git a/docs/reference/gedit-docs.xml b/docs/reference/gedit-docs.xml
- index a0dc624cf..9e32e5469 100644
- --- a/docs/reference/gedit-docs.xml
- +++ b/docs/reference/gedit-docs.xml
- @@ -1,48 +1,49 @@
- <?xml version="1.0"?>
- <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
- "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
- <book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
- <bookinfo>
- <title>gedit Reference Manual</title>
- </bookinfo>
-
- <part id="api-reference">
- <title>API Reference</title>
- <xi:include href="xml/gedit-app.xml"/>
- <xi:include href="xml/gedit-app-activatable.xml"/>
- <xi:include href="xml/gedit-commands.xml"/>
- <xi:include href="xml/gedit-document.xml"/>
- <xi:include href="xml/gedit-encodings-combo-box.xml"/>
- <xi:include href="xml/gedit-menu-extension.xml"/>
- <xi:include href="xml/gedit-message-bus.xml"/>
- <xi:include href="xml/gedit-message.xml"/>
- + <xi:include href="xml/gedit-progress-info-bar.xml"/>
- <xi:include href="xml/gedit-statusbar.xml"/>
- <xi:include href="xml/gedit-tab.xml"/>
- <xi:include href="xml/gedit-view.xml"/>
- <xi:include href="xml/gedit-view-activatable.xml"/>
- <xi:include href="xml/gedit-window.xml"/>
- <xi:include href="xml/gedit-window-activatable.xml"/>
- <xi:include href="xml/gedit-debug.xml"/>
- <xi:include href="xml/gedit-utils.xml"/>
- </part>
-
- <xi:include href="api-breaks.xml"/>
-
- <part id="annexes">
- <title>Annexes</title>
-
- <chapter>
- <title>Object Hierarchy</title>
- <xi:include href="xml/tree_index.sgml"/>
- </chapter>
-
- <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
-
- <index>
- <title>Index of all symbols</title>
- <xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
- </index>
- <index role="deprecated">
- <title>Index of deprecated symbols</title>
- <xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
- </index>
- diff --git a/docs/reference/gedit-sections.txt b/docs/reference/gedit-sections.txt
- index cec055fce..a71e00faa 100644
- --- a/docs/reference/gedit-sections.txt
- +++ b/docs/reference/gedit-sections.txt
- @@ -27,61 +27,64 @@ gedit_app_activatable_activate
- gedit_app_activatable_deactivate
- gedit_app_activatable_extend_menu
- <SUBSECTION Standard>
- GEDIT_TYPE_APP_ACTIVATABLE
- GEDIT_APP_ACTIVATABLE
- GEDIT_APP_ACTIVATABLE_IFACE
- GEDIT_IS_APP_ACTIVATABLE
- GEDIT_APP_ACTIVATABLE_GET_IFACE
- gedit_app_activatable_get_type
- </SECTION>
-
- <SECTION>
- <FILE>gedit-commands</FILE>
- <TITLE>GeditCommands</TITLE>
- gedit_commands_load_location
- gedit_commands_load_locations
- gedit_commands_save_document
- gedit_commands_save_document_async
- gedit_commands_save_document_finish
- gedit_commands_save_all_documents
- </SECTION>
-
- <SECTION>
- <FILE>gedit-document</FILE>
- <TITLE>GeditDocument</TITLE>
- GeditDocument
- gedit_document_new
- gedit_document_get_file
- gedit_document_get_short_name_for_display
- gedit_document_get_mime_type
- +gedit_document_is_untouched
- gedit_document_is_untitled
- +gedit_document_goto_line
- +gedit_document_goto_line_offset
- gedit_document_set_language
- gedit_document_get_content_type
- gedit_document_get_metadata
- gedit_document_set_metadata
- gedit_document_set_search_context
- gedit_document_get_search_context
- <SUBSECTION Standard>
- GEDIT_DOCUMENT
- GEDIT_IS_DOCUMENT
- GEDIT_TYPE_DOCUMENT
- gedit_document_get_type
- GEDIT_DOCUMENT_CLASS
- GEDIT_IS_DOCUMENT_CLASS
- GEDIT_DOCUMENT_GET_CLASS
- </SECTION>
-
- <SECTION>
- <FILE>gedit-encodings-combo-box</FILE>
- <TITLE>GeditEncodingsComboBox</TITLE>
- GeditEncodingsComboBox
- gedit_encodings_combo_box_new
- gedit_encodings_combo_box_get_selected_encoding
- gedit_encodings_combo_box_set_selected_encoding
- <SUBSECTION Standard>
- GEDIT_ENCODINGS_COMBO_BOX
- GEDIT_IS_ENCODINGS_COMBO_BOX
- GEDIT_TYPE_ENCODINGS_COMBO_BOX
- gedit_encodings_combo_box_get_type
- GEDIT_ENCODINGS_COMBO_BOX_CLASS
- GEDIT_IS_ENCODINGS_COMBO_BOX_CLASS
- @@ -121,111 +124,138 @@ GEDIT_TYPE_MESSAGE_BUS
- gedit_message_bus_get_type
- GEDIT_MESSAGE_BUS_CLASS
- GEDIT_IS_MESSAGE_BUS_CLASS
- GEDIT_MESSAGE_BUS_GET_CLASS
- GeditMessageBusPrivate
- </SECTION>
-
- <SECTION>
- <FILE>gedit-message</FILE>
- <TITLE>GeditMessage</TITLE>
- GeditMessage
- gedit_message_get_object_path
- gedit_message_get_method
- gedit_message_type_has
- gedit_message_type_check
- gedit_message_has
- gedit_message_is_valid_object_path
- gedit_message_type_identifier
- <SUBSECTION Standard>
- GEDIT_MESSAGE
- GEDIT_MESSAGE_CONST
- GEDIT_IS_MESSAGE
- GEDIT_TYPE_MESSAGE
- gedit_message_get_type
- GEDIT_MESSAGE_CLASS
- GEDIT_IS_MESSAGE_CLASS
- GEDIT_MESSAGE_GET_CLASS
- GeditMessagePrivate
- </SECTION>
-
- +<SECTION>
- +<FILE>gedit-progress-info-bar</FILE>
- +<TITLE>GeditProgressInfoBar</TITLE>
- +GeditProgressInfoBar
- +gedit_progress_info_bar_new
- +gedit_progress_info_bar_set_icon_name
- +gedit_progress_info_bar_set_markup
- +gedit_progress_info_bar_set_text
- +gedit_progress_info_bar_set_fraction
- +gedit_progress_info_bar_pulse
- +<SUBSECTION Standard>
- +GEDIT_PROGRESS_INFO_BAR
- +GEDIT_IS_PROGRESS_INFO_BAR
- +GEDIT_TYPE_PROGRESS_INFO_BAR
- +gedit_progress_info_bar_get_type
- +GEDIT_PROGRESS_INFO_BAR_CLASS
- +GEDIT_IS_PROGRESS_INFO_BAR_CLASS
- +GEDIT_PROGRESS_INFO_BAR_GET_CLASS
- +</SECTION>
- +
- <SECTION>
- <FILE>gedit-statusbar</FILE>
- <TITLE>GeditStatusbar</TITLE>
- GeditStatusbar
- gedit_statusbar_new
- gedit_statusbar_set_window_state
- gedit_statusbar_set_overwrite
- gedit_statusbar_clear_overwrite
- gedit_statusbar_flash_message
- <SUBSECTION Standard>
- GEDIT_STATUSBAR
- GEDIT_IS_STATUSBAR
- GEDIT_TYPE_STATUSBAR
- gedit_statusbar_get_type
- GEDIT_STATUSBAR_CLASS
- GEDIT_IS_STATUSBAR_CLASS
- GEDIT_STATUSBAR_GET_CLASS
- </SECTION>
-
- <SECTION>
- <FILE>gedit-tab</FILE>
- <TITLE>GeditTab</TITLE>
- GeditTab
- GeditTabState
- gedit_tab_get_view
- gedit_tab_get_document
- gedit_tab_get_from_document
- gedit_tab_get_state
- gedit_tab_get_auto_save_enabled
- gedit_tab_set_auto_save_enabled
- gedit_tab_get_auto_save_interval
- gedit_tab_set_auto_save_interval
- gedit_tab_set_info_bar
- <SUBSECTION Standard>
- GEDIT_TAB
- GEDIT_IS_TAB
- GEDIT_TYPE_TAB
- gedit_tab_get_type
- GEDIT_TAB_CLASS
- GEDIT_IS_TAB_CLASS
- GEDIT_TAB_GET_CLASS
- GEDIT_TYPE_TAB_STATE
- gedit_tab_state_get_type
- </SECTION>
-
- <SECTION>
- <FILE>gedit-view</FILE>
- GeditViewPrivate
- <TITLE>GeditView</TITLE>
- GeditView
- gedit_view_new
- +gedit_view_cut_clipboard
- +gedit_view_copy_clipboard
- +gedit_view_paste_clipboard
- +gedit_view_delete_selection
- +gedit_view_select_all
- +gedit_view_scroll_to_cursor
- +gedit_view_set_font
- <SUBSECTION Standard>
- GEDIT_VIEW
- GEDIT_IS_VIEW
- GEDIT_TYPE_VIEW
- gedit_view_get_type
- GEDIT_VIEW_CLASS
- GEDIT_IS_VIEW_CLASS
- GEDIT_VIEW_GET_CLASS
- </SECTION>
-
- <SECTION>
- <FILE>gedit-view-activatable</FILE>
- <TITLE>GeditViewActivatable</TITLE>
- GeditViewActivatable
- gedit_view_activatable_activate
- gedit_view_activatable_deactivate
- <SUBSECTION Standard>
- GEDIT_TYPE_VIEW_ACTIVATABLE
- GEDIT_VIEW_ACTIVATABLE
- GEDIT_VIEW_ACTIVATABLE_IFACE
- GEDIT_IS_VIEW_ACTIVATABLE
- GEDIT_VIEW_ACTIVATABLE_GET_IFACE
- gedit_view_activatable_get_type
- </SECTION>
-
- <SECTION>
- <FILE>gedit-window</FILE>
- <TITLE>GeditWindow</TITLE>
- GeditWindow
- GeditWindowState
- @@ -264,70 +294,76 @@ gedit_window_state_get_type
-
- <SECTION>
- <FILE>gedit-window-activatable</FILE>
- <TITLE>GeditWindowActivatable</TITLE>
- GeditWindowActivatable
- gedit_window_activatable_activate
- gedit_window_activatable_deactivate
- gedit_window_activatable_update_state
- <SUBSECTION Standard>
- GEDIT_TYPE_WINDOW_ACTIVATABLE
- GEDIT_WINDOW_ACTIVATABLE
- GEDIT_WINDOW_ACTIVATABLE_IFACE
- GEDIT_IS_WINDOW_ACTIVATABLE
- GEDIT_WINDOW_ACTIVATABLE_GET_IFACE
- gedit_window_activatable_get_type
- </SECTION>
-
- <SECTION>
- <FILE>gedit-debug</FILE>
- GeditDebugSection
- DEBUG_VIEW
- DEBUG_PREFS
- DEBUG_WINDOW
- DEBUG_PANEL
- DEBUG_PLUGINS
- DEBUG_TAB
- DEBUG_DOCUMENT
- DEBUG_COMMANDS
- DEBUG_APP
- DEBUG_UTILS
- +DEBUG_METADATA
- gedit_debug_init
- gedit_debug
- gedit_debug_message
- gedit_debug_plugin_message
- <SUBSECTION Standard>
- GEDIT_TYPE_DEBUG_SECTION
- gedit_debug_section_get_type
- </SECTION>
-
- <SECTION>
- <FILE>gedit-menu-extension</FILE>
- GeditMenuExtension
- gedit_menu_extension_new
- gedit_menu_extension_append_menu_item
- gedit_menu_extension_prepend_menu_item
- gedit_menu_extension_remove_items
- <SUBSECTION Standard>
- GEDIT_IS_MENU_EXTENSION
- GEDIT_IS_MENU_EXTENSION_CLASS
- GEDIT_MENU_EXTENSION
- GEDIT_MENU_EXTENSION_CLASS
- GEDIT_MENU_EXTENSION_CONST
- GEDIT_MENU_EXTENSION_GET_CLASS
- GEDIT_TYPE_MENU_EXTENSION
- GeditMenuExtensionClass
- gedit_menu_extension_get_type
- </SECTION>
-
- <SECTION>
- <FILE>gedit-utils</FILE>
- +GBOOLEAN_TO_POINTER
- +GPOINTER_TO_BOOLEAN
- gedit_utils_menu_position_under_tree_view
- gedit_utils_set_atk_name_description
- +gedit_warning
- +gedit_utils_replace_home_dir_with_tilde
- gedit_utils_basename_for_display
- +gedit_utils_decode_uri
- gedit_utils_drop_get_uris
- gedit_utils_get_compression_type_from_content_type
- gedit_utils_is_valid_location
- gedit_utils_location_get_dirname_for_display
- gedit_utils_set_direct_save_filename
- gedit_utils_newline_type_to_string
- </SECTION>
- diff --git a/docs/reference/meson.build b/docs/reference/meson.build
- index 9a9c414dc..ed85f9cec 100644
- --- a/docs/reference/meson.build
- +++ b/docs/reference/meson.build
- @@ -1,42 +1,38 @@
- html_dir = get_option('prefix') / gnome.gtkdoc_html_dir('gedit')
-
- glib_docpath = dependency('glib-2.0').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/glib'
- gobject_docpath = dependency('gobject-2.0').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/gobject'
- gio_docpath = dependency('gio-2.0').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/gio'
- gdk_docpath = dependency('gdk-3.0').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/gdk3'
- gtk_docpath = dependency('gtk+-3.0').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/gtk3'
- gsv_docpath = dependency('gtksourceview-4').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/gtksourceview-4.0'
- -amtk_docpath = dependency('amtk-5').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/amtk-5'
- -tepl_docpath = dependency('tepl-6').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/tepl-6'
- libpeas_docpath = dependency('libpeas-1.0').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/libpeas'
-
- gedit_doc_dep = declare_dependency(
- link_with: libgedit_shared_lib,
- include_directories: root_include_dir,
- - dependencies: deps_basic_list,
- + dependencies: deps_basic_list + [libxml_dep],
- )
-
- gnome.gtkdoc(
- 'gedit',
- main_xml: 'gedit-docs.xml',
- src_dir: include_directories('../../gedit/'),
- dependencies: gedit_doc_dep,
- scan_args: ['--rebuild-types'],
- fixxref_args: [
- '--html-dir=@0@'.format(html_dir),
- '--extra-dir=@0@'.format(glib_docpath),
- '--extra-dir=@0@'.format(gobject_docpath),
- '--extra-dir=@0@'.format(gio_docpath),
- '--extra-dir=@0@'.format(gdk_docpath),
- '--extra-dir=@0@'.format(gtk_docpath),
- '--extra-dir=@0@'.format(gsv_docpath),
- - '--extra-dir=@0@'.format(amtk_docpath),
- - '--extra-dir=@0@'.format(tepl_docpath),
- '--extra-dir=@0@'.format(libpeas_docpath),
- ],
- content_files: [
- 'api-breaks.xml'
- ],
- ignore_headers: libgedit_private_headers,
- install: true,
- )
- diff --git a/docs/roadmap-done.md b/docs/roadmap-done.md
- deleted file mode 100644
- index 7f210e49b..000000000
- --- a/docs/roadmap-done.md
- +++ /dev/null
- @@ -1,56 +0,0 @@
- -gedit roadmap - done tasks
- -==========================
- -
- -Tepl-ification of the gedit core
- ---------------------------------
- -
- -- gedit 3.36:
- - - Start to use the Tepl library.
- - - Use some Tepl utility functions.
- - - Use TeplFileMetadata, remove GeditMetadataManager.
- -- gedit 3.38:
- - - Move some utility functions to the Tepl library.
- - - Refactor and move some I/O error infobars to Tepl.
- - - GeditView now inherits from TeplView.
- - - Port to the new Tepl metadata API.
- - - Use TeplStyleSchemeChooserWidget in the preferences dialog.
- - - Create GeditFactory class, subclass of TeplAbstractFactory.
- -- gedit 40:
- - - Use `tepl_pango_font_description_to_css()`.
- - - Use TeplLanguageChooser's, for choosing a language for the syntax
- - highlighting. Remove GeditHighlightModeSelector and
- - GeditHighlightModeDialog.
- - - Use TeplProgressInfoBar. Remove GeditProgressInfoBar.
- - - GeditDocument now inherits from TeplBuffer, start to use the
- - TeplBuffer and TeplFile APIs.
- -
- -Links:
- -- https://wiki.gnome.org/Projects/Tepl
- -
- -Tepl-ification of the gedit plugins
- ------------------------------------
- -
- -- gedit 40:
- - - Draw Spaces plugin: new implementation based on TeplSpaceDrawerPrefs.
- -
- -Other done tasks in gedit plugins
- ----------------------------------
- -
- -- gedit 40:
- - - Smart Spaces plugin: new implementation based on a GtkSourceView
- - feature.
- -
- -New version of gedit on Windows
- --------------------------------
- -
- -[gedit is now available on the Microsoft Store](https://www.microsoft.com/store/apps/9PL1J21XF0PT).
- -It was done during the GNOME 3.38 development cycle. The integration with
- -Windows is not perfect, but it works. It is planned to improve gedit for
- -Windows over time.
- -
- -Documentation for contributors
- -------------------------------
- -
- -Write a guide to get started with gedit development.
- -
- -Done during the GNOME 3.34 development cycle.
- diff --git a/docs/roadmap.md b/docs/roadmap.md
- index 44a2f00b7..ec9445712 100644
- --- a/docs/roadmap.md
- +++ b/docs/roadmap.md
- @@ -1,57 +1,40 @@
- gedit roadmap
- =============
-
- This page contains the plans for major code changes we hope to get done in the
- future.
-
- -See the [roadmap-done.md](roadmap-done.md) file for done tasks.
- +See also the [GtkSourceView](https://wiki.gnome.org/Projects/GtkSourceView/RoadMap).
-
- See the [NEWS file](../NEWS) for a detailed history.
-
- -See also the
- -[Tepl roadmap](https://gitlab.gnome.org/GNOME/tepl/blob/master/docs/roadmap.md).
- -
- -Continue to make the gedit source code more re-usable
- ------------------------------------------------------
- -
- -Status: **in progress** (this is an ongoing effort)
- -
- -Next steps:
- -- Use more features from the Tepl library, and develop Tepl alongside gedit.
- - The goal is to reduce the amount of code in gedit, by having re-usable code
- - in Tepl instead.
- -
- -Links:
- -- https://wiki.gnome.org/Apps/Gedit/ReusableCode
- -- https://wiki.gnome.org/Projects/Tepl
- -
- Improve gedit on Windows
- ------------------------
-
- Status: **in progress**
-
- [gedit is now available on the Microsoft Store](https://www.microsoft.com/store/apps/9PL1J21XF0PT).
- The integration with Windows is not perfect, but it works. It is planned to
- improve gedit for Windows over time.
-
- Replace search and replace dialog window by an horizontal bar below the text
- ----------------------------------------------------------------------------
-
- Status: **todo**
-
- To not hide the text.
-
- Be able to quit the application with all documents saved, and restored on next start
- ------------------------------------------------------------------------------------
-
- Status: **todo**
-
- Even for unsaved and untitled files, be able to quit gedit, restart it later and
- come back to the state before with all tabs restored.
-
- Improve the workflow for printing to paper
- ------------------------------------------
-
- Status: **todo**
-
- Implement it like in Firefox, show first a preview of the file to print.
- diff --git a/gedit/Gedit-3.0.metadata b/gedit/Gedit-3.0.metadata
- index e36d7cb30..1a5b45a3a 100644
- --- a/gedit/Gedit-3.0.metadata
- +++ b/gedit/Gedit-3.0.metadata
- @@ -1,23 +1,24 @@
- App cheader_filename="gedit/gedit-app.h"
- AppActivatable cheader_filename="gedit/gedit-app-activatable.h"
- DebugSection cheader_filename="gedit/gedit-debug.h"
- Document cheader_filename="gedit/gedit-document.h"
- EncodingsComboBox cheader_filename="gedit/gedit-encodings-combo-box.h"
- MenuExtension cheader_filename="gedit/gedit-menu-extension.h"
- Message cheader_filename="gedit/gedit-message.h"
- MessageBus cheader_filename="gedit/gedit-message-bus.h"
- +ProgressInfoBar cheader_filename="gedit/gedit-progress-info-bar.h"
- Statusbar cheader_filename="gedit/gedit-statusbar.h"
- Tab cheader_filename="gedit/gedit-tab.h"
- TabState cheader_filename="gedit/gedit-tab.h"
- View cheader_filename="gedit/gedit-view.h"
- ViewActivatable cheader_filename="gedit/gedit-view-activatable.h"
- Window cheader_filename="gedit/gedit-window.h"
- WindowActivatable cheader_filename="gedit/gedit-window-activatable.h"
- WindowState cheader_filename="gedit/gedit-window.h"
-
- commands_* cheader_filename="gedit/gedit-commands.h"
- debug* cheader_filename="gedit/gedit-debug.h"
- utils_* cheader_filename="gedit/gedit-utils.h"
-
- MessageBusForeach cheader_filename="gedit/gedit-message-bus.h"
- MessageCallback cheader_filename="gedit/gedit-message-bus.h"
- diff --git a/gedit/gedit-app-osx.m b/gedit/gedit-app-osx.m
- index b02e9a28b..5df1b94da 100644
- --- a/gedit/gedit-app-osx.m
- +++ b/gedit/gedit-app-osx.m
- @@ -4,61 +4,61 @@
- *
- * Copyright (C) 2010 - Jesse van den Kieboom
- *
- * gedit is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * gedit is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with gedit; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
- #include "gedit-app-osx.h"
-
- #include <gdk/gdkquartz.h>
- #include <string.h>
- #include <glib/gi18n.h>
-
- #include "gedit-app-private.h"
- #include "gedit-dirs.h"
- #include "gedit-debug.h"
- #include "gedit-commands.h"
- #include "gedit-commands-private.h"
- -#include "gedit-recent-osx.h"
- +#include "gedit-recent.h"
- #import <AppKit/AppKit.h>
-
- NSWindow *gdk_quartz_window_get_nswindow(GdkWindow *window);
- NSEvent *gdk_quartz_event_get_nsevent(GdkEvent *event);
-
- static GeditWindow *
- ensure_window (GeditAppOSX *app,
- gboolean with_empty_document)
- {
- GList *windows;
- GeditWindow *ret = NULL;
-
- windows = gtk_application_get_windows (GTK_APPLICATION (app));
-
- while (windows)
- {
- GtkWindow *window;
- GdkWindow *win;
- NSWindow *nswin;
-
- window = windows->data;
- windows = g_list_next (windows);
-
- if (!gtk_widget_get_realized (GTK_WIDGET (window)))
- {
- continue;
- }
-
- if (!GEDIT_IS_WINDOW (window))
- {
- @@ -259,61 +259,61 @@ gedit_app_osx_set_window_title_impl (GeditApp *app,
- }
-
- native = gdk_quartz_window_get_nswindow (wnd);
- document = gedit_window_get_active_document (window);
-
- if (document)
- {
- bool ismodified;
-
- if (gedit_document_is_untitled (document))
- {
- [native setRepresentedURL:nil];
- }
- else
- {
- GtkSourceFile *file;
- GFile *location;
- gchar *uri;
-
- file = gedit_document_get_file (document);
- location = gtk_source_file_get_location (file);
-
- uri = g_file_get_uri (location);
-
- NSURL *nsurl = [NSURL URLWithString:[NSString stringWithUTF8String:uri]];
-
- [native setRepresentedURL:nsurl];
- g_free (uri);
- }
-
- - ismodified = !tepl_buffer_is_untouched (TEPL_BUFFER (document));
- + ismodified = !gedit_document_is_untouched (document);
- [native setDocumentEdited:ismodified];
- }
- else
- {
- [native setRepresentedURL:nil];
- [native setDocumentEdited:false];
- }
-
- GEDIT_APP_CLASS (gedit_app_osx_parent_class)->set_window_title (app, window, title);
- }
-
- typedef struct
- {
- GeditAppOSX *app;
- GtkRecentInfo *info;
- } RecentFileInfo;
-
- static void
- recent_file_info_free (gpointer data,
- GClosure *closure)
- {
- RecentFileInfo *info = data;
-
- g_object_unref (info->app);
- gtk_recent_info_unref (info->info);
-
- g_slice_free (RecentFileInfo, data);
- }
-
- static void
- diff --git a/gedit/gedit-app-private.h b/gedit/gedit-app-private.h
- index 6e1278a3b..e9c58cc27 100644
- --- a/gedit/gedit-app-private.h
- +++ b/gedit/gedit-app-private.h
- @@ -1,52 +1,55 @@
- /*
- * gedit-app-private.h
- * This file is part of gedit
- *
- * Copyright (C) 2015 - Sébastien Wilmet <swilmet@gnome.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
- #ifndef GEDIT_APP_PRIVATE_H
- #define GEDIT_APP_PRIVATE_H
-
- #include "gedit-app.h"
- +#include "gedit-metadata-manager.h"
- #include "gedit-menu-extension.h"
-
- G_BEGIN_DECLS
-
- /* global print config */
- GtkPageSetup *_gedit_app_get_default_page_setup (GeditApp *app);
- void _gedit_app_set_default_page_setup (GeditApp *app,
- GtkPageSetup *page_setup);
- GtkPrintSettings *_gedit_app_get_default_print_settings (GeditApp *app);
- void _gedit_app_set_default_print_settings (GeditApp *app,
- GtkPrintSettings *settings);
-
- +GeditMetadataManager *_gedit_app_get_metadata_manager (GeditApp *app);
- +
- GMenuModel *_gedit_app_get_hamburger_menu (GeditApp *app);
-
- GMenuModel *_gedit_app_get_notebook_menu (GeditApp *app);
-
- GMenuModel *_gedit_app_get_tab_width_menu (GeditApp *app);
-
- GMenuModel *_gedit_app_get_line_col_menu (GeditApp *app);
-
- GeditMenuExtension *_gedit_app_extend_menu (GeditApp *app,
- const gchar *extension_point);
-
- G_END_DECLS
-
- #endif /* GEDIT_APP_PRIVATE_H */
-
- /* ex:set ts=8 noet: */
- diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
- index 5532d5975..27d71a87a 100644
- --- a/gedit/gedit-app.c
- +++ b/gedit/gedit-app.c
- @@ -1,83 +1,92 @@
- /*
- * gedit-app.c
- * This file is part of gedit
- *
- * Copyright (C) 2005-2006 - Paolo Maggi
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
- #include "config.h"
-
- #include "gedit-app.h"
- #include "gedit-app-private.h"
-
- #include <string.h>
- #include <unistd.h>
- #include <stdlib.h>
-
- #include <glib/gi18n.h>
- +#include <gio/gio.h>
- #include <libpeas/peas-extension-set.h>
- -#include <tepl/tepl.h>
- +#include <gtksourceview/gtksource.h>
-
- #include "gedit-commands-private.h"
- #include "gedit-notebook.h"
- #include "gedit-debug.h"
- #include "gedit-utils.h"
- #include "gedit-enum-types.h"
- #include "gedit-dirs.h"
- #include "gedit-settings.h"
- #include "gedit-app-activatable.h"
- #include "gedit-plugins-engine.h"
- #include "gedit-commands.h"
- #include "gedit-preferences-dialog.h"
- #include "gedit-tab.h"
-
- +#ifndef ENABLE_GVFS_METADATA
- +#include "gedit-metadata-manager.h"
- +#endif
- +
- #define GEDIT_PAGE_SETUP_FILE "gedit-page-setup"
- #define GEDIT_PRINT_SETTINGS_FILE "gedit-print-settings"
-
- typedef struct
- {
- GeditPluginsEngine *engine;
-
- +#ifndef ENABLE_GVFS_METADATA
- + GeditMetadataManager *metadata_manager;
- +#endif
- +
- GtkCssProvider *theme_provider;
-
- GtkPageSetup *page_setup;
- GtkPrintSettings *print_settings;
-
- GSettings *ui_settings;
- GSettings *window_settings;
-
- GMenuModel *hamburger_menu;
- GMenuModel *notebook_menu;
- GMenuModel *tab_width_menu;
- GMenuModel *line_col_menu;
-
- PeasExtensionSet *extensions;
-
- /* command line parsing */
- gboolean new_window;
- gboolean new_document;
- const GtkSourceEncoding *encoding;
- GInputStream *stdin_stream;
- GSList *file_list;
- gint line_position;
- gint column_position;
- GApplicationCommandLine *command_line;
- } GeditAppPrivate;
-
- static const GOptionEntry options[] =
- {
- /* Version */
- {
- @@ -118,60 +127,64 @@ static const GOptionEntry options[] =
- "wait", 'w', 0, G_OPTION_ARG_NONE, NULL,
- N_("Open files and block process until files are closed"),
- NULL
- },
-
- /* New instance */
- {
- "standalone", 's', 0, G_OPTION_ARG_NONE, NULL,
- N_("Run gedit in standalone mode"),
- NULL
- },
-
- /* collects file arguments */
- {
- G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, NULL, NULL,
- N_("[FILE…] [+LINE[:COLUMN]]")
- },
-
- {NULL}
- };
-
- G_DEFINE_TYPE_WITH_PRIVATE (GeditApp, gedit_app, GTK_TYPE_APPLICATION)
-
- static void
- gedit_app_dispose (GObject *object)
- {
- GeditAppPrivate *priv;
-
- priv = gedit_app_get_instance_private (GEDIT_APP (object));
-
- +#ifndef ENABLE_GVFS_METADATA
- + g_clear_object (&priv->metadata_manager);
- +#endif
- +
- g_clear_object (&priv->ui_settings);
- g_clear_object (&priv->window_settings);
-
- g_clear_object (&priv->page_setup);
- g_clear_object (&priv->print_settings);
-
- /* Note that unreffing the extensions will automatically remove
- * all extensions which in turn will deactivate the extension
- */
- g_clear_object (&priv->extensions);
-
- g_clear_object (&priv->engine);
-
- if (priv->theme_provider != NULL)
- {
- gtk_style_context_remove_provider_for_screen (gdk_screen_get_default (),
- GTK_STYLE_PROVIDER (priv->theme_provider));
- g_clear_object (&priv->theme_provider);
- }
-
- g_clear_object (&priv->hamburger_menu);
- g_clear_object (&priv->notebook_menu);
- g_clear_object (&priv->tab_width_menu);
- g_clear_object (&priv->line_col_menu);
-
- G_OBJECT_CLASS (gedit_app_parent_class)->dispose (object);
- }
-
- static gchar *
- gedit_app_help_link_id_impl (GeditApp *app,
- @@ -616,71 +629,82 @@ add_accelerator (GtkApplication *app,
- const gchar *action_name,
- const gchar *accel)
- {
- const gchar *vaccels[] = {
- accel,
- NULL
- };
-
- gtk_application_set_accels_for_action (app, action_name, vaccels);
- }
-
- static gboolean
- show_menubar (void)
- {
- GtkSettings *settings = gtk_settings_get_default ();
- gboolean result;
-
- g_object_get (settings,
- "gtk-shell-shows-menubar", &result,
- NULL);
-
- return result;
- }
-
- static void
- gedit_app_startup (GApplication *application)
- {
- GeditAppPrivate *priv;
- GtkCssProvider *css_provider;
- GtkSourceStyleSchemeManager *manager;
- +#ifndef ENABLE_GVFS_METADATA
- + const gchar *cache_dir;
- + gchar *metadata_filename;
- +#endif
-
- priv = gedit_app_get_instance_private (GEDIT_APP (application));
-
- G_APPLICATION_CLASS (gedit_app_parent_class)->startup (application);
-
- /* Setup debugging */
- gedit_debug_init ();
- gedit_debug_message (DEBUG_APP, "Startup");
-
- setup_theme_extensions (GEDIT_APP (application));
-
- +#ifndef ENABLE_GVFS_METADATA
- + cache_dir = gedit_dirs_get_user_cache_dir ();
- + metadata_filename = g_build_filename (cache_dir, "gedit-metadata.xml", NULL);
- + priv->metadata_manager = gedit_metadata_manager_new (metadata_filename);
- + g_free (metadata_filename);
- +#endif
- +
- /* Load/init settings */
- _gedit_settings_get_singleton ();
- priv->ui_settings = g_settings_new ("org.gnome.gedit.preferences.ui");
- priv->window_settings = g_settings_new ("org.gnome.gedit.state.window");
-
- g_action_map_add_action_entries (G_ACTION_MAP (application),
- app_entries,
- G_N_ELEMENTS (app_entries),
- application);
-
- /* menus */
- if (!show_menubar ())
- {
- gtk_application_set_menubar (GTK_APPLICATION (application), NULL);
- priv->hamburger_menu = get_menu_model (GEDIT_APP (application),
- "hamburger-menu");
- }
-
- priv->notebook_menu = get_menu_model (GEDIT_APP (application), "notebook-menu");
- priv->tab_width_menu = get_menu_model (GEDIT_APP (application), "tab-width-menu");
- priv->line_col_menu = get_menu_model (GEDIT_APP (application), "line-col-menu");
-
- /* Accelerators */
- add_accelerator (GTK_APPLICATION (application), "app.new-window", "<Primary>N");
- add_accelerator (GTK_APPLICATION (application), "app.quit", "<Primary>Q");
- add_accelerator (GTK_APPLICATION (application), "app.help", "F1");
- add_accelerator (GTK_APPLICATION (application), "app.shortcuts", "<Primary>question");
-
- add_accelerator (GTK_APPLICATION (application), "win.hamburger-menu", "F10");
- add_accelerator (GTK_APPLICATION (application), "win.open", "<Primary>O");
- @@ -1087,60 +1111,64 @@ save_print_settings (GeditApp *app)
- gchar *filename;
- GError *error = NULL;
-
- filename = get_print_settings_file ();
-
- gtk_print_settings_to_file (priv->print_settings,
- filename,
- &error);
- if (error)
- {
- g_warning ("%s", error->message);
- g_error_free (error);
- }
-
- g_free (filename);
- }
- }
-
- static void
- gedit_app_shutdown (GApplication *app)
- {
- gedit_debug_message (DEBUG_APP, "Quitting\n");
-
- /* Last window is gone... save some settings and exit */
- ensure_user_config_dir ();
-
- save_accels ();
- save_page_setup (GEDIT_APP (app));
- save_print_settings (GEDIT_APP (app));
-
- + /* GTK+ can still hold references to some gedit objects, for example
- + * GeditDocument for the clipboard. So the metadata-manager should be
- + * shutdown after.
- + */
- G_APPLICATION_CLASS (gedit_app_parent_class)->shutdown (app);
- }
-
- static gboolean
- window_delete_event (GeditWindow *window,
- GdkEvent *event,
- GeditApp *app)
- {
- GeditWindowState ws;
-
- ws = gedit_window_get_state (window);
-
- if (ws &
- (GEDIT_WINDOW_STATE_SAVING | GEDIT_WINDOW_STATE_PRINTING))
- {
- return TRUE;
- }
-
- _gedit_cmd_file_quit (NULL, NULL, window);
-
- /* Do not destroy the window */
- return TRUE;
- }
-
- static GeditWindow *
- gedit_app_create_window_impl (GeditApp *app)
- {
- GeditWindow *window;
-
- window = g_object_new (GEDIT_TYPE_WINDOW, "application", app, NULL);
- @@ -1226,69 +1254,64 @@ load_print_settings (GeditApp *app)
-
- priv->print_settings = gtk_print_settings_new_from_file (filename, &error);
- if (error != NULL)
- {
- /* - Ignore file not found error.
- * - Ignore empty file error, i.e. group not found. This happens
- * when we click on cancel in the print dialog, when using the
- * printing for the first time in gedit.
- */
- if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT) &&
- !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND))
- {
- g_warning ("Load print settings error: %s", error->message);
- }
-
- g_error_free (error);
- }
-
- g_free (filename);
-
- /* fall back to default settings */
- if (priv->print_settings == NULL)
- {
- priv->print_settings = gtk_print_settings_new ();
- }
- }
-
- static void
- gedit_app_init (GeditApp *app)
- {
- - TeplApplication *tepl_app;
- -
- g_set_application_name ("gedit");
- gtk_window_set_default_icon_name ("org.gnome.gedit");
-
- g_application_add_main_option_entries (G_APPLICATION (app), options);
- -
- - tepl_app = tepl_application_get_from_gtk_application (GTK_APPLICATION (app));
- - tepl_application_handle_metadata (tepl_app);
- }
-
- /**
- * gedit_app_create_window:
- * @app: the #GeditApp
- * @screen: (allow-none):
- *
- * Create a new #GeditWindow part of @app.
- *
- * Return value: (transfer none): the new #GeditWindow
- */
- GeditWindow *
- gedit_app_create_window (GeditApp *app,
- GdkScreen *screen)
- {
- GeditAppPrivate *priv;
- GeditWindow *window;
- GdkWindowState state;
- gint w, h;
-
- gedit_debug (DEBUG_APP);
-
- priv = gedit_app_get_instance_private (app);
-
- window = GEDIT_APP_GET_CLASS (app)->create_window (app);
-
- if (screen != NULL)
- {
- gtk_window_set_screen (GTK_WINDOW (window), screen);
- }
- @@ -1544,60 +1567,79 @@ _gedit_app_get_default_print_settings (GeditApp *app)
-
- priv = gedit_app_get_instance_private (app);
-
- if (priv->print_settings == NULL)
- {
- load_print_settings (app);
- }
-
- return gtk_print_settings_copy (priv->print_settings);
- }
-
- void
- _gedit_app_set_default_print_settings (GeditApp *app,
- GtkPrintSettings *settings)
- {
- GeditAppPrivate *priv;
-
- g_return_if_fail (GEDIT_IS_APP (app));
- g_return_if_fail (GTK_IS_PRINT_SETTINGS (settings));
-
- priv = gedit_app_get_instance_private (app);
-
- if (priv->print_settings != NULL)
- {
- g_object_unref (priv->print_settings);
- }
-
- priv->print_settings = g_object_ref (settings);
- }
-
- +
- +GeditMetadataManager *
- +_gedit_app_get_metadata_manager (GeditApp *app)
- +{
- +#ifndef ENABLE_GVFS_METADATA
- + GeditAppPrivate *priv;
- +
- + g_return_val_if_fail (GEDIT_IS_APP (app), NULL);
- +
- + priv = gedit_app_get_instance_private (app);
- +
- + return priv->metadata_manager;
- +#else
- + g_assert_not_reached ();
- + return NULL;
- +#endif
- +}
- +
- +
- GMenuModel *
- _gedit_app_get_hamburger_menu (GeditApp *app)
- {
- GeditAppPrivate *priv;
-
- g_return_val_if_fail (GEDIT_IS_APP (app), NULL);
-
- priv = gedit_app_get_instance_private (app);
-
- return priv->hamburger_menu;
- }
-
- GMenuModel *
- _gedit_app_get_notebook_menu (GeditApp *app)
- {
- GeditAppPrivate *priv;
-
- g_return_val_if_fail (GEDIT_IS_APP (app), NULL);
-
- priv = gedit_app_get_instance_private (app);
-
- return priv->notebook_menu;
- }
-
- GMenuModel *
- _gedit_app_get_tab_width_menu (GeditApp *app)
- {
- GeditAppPrivate *priv;
-
- g_return_val_if_fail (GEDIT_IS_APP (app), NULL);
- diff --git a/gedit/gedit-commands-edit.c b/gedit/gedit-commands-edit.c
- index 66ea0174b..978440150 100644
- --- a/gedit/gedit-commands-edit.c
- +++ b/gedit/gedit-commands-edit.c
- @@ -17,180 +17,180 @@
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
- #include "config.h"
-
- #include "gedit-commands.h"
- #include "gedit-commands-private.h"
-
- #include <gtk/gtk.h>
-
- #include "gedit-window.h"
- #include "gedit-debug.h"
- #include "gedit-view.h"
- #include "gedit-preferences-dialog.h"
-
- void
- _gedit_cmd_edit_undo (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
- {
- GeditWindow *window = GEDIT_WINDOW (user_data);
- GeditView *active_view;
- GtkSourceBuffer *active_document;
-
- gedit_debug (DEBUG_COMMANDS);
-
- active_view = gedit_window_get_active_view (window);
- - g_return_if_fail (active_view != NULL);
- + g_return_if_fail (active_view);
-
- active_document = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (active_view)));
-
- gtk_source_buffer_undo (active_document);
-
- - tepl_view_scroll_to_cursor (TEPL_VIEW (active_view));
- + gedit_view_scroll_to_cursor (active_view);
-
- gtk_widget_grab_focus (GTK_WIDGET (active_view));
- }
-
- void
- _gedit_cmd_edit_redo (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
- {
- GeditWindow *window = GEDIT_WINDOW (user_data);
- GeditView *active_view;
- GtkSourceBuffer *active_document;
-
- gedit_debug (DEBUG_COMMANDS);
-
- active_view = gedit_window_get_active_view (window);
- - g_return_if_fail (active_view != NULL);
- + g_return_if_fail (active_view);
-
- active_document = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (active_view)));
-
- gtk_source_buffer_redo (active_document);
-
- - tepl_view_scroll_to_cursor (TEPL_VIEW (active_view));
- + gedit_view_scroll_to_cursor (active_view);
-
- gtk_widget_grab_focus (GTK_WIDGET (active_view));
- }
-
- void
- _gedit_cmd_edit_cut (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
- {
- GeditWindow *window = GEDIT_WINDOW (user_data);
- GeditView *active_view;
-
- gedit_debug (DEBUG_COMMANDS);
-
- active_view = gedit_window_get_active_view (window);
- - g_return_if_fail (active_view != NULL);
- + g_return_if_fail (active_view);
-
- - tepl_view_cut_clipboard (TEPL_VIEW (active_view));
- + gedit_view_cut_clipboard (active_view);
-
- gtk_widget_grab_focus (GTK_WIDGET (active_view));
- }
-
- void
- _gedit_cmd_edit_copy (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
- {
- GeditWindow *window = GEDIT_WINDOW (user_data);
- GeditView *active_view;
-
- gedit_debug (DEBUG_COMMANDS);
-
- active_view = gedit_window_get_active_view (window);
- - g_return_if_fail (active_view != NULL);
- + g_return_if_fail (active_view);
-
- - tepl_view_copy_clipboard (TEPL_VIEW (active_view));
- + gedit_view_copy_clipboard (active_view);
-
- gtk_widget_grab_focus (GTK_WIDGET (active_view));
- }
-
- void
- _gedit_cmd_edit_paste (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
- {
- GeditWindow *window = GEDIT_WINDOW (user_data);
- GeditView *active_view;
-
- gedit_debug (DEBUG_COMMANDS);
-
- active_view = gedit_window_get_active_view (window);
- - g_return_if_fail (active_view != NULL);
- + g_return_if_fail (active_view);
-
- - tepl_view_paste_clipboard (TEPL_VIEW (active_view));
- + gedit_view_paste_clipboard (active_view);
-
- gtk_widget_grab_focus (GTK_WIDGET (active_view));
- }
-
- void
- _gedit_cmd_edit_delete (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
- {
- GeditWindow *window = GEDIT_WINDOW (user_data);
- GeditView *active_view;
-
- gedit_debug (DEBUG_COMMANDS);
-
- active_view = gedit_window_get_active_view (window);
- - g_return_if_fail (active_view != NULL);
- + g_return_if_fail (active_view);
-
- - tepl_view_delete_selection (TEPL_VIEW (active_view));
- + gedit_view_delete_selection (active_view);
-
- gtk_widget_grab_focus (GTK_WIDGET (active_view));
- }
-
- void
- _gedit_cmd_edit_select_all (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
- {
- GeditWindow *window = GEDIT_WINDOW (user_data);
- GeditView *active_view;
-
- gedit_debug (DEBUG_COMMANDS);
-
- active_view = gedit_window_get_active_view (window);
- - g_return_if_fail (active_view != NULL);
- + g_return_if_fail (active_view);
-
- - tepl_view_select_all (TEPL_VIEW (active_view));
- + gedit_view_select_all (active_view);
-
- gtk_widget_grab_focus (GTK_WIDGET (active_view));
- }
-
- void
- _gedit_cmd_edit_preferences (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
- {
- GeditWindow *window = GEDIT_WINDOW (user_data);
-
- gedit_debug (DEBUG_COMMANDS);
-
- gedit_show_preferences_dialog (window);
- }
-
- void
- _gedit_cmd_edit_overwrite_mode (GSimpleAction *action,
- GVariant *state,
- gpointer user_data)
- {
- GeditWindow *window = GEDIT_WINDOW (user_data);
- GeditView *active_view;
- gboolean overwrite;
-
- gedit_debug (DEBUG_COMMANDS);
-
- active_view = gedit_window_get_active_view (window);
- g_return_if_fail (active_view);
-
- diff --git a/gedit/gedit-commands-file.c b/gedit/gedit-commands-file.c
- index fb64f880d..d1d440a3e 100644
- --- a/gedit/gedit-commands-file.c
- +++ b/gedit/gedit-commands-file.c
- @@ -1,80 +1,75 @@
- /*
- * gedit-commands-file.c
- * This file is part of gedit
- *
- * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
- * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
- * Copyright (C) 2002-2005 Paolo Maggi
- * Copyright (C) 2014 Sébastien Wilmet
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
- #include "config.h"
-
- #include "gedit-commands.h"
- #include "gedit-commands-private.h"
-
- #include <glib/gi18n.h>
- -#include <tepl/tepl.h>
-
- #include "gedit-app.h"
- #include "gedit-debug.h"
- #include "gedit-document.h"
- #include "gedit-document-private.h"
- #include "gedit-tab.h"
- #include "gedit-tab-private.h"
- #include "gedit-window.h"
- #include "gedit-window-private.h"
- #include "gedit-notebook.h"
- #include "gedit-statusbar.h"
- #include "gedit-utils.h"
- #include "gedit-file-chooser-dialog.h"
- #include "gedit-file-chooser-open.h"
- #include "gedit-close-confirmation-dialog.h"
-
- -/* useful macro */
- -#define GBOOLEAN_TO_POINTER(i) (GINT_TO_POINTER ((i) ? 2 : 1))
- -#define GPOINTER_TO_BOOLEAN(i) ((gboolean) ((GPOINTER_TO_INT(i) == 2) ? TRUE : FALSE))
- -
- #define GEDIT_IS_CLOSING_ALL "gedit-is-closing-all"
- #define GEDIT_NOTEBOOK_TO_CLOSE "gedit-notebook-to-close"
- #define GEDIT_IS_QUITTING "gedit-is-quitting"
- #define GEDIT_IS_QUITTING_ALL "gedit-is-quitting-all"
-
- void
- _gedit_cmd_file_new (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
- {
- GeditWindow *window = GEDIT_WINDOW (user_data);
-
- gedit_debug (DEBUG_COMMANDS);
-
- gedit_window_create_tab (window, TRUE);
- }
-
- static GeditTab *
- get_tab_from_file (GList *docs,
- GFile *file)
- {
- GList *l;
-
- for (l = docs; l != NULL; l = l->next)
- {
- GeditDocument *doc;
- GtkSourceFile *source_file;
- GFile *location;
-
- doc = l->data;
- @@ -123,105 +118,107 @@ load_file_list (GeditWindow *window,
- gboolean jump_to = TRUE; /* Whether to jump to the new tab */
- const GSList *l;
- gint num_loaded_files = 0;
-
- gedit_debug (DEBUG_COMMANDS);
-
- win_docs = gedit_window_get_documents (window);
-
- /* Remove the files corresponding to documents already opened in
- * "window" and remove duplicates from the "files" list.
- */
- for (l = files; l != NULL; l = l->next)
- {
- GFile *file = l->data;
-
- if (is_duplicated_file (files_to_load, file))
- {
- continue;
- }
-
- tab = get_tab_from_file (win_docs, file);
-
- if (tab == NULL)
- {
- files_to_load = g_slist_prepend (files_to_load, file);
- }
- else
- {
- if (l == files)
- {
- - TeplView *view;
- + GeditDocument *doc;
-
- gedit_window_set_active_tab (window, tab);
- jump_to = FALSE;
- - view = TEPL_VIEW (gedit_tab_get_view (tab));
- + doc = gedit_tab_get_document (tab);
-
- if (line_pos > 0)
- {
- if (column_pos > 0)
- {
- - tepl_view_goto_line_offset (view,
- - line_pos - 1,
- - column_pos - 1);
- + gedit_document_goto_line_offset (doc,
- + line_pos - 1,
- + column_pos - 1);
- }
- else
- {
- - tepl_view_goto_line (view, line_pos - 1);
- + gedit_document_goto_line (doc, line_pos - 1);
- }
- +
- + gedit_view_scroll_to_cursor (gedit_tab_get_view (tab));
- }
- }
-
- ++num_loaded_files;
- loaded_files = g_slist_prepend (loaded_files,
- gedit_tab_get_document (tab));
- }
- }
-
- g_list_free (win_docs);
-
- if (files_to_load == NULL)
- {
- return g_slist_reverse (loaded_files);
- }
-
- files_to_load = g_slist_reverse (files_to_load);
- l = files_to_load;
-
- tab = gedit_window_get_active_tab (window);
- if (tab != NULL)
- {
- GeditDocument *doc;
-
- doc = gedit_tab_get_document (tab);
-
- - if (tepl_buffer_is_untouched (TEPL_BUFFER (doc)) &&
- + if (gedit_document_is_untouched (doc) &&
- gedit_tab_get_state (tab) == GEDIT_TAB_STATE_NORMAL)
- {
- _gedit_tab_load (tab,
- l->data,
- encoding,
- line_pos,
- column_pos,
- create);
-
- /* make sure the view has focus */
- gtk_widget_grab_focus (GTK_WIDGET (gedit_tab_get_view (tab)));
-
- l = g_slist_next (l);
- jump_to = FALSE;
-
- ++num_loaded_files;
- loaded_files = g_slist_prepend (loaded_files,
- gedit_tab_get_document (tab));
- }
- }
-
- while (l != NULL)
- {
- g_return_val_if_fail (l->data != NULL, NULL);
-
- tab = gedit_window_create_tab_from_location (window,
- l->data,
- encoding,
- line_pos,
- column_pos,
- @@ -446,113 +443,113 @@ _gedit_cmd_file_reopen_closed_tab (GSimpleAction *action,
- GFile *file;
-
- file = _gedit_window_pop_last_closed_doc (window);
- if (file != NULL)
- {
- gedit_commands_load_location (window, file, NULL, 0, 0);
- }
- }
-
- /* File saving */
-
- /* FIXME: modify this dialog to be similar to the one provided by gtk+ for
- * already existing files - Paolo (Oct. 11, 2005) */
- static gboolean
- replace_read_only_file (GtkWindow *parent,
- GFile *file)
- {
- GtkWidget *dialog;
- gint ret;
- gchar *parse_name;
- gchar *name_for_display;
-
- gedit_debug (DEBUG_COMMANDS);
-
- parse_name = g_file_get_parse_name (file);
-
- /* Truncate the name so it doesn't get insanely wide. Note that even
- * though the dialog uses wrapped text, if the name doesn't contain
- * white space then the text-wrapping code is too stupid to wrap it.
- */
- - name_for_display = tepl_utils_str_middle_truncate (parse_name, 50);
- + name_for_display = gedit_utils_str_middle_truncate (parse_name, 50);
- g_free (parse_name);
-
- dialog = gtk_message_dialog_new (parent,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_NONE,
- _("The file “%s” is read-only."),
- name_for_display);
- g_free (name_for_display);
-
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
- _("Do you want to try to replace it "
- "with the one you are saving?"));
-
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- _("_Cancel"), GTK_RESPONSE_CANCEL,
- _("_Replace"), GTK_RESPONSE_YES,
- NULL);
-
- gtk_dialog_set_default_response (GTK_DIALOG (dialog),
- GTK_RESPONSE_CANCEL);
-
- gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
-
- ret = gtk_dialog_run (GTK_DIALOG (dialog));
-
- gtk_widget_destroy (dialog);
-
- return ret == GTK_RESPONSE_YES;
- }
-
- static gboolean
- change_compression (GtkWindow *parent,
- GFile *file,
- gboolean compressed)
- {
- GtkWidget *dialog;
- gint ret;
- gchar *parse_name;
- gchar *name_for_display;
- const gchar *primary_message;
- const gchar *button_label;
-
- gedit_debug (DEBUG_COMMANDS);
-
- parse_name = g_file_get_parse_name (file);
-
- /* Truncate the name so it doesn't get insanely wide. Note that even
- * though the dialog uses wrapped text, if the name doesn't contain
- * white space then the text-wrapping code is too stupid to wrap it.
- */
- - name_for_display = tepl_utils_str_middle_truncate (parse_name, 50);
- + name_for_display = gedit_utils_str_middle_truncate (parse_name, 50);
- g_free (parse_name);
-
- if (compressed)
- {
- primary_message = _("Save the file using compression?");
- }
- else
- {
- primary_message = _("Save the file as plain text?");
- }
-
- dialog = gtk_message_dialog_new (parent,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_NONE,
- "%s",
- primary_message);
-
- if (compressed)
- {
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
- _("The file “%s” was previously saved as plain "
- "text and will now be saved using compression."),
- name_for_display);
-
- button_label = _("_Save Using Compression");
- }
- else
- {
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
- @@ -760,60 +757,61 @@ confirm_overwrite_callback (GeditFileChooserDialog *dialog,
-
- /* Call save_as_tab_finish() in @callback. */
- static void
- save_as_tab_async (GeditTab *tab,
- GeditWindow *window,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
- {
- GTask *task;
- GeditFileChooserDialog *save_dialog;
- GtkWindowGroup *window_group;
- GtkWindow *dialog_window;
- GeditDocument *doc;
- GtkSourceFile *file;
- GFile *location;
- const GtkSourceEncoding *encoding;
- GtkSourceNewlineType newline_type;
-
- g_return_if_fail (GEDIT_IS_TAB (tab));
- g_return_if_fail (GEDIT_IS_WINDOW (window));
-
- gedit_debug (DEBUG_COMMANDS);
-
- task = g_task_new (tab, cancellable, callback, user_data);
- g_task_set_task_data (task, g_object_ref (window), g_object_unref);
-
- /* Translators: "Save As" is the title of the file chooser window. */
- save_dialog = gedit_file_chooser_dialog_create (C_("window title", "Save As"),
- GTK_WINDOW (window),
- + GEDIT_FILE_CHOOSER_FLAG_SAVE,
- _("_Save"),
- _("_Cancel"));
-
- gedit_file_chooser_dialog_set_do_overwrite_confirmation (save_dialog, TRUE);
-
- g_signal_connect (save_dialog,
- "confirm-overwrite",
- G_CALLBACK (confirm_overwrite_callback),
- NULL);
-
- window_group = gedit_window_get_group (window);
-
- dialog_window = gedit_file_chooser_dialog_get_window (save_dialog);
-
- if (dialog_window != NULL)
- {
- gtk_window_group_add_window (window_group, dialog_window);
- }
-
- /* Save As dialog is modal to its main window */
- gedit_file_chooser_dialog_set_modal (save_dialog, TRUE);
-
- /* Set the suggested file name */
- doc = gedit_tab_get_document (tab);
- file = gedit_document_get_file (doc);
- location = gtk_source_file_get_location (file);
-
- if (location != NULL)
- {
- gedit_file_chooser_dialog_set_file (save_dialog, location);
- diff --git a/gedit/gedit-commands-search.c b/gedit/gedit-commands-search.c
- index 22703985e..f120b8bad 100644
- --- a/gedit/gedit-commands-search.c
- +++ b/gedit/gedit-commands-search.c
- @@ -2,61 +2,60 @@
- * gedit-commands-search.c
- * This file is part of gedit
- *
- * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
- * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
- * Copyright (C) 2002-2006 Paolo Maggi
- * Copyright (C) 2013 Sébastien Wilmet
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
- #include "config.h"
-
- #include "gedit-commands.h"
- #include "gedit-commands-private.h"
-
- #include <string.h>
- #include <glib/gi18n.h>
- #include <gdk/gdkkeysyms.h>
- -#include <tepl/tepl.h>
-
- #include "gedit-debug.h"
- #include "gedit-statusbar.h"
- #include "gedit-tab.h"
- #include "gedit-tab-private.h"
- #include "gedit-view-frame.h"
- #include "gedit-window.h"
- #include "gedit-window-private.h"
- #include "gedit-utils.h"
- #include "gedit-replace-dialog.h"
-
- #define GEDIT_REPLACE_DIALOG_KEY "gedit-replace-dialog-key"
- #define GEDIT_LAST_SEARCH_DATA_KEY "gedit-last-search-data-key"
-
- typedef struct _LastSearchData LastSearchData;
- struct _LastSearchData
- {
- gint x;
- gint y;
- };
-
- static void
- last_search_data_free (LastSearchData *data)
- {
- g_slice_free (LastSearchData, data);
- }
-
- static void
- last_search_data_restore_position (GeditReplaceDialog *dlg)
- {
- @@ -105,117 +104,117 @@ text_found (GeditWindow *window,
- window->priv->generic_message_cid,
- ngettext("Found and replaced %d occurrence",
- "Found and replaced %d occurrences",
- occurrences),
- occurrences);
- }
- else if (occurrences == 1)
- {
- gedit_statusbar_flash_message (GEDIT_STATUSBAR (window->priv->statusbar),
- window->priv->generic_message_cid,
- _("Found and replaced one occurrence"));
- }
- else
- {
- gedit_statusbar_flash_message (GEDIT_STATUSBAR (window->priv->statusbar),
- window->priv->generic_message_cid,
- " ");
- }
- }
-
- #define MAX_MSG_LENGTH 40
-
- static void
- text_not_found (GeditWindow *window,
- GeditReplaceDialog *replace_dialog)
- {
- const gchar *search_text;
- gchar *truncated_text;
-
- search_text = gedit_replace_dialog_get_search_text (replace_dialog);
- - truncated_text = tepl_utils_str_end_truncate (search_text, MAX_MSG_LENGTH);
- + truncated_text = gedit_utils_str_end_truncate (search_text, MAX_MSG_LENGTH);
-
- gedit_statusbar_flash_message (GEDIT_STATUSBAR (window->priv->statusbar),
- window->priv->generic_message_cid,
- /* Translators: %s is replaced by the text
- entered by the user in the search box */
- _("“%s” not found"), truncated_text);
-
- g_free (truncated_text);
- }
-
- static void
- finish_search_from_dialog (GeditWindow *window,
- gboolean found)
- {
- GeditReplaceDialog *replace_dialog;
-
- replace_dialog = g_object_get_data (G_OBJECT (window), GEDIT_REPLACE_DIALOG_KEY);
-
- g_return_if_fail (replace_dialog != NULL);
-
- if (found)
- {
- text_found (window, 0);
- }
- else
- {
- text_not_found (window, replace_dialog);
- }
- }
-
- static gboolean
- forward_search_finished (GtkSourceSearchContext *search_context,
- GAsyncResult *result,
- GeditView *view)
- {
- gboolean found;
- GtkSourceBuffer *buffer;
- GtkTextIter match_start;
- GtkTextIter match_end;
-
- found = gtk_source_search_context_forward_finish (search_context,
- result,
- &match_start,
- &match_end,
- NULL,
- NULL);
-
- buffer = gtk_source_search_context_get_buffer (search_context);
-
- if (found)
- {
- gtk_text_buffer_select_range (GTK_TEXT_BUFFER (buffer),
- &match_start,
- &match_end);
-
- - tepl_view_scroll_to_cursor (TEPL_VIEW (view));
- + gedit_view_scroll_to_cursor (view);
- }
- else
- {
- GtkTextIter end_selection;
-
- gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (buffer),
- NULL,
- &end_selection);
-
- gtk_text_buffer_select_range (GTK_TEXT_BUFFER (buffer),
- &end_selection,
- &end_selection);
- }
-
- return found;
- }
-
- static void
- forward_search_from_dialog_finished (GtkSourceSearchContext *search_context,
- GAsyncResult *result,
- GeditWindow *window)
- {
- GeditView *view = gedit_window_get_active_view (window);
- gboolean found;
-
- if (view == NULL)
- {
- return;
- }
-
- @@ -267,61 +266,61 @@ run_forward_search (GeditWindow *window,
- (GAsyncReadyCallback)forward_search_finished,
- view);
- }
- }
-
- static gboolean
- backward_search_finished (GtkSourceSearchContext *search_context,
- GAsyncResult *result,
- GeditView *view)
- {
- gboolean found;
- GtkTextIter match_start;
- GtkTextIter match_end;
- GtkSourceBuffer *buffer;
-
- found = gtk_source_search_context_backward_finish (search_context,
- result,
- &match_start,
- &match_end,
- NULL,
- NULL);
-
- buffer = gtk_source_search_context_get_buffer (search_context);
-
- if (found)
- {
- gtk_text_buffer_select_range (GTK_TEXT_BUFFER (buffer),
- &match_start,
- &match_end);
-
- - tepl_view_scroll_to_cursor (TEPL_VIEW (view));
- + gedit_view_scroll_to_cursor (view);
- }
- else
- {
- GtkTextIter start_selection;
-
- gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (buffer),
- &start_selection,
- NULL);
-
- gtk_text_buffer_select_range (GTK_TEXT_BUFFER (buffer),
- &start_selection,
- &start_selection);
- }
-
- return found;
- }
-
- static void
- backward_search_from_dialog_finished (GtkSourceSearchContext *search_context,
- GAsyncResult *result,
- GeditWindow *window)
- {
- GeditView *view = gedit_window_get_active_view (window);
- gboolean found;
-
- if (view == NULL)
- {
- return;
- }
-
- diff --git a/gedit/gedit-commands-view.c b/gedit/gedit-commands-view.c
- index 71785b78f..369bc93b0 100644
- --- a/gedit/gedit-commands-view.c
- +++ b/gedit/gedit-commands-view.c
- @@ -1,58 +1,63 @@
- /*
- * gedit-view-commands.c
- * This file is part of gedit
- *
- * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
- * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
- * Copyright (C) 2002-2005 Paolo Maggi
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
- #include "config.h"
- +
- #include "gedit-commands.h"
- #include "gedit-commands-private.h"
- -#include <tepl/tepl.h>
- +
- +#include <gtk/gtk.h>
- +
- #include "gedit-debug.h"
- #include "gedit-window.h"
- +#include "gedit-highlight-mode-dialog.h"
- +#include "gedit-highlight-mode-selector.h"
-
- void
- _gedit_cmd_view_focus_active (GSimpleAction *action,
- GVariant *state,
- gpointer user_data)
- {
- GeditView *active_view;
- GeditWindow *window = GEDIT_WINDOW (user_data);
-
- gedit_debug (DEBUG_COMMANDS);
-
- active_view = gedit_window_get_active_view (window);
-
- if (active_view)
- {
- gtk_widget_grab_focus (GTK_WIDGET (active_view));
- }
- }
-
- void
- _gedit_cmd_view_toggle_side_panel (GSimpleAction *action,
- GVariant *state,
- gpointer user_data)
- {
- GeditWindow *window = GEDIT_WINDOW (user_data);
- GtkWidget *panel;
- gboolean visible;
-
- gedit_debug (DEBUG_COMMANDS);
-
- @@ -94,88 +99,75 @@ _gedit_cmd_view_toggle_bottom_panel (GSimpleAction *action,
- }
-
- void
- _gedit_cmd_view_toggle_fullscreen_mode (GSimpleAction *action,
- GVariant *state,
- gpointer user_data)
- {
- GeditWindow *window = GEDIT_WINDOW (user_data);
-
- gedit_debug (DEBUG_COMMANDS);
-
- if (g_variant_get_boolean (state))
- {
- _gedit_window_fullscreen (window);
- }
- else
- {
- _gedit_window_unfullscreen (window);
- }
- }
-
- void
- _gedit_cmd_view_leave_fullscreen_mode (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
- {
- _gedit_window_unfullscreen (GEDIT_WINDOW (user_data));
- }
-
- static void
- -language_activated_cb (TeplLanguageChooserDialog *dialog,
- - GtkSourceLanguage *language,
- - GeditWindow *window)
- +language_selected_cb (GeditHighlightModeSelector *selector,
- + GtkSourceLanguage *language,
- + GeditWindow *window)
- {
- GeditDocument *active_document;
-
- active_document = gedit_window_get_active_document (window);
- if (active_document != NULL)
- {
- gedit_document_set_language (active_document, language);
- }
- -
- - gtk_widget_destroy (GTK_WIDGET (dialog));
- -}
- -
- -static void
- -language_chooser_dialog_response_after_cb (TeplLanguageChooserDialog *dialog,
- - gint response_id,
- - gpointer user_data)
- -{
- - gtk_widget_destroy (GTK_WIDGET (dialog));
- }
-
- void
- _gedit_cmd_view_highlight_mode (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
- {
- GeditWindow *window = GEDIT_WINDOW (user_data);
- - TeplLanguageChooserDialog *dialog;
- + GeditHighlightModeDialog *dialog;
- + GeditHighlightModeSelector *selector;
- GeditDocument *active_document;
-
- - dialog = tepl_language_chooser_dialog_new (GTK_WINDOW (window));
- + dialog = GEDIT_HIGHLIGHT_MODE_DIALOG (gedit_highlight_mode_dialog_new (GTK_WINDOW (window)));
- + selector = gedit_highlight_mode_dialog_get_selector (dialog);
-
- active_document = gedit_window_get_active_document (window);
- if (active_document != NULL)
- {
- GtkSourceLanguage *language;
-
- language = gedit_document_get_language (active_document);
- - tepl_language_chooser_select_language (TEPL_LANGUAGE_CHOOSER (dialog), language);
- + gedit_highlight_mode_selector_select_language (selector, language);
- }
-
- - g_signal_connect_object (dialog,
- - "language-activated",
- - G_CALLBACK (language_activated_cb),
- + g_signal_connect_object (selector,
- + "language-selected",
- + G_CALLBACK (language_selected_cb),
- window,
- 0);
-
- - g_signal_connect_after (dialog,
- - "response",
- - G_CALLBACK (language_chooser_dialog_response_after_cb),
- - NULL);
- -
- gtk_widget_show (GTK_WIDGET (dialog));
- }
-
- /* ex:set ts=8 noet: */
- diff --git a/gedit/gedit-debug.c b/gedit/gedit-debug.c
- index 5aa82fa51..396dc140f 100644
- --- a/gedit/gedit-debug.c
- +++ b/gedit/gedit-debug.c
- @@ -73,60 +73,64 @@ gedit_debug_init (void)
- enabled_sections |= GEDIT_DEBUG_WINDOW;
- }
- if (g_getenv ("GEDIT_DEBUG_PANEL") != NULL)
- {
- enabled_sections |= GEDIT_DEBUG_PANEL;
- }
- if (g_getenv ("GEDIT_DEBUG_PLUGINS") != NULL)
- {
- enabled_sections |= GEDIT_DEBUG_PLUGINS;
- }
- if (g_getenv ("GEDIT_DEBUG_TAB") != NULL)
- {
- enabled_sections |= GEDIT_DEBUG_TAB;
- }
- if (g_getenv ("GEDIT_DEBUG_DOCUMENT") != NULL)
- {
- enabled_sections |= GEDIT_DEBUG_DOCUMENT;
- }
- if (g_getenv ("GEDIT_DEBUG_COMMANDS") != NULL)
- {
- enabled_sections |= GEDIT_DEBUG_COMMANDS;
- }
- if (g_getenv ("GEDIT_DEBUG_APP") != NULL)
- {
- enabled_sections |= GEDIT_DEBUG_APP;
- }
- if (g_getenv ("GEDIT_DEBUG_UTILS") != NULL)
- {
- enabled_sections |= GEDIT_DEBUG_UTILS;
- }
- + if (g_getenv ("GEDIT_DEBUG_METADATA") != NULL)
- + {
- + enabled_sections |= GEDIT_DEBUG_METADATA;
- + }
-
- out:
-
- #ifdef ENABLE_PROFILING
- if (enabled_sections != GEDIT_NO_DEBUG)
- {
- timer = g_timer_new ();
- }
- #endif
- }
-
- /**
- * gedit_debug:
- * @section: debug section.
- * @file: file name.
- * @line: line number.
- * @function: name of the function that is calling gedit_debug().
- *
- * If @section is enabled, then logs the trace information @file, @line, and
- * @function.
- */
- void
- gedit_debug (GeditDebugSection section,
- const gchar *file,
- gint line,
- const gchar *function)
- {
- gedit_debug_message (section, file, line, function, "%s", "");
- }
-
- diff --git a/gedit/gedit-debug.h b/gedit/gedit-debug.h
- index a9d7caf37..49e5127e1 100644
- --- a/gedit/gedit-debug.h
- +++ b/gedit/gedit-debug.h
- @@ -21,63 +21,65 @@
- */
-
- #ifndef GEDIT_DEBUG_H
- #define GEDIT_DEBUG_H
-
- #include <glib.h>
-
- /**
- * GeditDebugSection:
- *
- * Enumeration of debug sections.
- *
- * Debugging output for a section is enabled by setting an environment variable
- * of the same name. For example, setting the <code>GEDIT_DEBUG_PLUGINS</code>
- * environment variable enables all debugging output for the %GEDIT_DEBUG_PLUGINS
- * section. Setting the special environment variable <code>GEDIT_DEBUG</code>
- * enables output for all sections.
- */
- typedef enum {
- GEDIT_NO_DEBUG = 0,
- GEDIT_DEBUG_VIEW = 1 << 0,
- GEDIT_DEBUG_PREFS = 1 << 1,
- GEDIT_DEBUG_WINDOW = 1 << 2,
- GEDIT_DEBUG_PANEL = 1 << 3,
- GEDIT_DEBUG_PLUGINS = 1 << 4,
- GEDIT_DEBUG_TAB = 1 << 5,
- GEDIT_DEBUG_DOCUMENT = 1 << 6,
- GEDIT_DEBUG_COMMANDS = 1 << 7,
- GEDIT_DEBUG_APP = 1 << 8,
- GEDIT_DEBUG_UTILS = 1 << 9,
- + GEDIT_DEBUG_METADATA = 1 << 10,
- } GeditDebugSection;
-
- #define DEBUG_VIEW GEDIT_DEBUG_VIEW, __FILE__, __LINE__, G_STRFUNC
- #define DEBUG_PREFS GEDIT_DEBUG_PREFS, __FILE__, __LINE__, G_STRFUNC
- #define DEBUG_WINDOW GEDIT_DEBUG_WINDOW, __FILE__, __LINE__, G_STRFUNC
- #define DEBUG_PANEL GEDIT_DEBUG_PANEL, __FILE__, __LINE__, G_STRFUNC
- #define DEBUG_PLUGINS GEDIT_DEBUG_PLUGINS, __FILE__, __LINE__, G_STRFUNC
- #define DEBUG_TAB GEDIT_DEBUG_TAB, __FILE__, __LINE__, G_STRFUNC
- #define DEBUG_DOCUMENT GEDIT_DEBUG_DOCUMENT,__FILE__, __LINE__, G_STRFUNC
- #define DEBUG_COMMANDS GEDIT_DEBUG_COMMANDS,__FILE__, __LINE__, G_STRFUNC
- #define DEBUG_APP GEDIT_DEBUG_APP, __FILE__, __LINE__, G_STRFUNC
- #define DEBUG_UTILS GEDIT_DEBUG_UTILS, __FILE__, __LINE__, G_STRFUNC
- +#define DEBUG_METADATA GEDIT_DEBUG_METADATA,__FILE__, __LINE__, G_STRFUNC
-
- void gedit_debug_init (void);
-
- void gedit_debug (GeditDebugSection section,
- const gchar *file,
- gint line,
- const gchar *function);
-
- void gedit_debug_message (GeditDebugSection section,
- const gchar *file,
- gint line,
- const gchar *function,
- const gchar *format, ...) G_GNUC_PRINTF(5, 6);
-
- void gedit_debug_plugin_message (const gchar *file,
- gint line,
- const gchar *function,
- const gchar *message);
-
- #endif /* GEDIT_DEBUG_H */
- /* ex:set ts=8 noet: */
- diff --git a/gedit/gedit-document-private.h b/gedit/gedit-document-private.h
- index 62444cc76..574c0bb89 100644
- --- a/gedit/gedit-document-private.h
- +++ b/gedit/gedit-document-private.h
- @@ -1,57 +1,63 @@
- /*
- * gedit-document.h
- * This file is part of gedit
- *
- * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
- * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
- * Copyright (C) 2002-2005 Paolo Maggi
- * Copyright (C) 2014, 2020 Sébastien Wilmet
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
- #ifndef GEDIT_DOCUMENT_PRIVATE_H
- #define GEDIT_DOCUMENT_PRIVATE_H
-
- #include "gedit-document.h"
-
- G_BEGIN_DECLS
-
- -#define GEDIT_METADATA_ATTRIBUTE_POSITION "gedit-position"
- -#define GEDIT_METADATA_ATTRIBUTE_ENCODING "gedit-encoding"
- -#define GEDIT_METADATA_ATTRIBUTE_LANGUAGE "gedit-language"
- +#ifdef G_OS_WIN32
- +#define GEDIT_METADATA_ATTRIBUTE_POSITION "position"
- +#define GEDIT_METADATA_ATTRIBUTE_ENCODING "encoding"
- +#define GEDIT_METADATA_ATTRIBUTE_LANGUAGE "language"
- +#else
- +#define GEDIT_METADATA_ATTRIBUTE_POSITION "metadata::gedit-position"
- +#define GEDIT_METADATA_ATTRIBUTE_ENCODING "metadata::gedit-encoding"
- +#define GEDIT_METADATA_ATTRIBUTE_LANGUAGE "metadata::gedit-language"
- +#endif
-
- G_GNUC_INTERNAL
- glong _gedit_document_get_seconds_since_last_save_or_load (GeditDocument *doc);
-
- G_GNUC_INTERNAL
- gboolean _gedit_document_needs_saving (GeditDocument *doc);
-
- G_GNUC_INTERNAL
- gboolean _gedit_document_get_empty_search (GeditDocument *doc);
-
- G_GNUC_INTERNAL
- void _gedit_document_set_create (GeditDocument *doc,
- gboolean create);
-
- G_GNUC_INTERNAL
- gboolean _gedit_document_get_create (GeditDocument *doc);
-
- G_GNUC_INTERNAL
- gchar * _gedit_document_get_uri_for_display (GeditDocument *doc);
-
- G_END_DECLS
-
- #endif /* GEDIT_DOCUMENT_PRIVATE_H */
- /* ex:set ts=8 noet: */
- diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
- index 54c11a96c..4cb08ee03 100644
- --- a/gedit/gedit-document.c
- +++ b/gedit/gedit-document.c
- @@ -1,156 +1,177 @@
- /*
- * gedit-document.c
- * This file is part of gedit
- *
- * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
- * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
- * Copyright (C) 2002-2005 Paolo Maggi
- - * Copyright (C) 2014-2020 Sébastien Wilmet
- + * Copyright (C) 2014-2015 Sébastien Wilmet
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
- #include "config.h"
- +
- #include "gedit-document.h"
- #include "gedit-document-private.h"
- +
- #include <string.h>
- #include <glib/gi18n.h>
- +
- +#include "gedit-app.h"
- +#include "gedit-app-private.h"
- #include "gedit-settings.h"
- #include "gedit-debug.h"
- #include "gedit-utils.h"
- +#include "gedit-metadata-manager.h"
- +
- +#define METADATA_QUERY "metadata::*"
-
- #define NO_LANGUAGE_NAME "_NORMAL_"
-
- static void gedit_document_loaded_real (GeditDocument *doc);
-
- static void gedit_document_saved_real (GeditDocument *doc);
-
- static void set_content_type (GeditDocument *doc,
- const gchar *content_type);
-
- typedef struct
- {
- GtkSourceFile *file;
-
- - TeplMetadata *metadata;
- + GSettings *editor_settings;
- +
- + gint untitled_number;
- +
- + GFileInfo *metadata_info;
-
- gchar *content_type;
-
- GDateTime *time_of_last_save_or_load;
-
- /* The search context for the incremental search, or the search and
- * replace. They are mutually exclusive.
- */
- GtkSourceSearchContext *search_context;
-
- + GeditMetadataManager *metadata_manager;
- +
- + guint user_action;
- +
- guint language_set_by_user : 1;
- + guint use_gvfs_metadata : 1;
-
- /* The search is empty if there is no search context, or if the
- * search text is empty. It is used for the sensitivity of some menu
- * actions.
- */
- guint empty_search : 1;
-
- /* Create file if location points to a non existing file (for example
- * when opened from the command line).
- */
- guint create : 1;
- } GeditDocumentPrivate;
-
- enum
- {
- PROP_0,
- + PROP_SHORTNAME,
- PROP_CONTENT_TYPE,
- PROP_MIME_TYPE,
- PROP_EMPTY_SEARCH,
- + PROP_USE_GVFS_METADATA,
- LAST_PROP
- };
-
- static GParamSpec *properties[LAST_PROP];
-
- enum
- {
- + CURSOR_MOVED,
- LOAD,
- LOADED,
- SAVE,
- SAVED,
- LAST_SIGNAL
- };
-
- static guint document_signals[LAST_SIGNAL];
-
- -G_DEFINE_TYPE_WITH_PRIVATE (GeditDocument, gedit_document, TEPL_TYPE_BUFFER)
- +static GHashTable *allocated_untitled_numbers = NULL;
-
- -static void
- -load_metadata_from_metadata_manager (GeditDocument *doc)
- +G_DEFINE_TYPE_WITH_PRIVATE (GeditDocument, gedit_document, GTK_SOURCE_TYPE_BUFFER)
- +
- +static gint
- +get_untitled_number (void)
- {
- - GeditDocumentPrivate *priv = gedit_document_get_instance_private (doc);
- - GFile *location;
- + gint i = 1;
-
- - location = gtk_source_file_get_location (priv->file);
- + if (allocated_untitled_numbers == NULL)
- + allocated_untitled_numbers = g_hash_table_new (NULL, NULL);
-
- - if (location != NULL)
- + g_return_val_if_fail (allocated_untitled_numbers != NULL, -1);
- +
- + while (TRUE)
- {
- - TeplMetadataManager *manager;
- + if (g_hash_table_lookup (allocated_untitled_numbers, GINT_TO_POINTER (i)) == NULL)
- + {
- + g_hash_table_insert (allocated_untitled_numbers,
- + GINT_TO_POINTER (i),
- + GINT_TO_POINTER (i));
-
- - manager = tepl_metadata_manager_get_singleton ();
- - tepl_metadata_manager_copy_from (manager, location, priv->metadata);
- + return i;
- + }
- +
- + ++i;
- }
- }
-
- static void
- -save_metadata_into_metadata_manager (GeditDocument *doc)
- +release_untitled_number (gint n)
- {
- - GeditDocumentPrivate *priv = gedit_document_get_instance_private (doc);
- - GFile *location;
- -
- - location = gtk_source_file_get_location (priv->file);
- -
- - if (location != NULL)
- - {
- - TeplMetadataManager *manager;
- + g_return_if_fail (allocated_untitled_numbers != NULL);
-
- - manager = tepl_metadata_manager_get_singleton ();
- - tepl_metadata_manager_merge_into (manager, location, priv->metadata);
- - }
- + g_hash_table_remove (allocated_untitled_numbers, GINT_TO_POINTER (n));
- }
-
- static void
- update_time_of_last_save_or_load (GeditDocument *doc)
- {
- GeditDocumentPrivate *priv = gedit_document_get_instance_private (doc);
-
- if (priv->time_of_last_save_or_load != NULL)
- {
- g_date_time_unref (priv->time_of_last_save_or_load);
- }
-
- priv->time_of_last_save_or_load = g_date_time_new_now_utc ();
- }
-
- static const gchar *
- get_language_string (GeditDocument *doc)
- {
- GtkSourceLanguage *lang = gedit_document_get_language (doc);
-
- return lang != NULL ? gtk_source_language_get_id (lang) : NO_LANGUAGE_NAME;
- }
-
- static void
- save_metadata (GeditDocument *doc)
- {
- GeditDocumentPrivate *priv;
- const gchar *language = NULL;
- GtkTextIter iter;
- gchar *position;
- @@ -168,215 +189,361 @@ save_metadata (GeditDocument *doc)
- position = g_strdup_printf ("%d", gtk_text_iter_get_offset (&iter));
-
- if (language == NULL)
- {
- gedit_document_set_metadata (doc,
- GEDIT_METADATA_ATTRIBUTE_POSITION, position,
- NULL);
- }
- else
- {
- gedit_document_set_metadata (doc,
- GEDIT_METADATA_ATTRIBUTE_POSITION, position,
- GEDIT_METADATA_ATTRIBUTE_LANGUAGE, language,
- NULL);
- }
-
- g_free (position);
- }
-
- static void
- gedit_document_dispose (GObject *object)
- {
- GeditDocument *doc = GEDIT_DOCUMENT (object);
- GeditDocumentPrivate *priv = gedit_document_get_instance_private (doc);
-
- gedit_debug (DEBUG_DOCUMENT);
-
- /* Metadata must be saved here and not in finalize because the language
- * is gone by the time finalize runs.
- */
- - if (priv->metadata != NULL)
- + if (priv->file != NULL)
- {
- save_metadata (doc);
-
- - g_object_unref (priv->metadata);
- - priv->metadata = NULL;
- + g_object_unref (priv->file);
- + priv->file = NULL;
- }
-
- - g_clear_object (&priv->file);
- + g_clear_object (&priv->metadata_info);
- g_clear_object (&priv->search_context);
- + g_clear_object (&priv->metadata_manager);
-
- G_OBJECT_CLASS (gedit_document_parent_class)->dispose (object);
- }
-
- static void
- gedit_document_finalize (GObject *object)
- {
- - GeditDocumentPrivate *priv = gedit_document_get_instance_private (GEDIT_DOCUMENT (object));
- + GeditDocumentPrivate *priv;
-
- gedit_debug (DEBUG_DOCUMENT);
-
- + priv = gedit_document_get_instance_private (GEDIT_DOCUMENT (object));
- +
- + if (priv->untitled_number > 0)
- + {
- + release_untitled_number (priv->untitled_number);
- + }
- +
- g_free (priv->content_type);
-
- if (priv->time_of_last_save_or_load != NULL)
- {
- g_date_time_unref (priv->time_of_last_save_or_load);
- }
-
- G_OBJECT_CLASS (gedit_document_parent_class)->finalize (object);
- }
-
- static void
- gedit_document_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
- {
- GeditDocument *doc = GEDIT_DOCUMENT (object);
- GeditDocumentPrivate *priv;
-
- priv = gedit_document_get_instance_private (doc);
-
- switch (prop_id)
- {
- + case PROP_SHORTNAME:
- + g_value_take_string (value, gedit_document_get_short_name_for_display (doc));
- + break;
- +
- case PROP_CONTENT_TYPE:
- g_value_take_string (value, gedit_document_get_content_type (doc));
- break;
-
- case PROP_MIME_TYPE:
- g_value_take_string (value, gedit_document_get_mime_type (doc));
- break;
-
- case PROP_EMPTY_SEARCH:
- g_value_set_boolean (value, priv->empty_search);
- break;
-
- + case PROP_USE_GVFS_METADATA:
- + g_value_set_boolean (value, priv->use_gvfs_metadata);
- + break;
- +
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
- }
-
- static void
- gedit_document_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
- {
- GeditDocument *doc = GEDIT_DOCUMENT (object);
- + GeditDocumentPrivate *priv = gedit_document_get_instance_private (doc);
-
- switch (prop_id)
- {
- case PROP_CONTENT_TYPE:
- set_content_type (doc, g_value_get_string (value));
- break;
-
- + case PROP_USE_GVFS_METADATA:
- + priv->use_gvfs_metadata = g_value_get_boolean (value);
- + break;
- +
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
- }
-
- +static void
- +gedit_document_begin_user_action (GtkTextBuffer *buffer)
- +{
- + GeditDocumentPrivate *priv;
- +
- + priv = gedit_document_get_instance_private (GEDIT_DOCUMENT (buffer));
- +
- + ++priv->user_action;
- +
- + if (GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->begin_user_action != NULL)
- + {
- + GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->begin_user_action (buffer);
- + }
- +}
- +
- +static void
- +gedit_document_end_user_action (GtkTextBuffer *buffer)
- +{
- + GeditDocumentPrivate *priv;
- +
- + priv = gedit_document_get_instance_private (GEDIT_DOCUMENT (buffer));
- +
- + --priv->user_action;
- +
- + if (GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->end_user_action != NULL)
- + {
- + GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->end_user_action (buffer);
- + }
- +}
- +
- +static void
- +gedit_document_mark_set (GtkTextBuffer *buffer,
- + const GtkTextIter *iter,
- + GtkTextMark *mark)
- +{
- + GeditDocument *doc = GEDIT_DOCUMENT (buffer);
- + GeditDocumentPrivate *priv;
- +
- + priv = gedit_document_get_instance_private (doc);
- +
- + if (GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->mark_set != NULL)
- + {
- + GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->mark_set (buffer, iter, mark);
- + }
- +
- + if (mark == gtk_text_buffer_get_insert (buffer) && (priv->user_action == 0))
- + {
- + g_signal_emit (doc, document_signals[CURSOR_MOVED], 0);
- + }
- +}
- +
- +static void
- +gedit_document_changed (GtkTextBuffer *buffer)
- +{
- + g_signal_emit (GEDIT_DOCUMENT (buffer), document_signals[CURSOR_MOVED], 0);
- +
- + GTK_TEXT_BUFFER_CLASS (gedit_document_parent_class)->changed (buffer);
- +}
- +
- static void
- gedit_document_constructed (GObject *object)
- {
- GeditDocument *doc = GEDIT_DOCUMENT (object);
- + GeditDocumentPrivate *priv;
- GeditSettings *settings;
- GSettings *editor_settings;
-
- + priv = gedit_document_get_instance_private (doc);
- +
- settings = _gedit_settings_get_singleton ();
- editor_settings = _gedit_settings_peek_editor_settings (settings);
-
- + if (!priv->use_gvfs_metadata)
- + {
- + GeditMetadataManager *metadata_manager;
- +
- + metadata_manager = _gedit_app_get_metadata_manager (GEDIT_APP (g_application_get_default ()));
- + g_assert (GEDIT_IS_METADATA_MANAGER (metadata_manager));
- + priv->metadata_manager = g_object_ref (metadata_manager);
- + }
- +
- /* Bind construct properties. */
- g_settings_bind (editor_settings, GEDIT_SETTINGS_ENSURE_TRAILING_NEWLINE,
- doc, "implicit-trailing-newline",
- G_SETTINGS_BIND_GET | G_SETTINGS_BIND_NO_SENSITIVITY);
-
- G_OBJECT_CLASS (gedit_document_parent_class)->constructed (object);
- }
-
- static void
- gedit_document_class_init (GeditDocumentClass *klass)
- {
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- + GtkTextBufferClass *buf_class = GTK_TEXT_BUFFER_CLASS (klass);
-
- object_class->dispose = gedit_document_dispose;
- object_class->finalize = gedit_document_finalize;
- object_class->get_property = gedit_document_get_property;
- object_class->set_property = gedit_document_set_property;
- object_class->constructed = gedit_document_constructed;
-
- + buf_class->begin_user_action = gedit_document_begin_user_action;
- + buf_class->end_user_action = gedit_document_end_user_action;
- + buf_class->mark_set = gedit_document_mark_set;
- + buf_class->changed = gedit_document_changed;
- +
- klass->loaded = gedit_document_loaded_real;
- klass->saved = gedit_document_saved_real;
-
- + /**
- + * GeditDocument:shortname:
- + *
- + * The document's short name.
- + */
- + properties[PROP_SHORTNAME] =
- + g_param_spec_string ("shortname",
- + "Short Name",
- + "The document's short name",
- + NULL,
- + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
- +
- /**
- * GeditDocument:content-type:
- *
- * The document's content type.
- */
- properties[PROP_CONTENT_TYPE] =
- g_param_spec_string ("content-type",
- "Content Type",
- "The document's Content Type",
- NULL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- /**
- * GeditDocument:mime-type:
- *
- * The document's MIME type.
- */
- properties[PROP_MIME_TYPE] =
- g_param_spec_string ("mime-type",
- "MIME Type",
- "The document's MIME Type",
- "text/plain",
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
-
- /**
- * GeditDocument:empty-search:
- *
- * <warning>
- * The property is used internally by gedit. It must not be used in a
- * gedit plugin. The property can be modified or removed at any time.
- * </warning>
- */
- properties[PROP_EMPTY_SEARCH] =
- g_param_spec_boolean ("empty-search",
- "Empty search",
- "Whether the search is empty",
- TRUE,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
-
- + /**
- + * GeditDocument:use-gvfs-metadata:
- + *
- + * Whether to use GVFS metadata. If %FALSE, use the gedit metadata
- + * manager that stores the metadata in an XML file in the user cache
- + * directory.
- + *
- + * <warning>
- + * The property is used internally by gedit. It must not be used in a
- + * gedit plugin. The property can be modified or removed at any time.
- + * </warning>
- + */
- + properties[PROP_USE_GVFS_METADATA] =
- + g_param_spec_boolean ("use-gvfs-metadata",
- + "Use GVFS metadata",
- + "",
- + TRUE,
- + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
- +
- g_object_class_install_properties (object_class, LAST_PROP, properties);
-
- + /* This signal is used to update the cursor position in the statusbar,
- + * it's emitted either when the insert mark is moved explicitely or
- + * when the buffer changes (insert/delete).
- + * FIXME When the replace_all was implemented in gedit, this signal was
- + * not emitted during the replace_all to improve performance. Now the
- + * replace_all is implemented in GtkSourceView, so the signal is
- + * emitted.
- + */
- + document_signals[CURSOR_MOVED] =
- + g_signal_new ("cursor-moved",
- + G_OBJECT_CLASS_TYPE (object_class),
- + G_SIGNAL_RUN_LAST,
- + G_STRUCT_OFFSET (GeditDocumentClass, cursor_moved),
- + NULL, NULL, NULL,
- + G_TYPE_NONE,
- + 0);
- +
- /**
- * GeditDocument::load:
- * @document: the #GeditDocument.
- *
- * The "load" signal is emitted at the beginning of a file loading.
- *
- * Before gedit 3.14 this signal contained parameters to configure the
- * file loading (the location, encoding, etc). Plugins should not need
- * those parameters.
- */
- document_signals[LOAD] =
- g_signal_new ("load",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GeditDocumentClass, load),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-
- /**
- * GeditDocument::loaded:
- * @document: the #GeditDocument.
- *
- * The "loaded" signal is emitted at the end of a successful file
- * loading.
- *
- * Before gedit 3.14 this signal contained a #GError parameter, and the
- * signal was also emitted if an error occurred. Plugins should not need
- * the error parameter.
- */
- document_signals[LOADED] =
- @@ -605,128 +772,188 @@ static void
- on_content_type_changed (GeditDocument *doc,
- GParamSpec *pspec,
- gpointer useless)
- {
- GeditDocumentPrivate *priv;
-
- priv = gedit_document_get_instance_private (doc);
-
- if (!priv->language_set_by_user)
- {
- GtkSourceLanguage *language = guess_language (doc);
-
- gedit_debug_message (DEBUG_DOCUMENT, "Language: %s",
- language != NULL ? gtk_source_language_get_name (language) : "None");
-
- set_language (doc, language, FALSE);
- }
- }
-
- static gchar *
- get_default_content_type (void)
- {
- return g_content_type_from_mime_type ("text/plain");
- }
-
- static void
- on_location_changed (GtkSourceFile *file,
- GParamSpec *pspec,
- GeditDocument *doc)
- {
- + GeditDocumentPrivate *priv;
- + GFile *location;
- +
- gedit_debug (DEBUG_DOCUMENT);
- - load_metadata_from_metadata_manager (doc);
- +
- + priv = gedit_document_get_instance_private (doc);
- +
- + location = gtk_source_file_get_location (file);
- +
- + if (location != NULL && priv->untitled_number > 0)
- + {
- + release_untitled_number (priv->untitled_number);
- + priv->untitled_number = 0;
- + }
- +
- + g_object_notify_by_pspec (G_OBJECT (doc), properties[PROP_SHORTNAME]);
- +
- + /* Load metadata for this location: we load sync since metadata is
- + * always local so it should be fast and we need the information
- + * right after the location was set.
- + * TODO: do async I/O for the metadata.
- + */
- + if (priv->use_gvfs_metadata && location != NULL)
- + {
- + GError *error = NULL;
- +
- + if (priv->metadata_info != NULL)
- + {
- + g_object_unref (priv->metadata_info);
- + }
- +
- + priv->metadata_info = g_file_query_info (location,
- + METADATA_QUERY,
- + G_FILE_QUERY_INFO_NONE,
- + NULL,
- + &error);
- +
- + if (error != NULL)
- + {
- + /* Do not complain about metadata if we are opening a
- + * non existing file.
- + */
- + if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_ISDIR) &&
- + !g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOTDIR) &&
- + !g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT) &&
- + !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
- + {
- + g_warning ("%s", error->message);
- + }
- +
- + g_error_free (error);
- + }
- +
- + if (priv->metadata_info == NULL)
- + {
- + priv->metadata_info = g_file_info_new ();
- + }
- + }
- }
-
- static void
- gedit_document_init (GeditDocument *doc)
- {
- GeditDocumentPrivate *priv = gedit_document_get_instance_private (doc);
- - TeplFile *tepl_file;
- GeditSettings *settings;
- GSettings *editor_settings;
-
- gedit_debug (DEBUG_DOCUMENT);
-
- + settings = _gedit_settings_get_singleton ();
- + editor_settings = _gedit_settings_peek_editor_settings (settings);
- +
- + priv->untitled_number = get_untitled_number ();
- priv->content_type = get_default_content_type ();
- priv->language_set_by_user = FALSE;
- priv->empty_search = TRUE;
-
- update_time_of_last_save_or_load (doc);
-
- priv->file = gtk_source_file_new ();
- - tepl_file = tepl_buffer_get_file (TEPL_BUFFER (doc));
- -
- - g_object_bind_property (priv->file, "location",
- - tepl_file, "location",
- - G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
- -
- - priv->metadata = tepl_metadata_new ();
- + priv->metadata_info = g_file_info_new ();
-
- g_signal_connect_object (priv->file,
- "notify::location",
- G_CALLBACK (on_location_changed),
- doc,
- 0);
-
- - settings = _gedit_settings_get_singleton ();
- - editor_settings = _gedit_settings_peek_editor_settings (settings);
- -
- g_settings_bind (editor_settings, GEDIT_SETTINGS_MAX_UNDO_ACTIONS,
- doc, "max-undo-levels",
- G_SETTINGS_BIND_GET | G_SETTINGS_BIND_NO_SENSITIVITY);
-
- g_settings_bind (editor_settings, GEDIT_SETTINGS_SYNTAX_HIGHLIGHTING,
- doc, "highlight-syntax",
- G_SETTINGS_BIND_GET | G_SETTINGS_BIND_NO_SENSITIVITY);
-
- g_settings_bind (editor_settings, GEDIT_SETTINGS_BRACKET_MATCHING,
- doc, "highlight-matching-brackets",
- G_SETTINGS_BIND_GET | G_SETTINGS_BIND_NO_SENSITIVITY);
-
- g_signal_connect_object (editor_settings,
- "changed::" GEDIT_SETTINGS_SCHEME,
- G_CALLBACK (editor_settings_scheme_changed_cb),
- doc,
- 0);
-
- update_style_scheme (doc);
-
- g_signal_connect (doc,
- "notify::content-type",
- G_CALLBACK (on_content_type_changed),
- NULL);
- }
-
- GeditDocument *
- gedit_document_new (void)
- {
- - return g_object_new (GEDIT_TYPE_DOCUMENT, NULL);
- + gboolean use_gvfs_metadata;
- +
- +#ifdef ENABLE_GVFS_METADATA
- + use_gvfs_metadata = TRUE;
- +#else
- + use_gvfs_metadata = FALSE;
- +#endif
- +
- + return g_object_new (GEDIT_TYPE_DOCUMENT,
- + "use-gvfs-metadata", use_gvfs_metadata,
- + NULL);
- }
-
- static gchar *
- get_content_type_from_content (GeditDocument *doc)
- {
- gchar *content_type;
- gchar *data;
- GtkTextBuffer *buffer;
- GtkTextIter start;
- GtkTextIter end;
-
- buffer = GTK_TEXT_BUFFER (doc);
-
- gtk_text_buffer_get_start_iter (buffer, &start);
- end = start;
- gtk_text_iter_forward_chars (&end, 255);
-
- data = gtk_text_buffer_get_text (buffer, &start, &end, TRUE);
-
- content_type = g_content_type_guess (NULL,
- (const guchar *)data,
- strlen (data),
- NULL);
-
- g_free (data);
-
- return content_type;
- }
-
- static void
- @@ -787,93 +1014,107 @@ set_content_type (GeditDocument *doc,
- if (content_type == NULL)
- {
- GFile *location;
- gchar *guessed_type = NULL;
-
- /* If content type is null, we guess from the filename */
- location = gtk_source_file_get_location (priv->file);
- if (location != NULL)
- {
- gchar *basename;
-
- basename = g_file_get_basename (location);
- guessed_type = g_content_type_guess (basename, NULL, 0, NULL);
-
- g_free (basename);
- }
-
- set_content_type_no_guess (doc, guessed_type);
- g_free (guessed_type);
- }
- else
- {
- set_content_type_no_guess (doc, content_type);
- }
- }
-
- /* Note: this never returns %NULL. */
- gchar *
- _gedit_document_get_uri_for_display (GeditDocument *doc)
- {
- - TeplFile *file;
- + GeditDocumentPrivate *priv;
- GFile *location;
-
- g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), g_strdup (""));
-
- - file = tepl_buffer_get_file (TEPL_BUFFER (doc));
- - location = tepl_file_get_location (file);
- + priv = gedit_document_get_instance_private (doc);
- +
- + location = gtk_source_file_get_location (priv->file);
-
- if (location == NULL)
- {
- - return tepl_file_get_short_name (file);
- + return g_strdup_printf (_("Untitled Document %d"),
- + priv->untitled_number);
- }
- else
- {
- return g_file_get_parse_name (location);
- }
- }
-
- /**
- * gedit_document_get_short_name_for_display:
- * @doc: a #GeditDocument.
- *
- * Note: this never returns %NULL.
- **/
- gchar *
- gedit_document_get_short_name_for_display (GeditDocument *doc)
- {
- - TeplFile *file;
- + GeditDocumentPrivate *priv;
- + GFile *location;
-
- g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), g_strdup (""));
-
- - file = tepl_buffer_get_file (TEPL_BUFFER (doc));
- - return tepl_file_get_short_name (file);
- + priv = gedit_document_get_instance_private (doc);
- +
- + location = gtk_source_file_get_location (priv->file);
- +
- + if (location == NULL)
- + {
- + return g_strdup_printf (_("Untitled Document %d"),
- + priv->untitled_number);
- + }
- + else
- + {
- + return gedit_utils_basename_for_display (location);
- + }
- }
-
- gchar *
- gedit_document_get_content_type (GeditDocument *doc)
- {
- GeditDocumentPrivate *priv;
-
- g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), NULL);
-
- priv = gedit_document_get_instance_private (doc);
-
- return g_strdup (priv->content_type);
- }
-
- /**
- * gedit_document_get_mime_type:
- * @doc: a #GeditDocument.
- *
- * Note: this never returns %NULL.
- **/
- gchar *
- gedit_document_get_mime_type (GeditDocument *doc)
- {
- GeditDocumentPrivate *priv;
-
- g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), g_strdup ("text/plain"));
-
- priv = gedit_document_get_instance_private (doc);
-
- if (priv->content_type != NULL &&
- @@ -1005,225 +1246,398 @@ saved_query_info_cb (GFile *location,
- priv->create = FALSE;
-
- save_encoding_metadata (doc);
-
- /* Async operation finished. */
- g_object_unref (doc);
- }
-
- static void
- gedit_document_saved_real (GeditDocument *doc)
- {
- GeditDocumentPrivate *priv;
- GFile *location;
-
- priv = gedit_document_get_instance_private (doc);
-
- location = gtk_source_file_get_location (priv->file);
-
- /* Keep the doc alive during the async operation. */
- g_object_ref (doc);
-
- g_file_query_info_async (location,
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
- G_FILE_QUERY_INFO_NONE,
- G_PRIORITY_DEFAULT,
- NULL,
- (GAsyncReadyCallback) saved_query_info_cb,
- doc);
- }
-
- +gboolean
- +gedit_document_is_untouched (GeditDocument *doc)
- +{
- + GeditDocumentPrivate *priv;
- + GFile *location;
- +
- + g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), TRUE);
- +
- + priv = gedit_document_get_instance_private (doc);
- +
- + location = gtk_source_file_get_location (priv->file);
- +
- + return location == NULL && !gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc));
- +}
- +
- gboolean
- gedit_document_is_untitled (GeditDocument *doc)
- {
- - TeplFile *file;
- + GeditDocumentPrivate *priv;
-
- g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), TRUE);
-
- - file = tepl_buffer_get_file (TEPL_BUFFER (doc));
- - return tepl_file_get_location (file) == NULL;
- + priv = gedit_document_get_instance_private (doc);
- +
- + return gtk_source_file_get_location (priv->file) == NULL;
- }
-
- /*
- * Deletion and external modification is only checked for local files.
- */
- gboolean
- _gedit_document_needs_saving (GeditDocument *doc)
- {
- GeditDocumentPrivate *priv;
- gboolean externally_modified = FALSE;
- gboolean deleted = FALSE;
-
- g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
-
- priv = gedit_document_get_instance_private (doc);
-
- if (gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc)))
- {
- return TRUE;
- }
-
- if (gtk_source_file_is_local (priv->file))
- {
- gtk_source_file_check_file_on_disk (priv->file);
- externally_modified = gtk_source_file_is_externally_modified (priv->file);
- deleted = gtk_source_file_is_deleted (priv->file);
- }
-
- return (externally_modified || deleted) && !priv->create;
- }
-
- +/* If @line is bigger than the lines of the document, the cursor is moved
- + * to the last line and FALSE is returned.
- + */
- +gboolean
- +gedit_document_goto_line (GeditDocument *doc,
- + gint line)
- +{
- + GtkTextIter iter;
- +
- + gedit_debug (DEBUG_DOCUMENT);
- +
- + g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
- + g_return_val_if_fail (line >= -1, FALSE);
- +
- + gtk_text_buffer_get_iter_at_line (GTK_TEXT_BUFFER (doc),
- + &iter,
- + line);
- +
- + gtk_text_buffer_place_cursor (GTK_TEXT_BUFFER (doc), &iter);
- +
- + return gtk_text_iter_get_line (&iter) == line;
- +}
- +
- +gboolean
- +gedit_document_goto_line_offset (GeditDocument *doc,
- + gint line,
- + gint line_offset)
- +{
- + GtkTextIter iter;
- +
- + g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
- + g_return_val_if_fail (line >= -1, FALSE);
- + g_return_val_if_fail (line_offset >= -1, FALSE);
- +
- + gtk_text_buffer_get_iter_at_line_offset (GTK_TEXT_BUFFER (doc),
- + &iter,
- + line,
- + line_offset);
- +
- + gtk_text_buffer_place_cursor (GTK_TEXT_BUFFER (doc), &iter);
- +
- + return (gtk_text_iter_get_line (&iter) == line &&
- + gtk_text_iter_get_line_offset (&iter) == line_offset);
- +}
- +
- /**
- * gedit_document_set_language:
- * @doc:
- * @lang: (allow-none):
- **/
- void
- gedit_document_set_language (GeditDocument *doc,
- GtkSourceLanguage *lang)
- {
- g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
-
- set_language (doc, lang, TRUE);
- }
-
- /**
- * gedit_document_get_language:
- * @doc:
- *
- * Return value: (transfer none):
- */
- GtkSourceLanguage *
- gedit_document_get_language (GeditDocument *doc)
- {
- g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), NULL);
-
- return gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (doc));
- }
-
- glong
- _gedit_document_get_seconds_since_last_save_or_load (GeditDocument *doc)
- {
- GeditDocumentPrivate *priv;
- GDateTime *now;
- GTimeSpan n_microseconds;
-
- gedit_debug (DEBUG_DOCUMENT);
-
- g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), -1);
-
- priv = gedit_document_get_instance_private (doc);
-
- if (priv->time_of_last_save_or_load == NULL)
- {
- return -1;
- }
-
- now = g_date_time_new_now_utc ();
- if (now == NULL)
- {
- return -1;
- }
-
- n_microseconds = g_date_time_difference (now, priv->time_of_last_save_or_load);
- g_date_time_unref (now);
-
- return n_microseconds / (1000 * 1000);
- }
-
- +static gchar *
- +get_metadata_from_metadata_manager (GeditDocument *doc,
- + const gchar *key)
- +{
- + GeditDocumentPrivate *priv;
- + GFile *location;
- +
- + priv = gedit_document_get_instance_private (doc);
- +
- + location = gtk_source_file_get_location (priv->file);
- +
- + if (location != NULL)
- + {
- + return gedit_metadata_manager_get (priv->metadata_manager, location, key);
- + }
- +
- + return NULL;
- +}
- +
- +static gchar *
- +get_metadata_from_gvfs (GeditDocument *doc,
- + const gchar *key)
- +{
- + GeditDocumentPrivate *priv;
- +
- + priv = gedit_document_get_instance_private (doc);
- +
- + if (priv->metadata_info != NULL &&
- + g_file_info_has_attribute (priv->metadata_info, key) &&
- + g_file_info_get_attribute_type (priv->metadata_info, key) == G_FILE_ATTRIBUTE_TYPE_STRING)
- + {
- + return g_strdup (g_file_info_get_attribute_string (priv->metadata_info, key));
- + }
- +
- + return NULL;
- +}
- +
- +static void
- +set_gvfs_metadata (GFileInfo *info,
- + const gchar *key,
- + const gchar *value)
- +{
- + g_return_if_fail (G_IS_FILE_INFO (info));
- +
- + if (value != NULL)
- + {
- + g_file_info_set_attribute_string (info, key, value);
- + }
- + else
- + {
- + /* Unset the key */
- + g_file_info_set_attribute (info,
- + key,
- + G_FILE_ATTRIBUTE_TYPE_INVALID,
- + NULL);
- + }
- +}
- +
- /**
- * gedit_document_get_metadata:
- * @doc: a #GeditDocument
- * @key: name of the key
- *
- * Gets the metadata assigned to @key.
- *
- * Returns: the value assigned to @key. Free with g_free().
- */
- gchar *
- gedit_document_get_metadata (GeditDocument *doc,
- const gchar *key)
- {
- GeditDocumentPrivate *priv;
-
- g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), NULL);
- g_return_val_if_fail (key != NULL, NULL);
-
- priv = gedit_document_get_instance_private (doc);
-
- - if (priv->metadata == NULL)
- + if (priv->use_gvfs_metadata)
- {
- - return NULL;
- + return get_metadata_from_gvfs (doc, key);
- }
-
- - return tepl_metadata_get (priv->metadata, key);
- + return get_metadata_from_metadata_manager (doc, key);
- }
-
- /**
- * gedit_document_set_metadata:
- * @doc: a #GeditDocument
- * @first_key: name of the first key to set
- * @...: (allow-none): value for the first key, followed optionally by more key/value pairs,
- * followed by %NULL.
- *
- * Sets metadata on a document.
- */
- void
- gedit_document_set_metadata (GeditDocument *doc,
- const gchar *first_key,
- ...)
- {
- GeditDocumentPrivate *priv;
- - va_list var_args;
- + GFile *location;
- const gchar *key;
- + va_list var_args;
- + GFileInfo *info = NULL;
-
- g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
- g_return_if_fail (first_key != NULL);
-
- priv = gedit_document_get_instance_private (doc);
-
- - if (priv->metadata == NULL)
- + location = gtk_source_file_get_location (priv->file);
- +
- + /* With the metadata manager, can't set metadata for untitled documents.
- + * With GVFS metadata, if the location is NULL the metadata is stored in
- + * priv->metadata_info, so that it can be saved later if the document is
- + * saved.
- + */
- + if (!priv->use_gvfs_metadata && location == NULL)
- {
- return;
- }
-
- + if (priv->use_gvfs_metadata)
- + {
- + info = g_file_info_new ();
- + }
- +
- va_start (var_args, first_key);
-
- - for (key = first_key; key != NULL; key = va_arg (var_args, const gchar *))
- + for (key = first_key; key; key = va_arg (var_args, const gchar *))
- {
- const gchar *value = va_arg (var_args, const gchar *);
- - tepl_metadata_set (priv->metadata, key, value);
- +
- + if (priv->use_gvfs_metadata)
- + {
- + set_gvfs_metadata (info, key, value);
- + set_gvfs_metadata (priv->metadata_info, key, value);
- + }
- + else
- + {
- + gedit_metadata_manager_set (priv->metadata_manager, location, key, value);
- + }
- }
-
- va_end (var_args);
-
- - save_metadata_into_metadata_manager (doc);
- + if (priv->use_gvfs_metadata && location != NULL)
- + {
- + GError *error = NULL;
- +
- + /* We save synchronously since metadata is always local so it
- + * should be fast. Moreover this function can be called on
- + * application shutdown, when the main loop has already exited,
- + * so an async operation would not terminate.
- + * https://bugzilla.gnome.org/show_bug.cgi?id=736591
- + */
- + g_file_set_attributes_from_info (location,
- + info,
- + G_FILE_QUERY_INFO_NONE,
- + NULL,
- + &error);
- +
- + if (error != NULL)
- + {
- + /* Do not complain about metadata if we are closing a
- + * document for a non existing file.
- + */
- + if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT) &&
- + !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
- + {
- + g_warning ("Set document metadata failed: %s", error->message);
- + }
- +
- + g_error_free (error);
- + }
- + }
- +
- + g_clear_object (&info);
- }
-
- static void
- update_empty_search (GeditDocument *doc)
- {
- GeditDocumentPrivate *priv;
- gboolean new_value;
-
- priv = gedit_document_get_instance_private (doc);
-
- if (priv->search_context == NULL)
- {
- new_value = TRUE;
- }
- else
- {
- GtkSourceSearchSettings *search_settings;
-
- search_settings = gtk_source_search_context_get_settings (priv->search_context);
-
- new_value = gtk_source_search_settings_get_search_text (search_settings) == NULL;
- }
-
- if (priv->empty_search != new_value)
- {
- priv->empty_search = new_value;
- g_object_notify_by_pspec (G_OBJECT (doc), properties[PROP_EMPTY_SEARCH]);
- }
- }
-
- diff --git a/gedit/gedit-document.h b/gedit/gedit-document.h
- index 901d02dc0..ed52a42fb 100644
- --- a/gedit/gedit-document.h
- +++ b/gedit/gedit-document.h
- @@ -1,83 +1,93 @@
- /*
- * gedit-document.h
- * This file is part of gedit
- *
- * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
- * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
- * Copyright (C) 2002-2005 Paolo Maggi
- - * Copyright (C) 2014-2020 Sébastien Wilmet
- + * Copyright (C) 2014 Sébastien Wilmet
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
- #ifndef GEDIT_DOCUMENT_H
- #define GEDIT_DOCUMENT_H
-
- -#include <tepl/tepl.h>
- +#include <gtksourceview/gtksource.h>
-
- G_BEGIN_DECLS
-
- #define GEDIT_TYPE_DOCUMENT (gedit_document_get_type())
-
- -G_DECLARE_DERIVABLE_TYPE (GeditDocument, gedit_document, GEDIT, DOCUMENT, TeplBuffer)
- +G_DECLARE_DERIVABLE_TYPE (GeditDocument, gedit_document, GEDIT, DOCUMENT, GtkSourceBuffer)
-
- struct _GeditDocumentClass
- {
- - TeplBufferClass parent_class;
- + GtkSourceBufferClass parent_class;
-
- /* Signals */
- + void (* cursor_moved) (GeditDocument *document);
-
- void (* load) (GeditDocument *document);
-
- void (* loaded) (GeditDocument *document);
-
- void (* save) (GeditDocument *document);
-
- void (* saved) (GeditDocument *document);
- };
-
- GeditDocument *gedit_document_new (void);
-
- GtkSourceFile *gedit_document_get_file (GeditDocument *doc);
-
- gchar *gedit_document_get_short_name_for_display (GeditDocument *doc);
-
- gchar *gedit_document_get_content_type (GeditDocument *doc);
-
- gchar *gedit_document_get_mime_type (GeditDocument *doc);
-
- +gboolean gedit_document_is_untouched (GeditDocument *doc);
- +
- gboolean gedit_document_is_untitled (GeditDocument *doc);
-
- +gboolean gedit_document_goto_line (GeditDocument *doc,
- + gint line);
- +
- +gboolean gedit_document_goto_line_offset (GeditDocument *doc,
- + gint line,
- + gint line_offset);
- +
- void gedit_document_set_language (GeditDocument *doc,
- GtkSourceLanguage *lang);
- GtkSourceLanguage
- *gedit_document_get_language (GeditDocument *doc);
-
- gchar *gedit_document_get_metadata (GeditDocument *doc,
- const gchar *key);
-
- void gedit_document_set_metadata (GeditDocument *doc,
- const gchar *first_key,
- ...);
-
- void gedit_document_set_search_context (GeditDocument *doc,
- GtkSourceSearchContext *search_context);
-
- GtkSourceSearchContext *
- gedit_document_get_search_context (GeditDocument *doc);
-
- G_END_DECLS
-
- #endif /* GEDIT_DOCUMENT_H */
- /* ex:set ts=8 noet: */
- diff --git a/gedit/gedit-documents-panel.c b/gedit/gedit-documents-panel.c
- index 98d84a98f..8033f944e 100644
- --- a/gedit/gedit-documents-panel.c
- +++ b/gedit/gedit-documents-panel.c
- @@ -1,56 +1,55 @@
- /*
- * gedit-documents-panel.c
- * This file is part of gedit
- *
- * Copyright (C) 2014 - Sébastien Lafargue <slafargue@gnome.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
- #include "config.h"
-
- #include "gedit-documents-panel.h"
-
- #include <glib/gi18n.h>
- -#include <tepl/tepl.h>
-
- #include "gedit-debug.h"
- #include "gedit-document.h"
- #include "gedit-multi-notebook.h"
- #include "gedit-notebook.h"
- #include "gedit-notebook-popup-menu.h"
- #include "gedit-tab.h"
- #include "gedit-tab-private.h"
- #include "gedit-utils.h"
- #include "gedit-commands-private.h"
-
- typedef struct _GeditDocumentsGenericRow GeditDocumentsGenericRow;
- typedef struct _GeditDocumentsGenericRow GeditDocumentsGroupRo
|