1

I know, that GNOME3 UI uses HTML and CSS elements for creating menus and windows. How can I write simple web-based application like some text-editor with own document-format and formatting tools written in JS? HTML widget, that saves documents to the file-system.

Main reason of this question - to create Text editor, with Markdown support...

GTK File Menu:

  • Open
  • Save as...

WebKit content:

<link rel="stylesheet"...>
<script src="..."></script>
<nav>...</nav>
<content>{opened file}</content>
1
  • Try with bluefish :) if you really dont want to stick to Webkit
    – bebojoor
    Apr 25, 2012 at 9:21

1 Answer 1

1

It doesn't use HTML. It uses GTK, which itself uses a styling language based on CSS. However, you can use WebKit to provide the functionality you're after. For instance, the following program will give you a WebKit-based AskUbuntu-browser.

I wrote this in Python, but you can use JavaScript as well if you like. That's the great thing about GObject Introspection, from which we're importing GTK and WebKit. It works with most languages and the code will be very similar in JavaScript. And of course, just replace http://askubuntu.com with the location of your HTML-application.


#!/usr/bin/env python
from gi.repository import Gtk, WebKit

win = Gtk.Window()
win.set_title("AskUbuntu!")
web = WebKit.WebView()
web.open("http://askubuntu.com")
scroller = Gtk.ScrolledWindow()
win.add(scroller)
scroller.add(web)
win.show_all()
win.connect("destroy", Gtk.main_quit)
Gtk.main()
1
  • Ok, but how to open/save documents on file-system using this widget?
    – iegik
    Apr 25, 2012 at 9:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .