Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

WIP: Bring docbrowser into this decade #50

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 3 additions & 72 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -62,43 +62,6 @@ fi
AC_SUBST(GNOME_SHARP_LIBS)
AM_CONDITIONAL(ENABLE_GNOME, test "x$enable_gnome" = "xyes")

AC_ARG_ENABLE(gtkhtml,
AC_HELP_STRING([--enable-gtkhtml], [Use GTKHTML Browser]),,
enable_gtkhtml=yes)

if test "x$enable_gtkhtml" = "xyes" ; then
PKG_CHECK_MODULES([GTKHTML_SHARP],
[gtkhtml-sharp-3.14],
[CSHARP_FLAGS="-d:GTKHTML_SHARP_3_14"],
[
PKG_CHECK_MODULES([GTKHTML_SHARP],
[gtkhtml-sharp-2.0],
[CSHARP_FLAGS=""],
[])
]
)
AC_SUBST(GTKHTML_SHARP_LIBS)
AC_SUBST(CSHARP_FLAGS)
fi

AM_CONDITIONAL(ENABLE_GTKHTML, test "x$enable_gtkhtml" = "xyes")

AC_ARG_ENABLE(gecko,
AC_HELP_STRING([--enable-gecko], [Use Gecko / Xulrunner-1.8 browser libs]),,
enable_gecko=yes)

if test "x$enable_gecko" = "xyes" ; then
PKG_CHECK_MODULES(GECKO_SHARP, gecko-sharp-2.0)

AC_SUBST(GECKO_SHARP_LIBS)

# get the mozilla home directory
MOZILLA_HOME="`$PKG_CONFIG --variable=libdir mozilla-gtkmozembed`"
AC_SUBST(MOZILLA_HOME)
fi

AM_CONDITIONAL(ENABLE_GECKO, test "x$enable_gecko" = "xyes")

AC_ARG_ENABLE(webkit,
AC_HELP_STRING([--enable-webkit], [Use Webkit browser]),,
enable_webkit=yes)
Expand All @@ -110,37 +73,9 @@ fi

AM_CONDITIONAL(ENABLE_WEBKIT, test "x$enable_webkit" = "xyes")

# PKG_CHECK_MODULES(MONOWEBBROWSER, mono-webbrowser, enable_monowebbrowser=yes, enable_monowebbrowser=no)
# AC_SUBST(MONOWEBBROWSER_LIBS)

AC_ARG_ENABLE(monowebbrowser,
AC_HELP_STRING([--enable-monowebbrowser], [Use Mono.Webbrowser]),,
enable_monowebbrowser=yes)

if test "x$enable_monowebbrowser" = "xyes" ; then
AC_MSG_CHECKING([for Mono.WebBrowser])
if test "x$GACUTIL" = "xno"
then
AC_MSG_RESULT([no])
if test "x$enable_monowebbrowser" = "x" ; then enable_monowebbrowser=no ; fi
else
if $GACUTIL -l Mono.WebBrowser | grep -q "Mono.WebBrowser"
then
AC_MSG_RESULT([yes])
enable_monowebbrowser=yes
MONOWEBBROWSER_LIBS=-r:Mono.WebBrowser
else
AC_MSG_RESULT([no])
enable_monowebbrowser=no
fi
fi
fi

AM_CONDITIONAL(ENABLE_MONOWEBBROWSER, test "x$enable_monowebbrowser" = "xyes")

if test "x$enable_gtkhtml$enable_gecko$enable_monowebbrowser$enable_webkit" = "xnononono" ; then
AC_MSG_ERROR([no HTML display found. You need either gtkhtml, gecko, WebKit or Mono.WebBrowser])
fi
#if test "x$enable_webkit" = "xno" ; then
# AC_MSG_ERROR([no HTML display found. You need WebKit])
#fi

AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],
Expand Down Expand Up @@ -326,11 +261,7 @@ echo "---"
echo "Configuration summary"
echo ""
echo " * Installation prefix = $prefix"
echo " * Using Gecko = $enable_gecko"
echo " * Using GtkHtml = $enable_gtkhtml"
echo " * Using Mono.WebBrowser = $enable_monowebbrowser"
echo " * Using WebKit = $enable_webkit"
echo " * Using Gnome = $enable_gnome"
echo ""
echo " NOTE: if any of the above say 'no' you may install the"
echo " corresponding development packages for them, rerun"
Expand Down
145 changes: 145 additions & 0 deletions docbrowser/AddBookmarkDialog.glade
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<!--*- mode: xml -*-->
<interface>
<requires lib="gtk+" version="3.0"/>
<object class="GtkWindow" id="add_bookmark_dialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Add Bookmark</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="window_position">center</property>
<property name="default_width">60</property>
<property name="default_height">115</property>
<property name="type_hint">dialog</property>
<signal name="delete-event" handler="on_AddBookmark_delete_event" swapped="no"/>
<child>
<placeholder/>
</child>
<child>
<object class="GtkVBox" id="vbox32">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">23</property>
<child>
<object class="GtkHBox" id="hbox36">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">2</property>
<property name="spacing">22</property>
<child>
<object class="GtkLabel" id="Label67">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="label" translatable="yes">Name:</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="name_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">*</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox37">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">2</property>
<property name="spacing">5</property>
<child>
<object class="GtkLabel" id="label68">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="label" translatable="yes">Create in:</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox38">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="spacing">199</property>
<child>
<object class="GtkButton" id="CancelButton">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_CancelButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="AddButton">
<property name="label">gtk-add</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_AddButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">4</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
49 changes: 30 additions & 19 deletions docbrowser/BookmarkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

using System;
using Gtk;
using Glade;
using System.Collections;
using System.Xml.Serialization;
using System.Xml;
Expand Down Expand Up @@ -56,17 +55,22 @@ public Bookmark (string name, string url){
public Bookmark () {}
}
internal class ManageBookmarkDialog {
[Glade.Widget] Gtk.TreeView bookmarks_treeview;
[Glade.Widget] Gtk.Window manage_bookmarks_dialog;
Gtk.TreeView bookmarks_treeview;
Gtk.Window manage_bookmarks_dialog;
BookmarkGroup root_group;
Hashtable iter_to_id;
string selected_id = string.Empty;
CellRendererText cell_render;
const string UNTITLED = "Untitled";

public ManageBookmarkDialog (BookmarkGroup bookmarks) {
Glade.XML xml = new Glade.XML ("browser.glade","manage_bookmarks_dialog");
xml.Autoconnect (this);
var ui = new Builder();
ui.AddFromFile("BookmarksManager.glade");
ui.Autoconnect (this);

manage_bookmarks_dialog = (Window) ui.GetObject ("manage_bookmarks_dialog");
bookmarks_treeview = (TreeView) ui.GetObject ("bookmarks_treeview");

iter_to_id = new Hashtable ();
root_group = bookmarks;
bookmarks_treeview.RulesHint = true;
Expand All @@ -89,7 +93,7 @@ void on_row_expanded (object sender, Gtk.RowExpandedArgs args) {
}
void on_row_selected (object sender, EventArgs args) {
Gtk.TreeIter iter;
Gtk.TreeModel model;
Gtk.ITreeModel model;

if (bookmarks_treeview.Selection.GetSelected (out model, out iter)) {
selected_id = iter_to_id[iter] as string;
Expand Down Expand Up @@ -203,32 +207,38 @@ void BuildTreeViewHelper (BookmarkGroup bookmarks, TreeIter iter, TreeStore stor
}

internal class AddBookmarkDialog {
[Glade.Widget] Gtk.Entry name_entry;
[Glade.Widget] HBox hbox37;
[Glade.Widget] Gtk.Window add_bookmark_dialog;
Gtk.Entry name_entry;
HBox hbox37;
Gtk.Window add_bookmark_dialog;

string text, url;
BookmarkGroup root;
Combo combo;
Entry combo;
Hashtable combo_to_id = new Hashtable ();

public AddBookmarkDialog (BookmarkGroup root_group)
{
Glade.XML xml = new Glade.XML ("browser.glade","add_bookmark_dialog");
xml.Autoconnect (this);
var ui = new Builder();
ui.AddFromFile("AddBookmarkDialog.glade");
ui.Autoconnect (this);

add_bookmark_dialog = (Window) ui.GetObject ("add_bookmark_dialog");
hbox37 = (HBox) ui.GetObject ("hbox37");
name_entry = (Entry) ui.GetObject ("name_entry");

combo = new Combo ();
combo = new Entry ();

ArrayList list = new ArrayList ();

BuildComboList (root_group,list);
combo.PopdownStrings = list.ToArray (typeof (string)) as string[];
combo.AllowEmpty = false;
combo.Entry.Editable = false;
combo.DisableActivate ();
// TODO: This needs to be a combo box again, but it can't be a Gtk.Combo anymore
//combo.PopdownStrings = list.ToArray (typeof (string)) as string[];
//combo.AllowEmpty = false;
//combo.Entry.Editable = false;
//combo.DisableActivate ();

// pusihing widget into hbox
hbox37.PackEnd (combo);
hbox37.PackEnd (combo, true, true, 0);

//combo.Entry.Activated += new EventHandler (on_combo_entry_activated);

Expand Down Expand Up @@ -259,7 +269,8 @@ public void on_AddBookmark_delete_event (object o, DeleteEventArgs args)

public void on_AddButton_clicked (object o, EventArgs args)
{
BookmarkManager.AddBookmark (root,combo_to_id [combo.Entry.Text] as string,name_entry.Text,url);
// BookmarkManager.AddBookmark (root,combo_to_id [combo.Entry.Text] as string,name_entry.Text,url);
BookmarkManager.AddBookmark (root,combo_to_id [combo.Text] as string,name_entry.Text,url);
add_bookmark_dialog.Hide ();
BookmarkManager.Refresh ();
}
Expand Down
Loading